w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Is a Parse query fetching an Object multiple times when referenced by multiple rows?
The include is implemented as a separate query which gets all the objects pointed to by the initial query. So the answer is no, this object is not fetched again by each row that points to it, since all the included objects are fetched at once in a separate query.

Categories : Parse Com

Parse c++ string using multiple threads
std::string::getline is not thread-safe, you cannot use getline() from different threads. You either need to access a known position in the raw string-data in memory using strncopy (c-style) strncopy(matrix_str.c_str(), temp, 4000); or using the substring-function (C++-style) std::string piece = matrix_str.substr(i,4000) EDIT: If your matrix_str is not a std::string but a std::sstream object, this will not work as a stream has to be accessed in order. Your question is a bit vague on that part...

Categories : C++

Parse multiple JSON in Objective C
You should be able to use the dot notation JSON { "author": { "name" : "mckeejm" } } Objective C: blogPost.author = [bpDictionary valueForKeyPath:@"author.name"]; updated Thanks @Martin

Categories : Objective C

How to get and parse SOAPElement for multiple tags
After a lot R&D I could be able to solve the above problem. When I wrote following code <xs:complexType name="MyInputs"> <xs:sequence> <xs:element name="MyResponse" type="xs:anyType"/> </xs:sequence> </xs:complexType> and generated Java bean skeleton from RAD IDE, created Object type parameter and return in getter and setter of generated bean instead of SOAPElement. This has solved my problem. Thanks :)

Categories : Web Services

iOS - Parse multiple XML files for each tableView row
The pattern here is just like lazy loading images. 1) Create a custom object like TrainStation, it should have an NSString station code, some BOOL property of function that tells callers that it's been initialized from the web service, and an init method that provides a block completion handler. // TrainStation.h @interface TrainStation : NSObject @property (strong, nonatomic) NSString *stationCode; // your two character codes @property (strong, nonatomic) id stationInfo; // stuff you get from the web service @property (strong, nonatomic) BOOL hasBeenUpdated; @property (copy, nonatomic) void (^completion)(BOOL); - (void)updateWithCompletion:(void (^)(BOOL))completion; @end 2) The completion handler starts an NSURLConnection, saving the completion block for later when the parse is d

Categories : Iphone

how to parse multiple json objects with no name
JSONObject jObject = null; mJsonString = downloadFileFromInternet(urlString); jObject = new JSONObject(mJsonString); This will get you json object. This is the way to get json array from json object: JSONArray jsonImageArray = jObject.getJSONArray("your string");

Categories : Java

How to parse multiple json in objective-c?
With the new syntax it should be easier to gets keys in a nested dictionaries. You can know the full keys/indexes path by just drawing a tree, remember that a dictionary starts with braces, and an array starts with brackets. For example let's retrieve the "thumbnail" and "url" value for the first entry in the children array: NSDictionary *json = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error]; if(!json) { // Always handle eventual errors: NSLog(@"%@",error); return; } NSString* thumbnail= json[@"data"][@"children"][0][@"data"][@"thumbnail"]; NSString* url= json[@"data"][@"children"][0][@"data"][@"url"];

Categories : Objective C

Parse multiple arrays in subroutine
You don't have to use references, pass your list as it is and iterate over every second element as greeting and name are set in pairs. use strict; use warnings; sub test { my @arg = @_; my $returnString = ""; foreach my $i (grep { ! ($_%2) } 0 .. $#arg) { my ($greeting, $name) = @arg[$i, $i+1]; $returnString .= "$greeting, $name! "; } return $returnString; } print test("Hi", "Tim", "Hello", "Tom", "Bye", "Chris");

Categories : Perl

LuaXML parse the XML with multiple tags with the same name
After calling xml.load you get back a table that represents the xml file just loaded. You can get to a specific node by accessing its corresponding numerical index in the table: require 'luaxml' local level = xml.load('level.xml') -- level[1] == <bg>details1</bg> -- level[2] == <bg>details2</bg> for i = 1, #level do print(level[i]) end Edit: From your edited question, here's one way to pull the data out of the xml file: require 'luaxml' local xmlroot = xml.load('your.xml') local b = xmlroot:find 'b' for level = 1, #b do print(b[level][1][1]) end If you have control over the xml format you can modify it somewhat to make the parse more readable: <a> <b> <level bg="details1"> </level> <level bg="details2"> </le

Categories : Xml

Parse datetime in multiple formats
If the possible formats are fixed then you can use TryParseExact A possible solution is to use TryParse, if it fails to get proper date then fallback to known formats and use TryPraseExact

Categories : C#

Multiple objects in PFQueryTableViewController - Parse.com
Just add more @propertys to your view controller. Make sure to add the necessary ones (className2, textKey2, etc) and to modify the datasource methods of your table view to display the data. That being said, it seems strange the the view controller is initiated with initWithCoder. That is usually the method invoked by storyboard for views.

Categories : Iphone

Php parse xml (multiple nested <> ). With one nested <> works, - multiple does not work
The reason is because you are accessing the $currencies like its the root element. You could load the file and reference currencies with $xmlDoc->currencies and it should work. Please try the following: $xmlDoc = simplexml_load_file('__joomla.xml'); /**/ $cdate=$xmlDoc->Date; echo "<time>". $cdate. "</time><br>"; foreach ($xmlDoc->Currencies->Currency as $currency): $id=$currency->ID; $units=$currency->Units; $rate=$currency->Rate; echo " <div class='id'>". $id. "</div> <div class='units'>". $units. "</div> <div class='rate'>". $rate. "</div> "; endforeach; Update: Updated $xmlDoc->Currencies to $xmlDoc->Currencies->Currency, as we want to loop through the Currencies' children.

Categories : PHP

How to Parse a String with Multiple Decimal Points
The the string you're trying to parse looks like a verson, so try using the Version class. var prevVersion = Version.Parse("10.0.20"); var currentVersion = Version.Parse("10.0.30"); var result = prevVersion < currentVersion; Console.WriteLine(result); // true

Categories : C#

How to I parse multiple items using jQuery and Ajax?
Try $(this).find('author').each(function(){ var author = $(this).text(); $('<a href="#"></a>').html(author).appendTo('#link_'+id+' div.itemauthor'); }); since you want to iterate the author tags regardless of the authors tag. Also use the current link div id to append it to only that one. $(this).find('author').each(function(){ var name = $(this).find('name').text(); var link = $(this).find('link').text(); $('<a href="'+link+'"></a>').html(name).appendTo('#link_'+id+' div.itemauthor'); });

Categories : Jquery

Get jQuery to parse through multiple XML nodes but output as one
Yes, I can create lang, lat and the rest of the xml: <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>jQuery UI Autocomplete - XML data parsed once</title> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <link rel="stylesheet" href="/resources/demos/style.css" /> <style> .ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; } </style> <script> $(function() { function log( message ) { $( "<div/>" ).text( mes

Categories : Jquery

Python: Parse multiple datatypes using argparse
import ast dict_parser.add_argument('--dict', nargs='*',type=ast.literal_eval,default={}) args = dict_parser.parse_args(["--dict", "{'name':'man', 'address': 'kac', 'tags':'don'}"])

Categories : Python

Using BeautifulSoup to parse multiple paragraphs in Python
In <p><b>Innovation</b><br />x2</p><p>x3</p><p>x4</p> you are going to the <b> element and locating x2 thought next_element. That's all good. But to locate x3 and x4 you need first to go up in the element hierarchy to the enclosing <p> element and from there locate the following <p>s enclosing x3 and x4.

Categories : Python

Android - Unable to parse multiple urls in xml
Your parsing code assumes that the urls come in as character data like the title. They aren't given that way in your xml, but as additional attributes on the <link> tag. So you need to parse the href attribute in your startElement method: @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { obj = new StringBuilder(); if ("entry".equals(qName)) { currentItem = new RssItem(); } else if ("title".equals(qName)) { parsingTitle = true; } else if ("summary".equals(qName)) { parsingDescription = true; } else if ("link".equals(qName)) { String LinkType = attributes.getValue("rel"); String url = attributes.getValue("href"); if

Categories : Android

Handling Login on Multiple Devices using Parse iOS
You can generate a unique identifier for each installation of your game (just a UUID stored in user defaults). Each time a use logs in, update the identifier into your user information stored on the server. When you upload any edit to the server you can send the identifier and check it with cloud code (or check the identifier first) to decide if the login is still valid. How you check depends on what you want to do if you find the login to be invalid. The more efficient route is to use cloud code and send back an error response that the app handles to alert the user and action the logout.

Categories : IOS

How can I parse an attribute directive which has multiple values?
You can try this: app.directive('animals', function(userService) { return { restrict: 'A', link: function (scope, element, attrs) { var animals = attrs.animals.split(' '); if (userService.likesAllAnimals(animals)) element.css('display', 'block'); else element.css('display', 'none'); } }; }); Plunker here. You can do this as well: app.directive('animals', function(userService, $parse) { return { restrict: 'A', link: function (scope, element, attrs) { var animals = $parse(attrs.animals)(scope); if (userService.likesAllAnimals(animals)) element.css('display', 'block'); else element.css('display', 'none'); } }; }); And now you can pass an actual array to the directive: <div animals=

Categories : Javascript

Rails - Upload and parse multiple CSV files
Well, as far as I see. This behavior shouldn't actually be happening. I would suggest another way of doing this code, since it's looking a bit polluted. def import (1..x).each do |i| #with x being the max number of files uploaded at the same time RatingSet.multi_uploader(params["file_#{i}".to_sym]) end redirect_to "/multi_uploader", :flash => { :notice => "Successfully Uploaded." } end Either way, this shouldn't solve your problem. I can't tell why this is happening to be honest. UPDATE: Have you considered using: <%= f.file_field :file, :multiple => true %> instead of mutiple file_tags?

Categories : Ruby On Rails

Parse CSV file with and aggregate values, multiple columns
Here is one way using itertools.groupby. import StringIO import csv import itertools data = """CITY,AMOUNT,AMOUNT2,AMOUNTn London,20,21,22 Tokyo,45,46,47 London,55,56,57 New York,25,26,27""" # I use StringIO to create a file like object for demo purposes f = StringIO.StringIO(data) fieldnames = f.readline().strip().split(',') key = lambda x: x[0] # the first column will be a grouping key # rows must be sorted by city before passing to itertools.groupby rows_sorted = sorted(csv.reader(f), key=key) outfile = StringIO.StringIO('') writer = csv.DictWriter(outfile, fieldnames=fieldnames, lineterminator=' ') writer.writeheader() for city, rows in itertools.groupby(rows_sorted, key=key): # remove city column for aggregation, convert to ints rows = [[int(x) for x in row[1:]] for row in

Categories : Python

Simple way to get multiple related objects in Parse.com with Javascript?
I finally sorted this out, though there is a caveat that makes this work differently than the documentation would indicate. //Assuming we have 'player', an object of Class 'Player'. var r = player.relation("trophies"); r.query().find({ success: function(trophies){ response.success(trophies); //list of trophies pointed to by that player's "trophies" column. }, error: function(error){ response.error(error); } }) The caveat: You must have a 'full' player object in memory for this to work. You can't save a player object, grab the object from the success callback and have this work. Some reason, the object that is returned in the success handler is appears to be an incomplete Parse.Object, and is missing some of the methods required to do this. Another stumbling block abou

Categories : Javascript

How to use Python re to parse this string in to list of multiple key value pairs?
Something like this, using re.findall: >>> str1 = 'abc(1),bcd(xxx),ddd(dfk dsaf)' >>> results = re.findall(r'(w+)(([^)]+)),?',str1) for k,v in results: print('key = %r, value = %r' % (k, v)) ... key = 'abc', value = '1' key = 'bcd', value = 'xxx' key = 'ddd', value = 'dfk dsaf' Pass it to dict() if you want a dict: >>> dict(results) {'bcd': 'xxx', 'abc': '1', 'ddd': 'dfk dsaf'}

Categories : Python

Updating Multiple rows in 1 query call . Parse.com
If it is a big number of records I suggest you to execute the update via cloud code. What you need to do is to query and receive a list of records then iterate through the list, update the records and then save the records. you can find information about cloud code at https://www.parse.com/docs/cloud_code_guide.

Categories : Iphone

I need to parse a log file into multiple files based on delimiters
Below script would help you to get the information. You can modify them to create the data you require. #!/bin/sh cmd=`cat data.dat | paste -d, - - - - - | cut -d ',' -f 2,4 > file.out` $cmd while read p; do fileName=`echo $p | cut -d ',' -f 1` echo $fileName dataInfo=`echo $p | cut -d ',' -f 2` echo $dataInfo done< file.out

Categories : Bash

How to parse a message from a text file with c# that spans multiple lines?
I would use Regex.Split and break the file up on anything that matches the date pattern (ex. 2013-06-19) at the beginning of each error.

Categories : C#

Using XSLT 2.0 to parse the values of multiple attributes into an array-like structure
You can use the tokenize function in a for expression to get a sequence of the separate values, then create an attribute node for each one. However, since XSLT doesn't let you create a bare attribute node with no element parent, you'll have to use a trick like this: <xsl:variable name="archElements"> <xsl:for-each select="for $attr in $initialNodeSet return tokenize($attr, '[:;]')"> <dummy arch="{.}" /> </xsl:for-each> </xsl:variable> and then $archElements/dummy/@arch should be the set of separated arch attribute nodes that you require. Complete example: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output indent="yes" /> <xsl:template match="/"> <xsl:v

Categories : Xslt

How to Find the Nearest Places based on current lat and long using Parse API(parse.com) in android
Did you try whereWithinKilometers, whereWithinMiles or whereWithinRadians Check on the ParseQuery in the right menu. You code will look like something like: ParseGeoPoint userLocation = (ParseGeoPoint) userObject.get("location"); ParseQuery query = new ParseQuery("PlaceObject"); query.whereWithinKilometers("location", userLocation); query.findInBackground(new FindCallback() { ... });

Categories : Android

Using Parse for Facebook login but i get --https://api.parse.com/1/users 404-- After Refreshing 3 Times
"User cancelled the facebook login or did not fully authorize" means that you are already logged in. Use chrome's developer tools console to check if your current user using this commmand: Parse.User.current() If you get an object, you are already logged in. You can use Parse.User.logOut() to logout, then Parse.User.current() should return a null! Also you can use Parse.User.current().get('authData')['facebook'], as mentioned here Notes: If logging out from parse logs you out of facebook, update your parse reference

Categories : Javascript

can't parse parse time string with posix-style timezone in python
How about this: parse date string without the timezone part into datetime object via strptime() parse timezone string into pytz timezone update tzinfo on the datetime object via replace() from datetime import datetime import pytz date_string = "2013-08-22 16:56:19" tz_string = "Etc/GMT" dt = datetime.strptime(date_string, "%Y-%m-%d %H:%M:%S") dt = dt.replace(tzinfo=pytz.timezone('Etc/GMT')) print dt prints: 2013-08-22 16:56:19+00:00 This actually correctly understands and reverses signs in the POSIX timezone format, for example: dt = dt.replace(tzinfo=pytz.timezone('Etc/GMT-1')) print dt # prints 2013-08-22 16:56:19+01:00

Categories : Python

Upload data to Parse.com using Arduino and GSM shield and Parse REST API
you need to fork the library and rewrite the httpPost() function to add the headers elements you need: #define REST_APP_ID "gmOpYot0OhWGnkMojjZv9KYUHMySCSeTGyyplArZ" #defnie REST_API_KEY "XQMA4Wd3SQdOsxudtKz5OdbPaVN3YE9aOKx0VSh2" int InetGSM::parsePOST(const char* path, const char* parameters, char* result, int resultlength) { const char* server = "https://api.parse.com"; int port = 443; char itoaBuffer[8]; int num_char; if (!gsm.connectTCP(server, port)){ return 0; } strcpy(_buffer,"POST "); strcat(_buffer,path); strcat(_buffer," HTTP/1.0 Host: "); strcat(_buffer,); strcat(_buffer," X-Parse-Application-Id: "); strcat(_buffer,REST_APP_ID); strcat(_buffer," X-Parse-REST-API-Key: "); strcat(_buffer,REST_API_KEY); strcat

Categories : Api

PhysicalAddress.Parse() won't parse lower cased string, is this a bug?
From MSDN: The address parameter must contain a string that can only consist of numbers and upper-case letters as hexadecimal digits. Some examples of string formats that are acceptable are as follows .... Note that an address that contains f0-e1-d2-c3-b4-a5 will fail to parse and throw an exception. So you could simply do: PhysicalAddress.Parse(ad.ToUpper());

Categories : C#

Cannot parse chinese characeters with TJSONObject.Parse
It is obvious because you are using TEncoding.ASCII.GetBytes. You should use TEncoding.UTF8.GetBytes. You can also use the TJSONObject.ParseJSONValue overload that takes a string directly.

Categories : Json

Parse.com how can i save my model using parse cloud js?
First I would double check the version of the javascript sdk you're using in your cloud code. Make sure it's up to date e.g. 1.2.8. The version is set in the config/global.json file under your cloud code directory. Assuming you're up to date I would try modifying your code by chaining the promises using multiple then's like so: query.find().then(function(results){ if (results.length > 0){ return results[0]; } else { //no object found, so i want to make an object... do i do that here? return null; } }, function(error){ response.error("ServerDown"); console.error("Se

Categories : Javascript

Can't apply Geo queries in parse (Parse Framework)
Try this: ParseObject.registerSubclass(MasterEntity.class); ParseGeoPoint userLocation = new ParseGeoPoint(latitude,longitude); ParseQuery<MasterEntity> query = ParseQuery.getQuery("UserMaster"); query.whereNear("location", userLocation); query.setLimit(30); query.findInBackground(new FindCallback<MasterEntity>() { @Override public void done(List<MasterEntity> mlist, ParseException e) { dlg.dismiss(); if (e==null) { for (int i = 0; i < mlist.size(); i++) { MasterEntity cc = mlist.get(i); String s_email = cc.getEmail(); String s_uname = cc.getuserName(); String s_objid = cc.getObjectID(); List<ParseObject>

Categories : Parse Com

Decimal.Parse/Double.Parse Returns a Value without the Decimal Point
My strong suspicion is that you're running on a machine with a culture which doesn't use . as a decimal point. Specify the culture explicitly, e.g. to the invariant culture decimal margin1 = decimal.Parse(strProfitMargin, CultureInfo.InvariantCulture);

Categories : C#

Multiple Build Folders (multiple clients, mulitask, multiple targets) using Grunt (Yeoman)
There's really no best practice out there beside what's recommended for PG 3. For multiple clients, you may want to modify your gruntjs. This is my project structure, where assets folder contain data for different clients: And here is my gruntjs file. It use ImageMagik to create all the necessary launcher icons. Build and deploy for over the air installation. You get the idea... /*** * Package script for MobileStore ***/ 'use strict'; // require package.json: /* { "name": "MobileStore", "version": "1.0.1", "devDependencies": { "grunt": "~0.4.1", "grunt-contrib-jshint": "~0.6.0", "grunt-contrib-clean": "~0.4.1", "grunt-contrib-copy": "~0.4.1", "grunt-contrib-concat": "~0.3.0", "grunt-exec": "~0.4.2", "grunt-string-replace": "~0.2.4", "grunt

Categories : Javascript

Multiple readers and multiple writers(i mean multiple) synchronization
If you are using pthreads, take a look at the synchronization approach in this question. You could use a similar approach with two variables readerCount and writerCount and a mutex. In a reader thread you would lock the mutex and wait for writerCount == 0. If this is condition is met, you increment the readerCount by 1 and release the lock. Then you do the reading. When you are done, you lock the mutex again, decrement the readerCount, signal the condition change and release the lock. The writer thread follows the same logic but waits for the condition readerCount == 0 and increments/decrements writerCount instead.

Categories : Unix

PHP SQL, Getting a multiple data from multiple table with multiple condition in PHP
Make a condition for job_taker and users like job_taker.user_id=users.user_id Query, $data_query ="SELECT users.user_name, jobs.job_code, jobs.job_desc, jobs.job_client, jobs.job_year, jobs.job_month, jobs.job_category, job_taker.job_hours FROM jobs,job_taker,users WHERE jobs.job_id = job_taker.job_id AND users.user_id ='$uid' AND job_taker.user_id=users.user_id ORDER BY 'login.jobs.job_id' DESC";

Categories : PHP



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.