php,rest,google-plusRelated issues-Collection of common programming errors
Webnet
php
I have this code and I need to make this work:if ($handle = opendir(“images/”)) { $i=0;while (false !== ($file = readdir($handle))){if ($file != “.” && $file != “..” && $file != “Recursive Dir_Renfiles_dirname-filename.php”) {$filename[$i]=$file;$i++;}}}//print_r($filename);foreach($filename as $filename){$percent = 0.5;// Content typeheader(‘Content-Type: image/jpeg’);// Get new dimensionslist($width, $height) = getimagesize($filename);$new_width = $width * $percent;$new_height
Emanuil Rusev
php function
In CakePHP there is a (quite fundamental) method called find. Most of the time this method would return an array but if you pass count as the first parameter the method would return a different data type – an integer.The method is allowed to return various data types.Isn’t that bad?
jela
php
given the following script<?phpini_set(‘display_errors’,’On’); error_reporting(E_ALL);thisisanerror?>I get the expectedNotice: Use of undefined constant error – assumed ‘error’ in /htdocs/test.php on line 8but if I add something to the script<?phpini_set(‘display_errors’,’On’); error_reporting(E_ALL);errorfunction test () {echo(‘test’);}?>I getHTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.Why am
Alan Moore
php regex
I’m working on a simple project to teach about XSS. I’m trying to make a regex that will catch <script>alert(‘anything’)</script>;I crafted: <script>alert\(\'[\w!@#$%^&*()-=+]+\’\);</script> but when i try to implement it in php I get errors yet when I try it in a regex tool it says it matches my string.Anyone know how to make a regex that works?Thanks
Mr Biscuit
php session variables if-statement phpmyadmin
I am trying to create a user login page. Upon successful registration admins are assigned a value of “A” in my database and customers a “C”. Upon successful login customers will be directed to one page and admins to another. I created three session variables, their userId, userFName and their userType. I want to create an if statement to check the value of userType and have tried everything but I still get the error message “Parse error: syntax error, unexpected T_ELSE…on line 74”.`//create a
Dominic Rodger
php variables scope
I have a function with a big hierarchy:function func(){$a= 0; // Here the variable is 0while(…){echo $a; // gives me always 0for(…){if(…){if(…){$num = func3();$a = $num; // this $a does not corrospond to $a in the beginning}}}} }Does anyone know how I can change the value of $a from the nested scopes?
skaffman
php exception-handling
When throwing a new exception is it best to simply return true if no exception needs to be thrown. Alternatively is it best to return false instead of throwing an exception. Im using php.
noloader
php sqlsrv
I have experience with mysql databases and have successfully connected to them with a couple dozen projects. Now, I’m having trouble connecting to a SQL Server 2007. This works: <?php phpinfo(); ?> and the sqlsrv and pdo_sqlsrv sections appear on this page. Here’s the code that I’m using to connect: <?php $serverName = “serverName\sqlexpress”; //serverName\instanceName $connectionInfo = array( “Database”=>”dbName”, “UID”=>”userName”, “PWD”=>”password”); $conn = sqlsrv_connect(
Chimera
php function types parameters casting
This might sound like a silly question to many of you, but it keeps me wondering why PHP does not allow typecasting in its function parameters. Many people use this method to cast into their parameters:private function dummy($id,$string){echo (int)$id.” “.(string)$string }Orprivate function dummy($id,$string){$number=(int)$id;$name=(string)$string;echo $number.” “.$name; }But looking at many other programming languages, they accept typecasting into their function parameters. But doing this in PH
Sumurai8
php apache .htaccess codeigniter error-handling
My website has been slowed down a little last couple of days. I’ve looked into my error log and found lots of these:[Mon Sep 30 00:09:53 2013] [error] [client 66.249.66.205] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use ‘LimitInternalRecursion’ to increase the limit if necessary. Use ‘LogLevel debug’ to get a backtrace. [Mon Sep 30 00:09:53 2013] [debug] core.c(3120): [client 66.249.66.205] r->uri = /home/mysitecom/domains/mysite.com/public_html/
Matt M.
rest dns
We are are going to be creating some RESTful services which are essentially going to be a passthrough to some ye-olde-fashioned SOAP-based webservices. The SOAP services are more generalized and will used across our entire organization (at least that’s the plan). The RESTful services are tailored to specific clients. This decision was already made and is unfortunately out of my control to change…We’re struggling with how to structure our RESTful resources in a way that makes sense, follows
Ashish Patha
windows json wcf rest curl
when i post a raw string as an input to JSON REST Service call it is executing ex:curl -d “{\”input1\”: \”as\”, \”input2\”: \”ad\”}” -i -X POST -H “Content-Type:application/json” http://localhost/rtygies/Service1.svc/rest/receivedata1 But when i am posting as an xml as input it is giveng error as below:curl -d “{\”input1\”: \”<xml></xml>\”, \”input2\”: \”<xml></xml>\”}” -i -X POST -H “Content-Type:application/json” http://localhost/rtygies/Service1.svc/rest/receivedat
noircc
rest jersey jackson enunciate
I have a rest-project which is using jersey+enunciate and now i wanna test the endpoints with malicious strings. The output of the programm seems to me like a JacksonParseException but with no details or stacktrace:Unexpected character (‘6’ (code 54)): was expecting comma to separate ARRAY entriesat [Source: org.apache.catalina.connector.CoyoteInputStream@28fe53cf; line: 1, column: 35]I wanna catch the exception but even declaring an default error-page won’t do the work, also the ExceptionMapper
LU RD
wcf asp.net-mvc-3 rest
I have created a ReST WCF Service in .NET 4.0. It’s hosted in IIS (.svc). The .svc file is mapped correctly in IIS 7.5. When I try to consume the WCF Service in MVC 3, I get an error :”The remote server returned an unexpected response: (405) Method Not Allowed.” I created a proxy by adding a service reference to my MVC project. Let me know if you have encountered this issue and have the solution. Please help! I already spent 2 days on it.
conny
web-services rest http-status-codes
Is it to be considered good practice to reuse RFC HTTP Status codes like this, or should we be making up new ones that map exactly to our specific error reasons?We’re designing a web service API around a couple of legacy applications. In addition to JSON/XML data structures in the Response Body, we aim to return HTTP Status Codes that make sense to web caches and developers.But how do you go about mapping different classes of errors onto appropriate HTTP Status codes? Everyone on the team agrees
Cory Kendall
http rest
I’m implementing the logic for a RESTful web server which supports searching with a SolR like syntax. Here are some common valid requests:”https://www.somewhere.com/fooResource/123″ “https://www.somewhere.com/fooResource/456” “https://www.somewhere.com/fooResource?q=title:hi” “https://www.somewhere.com/fooResource?q=title:hello&sort=foo”My question is very generic; what should I do if I receive a request like this?”https://www.somewhere.com/fooResource?q=title:hi&something=foo”I receive
Bruce
rest soap communication
We are building a proprietary system involving a client and a server linked over TCP/IP. Occasionally, the server will have some new expected or unexpected information that would be of interest to the client. My understanding is that SOAP and REST are query/response systems that require the client to request something and the server responds back. We need the client to register and the server to respond back if and when the new information is available. Are these protocols capable of such be
mdtsandman
java android rest restlet
I’ve been playing around a bit with restlet, and so far I like it :)I am having some trouble getting a restlet client to work on an android emulator, though.Right now a have a very simple restlet server running under JSE. All it does is expose a root resource (which for the moment is just a line of text) via the GET method. I can get consume the resource with a browser, and also with a simple restlet client running in the console. I have modified the code for the JSE client to try to connect
Marek Grzenkowicz
web-services rest soap soapui sugarcrm
I saw somewhere in net (like SugarCRM SOAP test call fails), that some people use SoapUI to access SugarCRM SOAP or REST web services, with urls like http://ip/sugarcrm/service/v2/soap.php and http://ip/sugarcrm/service/v2/rest.php, respectively. I tried it, with ‘New SoapUI Project’ wizard, and putting that urls in ‘Initial WSDL/WADL:”. But I only get error messages:”Error loading [http://ip/sugarcrm/service/v2/soap.php] org.apache.xmlbeans.XmlException: error: Unexpected character encountered:
katit
.net json wcf rest ierrorhandler
In WCF service I have custom IErrorHandler. Works great and I fixed lot’s of stuff by logging errors. Last error I’m getting is serialization exception:Unexpected end of file. Following elements are not closed: Source, item, root.There was an error deserializing the object of type System.Collections.Generic.List`1[[My.Web.Services.Dto.Log, My.Web.Services.Dto, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]. Unexpected end of file. Following elements are not cloThat tells me that message
auino
javascript ajax api google-chrome-extension google-plus
I’m developing a Google Chrome extension and I want to retrieve Google+ notifications count for current user, in a script running in the background. Is it possible? I studied the Google+ APIs at https://developers.google.com/+/api/ but it seems not supported yet.How is it possible to retrieve the count value anyway? I tried with a (cross-domain permitted) AJAX request, but the notification value seems generated at runtime, in JavaScript.
Amorgos
android google-plus
Here is a basic Google+ Android Sign-In button in XML:<com.google.android.gms.common.SignInButtonandroid:id=”@+id/sign_in_button”android:layout_width=”wrap_content”android:layout_height=”wrap_content” />In the class documentation it states that you can specify the size of the button as ICON_ONLY, STANDARD AND WIDE.How do you do this using xml?
Lego
google-plus hangout
I am trying to build a app using the hangout API, starter app. Does the Hangouts API have support for data fields to be added on runtime?For example,a. If we need to add team members to our app b. Or when we do ‘Create Application’ (https://appengine.google.com/) c. When we enter AppEngine app ID to Gadget URL (https://code.google.com/apis/console/?api=plusHangouts)Can we do the above using Python code and using the API (if there are any)?
Kara
android google-plus android-button
I created a custom button design to fit my apps theme for google connection.How can I make sure that when the button is pressed that it will go through the correct procedures to present the user with the account select screen/login that would be associated with the Google Sign In Button?if (v.getId() == R.id.sign_in_button && !mPlusClient.isConnected()) {if (mConnectionResult == null) {mConnectionProgressDialog.show();} else {try {mConnectionResult.startResolutionForResult(this,REQUEST_C
stivlo
java google-app-engine xmpp google-plus
I’ve noticed errors in my Google App Engine Log while parsing messages. The stack trace was unhelpful to diagnose the problem, so I wrote a small message dumper inspired by Google’s implementation of InboundMessageParser.public class ChatRequestParser extends HttpRequestParser {public static Map<String, String> parseMessage(HttpServletRequest request)throws IOException {try {Map<String, String> message = new HashMap<String, String>();MimeMultipart multipart = parseMultipartRequ
Midhun MP
iphone ios google-plus socialshare
I want to share image on google plus:I have used google+ apiAppDelegate.m[GPPSignIn sharedInstance].clientID = @”MyClientID”; [GPPDeepLink setDelegate:self]; [GPPDeepLink readDeepLinkAfterInstall];and on button actionViewController.mid<GPPShareBuilder> shareBuilder = [[GPPShare sharedInstance] shareDialog];[shareBuilder setURLToShare:[NSURL URLWithString:@”http://dummy.com”]]; [shareBuilder setTitle:@”Some title” description:@”Some description” thumbnailURL:[NSURL URLWithString:@”http://du
Eagle
android google-plus user-feedback
I’m looking for an .jar or library project that will allow users of my application to easily send feedback from inside the application about their experience.As asked in this question, I am looking for something similar to the crash reporting tool used in Google Plus, that allows the user to get in contact with me, besides leaving bad reviews.Some not-quite there solutions that came up in answers to other questions:ACRA : Application Crash Report for Android (functions as a crash reporting tool)
Nicktar
android google-plus
I have done my Google+ integration in android I am using Kit Kat version for testing everything is fine when I login to google plus its successfully login but when i want to share something. google Plus is crashed and the error is give below I don’t understand what’s the error meant12-06 17:50:14.827: I/chromium(26490): [INFO:async_pixel_transfer_manager_android.cc(56)] Async pixel transfers not supported [05:53:30 PM] Asim Habib: 12-06 17:50:14.907: E/qdutils(26490): FBIOGET_FSCREENINFO failed
Waldir Leoncio
ios google-plus
I used Google Plus API in my application for sharing content. I used these lines for showing the native share dialog in my application:id<GPPNativeShareBuilder> shareBuilder = [[GPPShare sharedInstance] nativeShareDialog];[shareBuilder setPrefillText:MY_TEXT];[shareBuilder setURLToShare:[NSURL URLWithString:MY_URL];[shareBuilder open];Dialog was shown successfully. When I touched “Public” for changing privacy, crash app immediately.I am using XCode 5 and my iphone is iOS 5.0. XCode shows l
Nam G. VU
google-plus album share
I can’t find the page where I could see all the albums other users have given me access to on my Google+ albums photo https://plus.google.com/photos
Web site is in building