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 |
---|---|---|---|---|---|
744,687 | 744,688 | Derived to base class conversion | <p>How does the conversion between derived and base class internally occurs and how does compiler knows or does it store the size of object?</p>
<p>For example in the following:</p>
<pre><code>class A
{
public:
A():x(2){};
private:
int x;
};
class B : public A
{
public:
B():A(),y(5){};
private:
int y;
};
class C : public B
{
public:
C():B(),z(9){};
private:
int z;
};
int main()
{
C *CObj = new C;
B *pB = static_cast<B*>(CObj);
delete CObj;
}
</code></pre>
<p><strong>Edit:</strong> It must have been this:</p>
<pre><code>B BObj = static_cast<B>(*CObj);
</code></pre>
| c++ | [6] |
2,545,886 | 2,545,887 | Quick Jquery slideUp/Down question | <p>Hey guys quick question, I have a function and it works when you click close, it slides up. However I want it to slide down by default when you first go to the page and it is just appearing right now, not sliding down.</p>
<pre><code>$(document).ready(function(){
$("#related2").slideDown();
$(".close2").click(function(event) {
event.preventDefault();
$("#related2").slideUp();
});
});
</code></pre>
| jquery | [5] |
5,720,151 | 5,720,152 | sort datatable according to datetime column | <p>I am using DataTables to display some data and it works great but I want to customize it slightly and not sure how.</p>
<p>i want to show record which are sorted according to datetime in desending order when datatable will be drawn...</p>
| jquery | [5] |
5,070,864 | 5,070,865 | How can i change scroll bar track color from a set position? | <p>I have two horizontal scroll bars and they move together, My two documents are different widths.</p>
<p>The scroll bar that will not scroll all the way must have red highlighting on the position it wont affect the web browsers scrolling.</p>
<p>In the picture below the right hand web browser is at its full webBrowser2Document.Body.ScrollRectangle.Right but the left had browser can still scroll more.</p>
<p>So when a web browser position reaches webBrowser2Document.Body.ScrollRectangle.Right, how can i turn the remaining track red?</p>
<p>Or even better how can i set a portion of the track color to be red from a position on wards. </p>
<p><img src="http://i.stack.imgur.com/f4IiW.png" alt="enter image description here"></p>
| c# | [0] |
1,291,244 | 1,291,245 | Is it possible to find object's class in the list of objects? | <p>I've got a list of objects = { obj1,obj2,obj3 }</p>
<p>Every class of the objects is inherited from the same interface</p>
<pre><code>interface IObjects
class Obj1:IObjects
class Obj2:IObjects
class Obj3:IObjects
</code></pre>
<p>And I want to find object of Obj1 class for examp.
How to do it?</p>
| c# | [0] |
4,742,758 | 4,742,759 | Instantiating a legacy COM object in C# dynamically (using its ID in a string) | <p>In Python, when I want to use this COM object, all I do is <code>win32com.client.Dispatch("Myapp.Thing.1")</code> and it gives me an object which I can call methods and such on. </p>
<p>I want to do this in C# and, shockingly, I can't seem to figure out how. I do <em>not</em> want to use one of those automatically generated COM wrappers, for reasons I can't get into. I need to do the late binding, dynamic COM of times past.</p>
<p>I've tried doing this, but I get a Null Ref Exception on the invoke call. </p>
<pre><code>Type t = Type.GetTypeFromProgID("Myapp.Thing.1")
o = Activator.CreateInstance(t)
t.GetMethod("xyz").Invoke(o, args)
</code></pre>
<p>Any example code that is able to load up a COM object by its name and use it in some basic manner would be ideal. </p>
| c# | [0] |
754,285 | 754,286 | Automatic line break in asp.net textbox control | <p>I have a scenario in my application, by saving a text of length 20000 chars without line break in between.When i retrieve the same to an asp.net textbox control my UI is stretching to the length of these 2000 chars in a single line . I have to wrap the text automatically inside text box.
Can any one help to solve this issue ?</p>
<p>Thanks in advance.
Pradeep</p>
| asp.net | [9] |
4,197,935 | 4,197,936 | ImageIcon not displayed after creating jar | <p>i'm trying to make a small project in java with no luck
if i'm compiling the program with eclipse everything is good, but when i'm i creating the jar file i get a blank window</p>
<p>this is the image i declared for:</p>
<pre><code>public ImageIcon BACKGROUND = new ImageIcon() ;
</code></pre>
<p>I have tried to do the following stuff:</p>
<p>1.</p>
<pre><code>new ImageIcon("Images/wood.jpg").getImage());
</code></pre>
<p>2.</p>
<pre><code>this.BACKGROUND.setImage(Toolkit.getDefaultToolkit().getImage("Images/wood.jpg"));
</code></pre>
<p>3.</p>
<pre><code>this.BACKGROUND = new ImageIcon(getClass().getResource("Images/wood.jpg"));
</code></pre>
<p>4.</p>
<pre><code>/** Returns an ImageIcon, or null if the path was invalid. */
protected ImageIcon createImageIcon(String path,
String description) {
java.net.URL imgURL = getClass().getResource(path);
if (imgURL != null) {
return new ImageIcon(imgURL, description);
} else {
System.err.println("Couldn't find file: " + path);
return null;
}
}
</code></pre>
<p>1 & 2 showing the images after compiling and 3 & 4 returns null</p>
<p>another think is that i'm using mac and when i'm working with windows no image is displayed after compiling.</p>
| java | [1] |
691,479 | 691,480 | Getting the list of distribution lists using ewp api in c# | <p>I want to get all distribution lists & the members of those lists using the ewp api in c#.
I made the connection to the outlook server and I can get the calendar information of mine using c#. But I couldn't find a way to get the distribution lists.</p>
| c# | [0] |
1,950,835 | 1,950,836 | Hovering list items with nested divs | <p>I'm using an old jquery version, that's why live() is used below.</p>
<pre><code>$('#searchresult li').live({
mouseenter: function () {
$(this).addClass('active');
},
mouseleave: function () {
$(this).removeClass('active');
}
});
</code></pre>
<p>My html structure:</p>
<pre><code><ul id="searchresult">
<li>
<div>a</div>
</li>
</ul>
</code></pre>
<p>Css:</p>
<pre><code>.active { background-color: Red; }
</code></pre>
<p>My code works in every browser but IE7. The background color flickers, and I guess that's because it only changes when I hover the list element and not the div.</p>
<p>Is there any way to include the divs?</p>
<p>Update: </p>
<h1><a href="http://jsfiddle.net/yTsw5/3/show/" rel="nofollow">Fiddle</a></h1>
| jquery | [5] |
4,517,437 | 4,517,438 | Store a huge html string in a string variable | <p>I have this html string:</p>
<pre><code><h1>MDPI Open Access Information and Policy</h1>
<div class="info-intro">All articles published by MDPI are made available under an open access license worldwide immediately. This means:
<ul>
</code></pre>
<p>And i would like to store this in a string: </p>
<pre><code>String abaut="<h1>MDPI Open Access Information and Policy</h1>
<div class="info-intro">All articles published by MDPI are made available under an open access license worldwide immediately. This means:
<ul>";
</code></pre>
<p>And i am gotting some problems: the string is not accepted because of some " inside of the string and some new lines. How can I do this differently?</p>
| android | [4] |
1,447,174 | 1,447,175 | C++ return local object | <p>Several co-workers and I are having a debate about what happens when a local variable (allocated on the stack) is returned from a C++ method. </p>
<p>The following code works in a unit test, but I believe that is only because the unit test is lucky and doesn't attempt to reuse the memory on the stack used by obj. </p>
<p><strong>Does this work?</strong></p>
<pre><code>static MyObject createMyObject() {
MyObject obj;
return obj;
}
</code></pre>
| c++ | [6] |
1,725,626 | 1,725,627 | How to delete files from iPhone's document directory which are older more than two days | <p>I have an App in which I record the sound files and store it in apps Document Directory.</p>
<p>What I want is, it should contain only yesterday and to days older files and remove all others from the folder in iPhone app. Is there any way to do this?</p>
<p>Thanks ..</p>
| iphone | [8] |
3,411,517 | 3,411,518 | how to call activity from inputmethodservice and pass data to Inputmethodsevice from activity | <p>I have a soft keyboard as a inputmethodservice calling an activity. A button is pressed and a scanner is activated. The scanner activity captures a set of data then returns the data to the inputmethodservice for filling in a text field on a browser.</p>
<p>How do I return the scan value of the activity back to the inputmethodservice and how to set to getCurrentInputConnection().commitText(data, 1)?
the following snnipet for call scannerActivity</p>
<pre><code>final Intent intent = new Intent(Intent.ACTION_MAIN, null);
final ComponentName cn = new ComponentName(
"com.example.android.softkeyboard",
"com.example.android.softkeyboard.ScannerActivity");
intent.setComponent(cn);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
</code></pre>
| android | [4] |
409,534 | 409,535 | Nutiteq GPS tracking | <p>iam a newbie for this kind of development. im trying to create an android application which involves GPS tracking. i am using Nutiteq because i have to use openstreetmap as the default map. please help me.</p>
| android | [4] |
1,069,845 | 1,069,846 | double truncates at 7 characters of output | <pre><code>double fat = 0.2654654645486684646846865584656566554566556564654654899866223625564668186456564564664564;
cout<<fat<<endl;
</code></pre>
<p>results in:</p>
<blockquote>
<p>0.265465</p>
</blockquote>
<p>Should it be 7 charcters longer? I thought that a double could hold more than that?</p>
<p>I also get the same result of a "long double".</p>
| c++ | [6] |
5,387,480 | 5,387,481 | Navigating to a project document from a LinkButton | <p>I am trying to get an excel file to popup on a page in a new window when a user clicks an asp:linkbutton on a webform. I am setting it up to use the OnClick function and in the code behind I do a respond.redirect to the location of the excel file in the project. You can see this in the code below. For some reason it is not working, I get a blank page that pops up in my browser. Is this even best practices? I could also direct the link to shared network drive where there excel files can be stored but that just seems a little too complicated. </p>
<pre><code><asp:LinkButton ID="btnCBFormat" runat="server" Text="CB Format Example" OnClick="btnCBFormat_Click" Target="_blank" />
<asp:LinkButton ID="btnMBFormat" runat="server" Text="MB Format Example" OnClick="btnMBFormat_Click" Target="_blank" />
protected void btnCBFormat_Click(object sender, EventArgs e)
{
Response.Redirect("//Chargebacks/Formats/CBFormat.xsl");
}
protected void btnMBFormat_Click(object sender, EventArgs e)
{
Response.Redirect("//Chargebacks/Formats/MBFormat.xls");
}
</code></pre>
| asp.net | [9] |
3,138,685 | 3,138,686 | Uploading video to Youtube from PHP driven webpage | <p>It is possible to upload a video file from my own webpage on you tube without using google. If yes how to do it?</p>
| php | [2] |
370,897 | 370,898 | Need for disabling Viewstate | <p>I understand the use of View state. Any material that talks about view state, explains the need and use of it. However there is an option provided at every control level/ page level to disable it as well.</p>
<p>In what circumstances we might want to disable the viewstate of a page or control? </p>
<p>From an online material, I read that, </p>
<blockquote>
<p>If the page doesn't have any dynamic data, data to be persisted
between round trips we can disable viewstate.</p>
</blockquote>
<p>I agree to this statement, but what's the advantage of doing this? What do we get out of it?</p>
| asp.net | [9] |
1,219,599 | 1,219,600 | When we go for Abstract class and when we go for Interface? | <blockquote>
<p><strong>Possible Duplicates:</strong><br>
<a href="http://stackoverflow.com/questions/56867/interface-vs-base-class">Interface vs Base class</a><br>
<a href="http://stackoverflow.com/questions/479142/when-to-use-an-interface-instead-of-an-abstract-class-and-vice-versa">When to use an interface instead of an abstract class and vice versa?</a><br>
<a href="http://stackoverflow.com/questions/2869222/use-of-java-interfaces-abstract-classes">Use of Java [Interfaces / Abstract classes]</a> </p>
</blockquote>
<p>Can anyone give one real scenario to when we choose Abstract Class and when we choose for an Interface?</p>
| java | [1] |
3,617,376 | 3,617,377 | ASP.NET - Dynamically created button | <p>I have added a dynamically created button in my Webform. But its click event is not working. Can anyone please explain why?</p>
<p>This is my code:</p>
<pre><code> Button save = new Button();
save.ID = "btnSave";
save.Text = "Save";
save.Click += new System.EventHandler(this.Save_Click);
Webform.Controls.Add(save);
protected void Save_Click(object sender, EventArgs e)
{
Response.Redirect("Default.aspx");
}
</code></pre>
<p>Its coming back to the same page itself. It is not redirecting to Default.aspx.</p>
| asp.net | [9] |
2,328,070 | 2,328,071 | Traceview maximum record time? | <p>I am using Debug.startMethodTracing and Debug.stopMethodTracing to optimize a piece of code that takes about 30 sec to execute but when I open the trace file with trace view it only shows me about 6.5 secondes of trace data. </p>
<p>Any clues ?</p>
| android | [4] |
3,623,598 | 3,623,599 | weird ! and space character while sending mail | <p>So here is my situation : On a godaddy server, I've got a php script which sends periodically html emails (a kind of newsletters). And for a reason I can't explain, in some of the emails I send (always at the same exact spot), a ! character appear, along with an unusual space. Here are some example : </p>
<ul>
<li>"I am ! so certa in" instead of "I am so certain" </li>
<li>"that anger ! at them" instead of "that anger at them"</li>
<li>"to be childre! n during" instead of "to be children during"</li>
</ul>
<p>Some more details regarding the script's mechanics : it reads the content email from .html files (converted from a .doc file - I know that's a wierd idea, and the html code generated is shitty, the formatting aim to resolve this issue), does some formatting, and sends it with the appropriate headers. What I did try to diagnose the issue : </p>
<ul>
<li>Tried to view the email with different software (from my gmail account, my old Windows live mail account and outlook). It's all the same.</li>
<li>Tried to change the charset of the email (from utf-8 to ISO-8859-1).</li>
<li>Made sure there was not any rogue character by using the html_entity_decode function.</li>
<li>Checked if the file on the server didn't get deformed for some random reason - and it's note.</li>
</ul>
<p>So any idea about this?</p>
| php | [2] |
636,608 | 636,609 | Difference between eval and setTimeout execute string code | <p>I know that <code>eval</code> and <code>setTimeout</code> can both accept a string as the (1 st) parameter, and I know that I'd better not use this. I'm just curious why is there a difference:</p>
<pre><code>!function() {
var foo = 123;
eval("alert(foo)");
}();
!function() {
var foo = 123;
setTimeout("alert(foo)", 0);
}();
</code></pre>
<p>the first would work, and the second will give an error: <code>foo is not defined</code></p>
<p>How are they executed behind the scene? </p>
| javascript | [3] |
1,587,118 | 1,587,119 | ObjectFile problem | <p>I have created sample application in iphone 2.0... Now i want to make this application as object files ...</p>
<p>How can i do this?</p>
<p>Can anyone help me ?
Thanks in advance.....</p>
| iphone | [8] |
2,519,498 | 2,519,499 | Is the value of i defined after: int i, j = 1; | <p>Given:</p>
<pre><code>int i, j = 1;
</code></pre>
<p>Is the value of <code>i</code> defined? If so, what is it?</p>
<p><sup>I suspect this is a duplicate, but it's somewhat hard to search for - if anyone can find it let me know.</sup></p>
| c++ | [6] |
2,164,114 | 2,164,115 | Deleting line breaks in a text file with a condition | <p>I have a text file. Some of the lines in it end with lf and some end with crlf. I only need to delete lfs and leave all crlfs.</p>
<p>Basically, my file looks like this</p>
<blockquote>
<p>Mary had a lf</p>
<p>dog.crlf</p>
<p>She liked her lf</p>
<p>dog very much. crlf</p>
</blockquote>
<p>I need it to be</p>
<blockquote>
<p>Mary had a dog.crlf</p>
<p>She liked her dog very much.crlf</p>
</blockquote>
<p>Now, I tried just deleting all lfs unconditionally, but then I couldn't figure out how to write it back into the text file. If I use File.WriteAllLines and put a string array into it, it automatically creates line breaks all over again. If I use File.WriteAllText, it just forms one single line.
So the question is - how do I take a text file like the first and make it look like the second? Thank you very much for your time.
BTW, I checked similar questions, but still have trouble figuring it out.</p>
| c# | [0] |
1,369,865 | 1,369,866 | jQuery write in a text input | <p>I have a form upload</p>
<p>I need a jQuery function that will write in a hidden text input what is written in the input file.</p>
<p>So I have :</p>
<pre><code><input class="addFile" id="field2" name="fileLyric" type="file" />
</code></pre>
<p>Whatever will be written there by the uploading (obviously the file path) should be then automatically written in a hidden text input</p>
<pre><code><input id="field2hidden" name="fileLyrichidden" type="text" style="display:none"/>
</code></pre>
<p>Is there a way to achieve this?</p>
<p>Thank you!</p>
| jquery | [5] |
5,946,060 | 5,946,061 | Why do two regex literals in my Javascript vary on a property? | <p>I read in <em>Javascript: The Good Parts</em> by Douglas Crockford that javascript regular expression literals share the same object. If so, then how come these two regex literals vary in the <code>lastIndex</code> property?</p>
<pre><code>var a = /a/g;
var b = /a/g;
a.lastIndex = 3;
document.write(b.lastIndex);
</code></pre>
<p><a href="http://jsfiddle.net/5gTR2/" rel="nofollow">JS Fiddle</a></p>
<p>0 is outputted as opposed to 3.</p>
| javascript | [3] |
1,074,251 | 1,074,252 | Is it possible to access private variable of javascript function | <p>Suppose I have a JavaScript function. and it contain a variable x;</p>
<pre><code>function A(){
var x = 12+34;
}
</code></pre>
<p>Is it possible to access x from outside function x?</p>
| javascript | [3] |
2,771,874 | 2,771,875 | database implementation in window based application | <p>I am new in iPhone programming. I am making an application in which there is need of database implementation to store the data. But I dont know how should I start for it. Application is window based. Please give me some hint so that I would be able to implement database concept.</p>
<p>Thanks alot.</p>
| iphone | [8] |
2,017,366 | 2,017,367 | Android Set up Question - Which API Level do I Install? | <p>I'm trying to set up the Android SDK on Ubuntu. Someday I want to make apps that can reach most of the market.</p>
<p>I've heard I need to make the apps compatible with Android 1.6 for this. Does that mean everything I install should be for Android 1.6 (API level 4?). Will I have any trouble running the apps on my phone with is Android 2.1?</p>
| android | [4] |
17,167 | 17,168 | i cant pass from array in the textfields numbers | <p>Hi I have to do a lottery with numbers when I first choice in a panel when I press Start it should serve me a panel with figures given them passed to the constructor panel but while I normally displays the panel the numbers in the <code>JTextField</code> does not apper.</p>
<p>The code when I press the button to make a panel with numbers at the function that returns to 2nd table numbers I put here a system.out and she shows them normally underneath its constructor passing the table as a parameter.</p>
<pre><code>if (source == start) {
try {
int numbers[][] = fucts.takeBulletin();
RMIClient r=new RMIClient( numbers,1);
}catch() {
}
}
</code></pre>
<p>heare is the constructor code </p>
<pre><code>public RMIClient(int [][]numbs,int a) {
super("!!!!!!!!!!!!!!!BINGO!!!!!!!!!!!!!!!!!!");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
Container pane = getContentPane();
GridLayout layout=new GridLayout(7 , 7);
pane.setLayout(layout);
pane.add(numB);
pane.add(numI);
pane.add(numN);
pane.add(numG);
pane.add(numO);
pane.add(num13);
for (int row = 0; row < numbs.length; row++) {
for (int col = 0; col < numbs[row].length; col++) {
pane.add(new JTextField(""+numbs[row][col])); <----- is nedd " "+
}
}
setContentPane(pane);
pack();
}
</code></pre>
<p>I can not understand why they do not pass the values from the table in textfield , is show me empty textfields </p>
| java | [1] |
3,183,332 | 3,183,333 | Java Coding Style | <p>I have been programming in java for around 3 to 4 years now...but the frequent feedback am getting is that am not using methods effectively.People above me are stating that good coders do keep the lines of code within a method within 25 lines.But how much ever i struggle or try to implement more methods ...i keep writing more lines of code in my methods say 50 to 100.</p>
<p>Any suggestions on whether my coding style is wrong or can continue the way am coding..</p>
<p>I've tried reading books like Effective java , Thinking in Java...but when it comes to actual code i tend to elaborate..</p>
<p>Suggestions to improve myself will be highly helpful for me!!!</p>
| java | [1] |
5,022,816 | 5,022,817 | Site structure in PHP, with examples...Please | <p>I've been reading about site structure in PHP, but whenever I read or ask questions about site structure, I get something like this</p>
<pre><code> /application
/config
application.ini
/controllers
/views
/models
bootstrap.php
/var
/log
/tests
/controllers
/views
/models
/libraries
/mylib
/myframework
/web_root
/media
/js
/css
index.php
.htaccess
</code></pre>
<p>Now this is a good answer, but I still dont fully comprehend. It would help a lot more if I could get some examples of good site structures with actual files in place (and what they do), or at least with explanations on what each folder is meant to hold explicitly.</p>
<p>Thank you</p>
| php | [2] |
766,613 | 766,614 | How to extract declarations (a .hpp file) from implementation (a .cpp file)? | <p>I was wondering if there was a tool (maybe GNU C++ compiler) to obtain from a .cpp file
full of functions a .hpp file with the mentioned functions declarations.</p>
<p><strong>Example</strong>:</p>
<p>I have:<br>
magic.cpp</p>
<pre><code>int foo() { return 42; }
char bar() { return 'z'; }
</code></pre>
<p>And I would like to obtain this after applying the wonderful tool:<br>
magic.hpp</p>
<pre><code>int foo();
char bar();
</code></pre>
| c++ | [6] |
4,238,643 | 4,238,644 | Content Providers or Application Cache directory for storing image path | <p>i am trying to perform an action where i can access and tag images stored in the sd-card from my application based on certain actions.
i would like to know the best way to temporary store the image path or the images, so that the application always remembers the set tagged images when ever it gets restarted(so the user does not have to do it all over again) and the images are still available on the sdcard when the application gets deleted or uninstalled. </p>
<p>should i use a content provider or the applications cache?.. Any other solution is highly appreciated. </p>
| android | [4] |
1,879,990 | 1,879,991 | How to give my paid app to someone for free | <p>I have an app on the app store which is a paid-for app. Is there a way of giving my app away to certain people via email for free? </p>
<p>I don't mean 'gifting it' because that would cost me 30%. I mean completely free for both parties?</p>
| iphone | [8] |
5,087,743 | 5,087,744 | php date ('m') is show single digit month and not double | <p>according to php.net date('m') should should 01 but i'm getting 1 instead</p>
<pre><code>dirloc = date('Y') . "/" . date('m') . "/" . $word_id . "/";
</code></pre>
| php | [2] |
4,529,285 | 4,529,286 | Unable to add to object prototype | <p>I have this Object Literal: </p>
<pre><code>var RPSPlayer = {....}
</code></pre>
<p>and I want to make new "children" from this object by using:</p>
<pre><code>var player1 = new Player(randomPlay);
</code></pre>
<p>When I try to add a function to a <code>Player</code> prototype like this:</p>
<pre><code>function Player(play) {
this.prototype.play = play;
return play;
};
</code></pre>
<p>I get an error.</p>
<p><code>play</code> is a function returning a string which Player function gets as a parameter.</p>
<p>The problematic line is:</p>
<pre><code> this.prototype.play = play;
</code></pre>
| javascript | [3] |
1,494,103 | 1,494,104 | how to properly execute if in android? | <p>Can anyone please tell why the <code>if</code> statement never gets executed even though I enter <code>ran</code> in the edit text field and press <kbd>ok</kbd>? When the user enters <code>ran</code> and presses the button <kbd>ok</kbd>, I want another button to become visible which enables him to stop the current activity. Basically I want to know why the <code>if</code> is skipped.</p>
<pre><code>public class Reciever extends Activity{
protected static final String TAG = null;
private Button ok,stp;
private TextView tv;
private EditText ev;
private String s1,s2,s3,s4;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
s1="nar";
setContentView(R.layout.stop);
tv=(TextView) findViewById(R.id.textView1);
tv.setText(s1);
ev=(EditText) findViewById(R.id.editText1);
ok=(Button) findViewById(R.id.ok_button);
ok.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
s2="ran";
tv.setText(ev.getText().toString());
s3=ev.getText().toString();
if(s3==s2)//not going inside this loop
{
stp=(Button) findViewById(R.id.stopb);
stp.setVisibility(View.VISIBLE);
stp.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
finish();
}
});
}
}
});
}
}
</code></pre>
| android | [4] |
3,073,172 | 3,073,173 | URL in JOptionPane | <p>How can I add a clickable URL into a JOptionPane (in the middle of a text) ?</p>
| java | [1] |
2,659,155 | 2,659,156 | Mini calendar to control main calendar | <p>I am using <a href="http://arshaw.com/fullcalendar/" rel="nofollow">arshaw's fullcalendar</a> on my website - I want to have a mini version of this calendar on my admin page that I could use for admin functions. The main calendar for public viewing should have admin functionality disabled.</p>
<p>What is the best way to accomplish this?</p>
| jquery | [5] |
4,011,957 | 4,011,958 | PHP assigment operator =& | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1768343/reference-assignment-operator-in-php">Reference assignment operator in php =&</a> </p>
</blockquote>
<p>What does the <em>=&</em> assigment operator mean in PHP? I could not find any reference in PHP Manual in assignment section.</p>
<p>I saw it in a class instantiation, so I quite don't understand what's the difference between <em>=&</em> and solely <em>=</em>.</p>
<p>Thanks in advance! </p>
| php | [2] |
934,140 | 934,141 | How can I ensure my c# string ends in a period? | <p>I have c# strings looking like this:</p>
<pre><code>"abc";
"def.";
</code></pre>
<p>When I read these into another variable I need some simple way to check the last character of the string and if it's not a period then append a period to that string. </p>
<p>Does anyone have any ideas of a simple way I could do this?</p>
| c# | [0] |
5,591,497 | 5,591,498 | Real World C++ library | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/777764/what-modern-c-libraries-should-be-in-my-toolbox">What modern C++ libraries should be in my toolbox?</a> </p>
</blockquote>
<p>I am starting to get serious into C++ development. To that end, I want to learn more about what C++ libraries that are actually used in the real world. The only two well known production quality libraries that I know of is <code>boost</code> and <code>stl</code>. Is there any other C++ library that is well suited and tested for real world application? A light wrapper to some existing C library does not count. </p>
<p>Limited one per entry, and library specific to C++. Also give a short description to the library. </p>
| c++ | [6] |
3,991,094 | 3,991,095 | How to manipulate width of multiple images in javascript | <p>I have multiple images and i wnat to place all of them in a single line.How should i manipulate the width of images such that the sum of width of al images does not exceed the browser's width.??</p>
| javascript | [3] |
3,895,324 | 3,895,325 | Can I use jQuery to change the contents of links on a page? | <p>I have HTML looking like this:</p>
<pre><code><div id="control">
<a href="/xx/x">y</a>
<ul>
<li><a href="/C003Q/x" class="dw">x</a></li>
<li><a href="/C003R/xx" class="dw">xx</a></li>
<li><a href="/C003S/xxx" class="dw">xxx</a></li>
</ul>
</div>
</code></pre>
<p>Is there a way using jQuery that I can easily change this HTML to look like the HTML below where every link has text that is enclosed in a <code><span></code> and where every
<code>href</code> is changed to <code>data-href</code>?</p>
<pre><code><div id="control">
<a data-href="/xx/x" ><span>y</span></a>
<ul>
<li><a data-href="/C003Q/x" class="dw"><span>x</span></a></li>
<li><a data-href="/C003R/xx" class="dw"><span>xx</span></a></li>
<li><a data-href="/C003S/xxx" class="dw"><span>xxx</span></a></li>
</ul>
</div>
</code></pre>
| jquery | [5] |
4,834,495 | 4,834,496 | How to select spans that have a specific attribute in javascript | <p>I'm trying to manipulate spans that have the "email" attribute, this is my code:</p>
<pre><code>var spans = document.getElementsByTagName("span"),
index, node, emailAttr;
for (index = 0; index < spans.length; ++index) {
node = spans.item(index);
emailAttr = node.getAttribute("email");
if (emailAttr) {
// Do something with `node` and `emailAttr`
}
}
</code></pre>
<p>Everything goes well until the last if statement, it can find the spans but no result for spans that have the email attribute. What is wrong here?</p>
<p>This is part of the html code i'm trying to scan:</p>
<pre><code><span class="yP" email="[email protected]">Mozilla Add-ons</span>
</code></pre>
<p>Note: i don't want to use jQuery. </p>
| javascript | [3] |
5,358,479 | 5,358,480 | indexes in a list | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/8184768/comparing-lists-python">comparing lists python</a> </p>
</blockquote>
<p>I have 1 original list such as:</p>
<pre><code>original = [1, 2, 3]
</code></pre>
<p>and another list with nested lists (with the same size) such as:</p>
<pre><code>bigList = [[1, 2, 3], [2, 2, 2], [3, 2, 3]...]
</code></pre>
<p>and I want to count how many indexes in each nested list is the same as in the original list.
this is what i wrote:</p>
<pre><code>count= 0
for innerlist in (bigList):
for indexes in (innerlist):
for i in (original):
if indexes == i:
count= count+1
</code></pre>
<p>The problem is that it will count all the correct places in all the nested lists together, but I want it to count how many correct places are in each nested list.
how should I do it? </p>
| python | [7] |
5,698,950 | 5,698,951 | jquery find nearest class and remove it | <p>I am trying to remove <code>list_product</code> entire block if that particular <code>delete</code> class is clicked. I am very new to jquery and still learning.</p>
<pre><code><div class='list_product'>
<div class='row'>
<div class='delete'>x</div>
<div class='title'>Standing Fan</div>
</div>
</div>
<div class='list_product'>
<div class='row'>
<div class='delete'>x</div>
<div class='title'>Standing Fan 2</div>
</div>
</div>
<div class='list_product'>
<div class='row'>
<div class='delete'>x</div>
<div class='title'>Standing Fan 3</div>
</div>
</div>
<div class='list_product'>
<div class='row'>
<div class='delete'>x</div>
<div class='title'>Standing Fan 4</div>
</div>
</div>
</code></pre>
<p>Jquery:</p>
<pre><code>$('.delete').click(function() {
$(this).find('.list_product').remove();
});
</code></pre>
<p>Is not working. may i know why and how do i fix it? thanks</p>
| jquery | [5] |
3,403,809 | 3,403,810 | How to set the Android progressbar's height? | <p>My <code>activity_main.xml</code> is below, as you see, the height is set 40 dip.
</p>
<p>And in MyEclipse, it looks like below:</p>
<p><img src="http://i.stack.imgur.com/evdoE.png" alt="enter image description here"></p>
<p>But when I run it on my phone, it looks like below:</p>
<p><img src="http://i.stack.imgur.com/JhX5L.png" alt="enter image description here"></p>
<p>So my question is why the real height of the progressbar is not the one I set? How to increase the height of the progressbar?</p>
| android | [4] |
4,944,883 | 4,944,884 | Refiring an event when dynamic html is loaded? | <p>I have div#1 that is clickable and expands another div#2. Now when div#2 loads dynamic htmlbut at the same time div#1 has dynamic text ... on first load the expand event fires, but when the dynamic data is written it re-writes div#1 and div#2 so afterwards it does not fire the expand event?</p>
| jquery | [5] |
4,504,540 | 4,504,541 | How can I extract 3 random values from an array? | <p>I build my MyObject array with :</p>
<pre><code> MyObject[] myObject = (from MyObject varObj in MyObjects
select varObj).ToArray();
</code></pre>
<p>and now, I'd like to extract 3 random MyObject from this array! How can I do it on C#?</p>
<p>Of course, if array lenght is <3 I need to extract all objects!</p>
| c# | [0] |
2,895,722 | 2,895,723 | Jquery display block after partial page load | <p>here is my code:</p>
<pre><code>$("a").live('click', function(){
history.pushState({}, '', this.href);
popstate(this.href);
$("#loadpage").css("display", "block");
return false;
});
popstate = function(url){
url = '/ajaxlinks/ajaxlink'+window.location.pathname.substr(1);
if (url == '/ajaxlinks/ajaxlink'){url = '/ajaxlinks/ajaxlinkindex.php'}
if (url.indexOf(".php") == -1){url = '/ajaxlinks/ajaxlinkprofile.php'}
if (url == '/ajaxlinks/ajaxlinkaccountrecovery.php'){window.location = 'http://www.pearlsquirrel.com/accountrecovery.php';}
if (url == '/ajaxlinks/ajaxlinklogin.php'){window.location = 'http://www.pearlsquirrel.com/login.php';}
if (url == '/ajaxlinks/ajaxlinklogout.php'){window.location = 'http://www.pearlsquirrel.com/logout.php';}
$('#ajaxloadcontent').load(url);
$('html, body').animate({scrollTop:0}, 'fast');
}
$(document).load(function(){
window.onpopstate = function(event){
popstate(window.location.href);
event.preventDefault();
}
});
</code></pre>
<p>When clicking on a link, I start this bit of code to show the loading div:</p>
<pre><code>$("#loadpage").css("display", "block");
</code></pre>
<p>However, I don't know where to put the bit of code that displays this div as none:</p>
<pre><code>$("#loadpage").css("display", "none");
</code></pre>
<p>I have tried putting this bit of code everywhere, and I just can not seem to get it to work. If anyone knows where I should put this code and maybe if I should even use different syntax, the help would be greatly appreciated.</p>
| jquery | [5] |
707,915 | 707,916 | MyTouch android phone's menu button doesn't work | <p>I am writing an action game, but I noticed that when there are a lot of actions going on during the game, the menu button on my MyTouch phone doesn't work. I have to pause the game before the menu buttons work. </p>
<p>I tried raising the priority of the activity thread by doing this:</p>
<pre><code><uses-permission
android:name="android.permission.VIBRATE"
id="android.permission.RAISED_THREAD_PRIORITY" />
</code></pre>
<p>I also tried to lower the game's thread priority with setPriority() but none of the above work.</p>
<p>The only thing that works was adding a bunch of buttons beneath the game view. Can someone help me? Thanks.</p>
<p><strong>Edit</strong></p>
<p>Ok now I tried this:</p>
<p>return true for all keys I use in my game and super.onKeyDown(event) for everything else, now the menu button sort of works in that pressing it brings up the keyboard (not the settings menu), even if I am not doing a long touch.</p>
| android | [4] |
1,996,296 | 1,996,297 | How can I make li background visible as well with jQuery? | <p>Javascript as below:</p>
<pre><code>$(function(){
div = $("#titlelist");
ul = $('#titlelist li');
ul.css({overflow: 'hidden'});
ul.each(function(){
$(this).css({overflow: 'hidden'});
$(this).mouseenter(function(e){
$(this).css({overflow: 'visible', background:'#CCC', 'z-index': '100'});
});
$(this).mouseleave(function(e){
$(this).css({overflow: 'hidden', background:''});
});
});
});
</code></pre>
<p>HTML as below:</p>
<pre><code><div id="container">
<ul id="titlelist">
<li>GBin1 Page view monitor Demo</li>
<li>GBin1 Page view monitor Demo</li>
<li>GBin1 Page view monitor Demo</li>
</ul>
</div>
</code></pre>
<p>When mouse enter, only li content and part of background color can be visible, how can I make the background visible for all li content as well?</p>
<p>Thanks!</p>
| jquery | [5] |
3,145,122 | 3,145,123 | creating testsuite in python | <p>I have python scripts, such as a.py, b.py, c.py located in say directory A:</p>
<p>I want to create test suite which will execute all those python scripts sequentially.
Those scripts are no a unit test. Those are regular python scripts.</p>
<p>Please let me know how do I run them in test suite and generate report after execution.</p>
<p>Thanks for your time</p>
| python | [7] |
1,114,362 | 1,114,363 | How To Zoom ImageView in Android | <p>I have an ImageView declared in main.XML . I want it to be Zoomed .
How can this be done in Android?</p>
<p>Thanks in Advance</p>
| android | [4] |
2,835,747 | 2,835,748 | Java Script - Extract number from string | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1849149/how-might-i-extract-the-number-from-a-number-unit-of-measure-string-using-java">How might I extract the number from a number + unit of measure string using JavaScript?</a> </p>
</blockquote>
<p>How to extract number from string like this in JS.
String: "Some_text_123_text" -> 123</p>
| javascript | [3] |
1,875,284 | 1,875,285 | jQuery - Detecting when a user clicks OUT of an input type Text Field | <p>I want to detecting when a user clicks OUT of an input type Text Field, not in.</p>
<p>Here's what I have but both events are firing on click inside (focus):</p>
<pre><code><input id="title" val="hello" />
$("#title").focusout(function() {
console.log('inside');
}).blur(function() {
console.log('outside');
});
</code></pre>
| jquery | [5] |
1,466,765 | 1,466,766 | How to sort this jQuery element to this | <p>I want to make id="a" element div to be the second div in the div.b element.
And I want to how to make id="a" element div to be the last div in the div.b element. </p>
<p>Here is the code:</p>
<pre><code><div class='b'>
<div>a</div>
<div>a</div>
<div id="a">I want to moderate this div </div>
<div>a</div>
</div>
</code></pre>
<p>The result I want to achieve is:</p>
<pre><code><div class='b'>
<div>a</div>
<div id="a">I want to moderate this div</div>
<div>a</div>
<div>a</div>
</div>
</code></pre>
<p>And:</p>
<pre><code><div class='b'>
<div>a</div>
<div>a</div>
<div>a</div>
<div id="a">I want to moderate this div</div>
</div>
</code></pre>
| jquery | [5] |
4,667,176 | 4,667,177 | validate combobox in javascript | <p>I have written the below code. But it does not show me the alert message when I don't select the other value and click onto the submit button.
I don't want to use <code>getElementbyId</code>. I am using the name attribute of the HTML.</p>
<pre><code><HTML>
<HEAD>
<TITLE>ComboBox Validation</TITLE>
<script Language="JavaScript">
function validate()
{
if (document.comboForm.technology.value=="0") \
{
alert("Please Select Technology");
}
}
</script>
</HEAD>
<BODY>
<form name="comboForm">
<select name="technology">
<option value="0">Select</option>
<option value="1">Java Server Pages</option>
</select>
<input type="submit" value="submit" onClick="validate();">
</form>
</BODY>
</HTML>
</code></pre>
| javascript | [3] |
3,580,450 | 3,580,451 | How to get Client IP address in PHP? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1437771/how-can-i-get-the-clients-ip-address-in-a-php-webservice">How can I get the client’s IP address in a PHP webservice?</a> </p>
</blockquote>
<p>How can I get Client IP address using PHP? I want to keep record of the user who logged into my website through his/her IP address.</p>
| php | [2] |
5,683,533 | 5,683,534 | Get day of week in PHP with strftime() | <p>What is the most reliable way to get the day of the week?</p>
<ul>
<li><code>strftime("%u")</code> (1 = moonday to 7 = Sunday) </li>
<li><code>strftime("%w")</code> (0 = sunday to 6 = moonday)</li>
</ul>
| php | [2] |
1,276,157 | 1,276,158 | why would you assign this to another variable? | <p>At the start of <a href="http://documentcloud.github.com/underscore/docs/underscore.html" rel="nofollow">the source code for underscore.js</a>, you see this:</p>
<pre><code>var root = this;
var previousUnderscore = root._;
</code></pre>
<p>So the question becomes why didnt the author just write:</p>
<pre><code>var previousUnderscore = this._;
</code></pre>
| javascript | [3] |
3,405,358 | 3,405,359 | Get list of dictionary elements ordered by dictionary key | <p>I have a dictionary <code>d</code> for which the keys are all strings. Now when I do:</p>
<pre><code>for key in d:
print(d[key])
</code></pre>
<p>I get the elements of <code>d</code> is some "random" order. How can I force the element of <code>d</code> to come out sorted by the lexicographical order?</p>
| python | [7] |
4,751,667 | 4,751,668 | Windows 7 adb driver for arnova 10b g3 | <p>I have downloaded the arnova adb driver from
<a href="http://www.archos.com/support/support_tech/updates_adb.html?country=us&lang=en" rel="nofollow">http://www.archos.com/support/support_tech/updates_adb.html?country=us&lang=en</a></p>
<p>When I select the folder it is in to update the driver for the AN10BG3 device which is what my windows 7 machine is displaying for the tablet, it tells me that windows could not find driver software for your device. </p>
<p>Any ideas? </p>
| android | [4] |
3,861,174 | 3,861,175 | inserting checkbox values to database | <p>I have a php form with some textbox and checkboxes which is connected to a database
I want to enter all the details into the database from the form.All the textbox values are getting entered except the checkbox values.I have a single column in my table for entering the checkbox values and the column name is URLID.I want to enter all the selected checkbox(URLID)values to that single column only ,separated by commas.I have attached the codings used.can anyone find the error and correct me?
NOTE: (The URLID values in the form is brought from the previous php page.those codings are also included.need not care about it)</p>
<pre><code>URLID[]:
<BR><?php
$query = "SELECT URLID FROM webmeasurements";
$result = mysql_query($query);
while($row = mysql_fetch_row($result))
{
$URLID = $row[0];
echo "<input type=\"checkbox\" name=\"checkbox_URLID[]\" value=\"$row[0]\" />$row[0]<br />";
$checkbox_values = implode(',', $_POST['checkbox_URLID[]']);
}
?>
</code></pre>
| php | [2] |
4,254,019 | 4,254,020 | Remove ArrayList Object from Memory | <p>I have a bunch of Objects in an <code>ArrayList</code>, if I call <code>ArrayList.remove(object)</code> Do I need to do anything else to remove the object from memory? I am adding and removing objects from this list at a fairly very quick pace, so if it doesn't get removed from memory I it will start taking up space and start to slow down the Game.</p>
| java | [1] |
3,828,252 | 3,828,253 | how to handle media button to stop a song? | <p>I have one service in which I am playing a song. Now I want to stop the song when i press volumn up and down button.</p>
<p>i used broadcast receiver also with the following code but it doesn't help me</p>
<p>if (intent.getAction().equals(Intent.ACTION_MEDIA_BUTTON))
{
player.stop();<br>
}</p>
<p>please help me.</p>
<p>Thanks in advance </p>
| android | [4] |
464,778 | 464,779 | creating a nested list class within python | <p>I can't figure out what I'm doing wrong. I have to create a nested list(of possible solutions to a problem), so I created a class that appends a solution to a list of existing solutions(since each solution is being calculated one at a time)</p>
<p>This function works fine:</p>
<pre><code>def appendList(list):
#print list
list2.append(list)
x =0
while x < 10:
x = x+1
one = "one"
two = "two"
appendList([(one), (two)])
print list2
</code></pre>
<p>with a result of:</p>
<pre><code>[['one', 'two'], ['one', 'two'], ['one', 'two'], ['one', 'two'], ['one', 'two'], ['one', 'two'], ['one', 'two'], ['one', 'two'], ['one', 'two'], ['one', 'two']]
</code></pre>
<p>but when I take this exact same function and put it in a class, I get an error saying:</p>
<pre><code>TypeError: appendList() takes exactly 1 argument (2 given)
</code></pre>
<p>Here's the class and how I call it:</p>
<blockquote>
<pre><code>class SolutionsAppendList:
list2 = []
def appendList(list):
#print list
list2.append(list)
</code></pre>
</blockquote>
<pre><code>appendList.appendList([('one'), ('two')])
</code></pre>
<p>I'm sure I'm making a very basic error but I can't seem to figure out why, since I'm using the same function in the class. </p>
<p>Any suggestions/advice would be great.
Thanks</p>
| python | [7] |
4,210,069 | 4,210,070 | How to assign multiple selection (checkbox) to gridview in c# | <p>We need multiple selection on gridview through checkboxes, how can we do it? Give me solution for this problem in C#.</p>
| c# | [0] |
4,648,456 | 4,648,457 | multiple try/except in a single function does not work | <pre><code> def creating_folder_for_csv_files(cwd):
try:
os.makedirs(cwd+'\\migration_data\\trade')
except os.error, e:
print "Could not create the destination folder for CSV files"
# end of first try/except block
try:
os.makedirs(cwd+'\\migration_data\\voucher')
except os.error, e:
print "Could not create the destination folder for CSV files"
</code></pre>
<p>In my code, the first try/except block works but the second does not. What's the problem?</p>
| python | [7] |
5,614,381 | 5,614,382 | Bitset in java 5 | <p>What is usage of bitset in java?</p>
| java | [1] |
4,615,653 | 4,615,654 | Reducing code redundancy in C# | <p>I'm new to tinkering with C#, and so far that's the extent of it. I'm just tinkering for a small project I have.</p>
<p>The redundancy is driving me crazy, though. Writing long lists of similar code taking up line after line just doesn't sit well with me.</p>
<p>I have a few tabs with checkboxes and radio buttons in them, that's where I noticed the duplication the most. Unfortunately I... don't quite grasp every aspect of C# as well as I should, yet. So I was hoping to learn from you folks.</p>
<p>Example:</p>
<pre><code>//setup checkbox
checkBox1.AutoSize = true;
checkBox1.Checked = false;
checkBox1.CheckState = CheckState.Unchecked;
checkBox1.Location = new Point(5, 102);
checkBox1.Text = "Check Box 1!";
checkBox1.UseVisualStyleBackColor = true;
//set radio 1
radio1.AutoSize = true;
radio1.Checked = true;
radio1.Location = new Point(5, 33);
radio1.Size = new Size(20, 20);
radio1.Text = "Radio-e-o-e-o";
radio1.UseVisualStyleBackColor = true;
//set radio 2
radio2.AutoSize = true;
radio2.Checked = false;
radio2.Location = new Point(5, 56);
radio2.Size = new Size(18, 20);
radio2.Text = "Option 2!";
radio2.UseVisualStyleBackColor = true;
</code></pre>
<p>My instinct would be to set up some arrays with the variable data for things like the names and the distinct data. But as I said, I'm very new, I've only been tinkering... and the resources I've come across tend to either not match what I'm looking for, or add layers of complexity I'm probably not ready for.</p>
| c# | [0] |
4,478,166 | 4,478,167 | invalid pointer error when trying to return object by value | <p>I have a class, Matrix</p>
<pre><code>class Matrix
{
private:
int cols;
int rows;
int **matrix;
public:
//constructors and methods
friend Matrix addandupdate(Matrix a, Matrix b);
}
</code></pre>
<p>I have the function addandupdate defined outside as below,</p>
<pre><code>Matrix addandupdate(Matrix a, Matrix b)
{
int rsize = a.rows;
int csize = a.cols;
Matrix c(csize, rsize);
for(int i=0; i<rsize; i++)
{
for(int j=0; j<csize; j++)
{
c.set(i,j,a.matrix[i][j]+b.matrix[i][j]);
}
}
return c;
}
</code></pre>
<p>Then in main, </p>
<pre><code>Matrix x(c, r);
//filling values in x
//printing x
Matrix newx = addandupdate(x, x); //something is not right here
//printing newx
</code></pre>
<p>Everything is fine except the line above that is causing to throw a runtime error.</p>
<pre><code>*** glibc detected *** ./a.out: munmap_chunk(): invalid pointer: 0x085c6020 ***
======= Backtrace: =========
/lib/i386-linux-gnu/libc.so.6(+0x73e42)[0x183e42]
/lib/i386-linux-gnu/libc.so.6(+0x74525)[0x184525]
/usr/lib/i386-linux-gnu/libstdc++.so.6(_ZdlPv+0x1f)[0x84d51f]
./a.out[0x8048c69]
./a.out[0x8048b05]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x1294d3]
./a.out[0x8048751]
</code></pre>
<p>I'm writing C++ code after a long time. Please excuse me if it's something silly.</p>
| c++ | [6] |
3,306,864 | 3,306,865 | Is there a way for php to make a file name match an id | <p>here is my code</p>
<pre><code><div id="lara"><a href="http://anywhere.com/work/lara.jpg">some crap</a></div>
<div id="jerk"><a href="http://anywhere.com/work/jerk.jpg">some crap</a></div>
<div id="yessir"><a href="http://anywhere.com/work/yessir.jpg">some crap</a></div>
</code></pre>
<p>basically i'm wondering if there is a way to replace the filename (of the image) with some php that will dynamically add the id of the parent div in its place.</p>
<p>why you ask? i have several links like this where the id matches the filename, and i feel as though i should not have to manually type each file name in. I believe i've seen this done in ASP, but am not sure what the method is called, or if it's possible in php. </p>
<p>help! </p>
| php | [2] |
2,944,773 | 2,944,774 | How do I get the span text within the list item using jQuery? | <p>I have t he following list item:</p>
<pre><code><li class="item" id="44">
<div class="name">Bogstadveien</div>
<div>
<span class="city">Oslo</span>,
<span class="country">Norway</span>
</div>
</li>
</code></pre>
<p>Upon clicking the list item, I run the script:</p>
<pre><code>var list_item = jQuery(this);
var guide_id = list_item.attr('id');
</code></pre>
<p>How do I get the city and country values?<br>
I've tried using <code>find</code>, <code>closest</code> and <code>next</code>, but I'm not using them correctly.</p>
| jquery | [5] |
337,259 | 337,260 | jquery-ui-dialog: why does clicking on elements inside dialog spawn more dialogs? | <pre><code>$(top.document).ready(function () {
$(document).click(processAction);
function processAction(e){
var clicked = e.target;
newDialog("You've Clicked On A Link !")
function newDialog(mytitle){
var $dialog = $('<div id="myunique"></div>')
.html("<a href='http://sss.com'>click</a>")
.dialog({
autoOpen: false,
modal: true,
title: mytitle
});
$dialog.dialog('open');
return false
}
});
</code></pre>
<p>The problem I am having is that when I click anywhere in the dialog, a new dialog popups, and it seems to produce several of these in a row.</p>
<p>My goal is:
catch all the clicks on page EXCEPT the elements inside the dialog.</p>
| jquery | [5] |
4,136,957 | 4,136,958 | before closing the Application browser should prompt conformation | <p>I have a small requirement..</p>
<p>if the user dint sign off or log off then he try's to close the browser IE clicking on 'X' (top right of IE or Firefox browser ) then i need to ask a conformation message like "Are you sure you want to close ?" ...
I am using Master page in my application and i tried the event : "window.onbeforeunload " in my master page its works fine, shows an alert(conformation) message. but if i press back button on the browser(IE on IE or Firefox) then also its firing(but it should not) is there any way to full fill my requirement ..I hope i had explained u clearly...if not pl z let me know........</p>
<p>what i mean to say is.. if the Session("USerid") is active or if it contains any value ie.
Session("USerid")="XXX"
at that moment if user trys to close the browse(click in 'X'/Close button browser either IE or Firefox ) it should give prompt a message "are u sure do u want to close?"..</p>
| asp.net | [9] |
4,991,055 | 4,991,056 | How to create duplicate objects in an array | <p>I would like to copy the 3 objects in my array until there is a total of 50. How do I go about doing this?</p>
<pre><code>var listings = [
{
address: "123 41st St",
bedrooms: 2,
bathrooms: 2,
image: "img/1bdrm_a.jpg"
},
{
address: "234 52nd St",
bedrooms: 1,
bathrooms: 1,
image: "img/1bdrm_b.jpg"
},
{
address: "345 63rd St",
bedrooms: 3,
bathrooms: 2,
image: "img/1bdrm_c.jpg"
}
];
</code></pre>
| javascript | [3] |
3,684,643 | 3,684,644 | Pattern for a Singleton contaning lists | <p>I have various small lookup tables in my application where I don't want to query the database every time they are requested. So I want to only read these once when the singleton object is first requested. The only issue I can see is if a user wants to edit records in these tables, I need to reset and reload the objects in the list again.</p>
<p>Is there a thread safe pattern for having a Singleton used for storing and retrieving lists of objects?</p>
| java | [1] |
2,713,402 | 2,713,403 | JQuery, fade in background pic on click | <p>I want background images to fade in "on click" and here is what i got right now. And it´s working, but i want the images to fade-in on click...</p>
<pre><code>$(document).ready(function() {
//this represents window.load in javascript.
//now to select the element suppose you have anchor tag <a> with id=clickme
$("#test").click(function() {
//select the element whose background image you want to change. suppose with id=imgBack
$("body").css({'background-image':'url(url to image)'});
})
});
</code></pre>
| jquery | [5] |
3,687,587 | 3,687,588 | Does is_file() use include paths? | <p>If I add a path to the include_path, will the php function: is_file() then use this path to search for a filename that I pass to it?</p>
| php | [2] |
4,954,900 | 4,954,901 | state at compile time not known | <p>I need a way to Parse an string into an integer value in c#. The problem is the user chosses a string from a combo box which contains strings such as "AAAAA" or "5". That means only at run time it is known if the parameter is a real string or an string which can be parsed to an integer. I tried around with reflection and have the fitting Parameter object.</p>
<pre><code>ParameterInfo p = ps[i];
Type t = p.ParameterType;
</code></pre>
<p>I don't know how to go on from there or if it even is possible. I can't use if else statments because the program is supposed to load other interfaces with new parameters as well. So I could handle the default ones with if else statmentes but when a new interface with new Methodinfos is loaded that dos not work anymore.</p>
| c# | [0] |
3,729,994 | 3,729,995 | How to choose a selector based on the index position of an array using jquery | <p>I have div's set up that represent the days of a pay-period and an array that holds the employee times each day- What Im trying to do is .text the input time in the correct div for that day. The 'wt' below is the wArray.length. What am I missing? I have also tried using jquerys :nth child selector and had no luck there either. </p>
<pre><code>$('.daysContain:eq(wt)').text('Time In: ' + timeIn);
</code></pre>
| jquery | [5] |
3,951,388 | 3,951,389 | Can you call a CLR Injection into SQL Server from C++? | <p>Does anybody know if you can you call a CLR Injection into SQL Server from C++?</p>
| c++ | [6] |
1,858,694 | 1,858,695 | How to translate a button from its relative position to the bottom of the screen? | <p>I would like to translate a button from its relative position to the bottom of the screen.</p>
<p>I am doing the TranslateAnimation using Java code.</p>
<p>The following is the code snippet of what I've already did:</p>
<pre><code>Display display = getWindowManager().getDefaultDisplay();
int screenHeight = display.getHeight();
translateButtonAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, Animation.RELATIVE_TO_SELF, Animation.RELATIVE_TO_SELF, height);
</code></pre>
<p>The result is that the button fly outside of the emulator screen!! :(</p>
<p>Thanks in advance for your help.</p>
| android | [4] |
5,609,083 | 5,609,084 | Android: Set power of vibration | <p>I'm currently working on a project, where I'd like to use the vibrating motor situated inside the Android phone. </p>
<p>I'd figured out, that setting the right permission in the manifest and getting an instance of the vibrator:</p>
<pre><code>Vibrator v = (Vibrator) game.getSystemService(Context.VIBRATOR_SERVICE);
</code></pre>
<p>would give me access to it. As far as I can see the only methods to make it vibrate are:</p>
<blockquote>
<p>public abstract void vibrate (long milliseconds)</p>
</blockquote>
<p>and</p>
<blockquote>
<p>public abstract void vibrate (long[] pattern, int repeat)</p>
</blockquote>
<p>Yet I'd like to have control the power of the vibration:</p>
<p>How can I control the power of the vibration?</p>
<p><strong>Update:</strong></p>
<p>Shouldn't the speed be controlled by varying voltage (or PWMing DC)?</p>
| android | [4] |
5,762,292 | 5,762,293 | How to access resource file in C#? | <p>i have add .zip file to my resource
how can i access that zip file ?</p>
| c# | [0] |
1,640,598 | 1,640,599 | How do I determine the owner of a process in C#? | <p>I am looking for a process by the name of "MyApp.exe" and I want to make sure I get the process that is owned by a particular user. </p>
<p>I use the following code to get a list of the processes:</p>
<pre><code>Process[] processes = Process.GetProcessesByName("MyApp");
</code></pre>
<p>This gives me a list of processes, but there does not appear to be a way in the Process class to determine who owns that process? Any thoughts on how I can do this?</p>
| c# | [0] |
4,225,826 | 4,225,827 | Context sensitive app for iPhone | <p>For something like the Notes or Reminders on the iPhone, Apple makes the app look like a yellow sheet of notepad paper, or a white sheet of notepad paper. I was wondering the basic premise on how someone goes about that. </p>
<p>For the Reminders app, I'm guessing they just use that off-white color for the background of the tableViewCell, and have that double red line on each TableViewCell on the LHS that makes it look like a sheet of school paper.</p>
<p>For the Notes app, no clue. Any thoughts on either of these? I kind of wanted a rough idea of how hard it is to make something like this. Thanks.</p>
| iphone | [8] |
3,165,034 | 3,165,035 | Retrieving content from a bean without having to worry about returning a null? | <p>Suppose you have some content that is guaranteed to have some value. Your job is to find it when given something <code>like</code> it.</p>
<p><strong>This works:</strong></p>
<pre><code>public KVPair getKvpForKey(String keyValue) {
KVPair kvpInThisContent = null;
for (KVPair kvp : kvContent) {
if (kvp.getKey().getAsFound().equals(keyValue)) {
kvpInThisContent = kvp;
break;
}
}
return kvpInThisContent;
}
</code></pre>
<p><strong>This also works:</strong></p>
<pre><code>public KVPair getKvpForKey(String keyValue) {
for (KVPair kvp : kvContent) {
if (kvp.getKey().getAsFound().equals(keyValue))
return kvp;
}
return null;
}
</code></pre>
<p>But ... both assume a possibility .. that in some cases <code>null</code> may be returned. While fine, this seems sloppy, assuming we know that it is not possible (content is there!). </p>
<p>Is there a way to do it cleaner without having to worry about a <code>null</code>?</p>
| java | [1] |
395,898 | 395,899 | AppWidget image quality | <p>I have an image with transparency which I need to place on the AppWidget. The transparent areas look fine on Motorola Droid, but on some other devices (e.g. HTC Hero) I got a lot of ugly noise. The manual says:</p>
<p>"In some cases, devices have low pixel depths that can cause visual banding and dithering issues. To solve this, application developers should pass assets through a "proxy" drawable defined as XML:. This technique references the original artwork, in this case "background.9.png", and instructs the device to dither it as needed."</p>
<p>Looks like it may be the solution. Unfortunately I need to prepare the widget image dynamically (combining a set of other images together, depending on the data received) and can not create a XML bitmap referencing a static resource.</p>
<p>Is there any way around this?</p>
<p>P.S. I've found out that even when I use a "proxy" XML bitmap with dithering enabled I still get a noise in the transparent areas :(</p>
<p>/Thanks</p>
| android | [4] |
5,117,821 | 5,117,822 | How can i know the body content is outputed (then cannot use the header function)? | <p>How can i know the body content is outputed (then cannot use the header function)?</p>
| php | [2] |
4,119,480 | 4,119,481 | iphone xml handing | <p>I want my app to read a XML via internet. </p>
<p>Also I want to keep the previously download xml so next time I may not need to download again until certain hours is passed or whatever period of time according to settings.</p>
<p>Do you recommend me to download it first and store locally before process it? Or should I process it while downloading (with libxml2 I guess)?</p>
<p>What do you usually with apps using remote XML?</p>
<p>Targeting 3.0 devices btw.</p>
| iphone | [8] |
3,553,757 | 3,553,758 | How to draw a rotated text in a Meta file | <p>I am in need to draw a rotated text of any angle in a desired location and the image should be in emf format .so that it can be a editable text in the office documents.I need this to be done using c# or GDI commands.</p>
<p>Please,if it possible post me with a sample code snippet.</p>
<p>Thanks,
Lokesh</p>
| c# | [0] |
767,384 | 767,385 | Iphone Image Processing Image APIS | <p>I wanted to know about image processing APIs in Iphone like increasing or decreasing brightness of an image , rotating image ,scaling image etc. How can I achieve this in Iphone?</p>
| iphone | [8] |
4,143,971 | 4,143,972 | Java unchecked code | <p>I write a simple class (the merit of StringPools themselves is not my question; I have specific reasons for wanting this class):</p>
<pre><code>import java.lang.ref.WeakReference;
import java.util.WeakHashMap;
public final class StringPool {
private WeakHashMap m_pool = new WeakHashMap();
public String intern(String s) {
WeakReference reference = (WeakReference)m_pool.get(s);
if(reference != null) {
String interned = (String)reference.get();
if(interned != null)
return interned;
}
m_pool.put(s,new WeakReference(s));
return s;
}
};
</code></pre>
<p>When I compile it, the compiler notes it uses unchecked or unsafe operations:</p>
<pre><code>warning: [unchecked] unchecked call to WeakReference(T) as a member of the raw type WeakReference
m_pool.put(s,new WeakReference(s));
^ where T is a type-variable:
T extends Object declared in class WeakReference
warning: [unchecked] unchecked call to put(K,V) as a member of the raw type WeakHashMap
m_pool.put(s,new WeakReference(s));
^ where K,V are type-variables:
K extends Object declared in class WeakHashMap
V extends Object declared in class WeakHashMap
2 warnings
</code></pre>
<p>How should I fix these warnings so the code compiles clean and is correct?</p>
| java | [1] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.