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
2,604,951
2,604,952
LiveValidation js -- Change Text Message to Image
<p>LiveValidation is a nice little inline form validation plugin.</p> <p><a href="http://livevalidation.com/examples#exampleHomepage" rel="nofollow">http://livevalidation.com/examples#exampleHomepage</a></p> <p>I'd like to change the text confirmation message to an image.</p> <p>The line that I edit is:</p> <pre><code>var message = paramsObj.failureMessage || "Must be included in the list!"; </code></pre> <p>But when I change Must be... to img src=... it only displays the html text itself, not the image I'm calling.</p>
javascript
[3]
2,366,000
2,366,001
Android Conversion to Ordinal Format
<p>Before I go reinventing the wheel, does Android have any facility for converting an integer to an ordinal string with multi-language support? That is, it would convert the integer 3 to "3rd" in English and "3eme" in French.</p> <p>I can see how to do this myself using a bit of logic along with Android's automatic string substitution, but thought that this surely must have been encountered by others, and not just for use with dates.</p>
android
[4]
1,681,795
1,681,796
Uploading Not Working
<p>i have an online application form. i have provided two upload options in the form, one is for uploading image and another is for uploading document. </p> <p>But the problem is that the uploading is not working, though i see no error in my code.</p> <p>Anyone Please help.</p> <p>here is my php...</p> <pre><code>if(isset($_POST['submit'])) { //Get the uploaded file information $name_of_resume_file = basename($_FILES['resume_file']['name']); $name_of_image_file = basename($_FILES['image_file']['name']); //get the file extension of the file $type_of_resume_file = substr( $name_of_resume_file, strrpos($name_of_resume_file, '.') + 1 ); $type_of_image_file = substr( $name_of_image_file, strrpos($name_of_image_file, '.') + 1 ); $size_of_resume_file = $_FILES["resume_file"]["size"]/1024; $size_of_image_file = $_FILES["image_file"]["size"]/1024; //send the email { //copy the temp. uploaded file to uploads folder $path_of_resume_file = $uploads_folder . $name_of_resume_file; $path_of_image_file = $uploads_folder . $name_of_image_file; $tmp_path = $_FILES["resume_file"]["tmp_name"]; $tmp_path = $_FILES["image_file"]["tmp_name"]; $message-&gt;addAttachment($path_of_resume_file); $message-&gt;addAttachment($path_of_image_file); </code></pre>
php
[2]
4,563,607
4,563,608
How to make Custom Delegate in iOS app
<p>In iPhone every UIContrrol has predefined delegate methods but how we will create our own custom delegate methods </p>
iphone
[8]
1,647,672
1,647,673
Jquery "find" problem
<p>Can anyone help with a problem with a JQuery Find? In the example below I want to find the select &amp; text objects within Div1. Here is the HTML:</p> <pre><code>&lt;div id="div1" style="border:solid 1px #c6c8dd; background-color:#ff0000; padding:5px;"&gt; &lt;div style="width:916px; padding-top:10px;"&gt; &lt;select id="Select1" runat="server"&gt;&lt;/select&gt;&amp;nbsp: &lt;input id="Text1" type="text" style="width:200px;" /&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Here is the jQuery:</p> <pre><code>Select1 = jQuery("#div1").find("#Select1")[0]; Text1 = jQuery("#div1").find("#Text1")[0]; </code></pre> <p>Select1 comes back as undefined, but it finds the Text1 object. </p> <p>Can anyone tell me why I can't find the Select1 object?</p>
jquery
[5]
5,449,394
5,449,395
Moving A Method Inline - Resharper Possible
<p>I want to create an instance of <code>IEnumerable&lt;T&gt;</code> - I can do that by creating a method like</p> <pre><code>public IEnumerator&lt;T&gt; MakeEnumerator(){ yield return 1; } </code></pre> <p>But I need to pass this Enumerator to another class and so wanted to see whether I could create this inline with a delegate</p> <p>Is that possible </p> <p>EDIT: What I would like to remove is something like this: </p> <pre><code>new CustomClass(MakeEnumerator()) </code></pre> <p>and replace with</p> <pre><code>new CustomClass(delegate... ) // The method is now inline </code></pre>
c#
[0]
2,663,838
2,663,839
cannot scale images pulled from web
<p>Sorry for the newbie question, hope someone can put me on the right track...</p> <p>As a learning exercise, I am trying to build an app which pulls in images from the web (comic strips).</p> <p>My layout contains 3 HorizontalScrollViews, within each is an ImageView. In the layout I set the ImageView height to match_parent</p> <p>When the images are local, everything works fine. The images are scaled to the height of the HorizontalScrollView container. I can scroll the images left/right to see the whole image.</p> <p>When I pull the same images from the web they are visible but they do not scale to the container.</p> <p>Any ideas please?</p> <pre><code>// url = url of image //grab image to display try { imgView2.setImageDrawable(grabImageFromUrl(url)); } catch (Exception e) { txterror.setText("Image not found"); } } private Drawable grabImageFromUrl(String url) throws Exception { return Drawable.createFromStream((InputStream)new URL(url).getContent(), "src"); } </code></pre>
android
[4]
1,759,842
1,759,843
php : how to write $item$i
<p>how to write this correctly?</p> <pre><code>for($i=2;$i&lt;5;$i++) { $items{$i} = $doc{$i}-&gt;getElementsByTagName('url'); } </code></pre> <p>got an error: </p> <blockquote> <p>Fatal error: Call to a member function getElementsByTagName() on a non-object</p> </blockquote> <p>Thanks, bye</p>
php
[2]
2,809,463
2,809,464
Python Keyboard shortcuts
<p>So, I have a python script running I the background, and I want it to trigger X function whenever a key combination is pressed. How would I implement that? The problem is that the app will be running in the background, so it won't have focus from the OS.</p>
python
[7]
8,118
8,119
jquery an div tags used in a ordered list
<p>i'm not sure where my errors are lying but here is my scenario...</p> <p>i have an un-ordered list in html that handles my main link bar...</p> <pre><code> &lt;ul id="navlist"&gt; &lt;li&gt;&lt;a href="/" id="current"&gt;home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" id="search"&gt;search&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" id="users"&gt;login&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>and what i want done is to call each id and have jQuery handle each and dislpay it where specified in my css file... for now, lets just ignore my "home" link...</p> <p>here is a snippet of my inline jquery</p> <pre><code>$(document).ready(function() { $("a").click(function () { $("div#login").slideToggle("fast"); }); }) </code></pre> <p>Now, whichever div i specify, it calls that ... however it will only call one div, using either from the un-orderd list, as mentioned above in the html.</p> <p>My Goal is to call a search bar when search is clicked, and to call a login box when login is clicked.</p> <p>to my knowledge (noob), i believe use an as a class, however that is what brings me here.</p> <p>i believe my error is in my jquery and not my css, as stated above, either instance will be displayed when the jquery function calls either tag.</p> <p>any help is greatly appreciated.</p> <p>thanks in advance</p> <p>shan2on</p>
jquery
[5]
3,836,632
3,836,633
Save variable amount of variables from PHP form into database
<p>All, I'm allowing my user to create questions which I'll need to save answers to. They can create as little or as many questions as they would like. My dilemma is how to save these variables and also retrieve and display them back to the user. </p> <p>When I output the form to the user I have the following PHP code (I have the questions stored in a different table as well as the answers that are applicable in a different table):</p> <pre><code>$qryquestion = "Select * from feedback_questions order by question_display ASC"; $resultquestion = mysql_query($qryquestion); $i=1; while($resultsetquestion = mysql_fetch_array($resultquestion)){ if ($i%2==0){ echo '&lt;tr bgcolor="#FFFFFF" id="row'.$i.'"&gt;'; } else { echo '&lt;tr id="row'.$i.'"&gt;'; } echo '&lt;td align="center"&gt;&lt;b&gt;'.$resultsetquestion['question_value'].'&lt;/b&gt;&lt;/td&gt;'; echo '&lt;td align="center"&gt;&lt;div style="text-align:center;"&gt;&lt;input type="radio" name="rating_value_'.$resultsetquestion['question_id'].'" id="rating_value_'.$resultsetquestion['question_id'].'" value="'.$resultsetratings['rating_id'].'"&gt;&lt;/td&gt;'; } </code></pre> <p>I was thinking about saving them in the db like the following:</p> <pre> user_id question_id answer_id feedback_id 1 1 5 1 1 2 5 1 1 3 1 1 2 1 2 2 </pre> <p>How would I save these variables from a $_POST perspective when the form gets submitted? </p>
php
[2]
2,070,562
2,070,563
Java : Removing First three characters from a String
<p>I am getting a String value as </p> <pre><code>String A = KS!BACJ String B = KS!KLO String C = KS!MHJU String D = KS!GHHHY </code></pre> <p>Is it possible to remove the KS! from the String so that it only looks like BACJ </p> <pre><code>public class Main { public static void main(String args[]) { String A = "KS!BACJ"; if(A.startsWith("KS!")) { } } } </code></pre>
java
[1]
4,884,476
4,884,477
dialogresult does not work or partially work for some reason
<p>I made a form to be a dialog and the form only has one textbox, one OK button and one Cancel button. somehow, when the following does not work unless i change rnmForm.DialogResult!=DialogResult.OK), why is that???? </p> <pre><code> frmRename rnmForm = new frmRename(); rnmForm.ShowDialog(new Form()); if (rnmForm.DialogResult==DialogResult.OK) { MessageBox.Show("test"); } </code></pre>
c#
[0]
1,124,727
1,124,728
to display image in modal pop
<p>I have a requirement where when a user clicks on the details view thumbnail image, then I need to pop up an image in a modal control along with data.</p> <p>Right now my code is like this:</p> <pre><code>&lt;asp:DataList ID="gvImages" runat="server" RepeatColumns="5" RepeatDirection="Horizontal" Width="100%"&gt; &lt;ItemTemplate&gt; &lt;a href="javascript:void(window.open('&lt;%# "FullImage.ashx?ImID="+ Eval("ImageID")%&gt;','_blank','toolbar=no,menubar=no'))"&gt; &lt;asp:Image ID="Image1" runat="server" ImageUrl='&lt;%# "ThumbNailImage.ashx?ImID="+ Eval("ImageID") %&gt;' /&gt; &lt;/a&gt; &lt;/ItemTemplate&gt; &lt;ItemStyle BorderStyle="Double" BorderWidth="2px" HorizontalAlign="Left" VerticalAlign="Top" Width="20%" /&gt; &lt;/asp:DataList&gt; </code></pre> <p>I am using filehandler file to convert images into a thumbnail image while showing in the datalist control. But once the user clicks the thumbnail image I need to show the image in a modal control.</p> <p>I tried doing this concept in jQuery light box but there is a problem when we immplement it in the master page.</p>
asp.net
[9]
810,408
810,409
What does String [][] means in C#?
<p>EG. </p> <pre><code>String [ ][ ] LinesSplitByComma1 = File.ReadAllLines("Filepath").Select(s =&gt; s.Split(',')).ToArray(); </code></pre>
c#
[0]
4,295,056
4,295,057
Call-time pass-by-reference issue in php
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4665782/call-time-pass-by-reference-has-been-deprecated">Call-time pass-by-reference has been deprecated;</a> </p> </blockquote> <pre><code>function getLib($pfComponentType,$pfComponentCode,$componentCode) { if($temp=require_once($this-&gt;getConfig($pfComponentType,$pfComponentCode,'librariesPath').$componentCode.'.php')) { $obj_lib = __NAMESPACE__.'\\'.$componentCode; return new $obj_lib(&amp;$this); } else return NULL; } </code></pre> <p>I am getting a error saying that Call-time pass-by-reference has been removed in the line 6 of above function i.e., return new $obj_lib(&amp;$this);</p>
php
[2]
55,067
55,068
Python issue in while statement
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/12090110/python-while-statement-issue">python while statement issue</a> </p> </blockquote> <p>hi guys I have to write a program that reads in multiple lines of text from the user until a blank line. Your program should count whether each line contains the string mega or uber.</p> <p>Once the user has stopped entering input, print out how many lines contained those words. </p> <p>Means it should count only uber and mega in lower case so here some example and this is the way I'm propsed to write the code.</p> <p>I have written something but its not showing as I'm asked to write so can you help me about it.</p> <p>For example:</p> <pre><code>Your friend says: That was so mega-awesome! Your friend says: Radical. Your friend says: uberlol Your friend says: 2 language violation(s) </code></pre> <p>And here's an example with no matches:</p> <pre><code>Your friend says: MEGAAWESOME! Your friend says: 0 language violation(s) </code></pre> <p>Here is my code so please tell me where i am making the mistake, i'll be really grateful to you.</p> <pre><code>said = raw_input("Your friend says: ") i = said.count('mega') b = said.count('uber') a = i + b s = 0 while s == said or a &lt; said: if(str(a) in said): print a, "language violation(s)" s = s + 1 else: said = raw_input("Your friend says: ") </code></pre>
python
[7]
1,191,142
1,191,143
How to generate a fixed-length hash based on current date and time in Python?
<p>I want to generate a fixed-length (say 10 characters) hash based on current date &amp; time. This hash will be append to names of the uploaded files from my users. How can I do that in Python?</p>
python
[7]
5,623,362
5,623,363
Cannot write session data to file
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2005537/failed-to-write-session-data">Failed to write session data</a> </p> </blockquote> <p>I am having a problem with sessions on my server. Is this a server problem or a coding problem? I get this error message:</p> <pre><code>Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/php_sessions) in Unknown on line 0 </code></pre>
php
[2]
2,009,428
2,009,429
Can JavaScript draw dashed lines?
<p>I am a JavaScript newbie. I know JavaScript can draw lines, but can it draw dashed lines? If it can, how can I do so? Can it draw anti-aliased lines? If so, how?</p>
javascript
[3]
4,482,626
4,482,627
Images not showing in device for Web view in iphone
<p>I am working on one application. I stuck with one problem. I have HTML page and some images are in Resource Directory. Whenever i run the application on Simulator it works perfectly fine. But when i run the application on the device the image are not displaying but text is displaying only and instead of image Question mark is showing.</p> <p><strong>Code:</strong> NSString *path = [[NSBundle mainBundle] pathForResource:@"test1" ofType:@"html"]; NSFileHandle *readHandle = [NSFileHandle fileHandleForReadingAtPath:path];</p> <pre><code>NSString *htmlString = [[NSString alloc] initWithData: [readHandlereadDataToEndOfFile]encoding:NSUTF8StringEncoding]; NSURL *baseurl = [NSURL fileURLWithPath:path]; [self.webView loadHTMLString:htmlString baseURL:baseurl]; </code></pre> <p><strong>HTML Code:</strong></p> <pre><code> &lt;img src="mainGrid.png"&gt; </code></pre>
iphone
[8]
4,431,680
4,431,681
how to keep on running the chronometer between switching the pages
<p>I have two pages.First page having chronometer.it works well.but when i go to second page and come back to the first page the timer has stopped working.Can any one help me to fix this issue. Thanks..</p>
android
[4]
2,243,863
2,243,864
Visual C++ 2010 error. Can't Find program.exe when running
<p>This is the message I get</p> <blockquote> <p>Unable to start program C:\Users\Documents\Visual Studio 2010\Projects\EULER'S Fixed\Debug\EULER'S Fixed.exe</p> <p>The system cannot find the file specified.</p> </blockquote> <p>Here is the Build Output</p> <pre><code>1&gt;------ Build started: Project: EULER'S Fixed, Configuration: Debug Win32 ------ 1&gt;LINK : error LNK2001: unresolved external symbol _mainCRTStartup 1&gt;C:\Users\adicpluplu\Documents\Visual Studio 2010\Projects\EULER'S Fixed\Debug\Debug\EULER'S Fixed.exe : fatal error LNK1120: 1 unresolved externals ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== </code></pre>
c++
[6]
3,107,498
3,107,499
How to get the intermediate dates given the start date and end date?
<pre><code>start_date = '07_Nov_2011' end_date = '10_Jan_2012' </code></pre> <p>I want to print all the intermediate dates in the same format:</p> <pre><code>day_month_year </code></pre> <p>If I can somehow convert start_date to date type I can do this:</p> <pre><code>sdate+timedelta(1)).strftime('%d_%b_%Y') </code></pre> <p>How do I convert it? Or is there a better way to do this?</p>
python
[7]
3,184,004
3,184,005
JQuery How to set attribute of element using other attribute of the same element
<p>I want to set title text of a link calling a function which receives as parameter the id of the element and outputs the text.</p> <p>something like</p> <pre><code>$(a).attr('title', function() {return $(this).id + "foo"}); </code></pre> <p>but a construct like this doesn't exist as far I know. What can I do? Thanks.</p>
jquery
[5]
5,033,141
5,033,142
Linker error: Unresolved external '__Fastcall_Advgrid::TAdvstringGrid::AutosizeCol......referenced from ...name.OBJ
<p>I was compiling a project, and this project has a unit called Gamespaceframe, the header file was as follow:</p> <pre><code>: #include "Advdgrid.hpp" : </code></pre> <p>and the .cpp was as follow:</p> <pre><code>: #Pragma link "Advdgrid" : </code></pre> <p>When I recompiled this project, I got this linker error:</p> <blockquote> <p><code>Linker error: Unresolved external '__Fastcall_Advgrid::TAdvstringGrid::AutosizeCol(const int, const int) referenced from C:\MHSS\Gamespaceframe.OBJ.</code></p> </blockquote> <p>Any help or comment is appreciated,</p> <p>Thanks in advance,</p> <p>Regards,</p> <p>David.</p>
c++
[6]
6,012,000
6,012,001
Android push notifications - should my service extend GCMBaseIntentService or IntentService
<p>The basic architecture of the push functionality that I am trying to create is </p> <p>1) I would get the phone id and store it in my db</p> <p>2) Only when something happened on the server I would try to create a push message</p> <p>So I do not need the part where the app tries to call the server to send it the message. I am wondering what should I extend in the Service class and what methods in it do I need to implement.</p> <p>Also, am I able to get the device id and send that info to my server without using the server?</p> <p>I am using Google cloud messaging.</p> <p>Thanks!</p>
android
[4]
3,733,392
3,733,393
Why add void to method parameter list
<p>I've seen methods with the following signature:</p> <pre><code>void foo (void); </code></pre> <p>They take no argument, however I'm wondering whether doing this is useful or not. Is there a reason why you would want to do it?</p>
c++
[6]
1,741,634
1,741,635
jQuery basic structure
<p>i wanna understand what that line means: </p> <pre><code>var oViewport = { obj: $('.viewport', root) }; </code></pre> <p>it's a line out of the plugin tinyscrollbar. Can someone explain the values of this line to me? I really searched for an answer but didn't find one. I appreciate your help. </p>
jquery
[5]
407,038
407,039
how do i tell the android launcher to reload its icons?
<p>while testing, if i load a new version of my application onto my phone, the icon shown in the launcher isn't refreshed. is there any way to tell the launcher to reload its icons?</p>
android
[4]
5,790,376
5,790,377
How to SET jquery .attr(), not get it
<p>When I want to read an attribute, I use </p> <pre><code>$('#mydiv').attr('id'); </code></pre> <p>How do I write to this attribute instead, so that I can change the id of the div in the markup?</p>
jquery
[5]
3,190,594
3,190,595
Microsoft JScript runtime error: '0.scrollHeight' is null or not an object
<p>I use jQuery to scroll the div vertical bar to it's last line in my web chat application. I found that whenever there are several lines which don't need to scroll down to the last line, it comes out an error says: Microsoft JScript runtime error: '0.scrollHeight' is null or not an object. When there are more lines, it doesn't show. Anyone knows how to resolve this? my code:</p> <pre><code>var height = $('#chatbox')[0].scrollHeight; $('#chatbox').scrollTop(height); </code></pre> <p>chatbox is the div id. I set overflow-y: auto; for chatbox</p>
jquery
[5]
2,369,041
2,369,042
How to set the focus on button?
<p>Hi I have some EditTexts and a button at the bottom of the view. Upon starting the activity, the first EditText will gain focus and a keyboard will pop up. I want to upon starting the activity, the focus will be on the button instead of the EditText and the keyboard should not pop up. I tried running:</p> <pre><code>button.requestFocus(); </code></pre> <p>The EditText still have focus and pops up the keyboard. How can I resolve this? Thanks.</p>
android
[4]
4,688,547
4,688,548
Generating the same random number in Java and Python
<p>Is it possible to generate the same random number in python as in java if given the same seed</p> <p>Explained in a more accurate way, Is it possible to use the linear congruential formula from java in Python?</p>
python
[7]
4,405,246
4,405,247
structures and pointers
<p>I'm not sure what I'm doing...</p> <p>Let say I have a structure</p> <pre><code>struct Inner{ exampleType a; int b; } struct Outer{ int current; int total; Inner records[MAXNUMBER]; } struct Outer2{ Outer outer; } </code></pre> <p>And I have the following functions:</p> <pre><code>void try3( Outer2&amp; outer, type var, type2 var2 ){ } void try2( Outer2* outer ){ try3(*outer, var, var2); } </code></pre> <p>Inside main:</p> <pre><code>int myMain( int argc, char *argv[] ){ Outer2 outer2; try2 (&amp;outer2); } </code></pre> <p>Here's the question. Can I increment the value of current by sticking the following line in try3:</p> <pre><code>++outer.outer.current; </code></pre>
c++
[6]
4,294,134
4,294,135
How to return a reference to a string in c#?
<p>I am looking to write a function like </p> <pre><code>ref String TestIt( int index ) { return this.TestArray[index]; }; </code></pre> <p>so that I could write code like:</p> <pre><code>MyClass.TestIt(0) = "Hello World"; </code></pre> <p>My goal is to mimic this c++ declaration</p> <pre><code>CString&amp; MyClass::Data( UINT index); </code></pre> <p>By Reference I am referring to the c++ term the Address of the variable.<br /> in other words after my call to TestIT(0) TestArray[0] would contain "Hello World".</p> <p><strong>EDIT</strong> I can't use an indexer because my goal is to convert a .cpp file to c# on an ongoing basis. The closer I can mimic this c++ code, the less of a converter I have to write.</p>
c#
[0]
3,299,664
3,299,665
Can I override the 'Home' button in my application?
<p>I want to create my own 'home' screen on my android, and I want to call that home screen from my application.</p> <p>How can I override the 'Home' button so that when it's pressed the application will be redirected to my home screen instead of the default home screen? Is it possible to override the home button?</p>
android
[4]
5,569,948
5,569,949
making a class behave like a bunch of keyword arguments in python
<p>So I have a class that will have a lot of attributes. Is there a way to make this class behave in a way that I can pass it as a **kwarg to a function?</p> <pre><code>class Foo ( object ) : def __init__( self ) : self.a = 'a' self.b = 'b' foo = Foo() somefunc(**foo) </code></pre> <p>I cannot find the right operator to overload.</p> <p>Thanks a lot!</p>
python
[7]
6,032,634
6,032,635
jquery selector result is prevObject: e.fn.e.init[3] how do I get an element from that
<p>I have a selector <code>$('.element')</code> is returning <code>prevObject: e.fn.e.init[3]</code>. I looked into the results and the first object there is what I need. 2 questions here. What is <code>prevObject</code>? Also how can I select from the result the first object. Thanks for any help.</p>
jquery
[5]
2,082,925
2,082,926
Python- input string and prints indexes of vowels in string
<p>Implement the function vowels(s) that takes as input a string and prints the indexes of all vowels in the string. Hint: A vowel can be defined as any character in string "aeiouAEIOU"</p> <pre><code>vowels ('Hello WORLD') 1 4 7 </code></pre>
python
[7]
1,351,360
1,351,361
dream css image slider
<p>Does anyone ever use this slider: <a href="http://www.dreamcss.com/2009/04/create-beautiful-jquery-sliders.html" rel="nofollow">http://www.dreamcss.com/2009/04/create-beautiful-jquery-sliders.html</a>.</p> <p>I need someone's advice on how to remove the navigation and only show while on hover.. thanks</p>
jquery
[5]
5,233,041
5,233,042
creating sqlite database
<p>How to create a sqlite database in applications resource or assets folder?</p>
android
[4]
1,754,807
1,754,808
Capturing the Desktop wallpaper in the background of the Activity
<p>I have a problem that I want to create an Android App which captures the current wallpaper of Device Desktop, in the background. Which is already done in an App which is shown below in images. as:</p> <p><img src="http://i.stack.imgur.com/KwtFD.png" alt="enter image description here"></p> <p><strong>Desktop of Device:</strong></p> <p><strong>And Background of an Clock App:</strong></p> <p><img src="http://i.stack.imgur.com/8l99d.png" alt="enter image description here"></p> <p>So, My problem is the same as above, how we set the background of an Activity as the current Desktop WallPaper. Please suggest me the right solution about the same.</p> <p>Thanks in advance.</p>
android
[4]
2,710,530
2,710,531
How could I use the Android LVL in my premium key app?
<p>It seems that the commonly accepted approach to implement a paid "premium key" application is to have a the free app check if the paid one is installed to unlock features. This part is straight forward as is the implementation of the LVL but I cannot figure out how to combine both. If the paid app is never intended to be run, there is no way to call the License Verification Service. Only way I could think of was to have the free app invoke an intent from the paid one and wait for a response. The paid app could do the license verification. Problem with this approach is that when the free app calls the intent, it is paused and can be killed anytime by the OS. So nothing guarantees that the app is still running after the license check.</p> <p>Any ideas or suggestions on how to implement a paid app that would only be an unlock key but also implements the LVL?</p> <p>Thank you</p>
android
[4]
2,147,475
2,147,476
get the size of data partition by coding
<p>i have test code using :</p> <pre><code> $ adb -s emulator-5554 shell # df df /dev: 47084K total, 0K used, 47084K available (block size 4096) /sqlite_stmt_journals: 4096K total, 0K used, 4096K available (block size 4096) /system: 73600K total, 73600K used, 0K available (block size 4096) /data: 65536K total, 18464K used, 47072K available (block size 4096) /cache: 65536K total, 1156K used, 64380K available (block size 4096) </code></pre> <p>you see the data have total 65536k and so on,my question is how to get the size by coding?if i need root right?can you give me some advice?</p>
android
[4]
4,807,389
4,807,390
file_put_contents, placing content between lines
<p>I am new to PHP and I am practicing the file_put_contents() function, and I was wondering if this was possible.</p> <p>I have a text file with the following copy:</p> <pre><code>--start placed content -- (content goes here) --end placed content -- </code></pre> <p>Is it possible to use file_put_contents to place the content inbetween the --start-- and --end-- lines. I have tried the FILE_APPEND flag, but it always places the content after the --end-- line. Or do I need to use file_get_contents first?</p> <p>Thanks a lot, any help would be greatly appreciated.</p>
php
[2]
4,209,903
4,209,904
Is there any Listener for Media Recorder?
<p>Actually i am creating an application which starts recording when user start speaking and stop recording automatically when user stop speaking.</p> <p>so is there any way to find if user is speaking or not? is there any listener for Media Recorder for this?</p>
android
[4]
674,720
674,721
Android HtmlGet trouble
<p>I want to get source of webpage. And for now only display. I can't compile this code succesfuly. Eclipse saying Unhandled declaration type IOExeption. When i add "throws declaration" still have some problems. I'm sorry for my english. Thanks for answers. </p> <pre><code>package com.html; import java.io.BufferedReader; // More and more import import android.widget.TextView; public class GetHtmlActivity extends Activity { String html; public String HtmlGet(String url) throws IOException { HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet(url); HttpResponse response = client.execute(request); InputStream in = response.getEntity().getContent(); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); StringBuilder str = new StringBuilder(); String line = null; while((line = reader.readLine()) != null) { str.append(line); } in.close(); return str.toString(); } public void onCreate(Bundle Spusteni) { super.onCreate(Spusteni); setContentView(R.layout.main); HtmlGet("***"); TextView tv = new TextView(this); tv.setText(html); setContentView(tv); } } </code></pre>
android
[4]
1,239,323
1,239,324
TextView showing HexValue (0x0d0a) for CR LF in Android
<p>While saving data from textview, CR LF is storing like hex value 0x0d0a. But while showing same data in another text view <strong>which is inside list view</strong>, not showing return space for 0x0d0a. Instead of that it is directly printing /0x0d0a. Any help here. Thanks in advance. -- Raghav</p>
android
[4]
610,637
610,638
I need to remove the object of an image and fill with transparency in Android(removing background layer)
<p>I have a persons image which is taken from camera or gallery , In that image the background is a scenery. I need to remove that scenery and replace with some other image, So that it would look like the persons background is the the new replaced image not the old background.How this could be done in Android??? </p>
android
[4]
4,339,960
4,339,961
populate select boxes from json string using jquery
<p>I have a list of select boxes with incremental numbers to identify then e.g.</p> <pre><code>&lt;select id="my-select-0"&gt; &lt;option value="1"&gt;first option&lt;/option&gt; &lt;option value="2"&gt;first option&lt;/option&gt; &lt; option value="3"&gt;first option&lt;/option&gt; &lt;/select&gt; &lt;select id="my-select-1"&gt; &lt;option value="1"&gt;first option&lt;/option&gt; &lt;option value="2"&gt;first option&lt;/option&gt; &lt;option value="3"&gt;first option&lt;/option&gt; &lt;/select&gt; &lt;select id="my-select-2"&gt; &lt;option value="1"&gt;first option&lt;/option&gt; &lt;option value="2"&gt;first option&lt;/option&gt; &lt;option value="3"&gt;first option&lt;/option&gt; &lt;/select&gt; </code></pre> <p>I have a json string which I want to use to pre populate these selects e.g.</p> <pre><code>json = "[{'my-select': 1}, {'my-select': 3}]"; </code></pre> <p>in the example above <code>my-select-0</code> would be set to 1 and <code>my-select-1</code> is set to 3.</p> <p>How would I go about doing this in JQuery?</p> <p>Thanks</p>
jquery
[5]
2,735,464
2,735,465
<identifier> expected. java
<p>I have this snippet of java code. I am a noob in java.. </p> <p>Error :</p> <pre><code>&lt;identifier&gt; expected cfg = new Config; </code></pre> <p>Code:</p> <pre><code>import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.HashMap; import java.util.HashSet; import java.util.Set; import java.io.*; import java.util.*; import java.util.Properties; public class Config { Properties configFile; public Config() { configFile = new java.util.Properties(); try { configFile.load(this.getClass().getClassLoader().getResourceAsStream("config")); }catch(Exception eta){ eta.printStackTrace(); } } public String getProperty(String key) { String value = this.configFile.getProperty(key); return value; } } public class ClosureBuilder { </code></pre> <p><code>cfg = new Config();</code></p> <pre><code>private static String JDBC = cfg.getProperty("JDBC"); private static String URL = cfg.getProperty("URL"); private static String DIMENSION_TABLE = cfg.getProperty("DIMENSION_TABLE"); private static String CLOSURE_TABLE = cfg.getProperty("CLOSURE_TABLE"); private static String KEY = cfg.getProperty("KEY"); private static String PARENT_KEY = cfg.getProperty("PARENT_KEY"); private static Object TOP_LEVEL_PARENT_KEY = '0'; private Object topLevel = null; private Set&lt;Object&gt; processedNodes; private PreparedStatement aPst; public static void main(String[] args) throws Exception { ----------- More code -------- </code></pre>
java
[1]
2,739,539
2,739,540
Javascript help - combo box
<p>Hi I need some help understanding this code: It works well but can someone add some comments to help me understand it better? Thanks</p> <p>Here's the code:</p> <pre><code>function contractall() { if (document.getElementById) { var inc = 0 while (document.getElementById("dropmsg" + inc)) { document.getElementById("dropmsg" + inc).style.display = "none" inc++ } } } function expandone() { if (document.getElementById) { var selectedItem = document.dropmsgform.dropmsgoption.selectedIndex contractall() document.getElementById("dropmsg" + selectedItem).style.display = "block" } } if (window.addEventListener) window.addEventListener("load", expandone, false) else if (window.attachEvent) window.attachEvent("onload", expandone) </code></pre>
javascript
[3]
268,807
268,808
Mozilla display Problem with javascript
<p>I n an aspx page I am using a javascript function like</p> <p>function ReverseResult() {</p> <pre><code>document.getElementById("ctl00_ContentPlaceHolder1_txtIncrementAmount").value = parseInt(document.getElementById("ctl00_ContentPlaceHolder1_txtNewCTC").value) - parseInt(document.getElementById('&lt;%=lblCurrentCTC.ClientID %&gt;').innerText); var result; result = parseInt(document.getElementById("ctl00_ContentPlaceHolder1_txtIncrementAmount").value)*100 / parseInt(document.getElementById('&lt;%=lblCurrentCTC.ClientID %&gt;').innerText); if(result == "Infinity") { document.getElementById("ctl00_ContentPlaceHolder1_txtIncrementPerc").value = 100.00; } else { document.getElementById("ctl00_ContentPlaceHolder1_txtIncrementPerc").value = result.toFixed(2); } </code></pre> <p>}</p> <p>This works fine in IE. But in the mozilla the result display as Nan</p> <p>Pls help to solve this issue</p>
javascript
[3]
5,717,069
5,717,070
Return "null" on primitive return type function?
<p>I have a function which returns an <code>int</code> value for a given key (from a <code>HashMap&lt;String, Integer&gt;</code>). If the key doesn't exist, I want to return something the caller can check for. It seems that, most commonly, this would be a "<em>returns -1 if key doesn't exist</em>" kind of thing. However, I can't reserve -1 for that purpose in my case, because negative numbers are feasible values for keys which <em>do</em> exist.</p> <p>The only other options I have been able to come up with are the following:</p> <ol> <li>Change return type to <code>Integer</code> wrapper class and check for <code>null</code></li> <li>Return something very unlikely, such as <code>Integer.MIN_VALUE</code></li> <li>Make an additional <code>boolean keyExists(String key)</code> function which should always be called first</li> <li>Switch to <code>float</code> and use <code>NaN</code> instead</li> </ol> <p>I am writing this in Java, but people from similar language backgrounds are welcome to post. Thanks!</p>
java
[1]
570,773
570,774
c# Splitting a string based on number of characters
<p>I'm looking through the functionality of the Split ability of Strings in c#, and I was wondering if there was a way that I could split a string based on number of characters rather than a specific delimiter?</p> <p>For example, can I split "cat dog" in a way that would fill the first 7 slots in an array, since there are 6 characters and a space.</p> <p>Or is it required that you specify a delimiter to split on?</p>
c#
[0]
5,777,693
5,777,694
Generating an ascending list of numbers of arbitrary length in python
<p>I've been looking at how to do this for a bit and there has to be a fast way, is there a function i can call that returns a list of ascending numbers? ie. function(10) would return [0,1,2,3,4,5,6,7,8,9]? Its probably something I'm overlooking.</p>
python
[7]
2,077,761
2,077,762
FileWatcher on Private Folder
<p>I have a windows service that listens on a folder on a server for newly added files. Once a new file is added then the services executes a method to carry out a specific function. I don't want the watched folder to be viewable or editable by users' that log in to the server. I would like for another program to c# .exe to be the only app that is able to view and add files. Is it possible to hide a folder away from users but make it available to an application?</p>
c#
[0]
2,528,825
2,528,826
permission for my php to create a dynamic file on the server
<p>For a project I need my php file to create a dynamic file (on remote server which I bought) which loads into a flash component. Everything is working fine on my localhost. But once I upload it to the server, it throws the following errors:</p> <pre><code>Warning: fopen(output.html) [function.fopen]: failed to open stream: Permission denied in C:\Inetpub\vhosts\x.co.in\httpdocs\blabla.php on line 25 Warning: DOMDocument::save(k_id.xml) [domdocument.save]: failed to open stream: Permission denied in C:\Inetpub\vhosts\x.co.in\httpdocs\blabla.php on line 136 </code></pre> <p>where on those lines fopen is written.</p> <p>I understood as there is no permission to my php file to create any dynamic files on the server. So i just wanna understand is there a way by which I can privilege my php to create that file on the server. </p> <p>I've the login access, which I think I've to put somewhere in code before it tries to create such file...but i dont know how to figure this...any suggestions?</p>
php
[2]
897,986
897,987
Javascript - Where i'm making a mistake?
<p>i'm creating that script if someone delete the text or link on footer of my template it will redirect to my site, but its redirecting without removing anything.</p> <pre><code>function loadBody() { var elem = document.getElementById("mycontent"); if(elem.innerHTML !== "MySite" || elem.href !== "http://mysite.com") window.location="mysite.com"; } </code></pre> <p>here is the footer html</p> <pre><code> &lt;div id='mycontent'&gt; &lt;p&gt;&amp;#169; Template is designed by &lt;a href='http://mysite.com' title=''&gt;Mysite&lt;/a&gt;&lt;/p&gt; &lt;/div&gt; </code></pre> <p>thanks in advance.</p>
javascript
[3]
4,682,337
4,682,338
Newlines are missing after downloading txt file through the browser
<p>I have a txt file that is generated on the server and contains newlines. If I view the file in my ftp editor, they are here. If I download it through my ftp client and open in it windows with notepad, I also see the newlines.</p> <p>But when I try to download it through the browser by forcing a download window, and then open the file, all the new lines are suddenly gone.</p> <p>This is the code I have now. I also tried to set the content type to application/force-download, but that also made no difference.</p> <pre><code>header('Content-Type: text/plain'); header('Content-Disposition: attachment; filename="'.$myFile.'"'); header("Content-Transfer-Encoding: binary"); </code></pre> <p>Any idea why the new lines are only missing when I download it through the browser? But are intact when I view the file on the server, or download it from the ftp and the open in notepad?</p>
php
[2]
5,848,544
5,848,545
can not stop NSTimer
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1031554/nstimer-doesnt-stop">NSTimer doesn&#39;t stop</a> </p> </blockquote> <p>I hope to stop a running NSTimer, below are my codes:</p> <pre><code>timer=[[NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(timerFired:) userInfo:nil repeats:NO] retain]; </code></pre> <p>the function that stops the timer</p> <pre><code>-(void)stopTimer; { [timer invalidate]; [timer release]; timer = nil; } </code></pre> <p>But I found that even I called 'stopTimer', the timer did not stop and 'timerFired' would be triggered.</p> <p>Welcome any comment</p> <p>Thanks</p> <p>interdev</p>
iphone
[8]
5,026,316
5,026,317
How to stop an Activity in android
<p>My code looks as follows..</p> <pre><code>@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); try { Thread.sleep(3000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } finish(); } </code></pre> <p>And my XML is</p> <pre><code>&lt;LinearLayout android:id="@+id/LinearLayout01" android:layout_width="fill_parent" android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_gravity="center"&gt;&lt;Button android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" android:layout_gravity="center" android:layout_marginTop="80px"&gt;&lt;/Button&gt; </code></pre> <p></p> <p>In my XML i had a button. Now what i want is After starting the activity i have to wait for 3 seconds and then the Activity has to be stopped..Through my code the Activity is stopped after 3 seconds. But am not seeing any Button when the activity is started..Only Black screen is appearing for 3 seconds..But i also want to display that button..can any one help with sample code..please...I am need of it..</p>
android
[4]
26,561
26,562
Can I write this javascript more efficiently with jquery?
<p>Do you think jquery could help me get the following script work faster? Thanks!</p> <pre><code>window.onload=function colorizeCheckedRadios(){ var inputs = document.getElementsByTagName("input"); if (inputs) { for (var i = 0; i &lt; inputs.length; ++i) { if(inputs[i].checked&amp;&amp;inputs[i].type=="radio"){ inputs[i].parentNode.parentNode.style.backgroundColor='#FCE6F4'; } } } } </code></pre>
jquery
[5]
5,012,217
5,012,218
Wrap text after particular symbol with jQuery
<p>What I'm trying to do, is wrap text into div inside ll tag. It wouldn't be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. </p> <p>This is my html:</p> <pre><code>&lt;ul&gt; &lt;li&gt;Some list text - Additional text&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>As I result I'm trying to achieve this:</p> <pre><code>&lt;ul&gt; &lt;li&gt;Some list text &lt;span class="after"&gt;- Additional text&lt;span&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Will anyone will be able to help me please?</p> <p>Thank you in advance.</p>
jquery
[5]
4,838,253
4,838,254
$_POST and $_GET array data modification possible or not?
<p>I was confounded by a question whether $_POST and $_GET arrays data modification is possible for more than one time as I tried to assign some value to $_POST for making the posted data sanitized from single and double quote and backslashes and then again assigned $_POST array the trimmed value of the $_POST array.</p> <p>But what I found was astonishing as this only reflected the last assigned value to $_POST array not both of the operations.</p> <p>I did this on latest version of PHP.</p> <p>Some people say you can assign the data only once?.</p> <p>Is it true.</p> <p>What I did was this : </p> <pre><code>foreach($_POST as $key=&gt;$value) { $_POST[$key] = mysql_real_escape_string($value); $_POST[$key] = trim($value); } </code></pre>
php
[2]
1,979,909
1,979,910
android webviewer doesn't displaying websites correctly
<p>I'm using a webviewer for displaying my website . The websites are in persian . The problem is that the contents are really messed up and it displays it very very bad .</p> <p>Is there anyway to solve this problem ? I've tried too many websites but non of them showed well .</p> <p>Thanks </p>
android
[4]
3,511,216
3,511,217
Exception when calling SchemaFactory.newInstance on Android 4.0
<p>I have an android 4.0 app which try to call the following as recommended in Android SDK:</p> <pre><code>SchemaFactory sf = SchemaFactory.newInstance(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI); </code></pre> <p>but this gives me the following exception: </p> <pre><code>java.lang.IllegalArgumentException: http://www.w3.org/2001/XMLSchema </code></pre> <p>my code:</p> <pre><code>btnSearch.setOnClickListener(new Button.OnClickListener(){ public void onClick(View v) { try{ //no code before this line and exception threw right here. SchemaFactory sf = SchemaFactory.newInstance(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI); .... } </code></pre>
android
[4]
2,912,897
2,912,898
JQuery: how to know the kind of form object we are dealing with?
<p>I am building a interactive form and loading the fields according to the answer of the user. Right now I just have two kind of objects "input radio" and "textarea". As I am getting the value of the answers via JQuery, how can I know what object I am dealing with inside the very LAST loaded fieldset?</p> <p>This is what I am trying:</p> <pre><code>$.fn.getNodeName = function() { // returns the nodeName of the first matched element, or "" return this[0] ? this[0].nodeName : ""; }; //var $something = $('input[type=radio]:checked:last'); var $something = $('fieldset:last').parent('nth-child(2)'); //$('#news ul li:first-child').addClass('active'); alert($something.getNodeName()); </code></pre> <p>But it's not working... Thanks.</p>
jquery
[5]
1,125,122
1,125,123
How to create a detachable toolbar kind of thing
<p>I am developing a web based application where I need to have a detachable toolbar kind of thing. This way user would be able to move the toolbar to somewhere else in the browser while working.</p> <p>A site already has this kind of functionality. Here is a snapshot</p> <p><a href="http://skitch.com/neerajdotname/dai12/neeraj-singh-flavors.me" rel="nofollow">http://skitch.com/neerajdotname/dai12/neeraj-singh-flavors.me</a></p> <p>What jQuery plugin might help me get that kind of detachable window?</p>
jquery
[5]
5,536,515
5,536,516
How to find fast the number of files in directory?
<p>I have thousands log files in a few directories in my system. Mostly I need to know just number of these files in directory. I fear that this attitude:</p> <pre><code>$files = count(scandir("logs")) - 2; </code></pre> <p>Is not very effective (memory, filesystem). I am considering some global counter (incremented after file is added), unless there is some other effective way?</p>
php
[2]
3,623,672
3,623,673
How to get all children elements except one
<p>I have the following content:</p> <pre><code>&lt;input type='checkbox' id='inputCheckbox'/&gt;&lt;strong&gt;sdfsf&lt;/strong&gt;&lt;p&gt;dfsfsdsd&lt;/p&gt; </code></pre> <p>From the elements above, I only need to get these elements when the checkbox are selected and omit the input element:</p> <pre><code>&lt;strong&gt;sdfsf&lt;/strong&gt;&lt;p&gt;dfsfsdsd&lt;/p&gt; </code></pre> <p>My attempt:</p> <pre><code>$("#testPatternButton").on("click", function() { $("input:checked").each(function() { alert($(this).parent().children().not("input").html()); // only the strong text shows up }); }); </code></pre>
jquery
[5]
2,415,087
2,415,088
JavaScript stripping the .00 from my decimal?
<p>Was wondering is anyone can shed some light onto why my subtotal is 1, and the .00 is being stripped off the subtotal.</p> <p>price is 1.00, and itemQty is 1.</p> <pre><code>var price = parseFloat(res.productPrice).toFixed(2); var subTotal = price * parseInt(res.itemQty); </code></pre>
javascript
[3]
4,086,244
4,086,245
How to filter a sub list which is part of another list in C#
<p>I want to filter the list which is already part of another list.</p> <p>Consider,</p> <p>Class MainClass</p> <pre><code> properties String Name String MainAddress List&lt;SubClass&gt; ExtraInfo </code></pre> <p>Class SubClass</p> <pre><code> properties String Address String City String PhoneNo </code></pre> <p>Now i have 10 items in my List and each item in List has 2 ExtraInfo items this is List items.</p> <p>Now i want to filter List items with Condition City == "New York".</p> <p>So, all 10 items in the main list (List) should have the ExtraInfo (List) items based on the filter condition.</p> <p>I mean i just want to filter the Sub list not the main list.</p> <p>Thanks in Advance!</p> <p>Sample Data Name MainAddress ExtraInfo Address City Phone No<br> 1. Vimal Bangalore North Street New York 654564646 --->Sub item 1 North Street California 464654565 --->Sub item 2</p> <ol> <li>Hareesh Chennai North Street Washington 546466466 --->Sub item 1 Tower B New York 464645465 --->Sub item 2</li> </ol> <p>After Filter (Condition City == "New York"), I should get the output in the main list like </p> <pre><code> Name MainAddress ExtraInfo Address City Phone No </code></pre> <p>1. Vimal Bangalore North Street New York 654564646 --->Sub item 1</p> <ol> <li>Hareesh Chennai Tower B New York 464645465 --->Sub item 1</li> </ol> <p>Hope this helps!</p>
c#
[0]
4,989,422
4,989,423
app specific keyboard
<p>I don't want to replace the entire soft keyboard. I want to add a Next/Prev buttons when the soft keyboard is deployed when a field in my WebView in the fashion that looks like the display on mylogin.yahoo.com</p> <p><a href="http://imgur.com/a/zH0Ux" rel="nofollow">http://imgur.com/a/zH0Ux</a></p> <p>I have found this on github</p> <p><a href="https://github.com/chrisboyle/sgtpuzzles/blob/master/src/name/boyle/chris/sgtpuzzles/SmallKeyboard.java" rel="nofollow">https://github.com/chrisboyle/sgtpuzzles/blob/master/src/name/boyle/chris/sgtpuzzles/SmallKeyboard.java</a></p> <p>which seems like a reasonable way to accomplish this functionality.</p> <p>Is extending android.inputmethodservice.KeyboardView be a reasonable way to go?</p> <p>Mark</p>
android
[4]
1,127,153
1,127,154
Call a method at fixed time in Java
<p>How do I call a method at a particular time?</p> <p>For example to call the method at 6:00 and 13:00.</p> <p>I'm working at a desktop application for Windows.</p>
java
[1]
4,252,477
4,252,478
How can I extract list items using dictionary keys?
<p>I have list and dictionary like this:</p> <pre><code>list_1 = ['if looks kill then i'm murdering] dic_1 = {"kill": -2, "murdering": -3} </code></pre> <p>I want to extract list items that matches the dictionary key and append it to a set. I have two problems: 1. I cannot extract the list items that matches with key in the dictionary 2. How do I append list items to a set?</p> <pre><code>set_1 = set() for items in list_1: list_1 = items.lower().split() for term in dic_1: forth_list = [words for words in list_1 if term != words] print forth_list </code></pre> <h1>This will print</h1> <pre><code>['if', 'looks', 'then', 'i', 'm', 'murdering'] ['if', 'looks', 'kill', 'then', 'i', 'm'] set_1.add(forth_list) # this produce a TypeError: unhashable type: 'list' print set_1 </code></pre>
python
[7]
5,386,757
5,386,758
how to parse php variable with html?
<p>Hi friends I have created newsletter system. In which I want to send person name like typing Hello %username% in html form, which will be coming from database $username. So when the person get email He will have "Hello Falana".</p> <p>Thanks</p>
php
[2]
5,617,975
5,617,976
Synchronizing android with the web
<p>I was wondering if there are some commonly used techniques for synchronizing an app with a server? I have looked at the socket-framework and maybe some http? I am thinking for instance when making a game or a grocery list, any developers out there who want to share?</p>
android
[4]
55,356
55,357
debug error : max must have union class struct types
<p>this is my code:</p> <pre><code>#include &lt;iostream&gt; using namespace std; class Sp { private : int a; int b; public: Sp(int x = 0,int y = 0) : a(x), b(y) { }; int max(int x,int y); }; int Sp::max(int a,int b) { return (a &gt; b ? a : b); }; int main() { int q,q1; cin &gt;&gt; q &gt;&gt;q1; Sp *mm = new Sp(q,q1); cout &lt;&lt; mm.max(q,q1); return 0; } </code></pre>
c++
[6]
5,975,323
5,975,324
Function point count given source code
<p>Given the source code of a program, how do I analyze it and count the function points within it?</p> <p>Thanks!</p>
java
[1]
4,227,102
4,227,103
PHP Define security issues?
<p><strong>index.php:</strong></p> <pre><code>define("included", true); </code></pre> <p><strong>INCLUDED PAGES:</strong></p> <pre><code>if (included !== true) header('HTTP/1.1 404 Not Found'); </code></pre> <p>The purpose for the codes was to disallow access directly but allow it if included. I am not sure if this opens any risks. I am not allowed to override <code>.htaccess</code> so I am stuck with a PHP alternative.</p> <p>Any help would be much appreciated!</p>
php
[2]
2,328,292
2,328,293
jquery .load() doesn't work after hard refresh for some reason
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/5323042/jquery-load-doesnt-work-after-hard-refresh">jquery .load() doesn&#39;t work after hard refresh</a> </p> </blockquote> <p>I have some code that when the page loads gets the height of an image and then resizes its container div accordingly. This works fine unless its the first time the page has been loaded or i do a hard refresh with ctrl + f5, then it doesn't work. I have tried using</p> <pre><code>$('#div img').load(function() { // put the code here }); </code></pre> <p>But I get the same problem. Anyone know why this is happening?</p> <p>This is my code:</p> <pre><code>$(document).ready(function() { maxheight = 0; $('#venue #main-img img').each(function() { height = $(this).height(); if(height &gt; maxheight) { maxheight = height; } $(this).hide(); }); $('#venue #main-img').animate({ height: maxheight }); $('#venue #main-img img').first().show(); }); </code></pre>
jquery
[5]
5,450,005
5,450,006
How to maintain and access javascript variable which is accesible from all the pages?
<p>I have a temp.js file containing global variable 'num' which is intially set to 0. It has a function Increment() which increments the num by 1.</p> <p>I have 2 html files Page1.html and Page2.html. Both are referring to temp.js file (). Both the pages are having a button on click of which I call a javascript and navigate to the other page. i.e, on button click from Page1.html I navigate to Page2.html and vice versa.</p> <p>Before navigating from any page, I call Increment() function. What I see is num is always intialized to 0 and Increment function sets it to 1. What I want is num be set to 0 for the very first time and later increment by 1 anytime I call the function.</p> <p>Anyway that I can acheive the above. Passing the value using querystring or maintaining masterpage of some kind is ruled out in my scenario.</p>
javascript
[3]
4,479,318
4,479,319
applyTransformation method not invoked in custom animation
<p>The applyTransformation method in my custom Animation is somethimes not being called after I started my animation with view.startAnimation(myAnimation). Is this a known issue?</p>
android
[4]
1,130,617
1,130,618
What should be the Roadmap for JAVA EE
<p>I have done Java SE and want to start JAVA EE. But i am very confused, from where i have to start .So please tell me the roadmap from where to start Java EE ?</p>
java
[1]
3,855,346
3,855,347
Duplicate a DB file[Android]
<p>I'm working with an application that has to download a huge amount of data and insert them to database . I had it to work on a thread . But the problem is , when the thread is doing inserts , a db lock error occurs while my application reads from db . So I'm thinking about a way to avoid this : Copy the existing db file , let a thread to do inserts to this duplicate while my application reads from the original one until the inserts are completed . Then delete the original one and rename the duplicate to the original . My question is , is my way feasible ?</p>
android
[4]
5,214,231
5,214,232
how to make select tag show options by default without clicking
<p>I had created a dropdown using <code>&lt;select&gt;</code> tag and now i want to show the options in <code>&lt;select&gt;</code> without clicking the dropdown(i mean when we open that html, we should be able to see all options instead of clicking on the select ). Is this possible using jQuery or is there any other way to do it.</p> <p>Below is my code in jsfiddle</p> <p><a href="http://jsfiddle.net/sukumar/xtTcZ/" rel="nofollow">http://jsfiddle.net/sukumar/xtTcZ/</a></p> <p>I want the options to be shown like below by default</p> <p><img src="http://i.stack.imgur.com/sGP8Y.jpg" alt="enter image description here"></p>
jquery
[5]
1,550,932
1,550,933
Getting response from Facebook to Android
<p>I am working on book activity App. I have to check whether the user has liked my FaceBook page. After the user pressed like button and sign in, the contents of the chapters will be opened. For that, I need to know whether the user liked my page and after that I need to open my next activity. How to get response from FaceBook. I am totally new to android, help me to proceed.</p> <pre><code>Uri uriUrl = Uri.parse("http://www.facebook.com/"); Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl); startActivity(launchBrowser); </code></pre>
android
[4]
4,214,703
4,214,704
What to do after reading a beginner's book on C#?
<p>I am 16 years old and want to get a job in the programming field in the future. Since I will be applying for a foreign university, I want to start programming by myself and gain experience, both to increase my chances for quality education and for later employment. Last year I learned Java, but whatever motivation I had mustered fizzled out after finishing the book, and I only did some basic work on a project I came up with by myself, before getting stuck and abandoning it.</p> <p>This year, I decided to learn C#. My Java knowledge, however small it may be, would help me pick up and remember more information from a beginner book, and since an year of inactivity without much prior experience warrants a reread anyway, I thought I might as well learn a different-yet-similar language, as opposed to just going through my HF Java for a second time. </p> <p>I picked up Herb Schildt's "C# 3.0 A Beginner's Guide" and finished it. However, I have no idea what to do now. Come up with a random project and work on it (potentially picking up something far beyond my limited ability)? Read up on more advanced topics (even though I don't have any practical experience)? I'm at a loss regarding what to do to actually become a capable programmer, after reading a beginner's book.</p>
c#
[0]
2,483,191
2,483,192
Shorter way to write my if statement in php
<p>Besides shortening the variable name, is there a shorter way to write this code. It hurts my eyes.</p> <pre><code>if($day &gt; 30 &amp;&amp; ($month == 1 || $month == 3 || $month == 5 || $month == 7 || $month == 8 || $month == 10 || $month == 12)) </code></pre>
php
[2]
2,302,157
2,302,158
ASP.NET Event OnAuthenticationFailed?
<p>Is there an event that gets fired right after ASP.NET authentication has failed to identify the user? I need to trigger an alarm every time that happens. Don't offer to implement custom membership provider nor to do it from the Login form's controller. I'm looking for native ASP.NET pipeline event. HttpApplication has two events: one for <strong>before</strong> Authentication and one <strong>after</strong>, but nothing for <strong>failure</strong>.</p>
asp.net
[9]
3,811,152
3,811,153
In JavaScript how can I use a function parameter as the key to an object?
<p>For example the following code prints </p> <blockquote> <p>{ key: 'b' }</p> </blockquote> <pre><code>function myFunc(key, value) { myFunc2({key: value}); } function myFunc2(obj) { console.log(obj); } myFunc('a', 'b'); </code></pre> <p>How would I get it to print </p> <blockquote> <p>{ 'a': 'b' }</p> </blockquote>
javascript
[3]
1,270,780
1,270,781
Architectural solution for jQuery - servlet - WS
<p>I have to develop an application with jQuery in the UI and which will make AJAX call to back end (servlet) which in turns calls another server which is implements restful web service and send response in XML. Servlet will pass the response back to the AJAX to create the UI.</p> <p>The UI will have several functionality and like create/delete user, add group etc. </p> <p>There will be a filter that will get security information from the back end to enforce privilege for the users. Some users will have some functionality disables in the UI itself. Our requirement is to develop the application with flat like interface (that why jQuery) and call the restful web service (which is already there) to delegate the actual functionality.</p> <p>Can any one suggest me a good architectural solution for this. I know the question is too generic but I want only architectural solution. </p>
jquery
[5]
2,294,229
2,294,230
To create generic method for various User defined class in java
<p>I am trying to achieve the following: I have this method</p> <pre><code>public String methodName(Userdefinedclass.class,Userdefinedclass obj) { //some code ......... method(Userdefinedclass.class); method2(obj); } </code></pre> <p>I want to generalise this method.</p> <p>The challenge is that the argument here is user defined, i.e it can change. So please help. </p>
java
[1]
5,530,515
5,530,516
C++: Repeat output i times without an explicit loop
<p>Is there is way to do so <strike>without a loop</strike> writing as less code as possible:</p> <pre><code>for (int i = 0; i &lt; 10; i++) std::cout &lt;&lt; 'x'; </code></pre> <p>Like in python:</p> <pre><code>print 'x' * 10 </code></pre>
c++
[6]
1,275,954
1,275,955
dynamical change td width with js
<p>I need to change the width of a td using javascript. The value of the width will be pulled in and then I need to multiple it to get a percentage. I just need to know how to write the js so far I have got to here but it is not working</p> <pre><code>&lt;script language="JavaScript"&gt; var divWidth = 66*0.4; document.write("&lt;td width="+divWidth+"&gt;"); document.getElementById("myRow").write("&lt;td width="+divWidth+"&gt;"); &lt;/script&gt; &lt;table&gt; &lt;tr&gt; &lt;td id="myRow"&gt;&lt;/td&gt; &lt;/tr&gt; </code></pre> <p></p> <p></p>
javascript
[3]
4,666,981
4,666,982
Forward declaration issues
<p>Here is my issue.</p> <p>I have 2 classes which I want to implement in 1 h file</p> <p>lets call them class Foo and class Bar. My issue is that Bar has functions which have a return value of Foo and Foo has functions with a return value of Bar.</p> <p>Therefore, how do I properly forward declare these so they can play nice with each other.</p> <p>Thanks</p>
c++
[6]
2,401,687
2,401,688
How can I replace newlines/line breaks with spaces in javascript?
<p>I have a var that contains a big list of words (millions) in this format: </p> <pre><code>var words = " car house home computer go went "; </code></pre> <p>I want to make a function that will replace the ENTER between each word with space. so the results would look like some like this:</p> <pre><code>car house home computer go went </code></pre>
javascript
[3]
5,673,969
5,673,970
C# datetime midnight time Format
<p>I want to run a report where i want to pass parameters as starttime which is yesterday 12 am(midnight) and enddate as today 12 am (mid night), how to get midnight time in datetime format in c#</p>
c#
[0]