Unnamed: 0
int64
65
6.03M
Id
int64
66
6.03M
Title
stringlengths
10
191
input
stringlengths
23
4.18k
output
stringclasses
10 values
Tag_Number
stringclasses
10 values
5,526,181
5,526,182
How to build a streaming API in java?
<p>I want to build a Streaming API similar to Twitter Streaming API in java? what is needed to do so ? does need to use a special tomcat configuration?</p> <p>Thanks</p>
java
[1]
3,493,268
3,493,269
Get contact name of the sender from the sms table?
<p>Hii i am using the following to get the sms from the inbox </p> <pre><code>ContentResolver cr = getContentResolver(); Cursor cur = cr.query(Uri.parse("content://sms"), null,null,null, null); DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); cursor_count=cur.getCount(); if(cur.moveToFirst()) { do { sender.add(cur.getString(2)); msg.add(cur.getString(11)); date.add(formatter.format(Long.parseLong(cur.getString(4)))); } while (cur.moveToNext()); </code></pre> <p>i get the address of the person from the address field but i also want to get the contact name of the sender if stored in my contacts ,the person field always returns null y?</p>
android
[4]
2,251,317
2,251,318
C++: Objects allocated on heap
<p>When we create an object using <em>new</em> it is allocated on the heap. But, what happens to the members of the class that we are instantiating? For example, </p> <pre><code>class foo { Bar x; Bar *y; foo() { x = 10; y = new Bar(); } } </code></pre> <p>Here, x is an object while y is an instance of Bar. Are they both allocated on the heap? So if an object of foo <em>F</em> is created locally inside a method, what will happen to <em>y</em> when F goes out of scope?</p> <p>Also, if <em>F</em> is created on the heap, when will we conclude that <em>F</em> is dangling (no one pointing to it)? Because, there may be no references to F but there may be references to <em>Y</em>.</p>
c++
[6]
2,723,571
2,723,572
Comparing Java Beans with BeanComparator
<p>I am trying to compare 2 beans of the same class and determine what part of the beans (if any) do not match. This may include beans with internally nested beans of another class, but for the most part the classes will be matching. Basically I want to derive the first class from the database and compare it with a new copy which will inevitably update the data in the database that is not already the same as whats currently in there.</p> <p>So basically I will need to loop through each variable in the bean and compare it with bean 2. If it matches...move onto the next. If it does not match, return the index of the variable so I know what field to update in the database. </p> <p>Is this something I can do with apache commons BeanComparator? Or will I have to come up with my own custom tool?</p>
java
[1]
3,343,879
3,343,880
Want to strip a particular Character
<p>Guys,currently I'm using this:</p> <pre><code>$meta = htmlspecialchars($m); </code></pre> <p>This one is stripping all the HTML chars..But i want to just remove "&lt;" and ">"</p> <p>How do i do it ?</p> <p>Thanks</p>
php
[2]
5,690,874
5,690,875
I've recently dabbled in JScript for backend development with Node.js, now where can I practice?
<p>I always like to practice new skills and use them in a realistic environment. I'm just not sure how to do this with backend web development. What are some ways where one can use web skills in a practical environment?</p>
javascript
[3]
6,014,729
6,014,730
How should I execute Javascript files independently?
<p>Let's say I had an array of Javascript file names:</p> <pre><code>["funScriptStuff.js", "jQuery.js", "dojo.js", "scriptyScript.js"] </code></pre> <p>how could I execute them independently of each other? </p> <p>For example, let's suppose one script did some evil stuff like </p> <pre><code>var undefined = true; var window = "Windows 98"; </code></pre> <p>and another script had code that relied on these global variables being unsabotaged</p> <pre><code>if (a !== undefined) { window.open(url); } </code></pre> <p>if the first script ran first, it would ruin everything in the second one. Without changing anything in these script files, how can I run them independently of each other to prevent them from messing each other up?</p> <p><strong>EDIT:</strong> I am not asking what Javascript patterns to use to prevent namespace collisions, like wrapping my code in a big closure and so forth. I know about those. I'm trying to create an environment where you can run arbitrary scripts that I have no control over without them stepping on each other's toes.</p>
javascript
[3]
1,612,167
1,612,168
simple string question - the Single quotation marks and Double quotation marks inside the string just make the string into several parts
<p>I need to use a long string for testing regular expression. However, the test string is always altered by the inside quotation marks, which leads to the whole string seperetaed into several parts and some of them are not included into the string, and thus error occurred.</p> <pre><code> str1=r"row Id="7" PostTypeId="2" ParentId="4" \n CreationDate="2008-07-31T22:17:57.883"\n Score="49" ViewCount="0" Body="&lt;p&gt;An explicit cast to double i" </code></pre> <p>Would you pleae tell me how to tackle this? Thanks a lot.</p>
python
[7]
2,196,046
2,196,047
Syntax error in aggregate argument: Expecting a single column argument with possible 'Child' qualifier
<pre><code>DataTable distinctTable = dTable.DefaultView.ToTable(true,"ITEM_NO","ITEM_STOCK"); DataTable dtSummerized = new DataTable("SummerizedResult"); dtSummerized.Columns.Add("ITEM_NO",typeof(string)); dtSummerized.Columns.Add("ITEM_STOCK",typeof(double)); int count=0; foreach(DataRow dRow in distinctTable.Rows) { count++; //string itemNo = Convert.ToString(dRow[0]); double TotalItem = Convert.ToDouble(dRow[1]); string TotalStock = dTable.Compute("sum(" + TotalItem + ")", "ITEM_NO=" + dRow["ITEM_NO"].ToString()).ToString(); dtSummerized.Rows.Add(count,dRow["ITEM_NO"],TotalStock); } </code></pre> <p>Error Message: Syntax error in aggregate argument: Expecting a single column argument with possible 'Child' qualifier.</p> <p>Do anyone can help me out?</p> <p>Thanks.</p>
c#
[0]
3,058,606
3,058,607
jQuery focusout()
<p>I have a login box that slides/toggles up and down when an <code>&lt;a&gt;</code> link is clicked.</p> <p>This is a DIV that is around 150px by 100px is size.</p> <p>When someone clicks outside this DIV I want the DIV to slide backup. I've been playing with focusout() but I must have the wrong function.</p> <p>Any advice? code below.</p> <pre><code>$('a#member_login').click(function(event) { event.preventDefault(); $('div#member_login_container').slideToggle(); }); // Hide Login Box if Click outside the Login Box $('div#member_login_container').focusout(function(event) { alert('here'); //$('div#member_login_container').slideUp(); }); </code></pre>
jquery
[5]
3,453,954
3,453,955
PHP include problem, not sure what the problem is
<pre><code>&lt;?php $city = $_GET["city"]; $prov = $_GET["prov"]; $file = "citycountdetails.php?city=".$city."&amp;prov=".$prov.""; ?&gt; &lt;?php include $file; ?&gt; </code></pre> <p>Warning: include(citycountdetails.php?city=Halifax&amp;prov=NS) [function.include]: failed to open stream: No such file or directory in ....</p> <p>Not sure what I am doing wrong...</p> <p>Thanks</p>
php
[2]
2,294,248
2,294,249
Regular expression to remove last word in a string?
<pre><code>I have a string like this "87 CAMBRIDGE PARK DR".I have used the below regular expression to remove the last word "DR", but it also removing the word "PARK" also.. </code></pre> <p>Below is my code...</p> <pre><code>String regex = "[ ](?:dr|vi|tes)\\b\\.?"; /*regular expression format*/ String inputString ="87 CAMBRIDGE PARK DR"; /*input string */ Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(inputString); inputString = matcher.replaceAll(""); Now the out put is "87 CAMBRIDGE".. </code></pre> <p>But I need the out put as "87 CAMBRIDGE PARK"</p>
java
[1]
1,215,426
1,215,427
php eval function
<p>How to know that eval() is disabled or enabled in the web server.What is the php code to know this?Whether there is any php code to enable it , if it is disabled on the server?</p>
php
[2]
3,042,255
3,042,256
Unchecked unsafe operations
<p>I am getting a warning about unchecked unsafe operations. I am not quite sure why I am getting this warning, but does anyone know what exception I should be trying to catch and where? I am assuming that I getting this warning because I am not checking for possible exceptions.</p> <pre><code>import java.awt.*; import java.util.*; import java.awt.event.*; import javax.swing.*; public class Tokenizer{ public static String split( String string ) { TreeSet tree = new TreeSet(); StringTokenizer tokenizer = new StringTokenizer( string ); while ( tokenizer.hasMoreTokens() ) tree.add( tokenizer.nextToken() ); String result = tree.toString(); return result; }//end of split public static void main( String args[] ) { String str; Scanner input = new Scanner(System.in); System.out.println("Please input a string:"); str = input.nextLine(); split(str); }//end of main }//end of tokenizer </code></pre>
java
[1]
5,148,950
5,148,951
convert this link to POST mode
<p>How can I convert this $_GET method to $_POST method?</p> <pre><code>$linkword .= "\n&lt;A HREF=\"$self?letters=$alpha[$c]$letters&amp;n=$n\"&gt;$alpha[$c]&lt;/A&gt; "; </code></pre>
php
[2]
2,803,603
2,803,604
Editing Python scripts with Python
<p>I'm trying to permanently edit variables within a Python script' source.</p> <hr> <p>e.g.</p> <pre><code>urlpatterns = patterns('core.views', ) </code></pre> <p>to</p> <pre><code>urlpatterns = patterns('core.views', url(r'^admin/', include(admin.site.urls)), ) </code></pre> <hr> <p>e.g.</p> <pre><code>items = [ 'unicorn', 'cats', ] </code></pre> <p>to</p> <pre><code>items = [ 'unicorn', 'cats', 'knights', 'panthers', ] </code></pre> <hr> <h3>The problem is capturing the single variable, extending it and replacing it, source of the python file can be quite big and varied.</h3> <p>This has probably been done already, but cannot seem to find much around.</p> <p>Any ideas, tips or suggestions?</p> <hr> <h2>My solution for now:</h2> <p>I'm just going to add code at the bottom of the script file</p> <p>e.g.</p> <pre><code>urlpatterns += patterns('core.views', url(r'^admin/', include(admin.site.urls)), ) </code></pre> <p>works for now :)</p>
python
[7]
2,349,317
2,349,318
Javascript, Do While Loop multiple options
<p>Can you please explain and show the right answer:</p> <pre><code>&lt;p id="show"&gt;&lt;/p&gt; &lt;script&gt; var a = "word1"; var b = "word2"; do { color = prompt("Write a word1 or word2 to get out of loop", ""); } while (color != a || color != b); document.getElementById("show").innerHTML=color; &lt;/script&gt; </code></pre> <p>It works when I delete 'b' option and leave as is only with 'a' option. So how can I use it for multiple options? Also, if you have a solution to keep it simple if I had 15 options for example, it will be great!</p> <p>Thank you</p>
javascript
[3]
5,819,143
5,819,144
Making a form visible based on specific selection in a drop down field
<p>I have a dynamically populated drop down field . Depending on users selection from that drop down field i want to make additional fields in a form visible on the same page .I'm a newbie to ui development so i dont know much about jquery n stuff . is it possible to do it in plain javascript? Any help is appreciated. Thanks, Arun</p>
javascript
[3]
5,521,833
5,521,834
Java: Fizzy/JBOX2D Collision examples?
<p>recently I saw alot of people suggesting a external java library for handling 2D collisions. I decided to try one of these (Fizzy). I then decided to try fine some examples of how to use Fizzy, but I could not find any. Does anyone have any links or examples of the use of 2D collisions using Fizzy I would really appreciate it.</p> <p>Thanks.</p>
java
[1]
5,425,739
5,425,740
PHP: foreach - reverse 1 iteration
<p>Let's say I've a code:</p> <pre><code>foreach($array as $key =&gt; $value) { //do something if($var === true) //"reverse" } </code></pre> <p>is it possible to "reverse" foreach, so it'll "run" with the same array's element it was "running" when called to "get back" ;)?</p>
php
[2]
3,737,562
3,737,563
Android: How to check if a DB field is blank and, if so, add a value like "Unnamed Record"?
<p>I am working off the Android Notepad Tutorial as a base. The problem is that when someone creates a record with a null name field, it shows up as a blank space in the listview and is unclickable, and therefore undeletable from the list. </p> <p>I would like to have the program check for a null "name" field and replace it with the string "Unnamed Record" so that it comes up appropriately in the listview. Everything that I have tried so far has not worked correctly.</p> <p>Another possible solution might be the give the name field an initial value of "Unnamed Record" but I am not sure that this would be effective.</p> <p>Thanks.</p>
android
[4]
1,942,023
1,942,024
Why ping all times alive?
<p>I scripting script which in log write ping alive or no alive.</p> <p>But all times to log write that ping alive.</p> <p>Why?</p> <p>Code:</p> <pre><code>import os import re import time import sys from threading import Thread from time import gmtime, strftime class IntTools: def PingTool(self): ipconf = open('ip.conf', 'r') ipstrip = ipconf.readlines() ip = ipstrip[2].strip() ip2 = ipstrip[3].strip() ip3 = ipstrip[4].strip() ip4 = ipstrip[5].strip() ip5 = ipstrip[6].strip() class testit(Thread): def __init__ (self,ip): Thread.__init__(self) self.ip = ip self.status = -1 def run(self): pingaling = os.popen("ping "+self.ip+" -n 1","r") while 1: line = pingaling.readline() #print line if not line: break igot = re.findall(testit.lifeline,line) if igot: self.status = int(igot[0]) testit.lifeline = re.compile(r"(\d) received") report = ("No response","Partial Response","Alive") print time.ctime() pinglist = [] current = testit(ip) pinglist.append(current) current.start() for pingle in pinglist: pingle.join() pinglog = open('ping.log', 'a') pinglog.write('Status from '+pingle.ip+" is "+report[pingle.status]+'\n') pinglog.close() def ReadPingLog(self): pinglog = open('ping.log', 'r+') print pinglog.read() pinglog.close() IntTools = IntTools() IntTools.PingTool() </code></pre>
python
[7]
2,787,490
2,787,491
Program compiles and executes but an unreasonably large number is output as the maximum. How can a long double be displayed?
<p>So I got this program to run, but now any numbers that I input come out as really large numerals. Do I need to add a header for math computation? Or is there something like with C, a printf function for C++?</p> <pre><code>#include &lt;iostream&gt; // Necessary using namespace std; #define mMaxOf2(max, min) ((max) &gt; (min) ? (max) : (min)) #define mMaxOf3(Min, Mid, Max)\ {\ mMaxOf2(mMaxOf2((Min), (Mid)),(Max))\ } int main() { double primary; double secondary; double tertiary; long double maximum = mMaxOf3(primary, secondary, tertiary); cout &lt;&lt; "Please enter three numbers: "; cin &gt;&gt; primary &gt;&gt; secondary &gt;&gt; tertiary; cout &lt;&lt; "The maximum of " &lt;&lt; primary &lt;&lt; " " &lt;&lt; secondary &lt;&lt; " " &lt;&lt; tertiary; cout &lt;&lt; " using mMaxOf3 is " &lt;&lt; maximum; return 0; } </code></pre>
c++
[6]
2,776,750
2,776,751
How can I hide a date value if it is less than current date?
<p>I have the following date dropdownlist options:</p> <pre><code>&lt;asp:DropDownList id="eventsDate" runat="server"&gt; &lt;asp:ListItem Value="04/31/2012"&gt;Apr 31, 2012&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="05/21/2012"&gt;May 21, 2012&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="07/22/2012"&gt;Jul 22, 2012&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="10/16/2012"&gt;Oct 16, 2012&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="11/12/2012"&gt;Nov 12, 2012&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="12/18/2012"&gt;Dec 18, 2012&lt;/asp:ListItem&gt; &lt;/asp:DropDownList&gt; </code></pre> <p>If any of the dates in the dropdown is less than today's date, hide it.</p> <p>For instance, today's day is April 26, 2012. Assuming that the first date on the dropdownlist is April 25, 2012, it should not show up on the dropdownlist.</p> <p>I am drawing blanks.</p>
asp.net
[9]
52,950
52,951
Incrementing days if day is a workday
<p>I need your help again. This should be a function for php. I've got two dates. One is set by myDate and the other one is the date of today. I want to find out the number of days left to myDate, but saturday and sundy should be excluded. The result for this function would be 7... How can I make it work?</p> <p><pre><code> &lt;?php myDate = &quot;29.07.2010 &quot;</p> <p>DaysTillmyDate = 0 iterate day to myDate { if (date/day is a weekday(Monday,Tuesday,Wednesday,Thursday, Friday)) increment DaysTillmyDate by 1 } ?&gt;</pre></code></p> <p>A hint or any help would be much appreciated. Faili</p>
php
[2]
4,073,051
4,073,052
Toggle not working in IE
<p>I am using this code on my site:</p> <pre><code>var panel = $('.couch-hide'); var originalPos = panel.css("right"); panel.toggle(function() {$(this).animate({right:0},1000, 'easeOutBounce');},function(){$(this).animate({right:originalPos},1000);} ); </code></pre> <p>In FF it works flawlessly, but in IE, it doesn't pop out on click. Also, since im using the CSS right it shows the horizontal scrollbars but in FF it doesn't. Any ideas on what I can do to fix this issue?</p>
jquery
[5]
5,438,549
5,438,550
Creat c# program that allows the user to input expression ex." 5+3/2*2 " program output infix,postfix,prefix and also the Result
<blockquote> <p>Creat c# program that allows the user to input expression ex.“ 5+3/2*2 ” program output infix,postfix,prefix and also the Result</p> </blockquote> <p>im a 1st year student need to understand expression tree</p>
c#
[0]
2,136,099
2,136,100
problem in installing pypol
<p>I have been trying to install pypol in cygwin. But when I do setup where I have to type python setup.py install then it displays an error as the following:</p> <p>Traceback (most recent call last):</p> <p>File "setup.py", line 1, in </p> <pre><code>from setuptools import find_packages, setup, Command </code></pre> <p>File "/cygdrive/c/pypol_-0.4/setuptools/<strong>init</strong>.py", line 2, in </p> <pre><code>from setuptools.extension import Extension, Library </code></pre> <p>File "/cygdrive/c/pypol_-0.4/setuptools/extension.py", line 2, in </p> <pre><code>from setuptools.dist import _get_unpatched </code></pre> <p>File "/cygdrive/c/pypol_-0.4/setuptools/dist.py", line 6, in </p> <pre><code>from setuptools.command.install import install </code></pre> <p>File "/cygdrive/c/pypol_-0.4/setuptools/command/<strong>init</strong>.py", line 8, in </p> <pre><code>from setuptools.command import install_scripts </code></pre> <p>File "/cygdrive/c/pypol_-0.4/setuptools/command/install_scripts.py", line 3, in </p> <pre><code>from pkg_resources import Distribution, PathMetadata, ensure_directory </code></pre> <p>ImportError: No module named pkg_resourceserror </p> <p>Its clear that some of the modules are missing in my setuptools but I installed the setuptools again and they are still not there. How do I get out of this problem? Please help. Thank you.</p>
python
[7]
1,894,808
1,894,809
How Does the toString(), ==, equals() object methods work differently or similarly on reference and primitive types?
<p>How Does the toString(), ==, equals() object methods work differently or similarly on reference and primitive types?</p>
java
[1]
3,220,365
3,220,366
PHP spawn process
<p>How can I spawn a process in a PHP page in order to start a program <em>that survives the execution time of the request</em>?</p> <p>In other words, I want the page to have a normal lifetime (few milliseconds) but launch a program that keeps running on the server. Thanks</p>
php
[2]
4,653,982
4,653,983
adding content to a getasync
<p>when using HttpClient and performing a PostAsync I am able to add a contract with HttpContent. for example </p> <pre><code>HttpContent content = new ObjectContent&lt;myContractType&gt;(MyContract, xmlFormatter); var resp myClient.PostAsync(myUri,content).Result </code></pre> <p>when doing a GetAsync I am unable to pass a HttpContract object. That said do I need to just add the members of the contract in a query string or is there a better way to go about it?</p>
c#
[0]
5,792,696
5,792,697
How to use microphone for inputting text into TextBox?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/227140/c-sharp-speech-recognition-is-this-what-the-user-said">C# Speech Recognition - Is this what the user said?</a> </p> </blockquote> <p>I was wondering to make my own program in c sharp for taking the input from microphone into text box, so! do .net framework provide any class for it if so little info, if not any other approach,, I will appreciate any help, Thanks in advance.</p> <p>Later Edit: what about for creating our own recognition engine,, rather than using .net framework library??</p>
c#
[0]
6,002,618
6,002,619
How to read the downloaded file in android?
<p>I configure my email in the Android simulator(Default Email configuration in android aimulator 2.1) .And I download the attachment from my mail. I need to read that file in my application .Is there any possibility to read the file in my application. I am new to android. Can anyone help me to solve this ??? Thanks in advance? </p> <p>Note in the Eclipse android file explore it show the data in data/data/com.email.attachmentprovidr/databases/_att.1/<strong>1</strong> I export that object 1 to my computer it has the actual data</p>
android
[4]
560,109
560,110
How do I get values from a stringbuilder with multiple delimiters?
<p>I have a stringbuilder output as (AnimalAge;Dog:20,Cat:10,Rat:5#\r\nAnimalType;Whale:Mammal,Crocodile:Reptile#\r\n)</p> <p>I want to have AnimalAge as different entity and AnimalType as a different output.</p> <p>How do i separate these values so that i can populate this in different textboxes\labels?</p>
c#
[0]
3,617,124
3,617,125
Create runnable jar from command line
<p>In folder <code>~/code/</code> I have <code>bin/ src/ lib/</code> A manifest.txt is created in ~/ with the content:</p> <pre><code>Main-class: test.MyMainClass Class-Path: lib/*.jar </code></pre> <p>Then in ~ I used command</p> <p><code>jar cfm d.jar manifest.txt code/</code></p> <p>then I run</p> <p><code>java -jar d.jar</code></p> <p>it says</p> <p><code>Exception in thread "main" java.lang.NoClassDefFoundError: test/MyMainClass Caused by: java.lang.ClassNotFoundException: test.MyMainClass</code></p>
java
[1]
1,018,860
1,018,861
How to create variables dynamiccally in JavaScript
<p>I'm looking for a way to create variables dynamically in javascript</p> <p>eg</p> <p>I have a loop </p> <pre><code>for (i=0;i&lt;15;i++){ } </code></pre> <p>now I need to create variables dynamically eg var "a"+i for eavh value in the loop. Is this possible and how?</p>
javascript
[3]
3,293,167
3,293,168
Best scaleable way to find many keywords in a large amount of text?
<p>Ever few minutes around 500 paragraphs are supposed to be submitted to the database in a table called "Content" (this number will go to over 2,500 in a few months). There is another table called "Keywords" which has over 4,000 rows (and is expected to grow to over 10,000).</p> <pre><code>Keywords +------------+-------------------+ | Keyword_id | keyword | +------------+-------------------+ | 1 | "Venture Capital" | | 2 | "Financing" | +------------+-------------------+ </code></pre> <p>The question is: <strong>What is the best way to scale a solution where each keyword is cross-referenced among an incoming paragraphs of text to see if there is a match?</strong></p> <p>Since I'm not concerned about where in the paragraph there is a match (my only concern is that there IS a match); <code>if(preg_match()){}</code> could possibly work but even at the low-end that's 2,000,000 times you're running over a paragraph searching for a keyword. Plus, correct me if I'm wrong, preg_match is pretty expensive.</p> <p>One of the possibilites that crossed my mind was to keep an array of the keywords in the cache instead of having to call on the DB for every row. That would definitely help speed things up I think.</p> <p>I'm not concerned with this being only in PHP. If this section of the application needs to be in Python (correct me if I'm wrong, but I hear Python is a lot less expensive at parsing text), then I'm all ears.</p>
php
[2]
2,725,433
2,725,434
Issue with sending form in jquery
<p>I am working on a function that lets people log in to their accounts and the form should be sent without reloading the page. The problem is, with my current code the form values are not sent for some reason. What is wrong with my code?</p> <p><strong>Jquery</strong></p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { $('#form form').submit(function(){ $("#form :input").attr("disabled", true); $.post('0_0.php', $(this).serialize(), function(data){ $('#message').html(data); $("#message").fadeIn(500); $("#form :input").attr("disabled", false); }); return false; }); }); &lt;/script&gt; </code></pre> <p><strong>html</strong></p> <pre><code>&lt;div id="form"&gt;&lt;form&gt; &lt;table&gt;&lt;tr&gt; &lt;td&gt;&lt;input type="text" value="" class="input 1" placeholder="E-post" name="email" id="i" /&gt;&lt;/td&gt;&lt;td&gt; &lt;input type="password" name="pass" placeholder="Lösenord" class="input" value="" id="p" /&gt;&lt;/td&gt;&lt;td&gt; &lt;input type="submit" value="Logga in" class="button" name="submit" /&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="checkbox" id="checkbox-1-4" name="remember" class="regular-checkbox" /&gt;&lt;label for="checkbox-1-4"&gt;&lt;/label&gt; &lt;/td&gt;&lt;td&gt;&lt;a class="link" style="margin:0; font-size:11px;" href="forgot_password.php"&gt;Glömt lösenordet?&lt;/a&gt; &lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/form&gt;&lt;/div&gt; </code></pre>
jquery
[5]
4,497,167
4,497,168
Reading lines from Python queues
<p>I'm dipping my toes into Python threading. I've created a supplier thread that returns me character/line data from a *nix (serial) /dev via a Queue.</p> <p>As an exercise, I would like to consume the data from the queue one line at a time (using '\n' as the line terminator).</p> <p>My current (simplistic) solution is to put() only 1 character at a time into the queue, so the consumer will only get() one character at a time. (Is this a safe assumption?) This approach currently allows me to do the following:</p> <pre><code>... return_buffer = [] while True: rcv_data = queue.get(block=True) return_buffer.append(rcv_data) if rcv_data == "\n": return return_buffer </code></pre> <p>This seems to be working, but I can definitely cause it to fail when I put() 2 characters at a time.</p> <p>I would like to make the receive logic more generic and able to handle multi-character put()s.</p> <p>My next approach would be to rcv_data.partition("\n"), putting the "remainder" in yet another buffer/list, but that will require juggling the temporary buffer alongside the queue. (I guess another approach would be to only put() one line at a time, but where's the fun in that?)</p> <p>Is there a more elegant way to read from a queue one line at a time?</p>
python
[7]
2,106,115
2,106,116
Javascript read a text file being uploaded through a form
<p>I want to do some basic calculations based on a text file. However since it's for a client it needs to be straight forward. Is it possible to do these calculations purely in the client. If somebody selects a file to upload through a form. Can I instead capture that through Javascript and process it that way?</p>
javascript
[3]
2,820,416
2,820,417
Join the content of files to one file
<p>I have two files and I want to join the content of them into one file side-by-side, i.e., line n of the output file should consist of line n of file 1 and line n of file 2. The files have the same number of lines.</p> <p>What I have until now:</p> <pre><code>with open('test1.txt', 'r') as f1, open('test2.txt', 'r') as f2: with open('joinfile.txt', 'w') as fout: fout.write(f1+f2) </code></pre> <p>but it gives an error saying - </p> <pre><code>TypeError: unsupported operand type(s) for +: 'file' and 'file' </code></pre> <p>What am I doing wrong?</p>
python
[7]
2,222,585
2,222,586
How to show number of unpublished articles?
<p>I recently started an article directory using wordpress, and theme by dimox and plugin and plugin by artilcesss dot com.</p> <p>On homepage it shows number registered authors and and published posts. </p> <p>It is using %2$s for registered authors and %1$s for number of published articles in main index template.</p> <p>I have so many unpublished articles too, so my question is that is there any way to show the number of unpublished articles (only counts) on the homepage? </p> <p>Update:</p> <p>thanks for the answers, it is useful for users like me, I am not expert in this, here is the code.</p> <pre><code>&lt;p&gt;&lt;?php global $numposts, $users; printf(__('We have &lt;strong&gt;%2$s&lt;/strong&gt; registered authors and &lt;strong&gt;%1$s&lt;/strong&gt; published articles till the date.', 'article-directory'), $numposts, $users); ?&gt;&lt;/p&gt; </code></pre> <p>And this will show the output:</p> <p>We have 24 registered authors and 43 published articles till the date.</p> <p>(24 and 43 numbers are current statistics)</p>
php
[2]
2,047,541
2,047,542
JQuery Offset problem
<p>I have a div on page load has the css "Display:none; position:absolute"</p> <p>There is a jQuery click event on a label that shows this div</p> <p>Before I do .fadeIn() on I find the width and height of the window and set the offset of the div to try place to div in the centre of the screen. </p> <p>This div also has a close image that has a jQuery click event that sets the div to fade out</p> <p>The first time I open the div the div is positioned correctly on the screen, if I close the div and open it the div moves further right and down. It keeps on doing this until I do a full page refresh</p>
jquery
[5]
536,935
536,936
How do I change the html element <li>'s color with a click via jQuery?
<p>How to change the background color of UL 'li' on click?</p> <p>EDIT i can change li "a" but what about the entire <strong>li</strong></p> <p>this works:</p> <pre><code> $(".clickableUL").click(function() { $(this).find("li a").addClass("active"); }); </code></pre> <p>but find("li") does nothing. I want the LI highlighted not just the text of the link.</p>
jquery
[5]
3,033,988
3,033,989
Get last item added in a BindlingList
<p>I have a BindingList variable and I need to get the last item that was added to it. The following code works, but I'd like to know if there's a better way or something that I'm missing:</p> <pre><code>WorkoutScheduleList[WorkoutScheduleList.IndexOf(WorkoutScheduleList[(WorkoutScheduleList.Count - 1)])].WorkoutScheduleID); </code></pre> <p>It's not the easiest to read, but it basically takes the count of the list and subtracts 1 from it, and uses that for the IndexOf method to get the last item that was added to the list.</p>
c#
[0]
3,893,331
3,893,332
Visual studio 2010 web application deployment
<p>I'm running Visual Studio 2010 sp1 on Windows 7 23bit. I have recently converted my web application from Visual Studio 2008. When I try to compile my web app, by clicking on "publish website" it tells me "Publish succeeded" but the deployment folder is empty. I even checked to see whether I have syntax errors. I have none, that I could locate. I also did some extensive googling but no satisfactory answer. What is causing this? Am I missing something here? Is it a bug from Visual Studio 2010? Your help would be very much appreciated.</p> <p>Regards</p>
asp.net
[9]
5,902,880
5,902,881
Is there a more elegant pythonic way of expressing the following condional expression?
<p>I would like a more pythonic way for the following branch if any:</p> <pre><code>if a&lt;b: a.append('value') elif a==b: b.append('value') else: do nothing </code></pre> <p>Is there any ternary operator for that?</p>
python
[7]
2,579,294
2,579,295
Then files in my project folder used for what?
<p>I finished one project. But others want me give them the non-Compiled code.what's that?</p> <p>My project folder include:</p> <p>Classes:of course, the source code. build: I don't understand clearly. imagesrc: I added, include the images of my project. The others are the nib file. Give me the explanation in detail,thank you so much.</p>
iphone
[8]
1,271,673
1,271,674
Speedup a php web site
<p>What's the best way (ways?) to speed up a php web site and how much faster it can using this or that way?</p>
php
[2]
5,956,796
5,956,797
Android: ListView Exception?
<p>When i try to put a imageview in listview i have this error:</p> <pre><code>android.widget.listview.measureHeightOfChildren </code></pre> <p>why? </p>
android
[4]
1,055,283
1,055,284
query execution error check
<p>hello please help me out regarding this function </p> <pre><code> function delete($serviceid) { $result = $this-&gt;query=("delete from service where service_id='$serviceid'"); $exe=$this-&gt;executeNonQuery(); if ($exe){ return $success = "Record deleted successfully."; } else { return $error = "Unable to process at this time."; } } </code></pre> <p>$exe is always 1 even if the record is not deleted as may b its because of , it only check that query is executed or not , how can i check if the record is deleted then show success message</p>
php
[2]
5,267,205
5,267,206
read one java.util.arrayqueue from more than one thread
<p>Question, more than one thread of a process program could read sequentially from one static java.util.arrayqueue? If three threads of a process program are running and three data object arrive into the arrayqueue, each thread will process one data object or just one thread will process all three data object</p>
java
[1]
144,725
144,726
$_SERVER VARS are empty
<p>I'm using PHP 5.3.12 on a Windows system , i am trying to use some of the <code>$_SERVER</code> variables, but the following <code>$_SERVER</code> variables are empty for me</p> <pre><code>$_SERVER['SERVER_NAME'] $_SERVER['SERVER_PORT'] $_SERVER['REQUEST_URI'] </code></pre> <p>i have set <code>ServerName</code> in the config file, but <code>SERVER_NAME</code> and <code>SERVER_PORT</code> are both empty and i have no idea why that is, how can i set those variables and prevent them from being empty?</p>
php
[2]
440,824
440,825
Gui Library in Python
<p>I am in need of making an interface for Automata Construction. For those who are unaware of what an automata is, I basically need circles and arrows, extending them on the user interface and then various text to describe it. For example :- <a href="http://en.wikipedia.org/wiki/File:DFAexample.svg" rel="nofollow">http://en.wikipedia.org/wiki/File:DFAexample.svg</a></p> <p>I was wondering if there is any advanced library in Python which could let me do all of this. Please give me suggestions. I plan to use lots of internal frames and showing parsing of strings diagramatically . I had planned to use jython to use the swing libraries but I would like to know if there any other suggestions that I can use. </p>
python
[7]
3,615,705
3,615,706
Convert list to namedtuple
<p>In python 3, I have a tuple <code>Row</code> and an array <code>A</code> as following</p> <pre><code>Row = namedtuple('Row', ['first', 'second', 'third']) A = ['1', '2', '3'] </code></pre> <p>How do I insert this array into named tuple? Note that in my situation I cannot directly do this:</p> <pre><code>newRow = Row('1', '2', '3') </code></pre> <p>I have tried different methods</p> <pre><code>1. newRow = Row(Row(x) for x in A) 2. newRow = Row() + data # don't know if it is correct </code></pre>
python
[7]
372,836
372,837
I want to get the values in array and pass it to some location
<pre><code>&lt;script type="text/javascript"&gt; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open("GET", "products.xml", false); xmlhttp.send();`enter code here` xmlDoc = xmlhttp.responseXML; document.write("&lt;table border='1'&gt;"); var x = xmlDoc.getElementsByTagName("productItem"); for (i = 0; i &lt; x.length; i++) { document.write("&lt;tr&gt;&lt;td&gt;"); document.write(x[i].getElementsByTagName("ProName")[0].childNodes[0].nodeValue); document.write("&lt;/td&gt;&lt;td&gt;"); document.write(x[i].getElementsByTagName("ProRate")[0].childNodes[0].nodeValue); document.write("&lt;/td&gt;&lt;/tr&gt;"); } document.write("&lt;/table&gt;"); &lt;/script&gt; </code></pre> <p>This is my JavaScript coding.. I am fetching the values from XML file.. so i want to get these values from an array and to pass in some other place</p>
javascript
[3]
918,079
918,080
updating an object in a list after an object changed
<p>I have a list of objects and I'm doing a foreach on the list and I'm sending each object to a method that modifies the object and returns it; like this:</p> <pre><code>foreach (MyObjectModel o in TheMasterObject.ListOfMyObjectModel) { o = MyMethod(o); } </code></pre> <p>That doesn't work. What I want to do is replace the object I'm iterating on with the modified version that gets returned by MyMethod.</p> <p>What do I need to change?</p> <p>Thanks.</p>
c#
[0]
3,086,129
3,086,130
Can core data be used without tableView?
<p>I've seen some sample code about core data. All of that uses navigation base template where the tableView is already provided. When I remove the tableView or use window base template, it kept crashing with the console stated the same error, something like it couldn't find this entity name. And the entity name is exactly the same (in @"" as it should be). So can I use core data to do saving without having those table? Thanks in advance </p>
iphone
[8]
2,488,143
2,488,144
Integrating modules one solution 4projects
<p>I am trying to integrate 2 modules using Visual web developer</p> <p>Module1 contains the following: UILayerMOdule1, BLLModule1, DALModule1, webconfig, Site.master</p> <p>Module2 contains UILayerMOdule2, BLLModule2, DALModule2, webconfig, Site.master</p> <p>This is how I started. </p> <p>Create a new project in VisualWeb developer</p> <ol> <li><p>Add project: BLL. I this BLL I added BLLModule1,BLLModule2</p></li> <li><p>Project2 DAL: This I added DALModule1,DALModule2</p></li> <li><p>Project3: UILayerModule1</p></li> <li><p>Project4: UILayerMOdule2</p></li> </ol> <p>Then put all these under the same namespace. </p> <p>But it shows an error in Configuration and System.UI. (unable to recognize System.web)</p> <p>Unable to recongnize System.Configuration</p> <p>Also, in the UIlayer none of aspx files are shown, Only the aspx.cs and designer are shown</p> <p>Thanks</p> <p>Sun</p>
asp.net
[9]
1,242,008
1,242,009
Set value of a scoped variable in callback / closure
<p>I have a very large JS script with many functions, callbacks and so on... one of my first actions is to obtain a value from an Ajax call. This value I then set to a global variable defined at the start of my script so I can reference the value again and again... the value with determine the user language for instance.</p> <pre><code>// define my global var at the top of my script.. var globalOpCo = ""; // I then try to give this a value in the next function I call... $.ajax({ url:"getURL", type:"POST", dataType:"json", success:function(data){ if(data === null){ // do something... }else{ // set the current language... globalOpCo = data.Opco.toLowerCase(); console.log(globalOpCo); // this is the value I want it to be from data.Opco.toLowerCase() // now do something.... } }, error:function(xhr, ajaxOptions, thrownError){ console.log(xhr.status); console.log(xhr.statusText); console.log(thrownError); } }); </code></pre> <p>Now later in my script I wish to pass the <code>globalOpCo</code> to another function like so...</p> <pre><code> $("#aButton").on("click", function(){ anotherFunction(globalOpCo); // I want to pass the globalOpCo as an arguement but its value isn't get updated above? }); </code></pre> <p>however the value of <code>globalOpCo</code> is an empty string! The #aButton cannot be clicked before or until the ajax call above is run. Can someone help?</p>
javascript
[3]
870,562
870,563
Please exlpain the following while initializing a class in java
<pre><code>class Size{ Size(){ } //public final Size SMALL = new Size();//infinite loop final Size as = new Size();//infinite loop //static Size aw = new Size();//No infinte loop } class b{ static public void main(String ftr[]){ Size z = new Size(); } } </code></pre> <p>when static Size aw is equal to new Size(); there is error when above program is run. See the scenario below, when the program is run with:</p> <pre><code> public final Size SMALL = new Size();// infinite loop is happening final Size as = new Size(); </code></pre> <p>an infinite loop is happening and program is giving </p> <pre><code> Exception in thread "main" java.lang.StackOverflowError at Size.&lt;init&gt;(Interesting.java:6) at Size.&lt;init&gt;(Interesting.java:6) </code></pre> <p>Can somebody explain to me or, point me to the places where I can find the reason behind this.</p>
java
[1]
3,235,142
3,235,143
Asp.net "allowDefinition=MachineToApplication" error
<p>I have edited the relevant .cs files in my web service. But after editing I end up with the following error: "It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS." Can you please let me know what should be the problem? Because there are no Warnings, no issues, it's just one error. Please help me. Thank you in advance.</p>
asp.net
[9]
856,930
856,931
Image fit screen in a WebView
<p>In my app, I display pictures thanks to a webView. So for each image I create small HTML code that I load with the webView. So my html code consist basically in a img tag (with the path to my picture).</p> <p>My pictures have different sizes, that's why I'd like to set my webView zoom to fit the pictures width to the webView width. So the user don't have do zoom in or out to be able to see the entire picture.</p> <p>Is there a way to achieve it ?</p> <p>Thanks.</p>
android
[4]
3,212,265
3,212,266
Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. MyDataset.Tables[0].Merge
<p>When i'm trying to merge Table in dataset this Exception Occurred :- (Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.)</p> <p>Code:</p> <pre><code>MyDataset.Tables[0].Merge(dt, false, MissingSchemaAction.Add); </code></pre>
c#
[0]
1,948,166
1,948,167
Is there such a function in python string.remove?
<p>C# - String.Remove Ex.</p> <pre><code>int j = 4; string pages = "/.././ewcwe/"; pages = pages.Remove(j, 2); // pages = "/../ewcwe/"; // delete ./ </code></pre> <p>Is there such a function in python string.remove?</p> <p>sorry, <strong><em>*</em>*</strong>./<strong>**</strong> -> ./</p>
python
[7]
4,938,204
4,938,205
How to get an array of months in c#
<p>I want to get the month array in c#.<br> somthing like this : <code>{ January , February , ... , December }</code><br> How can I do this? please send me codes in C#. thanks</p>
c#
[0]
4,789,848
4,789,849
php function to convert Unix timestamp into minutes or hours or days like digg?
<p>i want a php function to convert a unix time stamp to like this:</p> <p>15 seconds</p> <p>or</p> <p>45 minutes</p> <p>or</p> <p>3 hours</p> <p>and not like this : 2seconds, 5minutes, 9 hours</p> <p>i want only one value like digg ( made popular xx xxxxx )</p> <p>Thanks</p>
php
[2]
5,959,535
5,959,536
jQuery .toggle() not working
<p>The code:</p> <pre><code>$(document).ready(function() { $('#new_opt').click(function() { $('#reg_form').toggle('slow'); }); }); </code></pre> <p>Using Firefox.<br> First time I click, it shows, but then it doesn't hide when I click after that.</p> <p>CSS: </p> <pre><code>#reg_form - display: none; </code></pre> <p>If it helps - </p> <pre><code>#new_opt - cursor: pointer; </code></pre> <p>When I click the first time the cursor is pointer and it shows but after that the cursor doesn't become a pointer too. weird.</p>
jquery
[5]
5,474,241
5,474,242
ASP.NET: Thread-safety in a file-based database
<p>I have worked a bit with ASP.NET before. I was using a MS SQL server to store and retrieve data to display in some dynamic pages in one project I started to learn ASP.NET a bit. Now I am about to start a new project but this time I would like to store the data in a file-based database , like say, an Access file. This project is also a hobby project and I'm not afraid of the scaling problem because perhaps only 3 users will be using the application at the same time and no be data traffic will be expected.</p> <p>Now , about my question: using a MS SQL database there is no problem with several users reading-writing to the Db at the same time because the DB engine will take care of this, but using a file-based database with ADO.NET will be a problem in that case, am I right? </p> <p>What I mean, do I need to take care of multiuser synchronization myself (using some synchronization mechanism, lock, mutex, whatever) to guarantee thread safety when working with the database or does ADO.NET takes care of that as well?</p> <p>Should I use perhaps a singleton class for the data layer? </p>
asp.net
[9]
2,884,747
2,884,748
Using in range(..) in an if-else statment
<p>python 2.7</p> <p>Is it possible to do this:</p> <pre><code>print "Enter a number between 1 and 10:" number = raw_input("&gt; ") if number in range(1, 5): print "You entered a number in the range of 1 to 5" elif number in range(6, 10): print "You entered a number in the range of 6 to 10" else: print "Your number wasn't in the correct range" </code></pre> <p>I find if I put a number between 1 to 10 it always falls to the else statement.</p> <p>Is this an incorrect use of in range in an if-else statement?</p> <p>Many thanks in advance,</p>
python
[7]
5,131,631
5,131,632
Does not work if condition, where is wrong code?
<pre><code>if (cevabb.getText().toString() == cev0.getText().toString()) { Toast.makeText(test.this,"aaaa", Toast.LENGTH_LONG).show(); } else { Toast.makeText(test.this,"bbb", Toast.LENGTH_LONG).show(); } </code></pre> <p><code>cevabb.getText().toString()="xxx"</code> and <code>cev0.getText().toString()="xxx"</code>, but message shows "bbb" </p>
android
[4]
4,190,068
4,190,069
Will $_SERVER['HTTP_REFERER'] detect a site as a referer if it is using a redirect?
<p>In PHP I see that</p> <pre><code>$_SERVER['HTTP_REFERER'] </code></pre> <p>gives me the refering url if the refering page had a link that was clicked through to my current page. But what if page A has a htaccess redirect that sends the user to page B. If I have the above snippet on Page B will I get Page A as the referer?</p> <p>Or does it only work if a user clicks on a link that takes them to page B?</p>
php
[2]
1,052,859
1,052,860
how change Username And Password to proxy
<p>I have username and password to login a web site but i need login with proxy how can change username and pass to proxy i can login to web site with this url www.mydomain.com?user=1&amp;pass=2 or insert user and pass to login page how i can login web site with HttpWebRequest in asp.net C#?</p> <pre><code>&lt;code&gt; Encoding encode = System.Text.Encoding.GetEncoding("utf-8"); HttpWebRequest Request = (HttpWebRequest)HttpWebRequest.Create(Url); HttpWebResponse Response = (HttpWebResponse)Request.GetResponse(); &lt;/code&gt; </code></pre>
asp.net
[9]
4,073,957
4,073,958
String index out of range
<p>Im trying to make this program to count the number of consecutive characters and im getting the error that says :"String index out of range." Can anyone help me fix this?</p> <pre><code>import javax.swing.*; public class Project0 { public static void main(String[] args){ String sentence; sentence = JOptionPane.showInputDialog(null, "Enter a sentence:"); /*Asks the user to enter a sentence*/ int pairs = 0; for (int i = 0; i &lt; sentence.length(); i++){ //counts the pairs of consecutive characters if ( sentence.charAt(i) == sentence.charAt(i+1)) pairs++; } JOptionPane.showMessageDialog(null, "There were " + pairs + " pairs of consecutive characters"); }//main }// Project0 </code></pre>
java
[1]
4,597,451
4,597,452
Cloning android source code repo into a different directory
<p>I followed instructions at <a href="http://source.android.com/source/download.html" rel="nofollow">http://source.android.com/source/download.html</a> to build android source code on Mac OS X. Created case-sensitive image of size 8.5 GB and gave make for 'full-eng' target in lunch command, After sometime got this error complaining about insufficient disk space :</p> <pre><code>prebuilt/darwin-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-ar: out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/libwebcore.a: No space left on device make: *** [out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/libwebcore.a] Error 1 make: *** Deleting file `out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/libwebcore.a' </code></pre> <p>Is 8.5GB not sufficient to build, instructions say 8Gig is enough.Did i miss something.?</p> <p>Now I want to create another case-sensitive image of size say 12GB and build it, can simple copy of files from 8.5GB volume to 12GB volume work? Or is there any special command (git clone or something.. sorry noob to git) to copy the entire repo so that all git projects will copy safely.</p>
android
[4]
540,970
540,971
How can I set the default value for a radio button on load of document?
<p>I need to set default value for radio button on load of document. I tried this code:</p> <pre><code>$(document).ready(function(){ $(":radio[name='sectionRules']").val(1); }); </code></pre> <p>but it is not working. Can anyone help me out?</p>
jquery
[5]
496,270
496,271
difference in 'category-".$row['id'].".php' and 'category-.php".$row['id']."'
<p>I am confused and couldn't figure out the difference between these two lines!!</p> <pre><code>echo "&lt;li&gt;&lt;a href='category-".$row['id'].".php' &gt;".$row['name']."&lt;/a&gt;&lt;/li&gt;"; </code></pre> <p>The first one echos categories I displayed in a home page. It works fine and I don't have to create the category.php file.</p> <pre><code>echo "&lt;li&gt;&lt;a href='category-.php".$row['id']."' &gt;".$row['name']."&lt;/a&gt;&lt;/li&gt;"; </code></pre> <p>But the second code it tells me file doesn't exist. </p> <p>So my question is, why the first code doesn't require the file but the second code does?</p>
php
[2]
5,241,801
5,241,802
mysql_insert_array is a fatal error
<p>i am trying to insert the contents of the array below into my mysql table into the fields supplied. but i get fatal error: Call to undefined function mysql_insert_array(); any ideas?</p> <pre><code> &lt;?php // Open database here $connect = mysql_connect("xxxxx", "xxxx", "xxxx") or die('Couldn\'t connect to MySQL Server: ' . mysql_error()); mysql_select_db("xxxx", $connect ) or die('Couldn\'t Select the database: ' . mysql_error( $connect )); // Let's pretend these values were passed by a form $_POST['name'] = "Bob Marley"; $_POST['country'] = "Jamaica"; $_POST['music'] = "Reggae"; $_POST['submit'] = "Submit"; // Insert all the values of $_POST into the database table `artists`, except // for $_POST['submit']. Remember, field names are determined by array keys! $result = mysql_insert_array("artists", $_POST, "submit"); // Results if( $result['mysql_error'] ) { echo "Query Failed: " . $result['mysql_error']; } else { echo "Query Succeeded! &lt;br /&gt;"; echo "&lt;pre&gt;"; print_r($result); echo "&lt;/pre&gt;"; } // Close database ?&gt; </code></pre>
php
[2]
1,696,693
1,696,694
Convert int string to hex string
<p>How would I convert a string that represents an integer like "4322566" to a hex string?</p>
c#
[0]
4,644,980
4,644,981
Android-limit/delete data from database
<p>I want to retrieve data from the database. The number of data is fixed and when new data is entered the oldest data is deleted. How can I do that? What to use to erase old data and store new data? I have 25 data location and there will always be new data. Its android app and SQLite database is used. </p>
android
[4]
4,173,942
4,173,943
build android system on ubuntu 10.04 x86-64 occrur internal compiler error
<p>I'm trying to build android system ; enviroment: ubuntu 10.04, gcc-4.4 jdk 1.6-0-20 get source code follows <a href="http://source.android.com/source/download.html" rel="nofollow">http://source.android.com/source/download.html</a></p> <p>$ . build/envsetup.sh</p> <p>$ choosecombo</p> <p>$ make</p> <p>then compiler error occurs: </p> <p>frameworks/base/opengl/libagl/egl.cpp:1955: instantiated from here frameworks/base/opengl/libagl/egl.cpp:72: warning: comparison between signed and unsigned integer expressions frameworks/base/opengl/libagl/egl.cpp:74: warning: comparison between signed and unsigned integer expressions</p> <p><strong>frameworks/base/opengl/libagl/egl.cpp: In member function ‘virtual EGLBoolean android::egl_window_surface_v2_t::swapBuffers()’: frameworks/base/opengl/libagl/egl.cpp:554: internal compiler error: in add_phi_arg, at tree-phinodes.c:391</strong></p> <p>in line 554: the code below: const Region copyBack(Region::subtract(oldDirtyRegion, dirtyRegion));</p> <p>Any one know the solution ? roll back to gcc4.3 may not a nice solution</p>
android
[4]
1,633,340
1,633,341
c# what does this mean: Loaded += MyWindow_Loaded;
<p>i have a vb.net background and trying to learn c# syntax</p> <p>thank you for your help!</p>
c#
[0]
1,774,306
1,774,307
jQuery: question about children() function
<p>how can I avoid this in jQuery:</p> <blockquote> <p>$(this).parents(".node-inner").children().children().children();</p> </blockquote> <p>I tried:</p> <blockquote> <p>$(this).parents(".node-inner").children(".className");</p> </blockquote> <p>but it doesn't work.</p> <p>thanks</p>
jquery
[5]
915,164
915,165
Checkout Android Project in Eclipse
<p>For some reason whenever I checkout my Android project from the SVN repository into Eclipse it fails to recognize that it is an Android project. </p> <p>Even when I use "Convert to Android Project" it says: "Project1 does not exist." </p> <p>What might be the problem or how do I checkout an android project from a repository?</p>
android
[4]
76,962
76,963
How to load a Google AD code in background in my asp.net webpage?
<p>I embed a google AD code in my asp.net webpage, it causes my webpage to load slow.</p> <p>Is there way to load the Google AD code in background? I hope to display other content of webpage first and display google AD last.</p> <pre><code>&lt;script type="text/javascript"&gt;&lt;!-- google_ad_client = "pub-5823168326939016"; /* HiCalc 234x60 On 10-10-22 */ google_ad_slot = "1050696847"; google_ad_width = 234; google_ad_height = 60; //--&gt; &lt;/script&gt; &lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt; &lt;/script&gt; </code></pre>
asp.net
[9]
1,562,064
1,562,065
jQuery if javascript is disabled/enabled?
<p>I was <a href="http://tutsplus.com/lesson/slides-and-structure/" rel="nofollow">watching this video tutorial</a> and I noticed he said that he's added this: </p> <p><code>$('html').addClass('js');</code> </p> <p>He said that if javascript is disabled, then the class won't show, but if it is enabled, the class will show. I don't understand how that works. How does jQuery know if JS is enabled, and to apply a certain class when JS is enabled/disabled? There's no if statement. I'm a tad bit confused. </p> <p>"If HTML has a class of JS, javascript is available, if not, JS is not available". I don't understand that. </p> <p>He also mentioned a "JavaScript hook"..?</p> <p>Watch from 2:30 to 3:40, it's where he explains it but I don't understand.</p> <p>Thanks!</p> <p><strong>edit: I cannot believe the answer was so simple and I did not see it. Thanks guys.</strong></p>
jquery
[5]
1,611,167
1,611,168
Does Java have all the PHP features?
<p>To make my question clearer, I figured out that Java doesn't have a JSON class. Are there many PHP functions that doesn't exist in Java?</p>
java
[1]
1,604,175
1,604,176
Why can't I assign for loop to a variable?
<p>So I am just wondering why the following code dosen't work. I am looking for a similar strategy to put the for loop in a variable.</p> <pre><code>var whatever = for (i=1;i&lt;6;i++) { console.log(i) }; </code></pre> <p>Thanks!</p>
javascript
[3]
9,553
9,554
Selecting previous label element JQUERY
<p>So I have a form;</p> <pre><code>&lt;label for="name"&gt;Job Date&lt;/label&gt;&lt;br /&gt;&lt;input id="name" class="required" title="Enter a name!" name="name" type="text" /&gt; </code></pre> <p>and some Jquery to cycle through each input with class "required" and see if it is empty/blank and if so give this input a red border color, and also the label assosciated with it a red color;</p> <pre><code>function checkreview() { var errors = ""; $(".required").each(function (i) { if($(this).val() == "") { errors += $(this).attr('title')+'&lt;br /&gt;'; $(this).css('border-color','#FF0000'); //need to select previous label and set color to red } }); } </code></pre> <p>So I need a selector that will select the previous label and allow me to give it .css('color','FF0000').</p> <p>Any ideas how to select the previous label in JQUERY?</p>
jquery
[5]
222,015
222,016
how to store 6:00pm in sqlite database in android
<p>can anybody help me how to store 6:00pm(time with am or pm) in sqlite database in android</p>
android
[4]
3,893,958
3,893,959
Problem in DialogPreference
<p>My problem is the following : I have a component that extends DialogPreference, if I change the associated preference from other part than the UI, with </p> <pre><code>SharedPreferences.Editor ed= sharedPreferences.Edit(); ed.putInteger("Setting",aValue); ed.commit(); </code></pre> <p>then when I open the dialog the selected preference is not changed accordingly to the previous setted value, even if in the shared preferences the value is modified.</p> <p>Has anyone , any idea what could cause this ?</p>
android
[4]
2,465,342
2,465,343
Jquery getting ul depending a match in the child text in an anchor inside with variable value
<p>I have the following javascript variable:</p> <pre><code>&lt;script&gt; var theme="Videocameras"; &lt;/script&gt; </code></pre> <p>And the following html code:</p> <pre><code>&lt;div&gt; &lt;span&gt;Tecnology&lt;/span&gt; &lt;ul id="menu"&gt; &lt;li&gt; &lt;a href="#"&gt;Multimedia&lt;/a&gt; &lt;ul&gt; &lt;li&gt; &lt;a href="#"&gt;Videocameras&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="#"&gt;Cameras&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="#"&gt;MP3 and MP4&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="#"&gt;Telephony&lt;/a&gt; &lt;ul&gt; &lt;li&gt; &lt;a href="#"&gt;Mobile Phones&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>I would like to know how to get a unique ul that has inside an href with text that matches to the value of the variable.</p> <p>Could you give me a hand? Best Regards.</p>
jquery
[5]
5,414,606
5,414,607
Finding Sampling Rate Of Touch Screen In Android
<p>Is there a way to find out sampling rate of the touch screen in an Android device ? </p> <p>I tried this stackoverflow post but did not help my exact requirement <a href="http://stackoverflow.com/questions/6746127/adjust-touch-input-sample-rate-on-android">Adjust touch input sample rate on Android</a>.</p>
android
[4]
616,166
616,167
How to strip "control characters" from a CharSequence?
<p>I have <code>CharSequence source, int start, int end</code></p> <p>I would like to strip all "control characters" from source between start and end and return this as a new CharSequence</p> <p>by "control character" I mean undeseriable characters like Tab and Return, line feeds and such... basically all that was in ASCII &lt; 32 (space) ... but I don't know how to do it in this "modern age"</p> <p>what is a <code>char</code>? is it unicode? How can I remove these "control characters" ?</p>
java
[1]
1,948,114
1,948,115
c# remove item from list
<p>I have a list stored in resultlist as follows:</p> <pre><code> var resultlist = results.ToList(); </code></pre> <p>It looks something like this</p> <pre><code>ID FirstName LastName -- --------- -------- 1 Bill Smith 2 John Wilson 3 Doug Berg </code></pre> <p>How do I remove ID 2 from the list? </p>
c#
[0]
1,179,585
1,179,586
How do I keep the infinite timer that triggers JS function on html page?
<p>I need to call a function that updates some JS objects on the page every 2 minutes. How would I do that?</p> <p>I created a onload function and a countdown function that refreshes a whole page and therefore resets the timer until next page refresh, but this is not the way I want it. Is there a way to keep an infinite time loop?</p> <p>I assume, if I could create a an infinite loop and do something like this:</p> <pre><code>if (currentSeconds%120==0){ callFunction(); } </code></pre>
javascript
[3]
2,849,744
2,849,745
Asp.net Problem while pressing back button of browser
<p>I have two page one is login and second is attendance..</p> <p>In attendance page there is two button In and Out visible any one of them at a time.. while i am pressing back button it navigates to previous button instead of previous page. plz give me solution for this.. </p>
asp.net
[9]
664,100
664,101
How to capitalize a word I am pulling from the name of the document
<p>I am getting the name of my document like this...</p> <pre><code>&lt;?= basename($_SERVER['PHP_SELF'],'.php')?&gt; </code></pre> <p>It is an all lowercase word. How to get the first letter to be capitalized when it appears on my page?</p>
php
[2]
5,201,409
5,201,410
Java Casting with Method Calls
<p>Suppose I have the following classes</p> <pre><code>class A{ public method(A a) { System.out.println(3); } } class B extends A{ public void method (A a) { System.out.println(2); } public void method (B b) { System.out.println(1); } } A obj = new B(); obj.method( (B) obj); ((B) obj).method( (B) obj); </code></pre> <p>The first method call prints out 2 while the second method call prints out 1. Why don't both method calls print out 1?</p>
java
[1]
5,053,196
5,053,197
Show dialog from Application
<p>I have a class that extends <code>Application</code>, in the <code>onCreate</code> method I load some stuff from a DB and it doesn't make sense so do it asynchronously, because the app is useless without that data. 1. problem: when the loading takes somes seconds, Android will show ANR. 2. problem: can I show a dialog from the extended application class? </p> <pre><code>pd = new ProgressDialog(this); </code></pre> <p>and</p> <pre><code>pd = new ProgressDialog(getApplicationContext()); </code></pre> <p>both resultet in </p> <pre><code>E/AndroidRuntime(14168): java.lang.RuntimeException: Unable to create application com.example.skelett.GlobalApp: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application </code></pre> <p>Should I probably do all the loading stuff in the <code>onCreate</code> method of my first <code>Activity</code>? How can I prevent ANR when I <em>do</em> want to block the UI until my stuff is loaded?</p>
android
[4]