Search Results

Search found 15081 results on 604 pages for 'passing by reference'.

Page 66/604 | < Previous Page | 62 63 64 65 66 67 68 69 70 71 72 73  | Next Page >

  • String from Httpresponse not passing full value.

    - by Shekhar_Pro
    HI i am in desperate need for help here, I am making a web request and getting a json string with Response.ContentLenth=2246 but when i parse it in a string it gives only few 100 characters, i traked it down that it is only getting values less than 964. strings length is still 2246 but remaining values are just (\0) null characters. Its also giving an error Unterminated string passed in. (2246): at following line FacebookFeed feed = sr.Deserialize<FacebookFeed>(data); It works fine if the response stream contains characters less than 964 chars. Following is the extract from the full code error encountered in last line. System.Web.Script.Serialization.JavaScriptSerializer sr = new System.Web.Script.Serialization.JavaScriptSerializer(); System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(@"https://graph.facebook.com/100000570310973_181080451920964"); req.Method = "GET"; System.Net.HttpWebResponse res = (System.Net.HttpWebResponse)req.GetResponse(); byte[] resp = new byte[(int)res.ContentLength]; res.GetResponseStream().Read(resp, 0, (int)res.ContentLength); string data = Encoding.UTF8.GetString(resp); FacebookFeed feed = sr.Deserialize<FacebookFeed>(data); error given is Unterminated string passed in. (2246): {"id":"100000570310973_1810804519209........ (with rest of data in the string data including null chars) following is the shape of classes used in my code: public class FacebookFeed { public string id { get; set; } public NameIdPair from { get; set; } public NameIdPair to { get; set; } public string message { get; set; } public Uri link{get;set;} public string name{get; set;} public string caption { get; set; } public Uri icon { get; set; } public NameLinkPair[] actions { get; set; } public string type { get; set; } public NameIdPair application { get; set; } //Mentioned in Graph API as attribution public DateTime created_time { get; set; } public DateTime updated_time { get; set; } public FacebookPostLikes likes { get; set; } } public class NameIdPair { public string name { get; set; } public string id { get; set; } } public class NameLinkPair { public string name { get; set; } public Uri link{get; set;} } public class FacebookPostLikes { public NameIdPair[] data { get; set; } public int count { get; set; } }

    Read the article

  • passing values to pages

    - by Indranil Mutsuddy
    Hello friends, What i am trying here is to pass values to other pages. When i include the following code private void Button1_Click(object sender, System.EventArgs e) { // Value sent using HttpResponse Response.Redirect("WebForm5.aspx?Name="+txtName.Text); } if (Request.QueryString["Name"]!= null) Response.write( Request.QueryString["Name"]); everything works fine the name gets displayed. Now if use MemberId instead, though i can see the Id in the Url, but while checking for Null in other page, its true. Whats wrong?? Now I tried the same thing using session i.e. Session["MemberId"] = this.TxtEnterMemberId.Text; if (MemberSex.Equals("M")) Response.Redirect("PatientDetailsMale.aspx",false ); Page_load event of the other page if (Session["MemberId"] != null) mid = Session["MemberId"].ToString(); IT Works..Could u guys explain the behaviour please? P.S. Can anyone give a breif in layman words about SessionId and its usage. Thanking you, Indranil

    Read the article

  • best practice for passing many arguments to method ?

    - by Tony
    Occasionally , we have to write methods that receive many many arguments , for example : public void doSomething(Object objA , Object objectB ,Date date1 ,Date date2 ,String str1 ,String str2 ) { } When I encounter this kind of problem , I often encapsulate arguments into a map. Map<Object,Object> params = new HashMap<Object,Object>(); params.put("objA",ObjA) ; ...... public void doSomething(Map<Object,Object> params) { // extracting params Object objA = (Object)params.get("objA"); ...... } This is not a good practice , encapsulate params into a map is totally a waste of efficiency. The good thing is , the clean signature , easy to add other params with fewest modification . what's the best practice for this kind of problem ?

    Read the article

  • Passing Variables Along in a Function

    - by John
    Hello, In the function show_commentbox() below, I would like to pass along the variables $_SESSION['loginid'], $submissionid, $submission, $url, $submittor, $submissiondate, $countcomments, $dispurl. With the setup below, it's not working. How could I change it to make show_commentbox() pass the variables along? Thanks in advance, John index.php: <?php $submission = $_GET['submission']; require_once "header.php"; include "login.php"; include "comments.php"; include "commentformonoff.php"; ?> In header.php: require_once ("function.inc.php"); In comments.php: $uid = $_SESSION['loginid']; $submissiondate = mysql_real_escape_string($_GET['submissiondate']); $submittor = mysql_real_escape_string($_GET['submittor']); $countcomments = mysql_real_escape_string($_GET['countcomments']); $dispurl = mysql_real_escape_string($_GET['dispurl']); $url = mysql_real_escape_string($_GET['url']); $submission = mysql_real_escape_string($_GET['submission']); $submissionid = mysql_real_escape_string($_GET['submissionid']); commentformonoff.php: <?php if (!isLoggedIn()) { if (isset($_POST['cmdlogin'])) { if (checkLogin($_POST['username'], $_POST['password'])) { show_commentbox(); } else { echo "Login to comment"; } } else { echo "Login to comment"; } } else { show_commentbox(); } ?> In display.functions.inc.php: function show_commentbox() { echo '<form action="http://www...com/sandbox/comments/comments2.php" method="post"> <input type="hidden" value="'.$_SESSION['loginid'].'" name="uid"> <input type="hidden" value="'.$submissionid.'" name="submissionid"> <input type="hidden" value="'.$submission.'" name="submission"> <input type="hidden" value="'.$url.'" name="url"> <input type="hidden" value="'.$submittor.'" name="submittor"> <input type="hidden" value="'.$submissiondate.'" name="submissiondate"> <input type="hidden" value="'.$countcomments.'" name="countcomments"> <input type="hidden" value="'.$dispurl.'" name="dispurl"> <label class="addacomment" for="title">Add a comment:</label> <textarea class="commentsubfield" name="comment" type="comment" id="comment" maxlength="1000"></textarea> <div class="commentsubbutton"><input name="submit" type="submit" value="Submit"></div> </form> '; }

    Read the article

  • Passing a 'var' into another method

    - by Danny
    Hi, I am probably totally missing the point here but.... How can I pass a 'var' into another method? (I am using linq to load XML into an Enumerable list of objects). I have differernt object types (with different fields), but the final step of my process is the same regardless of which object is being used. XNamespace xmlns = ScehmaName; var result = from e in XElement.Load(XMLDocumentLocation).Elements(xmlns + ElementName) select new Object1 { Field1 = (string)e.Element(xmlns + "field1"), Field2 = (string)e.Element(xmlns + "field2") }; var result2 = Enumerable.Distinct(result); This code will vary for the different type of XML files that will be processed. But I then want to iterate though the code to check for various issues: foreach (var w in result2) { if (w.CheckIT()) { //do something } } What I would love is the final step to be in a method in the base class, and I can pass the 'var' varible into it from each child class.

    Read the article

  • linq NullReferenceException while checking for null reference

    - by Odrade
    I have the following LINQ query: List<FileInputItem> inputList = GetInputList(); var results = from FileInputItem f in inputList where ( Path.GetDirectoryName(f.Folder).ToLower().Trim() == somePath || Path.GetDirectoryName(f.Folder).ToLower().Trim() == someOtherPath ) && f.Expression == null select f; Every time this query is executed, it generates a NullReferenceException. If I remove the condition f.Expression == null or change it to f.Expression != null, the query executes normally (giving the wrong results, of course). The relevant bits of FileInputItem look like this: [Serializable] public class FileInputItem { [XmlElement("Folder")] public string Folder { get; set; } [XmlElement("Expression")] public string Expression { get; set; } /*SNIP. Irrelevant properties */ } I'm new to LINQ to objects, so I'm probably missing something fundamental here. What's the deal?

    Read the article

  • Exporting Eclipse project with a reference to native library

    - by TacB0sS
    I have an Eclipse project, that uses JMF, I found out I could skip the JMF installation process and still to use the CaptureDeviceManager of the JMF, and to receive the list of devices if I could point my project to the native lib of the JMF. I've managed to add the native lib to the IDE run/debug, but once I export the application to an external runnable Jar, the application cannot find the native lib. the files are located in c:\JMF*.dll I tried to add the folder path to the environment variable in windows - didn't work. I tried to add them into another Jar and add it to the project - didn't work. I tried to add the files into the project - didn't work. I tried to add the path to the class path - didn't work. I tried to add the path to the library path - didn't work. does someone have any sort of a solution? Thanks in advance, Adam Zehavi.

    Read the article

  • Passing a variable to jsp when reloading an iframe using javascript

    - by Vee
    In my javascript code I load a jsp page in an iframe and pass some variables like this: htmlData[i++]="<iframe id=\"mapframe\" frameborder=\"0\" style=\"width:330px;height:300px\" src=\"" + "mapURL.jsp" +"&lat=" + AjxStringUtil.urlComponentEncode("33.65") +"&lng=" + AjxStringUtil.urlComponentEncode("-84.42") +"&accord=" + AjxStringUtil.urlComponentEncode(accord) +"\"></iframe>"; Then I have to reload that jsp page after an action, and I do this: accord = ui.newHeader.text(); document.getElementById('mapframe').contentWindow.location.reload(); The reload works except that the "accord" variable is not getting updated. When I call it from the jsp, it still has its original value. How do I pass the new value when reloading the iframe/jsp? It shouldn't make any difference, but I am working with jquery and this is for a Yahoo zimlet. Thanks.

    Read the article

  • PHP: passing a function with parameters as parameter

    - by Oden
    Hey, I'm not sure that silly question, but I ask: So, if there is an anonymous function I can give it as another anonymous functions parameter, if it has been already stored a variable. But, whats in that case, if I have stored only one function in a variable, and add the second directly as a parameter into it? Can I add parameters to the non-stored function? Fist example (thats what i understand :) ): $func = function($str){ return $str; }; $func2 = function($str){ return $str; }; $var = $func($func2('asd')); var_dump($var); // prints out string(3) "asd" That makes sense for me, but what is with the following one? $func = function($str){ return $str; }; $var = $func(function($str = "asd"){ return $str; }); var_dump($var); /** This prints out: object(Closure)#1 (1) { ["parameter"]=> array(1) { ["$str"]=> string(10) "" } } But why? */ And at the end, can someone recommend me a book or an article, from what i can learn this lambda coding feature of php? Thank you in advance for your answers :)

    Read the article

  • WCFExtras SOAP headers support returns null reference exception

    - by jlp
    I use WCFExtras to add headers to my service. I set up everything according to http://wcfextras.codeplex.com/wikipage?title=HowToUse&referringTitle=Home My WCF client works but throws NullReferenceException on both: client.InnerChannel.SetHeader("myHeader", new local.Header()); and var header = client.InnerChannel.GetHeader<local.Header>("myHeader"); I wonder if web.config element <wsdlExtensions location="noidea" singleFile="True"/> might cause a problem because I don't know what type in location attribute. I simply tried to type service address but it didn't fix anything.

    Read the article

  • Blackberry: Passing KML file to Google Maps

    - by Pria
    I want to know that can I pass KML as a string to google map application? Code snippet: //KML String String document = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><kml xmlns=\"http://www.opengis.net/kml/2.2\"><Document><Folder><name>Paths</name><open>0</open><Placemark><LineString><tessellate>1</tessellate><coordinates> -112.0814237830345,36.10677870477137,0 -112.0870267752693,36.0905099328766,0</coordinates></LineString></Placemark></Folder></Document></kml>"; //Invoke Google Maps int module = CodeModuleManager.getModuleHandle("GoogleMaps"); if (module == 0) { try { throw new ApplicationManagerException("GoogleMaps isn't installed"); } catch (ApplicationManagerException e) { System.out.println(e.getMessage()); } } String[] args = {document}; //Is this possible??? ApplicationDescriptor descriptor = CodeModuleManager.getApplicationDescriptors(module)[0]; ApplicationDescriptor ad2 = new ApplicationDescriptor(descriptor, args); try { ApplicationManager.getApplicationManager().runApplication(ad2, true); } catch (ApplicationManagerException e) { System.out.println(e.getMessage()); }

    Read the article

  • Passing data between objects in Chain of Responsibility pattern

    - by AbrahamJP
    While implementing the Chain of Responsibility pattern, i came across a dilemma om how to pass data between objects in the chain. The datatypes passed between object in the chain can differ for each object. As a temporary fix I had created a Static class containing a stack where each object in the chain can push the results to the stack while the next object in the chain could pop the results from the stack. Here is a sample code on what I had implemented. public interface IHandler { void Process(); } public static class StackManager { public static Stack DataStack = new Stack(); } //This class doesn't require any input to operate public class OpsA : IHandler { public IHandler Successor {get; set; } public void Process() { //Do some processing, store the result into Stack var ProcessedData = DoSomeOperation(); StackManager.DataStack.Push(ProcessedData); if(Successor != null) Successor(); } } //This class require input data to operate upon public class OpsB : IHandler { public IHandler Successor {get; set; } public void Process() { //Retrieve the results from the previous Operation var InputData = StackManager.DataStack.Pop(); //Do some processing, store the result into Stack var NewProcessedData = DoMoreProcessing(InputData); StackManager.DataStack.Push(NewProcessedData); if(Successor != null) Successor(); } } public class ChainOfResponsibilityPattern { public void Process() { IHandler ProcessA = new OpsA(); IHandler ProcessB = new OpsB(); ProcessA.Successor = ProcessB; ProcessA.Process(); } } Please help me to find a better approach to pass data between handlers objects in the chain.

    Read the article

  • passing nsdata in stringwithformat

    - by milanjansari
    hello, How to pass nsdata in below of the string NSData *myData = [NSData dataWithContentsOfFile:pathDoc]; pathDoc = [NSString stringWithFormat:@"<size>%d</size><type>%d</type><cdate>%@</cdate><file>%c</file><fname>File</fname>",fileSizeVal,filetype,creationDate,file]; Any idea about this? Thanks you, Milan

    Read the article

  • Passing Variable in load

    - by Tyler
    I have a load action tied to the submit button of a form. jQuery('#content').load("/control/ajxdata/installs.php?country=" + country); jQuery('#content').load("/control/ajxdata/installs.php",{ 'country': country }); The name, and the id of the form element I am trying to utilize is "country" In the error console, I am getting "Error: country is not defined"

    Read the article

  • Passing an arbitrary JSONValue to a JSNI function

    - by Riley Lark
    I have a JSONValue in my Java that may be a JSONArray, a JSONObject, a JSONString, etc. I want to pass it to a JSNI function that can accept any of those types. If I naively write my JSNI as something like: public final native jsni(Object parameter) /*-{ doSomething(parameter); }-*/; public void useFunction(JSONValue value) { jsni(value); //Throws js exception at runtime :( } then I get a javascript exception, because GWT doesn't know how to convert the JSONValue to a JavaScriptObject (or native string / number value). My current workaround is public final native jsniForJSO(Object parameter) /*-{ doSomething(parameter); }-*/; public final native jsniForString(String parameter) /*-{ doSomething(parameter); }-*/; public final native jsniForNumber(double parameter) /*-{ doSomething(parameter); }-*/; public actuallyUseFunction(JSONValue value) { if (value.isObject()) { jsniForJSO(value.isObject().getJavaScriptObject()); } else if (value.isString()) { jsniForString(value.isString().stringValue()); } else { //etc } } This is a big burden for code maintainability, etc... especially if you have more than one parameter. Is there a way to generate these functions automatically, or get around this issue altogether? I've taken to wrapping everything in a JSONObject first, so I can definitely get a JavaScriptObject to pass to my jsni, but that's another clumsy mechanic.

    Read the article

  • Passing parameter as final in C#

    - by Ravisha
    This might be a duplicate question.But could not find it in search In java to mark a method parameter as constant we declare it as final whats the equivalent C# keyword? Like: public void doSomeThing(final object myObject) { //print myobject }

    Read the article

  • How to quote and reference MS SQL table and field names

    - by artvolk
    Good day! Despite the fact LINQ2SQL and ADO.NET Entity Framework exists there were situations when I need to revert to plain old DataSet (not typed) and friends. While writing SQL for SqlCommand: Is it needed to quote field and table names with []? Is it good to prefix table names with [dbo] I use to use this syntax: SqlCommand command = new SqlCommand("SELECT [Field1], [Field2] FROM [dbo].[TableName]", connection); May be there is a better way? Thanks in advance!

    Read the article

  • Core Data: Deleting causes 'NSObjectInaccessibleException' from NSOperation with a reference to a deleted object

    - by Bryan Irace
    My application has NSOperation subclasses that fetch and operate on managed objects. My application also periodically purges rows from the database, which can result in the following race condition: An background operation fetches a bunch of objects (from a thread-specific context). It will iterate over these objects and do something with their properties. A bunch of rows are deleted in the main managed object context. The background operation accesses a property on an object that was deleted from the main context. This results in an 'NSObjectInaccessibleException', reason: 'CoreData could not fulfill a fault' Ideally, the objects that are fetched by the NSOperation can be operated on even if one is deleted in the main context. The best way I can think to achieve this is either to: Call [request setReturnsObjectsAsFaults:NO] to ensure that Core Data won't try to fulfill a fault for an object that no longer exists in the main context. The problem here is I may need to access the object's relationships, which (to my understanding) will still be faulted. Iterate through the managed objects up front and copy the properties I will need into separate non-managed objects. The problem here is that (I think) I will need to synchronize/lock this part, in case an object is deleted in the main context before I can finish copying. Am I missing something obvious? It doesn't seem like what I'm trying to accomplish is too out of the ordinary. Thanks for your help.

    Read the article

  • return by reference - which of the two is the correct one

    - by eriks
    i have the function: const A& f(...) {...} a. const A a1 = f(..); b. const A &a2 = f(...); which of the is the better one to use? in both cases, if i understand correctly, i prevent the possibility of modifying the returned object. in the first option, the copy constructor of A will be called - am i correct?

    Read the article

< Previous Page | 62 63 64 65 66 67 68 69 70 71 72 73  | Next Page >