Search Results

Search found 37183 results on 1488 pages for 'string conversion'.

Page 165/1488 | < Previous Page | 161 162 163 164 165 166 167 168 169 170 171 172  | Next Page >

  • Using a Loader for a string of QML

    - by Robbert
    In Qt 5.3 I've been using the Loader QML element for loading screens. Now I'm trying to load a string of QML dynamically. Qt.createQmlObject enables me to do so, but I can't seem to get the Loader element to play along. Seems like Loader only takes a URL (QUrl) or component (QQmlComponent), but Qt.createQmlObject creates an object (QObject). I'm new to QML, but from my understanding components are reusable elements, similar to classes, and objects are the instances of those classes. I thus can't seem to wrap my head around why Loader wouldn't work with objects. How can I show a loading screen while (asynchronously) parsing and initializing a string of QML? Example QML code: Item { Rectangle {id: content} Loader {id: loader} Component.onCompleted: { var obj = Qt.createQmlObject('import QtQuick 2.3; Rectangle {}', content); loader.source = obj; // Throws error. } }

    Read the article

  • Nginx: Rewriting entire URI to query string

    - by Doug
    Still pretty new to nginx here, trying to get a simple rewrite to work, but the server just responds '404 not found' My server block server { listen 80; listen [::]:80; server_name pics.example.com; root /home/pics; rewrite ^(.*)$ index.php?tag=$1; location / { try_files $uri $uri/ $uri.php /index.html $uri =404; #try_files $uri =404; fastcgi_split_path_info ^([a-z]+)(/.+)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass unix:/tmp/php5-fpm.sock; fastcgi_index index.php; } location /doc/ { alias /usr/share/doc/; autoindex on; allow 127.0.0.1; deny all; } } pics.example.com/foobear should rewrite to pics.example.com/index.php?tag=foobear

    Read the article

  • Split a html string in N parts

    - by Matt Brailsford
    Hi Guys, Does anybody have an example of spliting a html string (coming from a tiny mce editor) and splitting it into N parts using C#? I need to split the string evenly without splitting words. I was thinking of just splitting the html and using the HtmlAgilityPack to try and fix the broken tags. Though I'm not sure how to find the split point, as Ideally it should be based purley on the text rather than the html aswell. Anybody got any ideas on how to go about this? Many thanks Matt

    Read the article

  • [Cocoa] NSTask string encoding problem

    - by ryyst
    Hi, In my program, I'm grep-ing via NSTask. For some reason, sometimes I would get no results (even though the code was apparently the same as the command run from the CLI which worked just fine), so I checked through my code and found, in Apple's documentation, that when adding arguments to an NSTask object, "the NSTask object converts both path and the strings in arguments to appropriate C-style strings (using fileSystemRepresentation) before passing them to the task via argv[]" (snip). The problem is that I might grep terms like "Río Gallegos". Sadly (as I checked with fileSystemRepresentation), that undergoes the conversion and turns out to be "RiÃÅo Gallegos". How can I solve this? -- Ry

    Read the article

  • Convert JSON String to Java Object or HashMap

    - by Priyank
    Hi. I am writing an android app. I want to pass some data across the intents/activities and I feel that a conversion to and from JSON is probably a more optimal way at this point. I am able to convert a java hashmap to a json string successfully using JSONObject support. However i need to convert back this JSON string to a java object or a hashmap. What is the best way to go about it. Is parcelable really a change worth doing; if I have simple 5 field object? What are the other ways to transfer data between intents. Cheers

    Read the article

  • Call a function by its name, given from string java

    - by Joao
    Hello, I would like to be able to call a function based on its name provided by a string. Something like public void callByName(String funcName){ this.(funcName)(); } I have searched a bit into lambda funcions but they are not supported. I was thinking about going for Reflection, but I am a bit new to programming, so I am not so familiar with the subject. This whole question was brought up on my java OOP class, when I started GUI (Swing, swt) programming, and events. I found that using object.addActionCommand() is very ugly, because I would later need to make a Switch and catch the exact command I wanted. I would rather do something like object.attachFunction(btn1_click), so that it would call the btn1_click function when the event click was raised. Thank you Joao

    Read the article

  • PHP SOAP Windows: maximum string content length quota (8192) has been exceeded while reading XML dat

    - by Sadi
    I am trying to use bing with PHP SOAP. It works fine for short strings. But for larger string I get following error: Fatal error: Uncaught SoapFault exception: [a:DeserializationFailed] The formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation 'Translate'. The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 9, position 227. in ........ I am using XAMPP in windows 7. All the solution I found are for .net not the PHP. PHP has no web.config file as far as I concern. Any idea how can I solve it. Thank you Sadi

    Read the article

  • PHP JSON encode output number as string

    - by mitch
    I am trying to output a JSON string using PHP and MySQL but the latitude and longitude is outputting as a string with quotes around the values. This causes an issue when I am trying to add the markers to a google map. Here is my code: $sql = mysql_query('SELECT * FROM markers WHERE address !=""'); $results = array(); while($row = mysql_fetch_array($sql)) { $results[] = array( 'latitude' =>$row['lat'], 'longitude' => $row['lng'], 'address' => $row['address'], 'project_ID' => $row['project_ID'], 'marker_id' => $row['marker_id'] ); } $json = json_encode($results); echo "{\"markers\":"; echo $json; echo "}"; Here is the expected output: {"markers":[{"latitude":0.000000,"longitude":0.000000,"address":"2234 2nd Ave, Seattle, WA","project_ID":"7","marker_id":"21"}]} Here is the output that I am getting: {"markers":[{"latitude":"0.000000","longitude":"0.000000","address":"2234 2nd Ave, Seattle, WA","project_ID":"7","marker_id":"21"}]} Notice the quotes around the latitude and longitude values.

    Read the article

  • translate by replacing words inside existing text

    - by Berry Tsakala
    What are common approaches for translating certain words (or expressions) inside a given text, when the text must be reconstructed (with punctuations and everythin.) ? The translation comes from a lookup table, and covers words, collocations, and emoticons like L33t, CUL8R, :-), etc. Simple string search-and-replace is not enough since it can replace part of longer words (cat dog ? caterpillar dogerpillar). Assume the following input: s = "dogbert, started a dilbert dilbertion proces cat-bert :-)" after translation, i should receive something like: result = "anna, started a george dilbertion process cat-bert smiley" I can't simply tokenize, since i loose punctuations and word positions. Regular expressions, works for normal words, but don't catch special expressions like the smiley :-) but it does . re.sub(r'\bword\b','translation',s) ==> translation re.sub(r'\b:-\)\b','smiley',s) ==> :-) for now i'm using the above mentioned regex, and simple replace for the non-alphanumeric words, but it's far from being bulletproof. (p.s. i'm using python)

    Read the article

  • Cannot implicitly convert type 'string' to 'System.Web.UI.WebControls.Unit'

    - by user203127
    hi, I ma getting error like Cannot implicitly convert type 'string' to 'System.Web.UI.WebControls.Unit' in the following code. How to fix this. protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { RadTab tab = new RadTab(); tab.Text = string.Format("New Page {0}", 1); RadTabStrip1.Tabs.Add(tab); RadPageView pageView = new RadPageView(); pageView.Height = "100px"; RadMultiPage1.PageViews.Add(pageView); BuildPageViewContents(pageView, RadTabStrip1.Tabs.Count); RadTabStrip1.SelectedIndex = 0; RadTabStrip1.DataBind(); } } Here I am getting error. pageView.Height = "100px"; How to fix this?

    Read the article

  • 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

  • Tokenize problem in Java with separator ". "

    - by user112976
    I need to split a text using the separator ". ". For example I want this string : Washington is the U.S Capital. Barack is living there. To be cut into two parts: Washington is the U.S Capital. Barack is living there. Here is my code : // Initialize the tokenizer StringTokenizer tokenizer = new StringTokenizer("Washington is the U.S Capital. Barack is living there.", ". "); while (tokenizer.hasMoreTokens()) { System.out.println(tokenizer.nextToken()); } And the output is unfortunately : Washington is the U S Capital Barack is living there Can someone explain what's going on?

    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

  • 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

  • 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

  • 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

  • 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

  • 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

< Previous Page | 161 162 163 164 165 166 167 168 169 170 171 172  | Next Page >