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
1,001,614
1,001,615
how to push application to foreground of it is pushed background?
<p>Hi guys I am developing an application in which I have created a screen i.e is activity. once the activity is been displayed it disables all the keys. But some how I am able to switch my application to background. So is there any way that if my application is pushed to background it automatically comes again to foreground? As in blackberry we can do it using activate() and deactivate() method.</p>
android
[4]
965,963
965,964
Backing Up mmssms.db From /data/ With Root Permissions
<p>I am trying to write an Android application for myself that will simply copy the file located at /data/data/com.android.providers.telephony/databases/mmssms.db to a location on my sdcard, /sdcard/test/mmssms.db</p> <p>The device is rooted and the application has been granted super user access but the file is never actually copied. The destination directory does exist and the SDK for the application for is 1.5. The following are the commands used to perform the backup.</p> <pre><code>Runtime.getRuntime().exec("su"); Runtime.getRuntime().exec("mount -o rw,remount -t yaffs2 /data/data/com.android.providers.telephony/databases /data"); Runtime.getRuntime().exec("chmod -R 777 /data/data/com.android.providers.telephony/databases"); Runtime.getRuntime().exec("cp /data/data/com.android.providers.telephony/databases/mmssms.db /sdcard/test/mmssms.db"); </code></pre> <p>The following permission is used in the Manifest xml:</p> <pre><code>&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; </code></pre> <p>I would just like to know what I can do to be able to copy the that file and the others in the /data/ directory. Thanks for your time.</p>
android
[4]
2,417,511
2,417,512
iPhone: how to create an empty bitmap in memory?
<p>I need to create a empty bitmap (in memory) with known values of the width and height. I'll use context of this bitmap to draw and then display image on the MKOverlayVew. Does anyone know the easiest way to do this?</p>
iphone
[8]
4,207,174
4,207,175
how to add image to html file which is created using file.create method
<p>i am creating html file by using below code</p> <pre><code>string path = HttpContext.Current.Server.MapPath("Attachments/test.html"); // Delete the file if it exists. if (File.Exists(path)) { File.Delete(path); } // Create the file. using (FileStream fs = File.Create(path, 1024)) { byte[] info = new UTF8Encoding(true).GetBytes("&lt;html&gt;&lt;body&gt;&lt;div&gt;Test&lt;/div&gt;&lt;/body&gt;&lt;html&gt;"); // Add some information to the file. fs.Write(info, 0, info.Length); } </code></pre> <p>I want to add a image to this html file... how to add image to this html file.</p>
c#
[0]
4,913,067
4,913,068
How does Python interpret this conditional?
<p>The problem I am working on is explained below:</p> <blockquote> <blockquote> <p>2.1) Write a program that asks a user to input a color. If the color is black or white, output "The color was black or white". If it starts with a letter that comes after "k" in the alphabet, output "The color starts with a letter that comes after "k" in the alphabet". (Optional: consider both capitalized and non-capitalized words. Note: the order of the alphabet in Unix and Python is: symbols, numbers, upper case letters, lower case letters.)</p> </blockquote> </blockquote> <p>Here is the authors solution:</p> <pre><code>#!/usr/bin/env python # # guess a color # answer = raw_input ("Please enter a color: ") if (answer == "black") or (answer == "white"): print "The color was black or white." elif answer &gt;= "k": print "The color starts with a letter that comes after \"k\" in the alphabet." </code></pre> <p>This is my answer to the problem:</p> <pre><code>#!usr/bin/env python # #This program asks the user to input a color color = raw_input("Please, enter a color, any color.") if (color == "black") or (color == "white"): print "The color was black or white." elif color[0] != "a" or "b" or "c" or "d" or "e" or "f" or "g" or "h" or "i" or "j" or "k": print "The color starts with a letter that comes after 'k' in the alphabet." else: print "The color was niether black nor white." </code></pre> <p>I am having trouble understanding how the authors solution works, specifically for identifying if, "The color starts with a letter that comes after "k" in the alphabet".</p> <p>How is does Python make this work?</p> <pre><code>elif answer &gt;= "k": </code></pre> <p>How is Python identifying the first character, such as color[0] and the range of letters beyond k?</p>
python
[7]
5,454,093
5,454,094
Android apps Programming solution required
<p>I am developing an app in which i want whenever a user clicks on a particular num on call log screen or a num on contact screen it should open my application view.please help. Also is it advisable to create a service for apps which monitor call logs? </p>
android
[4]
279,471
279,472
What does this code do?
<p>What does</p> <pre><code>using (SqlConnection cn = new SqlConnection(connectionString)) </code></pre> <p>do?</p>
c#
[0]
5,414,954
5,414,955
Is it a mandatory to wrap a System.Diagnostics.Process with using when I don't know whether the executable being invoked is managed or native?
<p>Is it a mandatory to wrap a <code>System.Diagnostics.Process</code> with <code>using</code> when I don't know whether the executable being invoked is managed or native? </p> <p><strong>Code 1:</strong></p> <pre><code> Process p = new Process(); p.EnableRaisingEvents = true; p.Exited += new EventHandler(p_Exited); p.StartInfo.Arguments = "-interaction=nonstopmode " + inputpath; p.StartInfo.WorkingDirectory = dir; p.StartInfo.UseShellExecute = false; p.StartInfo.FileName = "pdflatex.exe"; p.StartInfo.LoadUserProfile = true; p.Start(); p.WaitForExit(); </code></pre> <p>or </p> <p><strong>Code 2:</strong></p> <pre><code> using (Process p = new Process()) { p.EnableRaisingEvents = true; p.Exited += new EventHandler(p_Exited); p.StartInfo.Arguments = "-interaction=nonstopmode " + inputpath; p.StartInfo.WorkingDirectory = dir; p.StartInfo.UseShellExecute = false; p.StartInfo.FileName = "pdflatex.exe"; p.StartInfo.LoadUserProfile = true; p.Start(); p.WaitForExit(); } </code></pre> <p>?</p> <h2>Edit 1</h2> <p>Let consider the code 1 above, what will happen when the <code>pdflatex.exe</code> gets crashed?</p>
c#
[0]
4,935,170
4,935,171
Passing arraylist in intent from one activity to another
<p>I have a class 'Product' and i need to pass the arraylist of 'Product' objects from one activity to another. I read that i can do so by making my Product class as Parcelable and use : putParcelableArrayListExtra (String name, ArrayList value).</p> <p>In my app, i need to pass arraylists of objects from one activity to another. In this case, i need to make all those classes as parcelable and implement the interface methods. Is this the correct way to solve the problem? Is there any other way to send the list of objects in intents?</p> <p>Thanks..</p>
android
[4]
3,653,769
3,653,770
Re-Tying a the jquery click dynamically after replacing the element
<p>I have a set of nested elements like such.</p> <pre><code>&lt;div id="master"&gt; &lt;span id="num-1" class="num"&gt;&lt;/span&gt; &lt;span id="num-2" class="num"&gt;&lt;/span&gt; &lt;span id="num-3" class="num"&gt;&lt;/span&gt; &lt;span id="num-4" class="num"&gt;&lt;/span&gt; &lt;/div&gt; </code></pre> <p>And I have the following script</p> <pre><code>$( document ).ready( function() { $( '#master &gt; span.num' ).click( function() { q = $( "span[id*=num-']" ).attr( "id" ); $( '#master' ).html( '&amp;nbsp;' ).load( 'www.someurl.com/?rating=' + q ); }); }); </code></pre> <p>The load function returns a completely new set of span elements for inside the div. Problem is that I can't seem to figure out how to get this to work past the first time I click one. Since the click is tied to the spans and the spans get replaced, I understand that they no longer have a script tied to them, but I haven't been able to figure out how to get this to re-tie on the fly. I'm super new to jquery and javascript so any help would be appriciated.</p> <p>All my experiments with using .live() have merely rendered my script useless. Help?</p>
jquery
[5]
4,864,587
4,864,588
Should Properties have side effects
<p>Should properties in C# have side effects beside notifying of a change in it's states? </p> <p>I have seen properties used in several different ways. From properties that will load the value the first time they are accessed to properties that have massive side effects like causing a redirect to a different page. </p>
c#
[0]
4,532,835
4,532,836
Java import can be slow?
<p>Is import package.* slower than import package.MyClass? If yes, in which scneario: runtime or compilation?</p>
java
[1]
1,260,114
1,260,115
Porting Issue - Internet Explorer to Everything Else
<p>I have some code which was developed on a Windows 7 computer and runs any Windows 7 compeer without any hiccups. I tried running it on my Mac and the program just stays on the loading page. </p> <p>The program displays the bing maps view and loads a few things in order to get the location of a particular satellite. Now all the maths and stuff works but I think the problem lies here:</p> <pre><code>function getOrbitalElements() { TLE_Line1=""; TLE_Line2=""; pgTXT = ""; xmlhttp = null; xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); if (xmlhttp!=null) { xmlhttp.onreadystatechange = stateChange; xmlhttp.open("GET",url,true); xmlhttp.send(null); } } </code></pre> <p>So is there any way that this can be changed to run on any browser? Thanks P.S. If you need to see the entire code I'll add it</p>
javascript
[3]
3,393,593
3,393,594
Looking for a variable inside another programs memory
<p>Im trying to find a int inside another programs memory (my own little c++ that only holds that variable). The value is 1234, but i cant seem to find it :-(</p> <p>Ill post what im doing </p> <pre><code> for (uint adr = 0x00000000; adr &lt;= 0x7FFFFFFF; adr += 1) { // we want status... uint progress = (adr*100) / 0x7FFFFFFF; Console.WriteLine("Progress: {0} %", progress); // look for a int IntPtr bytes; byte[] buffer = new byte[4]; ReadProcessMemory(process, adr, buffer, 4, out bytes); if (BitConverter.ToInt32(buffer, 0) == 1234) { // we found it... } } </code></pre> <p>There are several errors, for 1 the progress does not work and i never get a hit on found. Help someone? :D</p>
c#
[0]
5,159,070
5,159,071
Multiple notification icons on one bar?
<p>Is it possible to create a notification bar that contains multiple icons horizontally and each icon launches a separate service/activity? </p>
android
[4]
4,209,150
4,209,151
How to read in one file and display content vertically and then read in another file and display content vertically in c++
<p>Hi I'm working on a program that reads in two files and i want to display the files content in their own columns for ex. </p> <pre><code>File1 File2 Time data Time data </code></pre> <p>I'm not quit sure how to create columns as such, I already have the code to read in the files and perform the functions needed its the output I'm stumped on. If anyone has any suggestions or help that would be awesome. Thanks! PS. This is NOT Homework Related. </p>
c++
[6]
1,065,204
1,065,205
How to make jquery function work more than once
<p>Can someone help me? I want to ask about the function on JQuery. When I gave JQuery function on my website, I want to provide these functions at 2 object. but somehow when I give the Jquery function to a second object, somehow function does not work. I provide these functions at two objects with the same id. so, anyone can help solve this problem?</p>
jquery
[5]
5,920,136
5,920,137
how to access the id of textarea in javascript
<p>i have to acces the id of textarea in javasript.Please tell me how we can access the id of the textarea in javascript.</p>
javascript
[3]
5,976,779
5,976,780
When exactly is a function used to initialize a global variable executed?
<p>At the top of some file in my program, outside all functions, I have these variables:</p> <pre><code>namespace { int foo = foo_func(); } int bar = bar_func(); </code></pre> <p>As you know, <code>foo</code> is a variable local only to that file, but <code>bar</code> is accessible to every file.</p> <p>...but question: When are the functions <code>foo_func()</code> and <code>bar_func()</code> actually run? Does this happen before <code>main()</code> runs, or possibly sometime later (say just before those values are actually needed)?</p>
c++
[6]
3,587,550
3,587,551
DLL exporting only certain templatized functions
<p>Hey all, so this seems to be a rather strange issue to me. I have a very simple templatized container class which is part of a DLL. The entire class is defined in a header file, to allow automatic template generation. Now another part of the DLL actually requests a certain template type to be generated, so the code should exist within the DLL. However, when using the object from another executable, the constructor/destructor, plus multiple other functions work, however 2 functions are not found by the linker. Following are is the code for these two functions, as well as for a working function.</p> <pre><code>const T** getData() const { return m_data; } int getNumRows() const { return m_nRows; } int getNumCols() const { return m_nCols; } </code></pre> <p>So the getNumRows() and getNumCols() functions are not found by the linker, however the getData() function is. Is this a common problem, do the functions need to have a templatized parameter in order to be generated?</p> <p>@1 800 INFORMATION</p> <p>I have exported this from the DLL via a standard macro:</p> <pre><code>#ifdef ACORE_EXPORTS #define ACORE_API __declspec(dllexport) #else #define ACORE_API __declspec(dllimport) #endif </code></pre> <p>And at the class definition:</p> <pre><code>template &lt; class T &gt; class ACORE_API matrix </code></pre>
c++
[6]
1,786,297
1,786,298
javascript setAttribute
<p>I am using javascript <code>setAttribute</code> for following to change 'lorem ipsum' to 'coming' in the following manner :</p> <pre><code>&lt;span id="pop_title" name="pop_title" class="title01_mc10401 ff_1 fs_10 fc22 fsb"&gt;lorem ipsum&lt;/span&gt; </code></pre> <p>Script:</p> <pre><code>function modifyDOM(){ var elem_pop = document.getElementById("pop_title"); elem_pop.setAttribute("value","coming"); } </code></pre> <p>When I inspect in firebug, its showing that the value attribute is added with coming, but its reflecting in the browser (I am using mozilla 3.0.5) What may be the issue ?? do i need to set different attribute ??</p>
javascript
[3]
1,346,872
1,346,873
I need to know the Big O time of my binary heap code and if there are improvements
<p>I need to know what the Big O time of my binary heap code is, and how can I improve it?</p> <p>Here's the code:</p> <pre><code>public static void CreateMaxHeap(int[] a) { for (int heapsize = 0; heapsize &lt; a.Length; heapsize++) { int n, p; n = heapsize; while (n &gt; 0) { p = (n - 1) / 2; if(a[n]&gt;a[p]) Swap(a,n,p); n = p; } } } // end of create heap </code></pre>
java
[1]
1,663,528
1,663,529
Best Way to Store Previously Entered User Input in EditText?
<p>What is the best way to store previously entered user input from an EditText and have that EditText suggest it back to the user when they begin to type it the next time they use the application?</p> <p>My original idea was to use an AutoCompleteTextView which would then store user inputed data into an array (maybe using SharedPreferences?). Upon application reload, it would pull up this string array and be available to suggest previously entered input the user. Obviously SharedPreferences can't store arrays, so what is the best way to go about doing this?</p> <p>I can't seem to find this question posted elsewhere. Thoughts?</p>
android
[4]
2,759,246
2,759,247
How to return 2 value in c# method
<p>I created the function of c# to compare the price in my project.</p> <pre><code>public static decimal? SpecialPrice(decimal w, decimal p) { if (w &lt; p) { return p; } else if (w &gt; p &amp;&amp; p &gt; 0) { //return (w , p); } else { return w; } } </code></pre> <p>I want to return two variable ( w and p) when w > p and p >0 , but I don't know how can I return like that. Anyone know about it?</p>
c#
[0]
3,893,209
3,893,210
Jquery & Variable ID Names
<p>I am trying to avoid having the same code for different ids. Something like submitter1, submitter2, etc. In the same process, having the variable also used to get the input box id of differentlocation1, differentlocation2, etc. Can someone help me out with the code below?</p> <pre><code>$(document).ready(function() { $('#submitter&lt;--Variable Here--&gt;').click(function(event) { event.preventDefault(); var newlocation = $("input[name=differentlocation"&lt;--Same Variable Here--&gt;"']"); alert(newlocation); //testing purposes //$('#location').val(newlocation).change(); //Changes location input box //$("#submit").click(); //submits new location }); }); </code></pre> <p>This code works using static ids, but like I said I would like to adjust it to use variable ids as well. </p> <p>Thanks.</p>
jquery
[5]
1,640,813
1,640,814
averages of a two dimensional list
<p>Basically, the function should deliver the average of the lists within the list. Example:</p> <pre><code>lst = [[46, 27, 68], [26, 65, 80], [98, 56, 35], [98, 65, 0]] average(lst) &gt;&gt;&gt; [47.0, 57.0, 63.0, 54.33333333333333] </code></pre> <p>My code:</p> <pre><code>def average(l): for i in range(len(l)): for j in range(len(l[0])): l[i] / l[j] return l </code></pre> <p>My coding shows up an error sign saying "TypeError: unsupported operand type(s) for /: 'list' and 'list'". I don't get what I'm doing wrong.</p>
python
[7]
81,910
81,911
Starting an activity from a random class
<p>I've adapted the <code>GridInputProcessor</code>-class of the 3D-Gallery ( <a href="http://android.git.kernel.org/?p=platform/packages/apps/Gallery3D.git;a=blob;f=src/com/cooliris/media/GridInputProcessor.java;h=91dfd4783be6b21ec8ff2518a5c244752570e90d;hb=HEAD" rel="nofollow">http://android.git.kernel.org/?p=platform/packages/apps/Gallery3D.git;a=blob;f=src/com/cooliris/media/GridInputProcessor.java;h=91dfd4783be6b21ec8ff2518a5c244752570e90d;hb=HEAD</a> ) so that it detects upward/downward swipes.</p> <p>The detection of swipes works, but I now want to start another activity (or draw a bitmap on the currently displayed activity), but I seemingly can't use <code>startActivity(mContext, myIntent)</code>, because the class declaration is <code>public final class GridInputProcessor implements GestureDetector.OnGestureListener, GestureDetector.OnDoubleTapListener {</code> so it doesn't extend <code>Activity</code>...</p> <p>Can I still start an Activity through this class, or how would I go about doing this? I have also tried sending a broadcast, but this is also not "implemented".</p> <p>Thanks, Nick</p>
android
[4]
5,591,057
5,591,058
tell the order of javascript functions that have been called
<p>I've been using Chrome scripts to <strong>identify the order of the Javascript functions that are running</strong>. </p> <p>It's a bit overkill for what I'm doing right now as what I only really need is to have a log of the javascript functions that have been called.</p> <p>What are you guys here using for that purpose?</p> <p>Thanks for the feedback.</p>
javascript
[3]
1,984,298
1,984,299
Counting hidden table rows using JQuery
<p>I have a a table with a couple of hidden rows. What I want to achieve is having it show a hidden row with each button click, is this possible?</p> <p>I count the number of table rows using the following</p> <pre><code>var rowCount = parseInt($('#Table tr').length); </code></pre> <p>How do I count hidden table rows?</p>
jquery
[5]
521,835
521,836
problem with KeyGuardManager
<p>I am trying to use the KeyGuardManager to unlock the phone easily. so far no problems the phone is unlocked and all is good. However when this code is executed later I notice my phone is behaving weirdly. until a I see the following message in the Logcat file : </p> <pre><code>WindowManagerService.mKeyguardTokenWatcher: cleaning up leaked reference </code></pre> <p>meaning as far as I can tell the reference to the key-guard was leaked. I have no idea why this would happen especially as I cannot see a method which seems to safely dispose of the keyguard lock.</p> <p>The code that aquaired the lock looks like this:</p> <pre><code>// use KeyGuardManager to automaticly unlock the device KeyguardManager kgm = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); KeyguardLock kgl = kgm.newKeyguardLock("BusSnooze"); if (kgm.inKeyguardRestrictedInputMode()) kgl.disableKeyguard(); </code></pre> <p>Anyone know why this is happening? thanks, Jason</p>
android
[4]
4,367,271
4,367,272
Block javascript Alert box
<p><br> I'm working on a website using extensively javascript. The code I'm working on also rely on other <em>big</em> javascript libs. The thing is that somewhere in these libraries, some alert box are poping.</p> <p>I was wondering if there are some way to disable the javascript alert box <em>on the fly</em> and re-enable it later.</p> <p>Thanks</p>
javascript
[3]
980,871
980,872
how to write sqlite query using coredata
<p>Please help me,</p> <p>I want to write query(mentioned below) using coredata.</p> <pre><code>select primKey, ( primKey - 5 ) as **d** from TABLE Order by **d** limit 1. </code></pre>
iphone
[8]
3,119,004
3,119,005
Is leaving out the word Void the same as including Void?
<p>Are these the same?</p> <p><code>public void MyMethod() {do something}</code></p> <p><code>public MyMethod() {do something}</code></p> <p><code>void</code> means return nothing - so leaving this key word out also means return nothing? If this is the case then why does the word exist in the language - is it used in other situations?</p>
c#
[0]
1,475,747
1,475,748
AddClass with jQuery target help needed
<p>I have a the following HTML</p> <pre><code>&lt;fieldset&gt; &lt;legend&gt; &lt;input type="checkbox" class="myCheck"&gt;Click &lt;/legend&gt; content &lt;fieldset&gt; </code></pre> <p>I'm trying to add class when the checkbox is selected and remove when unchecked. Should't something like this work:</p> <pre><code>$(".myCheck").change(function() { if ($(this).is(':checked')){ $(this).parent("fieldset").addClass("myClass"); } else { $(this).parent("fieldset").removeClass("myClass"); } }); </code></pre> <p>What am I missing?</p>
jquery
[5]
866,406
866,407
syntax for creating a dictionary into another dictionary in python
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3748063/syntax-to-insert-one-list-into-another-list-in-python">syntax to insert one list into another list in python</a> </p> </blockquote> <p>How could be the syntax for creating a dictionary into another dictionary in python</p>
python
[7]
1,931,909
1,931,910
Is there a way to use features in Android 2.1/2.2 while keeping a minSDK version to 3?
<p>I have a project that is just using Android 1.5 for programming, but with the proliferation of other handsets and some cool features in Android 2.2, we'd like to support the features without losing support for 1.5 or forking a new code base. Is it possible to do with Android SDK?</p> <p>I do have some sense of the "ugly" way to do it, as in keeping the same code base but have a build system that builds different versions for the platforms and keep different Java files around that get added in our out of the build based on which version is selected. I'm hoping someone else has solved the problem based on the many versions of apps in the market that run on multiple Android versions.</p>
android
[4]
3,350,511
3,350,512
help regarding rounding off numbers
<p>float per = (num / (float)totbrwdbksint) * 100;</p> <p>i m getting the value of per as say 29.475342 . i want it to round off upto two decimal places only.like 29.48 .how to achieve this?</p>
java
[1]
71,880
71,881
When do I need inflaters?
<p>I'm reading the book 'Hello, Android'. In the Sudoku example, it uses a options menu. It needs a MenuInflater that we use to read the menu definition from XML and turns it into a real view. To use button, textview, or many other views, I don't need to inflate them.</p> <p>My question is, in what situations, I need inflaters? Why doesn't Android treat menus like other views?</p>
android
[4]
4,268,184
4,268,185
How to avoid scroll bar in all browsers while a jQuery Dialog box is showing?
<p>I have a page where when we click a button a Jquery dialog box is called using JQuery. But when it is shown the Window scroll bar is shown in all browsers. How can we avoid this? Can we avoid this uising JQuery? Or is it is better to fix by CSS?.</p>
jquery
[5]
5,195,209
5,195,210
what is document.getElementById?
<p><strong>consider the following code:</strong></p> <pre><code>&lt;script&gt; function testFunc(){ alert('test') } $(function(){ var g = document.getElementById , w = window.testFunc ; //g alert(typeof(g)); alert(String(g)); alert(g instanceof Object); alert(g instanceof Function); //w alert(typeof(w)); alert(String(w)); alert(w instanceof Object); alert(w instanceof Function); //run it alert(g('t')); w(); }); &lt;/script&gt; </code></pre> <h2><strong>the code behaves the same in modern browser(chrome,IE 9,Firefox).And the result is:</strong></h2> <p>typeof => "function"<br/> String => "function #funcName#{[native code]}"<br/> instanceof Object => true<br/> instanceof Function => true<br/> it is a little weird, we can easily invoke <code>w</code> by using <code>()</code>, but for <code>g</code>, we must invoke it like this:</p> <pre><code>g.call(document,elementId); </code></pre> <p>When it comes to IE 6, the result is totally diffrent:</p> <hr> <p>//g<br/> <b>typeof => "object"</b><br/> String => "function getElementById{[native code]}"<br/> instanceof Object => false<br/> instanceof Function => false<br/> //w<br/> <b>typeof => "function"</b><br/> String => "function testFunc{alert('test')}"<br/> instanceof Object => true<br/> instanceof Function => true<br/> what is more,we must run g and w directly by using '()', and we can not invoke g like this:</p> <pre><code>g.call(document,'t') </code></pre> <p>this will cause an error. So here is my question: what is <code>document.getElementById</code>, function or object, and what is the diffrence between <code>g</code> and <code>w</code>?</p>
javascript
[3]
4,751,496
4,751,497
What's the best method for skinning a horizontal scroll pane using jQuery?
<p>I am currently using <a href="http://plugins.jquery.com/project/jscrollhorizontalpane" rel="nofollow">jScrollHorizontalPane</a> to scroll through the thumbnails <a href="http://v2.revelinnewyork.com/people/kev-okane" rel="nofollow">here</a>. It's a great plugin, but unfortunately, the browser has to be resized for the scrollbar to show up. I suppose this is a bug, but the support is lacking.</p> <p>My question is should I keep trying to get this to work correctly, or is there a simpler, or more efficient jQuery based scrolling method out there?</p> <p>Remember, I'm not creating a scrolling slideshow, rather just skinning the default scrollbar. Thoughts? Ideas?</p>
jquery
[5]
3,466,080
3,466,081
Can't change element class on click
<p>Tell me please why div with id <code>AudioVol+..(ex.1,2,3 and other)</code> dont change class name when click on element with class name <code>option_audio_player_mute</code>?</p> <p>Also tell me, can I reduce/refactor my code? </p> <pre><code>$('.option_audio_player_mute').live('click', function () { var idn = this.id.split('+')[1]; var vol1 = $('#AudioVol1+' + idn); if ($(this).hasClass('audio_mute')) { vol1.removeClass('audio_vol_not_active').addClass('audio_vol_active'); } else if ($(this).hasClass('audio_not_mute')) { vol1.removeClass('audio_vol_active').addClass('audio_vol_not_active'); } }); </code></pre> <p>why doesn't this work?</p>
jquery
[5]
432,229
432,230
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]
2,588,310
2,588,311
function call std::vector
<p>Below is how i am calling the function Xpath.evaluate. This is not working because of the wrong function call. please help </p> <pre><code>std::vector&lt;std::string&gt; album; xpath.evaluate("*[local-name()=*album*]/text()",album); </code></pre> <p>the xpath.evaluate function is </p> <pre><code>void XPath::evaluate(char const* xpath, vector&lt;string&gt;&amp; result) const throw (Error) { result.clear(); vector&lt;xmlNodePtr&gt; r; evaluate(xpath, r); xmlBufferPtr buff = xmlBufferCreate(); for (size_t i = 0; i &lt; r.size(); ++i) { xmlSaveCtxtPtr ctxt = xmlSaveToBuffer(buff, "UTF-8", XML_SAVE_NO_DECL | XML_SAVE_NO_XHTML); xmlNodePtr clone = xmlCopyNode(r[i], 1); xmlSaveTree(ctxt, clone); // OMG if (clone-&gt;doc != NULL &amp;&amp; clone-&gt;doc != r[i]-&gt;doc) { xmlFreeDoc(clone-&gt;doc); } else { xmlFreeNode(clone); } xmlSaveFlush(ctxt); result.push_back(string((char const*) buff-&gt;content, buff-&gt;use)); xmlSaveClose(ctxt); xmlBufferEmpty(buff); } xmlBufferFree(buff); } </code></pre> <p>how do I call this function ??</p>
c++
[6]
532,782
532,783
firing an Event by code in android
<p>Wondering if there is any way to build and fire an event (e.g. on click event) in android applications programmatically. </p> <p>Thanks.</p> <p>sorry, it seems question is not clear enough, let me explain a bit more:</p> <ul> <li>I have an Activity (lets call it A) with multiple views (5 ImageView for example).</li> <li>And a normal Java class (lets call it B) which is used by my Activity.</li> <li>There is an instance of B in my Activity. </li> <li>If user click on a View (Image View) the view OnClickListener calls a method in B </li> <li>In B, if operation is successful, it will call back a method in activity again. </li> <li>in activity method, It will change image or state for clicked ImageView.</li> </ul> <p>in the other hand:</p> <p>click on view (x) in Activity -------> B.doSomething() --------> A.bIsDone() -----> change image for view (x) </p> <p>with normal execution, its working and there is no problem.</p> <p>the problem is that I want to simulate this process to be automatic, my code looks like this:</p> <pre><code> while (!b.isFinished()) { try { b.doSomething(&lt;for View x&gt;); Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } </code></pre> <p>The issue is that, it won't render anything, until the end of the loop. </p> <p>I tried to put the loop in another Thread, but its throwing exception:</p> <pre><code> android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. </code></pre> <p>what can i do for this issue? i was think generate an click event on view (by code), to see it can help or not.</p> <p>what is your solution? Thanks </p>
android
[4]
2,013,011
2,013,012
Getting user's current time (not server or computer clock BUT ACTUAL real time) and pass as a variable into php
<p>How can i do this?</p> <p>EDIT: I'm not sure if this would work but sometimes you get those annoying pop-ups that tell you what city/suburb you're in (usually for dating sites) - could we somehow extrapolate from that data what the time is??? Is this data based on a reverse IP lookup??</p> <p>Any suggestion code to get me started (I don't really know what I'm looking for - just the end result i want!) would be fantastic!</p> <p>Thanks.</p>
php
[2]
3,884,058
3,884,059
PHP convert date format from xml feed from 25 November 2011 to 25 Nov?
<p>Im importing content from an XML feed. The date format for the date field is 25 November 2011, which I need to convert into 25 Nov. Whats the best way to do this?</p> <p>I could use str_replace to replace each month with its abbreviation, but im wondering if there is a cleaner solution.</p>
php
[2]
5,311,071
5,311,072
JQuery-PAge load
<p>Upon page reload, all the nodes expand and then only the selected node remain expanded which is the desired behavior. However, I'd like to prevent all the nodes from expanding upon refresh as it creates a flicker. Has anyone else experience this behaviour? How can I turn it off?</p> <p>Thanks</p>
jquery
[5]
4,586,411
4,586,412
which class should i import to use jboss cache?
<p>i want to use jboss cache, but i don't know which jar and where to get it.</p> <pre><code> import org.jboss.cache.Fqn; import org.jboss.cache.Node; import org.jboss.cache.PropertyConfigurator; import org.jboss.cache.TreeCache; </code></pre> <p>i get errors like "The import org.jboss.cache.TreeCache cannnot be resolved."</p> <p>Thanks.</p>
java
[1]
856,465
856,466
Decode sha1 string to normal string
<p>I am using following code to convert string to sha1 string but i am not able to find any solution for reverse of this i.e normal string from sha1 string.</p> <pre><code>+(NSString *)stringToSha1:(NSString *)str{ const char *s = [str cStringUsingEncoding:NSASCIIStringEncoding]; NSData *keyData = [NSData dataWithBytes:s length:strlen(s)]; // This is the destination uint8_t digest[CC_SHA1_DIGEST_LENGTH] = {0}; // This one function does an unkeyed SHA1 hash of your hash data CC_SHA1(keyData.bytes, keyData.length, digest); // Now convert to NSData structure to make it usable again NSData *out = [NSData dataWithBytes:digest length:CC_SHA1_DIGEST_LENGTH]; // description converts to hex but puts &lt;&gt; around it and spaces every 4 bytes NSString *hash = [out description]; hash = [hash stringByReplacingOccurrencesOfString:@" " withString:@""]; hash = [hash stringByReplacingOccurrencesOfString:@"&lt;" withString:@""]; hash = [hash stringByReplacingOccurrencesOfString:@"&gt;" withString:@""]; NSLog(@"Hash is %@ for string %@", hash, str); NSData *dtt = [hash dataUsingEncoding:NSUTF8StringEncoding]; //dtt = [nsda] NSString *unhash = [dtt description]; return hash; } </code></pre> <p>plz help me to solve this issue.</p> <p>Thanks in advance</p>
iphone
[8]
3,428,350
3,428,351
The ideal connection implementation for an internet cafe software
<p>I am coding an internet cafe program and trying to decide which path to take. I've read some articles and came to know that there are a few ways to implement a server/client connection.(a bit messy Asyncronous, simple TCP and Socket) I'm a bit confused. I kindly ask you to show me the ideal way regarding to the needs that I mentioned below</p> <p>Clients will always stay connected to server and server will know when any client is disconnected. Server will send object and string to clients, clients will send string to server.</p> <p>So, Should I use an asyncronous or simple tcp or what? Thanks in advance</p>
c#
[0]
3,836,694
3,836,695
Matching strings for multiple data set in Python
<p>I am working on python and I need to match the strings of several data files. First I used pickle to unpack my files and then I place them into a list. I only want to match strings that have the same conditions. This conditions are indicated at the end of the string. </p> <p>My working script looks approximately like this:</p> <pre><code>import pickle f = open("data_a.dat") list_a = pickle.load( f ) f.close() f = open("data_b.dat") list_b = pickle.load( f ) f.close() f = open("data_c.dat") list_c = pickle.load( f ) f.close() f = open("data_d.dat") list_d = pickle.load( f ) f.close() for a in list_a: for b in list_b: for c in list_c for d in list_d: if a.GetName()[12:] in b.GetName(): if a.GetName[12:] in c.GetName(): if a.GetName[12:] in d.GetName(): "do whatever" </code></pre> <p>This seems to work fine for these 2 lists. The problems begin when I try to add more 8 or 9 more data files for which I also need to match the same conditions. The script simple won't process and it gets stuck. I appreciate your help.</p> <p>Edit: Each of the lists contains histograms named after the parameters that were used to create them. The name of the histograms contains these parameters and their values at the end of the string. In the example I did it for 2 data sets, now I would like to do it for 9 data sets without using multiple loops. </p> <p>Edit 2. I just expanded the code to reflect more accurately what I want to do. Now if I try to do that for 9 lists, it does not only look horrible, but it also doesn't work.</p>
python
[7]
543,959
543,960
Want to make a link like download?id=**
<p>I wanted to make download links in php.</p> <p>For an example If i have 2 files in my directory then How do i make the download links like download.php?id=1 or 2 or anything.</p> <p>So what will be the codes in the download.php file.</p> <p>Please somebody tell me the codes.</p>
php
[2]
3,083,106
3,083,107
python string formating
<p>hi: i want to execute a git command , in shell it is as bellow:</p> <pre><code>$ git log v2.6.38..v2.6.38-rc8 --pretty=format:%s%n%n </code></pre> <p>the --pretty=format:%s%n%n is to say only show the commit subject message ,and every message is split by two new line.</p> <p>now , i want to execute in python script ,and input tag name as parameter.</p> <p>i want do like this :</p> <pre><code>git_cmd = "git log %(old_tag)s..%(new_tag)s --pretty=format:'%s%n%n'" git_cmd = git_cmd % {'old_tag'='v2.6.38','new_tag'='v2.6.38-rc8'} subprocess.Popen(shlex.split(git_cmd)) </code></pre> <p>bug it go wrong, because %s%n%n is now interpret as a string format.</p> <p>how can i solve it ?</p> <p>thanks .</p>
python
[7]
1,857,993
1,857,994
Applying a function all values in an array
<p>$jobs is an array retrieved from a DB query. <code>print_r($jobs)</code> shows:</p> <pre><code>Array ( [ID] =&gt; 131 [Title] =&gt; -bla- [Baseline] =&gt; lorem ipsum ... [Description] =&gt; &lt;ul&gt;&lt;li&gt;list 1&lt;/li&gt;&lt;li&gt;list 2&lt;/li&gt;&lt;/ul&gt; [EventID] =&gt; 1008 ) Array ( [ID] =&gt; 132 [Title] =&gt; -bla 2- [Baseline] =&gt; lorem ipsum lorem ipsum... [Description] =&gt; &lt;ul&gt;&lt;li&gt;list 1&lt;/li&gt;&lt;li&gt;list 2&lt;/li&gt;&lt;/ul&gt; [EventID] =&gt; 1009 ) </code></pre> <p>etc ...</p> <p>Id like to run utf8_encode() on all values of these arrays. I'm not sure if I should use array_map, array_walk_recursive ? The output should not alter the names of the array keys so that I don't need to change anything in my template, so</p> <pre><code>&lt;h1&gt;&lt;?=$j['title']?&gt;&lt;/h1&gt; </code></pre> <p>should still work, albeit utf8 encoded.</p> <p>EDIT: I'm trying the following, no luck</p> <pre><code>function fix_chars($key, $value) { return utf8_encode($value); } array_walk_recursive($jobs, 'fix_chars'); </code></pre>
php
[2]
1,701,016
1,701,017
In Java does a data type like this exist?
<p>I found this in redis and was trying to see if there was anything similar in Java. Say I have the following data:</p> <pre><code>3:1 3:2 3:3 4:1 </code></pre> <p>As you can see non of the data points on their own are unique but the combination is unique. There is a command in redis:</p> <pre><code>sadd 3 1 2 sadd 3 3 sadd 4 1 </code></pre> <p>That would give me a something like this:</p> <pre><code>3 -&gt; 1, 2, 3 4 -&gt; 1 </code></pre> <p>By doing something like <code>smembers 3</code>(this would return everything for 3) or <code>smembers 3 2</code>(this would return if the subvalue exists). </p> <p>I'm wondering what the closest I can get to this functionality within Java? </p>
java
[1]
5,447,548
5,447,549
Image uploading from temporary path
<p>I am developing a from in php with 2 fields (One for Unique name, second for image upload). When submit the form after filling data, I am checking the name field with database records. If the new name exits in the database I am showing a error. this is fine, but i lost the image name what I uploaded before. For this i am using sessions. From sessions I am getting the image name and temporary name and i am passing those through hidden variables. But the image not uploading. Can you please say how can I implement this in my site</p> <p>Thanks Sateesh</p>
php
[2]
2,967,224
2,967,225
Elegant approach to keeping a div's height synced to another's
<p>CoffeeScript:</p> <pre><code>$(window).on("deviceorientation", -&gt; if($(window).width() &gt; $(window).height()) # Landscape mode height = $(".infoContainer").offset().top + $(".infoContainer").height(); $("#map_canvas").height(height); $(".uiContainer").height(height); else $("#map_canvas").height($(window).height()); $(".uiContainer").height($(window).height()); ) </code></pre> <p>This code works fine (on mobile only, which is the only meaningful target for this code to run on so that's good) but it fires way too fast so it slows down the experience a bit noticeably (On a dual-core Xperia S, dont want to imagine the effect on lower-end phones) so i want to know if there is a more elegant (CSS preferred) way to deal with this issue.</p>
javascript
[3]
2,499,021
2,499,022
iphone - trying to understand @property
<p>Suppose I have two classes. In the first one I declare this in Class1.h</p> <pre><code>@interface Class1 : UIViewController { NSString *myString; id myObject; } </code></pre> <p>On the second class I go beyond that I declare it like</p> <pre><code>@interface Class2 : UIViewController { NSString *myString; id myObject; } @property (nonatomic, retain) NSString *myString; @property (nonatomic, retain) id myObject; </code></pre> <p>and then I <strong>@synthesize myString, myObject</strong> on Class2.m</p> <p>Then, on my main program, I create two objects: one based on Class1 and another one based on Class2.</p> <p>What effect the @property of class2 will have? Will every value assigned to both values on Class2 be always retained? If so, do I need to "release" them? How?</p> <p>Thanks.</p>
iphone
[8]
5,017,074
5,017,075
Move the ImageView to EditTextView
<p>In my application i want displaying the one image as half of the screen and below i am producing that image spelling and below display that image name letters as shuffled and kid will take one image and place into into that place in above spelling.For example see following website</p> <blockquote> <p>//www.youtube.com/watch?v=_LSlYYu3F0k</p> </blockquote> <p>For this how can i design my layout(xml)Please gice me some code suggestions.Thanks in advance</p>
android
[4]
5,334,818
5,334,819
listview view error
<p>am doing chat app in which i want to display photo,adaptermodel,small icon for online status in listview </p> <p>this gives error:</p> <pre><code>final List&lt;AttendeeModel&gt; attendeesList = getAttendeesList( attendees, sender); ListView listView = (ListView) findViewById(R.id.listView); listView.setAdapter(new ArrayAdapter&lt;AttendeeModel&gt;(this,android.R.layout.simple_list_item_2, attendeesList,R.layout.row, R.id.icon)); </code></pre> <p>how simple i implement this..</p> <p>thanks in advance...</p>
android
[4]
996,992
996,993
javascript issue with unexpected token {
<p>I am getting an unexpected token { in the following line:</p> <pre><code>var that = this, tag_array = "img,object,embed,audio,video,iframe".split(','), video_array = ['EMBED', 'OBJECT', 'VIDEO'], is_ooyala = false, platform = {{ platform }}; </code></pre> <p>seems like every thing is in balance. Any idea?</p>
javascript
[3]
1,403,380
1,403,381
PHP mkdir: Permission denied problem
<p>I am trying to create a directory with PHP mkdir function but I get an error as follows: <code>Warning: mkdir() [function.mkdir]: Permission denied in ...</code>. How to settle down the problem?</p>
php
[2]
2,104,839
2,104,840
Index and length must refer to a location within the string. Parameter name: length
<p>Index and length must refer to a location within the string. Parameter name: length</p> <pre><code>string a1 = ddlweek.Text.Substring(0, 8); string a3 = ddlweek.Text.Substring(10, 14); </code></pre>
asp.net
[9]
4,596,302
4,596,303
JavaScript for virtual keyboard key value assignment
<p>I'm working on a Web app the uses a virtual keyboard. I have a custom unifont I made that has over 200 characters. The keyboard has a row of multiple keys above the character keys. What I am trying to do is when I select a button on the top row, I need to assign the value for the character key. So, the top row buttons are numbered 1, 2, 3, and 4. When I select 1, I need to assign a value to key A. When I select 2, I need to assign a different value to key A, and so on. The same is true for all the keys. Each key has multiple characters that I need to assign the value based on the button selected in the top row. I have all the codepoints, and can manually assign the value, but I'm having trouble figuring out how to code the Javascript.</p>
javascript
[3]
184,425
184,426
Changing the context of a function in JavaScript
<p>This is taken from John Resig`s Learning Advanced Javascript #25, called changing the context of a function. </p> <p>1) in the line <code>fn() == this</code> what does this refer to? is it referring to the this inside the function where it says return this? </p> <p>2) although I understand the purpose of the last line (to attach the function to a specific object), I don't understand how the code does that. Is the word "call" a pre-defined JavaScript function? In plain language, please explain "fn.call(object)," and explicitly tell me whether the object in parens <code>(object)</code> is the same object as the <code>var object</code>. </p> <p>3). After the function has been assigned to the object, would you call that function by writing <code>object.fn();</code> ?</p> <pre><code>var object = {}; function fn(){ return this; } assert( fn() == this, "The context is the global object." ); assert( fn.call(object) == object, "The context is changed to a specific object." </code></pre>
javascript
[3]
1,984,026
1,984,027
How To Write To Database User's Logout Timestamp When Browser Is Closed / Crash
<p>I have a table on my database called 'Log'. This Log table contains ID, Username, LoginTime and LogoutTime. That's all.</p> <p>It's really easy to INSERT into ID, Username and LoginTime columns...</p> <p>But dealing with LogoutTime, I was thinking there will be 2 condition :</p> <ol> <li><p>User click logout button >> PROBLEM SOLVED, I can easily put INSERT script on my logout.php to handle LogoutTime column.</p></li> <li><p>User just run away from my website by clicking close button of their browser >> THIS WILL CAUSE A PROBLEM. How can I write to LogoutTime column in this situation like this?</p></li> </ol> <p>can it be handle by PHP only? I mean, doesn't have to use jQuery... Thanks before.</p>
php
[2]
1,535,034
1,535,035
What do square brackets, "[]", mean in function/class documentation?
<p>I am having trouble figuring out the arguments to csv.dictreader and realized I have no clue what the square brackets signify.</p> <p>From the docmentation:</p> <pre><code>class csv.DictReader(csvfile[, fieldnames=None[, restkey=None[, restval=None[, dialect='excel'[, *args, **kwds]]]]]) </code></pre> <p>I'd appreciate a summary of the arguments to the class instantiation.</p> <p>Thanks</p>
python
[7]
1,209,553
1,209,554
Issue with for loop of checkboxes
<p>I have series of checkboxes whom value I am taking and generating a string like....if checkbox is selected I add '1' to string and if it is not selected I add '0' to string. </p> <pre><code>&lt;input type="checkbox" name="auth_0" id="auth_0" class="checkboxes" value="Yes"/&gt; </code></pre> <p>My php script is...</p> <pre><code>if (isset($_REQUEST["save"])) { /* echo $_REQUEST['auth_0'];*/ for ($i = 0; $i &lt;= 49; $i++) { if ($_REQUEST['auth_[$i]'] == 'Yes') { $auth_string .= '1'; } else { $auth_string .= '0'; } } echo $auth_string; } </code></pre> <p>Though string is generating but its value is always 0 in both cases that if checkbox is selected or not.</p>
php
[2]
2,375,493
2,375,494
check for existing record
<pre><code>class Catalog { bool BookCopy; public: string BookTitle; Catalog() { BookCopy = false; } Catalog(string Title, bool Copy) { BookTitle = Title; BookCopy = Copy; } void SetTitle(string Title) {BookTitle = Title; } void SetBookCopy(bool Copy) {BookCopy = Copy; } string GetTitle() { return BookTitle; } bool GetCopy() { return BookCopy; } }; class BookList { vector&lt;Catalog&gt; List; vector&lt;Catalog&gt;::iterator Transit; public: void Fill(); void Show(); }; void BookList::Fill() //Create book record { string Title; bool Copy; Catalog Buffer; cout &lt;&lt; "Enter book information, Stop To quit" &lt;&lt; endl; cout &lt;&lt; "-------------------------- " &lt;&lt; endl; while(true) { cout &lt;&lt; "Title: "; getline(cin, Title); if(Title == "Stop") break; for(Transit = List.begin() ; Transit != List.end() ; Transit++ ) { if(Transit-&gt;GetTitle() == Title) { Copy = true; } else Copy = false; } </code></pre> <p>I want to check if an identical title exists when making a new record. If it exists then to assign 1 to Copy otherwise leave it as 0. When I make a record with an identical title 1 does not get assigned to copy.</p>
c++
[6]
4,380,122
4,380,123
Getting an array with the content of attributes
<p>I have a class in my code in C# where I want to get all the attributes from a nested class in an array with the size of the number of parameters and the content of all of them in an array of objects. Like these:</p> <pre><code>class MyClass { class Parameters { public const string A = "A"; public const string B = "B"; public const string C = "C"; public const string D = "D"; public const string E = "E"; public const string F = "F"; } public object[] getAllParameters() { object[] array = new object[6]; array[0] = Parameters.A; array[1] = Parameters.B; array[2] = Parameters.C; array[3] = Parameters.D; array[4] = Parameters.E; array[5] = Parameters.F; } //more methods and code </code></pre> <p>}</p> <p>But if I want to add for example, <code>G</code> and <code>H</code> parameters, I would have to update the size of the method <code>getAllParameters</code>, the initialization and more stuff in other parts of the code.</p> <p>Could I do this "<code>getAllParameters</code>" method more generic, without taking account of the explicit parameters? With reflection maybe?</p>
c#
[0]
5,457,663
5,457,664
website session not set
<p>I'm kind of a website development nub so bear with me.</p> <p>My problem is that the website php session doesn't seem to be set when I log in to my website. After ensuring that the username and password are correct, I have the following simple code:</p> <pre><code>session_start(); $_SESSION['username'] = $myusername; $_SESSION['password'] = $mypassword; </code></pre> <p>Content that should display after logging in is not displayed.</p> <p>For example:</p> <pre><code>if(isset($_SESSION['username'])){ echo "&lt;a class=\"logout\" href=\"logout.php\"&gt;&lt;img src=\"Images\logout_button.png\"&gt;&lt;/a&gt;"; } else{ echo "&lt;a class=\"login\" href=\"main_login.php\"&gt;&lt;img src=\"Images\login_button.png\"&gt;&lt;/a&gt;"; } </code></pre> <p>The login button is always visible.</p> <p>Thanks in advance,</p> <p>Matt</p>
php
[2]
59,440
59,441
How do I directly create and output a .gz file with PHP
<p>I'm making a dynamic sitemap and i want it gziped before output. How do I do that? What header should I add?</p>
php
[2]
1,201,851
1,201,852
jquery - making a compound selector
<p>I've got several buttons that have the same class but apply to different data (albums), so I added an ID to differentiate between them. Because each album has a unique ID, I don't have to worry about having more than one ID on a page:</p> <pre><code>&lt;button class="addalbum" id="add&lt;?php echo $a-&gt;album_id; ?&gt;"&gt;Add album&lt;/button&gt; so the IDs would look like: #add121, #add122, etc. </code></pre> <p><strong>How do I select one of these ids for a jQuery function?</strong> I tried the code below:</p> <pre><code>var a = $(elm).attr('id'); $('.addalbum' + a).click(function() { //stuff here }); </code></pre>
jquery
[5]
3,874,362
3,874,363
C++ network stream
<p>I am a newbie using C++ and I have a background with Java</p> <p>I am working on a simple linux server using c++ and I have a question about converting byte data.</p> <p>In Java, I can use putShort, or putString in ByteBuffer and simply send the buffer over socket using byteBuffer.array() </p> <p>What is the corresponding c++ code of this? </p> <p>Thanks in advance.</p>
c++
[6]
5,660,480
5,660,481
Is it UITableView or colorWithPatternImage problem? Background image turns white although it is light gray color
<p>I am using the following way to set the background of the UITableView.</p> <pre><code>self.tableView.backgroundColor = [UIColor clearColor]; self.parentViewController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageWithData:imageData]]; </code></pre> <p>The image which I want to set as the background is light gray color But the image which I see is totally white. </p> <p>What is the problem. Like is it with the colorWithPatterImage or with the UITable.</p>
iphone
[8]
1,635,411
1,635,412
how to set multiple text views with radio button in list view single choice mode in android using simple adapter
<p>I have problem in list view with single choice mode. I want to display three text views with one radio button in list view. list view working properly. The problem is single choice mode. i want to select only one list item at a time rest of thing unselect mode. I searched last three days still i won't get any idea. Could you please help me. Thanks in advance.</p>
android
[4]
1,743,183
1,743,184
how to implement delete functionality from the iphone photo library?
<p>I am implementing photo galary.now i want to implement delete photo functionality(animation) from the gallery same as default delete functionality in the iphone photo library.So please advice me.</p>
iphone
[8]
2,263,375
2,263,376
ListView force app to close down
<p>I'm trying to get a ListView to work, but I get a message on the screen that need to close down the app! I'm searching for error, but I can't find any! Perhaps it's inside the layout? I'm not sure about if I should have a ListView inside there or if this is created cdynamic? What am I doing wrong? I'm also going to use a onClick method, but I guess thats a miner problem in this case!? Preciate some help! Thanks!</p> <pre><code>public class Activity_3 extends ListActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String[] projection = {ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME, ContactsContract.CommonDataKinds.Phone.NUMBER, ContactsContract.CommonDataKinds.Phone._ID}; // Get a cursor with all people Cursor cursor = managedQuery(ContactsContract.Contacts.CONTENT_URI, projection, null, null, null); startManagingCursor(cursor); ListAdapter adapter = new SimpleCursorAdapter(this, R.layout.activity_3, cursor, new String[] {ContactsContract.Contacts.DISPLAY_NAME}, new int[] {R.id.contactItem }); setListAdapter(adapter); } } </code></pre> <p>The layout</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;ListView android:id="@+id/contactList" android:layout_width="match_parent" android:layout_height="wrap_content" &gt; &lt;/ListView&gt; &lt;TextView android:id="@+id/contactItem" &gt; &lt;/TextView&gt; &lt;/LinearLayout&gt; </code></pre>
android
[4]
2,912,856
2,912,857
Can TabWidget in TabHost be not selected when TabActivity starts first time?
<p>I have a class which extends TabActivity in which I have 3 TabWidgets. When my activity starts for the first time my first Tab is already selected but I want to not select any of the TabWidget till the user selects any Tab. Can we do it in Android, it is very necessary to complete that task.</p> <p>Please look into this. Thanks in advance.</p>
android
[4]
5,217,207
5,217,208
How to reload the listView on click of a button in android?
<p>I have created a view in which i have 1 list view and 2 buttons. The first button is for deleting the selected list view and the 2nd button is for deleting the deleted the entire data from the table. I want that if I delete the entire data from the table the list view should get refreshed an it should get reloaded. Please help me out in achieving this.Thanks in advance.</p>
android
[4]
2,989,425
2,989,426
can help me to solve ListView?
<p>I am new in android. I dont know to list items in android? Can anyone help me with this?</p>
android
[4]
4,841,874
4,841,875
Calling .NET webservice from java swing application via SOAP
<p>I dont no how to call a .NET webservice as there is a requirement in my application that call the .NET webservice and login in that by calling the login method which gives some token. Please provide me a link that solves this problem or give me a sample code for it.</p>
java
[1]
2,335,592
2,335,593
Creating A Temporary File in Php
<p>I was wondering if it's possible to create a temporary page with a php script. Basically what I am wanting to do is have a file at example.com/example/button.php that will access a php script, and create text on say example.com/example/temppage.php. I simply only need it to say "shutdown" for 30 seconds on the temppage, and then it can go back to being blank.</p> <p>Is this Possible? Thanks!</p>
php
[2]
4,461,165
4,461,166
Total digits are inconsistent
<p>I m using following code to get random hex values. But the output is inconsistent Sometimes it returns 6 digits sometimes 5 digits</p> <pre><code>function generateHexValue($length=6) { $chars = "0123456789abcdef"; $i = 0; $str = ""; while ($i&lt;$length) { $str .= $chars[mt_rand(0,strlen($chars))]; $i++; } return $str; } $col=generateHexValue(); echo "&lt;div style='background-color:#".$col."; width:100px; height:100px;'&gt;&lt;/div&gt;"; echo $col."&lt;br/&gt;"; </code></pre>
php
[2]
6,030,927
6,030,928
UIWebView image copy and paste to UIImage
<p>Basically I want a way to copy image from the UIWebView and then paste it to an UIImageView.</p> <p>I try following but not working:</p> <ol> <li>I have copied image by long press on any image from UIWebView (as iOS default copy option)</li> <li><p>and then paste that copied image to UIImageView as below:</p> <pre><code>UIPasteboard *pasteBoard = [UIPasteboard generalPasteboard]; UIImage *image = pasteBoard.image; self.imageView.image = image; </code></pre></li> </ol> <p>But above code doesen't working.</p> <p>Any insights, ideas are appreciated.</p> <p>Thanks in advance</p>
iphone
[8]
3,411,403
3,411,404
I might be working on an ASP.NET application. What does a Java/PHP developer need to know before starting?
<p>I am primarily a Java and PHP developer and have some experience with .NET with C# but mostly on the desktop.</p> <p>What advice would you give me in starting a new ASP.NET application? What is the best MVC choice? What should I avoid doing? What are the major differences in developing a web app using ASP.NET as opposed to PHP or Java? Are there any conventions that ASP.NET uses that PHP and Java don't?</p> <p>What are some best practices or things I should avoid doing all together?</p> <p>Anything you could think of would be a great deal of help.</p>
asp.net
[9]
1,787,217
1,787,218
Iphone sdk - moving a UIImageView with the Accelerometer?
<p>I haven't had any experience with the accelerometer yet and i was wondering how i would move my UIImageView with the accelerometer, can anyone point me to any tutorials or give me a little help? thanks, harry</p>
iphone
[8]
702,530
702,531
When I click on item not showing alertdialouge?
<p>I want to display alert dialogue on click of pdfimage, I try following code but not showing alertdialogue . </p> <pre><code>private OnItemClickListener itemClickListener=new OnItemClickListener() { @SuppressWarnings("rawtypes") public void onItemClick(AdapterView parent, View arg1, int position, long arg3) { int i=position; pdf=pdfarray[i]; /*******************************/ AlertDialog.Builder builder = new AlertDialog.Builder(ImageShowActivity.this); final AlertDialog alert = builder.create(); builder.setMessage("Are you sure you want to exit?") .setNeutralButton("Cancel",new DialogInterface.OnClickListener(){ public void onClick(DialogInterface dialog, int id) { alert.dismiss(); } }) .setPositiveButton("Download", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent intent=new Intent(ImageShowActivity.this,OpenPDFNew.class); intent.putExtra("pdfurl",pdf ); startActivity(intent); } }) .setNegativeButton("Online", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }); alert.show(); /****************************************/ } }; </code></pre>
android
[4]
4,017,173
4,017,174
Caching android app webcontent and displaying the content when offline
<p>I am creating an android application that fetch data online using json. I want to display the previous content if offline . Can anyone please suggest a solution for this? Thanks, in advance.</p>
android
[4]
202,798
202,799
Android:how do i retrieve the contact photo,name,number from the address book and display it using a list view
<p>Android:how do i retrieve the contact photo,name,number from the address book and display it using a list view </p>
android
[4]
5,582,682
5,582,683
Check if CheckBox is checked, which is not in view of ListView
<p>I have ListView, which contains a TextView and a CheckBox.<br/> Now I am able to get text in the TextView, which is not in view of TextView, but I am not able to get if the CheckBox, which is not in view of ListView, is checked or not.</p> <p>Please suggest me the solution.</p>
android
[4]
848,961
848,962
Android Phrase o-matic
<p>I'd like to port this little program to Android, thing is that im level basic -1 at android, what the program does is that it randomly creates a phrase taken from strings in an array. I know how to make a button to show me an xml from the layout resources but thatjust works with textviews that do not change, Could you please tell me which steps to follow in order to display a randomly generated string taken from the array of strings?</p> <p>heres the code(head first java):</p> <pre><code>public class PhraseOMatic { public static void main (String[] args) { String[] wordListOne = {"24/7", "multi-tier", "30,OOO foot", "B-to-B" , "win-win" , "frontend", "web- based" , "pervasive", "smart", "sixsigma", "critical-path", "dynamic"}; String[] wordListTwo = {"empowered", "sticky", "value-added", "oriented", "centric", "distributed", "clustered", "branded", "outaide-the-box", "positioned", "networked", "focused", "leveraged", "aligned", "targeted", "shared", "cooperative", "accelerated"}; String[] wordListThree = {"process", "tipping-point", "solution", "architecture", "core competency", "strategy", "mindshare", "portal", "space", "vision", "paradigm", "session"}; // find out how many words are in each list int oneLenqth = wordListOne.length; int twoLength = wordListTwo.length; int threeLength = wordListThree.length; // generate .... random numbers int randl = (int) (Math.random() * oneLenqth); int rand2 = (int) (Math.random() * twoLength); int rand3 = (int) (Math.random() * threeLength); //now build a phrase String phrase = wordListOne[randl] + " " + wordListTwo[rand2] + " " + wordListThree[rand3]; // print out the phrase System.out.println("What we need is a " + phrase); } } </code></pre>
android
[4]
5,052,837
5,052,838
AJAX query error/success
<p>Please correct me if I'm wrong but my understanding of <code>$.post</code> success/failure is if the url is valid, this will return a success. The only time this will return a failure is if the url is not valid.</p> <p>If this is true, how do I validate the success function? Reason I ask is no matter what happens, I always get the same success alert even though there's error in the code behind. </p>
jquery
[5]
1,004,402
1,004,403
Making a Custom Menu in Android
<p>I'm working on making a game for the android, with a friend doing the artwork. My friend wants to do his own menu, as in, he made an image to be used as the menu.</p> <p>My question is, is there a way to have onMenuOpened() activate upon pressing the menu button with no menu items in onCreateOptionsMenu(), and then from my SurfaceView class close the menu? Or simply, how can I do my own menu that's activated upon pressing the menu button?</p>
android
[4]
1,470,623
1,470,624
how to display string in mobile number format
<p>i have a string of mobile number eg:919999999999.</p> <p>i need to display this number in this format (+91)999-999-9999;</p> <p>here 91 is country code.</p> <p>how can i done this,can any one please post some code.</p> <p>Thank u in advance. </p>
iphone
[8]
385,658
385,659
JQUERY, TEXT, appending an LI to a list with a SPAN wrapped?
<p>here is my current line of code:</p> <pre><code>$("&lt;li&gt;").text($(this).text()).appendTo("#theList"); </code></pre> <p>Which results in</p> <pre><code>&lt;ul id="theList"&gt; &lt;li&gt;blah&lt;/li&gt; &lt;li&gt;blah&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>How can I update that code above to result in:</p> <pre><code>&lt;ul id="theList"&gt; &lt;li&gt;&lt;span&gt;blah&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span&gt;blah&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>
jquery
[5]
1,077,759
1,077,760
Control windows explorer from C#
<p>Is there a way to control windows explorer (file browser), programmatically from C#?</p>
c#
[0]
3,579,344
3,579,345
attach bullets to slider images
<p>I have set up a jsfiddle</p> <p><a href="http://jsfiddle.net/K8aex/" rel="nofollow">http://jsfiddle.net/K8aex/</a></p> <p>I need the bullets to move the slides also I am trying to attach the click of the bullet to the index of the relevant slide How would I do this? find the index of the bullet the find the index of the img with same index? make that one the current slide?</p> <p>Any help would be greatly appreciated</p> <pre><code> $('.bullets a').click(function(e) { e.preventDefault(); var bulletIndex = (this).index() console.log(bulletIndex) wrapper.find('li:nth-child(bulletIndex) img').addClass('current'); }); </code></pre> <p>Thanks</p>
jquery
[5]
4,676,835
4,676,836
MySQL SELECT WHERE php array equivalent
<p>I am wanting to know if there is such a thing like the MySQL SELECT WHERE but in arrays.</p> <p>I have this array:</p> <pre><code>$array = array( 1 =&gt; array('test' =&gt; '1', 'test2' =&gt; '2' ), 2 =&gt; array('test' =&gt; '4','test2' =&gt; '2' ) ); </code></pre> <p>I am basically wanting all the records where 'test2' = '2'. So my result should be the id's 1,2.</p> <p>Can this be done?</p>
php
[2]