Search Results

Search found 1121 results on 45 pages for 'quotes'.

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

  • Android quotes within an sql query string

    - by miannelle
    I want to perform a query like the following: uvalue = EditText( some user value ); p_query = "select * from mytable where name_field = '" + uvalue + "'" ; mDb.rawQuery( p_query, null ); if the user enters a single quote in their input it crashes. If you change it to: p_query = "select * from mytable where name_field = \"" + uvalue + "\"" ; it crashes if the user enters a double quote in their input. and of course they could always enter both single and double quotes.

    Read the article

  • shell_exec escaping quotes in php for Twitter API --> Getting CURL to work with obscure twitter api

    - by yc10
    I'm using shell_exec() to execute a Twitter API Call. shell_exec('curl -u user:password -d "id=3191321" http://api.twitter.com/1/twitterapi/twitterlist/members.xml'); That works fine when I authenticate correctly and put in a number for the id. But when I try to put in a variable ($id), it screws up. $addtolist = shell_exec('curl -u pxlist:Weekend1 -d "id='.$id.'" http://twitter.com/username/twitterlist/members.xml'); I tried flipping the quote types $addtolist = shell_exec("curl -u pxlist:Weekend1 -d 'id=$id' http://twitter.com/username/twitterlist/members.xml"); I tried using double quotes and escaping them $addtolist = shell_exec("curl -u pxlist:Weekend1 -d \"id=$id\" http://twitter.com/username/twitterlist/members.xml"); None of them worked. What am I doing wrong? EDIT: The purists say I should be using PHP's built in curl methods, not the shell_exec. That's not working either. $url = 'http://twitter.com/user/list/members.xml'; // Set up and execute the curl process $curl_handle = curl_init(); curl_setopt($curl_handle, CURLOPT_URL, "$url"); curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl_handle, CURLOPT_POST, 1); curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "id=$id"); curl_setopt($curl_handle, CURLOPT_USERPWD, "user:pw"); $buffer = curl_exec($curl_handle); curl_close($curl_handle); It returns bool(false), and doesn't properly update the Twitter List in question (the whole point of the exercise)

    Read the article

  • How to suppress quotes in Powershell commands to executables

    - by David Gladfelter
    Is there any way to supress the enclosing quotation marks around each command-line argument that powershell likes to generate and then pass to external executables for command line arguments that have spaces in them? Here's the situation: One way to unpack many installers is a command of the form: msiexec /a <packagename> /qn TARGETDIR="<path to folder with spaces>" Trying to execute this from powershell has proven quite difficult. Powershell likes to enclose parameters with spaces in double-quotes. The following lines: msiexec /a somepackage.msi /qn 'TARGETDIR="c:\some path"' msiexec /a somepackage.msi /qn $('TARGETDIR="c:\some path"') $td = '"c:\some path"' msiexec /a somepackage.msi /qn TARGETDIR=$td All result in the following command line (as reported by the Win32 GetCommandLine() api): "msiexec" /a somepackage.msi /qn "TARGETDIR="c:\some path"" This command line: msiexec /a somepackage.msi TARGETDIR="c:\some path" /qn results in "msiexec" /a fooinstaller.msi "TARGETDIR=c:\some path" /qn It seems that Powershell likes to enclose the results of expressions meant to represent one argument in quotation marks when passing them to external executables. This works fine for most executables. However, MsiExec is very specific about the quoting rules it wants and won't accept any of the command lines Powershell generates for paths have have spaces in them. Is there any way to suppress this behavior?

    Read the article

  • Parsing tab delimited file with double quotes in Perl

    - by sfactor
    I have a data set that is tab delimited with the user-agent strings in double quotes. I need to parse each of these columns and based on the answer of my other post I used the Text::CSV module. 94410634 0 GET "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6.6; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; AskTB5.5)" 1 The code is a simple one. #!/usr/bin/perl use strict; use warnings; use Text::CSV; my $csv = Text::CSV->new(sep_char => "\t"); while (<>) { if ($csv->parse($_)) { my @columns = $csv->fields(); print "@columns\n"; } else { my $err = $csv->error_input; print "Failed to parse line: $err"; } } But i get the Failed to parse line: error when I try it on this dataset. what am I doing wrong? I need to extract the 4th column containing the user-agent strings for further processing.

    Read the article

  • SQL putting two single quotes around datetime fields and fails to insert record

    - by user82613
    I am trying to INSERT into an SQL database table, but it doesn't work. So I used the SQL server profiler to see how it was building the query; what it shows is the following: declare @p1 int set @p1=0 declare @p2 int set @p2=0 declare @p3 int set @p3=1 exec InsertProcedureName @ConsumerMovingDetailID=@p1 output, @UniqueID=@p2 output, @ServiceID=@p3 output, @ProjectID=N'0', @IPAddress=N'66.229.112.168', @FirstName=N'Mike', @LastName=N'P', @Email=N'[email protected]', @PhoneNumber=N'(254)637-1256', @MobilePhone=NULL, @CurrentAddress=N'', @FromZip=N'10005', @MoveInAddress=N'', @ToZip=N'33067', @MovingSize=N'1', @MovingDate=''2009-04-30 00:00:00:000'', /* Problem here ^^^ */ @IsMovingVehicle=0, @IsPackingRequired=0, @IncludeInSaveologyPlanner=1 select @p1, @p2, @p3 As you can see, it puts a double quote two pairs of single quotes around the datetime fields, so that it produces a syntax error in SQL. I wonder if there is anything I must configure somewhere? Any help would be appreciated. Here is the environment details: Visual Studio 2008 .NET 3.5 MS SQL Server 2005 Here is the .NET code I'm using.... //call procedure for results strStoredProcedureName = "usp_SMMoverSearchResult_SELECT"; Database database = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = database.GetStoredProcCommand(strStoredProcedureName); dbCommand.CommandTimeout = DataHelper.CONNECTION_TIMEOUT; database.AddInParameter(dbCommand, "@MovingDetailID", DbType.String, objPropConsumer.ConsumerMovingDetailID); database.AddInParameter(dbCommand, "@FromZip", DbType.String, objPropConsumer.FromZipCode); database.AddInParameter(dbCommand, "@ToZip", DbType.String, objPropConsumer.ToZipCode); database.AddInParameter(dbCommand, "@MovingDate", DbType.DateTime, objPropConsumer.MoveDate); database.AddInParameter(dbCommand, "@PLServiceID", DbType.Int32, objPropConsumer.ServiceID); database.AddInParameter(dbCommand, "@FromAreaCode", DbType.String, pFromAreaCode); database.AddInParameter(dbCommand, "@FromState", DbType.String, pFromState); database.AddInParameter(dbCommand, "@ToAreaCode", DbType.String, pToAreaCode); database.AddInParameter(dbCommand, "@ToState", DbType.String, pToState); DataSet dstSearchResult = new DataSet("MoverSearchResult"); database.LoadDataSet(dbCommand, dstSearchResult, new string[] { "MoverSearchResult" });

    Read the article

  • Changing commas within quotes

    - by user1822739
    I am trying to read the data in a text file which is separated by commas. My problem, is that one of my data pieces has a comma within it. An example of what the text file looks like is: a, b, "c, d", e, f. I want to be able to take the comma between c and d and change it to a semicolon so that I can still use the string.Split() method. using (StreamReader reader = new StreamReader("file.txt")) { string line; while ((line = reader.ReadLine ()) != null) { bool firstQuote = false; for (int i = 0; i < line.Length; i++) { if (line [i] == '"' ) { firstQuote = true; } else if (firstQuote == true) { if (line [i] == '"') { break; } if ((line [i] == ',')) { line = line.Substring (0, i) + ";" + line.Substring (i + 1, (line.Length - 1) - i); } } } Console.WriteLine (line); } } I am having a problem. Instead of producing a, b, "c; d", e, f, it is producing a, b, "c; d"; e; f. It is replacing all of the following commas with semicolons instead of just the comma in the quotes. Can anybody help me fix my existing code?

    Read the article

  • enclosing double quotes in array

    - by Jared
    Hi all I might be looking at this the wrong way, but I have a form that does its thing (sends emails etc etc) but I also put in some code to make a simple flatfile csv log with some of the user entered details. If a user accidentally puts in for instance 'himynameis","bob' this would either break the csv row (because the quotes weren't encapsulated) or if I use htmlspecialchars() and stripslashes() on the data, I end up with a ugly data value of 'himynameis&quot;,&quot;bob'. My question is, how can I handle the incoming data to cater for '"' being put in the form without breaking my csv file? this is my code for creating the csv log file. @$name = htmlspecialchars(trim($_POST['name'])); @$emailCheck = htmlspecialchars(trim($_POST['email'])); @$title = htmlspecialchars(trim($_POST['title'])); @$phone = htmlspecialchars(trim($_POST['phone'])); function logFile($logText) { $path = 'D:\logs'; $filename = '\Log-' . date('Ym', time()) . '.csv'; $file = $path . $filename; if(!file_exists($file)) { $logHeader = array('Date', 'IP_Address', 'Title', 'Name', 'Customer_Email', 'Customer_Phone', 'file'); $fp = fopen($file, 'a'); fputcsv($fp, $line); } $fp = fopen($file, 'a'); foreach ($logText as $record) { fputcsv($fp, $record); } } //Log submission to file $date = date("Y/m/d H:i:s"); $clientIp = getIpAddress(); //get clients IP address $nameLog = stripslashes($name); $titleLog = stripslashes($title); if($_FILES['uploadedfile']['error'] == 4) $filename = "No file attached."; //check if file uploaded and return $logText = array(array("$date", "$clientIp", "$titleLog", "$nameLog", "$emailCheck", "$phone", "$filename")); logFile($logText); //write form details to log Here is a sample of the incoming array data: Array ( [0] => Array ( [0] => 2010/05/17 10:22:27 [1] => xxx.xxx.xxx.xxx [2] => title [3] => """"himynameis","bob" [4] => [email protected] [5] => 346346 [6] => No file attached. ) ) TIA Jared

    Read the article

  • javascript - catch SyntaxError and run alternate function

    - by ludicco
    Hello there, I'm trying to build something on javascript that I can have an input that can be everything like string, xml, javascript and (non-javascript string without quotes) as follows: //strings eval("'hello I am a string'"); /* note the following proper quote marks */ //xml eval(<p>Hello I am a XML doc</p>); //javascript eval("var hello = 2+2;"); So this first 3 are working well since they are simple javascript native formats but when I try use this inside javascript //plain-text without quotes eval("hello I am a plain text without quotes"); //--SyntaxError: missing ; before statement:--// Obviously javascript interprets this as syntax error because it thinks its javascript throwing a SyntaxError. So what I would like to do it to catch this error and perform the adjustment method if this occurs. I've already tried with try catch but it doesn't work since it keeps returning the Syntax error as soon as it tries to execute the code. Any help would be much appreciated Cheers :) Additional Information: Imagine an external file that javascript would read, using spidermonkey, so it's a non-browser stuff(I can't use HttpRequest, DOM, etc...)..not sure if this matters, but there it is. :)

    Read the article

  • JSON.parse string with quotes

    - by mjsilva
    Hi, I've this: JSON.parse('{"130.00000001":{"p_cod":"130.00000001","value":"130.00000001 HDD Upgrade to 2x 250GB HDD 2.5\" SATA2 7200rpm"}}'); http://www.jsonlint.com/ says it's perfectly valid json. But on execution I have a JSON.parse error. But, if I change my code to: JSON.parse('{"130.00000001":{"p_cod":"130.00000001","value":"130.00000001 HDD Upgrade to 2x 250GB HDD 2.5\\" SATA2 7200rpm"}}'); (note the double backslash) It works, but now jsonlint gives me invalid json :/ Can someone help to understand this behavior?

    Read the article

  • Removing white space inside quotes in XSLT

    - by fudgey
    I'm trying to format a table from XML. Lets say I have this line in the XML <country>Dominican Republic</country> I would like to get my table to look like this <td class="country DominicanRepublic">Dominican Republic</td> I've tried this: <td class="country {country}"><xsl:value-of select="country"/></td> then this: <xsl:element name="td"> <xsl:attribute name="class"> <xsl:text>country </xsl:text> <xsl:value-of select="normalize-space(country)"/> </xsl:attribute> <xsl:value-of select="country"/> </xsl:element> The normalize-space() doesn't remove the space between the two parts of the name and I can't use <xsl:strip-space elements="country"/> because I need the space when I display the name inside the table cell. How can I strip the space from the value inside the class, but not the text in the cell?

    Read the article

  • Mysql Real Escape String PHP Function Adding "\" to My Field Entry

    - by Jascha
    Hello, I am submitting a form to my mySql database using PHP. I am sending the form data through the mysql_real_escape_string($content); function. When the entry shows up in my database (checking in myPhpAdmin) all of my double quotes and single quotes are escaped. I'm fairly certain this is a PHP configuration issue? so: $content = 'Hi, my name is Jascha and my "favorite" thing to do is sleep'; mysql_real_escape_string($content); $query = 'INSERT INTO DB...' comes up in my database as: Hi, my name is Jascha and my \"favorite" thing to do is sleep Who do I tell what to do? (I cannot access the php.ini). -J

    Read the article

  • Rails escape_javascript creates invalid JSON by escaping single quotes

    - by Arrel
    The escape_javascript method in ActionView escapes the apostrophe ' as backslash apostrophe \', which gives errors when parsing as JSON. For example, the message "I'm here" is valid JSON when printed as: {"message": "I'm here"} But, <%= escape_javascript("I'm here") %> outputs "I\'m here", resulting in invalid JSON: {"message": "I\'m here"} Is there a patch to fix this, or an alternate way to escape strings when printing to JSON?

    Read the article

  • Why Spark viewengine renders unnecessary (or unexpected) quotes?

    - by Arnis L.
    If i add pageBaseType="Spark.Web.Mvc.SparkView" in my web.config (necessary to fix intellisense), somehow it does not render links (probably not only) correctly anymore. This is how it's supposed to look like (and does, if page base type is not specified)= This is how it looks when base type is specified= Chrome source viewer shows identical page source code for both cases= <body> <div class="content"> <div class="navigation"> <a href="/Employee/List">Employees</a> <a href="/Product/List">Products</a> <a href="/Store/List">Stores</a> <div class="navigation_title"> Navigation</div> </div> <div class="main"> <div class="content"> <h2>Employees</h2>Nothing found... &lt;a href=&quot;/Employee/Create&quot;&gt;Create&lt;/a&gt; </div> </div> </div> </body> Developer tools does not= So - why my link gets htmlencoded (if that's what happens)? If it's default behavior, then how to render raw html? Using latest Spark version, rebuilt with Asp.Net Mvc2 RC assemblies.

    Read the article

  • I need free index/fund/stock end of day quotes in CSV

    - by Janne Mikkola
    Hello, I need (free or cheap) source for end of day stock/mutual funds/index values. Major world indexes & European stocks are primary intrest. I keep seeing that yahoo/ google/ MS offer this data, yet I cant find HOWTO doc (or similar) on getting the data. Reuters is an option - ~$300/month puts it out of my range. Sample of what I am looking for: WMX.IDX,20100326,54.49,54.6,54.17,54.41,0 XAH.IDX,20100326,52.39,52.77,52.33,52.54,0 XAL.IDX,20100326,37.34,38.4,37.34,37.59,0 XAO.IDX,20100326,4896.2998,4905.2002,4848.2998,4905.2002,0 I wish to get this data into txt file in an automated manner. My platform is Linux, (I also have pc with windows & emulator in for win in linux so windows is an option) http://www.eoddata.com/ is best site I have found so far. This is quite good yet I desire more info on european finances. Please advice! Sincerely, Janne

    Read the article

  • Mysql storing quotes as &#39;

    - by Click Upvote
    I have some PHP code which stores whatever is typed in a textbox in the databse. If I type in bob's apples, it gets stored in the database as bob&#39;s apples. What can be the problem? The table storing this has the collation of latin1_swedish_ci.

    Read the article

  • c#: how do i search for a string with quotes

    - by every_answer_gets_a_point
    i am searching for this string: <!--m--><li class="g w0"><h3 class=r> within the html source of this link: "http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=Santarus Inc?" this is how i am searching for it: d=html.IndexOf(@"<!--m--><li class=""g w0""><h3 class=r><a href=""",1); for some reason it is finding an occurence of it that is incorrect. (it says that it is at position 45 (another words d=45) but this incorrect here are the first couple hundred characters of the string html: <!doctype html><head><title>Santarus Inc&#8206; - Google Search</title><script>window.google={kEI:\"b6jES5nPD4rysQOokrGDDQ\",kEXPI:\"23729,24229,24249,24260,24414,24457\",kCSI:{e:\"23729,24229,24249,24260,24414,24457\",ei:\"b6jES5nPD4rysQOokrGDDQ\",expi:\"23729,24229,24249,24260,24414,24457\"},ml:function(){},kHL:\"en\",time:function(){return(new Date).getTime()},log:function(b,d,c){var a=new Image,e=google,g=e.lc,f=e.li;a.onerror=(a.onload=(a.onabort=function(){delete g[f]}));g[f]=a;c=c||\"/gen_204?atyp=i&ct=\"+b+\"&cad=\"+d+\"&zx=\"+google.time();a.src=c;e.li=f+1},lc:[],li:0,Toolbelt:{}};\nwindow.google.sn=\"web\";window.google.timers={load:{t:{start:(new Date).getTime()}}};try{}catch(u){}window.google.jsrt_kill=1;\n</script><style>body{background:#fff;color:#000;margin:3px 8px}#gbar,#guser{font-size:13px;padding-top:1px !important}#gbar{float:left;height:22px}#guser{padding-bottom:7px !important;text-align:right}.gbh,.gbd{border-top:1px solid #c9d7f1;font-size:1px}.gbh

    Read the article

  • Regex Help matching quotes

    - by Farhan
    Hi Guys, I havin a reg ex problemm i would like to have a reg ex that will match the '\nGO at the end of my file(see below.) I have got the following so far: ^\'*GO but its match the quote sysbol? EOF: WHERE (dbo.Property.Archived <> 1) ' GO

    Read the article

  • Pyparsing CSV string with random quotes

    - by gtfx
    Hey, I have a string like the following: <118date=2010-05-09,time=16:41:27,device_id=FE-2KA3F09000049,log_id=0400147717,log_part=00,type=statistics,subtype=n/a,pri=information,session_id=o49CedRc021772,from="[email protected]",mailer="mta",client_name="example.org,[194.177.17.24]",resolved=OK,to="[email protected]",direction="in",message_length=6832079,virus="",disposition="Accept",classifier="Not,Spam",subject="=?windows-1255?B?Rlc6IEZ3OiDg5fDp5fog+fno5fog7Pf46eHp7S3u4+Tp7SE=?=" I tried using CSV module and it didn't fit, cause i haven't found a way to ignore what's quoted. Pyparsing looked like a better answer but i haven't found a way to declare all the grammars. Currently, i am using my old Perl script to parse it, but i want this written in Python. if you need my Perl snippet i will be glad to provide it. Any help is appreciated.

    Read the article

  • Haskell: variant of `show` that doesn't wrap String and Char in quotes

    - by Joey Adams
    I'd like a variant of show (let's call it label) that acts just like show, except that it doesn't wrap Strings in " " or Chars in ' '. Examples: > label 5 "5" > label "hello" "hello" > label 'c' "c" I tried implementing this manually, but I ran into some walls. Here is what I tried: {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE UndecidableInstances #-} module Label where class (Show a) => Label a where label :: a -> String instance Label [Char] where label str = str instance Label Char where label c = [c] -- Default case instance Show a => Label a where label x = show x However, because the default case's class overlaps instance Label [Char] and instance Label Char, those types don't work with the label function. Is there a library function that provides this functionality? If not, is there a workaround to get the above code to work?

    Read the article

  • real time stock quotes, StreamReader performance optimization

    - by sean717
    I am working on a program that extracts real time quote for 900+ stocks from a website. I use HttpWebRequest to send HTTP request to the site and store the response to a stream and open a stream using the following code: HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream stream = response.GetResponseStream (); StreamReader reader = new StreamReader( stream ) the size of the received HTML is large (5000+ lines), so it takes a long time to parse it and extract the price. For 900 files, It takes about 6 mins for parsing and extracting. Which my boss isn't happy with, he told me he'd want the whole process to be done in TWO mins. I've identified the part of the program that takes most of time to finish is parsing and extracting. I've tried to optimize the code to make it faster, the following is what I have now after some optimization: // skip lines at the top for(int i=0;i<1500;++i) reader.ReadLine(); // read the line that contains the price string theLine = reader.ReadLine(); // ... extract the price from the line now it takes about 4 mins to process all the files, there is still a significant gap to what my boss's expecting. So I am wondering, is there other way that I can further speed up the parsing and extracting and have everything done within 2 mins?

    Read the article

  • why limxml2 quotes starting double slash in CDATA with javascript

    - by Vincenzo
    This is my code: <?php $data = <<<EOL <?xml version="1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <script type="text/javascript"> //<![CDATA[ var a = 123; // JS code //]]> </script> </html> EOL; $dom = new DOMDocument(); $dom->preserveWhiteSpace = false; $dom->formatOutput = false; $dom->loadXml($data); echo '<pre>' . htmlspecialchars($dom->saveXML()) . '</pre>'; This is result: <?xml version="1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <script type="text/javascript"><![CDATA[ //]]><![CDATA[ var a = 123; // JS code //]]><![CDATA[ ]]></script></html> If and when I remove the DOCTYPE notation from XML document, CDATA works properly and leading/trailing double slash is not turned into CDATA. What is the problem here? Bug in libxml2? PHP version is 5.2.13 on Linux. Thanks.

    Read the article

  • ahow can I resolve Django Error: str' object has no attribute 'autoescape'?

    - by Angelbit
    Hi have tried to create a inclusion tag on Django but don't work and return str' object has no attribute 'autoescape' this is the code of custom tag: from django import template from quotes.models import Quotes register = template.Library() def show_quote(): quote = Quotes.objects.values('quote', 'author').get(id=0) return {'quote': quote['quote']} register.inclusion_tag('quotes.html')(show_quote) EDIT: Quote class from django.db import models class Quotes(models.Model): quote = models.CharField(max_length=255) author = models.CharField(max_length=100) class Meta: db_table = 'quotes' quotes.html <blockquote id="quotes">{{ quote }}</blockquote>

    Read the article

  • replacing text within quotes until next quote

    - by Jordan Trainor
    String input = "helloj\"iojgeio\r\ngsk\\"jopri\"gj\r\negjoijisgoe\"joijsofeij\"\"\"ojgsoij\""; This is my current code that works but iv added some code that has to run before this which makes some '"' split onto another line thus making the code below obsolute unless under certain cirumstances the '"' is not put onto the next line. firstQuote = input.IndexOf("\""); lastQuote = input.LastIndexOf("\""); input = input.Substring(0, firstQuote) + "<span>quote" + input.Substring(firstQuote + 1, lastQuote - (firstQuote + 1) + "quote</span>" + input.Substring(lastQuote + 1, lines.Length - (lastQuote + 1); How could I change the input string from input = "helloj\"iojgeio\r\ngsk\\"jopri\"gj\r\negjoijisgoe\"joijsofeij\"\"\"ojgsoij\""; to input = "helloj(<span>quoteiojgeio\r\ngsk\\"jopriquote</span>gj\r\negjoijisgoe<span>quotejoijsofeijquote</span>quote<span>quote</span>ojgsoij<span>quote</span>";

    Read the article

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