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
890,465
890,466
Android connectivity with Desktop app
<p>Currently i am building a mobile app on ubuntu 11.10 system.For checking the local app on phone i am using emulator.Is it possible to check the local app through my android phone.via emulator i am accessing my app via 10.0.2.2:3000.For android mobile how to do</p>
android
[4]
4,688,606
4,688,607
No text is being set once I select an Item on an Android spinner.
<p>No text is being set when I select any item from a spinner. What might be the error?</p> <pre><code> ArrayAdapter&lt;String&gt; pSelectAdapter = new ArrayAdapter&lt;String&gt;(PCreate.this,android.R.layout.simple_spinner_item, pNames); pSelectAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); selectP.setAdapter(pSelectAdapter); selectP.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub String nameSelected = pNames.get(arg2); pID = pMatch.get(nameSelected); p.setText(nameSelected); } @Override public void onNothingSelected(AdapterView&lt;?&gt; arg0) { // TODO Auto-generated method stub } }); </code></pre>
android
[4]
5,120,961
5,120,962
Package background autoupdater without using google play market without user interaction
<p>My app not stored in google play, it is stored in my server. My device does not have google play market app. New versions of my app I put to my server. I want that my app would update in background automatically without user interaction. Is it possibble? I checked several links on stack regarding to this question, but I want to refresh it. Thank you. </p>
android
[4]
2,789,823
2,789,824
How can I improve this basic jQuery code?
<p>I'm just starting to get my hands dirty with some basic jQuery. I want to be able to add a "defaultValue" attribute to any textbox and then have the box cleared on focus and then the default value reinserted into the textbox if the value is blank. I've come up with a basic couple of function to do this, but is there a better way? I seem to recall seeing some examples of jQuery functions that don't rely on two separate methods...</p> <pre><code>$(document).ready(function () { $('input[type=text]').click(function () { var defaultValue = $(this).attr('defaultValue'); if ($(this).val() == defaultValue) $(this).val(''); }); $('input[type=text]').blur(function () { var defaultValue = $(this).attr('defaultValue'); if ($(this).val() == '') $(this).val(defaultValue); }); }); </code></pre>
jquery
[5]
3,699,405
3,699,406
TimePicker Android
<p>I am making an simple alarm clock in android, and I want to set the alarm in any time i want but i have no idea how can i do that. I have an layout where I have timepicker and now from this line of code alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + (5 * 1000), sender); I wanna make my own time which i choosed from the layout from timepicker. I have referenced timepicker </p> <pre><code>TimePicker addtime; ddtime = (TimePicker) findViewById(R.id.addtime); </code></pre> <p>How to get actually the value time which are in the timepicker??</p>
android
[4]
1,435,436
1,435,437
OnTextChanged loses focus when AutoPostBack is true
<p>I have a ASP.Net webform that has several textboxes. Some of the textboxes have an OnTextChanged event with AutoPostBack set to true.</p> <p>When the user enters some text and leaves the textbox, I want some code to run. This part works fine.</p> <p>The problem is that if a user enters some text, then clicks or tabs to another textbox, the OnTextChanged of the current textbox event fires fine but the textbox that the user clicked on does not keep focus. This causes problems because the user thinks they are on the next textbox but they aren't. And no object seems to have the focus.</p> <p>Is there anything that can be done to make the next object keep focus while the OnTextChanged event of the current textbox fires?</p>
asp.net
[9]
5,821,155
5,821,156
horizontal Text on a circle
<p>Hello i want to place several Text around a circle, but dont want to rotate it, the Text should be horizontal, like a speedometer. Rotate canvas or TextOnPath rotate the text, so its not horizontal.</p> <p>How can i do this in Android?</p> <pre><code> for (int i = minValue; i &lt;= maxValue; ++i) { float y1 = scaleRect.top; float y2 = y1 - 0.020f; canvas.drawLine(0.5f, y1, 0.5f, y2, scalePaint); if (i%2==0) { String valueString = Integer.toString(i); canvas.drawText(valueString, 0.5f, y2 - 0.015f, scalePaint); } canvas.rotate(degreesPerNick, 0.5f, 0.5f); } </code></pre>
android
[4]
1,115,571
1,115,572
UISearchBar disable table view on activation
<p>I have a UISearchBar in the table cell. All done in code (not in IB). When the search bar is activated I want to disable the table view are between the search bar and keyboard, so there is no way to touch and navigate out of this view. Cannot really get it working. Help please.</p>
iphone
[8]
3,974,227
3,974,228
If condition with && precedence not working
<p>Code:</p> <pre><code>if (!IDTextField.value &amp;&amp; !FirstNameField.value &amp;&amp; !LastNameField.value &amp;&amp; !DateOfBirthField.value!GenderField.value) { alert('No criteria Added'); return; } </code></pre> <p>The <code>alert</code> is not called when all the text fields are blank.</p>
javascript
[3]
3,902,119
3,902,120
ASP.NET localization translating HTML Content
<p>I am localizing an ASP.NET site using automatic feature , where it creates a local resource file and adds the meta keyword to asp.net controls. However I have a lot of HTML like below</p> <pre><code>&lt;h2&gt; Welcome to our page"&lt;/h2&gt; &lt;li&gt; Option one &lt;/li&gt; </code></pre> <p>Is there a way to get these automatically translated using the automatic localize utility ? I tried adding the runat="server" for these tags but to no avail.</p> <p>Also instead of localizing page by page is there a way to localize bulk - it a directory or a site at one go</p> <p>thanks</p>
asp.net
[9]
3,963,013
3,963,014
Code Editor control for ASP.NET
<p>I am aware of the Rich Text box controls, but I'd like to know if there are any controls I can use for users to enter C# code (with intellisense if possible)?</p> <p>Thanks!</p> <p>EDIT: Still looking for one</p>
asp.net
[9]
445,454
445,455
What is better for JavaScript validation, JSLint or JavaScript Lint?
<p>The two projects seem to be trying to accomplish the same task but they both go about it in very different ways. In your opinion, which one do you think is more relevant to the everyday javascript developer? Until recently, I hadn't even heard of <a href="http://www.javascriptlint.com/" rel="nofollow">Javascript Lint</a> but have heard plenty about <a href="http://jslint.com/" rel="nofollow">JSLint</a>. If popularity is any indicator, JSLint seems to be the clear winner.</p> <p>Thoughts?</p>
javascript
[3]
3,072,976
3,072,977
How can we get the values entered in edittext from one activity to another?
<p>I am devoloping a dictionary application and i have declared two string dynamically..</p> <pre><code>final String words[]={ "Gamble", "Stress", "Stammer" }; final String meanings[]={ "To play", "Tension", "To speak with involuntary pauses or repetitions " }; </code></pre> <p>When the user enters the word in edittext view I want to switch to another activity if the word is found from the above array and show the meaning on the next activity.</p> <p>How can I fetch the meanings array to display on second activity?</p>
android
[4]
3,065,102
3,065,103
Validating a String and calling an activity as per the result
<p>I wanted to call a different activity if my String value(from) is empty and vice verse:</p> <pre><code> String[] from = new String[] { "name" }; if (from.length &gt;= 1) { int[] to = new int[] { R.id.countryTextView111}; conAdapter = new SimpleCursorAdapter(CountryList.this, R.layout.countrylist, null, from, to); setListAdapter(conAdapter); // set adapter } else { Intent intent = new Intent(getApplicationContext(), EmailSettings.class); startActivity(intent); } </code></pre> <p>For some reason my Condition isn't working so need an Expert view.</p> <p>Thanks,</p> <p>Ali</p>
android
[4]
425,686
425,687
call this function with url parameter
<p>How to call this function with url parameter</p> <pre><code>function test($str, $str_){ if ($str == $str) echo "null"; else echo "helloworld"; } </code></pre>
php
[2]
3,749,421
3,749,422
when I click a gallery textview a listview has to be displayed
<p>I have a text gallery.when I click one of the textview in the gallery I need to display a listview.please give me some ideas.</p>
android
[4]
2,576,356
2,576,357
Display complete umlaut with PHP text limit function
<p>I have the following function that replaces strings with more than 32 characters with "...". My problem is that if an umlaut falls in the range of 29th - 33rd character, it is represented by a weird character. How do I alter the function to show the entire umlaut without breaking it, despite what number length I place in the variable $length?</p> <p>For example, there are 31 characters ahead of für, but using the function below, it gives 31 characters plus f�...</p> <pre><code>function textLimit($string, $length, $replacer = '...') { if(strlen($string) &gt; $length) return (preg_match('/^(.*)\W.*$/', substr($string, 0, $length+1), $matches) ? $matches[1] : substr($string, 0, $length)) . $replacer; return $string; } </code></pre>
php
[2]
1,732,653
1,732,654
How to get contacts in Android
<p>I am a developing an application for composing sms in android platform. For that i need to get "Contacts", "Recent Contacts" and "Groups". Please tell me any tutorial or the code of how to do it. When we click on any of these three buttons there should be contacts along with a checkbox for selecting multiple contacts. Thanks.</p>
android
[4]
4,721,282
4,721,283
What is a better practice to handle dynamic form content?
<p>I design a form that contains dynamic contents.</p> <p>For example, The form has a textfield for Paper_Name and a textfield for Paper_Link. The user can add up to ten paper names and paper links.</p> <p>The id for each paper name and paper link is as follows:</p> <p>papername01, paperlink01, ..., papername10, paperlink10.</p> <p>Those ids are dynamically created by JavaScript. In other words, if the user doesn't click Add Paper button and submit the form, the only field that will be received by the server is paperlink01, and papername01.</p> <p>Now, the question what is a better practice to design the server PHP script to handle those submitted form content.</p> <p>1> Use aJax form plugin? 2> Use regular form submission and iterate through all variables and see whether any of them is set? 3> use JSON data format?</p> <p>Yes, the question is related to both server and client. I would like to know the best practice and change my client accordingly. Please help and thank you</p> <p>The form design looks like the following: &lt; div id="divDummy001"> &lt; div id="paperTitle001Fld"> &lt; label for="papertitle001">Title of Paper 001&lt; /label > &lt; div> &lt; input type="text" size="16" value="" id="papertitle001" name="papertitle001" /> &lt; /div > &lt; /div ></p> <pre><code> &lt; div id="paperURL001Fld" &gt; &lt; label for="paperurl001"&gt;Paper Link 001&lt; /label &gt; &lt; div&gt; &lt; input type="text" size="96" value="" id="paperurl001" name="paperurl001" /&gt; &lt; /div &gt; &lt; /div &gt; &lt; /div &gt; </code></pre> <p>When the user clicks Add button, a new div will be created with the only difference is that the ID will be increased by 1.</p>
php
[2]
1,576,757
1,576,758
C++ - accepting command line arguments?
<p>So this was my original code:</p> <pre><code>#include &lt;iostream&gt; using namespace std; int main () { float x; cout &lt;&lt; "Please enter an integer value: "; cin &gt;&gt; x; if ((x &gt;= 100) &amp;&amp; (x &lt; 200)) { cout &lt;&lt; "split"; } else if (x == 0 ||x == 1 ) { cout &lt;&lt; "steal"; } else { cout &lt;&lt; "split"; } system("pause"); } </code></pre> <hr> <p>It works perfectly, but I need it to run this way:</p> <pre><code>C:\&gt; program.exe 109 </code></pre> <p>it will read <code>109</code> and give the output - <code>"steal"</code>. </p> <pre><code>C:\&gt; program.exe 0.5 </code></pre> <p>it will read <code>0.5</code> and give me the output <code>"split"</code>. </p> <p>What do I have to add to my original code to do this? </p>
c++
[6]
1,635,844
1,635,845
Javascript numerical calculation concerns
<p>I am implementing a currency converter with javascript, e.g., convert USD to SGD. Do you know any article or trick about concerns like precision issue that I need to tackle? </p> <p>Thanks.</p>
javascript
[3]
2,719,351
2,719,352
write a C/C++ program to find if a machine is 32 bit or 64 bit
<p>I searched in web, could not get any program.<br> I found following links <a href="http://stackoverflow.com/questions/2601540/size-of-machine-64-or-32-bit">size of machine 64 or 32 bit</a> and <a href="http://stackoverflow.com/questions/3113958/processing-files-in-64-bit-machine-but-developing-in-32-bit-machine">processing files in 64 bit machine but developing in 32 bit machine</a>.<br> Now it is clear that sizeof(int*) is not the way. Because it will return 4/8 based on the architecture of the machine used for compilation. So then how to find it?<br> Condition: do not use any system/os/library call.<br> Actually it is a question asked in the interview.</p>
c++
[6]
3,385,111
3,385,112
f.write vs print >> f
<p>There are at least two ways to write to a file in python:</p> <pre><code>f = open(file, 'w') f.write(string) </code></pre> <p>or</p> <pre><code>f = open(file, 'w') print &gt;&gt; f, string </code></pre> <p>Is there a difference between the two? Or is any one more Pythonic? I'm trying to write a bunch of HTML to file so I need a bunch of write/print statements through my file(but I don't need a templating engine).</p>
python
[7]
3,174,297
3,174,298
Image upload format
<p>I have a form for uplading photo. That photo should be either <code>.jpg</code>, <code>.jpeg</code>, <code>.png</code>, or <code>.bmp</code>. When I am trying to upload an image, or photo, then it will stored in a temporary folder and the name of the image/photo should be the user_id of the form. Till yet am done..</p> <p>But my problem is that, </p> <ol> <li>only the <code>.jpg</code> file is uploaded and displayed and when I try to upload the other type, then it will stored in temporary folder, and it does not displayed.</li> </ol>
php
[2]
3,537,413
3,537,414
JQuery Show Div on Hover
<p>I'm trying to figure out how to use JQuery to display some tools when the user is hovering over a content block. For example, the blocks are displayed as follows with the tools initially hidden: </p> <pre><code>&lt;div id="block_1"&gt; &lt;div class="tools" style="display:none;"&gt;Tools Here&lt;/div&gt; &lt;/div&gt; &lt;div id="block_2"&gt; &lt;div class="tools" style="display:none;"&gt;Tools Here&lt;/div&gt; &lt;/div&gt; </code></pre> <p>I need it to show the tools for block_1 when the user is hovering over anything in block_1.</p> <p>I see that you can use wildcards to do something like:</p> <pre><code>$("*[id^=block_]").hover( function () { // somehow toggle div.tools for this block }, function () { // somehow toggle div.tools for this block } </code></pre> <p>I just can't figure out how you can specifically toggle just the div.tools for that block...</p>
jquery
[5]
2,668,204
2,668,205
Display date also in Arabic numbers - PHP
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/11646546/convert-numeral-date03-11-1991-into-arabic-no-php">Convert numeral date(03-11-1991) into arabic no(۱۹۹۱/۱۱/۰۳) php</a> </p> </blockquote> <p>This is my client's requirement. He want to show Today's date in Normal numbers and below that in Arabic numbers too. <a href="http://i.imgur.com/lolRi.png" rel="nofollow">see this screen shot</a></p> <p>I can get the current date easily by the following code snippet :</p> <pre><code>$current_date = date('d').'-'.date('m').'-'.date('Y'); </code></pre> <p>but how could i convert the numbers to Arabic numbers and display them.? Please advice good methods to do this.</p>
php
[2]
201,680
201,681
Is there any specific use when a c/c++ sentence consists of only a variable name?
<p>I once saw a snip of code as below,</p> <pre><code>/** Starts a synchronized block * * This macro starts a block synchronized on its argument x * Note that the synchronized block defines a scope (i.e. { }) * All variables declared in it will live inside this block only */ #define SYNCHRONIZE_ON(x) { \ const abcd::LockBase &amp; __lock = \ abcd::MakeLock(x); __lock; /** Ends a synchronized block */ #define END_SYNCHRONIZE } </code></pre> <p>The <code>SYNCHRONIZE_ON</code> and <code>END_SYNCHRONIZE</code> are used together to synchronize on an object. The macro <code>SYNCHRONIZE_ON</code> defines a variable <code>____lock</code> in it's block.</p> <p>The question here is: <strong>what is the sentence <code>__lock;</code> (after the <code>abcd::MakeLock(x);</code>) for?</strong> Notice that this sentence consist of only the variable name.</p>
c++
[6]
1,088,001
1,088,002
Using customview from library in project
<p>I have CustomLayout class declared in a library customAndroidLibrary. This CustomLayout extends ViewGroup. Now I want to use this CustomLayout in my layout.xml which is in my project. I have included this library in my project.</p> <p>CustomLayout class</p> <pre><code>package com.android.custom; public class CustomLayout extends ViewGroup { ..... } </code></pre> <p>layout.xml</p> <pre><code>&lt;com.android.custom.CustomLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/animation_layout" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;/com.android.custom.CustomLayout </code></pre> <p>MainActivity</p> <pre><code>package com.android.ui; public class MainActivity extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.layout); } } </code></pre> <p>But it is throwing Class Not Found exception Even it is not detecting my activity also if I am using the custom view in layout.xml If I am using simple textview in layout.xml. Then it is not giving any error.</p> <p>Can anyone please help me</p>
android
[4]
2,332,973
2,332,974
Jquery/JavaScript String Difference
<p>How to find difference between two strings?</p> <p>Eg</p> <pre><code>str1='how are you Mr x?'; str2='who are you Mr x?'; </code></pre> <p>Now differences are 'how' and 'who'.</p> <p>Like this example, find that difference.</p>
javascript
[3]
628,564
628,565
Python operator that mimic javascript || operator
<p>I am Python newbie, so maybe don't knew if this is obvious or not.</p> <p>In Javascript <code>a||b</code> returns <code>a</code> if <code>a</code> is evaluated to true, else returns <code>b</code>. Is that possible in Python other than lengthy if else statement.</p>
python
[7]
5,437,756
5,437,757
This weird piece of code I always see in Javascript
<p>I'm not Javascript expert, but the old Javascript I know is just a bunch of simple functions and variables like this:</p> <pre><code>function doSomething(){ var data = "test"; return data; } </code></pre> <p>But lately I'm seeing some Javascript code like this:</p> <pre><code>$(document).ready(function(){ $("#about").hide(); $(".tababout").collapser({ target: '#about', effect: 'slide', changeText: false, }); }); </code></pre> <p>What the hell is this? What is it called? Is it easier and supported by all browsers? I need more informations about this please.</p>
javascript
[3]
2,485,138
2,485,139
mouseleave for two elements to hide another div
<p>I need my submenu div to only disappear when both li item and the submenu itself are not hovered.</p> <p>CSS solution will not work here as I need to use first-child hover and the submenu div is not a child element.</p> <p>I have searched the forums but can't find a solution for this when the submenu is not a child of the li item.</p> <p>HTML:</p> <pre><code>&lt;ul id="top-menu"&gt; &lt;li&gt;item 1&lt;/li&gt; &lt;li&gt;item 2&lt;/li&gt; &lt;li&gt;item3&lt;/li&gt; &lt;/ul&gt; &lt;!-- somewhere else in DOM (not directly after or child of menu) --&gt; &lt;div id="#menu1_expansion"&gt; sub menu1 content &lt;/div&gt; </code></pre> <p>jQuery:</p> <pre><code> $(document).ready(function () { $('#top-menu li:nth-child(1)').hover( function() { $('#menu1_expansion').stop(); if ($('#menu1_expansion:hidden')) { $('#menu1_expansion').show(); } } ); $('#menu1_expansion').mouseleave( function(){ $('#menu1_expansion').hide(); }); }); </code></pre> <p>CSS:</p> <pre><code>#menu1_expansion {display:none; position:absolute;} </code></pre> <p>Currently this gets the submenu to appear on li item hover and the submenu disappears when mouseleave but I need the submenu to hide when both it AND the li item is mouseleave - can anyone advise how to do it? thanks.</p>
jquery
[5]
2,958,206
2,958,207
How to play videos in c#?
<p>I want to know how to play videos dynamically in asp.net. in my project gave provision to add videos.path of videos will be in project and videos saved in one of folders in application named videos.I displayed them also.when clicks each item i want to run that particular video.used flash player object and vlc media player object .but its not coming in all systems.How to do this searched many times in internet but didnt get any useful link.How to do this?</p> <p>Thanks in Advance Amrutha </p>
c#
[0]
3,766,005
3,766,006
HTML Email Newsletter Editing
<p>i'm developing a website like email marrketing campaign in Asp.Net C# and i want to add functionality of editing of email newsletters like exist in email marketing system you may see. plz guide me how can i add this functionality thanks </p>
c#
[0]
5,504,021
5,504,022
Behavior of Java's ScheduledExecutorService.scheduleAtFixedRate()
<p>I have a question regarding the <a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ScheduledExecutorService.html#scheduleAtFixedRate%28java.lang.Runnable,%20long,%20long,%20java.util.concurrent.TimeUnit%29" rel="nofollow">scheduleAtFixedRate()</a> method on ScheduledExecutorService in Java 6. </p> <p>[<strong><em>edit</em></strong>: the Javadoc for 1.6 is more complete than that for 1.5. See comment below]</p> <p>Given that:</p> <ul> <li>the ScheduledExecutorService is constructed with N = 1 thread in the pool</li> <li>the fixed-rate is a period of T seconds</li> <li>no initial delay</li> </ul> <p>What happens in this case (times are not meant to be absolute, in the real-time sense):</p> <ul> <li>at time T, the service kicks off a Runnable task, "task1"</li> <li>at time 2T, task1 has not yet completed, and service is scheduled to fire </li> </ul> <p>Is the service guaranteed to do any of the following?</p> <ul> <li>(a) at 2T, kick off a Runnable task, "task2" (recall N = 1)</li> <li>(b) block until task1 is finished</li> <li>(c) skip this time and try again at 3T</li> <li>(d) behavior is undefined </li> </ul> <p>Or something else? Does the answer change if N > 1 ?</p>
java
[1]
3,339,941
3,339,942
How to assign the value of AutoCompleteTextView from Dropdown selected value to another String
<p>Friend's I need help on setting the data content showing from DropDownlist of auto complete text box to another string,when i click the particular content from dropdown list. Help me.</p> <p>thanks in advance.</p>
android
[4]
2,082,714
2,082,715
Is there a fiddler like app for IPhone to see what HTTP calls are being made?
<p>This is for troubleshooting my app on IPhone.</p>
iphone
[8]
1,530,986
1,530,987
Externalize rendering of polymorphic objects
<p>Let's say we have a classical polymorphic architecture :</p> <pre><code>class Animal { virtual void eat() = 0; }; class Frog : public Animal { virtual void eat() { ... } }; class Chipmunk : public Animal { virtual void eat() { ... } }; </code></pre> <p>This is fine. But when it comes to rendering, I could add a virtual <code>render</code> method to the <code>Animal</code> base class just like the <code>eat</code> method.</p> <p>But then animals source files have dependencies to the particular library that is being used. This doesn't make things modulable and maintainable. Plus, their rendering code basically doesn't concern them.</p> <p>What is a nice way of putting the render specific code out of the derived classes ? </p> <p>When I say nice, I mean without using something like an overloaded method that returns a different number for each derived class so I can do a big <em>if...else if ...</em>.</p>
c++
[6]
4,824,062
4,824,063
how to put comma in every 3 digit for a number
<p>I want to put comma in every 3 digit for a number, for example.</p> <pre><code>$number = 1234567; // should print 1,234,567 </code></pre> <p>how can I do this?</p> <p><strong>update: please see this code</strong></p> <pre><code>&lt;?php /** * Get Popularity Text of a Domain via Alexa XML Data * * @return string|FALSE text or FALSE on error */ function alexa_get_rank($domain) { $alexa = "http://data.alexa.com/data?cli=10&amp;dat=s&amp;url=%s"; $request_url = sprintf($alexa, urlencode($domain)); $xml = simplexml_load_file($request_url); if (!$xml) { return FALSE; } $nodeAttributes = $xml-&gt;SD[1]-&gt;POPULARITY-&gt;attributes(); $text = (int) $nodeAttributes['TEXT']; $num = number_format($text); return $num; } </code></pre> <p><strong>in this return only 3 digit.</strong></p>
php
[2]
135,752
135,753
Is it possible to perform XOR operation on 4bytes at a time
<p>i need to perform XOR operation on 4 bytes which are represented as a single byte</p> <pre><code>b[0]=97; b[1]=98; b[2]=99; b[3]=100; int temp=0; int temp1=0; int temp2=0; int temp3=0; int temp4=0; temp1=temp1|b[0]; temp1=temp1&lt;&lt;24; temp2=temp2|b[1]; temp2=temp2&lt;&lt;16; temp3=temp3|b[2]; temp3=temp3&lt;&lt;8; temp4=temp4|b[3]; temp=temp4|temp3|temp2|temp1; </code></pre> <p>i have used the above code to convert the four bytes into a single integer. Now how can i represent this integer in a byte</p>
java
[1]
3,986,967
3,986,968
How to dynamically set directives in php.ini from our php code?
<p>How do we dynamically set directives in php.ini from our code? We were asked this question in our exam. Is this a trick question? I thought we can't set directives directly like that and it requires restarting of Apache server.</p> <p>Thanks in advance:)</p>
php
[2]
388,728
388,729
Accessing objects using index in jquery
<p>How can I access Objects when there are multiple objects are returned when using selectors?</p> <pre><code> $('.copy_anim')[i].css({ 'position' : 'relative', 'right' : '-30px', 'opacity' : '0' }); </code></pre> <p>using the above code says <code>$('.copy_anim')[i].css</code> is not a function.</p>
jquery
[5]
138,624
138,625
Asp.net - Session Timeout Windows
<p>We got few legacy apps developed in DotNet 1.0/2.0. We want to implement session timeout for these applications. </p> <p>So if user hasn't done any activity for 20 mins, pop up window should come up saying whether you want to keep the session active or not - if not then log me off, else keep his session active.</p> <p>Please help as Im new to DotNet.</p> <p>Regards</p>
asp.net
[9]
228,344
228,345
Function that takes a list of multiple strings and tuples
<p>So, I want to create a function that takes a list of multiple strings and tuples, and what it does is, if its a string, it just prints the string, but if its a tuple, the tuple takes an integer and a string and it multiplies them.</p> <p>Example:</p> <pre><code>print(something(["1stString", "2ndString", (3, "Pie"), (4, "Soda")])) </code></pre> <p>and it prints:</p> <pre><code>1stString 2ndString Pie Pie Pie Soda Soda Soda Soda </code></pre> <p>My miserable attempt:</p> <pre><code>def something(s): for x in s: if isinstance(s, str): print(s) if isinstance(s, tuple): x = tuple[0] * tuple[1] print(x) exit() </code></pre> <p>This works for the strings but not for the tuples.</p> <p>It prints out:</p> <pre><code>1stString 2ndString (3, 'Pie') (4, 'Soda') </code></pre> <p>What am I doing wrong?</p> <p>One more thing. How about if I want it to print it out as a list?</p> <p>Like this:</p> <pre><code>['1stString', '2ndString', 'Pie', 'Pie', 'Pie', 'Soda', 'Soda', 'Soda', 'Soda'] </code></pre>
python
[7]
2,590,707
2,590,708
What are these API's?
<p>i'm new to android and i would like to know about these api's..</p> <p>wen i was browsing the developers guide i found out some thing like Api 1,Api 2,Api 7......etc</p> <p>what are these Api's and the purpose of their presence.....</p>
android
[4]
828,921
828,922
How to get started with the MVC pattern
<p>It's there some good MVC framework to get started with?</p> <p>I want to migrate my projects to a MVC framework but i'm very confused and I don't know what framework is the best for learn...</p> <p>My projects always consists of backend and a frontend, programmed by me.</p> <p>Do you recommend me some book to understand MVC more deeply? What framework to use? What's the easiest to learn and the most powerful?</p> <p>Thanks</p>
php
[2]
2,396,388
2,396,389
Jquery hide onload, not working on all selected elements
<p>im trying to hide all the selected element on document ready, but only the element in the first li is hide, all other li requires to run my hover script before its hide here is the rough structure</p> <pre><code> &lt;#container&gt; &lt;.block_content&gt; &lt;ul&gt; &lt;li&gt;&lt;.selected_content&gt;&lt;/&gt; &lt;li&gt;&lt;.selected_content&gt;&lt;/&gt; &lt;li&gt;&lt;.selected_content&gt;&lt;/&gt; </code></pre> <p>Using the document.ready function {$('.block_content > ul > li.selected').hide(); $('container').hover(function).....}</p> <p>only the .selected in the first li is hidden, the other requires to hover above to trigger the second function to hide</p> <p>all of these li is under the same class, so anyone have any idea to hide them all at the start?</p>
jquery
[5]
4,807,498
4,807,499
accessing id of a label's "for" attribute
<p>I have a JSF application that produces a page with a label on it:</p> <pre><code>&lt;label for="_idJsp0:question" class="left"&gt;Question&lt;/label&gt; </code></pre> <p>And then elsewhere in the DOM is the component:</p> <pre><code>&lt;td&gt;&lt;textarea rows="7" cols="25" id="_idJsp0:question" name="_idJsp0:question"&gt;My Question.&lt;/textarea&gt;&lt;/td&gt; </code></pre> <p>For Selenium, I am building a custom location strategy using jQuery, and so my question is how do return the ID of the label's "for" attribute? I can use .attr("for") on the label to return the string of the ID but I am missing how to actually return properly formatted selector output. I've tried approaches like:</p> <pre><code>var inner = "label:contains('Question')"; $('#' + $(document).find(inner).attr('for')); </code></pre> <p>Any help would be appreciated!</p>
jquery
[5]
5,118,464
5,118,465
How to kill/abandon ALL asp.net sessions on server
<p>If I need all the sessions, of all users on a website to reinitialize themselves, or perhaps all of them to go abandoned so that they will re-init themselves, how to go about this besides restarting the www service?</p> <p>Many thanks!</p>
asp.net
[9]
5,420,648
5,420,649
Type inference with control statements
<pre><code>var sortQ = filterQ; // &lt;--- update if (iSortingCols &gt; 0) { sortQ = (sortDirs[0] == "asc") ? sortQ.OrderBy((d) =&gt; d.GetColumnData()[sortCols[0]]) : sortQ.OrderByDescending((d) =&gt; d.GetColumnData()[sortCols[0]]); if (iSortingCols &gt; 1) { for (int i = 1; i &lt; iSortingCols; i++) { sortQ = (sortDirs[i] == "asc") ? sortQ.ThenBy(d =&gt; d.GetColumnData()[sortCols[i]]) : sortQ.ThenByDescending(d =&gt; d.GetColumnData()[sortCols[i]]); } } } </code></pre> <p>The compiler underlines the two results of the ternary operator inside the for loop, saying that IEnumerable&lt;...> doesn't have a method overload called ThenBy (and similarly for ThenByDescending), but the sortQ will be an IOrderedEnumerable&lt;...> in that block. Why isn't C# type inference picking that up?</p> <p><strong>Update</strong>: for those who might have been confused before, what I left out of the original snippet was that I was assigning sortQ to the result of another query which forced the type inference engine to type sortQ as an IEnumerable&lt;..>, which of course is what was screwing up my example. The answer below is the way around this. Thanks to @Marc for reading between the lines.</p>
c#
[0]
2,669,787
2,669,788
Confusion about Internal linkage
<p>According to the definition of internal linkage that i have read everywhere states that internal linkage means object is visible at file scope or everywhere in same file.</p> <pre><code>int main() { extern int i; i = 0; //linker error } static int i; </code></pre> <p>Would you have it any way to make <code>i</code> visible inside, if its declared after main() without defining before it?</p>
c++
[6]
5,085,487
5,085,488
How to add content to html body using javascript
<p>I have many in my html and want to add more through javascript. However, using innerhtml is just replacing my existing sections with new ones, instead of adding them to the old ones.</p> <p>What else can I use?</p>
javascript
[3]
5,097,753
5,097,754
HTML editor and image upload to server
<p>in asp.net when we work with any html editor and if i include the image and text. then how image will upload to a specific folder in server and save the image relative path in db. need concept for cms.</p>
asp.net
[9]
4,379,176
4,379,177
C++ where to begin with graphics?
<p>Is there opengl for c++? I am trying to find out how to do somthing graphical but hav had no luck. Heck, I cant even find out how to make a simple window! Please help, I am a beginner too, so try to explain difficult code to me. I just want to know where to start and what to start with for graphics. All i know is that i want to use opengl.</p>
c++
[6]
1,650,072
1,650,073
Beginning to learn Java
<p>I am just starting to learn Java and I have a lot of experience with C++, particularly object oriented programming in C++. </p> <p>I hope this question isn't too narrow but I'm wanting to know suggestions for a good API to begin using with Java; I'm looking for something that has the capability to create simple standard GUI's and perhaps something that would be useful when making a game. I already know quite a bit of OpenGL, but I'm looking for something different. </p> <p>Thanks in advance </p>
java
[1]
3,380,605
3,380,606
Read from DataGridView
<p>I have dataGridView which contain column have checkbox I need to read these rows who was checked How can I do that</p>
c#
[0]
2,281,804
2,281,805
Get username of client machine using java code
<p>I am developing a web application using java. Here I want to get the username of the client machine using java code or by any other better way if not possible using java code. </p> <p>Can anyone help me for this ?</p>
java
[1]
155,910
155,911
Can I use code to load a stream of my choosing into an assembly's manifestresourcestream?
<p>I'm calling a library in a separate appdomain (this library has a memory leak and this was the way I solved it). The library has an option to either specify the manifest resource name for the file it needs or else specify a file path.</p> <p>Up until now, I've just passed the file path string from the main appdomain where my program is to the sandboxed library appdomain. However, I want to move to using embedded resources instead so I don't have to make sure to include all these files and send them to their proper directories in the installer project.</p> <p>Of course, the library is looking in the assembly that's running it (the sandbox appdomain) for the embedded resources. I need to know if there's a way to add resources to the mainfestResourceStream at runtime. If there is, I could just pass a stream object across appdomains, add it to the resource stream, then call the library.</p> <p>So, is it possible to add resources at runtime to an assemblys manifestResourceStream?</p> <p>Thanks!</p>
c#
[0]
1,793,371
1,793,372
IndentationError: expected an indented block
<p>Can someone please tell me what I'm doing wrong in this Python code sample?</p> <pre><code>for i in range(len(Adapters)): print Adapters[i] </code></pre> <p>I'm trying to list/print out the Array content but the code gives me error on print command: <strong>IndentationError: expected an indented block</strong></p>
python
[7]
4,880,249
4,880,250
Can Events be declared as Static, if yes how and why
<p>I want to know can we declare the events as static if yes why and application of such declaration.</p> <p>Sample please as seeing is believing</p>
c#
[0]
5,086,127
5,086,128
Could not find ColorSync function message in xcode message
<p>I have updated my <code>xcode</code> to 4.2 beta version. The image picked from the image picker is not shown in the imageView. It creates the following message in the console:</p> <pre><code>ImageIO - could not find ColorSync function 'ColorSyncProfileCreateWithName' ImageIO - could not find ColorSync function 'ColorSyncProfileCopyData' </code></pre> <p>Please help...</p>
iphone
[8]
2,815,996
2,815,997
Data is not getting
<p>Here I used database connection with dataset, but i am not getting the data.</p> <p>can you please help me any error in the following code</p> <pre><code> string con = @"Data Source=HA-INT13\SQL2008;" + "Initial Catalog=AdventureWorks;Integrated Security=True;database=AdventureWorks;user=sa;password=sa123"; dsReports = new DataSet(); daAdapter = new SqlDataAdapter("select * from dbo.Employees",con); SqlCommandBuilder cmdbldr = new SqlCommandBuilder(daAdapter); daAdapter.Fill(dsReports,"dbo.Employee"); </code></pre> <p>Thanks, Rajasekhar</p>
c#
[0]
327,400
327,401
How to pass series of variables in function as array or regardless of their order?
<p>I am sorry, that sounds like a noob question. I am trying to do this, maybe my question is not clear.</p> <p>I want to be able to pass something like this:</p> <pre><code>make_thumbnail( array( 'width' =&gt; 60, 'height' =&gt; 40', 'title' =&gt; 'my image' ) ); </code></pre> <p>Now the above line calls the function which already produces the thumbnails I have that no problem, but I want flexibility here. I mean my function has variables ordered like this:</p> <pre><code>function make_thumbnail($title,$width,$height) { the code.. echo ... } </code></pre> <p>Now you get what I want to do? I want to be able to pass the variables in any order.. they do not have to come in same order title, width, height.. i want to be able to specify the order when I call the function in template as I put in very first line.</p> <p>I tried to make my question as clear as I can, but really could not find anything about it.</p>
php
[2]
4,330,682
4,330,683
print arraylist element?
<p>how do i print the element "e" in arraylist "list" out?</p> <pre><code> ArrayList&lt;Dog&gt; list = new ArrayList&lt;Dog&gt;(); Dog e = new Dog(); list.add(e); System.out.println(list); </code></pre>
java
[1]
5,953,294
5,953,295
How to animate zoom out with ImageView that uses Matrix scaling
<p>So I have an ImageView using a Matrix to scale the Bitmap I'm displaying. I can double-tap to zoom to full-size, and my ScaleAnimation handles animating the zoom-in, it all works fine.</p> <p>Now I want to double-tap again to zoom out, but when I animate this with ScaleAnimation, the ImageView does not draw the newly exposed areas of the image (as the current viewport shrinks), instead you see the portion of visible image shrinking in. I have tried using ViewGroup.setClipChildren(false), but this only leaves the last-drawn artifacts from the previous frame - leading to an trippy telescoping effect, but not quite what I was after.</p> <p>I know there are many zoom-related questions, but none cover my situation - specifically animating the zoom-out operation. I do have the mechanics working - ie aside from the zoom-out animation, double-tapping to zoom in and out works fine. </p> <p>Any suggestions?</p>
android
[4]
4,010,547
4,010,548
How do I retrieve some input value in jQuery
<p>Example my temporary input is <code>1,2,3</code></p> <pre><code>&lt;input type="hidden" id="temp" name="temp" value="1,2,3"&gt; var tempvalue = $("#temp").attr("value") </code></pre> <p>With jQuery it's possible to get the number <code>3</code> only for <code>tempvalue</code>? So <code>1,2,</code> will be removed while onclick action.</p>
jquery
[5]
3,140,040
3,140,041
Indoor positioning system in android
<p>I would like to ask a question regarding redpin indoor positioning system on android. I read somewhere stackoverflow about redpin and visited their website. From there i followed their instructions on how to set up redpin on android, but i only get a red dot pointing on the top left corner of the map i uploaded. I would like to know if anyone has successfully gotten redpin to work for android and assist me in doing so?....or maybe can tell me what am I doing wrong. Sorry to ask, I am very new at this, thank you.</p>
android
[4]
4,023,517
4,023,518
how to remove page reload
<p>In my application when we click on add button a Modal PopUp Extender appears in that their are 2 asp button Save and Cancel. When we click on these buttons the page gets reloaded i have to stop it. Plz help ..</p>
asp.net
[9]
4,538,756
4,538,757
set android alarm at specific time
<p>i set the alarm at specific time but every time i open the application it will turn on this is the code i used :</p> <pre><code> AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(this, AlarmReceiver.class); PendingIntent pendingIntent = PendingIntent.getBroadcast(this,0010000,intent,0); Calendar time = Calendar.getInstance(); time.set(Calendar.HOUR, 5); time.set(Calendar.MINUTE, 59); time.set(Calendar.SECOND, 0); alarmManager.set(AlarmManager.RTC,time.getTimeInMillis(),pendingIntent); </code></pre>
android
[4]
112,274
112,275
parsing the number in the end
<p>Given:</p> <pre><code>Test123 Test 23 Test 456 </code></pre> <p>What are some ways to get the number (that's on the end) and place in an number variable?</p>
c#
[0]
3,838,457
3,838,458
WinForm resolution
<p>When I developed some winforms in C# and fixed a certain size for and run that program in another machine with smaller screen, most of the controls hide because the screen is smaller than mine. I think the best way is to fix the size in percentage according to the underlying Screen Resolution. So, how can I do so?</p>
c#
[0]
24,256
24,257
Is there a way to load thumbnails of images without loading full image and resizing?
<p>I have an app where I take multiple photos using the Camera and need to display the taken photos as thumbnails after taking.</p> <p>Is it possible to load a thumbnail of a large photo without having to load the full image?</p> <p>Currently i'm thinking of saving 2 versions of a photo when its taken with the camera, but just wondered if there is a way to load a thumbnail of an image from a file to save me having to have 2 versions of the file..</p> <p>Thanks</p>
iphone
[8]
1,639,652
1,639,653
How to implement other events for UISegmentcontrol?
<p>I have implement UISegment controll using value change event.I want to implement UIButtons event in uisegment controll.Is it possible?</p>
iphone
[8]
5,148,424
5,148,425
Can I return a reference?
<p>If i need to return a referenced value, this function code works?</p> <pre><code>&amp;int returnvalue(){ return &amp;property; } </code></pre> <p>I want to return just a reference to a property of my class, it's possible to do?</p>
c++
[6]
246,128
246,129
How to change string to datetime format in android?
<p>I am working on android project. I am setting date and time but it is displaying in the following format.</p> <p><strong>Mon Nov 19 11:00:00 GMT+05:30 2012</strong></p> <p>In my database table the datetime column datatype is <strong>datetime</strong>. So how can I change the above output to datetime format to store it in database. </p> <p>Any help in this regard will be thankful.</p>
android
[4]
2,396,037
2,396,038
How to control or override the Client Side Naming of a Server Side Control in ASP.net 3.5?
<p>Is there a way to control the client side name that is assigned to a Server Side Control in ASP.Net 3.5.</p> <p>I currently the following in an ASP.Net Repeater that just presents a list of a bunch of Yes No Questions.</p> <pre><code> &lt;asp:RadioButtonList RepeatDirection="Horizontal" CssClass="YesNo" ID="YesNo" runat="server"&gt; &lt;asp:ListItem Value="Yes" Text="Yes" /&gt; &lt;asp:ListItem Value="No" Text="No" /&gt; &lt;/asp:RadioButtonList&gt; </code></pre> <p>On the Client Side the following is what is rendered.</p> <pre><code>&lt;input id="Repeater1_ctl00_YesNo_0" type="radio" value="Yes" name="Repeater1$ctl00$YesNo"&gt; &lt;label for="Repeater1_ctl00_YesNo_0"&gt;Yes&lt;/label&gt; </code></pre> <p>I would like to be able to have the Client Side Name of the control be something like </p> <pre><code>name = &lt;%# DataBinder.Eval(Container.DataItem, "QuestionNumber") %&gt;YesNo </code></pre> <p>So when the form data is posted I can easily Identify the QuestionNumber and type of Question. </p> <p>Is there a way to override the naming scheme that asp.net using so instead of seeing Repeater1$ctl00$YesNo I will see 4YesNo when the form is posted?</p>
asp.net
[9]
5,889,676
5,889,677
Write CSV file into vectors in C (continued)
<p>Basically I have 14800x8 matrix that has been extracted from matlab as CSV file ("moves.mo"). I need to read this file into 14800 vectors with 8 values each. Here is a few lines from the file:</p> <pre><code>1,2,3,4,-1,-3,-2,-4 1,2,3,5,-1,-3,-2,-5 1,2,3,6,-1,-3,-2,-6 1,2,3,7,-1,-3,-2,-7 1,2,3,8,-1,-3,-2,-8 1,2,3,9,-1,-3,-2,-9 </code></pre> <p>I wrote the following code:</p> <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt; #include&lt;stdio.h&gt; #include &lt;string&gt; #include &lt;istream&gt; #include &lt;vector&gt; #include &lt;sstream&gt; using namespace std; int main() { std::fstream inputfile; inputfile.open("moves.da"); std::vector&lt; std::vector&lt;int&gt; &gt; vectorsmovesList; //declare vector list while (inputfile) { std::string s; if (!getline( inputfile, s )) break; istringstream ss( s ); vector &lt;int&gt; recordmove; while (ss) { if (!getline( ss, s, ',' )) break; int recordedMoveInt = atoi(s.c_str()); recordmove.push_back( recordedMoveInt ); } vectorsmovesList.push_back( recordmove ); } if (!inputfile.eof()) { cerr &lt;&lt; "Fooey!\n"; } </code></pre> <p>It compiles but does not give me desirable output (i.e. just prints Fooey!) . I don't know why... This problem at this point is driving me insane. </p> <p>Please help!</p>
c++
[6]
5,601,097
5,601,098
how to change the button text programmaticaly in iphone
<p>Im new to iphone development.here i added some list of names in pickerview.the action of pickerview was given to button in view. now i want to show.when click the button pickerview list was displayed i selected one name regarding in pickerview that name was displayed at button in view. I dont no how to change the title in button in iphone.</p> <p>Can any one plz give me information for my problem.</p> <p>thank you in advance. </p>
iphone
[8]
4,346,427
4,346,428
java one elment list
<p>What is the most efficient (performant) way to create a list with just one element? </p>
java
[1]
4,666,428
4,666,429
Get WAP MAC on iPhone/ObjC?
<p>What call can I use to get the MAC address of the WAP I'm currently connected to on the iPhone?</p>
iphone
[8]
4,486,260
4,486,261
Converting string to floating number Javascript
<p>I have a issue using variable in if condition. I have three variable where one is a string type and two more in Json. Here settings.DecimalDigits value is 2 or anything more than 2. </p> <pre><code>var controlValue = integer + '.' + mantissa; controlValue = parseFloat(controlValue).toFixed(settings.DecimalDigits); </code></pre> <p>integer &amp; mantissa will have a certain value which is stored in controlValue as string. <strong>controlValue</strong> is then compared with other two variables (<strong>settings.MaxValue &amp; settings.MinValue</strong>) in IF condition but its not going through condition as it type is <strong>string type</strong></p> <pre><code>if (controlValue &gt; settings.MaxValue) controlValue = settings.MaxValue; if (controlValue &lt; settings.MinValue) controlValue = settings.MinValue; </code></pre> <p>In my parsing all three variables will have three values in floating type </p> <p>controlValue = 123.23 or 123.00 <br/> settings.MaxValue = 99.99 <br/> settings.MinValue = -99.99 <br/> Please help so that the parsing goes through the <strong>IF Condition</strong></p>
javascript
[3]
1,103,739
1,103,740
Is it possible to perform an assignment in a PHP return statement?
<p>I have a quick question regarding PHP's return statement. In C++, we're able to perform the following:</p> <pre><code>... function body ... return (foo = bar, biz()); </code></pre> <p>Where the variable <code>bar</code> is assigned to <code>foo</code> before the result of <code>biz()</code> is returned.</p> <p>Is this possible (or something similar) in PHP? The above statement in PHP results in a parse error. Now, I'm aware that I can simply perform the assignment before the return statement, but this is just a contrived example, and I'm curious as to the feasibility. </p> <p><strong>Edit</strong>: Providing a little more clarification. Here is what I'm basically attempting to do in PHP:</p> <pre><code>return ($foo = $bar, biz()) || ($foo = $bar, baz()) || ($foo = $bar, qux()); </code></pre> <p><code>foo</code> is a global reference in which <code>biz</code> modifies. If <code>biz</code> returns false, the next segment in the OR statement is tested. Because <code>biz</code> returned false, I need to "reset" the value of <code>foo</code> before executing <code>baz</code> and so on and so forth. </p> <p><strong>I'm aware that what I'm trying to do here is impure, but I'm just curious is an equivalent (or at least similar thing) is possible in PHP.</strong></p>
php
[2]
5,671,544
5,671,545
What's wrong with my remove function?
<pre><code>Array.prototype.remove = function (obj) { for(var i = 0; i &lt; this.length; i++) { if(this[i] === obj) { if (i == this.length) { this[i] = null; } else { for(var j = i; j &lt; this.length-1; j++) { this[j] = this[j+1]; } delete this[j]; // updated from this[j] = null; still not working. } } } return this; }; </code></pre> <p>calling it with:</p> <pre><code>write("ARRAY TEST = " + [22, 33, 44].remove(33).remove(22)); </code></pre> <p>..it prints:</p> <pre><code>44,, </code></pre> <p>Why this 2 commas and how to fix my remove function to remove the commas as well?</p>
javascript
[3]
4,904,629
4,904,630
Removing a class from an HTML element using JavaScript
<p>I am attempting to remove a class from an html tag using JavaScript but I have no idea where to start. I have searched but to no avail. While I am decently fluent in jQuery, I am not in JavaScript and I need to use JavaScript in this instance Anything I have found thus far would need to be adjusted for my own use, which I have not been successful at. Hopefully someone can explain it in a fool-proof way.</p> <p>The element the class is attached to is the "ul" tag. The class is named "nojavaScript" and is only applied to this single instance of the "ul" tag. While as I said the class is only used once in the page, the "ul" tag is used in other instances with different classes or ids. If it would make it easier for the JavaScript, I can change the class to an id.</p> <p>I hope I have given you enough to go on. I will include an example of the html code below.</p> <pre><code>&lt;ul id="lines_list" class="nojavaScript"&gt;&lt;/ul&gt; </code></pre> <p>As I mentioned, if it's easier to remove an id than a class, I can make the current id a class, and the current class an id. But essentially it's the "nojavaScript" that needs to be removed.</p> <p>Thanks!</p>
javascript
[3]
5,810,664
5,810,665
Need Help- Switch statement
<p>Hello I'm new to programming and I need help figuring out what is wrong with my code.</p> <p>Basically I need to take a letter A-Z and convert it to Leek(a combo of sign,#,letter that look like the A-Z characters. I'm only allow to use switch statements (switch,case,breaks) also I have to use the .next().charAt(0) method.</p> <p>I have been researching for days and still no luck on figuring out what is wrong. When I try to compile my program it comes up with multiple error all reading "can not find symbol" pointing at the a-z character i used in the case statement. Could someone be kind and point out what I'm doing wrong?</p> <pre><code>import java.util.Scanner; public class dlin_Leet { public static void main(String args[]) { Scanner input = new Scanner(System.in); char character;//input by user String Leet; System.out.print("Enter character to convert:"); String Leet = input.next(); char character = Leet.charAt(0); switch (character) { case a: Leet = "4"; break; case b: Leet = "I3"; break; case c: Leet = "["; break; case d: Leet = ")"; break; case e: Leet = "3"; break; case f: Leet = "|="; break; case g: Leet = "&amp;"; break; case h: Leet = "#"; break; case i: Leet = "1"; break; case j: Leet = "J"; break; case k: Leet = "|&lt;"; break; case l: Leet = "1"; } System.out.println(Leet); } } </code></pre>
java
[1]
1,866,489
1,866,490
C# more elegant replacement for foreach-search
<p>Here is the entirety of a method inside a class:</p> <pre><code>public Foo GetFooByInfoName(string name) { Debug.Assert(name != null, "name is not an optional argument"); foreach (Foo f in storedFoos.Values) { if (name.Equals(f.FooInfo.Name)) { return f; } } return null; } </code></pre> <p>I have obviously changed the names, so assume FooInfo is required and Name can't simply be a property of the class Foo.</p> <p>Is there a more elegant way to write this method? I'm not very familiar with C# but I feel like there's an extension method or something which can turn this method into a 2-liner.</p> <p>Note I'm looking for readability, it's not a contest to reduce the number of lines. I simply think the method would be more clear if C# had a way to search for the named <code>Foo</code> in one line.</p> <p>(I'm using C# 3.5)</p>
c#
[0]
4,931,227
4,931,228
What version of Python should I use if I'm a new to Python?
<p>If I'm absolutely new to Python and am literally reading about printing statements to console, variable types, collections, etc:</p> <blockquote> <p>What version of Python should I use?</p> </blockquote> <p>I'm aware that there is an abundance of 3rd party libraries for Python 2.6.x, but I'm scared I'll learn some things that won't carry over well into Python 3.</p> <p>For example, in Python 3 you can use input(), in Python 2 you have to use raw_input().</p> <p>Thank you very much for the information.</p>
python
[7]
1,587,842
1,587,843
How to check if my list has an item from another list(dictionary)?
<p>I'm a beginner in programming with python, and I've got a question which may have an easy answer.</p> <p>So I have a dictionary of words which is imported from a .txt file, next my program asks you to type a sentence, and then it saves every word which you've typed into another list.</p> <p>I have to write a program which checks if every word of a list named <code>sentence_list</code> is in the list which is named <code>words</code>. If the word is not present in the dictionary I have to put it in another list which is being filled by all the words that are mistyped or not in the dictionary.</p> <p>For easier understanding, my program should work something like that:</p> <pre class="lang-none prettyprint-override"><code>Type your sentence: My naeme is John, I lieve in Italy, which is beatiful country. </code></pre> <pre><code>['naeme', 'lieve', 'beatiful'] </code></pre> <p>This is what I could do until now:</p> <pre><code>words = open("dictionary.txt", encoding="latin2").read().lower().split() sentence=input("Type your sentence: ") import re sentence_list = re.findall("\w+", sentence.lower()) </code></pre> <p>I know I have to do something with for, but for is different in python that it is in Javascript, which I am familiar with.</p>
python
[7]
1,342,160
1,342,161
jQuery .fadeIn() not working as expected
<p>I have the code below for showing a submenu. I want the submenu to fade in on mouse-over, but it doesn't fade in - it just immediately shows the submenu:</p> <pre><code>jQuery("ul li").mouseover(function() { jQuery(this).fadeIn(1000, function () { jQuery(this).find('ul').css('right','0px').css('top','24px'); }); }).mouseout(function(){ jQuery(this).find('ul').css('right','-1000px'); }); </code></pre> <p>thanks</p>
jquery
[5]
2,029,564
2,029,565
JQuery selector question for classes / ids containing the same number
<p>My website has a set of elements with the classes "element1", "element2", "element3", etc, and also another set containing elements with the classes "1", "2", "3". These are not directly related in the DOM so I cannot use parent / child selectors.</p> <p>I want to write a JQuery script that, when the user hovers on "element1", triggers an effect / function in "1".</p> <p>Of course, I don't want to write all the pairings manually. How could I write this code so the selectors "detect" the number in the class names? Do I need to use regular expressions?</p> <p>I can change my HTML if needed.</p>
jquery
[5]
800,063
800,064
unable to be compiled
<pre><code>#include &lt;iostream&gt; using namespace std; template &lt; class T &gt; void swap (T&amp; a, T&amp; b) { T temp = a; a = b; b = temp; } int main () { char a = 'a'; char b = 'b'; swap (a, b); cout &lt;&lt; "a = " &lt;&lt; a &lt;&lt; endl; cout &lt;&lt; "b = " &lt;&lt; b &lt;&lt; endl; return 0; } </code></pre> <p>the code can not be compiled under linux KDE command line (gcc compiler). however if I change "using namespace std" into "using std::cout; using std::cin using std::endl" the program can be compiled and run well. what's wrong with it? Thank you very much</p>
c++
[6]
3,201,119
3,201,120
PHP - Cleanup the Junk
<p>I have inherited a very messy project. There are at least 3 versions that I can tell in it. </p> <p>Is there a utility that can trace the PHP code from the main index.php so that I can figure out what isn't being used and what is, or am I stuck doing a manual cleanup?</p> <p>Thanks</p> <p>*<strong><em>Update</em>*</strong></p> <p>I don't think I've been clear about what I'm looking for, that or I'm not understanding how the products mentioned work. What I'm looking for is something that can run on a folder (directory) and step through the project and give me a report of which files are actually referenced or used (in the case of images, CSS, etc). </p> <p>This project has several thousand files and it's a very small project. I'm trying to clean it up and when I do a "search in files" in my IDE I get 3 or 4 references and can't easily tell which one is the right one.</p> <p>Hope that makes it a little clearer.</p>
php
[2]
384,947
384,948
C# - How to add a reference do system.numerics.dll
<p>I want to use the BigInteger class from the System.Numerics but if i want to write </p> <pre><code>using System.Numerics </code></pre> <p>Numerics is not found. I searched the web and I found that I have to add a reference to System.Numerics.dll But how can I do that?</p>
c#
[0]
5,903,455
5,903,456
How to Reference ConnectionString in ASP.NET?
<p>I have a web project and a separate project for a class which contains a constant and I am thinking of adding a connection string. What is the best way for storing this? </p> <p>Thanks</p>
asp.net
[9]
3,281,070
3,281,071
event to identify Call Answering In Android
<p>Hi i am developing call recording application. I want to know call answering event. For example if the user lift the call then i have to start recording. How to know whether he answered a call or not</p>
android
[4]
4,552,760
4,552,761
Custom php.ini when using #!/usr/bin/php
<p>I have a script in which I am trying to load a custom <code>php.ini</code> file. The script is run on *nix systems via a <code>#!/usr/bin/php -qc /path/to/php.ini</code> header. When doing this, however, PHP reports that the loaded <code>php.ini</code> file does not exist, i.e. none is loaded.</p> <p>If I execute <code>php -qc /path/to/php.ini /path/to/script</code> in the command line directly, it picks up the <code>php.ini</code> -- is it possible to override the <code>php.ini</code> file using the <code>#!</code> notation?</p>
php
[2]
129,172
129,173
Loop to find max value
<p>hi i'm having a problem to write a loop which finds the largest value.</p> <p>A list of integers and an integer variable are declared like this: List list; int max; </p> <p>Assuming that some values (including negatives!) have been added to the list. i need to find the largest value in list and stores it in max.</p> <pre><code>// start of test code
 import java.util.*;
 public class ListTest
 {
 private List&lt;Integer&gt; list;
 private int max; public void findMaxInListTest()
 {
 list = new ArrayList&lt;Integer&gt;(); // could be a Linked list
 list.add(0); list.add(-99);
 list.add(99); list.add(1320);
 list.add(470000);
 list.add(12); list.add(-5000); list.add(300); /*# max = starting value
 iterate through list to set max = max value in list
 in this case 470000
 */
 }
 } </code></pre> <p>i tried using this loop but then encounter an error: int max = list[0]; for(int i=470000;i &lt; list.length;i++){ if(list[i] > max){ max = list[i]; } } return max;</p> <p>do you know which kind of loop that appropriate for this? Thanks</p>
java
[1]
3,896,199
3,896,200
PHP array_pop is not working
<pre><code>$fav = explode("|","0 | 1 | 2 | "); print_r($fav); $fav = array_pop($fav); echo "&lt;br&gt;after &lt;br&gt;"; print_r($fav); </code></pre> <p>what's the problem in my code? i want to remove the last value in the array <code>$fav</code>.</p>
php
[2]
5,707,804
5,707,805
Compare percentage of words or characters
<p>I have a of list of phrases. Each phrase can be a single word or a list of words.</p> <p>I would like to compare a phrase with each of its sibling phrases and rank those which match the most. Character match or word match come to mind. However the list is quite dirty with commas and hyphens, non-closed brackets etc.</p> <p>The ranking does not have to be terribly accurate. It is needed as a helper for content editors.</p> <p>Example list:</p> <pre><code>Hello sir, how are you? </code></pre> <p>Top ranking siblings to this phase in this list </p> <pre><code>Hello madam, how are you? How are you today? Today, are you well? </code></pre> <p>Is there an existing function out there to help with this?</p>
c#
[0]
3,636,732
3,636,733
If you .Remove() a specific item from a List<T> does it also remove the 'empty slot'?
<p>Feel free to correct my terminology, and understanding of the List if needed..</p> <p>If I have a list of five items where each item has a unique ID...</p> <pre><code>[item 1] [item 2] [item 3] [item 4] [item 5] </code></pre> <p>and I remove item with ID 72 (for example) and it happens to be 3rd in the List...</p> <p>will it end up like this...</p> <pre><code>[item 1] [item 2] [null] [item 4] [item 5] </code></pre> <p>or like this</p> <pre><code>[item 1] [item 2] [item 3] [item 4] </code></pre> <p>where what used to be item 4 is now item 3, etc.</p> <p>Please explain if you can :)</p>
c#
[0]