Search Results

Search found 35302 results on 1413 pages for 'string literals'.

Page 127/1413 | < Previous Page | 123 124 125 126 127 128 129 130 131 132 133 134  | Next Page >

  • Strcpy() corrupts the copied string in Solaris but not Linux

    - by strictlyrude27
    Hi all, I'm writing a C code for a class. This class requires that our code compile and run on the school server, which is a sparc solaris machine. I'm running Linux x64. I have this line to parse (THIS IS NOT ACTUAL CODE BUT IS INPUT TO MY PROGRAM): while ( cond1 ){ I need to capture the "while" and the "cond1" into separate strings. I've been using strtok() to do this. In Linux, the following lines: char *cond = NULL; cond = (char *)malloc(sizeof(char)); memset(cond, 0, sizeof(char)); strcpy(cond, strtok(NULL, ": \t\(){")); //already got the "while" out of the line will correctly capture the string "cond1".Running this on the solaris machine, however, gives me the string "cone1". Note that in plenty of other cases within my program, strings are being copied correctly. (For instance, the "while") was captured correctly. Does anyone know what is going on here?

    Read the article

  • SQL ConnectionString in global.asax overridden by web.config

    - by rlb.usa
    This is going to sound very odd, but I have a web.config like this: <connectionStrings> <remove name="LocalSqlServer"/> <add name="LocalSqlServer" connectionString="Data Source=BACKUPDB;..." providerName="System.Data.SqlClient"/> </connectionStrings> And a global.asax like this: void Session_Start(object sender, EventArgs e) { // Code that runs when a new session is started if (Application["con"] == null || Application["con"] == "") { Application["con"] = "Data Source=PRODUCTIONDB;..."; } } And EVERYWHERE in my code, I reference my ConnectionStrings like this: SqlConnection con = new SqlConnection(Convert.ToString(HttpContext.Current.Application["con"])); However, I see that everything I do inside this application goes to BACKUP db instead of PRODUCTIONDB. What is going on, how could this happen, and why? It doesn't make any sense to me, and it got me into a lot of trouble. We use LocalSqlServer string for FormsAuthentication.

    Read the article

  • [Flex Beginner question] String and value object

    - by James
    Hi all, In php we can assign a method name to a variable and then use that variable to call the method. For example: $image_create_func = 'ImageCreateFromGIF'; $newImage = $image_create_func($oldImage); But can we do this in Flex? In flex, I have the string public var key:String = "email" And I also have a value object searchTerm:SearchTermVO which has a public property "email" (searchTerm.email). Now I want to do searchTerm.email by doing something like in php: searchTerm.key but it's not possible. Can anybody help me with this plz? Thank you.

    Read the article

  • Decode the string encoded through php in javascript

    - by Pankaj Khurana
    Hi, I am working on a facebook page in which i have used ajax & response is returned in json format. I have encoded the string in php. Now i want to decode that string in javascript. foreach($feedbackdetails as $feedbackdetail) { $str.= '<div class="tweet"> <img style="cursor:pointer;" id="imgVoteUp" src="http://myserver/facebook/vote_up.gif" alt="Vote Up" title="Vote Up" onclick="saveVote('.$feedbackdetail[pk_feedbackid].',1)" /> : '.$feedbackdetail[upvotecount].' <img style="cursor:pointer;" id="imgVoteDown" src="http://myserver/facebook/vote_down.gif" alt="Vote Down" title="Vote Down" onclick="saveVote('.$feedbackdetail[pk_feedbackid].',0)" /> : '.$feedbackdetail[downvotecount].' <p class="'.$pclass.'">'.$feedbackdetail[title].' by '.$feedbackdetail[name].'<br>'.$feedbackdetail[description].'</p></div>'; } $str=urlencode($str); echo '{"fbml_test":"'.$str.'"}'; Javascript Function: function saveVote(id,type,class) { contentdiv='div_'+id; processdiv='processdiv_'+id; document.getElementById(processdiv).setInnerXHTML('<span id="caric"><center><img src="http://static.ak.fbcdn.net/rsrc.php/z5R48/hash/ejut8v2y.gif" /></center></span>'); posturl='http://myserver/facebook/vote.php'; if(class==0) { class='firstmessage'; } else { class='message'; } var queryString = "?id="+id+"&type="+type+"&pclass="+class; posturl = posturl +queryString; ajax = new Ajax(); ajax.responseType = Ajax.JSON; ajax.requireLogin = true; ajax.ondone = function(data) { document.getElementById('caric').setStyle('display','none'); //new Dialog().showMessage('Dialog',data); if(data.error) { new Dialog().showMessage('Dialog',data.error); } if(data.fbml_test) { document.getElementById(contentdiv).setInnerFBML(data)); } //div_id.setInnerFBML(data); } ajax.post(posturl); } Right now i am getting encoded string how can i change it? Please help me on this Thanks Pankaj

    Read the article

  • Rendering a view to a string in ASP.NET MVC 2

    - by Frank Rosario
    We need to render an ActionResult to a string to add pages to our internal search engine index. We settled on this solution to render to string. I've run into a problem with the ExecuteResult call used to process the View. Code Snippet: var oldController = controllerContext.RouteData.Values["controller"]; controllerContext.RouteData.Values["controller"] = typeof(TController).Name.Replace("Controller", ""); viewResult.ExecuteResult(controllerContext); // this line breaks I receive the following error: "Object reference not set to instance of object" error. I've confirmed viewResult is not null, so the exception has to be thrown internally in ExecuteResult. What could we be missing?

    Read the article

  • SQL ConnectionString in web.config and global.asax implications

    - by rlb.usa
    This is going to sound very odd, but I have a web.config like this: <connectionStrings> <remove name="LocalSqlServer"/> <add name="LocalSqlServer" connectionString="Data Source=BACKUPDB;..." providerName="System.Data.SqlClient"/> </connectionStrings> And a global.asax like this: void Session_Start(object sender, EventArgs e) { // Code that runs when a new session is started if (Application["con"] == null || Application["con"] == "") { Application["con"] = "Data Source=PRODUCTIONDB;..."; } } And EVERYWHERE in my code, I reference my ConnectionStrings like this: SqlConnection con = new SqlConnection(Convert.ToString(HttpContext.Current.Application["con"])); However, I see that everything I do inside this application goes to BACKUP db instead of PRODUCTIONDB. What is going on, how could this happen, and why? It doesn't make any sense to me, and it got me into a lot of trouble. We use LocalSqlServer string for FormsAuthentication.

    Read the article

  • 2d String Array NullPointerException (java)

    - by Student01
    I am currently creating a java application in which I have a 2d array which I want to get some data into. I am creating the 2d array as such String[][] addressData; and then when I am trying to put data in I am using reference the exact position in the 2d array I want to enter the data into e.g addressData[0][0] = "String Data"; The program compiles yet when I run I get a NullPointerException error. Am I using the wrong method to enter data into this 2d array?

    Read the article

  • Declarative JDOQL vs Single-String JDOQL : performance

    - by DrDro
    When querying with JDOQL is there a performance difference between using the declarative version and the Single-String version: Example from the JDOQL doc: //Declarative JDOQL : Query q = pm.newQuery(org.jpox.Person.class, "lastName == \"Jones\" && age < age_limit"); q.declareParameters("double age_limit"); List results = (List)q.execute(20.0); //Single-String JDOQL : Query q = pm.newQuery("SELECT FROM org.jpox.Person WHERE lastName == \"Jones\"" + " && age < :age_limit PARAMETERS double age_limit"); List results = (List)q.execute(20.0); Other then performance, are there any reasons for which one is better to use then the other or is it just about the one with which we feel more comfortable.

    Read the article

  • Return a dynamic string from std::exception's `what`

    - by Shtééf
    I'm convinced at this point that I should be creating subclasses of std::exception for all my exception throwing needs. Now I'm looking at how to override the what method. The situation that I'm facing, it would be really handy if the string what returns be dynamic. Some pieces of code parse an XML file for example, and adding a position or line number to the error message is useful to me. What I'd like to know: what returns a const char *, which implies any catcher is likely not going to free the string. So I need some other place to store the result, but where would that be? (I need thread-safety.) what also includes throw() in its signature. While I can prevent my what from throwing anything, it seems to me that this method really isn't intended for anything too dynamic. If what is not the right place, then where should I be doing this instead?

    Read the article

  • Parsing String to Time and insert in mysqldatabase

    - by kawtousse
    Goal: Parse a string from an input type text into TIME type to be inserted in MYSQL Database. String start= request.getParameter("startp"); System.out.println("start:" +start); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); long ms=0; try { ms = sdf.parse(start).getTime(); System.out.println(" the value of ms is:" +ms); } catch (ParseException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } Time ts = new Time(ms); System.out.println("the value of ts is:" +ts); start:14:12 (value witch i entered actually in the form at the start field named startp) the value of ts is :01:00:00 java.text.ParseException: Unparseable date: "14:12" at java.text.DateFormat.parse(Unknown Source) ms not displayed I ensure that database type of the following parameter is TIME. Thanks.

    Read the article

  • How do I convert CamelCase into human-readable names in Java?

    - by Frederik
    I'd like to write a method that converts CamelCase into a human-readable name. Here's the test case: public void testSplitCamelCase() { assertEquals("lowercase", splitCamelCase("lowercase")); assertEquals("Class", splitCamelCase("Class")); assertEquals("My Class", splitCamelCase("MyClass")); assertEquals("HTML", splitCamelCase("HTML")); assertEquals("PDF Loader", splitCamelCase("PDFLoader")); assertEquals("A String", splitCamelCase("AString")); assertEquals("Simple XML Parser", splitCamelCase("SimpleXMLParser")); assertEquals("GL 11 Version", splitCamelCase("GL11Version")); }

    Read the article

  • Bouncy Castle, RSA : transforming keys into a String format

    - by Rami W.
    Hi, iam using RSA(Bouncy Castle API) in my c# porject. Igenerated the keypair with this method RsaKeyPairGenerator r = new RsaKeyPairGenerator(); r.Init(new KeyGenerationParameters(new SecureRandom(), 1024)); AsymmetricCipherKeyPair keys = r.GenerateKeyPair(); AsymmetricKeyParameter private_key = keys.Private; AsymmetricKeyParameter public_key = keys.Public; now i want to save them in txt file but the problem is that i can't convert them to a string format. i read in another post that keys must be serialized using PrivateKeyInfo k = PrivateKeyInfoFactory.CreatePrivateKeyInfo(private_key); byte[] serializedKey = k.ToAsn1Object().GetDerEncoded(); Is it the right way ? if yes, what should i do after this ? just convert them from byte[] to String ? thx for any help.

    Read the article

  • How to extract valid email from larger string in Scala

    - by luigi-prog
    My scala version 2.7.7 Im trying to extract an email adress from a larger string. the string itself follows no format. the code i've got: import scala.util.matching.Regex import scala.util.matching._ val Reg = """\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b""".r "yo my name is joe : [email protected]" match { case Reg(e) => println("match: " + e) case _ => println("fail") } the Regex passes in RegExBuilder but does not pass for scala. Also if there is another way to do this without regex that would be fine also. Thanks!

    Read the article

  • Easily switching ConnectionStrings on publish to Azure

    - by David Pfeffer
    I'm currently building an Azure Web Role. I am testing this project against a local database server on localhost. Then, when confident that the project is working, I publish it to Staging on Windows Azure. However, I also have to remember to change the connection string to point to the live SQL server on SQL Azure before deploying, and then change it back to localhost afterwards. Is there any nice way to automate this, or perhaps a different process to take to avoid the issue altogether? For example is there a way to have a configuration file for Azure that isn't updated with every deploy?

    Read the article

  • Looking for a method to replace a string with a hyperlink

    - by Richard West
    I have a usercontrol in an asp web forms application that I am working on in C#. I am binding to a repeater and outputting a field of information, named "Text", using the following syntax: <%# DataBinder.Eval(Container.DataItem, "Text") %> I am looking for a method that will allow my to search for a keyword within the string that is returned from above, and replace that string with a hyperlink such as <a href="www.anysite.com/keyword">keyword</a>. I'm not very familer with user controls and getting data back in this manner so I am looking for advice on how this might be best handled. Thanks!

    Read the article

  • How to remove code from HTML string?

    - by TruMan1
    I have a variable that has this string: <DIV><SPAN style="FONT-FAMILY: Tahoma; FONT-SIZE: 10pt">[If the confirmation is active the subscriber will receive this email after succesfully confirming. If not, this will be the first and only email he will receive.]</SPAN></DIV> <p align=center> <input class=fieldbox10 type = 'button' name = 'button' value = 'Close' onclick = "window.close()"> </p> How do I remove the below string without worrying about spaces via Javascript (or jQuery)? <p align=center> <input class=fieldbox10 type = 'button' name = 'button' value = 'Close' onclick = "window.close()"> </p>

    Read the article

  • safely encode and pass a string from a html link to PHP program

    - by bert
    What series of steps would be reqired to safely encode and pass a string from a html href using javascript to construct the link to a php program. in javascript set up URL // encodes a URI component. path = "mypgm.php?from=" + encodeURIComponent(myvar) ; in php: // get passed variables $myvar = isset($_GET['myvar']) ? ($_GET['myvar']) : ''; // decode - (make the string readable) $myvar = (rawurldecode($myvar)); // converts characters to HTML entities (reduce risk of attack) $myvar = htmlentities($myvar); // maybe custom sanitize program as well? // see [http://stackoverflow.com/questions/2668854/php-sanitizing-strings-to-make-them-url-and-filename-safe][1] $myvar = sanitize($myvar);

    Read the article

  • Validate a string in a table in SQL Server

    - by Ashish Gupta
    I need to check If a column value (string) in SQL server table starts with a small letter and can only contain '_', '-', numbers and alphabets. I know I can use a SQL server CLR function for that. However, I am trying to implement that validation using a scalar UDF and could make very little here...I can use 'NOT LIKE', but I am not sure how to make sure I validate the string irrespective of the order of characters or in other words write a pattern in SQL for this. Am I better off using a SQL CLR function? Any help will be appreciated.. Thanks in advance

    Read the article

  • PHP: Replace umlauts with closest 7-bit ASCII equivalent in an UTF-8 string

    - by BlaM
    What I want to do is to remove all accents and umlauts from a string, turning "lärm" into "larm" or "andré" into "andre". What I tried to do was to utf8_decode the string and then use strtr on it, but since my source file is saved as UTF-8 file, I can't enter the ISO-8859-15 characters for all umlauts - the editor inserts the UTF-8 characters. Obviously a solution for this would be to have an include that's an ISO-8859-15 file, but there must be a better way than to have another required include? echo strtr(utf8_decode($input), 'ŠŒŽšœžŸ¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ', 'SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy'); UPDATE: Maybe I was a bit inaccurate with what I try to do: I do not actually want to remove the umlauts, but to replace them with their closest "one character ASCII" aequivalent.

    Read the article

  • Remove unmatched HTML tags in a string

    - by Freeman
    Folks does anyone knows of a PHP function to remove unmatched HTML tags from a string. for example<div> This is a string <b> with an unmatched bold tag </div>. If there isnt one then help me buld one, maybe I can have a function that counts the number of opening tags and matching closing tags. If they are not even then remove the first opening tag or if closing tags are more, it removes the last tag?

    Read the article

< Previous Page | 123 124 125 126 127 128 129 130 131 132 133 134  | Next Page >