Daily Archives

Articles indexed Sunday March 28 2010

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

  • All symbols after & stripped

    - by user300413
    My query: mysql::getInstance()->update('requests', array('response' => mysql_real_escape_string($_POST['status'])), array('secret' => $_POST['secret'])); ?> If i wand to add string with "&" symbol, all symbols after "&" stripped. Example: string: !"?;%:?*()_+!@#$%^&*()_+ in database i see only: !"?;%:?*()_+!@#$%^ How to fix this? update function, if anyone need: function update($table, $updateList, $whereConditions) { $updateQuery = ''; foreach ($updateList as $key => $newValue) { if (!is_numeric($newValue)) { $newValue = "'" . $newValue . "'"; } if (strlen($updateQuery) == 0) { $updateQuery .= '`' . $key . '` = ' . $newValue; } else { $updateQuery .= ', `' . $key . '` = ' . $newValue; } } return $this->query('UPDATE ' . $table . ' SET ' . $updateQuery . $this->buildWhereClause($whereConditions)); }

    Read the article

  • How does session_start lock in PHP?

    - by Morgan Cheng
    Originally, I just want to verify that session_start locks on session. So, I create a PHP file as below. Basically, if the pageview is even, the page sleeps for 10 seconds; if the pageview is odd, it doesn't. And, session_start is used to obtain the page view in $_SESSION. I tried to access the page in two tabs of one browser. It is not surprising that the first tab takes 10 seconds since I explicitly let it sleep. The second tab would not sleep, but it should be blocked by sessiont_start. That works as expected. To my surprise, the output of the second page shows that session_start takes almost no time. Actually, the whole page seems takes no time to load. But, the page does take 10 seconds to show in browser. obtained lock Cost time: 0.00016689300537109 Start 1269739162.1997 End 1269739162.1998 allover time elpased : 0.00032305717468262 The page views: 101 Does PHP extract session_start out of PHP page and execute it before other PHP statements? This is the code. <?php function float_time() { list($usec, $sec) = explode(' ', microtime()); return (float)$sec + (float)$usec; } $allover_start_time = float_time(); $start_time = float_time(); session_start(); echo "obtained lock<br/>"; $end_time = float_time(); $elapsed_time = $end_time - $start_time; echo "Cost time: $elapsed_time <br>"; echo "Start $start_time<br/>"; echo "End $end_time<br/>"; ob_flush(); flush(); if (isset($_SESSION['views'])) { $_SESSION['views'] += 1; } else { $_SESSION['views'] = 0; } if ($_SESSION['views'] % 2 == 0) { echo "sleep 10 seconds<br/>"; sleep(10); } $allover_end_time = float_time(); echo "allover time elpased : " . ($allover_end_time - $allover_start_time) . "<br/>"; echo "The page views: " . $_SESSION['views']; ?>

    Read the article

  • Anti-Joel Test

    - by Vaibhav Garg
    The Joel Test is a measure of how a team performs with regards to the best practices in coding. What questions, given a 'yes' answer, would subtract from the the Joel test score? (Assuming you don't simply negate the current questions on the 'Joel Test', ie: "Do you have no source control?") For example: Does the company insist on being very process heavy?

    Read the article

  • Strange IE7 behaviors(or not)

    - by c0mrade
    I see no reason why this shouldn't work in all browsers, here is my css for anchor tag : .myButton{ background:none repeat scroll 0 0 #FFFFFF; border:1px solid #D8DFEA !important; color:#3B5998; cursor:pointer; font-size:20px; padding:10px; } Here is how it looks in IE7 : And here is how it looks in other browsers : HTML is nothing unusual as well : <a href="#" class="myButton">Beta</a> All of this is inside table, this anchor html is wrapped around with : <tr> <td><a>...</a></td> <tr> I don't think this has to do it with anything but I mentioned it just in case, so the button is missing border top, any indications what might cause this?

    Read the article

  • Making bash script to check connectivity and change connection if necessary. Help me improve it?

    - by cypherpunks
    My connection is flaky, however I have a backup one. I made some bash script to check for connectivity and change connection if the present one is dead. Please help me improve them. The scripts almost works, except for not waiting long enough to receive an IP (it cycles to next step in the until loop too quick). Here goes: #!/bin/bash # Invoke this script with paths to your connection specific scripts, for example # ./gotnet.sh ./connection.sh ./connection2.sh until [ -z "$1" ] # Try different connections until we are online... do if eval "ping -c 1 google.com" then echo "we are online!" && break else $1 # Runs (next) connection-script. echo fi shift done echo # Extra line feed. exit 0 And here is an example of the slave scripts: #!/bin/bash ifconfig wlan0 down ifconfig wlan0 up iwconfig wlan0 key 1234567890 iwconfig wlan0 essid example sleep 1 dhclient -1 -nw wlan0 sleep 3 exit 0

    Read the article

  • XmlTextReader issue

    - by Stanislav Palatnik
    I'm try to parse this xml, but c# keeps throwing an exception saying it has invalid characters. I can't copy the text from the messagebox directly, so I've screened it. http://img29.imageshack.us/img29/694/xmler.jpg Here's the code to get the string string strRetPage = System.Text.Encoding.GetEncoding(1251).GetString(RecvBytes, 0, bytes); while (bytes > 0) { bytes = socket.Receive(RecvBytes, RecvBytes.Length, 0); strRetPage = strRetPage + System.Text.Encoding.GetEncoding(1251).GetString(RecvBytes, 0, bytes); } int start = strRetPage.IndexOf("<?xml"); string servReply = strRetPage.Substring(start); servReply = servReply.Trim(); servReply = servReply.Replace("\r", ""); servReply = servReply.Replace("\n", ""); servReply = servReply.Replace("\t", ""); XmlTextReader txtRdr = new XmlTextReader(servReply);

    Read the article

  • Convert a MSSQL database to MYSQL database

    - by soldieraman
    Alright so I want to convert an already exist MSSQL database (2005) to a MYSQL database. There is nothing extraordinary to be done The only things I need to achieve is Recreate the tables Transfer data Relationships would be nice but not necessary No views, no sprocs, no functions. Any easy way to do this. Also do you know of any DST (Database Synchronization Tool) which would let me do MSSQL to MYSQL MYSQL to MYSQL MSSQL to MSSQL (I know there is SQL Delta for this)

    Read the article

  • How to prevent Windows XP from stealing my input Ctrl-Space which is meant for Emacs

    - by Dean
    I am learning and using Emacs. What I found annoying is that Ctrl-Space input will be stolen by Windows XP to switch the language bar instead of setting the mark in Emacs. The "language bar" is the native input languages selection such as Chinese keyboard other than English keyboard. Is there a way to temporarily prevent XP from stealing it? I have disabled the language bar from "Regional and language options" from Control Panel but the problem still exists. It doesn't happen on my Windows 2000 desktop at office but it happens on my work Windows XP laptop. Thank you very much.

    Read the article

  • problem connecting to datasource defined in freetds.conf

    - by pkaeding
    I can connect successfully to my database using tsql when I bypass the freetds.conf file, like so: % TDSVER=8.0 tsql -H 10.100.102.202 -p 1086 -U sa After I enter my password, I am presented with a 1> prompt, and it is ready for my commands. However, if I try to connect using the definition in my freetds.conf file, like this: % tsql -S Millie -U sa after entering my password, it seems to be trying to generate a prompt, but it just keeps counting. I will see 1, followed by 2, etc, without ever displaying a > character. Here is what I have for my freetds.conf: [global] # TDS protocol version tds version = 8.0 text size = 64512 [Millie] host = 10.100.102.202 port = 1086 What could be causing this anomaly? If it helps, here is the output of tsql -C: % tsql -C Compile-time settings (established with the "configure" script) Version: freetds v0.82 freetds.conf directory: /usr/local/etc MS db-lib source compatibility: no Sybase binary compatibility: no Thread safety: yes iconv library: yes TDS version: 5.0 iODBC: no unixodbc: no

    Read the article

  • CodeIgniter's Scaffolding not working

    - by 01010011
    Hi, I keep getting a 404 Page Not Found whenever I try to access CodeIgniter's Scaffolding page in my browser, like so: localhost/codeignitor/index.php/blog/scaffolding/mysecretword I can access localhost/codeignitor/index.php/blog just fine. I followed CodeIgnitor's instructions in their "Create a blog in 20 minutes" by storing my database settings in the database.php file; and automatically connecting to the database by inserting "database" in the core array of the autoload.php; and I've added both parent::Controller(); and $this-load-scaffolding('myTableName') to blog's constructor. It still gives me this 404. Any suggestions?

    Read the article

  • Xfce power manager warns HAL daemon is not running, no keyboard on startup on Ubuntu

    - by Macha
    I changed my grub boot options to add "vga=0x323" to them to resolve some issues with corrupted display during startup/shutdown on my laptop. The next time I booted the system up, I got a warning over the login screen saying Xfce Power Manager HAL Daemon not running The keyboard and mouse are unresponsive. After a minute or so, they start to work and the system functions as normal. How can I solve this?

    Read the article

  • SQLAuthority News – Author Visit to Nepal TechMela – 2 Technical Sessions

    - by pinaldave
    Microsoft MDP Nepal is going to organize a Tech Mela for the IT community of Nepal on March 29 & 30, 2010 (2066 Chaitra 16 & 17), Monday and Tuesday,  at the Russian Center for Science & Culture, Kamalpokhari, Kathmandu. The objective of the event is to enhance and exchange knowledge about Information Technology, as well as Microsoft products and technologies, with the IT community. I am very excited to attend this one-of-a-kind event in Nepal. I will be giving two presentations in the said event, which includes: 1) Become An Efficient Developer – Learn The Tricks of SQL Server Management Studio (SSMS) There are so many features in SQL Server Management Studio that we may not know or use all of them. This presentation will impart tricks and tips of SQL Server Management Studio to the event goers. This aims to make you an efficient developer by having an edge over the other developers. 2) Good, Bad and Ugly: The Story of Index Index is often considered as the sure shot tool of improving the performance of any query. Learn the basics with examples and discover the good, bad and ugly sides of Index. This session will help you efficiently write queries in future. I am very excited to attend this special event as this is the very first time I will be presenting in technical sessions in Nepal. If you are in Nepal, I strongly suggest that you go to this once-in a lifetime IT fair. Reference : Pinal Dave (http://blog.SQLAuthority.com) Filed under: Pinal Dave, SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, SQLAuthority Author Visit, SQLAuthority News, T SQL, Technology

    Read the article

  • .NET MVC Ajax Form - How do you hide it?

    - by Tommy
    Ok, everything is 'functionally' working with what I am attempting to accomplish and once again, I am sure this is something dumb, but I cannot figure out how to do this one thing. I have an edit form for an entity, lets say a car. This 'car' can have 0 - many passengers. So on my edit form, I have all the fields for the car, then a list view showing each passenger (partial). I also have a 'add new passenger' button that will render a new partial view that allows you to enter a passenger. This has a cancel link and an add button to submit an Ajax form. When you add a passenger, the passenger is automatically added to the list, but I need the enter passenger form to go away. I have tried using the onSuccess and onComplete functions to hide the div that the form is in, but both render just the partial view HTML elements (white screen, text) and not the partialView in the context of the entire page. Sources: 1) Main Edit View <script type="text/javascript"> Function hideForm(){ document.getElementById('newPassenger').style.display = 'none'; } </script> <h2>Edit</h2> <%-- The following line works around an ASP.NET compiler warning --%> <%= ""%> <%Html.RenderPartial("EditCar", Model)%> <h2>Passengers for this car</h2> <%=Ajax.ActionLink("Add New Passenger", "AddPassenger", New With {.ID = Model.carID}, New AjaxOptions With {.UpdateTargetId = "newPassenger", .InsertionMode = InsertionMode.Replace})%> <div id="newPassenger"></div> <div id="passengerList"> <%Html.RenderPartial("passengerList", Model.Passengers)%> </div> <div> <%= Html.ActionLink("Back to List", "Index") %> </div> 2) AddPassenger View. The cancel link below is an action that returns nothing, thus removing the information in the div. <% Using Ajax.BeginForm("AddPassengerToCar", New With {.id = ViewData("carID")}, New AjaxOptions With {.UpdateTargetId = "passengerList", .InsertionMode = InsertionMode.Replace})%> <%=Html.DropDownList("Passengers")%> <input type="submit" value="Add" /> <%=Ajax.ActionLink("Cancel", "CancelAddControl", _ New AjaxOptions With {.UpdateTargetId = "newPassenger", .InsertionMode = InsertionMode.Replace})%><% end using %>

    Read the article

  • PHP: Convert curl_exec output to UTF8

    - by Paul Tarjan
    I would like to only work with UTF8. The problem is I don't know the charset of every webpage. How can I detect it and convert to UTF8? <?php $url = "http://vkontakte.ru"; $ch = curl_init($url); $options = array( CURLOPT_RETURNTRANSFER => true, ); curl_setopt_array($ch, $options); $data = curl_exec($ch); // $data = magic($data); print $data; See this at: http://paulisageek.com/tmp/curl-utf8 What is magic()?

    Read the article

  • Class for move, scale and rotate, of a uiimageview

    - by David
    Hi Everyone, I'm creating a subclass of UIImageView that detects touches, and will move, rotate and scale the image based on the touches. However, I really feel like I'm reinventing the wheel here, and it's driving me nuts. Shouldn't this already exist somewhere? Does anyone have any examples, or links to a class that is already doing this? Or if you have a class you've written, that'd be helpful too. Thanks a lot in advance.

    Read the article

  • Why is the Clojure Hello World program so slow compared to Java and Python?

    - by viksit
    Hi all, I'm reading "Programming Clojure" and I was comparing some languages I use for some simple code. I noticed that the clojure implementations were the slowest in each case. For instance, Python - hello.py def hello_world(name): print "Hello, %s" % name hello_world("world") and result, $ time python hello.py Hello, world real 0m0.027s user 0m0.013s sys 0m0.014s Java - hello.java import java.io.*; public class hello { public static void hello_world(String name) { System.out.println("Hello, " + name); } public static void main(String[] args) { hello_world("world"); } } and result, $ time java hello Hello, world real 0m0.324s user 0m0.296s sys 0m0.065s and finally, Clojure - hellofun.clj (defn hello-world [username] (println (format "Hello, %s" username))) (hello-world "world") and results, $ time clj hellofun.clj Hello, world real 0m1.418s user 0m1.649s sys 0m0.154s Thats a whole, garangutan 1.4 seconds! Does anyone have pointers on what the cause of this could be? Is Clojure really that slow, or are there JVM tricks et al that need to be used in order to speed up execution? More importantly - isn't this huge difference in performance going to be an issue at some point? (I mean, lets say I was using Clojure for a production system - the gain I get in using lisp seems completely offset by the performance issues I can see here). The machine used here is a 2007 Macbook Pro running Snow Leopard, a 2.16Ghz Intel C2D and 2G DDR2 SDRAM. BTW, the clj script I'm using is from here and looks like, #!/bin/bash JAVA=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java CLJ_DIR=/opt/jars CLOJURE=$CLJ_DIR/clojure.jar CONTRIB=$CLJ_DIR/clojure-contrib.jar JLINE=$CLJ_DIR/jline-0.9.94.jar CP=$PWD:$CLOJURE:$JLINE:$CONTRIB # Add extra jars as specified by `.clojure` file if [ -f .clojure ] then CP=$CP:`cat .clojure` fi if [ -z "$1" ]; then $JAVA -server -cp $CP \ jline.ConsoleRunner clojure.lang.Repl else scriptname=$1 $JAVA -server -cp $CP clojure.main $scriptname -- $* fi

    Read the article

  • StructureMap resolve dependency through injection instead of service location

    - by Chris Marisic
    In my project I register many ISerializers implementations with the assembly scanner. FWIW this is the code that registers my ISerializers Scan(scanner => { scanner.AssemblyContainingType<ISerializer>(); scanner.AddAllTypesOf<ISerializer>().NameBy(type => type.Name); scanner.WithDefaultConventions(); }); Which then correctly registers ISerializer (...ISerializer) Scoped as: Transient JsonSerializer Configured Instance of ...JsonSerializer BsonSerializer Configured Instance of ...BsonSerializer And so forth. Currently the only way I've been able to figure out how to resolve the serializer I want is to hardcode a service location call with jsonSerializer = ObjectFactory.GetNamedInstance<ISerializer>("JsonSerializer"); Now I know in my class that I specifically want the jsonSerializer so is there a way to configure a rule or similar that says for ISerializer's to connect the named instance based on the property name? So that I could have MySomeClass(ISerializer jsonSerializer, ....) And StructureMap correctly resolve this scenario? Or am I approaching this wrong and perhaps I should just register the concrete type that implements ISerializer and then just specifically use MySomeClass(JsonSerializer jsonSerializer, ....) for something along these lines with the concrete class?

    Read the article

  • What should I consider when deploying a new web farm?

    - by tsilb
    My web app has been chugging along just great in Production for years with one App server and one Web server. Now we're moving to a multi-server environment with 2 App and 3 Web servers. I have enough time to make changes before the go-live. As a Developer, what considerations should I take into account from coding, deployment, and architectural/ecosystem management perspectives? Already on my list: Remove tight-coupling between servers Applicable files (i.e. downloadables) stored in IMAGE fields in SQL instead of files on app server Deployment: Take out node out of the farm at a time

    Read the article

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