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,524,343
2,524,344
How do I combine my jQuery and set default content if no click
<p>It's possible to combine my jQuery below in simple code?</p> <pre><code>$(document).ready(function () { $("a.type").live('click', function () { var type = $(this).data("id"); $('#advertisements').load("ads.php?" + type); }); $("a.maincat").live('click', function () { var maincat = $(this).data("id"); $('#advertisements').load("ads.php?" + maincat); }); $("a.subcat").live('click', function () { var subcat = $(this).data("id"); $('#advertisements').load("ads.php?" + subcat); }); $("a.region").live('click', function () { var region = $(this).data("id"); $('#advertisements').load("ads.php?" + region); }); $("a.byuser").live('click', function () { var byuser = $(this).data("id"); $('#advertisements').load("ads.php?" + byuser); }); }); </code></pre> <p>and according to this code how do I load default content is by <code>$('#advertisements').load("ads.php?" + 1);</code></p> <p>Currently need to click for load a specific content.</p> <p>Let me know</p>
jquery
[5]
1,167,849
1,167,850
Can you program Android Apps in a functional language?
<p>Can you program Android Apps in a functional language?</p> <p>I meant is it possible to program for Android in a language that was designed from the ground up to be functional? I'm aware that you can use the functional components of an OO or a procedural language to program in a functional style, I was asking whether it would be applicable to use one of the "functional languages" on Android.</p>
android
[4]
2,112,039
2,112,040
ASP.NET 4 release?
<p>When will ASP.NET 4.0 be released?</p>
asp.net
[9]
4,857,048
4,857,049
Exception in thread "main" java.lang.NoClassDefFoundError:after setting PATh and CLASSPATH
<p>I have tried to write a program where i want to access class in a jar.</p> <p>I am using netbeans as ide,Windows 7 os and have added jar in the libraries. But i keep getting the error.</p> <pre><code>Exception in thread “main” java.lang.NoClassDefFoundError:after setting PATh and CLASSPATH I have set the PATh variable to my &lt;jdk directory&gt;/bin; CLASSPATH to %CLASSPATH%; and JAVA_HOME to &lt;jdk directory&gt; &lt;jdk directory&gt; =C:\Program Files\Java\jdk1.7.2 </code></pre>
java
[1]
1,385,967
1,385,968
Manipulate a number algorithim
<p>How can I fix this algo?</p> <pre><code>def change_num(n, direc, numMove): if direc == 'back': nums = range(10) return nums[n-numMove] elif direc == 'forward': nums = range(10) nums.reverse() return nums[n-numMove]-1 </code></pre> <p>This doesn't work for direc == 'back' here are some sample expected returns:</p> <pre><code>0 1 2 3 4 5 6 7 8 9 change_num(1,'back', 5) -&gt; 6 change_num(5,'back', 1) -&gt; 4 change_num(7,'forward',5) -&gt; 2 change_num(0,'forward',5) -&gt; 5 </code></pre> <p>Do you understand how the algo works? I'm just not implementing it right. Thanks</p>
python
[7]
2,054,461
2,054,462
Android Notification Icon
<p>I am giving notification by a background service. In notification i am displaying an image , image dimensions are 15*15. But when image is showed it automatically streches to big size , so it became blur. I haven't specified the image size in my program. Why this is happening</p>
android
[4]
4,134,855
4,134,856
jQuery .each inside function
<p>I dont know why .each() not working here in my code</p> <pre><code>function showhide(id){ $('#mydiv'+id).each(function(){ if(this).is(":visible") ) { $(this).css('display','none'); }else { $(this).css('display','block'); } }); } &lt;span id="mydiv" style="display:none;"&gt; blah blah blah &lt;/span&gt; &lt;a href="#" onclick="showhide($id);return false;" /&gt;show/hide&lt;/a&gt; </code></pre>
jquery
[5]
4,342,472
4,342,473
TabStrip control for ASP.NET
<p>Is this still available? I am unable to find it when I try to add it to my Toolbox.</p>
asp.net
[9]
5,565,382
5,565,383
Change count into an array of letters, python
<p>I am struggling with an idea I want put into a python script. I'm not even sure how to ask the most appropriate question as I've been surfing through the net trying to find what I want with no luck.</p> <p>Basically, I have a script that does a simple calculation:</p> <pre><code>divider = int(math.ceil(df.scale / 3000)) </code></pre> <p>This is because I want ' divider' to return the value divided by 3000 and always rounded up. I want to use that value to help me return letters.</p> <p>So, it goes like this:</p> <p>if 1 returns then I want a to return 'A' if 2 returns, then I want to create 'A', 'B' if 3 returns, then I want to create 'A', 'B', 'C' and so on....</p> <p>My end result is, that I want to save some files. 'divider' will determine how many files I want to save and then each file will recursively be named with the letter in it (i.e. FileA, FileB, FileC...)</p> <p>Ok, I know my question isn't exactly well put together, but I'm struggling with the logic, so if you need some clarity, please let me know.</p>
python
[7]
3,468,600
3,468,601
Where can I find some "humanized" C# tutorials?
<p>I've decided to start learning C#, but all the tutorials I can find are very dry and speak to the reader as if the reader is a machine.</p> <p>How about some tutorials that talk to me like I'm a human?</p>
c#
[0]
4,193,414
4,193,415
ajax Confirm button extender if textbox is empty.asp.net
<p>I want confirm button extender to pop up when Particular TextBox is empty in Grid View.</p> <p>How to do that? Thanks in advance. Any help would be appreciated.</p>
asp.net
[9]
4,617,047
4,617,048
How do I download a torrent using python and Torrent reactor API?
<pre><code>http://www.torrentreactor.to/torrents_search_rss.php </code></pre> <p>How do I make the API call and then once I have the XML response , I want to auto select a single file with the highest no. of seeds and peers and download it automatically . How do I do it in python ?</p> <p>Note: I tried coding it but it gave me a response saying <code>error:invalid order creation</code> </p>
python
[7]
2,638,559
2,638,560
C#: Adding DLL Reference
<p>Preface: I know basically nothing about C#. I've added a dll to my project. I have no build errors, but when I try to run, I get an error that says it can't find the dll. I've tried copying it to the output directories too. To no avail.</p> <p>Any idea what could be happening?</p> <p>Specific Error:</p> <blockquote> <p>System.IO.FileNotFoundException was unhandled Message=Could not load file or assembly 'controllib_clr.dll' or one of its dependencies. The specified module could not be found. Source=controllib_demo_cs...</p> </blockquote> <p>I'll be happy to add more information if need be. :) I just don't know what info would be beneficial given my (very) limited knowledge.</p>
c#
[0]
1,043,750
1,043,751
is operator confusion
<p>is operator compare the memory addresses of two object if they are same , then returns true otherwise false. <strong>Code #1</strong></p> <pre><code>&gt;&gt;a="poi" &gt;&gt;b="poi" a is b true </code></pre> <p>I have created two objects whose content is same but they are entire living on different memory addresses. Then why is operator returns true ? shouldn't it return false. Just like this code</p> <pre><code>&gt;&gt;ktr = "today is a fine day" &gt;&gt;ptr = "today is a fine day" &gt;&gt;ktr is ptr false </code></pre>
python
[7]
232,989
232,990
jquery too much recursion on multiple blur function
<p>I am checking some textboxes on blur, some need to be checked against the same critera so I put these all in one blur function. I have noticed that my page seems slow and in firebug I keep gettin the error <code>too much recursion</code> . </p> <p>My code is below, it checks the textbox and then sends the ID to another function which adds a class to say if it is valid or not valid.</p> <pre><code>$('#username, #customerName, #customerTown, #customerCounty, #contactName, #staffFirstname, #staffLastname, #staffTown, #staffCounty').blur(function() { var ID = $(this).attr('id'); var val = $(this).val(); if(validate(val)) { valid(ID); } else { notValid(ID); } }); function valid(elementID) { $('#'+elementID+'Img').html('&lt;img src="../images/tick.png" alt="Valid" title="Valid" /&gt;'); $('#' + elementID).addClass('valid'); } function notValid(elementID) { $('#'+elementID+'Img').html('&lt;img src="../images/cross.png" alt="Not Valid" title="Not Valid" /&gt;'); $('#' + elementID).removeClass('valid'); } function validate(val) { var reg = new RegExp ("^([a-zA-Z ]){3,90}$"); var regTest = reg.test(val); if(regTest) { return true; } else { return false; } } </code></pre> <p>Would it be better if I did a seprate <code>blur</code> function for each textbox? Or is there another way? I don't really want to write a blur function for every single textbox.</p> <p>Any suggestions? Thanks.</p>
jquery
[5]
890,076
890,077
can any one tell me what is wrong in my java code
<pre><code>import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.Stack; import java.util.StringTokenizer; public class shift { @SuppressWarnings("unchecked") public static void main(String args[]) { String speech = "Sentence:NounPhrase VerbPhrase:NounPhrase :Art Noun:VerbPhrase : Verb | Adverb Verb: Art : the | a : Verb :jumps | sings |: Noun:dog | cat | "; HashMap&lt;String, String&gt; hashmap = new HashMap&lt;String, String&gt;(); String a; StringTokenizer st = new StringTokenizer(speech,":"); while (st.hasMoreTokens()) { String key=st.nextToken().trim(); String value=st.nextToken().trim(); StringTokenizer st1 = new StringTokenizer(value,"|"); while (st1.hasMoreTokens()) { a=st1.nextToken().trim(); hashmap.put(key, a); } } Set set = hashmap.entrySet(); Iterator ia = set.iterator(); while(ia.hasNext()) { Map.Entry me = (Map.Entry)ia.next(); System.out.println(me.getKey()+"-&gt;"+me.getValue()); } } } the output is Noun-&gt;cat NounPhrase-&gt;Art Noun Art-&gt;a Sentence-&gt;NounPhrase VerbPhrase Verb-&gt;sings VerbPhrase-&gt;Adverb Verb </code></pre> <p>this code is missing some values to return such as the <code>the jumps etc are not show</code></p>
java
[1]
1,710,865
1,710,866
Number formatting: how to convert 1 to "01", 2 to "02", etc?
<p>I'm new to C#. I have numbers like 1,2,3 and I would like to make them into strings "01","02" and "03". Can someone tell me how I can do this. </p>
c#
[0]
4,868,679
4,868,680
Separating Loading data and UI via threading in Objecive C/Cocoa
<p>I'm currently developing an iPhone application that loads data via a webservice into a table. Right now I have it loading the data and creating/displaying my cells via [tableView cellForRowAtIndexPath] on two separate threads. My problem is that I need the data to create my cells. </p> <p>So currently I load my data into an array on one thread and lock the cell creation part on the other thread until completion. Once completed I go back to my main thread, unlock the cell creation part and continue. </p> <p>This actually makes the whole process slower. I'm trying to figure out a design so that I can speed up this process. Can someone help? </p> <p>Thank you to all that reply.</p>
iphone
[8]
3,133,262
3,133,263
nsinputstream to string?
<p>Is there anyway to view the values in a nsinputstream such as converting it to a string?</p>
iphone
[8]
4,953,518
4,953,519
A question about exception catching in Java
<p>I have an instance method, and within it, I did a simple webpage parsing:</p> <pre><code>public void doOperation(final AuthorAccess authorAccess, ArgumentsMap arguments) throws IllegalArgumentException,AuthorOperationException { final String server = "chiexist1.worldbook.com"; final String port = "8080"; try { docBuilder = docFactory.newDocumentBuilder(); doc = docBuilder.parse("http://" + server + ":" + port + "/exist/webdav/db/portfolio/config/products.xml"); ...} catch{} } </code></pre> <p>Because currently I am hard-coding the server address in the string, there might be situations where the server name is not right, so in that case, I want it to automatically to change the server URL string to "localhost".</p> <p>I think an if-else statement probably would work, but I am not very sure how to determine the boolean variable for detecting whether this parsing is failed or not. I also think of putting this in the catch statement, but what about other statements are also throwing exceptions?</p> <p>I've also checked the API for DocumentBuilder, the parse() method always return a Document Type but not boolean. So I would be grateful if anyone could give me some suggestions here on how to detect the wronged URL and then change to parsing localhost instead, thanks in advance.</p>
java
[1]
2,389,937
2,389,938
Unable to create .xlsx file ASP.NET
<p>I'm able to create .xls. I unable to create .xlsx file using asp.net. could </p> <p>you help someone on the same.</p> <p>thanks in advance.</p>
asp.net
[9]
440,131
440,132
How to avoid the crash when I scroll the tableview
<p>I am developing one application.In that when I scroll the table view then the application is crashing. So please tell me how to avoid the crashing when I scroll the table view.</p>
iphone
[8]
5,773,286
5,773,287
android Get the azimuth of phone when picture was taken
<p>I can use the SensorManager and SensorEventListener to get the azimuth. I am wondering if the built in Intent to capture an image provides the azimuth or orientation? Thanks Jon</p>
android
[4]
3,829,975
3,829,976
Android: How to check if an Activity has an options menu?
<p>Given an Activity object, is there a way to determine whether it has an options menu?</p>
android
[4]
8,160
8,161
JQuery effects behind the scenes
<p>I'm learning some basics about JQuery. When I learn about something, I always try to imagine how works behind the scenes, but I don't imagine how some effects really are done.</p> <p>For example some simple .hide(slow) is an example. As I understand, JQuery modifies HTML code of HTML components. A ".hide" without animation seems pretty "obvious", I guess "visibility:none" would do the trick.</p> <p>But animation implies something more interesting I guess. The first idea is a loop that changes attributes and expect rendering is fast enough to make a smooth animation. But it sounds pretty "CPU abusive".</p> <p>How it's really done?</p> <p>Edit: I don't consider even an average JS programmer, so reading the original source code is quite difficut. I was looking for some "big picture" explanation. Maybe the word <strong>really</strong> wasn't appropiated.</p>
jquery
[5]
3,215,243
3,215,244
Convert 64 bit Integer hex string to 64 bit decimal string on 32 bit system
<p>What is a simple way to convert a 64 bit integer encoded as a hex string to a decimal string on a 32 bit system. It needs to be the full value, it can not be in scientific notation or truncated :/</p> <p>"0c80000000000063" == "900719925474099299"</p> <p>"0c80000000000063" != 9.007199254741E+17</p> <p>PHP's base_convert() and hexdec() don't do the job right.</p>
php
[2]
3,107,733
3,107,734
Using enum as a class in java
<p>I have a class with <strong>enum</strong> in it and class, which contains <strong>list</strong> of that objects</p> <pre><code>public enum State { ACTIVE,NOT_ACTIVE; } public class SomeObject { State state; public SomeObject(State state) { this.state = state; } } public class SomeObjects{ State state; ArrayList&lt;SomeObject&gt; objects = new ArrayList&lt;Main.SomeObject&gt;(); public SomeObjects(int count) { state = State.ACTIVE; for (int i = 0; i &lt; count; i++) { objects.add(new SomeObject(state)); } } public void changeState(State state) { this.state = state; } } </code></pre> <p>And now if I use <code>changeState(State.NOT_ACTIVE)</code> it will change state in <strong>SomeObjects</strong> and in all Objects in <strong>list</strong> or only in SomeObjects?</p> <p>If only in <strong>SomeObjects</strong>, what should I do to <strong>change state</strong> in all Objects in list with <code>changeState()</code>?</p> <p>Is the creating of class, containing that enum, the <strong>only way</strong> in this case?</p> <p><strong>UPDATE:</strong> thanks, but in my case i need to change state of all objects with </p> <pre><code>this.state = state; </code></pre>
java
[1]
5,190,665
5,190,666
Python character count
<p>I have been going over python tutorials in this <a href="http://openbookproject.net/thinkcs/python/english2e/ch10.htmloutfile.close%28%29" rel="nofollow">resource</a>. Everything is pretty clear in the below code which counts number of characters. Only section that i dont understand is the section where count assigned to a list and multiplied by 120. Can anyone explain what is the purpose of this in plain english please.</p> <pre><code>def display(i): if i == 10: return 'LF' if i == 13: return 'CR' if i == 32: return 'SPACE' return chr(i) infile = open('alice_in_wonderland.txt', 'r') text = infile.read() infile.close() counts = 128 * [0] for letter in text: counts[ord(letter)] += 1 outfile = open('alice_counts.dat', 'w') outfile.write("%-12s%s\n" % ("Character", "Count")) outfile.write("=================\n") for i in range(len(counts)): if counts[i]: outfile.write("%-12s%d\n" % (display(i), counts[i])) outfile.close() </code></pre>
python
[7]
4,410,956
4,410,957
How to move the qtip tip based on the mouse over
<p>I am using qtip for the tool tip and i moved the tool tip based on the cursor. Shall i call function to move the arrow pointer from left to right and then right to left dynamically. Hoe will i change the tip left position from 10% to 95% on the mouse move. </p> <pre><code>jQuery('.fire-object a img').each(function() { jQuery(this).qtip({ // within an each() loop, $(this) refers to the trigger content: jQuery(this).attr('title'), style: { width: 110, padding: 5, background: '#FFFFFF', color: 'black', textAlign: 'center', border: { width: 7, radius: 5, color: '#FFFFFF' }, tip: 'bottomLeft', name: 'dark' // Inherit the rest of the attributes from the preset dark style }, position: { my: 'left top', target: 'mouse', viewport: $(window), // Keep it on-screen at all times if possible adjust: { x: 10, y: 10 } }, hide: { fixed: true // Helps to prevent the tooltip from hiding ocassionally when tracking! } }); }); </code></pre> <p><a href="http://craigsworks.com/projects/qtip/demos/effects/multitooltip" rel="nofollow">example</a> Any ideas? Thanks in advance.</p>
jquery
[5]
446,429
446,430
PHP List Structure
<p>Let's say I have an array containing these items:</p> <pre><code>$test = array(Item1, Item2, Item3, Item4, Item5, Item6, Item7, Item8, Item9); </code></pre> <p>How can I print this structure using for, or foreach?</p> <pre><code>&lt;ul&gt; &lt;li&gt; &lt;ul&gt; &lt;li&gt;Item 1&lt;/li&gt; &lt;li&gt;Item 2&lt;/li&gt; &lt;li&gt;Item 3&lt;/li&gt; &lt;li&gt;Item 4&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt; &lt;ul&gt; &lt;li&gt;Item 5&lt;/li&gt; &lt;li&gt;Item 6&lt;/li&gt; &lt;li&gt;Item 7&lt;/li&gt; &lt;li&gt;Item 8&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt; &lt;ul&gt; &lt;li&gt;Item 9&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre>
php
[2]
6,023,514
6,023,515
Jumping content after $(document).ready() executed
<p>This question is related to my previous question</p> <p><a href="http://stackoverflow.com/questions/6701591/vertical-floating-div">Vertical floating div</a></p> <p>So first when page is load floating div appeared in left:0, top:0 and than after some delay it is getting moved to the position according with logic defined in $(document).ready() </p> <p>So the question is how to avoid such kind of behavior is there something i can do to avoid that?</p> <p>Is there any way beautify load such kind of content, to display content only after $(document).ready() or something?</p>
jquery
[5]
4,249,616
4,249,617
What is the default value of android:vmSafeMode?
<p>I'm trying to understand a bit more about the JIT compiler optimization. Is this optimization automatically enabled? Why wouldn't I want this option enabled?</p> <p>This is my manifest sdk target:</p> <pre><code>&lt;uses-sdk android:minSdkVersion="4" android:targetSdkVersion="15" /&gt; </code></pre>
android
[4]
5,941,143
5,941,144
Problem with require() when using a fully qualified URL
<p>So, my code was using relative paths, but running into some problems with common files which could be include/required from different directory levels.</p> <p>Absolute paths are more efficient anyway, right? So, I changed all include/require to absolute paths, using <code>require_once('http://' . $_SERVER['HTTP_HOST'] . 'file_name.php');</code></p> <p><code>$_SERVER['HTTP_HOST']</code> is correct, isn't it? It seemed so when I googled. </p> <p>That required me to set 'allow_url_include=on` in php.ini and restart Apache.</p> <p>So, now I have a situation that looks something like this (simplified example):</p> <p>File2.php contains</p> <pre><code>&lt;?php function hello() { echo 'hello&lt;br&gt;'; } ?&gt; </code></pre> <p>and if file1.php contains</p> <pre><code>&lt;?php require_once('file2.php'); hello(); ?&gt; </code></pre> <p>then I see the expected output "hello", <strong>but</strong> if I change that line to </p> <pre><code> require_once('http://' . $_SERVER['HTTP_HOST'] . '/file2.php'); </code></pre> <p>Then I get "Fatal error: Call to undefined function hello() in C:\xampp\htdocs\file1.php"</p> <p>(I guess that the reference to c:\xammp\httdos came from Xdebug, because PhpInfo shows HTTP_HOST localhost)</p> <p>Anyway, that's a long post to say that I am missing some simple point and to ask what it is.</p>
php
[2]
5,495,636
5,495,637
Making a Certain Color on a BufferedImage Become Transparent
<p>A very similar question that has been answered: <a href="http://stackoverflow.com/questions/665406/how-to-make-a-color-transparent-in-a-bufferedimage-and-save-as-png">How to make a color transparent in a BufferedImage and save as PNG</a></p> <p>Unfortunately I couldn't formulate an answer for myself out of that source.</p> <p><strong>Q:</strong> I draw a BufferedImage to my Canvas and would simply like to create a method that turns every pixel with the a certain color (in this case: [214, 127, 255] / 0xD67FFF) into a transparent one. The BufferedImage is of type ARGB. </p> <p><em>I do not want to save the BufferedImage as a file, simply display it on my canvas.</em></p> <p>Thanks in advance.</p>
java
[1]
319,772
319,773
Need to combine these two javascripts
<p>I would like to run both of these scripts..</p> <pre><code>var myScroll; function loaded() { myScroll = new iScroll('wrapper', { scrollbarClass: 'myScrollbar' }); } document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false); document.addEventListener('DOMContentLoaded', loaded, false); </code></pre> <p>I want to add this below in addition to what is above.</p> <pre><code>var myScroll; function loaded() { myScroll = new iScroll('wrapper', { snap: true, momentum: false, hScrollbar: false, onScrollEnd: function () { document.querySelector('#indicator &gt; li.active').className = ''; document.querySelector('#indicator &gt; li:nth-child(' + (this.currPageX+1) + ')').className = 'active'; } }); } document.addEventListener('DOMContentLoaded', loaded, false); </code></pre>
javascript
[3]
1,495,343
1,495,344
How to learn Python: Good Example Code?
<p>I have been dabbling in Python for a couple months now, read the online docs/tutorial and started playing with Django a bit as well... and I feel like I am starting to leave my formative toddler years and ready for some more serious code. Most everything I see is generally encapsulated in a single script or so large and unwieldy I don't know where to start. </p> <p>I would really like to see an excellent example of some proper Python code, style, organization etc. and ideally a WHY associated with some of those decisions. Any ideas for where I should look next? I would prefer a simple console app with at most just a few extra .py files (maybe one package for good measure)...</p> <p>Oh, and one more thing: The reason this is coming up is I have quite a bit of experience in Java and .NET where it is generally preferred to have one class definition per source file. That rarely seems to be the case in the python world (at least in my very limited exposure) and it just doesn't smell right to me. So maybe this is more Enterprise Python that hobbyist python or something.</p>
python
[7]
3,799,232
3,799,233
display default value when i nothing selected from spinner array android
<p>i make a spinner put the value in spinner using array,now even i was not select any value from spinner it automatically takes first value from spinner array, i want to set default value when nothing is selected form spinner array by user,means i get default value which i set ,when i was not selected any value, is this possible, and what is the use of onNothingSelected(AdapterView ....below code should run when user select manually any value from spinner but it run always and get first value which is in array,so pls tell how to get default value when i nothing selected from spinner, can i use on nothing selected method..?</p> <pre><code>ArrayAdapter&lt;String&gt; CurrencyAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_dropdown_item_1line, Currency); currency.setAdapter(CurrencyAdapter); currency.setOnItemSelectedListener( new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id) { } @Override public void onNothingSelected(AdapterView&lt;?&gt; parent) { } }); </code></pre>
android
[4]
5,019,270
5,019,271
PHP: calling domain.com/filename/id1234
<p>how do i setup my php file so it can be called from domain.com/filename.php?id=12345 to domain.com/filename/12345 ?</p> <p>THANKS!</p>
php
[2]
4,027,588
4,027,589
C#: how to check and display the content of a folder?
<p>I'm not sure whether this topics has been disscussed before or not, but I'm not sure the exact word to search for it. What method/class should I use?</p> <p>The program has 3 buttons: <strong>1) for folder browsing, 2) scan for the selected folder content, and 3) open the file.</strong> When user browse the selected folder*<em>(1)<strong>, user click scan button to scan from the first file until the last available files and listed it text box</strong>(2)</em>* and from that user can decide whether to open the files or not*<em>(3)</em>*.</p> <p>Here are what have I done so far (no 1 and 3):</p> <pre><code>//For browse. private void browse2() { if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) { this.txtDest.Text = folderBrowserDialog1.SelectedPath; } } //For opening folder. private void btnOpen_Click(object sender, EventArgs e) { try { Process.Start(txtDest.Text); } catch { MessageBox.Show("Please select one file/folder"); } } </code></pre>
c#
[0]
3,206,726
3,206,727
'was not declared in this scope' error
<p>So I was writing this simple program to calculate the day of any date using the Gaussian algorithm found <a href="http://en.wikipedia.org/wiki/Determination_of_the_day_of_the_week#Gaussian_algorithm" rel="nofollow">here</a>.</p> <pre><code>#include &lt;iostream&gt; using namespace std; //Using the Gaussian algorithm int dayofweek(int date, int month, int year ){ int d=date; if (month==1||month==2) {int y=((year-1)%100);int c=(year-1)/100;} else {int y=year%100;int c=year/100;} int m=(month+9)%12+1; int product=(d+(2.6*m-0.2)+y+y/4+c/4-2*c); return product%7; } int main(){ cout&lt;&lt;dayofweek(19,1,2054); return 0; } </code></pre> <p>It's a very simple program and what's even more puzzling is the output.</p> <pre><code>:In function dayofweek(int, int, int)’: :19: warning: unused variable ‘y’ :19: warning: unused variable ‘c’ :21: warning: unused variable ‘y’ :21: warning: unused variable ‘c’ :23: error: ‘y’ was not declared in this scope :25: error: ‘c’ was not declared in this scope </code></pre> <p>It says that my variable is unused but then says that it isn't declared? Could anyone please tell me whats wrong.</p>
c++
[6]
2,169,475
2,169,476
C# Anonymous and returning filtered properties with JSON
<p>What is the best way to return only few properties to JSON Result from a collection IEnumerable?</p> <p>Department object has 7properties I only need to 2 of them in client. Can I do this using C# anonymous types?</p> <pre><code> public class Department { public string DeptId { get; set; } public string DeptName { get; set; } public string DeptLoc1 { get; set; } public string DeptLoc2 { get; set; } public string DeptMgr { get; set; } public string DeptEmp { get; set; } public string DeptEmp2 { get; set; } } [HttpGet] public JsonResult DepartmentSearch(string query) { IEnumerable&lt;Department&gt; depts = DeptSearchService.GetDepartments(query); //Department object has 15 properties, I ONLY need 2 (DeptID and DeptName) in the view via returns JSON result) return Json(depts, JsonRequestBehavior.AllowGet); // I don’t want all the properties of a department object } </code></pre>
c#
[0]
3,448,522
3,448,523
How do I pass parameters in window.open method
<p>How do I pass parameters in window.open method.</p> <pre><code>&lt;table id="tblUsers" cellspacing="0" &gt; &lt;asp:Repeater ID="repUsers" runat="server"&gt; &lt;ItemTemplate&gt; &lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;a ID="hlUser" runat="server" Target="_new" onclick="return OpenWindow();" &gt;&lt;%# Eval("Username") %&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&gt; &lt;/table&gt; function OpenWindow() { var toUsername = document.getElementById("hlUser"); window.open("ChatWindow.aspx?username=" + toUsername.value, "ChatWindow", "width=350,height=250"); return null; } </code></pre>
asp.net
[9]
4,650,505
4,650,506
what does this function declaration mean in c++
<pre><code>virtual const char* what() const throw() { } </code></pre> <p>AFAIK function what will return a constant pointer to a mutable char.the rest i am not sure. could nybody help?</p>
c++
[6]
5,771,675
5,771,676
Saving some Rich text boxes value
<p>I have recently started programming using c#.net I have designed a windows form that it has some Richtextboxes. I wanna save all of these richtextbox just in a .txt file and I want that when I open this .txt file on the this form all of the richtextbox`s value get opened on this form I wonder if some one help me.</p>
c#
[0]
323,964
323,965
Why can't my inner class see my outer class object?
<pre><code>import javax.swing.*; import javax.swing.event.*; public class NewGUIStuff{ public static void main(String args[]){ NewGUIStuff gui = new NewGUIStuff(); gui.go(); } class handlesListListeners implements ListSelectionListener{ public void valueChanged(ListSelectionEvent lse){ list.setVisibleRowCount(4); } } public void valueChanged(ListSelectionEvent lse){ } public void go(){ JFrame frame = new JFrame(); JPanel panel = new JPanel(); JList list; String[] aList = {"alpha","beta","gamma","delta","epsilon","zeta","eta","theta"}; list = new JList(aList); list.addListSelectionListener(new handlesListListeners()); JScrollPane scroller = new JScrollPane(list); scroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); frame.setContentPane(scroller); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(300,300); frame.setVisible(true); } } </code></pre> <p>So my question here is if inner classes can see their outer classes variables and objects, why can't the inner-class <code>handlesListListeners</code> see the <code>list</code> object I made in <code>NewGUIStuff</code> outer class?</p>
java
[1]
5,634,736
5,634,737
How to lock back button
<p>I want to lock back button while my data process. I use AsyncTask to process data as below:</p> <pre><code>class Process extends AsyncTask&lt;String, String, String&gt; { @Override protected void onPreExecute() { super.onPreExecute(); progDailog = new ProgressDialog(ShareFolderActivity.this.getParent()); progDailog.setMessage("Loading..."); progDailog.setIndeterminate(false); progDailog.setMax(100); progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progDailog.setCancelable(true); progDailog.show(); lock = true; } @Override protected String doInBackground(String... aurl) { //process return null; } @Override protected void onPostExecute(String unused) { super.onPostExecute(unused); PostLoad(); progDailog.dismiss(); lock = false; } } </code></pre> <p>And below onBackPressed():</p> <pre><code>@Override public void onBackPressed() { if(!lock) { //back action } } </code></pre> <p>When at doInBackground back button be pressed, the back action not do, but the progDailog dismiss. How can I modify to avoid it dismiss?</p>
android
[4]
5,530,866
5,530,867
PHP, process and split CSV-file
<p>A S0-logger comes with a csv file on a monthly base. The file is updated every 5 minutes and can be retrieved any moment. At the end of the month the file counts over 8500 rows. When a new month starts a new file is made.</p> <p>Fileformat is like this:</p> <pre><code>Datum / Uhrzeit (UTC);Main meter - Sales office (kWh);Meter 9;Temperature - Server room;Supply conductor air conditioner 01.06.12 00:00:00;438.220;0.001;274;155 01.06.12 00:05:00;438.240;0.001;274;203 01.06.12 00:10:00;438.259;0.001;275;134 01.06.12 00:15:00;438.283;0.001;274;176 01.06.12 00:20:00;438.303;0.001;274;206 </code></pre> <p><code>dd.mm.yy</code> (This is european dateformat)</p> <p>I want to split the monthly file into a daily file with filename yymmdd.csv and store these files for further use and processing. There is no use for the column names.</p> <p>During the day, its data is updated every five minutes, but after a day is finished there is no need to reprocess this data, because nothing changes. I found out fgetcsv is the most appropriate method. But how to prevent the reprocessing of the data which is rather time consuming and unnecessary?</p>
php
[2]
5,704,624
5,704,625
Cross origin requests are only supported for HTTP but it's not cross-domain
<p>i'm using this code to make an ajax request:</p> <pre><code>$("#userBarSignup").click(function(){ $.get("C:/xampp/htdocs/webname/resources/templates/signup.php", {/*params*/}, function(response){ $("#signup").html("TEST"); $("#signup").html(response); }, "html"); </code></pre> <p>But from the Google Chrome javascript console i keep receiving this error:</p> <blockquote> <p>XMLHttpRequest cannot load file:///C:/xampp/htdocs/webname/resources/templates/signup.php. Cross origin requests are only supported for HTTP.</p> </blockquote> <p>The problem is that the <code>signup.php</code> file is hosted on my local web server that's where all the website is run from so it's not cross-domain.</p> <p>How can i solve this problem?</p>
javascript
[3]
5,910,576
5,910,577
How to get the value of non- public members of picturebox?
<p>I need to get the value of Image rectangle from Non public members of picturebox.</p> <p>How to get that value?</p> <p>Thanks in advance.</p>
c#
[0]
6,006,043
6,006,044
Best way to take the content from an LI tag and copy it elsewhere?
<p>I'm trying to take content from a list (but not including the LI tag wrapped around it) and copy it elsewhere.</p> <p>I've got this fiddle here: <a href="http://jsfiddle.net/csaltyj/u5tFb/" rel="nofollow">http://jsfiddle.net/csaltyj/u5tFb/</a></p> <p>I simply cannot figure this out. How do I get this working right?</p> <p>HTML:</p> <pre><code>&lt;div id="container"&gt; &lt;/div&gt; &lt;ul&gt; &lt;li&gt;&lt;p&gt;Text 1&lt;/p&gt;&lt;em&gt;Text 2&lt;/em&gt;&lt;/li&gt; &lt;li&gt;Gonna copy me too?&lt;/li&gt; &lt;li&gt;&lt;h3&gt;We're gonna be in DIVs!&lt;/h3&gt;&lt;/li&gt; &lt;/ul&gt; &lt;button id="copy"&gt;Copy&lt;/button&gt; &lt;button id="clear"&gt;Clear DIV&lt;/button&gt; </code></pre> <p>CSS:</p> <pre><code>#container { background: #eee; } #container .special { border: 1px solid red; } li { list-style-type: disc; margin: 1em; } </code></pre> <p>jQuery:</p> <pre><code>$('#copy').click(function() { $('li').each(function(i) { $(this).clone().contents().wrap('&lt;div class="special" /&gt;').appendTo('#container'); }); }); </code></pre> <p>jQuery:</p>
jquery
[5]
1,967,365
1,967,366
How to declare a generic type Multi-Dimensional array in java
<p>I want to store an array of 100 int elements in rows ie 1 row of 100 int datatypes.And every single element contains an array of 100 objects.How to do this in java or android. </p>
java
[1]
5,983,407
5,983,408
Change the Default Height of PickerControl
<p>I want to increase of decrease the default height of UIPickerControl in iPhone Application.</p> <p>May i know how to do this ?</p>
iphone
[8]
2,696,390
2,696,391
vim could not load library python27.dll
<p>I need Windows 7 + vim + python for writing vim plugins.</p> <pre><code>:python print("hello") E370: Could not load library python27.dll E263: Sorry, this command is disabled, the Python library could not be loaded. </code></pre> <p>Tried everything:</p> <ul> <li>reinstalled vim</li> <li>uninstalled all my 64bit python versions and installed 32bit ones</li> <li>reinstalled vim again</li> <li>restarted computer</li> <li>punched desk and keyboard</li> <li>restarted computer</li> </ul>
python
[7]
1,813,050
1,813,051
My android local host not working
<p>I am trying to send data to my php file and get response but couldn't able to do it I don't know why but i am not receiving any value on my php server. Please help me out</p> <p>Android Code:</p> <pre><code>HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://10.0.2.2/first.php"); try { List&lt;NameValuePair&gt; nvp= new ArrayList&lt;NameValuePair&gt;(2); nvp.add(new BasicNameValuePair("uid", "mirza")); nvp.add(new BasicNameValuePair("pass", "mirza")); httppost.setEntity(new UrlEncodedFormEntity(nvp)); HttpResponse response = httpclient.execute(httppost); } catch(IOException e){ } } </code></pre> <p>PHP CODE:</p> <pre><code>$ user = $_POST ["uid"]; $ pwd = $_POST ["pass"]; $con= mysql_connect("localhost","root"); if(! $con) { die("Not able to connect"); } mysql_select_db("try", $con); $result=mysql_query("Select * from info where uid=' $user 'and pass=' $pwd '"); if( mysql_num_rows( $result)&lt;=0) { echo "unsuccessful"; } else{ echo "successful"; } mysql_close( $con); ?&gt; </code></pre>
android
[4]
5,511,160
5,511,161
PHP object property declaration error
<p>I'm having a bit of trouble defining a property in a PHP class I'm creating.</p> <pre><code>&lt;?php class news_parser { public $var1 = Array(); function contents($parser, $data) { printf($data); } function start_tag($parser, $data, $attribs) { printf($data); } function end_tag($parser, $data) { printf($data); } function parse() { if(!$file = fopen("http://services.digg.com/2.0/story.getTopNews?type=rss&amp;topic=technology", "r")) die("Error opening file"); $data = fread($file, 80000); $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, array($this, "start_tag"), array($this, "end_tag")); xml_set_character_data_handler($xml_parser, array($this, "contents")); if(!xml_parse($xml_parser, $data, feof($fh))) die("Error on line " . xml_get_current_line_number($xml_parser)); xml_parser_free($xml_parser); fclose($fh); } } $digg_parser = new news_parser(); $digg_parser-&gt;parse(); echo phpversion(); ?&gt; </code></pre> <p>Produces the following error:</p> <pre><code>Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /homepages/8/d335242830/htdocs/caseyflynn/php/display_formatted_RSS_feed.php on line 3 </code></pre> <p>As far as I can tell I have the correct syntax. My server is running PHP 4.5. Any ideas?</p>
php
[2]
2,074,654
2,074,655
Android scrolling
<p>Everybody know how Rubik's cube works.<br> Is it possible to do somenthink like that in android: I have 5 on 5 square buttons. Is it possible to rotate them as Rubik's cube (2D)? If i have something like this:</p> <pre><code>&lt;ScrollView android:id="@+id/scrollView1" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"&gt; &lt;HorizontalScrollView android:id="@+id/horizontalScrollView1" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt; &lt;LinearLayout android:id="@+id/linearLayout2" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"&gt; &lt;/LinearLayout&gt; &lt;/HorizontalScrollView&gt; &lt;/LinearLayout&gt; &lt;/ScrollView&gt; </code></pre> <p>It's possible to scroll lines vertically or horizontally. But i want to scroll objects somtimes horizontally and somtimes vertically. How can i do that?</p>
android
[4]
1,029,307
1,029,308
Proper Context Usage of this keyword within a method callback
<p>I am trying to get the correct context of "this" when calling a method inside a prototype. It appears that the this keyword is referencing the callback method and not the prototype object that that $.getJSON is being used on. How do I correctly call the object's Timer within the getJSON callback?</p> <pre><code>function Stocks() { var Timer; } Stocks.prototype.GetQuote = function () { var requestURL = ""; //Some URL filled $.getJSON(requestURL, function(result) { //Error Line clearTimeout(this.Timer); //This is the wrong context }); this.Timer = setTimeout(this.QueryRequest.bind(this, ''), 1000); } Stocks.prototype.QueryRequest= function () { console.log('Requested'); this.Timer = setTimeout(this.QueryRequest.bind(this, ''), 1000); } </code></pre>
javascript
[3]
190,258
190,259
PHP conditional on query string with id
<p>I have this code:</p> <pre><code> if('open' == $post-&gt;comment_status || !isset($_GET['wp_accept_favor'])) { // show comment form } else { // dont show comment form } </code></pre> <p>domain.com/?wp_accept_favor then show comment form</p> <p>domain.com/?wp_accept_favor=2 then dont show comment form</p> <p>How do I do that? Thanks</p>
php
[2]
3,256,633
3,256,634
SearchManager has small icon in the right down side of SUGGEST_COLUMN_ICON1
<p><img src="http://i.stack.imgur.com/9h6tp.png" alt="enter image description here"></p> <p>As you can see, in my google search box, there is a tiny icon in the right down side. I do not want to show this tiny icon.. However, I cannot find any attribute to hide it. Are there anyone know how to fix it?</p>
android
[4]
2,943,116
2,943,117
From Web Development to Android Development
<p>I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? </p> <p>Also what new languages would I need to learn ? </p> <p>If any one could provide links to a beginners guide or something similar that would be much appreciated </p> <p>Thanks</p>
android
[4]
3,293,251
3,293,252
C++::GET & SET in a header file
<p>I am trying to implement the get() inside a header file of C++:</p> <p>for example: this is the file: test.hpp</p> <pre><code>class A { public: A(std::string f, int id):file(f), index(id){}; std::string getFile(){return file;}; int getIndex(){return id;}; private: std::string file; int index; }; } </code></pre> <p>But then I get a problem: undefined reference to `vtable A'. Could you please have a look?</p> <p>Thanks in advance.</p>
c++
[6]
4,832,478
4,832,479
Not allowed to start service Intent
<p>I'm trying to call a service from a activity:</p> <p>When I'm running the program the activity throws an error which says: Not allowed to start service Intent. What am I doing wrong? I'm sorry for possible stupid mistakes in the code, but I'm a newbie.</p> <p>activity code: </p> <pre><code>public void startService() { try { startService (new Intent ( this , SmsReminderService.class)) ; } catch (Exception e ) { Log.v("Error" , e.getMessage()) } } </code></pre> <p>service code :</p> <pre><code>public class SmsReminderService extends Service { @Override public void onStart(Intent intent, int startid) { Log.v("SSms", "Service started") ; }} </code></pre> <p>manifest: </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="me.sms.smsReminder" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="10" /&gt; &lt;permission android:name="SEND_SMS"&gt;&lt;/permission&gt; &lt;application android:icon="@drawable/ic_launcher" android:label="@string/app_name" &gt; &lt;activity android:label="@string/app_name" android:name=".SmsReminderActivity" &gt; &lt;intent-filter &gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;service android:name=".SmsReminderService" android:permission="android.permission.BIND_REMOTEVIEWS"&gt; &lt;intent-filter&gt; &lt;action android:name = "android.intent.category.LAUNCHER" &gt;&lt;/action&gt; &lt;/intent-filter&gt; &lt;/service&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p>Thanks in advance, Tom </p>
android
[4]
3,219,095
3,219,096
How to create striped button with rounded corners
<p>Is it possible to create a button with striped background and rounded corners?</p> <p>I know how to make striped background (diagonal stripes) using <a href="http://www.stripegenerator.com/" rel="nofollow">http://www.stripegenerator.com/</a> and bitmap xml with tileMode="repeat" and I know how to create round corners with shapes, I even can put them altogether in layer-list but I don't know how to make bitmap with rounded corners....</p>
android
[4]
3,257,418
3,257,419
How to get enum value by keyname
<pre><code>public enum aa{ a1=1,a2=2,a3=6,...,a100=203} </code></pre> <p>How to get value like this</p> <pre><code>string att=GetFromDatabase("attribute"); //this return a1 or a2 ... Enum.GetValue(att); </code></pre>
c#
[0]
1,083,905
1,083,906
Checking when all li's have been dynamically removed
<p>I've got a function that handles various types of behaviour for a property listing (My Shortlist) which is a <code>&lt;ul&gt;&lt;li&gt;</code> setup. One type of behaviour is removing a property listing item <code>&lt;li&gt;</code> when you click a button within each item, that's working fine however my <code>if</code> statement to check when all items have been removed isn't working.</p> <p>Can you tell me what I'm doing wrong? Here's the part of the function that handles removing items via the <code>onclick</code> event of the button and the dodgy <code>if</code> statement:</p> <pre><code>// Remove an item from the shortlist $(this).find('.btn-minus').click(function() { var btnRemove = $(this); var propTile = $(this).parents('.property-tile'); var propList = $('#property-listings'); // If IE 8 / 7 if ($('html').hasClass('lte8')) { propTile.hide('slide', 300, function() { btnRemove.data("tooltip").hide(); }); } // All other browsers else { propTile.fadeOut(200, function() { btnRemove.data("tooltip").hide(); $(this).remove(); }); } if (propTile.length === 0) { propList.remove(); } }); </code></pre> <p>And here's the call to the function: <code>$(".my-shortlist").myShortlist();</code> where <code>.my-shortlist</code> is the <code>&lt;ul&gt;</code> element.</p> <p>Thanks</p>
jquery
[5]
3,711,340
3,711,341
How to check if a record is already present in the DataView? C#
<p>I have a DataView which has two columns: <code>ContactID</code>, and <code>Name</code></p> <p>How can I check if a particular <code>ContactID</code> is already existing in the DataView?</p>
c#
[0]
698,848
698,849
SMS manager in Android
<p>I am assigned a project in which I have to send an SMS message from Android SDK automatically. Can anybody help me in this concern?</p>
android
[4]
16,178
16,179
Printing derived class name in base class
<p>How can I print out the derived class name from the base class without chaining constructors all the way down. In other words is it possible to do this strictly from the base class without adding code in each derived class?</p> <p>This is an example of what I got, and if there's a way I'd like to get rid of the constructor chaining.</p> <p><strong>EDIT:</strong> Ideally I am looking for something to add into the base class without having to edit all derived classes. At the moment my real code has got ~17 classes(with need for more), so something that could do the job straight from the base class would be ideal. Even if it's compiler specific (g++ or clang).</p> <pre><code>#include &lt;iostream&gt; class Base { public: Base(std::string id) { std::cout&lt;&lt;"Creating "&lt;&lt;id&lt;&lt;std::endl; } }; class Child : Base { public: Child(std::string id) : Base(id) {} Child() : Base(typeid(this).name()) {} }; class GrandChild : Child { public: GrandChild(std::string id) : Child(id) {} GrandChild() : Child(typeid(this).name()) {} }; class GrandGrandChild : GrandChild { public: GrandGrandChild(std::string id) : GrandChild(id) {} GrandGrandChild() : GrandChild(typeid(this).name()) {} }; int main() { GrandGrandChild *A = new GrandGrandChild(); GrandChild *B = new GrandChild(); Child *C = new Child(); return 0; } </code></pre> <p>Which prints:</p> <pre><code>Creating GrandGrandChild Creating GrandChild Creating Child </code></pre> <p>But with compiled added prefix.</p>
c++
[6]
5,491,556
5,491,557
Is there a basic id / value object in Java?
<p>I've created an "Attribut" class which is just a wrapper for a key/value single item. I know that Maps and HashMaps are designed for lists of this kind of items so I feel like i reinvented the wheel... Is there some Class which fulfill this purpose ?</p> <p>Regards</p> <p>( My code to be clear about what i'm looking for ) </p> <pre><code>public class Attribut { private int id; private String value; @Override public String toString() { return value; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } } </code></pre>
java
[1]
558,437
558,438
When to use "?android" or "@android"?
<p>I am a newbie and trying to understand the following XML code:</p> <p></p> <p>Looking at the documentation at developer.android.com, it says "starStyle" is a constant in R.attr and </p> <hr> <p>public static final int starStyle Since: API Level 1</p> <p>Default Star style.</p> <h2>Must be a reference to another resource, in the form "@[+][package:]type:name" or to a theme attribute in the form "?[package:][type:]name".</h2> <p>It seems to say that there are 2 syntax I can declare. 1) "@[+][package:]type:name" 2) "?[package:][type:]name".</p> <p>If there are 2 syntax, what is the correct one for "@[+][package:]type:name" ?</p> <p>I tried ""@android:attr/starStyle" but I didn't get a "star" checkbox even though the application compiled ok.</p>
android
[4]
2,900,384
2,900,385
Gestures overlay on videoview in android
<p>I'm just playing an movie using videoview(android). Now i just wanna draw some gestures over the video playing like drawing a circle or arrow mark like that.How could i do this?</p> <p>Thanks.</p>
android
[4]
1,733,481
1,733,482
Isn't asp.net FormsAuthentication.Authenticate() useless?
<p>Is there any use for FormsAuthentication.Authenticate() is real-world web applications?</p> <p>Why should we write some usernames in the web.config file when we can write them in databases using asp.net membership?</p>
asp.net
[9]
4,264,468
4,264,469
Discarding array item once used
<p>How can I make sure that a random number is only generated once?</p> <p>For example:</p> <pre><code>for(int i = 0; i&lt;len; i++) { while (rands.contains(rand = r.nextInt(len-2)+1)); rands.add(rand); System.out.print ("Rand ___ " + rand + "___"); } </code></pre> <p>How can I make sure that if the number 2 is generated from rand, it wont be generated again?</p> <p>I apologise if i am not making myself clear enough. Please comment if you require any more information.</p> <p>Thanks.</p>
java
[1]
2,618,104
2,618,105
How to save image in photo album?
<p>I am using GLImageProcessing sample code.I want to save modified image in photo album how it possible.please help me.</p>
iphone
[8]
2,203,240
2,203,241
keydown event on a iframe
<p>How i can get keydown event on iframe?</p>
jquery
[5]
4,101,028
4,101,029
Strict standards: Creating default object from empty value
<p>I have the following code.</p> <pre><code> public function get_users_theme($uid) { $r = $this-&gt;db2-&gt;query('SELECT * FROM users_theme WHERE user_id="'.$uid.'" LIMIT 1', FALSE); if ($this-&gt;db2-&gt;num_rows($r) &gt; 0) { $o-&gt;user_theme = new stdClass(); $ut = $this-&gt;db2-&gt;fetch_object($r); foreach($ut as $l=&gt;$s) { $o-&gt;user_theme-&gt;$l = stripslashes($s); } return $o-&gt;user_theme; } else { return FALSE; } } </code></pre> <p>It appears that line 5 are producing the following error:</p> <blockquote> <p>Strict standards: Creating default object from empty value</p> </blockquote> <p>How Can I Fix That ?</p> <p>Thanks</p>
php
[2]
1,272,447
1,272,448
How to get odbcexception number
<p>In sql we have sqlexeption.numer but In odbcexeption we don't have that property,how to get the execption number?</p>
c#
[0]
2,565,439
2,565,440
emmulator-5554 issue
<p>When i try running the simple Hello Android program i get the following message in console emulator-5554 disconnected! Cancelling 'com.android.hello.HelloAndroid As a result the program does not run.</p> <p>Can any one help me out of this...</p> <p>Thanks in Advance.. sandeep</p>
android
[4]
3,093,873
3,093,874
how to show code snippet on ASP.NET page with color formatting
<p>I want to show code in asp.net page , how to show code snippet that it will look in same colors as it looks in visual studio , best examlple i can give is this stackoverflow.com itself we can put code fragment in our question which looks well colored giving better user exprience </p> <p>i have just no clue ? also how to store code snippets when user enters them ?</p>
asp.net
[9]
654,437
654,438
openFileOutput FileNotFoundException
<p>This is my noob question for the week. I'm looking more for general speculation than specific code and maybe hoping the Android folks are watching and could correct this:</p> <p>the SDK documentation for Context.openFileOutput says:</p> <blockquote> <p>Open a private file associated with this Context's application package for writing. Creates the file if it doesn't already exist.</p> </blockquote> <p>Ok, that sounds good. I can create a file. Except this method also throws a FileNotFoundException, so apparently something is amiss. Why would a function that is <em>supposed</em> to create a file if it's not found throw an exception if the file is not found???</p> <p>Kinda defeats that whole "Creates the file..." thing, doesn't it?</p>
android
[4]
221,847
221,848
How to create a web based file manager that can read across different platforms?
<p>I would like to try creating a PHP web file manager that could read on my machines. As I have a couple of PC and laptops, and I would like to create a central storage to store my files, documents, etc. Hence, I would like to create a web based file manager that can fulfill my need. I know there are a handful of free and opensource web file manager out there, but I would like to create my own so that I can tweak accordingly.</p> <p>Hence I have some questions regarding how can I go about creating a file manager for such a purpose:</p> <p>1) As I have both mac and win machines, how can my file manager be able to access the different platforms, and reading shared or portable drives as well?</p> <p>2) I have done up to generating the files/folders:</p> <pre><code>// declare the folder $directory = "./"; // prepare to read directory contents $dir = @opendir($directory); // loop through the items while ($file = readdir($dir)) { // check if it is a dir if (is_dir($file)) { echo "dir: $file &lt;br /&gt;"; } else { echo "file: $file &lt;br /&gt;"; } } closedir($dir); </code></pre> <p>How do I create the links for these files etc?</p> <p>Thank you very much.</p>
php
[2]
4,550,641
4,550,642
i have written the code for updating my contacts by using content provider but its not updating my contact list
<p>i have written the code for updating my contact list by progamming using content provider , whenever i try to insert new phone number its not updating , its showing me the previous phone number for reference i pasting the code which i have written </p> <pre><code>private void updateContact(String phone) { if (updateUri == null) { Toast.makeText(NativeContentProvider.this, "There is nothing to update, Please create a contact and then click update", Toast.LENGTH_LONG).show(); } else { ContentValues newPhone = new ContentValues(); newPhone.put(People.Phones.TYPE, People.TYPE_MOBILE); newPhone.put(People.NUMBER, phone); getContentResolver().update(updateUri, newPhone, null,null); Toast.makeText(NativeContentProvider.this, "Updated the phone number to: " + phone, Toast.LENGTH_SHORT).show(); Log.i(getClass().getSimpleName(), "Updated the phone number"); } } </code></pre> <p>i am stuck</p>
android
[4]
2,184,576
2,184,577
Java EE versus JAVA SE for web application development
<p>What has me going is the degree of web application development we are talking about. There are different levels of web application development. For example, if I was asked to develop a web application to deal with housing customer information for a small mom and pop bakery (definitely not a enterprise situation), is there anything wrong with using Java EE as opposed to Java SE if I really want to. I know you might say that it would be overkill, and I can understand that, however, am I going to run into development issues that I would not run into using Java SE? In other words, I am trying to determine when does a small business web application turn into a enterprise web application. It seems to me that I should be able to use Java model that I want. Am I wrong in my thinking here?</p> <p>Need clarification here if you can help me.</p>
java
[1]
5,343,490
5,343,491
is it possible to make a PHP SOAP request to a java web service?
<p>I have a URL : '<a href="http://myurl.com/foo/bar.jws" rel="nofollow">http://myurl.com/foo/bar.jws</a>' I am attempting to make a SOAP connection through PHP to this URL but it doesn't seem to work. Am I missing something?</p> <pre><code>&lt;?php try { $soapObject = new SoapClient('http://myurl.com/foo/bar.jws'); } catch(Exception $e) { die('SOAP connection failed: ' .$e-&gt;getMessage()); } ?&gt; </code></pre> <p>I am getting this error:</p> <pre><code>SOAP connection failed: SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://myurl.com/foo/bar.jws' : failed to load external entity "http://myurl.com/foo/bar.jws" </code></pre>
php
[2]
4,963,649
4,963,650
Variable Options without Variables?
<pre><code>&lt;script type="text/javascript"&gt; clBoxActive = true; clBoxTrigger = "cl-trigger"; clBoxTriggerType = "#"; clBoxClass = "overlay-box"; clEffectIn = "fade"; clEffectOut = "fade"; clOnLoad = false; clAllowExit = true; &lt;/script&gt; </code></pre> <p>This is what i currently have. Its options to do a lightbox like script where you click on the trigger, and it opens:</p> <pre><code>&lt;div class="overlay-box" style="display:none;"&gt; &lt;div class="ol-wrapper"&gt; &lt;div class="ol-box-content"&gt; This is the overlay box content. &lt;/div&gt; &lt;/div&gt; &lt;div class="ol-box-bg"&gt;&amp;nbsp;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>ol-box-bg is the background which the jquery pulls the height and width of the browser, and set the css to the box, and the rest is in style.css which it says position: absolute; and opacity, and other stuff to just style it to make it black with see through...</p> <p>ol-box-content is the content box, its got a wrapper to allow it to center, but otherwise its got similar properties in the style.css as the ol-box-bg..</p> <p>My question is... Im trying to make it a little more dynamic where i can allow multiple lightbox triggers that open different boxes to overlay the pages content. However i came across the problem of, the variables can only be set one time, and i have no clue where to go from here..</p> <p>I notice that some people do stuff like:</p> <pre><code>optionName: optionvalue </code></pre> <p>but im not sure what it is, or how its used..</p>
jquery
[5]
3,143,504
3,143,505
C++ Pass by reference vs. pointer in a Class
<p>So, I have a class which stores a vector of pointers to objects. I have a method that adds objects to the vector. When adding, I know I can pass by reference or by pointer, and have read about the advantages and disadvantages of each, but in this case, I can't figure out which one is better and why. For all I can figure out, they're pretty much the same (but I'm probably wrong!)</p> <p>Here's (a paraphrasing of) passing by pointer/address:</p> <pre><code>hpp: class Room { vector&lt;Item*&gt; items; public: void addItem(Item*); }; cpp: void Room :: addItem(Item* item) { items.push_back(item); } </code></pre> <p>...and pass by reference:</p> <pre><code>hpp: class Room { vector&lt;Item*&gt; items; public: void addItem(Item &amp;); }; cpp: void Room :: addItem(Item &amp;item) { items.push_back(&amp;item); } </code></pre> <p>Which should I use?</p>
c++
[6]
3,114,828
3,114,829
Moving inline code into function, with object name generation
<p>I am customizing Denis Gritcyuk's <a href="http://javascriptkit.com/script/script2/timestamp.shtml" rel="nofollow">Popup date picker</a>.</p> <ol> <li><p>This pop-up script uses inline Javascript in a <code>href</code> link, to set the selected date into the <code>input</code> field, in the parent window, that is was called for. An example URL looks like:</p> <pre><code>&lt;a href="javascript:window.opener.document.formname.field.value='03-10-2011'; window.close();"&gt;3&lt;/a&gt; </code></pre></li> <li><p>The input field name, (e.g. <code>document.formname.field</code>), is passed to the script as a string parameter.</p></li> </ol> <p>I would like to add things done when that link is clicked (e.g. change background color of field, set flag, etc.). So while this DOES work, it's getting <strong>ugly</strong> fast.</p> <pre><code>&lt;a href="javascript:window.opener.document.formname.field.value='03-10-2011'; window.opener.document.formname.field.style.backgroundColor='#FFB6C1'; window.close();"&gt;3&lt;/a&gt; </code></pre> <p><br> How would I move these inline commands into a JS function? This would give me much cleaner URLs and code. The URL would now look something like </p> <pre><code>&lt;a href="javascript:updateField ('document.formname.field', '03-10-2011');"&gt;3&lt;/a&gt; </code></pre> <p>with a function like (this example obviously does NOT work):</p> <pre><code>function updateField (str_target, str_datetime) { var fieldName = "window.opener" + str_target; [fieldName].value = str_datetime; [fieldName].style.backgroundColor = '#FFB6C1'; // Set flag, etc. window.close(); } </code></pre> <p><br>So any suggestions on how this can be done, please?</p>
javascript
[3]
1,211,388
1,211,389
jquery global animation duration
<p>I have a page with many jQuery animations, each has it's own duration defined individually. </p> <p>I want to disable all the animations on mobile devices by setting the duration to 0.</p> <p>Is there a way to overwrite all the animation durations globally?</p> <p>something like this:</p> <pre><code> if (isMobile()) { $.animation.duration.disable = true; } </code></pre>
jquery
[5]
3,781,974
3,781,975
Is there any Java MultiMedia Conversion Library
<p>I wonder if there is a lib, like Apache Commons, or something of that sort to help convert media-files (e.g. avi, mkv, mp4 etc) any-to-any? For example an InputFile is in format .avi and an OutputFile is in mp4.</p>
java
[1]
4,557,250
4,557,251
How to auto start an app in Android ICS and onwards?
<p>I need to auto start an application after Installation (First Time) in ICS and onwards . I know in prior version ,Boot completed receiver was working fine but In ICS and onwards version ,when an app is first installed but not started ,no broadcast receivers or services will run until after it is started</p>
android
[4]
1,912,055
1,912,056
for ... in loop with string array outputs indices
<p>When I write some javascript such as this:</p> <pre><code>var words = ['word1', 'word2', 'word3'] for (word in words) { console.log(word) } </code></pre> <p>The resulting output is the numeric indices of the respective word. I did some searching on Google and I couldn't find the exact reason for this behavior. I'm guessing that this is completely expected behavior but I would like to know the reason why.</p> <p>Thanks!</p>
javascript
[3]
4,203,314
4,203,315
add whitespace <span> on space bar
<p>I currently have this function:</p> <pre><code>if (e.keyCode == 32){ var $cursor = $("#cursor") $cursor.val(""); this.append("&lt;span class = 'space'&gt;-&lt;/span&gt;"); $cursor.insertAfter(".space:last"); $cursor.focus(); } </code></pre> <p>I was wondering how one would add a whitespace for the span, right now I add a dash for testing.</p>
jquery
[5]
3,058,109
3,058,110
Compare two arrays save data to matches
<p>I have two arrays I need to compare....</p> <p>$Drink Array</p> <pre><code>( [0] =&gt; Drink Object ( [top_id] =&gt; 40C6-88 [name] =&gt; Pepsi [drink_id] =&gt; E936 ) [1] =&gt; Drink Object ( [top_id] =&gt; 46DB-9E [name] =&gt; Orange Juice [drink_id] =&gt; E936 ) ) [2] =&gt; Drink Object ( [top_id] =&gt; 5J71-4F79 [name] =&gt; Dr Pepper [drink_id] =&gt; E936 ) </code></pre> <p>$DrinkItem Array</p> <pre><code>( [0] =&gt; DrinkItem Object ( [bottom_id] =&gt; 45BD-92DD [name] =&gt; Diet Coke [drink_template_id] =&gt; 3B2A-4D82 ) [1] =&gt; DrinkItem Object ( [bottom_id] =&gt; 4A71-8F79 [name] =&gt; Orange Juice [drink_template_id] =&gt; 3B2A-4D82 ) ) </code></pre> <p>.. If the name matches one of the names in the DrinkItem Array I need to store the top_id of that item.</p> <p>I was trying to do something like:</p> <pre><code>foreach ($Drink as $d) { foreach ($DrinkItem as $item){ if ($d-&gt;name == $item-&gt;name){ $match = $d-&gt;top_id; } } } </code></pre> <p>But I might be way off base here. If there's a better approach for storing the id of the matches, or if i'm on the right track, any help is very appreciated!</p>
php
[2]
3,708,389
3,708,390
scrape the about page of websites with Python
<p>I am looking to scrape some content from some websites for research and I was hoping that using python and web scraping might speed up my process. I have used python and beautiful soup before for one small project to convert an xml from one format to another.</p>
python
[7]
4,316,705
4,316,706
App crashing when trying to create a TBXML object with this xml
<p>I am trying to parse following xml using tbxml library - </p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;REPLY replyCode="Success" &gt; &lt;TRACK track_id="1302234" track_mp3="74-Ruff_Ryders_feat_Sheek_Louch_and_Big_Pun_-_Piña_Colada.mp3"&gt;&lt;/TRACK&gt; &lt;/REPLY&gt; </code></pre> <p>But when I tried to create TBXML object the app is crashing I think this is because of some special chars in xml file (Piña).</p> <p>Any idea on this?</p>
iphone
[8]
3,948,271
3,948,272
c# waiting for a javascript event to finish
<p>what i like to do is this: in a button object in asp.net c# I want to read some hidden fields filled by javascript with client browsers data. the function in js if fire when the client push the button but sometimes when in c# I'm reading the hidden fields the js hasn't finish yet so I get the hidden blank. what I need to do is somehow start reading in c# when the js function is done.</p> <p>thanks in advance, any idea would be helpfull</p>
javascript
[3]
3,215,941
3,215,942
Adding contacts to a ListView
<p>Alright so I'm just learning how to work with contacts and such. I would like to have my contacts listed out in a ListView, with custom adapter (I think thats what it is called, where I can have ImageViews, TextViews, all that such, in one ListView entry). How would I be able to do that with the following code that I have?</p> <pre><code>Cursor cursor = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); while (cursor.moveToNext()) { String contactId = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID)); String hasPhone = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER)); if (Boolean.parseBoolean(hasPhone)) { // You know have the number so now query it like this Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = "+ contactId, null, null); while (phones.moveToNext()) { String phoneNumber = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); } phones.close(); } } cursor.close(); </code></pre>
android
[4]
1,297,550
1,297,551
jquery click function and "new page"
<p>i use jQuery "click" function. If use simple click on img is everything ok, but when on this image is link with tag 'target="_blank"' or user click right button, then 'open in new window', this function don't work. </p> <p>How made that click function work, when user open link in new window?</p> <p>My code:</p> <pre><code>$('.button_img').live('click', function(){ alert('new'); //do something }); &lt;a href="http://www.google.com" target="_blank"&gt; &lt;img class="button_img" src="img.png" /&gt; &lt;/a&gt; </code></pre>
jquery
[5]
4,245,613
4,245,614
from . import * from module
<p>there is a script in the working directory which I can access with</p> <pre><code>from . import core.py </code></pre> <p>but if I would also like to import * from core.py, how would I write this in python?</p>
python
[7]
4,209,128
4,209,129
Java assignment of integers to float
<p>I have integers X Y and Z</p> <p>I have this formula in which I am using to populate a float[][] array</p> <p>The formula is x/(y*(x+z) in which all 3 are integers</p> <p>But when calculated the value is 0, which is definitely not as I checked the values of x y and z.</p> <p>How do I go about preventing this and showing the float value instead?</p> <p>Many thanks in advance</p>
java
[1]