Search Results

Search found 1525 results on 61 pages for 'pair'.

Page 4/61 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Key-value pair request in ASIFormDataRequest does not get response

    - by onkar
    I am sending a key-value pair inorder to get jSON response.I am trying this way. NSString *url = SAMPLE_URL; ASIFormDataRequest *request =[[[ASIFormDataRequest alloc] init] autorelease]; request=[ASIFormDataRequest requestWithURL:url]; // NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; //[request setURL:[NSURL URLWithString:url]]; [request setHTTPMethod:@"POST"]; [request setPostValue:@"admin" forKey:@"username"]; [request setPostValue:@"123456" forKey:@"password"]; Issue The code is running fine, but no-response/acknowledgement is obtained. EDIT 1 [request setHTTPMethod:@"POST"]; has been changed to [request setRequestMethod:@"POST"];

    Read the article

  • OpenGL pixels drawn with each horizontal pair swapped

    - by Tim Kane
    I'm somewhat new to OpenGL though I'm fairly sure my problem lies in the pixel format being used, or how my texture is being generated... I'm drawing a texture onto a flat 2D quad using a 16bit RGB5_A1 pixel format, though I don't make use of any alpha at this stage. The problem I'm having is that each pair of horizontal pixel values have been swapped. That is... if the pixels positions should be in this order (assume 8x2 image) 0 1 2 3 4 5 6 7 they are instead drawn as 1 0 3 2 5 4 7 6 Or, more clearly from this image (below). Left is what I get... Right is what I should get. . The question is... How have I ended up with this? Is there something wrong with the pixel format? Unlikely since the colours all appear correct, and I would expect all kinds of nasty if it were down to endian-ness. Suggestions greatly appreciated. Update: Turns out the problem was in my source renderer. Interestingly, I've avoided the problem entirely by using 32-bit textures (haven't tried 24-bit at this point).

    Read the article

  • How to model parent to child pair in MySQL (SQL)

    - by mikeschuld
    I have a data model that includes element types Stage, Actor, and Form. Logically, Stages can be assigned pairs of ( Form <--- Actor ) which can be duplicated many times (i.e. same person and same form added to the same stage at a later date/time). Right now I am modeling this with these tables: Stage Form Actor Form_Actor _______________ |Id | |FormId | --> Id in Form |ActorId | --> Id in Actor Stage_FormActor __________________ |Id | |StageId | --> Id in Stage |FormActorId | --> Id in Form_Actor I am using CodeSmith to generate the data layer for this setup and none of the templates really know how to handle this type of relationship correctly when generating classes. Ideally, the ORM would have Stage.FormActors where FormActor would be the pair Form, Actor. Is this the correct way to model these relationships. I have tried using all three Ids in one table as well Stage_Form_Actor ______________ |Id | |StageId | --> Id in Stage |FormId | --> Id in Form |ActorId | --> Id in Actor This doesn't really get generated very well either. Ideas?

    Read the article

  • php multidimensional array as name value pair

    - by Ayad Mfs
    For ecommerce, that expected name value pair I have the following approved code: function create_example_purchase() { set_credentials(); $purchase = array( 'name' => 'Digital Good Purchase Example', 'description' => 'Example Digital Good Purchase', 'amount' => '12.00', // sum of all item_amount 'items' => array( array( // First item 'item_name' => 'First item name', 'item_description' => 'a description of the 1st item', 'item_amount' => '6.00', 'item_tax' => '0.00', 'item_quantity' => 1, 'item_number' => 'XF100', ), array( // Second item 'item_name' => 'Second Item', 'item_description' => 'a description of the 2nd item', 'item_amount' => '3.00', 'item_tax' => '0.00', 'item_quantity' => 2, 'item_number' => 'XJ100', ), ) ); return new Purchase( $purchase); } I would like to get $items Array inside associative $purchase array dynamically from shipping cart. Is there a way to generate exactly the same output above? My dirty solution, to write $purchase array as string inclusive the generated $items array in a file and include it later in the called script. Help appreciated.

    Read the article

  • SQL Design Question regarding schema and if Name value pair is the best solution

    - by Aur
    I am having a small problem trying to decide on database schema for a current project. I am by no means a DBA. The application parses through a file based on user input and enters that data in the database. The number of fields that can be parsed is between 1 and 42 at the current moment. The current design of the database is entirely flat with there being 42 columns; some have repeated columns such as address1, address2, address3, etc... This says that I should normalize the data. However, data integrity is not needed at this moment and the way the data is shaped I'm looking at several joins. Not a bad thing but the data is still in a 1 to 1 relationship and I still see a lot of empty fields per row. So my concerns are that this does not allow the database or the application to be very extendable. If they want to add more fields to be parsed (which they do) than I'd need to create another table and add another foreign key to the linking table. The third option is I have a table where the fields are defined and a table for each record. So what I was thinking is to make a table that stores the value and then links to those two tables. The problem is I can picture the size of that table growing large depending on the input size. If someone gives me a file with 300,000 records than 300,000 x 40 = 12 million so I have some reservations. However I think if I get to that point than I should be happy it is being used. This option also allows for more custom displaying of information albeit a bit more work but little rework even if you add more fields. So the problem boils down to: 1. Current design is a flat file which makes extending it hard and it is not normalized. 2. Normalize the tables although no real benefits for the moment but requirements change. 3. Normalize it down into the name value pair and hope size doesn't hurt. There are a large number of inserts, updates, and selects against that table. So performance is a worry but I believe the saying is design now, performance testing later? I'm probably just missing something practical so any comments would be appreciated even if it’s a quick sanity check. Thank you for your time.

    Read the article

  • c++ Sorting a vector based on values of other vector, or what's faster?

    - by pollux
    Hi, There are a couple of other posts about sorting a vector A based on values in another vector B. Most of the other answers tell to create a struct or a class to combine the values into one object and use std::sort. Though I'm curious about the performance of such solutions as I need to optimize code which implements bubble sort to sort these two vectors. I'm thinking to use a vector<pair<int,int>> and sort that. I'm working on a blob-tracking application (image analysis) where I try to match previously tracked blobs against newly detected blobs in video frames where I check each of the frames against a couple of previously tracked frames and of course the blobs I found in previous frames. I'm doing this at 60 times per second (speed of my webcam). Any advice on optimizing this is appreciated. The code I'm trying to optimize can be shown here: http://code.google.com/p/projectknave/source/browse/trunk/knaveAddons/ofxBlobTracker/ofCvBlobTracker.cpp?spec=svn313&r=313 Thanks

    Read the article

  • Java HashSet key/value pair

    - by harley
    Why does Java not provide functions to get at the key/value pairs in a HashSet like in Hashtable? It seems like a real pain to have to iterate over it every time you need to get at something. Or am I just a newb missing something?

    Read the article

  • Calculating Nearest Match to Mean/Stddev Pair With LibSVM

    - by Chris S
    I'm new to SVMs, and I'm trying to use the Python interface to libsvm to classify a sample containing a mean and stddev. However, I'm getting nonsensical results. Is this task inappropriate for SVMs or is there an error in my use of libsvm? Below is the simple Python script I'm using to test: #!/usr/bin/env python # Simple classifier test. # Adapted from the svm_test.py file included in the standard libsvm distribution. from collections import defaultdict from svm import * # Define our sparse data formatted training and testing sets. labels = [1,2,3,4] train = [ # key: 0=mean, 1=stddev {0:2.5,1:3.5}, {0:5,1:1.2}, {0:7,1:3.3}, {0:10.3,1:0.3}, ] problem = svm_problem(labels, train) test = [ ({0:3, 1:3.11},1), ({0:7.3,1:3.1},3), ({0:7,1:3.3},3), ({0:9.8,1:0.5},4), ] # Test classifiers. kernels = [LINEAR, POLY, RBF] kname = ['linear','polynomial','rbf'] correct = defaultdict(int) for kn,kt in zip(kname,kernels): print kt param = svm_parameter(kernel_type = kt, C=10, probability = 1) model = svm_model(problem, param) for test_sample,correct_label in test: pred_label, pred_probability = model.predict_probability(test_sample) correct[kn] += pred_label == correct_label # Show results. print '-'*80 print 'Accuracy:' for kn,correct_count in correct.iteritems(): print '\t',kn, '%.6f (%i of %i)' % (correct_count/float(len(test)), correct_count, len(test)) The domain seems fairly simple. I'd expect that if it's trained to know a mean of 2.5 means label 1, then when it sees a mean of 2.4, it should return label 1 as the most likely classification. However, each kernel has an accuracy of 0%. Why is this? On a side note, is there a way to hide all the verbose training output dumped by libsvm in the terminal? I've searched libsvm's docs and code, but I can't find any way to turn this off.

    Read the article

  • Swt combobox name/key pair

    - by zachary
    I want to have the text say one thing, but have the value say another Text Key But it only takes a string for adding items. How do Java programmers typically store text/id pairs in comboboxes

    Read the article

  • grep for value of keyvaue pair and format

    - by imerez
    When I do the following ps -aef|grep "asdf" I get a list of processes that are running. Each one of my process has the following text in the output: -ProcessName=XXXX I'd like to be able to format the out put so all I get is: The following processes are running: Process A Process B etc..

    Read the article

  • Pair of blocks in each?

    - by Aleksandr Koss
    As in the standart cycle: - @goods.each do |good| ??? ...to organize this (HAML): .columns-wrapper .column First good .column Second good .column Third good .columns-wrapper .column Fourth good .column Fifth good .column Sixth good

    Read the article

  • Why does yaml.dump add quotes this key-value pair

    - by jason gagne
    I'm trying to write a new entry to a rails database.yml and for some reason I'm getting quotes around this entry db_yml = {'new_env' = {'database' = 'database_name', '<<' = '*defaults' }} File.open("#{RAILS_ROOT}/config/database.yml", "a") {|f| YAML.dump(db_yml, f)} returns --- new_env: database: database_name "<<": "*defaults" I don't know why the "---" and the quotes around the defaults are returned, any thoughts on how to prevent? thanks!

    Read the article

  • .Net friendly, local, key-value pair, replicatable datastore

    - by Brad Mathews
    I am looking for a key/value type datastore with very specific requirements. Anyone know anything that will work? Needs to be a component of some sort. No additional installation needed. The datastore needs to be on the local hard drive. I am using VB.Net for a desktop app running Windows XP through 7 so it needs to callable by that environment. It needs to replicatable. If I have four copies of my app running on the network, each local copy of the datastore needs to replicate with the others. As close to real time as possible. The first three are easy, I can do that with ADO.Net out of the box. The last one, replication, is the one I do not have answer to. Does such an animal exist? Thanks, Brad

    Read the article

  • Get street address at lat/long pair

    - by Chris Wenham
    I've seen that it's possible to get the latitude and longitude (geocoding, like in Google Maps API) from a street address, but is it possible to do the reverse and get the street address when you know what the lat/long already is? The application would be an iPhone app (and why the app already knows lat/long), so anything from a web service to an iPhone API would work.

    Read the article

  • Page.ClientScript Register a pair of javascript code

    - by blgnklc
    How can I register a javascript code a page? I want to put th javascript function to the aspx.page; I thing it might be like that; string strJS= "<script language = javascript> (function(images, elements) { var fetchImages = function() { if(images.length > 0) { var numImages = 10; while(images.length > 0 && numImages-- > 0) { // assuming your elements are <img> document.getElementById(elements.shift()).src = images.shift(); // if not you could also set the background (or backgroundImage) css property // document.getElementById(elements.shift()).style.background = "url(" + images.shift() + ")"; } setTimeout(fetchImages, 5000); } } // bind to window onload window.onload = fetchImages; // if you're going to use something like jquery then do something like this instead //$(fetchImages); }(['url1', 'url2', 'url3'], ['img1', 'img2', 'img3'])) </script>"; Page.ClientScript.RegisterClientScriptBlock(typeof(ui_SUBMVGInfo), "SmartPenCheck", strJS); The second Questin is; ... ... g(ctrlIDBirthPlaceCode).onchange(); }} </script> <script language = javascript> var url1 = 'http://localhost:3645/ImageHandler.ashx?FormId=XXX.11&FieldId=s1_Adiniz'; var url2 ='http://localhost:3645/ImageHandler.ashx?FormId=XXX.11&FieldId=s1_Soyadiniz'; var url3 = 'http://localhost:3645/ImageHandler.ashx?FormId=XXX.11&FieldId=s1_tarih'; var url4 = 'http://localhost:3645/ImageHandler.ashx?FormId=XXX.11&FieldId=s1_Adiniz'; var url5 ='http://localhost:3645/ImageHandler.ashx?FormId=XXX.11&FieldId=s1_Soyadiniz'; var url6 = 'http://localhost:3645/ImageHandler.ashx?FormId=XXX.11&FieldId=s1_tarih'; var url7 = 'http://localhost:3645/ImageHandler.ashx?FormId=XXX.11&FieldId=s1_Adiniz'; var url8 ='http://localhost:3645/ImageHandler.ashx?FormId=XXX.11&FieldId=s1_Soyadiniz'; var url9 = 'http://localhost:3645/ImageHandler.ashx?FormId=XXX.11&FieldId=s1_tarih'; var url10 = 'http://localhost:3645/ImageHandler.ashx?FormId=XXX.11&FieldId=s1_Adiniz'; var url11 ='http://localhost:3645/ImageHandler.ashx?FormId=XXX.11&FieldId=s1_Soyadiniz'; var url12 = 'http://localhost:3645/ImageHandler.ashx?FormId=XXX.11&FieldId=s1_tarih'; function(images, elements) {var fetchImages = function() {if(images.length > 0) {var numImages = 5; while(images.length > 0 && numImages-- > 0) { document.getElementById(elements.shift()).src = images.shift(); }setTimeout(fetchImages, 5000); }}window.onload = fetchImages; }(['+url1+', '+url2+', '+url3+','+url4+', '+url5+', '+url6+','+url7+', '+url8+', '+url9+','+url10+', '+url11+', '+url12+'], ['ui_taskFormControl$ctl03$ctl00$ctl03$ui_CustomerNameImage', 'ui_taskFormControl$ctl03$ctl00$ctl03$ui_CustomerSurNameImage', 'ui_taskFormControl$ctl03$ctl00$ctl03$ui_MaritalStatusImage','ui_taskFormControl$ctl03$ctl00$ctl03$ui_SexImage','ui_taskFormControl$ctl03$ctl00$ctl03$ui_BirthDateImage','ui_taskFormControl$ctl03$ctl00$ctl03$ui_BirthPlaceCodeImage','ui_taskFormControl$ctl03$ctl00$ctl03$ui_BirthPlaceImage','ui_taskFormControl$ctl03$ctl00$ctl03$ui_IdNationalityImage','ui_taskFormControl$ctl03$ctl00$ctl03$ui_MotherOldSurNameImage','ui_taskFormControl$ctl03$ctl00$ctl03$ui_TaxNoImage','ui_taskFormControl$ctl03$ctl00$ctl03$ui_CitizenshipNoImage','ui_taskFormControl$ctl03$ctl00$ctl03$ui_HomePhoneImage'])); </script> <script> var ui_BirthPlaceCode_a='Intertech.Utility'; var ui_BirthPlaceCode_c='Intertech.Utility.Common'; var ui_BirthPlaceCode_sbn=''; ... .. What do you think is it allright or how can I do that? And according to second question above; the use of the code is correct? ref:** PS: To see my purpose please continue reading below; There is a web site page which is coded on asp.net with using c# and ajax is enabled too. I want a very fast loading web page; which is going to happen with the following architecture; 1- First all data is shown by the text boxes (There are 50 text boxes, it is an application form.) 2- When the web Page is requested and loaded, then I want all the photos are shown near the each text boxes 10 by 10 from top of the page till the end of it. (Each photo is between 5 kb - 20 kb; ) I know ImageHandler's the question is how can I put all these idea into real life? some examples and ideas will be great ! thanks This issue has been answered and you may have a look - here Regards Bk

    Read the article

  • iPhone expired dev certs - public/private key pair issue

    - by KevinDTimm
    My dev 'license' expired last week, and with it my dev certs. I re-upped my license, but my keys are still expired. I tried to create a new signing certificate via keychain, etc. but it seems my private key is not enough, it needs my public key to do so. I understand that the public key is stored in the provisioning certificate. The question is, can I retrieve the public key from there? (And if so, how?)

    Read the article

  • Create a CSR in C# using an explicit RSA key-pair

    - by rlandster
    Using the OpenSSL libraries one can create a CSR (certificate signing request) by doing this: openssl genrsa -out rsa.key 1024 openssl req -new -key rsa.key -out output.csr -config config.txt where config.txt contains the distinguished name to use in the certificate. I would like to do something similar under Windows using C#. However, the method createPKCS10 does not require you to supply an RSA key. Is there a way to get C# to generate an explicit RSA private key and then use that private key to create the CSR?

    Read the article

  • How to pair users? (Like Omegle.com)

    - by Carlos Dubus
    Hi, I'm trying to do an Omegle.com clone script, basically for learning purposes. I'm doing it in PHP/MySQL/AJAX. I'm having problems finding two users and connecting them. The purpose of omegle is connecting two users "randomly". What I'm doing right now is the following: When a user enters the website a session is assigned. There are 3 states for each session/user (Normal,Waiting,Chatting) At first the user has state Normal and a field "connected_to" = NULL If the users clicks the START button, a state of "Waiting" is assigned. Then it looks for another user with state Waiting, if doesn't find one then it keeps looping, waiting for the "connected_to" to change. The "connected_to" will change when other user click START and then find another user waiting and updates the sessions accordingly. Now this have several problems, like: A user only can be connected to one user at a time. In omegle you can open more than one chat simultaneously. I don't know if this is the best way. About the chat, each user is polling the events from the server with AJAX calls, I saw that omegle, instead of several HTTP requests each second (let's say), does ONE request and wait for an answer, that means that the PHP script is looping indefinitely until gets an answer.I did this using set_time_limit(30) each time the loop is started. Then when the Ajax call is done start over again. Is this approach correct? I will appreciate a LOT your answers, Thank you, Carlos

    Read the article

  • php - get content from second pair of quotes in string

    - by Aaron Turecki
    I'm trying to get the contents of the second quotes and only the second quotes from a string. Right now I'm able to get the contents of all three quotes. What am I doing wrong? Is it possible to just print the second value in the output array? Text 2014-06-02 11:48:41.519 -0700 Information 94 NICOLE Client "[WebDirect] (207.230.229.204) [207.230.229.204]" opening database "FMServer_Sample" as "Admin". PHP if (preg_match_all('~(["\'])([^"\']+)\1~', $line, $matches)) $database_names = $matches[2]; print_r($database); Output [WebDirect] (207.230.229.204) [207.230.229.204], FMServer_Sample, Admin

    Read the article

  • typeset problem/solution pair (example) in latex

    - by FurtiveFelon
    Hey guys, I'd like to know if there is a way in latex to show the following: Example 1: problem statement here Solution: solution here and wrap that in a box so that it will be noticeable. Seems like a common enough problem that there should be ready made solutions If there are any suggestions it would be much appreciated!

    Read the article

  • MySQL query against pseudo-key-value pair data in WordPress custom query

    - by andrevr
    I'm writing a custom WordPress query to use some of the data which the Woothemes Diarise theme creates. Diarise is an event planner theme with calendar blah, blah... and uses custom fields to store the event start and end dates in WP custom fields in the *wp_postmeta* table, which implements a key-value store. So for each post in the "event" category, there are 2 records in *wp_postmeta*, named *event_start_date* and *event_end_date* that I'm interested in. The task is to compare a tourist's arrival and departure dates with the start and end dates of events, yielding a what's on list of events available. We thought we'd killed it with a grand flash of logic, that goes like this: Disregard any event that ends before the tourist arrives, and any that begin after the departure date. I wrote this query: SELECT wposts.* FROM wp_posts wposts LEFT JOIN wp_postmeta wpostmeta ON wposts.ID = wpostmeta.post_id LEFT JOIN wp_term_relationships ON (wposts.ID = wp_term_relationships.object_id) LEFT JOIN wp_term_taxonomy ON (wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id) WHERE wp_term_taxonomy.taxonomy = 'category' AND wp_term_taxonomy.term_id IN(3,4) AND ( wpostmeta.meta_key = 'event_start_date' AND NOT ( concat(subst(wpostmeta.meta_value,7,4),'-',subst(wpostmeta.meta_value,4,2),'-',subst(wpostmeta.meta_value,1,2) > '2010-07-31' ) ) AND ( wpostmeta.meta_key = 'event_end_date' AND NOT ( concat(subst(wpostmeta.meta_value,7,4),'-',subst(wpostmeta.meta_value,4,2),'-',subst(wpostmeta.meta_value,1,2) < '2010-05-01' ) ) ) ORDER BY wpostmeta.meta_value ASC And, of course it returns no records. The problem I believe is in the dual reference to wpostmeta.meta_key, but how to get around that?

    Read the article

  • Pulling name value pair from a structured adsense code block contained in a txt file

    - by Scott B
    I have a txt file which contains a google adsense code block and I'm trying to pull in the file via file_get_contents to extract the values of the google_ad_client and google_ad_slot variables. In the examples below, I want to return to my calling function: $google_ad_client = 'pub-1234567890987654'; $google_ad_slot = '1234567890' The file may contain one of either of these two formats and I wont know which the user has chosen: Newer Ad Unit Style <script type="text/javascript"><!-- google_ad_client = "pub-1234567890987654"; google_ad_slot = "1234567890"; google_ad_width = 336; google_ad_height = 280; //--> </script> <script type="text/javascript" src="path-to-google-script"></script> Classic Style <script type="text/javascript"><!-- google_ad_client = "pub-1234567890987654"; /* 336x280, created 8/6/09 */ google_ad_slot = "1234567890"; google_ad_width = 336; google_ad_height = 280; google_ad_format="336x280_as"; google_ad_type="text_image"; google_color_border="FFFFFF"; google_color_bg="FFFFFF"; google_color_link="2200CC"; google_color_url="000000"; google_color_text="777777"; //--> </script>

    Read the article

  • MVC for a desktop application, connection a view/controller pair with another one

    - by lcf
    Hello. I've had mostly experience with "server-side" mvc frameworks very popular in different languages like ASP.NET MVC or Zend Framework for php, Spring for Java etc. Some of them are also possible to use for desktop applications development but I never tried that. I fully understand that design patterns should not limit implementation, they should generally provide ideas and common rules that can be differently implemented. Now I'm playing with one of those mvc frameworks for usual Desktop Applications development (it does not have many tutorials or a decent quickstart) and I have some questions regarding to the mvc paradigm. Here is one of them: What are common ways to link different views / controllers? If I click a button, special controller for that button dispatches the event that is generated, does something with the model, changes view state. But what if I need to interact with another view? Like, when I click on a button, it changes a model, but also I need to open another window or change state of another window (hiding a button on another window let's say...), without changing actually the model. What are common ways here to address this? Should my first controller generate an event for the second controller (or second view)? Or should the second controller be handling events from first view? Some links or examples for any languages/frameworks would be really helpful, thanks!

    Read the article

  • Sorting a value pair in Javascript

    - by Bradley M. Davis
    I must be missing the proper term or else I'm sure I could find the answer by searching... in any case, here's what I want to do. Through javascript, I get four variables (A, B, C, and D) that I would like to sort, and still keep track of the variable name (since it's encoded with meaning information). Sample Data: A = 2; B = 1; C = 4; D = 3; What I need to do now is sort them in value order (4,3,2,1) such that I can actually know the variable name ordering (C,D,A,B).

    Read the article

  • Pair attribute naming in custom configSections

    - by fearofawhackplanet
    I'm trying to store a user list in a config file. I've been looking at DictionarySectionHandler and NameValueSectionHandler. I'm not too sure what the difference between these two is, but anyway, neither of them do exactly what I'd like. You can add a custom config section like so: <configSections> <section name="userAges" type="System.Configuration.DictionarySectionHandler"/> </configSections> <userAges> <add key="userName1" value="10" /> <add key="userName2" value="52" /> <userAges> Which is ok, but actually I'd prefer to be able to write: ... <userAges> <add user="userName1" age="10" /> <add user="userName2" age="52" /> <userAges> Which I feel would make the config file clearer to anyone who needed to add/remove users in future. Is there an easy way to do this?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >