php,ios,httpRelated issues-Collection of common programming errors


  • user3367639
    php codeigniter
    So, I am making a from select with the code below: // Controller Code $data[‘message_to_options’] = array(‘1’ => ‘username 1′,’2’ => ‘username 2’, );// View Code <?php echo form_dropdown(‘message_to’, $message_to_options); ?>This all works great. Except the users needs to be dynamically created not hard coded. I have the following code from ion_auth for code igniter. This gets all the users in the system. Which Is what I want to do. $users = $this->ion_auth->users()->resul

  • Ed Cottrell
    php mysql database
    Here is my database connection code, whenever i sign up in form it always says “syntax error, unexpected T_STRING in”<?php//Database Connection Settingsmysql_connect(“localhost”, “root”, “”);mysql_select_db(“project mix”);global $connection;$connection = @mysql_connect(“”) or die(‘Connection could not be made to the SQL Server. Please report this system error at <font color=”blue”>[email protected]</font>’);@mysql_select_db(project mix,$connection) or die(‘Connec

  • Timothy Carter
    php javascript jsp splash-screen
    I want to know how to show a splash screen (like a gif or jpeg file) on the user screen during my script execution.Thank you for your help.

  • mikeTheLiar
    php try-catch composer-php
    I am trying to install Composer (http://getcomposer.org/download/) on a GoDaddy-hosted Linux server but it’s not working. No matter which method I try, I eventually run up against some version of the following error:Parse error: syntax error, unexpected ‘{‘ on line 290.Line 290 refers to line 290 in this file: https://getcomposer.org/installer which is the start of a try-catch block. And, indeed, even a simple script like:echo ‘<?php echo “Hello World “; try {echo “Goodbye”;} catch (Except

  • Pieter
    php strpos
    This is my code:<?php $url = “http://www.uhasselt.be/collegeroosters/2009_2010_298_5_10.html”; $headers = get_headers($url, 1); print_r($headers); $contloc = $headers[“Content-Location”]; echo “Content-Location: ” . $contloc . “\n”; $soft404test = strpos($contloc, “http://www.uhasselt.be/404b.htm”) ? true : false; var_dump($soft404test); ?>This is its output:Array ([0] => HTTP/1.1 200 OK[Content-Length] => 2030[Content-Type] => text/html[Content-Location] => http://www.uhasselt

  • Guillermo Phillips
    php oracle blobs
    I am attempting to transfer a set of photos (blobs) from one table to another across databases. I’m nearly there, except for binding the photo parameter. I have the following code:$conn_db1 = oci_pconnect(‘username’, ‘password’, ‘db1’); $conn_db2 = oci_pconnect(‘username’, ‘password’, ‘db2’);$parse_db1_select = oci_parse($conn_db1, “SELECTREF PID,BINARY_OBJECT PHOTOGRAPH FROMBLOBS”);$parse_db2_insert = oci_parse($conn_db2, “INSERT INTOPHOTOGRAPHS(PID,PHOTOGRAPH) VALUES(:pid,:photo)”); oci_e

  • Tianyu
    php c gcc llvm llvm-gcc
    I tried to generate LLVM intermediate code by callingllvm-gcc -emit-llvm -I/mypath/ -c main.c -o main.oIt works perfectly without any warnings or errors if I manually type this command in the terminal. However I have built a website that can automate this process by calling exec function in PHP like below.exec(“llvm-gcc -emit-llvm -I/mypath/ -c main.c -o main.o”,$msg,$ret);It will still generate .o file with a warning. The warning says that Potential incompatible plugin version. GCC: 4.5.3. Expe

  • John Conde
    javascript php jquery ajax
    I’m simply trying to read in a field from a text box, pass the value via ajax to PHP and then store the data in a mysql table. The table is already set up and ready to go, all I need is to insert values. Here is my js file var address = $(“input#email”).val(); //If submission is valid if(submitForm == “true”){$.ajax({ url: “bin/process.php”, type: “POST”, data: {email: address}, success: function(response) { $(‘#message’).html(response); }}); return false; }And then my PHP looks like this

  • user2718671
    php wordpress
    Is it possible to create sub menu pages depending on the options? In my plugin option page I got an input field for titles (of the submenu pages). These titles are separated by commas. I tried following in my plugin script:function my_menu() {global $page_hook_suffix;$page_hook_suffix = add_menu_page(…); //adding main menu$titles=get_option(‘my_option_name’);$titles=explode(“,”,$titles);if(!empty(get_option(‘my_option_name’))){foreach($titles as $title){ $slug = str_replace(‘ ‘, ‘_’, $titl

  • FoolishSeth
    php forms html-select
    I am trying to save what state a user select after ‘POST’ the form action runs on the same page, but I keep getting unexpected T_IS_EQUAL, expecting ‘}’ error. What am I missing? I have the following code:<select style=’width:50px; float:left; position:relative; left:-160px; top:2px; border-radius:3px; ‘ project=’statelist’ class=’statelist’ name=’statelist’>$state = array( ‘AZ’,’AL’,’AK’,’AR’, ‘CA’,’CO’, ‘CT’,’DE’,’DC’,’FL’, ‘GA’, ‘HI’,’ID’,’IL’, ‘IN’,’IA’,’KS’,’KY’,’LA’,’ME’,’MT’,’NV’,’

  • anonymous
    iphone objective-c ios xcode
    I have uiscrollview with some buttons in it. I want to make one particular button to glow.I made glowing-pulsating effect of button with following code:(button in UIView)- (IBAction)selectChampionAction:(id)sender{if ( self.timer ) {// Stop timer[self.timer invalidate];self.timer = nil;// Workaround: we have to return the layer’s delegate property to what it was// Otherwise, we will encounter an unexpected resultself.viewForGlowing.layer.delegate = self.viewForGlowing;} else {// Woraround: UIVie

  • gling
    ios restkit-0.20
    i m new with restkit and i have an issue with that. I have a restservice for check in. So i m calling my restservice with a “Put”-request. Looks like that Put: http: … /api/v1/locations/location/[Location-ID]/checkin?userId=[User-ID]. The response is a , so i called it checkin-object. After the check in i m calling another service (Get-Request). But the new mapping-result of the get-request includes previous checkin-object. How do i reset/erase it?[self.restHelper checkinUser:[NSNumber numberW

  • Kyle Decot
    ios objective-c sprite-kit game-physics
    I am having a problem when trying to put two blocks that have physics bodies on top of one another.http://s1173.photobucket.com/user/Kyle_Decot/media/example_zps02f027fe.mp4.htmlAs you can see in the video I am able to place my block on top of the stacked blocks even though they are placed right on top of one another.Both the player block and the other blocks inherit from a base Block class which looks like this#import “Block.h”@implementation Block+ (void)loadSharedAssets {}- (id)initWithColor:

  • Robert
    ios image-processing gpuimage
    I have tried to setup a simple GPUImage environment in a UIViewControler. However, I get a blank screen. I want to animate a property of the swirl filter whilst the source image is kept constant. How can I do this?I want good performance (> 30 fps) for large-ish images so would ideally like to avoid unnecessary pixel copies back and forth from GPU to CPU.- (void)viewDidLoad {UIImage *inputImage = [UIImage imageNamed:@”image.jpg”];self.stillImageSource = [[GPUImagePicture alloc] initWithImage:

  • OpenThread
    iphone ios uitableview
    I need to get notified when an UITableView’s drag has come to an end.But I’m working on an UITableView’s category, so I can’t use scrollViewDidEndDragging:willDecelerate: to archive this.I tried use KVO to observe on dragging Key Path:[self addObserver:self forKeyPath:@”dragging” options:NSKeyValueObservingOptionNew context:nil];But observeValueForKeyPath:ofObject:change:context: didn’t get called, since UITableView.dragging doesn’t have and setter and this property is not compliant with KVO.Is

  • mightee.cactus
    ios objective-c uitableview pstcollectionview
    In the app I develop I have a bunch of tiles (PSTCollectionView) on the screen. When user clicks on one cell he gets moved to another controller by calling segue programmatically. To avoid clicking cell several times at a time I add transparent overlay right after cell click that should prevent clicking at any collection tile.Everything seemed to go well until I run it on iPad 1: in some cases device hangs a bit and overlay appears a bit late which leads to the situation that allows user to clic

  • Aaron Brager
    ios objective-c core-animation calayer quartz-graphics
    On iOS, I am adding a CALayer to a UITableViewCell’s layer. This is my first time using CALayer, and it is simply supposed to change the background color of the table cell. My goal is (1) to learn how to use CALayer, and (2) to test using Instruments whether the drawing is faster than my current implementation, which slows down on CGContextFillRect.(Technical Q&A QA1708 was the catalyst for all this.)Current Implementation (works)- (void)drawRect:(CGRect)r {UIColor *myColor = [self someCol

  • Brian Douglas Moakley
    ios apple human-interface
    I’m currently developing an app for a client which makes use of a tabbar, but I’m concerned I may be violating the human interface guidelines. My app starts with a home viewcontroller which leads to several other viewcontrollers. One of the viewcontrollers has a tabbar. The very first item on the tab bar is a home button. Clicking the button will send the user back to the home viewcontroller. The home view controller does not have a tabbar. The question of the hour … is this a violation

  • Hunter
    iphone ios core-data nsmanagedobjectcontext
    I’ve got an app design question that I’m hoping someone can help with.Let’s take a very simple setup: Core Data app for displaying news items from a server.Main thread / UI has a managed object context that’s used by all the view controllers to display the data. An NSOperation runs in the background checking the server, with it’s own context, on the same persistent store.I want to merge the changes in the background context so I use NSManagedObjectContextObjectsDidChangeNotification.According to

  • Undo
    ios json parsing textview
    I am making an iOS application which communicate with an database via an API. The API sends valid JSON to the application but the application gives no error but another result: NULL. Here is my code for the iOS app:// Start hudMBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];hud.labelText = @”Zoeken…”;return TRUE;}- (void)requestFinished:(ASIHTTPRequest *)request{ [MBProgressHUD hideHUDForView:self.view animated:YES]; if (request.responseStatusCode == 400) {textVie

  • crockpotveggies
    java http scala gzip
    Because Scala Dispatch 0.9.5 doesn’t seem to have a default handler for decompressing GZIP streams, I’m attempting to modify it’s as.stream.Lines handler for incoming data. Since the same project is also using Spray.io, I attempted to use it’s GzipDecompressor on the HttpResponseBodyPart bytes, but it threw an exception. See below:def onBodyPartReceived(bodyPart: HttpResponseBodyPart) = {if (state == CONTINUE) {val decomp = new GzipDecompressorval bytes = decomp.decompress( bodyPart.getBodyPartB

  • user502052
    ruby-on-rails ruby http ruby-on-rails-3 httpwebrequest
    I am using Ruby on Rails 3 and I would like to set header and params values for a HTTP GET request of a client server. Then, on the other side, I would like to read those on the service server.What I do in the client is:host = “http://<site_name>.com” path = “/users/1.json” query_params = [“username=test_username”, “password=test_psw”].join(“&”)uri = URI.parse(“#{host}#{path}?#{query_params}”)http = Net::HTTP.new(uri.host, uri.port)http.start do@response_test = JSON(http.get(“#{host}#{

  • Mathilde
    http get angularjs itunes
    I’m just trying to do a basic call on the itunes search api using angularjs http.$http.jsonp(“http://itunes.apple.com/search”, {params:{“term”:”jack+johnson”}}).success(function (data, status, headers, config) {console.log(“is scope : ” + data);}).error(function (data, status, headers, config) {console.log(“error” + status);});The requests is well done (status:200) and I can see that the json is retrieved, this is an extract :{“resultCount”:50,”results”: [ {“wrapperType”:”track”, “kind”:”song”,

  • user1964161
    http protocols
    How do I handle a server error in the middle of an Http message?Assuming I already sent the header of the message and I am streaming the the body of the message, what do I do when I encounter an unexpected error.I am also assuming this error was caused while generating the content and not a connection error.(Greatly) Simplified Code: // I can define any transfer encoding or header fields i need to. send(header); // Sends the header to the Http client.// Using an iterable instead of stream for

  • Amy Palamountain
    javascript jquery http backbone.js get
    Backbone.js has a neat feature where you are able to sync changes back to your sever using standard HTTP verbs. For example you may have a model object and some code which executes a get:var coolModel = Backbone.Model.extend({url:’mysite/mymodel’}); var myCoolModel = new coolModel(); myCoolModel.fetch({error:processError});Under the case where the server returns a 4XX or 5XX the error function ‘processError’ is run, which is great, you are able to process the error in which ever way suits.As bac

  • Lucifer
    http networking blackberry
    I am using Httconnection for connecting to webserver , somtimes request fails causing EOFException when calling httpconnection.getResponseCode().I am setting the following headers while making the connectionHttpConnection httpconnection = (HttpConnection) Connector.open(url.concat(“;interface=wifi”)); httpconnection.setRequestProperty(“User-Agent”,”Profile/MIDP-2.0 Configuration/CLDC-1.0″); httpconnection.setRequestProperty(“Content-Language”, “en-US”);I am closing all the connections after proc

  • B Seven
    ruby http rspec tdd bdd
    Yes, I know it is best to use webmock, but I would like to know how to mock this method in RSpec:def method_to_testurl = URI.parse urireq = Net::HTTP::Post.new url.pathres = Net::HTTP.start(url.host, url.port) do |http|http.request req, foo: 1endres endHere is the RSpec:let( :uri ) { ‘http://example.com’ }specify ‘HTTP call’ dohttp = mock :httpNet::HTTP.stub!(:start).and_yield httphttp.should_receive(:request).with(Net::HTTP::Post.new(uri), foo: 1).and_return 202method_to_test.should == 202 endT

  • David-SkyMesh
    perl http asynchronous anyevent worker-pool
    I’m trying to write a script which will download at most N files simultaneously via HTTP. I’ve previously used AnyEvent::Worker::Pool to manage a pool of BLOCKING tasks. I’ve also used AnyEvent::HTTP in combination with AnyEvent->condvar to manage NON-BLOCKING downloads individually. I thought that it should be pretty simple to combine the two approaches so that AnyEvent->condvar makes AnyEvent::HTTP::http_get look BLOCKING from the perspective of AnyEvent::Worker::Pool.However, I’m getting some

  • user1618143
    html http firefox https youtube
    I’m working on a site that requires a login and includes embedded Youtube videos. Because of the login, I need to get SSL working, which it largely is. I’m hitting an unexpected problem with the Youtube embeds, though. It’s easy enough to point at https://www.youtube.com, but Firefox still complains that there’s unencrypted content on an encrypted page. According to Firebug, the only unencrypted load was from http://[stuff].youtube.com/videoplayback?[more stuff].Now, it’s perfectly understandabl

  • Kai Sellgren
    http nginx websocket
    I’m trying to proxy WebSocket + HTTP traffic with nginx.I have read this: http://nginx.org/en/docs/http/websocket.htmlMy config looks like:http {include mime.types;default_type application/octet-stream;sendfile on;keepalive_timeout 65;gzip on;map $http_upgrade $connection_upgrade {default upgrade;” close;}server {listen 80;server_name ourapp.com;location / {proxy_pass http://127.0.0.1:100;proxy_http_version 1.1;proxy_redirect off;proxy_set_header Host $host;pr

Web site is in building