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
4,528,259
4,528,260
Should I create each class in its own .py file?
<p>I'm quite new to Python in general.</p> <p>I'm aware that I can create multiple classes in the same .py file, but I'm wondering if I should create each class in its own .py file.</p> <p>In C# for instance, I would have a class that handles all Database interactions. Then another class that had the business rules.</p> <p>Is this the case in Python?</p>
python
[7]
4,082,145
4,082,146
Generating a complex unordered list with PHP
<p>I have to display some info in an unordered list like above:</p> <pre><code>&lt;ul&gt; &lt;li class="first"&gt;...&lt;/li&gt; &lt;li&gt;...&lt;/li&gt; &lt;li class="last"&gt;...&lt;/li&gt; &lt;li class="first"&gt;...&lt;/li&gt; &lt;li&gt;...&lt;/li&gt; &lt;li class="last"&gt;...&lt;/li&gt; &lt;li class="first"&gt;...&lt;/li&gt; &lt;li&gt;...&lt;/li&gt; &lt;li class="last"&gt;...&lt;/li&gt; ... &lt;/ul&gt; </code></pre> <p>I need to print this using PHP. </p> <p>My question is how can I set that class for the first la last element after each three results?</p> <p>Thank you.</p>
php
[2]
3,160,357
3,160,358
Where's the documentation for jQuery set version of .position()?
<p>I am not finding the documentation for jQuery set version of .position()? All I see is the get version at <a href="http://api.jquery.com/position" rel="nofollow">http://api.jquery.com/position</a>.</p> <p>The usage is like:</p> <pre><code>jQuery(theElement).position({ my: "center", at: "center", of: ElementPositionedAgainstTo, offset: "0 0" }); </code></pre>
jquery
[5]
3,542,610
3,542,611
Maintaining History in a Web Browser in Java
<p>Can anyone suggest me how to store history?</p> <p>I am making a Web Browser and I have to save the History and then display whenever the User wants. I have tried ArrayList but it will only store the web links that have been used by the open application. Once the application is closed all the saved web links are gone. Is there any way so that I can display all the previous day web links also. Kindly reply the code as I need it in my project.</p> <p>I am making my Web Browser in Java using Swing</p>
java
[1]
2,152,229
2,152,230
How to check whether the Question and Password in ASP.NET Membership is correct or not without using Password
<p>I am having an ASP.net Membership I need to verify the User Question and Answer.</p> <p>I dont need to use Password Because its Hashed we cannot validate it</p> <p>MembershipUser msUser = Membership.GetUser("Rasel");</p> <p>thanks, Lalithambigai</p>
asp.net
[9]
4,396,294
4,396,295
how to find the next available input id using jQuery?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/8868707/tab-behavior-using-jquery">Tab behavior using jQuery</a> </p> </blockquote> <p>Imagine that there are many text boxes in a web page and our cursor is focused on one of them randomly. Is there any solution to find out the next available textbox id using jQuery ?</p>
jquery
[5]
4,676,101
4,676,102
Location based services in android
<p>please guide me about how i can build an android app which can find the hotels or shopping mall according to my current location . I have gone through several tutorials but only what i can do is to find the latitude and longitude</p>
android
[4]
4,080,622
4,080,623
Jquery - check for clicks outside of a Select box
<p>I recreated a Select box and its dropdown function using this:</p> <pre><code>$(".selectBox").click(function(e) { if (!$("#dropDown").css("display") || $("#dropDown").css("display") == "none") $("#dropDown").slideDown(); else $("#dropDown").slideUp(); e.preventDefault(); }); </code></pre> <p>The only problem is that if you click away from the box, the dropdown stays. I'd like it to mimic a regular dropdown and close when you click away, so I thought I could do a 'body' click: </p> <pre><code>$('body').click(function(){ if ($("#dropdown").css("display") || $("#dropdown").css("display") != "none") $("#dropdown").slideUp(); }); </code></pre> <p>But now, when you click the Select box, the dropdown slides down and right back up. Any ideas what I'm doing wrong? Thanks very much in advance...</p>
jquery
[5]
5,382,924
5,382,925
Could not find class when application is loaded into emulator
<p>I have an activity (DemoAppActivity) from which I am trying to launch a different activity (MainActivity) when a button is pressed. However I am getting two errors:</p> <p>1) when the app is loaded into the emulator, I see the following in the Android logs:</p> <pre><code>10-12 18:48:19.579: ERROR/dalvikvm(620): Could not find class 'com.example.android.hcgallery.MainActivity', referenced from method com.consultknapp.demoapp.DemoAppActivity$1.onClick </code></pre> <p>2) when i actually push the button that calls startActivity:</p> <pre><code>10-12 18:54:58.019: ERROR/AndroidRuntime(620): java.lang.NoClassDefFoundError: com.example.android.hcgallery.MainActivity </code></pre> <p>Here is how I am starting the activity (note: I import the class with an import statment, import com.example.android.hcgallery.MainActivity) </p> <pre><code>startActivity(new Intent(DemoAppActivity.this, MainActivity.class)); </code></pre> <p>I have the MainActivity project folder in my build path in eclipse, and I even see it load the MainActivity.apk when I compile/run my DemoAppActivity. However, it bombs when I try to run it on the emulator. </p> <p>What am I missing here? Do I need to jar up my MainActivity and include it in the DemoAppActivity somehow?</p>
android
[4]
1,988,540
1,988,541
setTimeout does not work - what is wrong ?
<p>i need to work with setTimeout function but that function does not work. First of all,</p> <pre><code> Player.prototype.playByUrl = function (url) { this.object.data = url; return this.play(); } </code></pre> <p>Above code is my function and i call it</p> <pre><code>window.onload = function () { player = new Player('playerObject'); setTimeout(player.playByUrl($mp4Link),3000); } </code></pre> <p>However, in above code, setTimeout does not work why ? </p>
javascript
[3]
2,501,946
2,501,947
What is the proper way to handle a ProgressDialog using Activity lifecycle methods?
<p>I have been bitten by: "java.lang.IllegalArgumentException: View not attached to window manager", when using a ProgressDialog in an Activity.</p> <p><strong>What is the proper way to handle a ProgressDialog using Activity lifecycle methods ?</strong> </p> <p>Working code example much appreciated...</p>
android
[4]
3,188,656
3,188,657
simple copy paste function in javascript
<p>Hi All how i can make simple copy and paste in javascript</p>
javascript
[3]
891,466
891,467
How to toggle between images
<p>I currently have a title and an image to the left <img src="http://i.stack.imgur.com/z85fk.jpg" alt="Before text is clicked"></p> <p>When a user clicks on this link a description appears </p> <p><img src="http://i.stack.imgur.com/TkT0C.jpg" alt="Text appears"></p> <p>I do this using:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { $(".hidden").hide(); $("p.show").click(function () { $(this).next(".hidden").toggle() }); $("p.show").hover().css('cursor', 'pointer'); }); &lt;/script&gt; </code></pre> <p>However I would like the image to change when the text appears. I tried using replaceWith but that didn't work. I am still new to jQuery so any advice is great. I don't need an answer but just a pointer on what is best.</p> <pre><code>&lt;p style="color:Black;float:left;padding-top:0px;" class="show"&gt; &lt;img alt="+" src="resources/images/plussign.jpg" style="float:left; margin-right:10px;"/&gt;What is EFM?&lt;br /&gt;&lt;/p&gt; &lt;div class="hidden"&gt; &lt;p style="margin-left:20px;"&gt; &lt;br /&gt;EFM, also known as Ethernet in the First Mile, is an Ethernet leased line service that runs over copper rather than the fibre optic cable used for other Ethernet services. The copper is provided in bonded pairs, making the connection extremely robust. If one copper pair fails, the others remain live, meaning you don’t suffer any downtime and can continue working with reduced bandwidth until normal service is restored.&lt;/p&gt; &lt;/div&gt; </code></pre>
jquery
[5]
2,761,174
2,761,175
Crash Log in Android : Any Idea
<p>I am new in android and working on a maintenance project<br> Application crashes if no internet connection while creating Soap Request</p> <p>Following is screenshot of LogCat, Can any body tell me Whats the reason for crashing.</p> <p><img src="http://i.stack.imgur.com/gRpRo.png" alt="enter image description here"> <img src="http://i.stack.imgur.com/NbeVe.png" alt="enter image description here"></p> <p><strong>Amit Battan</strong></p>
android
[4]
2,361,594
2,361,595
why python not supporting : while( s = f.readline())?
<p>more example below:</p> <pre><code> if (a = xyz() ) &gt; abc: </code></pre> <p>Really want to know why, is it kinds of bad smell ? </p> <p>Note: I know the grammar, but I am asking why Python don't support such grammar as many other language( e.g., c , java...) do supporting</p>
python
[7]
3,892,243
3,892,244
Can we alias a class name the way we do in namespaces?
<p>Can we alias a class name the way we do in namespaces?</p> <p>For example:</p> <pre><code>namespace longname{ } namespace ln = longname;// namespace aliasing class LONGNAME {}; class LN = LONGNAME; // how to do class name aliasing, if allowed? </code></pre>
c++
[6]
3,434,613
3,434,614
Refactor this jQuery (it seems bloated)
<p>I'm performing this very simple task using jQuery, this code works, but feels bloated and i'm sure theres a quicker way to do it:</p> <p>menu and close are hidden by default.</p> <pre><code>$(document).ready(function(){ var menu = $('#menu'); var open = $('.btnOpen'); var close = $('.btnClose'); open.click(function(){ menu.show(); open.hide(); close.show(); }); close.click(function(){ menu.hide(); close.hide(); open.show(); }); </code></pre> <p>});</p>
jquery
[5]
4,074,995
4,074,996
Selective deletion of files in folder according to the name
<p>I would like to know (using c#) how I can delete files in a certain directory whose name contains *mhz.prj.</p> <p>In fact there are several files in this folder and I want to delete only Amhz.prj Bmhz.prj for example. My problem is that the end of the filename is important.</p>
c#
[0]
5,380,886
5,380,887
Special Counters
<p>I`m trying to create a special counter in C# ... I mean the counter will be consisting of characters not numbers.</p> <p>I have a <code>char[]</code> of size 3:</p> <pre><code>char[] str = new char[strSize]; int i = 0; int tmpSize = strSize - 1; int curr; while(!isEqual(str,finalStr,strSize)) { str[strSize] = element[i % element.Length]; i++; if (str[strSize] == element[element.Length - 1]) { int j = strSize - 1; if (j &gt; 0) { j--; int tmpCntr = j+1; curr = getCurrentID(str[tmpCntr]); str[tmpCntr] = element[(curr + 1) % element.Length]; while (str[tmpCntr] == element[0] &amp;&amp; (i % element.Length &gt; 0) &amp;&amp; tmpCntr &lt; 0) { tmpCntr--; curr = getCurrentID(str[tmpCntr]); str[tmpCntr] = element[(curr + 1) % element.Length]; } } } } </code></pre> <p>if the <code>strSize &lt; 3</code> the application works fine and gives accurate output. If the <code>strSize &gt;= 3</code>, the application goes in infinite loop!</p> <p>Need help.</p> <p>if this is hard this way, I would need a way to create a numerical counter and I`ll work on it to suite my application.</p>
c#
[0]
2,942,415
2,942,416
python: how to get a subset of dict
<p>I have a dict that has many elements, I want to write a function that can return the elements in the given index range(treat dict as array):</p> <pre><code>get_range(dict, begin, end): return {a new dict for all the indexes between begin and end} </code></pre> <p>How that can be done?</p> <p>EDIT: I am not asking using key filter... eg)</p> <pre><code>{"a":"b", "c":"d", "e":"f"} get_range(dict, 0, 1) returns {"a":"b", "c":"d"} (the first 2 elements) </code></pre> <p>I don't care the sorting... Actually I am implementing the server side paging...</p>
python
[7]
2,034,334
2,034,335
validate that Date of Birth should not be greater than the current date
<p>validate that Date of Birth should not be greater than the current date. using datetimepicker in asp.net 2.0 and c#..</p>
asp.net
[9]
5,079,913
5,079,914
Unable to use a struct that uses a template as a parameter in a method
<p>I have the following code:</p> <pre><code>template &lt;typename A, typename B&gt; struct TheStruct { A a; B b; }; class TheClass { public: void do_something(TheStruct&lt;A,B&gt; blah); } </code></pre> <p>I get compiler errors on the <code>do_somethng</code> method that resembles <code>error: 'A' was not declared in this scope</code>... </p> <p>What is the correct syntax for defining this kind of type in a method parameter?</p> <p>Thanks!</p>
c++
[6]
4,000,691
4,000,692
download latest version of jquery-1.3.2.min.js
<p>I want to download jquery-1.3.2.min.js file. Please suggest site .</p>
jquery
[5]
5,845,503
5,845,504
How to create a CD that contains all the department intranet web applications?
<p>I am working as a web developer and my department in the company now asked me to think in a way that let us able to create a CD that contains all the intranet web applications that we developed in our department in order to distribute this CD to the other departments in the company to show them the applications that we developed and used.</p> <p>The problem now is the following:</p> <ol> <li>Each application has a separate database</li> <li>Each application is an intranet application that was developed in ASP.NET and it uses Windows Authentication</li> <li>The access to these application are restricted to the users from our department or the selected users from the other departments.</li> <li>My department wants to distribute this CD to the other departments in the company in such a way that the one who has this CD can see the application and he can try the functionality of this application</li> </ol> <p>How can I do that? Any ideas?</p>
asp.net
[9]
5,889,566
5,889,567
JQuery Modal true with dialog is not working
<p>I want to have only one window opened so i am uisng modal", true , but still when a popup window is opened , multiple operations are being done </p> <pre><code> $("#fileuploadfun").attr('title',"Upload"); $("#fileuploadfun").dialog( "option", "modal", true ); </code></pre>
jquery
[5]
1,750,596
1,750,597
How to convert Double.POSITIVE_INFINITY to BigDecimal?
<p>I tried <code>BigDecimal.valueOf(Double.POSITIVE_INFINITY)</code>, but kept getting <code>NumberFormatException</code></p> <p>Thanks</p>
java
[1]
788,743
788,744
Java - Cannot find Symbol for Contstructor
<pre><code>import java.lang.*; public class GrammerStack extends GrammerStructure implements StringStack { private String structName; private int cap; public GrammerStack(String structureName, int limit){ this.structName = structureName; this.cap = limit; System.out.println(structName+"["+cap+"]"); } public void GrammerStructure(String structureName){ this.structName = structureName; } //Empty overrides. public String[] asArray(){}; public String push(String item) throws FillException{}; public String pop() throws EmptyException{}; public boolean contains(String query){}; public void empty(){}; public double fillPercent(){}; public String getName(){ return structName; } public void main(String args[]){ GrammerStack("Stack1",3); } } </code></pre> <p>When I run: javac GrammerStack.java I get the following:</p> <pre><code>GrammerStack.java:15: cannot find symbol symbol : constructor GrammerStructure() location: class GrammerStructure public GrammerStack(String structureName, int limit){ ^ GrammerStack.java:41: cannot find symbol symbol : method GrammerStack(java.lang.String,int) location: class GrammerStack GrammerStack("Stack1",3); ^ 2 errors </code></pre> <p>I can't figure out what is going wrong here, my method is not mismatched to the name of the file, either. "Grammer" is correct in this case.</p> <p>Any help?</p>
java
[1]
2,321,073
2,321,074
how to get back in navigation view using timer
<p>hi i am using this code for getting previous view </p> <pre><code>NSTimer *theTimer = [NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(pictureTimerFired:) userInfo:nil repeats:NO]; - (void) pictureTimerFired:(NSTimer*)theTimer { NSLog(@"Timer fired, closing picture"); } </code></pre> <p>but what happened is it directly quit from application and displays icon how can i resolve this </p>
iphone
[8]
2,958,193
2,958,194
Request-URI Too Large showing on server
<p>I am passing the following data through url : </p> <pre><code>&lt;?php $url = "generate_pdf.php/?feed=" . urlencode(serialize($result)); echo '&lt;div id="left-sidebar"&gt;'; echo '&lt;a href="' . $url . '"&gt;&lt;div id="pdf"&gt;Download PDF&lt;/div&gt;&lt;/a&gt;'; echo '&lt;/div&gt;'; ?&gt; </code></pre> <p>Here the <code>$result</code> containing the rss feed data in form of array. I am using <code>urlencode(serialize($result)</code> for passing that data through url and its working perfectly on local machine but in server it showing the following error : </p> <pre><code>Request-URI Too Large The requested URL's length exceeds the capacity limit for this server. </code></pre> <p>Please tell me your views to deal with this problem.</p>
php
[2]
4,949,225
4,949,226
PHP foreach() define 2 things?
<p>I'm trying to define both ['name'] and ['tmp_name'], but i'm having no idea how to do so?</p> <p>Here is my code:</p> <pre><code> foreach ($_FILES['uploads']['name'] as $filename) { // Do stuff } </code></pre> <p>But inorder to complete and move the file, I need the <code>$_FILES['uploads']['tmp_name']</code> aswell. How do I define both? I tried looking it up, but found nothing.</p>
php
[2]
5,168,542
5,168,543
JavaScript with() function
<p>Is <code>with()</code> part of the native JavaScript library? Which browsers support it?</p>
javascript
[3]
3,191,709
3,191,710
Printing in the console objects of an array
<p>Hi I have been trying to learn Javascript using codeacademy.com and I have reached an exercise that doesn't seem to make any sense when why the exercise I have written.This is my code:</p> <pre><code> (function(){ var bob = { firstName: "Bob", lastName: "Jones", phoneNumber: "(650) 777 - 7777", email: "bob.jones@example.com" }; var mary = { firstName: "Mary", lastName: "Johnson", phoneNumber: "(650) 888 - 8888", email: "mary.johnson@example.com" }; var contacts = [bob, mary]; var printPerson = function(person){ console.log(person.firstName + " " + person.lastName); } var list = function(){ var i = contacts.length; for(var j= 0; j &lt; i ; j++){ printPerson(contacts[i]); } }; list(); })(); </code></pre> <p>The problem is in the list function when I try to call the printPerson() function I get that person is undefined but if I write instead of the list() function this:</p> <pre><code> printPerson(contacts[0]); printPerson(contacts[1]); </code></pre> <p>Everything works.What am I doing wrong in the list() function that it doesn't work?</p>
javascript
[3]
1,536,300
1,536,301
Copy & Paste with c#
<p>For example right now, when you click left mouse and choose paste (if enable) if it is file,or text string or picture etc you can understand somewhere in RAM its already handled or stored, how can i reach that area with C#. And how can i store something (text,picture,file) there.<br> I mean<br></p> <pre><code> private void button1_Click(object sender, EventArgs e) { string message = "copy_me"; DoIt(message); } private void DoIt(string msg_arg) { // msg_arg argument will be copied in a txt file } </code></pre> <p>Thanks!</p>
c#
[0]
2,004,909
2,004,910
jQuery delete confirmation box
<p>In my jQuery am displaying my results in a table formatted output, a part of my jQuery is</p> <pre><code>&lt;td class='close' onclick='deleteItem(#ITEMID,#ITEMNAME)'&gt;&lt;/td&gt; </code></pre> <p>here <code>"close"</code> is a CSS class and in this class I have cross mark image, if I click this cross mark the function(deleteItem) will be fired.</p> <p>here what I want to do is if I click this cross mark a <code>"delete confirmation box"</code> should pop up and if I click yes this onclick event should fire, else if I click No nothing should happen.</p> <p>How can I achieve this, can anyone help me....</p>
jquery
[5]
2,754,606
2,754,607
Object must return function
<p>I have some JS code here:</p> <pre><code>function Car(manufacturer, model, year) { this.manufacturer = manufacturer; this.model = model; this.year = year == undefined ? new Date().getFullYear() : year; this.getInfo = function(){ return this.manufacturer +' '+ this.model +' '+ this.year; }; } var bmw = new Car("BMW", "X5", 2010); </code></pre> <p>So I want some interesting output in the console:</p> <pre><code>console.log('Car: ' + bmw); // Car: BMW X5 2010 </code></pre> <p>How to do it without calling any methods?</p> <p><strong>THANKS!</strong></p> <pre><code>I need the 'getInfo' method, so I have simply changed my code: function Car(manufacturer, model, year) { this.manufacturer = manufacturer; this.model = model; this.year = year == undefined ? new Date().getFullYear() : year; this.toString = this.getInfo = function(){ return this.manufacturer +' '+ this.model +' '+ this.year; }; } </code></pre>
javascript
[3]
1,108,413
1,108,414
Could anyone tell me why the program call abort() in the try block?
<p>The program below compiles successfully, yet it fails to run and call the abort() function which throws a message alerting that "This application has requested the Runtime to terminate it in an unusual way. Please contace the application's support team for more information.", Why so?</p> <pre><code>#include&lt;cstring&gt; #include&lt;iostream&gt; using std::string; using std::endl; using std::cout; class ThrowException{ private: string msg; int b; public: ThrowException(string m="Unknown exception",int factor=0) throw(string); //A }; ThrowException::ThrowException(string m, int f) throw(string):msg(m),b(f){ //B if(b==1) throw "b=1 not allowed."; } int main(){ try{ ThrowException a("There's nothing wrong.", 1); }catch(string e){ cout&lt;&lt;"The address of e in catch block is "&lt;&lt;&amp;e&lt;&lt;endl; } } </code></pre> <p><img src="http://i.stack.imgur.com/kg6eR.png" alt="Error message"></p>
c++
[6]
5,586,164
5,586,165
group array of php objects by object property
<p>I have a php object (book) with 3 properties: <code>name, category, description</code> I then have a list of these <code>book</code> objects in an array. I want to create a new associative array for these objects grouped by <code>category</code>.</p> <p>Say I have 4 book objects in an array called <code>$books</code></p> <pre><code>name category description ================================== book1 cat1 this is book 1 book2 cat1 this is book 2 book3 cat2 this is book 3 book4 cat3 this is book 4 </code></pre> <p>how can I create an associative array called <code>$categories</code></p> <pre><code>$categories['cat1'] = array(book1, book2) $categories['cat2'] = array(book2) $categories['cat3'] = array(book3) </code></pre> <p>where book? is the book object and not the word</p>
php
[2]
4,319,708
4,319,709
JQuery click function is not working
<p>I've seen this question before but all the answers I saw do not apply to my particular problem. Most of the ones I've seen were caused by the click not being used in a document ready function. All of the stuff in setup_calenders and disable_items is happening but no alert pops up when the checkbox is clicked.</p> <pre><code>$(document).ready(setup) function setup() { $("id_Clearance").click(enable_clearance); $("id_Paperwork").click(enable_paperwork); $("id_AVSupport").click(enable_support); setup_calendars(); disable_items(); } function enable_paperwork() { alert("clicked"); } </code></pre>
jquery
[5]
2,900,428
2,900,429
How to place ImageButton at x, y location?
<p>I want to place ImageButton at x, y location of my view. The problem is that Android adds padding around image. Because I don't know exact size of padding, I cannot place image button at exact location. So, I want to remove padding. How can I remove padding around image programmatically? button.setPadding(0, 0, 0, 0) makes button width shorter and height longer than bitmap. button.getLayoutParams().width gives minus value. What I tried so far is like this. </p> <pre><code>protected class MyLayout extends RelativeLayout { Bitmap img; ImageButton button; public MyLayout(Context context) { button = new ImageButton(context); img = BitmapFactory.decodeResource(getResources(), R.drawable.img); button.setImageBitmap(img); params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); button.setLayoutParams(params); params.setMargins(x, y, 0, 0); button.setBackgroundDrawable(null); addView(button, params); } } </code></pre>
android
[4]
2,804,146
2,804,147
Dealing with rapid tapping on Buttons
<p>I have a Button with an OnClickListener. For illustrative purposes, consider a button that shows a modal dialog:</p> <pre><code>public class SomeActivity ... { protected void onCreate(Bundle state) { super.onCreate(state); findViewById(R.id.ok_button).setOnClickListener( new View.OnClickListener() { public void onClick(View v) { // This should block input new AlertDialog.Builder(SomeActivity.this) .setCancelable(true) .show(); } }); } </code></pre> <p>Under normal usage, the alert dialog appears and blocks further input. Users must dismiss the dialog before they can tap the button again.</p> <p>But sometimes the button's OnClickListener is called twice before the dialog appears. You can duplicate this fairly easily by tapping really fast on the button. I generally have to try several times before it happens, but sooner or later I'll trigger multiple onClick(...) calls before the dialog blocks input.</p> <p>I see this behavior in Android 2.1 on the Motorola Droid phone. We've received 4 crash reports in the Market, indicating this occasionally happens to people.</p> <p>Depending on what our OnClickListeners do, this causes all sorts of havoc. How can we guarantee that blocking dialogs actually block input after the first tap?</p>
android
[4]
2,951,549
2,951,550
Set Auto Complete Text View Text Alignment to be right aligned
<p>I am trying to set the Text alignment of an auto complete text view to be right aligned, I used the android:gravity="Right", on the emulator It is working find, but on the device it is always left aligned,</p> <p>Does any one have an idea? note: I am using Samsung Galaxy Tab as a test device,</p> <p>Thanks</p>
android
[4]
4,189,882
4,189,883
How to produce a short unique id in php?
<p>In order to produce a unique Id I suppose I must use the uniqid function in php.<br> But uniqid produces a 13 digits long HEXA number, by default. </p> <pre><code>4f66835b507db </code></pre> <p>I would like to reduce this number to 7 digits long NUMERIC number but I want to conserve the unicity. Is it possible ? </p> <pre><code>4974012 </code></pre> <p>This number will be used as User Id. The authentication will be done with thid Id and a password.</p> <p>Some people say uniqid is not unique ! Is it a bad choice ?</p>
php
[2]
3,275,886
3,275,887
deserializing a csv stream to a vector of structures
<p>I have a Visual Studio 2008 C++ project where I would like to be able to take a list of comma-separated values stored in a std::stringstream and put them in a vector like this:</p> <pre><code>struct Foo { std::string A; std::string B; std::string C; } typedef std::vector&lt; Foo &gt; FooList; std::stringstream csv; // contains comma separated values </code></pre> <p>Such that if the stream contained "My,Mother,Eats,\nDonuts,From,Menards", the resulting structure would be:</p> <pre><code>{ { "My", "Mother", "Eats" }, { "Donuts", "From", "Menards" } } </code></pre> <p>What's the best way to accomplish this? I was looking at using <code>boost.split</code> if there is a way to specify how the string is copied to the vector.</p> <pre><code>FooList list; boost::split( list, csv.str(), boost::is_any_of( "," ) ); </code></pre> <p>I have control over the stream data, so if formatting it slightly differently makes things easier, I can do that.</p>
c++
[6]
4,867,733
4,867,734
How to implement a trackbar android
<p>Is there anyway to implement something like a trackbar on android, so I can explicity specify the values and select it?</p> <p><img src="http://i.stack.imgur.com/na06M.png" alt="enter image description here"></p>
android
[4]
4,403,848
4,403,849
Having a gesturebuilder in my own application
<p>I want to have a gesturebuilder in my own application.I want to store the gestures entered by the user and use it later.How do i do this?How do i call the gesturebuilder from my application.Or is there an easier way to do this.</p>
android
[4]
3,081,306
3,081,307
Calling a base class constructor from derived class in Java
<p>I have a class as follows:</p> <pre><code>public class Polygon extends Shape{ private int noSides; private int lenghts[]; public Polygon(int id,Point center,int noSides,int lengths[]) { super(id, center); this.noSides = noSides; this.lenghts = lengths; } } </code></pre> <p>Now a regular polygon is a polygon whose all sides are equal. What should be the constructor of my regular polygon?</p> <pre><code>public Regularpolygon extends Polygon{ //constructor ??? } </code></pre>
java
[1]
3,459,326
3,459,327
jQuery Plug-ins
<p>I am looking for a jQuery plug-in which will show / hide a div in a very smooth &amp; slide manners when I click on a link.</p> <p>Do anyone have any idea or URL? Thanks.</p>
jquery
[5]
535,676
535,677
Gridview Data Update by ComboBox
<p>Hi Friends i Want code for</p> <p>I have a gridvie Fill with dataset. But i want If i edit the data in gridview it reflect in corresponding combobox and update in db.</p> <p>Pl anyone help me</p>
c#
[0]
4,726,116
4,726,117
Use of Web Services
<p>Is it possible to store a applications content in a webpage and retrieve the same from there using another application in android.</p>
android
[4]
1,785,223
1,785,224
How to send encoded Base64 image string to server using JSON object
<p>I am new in android . i have send image to server using Json format as a string.</p> <p>so i have Encoded image string i.e base64 string.</p> <pre><code> Json j = new JSonObject(); String Image_string = Base64.ToEncodedString(bytearray, Base64.Default); j.put("image_file_content",Image_string); </code></pre> <p>But i am getting this error. Please help me..wts wrong</p> <p></p> <p>400 Bad Request</p> <p></p> <h1>Bad Request</h1> <p>Your browser sent a request that this server could not understand.<br /> </p> <p>Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.</p> <p></p>
android
[4]
5,898,777
5,898,778
Stack memory allocation
<p>It is being said that local variable will be allocated and deallocated automatically when function ends in C/C++.</p> <p>According to my understanding, when having been deallocated, the value held by local variable also be destroyed!!! Please correct me if i'm wrong</p> <p>Consider following code:</p> <pre><code>void doSomething(int** num) { int a = 10; *num = &amp;a; } // end of function and a will be destroyed void main() { int* number; doSomething(&amp;number); cout &lt;&lt; *number &lt;&lt; endl; // print 10 ??? } </code></pre> <p>Could anybody clarify for me? </p>
c++
[6]
3,211,438
3,211,439
How to access a base class value from derived class c#
<p>Can any one let me know "How to access base class variables in derived class"?</p> <p>Example:</p> <p>Class 1.cs Code</p> <pre><code>public class baseClass { public int intF = 0, intS = 0; public int addNo() { int intReturn = 0; intReturn = intF + intS; return intReturn; } } Public class child : baseClass { public int add() { int intReturn = 0; intReturn = base.intF * base.intS; return intReturn; } } </code></pre> <p>Class2.cs Code</p> <pre><code>class Program { static void Main(string[] args) { baseClass obj = new baseClass(); obj.intF = 5; obj.intS = 4; child obj1 = new child(); Console.WriteLine(Convert.ToString(obj.addNo())); Console.WriteLine(Convert.ToString(obj1.add())); Console.ReadLine(); } } </code></pre> <p>The problem is in child class which gets inherited from base class..</p> <p>The value of intF and intS is always showing as 0 instead of 5&amp;4.</p> <p>Can any one let me know where I am going wrong?</p> <p>Regards,</p> <p>G.V.N.Sandeep</p>
c#
[0]
4,753,284
4,753,285
How do you pass arguments from one function to another?
<p>Sorry for the newbie question guys, but I'm relatively new to python. I want to write a function that passes keyword and value arguments into another function:</p> <p>e.g.</p> <pre><code>def function_that_passes_arguments(arguments): some_other_function(arguments) </code></pre> <p>so when I call the first function they are passed into the second... e.g.</p> <pre><code>function_that_passes_arguments(arg1=1, arg2=2) </code></pre> <p>is effectively</p> <pre><code>some_other_function(arg1=1, arg2=2) </code></pre> <p>The argument names will change so it is important that I pass both keyword and value from one function to another.</p>
python
[7]
4,523,659
4,523,660
passing parameter in python script using "PyRun_SimpleString(pythonScript.py)"
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4028681/how-do-i-run-a-python-file-that-is-read-into-a-stdstring-using-pyrun">How do I run a python file that is read into a std::string using PyRun</a> </p> </blockquote> <p>i am very new to python. m invoking python script from C++ code and i want to pass one string in python script(pythonScript.py) and use it inside pythonScript.py. So please let me know asap how can i achieve it.</p> <p>Thanks in advance.</p>
python
[7]
4,260,839
4,260,840
I need to search through a list of classes to find the first that matches what I need
<p>I have the following class:</p> <pre><code>public class TestClass { public IList&lt;TestClassDetail&gt; TestClassDetails { get { return _testClassDetails; } } private List&lt;TestClassDetail&gt; _testClassDetails = new List&lt;TestClassDetail&gt;(); public TestClass() { this._testClassDetails = new List&lt;TestClassDetail&gt;(); } } public class TestClassDetail { public TestClassDetail() { this.Q = String.Empty; } public string Q { get; set; } } var TestClass a = &lt;some code here to create the instace of a&gt; </code></pre> <p>Now I need to be able to look at the object a, which in this case has 45 instance of TestClassDetail. I need to check each instance to see the first and only one which has a value of Q that is equal to "xx". If it's the 4th instance then I need to return 4. </p> <p>Is this something that I could do with LINQ?</p>
c#
[0]
2,606,527
2,606,528
How to do android payments using facebook credits
<p>I just want to do payment in android using facebook gateway.Is it possible in android native app.?if it possible means, how could i do tht? I've searched over tht "http://developers.facebook.com/docs/credits/".But i donno we can implement it on android or not?</p> <p>Thanks</p>
android
[4]
1,195,622
1,195,623
Problem Sending Mail through PHP
<p>I have a contact form that is build in arabic language. When it is ever used, the received mail looks like this ...</p> <pre><code>إسلام الإسم مهندس برمجيات المهنة 010 التليÙون email البريد الإلكترونى تجربة Ø§Ù„Ø¥Ø³ØªÙØ³Ø§Ø± </code></pre> <p>I need to solve this issue as soon as possible as this page is a part of a company website that I`m updating.</p> <p>Thanks in advance.</p> <p>PS: I will try the methods on my localhost before using it on the website.</p>
php
[2]
5,264,018
5,264,019
Problem in UITableView and UIScrollView
<p>My table has more than 10 rows with 50 row height....so i can't select my last row....so i have set UIScrollView and add this table into UIScrollView.</p> <p>Table display perfectly but which rows are displayed in UIScrollView, these are not selectable.</p> <p>How can i get this row selecablt in UIScrollView. If anyone body know then pls tell me wha to do?</p> <p>Thanks, Haresh. </p>
iphone
[8]
3,578,100
3,578,101
Is there any way to test iphone application on real device without paying $99 to Apple?
<p>Is there any way to test iphone application on real device without paying $99 to Apple because i dnt want to enrolled to apple iphone developer program i m newbie just playing around with iphone development. </p> <p>Thanks for your answers.</p>
iphone
[8]
5,856,522
5,856,523
Enable/disable use data packet from android code
<p>I want to disable or enable use data packet in android device from my application from which I have used on code as below :</p> <pre><code>try { Method dataConnSwitchmethod; Class telephonyManagerClass; Object ITelephonyStub; Class ITelephonyClass; TelephonyManager telephonyManager = (TelephonyManager) NetworkMonitorDemoAppActivity.this.getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager.getDataState() == TelephonyManager.DATA_CONNECTED) { isEnabled = true; } else { isEnabled = false; } telephonyManagerClass = Class.forName(telephonyManager.getClass().getName()); Method getITelephonyMethod = telephonyManagerClass.getDeclaredMethod("getITelephony"); getITelephonyMethod.setAccessible(true); ITelephonyStub = getITelephonyMethod.invoke(telephonyManager); ITelephonyClass = Class .forName(ITelephonyStub.getClass().getName()); if (isEnabled) { dataConnSwitchmethod = ITelephonyClass.getDeclaredMethod("disableDataConnectivity"); } else { dataConnSwitchmethod = ITelephonyClass.getDeclaredMethod("enableDataConnectivity"); } dataConnSwitchmethod.setAccessible(true); dataConnSwitchmethod.invoke(ITelephonyStub); } catch (Exception e) { System.out.println("error is occured in uses data packet enable &amp; disable :-"+e.getMessage()); } </code></pre> <p>But this code is not working fine. Can any my friend help me for this issue ?</p>
android
[4]
5,241,205
5,241,206
using global inside of function to get variable from included file. PHP
<p>Really simple I just think it's me. </p> <p>this is file 1.php</p> <pre><code>if(ctype_digit($_GET['id'])) { $item_id = "Hello"; } else { //Something } </code></pre> <p>this is file 2.php</p> <pre><code>function item_show(){ $item_query = "SELECT title FROM tbl_items WHERE id='" . mysql_real_escape_string($item_id) . "' "; } </code></pre> <p>Now my question is how do I get the value of <code>$item_id</code> from 1.php inside the function in 2.php ? </p> <p>To add file 1.php and file 2.php are both included in index.php</p>
php
[2]
2,409,507
2,409,508
Calendar Class in Javascript - unable to keep the reference.
<p>I wrote a datepicker in Javascript, but it is not working properly,</p> <p>as I lose the reference to the Calendar object.</p> <p>here is the example</p> <p><a href="http://asexpress.de/calendar/" rel="nofollow">http://asexpress.de/calendar/</a></p> <p>by clicking within the input field the calendar will be displayed.</p> <p>What should I do that the reference to the Calendar object remains in contact.</p>
javascript
[3]
2,764,954
2,764,955
USing jQuery modal popup
<p>I work on Asp.Net VS08 C#.Click on Button i want to show a model popup.containing the bellow controls.</p> <pre><code>&lt;div&gt; &lt;asp:Button ID="Button1" runat="server" Text="Close" /&gt; &lt;asp:Button ID="Button2" runat="server" Text="Save" /&gt; &lt;asp:Button ID="Button3" runat="server" Text="Search" /&gt; &lt;/div&gt; </code></pre> <p>Popup close only click on <strong>close</strong> button .Click on <strong>Save</strong> button Save value but not close popup,click on search button search value but popup not close.</p>
jquery
[5]
2,849,900
2,849,901
Can you help me understand this example of fibonacci using C# closures?
<p>Attempting to learn functional C#, I ported Dustin Campbell's <a href="http://diditwith.net/PermaLink,guid,f3be3915-873b-4082-a087-871f5dd52c82.aspx" rel="nofollow">fibonacci example</a> to C#3. My solution works but I have trouble understanding the last line of Nth_Fib. Isn't it weird that the agrument to formula doesn't matter? n gets instantly bound in the expression "fn => Nth_Fib(n - 1) + Nth_Fib(n - 2)" but I can't change the return type of build to Func&lt;int&gt;. This means I have to pass a redundant argument later?</p> <p>note: the test passes</p> <pre><code>[TestFixture] public class TestFibClosure{ [Test] public void test_fib(){ Assert.AreEqual(8, new FibClosure().Nth_Fib(5)); Assert.AreEqual(1597, new FibClosure().Nth_Fib(16)); } } public class FibClosure{ private Func&lt;int, int&gt;[] formulaCache; public int Nth_Fib(int n){ if (n &lt;= 2) return n; if(formulaCache == null) formulaCache = new Func&lt;int, int&gt;[(n + 1)]; Func&lt;int, int&gt; formula = build(n); //doesn't matter, n is already bound !! ?? return formula(334567);//same as formula(n) } private Func&lt;int, int&gt; build(int n){ if (formulaCache[n] == null) formulaCache[n] = (fn =&gt; Nth_Fib(n - 1) + Nth_Fib(n - 2)); return formulaCache[n]; } } </code></pre>
c#
[0]
2,775,811
2,775,812
Convert DB string into checkbox checking with PHP
<p>I have following SQL query: </p> <pre><code> $readNews_SQLselect = "SELECT "; $readNews_SQLselect .= "live, content, user, created, created_updated, user_updated "; // rows names $readNews_SQLselect .= "FROM "; $readNews_SQLselect .= "news "; // table name $readNews_SQLselect_Query = mysql_query($readNews_SQLselect); </code></pre> <p>And while loop to display the data from DB:</p> <pre><code> while ($row = mysql_fetch_array($readNews_SQLselect_Query, MYSQL_ASSOC)) { $LIVE = $row['live']; $CONTENT = $row['content']; $USER = $row['user']; $CREATED = $row['created']; $USER_UPDATED = $row['user_updated']; $CREATED_UPDATED = $row['created_updated']; echo '&lt;input type="checkbox" value=" '.$LIVE.'" /&gt;'; echo '&lt;input value=" '.$CONTENT.'" /&gt;'; echo '&lt;p&gt;'.$USER.'&lt;p/&gt;'; echo '&lt;p&gt;'.$CREATED.'&lt;p/&gt;'; echo '&lt;p&gt;'.$USER_UPDATED.'&lt;p/&gt;'; echo '&lt;p&gt;'.$CREATED_UPDATED.'&lt;p/&gt;'; } mysql_free_result($readNews_SQLselect_Query); </code></pre> <p><strong>As my <code>echo '&lt;input type="checkbox" value=" '.$LIVE.'" /&gt;';</code> will be either '0' or '1' - how can I convert this string into checkbox checking / unchecking with PHP?</strong></p> <p>Any suggestion much appreciated. </p>
php
[2]
720,613
720,614
How to do NFC(Near Field Communication) in android
<p>I just want to scan details from my bussiness card through NFC into my native app(like address,name,company name) programmatically. I dont have much idea on this.What are the necessary steps i need to set up?How could i begin to do this app in android?</p> <p>And one more,QR scanner is something different from NFC?</p> <p>Thanks.</p>
android
[4]
1,588,599
1,588,600
Regular Expressions in Python-Scraping Data from website
<p>I am new to Python and I trying to pull in xml files from a website and load them into a database. I have been using the Beautiful Soup module in Python but I cannot pull in the specific xml file that I want. In the website source code it looks as follows:</p> <pre><code>&lt;a href="ReportName I want 20130101.XML"&gt;ReportName.XML&lt;/a&gt; &lt;a href="ReportName I want 20120101.XML"&gt;ReportName.XML&lt;/a&gt; &lt;&lt;a href="ReportName I dont want 123.XML"&gt;ReportName.XML&lt;/a&gt; </code></pre> <p>The following shows the code I have in Python. This brings back everything with the 'href' tag whereas I want to filter the files on the 'Report I want name dddddddd'. I have tried using regular expressions such as 'href=\s\w+' for example but to no avail as it returns NONE. Any help is appreciated</p> <pre><code>from bs4 import BeautifulSoup import urllib import re webpage=("http://www.example.com") response=urllib.urlopen(webpage).read() soup=BeautifulSoup(response) for link in soup.find_all('a'): print(link.get('href') </code></pre> <p>When I use Python it findall('href') it pulls back the entire string but I want to filter just the xml aspect. I have tried variations of the code such as findall('href\MarketReports') and findall('href\w+') put this returns "None" when I run the code.</p> <p>Any help is appreciated</p>
python
[7]
1,973,384
1,973,385
Event anonymous function parameters not working correctly
<pre><code>PictureBox[,] picBoard = new PictureBox[3, 3]; for(int i = 0; i &lt; 3; i++) for (int j = 0; j &lt; 3; j++) { picBoard[i, j] = new PictureBox(); picBoard[i, j].Click += new EventHandler( (sender, e) =&gt; Debug.WriteLine(i.ToString() + " " + j.ToString())); } </code></pre> <p>I am trying to make picBoard[i, j] print the position it has in the 2D array when clicked. The problem is that each PictureBox prints "3 3" when clicked. This doesn't make any sense to me, since i and j are never equal to 3. I tried replacing i with 500 in Debug.Writeline(), and it performs as expected ( always prints "500 3" ).</p>
c#
[0]
1,514,015
1,514,016
How can I break the string on Java?
<p>I need to write strings into <code>ByteArrayOutputStream</code>, but I need to write strings with breaking. I have tried to do it as example:</p> <pre><code>out.write("123".getBytes()); out.write("\n456".getBytes()); </code></pre> <p>But '\n' doesn't work. Please, tell me, how can I fix it? Or suggest me alternative OutputStream for storing strings (this OS must allow to use breaking of lines) without making files. Thank you. </p>
java
[1]
1,840,268
1,840,269
How do I associate icons to zip file type with an iPhone/iPad application?
<p>Here is my code in plist file. It run correctly but the icon was not displayed.</p> <pre><code>&lt;key&gt;CFBundleDocumentTypes&lt;/key&gt; &lt;array&gt; &lt;dict&gt; &lt;key&gt;CFBundleTypeIconFiles&lt;/key&gt; &lt;array&gt; &lt;string&gt;iPad-320.png&lt;/string&gt; &lt;string&gt;iPad-64.png&lt;/string&gt; &lt;/array&gt; &lt;key&gt;CFBundleTypeName&lt;/key&gt; &lt;string&gt;Zip Archive&lt;/string&gt; &lt;key&gt;CFBundleTypeRole&lt;/key&gt; &lt;string&gt;Editor&lt;/string&gt; &lt;key&gt;LSHandlerRank&lt;/key&gt; &lt;string&gt;Owner&lt;/string&gt; &lt;key&gt;LSItemContentTypes&lt;/key&gt; &lt;array&gt; &lt;string&gt;com.pkware.zip-archive&lt;/string&gt; &lt;/array&gt; &lt;/dict&gt; &lt;/array&gt; </code></pre>
iphone
[8]
1,197,405
1,197,406
Zebra striping after jQuery remove()
<p>I use jQuery to zebra-stripe my table because it works for ie8.</p> <p><code>$('table.data tr:nth-child(odd)').css('background-color', '#ececec');</code></p> <p>Problem is, I have a button that allows you to remove a row.</p> <p><code>$(this).parents('tr').remove();</code></p> <p>Which throws off the zebra striping. So I've tried:</p> <pre><code>$(this).parents('tr').remove(); $('table.data tr:nth-child(odd)').css('background-color', '#ececec'); $('table.data tr:nth-child(even)').css('background-color', '#ffffff'); </code></pre> <p>And</p> <pre><code>$(this).parents('tr').remove(); $('table.data tr').css('background-color', '#ffffff'); $('table.data tr:nth-child(odd)').css('background-color', '#ececec'); </code></pre> <p>Neither of which work. <code>.remove()</code> doesn't have a callback function or I'd put the zebra striping in it. Any ideas?</p> <p>Edit - the code above works, but there was a css conflict. (See answer below). The conflict however doesn't set the background color. So, I would still like to know why the rule causes a conflict.</p>
jquery
[5]
2,514,091
2,514,092
jQuery attr method failing to add attribute
<p>In certain conditions I want to open links in the same window, while in others I want to open them in a new window. I have the following jQuery code:</p> <pre><code>if (internal) { jQuery(".main a").removeAttr('target'); } else { jQuery(".main a").attr('target', '_blank'); } </code></pre> <p>I have two <code>&lt;a&gt;</code>s contained in the "main" div. One is directly under the div while the other is buried under a couple of sub-divs. When it runs, it only adds the blank target to the first <code>&lt;a&gt;</code> tag. However, when I set a breakpoint through Firebug and step through it, everything works fine. Is there a reason it wouldn't work at full speed? What's the workaround?</p>
jquery
[5]
3,169,527
3,169,528
Is it possible to set text in a TextView with format
<p>In my layout.xml file, is it possible to set text with style? e.g. <b>this is bold</b> This is default</p> <p>Can I do that?</p>
android
[4]
4,994,360
4,994,361
Check if value exists in dataTable?
<p>I have DataTable with two columns Author, Bookname.</p> <p>I want to check if given string value Author already exists in DataTable. Is there some built in method to check it, like for Arrays array.contains ? </p>
c#
[0]
402,853
402,854
A HREF Modify the value causes the nested element inside A tag to be deleted
<p>The following A HREF element modified through the jquery deletes the nested IMG element .</p> <pre><code>&lt;table id="newHead" width="90%" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC" style="display: none;border: 1px #000066 groove;"&gt; &lt;tr height="25px"&gt; &lt;td style="text-align: center;padding-left: 10px;"&gt;&lt;strong style="white-space: nowrap; font-size: 12px; "&gt; &lt;font color="#000066"&gt; Report&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt; &lt;td&gt; &lt;a id="url" href="mmRep.do?action=getXLSummReport&amp;reportId="&gt;&lt;img align="right" hspace="850px" src="images/graph_bar/graph_Excel.jpg" width="25" height="25" border="0"&gt; &lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>This jquery removes the nested IMG element( )</p> <pre><code>var newurl = $("a#url").attr("href") + reportId; $("a#url").attr("href",newurl); </code></pre> <p>After i modify the href attr value, the html becomes likes this, the img element vanishes</p> <pre><code>&lt;td&gt; &lt;a id="url" href="mmRep.do?action=getXLSummReport&amp;reportId=75"&gt; &lt;/a&gt; &lt;/td&gt; </code></pre>
jquery
[5]
5,006,617
5,006,618
Login form on homepage for back-end login
<p>I am trying to add a login form on my homepage so that clients can use that to log in to my backend website in PHP where they can check the progress of their project. The way it is set up now is that the client goes to client.mywebsite.com and i would like them to be able to login from mywebsite.com instead. I was just wondering if this was possible. And thanks in advance. </p>
php
[2]
1,224,194
1,224,195
Quick jQuery fadeTo/fadeIn syntax
<p>I've got this line, but I've tried adding the fade in, or fadeto part, it's not having any effect, so I presume it's not written correctly...</p> <pre><code>$(".bold_link").replaceWith('&lt;span class="bold_link"&gt;No Virus Found! &lt;img src="/images/virus-tick.png" alt=""/&gt;&lt;/span&gt;').fadeTo('slow', 1); </code></pre> <p>The entire code, if it's needed is:</p> <pre><code>$(function() { $('.bold_link').click(function(e){ $("#vc_icon").attr('src',"/images/virus-checking.gif"); e.preventDefault(); var shortname = "&lt;?php echo $shortname; ?&gt;"; $.get("/virus-check.php?ajax", {sn: shortname}, function(data){ if(data == '"Safe"'){ $(".bold_link").replaceWith('&lt;span class="bold_link"&gt;No Virus Found! &lt;img src="/images/virus-tick.png" alt=""/&gt;&lt;/span&gt;').fadeTo('slow', 1); } else{ $(".bold_link").replaceWith('&lt;span class="bold_link"&gt;&lt;img src="/images/virus-cross.png" alt=""/&gt; Infection Detected!&lt;br /&gt;File no longer available for download.&lt;br /&gt;Administrators have been notified.&lt;/span&gt;'); } }); }); </code></pre> <p>});</p> <p>Which when a link is clicked, jquery send an ajax request to the server, which scans a file, and returns a result, "Safe" if so, and else if not. The jQuery responds accordingly. I just want it to look a little fancier with a fade in to the result...</p> <p>Any help would be great.</p> <p>Thanks.</p>
jquery
[5]
5,164,186
5,164,187
Creating own LiveWallpaperPreview?
<p>I would like to create my own LiveWallpaperPreview, i.e. to show the user a fullscreen preview of what the selected Live Wallpaper looks like (without the "Set Wallpaper" and "Settings" button that the stock-OS preview has).</p> <p>Rebuilding the LivePicker-Class from 2.1 (<a href="http://android.git.kernel.org/?p=platform/packages/wallpapers/LivePicker.git;a=tree;f=src/com/android/wallpaper/livepicker;h=1557e0ae77aa8b0f8191472a204b5a7b4add31a4;hb=master" rel="nofollow">android.git.kernel.org</a>) works great, so I am able to let the user select a wallpaper to be previewed, but the actual LiveWallpaperPreview-Class tries to import the following private Interfaces/Classes:</p> <p><code>import android.service.wallpaper.IWallpaperConnection;<br> import android.service.wallpaper.IWallpaperService;<br> import android.service.wallpaper.IWallpaperEngine;<br> import android.service.wallpaper.WallpaperSettingsActivity;</code> </p> <p>Is there any way to display a LiveWallpaper in my app without resorting to using the private APIs (which I obviously don't want to do)?</p> <p>Thanks!</p> <p>Nick</p>
android
[4]
2,093,704
2,093,705
Select Closest span
<p>Here is my HTML code </p> <pre><code> &lt;span class="xxt" style=""&gt;Hide Me&lt;/span&gt; &lt;div&gt;&lt;br/&gt;&lt;/div&gt; &lt;div&gt;&lt;/div&gt; &lt;span style=""&gt; &lt;table&gt; &lt;tr&gt; &lt;td style=""&gt; &lt;div&gt;&lt;/div&gt; &lt;input type="radio" class="a"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/span&gt; &lt;span class="xxt" style=""&gt;Hide Me&lt;/span&gt; &lt;div&gt;&lt;br/&gt;&lt;/div&gt; &lt;div&gt;&lt;/div&gt; &lt;span style=""&gt; &lt;table&gt; &lt;tr&gt; &lt;td style=""&gt; &lt;div&gt;&lt;/div&gt; &lt;input type="radio" class="a"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/span&gt; </code></pre> <p>I am trying to access the closest span element with class "xxt" which is nearer to the parent span of the changed radio button.<br> Here is my code </p> <pre><code> $('.a').live('change',function() { $(this).parents('span').closest('.xxt').addClass('DestQID'); $('.DestQID').hide(); }); </code></pre> <p>Here is <a href="http://jsfiddle.net/YJVbb/1/" rel="nofollow">my test jsfiddle</a> </p>
jquery
[5]
1,826,917
1,826,918
Javascript RegExp Curly Brace and test Issue
<p>I want regExp to test for two 'Hello'-s and return true but it only returns false even though I cannot find anything wrong with my code. How do I fix this? Please also suggest what is wrong with the code.</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;script type="text/javascript"&gt; var str ="Hello Hello"; var patt = /(hello){2}/gi; var result =patt.test(str); document.write("Returned value: " + result); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
javascript
[3]
3,447,329
3,447,330
jquery popup problem
<p>i am a nobe to jquery..what i am trying to do is when i click on the register button on my index i want a popup to include my register.php on the upper-right corner i have been trying the whole day but cant firgure it out i tried to use include "register.php" in ![enter image description here][1]</p>
jquery
[5]
3,889,624
3,889,625
Removing blocks of text with python
<p>I'm trying to remove large blocks of text from a file using python. Each block of text begins with</p> <p>/translation="SOMETEXT"</p> <p>Ending with the second quote.</p> <p>Can anyone give me some advice on how to accomplish this?</p> <p>Thank you</p>
python
[7]
3,257,696
3,257,697
can we specfity directory path with the property file while using ResourceBundle class in java
<p>I want to place my properties files in some folder, but i am not able to read them because we can specify only the bundle name in static getBundle method on ResourceBundle object.</p> <p>Suppose bundle is : myFile.properties</p> <p>current path is : src</p> <p>i want to keep my properties file in : src/temp</p> <p>so when i am using : </p> <p>ResourceBundle.getBundle("temp/myfile", currentLocale);</p> <p>it is throwing an exception "can't find bundle".</p> <p>I want some way to specify the path.</p> <p>Please suggest me some way to do this. Thankyou</p>
java
[1]
319,846
319,847
get value from radio group using jquery
<p>I am trying to get value of radio group with name <code>managerelradio</code>. My html code for this radio group is.</p> <pre><code> &lt;label&gt;&lt;input type="radio" name="managerelradio" value="Yes" id="Add"&gt;Add&lt;/label&gt; &lt;label&gt;&lt;input type="radio" name="managerelradio" value="No" id="Remove"&gt;Remove&lt;/label&gt; </code></pre> <p>and Jquery for this is..</p> <pre><code> var manageradiorel = $('input[name = "managerelradio"]:checked' , '#managechildform').val(); alert(manageradiorel); </code></pre> <p>its showing me undefined.</p> <p>Though I have also tried it as.</p> <pre><code> var manageradiorel = $('input[name = "managerelradio"]:checked').val(); alert(manageradiorel); </code></pre> <p>But still I am getting undefined value.</p>
jquery
[5]
2,401,350
2,401,351
Set photo as marker in map
<p>Let's say I got the absolute path into the photo. /mnt/sdcard/....jpg</p> <pre><code> String path = "/mnt/sdcard/....jpg"; BitmapDrawable d = new BitmapDrawable(this.getResources(), path); d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight()); overlayItem.setMarker(d); </code></pre> <p>This is what i tried, however the photo does not display.</p> <p>EDIT: fixed, wrong path to file.</p>
android
[4]
2,331,357
2,331,358
USB Drive Removal Code in C#
<p>When I use this function in c#, it is able to get drive letter but, when I remove the USB stick and test this function, it doesnt go to the Exception.</p> <p>So could someone help me with where I am going wrong in the function code?</p> <pre><code> public void GetDriveLetter() { try { ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_DiskDrive where InterfaceType='USB'"); foreach (ManagementObject queryObj in searcher.Get()) { foreach (ManagementObject b in queryObj.GetRelated("Win32_DiskPartition")) { foreach (ManagementBaseObject c in b.GetRelated("Win32_LogicalDisk")) { // writer.WriteLine("{0}" + "\\", c["Name"].ToString()); // here it will print drive letter usbDriveLetter = String.Format("{0}" + "\\", c["Name"].ToString()); } } } } catch (ManagementException e) { MessageBox.Show(e.StackTrace); } //CombinedPath = System.IO.Path.Combine(usbDriveLetter.Trim(), path2.Trim()); } </code></pre>
c#
[0]
292,871
292,872
How to start designing with (open) data and JavaScript, for dummies?
<p>I've been designing data-driven interfaces (mostly graphic, low fidelity and non-functional prototypes) for over a year, to be implemented using JavaScript libraries such as <a href="http://mbostock.github.com/d3/" rel="nofollow">d3.js</a>. Although I'm a web designer by education, I've never actually coded any data visualization.</p> <p>Are there any crash-course or quick online tutorial showing how to deal with (open) data using jQuery (or libraries such as d3.js and Polymaps), for dummies? I'd really like to learn the basics: handle JSON, understand big data, plot basic graphs, etc.</p>
javascript
[3]
5,770,931
5,770,932
Reading particular line in a file for a particular word in PHP
<p>I am new to php, I need to read a text file's 5th line and see if it contains a particular string what would be the most efficient way to do it ? I understand I can ready all lines using this method, should I put a counter here and break the loop if it is 5 ? or is there a better way to it ..</p> <pre><code> $file = fopen($fileName,'r'); while(!feof($file)) { $name = fgets($file); } fclose($file); </code></pre> <p>EDIT</p> <p>I have updated my code to this, but strpos always fails to find the string even if it is present.. I have verified the 5th line looks like this PACKAGE_NAME: com.boom.appfree </p> <pre><code>//read entire file into an array $lines = file($target_path); //check line 5 if it contains free $pos = strpos($line[4], 'free'); if ($pos === false) { $subject = "Paid Log uploaded"; } else { $subject = "Log uploaded"; } </code></pre> <p>Any advise please..</p>
php
[2]
1,958,630
1,958,631
Which Namespace include hWnd in C# .Net?
<p>I am working on a c#Project.</p> <p>I would like to know: Which Namespace include hWnd,tWindowPlacement,TAboutBox in C# .Net?</p>
c#
[0]
4,299,623
4,299,624
How to define F<T> and F<T,U> and F<T,U,V> interfaces in Java?
<p>How would I define <code>F&lt;T&gt;</code> and <code>F&lt;T,U&gt;</code> and <code>F&lt;T,U,V&gt;</code> interfaces in Java (in lieu of <code>Action</code> from C#, they would have functions with one, two and three parameters returning void inside)?</p> <p>When I try to create them as nested types, I get an error saying "Duplicate nested type F", when I try to create them as top-level types, I would have to place both <code>F&lt;T&gt;</code> and <code>F&lt;T,U&gt;</code> in F.java.</p> <p>I might be able to solve this by placing each F in separate package, but I don't like that solution as I'd have to define as many packages as many generic parameters I would have. </p> <p>The same would go for implementing a Tuple class with multiple generic parameters, etc.</p> <p>code sample, not working:</p> <pre><code>public interface F&lt;T&gt;{ public void f(T arg1); } public interface F&lt;T,U&gt;{ public void f(T arg1,U arg2); } </code></pre>
java
[1]
5,851,121
5,851,122
Auto set input values
<p>Somewhat a simple question, but i can't get it working.</p> <p>I want to make a simple checkup to see if the browser supports the placeholder attribute. If they don't i want to set the values if the input fields with jquery.</p> <p>I'm testing it on firefox now, but can't get it working. I don't get any alert field..</p> <p>This is what i got and what doesn't work...</p> <pre><code> jQuery.each(jQuery.browser, function(i, val){ if(i=="mozilla" && jQuery.browser.version.substr(0,3)=="1.9"){ $("input").each(function() { alert(this.id); }); } }); </code></pre> <p>Tried this as well without a result</p> <pre><code> jQuery.each(jQuery.browser, function(i, val){ if(i=="mozilla" && jQuery.browser.version.substr(0,3)=="1.9"){ var $inputs = $("form :input"); $inputs.each(function(el) { alert(el.id); }); } }); </code></pre>
jquery
[5]
736,257
736,258
Mixed Results for Class Method
<p>I use PHP with the Codeigniter framework, and often have methods in my classes that return an array of values. It makes things simpler in my views if there are no records returned, that the method return FALSE or NULL, rather than returning an empty array. In my views I can just have something like:</p> <pre><code>&lt;?php if($abc_array) : ?&gt; // loop through the array, etc. &lt;?php else : ?&gt; // show some message &lt;?php endif; ?&gt; </code></pre> <p>If I return an empty array, I end up including something like the following in the views:</p> <pre><code>&lt;?php if(is_array($abc_array) AND count($abc_array) &gt; 0) : ?&gt; </code></pre> <p>I guess this is kind of a trivial example, but I'm mainly wondering if it is considered bad practice to have class methods return mixed result types. What about if a mysql error is somehow generated in the class and caught, should I have the returned result types something like:</p> <p>FALSE (on some type of error)</p> <p>Empty Array (if no results were returned)</p> <p>Array of Results (results were returned)</p> <p>I'm just trying to figure out what the best practices are for this kind of thing...</p>
php
[2]
4,011,466
4,011,467
Post php variable from one file to another
<p>How can I post a php variable from one file to an other? I still asked this question before and got this answer back but it doesn't work. I guess it's because the two code bits are each in a different file. How can fix this problem?</p> <p><strong>upload.php</strong></p> <pre><code>$filename = $_FILES['upload']['name']; $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); </code></pre> <p><strong>sound_upload.php</strong></p> <pre><code>GetSQLValueString($ext, "text") </code></pre>
php
[2]
4,089,484
4,089,485
How to implement a less generic std::is_constructible with decltype
<p>I'm going out on a limb here, assuming that it is possible but I'm not quite sure. Basically what I'm looking for is a way to switch at compile-time between using a default constructor or a constructor that takes one argument by reference.</p> <p>i.e.</p> <pre><code>T* create&lt;T&gt;() { return new T(1); // if possible } T* create&lt;T&gt;() { return new T(); // fallback to here } </code></pre> <p>I'm using the VS2010 compiler and it does not support <code>std::is_constructible</code> but I can use <code>decltype</code>.</p> <p>I went digging in the VS2012 type_traits header and looked at the <code>std::is_constructible</code> implementation and well I got a bit turned around. I don't get it how people write code that way. The headers are the most convoluted piece of code I've ever seen. Anyway, I saw that it was using decltype and it got me think, hopefully someone with more experienced can provide me with an answer.</p> <p><strong>After going through @ipc's answer I've settled on the following code</strong></p> <pre><code>// std::declval is not supported by VS2010 template &lt;typename T&gt; typename std::add_rvalue_reference&lt;T&gt;::type declval(); template &lt;class T, class R0&gt; decltype(new T(declval&lt;R0&gt;())) createInstance_(R0&amp; r0, int = 0) { return new T(r0); } template &lt;class T, class R0&gt; T* createInstance_(R0&amp;, ...) { return new T(); } </code></pre> <p>The above code will work but it does confuse the IntelliSense Engine, anyway I thought it was nice that you could omit the extra function by simply using a default argument. I've tested this code with VS 2010 and it compiles fine and runs as expected.</p>
c++
[6]
1,968,347
1,968,348
How to set animation for button background
<p>I have button and I have two pictures green.png and red.png. How to achieve that when button is visible to change button background every 500 ms ( green.png=>red.png=>green.png=>red.png...) ? </p>
android
[4]
5,233,448
5,233,449
Javascript slice off last character if there are 2 of them
<p>how to cut off second sign if there is a second sign ?? some times id is ....5a and 5b and i need to cut of the 'a' and 'b'</p> <p>JS</p> <pre><code>$(".mieszkanie").click(function() { var num = this.id.replace(/c_10_0/, ""); var n = num.length; if (n = 2) { [than cut second sign] } $('.pdf').attr({ href: "img/rzuty/mieszkania/pietro10rzuty/00" + num + ".pdf" }); $('.karta img').attr({ src: "img/rzuty/mieszkania/pietro10rzuty/00" + num + ".png", alt: "mieszkanie 00" + num }); }); </code></pre> <p>HTML</p> <pre><code>&lt;div id="rzuty10p" class="rzuty"&gt; &lt;span id="c_10_01" class="mieszkanie" title=""&gt;&lt;/span&gt; &lt;span id="c_10_02" class="mieszkanie" title=""&gt;&lt;/span&gt; &lt;span id="c_10_03" class="mieszkanie" title=""&gt;&lt;/span&gt; &lt;span id="c_10_04" class="mieszkanie" title=""&gt;&lt;/span&gt; &lt;span id="c_10_06" class="mieszkanie" title=""&gt;&lt;/span&gt; &lt;span id="c_10_05a" class="mieszkanie" title=""&gt;&lt;/span&gt; &lt;span id="c_10_05b" class="mieszkanie" title=""&gt;&lt;/span&gt; &lt;/div&gt; </code></pre>
javascript
[3]
72,850
72,851
Says import not used. Now sound doesnt work
<p>New to Android Dev and this site. I created an app and basics were working. I added a sound button and it worked. I created a new app for earlier version of android and accidently dragged my Main Activity file to the new app instead of copying it. When I dragged it back, it said my imports were not used. Now the sound, which I had to do an 'import' statement for, does not work. Heres the code.</p> <pre><code>package com.offthericta.wiferemote; import android.media.MediaPlayer; import android.os.Bundle; import android.app.Activity; import android.util.Log; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.Toast; import com.offthericta.wiferemote.R; import com.offthericta.wiferemote.R.id; import com.offthericta.wiferemote.R.layout; import com.offthericta.wiferemote.R.menu; import com.offthericta.wiferemote.R.raw; public class MainActivity extends Activity { private static final String TAG = "MyActivity"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Log.v(TAG, "Initializing sounds..."); final MediaPlayer mp = MediaPlayer.create(this, R.raw.blah); Button Button03 = (Button)this.findViewById(R.id.Button03); Button03.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Log.v(TAG, "Playing sound..."); mp.start(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.activity_main, menu); return true; } public void onClick(View v){} public void disclaimerBTN (View v){ Toast.makeText(this, "FAILED: The remote object is not responding to this command",Toast.LENGTH_LONG).show(); } } </code></pre>
android
[4]
4,023,714
4,023,715
joining relative urls?
<p>So i want to join strings with relative urls in Javascript.</p> <p>base url = "http://www.adress.com/more/evenmore"</p> <p>with</p> <p>relative url = "../../adress" => "http://www.adress.com/adress"<br> relative url = "../adress" => "http://www.adress.com/more/adress"</p> <p>What would be the best way? I was thinking of using regexp and checking<br> how many "../" i find, then subtracting that amount from the baseurl and adding them to what is left.</p>
javascript
[3]
2,751,125
2,751,126
jQuery efficiency question
<p>I have HTML like this:</p> <pre><code>&lt;div id="best"&gt; &lt;img src="image.jpg"&gt; &lt;span&gt;title&lt;/span&gt; &lt;img src="image.jpg"&gt; &lt;span&gt;title&lt;/span&gt; &lt;img src="image.jpg"&gt; &lt;span&gt;title&lt;/span&gt; &lt;/div&gt; </code></pre> <p>I want jQuery code to remove all spans. Which is best:</p> <pre><code>$('#best').find('span').remove(); </code></pre> <p>or</p> <pre><code>$('#best').children('span').remove(); </code></pre> <p>or</p> <pre><code>$('#best').find('span').each().remove(); </code></pre> <p>or is there a better solution? Which is best?</p>
jquery
[5]
5,558,823
5,558,824
Change div text if Select contains option with specific text
<p>I have a CMS that multiple people administer. We enable/disable some of our shipping methods depending on the time of year. I want to setup our checkout page to display a different message in our pickup info TD if someone enables the "Text Reserv. Pick-up" shipping option, but leave it as the default if not.</p> <p>I've found plenty of examples to change a div or something else if an option is selected, but I just want to see if an option is in the list and then change the content of a TD based on that. I've tried modified of those examples to see if it will work for my situation, but haven't got it to work.</p> <p>I already have the code to change the TD, but can't figure out how to check to see if the select contains a certain option first. Here's the code I have to change the text and input button of the TD:</p> <pre><code>// Change description from "To pick up at the bookstore" on Step 2 of checkout to Reserve Your Textbooks $('td[id$=PickupAtStoreColumn] div.multipleship').each(function() { $(this).html($(this).html().replace("To pick up at the bookstore","Reserve Your Textbooks")); }); // Change "Pick Up At Store" button text on Step 2 of checkout to Reservation Pickup $('td[id$=PickupAtStoreColumn] input[id$=btnPickupAtStore]').attr('value','Reservation Pick-up'); </code></pre> <p>How can I check to see if select[id$=drpShipType] has "Text Reserv. Pick-up" enabled as an option first? Thanks!</p>
jquery
[5]