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
5,804,318
5,804,319
delete a pointer getting AccessViolationException
<p>I have a class pointer declaration:</p> <pre><code>MyClass* a; </code></pre> <p>In destruction method I have:</p> <pre><code> if (a) { delete a; a= NULL; } </code></pre> <p>I got a problem when delete the pointer a:</p> <pre><code>Attempted to read or write protected memory. This is often an indication that other memory is corrupt. </code></pre> <p>What is the cause of the problem and how can I get rid of it?</p> <p>Thanks in advance. </p>
c++
[6]
3,552,721
3,552,722
Jquery: syntax for inserting a function
<p>I'm trying to integrate an animation by using the bezier path plug-in and I can't seem to implement it right.</p> <p>Stripped down, here's what I have:</p> <pre><code> $('#next2btn').live('click', function(){ $(this).attr('id','next3btn'); $('#content2').show(300, function() { $('#account').fadeTo(500,1.0) var arc_params = { center: [278,120], radius: 186, start: -90, end: 90, dir: -1 }; }); $("#account").animate({path : new $.path.arc(arc_params)},1000); }); </code></pre> <p>So, I'm trying to add this piece of code into what I have:</p> <pre><code> var arc_params = { center: [278,120], radius: 186, start: -90, end: 90, dir: -1 }; }); $("#account").animate({path : new $.path.arc(arc_params)},1000) </code></pre> <p>which works on its own as does the other.</p> <p>I'm thinking it's something about declaring that variable and where I do that.</p> <p>I'm essentially chaining a few different animations/actions upon a button click.</p> <p>Thanks for any insight- kj</p>
jquery
[5]
1,331,054
1,331,055
Confused by Use of ~ in ASP.NET
<p>I am programming for the first time in ASP.NET. It's proven to be very easy and I'm really enjoying it. One feature I like is that, within a web page, I can reference files from root by using the tilde (~) character and then the rest of the path. However, this does not seem to be consistent. For example, it works within the context of href, e.g.</p> <pre><code>&lt;link href="~/css/StyleSheet.css" /&gt; </code></pre> <p>It doesn't work with respect to src, e.g.</p> <pre><code>&lt;img src="~/images/header.jpg" /&gt; </code></pre> <p>Why is this? Is there something I'm doing wrong. The inconsistency is annoying.</p>
asp.net
[9]
441,139
441,140
Why is it that an overridden method can't throw a new checked Exception
<p>I have two questions :</p> <ol> <li>What is the purpose of the constraint that an overridden method can't throw a new checked exception?</li> <li>Why it is allowed that an overridden method can only throw all or none, or a subset of the checked exceptions that are specified in the throws clause of the overridden method in the superclass?</li> </ol>
java
[1]
4,418,718
4,418,719
opening a link in <body onload=""
<p>I guess this is possible, but I don't know how.</p> <pre><code>&lt;a rel="width[640];height[480];autostart[true];loop[true];title[Google]" class="jcepopup" href="http://www.google.nl"&gt;Aanbieding&lt;/a&gt; </code></pre> <p><strong>Can it be done linke this?</strong></p> <pre><code>&lt;body onload="javascript: laden()"&gt; &lt;script type="text/javascript"&gt; function laden() { window.open('http://www.google.nl rel="width[640];height[480];autostart[true];loop[true];title[Google]" class="jcepopup"', 'blablabla', 'width=720', 'heigt=500'); } </code></pre> <p></p>
javascript
[3]
701,365
701,366
HIde word with JavaScript
<p>I am not developer so I need help from you guys.</p> <p>My Problem is simple.</p> <p>I just want javascript to hide word before "<strong>.</strong>"</p> <p><strong>Example :</strong> </p> <p>say for <strong>google.com</strong></p> <p>I just want word "<strong>.com</strong>" tobe print.</p> <p>Please note that my content is <strong>dynamic</strong> so <strong>google.com</strong> will keep changing everytime to <strong>google.net</strong> or <strong>yahoo.com</strong>...... so on..</p> <p>Thanx in advanced.</p>
javascript
[3]
1,687,193
1,687,194
setTimeout function isn't called?
<p>To put a delay on a menu onmouseover effect, setTimeout is one of the options. But when I try it, the function isn't called.</p> <p>HTML:</p> <pre><code> &lt;li&gt;&lt;a href="#" onmouseover="mopendelay('menu_proj')" &lt;li&gt; </code></pre> <p>JavaScript:</p> <pre><code>// open hidden layer function mopen(id) { // cancel close timer mcancelclosetime(); // close old layer if(ddmenuitem) ddmenuitem.style.visibility = 'hidden'; // get new layer and show it ddmenuitem = document.getElementById(id); ddmenuitem.style.visibility = 'visible'; } // delay menu open on mouseover function mopendelay(id) { var delay = setTimeout(function(){ alert('delay'); // isn't called mopen(id); }, 200); clearTimeout(delay); } </code></pre>
javascript
[3]
3,691,943
3,691,944
JQuery - Get value out of an input field inside hidden div
<p>Will <code>$('#some-field').val()</code> return "something" or empty string? I assume it would return the value regardless if the div is visible or not. But I have been getting empty string. Any idea?</p> <pre><code>&lt;div style="display:none;"&gt; &lt;form&gt; &lt;input id="some-field" type="text" value="something" /&gt; &lt;/form&gt; &lt;/div&gt; </code></pre>
jquery
[5]
4,203,469
4,203,470
Find and element by ID and redirect after specific time
<p>I am using the following JS to target an element with an ID of "someID" then redirect after 6 seconds. I only want this to work on a page where this element ID is present, but right now it redirects all pages it is applied to. What am I doing wrong here?</p> <pre><code>if (!document.getElementById("someID")) { setTimeout(function () { window.location.href = "http://www.somesite.com"; }, 6000); }; </code></pre>
javascript
[3]
1,793,503
1,793,504
Starting other Applications with Java
<p>Is it possible to start other application that are installed on the system with my java app and pass a file as a parameter to them? I have a client which receives videos from a server and I want my client program to start, lets say the VLC player with the file that I received. How do I manage to do that?</p>
java
[1]
3,436,165
3,436,166
Nested exceptions?
<p>Will this work?</p> <pre><code>try: try: field.value = filter(field.value, fields=self.fields, form=self, field=field) except TypeError: field.value = filter(field.value) except ValidationError, e: field.errors += e.args field.value = revert valid = False break </code></pre> <p>Namely, if that first line throws a <code>ValidationError</code>, will the second <code>except</code> catch it?</p> <p>I would have written it un-nested, but the second filter statement can fail too! And I want to use the same <code>ValidationError</code> block to catch that as well.</p> <p>I'd test it myself, but this code is so interwoven now it's difficult to trip it properly :)</p> <p>As a side note, is it bad to rely on it catching the <code>TypeError</code> and passing in only one arg instead? i.e., deliberately omitting some arguments where they aren't needed?</p>
python
[7]
5,519,315
5,519,316
When should I use the syntax "(function() {...})();"?
<p>My query is used in cases that "(function() {...})();" Given that I am not a plugin. For example "http://piecesofrakesh.blogspot.com/2009/03/downloading-javascript-files-in.html" </p> <pre><code>(function() { var s = [ "/javascripts/script1.js", "/javascripts/script2.js" ]; var sc = "script", tp = "text/javascript", sa = "setAttribute", doc = document, ua = window.navigator.userAgent; for(var i=0, l=s.length; i&lt;l; ++i) { if(ua.indexOf("MSIE")!==-1 || ua.indexOf("WebKit")!==-1) { doc.writeln("&lt;" + sc + " type=\"" + tp + "\" src=\"" + s[i] + "\" defer&gt;&lt;/" + sc + "&gt;"); } else { var t=doc.createElement(sc); t[sa]("src", s[i]); t[sa]("type", tp); doc.getElementsByTagName("head")[0].appendChild(t); } } })(); </code></pre> <p>Or</p> <pre><code>var s = [ "/javascripts/script1.js", "/javascripts/script2.js" ]; ... </code></pre> <p>Thank you.</p>
javascript
[3]
2,434,194
2,434,195
Where to search for checkstyle rules xml, PMD rules xml (ready to use)
<p>Where to search for checkstyle rules xml, PMD rules xml (ready to use) suitable for web application code review</p>
java
[1]
5,392,915
5,392,916
store form values in URL params
<p>I have a d3 chart with some <code>&lt;input&gt;</code> elements for configuration. I'd like these configuration options to update URL params as they're changed, and obviously when the page is loaded these URL params should be used as default values.</p> <p>This seems like a basic piece of functionality on a lot of sites, is there a jQuery library out there (I couldn't find one) that I could just drop in? Or do I need to roll my own.</p> <p>Thanks!</p>
jquery
[5]
3,819,395
3,819,396
What does s.strip() do exactly?
<p>I was told it deletes whitespace but </p> <pre><code>s = "ss asdas vsadsafas asfasasgas" print(s.strip()) </code></pre> <p>prints out</p> <pre><code>ss asdas vsadsafas asfasasgas </code></pre> <p>shouldn't it be <code>ssasdasvsadsafasasfasasgas</code>?</p>
python
[7]
1,930,416
1,930,417
Change the Color of Highlighted text in Android
<p>I'm not sure that this is possible, perhaps someone can set me straight. I have an EditText View in an android application that has white text on a blue background. When the text is selected (via a long press and the edit dialog), I'd like have the highlight be white and change the text color to be black. Annoyingly though there does not seem to be a way to set the color of the text on highlight. You can set the highlight color using <em>textColorHighlight</em>, but not the text color, so setting a white highlight with white text results in a big white block.</p> <p>It seems like it should be something trivial you can do declaratively in the xml, but though I've tried many combinations of styles and colors, I've not been able to change the color. </p> <p>Checking other standard applications it seems that the text color never seems to change so I'm thinking this is something that's not easily done. I'd rather not have to subclass the EditText if at all possible just to something so simple. Am I missing something? Can this be done in the view xml?</p>
android
[4]
1,457,062
1,457,063
Determine if process com.android.browser is running
<p>How can I determine if the process <code>com.android.browser</code> is running?</p>
android
[4]
5,040,657
5,040,658
java add hours to system date and in yyyyMMddHHmmss format
<p>I am getting input as some date/time in hours(integer) eg: 2 hrs I want to add this input hours to system date in yyyyMMddHHmmss format. How can i do this?</p>
java
[1]
1,052,470
1,052,471
PHP and mysql multiple select dropdown
<p>I am trying to populate drop down from mysql table. I am able to populate it successfully. But when I try to retrieve the data after submitting the form, I am not able to retrieve selected values. Can anyone help me on this?</p> <pre><code>$authorDB=new AuthorDB(); $myArr =$authorDB-&gt;retrieveAuthors(); echo '&lt;tr&gt; &lt;td rowspan="3"&gt;&lt;div style="position: relative;"&gt;Author&lt;/div&gt;&lt;/td&gt; &lt;td&gt; &lt;select name="selAuthor" id="$selAuthor" multiple="multiple" size="3"&gt;'; foreach ($myArr as &amp;$s_author) { echo '&lt;option value='.$s_author.'&gt;'.$s_author.'&lt;/option&gt;'; } '&lt;/select&gt; &lt;/td&gt; &lt;/tr&gt;' enter code here </code></pre> <p>and after submitting the form</p> <pre><code>$a_SelectedAuthors[]=$_POST["selAuthor"]; $nAuthors = count($a_SelectedAuthors); echo '&lt;h1&gt; Count :'.$nAuthors.'&lt;/h1&gt;'; for($i=0; $i &lt; $nAuthors; $i++) { echo($a_SelectedAuthors[$i] . " "); } </code></pre>
php
[2]
748,938
748,939
jQuery wrapping of a tr td with jQuery
<p>I'm trying to wrap my table with a new tr and then all the td's inside the wrapping tr.</p> <p>My code is as follows:</p> <pre><code>$('.ccbnBgTblTxt td').wrap('&lt;tr class="new"/&gt;'); </code></pre> <p>What I'm trying to do is.. this</p> <pre><code>&lt;tr class="new"&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt; </code></pre> <p>Right now I'm getting results like this.</p> <pre><code>&lt;tr class="new"&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="new"&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt; </code></pre> <p>Anyway to wrap all the td's?</p>
jquery
[5]
200,758
200,759
How to parse file with system characters?
<p>I have file like below:</p> <blockquote> <p>’”ЪNUL$13adc1e6-465e-11e1-a8f8-047d7b47de33“®188.254.116.66®188.254.116.67®188.254.116.68ЁРЈСЂРЅР°ЪNUL ed4bac9f1f1bf6812e76ef21a78fe9c0”ЪNUL$13b2fd14-465e-11e1-a8f8-047d7b47de33“®188.254.116.66®188.254.116.67®188.254.116.68°РљРѕРјРёСЃСЃРёСЏЪNUL 194bb53b6970bcc08ca743d2d238057f</p> </blockquote> <p>(original can be downloaded <a href="http://webvybory2012.ru/account/channels?station_id=65600" rel="nofollow">here</a>)</p> <p>How can I parse that (once downloaded) to extract:</p> <blockquote> <p>13adc1e6-465e-11e1-a8f8-047d7b47de33</p> <p>13b2fd14-465e-11e1-a8f8-047d7b47de33</p> <p>188.254.116.66</p> </blockquote> <p>? I am not sure how to look for this system characters.</p>
python
[7]
5,623,604
5,623,605
list with non-unique index
<p>I've always thought the any index should be unique, but I think it's not true at least for SQL Server as shown in the following post:</p> <p><a href="http://stackoverflow.com/questions/4332982/do-clustered-indexes-have-to-be-unique">Do clustered indexes have to be unique?</a></p> <p>Recently I had to store a very amount of data within a collection and thought of using a dictionary for it's the fastest collection to get an object by index. But my collection would have to allow duplicated keys. But in fact duplicated keys would not be a problem since any of the object returned would be meet the requirements (The objects are not exactly unique, but the keys would be).</p> <p>Some more research led me to the following post:</p> <p><a href="http://stackoverflow.com/questions/4598826/c-sharp-hashset-contains-non-unique-objects">C# Hashset Contains Non-Unique Objects</a></p> <p>Which shows a way to get a HashSet with "duplicated keys". His problem would be my solution but I wonder if there's any other way that I can have a list with duplicated keys which allows me to search very fast without having to do any workaround the get this done.</p>
c#
[0]
1,505,801
1,505,802
PHP Background Process Still Affecting Page Load
<p>So I have found a number of tutorials/guides for running a php script as a background process, but no matter which code I use, the process still appears visible in the browser.</p> <p>What I am doing is triggering a script that may take 5-10 seconds to run (relies on a third party API). I put the trigger at the very bottom of the page so that the page appears to render completely, but I have noticed that the browser status bar still shows the page as loading until the script runs. Additionally, Firebug is showing one (random?) image as loading until the php script is completely finished running. I can view the script in <code>top</code> and it is running as a separate process. How can I get the browser to stop waiting for it to finish though?</p> <p>The code I'm using currently is:</p> <pre><code>shell_exec('sleep 30 &gt;/dev/null 2&gt;/dev/null &amp;'); </code></pre> <p>I've also tried using exec() but there wasn't any difference.</p> <p><strong>Disclaimer:</strong> My final code will use <code>/usr/bin/GET</code>, sleep is just to be obvious about what's going on.</p>
php
[2]
5,097,265
5,097,266
save state of TextViews in a Listview embedded inside another Listview from an Sqlite Database
<p>Good day,this might be difficult to explain so please bear with me. </p> <p>1) i have a Listview A</p> <p>2) and a nested Listview B(from an ArrayList) in Listview A which gets called via a menu button in A</p> <p>3) An sqlite database is used to store and retrieve values in A.</p> <p>4) The nested Listview B is stored as a String column in the database via a JsonArray.</p> <p>5) Listview B has Textviews which their states are either crossed or not crossed.</p> <p>Now my question is, when i populate the Listview A via a cursor, how can i maintain the states of the Textviews in B when B gets called/has focus from A?</p> <p>I was thinking i might have to add a kind of string value to every element in the ArrayList when the textviews are crossed, so i can monitor it. what you think? </p> <p>I hope i did not confuse you guys or create a tongue twister here... but any tips or solution on how i can go about keeping states of the Textview. Thank you :) </p>
android
[4]
2,201,475
2,201,476
PHP shuffle not working like expected on my nested array
<p>I have a nested array of arrays, and I want to shuffle the inner arrays. My code looks like this (simplified):</p> <pre><code>$a = array(array('banana', 'peach'), array('ding', 'dong'), array('oh snow')); foreach ($a as &amp;$arr) { shuffle($arr); } var_dump($a); </code></pre> <p>The var_dump outputs this:</p> <pre><code>array(3) { [0]=&gt; array(2) { [0]=&gt; string(5) "peach" [1]=&gt; string(6) "banana" } [1]=&gt; array(2) { [0]=&gt; string(4) "ding" [1]=&gt; string(4) "dong" } [2]=&gt; &amp;array(1) { [0]=&gt; string(7) "oh snow" } } </code></pre> <p>As you can see in the output, the first two subarrays work, but the third subarray is linked by reference in the output...</p> <p>In my full app, this last array-link causes problems, but rather than working around the issue, I want to fix this shuffle thing...</p> <p>Cheers!</p>
php
[2]
3,325,249
3,325,250
placeholder-not-working-for-internet-explorer if input type is password, still its showing the *********
<p>I got 1 answer at <a href="http://stackoverflow.com/questions/8628522/placeholder-not-working-for-internet-explorer">Placeholder not working for Internet Explorer</a></p> <p>and i am using this code,</p> <pre><code>window.onload = function() { var arrInputs = document.getElementsByTagName("input"); for (var i = 0; i &lt; arrInputs.length; i++) { var curInput = arrInputs[i]; if (!curInput.type || curInput.type == "" || curInput.type == "text"|||| curInput.type == "password") HandlePlaceholder(curInput); } }; function HandlePlaceholder(oTextbox) { if (typeof oTextbox.placeholder == "undefined") { var curPlaceholder = oTextbox.getAttribute("placeholder"); if (curPlaceholder &amp;&amp; curPlaceholder.length &gt; 0) { oTextbox.value = curPlaceholder; oTextbox.setAttribute("old_color", oTextbox.style.color); oTextbox.style.color = "#c0c0c0"; oTextbox.onfocus = function() { this.style.color = this.getAttribute("old_color"); if (this.value === curPlaceholder) this.value = ""; }; oTextbox.onblur = function() { if (this.value === "") { this.style.color = "#c0c0c0"; this.value = curPlaceholder; } }; } } } </code></pre> <p>that's great, but now i am getting a problem, where in place of showing "password", it's showing <strong><em>*</em>*</strong> special symbol, is there any way to resolve this</p>
javascript
[3]
938,453
938,454
What does least significant byte mean?
<p>I have to implement a method that writes a byte to an <code>ostream</code> object. Let's just called this <code>ostream</code> object <code>strobj</code>. I also have a bit buffer used to store a byte of data, let's call it:</p> <pre><code>char &amp;bitter; </code></pre> <p>In my header file, I have this:</p> <pre><code>void writeThisByte(int sumInt); </code></pre> <p>The instructions says that I have to write the "less significant byte" of the int being passed in to an <code>ostream</code> object, i.e. <code>strobj</code>;</p> <p>However, I am confused on exactly what the least significant byte means.</p> <p>Does this mean you are checking to see whether <code>sumInt == 1</code>? And if it is, do you write it to the <code>ostream</code> like this?</p> <pre><code>strobj.write(&amp;bitter, 1); </code></pre> <p>I'm not sure :(</p>
c++
[6]
5,437,863
5,437,864
How to ensure video is played from website, not a cached version
<p>I have used the below code(read a video from a website and play it on a panel) its working, but this video is stored on my computer.</p> <pre><code>using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Microsoft.DirectX.AudioVideoPlayback; namespace webplayer { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { try { int width = panel1.Width; int height = panel1.Height; System.Uri u = new Uri("http://cassfordinfo.com/Testmovie.avi"); Video video; video = Video.FromUrl(u); video.Owner = panel1; video.Stop(); video.Play(); // resize the video to the size original size of the panel panel1.Size = new Size(width, height); }catch(Exception gh) { MessageBox.Show(gh.ToString()); } } } } </code></pre> <p>Once I run the exe it will read from the website but I have unplugged the internet connection and run it. It runs the same video without a connection. I have restarted my computer and again if I run the exe file I can view the video.</p> <p>Whenever I need to run this program it should read it from my website not from temporary file. How can I achieve this?</p>
c#
[0]
5,860,137
5,860,138
Epi Twitter Api Question
<p>The Epi Twitter API files <a href="http://www.jaisenmathai.com/files/jaisenmathai_com_oauth_test.zip" rel="nofollow">here</a> do all but allow for the oauth_callback URL to be set. Does anyone know the code to add this?</p>
php
[2]
5,279,368
5,279,369
How to achieve the role played by "public static variables of Java" in JavaScript or a webpage?
<p>On my homepage I have to set a cookie using the name of the logged in user. The cookie <code>set</code> and <code>get</code> part has to be done in JS. On the subsequent sub pages I have to retrieve the <code>cookie(username)</code> using the <code>set</code> variable name. </p> <p>How can I store the username/cookie name so that it is publicly accessible across all the pages? This username will obviously change with each new user and is not constant.</p> <p>I have tried doing this using external JS file but in every new page the value is reset to default which I don't want.</p> <p>The exact solution to my problem is like the work done by:</p> <pre><code>public static variable </code></pre> <p>in Java (not final). I want to achieve this in JS.</p>
javascript
[3]
3,089,775
3,089,776
How to access a method of an Activity inside TabActivity
<p>I would like to access the public method of an Activity run by a TabActivity using:</p> <pre><code>TabHost tabHost = getTabHost(); Intent intentMsgsView = new Intent().setClass(this, TeamHuddleScreenMsgsView.class); tabHost.addTab(tabHost.newTabSpec("msgs").setIndicator("Messages").setContent(intentMsgsView)); </code></pre> <p>Basically, what I what is to let the parent Activity call a method in child Activity in order to do something. Is this possible?</p> <p>I did try this:</p> <pre><code>((TeamHuddleScreenMsgsView)getTabHost().getCurrentTabView().getContext()).refreshModel(); </code></pre> <p>but I'm encountering a ClassCastException. It seems that the getContext() still gives the TabActivity. Any help on how to get the child Activity? </p> <p>Thanks.</p>
android
[4]
4,570,990
4,570,991
Try to locate php bin in Red hat
<p>I am connecting through SSH to a Red Hat machine. I am not root. I try to localize the PHP interpreter (in Debian, that would be /usr/bin/php for example) but I don't find it. <code>which</code> is not installed and since I'm not root I cannot install rpm packages. I know php is installed because I can type php in terminal and it goes in read mode. I tried <code>find / -type d -name php</code> or f<code>ind / -type f -name ph</code>p and I got the output "terminated" which I guess means nothing was found. How could I locate php?</p>
php
[2]
5,091,318
5,091,319
Can't delete file (process cannot access the file because it is being used by another process)
<p>I try to delete files from a directory I specify. The first time it works great, but the second time it gives the next exception:</p> <blockquote> <p>The process cannot access the file 'C:\Users\DAAGEU\AppData\Local\Temp\Manual_Avatar\AdamBody_1K_Pants_Black_Blended.jpg' because it is being used by another process.</p> </blockquote> <pre><code>foreach (String file in Directory.GetFiles((userDirectory))) { try { //using (FileStream fs = new FileStream(file, FileMode.OpenOrCreate)) //{ //fs.Unlock(fs.Position, fs.Length); //fs.Dispose(); //fs.Close(); //} File.Delete(file); } catch (Exception) { throw; } } </code></pre> <p>It are only the images that seems to be "locked". I found some stuff on stackoverflow but nothing helped? I use some 3rd party software to generate the image.</p> <p>Any 1 knows how to fix this or work around it??</p> <p>ANSWER:</p> <p><strong>I found the problem. I was using WinForms and in one WinForm I was hosting a WPF control with the image. I found out that I didn't dispose that UC after closing it. So my fault I should have mensioned that also in this question...</strong></p>
c#
[0]
1,260,873
1,260,874
integrating buy.com in my ecommerce project
<p>i want to integrate buy.com in my ecommerce project in c#.means when i add product in my project,that product should get added on buy.com. can you give me the links which can help me in do this.or the basic requirements for doing this.</p>
asp.net
[9]
3,636,478
3,636,479
so in java you can't have duplicate method names with different return and params?
<p>Is it possible to have two methods with the same name but different parameters and return types in Java? Seems like it would be a good way to generalize a simple getter and setter.. You can do that with constructors why not with regular methods ? for example</p> <p>why not be able to do .. </p> <pre><code>int getVal() { return int; } boolean getVal() { return true; } setVal(int a) { } </code></pre> <p>and </p> <pre><code>setVal(boolean a) { } </code></pre>
java
[1]
5,155,757
5,155,758
Inheritance, any suggestions how I should improve this program?
<pre><code>public class Person{ private String name; private String surname; private int age; private String address; Person(String n, String s, int a, String i){ name = n; surname = s; age = a; address = i; this.name = name; this.surname= surname; this.age = age; this.address = address; } public String getName() {return name;} public String getSurname() {return surname;} public int getAge() {return age;} public String getAddress() {return address;} System.out.println(name+surname+age+address); Person(){ this("Ryan","Borg",25,"Gudja"); } } public class Student extends Person{ int mark; String credits; Student(){ } Student(String n, String s, int a, String i, int m, String c){ super(n, s, a, i); mark = m; credits = c; public String getName() {return name;} public String getSurname() {return surname;} public int getAge() {return age;} public String getAddress() {return address;} public int getMark(){return mark;} public String getCredits() {return credits;} System.out.println(name+surname+age+address+mark+credits); } } public class Teacher extends Person{ int salary; String subject; Teacher(){ } Teacher(String n, String s, int a, String i, int sal, String sub){ super(n, s, a, i); salary = sal; subject = sub; public String getName() {return name;} public String getSurname() {return surname;} public int getAge() {return age;} public String getAddress() {return address;} public int getSalary(){return salary;} public String getSubject() {return subject;} System.out.println(name+surname+age+address+salary+subject); } } </code></pre>
java
[1]
3,686,072
3,686,073
Minimize browser window
<p>Thanks for your replies. First I am explaining my requirement :-</p> <p>I created my own minimize and maximize button in my Application. When I click on minimize button, my application should minimize like our application (If we minimize any application in our PC, that application is displaying in our taskbar) I want my application should display in taskbar after minimize.</p> <p>I know how to resize the application to its minimum size. But resize is not ful filling my requirement.</p>
javascript
[3]
4,564,959
4,564,960
sorting by first group element in python
<p>I was wondering how can I make python order my collection of tuples so that first similar items would appear grouped and groups ordered by first item.</p> <pre><code>order group 3 1 4 2 2 2 1 1 </code></pre> <p>After sort</p> <pre><code>order group 1 1 3 1 2 2 4 2 </code></pre> <p>Python list</p> <pre><code>unordered = [(3, 1), (4, 2), (2, 2), (1, 1)] </code></pre>
python
[7]
614,569
614,570
What is the best update mechanism for a software cataloguing application?
<p>I'm developing an Android application very much like the the Android Market (now Google Play) in which I offer various softwares to user for installation. The difference is here that I want the user to be able to browse the applications even when there is no internet connectivity. That means I have to store the data on a local database (here I want to use sqlite) and this data needs to be updated periodically.<br> Now my question is this. How should I implement this update mechanism to have the best performance and availability?<br> I think I have a few options which is as following:</p> <ol> <li>To update the whole database every time. This way I have to download every single record every time to have the updated content.</li> <li>To update the data based on the date they were added. Although this seems a good way, but there is a possibility that the previously added content may be edited and they are omitted in this approach. Also there is this possibility that some of the items are deleted.</li> </ol> <p>These were what I thought I can do but I don't know which is best way to go on?! Also I am open to any other suggestion that might work here.</p>
android
[4]
4,591,984
4,591,985
About unsynchronized & synchronized access in Java Collections Framework?
<p>Can anyone explain what is unsynchronized &amp; synchronized access in Java Collections Framework? Thanks in advance.</p>
java
[1]
624,938
624,939
Loading bundled python framework dependencies using only python
<p>I've come across <a href="http://stackoverflow.com/questions/331377/">this question</a> but I don't like the solution that is presented. Shell scripting is operating system dependent. </p> <p>Is there a python solution to this problem?</p> <p>I'm not looking for python to machine code compilers, just a way to modify the include paths with python.</p>
python
[7]
2,148,872
2,148,873
Image in Linkbutton
<blockquote> <p><strong>Possible Duplicate:</strong><br /> <a href="http://stackoverflow.com/questions/1394346/how-to-display-image-on-linkbutton-to-look-attractive-in-asp-net">How to Display image on Linkbutton to look attractive in asp.net</a> </p> </blockquote> <p>hi i am using this code</p> <p> </p> <p>for display image in link button but i want to show text in between Link button... can anybody help me regarding this?</p>
asp.net
[9]
1,756,508
1,756,509
Android animate background image
<p>I have one Relative Layout and i have set it's background as drawable, which is a selector. </p> <p>There are total tow background to this Relative Layout and one is in state as selected and one is in non selected mode, both the states are handled in the drawable selector xml file. </p> <p>What i want to implement is when selector switch the background image from selected to not selected or vice-versa i want to display fade in/out animation. </p> <p>I found out that i need to use <code>android:exitFadeDuration="@android:integer/config_mediumAnimTime</code> for implementing this in xml file but i am using Android API level 8 and it does not have this property. </p> <p>So do i need to implement this in java code, how should i implement this in java?<br> Is there any other option to implement it in xml? </p> <p>Thanks.</p>
android
[4]
3,898,670
3,898,671
Using JQuery .load() with .hide() and .show() on page startup
<p>I'm using the following code to show a <code>div</code> on page startup:</p> <pre><code>$("#mydiv").hide().show("slow"); </code></pre> <p>This will make the <code>div</code> appear with a slow animation on page startup (page load / refresh)</p> <p>However, if, on page startup (page load / refresh), I want to insert HTML from another file into this <code>div</code> before this animation starts I try to do this:</p> <pre><code>$("#mydiv").load("myPage.html"); $("#mydiv").hide().show("slow"); </code></pre> <p>When I do this, the animation no longer works on startup (page load / refresh). How can I load html from another file and still have the animation work on page startup (page load / refresh)?</p>
jquery
[5]
4,345,667
4,345,668
Python: Check an index against multiple other indexes
<p>I am using Python and I would like to check the location of a value in a list of lists against other indexes.</p> <p>Like if I had 1 at (1, 1) I would want to be able to check if 1 were at the other indexes so I could make something happen based on which index it matched. </p> <p>For example:</p> <pre><code>list_of_lists = [ [4, 5, 6], [7, 1, 8], [6, 2, 9] ] if 1 in row for row in list_of_lists: if index of 1 is (0, 0), (0, 1), or (0, 2) print ("It is in the First row!") if index of 1 is (1, 0), (1, 1), or (1, 2) print ("It is in the second row!") </code></pre> <p>If this worked correctly it should print: "It is in the second row!" Because the index of 1 matches with one of the indices in the third if statement. They may not necessarily be rows in some instances where I would be using this. So If you could provide a way that would not use the rows in your answer. Just a way to look at indexes and compare them. Obviously this is not the correct syntax. But how would I do that in Python? How would I get the index of 1 and compare it to other indexes in a list of lists?</p> <p>Thanks!</p>
python
[7]
1,766,724
1,766,725
Split up words but not if it contains HTML
<p>I need a function or some regex to split up spaces in a string but to treat an HTML tag as a word.</p> <pre><code>$str = 'one two &lt;a href=""&gt;three&lt;/a&gt; four'; $x = explode(" ", $str); print_r($x); /* Returns: Array ( [0] =&gt; one [1] =&gt; two [2] =&gt; &lt;a [3] =&gt; href=""&gt;three&lt;/a&gt; [4] =&gt; four ) Looking for way to return: Array ( [0] =&gt; one [1] =&gt; two [2] =&gt; &lt;a href=""&gt;three&lt;/a&gt; [3] =&gt; four ) */ </code></pre> <p>Any ideas? Thanks</p>
php
[2]
4,926,935
4,926,936
Do reactive extensions and ETL go together?
<p>I don't fully understand reactive extensions, but my inital reading caused me think about the ETL code I have.</p> <p>Right now its basically a workflow to to perform various operations in a certain sequence based on conditions it find as it progresses.</p> <p>I can also imagine an event driven way such that only a small amount of imperative logic causes a chain reaction to occur.</p> <p>Of course I don't need a new type of programming model to make an event driven collaboration like that.</p> <p>Just the same I am wondering if ETL is a good fit for potentially exploring Rx further.</p> <p>Is my connection in a valid direction even? If not, could you briefly correct the error in my logic?</p>
c#
[0]
2,518,779
2,518,780
Read HTML file from Website and convert into App
<p>I am looking into developing an App that will convert a website into more readable data for an android app. I am at university and have an online notice board which can be viewed on the web but if possible I would like to transfer this into an app on android to make it more easy to read on mobile devices.</p> <p>What I thinking is that the app would go to the website where the notice board is held and read in the html code to display each notice in a list adapter view. Each notice is within its own div so I assume I could use that to split each notice up into its own button on the list adapter view. Is this possible and if so how I can go about doing this. I have tried google for an answer but I have not yet found a solution to this problem. </p> <p>Thanks for your help</p>
android
[4]
4,114,212
4,114,213
what happens when you declare the same object/variable more than once (newbie)
<p>what does something like this do?</p> <pre><code>static int i; // wrapped in a big loop void update_text() { std::stringstream ss; // this gets called again and again ++i; ss &lt;&lt; i; text = new_text(ss.str()); // text and new_text are defined elsewhere show_text(text); // so is this } </code></pre> <p>does is create a new instance of ss in the stack with a new address and everything? would it be smarter to use sprintf with a char array?</p>
c++
[6]
3,432,102
3,432,103
Javascript: explain this one line of code to me please
<p>I have this simple array:</p> <pre><code>var RedirUrl = new Array(4); RedirUrl[0] = 'http://mafi.se/mf_redir/new_install_'+this_version+'.html'; RedirUrl[1] = 'http://ifurls.com/mf_redir/new_install_'+this_version+'.html'; RedirUrl[2] = 'http://ez.se/xml-update/mf_redir/new_install_'+this_version+'.html'; RedirUrl[3] = 'http://ilovre.net/mf_redir/new_install_'+this_version+'.html'; RedirUrl[4] = 'http://rihel.com/mf_redir/new_install_'+this_version+'.html'; </code></pre> <p>and then</p> <pre><code>RedirUrl.sort(function() {return 0.5 - Math.random()}) </code></pre> <p>The last bit is what is confusing me. I understand the "sort" and I understand the <code>Math.random</code> but the <code>return 0.5</code> confuses me... what exactly is that?</p> <p>(Needless to say I downloaded it off the net as it does what i want it to do... but i just dont understand it.)</p>
javascript
[3]
4,177,489
4,177,490
An example where start and stop GPS is implemented
<p>I am working on an app that involves starting and stopping the GPS in code. I have not tried this before. Completely clueless. Would anyone be willing to provide a page with some implementation of these principles? Thanks</p>
android
[4]
4,972,675
4,972,676
Fancybox Ajax not loading in IE
<p>I have an issue the Fancybox Ajax.</p> <p>It works fine in FF, but not in IE7. The popup layout breaks and content didn't load.</p> <p>You can see it here: <a href="http://www.sumsy.com/temp/templatesys/config.php?template=1" rel="nofollow">http://www.sumsy.com/temp/templatesys/config.php?template=1</a></p> <p>Basically, on my php page, it has the following content:</p> <pre><code>&lt;div id="content"&gt; &lt;a href="config.php?template=1"&gt;Template 1&lt;/a&gt; &lt;a href="config.php?template=2"&gt;Template 2&lt;/a&gt; &lt;/div&gt; </code></pre> <p>On another page, I call it by using:</p> <pre><code>&lt;a id="changeTemplate" href="modules/templateList.php"&gt;Change Template&lt;/a&gt; </code></pre> <p>Not sure why it is not showing up properly in IE7. If i use iframe (class="iframe") instead, then it works fine.</p> <p>Thanks in advanced.</p>
jquery
[5]
1,600,467
1,600,468
where to download JAXP samples?
<p>I went to the <a href="http://jaxp.java.net/downloads.html" rel="nofollow">JAXP site</a> and tried to get the samples. I have downloaded the <strong>JAXP 1.4.5</strong> and <strong>JAXP 1.4.4 source bundle</strong> from there but none contains the samples. I checked my JDK7 folder and seemed there was no JAXP sample. Where can I find those samples which were referred from its Java Tutorial?</p>
java
[1]
4,575,989
4,575,990
how to make an anchor url via foreach using grabbed URL n TITLE
<p>I use preg_match_all to grab urls and titles from another page and grabbing is ok but i cant get them in to one using foreach! or is there another way instead of foreach?</p> <pre><code>//gets URLs of href='xxxx' preg_match_all('/a href="([^"]+)" class=l.+?&gt;.+?&lt;\/a&gt;/',$sear,$results); //gets titles of &gt;xxxx&lt;/a&gt; preg_match_all('/a href=".+?" class=l.+?&gt;([^"]+)&lt;\/a&gt;/',$sear,$t); </code></pre> <p>Below code Displays grabbed URLs</p> <pre><code>foreach ($results[1] as $url) { echo "&lt;a href='$url'&gt;$u&lt;/a&gt; &lt;br&gt;"; $i++; } </code></pre> <p>Below code Displays grabbed titles</p> <pre><code> foreach ($t[1] as $title) { echo $title; $i++; } </code></pre> <p>but i dont know how to display them(url &amp; title) in one foreach so i can make it like </p> <pre><code>&lt;a href='URL'&gt;Title&lt;/a&gt; </code></pre> <p>I'm new to php please help me!!</p>
php
[2]
3,314,211
3,314,212
How do I find out what user owns what process programmatically?
<p>Okay, so what I'm attempting to do is find out the name of the user for which a given process belongs to.</p> <pre><code> Process[] processList = Process.GetProcesses(); foreach (Process p in processList) { Console.WriteLine(p.Id); } Console.ReadLine(); </code></pre> <p>Currently, I can find out the process ID of each process, but not the user. Is there a way to tell who the user is that owns the process if I know the process ID? </p>
c#
[0]
567,533
567,534
wifi connection is getting closed when device is going in sleep/locked state
<p>I developed one application which is having set of activities and one background service , this application will talk to the server over WiFi, so when device is in active state my application is able to communicate with the server over Wifi but when device goes to sleep/locked state, after some time connection is getting close. So now able to understand why it is happening, it seems like Wifi is getting turned off automatically when device goes to sleep mode. Is there any way to set the WiFi state as On when my application is running either in foreground or in background?</p> <p>Please share your idea with some samples.</p> <p>Regards, Piks</p>
android
[4]
4,886,047
4,886,048
document.all["" + object.getAttribute("EndDate", true) + ""].value; do not work in firefox
<p><code>document.all["" + object.getAttribute("EndDate", true) + ""].value;</code> </p> <p>does work in firefox but work in IE.</p> <p>what is the alternative way other than the code above to work in multiple browsers?</p>
javascript
[3]
1,374,568
1,374,569
IndexOutOfBoundsException in Edit Text for android
<p>i have an edit text in my activity.i am entering numbers in it manually but </p> <pre><code> int mystart = destinationNumber.getSelectionStart(); int myend = destinationNumber.getSelectionEnd(); numberText.getText().replace(Math.min(mystart, myend), Math.max(mystart, myend), "1", 0, 1); </code></pre> <p>its entering fine according to the cursor position.</p> <p>i have a delete button in my acitivity which deletes single character according to cursor postion.</p> <pre><code>numberText.getText().delete(myend - 1, mystart); </code></pre> <p>But this logic is not working properly when i select whole text and call delete method it gives me IndexOutOfBoundsException OR i select 4-5 digits and call this delete.</p> <p>I want the same functionality as android contact dialpad number enter field.Can someone help me figure out what is the correct logic to delete single digit from edittext and multiple selected digits as well.</p> <p>Thanks</p>
android
[4]
3,342,876
3,342,877
Bad practice to put = inside javascript if statement?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2576571/javascript-assign-variable-in-if-condition-statement-good-practice-or-not">Javascript : assign variable in if condition statement, good practice or not?</a> </p> </blockquote> <p>Is it bad practice to assign/evaluate things inside an if statement?</p> <p>eg.</p> <pre><code>var foo; var bar = function() { .. } if(foo = bar()) { .. } </code></pre>
javascript
[3]
1,489,962
1,489,963
Setting a title for every page PHP
<p>I am trying to use the constructor to put a title on every page unless I specify what the title should be for the specific page...</p> <p>For the How it Works page.. the title should be "TeamPlayer - How it works!" (Which currently works) For the FAQ page the title should be "TeamPlayer" (Which currently doesn't work).</p> <p>I don't want to have to put the $data['title'] = 'TeamPlayer'; in every function. How do I fix my problem?</p> <pre><code> function __construct() { parent::__construct(); $data['title'] = 'TeamPlayer'; } public function howitworks() { $data['title'] = 'TeamPlayer - How it works!'; load_page('howitworks', $data); } public function faq() { load_page('faq', $data); } </code></pre> <p>EDIT:::</p> <p>I don't understand how I can be more descriptive in my problem.. To help those trying to help... Here is how I am echoing my titles in my views. I tried using some of the solutions provided but could not get them to function within my controllers</p> <pre><code>&lt;title&gt;&lt;?php echo $title; ?&gt;&lt;/title&gt; </code></pre>
php
[2]
1,511,038
1,511,039
Scope of a variable declared in a method
<p>Is a variable inside the main, a public variable? </p> <pre><code> public static void main(String[] args) { ......... for(int i=0;i&lt;threads.length;i++) try { threads[i].join(); } catch (InterruptedException e) { e.printStackTrace(); } long time=0; .... } </code></pre> <p><code>i</code> and <code>time</code> are they both public variables?</p> <p>Of course if my reasoning is correct, also any variable belonging to a public method should be considered public. Am I right?</p>
java
[1]
328,924
328,925
How to add multiple TextView s for a LinearLayout by Java Code ( in Android )
<p>Here is my code. In the resulting screen it shows only the first TextView. Not the second one. Im kind of new to Android and please give a help.</p> <pre><code>public class Details extends Activity { protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); TextView label = new TextView(this); label.setText("Moves"); label.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); label.setTextSize(20); TextView label2 = new TextView(this); label2.setText("Time"); label2.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); label2.setTextSize(20); LinearLayout ll = new LinearLayout(this); ll.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT)); ll.setOrientation(LinearLayout.VERTICAL); ll.addView(label); ll.addView(label2); setContentView(ll); } } </code></pre>
android
[4]
5,585,368
5,585,369
How configure phonegap with eclipse
<p>i am android developer. i am using eclipse platform to develop Application. Now onward i want to use phonegap to develop Application in android. i had done lots of effort to cofigure phonegap with eclips but yet that is not perfect. so kindly request to help me if you have good solution for that problem.</p> <p>Thanks ..</p>
android
[4]
3,132,184
3,132,185
Notice: Uninitialized string offset: 62 in /.../libraries/functions.php on line 316
<p>Man oh man I cannot figure this out... Please help. What a missing here?</p> <p>here are the errors:</p> <pre><code>Notice: Uninitialized string offset: 62 in /..../libraries/functions.php on line 316 Notice: Undefined variable: stilldo in /..../libraries/functions.php on line 322 </code></pre> <p>Here is the code:</p> <pre><code>function generate_password($length = 12, $letters = true, $mixed_case = true, $numbers = true, $punctuation = false){ ## Generate the alfa $alfa = ''; if($letters == true) $alfa .= 'abcdefghijklmnopqrstuvwxyz'; if($mixed_case == true) $alfa .= strtoupper('abcdefghijklmnopqrstuvwxyz'); if($numbers == true) $alfa .= '0123456789'; if($punctuation == true)$alfa .= '~!@#$%^&amp;*(),.=+&lt;&gt;'; ## Set Random Seed if(!function_exists('_generate_password_seed')): function _generate_password_seed(){ list($usec, $sec) = explode(' ', microtime()); return (float) $sec + ((float) $usec * 100000); } endif; srand(_generate_password_seed()); ## Generate the password $token = ""; for($i = 0; $i &lt; $length; $i ++) { $token .= $alfa[@rand(0, @strlen($alfa))]; } ## Check the length if(strlen($token) &lt; $length){ // echo $stilldo = $length - strlen($token); $token .= generate_password($stilldo); } ## Return the password return $token; } </code></pre> <p>I get this error 5 out of 10 times i run this function and I can't seem to crack it.</p>
php
[2]
4,561,288
4,561,289
c++ - relearning
<p>I haven't done C++ for about three years and looking to get back and ready. What is the best way? any open source projects that I might want to look at to recall all the details and be ready for interviews? I started reading (again) C++ Primer 5th edition but was wondering whether there's more efficient way since I did program in C++ for few years before. </p> <p>Just wanted to add: Does anyone know about open source projects related to finance? (e.g. servers, fix, etc)</p>
c++
[6]
2,242,466
2,242,467
Find id of last inserted row
<p>I have to simple tables in SQLite in my app and I need to insert into my tables values, but when I insert into the first I need to find value id ( primary key first column ) and that to be foreign key in second table. I know to find this with select last but is there better way to find this, id of last inserted row ?</p>
android
[4]
3,863,234
3,863,235
possible to extract functions from a javascript file?
<p>Not sure if this is the right approach of if this even a "good" question, but I'm loading a javscript as part of a plugin style architecture and I have the following problem:</p> <p>If a particular node has a reference to a plugin, I want to load that plugin per the url provided via the json description of that plugin. the description will have something like the following (or a functional equivalent):</p> <pre><code>{ "pluginSrc" : "http://mysite.com/plugins/1204.js", "configData" : { "someData", "someValue", "someMoreData", "etc" } } </code></pre> <p>When the javascript loads, I'll have an onload handler that will check to see if a function name exists on the window object and if so, create a new instance of that function and pass it the config data (more or less), this part works very well, with a few exceptions.</p> <p>Sometimes I do not have a reference to the name of the function that I need to invoke and there is no way to get it from the json. What would be ideal, is if I could tell which function was added to the window object on the script's onload callback and create an instance of that function. Is this possible? I only need to worry about modern browsers, particularly webkit. Apologies if the question isn't clear, I'd be happy to clarify, but producing a fiddle might be difficult as there's a lot of code to write to reach a minimal example.</p> <p>What I'm thinking about so far is to create some kind of global variable in the loaded script file like</p> <pre><code>function MediaAnalytics(){}; var LoadedClass = MediaAnalytics; </code></pre> <p>and just creating an instance of LoadedClass when the script is loaded, but this falls short of a panacea because I will not always be writing the plugin.</p> <p>EDIT: These scripts will most likely not be from the same domain.</p>
javascript
[3]
2,544,365
2,544,366
Want the Latitude and longitude as soon my device is restart
<p>I am making a app which is fully depend on latitude and longitude , I am getting the current latitude and longitude when i start the App at 1ts but now I want that when i off my device and restart the device and lunch the app I am getting my current latitude and longitude 0.0,0,0 Show any one can help me please where I am worng </p>
android
[4]
4,758,741
4,758,742
Python counting file extensions
<p>I am trying to print the file extension in a certain directory and the count of each extension.</p> <p>This is what I have so far...</p> <pre><code>import os import glob os.chdir(r"C:\Python32\test") x = glob.glob("*.*") for i x: print(i) &gt;&gt;&gt; file1.py file2.py file3.py file4.docx file5.csv </code></pre> <p>So I am stuck, I need my overall output to be...</p> <pre><code>py 3 docx 1 csv 1 </code></pre> <p>I have tried to use something like i.split("."), but I get stuck. I think I need to put the extension in a list and then count the list, but that is where I am running into problems.</p> <p>Thanks for the help.</p>
python
[7]
1,450,354
1,450,355
Using foreach loop to print all results
<p>I'm new to jQuery and I have got stuck on an each loop. </p> <p>I'm trying to get the values from a variable with objects and when I print it using <code>alert()</code>, I get all the results.</p> <p>But when I'm trying to print it to the HTML I only get the last result printed to the HTML instead of 3, in this case. </p> <pre><code>$.each(playlist, function(index, item) { alert(item.title); $('.playlist1').text(item.title); }); </code></pre>
jquery
[5]
679,966
679,967
Stop scroll on click on anchor in a tab navigation in jquery
<p>How to stop the window from scrolling when an anchor is clicked or opened? <a href="http://domainsoutlook.com/s/site/stackoverflow.com.html#meta_info" rel="nofollow">http://domainsoutlook.com/s/site/stackoverflow.com.html#meta_info</a> Try some other tabs and the window scrolls down.</p> <p>Also, could it be possible to reload the whole page when an anchor/tab is clicked/changed?</p>
jquery
[5]
1,726,378
1,726,379
problem in scrolling jtable
<p>I'm putting the table in JScrollPane, but my table is not supporting vertical scrollable...if anyone can tell me where I'm going wrong. Here is my code..</p> <pre><code>PreparedStatement pst=c1.prepareStatement("select * from entry where visit_to_person=?"); pst.setString(1,visit_combo.getSelectedItem().toString()); ResultSet rs =pst.executeQuery(); while(rs.next()) { vno= rs.getString(1); vnam=rs.getString(2); vtp=rs.getString(3); pur=rs.getString(4); in=rs.getString(5); dat=rs.getString(6); String s[]={vno,vnam,vtp,pur,in,dat}; Vector coldata=new Vector(Arrays.asList(s)); rowdata.add(coldata); } String[] head={"VISITOR NO","VISITOR NAME","VISIT TO PERSON","PURPOSE","IN TIME","DATE"}; colname=new Vector(Arrays.asList(head)); tableModel =new DefaultTableModel(rowdata, colname); table = new JTable(tableModel); // table.isCellEditable(i, n); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); JTableHeader header = table.getTableHeader(); JScrollPane pane = new JScrollPane(table); pane.setAutoscrolls(true); pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); pane.setSize(450,300); pane.setVisible(true); panel.add(pane,BorderLayout.CENTER); JFrame.setDefaultLookAndFeelDecorated(true); } </code></pre> <p><strong>i hope to get a reply soon</strong></p>
java
[1]
2,093,037
2,093,038
why java language forbid program update a collection when program iterate it?
<p>I know there is a InnerClass named"Itr" in java.util.AbstractList. and there is a field named "expectedModCount", a method named "checkForComodification". when iterator a collection but update the collection, this method will throw the ConcurrentModificationException I want to know why java language designed like this? what is the purpose to do like this.</p> <p>Thx !</p>
java
[1]
132,457
132,458
Avoiding a NullReferenceException
<p>I have used this code for extracting urls from web page.But in the line of 'foreach' it is showing </p> <blockquote> <p>Object reference not set to an instance of an object</p> </blockquote> <p>exception. What is the problem? how can i correct that?</p> <pre><code>WebClient client = new WebClient(); string url = "http://www.google.co.in/search?hl=en&amp;q=java&amp;start=10&amp;sa=N"; string source = client.DownloadString(url); HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(source); foreach (HtmlNode link in doc.DocumentNode.SelectNodes("//a[@href and @rel='nofollow']")) { Console.WriteLine(link.Attributes["href"].Value); } </code></pre>
asp.net
[9]
124,041
124,042
Is this workflow acceptable UI for iPhone?
<p>I have an arrow that points to the bottom for each table cell. When you click on a table cell, the screen doesn't move to another screen. Rather, the bottom picker changes depending on which cell you selected.</p> <p>Is this workflow acceptable according to Apple, or does it break guidelines? <img src="http://i.stack.imgur.com/vj5pP.png" alt="enter image description here"></p>
iphone
[8]
2,474,933
2,474,934
To know the logic behind it
<p>is there anybody who explain me this coding</p> <pre> public class FunctionCall { public static void funct1 () { System.out.println ("Inside funct1"); } public static void main (String[] args) { int val; System.out.println ("Inside main"); funct1(); System.out.println ("About to call funct2"); val = funct2(8); System.out.println ("funct2 returned a value of " + val); System.out.println ("About to call funct2 again"); val = funct2(-3); System.out.println ("funct2 returned a value of " + val); } public static int funct2 (int param) { System.out.println ("Inside funct2 with param " + param); return param * 2; } } </pre>
java
[1]
2,572,883
2,572,884
Jquery IF maybe?
<p>I use the following code to find a particular table, hide it then show it on click:</p> <pre><code>$(function() { $('.Nav table .navitem').hide(); $('.Nav table.navheader').click(function() { $(this).parent().parent().next().find(".navitem").slideToggle('100'); }); }); </code></pre> <p>Here is the HTML Output:</p> <pre><code>&lt;div class="Nav"&gt; &lt;table cellpadding="0" cellspacing="0" border="0"&gt; &lt;tr&gt; &lt;td&gt; &lt;table class="navheader" cellpadding="0" cellspacing="0" border="0" width="100%"&gt; &lt;tr&gt; &lt;td style="width:100%;"&gt;&lt;a navheader" href="#"&gt;Header&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;table border="0" cellpadding="0" cellspacing="0" width="100%" class="navSubMenu"&gt; &lt;tr&gt; &lt;td&gt; &lt;table class="ms-navitem" cellpadding="0" cellspacing="0" border="0" width="100%"&gt; &lt;tr&gt; &lt;td style="width:100%;"&gt;&lt;a class=" ms-navitem" href="#" style="border-style:none;font-size:1em;"&gt;Item&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>A basic accordion navigation hacked together from a table, however some of the .havheader's do not have .navitem's so I dont want these to be clickable.</p> <p>How best can i achieve this?</p>
jquery
[5]
5,162,896
5,162,897
ASP.NET Page does't show code behind code when clicking on Design code
<p>Page does't show code behind code when clicking on Design code and also code behind code display error as control not found</p> <p>Below code display error : System Error </p> <pre><code>&lt;%@Page Language="C#" AutoEventWireup="true" CodeFile="Register.aspx.cs" Inherits="Register" %&gt; </code></pre> <p>I don't why it fetches this type of error ,please help me </p> <p>Code Behind:</p> <pre><code>using System; </code></pre>
asp.net
[9]
1,313,299
1,313,300
Android - How to simply make a scrolling text from left to right
<p>how do i make a scrollable very long text that scrolls from left to right</p> <p>-I managed to make a scrolling textview by setting ellipsize="marquee" and making it always focusable but i need the text to be scrolling to the right not to the left</p> <p>if you have any suggestions your help will be very appreciated.</p>
android
[4]
5,036,304
5,036,305
Android export give a "Conversion to Dalvik format failed error1"
<p>When i try to export my android project i'm getting the following eclipse error message "Conversion to Dalvik format failed error1""</p> <p>i try the following steps but no luck..</p> <p>01.Project » Clean 02.add the following to eclipse.ini -Xms128m /-Xmx512m 03.Restarting Eclipse with the -clean option</p> <p>Export Steps: Right click on project->export->android under that select the "export android application"</p> <p>regards, Sam</p>
android
[4]
3,400,614
3,400,615
Is it possible to authenticate claims-aware wcf using ASP.NET Security Token Service as STS Server or do i have to user wcf token service only
<p>I have a STS server created using ASP.NET Security Token </p> <p>Service Web Site. I have a claims aware WCF service to which I add </p> <p>the sts reference of the above STS server. but when i create and try to access a method of clamis aware service i get "incoming policy not validated". </p> <p>My question is it possible to use together aspnet token service as sts server and claims aware wcf </p> <p>Thanks Nilesh</p>
c#
[0]
5,536,690
5,536,691
Add the last entry object into an arraylist using for-each loop java
<p>I am trying to get the last element of an Entry object and add into an arraylist of Entry objects(so it will only store one Entry object in the arraylist).The reason I am doing this is that I need that ArrayList to be used in another class.</p> <p>Source code:</p> <pre><code>ArrayList&lt;Entry&lt;String,Integer&gt;&gt; allEntries = new ArrayList&lt;Entry&lt;String,Integer&gt;&gt;(); Iterator &lt;Entry &lt;String,Integer&gt;&gt; entries = post.getCategory().entrySet().iterator(); while(entries.hasNext()) { Entry &lt;String,Integer&gt; entry = entries.next(); if(topic.getField("categoryName").equals(entry.getKey())){ int increaseCount = entry.getValue(); increaseCount++; entry.setValue(increaseCount); } for(Entry&lt;String,Integer&gt; entrySet : post.getCategory().entrySet()){ if(!entries.hasNext()){ allEntries.add(entrySet); } } </code></pre>
java
[1]
5,697,942
5,697,943
Hide a string using jQuery?
<p>I want to hide strings inside a div. Consider the following example where I want to hide "some".</p> <pre><code>&lt;div id="Disappear"&gt;Here is some text.&lt;/div&gt; </code></pre> <p>After calling the function it should be</p> <pre><code>&lt;div id="Disappear"&gt;Here is text.&lt;/div&gt; </code></pre> <p>Notice that the space remains reserved. Also the sentence and string to be hidden are random. </p> <p>What have I tried?</p> <p>Replacing the string with spaces. The solution is not elegant, since the width of the spaces can't always be equal to the string.</p> <p><strong>UPDATE</strong> I can't use <code>&lt;span&gt;</code> either. The actual div contains a lot more strings, using span is not an option.</p>
jquery
[5]
2,976,225
2,976,226
Show hide elements on anchor click in a different container
<p>I need to show a bunch of different flash banners. best I can figure is to hide them all, then show when the title is clicked</p> <pre><code>&lt;!-- list that holds links --&gt; &lt;ul id="bannerList" class="list"&gt; &lt;li&gt;Type &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;Flash banner1 120x600&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;Other Type &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;Flash banner2 120x600&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; &lt;div id="bannerTarget"&gt; &lt;div class="vert"&gt;alpha&lt;/div&gt; &lt;div class="horiz"&gt;one&lt;/div&gt; &lt;div class="horiz"&gt;two&lt;/div&gt; &lt;div class="horiz"&gt;three&lt;/div&gt; &lt;div class="horiz"&gt;four&lt;/div&gt; &lt;/div&gt; #bannerTarget .vert { width: 120px; height: 600px; margin: 0 auto; float: left; display: none; } #bannerTarget .horiz { width: 728px; height: 90px; margin: 0 auto; float: left; display: none; } </code></pre> <p>I dont want to write a click function for each link to show it's corresponding div, how would I make the function more utilitarian? I'm having issues connecting a link to it's appropriate div</p> <pre><code>$("ul#bannerList li a").click(function(e) { e.preventDefault(); $parent.addClass("selected").siblings().removeClass("selected"); var href = $(this).attr('href'); $href.css("display","block"); }); </code></pre> <p>This doesn't work...any ideas?</p>
jquery
[5]
251,498
251,499
How to keep selected item in dropdown list in php?
<p>I am using this code to switch language in my website. Everything works fine but when I change language always first item is selected. I want to keep selected which language is website language. Here is my code.</p> <pre><code>&lt;td width="85%" align=right class=top_section&gt; &lt;form method='POST'&gt; &lt;select name="switchlanguage" onchange="this.form.submit()"&gt; &lt;option value="en" &lt;?php if($_POST['switchlanguage'] == 'en') echo 'selected';?&gt;English&lt;/option&gt; &lt;option value="ru" &lt;?php if($_POST['switchlanguage'] == 'ru') echo 'selected';?&gt;Русский&lt;/option&gt; &lt;option value="tj" &lt;?php if($_POST['switchlanguage'] == 'tj') echo 'selected';?&gt;Точики&lt;/option&gt; &lt;/select&gt; &lt;/form&gt; &lt;/td&gt; </code></pre> <p>How to make it work properly? If russian language is selected it should stay in russian. But it always goes to English.</p> <p>And using this code to change website language</p> <pre><code>if(!isset($_POST['switchlanguage'])) { include_once($DOCUMENT_LANG.'en.lng.php'); } else { include_once($DOCUMENT_LANG.$_POST['switchlanguage'].'.lng.php'); } </code></pre> <p>Even when I use tab to enter dropdownbox and using down key, it is automatically goes to first item.</p>
php
[2]
2,373,782
2,373,783
Camera.Preview Callback not generating Camera Frames
<p>I have created a customized System Service, and i want my service to capture Camera frames in the background without Preview. I have followed the steps in developer.android website and implemented the following code, but it is not generating any frames. Here is the code:</p> <pre><code> public void startCapture() { //Start The camera int openCamera = 0;//default camera to be opened mCamera = Camera.open(openCamera); Camera.Parameters p = mCamera.getParameters(); setPreviewSize(p.getPreviewSize());//method to get Camera size mCamera.getParameters().setPreviewFpsRange(1, 2); try{ Camera.PreviewCallback mPreviewCallback = new Camera.PreviewCallback() { @Override public void onPreviewFrame(byte[] data, Camera camera) { // public void cameraPreview(byte[] data, Camera camera) { // TODO Auto-generated method stub decodeYUV420SP(rgb, data, width, height);//method for processing the image bitmap.setPixels(rgb, 0, width, 0, 0, width, height); String newFolder = "/Pictures"; String extStorageDirectory = Environment.getExternalStorageDirectory().toString(); File myNewFolder = new File(extStorageDirectory + newFolder); if (!myNewFolder.exists()) myNewFolder.mkdir(); File file = new File(path, "/Pictures/Frame-"+count+".jpg"); boolean fileCreated = file.createNewFile(); FileOutputStream out = new FileOutputStream(file); bitmap.compress(Bitmap.CompressFormat.PNG, 90, out); out.flush(); out.close(); }; }catch (Exception e) { e.printStackTrace(); } } mCamera.setPreviewCallback(mPreviewCallback); mCamera.startPreview(); } </code></pre> <p>I wanted the frames to be captured and Stored in the SD Card in the Mentioned path.but i am not getting it done. what am i doing wrong here. Need some Help! </p> <p>Thanks to the Replier in Advance.</p>
android
[4]
173,604
173,605
append html to <head> with JQuery
<p>My situation is that, I have page contains a button and some links. Whenever user click on the button, it tries to append tag <code>&lt;base&gt;</code> to <code>&lt;head&gt;</code></p> <pre><code>function avoidRediect(){ $('head').append('&lt;base target="_blank" /&gt;'); } </code></pre> <p>But the page does not take the effect(means the link is still opened in the same window). Is my way correct? Thank in advance.</p>
jquery
[5]
1,546,984
1,546,985
Why in_array() is not working in this case? (array from file())
<p>Why is this code not working?</p> <p>I have test.txt it contains:</p> <pre><code>A B C </code></pre> <p>My PHP code is:</p> <pre><code>$arr = file('test.txt'); if (in_array('A', $arr)) { echo 'A is found'; } </code></pre> <p>Result. nothing. But this following code works fine:</p> <pre><code>if (in_array('C', $arr)) { echo 'C is found'; } </code></pre> <p>Can someone help me?</p>
php
[2]
1,891,911
1,891,912
wifi connection is getting closed when device is going in sleep/locked state
<p>I developed one application which is having set of activities and one background service , this application will talk to the server over WiFi, so when device is in active state my application is able to communicate with the server over Wifi but when device goes to sleep/locked state, after some time connection is getting close. So now able to understand why it is happening, it seems like Wifi is getting turned off automatically when device goes to sleep mode. Is there any way to set the WiFi state as On when my application is running either in foreground or in background?</p> <p>Please share your idea with some samples.</p> <p>Regards, Piks</p>
android
[4]
3,840,240
3,840,241
I'm not a programmer. Just need to know if DART is an alternative to JAVA
<p>I am not a programmer and really did not know how much of the work I do online, relies on JAVA. Now that everyone has been asked to disable it- I have not been able to find any info, on potential alternatives. None of the articles sharing the information mention any alternative. Did Google just not market this thing? I'm confused.</p> <p><strong>Can I just download DART</strong> and have it run INSTEAD of my JAVA?** And then be able to continue on business as usual? Or is it way more complicated than that?</p> <p>EX- If my Chrome stopped working. I would have other options to download, like FireFox or IE and continue on with work.</p> <p>I just want to be able to use my computer like I do when Java is enabled. Is DART the type of software that will help me to do that?</p> <p>Any thoughts will be greatly appreciated!!!!! Thank you so much! : )</p>
javascript
[3]
1,743,063
1,743,064
C# XmlWriter.Create() - Access to path denied
<p>I want to write a new xml file to disk but the following code gives an error.</p> <pre><code>static void Main(string[] args) { using (XmlWriter writer = XmlWriter.Create(@"C:\abc.xml")) { writer.WriteStartDocument(); writer.WriteStartElement("Employees"); writer.WriteEndElement(); writer.WriteEndDocument(); } Console.ReadKey(); } </code></pre> <p>Can anybody help me with this?</p> <p>Note: abc.xml does not already exit.</p> <p>Regards, ZB</p>
c#
[0]
4,650,154
4,650,155
Merging Values into an Array
<p>I have a situation where i have to manually merge a label with value and then store in array. For instance <code>aaa 10 , bbb 20, ccc 30</code> </p> <p>The values are coming from text field and finally i have to bring this in such format... with comma seperated and label's are hardcoded.</p> <p>How to create an Array or a String like this <code>aaa 10 , bbb 20, ccc 30</code> with Key:Value pair</p>
javascript
[3]
5,893,773
5,893,774
Replace all " and ' from a string
<p>I want to replace all the " and ' from a string</p> <p>eg strings </p> <pre><code>"23423dfd "'43535fdgd ""'4353fg ""'''3453ere </code></pre> <p>the result should be</p> <pre><code>23423dfd 43535fdgd 4353fg 3453ere </code></pre> <p>I tried this <code>myString.Replace("'",string.Empty).Replace('"',string.Empty);</code> but its not giving me the correct result.</p>
c#
[0]
980,660
980,661
Java Project architecture
<p>Can anybody please explain the basic architecture of the project folder of a java project? I know it contains subfolders such as bin for binaries, src for source files, lib for external libraries but I would like to know the specific functions performed by files such as build.xml, project.xml, .project, build.properties? </p>
java
[1]
5,056,473
5,056,474
List<> and Contains scenario, compare get excluded and included using asp.net 2.0
<p>I have two List's that contain a object of Tag like List i need to find excluded and included to do an update operation how do find the difference in them both since they contain a Tag object. Can you use Contains function with a Tag object inside the list need some help. </p> <p>Im using asp.net 2.0 so please if you can help me do it in that language please.</p> <pre><code>List&lt;Tag&gt; tag1 = new List&lt;Tag&gt;() tag1.Add(new Tag("Apples")); tag1.Add(new Tag("Oranges")); tag1.Add(new Tag("Pears")); List&lt;Tag&gt; tag2 = new List&lt;Tag&gt;() tag2.Add(new Tag("Apples")); tag2.Add(new Tag("Bananas")); txtExcluded.Text = list1; txtIncluded.Text = list2 </code></pre>
c#
[0]
4,304,632
4,304,633
How do I pipe the output of file to a variable in Python?
<p>How do I pipe the output of file to a variable in Python?</p> <p>Is it possible? Say to pipe the output of <code>netstat</code> to a variable x in Python?</p>
python
[7]
4,887,388
4,887,389
Recognise user without using IP
<p>I need to grant access to user with or without credentials.<br> I have tried the <code>SERVER[remote_addr]</code> but it didn't work due to dynamic IP used in the company.<br> Any suggestions? </p>
php
[2]
3,304,351
3,304,352
Battery usage by running application in Android
<p>i am looking for battery usage by application in android.How can i achieve it programmatically? i want for wifi GPS.</p> <p>Your help will be appreciated..</p> <p>thank you.</p>
android
[4]
2,080,017
2,080,018
Help - use PHP-broswer, or proxy or get_page_contents or include page, or something else?
<p>I am trying to develop a web application for which I need to capture a specific user-driven event (such as mouse dblclick) occurring on a different-website page loaded through my website.</p> <p>What I want to do is :</p> <ol> <li>User visits my website - hosted by me.</li> <li>There, user types in any website URL (e.g.: <a href="http://www.example.com" rel="nofollow">http://www.example.com</a>)</li> <li>That URL page gets loaded as is. </li> <li>When user double-clicks mouse over any link or image from that page, a popup/side-panel is displayed with content related to that particular image or link.</li> </ol> <p>I can do this with a combination of PHP get_page_contents or include-page, and javascript dblclick. However, when user clicks on any link or submits a form, the control goes to that other website, where I cannot show the side-panel. I might be able to handle the links by proxifying them when user clicks on any of them. How do I handle forms submission and other stuff ? I can use a full-featured proxy, but that will be too heavy just for the purpose of capturing the event.</p> <p>My question is that is there a way to write some kind of light PHP script that sits on my website - that loads other websites contents as is, but lets me capture the mouse-dblclick event to show related-content in the side panel .</p> <p>I have already searched the internet, but could not find anything.</p> <p>Any help is really appreciated. Thanks.</p>
php
[2]
4,849,087
4,849,088
Provision to convert mp3 to wav file in python and tutorial for audio processing using python [pymedia]
<p>I am a new to python and matlab. I wanted to know whether is there any provision for converting a mp3 file to wav using any pymedia functions or the function like'MP3WRITE' and 'MP3READ'in matlab? any good tutorial for audio processing tutorial using python?</p>
python
[7]