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 |
---|---|---|---|---|---|
3,209,680 | 3,209,681 | how to set rect inside rect | <p>I need to set Rectangle inside CGRect.</p>
<p>how can i do that.</p>
| iphone | [8] |
1,947,497 | 1,947,498 | ASP.NET Webmail Engine | <p>A friend of mine asked me today if there is any open-source or commercially available Webmail/Email "engine". When I asked her what she meant by engine, I got a list of features her boss asked for - </p>
<ul>
<li>Web interface to login & access e-mails</li>
<li>Ability to send/receive/forward e-mails using the web interface </li>
<li>Ability to compose and save drafts using the web interface</li>
<li>Ability to delete emails, empty deleted items folder using the web interface</li>
<li>Ability to search e-mails (by Sender's e-mail, Subject, Content)</li>
<li>Maintain and manage a contacts list (of e-mail addresses) using the web interface</li>
<li>Allow users to synchronise their e-mails with iPhone/Windows Mobile smartphones</li>
</ul>
<p>I found <a href="http://anmar.eu.org/projects/sharpwebmail/" rel="nofollow">SharpWebMail</a> to have some of the features, although it has not had updates in recent times, last update was in April 2006. I am inclined towards using ASP.NET, the proposal is to primarily use the e-mail in conjunction with an intranet (developed in ASP.NET). If you have any suggestions, please let me know.</p>
<p>indy</p>
| asp.net | [9] |
623,438 | 623,439 | Rearranging table in JavaScript | <p>I want reorder table rows using JavaScript .</p>
<p>for eg:</p>
<pre><code><table>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<tr>
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
<td>D</td>
<tr>
<tr>
<td>A1</td>
<td>B1</td>
<td>C1</td>
<td>D1</td>
<tr>
</table>
</code></pre>
<p>I want to do this in JavaScript without using jQuery. I want to show the A1,B1,C1,D1.. row as the first row and then 1,2,3,4 row and then A,B,C,D row.</p>
<p>I know that there will be some wait time on the client side but I need to do it in the client side. Is there some generic solution to do this, for any number of rows?</p>
| javascript | [3] |
185,213 | 185,214 | How to add Messenger,Linkedin,Digg,Deleicious in JW player using Share plugins. | <p>In my application am using JWplayer Version(4.6.485),i wanna add the following sites Digg,Delicious,Messenger,Linkedin,Google etc in JW player using Sharing plugins.Is it possible to add the above mentioned sites to JW player using sharing plugins.If possible please tell how to add the above mentioned sites in JW player.</p>
| javascript | [3] |
2,899,658 | 2,899,659 | android: how to append text to TextView in another activity every 2 seconds | <p>I have two activities, one is main and I have another activity called Test as well</p>
<p>in the main activity i have a button when I click on this button I go to the Test activity</p>
<p>in the Test activity I want the application to automatically append some text to the textview that it has every 10 seconds</p>
<p>this text can be for example "test"
so every 10 seconds "test" will be added
but, when I leave the activity and go to the main activity, this process will continue happening
so if for example I spend 20 seconds on the main activity and then return to the Test activity, I will see two more "test" strings in the textview..</p>
<p>I tried doing this with timertask and had no success at all</p>
<p>this is the Test activity's code, in the main activity I just have the button that shows me the other activity</p>
<pre><code>public class test2 extends Activity {
/** Called when the activity is first created. */
private TimerTask task;
private Handler handler;
private TextView tv;
private Timer t;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.text1);
t = new Timer();
task = new TimerTask() {
public void run() {
handler.post(new Runnable() {
public void run() {
TextView tv = (TextView) findViewById(R.id.tv1);
tv.append("test");
}
});
}
};
t.schedule(task, 2000);
}
}
</code></pre>
<p>when I click in the button of the main activity in order to go to the Test activity I get the following error:</p>
<pre><code> FATAL EXCEPTION: Timer-0
java.lang.NullPointerException
</code></pre>
<p>thanks in advance</p>
| android | [4] |
3,308,962 | 3,308,963 | jquery lightbox view slidershow | <p>I have a list of images. I want to show full size images using lightbox. But i dont want lightbox to work on click of those images. I want lightbox to work with click of some other link saying "Start Slide Show".</p>
| jquery | [5] |
3,840,174 | 3,840,175 | How Can I Detect Different ImageViews on MotionEvent.ActionMove | <p>I Am Making Be Jeweled Type Game 6*6 Squares are There and On ActionMove I have to Detect If They Are Of Similar Color get Destroy. </p>
<p><img src="http://i.stack.imgur.com/5ZtbJ.png" alt="This Is How My Game Look Like"></p>
<p>Touch Event</p>
<pre><code>gestureDetector = new GestureDetector(new MyGestureDetector());
gestureListener = new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
final int action =event.getAction();
Block b = (Block) v;
float x = event.getX();
float y = event.getY();
//int action = event.getAction();
Boolean randomTouch = false;
if (v != b && action == MotionEvent.ACTION_DOWN) {
randomTouch = true;
scoreView.setText(""+randomTouch);
gamespeed=1;
allBlocksRise();
}
// Is the event inside of this block(view)?
// if (x > b.left && x < (b.left+width) && y > (b.bottom-width) && y < b.bottom) {
b.bringToFront();
main.bringChildToFront(b);
if (action == MotionEvent.ACTION_DOWN) {
x_start = event.getX();
y_start = event.getY();
// timeView.setText("");
curBottom = b.bottom;
curLeft = b.left;
isSwitching = false;
RunAnimations(b,"mousedown");
}
if(action == MotionEvent.ACTION_MOVE) {
{
isSwitching = true;
</code></pre>
| android | [4] |
5,327,834 | 5,327,835 | Is it possible to have an in-browser debugger? | <p>Is it presently possible to programatically debug Javascript from within a browser window? I wish to be able to breakpoint/inspect Javascript from an in-browser window panel.</p>
<p>EDIT:</p>
<p>I should have been more specific: I'm loogking for an api to be used from within the page context, i.e. JS code in browser can add it's own breakpoints.</p>
| javascript | [3] |
3,855,729 | 3,855,730 | Changing the back color of UltraCalenderCombo | <p>How to change the back color of a UltraCalenderCombo control?</p>
| c# | [0] |
48,091 | 48,092 | Problem in uploading | <p>i have build my project in iphone sdk 3.0.i have used frameworks that is not available in iphone sdk 2.2.1. </p>
<p>while their uploading on app store their is one option
<strong>:-choose you device type for users running in iphone os 2.2.1 and below.
option 1)iPhone only
option 2)iphone and ipod touch(2nd generation)
option 3)iphone and ipod touch</strong></p>
<p>and this question is Mandatory.</p>
<p>have a look at following link it is screenshot of that.</p>
<p><a href="http://img520.imageshack.us/img520/2509/image001fwb.jpg" rel="nofollow">http://img520.imageshack.us/img520/2509/image001fwb.jpg</a></p>
<p>problem is my application may not run on devices which are using os version below 3.0
which option should i go for?</p>
<p>this is urgent
kindly help me.</p>
| iphone | [8] |
1,943,606 | 1,943,607 | Remove strings within a string | <p>The problem I'm encountering with this is if I have single characters in the array $wordstodelete it then deletes them from words in the $oneBigDescription.</p>
<pre><code>$oneBigDescription = str_replace ( $wordstodelete, '', $oneBigDescription);
</code></pre>
<p>So it makes it look like this:</p>
<pre><code>array (size=51)
'blck' => int 5
'centrl' => int 6
'clssc' => int 6
'club' => int 10
'crs' => int 54
'deler' => int 7
'delers' => int 5
'engl' => int 6
'felne' => int 8
'gude' => int 5
'hot' => int 5
'jgur' => int 172
'jgurs' => int 5
'lke' => int 6
</code></pre>
<p>Is there a way to only delete the single character from $oneBigDescription if it is on its own?</p>
| php | [2] |
4,610,424 | 4,610,425 | Create image with php from HTML and CSS | <p>I'm wondering if it's possible to convert markup (HTML and CSS) to an image with php? I want to let a user drag elements around, type in text etc then to allow them to hit save as image. If someone could tell me whether this is possible and any pointers to functions/tutorials on the matter.</p>
| php | [2] |
3,633,540 | 3,633,541 | how to generate line chart in website | <p>I like to generate line chart on my site ..</p>
<p>the data will change every hour so the chart should generate chart occur ding to the data </p>
<p>i inspired line chart in below site</p>
<p><a href="http://www.nseindia.com/" rel="nofollow">http://www.nseindia.com/</a> </p>
<p>so please somebody help me </p>
<p>Thanks</p>
| php | [2] |
2,684,793 | 2,684,794 | Change text of edit text on button click inside custom adapter | <p>How to change text in edit text which is embedded in a list view. i want to the change the text's value on button click</p>
<pre><code>holder.txtQty.setTag(position);
holder.plus.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
String val = holder.txtQty.getText().toString();
Float f = new Float(val);
f = f + 1;
holder.txtQty.setText(f.toString().replace(".0", "").trim());
}
});
</code></pre>
<p>but on this only the first and last rows edit text change . i need the corresponding edit text to change</p>
| android | [4] |
2,292,007 | 2,292,008 | Grab text on page and insert it into variable jquery | <p>I would like to target the text from the HTML below between the closing <code></span></code> tag and closing <code></h2></code> tag using jquery and insert the text value, in this case it would be "Hello World", into my <code>s.pageName=" "</code> traffic variable.</p>
<p>I don't know where to begin to solve this problem? Please let me know what info you need to help</p>
<p>This is my HTML:</p>
<pre><code><div class="portletTitleWrap">
<div class="portletTitle">
<div class="title">
<h2><span class="siteTitle">Homepage</span> Hello World</h2>
</div>
</div>
</div>
</code></pre>
<p>This is my javascript snippet that I would like to populate <code>s.pageName=""</code> dynamically with Hello World. This value will change from page to page which is why it would need to be dynamic.</p>
<pre><code><script language="JavaScript" type="text/javascript">
s.pageName = ""
var s_code = s.t();
if (s_code) document.write(s_code)
</script>
</code></pre>
| jquery | [5] |
3,366,169 | 3,366,170 | Alternate between writing to text file and console in JAVA | <p>I want to write to a text file. Then, I want to continue printing to the console.</p>
<p>I am able to successfully output to the text file. However, after closing the PrintStream created to write to the text file, I am unable to print to the console. In the code below, for instance, the text file has the output from the method called "permutation" followed by the phrase "Test before close". However, the phrase "Test after close" is printed to neither the text file nor the console. Thanks for any advice!!</p>
<pre><code>public static void main(String[] args) throws FileNotFoundException {
PrintStream out2 = new PrintStream(new FileOutputStream("output.txt"));
System.setOut(out2);
permutation("1234");
System.out.println("Test before close");
out2.close();
System.out.println("Test after close");
}
</code></pre>
| java | [1] |
5,827,004 | 5,827,005 | JavaScript Module pattern, is new a good idea? | <p>I'm trying to learn the JavaScript module pattern referenced <a href="http://www.yuiblog.com/blog/2007/06/12/module-pattern/" rel="nofollow">here</a>. Everything looks great but I keep seeing different ways to create the module.</p>
<p>In the article referenced above he access the module's public methods by using <code>YAHOO.myProject.myModule.init();</code> without calling <code>new</code>. But then I've seen a few people do something like <code>var module = new YAHOO.myProject.myModule();</code>. Should <code>new</code> be used and why?</p>
| javascript | [3] |
3,283,944 | 3,283,945 | Import error in python | <p>In file1.py</p>
<pre><code> def test1():
print "hi"
</code></pre>
<p>In file2.py</p>
<pre><code> from file1 import test1
def test2():
print "hello"
test1()
test2()
</code></pre>
<p>Output</p>
<pre><code> hi
hello
</code></pre>
<p>Now in file 1 if i include test2 i get the following error,Can some explain why and how to make it work.</p>
<pre><code> from file2 import test2
def test1():
print "hi"
Traceback (most recent call last):
File "file1.py", line 1, in ?
from file2 import test2
File "/root/pyt/file2.py", line 1, in ?
from file1 import test1
File "/root/pyt/file1.py", line 1, in ?
from file2 import test2
ImportError: cannot import name test2
</code></pre>
| python | [7] |
2,778,336 | 2,778,337 | Argument dependent name lookup and typedef | <p>I would not have expected this code to compile, but it does. My understanding is that <code>func(d)</code> it looks in the global namespace for a function called "func" but also in the namespace of any passed in parameters (Argument dependent lookup)</p>
<p>But in this case the parameter is in the global namespace. So why does it find "func" in the ns namespace? Are there special rules saying that if the parameter type is a typedef then it uses the namespace of the underlying type rather than the namespace of the actual parameter?</p>
<p>This appears to be true but I can't find anything supporting this... Is it the expected behavour?</p>
<pre><code>namespace ns
{
struct data {};
void func(ns::data item) {}
};
// Create an alias "datatype" in the global namespace for ns::data
typedef ns::data datatype;
int main()
{
datatype d;
func(d);
}
</code></pre>
| c++ | [6] |
3,610,138 | 3,610,139 | stop watch in android | <p>i need to create stopwatch with start,stop and pause in android. please assist me. not yet started any coding.</p>
| android | [4] |
754,748 | 754,749 | Unique algorithm on vectors c++ | <p>I have a structure stored inside the vector. There are duplicate copies of the struct in the vector. Can i use the unique algorithm on the vector? but generally i see that unique s used oly on individual values in c++</p>
| c++ | [6] |
5,710,067 | 5,710,068 | Defining a function multiple times | <p>I've got a dynamic Python service that will be defining functions on a per-record basis and I ran into something I couldn't quite figure out. Say I've got a test program set up like so: </p>
<pre><code>func_str = """
def func():
print "top"
"""
exec func_str
func_str = """
def func():
print "bottom"
"""
exec func_str
func()
</code></pre>
<p>This will, of course, print <code>"bottom"</code>, as the second call to <code>exec func_str</code> overwrites the first. I'm curious what happens under the hood. Is the first function definition deleted in some way?</p>
| python | [7] |
1,823,758 | 1,823,759 | android save-Lazy List HashMap | <p>I want to Serialize the Hash-Map of Default Lazy-list code and store it in a file on device..</p>
<p>Actually I want the images to be locally stored,,,, </p>
<p>As,my project contain a lot's of images to be used from server.... Please provide a way or code for modified lazy-list that stores the Hash-Map in a file.. As next time when app restart the Image-loader class must have that object so,,that image is not downloaded from server...</p>
| android | [4] |
5,613,239 | 5,613,240 | Designing UI for different screen resolutions | <p>I am doing the UI designing for an app,I have included all the images in hdpi,ldpi,and mdpi drawable folders,It works pretty good for small screen resolution but having a blured image for the big screen i mean for the resolution of 480X800,How can i rectify it </p>
| android | [4] |
435,520 | 435,521 | how set background color in Area (class)? | <p>i have some source </p>
<pre><code>protected void drawLocations(Canvas canvas) {
for (Area a : mAreaList) {
a.onDraw(canvas);
}
}
</code></pre>
<p>and some PolyArea class (I'm using the source <a href="https://github.com/catchthecows/AndroidImageMap" rel="nofollow">https://github.com/catchthecows/AndroidImageMap</a>)</p>
<pre><code>class PolyArea extends Area {
ArrayList<Integer> xpoints = new ArrayList<Integer>();
ArrayList<Integer> ypoints = new ArrayList<Integer>();
// centroid point for this poly
float _x;
float _y;
// number of points (don't rely on array size)
int _points;
// bounding box
int top=-1;
int bottom=-1;
int left=-1;
int right=-1;
public PolyArea(int id, String name, String coords) {
super(id,name);
// split the list of coordinates into points of the
// polygon and compute a bounding box
String[] v = coords.split(",");
int i=0;
while ((i+1)<v.length) {
int x = Integer.parseInt(v[i]);
int y = Integer.parseInt(v[i+1]);
xpoints.add(x);
ypoints.add(y);
top=(top==-1)?y:Math.min(top,y);
bottom=(bottom==-1)?y:Math.max(bottom,y);
left=(left==-1)?x:Math.min(left,x);
right=(right==-1)?x:Math.max(right,x);
i+=2;
}
_points=xpoints.size();
// add point zero to the end to make
// computing area and centroid easier
xpoints.add(xpoints.get(0));
ypoints.add(ypoints.get(0));
computeCentroid();
}
</code></pre>
| android | [4] |
877,532 | 877,533 | How do I highlight text in PHP with conditions? | <p>I have some numbers, and depending on the number's value I need to highlight a string which is in a table. The table is not in database.</p>
<p>Does anyone know how to highlight text in php?</p>
| php | [2] |
4,130,915 | 4,130,916 | extending jquery on the main element object | <p>I've seen some jquery code where people extend the main object like:</p>
<pre><code> $('someId').myCustomObject();
</code></pre>
<p>Is this possible or am I mistaken? (if yes, how?)</p>
| jquery | [5] |
3,597,645 | 3,597,646 | Convert a Python int into a big-endian string of bytes | <p>I have a non-negative int and I would like to efficiently convert it to a big-endian string containing the same data. For example, the int 1245427 (which is 0x1300F3) should result in a string of length 3 containing three characters whose byte values are 0x13, 0x00, and 0xf3.</p>
<p>My ints are on the scale of 35 (base-10) digits.</p>
<p>How do I do this? Thanks.</p>
| python | [7] |
3,254,925 | 3,254,926 | Python "Invalid Syntax Error" With Regular Expression for Phone | <p>I'm trying to create a phone regex, based on <a href="http://stackoverflow.com/a/123666/773210">a pattern provided in another stack overflow question.</a></p>
<p>This is the syntax I used to create it in Python:</p>
<pre><code>def phoneRegex = r'^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$'
</code></pre>
<p>However, when running this code I get the error:</p>
<pre><code>^ SyntaxError: invalid syntax
</code></pre>
<p>What am I doing wrong? Do I need to escape the characters somehow?</p>
| python | [7] |
996,681 | 996,682 | jQuery: how to add <li> in an existing <ul>? | <p>I have code that looks like this:</p>
<pre><code><div id="header">
<ul class="tabs">
<li><a href="/user/view"><span class="tab">Profile</span></a></li>
<li><a href="/user/edit"><span class="tab">Edit</span></a></li>
</ul>
</div>
</code></pre>
<p>I'd like to use jQuery to add the following to the list:</p>
<pre><code><li><a href="/user/messages"><span class="tab">Message Center</span></a></li>
</code></pre>
<p>I tried this:</p>
<pre><code>$("#content ul li:last").append("<li><a href="/user/messages"><span class="tab">Message Center</span></a></li>");
</code></pre>
<p>But that adds the new li <em>inside</em> the last li (just before the closing tag), not after it. What's the best way to add this li?</p>
| jquery | [5] |
4,852,689 | 4,852,690 | can I implement Holo theme and keep the old theme to support older devices? | <p>I'm trying to implement the holo theme for my app, so far so good...
but the app didn't work on older devices pre 3.0</p>
<p>so I made a custom theme, in values dir and values-v11 dir to make android switch to the correct one on runtime...</p>
<p>I also set the target sdk level to 7 to support android 2.1</p>
<p>now the holo theme isn't recognized</p>
<p>Am I aiming for something impossible?</p>
<p><strong>What I want is pre 3.0 devices to use the default android theme
and everything that supports holo to use holo theme.</strong></p>
| android | [4] |
4,895,815 | 4,895,816 | Dynamic creation of screens based on data configured in DB tables | <p>I am developing the application in Visual Studio 2010 with C# and asp.net
In my application user can configure the Number of tabs(left menu) that he want to see.
User can created fields & he can associate each filed to a tab & the index(position which states is it a first field in the tab or second etc) of the field in that tab.</p>
<p>I am saving tab details in one table & field details in another table.
When user logs in he has to get the number of tabs & in each tab number of fields & then display the tabs. And when a particular Tab is clicked, the fields associated with that tab should be shown on the screen.</p>
<p>On the bottom of screen there should be a Save button. On click of this button data entered in each field should be saved.</p>
<p>Please help me how to create the dynamic screen</p>
| asp.net | [9] |
459,805 | 459,806 | How to make code compatible for both IOS 5 and IOS 4 [iphone] | <p>I am on a new project. I want my code compatible to be for both IOS4 and IOS5 SDKs. I need all my functionalities work both in IOS4 and IOS5. That said, i am not planning to use new features in IOS5 (feature wise) and disable that feature for IOS4.</p>
<p>I have 2 options. Let me know which is best ?</p>
<ol>
<li>Target and code for IOS4. and that will work fine in IOS5 also, i think.</li>
<li>BaseSDK IOS5 and target IOS4 .(I am not planning to use ARC or storyboard for now anyway ).</li>
</ol>
<p>I think with method #2, i have to be extra careful while using each usages at the same time as i am not using story board and ARC , there are no benefits. So hope #1 is better.</p>
<p>Let me know expert opinion. </p>
<p>Note: in future if need to switch to IOS5 new features , hope only this ARC will be the blocking and that is also an optional thing and i can easily switch rt?</p>
| iphone | [8] |
5,281,035 | 5,281,036 | What is the use of IClonable interface in .NET? | <p>I just wanted to know what is the use of IClonable interface in .NET?</p>
| c# | [0] |
5,607,099 | 5,607,100 | Regex to isolate id | <p>I would like to have a php function that will strip any input and keep only a numeric ID, 36816268 in the example below. </p>
<p>The input can be something like this:</p>
<pre><code><iframe src="http://player.vimeo.com/video/36816268" width="400" height="225" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
</code></pre>
<p>or like this</p>
<pre><code><iframe src="http://player.vimeo.com/video/36816268" width="400" height="225" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe><p><a href="http://vimeo.com/36816268">ABCinema</a> from <a href="http://vimeo.com/eeseitz">Evan Seitz</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
</code></pre>
<p>I can strip the first part as</p>
<pre><code>preg_match('%.*http://player.vimeo.com/video/%im', $subject)
</code></pre>
| php | [2] |
1,552,998 | 1,552,999 | how to separate several "a little bit connected" projects? | <p>The main class in my program is <code>OrderBook</code> of some stock.</p>
<ul>
<li>one part of my program, let's call it, <code>NYSE Connector</code> reads data from <code>NYSE</code> and constructs <code>OrderBook</code> of some stocks</li>
<li>second part of my program, let's call it <code>LSE Connector</code> also constructs <code>OrderBook</code> of other stocks but from different exchange and by completely different algorithm</li>
<li>third part of my program manages all set of <code>OrderBook</code> and produce different signals to different connectors (buy such stock on LSE sell another on NYSE etc.)</li>
</ul>
<p>All parts of my program share the same instances of <code>OrderBook</code>. But parts itself are pretty independent. For example I can just run <code>NYSE Connector</code> without running anything else. Then I will just collect <code>OrderBook</code>. Doesn't make much sense, but possible.</p>
<p>Also I need everything to work asap, because even 1 ms is very important for me.</p>
<p>So now I just placed everything in one project (but in different folders), but I think it is not very good. If I will need another connector - I will just create one another folder.</p>
<p>How can I better separate my parts? But remember I need to share the same <code>OrderBook</code> instances.</p>
| c# | [0] |
394,630 | 394,631 | Approach for adding favorites tab | <p>Which approach is best to adding into favorites tab.</p>
<p>I need to add all my events which are in array. calling from web service.
two ways i can add to favorites...</p>
<ol>
<li>adding into local...</li>
</ol>
<p>USing nsuserdefaults...encoding and decoding......</p>
<p>or i can depend on web-service... create a web service. for favorites and fetch data from web service. when i click add favoirtes button.. it send device id and event id to web - service and created respective event in web service.. where i can fetch data from web service.</p>
<p>i got two ways approach which is best. </p>
<p>Can any one help me out.</p>
<p>@thanks in advance.</p>
| iphone | [8] |
2,218,772 | 2,218,773 | copy List<Type> to another another instance variable | <p>I am passing in to a callback method (List a) and I want to know how to copy over the value.</p>
<pre><code>List<addresses> mInstanceList;
public void setMyList(List<Address> addresses)
{
mInstanceList = addresses; // is this going to work?
}
</code></pre>
| java | [1] |
5,136,766 | 5,136,767 | how to master java | <p>I'm a beginner in Java, but I want to get the all essentials of Java. How can I be better in it?</p>
| java | [1] |
326,335 | 326,336 | changing value of input-button using parent's id | <p>How can I change value of input [button] using parent's id, in jQuery
Also, I need to set css to display: block</p>
<p>Any help guys?</p>
<pre><code><div id="upload_file" style="display: none;">
<input type="button" value="Add New File">
</div>
</code></pre>
| jquery | [5] |
5,809,661 | 5,809,662 | Handle external interrupts while switching activities in an App | <p>I Have developed an application which contains many activity.</p>
<p>I have noticed an issue while one activity starts another activity and meanwhile if we press camera button or get a call my application hangs and never recovers even after ending the call or closing the camera.</p>
<p>Basically what I want to know is how to handle external interrupts(alarms, calls, camera) so that my app resumes from where it had stopped.</p>
<p>I am replicating this issues on emulator as well as on LG Device.Can anyone give me some idea to how to handle onpause and onrsume function call in this case.</p>
<p>Thanks</p>
| android | [4] |
5,858,989 | 5,858,990 | compare keys of diffrent Hashmaps | <p>Lets say I have 2 Map's in Java. I want to compare map1's keys to map2's keys to see if there are any similar keys in the 2 maps. How can i do that?</p>
| java | [1] |
5,584,970 | 5,584,971 | Calling a function that uses object members without giving the object | <pre><code>void CVisualStudioDemoDoc::updateLine(void)
{
int newln = GetLineNumber(p_buf);
reinterpret_cast<CVisualStudioDemoView *>(m_viewList.GetHead())->SetCurrentLineNumber(ln, newln);
ln = newln;
}
</code></pre>
<p>I want to call this function from another part of my code without having to give the object pointer and include headers.</p>
<p>I want to call it just like a normal void function.</p>
<pre><code> if (changementLigne == true) {
currentLine = prog;
// TODO : appeler le callback de X2
updateLine();
Suspendre();
changementLigne = false;
}
</code></pre>
<p>I dont know if it's possible, since the CVisualStudioDemoDoc class is an MFC class, I didn't find a pointer I can use.</p>
| c++ | [6] |
3,491,971 | 3,491,972 | window.onload in jQuery | <p>I have use the example of sizzle and there I got window.onload in the last of the code. </p>
<p>What does this means.</p>
<p>My code is like this:</p>
<pre><code> var init = function() {
var trail = Sizzle;
var foo = trail('.foo');
foo[0].onmouseover = function() {
this.style.backgroundColor = (this.style.backgroundColor.indexOf('blue') === 0) ? 'yellow' : 'blue';
};
foo[1].onmouseover = function(){
this.style.backgroundColor = ( this.style.backgroundColor.indexOf('red') === 0) ? 'yellow' : 'red' ;
jQuery(foo[1]).after("<b>Hello</b>");
}
foo[2].onmouseover = function(){
this.style.backgroundColor = ( this.style.backgroundColor.indexOf('green') === 0) ? 'yellow' : 'green' ;
jQuery(foo[3]).toggle("slow");
jQuery('b').remove();
}
};
window.onload = init;
</code></pre>
<p>What does this mean?</p>
| jquery | [5] |
4,723,977 | 4,723,978 | Get PHP page name with all the get information | <p>I want to extract the page name with the link.</p>
<p>Say this is the page being viewed: example.php?id=5&name=John
I want to variable to be stored that exactly, not just example.php</p>
<p>Thanks</p>
| php | [2] |
1,360,464 | 1,360,465 | onTouch on ListView, change color of items | <p>I have a custom <code>listview</code> in my android application. When a user press an item in the list I want to change the background color of the pressed item. This is the code for that behaviour:</p>
<pre><code>tempView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View arg0, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
isDown = false;
tempView.setBackgroundColor(Color.parseColor("#f47920"));
}
if (event.getAction() == MotionEvent.ACTION_UP) {
tempView.setBackgroundResource(R.drawable.list_selector_focused);
}
if(event.getAction() == MotionEvent.ACTION_MOVE) {
tempView.setBackgroundResource(R.drawable.list_selector_focused);
}
return false;
}
});
</code></pre>
<p>But when I "Fling" my finger over the screen to scroll the <code>listview</code>, an item is also marked, and the "pressed" color will be static. How can I avoid this? </p>
| android | [4] |
2,655,642 | 2,655,643 | Rebind same gridview again | <p>I have ASP.NET page, Page1 and there is a gridview. There is also a linkbutton which takes user to Page2. And, once user clicks a button on Page2, the page is redirecting to Page1.</p>
<p>I want to rebind the gridview on the Page1 with previous gridview again upon coming back from Page2. So I am passing the gridview in the Session variables, and bind it to same gridview again, but it looks like it's not binding (No gridview displayed).</p>
<p>Is there any way I could preserve the gridview and rebind it upon coming back from another page?</p>
<p>Thanks!</p>
| asp.net | [9] |
4,027,314 | 4,027,315 | ArrayList not recognizing subclass variables | <p>I am having a problem with seeing subclass attributes in an ArrayList.</p>
<p>Here's some snippets of the main parts of my code that matter here.</p>
<pre><code>private ArrayList<Person> people = new ArrayList<Person>;
abstract class Person {
String fName;
String lName;
}
public class Employee extends Person {
protected int empID;
}
public class Client extends Person {
protected int clientID;
}
</code></pre>
<p>When using a for loop to search by clientID, I am getting </p>
<p>Enterprise.java:134: cannot find symbol
symbol : variable clientID
location: class Person</p>
<p>I have tried with and without instanceof Client on the for loop. I have also tried using Client instead of Person in the for loop parameters.</p>
<pre><code>for(Person x : people) {
if(x.clientID == cid) {
System.out.println(x);
}
</code></pre>
<p>Before turning these into subclasses I had them in an ArrayList of their own kind and everything worked flawlessly.</p>
<p>Any help would be greatly appreciated!</p>
| java | [1] |
1,879,225 | 1,879,226 | Show the Key(letter) pressed in a div using javascript not jquery | <p>I need to write a javascript code for a 5 letter word game that will detect when a Key(letter) is pressed to show in a div. Each letter of the word should display in its own div. If the player enters a letter and it's one of the letters in the word it should show up in one of the 5 divs if not then it should show in a another set of divs (7), player gets 7 guesses. I just need this part to get me started on the rest of the project.</p>
<p>thanks in advance,
greatfulOne</p>
| javascript | [3] |
5,578,241 | 5,578,242 | Java .add(value) with lists | <p>Basically I've got an input string, my test string is '5 + 4' and I want to check character by character to create a list in the form [5,+,4], ie white spaces are ignored. Also, if my test string was '567+5-1' it would output [567,+,5,-,1] by concatenating the numbers together. Unfortunately, it won't let me do <code>.add(inputChar)</code> to my <code>returnValue</code>, saying symbol not found... any ideas?</p>
<pre><code>import java.util.*;
public class CharacterArray {
public List<String> splitToChar(String s) {
List<String> returnValue = new LinkedList<String>();
char[] chars = s.toCharArray();
System.out.println(chars);
int currentNumber;
for (char inputChar : chars) {
if (Character.isDigit(inputChar) == true) {
currentNumber += inputChar;
} else if (inputChar == '.') {
currentNumber += inputChar;
} else if (inputChar == '+') {
returnValue.add(inputChar);
} else if (inputChar == '-') {
returnValue.add(inputChar);
} else if (inputChar == '/') {
returnValue.add(inputChar);
} else if (inputChar == '*') {
returnValue.add(inputChar);
} else if (inputChar == '(') {
returnValue.add(inputChar);
} else if (inputChar == ')') {
returnValue.add(inputChar);
} else {
System.out.println("Incorrect input symbol");
}
}
return returnValue;
}
}
</code></pre>
| java | [1] |
4,986,753 | 4,986,754 | What is the difference in these two declarations? | <pre><code>List<String> someName = new ArrayList<String>();
ArrayList<String> someName = new ArrayList<String>();
</code></pre>
<ol>
<li>Does it impact anything on performance?</li>
<li>The first one is a List of Objects and the latter one is ArrayList of Objects. Correct me if i am wrong. I got confused because ArrayList implements List Interface.</li>
<li>Why do people declare like this? Does it help in any situtions.</li>
<li>When i am receiving some email address from DB, what is the best way to collect it? List of eMail address Objects????</li>
<li>Finally one unrelated question.... can an interface have two method names with same name and signature and same name with different signature.</li>
</ol>
| java | [1] |
1,654,816 | 1,654,817 | Converting existing android application which is developed in 240 density toe 320 density | <p>If we want to convert our existing android applications developed in 240 density (1024x600) to 320 (1024x600) density, do I need to change the entire Layout UI files of the current application or do we have any other alternatives. Can we apply 320 density programetically to the current 240 density application?</p>
| android | [4] |
33,762 | 33,763 | Java condition program | <p>I am doing java programming practice from a website. I have to display this out put using arrays.</p>
<pre><code>Enter the number of students: 3
Enter the grade for student 1: 55
Enter the grade for student 2: 108
Invalid grade, try again...
Enter the grade for student 2: 56
Enter the grade for student 3: 57
The average is 56.0
</code></pre>
<p>This is my source code so far. It is showing results but not working properly. It takes number of students & grade for 1st student. But then it halts, if I press any number & press enter, it asks for next grade & so on. And this way it prints average at the end. If I enter not allowed input, it catches that.
What is wrong in this code. </p>
<pre><code>package array;
import java.util.Scanner;
public class GradesAverage {
public static void main(String[] args) {
int numStudents, sum=0;
int[] grades;
Scanner in = new Scanner(System.in);
System.out.print("Enter number of students : ");
numStudents = in.nextInt();
grades = new int[numStudents];
//System.out.println(grades.length);
for (int i = 0; i < numStudents; i++) {
System.out.print("Enter grade of student "+i+" :");
grades[i] = Integer.parseInt(in.next());
if(grades[i]>100 || grades[i]<0)
{
System.out.println("It is not a valid number!");
i--;
continue;
}
//grades[i] = Integer.parseInt(in.next());
sum+=grades[i];
}
System.out.print("Average grades are: "+sum/numStudents);
in.close();
}
}
</code></pre>
| java | [1] |
2,257,232 | 2,257,233 | how to store previous activity value in android? | <p>how to store previous activity value in android</p>
| android | [4] |
3,604,341 | 3,604,342 | Javascript onClick and onmouseover and onmouseOut | <p>I would like to ask how to differentiate between onClick and onMouseOver and onMouseOut.</p>
<p>For instance,
I use onMouseOver to change the tab background to grey using</p>
<pre><code>onMouseOver="this.style.backgroundColor=Blue;"
</code></pre>
<p>onMouseOut takes away this background</p>
<pre><code>onMouseOut="this.style.backgroundColor=White;"
</code></pre>
<p>How do I write a call for onClick that gives a blue background and keeps it there even when the mouse cursor moves away from the tab?</p>
<p>Thanks</p>
| javascript | [3] |
323,762 | 323,763 | Is there any time it is good to use a public field in c#? | <p>Is there any time it is good to use a public field in c# instead of a property?
And if there is no good case to use them, why are they available in the language?</p>
| c# | [0] |
2,290,752 | 2,290,753 | What's the best way to isolate users from an admin process they initiate? | <p>I need to write some software using C# that allows web users to do various admin tasks in our application and in active directory, even though their user accounts will not be granted the permissions to do so directly. They will visit a web page whilst logged into AD as standard users but be able to click buttons that perform basic tasks in AD. For example, some users will be permitted to reset the passwords of their subordinates or modify their name due to marriage.</p>
<p>What's the best way to implement this securely?</p>
| c# | [0] |
5,617,503 | 5,617,504 | what is integrated security in connection string in asp.net | <p>what is integrated security in connection string in asp.net. </p>
| asp.net | [9] |
5,529,538 | 5,529,539 | how do i split string in c#? | <p>In my application I need to stored given following data's..</p>
<p><strong>Street, City, State, Postal and Country</strong></p>
<hr>
<p><strong>---Sample Address ---</strong></p>
<p>***Street: #306, Los Angel,opp Line Tower,3rd cross</p>
<p>City/Town: Ang Mo Kio</p>
<p>State: Al-mera</p>
<p>Postal : 520506</p>
<p>Country: Dubai</p>
<hr>
<p>But my string like means</p>
<p><strong>"#306, Los Angel,opp Line Tower,3rd cross\nAng Mo Kio Al-mera 520506\nDubai"</strong></p>
<p>from above string how can i split for Street, City, State, Postal and Country. </p>
<p><strong>[Note: all fields are not mandatory field, even might be empty. So When empty field pass value as empty string for corresponding field]</strong></p>
<p>C# variable declaration: string street,city,state,postal,country=string.empty;</p>
<p>How can i store value from above orginal string split into correspondng c# variables?</p>
| c# | [0] |
4,383,324 | 4,383,325 | remove last character | <p>i noticed that there are a lot of topics like this in stackoverflow, but the ones that i read are with just 1 variable, and i have two and i'm a little confuse.</p>
<p>so this is my code,</p>
<pre><code>$query = mysql_query("SELECT Provider.provider_id, provider.company_name FROM Provider");
while($row = mysql_fetch_array($query)){
echo "'".$row['provider_id']."':'".$row['company_name']."',";
}
</code></pre>
<p>I am using this to generate javascript code for Jeditable.</p>
<p>I need to take out the last comma, so I can wrap up with the rest of the code...</p>
| php | [2] |
2,041,871 | 2,041,872 | How to sort std::list<..> | <p>i have a list of Elemtents of a custom type:</p>
<pre><code>std::list<CDataTransferElement*> m_list;
</code></pre>
<p>The class is defined like this:</p>
<pre><code> class CDataTransferElement
{
public:
CDataTransferElement(void);
~CDataTransferElement(void);
CString Name;
double PercentValue;
double MOLValue;
int PhaseIndex;
};
</code></pre>
<p>I have x Items in the m_list Object, that have to be sorted by the PhaseIndex Variable in a new Object (what type of ever).
In the end i need x lists of the CDataTransferElement Elements where each list has only Elements with the same PhaseIndex.</p>
<p>How do i do that at best?</p>
<p>regards
camelord </p>
| c++ | [6] |
4,098,320 | 4,098,321 | Dropdown default select value | <p>This is a Dropdown control where I am binding the data, after bind I am putting the select statement. Even though the index is kept to 0 always select comes last like this:</p>
<pre><code>now output:
india
Auz
US
--select--
required output:
--select--
india
AUZ
US
ddlcounty.DataSource = dtNew;
ddlcounty.DataTextField = "Weight";
ddlcounty.DataValueField = "Weight";
ddlcounty.DataBind();
ddlcounty.Items.Add("--Select--");
ddlcounty.SelectedValue = "0";
</code></pre>
<p>What is the change required here?</p>
<p>Thanks</p>
| asp.net | [9] |
3,034,928 | 3,034,929 | sending email in android | <pre><code>public class AndroidEmailActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final EditText edittextEmailAddress = (EditText) findViewById(R.id.email_address);
final EditText edittextEmailSubject = (EditText) findViewById(R.id.email_subject);
final EditText edittextEmailText = (EditText) findViewById(R.id.email_text);
Button buttonSendEmail_intent = (Button) findViewById(R.id.sendemail_intent);
buttonSendEmail_intent.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
String emailAddress = edittextEmailAddress.getText().toString();
String emailSubject = edittextEmailSubject.getText().toString();
String emailText = edittextEmailText.getText().toString();
String emailAddressList[] = { emailAddress };
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("plain/text");
intent.putExtra(Intent.EXTRA_EMAIL, emailAddressList);
intent.putExtra(Intent.EXTRA_SUBJECT, emailSubject);
intent.putExtra(Intent.EXTRA_TEXT, emailText);
startActivity(Intent.createChooser(intent,
"Choice App t send email:"));
}
});
}
}
</code></pre>
<p>This is my code.I am not getting any emails.I need to send emails through this intent method.how can I acheive that?Where I went wrong?pls give some suggestions.</p>
<p>I am getting the error when I click the Send email button as "No applications can perform this action."</p>
| android | [4] |
4,063,191 | 4,063,192 | but not go to next page in a single click when i am click on second time that time goes to next page,, | <pre><code><script language="JavaScript" type="text/javascript">
$(document).ready(function() {
$("#frmRegistration").validate({
errorElement:'div',
rules: {
package_type:{
required: true,
remote:{ url:"addcheck_data.php",type:'get'}
},
},
messages: {
package_type:{
required: "Please insert package type",
remote: jQuery.format("This package type already exist")
},
}
});
});
</script>
</code></pre>
| jquery | [5] |
4,834,835 | 4,834,836 | How to display line number of sentence (muliple line) in the first line? | <p>In test.txt, I have 2 lines of sentences.</p>
<pre><code>The heart was made to be broken.
There is no surprise more magical than the surprise of being loved.
</code></pre>
<p>In the codes:</p>
<pre><code>import re
file = open('test.txt','r')#specify file to open
data = file.readlines()
file.close()
print "---------------------------------------------------"
count = 0
for line in data:
line_split = re.findall(r'[^ \t\n\r, ]+',line)
count = count + 1
def chunks(line_split, n):
for i in xrange(0, len(line_split), n):
yield line_split[i:i+n]
separate_word = list(chunks(line_split, 8))
for i, word in enumerate(separate_word, 1):
print count, ' '.join(word)
print "---------------------------------------------------"
</code></pre>
<p>Results from the codes:</p>
<pre><code>---------------------------------------------------
1 The heart was made to be broken.
---------------------------------------------------
2 There is no surprise more magical than the
2 surprise of being loved.
---------------------------------------------------
</code></pre>
<p>Is there any possible way for displaying the number of sentence in the first line only?</p>
<p>Expect results:</p>
<pre><code>---------------------------------------------------
1 The heart was made to be broken.
---------------------------------------------------
2 There is no surprise more magical than the
surprise of being loved.
---------------------------------------------------
</code></pre>
| python | [7] |
1,309,852 | 1,309,853 | Which PHP tags are always available? | <p>Of the 4 types of PHP tags:</p>
<ul>
<li><strong>Standard</strong> tag : <code><?php ...?></code></li>
<li><strong>Short</strong> tag : <code><? .... ?></code></li>
<li><strong>Script</strong> tag: <code><script language=“php”>
... </script></code></li>
<li><strong>ASP</strong> tag : <code><% ... %></code></li>
</ul>
<p>Which is/are <strong><em>always</em></strong> available ?</p>
| php | [2] |
5,139,372 | 5,139,373 | Confusing calling method in Java | <pre><code>class Parent
{
private void method1()
{
System.out.println("Parent's method1()");
}
public void method2()
{
System.out.println("Parent's method2()");
method1();
}
}
class Child extends Parent
{
public void method1()
{
System.out.println("Child's method1()");
}
}
class test {
public static void main(String args[])
{
Parent p = new Child();
p.method2();
}
}
</code></pre>
<p>I'm confuse why does in Parent::method2() when invoking method1() it will cal Parents method1() and not Childs method1 ? I see that this happens only when method1() is private? Can someone explain me why ?<br>
Thanks you.</p>
| java | [1] |
2,621,584 | 2,621,585 | How to explore a package in python | <pre><code>import pkg
dir(pkg)
</code></pre>
<p>such a statement in python won't show all the classes / functions / subpackages in the package pkg because some of them might be loaded just in time.So what is the best way to explore a package in python?</p>
| python | [7] |
4,491,786 | 4,491,787 | how to send bulk mail using php | <p>I am trying to create mailing function like gmail and yahoo, where we can enter multiple id in to,cc,bcc fiels to send multiple mails but not able to do so. I can send single mail with attchment on only one mail id,but not to multiple mail ids in to ,cc ,bcc. I am using texboxes to add mail ids</p>
<p>Can any one help me.</p>
| php | [2] |
2,707,866 | 2,707,867 | Best method to download remote files | <p>I've been trying to find the best method to download large files from other servers using PHP , but seems i am failing in that or i am not fully satisfied .</p>
<p>so my question is , what is the fastest method that uses less ram to download large files ? is it curl ? of fopen ? and if it was fopen , what strategy to use ? </p>
<p>Thank you .</p>
| php | [2] |
3,050,827 | 3,050,828 | Android slide out animation , space left is filled by other view | <p>using sdk 2.3</p>
<p>I have a view at the bottom of the screen that I want to slide out so I use this code </p>
<pre><code> FrameLayout ll1 = (FrameLayout) findViewById(R.id.bottom_panel);
Animation anim1 = AnimationUtils.loadAnimation(this, R.anim.slideoutbottom);
anim1.setInterpolator((new
AccelerateDecelerateInterpolator()));
anim.setFillAfter(true);
ll1.setAnimation(anim1);
ll1.setVisibility(View.GONE);
</code></pre>
<p>xml: </p>
<pre><code> <?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromYDelta="0%p" android:toYDelta="45%p" android:duration="500" android:zAdjustment="bottom"/>
</set>
</code></pre>
<p>THe problem I have is that there is a view in the middle of the screen which is expanding to fill the space left by the view sliding out. I don't want this to happen, I just need the view in the middle to stay where it is and I will fade this one out.</p>
<p>How to solve
Thanks</p>
| android | [4] |
3,220,441 | 3,220,442 | Asp.net Cookie Domain / Scope | <p>I have a "cookie" handler / utility class that works quite well for me. It abstracts away a lot of the issues that I drive me crazy when dealing with cookies such as how to handle a response (write) operation followed by a request (read) operation on the same postback, how to handle encryption, etc.</p>
<p>The one thing that eludes me is how to segregate my cookies across different “virtual” domains. My applications are running in an intranet environment all with the same host / server name:</p>
<p><a href="http://server/app1/" rel="nofollow">http://server/app1/</a></p>
<p><a href="http://server/app2/" rel="nofollow">http://server/app2/</a></p>
<p>I don’t want these different applications sharing cookie values in the event that they use the same names. Approaches on the Request / Response object?</p>
| asp.net | [9] |
3,472,153 | 3,472,154 | Unexpected Run time error with simple code | <p>Can anybody please tell me why iam getting an unexpected run-time error for the code given below. It works for two times iteration but not for more than that.</p>
<pre><code>#include<iostream>
#include<fstream>
#include<string>
using namespace std;
void print(string hmm)
{
ofstream ko(hmm.c_str(),ios::trunc);
ko<<"chacho";
ko.close();
}
int main(){
for(int i=0;i<5;i++)
{
char *chat=new char;
sprintf(chat,"%d%s",i,"_num.txt");
string rat=chat;
print(rat);
}
system("pause");
return 0;
}
</code></pre>
| c++ | [6] |
5,171,287 | 5,171,288 | Accelerometer SensorEvent timestamp | <p>Im currently working on a android application.. I have to log the accelerometer sensor event coordinate with event time. I got the sensor event timestamp like "3497855005850" but i am not able to convert event timestamp into user readable date time format.Thanks in advance</p>
<p>How can i convert SensorEvent timestamp to unix timestamp?</p>
| android | [4] |
5,550,282 | 5,550,283 | getting nth:child jquery | <p>I have this html block</p>
<pre><code> <div id="pane" class="MosadBoxRight scroll_pane" style="overflow: hidden; height: 590px; width: 250px; padding: 0px 41px 0px 0px;">
<div class="MosadBoxRightKoteretpopUp">text</div>
<div class="area" id="area1">
<a iframe="/4746929" style="cursor:pointer" class="alink" id="aLink">example1
</a></div>
<div class="area" id="area2">
<a iframe="4746929" style="cursor:pointer" class="alink" id="aLink">example1
</a></div>
<div class="area" id="area3">
<a iframe="/474692946" style="cursor:pointer" class="alink" id="aLink">example1
</a></div>
</div>
</code></pre>
<p>I have also this javascript function</p>
<pre><code> function nextchapter() {
loc=loc+1;
var contextCmsPage = $("#pane .alink:nth-child(0)").attr("iframe");
}
</code></pre>
<p>and a button that call this function</p>
<pre><code><input type="button" id="btnc" onclick="nextchapter()" value="check" />
</code></pre>
<p>I am trying to get nth child of class <code>alink</code> in father Div <code>pane</code> </p>
<p>I getting undefinded for <code>$("#pane .alink:nth-child(0)").attr("iframe");</code></p>
<p>I also tried</p>
<pre><code>$("#pane").find(".alink:nth-child(0)").attr("iframe");
</code></pre>
<p>with same result</p>
<p>What can be the problem?</p>
<p>Thanks</p>
<p>Baaroz</p>
| jquery | [5] |
5,345,668 | 5,345,669 | How to use onSaveInstanceState with a lot of data and objects | <p>When my application became sophisticated and main activity started holding in memory a lot of data (loaded and parsed from files in response to user actions) I have (mistakenly) switched from <code>onSaveInstanceState</code> to <code>onRetainNonConfigurationInstance</code> without noticing that <code>onRetainNonConfigurationInstance</code> is not called when application is killed to save device memory. So as now I has to switch back to <code>onSaveInstanceState</code> I want to as what is the proper way to handle a huge amount of data distributed by tens of objects? Do I have to implement serialization for all these objects (<code>Parcelable</code>?) or may be put all the data into <code>Service</code> thread hoping it would not be killed? What is the best practice?</p>
| android | [4] |
4,882,545 | 4,882,546 | Android url.openStream slow? | <p>Im using the following code to retrieve some text from a http-server. The size is less than 1 kB and is generated in 0.002 milliseconds</p>
<p>However, retreiving the data may take 600 ms, but mostly between 2000 and 5000 ms.</p>
<p>the following code is used:</p>
<pre><code>long starttime = System.currentTimeMillis();
StringBuffer SB = new StringBuffer();
Common.toLog("101 took "+ (System.currentTimeMillis() - starttime) + " ms");
try {
URL url = new URL(Common.server+request);
Common.toLog("102 took "+ (System.currentTimeMillis() - starttime) + " ms");
InputStreamReader ISR = new InputStreamReader(url.openStream());
Common.toLog("102a took "+ (System.currentTimeMillis() - starttime) + " ms");
BufferedReader in = new BufferedReader(ISR);
Common.toLog("103 took "+ (System.currentTimeMillis() - starttime) + " ms");
String inputLine;
while ((inputLine = in.readLine()) != null) {
SB.append(inputLine);
}
in.close();
Common.toLog("105 took "+ (System.currentTimeMillis() - starttime) + " ms");
} catch (IOException e)
{
Common.toLog("Could not make connection 1");
showMSG(R.string.ERROR_NO_INTERNET, true);
}
</code></pre>
<p>The most timeconsuming method is between log-point 102 and point 102a. When using chrome i can load <a href="http://home.peterelzinga.eu/phpjsinterface/browse.php?action=getCPL" rel="nofollow">the page</a> within 300-350 ms. I would like to know if there is a more efficient way to retrieve this data</p>
| android | [4] |
3,134,215 | 3,134,216 | Starting to develop for Android, what SDK(s) should i choose to install? | <p>I'm starting to broad my developer skills also to the Android development.</p>
<p>I installed all the tools and configurations and every thing seem great, As a default settings I install the 3.2 SDK, but there is not too much docs on that one, mode of what is out there is on the 2.x SDKs.</p>
<p>Is it like IOS, does android have a good backward computability? Can I stay with the 3.x and count on it (with the features that are in the 2.x SDKs) to work on 2.x phones? What are the common version in the Android devices this days? I have lots of newbie develop questions like that, as i want to start from a good starting point and there are lots of materials and tutorials over the web that are not up to date.</p>
<p>Also, does any one know about a good site for this kind of Q&A?</p>
<p>Thank you,
Erez</p>
| android | [4] |
3,283,664 | 3,283,665 | PHP SID not showing | <p>I cannot get my SID working ...</p>
<pre><code><?php
session_start();
// Or maybe pass along the session id, if needed
echo '<br /><a href="page2.php?' . SID . '">page 2</a>';?>
</code></pre>
<p>does not show up SID number but session_id is working not sure if I am missing something.
THnks</p>
| php | [2] |
3,789,444 | 3,789,445 | Get process which changed FileInfo.lastAccessTime or FileInfo.lastWriteTime | <p>Is it possible to find the process which changed the FileInfo.lastAccessTime or FileInfo.lastWriteTime of a File?</p>
| c# | [0] |
1,024,842 | 1,024,843 | Javascript Show Hide - Changing toggle action from Checkbox to <a href> links | <p>currently I have a method of showing / hiding a div based on a form checkbox field as per below. What I do want however is to not use a form to show hide rather just call the show / hide function based on a simple on a link . I hope this makes sense what I am attempting to do. Any help /advice would be really valued!</p>
<pre><code><!-- Show hide-->
<script language="JavaScript">
function showhidefield()
{
if (document.goform.areas.checked)
{
document.getElementById("areaone").style.display = "block";
document.getElementById("areatwo").style.display = "none";
}
else
{
document.getElementById("areaone").style.display = "none";
document.getElementById("areatwo").style.display = "block";
}
}
</script>
<form name="goform" id="goform" action="xxxx" method="post" enctype="multipart/form-data">
<label><input name="areas" type="checkbox" onclick="showhidefield()" value="1"> Yes </label>
</form>
<div id="areaone" style="display:none;">
Area One
</div><!-- / Hideable area -->
<div id="areatwo" style="display:block;">
Area two
</div>
</code></pre>
<p>Changing the above so that rather than using a form checkbox to showhide, have a toggle effect based on event e.g.</p>
<pre><code><a href="xxx">Show Areaone / Hide Areatwo</a>
<a href="xxx">Show Areatwo / Hide Areaone</a>
</code></pre>
| javascript | [3] |
5,817,458 | 5,817,459 | Is there a C# type for representing an integer Range? | <p>I have a need to store an integer range. Is there an existing type for that in C# 4.0?</p>
<p>Of course, I could write my own class with int From and int To properties and build in proper logic to ensure that From <= To. But if a type already exists, I'd of course rather use that.</p>
| c# | [0] |
4,756,228 | 4,756,229 | delete of global ptr | <p>Hi
Just want to know if i delete a global ptr will this lead to memory leak</p>
| c++ | [6] |
3,209,835 | 3,209,836 | Unity Framework resolve error | <p>I am getting an error when the UnityContainer.Resolve method runs which states...
"An unhandled exception of type 'System.StackOverflowException' occurreed in Microsoft.Practices.ObjectBuilder2.dll.</p>
<p>Can anyone help me with where to start on troubleshooting this?</p>
<p>Thanks in advance.</p>
| c# | [0] |
3,406 | 3,407 | How to set a cookie in iframe? How Facebook cookies work? | <p>I'm trying to understand the principle behind the Facebook plugins.
As I understood they set a cookie when you login, and then whenever you visit a website with their plugin installed, they are abel to recognize your userId..</p>
<p>I'm trying to do it on my own on a couple of different domains I have, but I don't know where to start actually...</p>
<p>I set a cookie TEST when I visit site1.com with a random id value</p>
<p>but then when i visit site2.com what should I do? I can I read the previous cookie that contains my id?</p>
| javascript | [3] |
5,956,442 | 5,956,443 | how can delete a selected control in run time | <p>I have a form that in run time i make many picture box control and i located them on my form.
now my question is how can delete a picturebox(in run time) that it is been selected and keybord "delete" is entered.
thanks.</p>
| c# | [0] |
2,832,221 | 2,832,222 | Cannot login after I publish my asp.net web application in IIS7 | <p>I published it succesfully in IIS. The problem is that this application run , but when I try to login , it remain in the same page , so I cant log in ,cant go inside my application. It seems like the server redirect the browser in the same content page.</p>
| asp.net | [9] |
697,595 | 697,596 | Check for a specific character string using javascript | <p>How can I write ad check for a specific character string in a text field? </p>
<p>If someone types in this identification number in a textfield. <br> Upon submit, it will look if it starts with "D"
IE: D959344843 </p>
<p>If it does, display a DIV on the page. If not, prompt an error alert message.</p>
<p>-=-=-=-=-=-=-=-=-=-=-=--= <br>
New addition <br>
How can I code this on my page and make it work?</p>
<p><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"></code>
<br /><code><html xmlns="http://www.w3.org/1999/xhtml"></code>
<br /><code><head></code>
<br /><code><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></code>
<br /><code><title>Test</title></code></p>
<p><br /><code><script type="text/javascript"></code>
<br /><code>var mystring = 'D59344843';</code></p>
<p><br /><code>if(mystring.substring(0, 1) == 'D'){</code>
<br /><code>//display a DIV</code>
<br /><code>alert('cool');</code>
<br /><code>}else{</code>
<br /><code>alert('error is no kewl');</code>
<br /><code>}</code>
<br /><code></script></code></p>
<p><br /><code></head></code></p>
<p><br /><code><body></code>
<br /><code><input name="yourtextfield" value="" type="text" /></code>
<br /><code><input name="" type="submit" /></code>
<br /><code></body></code>
<br /><code></html></code></p>
| javascript | [3] |
1,104,019 | 1,104,020 | Where can I create a normal php file? | <p>I have a wordpress site and I want to create a normal php file. If I put it anywhere in my wp-content folder, I always get a page not found error when I try to access it. For example, I create a file: json.php, and I put it in the wp-content folder and try to acess it like that: www.example.com/json.php, but I get the error.</p>
<p>If I put it outside my wp-content folder, it works, but then I can not use the Wordpress functions like The Loop. How can I create a php file in wordpress and acess it normally?</p>
| php | [2] |
2,936,846 | 2,936,847 | Remove word(s) if they're longer than 30 characters? | <p>I need to remove words from string, if they're longer than 20 characters. I've tried this but it only adds line breaks.</p>
<pre><code>wordwrap($line,30,"",true);
</code></pre>
| php | [2] |
2,386,593 | 2,386,594 | Turning off Events and Firing the same ones back up again - Jquery | <p>I'm using jQuery's new On() and Off(). When an event is turned off, can it be turned back on again? If so, does anyone have a simple example they can show me? I've looked around but can't seem to grasp what is out there on the internet. Thanks much!</p>
| jquery | [5] |
1,997,904 | 1,997,905 | Close the child of the parent of the parent | <p>Hello i have an HTML Code like this</p>
<pre><code><div id="top">
<div class="panel">
<h1>toppanel</h1>
<p>Content from toppanel</p>
</div>
<div class="panelholder" id="ptop">
<a class="open" href="#">open</a>
<a class="close" href="#">close</a>
</div>
</div>
</code></pre>
<p>for more than on time. The only differnce is the id from the first div
My jQuery Code looks like this</p>
<pre><code>// Expand Panel
$(".open").click(function(){
$(#######).slideDown("slow");
});
</code></pre>
<p>and my question is what i have to write for $(#######), if I want to slideDown the div with the class panel</p>
| jquery | [5] |
2,237,179 | 2,237,180 | Push Notification Problem | <p>I want to get the reminder at each notification comes from the web service in the application for the different tasks. For that what i have used the following methods.
but i am not getting push notific</p>
<pre><code>- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
}
- (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err {
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
}
</code></pre>
| iphone | [8] |
3,917,308 | 3,917,309 | Enterprise library error | <p>I keep getting this error when I run my application, sometimes its goes away, but sometimes it appears again.</p>
<blockquote>
<p>System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0,
Culture=neutral, PublicKeyToken=null' or one of its dependencies.
The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=null'
at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr*
methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext,
RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[]
genericMethodArguments)</p>
</blockquote>
| asp.net | [9] |
1,563,615 | 1,563,616 | Tarring files together as iterable in Python? | <p>I'm running a WSGI server and part of the API I'm writing returns some (rather large) files along with meta-data about them. I'd like to tar/gzip the files together both to conserve bandwidth and so only one file has to be downloaded. Since WSGI lets you return an iterable object, I'd like to return an iterable that returns chunks of the tar.gz file as it's produced. </p>
<p>My question is what's a good way to tar/gzip files together in Python in a way that's amenable to streaming the output back to the user?</p>
<p>EDIT:</p>
<p>To elaborate on my response to Oben Sonne below, I'll have a function such as:</p>
<pre><code>def iter_file(f,chunk=32768): return iter(lambda: f.read(chunk), '')
</code></pre>
<p>Which will let me specify a chunk size to return from the file when returning it to the WSGI server.</p>
<p>Then it's a simple matter of:</p>
<pre><code>return iter_file(subprocess.Popen(["tar", "-Ocz"] + files, stdout=subprocess.PIPE).stdout)
</code></pre>
<p>or, if I want to return a file: </p>
<pre><code>return iter_file(open(filename, "rb"))
</code></pre>
| python | [7] |
729,649 | 729,650 | Showing blank page in WebView in no Internet Connected | <p>In my WebView show URL Address when Mobile User doesn't have an Internet connection.
So, I would like to show White Screen when user in WebView activity with no Internet connection.</p>
<p>How can I do so?</p>
| android | [4] |
1,739,007 | 1,739,008 | Added permission WAKE_LOCK, now problems on Droids | <p>I have an existing app that was working just fine on all phones.<br>
I added the permission WAKE_LOCK so I could control when the app goes
to sleep.<br>
It worked fine on my HTC Hero, so I published the new update. I
immediately started getting emails from Droid users that the app would
not launch anymore on their phones after they udpated. They get "could
not launch requested activity" when the try to start the app, but it
will allow them to run the app once if they run it from the App Store
button.<br>
I removed the permission, and now Droid users can run the app
normally.<br>
Here is my manifest xml: </p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.krugism.EntitySensor"
android:versionName="2.8" android:versionCode="12">
<application android:icon="@drawable/icon"
android:label="@string/app_name" android:debuggable="false"
android:permission="android.permission.WAKE_LOCK">
<activity android:name=".EntitySensor"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:permission="android.permission.WAKE_LOCK">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SettingsPref" android:label="@string/app_name">
</activity>
</application>
<uses-sdk android:minSdkVersion="3" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
</manifest>
</code></pre>
<p>Any ideas why this would be a problem on Droid phones? I have not heard of any other phones having this problem.<br>
Thanks,
Scott</p>
| android | [4] |
2,030,393 | 2,030,394 | What is the best way to keep track of images uploaded by an user using PHP | <p>I am planning to do a photo album website, So each user may upload as many number of images. What is the best way to keep track of images for an individual user. What should be the server configuration to handle this part. </p>
<p>-Lokesh</p>
| php | [2] |
1,252,467 | 1,252,468 | Javascript Alert issue | <p>I am having some problem regarding a Alert box.</p>
<p>My site is performing a Session out and after logging out it goes to the index/main.html.</p>
<p>Currently, I am showing a Pop up alert once the session times out and Redirecting it to the Index page.</p>
<p>I want to show a Alert message once the session times out in the Index page saying: "Your session has time out, plz Login to continue'- If the user clicks 'Ok' he will be able to Login again.</p>
<p>Is it possible?</p>
| javascript | [3] |
2,783,771 | 2,783,772 | help me edit this jquery | <p>I have a jQ:</p>
<pre><code>$(function() {
if($('span').css('color')=='rgb(250, 0, 0)' ||
$('span').css('color')=='#fa0000') {
$('span').before('hello ');
}
});
</code></pre>
<p>it work with this html:</p>
<pre><code><span style="color: #fa0000">Ann</span>
</code></pre>
<p>but it do not work with:</p>
<pre><code><span><span style="color: #fa0000">Ann</span></span>
</code></pre>
| jquery | [5] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.