Unnamed: 0 int64 65 6.03M | Id int64 66 6.03M | Title stringlengths 10 191 | input stringlengths 23 4.18k | output stringclasses 10 values | Tag_Number stringclasses 10 values |
|---|---|---|---|---|---|
2,518,278 | 2,518,279 | Need to call a function (referenced by static pointer) from a static member | <p>everyone.
Recently I face the challenge. Cannot say that it was a critical problem, but just an interesting thing.
There is src code:</p>
<pre><code>class Data {
typedef void (Object::*CallBack)(void);
public:
Data() : m_callBack(NULL) {}
void setCallBack(CallBack ptr)
{
m_callBack = ptr;
}
void start()
{
Aux::someAction();
}
private:
static CallBack m_callBack;
class Aux{
public:
static someAction()
{
if(m_callBack)
{
// How to call function for this reference ? - m_callBack
}
}
}; // End of 'Aux' class
}; // End of 'Data' class
</code></pre>
<p>So, I know that we can call functions from pointers like that: (this->*m_callBack)(). But static class members do not have an access to ‘this’ pointer. Of course, I can store a pointer of a parent with m_callBack pointer and call (parent->*m_callBack)(). In same cases it may be not so good.
So, my question: Is there any other methods to call m_callBack function from a static class member. Also, I’m interesting about – if m_callBack references to class member of static OR non static function.</p>
| c++ | [6] |
2,229,545 | 2,229,546 | importing an iphone application to another iphone application | <p>is it possible to merge two iphone application in to one??? for example :i have two xcode projects and i need to use classes of one to other ...</p>
| iphone | [8] |
5,393,928 | 5,393,929 | Is it worth to write a custom Profile Provider? | <p>I wrote a custom Membership Provider and it was relatively easy.</p>
<p>Now I need to create users with first name, last name and other fields not considered in the any of the MembershipProvider.CreateUser overloads.</p>
<p>I read that I should not overload CreateUser. Instead, I should write my own Profile Provider.</p>
<p>It seems like a lot of work and I am not sure of the benefits. Can you help me decide the right way to go? (It is for a MVC 3.0 web app.)</p>
| asp.net | [9] |
1,675,657 | 1,675,658 | javascript Image Editing | <p>I want a simple image editor functionality for my site. My requirement is like that an image is being displayed and user can draw squares and shapes on image and save the co-ordinates so that when the image is reloaded the area are highlighted. So we have to provide a simple toolbox to user so that he can do the image editing on runtime.</p>
<p>There are few scripts available for the purpose but none seems to be close to my requirement. Can you people recommend a good script for that that is cross browser too?</p>
<p>Thanks in advance for the help.</p>
| javascript | [3] |
2,902,625 | 2,902,626 | What is a good project to learn Windows Forms programming in C#? | <p>I want to learn c# so I can do some desktop developing. I've developed command-line C# applications and wanted to expand to Desktop applications. </p>
<p>I was thinking of create a screenshot tool like Jing or maybe a plugin for outlook to sync contact information with a service like Google. </p>
<p>What are your thoughts? My past experience is with web applications built in PHP.</p>
| c# | [0] |
2,130,402 | 2,130,403 | jwebsocket standalone server | <p>Is it possible for some one to provide an example of using jwebsocket in a standalone example?</p>
<p>I've been trying to follow the example at <a href="http://jwebsocket.org/howto/ht_1st_listener.htm" rel="nofollow">http://jwebsocket.org/howto/ht_1st_listener.htm</a> but failing miserably.</p>
<p>Thanks.</p>
<p>ps When I mean standalone I mean "without the use of an application server such as tomcat or glassfish"</p>
| java | [1] |
5,852,676 | 5,852,677 | How to play youtube URL through Android MediaPlayer? | <p>Is there anyway to play videos using Androind MediaPlayer with url to a youtube video?</p>
<p>Instead of it playing through youtube i would like for it to play through the MediaPlayer locally on the device.</p>
<p>How would i go about doing this?</p>
<p>EDIT: sorry for the title</p>
| android | [4] |
5,491,975 | 5,491,976 | Open PopUp When Browser is close/tab's closes or Navigate to other page | <p>I have to open a popup to get user input and save to the database using either of jquery/javascript or server side event, when user close the browser/close the tab or Navigate to other pages on the site. Please guide me on this. I have tried using </p>
<p><code>window.onbeforeunload = function evens(evt) {}</code></p>
<p>But, Not working.</p>
| asp.net | [9] |
3,125,343 | 3,125,344 | How to create bent buttons in android | <p>How to create buttons that are bent at bottom.
I tried posting the image, as I am a new member am unable to post the image, </p>
<p>please visit the website <a href="http://www.wix.com" rel="nofollow">http://www.wix.com</a> and I am talking about the "START NOW" button on the home page. </p>
| android | [4] |
1,108,510 | 1,108,511 | jQuery / jQueryUI forms like DOJO or ExtJS | <p>Whats the standard way to create Rich RIA Forms in jQuery / jQueryUI like the ones that come by default in DOJO or ExtJS. Thanks.</p>
| jquery | [5] |
1,946,274 | 1,946,275 | Return class pointer from a function | <p>I am not sure what is wrong with this (keep in mind I'm kinda sorta new to C++)</p>
<p>I have this class:</p>
<pre><code>Foo
{
string name;
public:
SetName(string);
}
string Foo::SetName(string name)
{
this->name = name;
return this->name;
};
//////////////////////////////////////////////
//This is where I am trying to return a Foo pointer from this global function:
Foo * ReturnFooPointer()
{
Foo foo;
Foo * foo_ptr;
foo_ptr = &foo;
return foo_ptr;
}
</code></pre>
<p>At compile time, this compiles just fine. However at run time it throws a runtime exception(Some sort of access violation)</p>
<p>What am I doing wrong?</p>
| c++ | [6] |
2,488,293 | 2,488,294 | a good tutorial on creating a php forum from scratch | <p>i've been looking online and cant find a good tutorial on creating a forum from scratch. i just want to wrap my head around what it takes to create something more advance than what i am capable of. if you know of a good tutorial let me know.</p>
<p>thanks</p>
| php | [2] |
239,314 | 239,315 | youtube video link | <p>I want to create a php application to download my films from youtube.
For example:</p>
<p>page with video: <a href="http://www.youtube.com/watch?v=5dT312CDPJI" rel="nofollow">http://www.youtube.com/watch?v=5dT312CDPJI</a>
link to video:</p>
<pre><code><a href="http://o-o.preferred.tpnet-waw2.v24.lscache1.c.youtube.com/videoplayback?sparams=id%2Cexpire%2Cip%2Cipbits%2Citag%2Cratebypass&fexp=904535%2C902314%2C910701&itag=22&ip=109.0.0.0&signature=A3C9407B96FF5D7548AFBCECFF248B90496CCDF7.5383C61DE0FFD40EEFA9090CB73C616ABF0E3C20&sver=3&ratebypass=yes&expire=1315674000&key=yt1&ipbits=8&id=e5d4f7d760833c92&title=Lykke+Li+-+Little+Bit+%28AutoErotique+Bootleg+Remix%29">video link</a>
</code></pre>
<p>But I can't find video link in page html. Where is the video link?
Is it possible to do it in php?</p>
| php | [2] |
1,873,471 | 1,873,472 | What's the syntax for a JavaScript sub namespaces/class inside current namespace/class? | <p>I've been working a lot with JavaScript lately and have created some large function collections. I've found the need to have sub functionality that I want to separate from the main library yet still be included in the main library but haven't found an elegant enough way to do this yet.</p>
<p>Here are a couple of examples that I use at the moment</p>
<p>So I usually setup my <strong>main library</strong> like this</p>
<pre><code>// Main library
var animals = functions(settings){
// Main library stuff
}
</code></pre>
<p>To add sub classes / sub functionality that's encapsulated separately but still part of the main library...</p>
<p>This is the first method using object literal notation</p>
<pre><code>animals.prototype.dogs = {
addDog: function(){
// Can only access the dogs object
var test = this;
},
removeDog: function(){}
}
// Usage of the whole thing
var animalsInstance = new animals({a: 1, b: 3});
animalsInstance.dogs.addDog();
</code></pre>
<p>While I really like the syntax of this i can never really use it as there is no way to reference the animals instance inside any of the functions inside the dogs object. So I came up with this notation as a replacement</p>
<pre><code>animals.prototype.dogs = function(){
var parent = this;
return {
addDog: function(){
// The animals instance
var test = parent;
// The dogs instance
var test2 = this;
},
removeDog: function(){}
}
}
// Usage
var animalsInstance = new animals({a: 1, b: 3});
animalsInstance.dogs().addDog();
</code></pre>
<p><strong>Although now I can get access to the animals instance from inside all the sub functionality of the dogs functions I don't really like the slightly hacky way I've done it.
Has anyone got any cleaner methods?</strong></p>
| javascript | [3] |
3,760,838 | 3,760,839 | Collection was modified; enumeration operation may not execute." Collection elements are not modified | <p>I have a nested loop "structure" in my code. Sometimes, I get the below message.</p>
<blockquote>
<p>Collection was modified; enumeration operation may not execute.</p>
</blockquote>
<p>I have a collection I am looping through, like below. <code>Coll</code> is a <code>List<string></code></p>
<pre><code>foreach (string[] s1 in obj.Coll
{
foreach (string s in s1) { }
}
</code></pre>
<p>For each string in the array, I need to work with it (read as read the value, not write).
All I do with it is get directories (this value is a path) and split this string into an array.</p>
<p>How can this be resolved?</p>
| c# | [0] |
1,528,357 | 1,528,358 | How to make an included php file a variable | <p>I would like to make a php file i have a part of a variable i'm building.</p>
<p>ie</p>
<pre><code>$print = 'something';
$print .= include('register_form.php');
print $print;
</code></pre>
<p>However this doesn't work. register_form.php will be not be included in the $print var, and will be echo'd out before the start of the print out.</p>
<p>Is there a way to achieve this?</p>
<p>I know I could go into register_form.php and make it all a function like register_form() and return its output, however, due to the way I've structured this (and i'm a bit of a newb) this would create more headaches then if I could merely do the above attempt.</p>
<p>Thanks for any pointers!</p>
| php | [2] |
383,459 | 383,460 | How to carry text values over to a text box on another form? | <p>I am attempting to carry the value of a single textbox into another textbox on another form.</p>
<p>In form 1 i have the following code: </p>
<pre><code>private SecondForm secondForm;
public void SecondFormTextBox()
{
uname.Text = secondForm.uname.Text;
}
</code></pre>
<p>In form 2 I have the following code.</p>
<pre><code>public TextBox uname
{
get
{
return uname;
}
}
</code></pre>
<p>I recieve the following errors, hope you can help!!</p>
<blockquote>
<p>An object reference is required for
the non-static field, method, or
property
'WindowsFormsApplication1.AdministratorHome.uname.get' </p>
<p>Ambiguity between
'WindowsFormsApplication1.AdministratorHome.uname'
and
'WindowsFormsApplication1.AdministratorHome.uname'</p>
</blockquote>
| c# | [0] |
5,836,835 | 5,836,836 | Show an image if the character count of a data field is equal to a specific number of characters | <p>I have a field in which all data needs to be 13 characters in length. I would like to show a check mark image if the file name that was placed in the database is the correct number of characters (13) or show an exclamation mark image if the file name is not equal to 13 characters in length. This is what I have so far, but obviously it's not working.</p>
<pre><code><?php
$val1 = 13;
if (count_chars($image_id) == ($val1)) {
echo '<img src="images/icons/check.gif" />';
}
else {
echo '<img src="images/icons/exclamation.gif" />';
}
?>
</code></pre>
| php | [2] |
3,739,996 | 3,739,997 | Make textarea readonly with jquery | <p>For text <code>input</code> I do:</p>
<pre><code>$('input[type="text"]').each(function(){
$(this).attr('readonly','readonly');
});
</code></pre>
<p>But what should I do for <code>textarea</code>, to make it <code>readonly</code>.</p>
| jquery | [5] |
1,250,677 | 1,250,678 | Low virtual memory on Sony Ericsson Xperia | <p>My application contains lot of images loading at runtime. This app works fine in almost all android devices but in Xperia it oftenly crashes with low virtual memory.
plz help me...</p>
| android | [4] |
4,142,475 | 4,142,476 | Dropdown list inside a datagird | <p>I am working with a dropdown list that is inside a datagrid. I am binding data to the dropdown list using a dataset. Here is the use case: I select a particular value in a dropdown list from the next row onwards and I select the same value in the other rows of the dropdown list, which causes a message to be displayed.</p>
<p>How do I achieve this by using javascript?</p>
| javascript | [3] |
1,385,309 | 1,385,310 | comparision of arraylist | <p>hi am storing the results in array list which are obtained by querying different database in java. i need to compare this array list to get the common rows</p>
<pre><code> List name = new ArrayList();
name.add(Spreadsheets.getString("Name"));
List namedb = new ArrayList();
namedb .add(rs.getString("eName"))
</code></pre>
<p>in c++ we use strcmp to compare. but in java how do i compare this arraylist and it should return common rows. or how do i apply binary search algorithm to search these to arraylist?</p>
| java | [1] |
4,289,865 | 4,289,866 | Android push new instance of main Activity? | <p>Is it possible to create/push-onto-stack a new Activity of the same main Activity in an Android application with an argument passed to the Activities constructor? Specifically from a Dialog object...</p>
| android | [4] |
3,669,756 | 3,669,757 | Converting time in PHP? | <p>How do i convert the time which I pull from a database <code>2009-09-27 23:58:54</code> to the following time using PHP <code>Sep 27, 2009</code>.</p>
| php | [2] |
2,397,885 | 2,397,886 | the dreaded UTF-8 BOM | <p>I read your answer to reformat php files used by includes and it did remove the problem. My question is we are working on a web site that needs to display different laguages, will this be a problem?</p>
<p>Thanks Conrad</p>
| php | [2] |
3,452,438 | 3,452,439 | Enumeration methods | <p>Enumeration interface has method hashMoreElements is used with refrence variable (Enumv), how can they be used
since they are not implemented ?
I meant it is an interface method so how can it be called - Enumv.hasMoreElements() it does not have a implementation .</p>
<pre><code>Vector v = new Vector();
//v contains list of elements - Suppose
Enumeration Enumv = v.elements();
while(Enumv.hasMoreElements()) {
System.out.println(Enumv.nextElement());
}
</code></pre>
<p>How is this possible?</p>
| java | [1] |
5,245,059 | 5,245,060 | setInterval timing slowly drifts away from staying accurate | <p>It seems that when I <code>setInterval</code> for 1000ms, it actually fires the function every 1001ms or so. This results in a slow temporal drift the longer its running.</p>
<pre><code>var start;
var f = function() {
if (!start) start = new Date().getTime();
var diff = new Date().getTime() - start;
var drift = diff % 1000;
$('<li>').text(drift + "ms").appendTo('#results');
};
setInterval(f, 1000);
</code></pre>
<p>When run this shows the inaccuracy immediately.</p>
<ul>
<li>0ms</li>
<li>1ms</li>
<li>2ms</li>
<li>3ms</li>
<li>4ms</li>
<li>5ms</li>
<li>5ms</li>
<li>7ms</li>
<li>8ms</li>
<li>9ms</li>
<li>9ms</li>
<li>10ms</li>
</ul>
<p>See it for yourself: <a href="http://jsfiddle.net/zryNf/">http://jsfiddle.net/zryNf/</a></p>
<p>So is there a more accurate way to keep time? or a way to make <code>setInterval</code> behave with more accuracy?</p>
| javascript | [3] |
3,548,480 | 3,548,481 | Rendering a unicode character correctly in TextView? | <p>I'm getting a string sent to me from a server (my app is running on android). One of the characters is a unicode symbol which is a musical note. I take the response from the server in a String, then hand it directly to a TextView. This is what should appear:</p>
<pre><code>♫
</code></pre>
<p>but instead I see just a block (kinda looks like):</p>
<pre><code>[]
</code></pre>
<p>when I print the string to logcat, I see:</p>
<pre><code>â«
</code></pre>
<p>I'm not sure how to get TextView to display the character correctly. I tried this:</p>
<pre><code>tv.setText(Html.fromHtml(text).toString());
</code></pre>
<p>but it's still rendering out the block. What's the right way to do this?</p>
<p>Thanks</p>
<p>-------------------- Update -----------------------------</p>
<p>I tried just creating a webpage with the character in it, then pointing the system browser to the page (on my nexus one). Same render issue, looks like the glyph for that character just does not exist?:</p>
<pre><code><html>
<body>
&#x266B;
<br />
&#9835;
</body>
</html>
</code></pre>
| android | [4] |
3,056,925 | 3,056,926 | Is this code is working in Windows 7 environment using pywinauto | <p>I have tried with opening the media player in Win7 using python</p>
<pre><code>from pywinauto.application import *
app=Application.Start("C:\Program Files\Windows Media Player\wmplayer.exe")
app.window_(title="Windows Media player")
app.WindowsMediaplayer.MenuSelect("Help->About Windows Media Player")
</code></pre>
<p>Only player is launching but I want Help window</p>
| python | [7] |
4,129,122 | 4,129,123 | Android Notifications | <p>Im trying to start a new activity once i press a notification...the related code is:</p>
<pre><code>NotificationManager notifManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Notification note = new Notification(R.drawable.android, "New E-mail", System.currentTimeMillis());
PendingIntent intent = PendingIntent.getActivity(this, 0, new Intent(this, DatabaseActivity.class), 0);
note.setLatestEventInfo(this, "New E-mail", "You have one unread message.", intent);
notifManager.notify(NOTIF_ID, note);
</code></pre>
<p>But the activity just dsnt begin..the notification pops up..but if i click it nothin happens...plz advice!!!</p>
| android | [4] |
103,611 | 103,612 | Grid View content click and selection | <p>I have made a <code>GridView</code> and enabled the <code>selection</code> property to it. Now <code>select</code> comes next to every row in the gridview. I want to remove the <code>select text/tag</code> and selection should be done on the click on the content.
How can i do this?
:)</p>
| asp.net | [9] |
5,956,967 | 5,956,968 | Javascript issue - null or not an object | <p>I get a below error when i try to do some javascript operations.</p>
<p>'null' is null or not an object.</p>
<p>Is there any resolution for this?</p>
| javascript | [3] |
5,858,378 | 5,858,379 | what is difference between .submit() vs :submit? | <p>Someone tell me the difference between .submit() vs :submit. When & where to use with a simple example please.</p>
<p>Thanks</p>
| jquery | [5] |
3,739,873 | 3,739,874 | who is sending orientation changed event in android | <p>I observed one problem in status bar that while we open it from the home screen and change the device to landscape mode, the orientation of the status bar is not changed to landscape,
but if we open any applications like messaging in which their orientation is changed according to device orientation and then open the status bar, it will also change the orientation. </p>
<p>That means keeping an application who orientation is constant in background and then opening the status bar will have this problem that orientation of status bar also becomes constant.</p>
<p>Please give me some suggestions so that I can rectify this problem. If I could know that who is parsing the xml file and if android:configChanges="keyboardHidden|orientation" is present in the manifest file who is deciding not to send Intent.ACTION_CONFIGURATION_CHANGED</p>
| android | [4] |
2,504,712 | 2,504,713 | how to cancel python schedule | <p>I have a repeated python schedule task as following,which need to run getMyStock() every 3 minutes in startMonitor():</p>
<pre><code>from stocktrace.util import settings
import time, os, sys, sched
schedule = sched.scheduler(time.time, time.sleep)
def periodic(scheduler, interval, action, actionargs=()):
scheduler.enter(interval, 1, periodic,
(scheduler, interval, action, actionargs))
action(*actionargs)
def startMonitor():
from stocktrace.parse.sinaparser import getMyStock
periodic(schedule, settings.POLLING_INTERVAL, getMyStock)
schedule.run( )
</code></pre>
<p>The questions are:</p>
<p>1.how could i cancel or stop the schedule when some user event comes?</p>
<p>2.Is there any other python module for better repeated scheduling?Just like java quartz?</p>
| python | [7] |
2,863,690 | 2,863,691 | Connect Android app to remote database over internet | <p>i have created an android application that stores information into a mysql database, i am using PHP and JSON to achieve this, it runs very well in my emulator, my problem is when i deploy this application onto my phone it can no longer connect to the database on my machine. How do make it communicate over the Internet or network with the remote database on my machine. i am quite new to android app development and really do need your help.i have googled for days and found nothing.</p>
| android | [4] |
1,185,420 | 1,185,421 | java.lang.arrayindexoutofboundsexception array index out of range: 0 In Android | <p>I have a method to get data from webservice</p>
<pre><code>public String getCinema_Show(String mv){
final String SOAP_ACTION = "http://tempuri.org/getDataCinema_Show";
final String METHOD_NAME = "getDataCinema_Show";
final String NAMESPACE = "http://tempuri.org";
final String URL = "http://10.0.2.2:10658/dataphim/Service.asmx";
SoapObject table =null;
SoapObject client =null;
SoapObject tablerow=null;
SoapObject responeBody =null;
SoapObject request = new SoapObject(NAMESPACE,METHOD_NAME);
//request.addProperty("movies",mv);
SoapSerializationEnvelope envelop = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelop.addMapping(NAMESPACE, "test",this.getClass() );
envelop.dotNet=true;
envelop.setOutputSoapObject(request);
HttpTransportSE httptran = new HttpTransportSE(URL);
try
{
client = new SoapObject(NAMESPACE, METHOD_NAME);
client.addProperty("movies",mv);
envelop.setOutputSoapObject(client);
envelop.bodyOut = client;
httptran.call(SOAP_ACTION, envelop);
responeBody = (SoapObject) envelop.getResponse();
responeBody = (SoapObject) responeBody.getProperty(1);
table = (SoapObject) responeBody.getProperty(0);
tablerow = (SoapObject) table.getProperty(0);
rap = tablerow.getProperty("CINEMASNAME").toString();
//Cinema_List.add(rap);
return rap;
} catch (Exception e)
{
System.out.print("Loi "+ e.toString());
rap=e.toString();
return rap;
}
}
</code></pre>
<p>"client.addProperty("movies",mv);" i try to send String to Webservice but i cant reci</p>
<p>When i run project, show "java.lang.arrayindexoutofboundsexception array index out of range: 0"
Please help me</p>
| android | [4] |
4,101,258 | 4,101,259 | How detect and handle if object is used as l-value or as r-value? | <p>I have a container class called <code>Properties</code>. I want to add to it <code>operator[](const std::string & name)</code> which will return property with specified name.</p>
<p>Now lets consider that there is no property with specified name. In this case I wan't to add new <code>Property</code> with specified name to my <code>Properties</code> if it is used as l-value and throw exception otherwise.</p>
<pre><code>Properties pts;
pts.add("name1", val1);
pts.add("name2", val2);
pts["name1"] = val3; //OK
pts["name3"] = val1; //OK creating new Property with value = val1
cout << pts["name4"]; //Ooops can't find Property with name = "name4", so throwing an exception
</code></pre>
<p>Is this possible in C++? How can I write such <code>operator[]</code>?</p>
| c++ | [6] |
1,915,634 | 1,915,635 | Why JavaScript converts my < into > | <p>JavaScript converts my <code><</code> into <code>&gt;</code>. I want to alert it but my message is with encoded marks like <code>@#&amp;*()}{&gt;?&gt;?</code> - how to <strong>display it normally</strong> but <strong>prevent from executing</strong> as HTML code?</p>
<pre><code><span id="ID" onClick="alertIt(this.id);">
<p>Some string with special chars: ~!@#&*()}{>?>?>|{">@#$#^#$</p>
<p>Why when clicked it gives something like this:</p>
<p>'<br>
Some string with special chars: ~!@#&amp;*()}{&gt;?&gt;?>|... and so on
<br>'</p>
</span>
<script type="text/javascript">
function alertIt(ID)
{
var ID = ID;
var content = document.getElementById(ID).innerHTML;
alert(content);
}
</script>
</code></pre>
| javascript | [3] |
5,198,386 | 5,198,387 | Creating a String object by "new" | <p>Consider statement:</p>
<blockquote>
<p>String s=new String("abc");</p>
</blockquote>
<p>Will this statement creates two String objects namely "abc" and the one represented by 's'?</p>
<p>and if it creates two objects then will "abc" get stored in String pool or just discarded?</p>
<p><strong>EDIT:</strong></p>
<p>i am asking this question in reference to <a href="http://stackoverflow.com/questions/3297867/difference-between-string-object-and-string-literal">difference between string object and string literal</a>, where in the last two answers , creation of two objects is denied.</p>
| java | [1] |
5,904,777 | 5,904,778 | Load file from resource | <p>Good morning,</p>
<p>To sumup : in order to add easily unit tests for a SAX parser I would like to load XML from a file.</p>
<p>Now, I have my XML in a static string inside my unit test class, but it is not very convenient for large XML.
This is why I would like to add some XML files to my project and load them in my unit test. How can I do ?</p>
<p>Regards,
Quentin</p>
| android | [4] |
2,432,747 | 2,432,748 | why using directive in C++ is not encouraged? | <p>I read that using directive is not encouraged in C++ saying never put using directives in header files. Why is it like that? Any hint for me?</p>
<p>Thanks!</p>
| c++ | [6] |
2,450,094 | 2,450,095 | How to get the correct results calculating two unix timestamps | <p>I know this has been asked several times before but I can't seem to find the right answer. I want to calculate the difference between two unix timestamps and show this difference in days. I'm not concerned about minutes or seconds here.</p>
<pre><code>$time = 172800 - time() + 1265010604;
echo floor($time/86400);
</code></pre>
<p>Where 1265010604 is the timestamp for today and 172800 is a 3 day offset. Thanks</p>
| php | [2] |
3,092,165 | 3,092,166 | How to stop same letter appearing twice in list? | <p>im trying to write a progam where you enter either a vowel or a consonant 8 times and the list of letters you have chosen is then shown. Is there a way to program it so that the same letter cannot come up twice, e.g if you select vowel and get the letter a, then the letter a cannot be randomly chosen again?
This is the program so far:</p>
<pre><code>lt = 0
letters = []
while lt<8:
letter = raw_input("Please enter v for a Vowel or c for a Consonant: ")
if letter == "c":
letters.append(random.choice(consonant)),
lt = lt + 1
elif letter == "v":
letters.append(random.choice(vowel)),
lt = lt + 1
else:
print("Please enter only v or c")
print ("letters:")
print letters
</code></pre>
| python | [7] |
3,297,733 | 3,297,734 | URL decoding confusion | <p>I've got a DB that refers to the following url:</p>
<p><a href="http://en.wikipedia.org/wiki/Herbert%5FGr%F6nemeyer" rel="nofollow">http://en.wikipedia.org/wiki/Herbert_Gr%F6nemeyer</a></p>
<p>However, it seems that this is a bad URLEncoding, causing problems with both HttpUtility.UrlDecode (gives me garbage) and Uri.UnescapeDataString (UriFormatException). My browser passes the path on to Wikipedia unaltered (so I assume the %F6 gets encoded by the browser), as follows:</p>
<p>GET /wiki/Herbert_Gr%F6nemeyer HTTP/1.1</p>
<p>Wikipedia recognizes and 301 redirects to:</p>
<p>Location: <a href="http://en.wikipedia.org/wiki/Herbert_Gr%C3%B6nemeyer" rel="nofollow">http://en.wikipedia.org/wiki/Herbert_Gr%C3%B6nemeyer</a></p>
<p>What's going on here? Does Wikipedia have an additional proprietary encoding?</p>
<p>EDIT: I've got a local copy of Wikipedia which I am attempting to cross reference aganst this url. The articles are indexed by title, which in this case would be: "Herbert Grönemeyer". Can anyone suggest how I would go from "Herbert_Gr%F6nemeyer" to "Herbert Grönemeyer" in code. Obviously the underscore is not the problem here.</p>
| c# | [0] |
2,752,404 | 2,752,405 | Posting a text to Facebook from a selected table cell | <p>I have a table view with bible verses on each cell. I want to post the verse to Facebook. </p>
<p>I have already done the posting with static text from a textview.</p>
<p>When I tap the cell, an action sheet pops up and there is a button to go to the posting page. This works, the posting page has a textview. How do I get the text view in the posting page to display the content of the selected cell from the tableview? </p>
| iphone | [8] |
2,379,488 | 2,379,489 | ArrayList being returned but recieving a null pointer? | <p>Assuming I have two methods. One that creates an arraylist and returns it, the other retrieving that list to process. both methods are in different classes:</p>
<pre><code>public ArrayList getSocialUsers() throws SQLException
{
Connection conn=DriverManager.getConnection("jdbc:mysql:///socialsystemtest1?user=root&password=");
Statement stmt= null;
String query="SELECT FORE_NAME FROM socialsystemtest1.socialworkers";
stmt= conn.createStatement();
ArrayList<String> socialWorkers= new ArrayList<String>();
try{
ResultSet rs= stmt.executeQuery(query);
while(rs.next())
{
String user= rs.getString("Fore_Name");
socialWorkers.add(user);
}
}
catch(SQLException e) {
//do nothing
}
finally{
if(stmt != null) {
stmt.close();
}
}
return socialWorkers;
}
public void processArray(){
try{
ArrayList<String>= db.getSocialUsers();
//code ommitted
}
catch(SQLException e){
//deal with it here
}
}
</code></pre>
<p>db is an instance of the class that returns the arraylist already instantiated. I recieve a null pointer error at the first line of the second classes method: <code>db.getSocialUsers();</code></p>
<p>when calling the <code>getSocialUsers()</code> method on its own this works and an <code>ArrayList</code> is indeed returned with the correct elements but when calling it from another class gives a null pointer and I don't know why </p>
| java | [1] |
5,781,879 | 5,781,880 | Overriding DialogPreference's default BACK keypress behaviour | <p>By default, when in DialogPreference you press BACK button, it mimics that you've pressed NegativeButton.</p>
<p>I'd like to override that but can't find an easy way except to recreate DialogPreference from scratch (which at the moment seems like an overkill), because I'd like that PositiveButton SET something, NegativeButton to UNSET something, and BACK key to leave things as they were (ie. to not unset something).</p>
<p>Is there a simple solution to this?</p>
<p>I've even tried to override showDialog() but: a) its not simple, b) I don't think I should mess too much with internals of OS supplied code like a bunch of private "m" variables.</p>
<p>Thank you for your time...</p>
| android | [4] |
2,846,935 | 2,846,936 | Return true or Return false | <p>I am learning Javascript, and I am trying to go over everything I have learned so far. I am trying to figure out how to get a message back like an alert box when using the return statement. <code>alert(Example(2,3));</code> works, also making a gobal variable like this works. <code>var sum = Example(2,3); alert(sum);</code>. But I bet there are better ways then I can think of.</p>
<pre><code>function Example(x, y) {
if (x * y === 108) {
return true;
} else {
return false;
}
}
Example(2, 3);
</code></pre>
| javascript | [3] |
3,559,202 | 3,559,203 | How to hide default keyboard | <p>I have 5 UITextFields added on a form. One of the textfileds is for entering the date of birth. So when that particular textfield is touched instead of displaying the default keyboard, datepicker needs to be displayed.</p>
<p>I tried the following:</p>
<pre><code>- (void)textFieldDidBeginEditing:(UITextField *)textField{
[textField resignFirstResponder];
[self showDatePicker];//this is my own function to display datepicker.
}
</code></pre>
<p>when this function is called the datepicker is displayed, along with the date picker the default keyboard is also displayed and that hides the datepicker. I don't know how to get rid of the default keyboard, for this particular textfiled. Please help me.</p>
| iphone | [8] |
5,981,914 | 5,981,915 | URI from InputStream | <p>Is it possible to obtain an URI from an InputStream?</p>
<p>If it is a FileInputStream I can create an URI from it path. But if it's just an InputStream, or a PipedInputStream?</p>
| android | [4] |
4,392,863 | 4,392,864 | Unable to write to console screen from C++ DLL | <p>I want to print messages onto the console screen from a C++ DLL. The front end for this application is in C#. I used AllocConsole() fundtion to create a console from the C++ DLL. The window is being created but no messages were being printed when I try to print a message. Please help me fix this problem.</p>
<p>Thanks,
Rakesh.</p>
| c++ | [6] |
411,492 | 411,493 | How to pass info from control to event at Runtime | <p>I'm creating buttons by code inside a FlowLayoutPanel and I can't create a click event for each one of the created buttons. I need some help cause i'm stuck on this.</p>
| c# | [0] |
2,724,006 | 2,724,007 | Initialize variable of derived struct type in compile time in c++ | <p>I have the next structs:</p>
<pre><code>struct B
{
int a;
int b;
};
struct D: public B
{
int c;
};
</code></pre>
<p>I want to initialize some variable of struct D in compile time, like if I would initialize the struct B it would looks like:</p>
<pre><code>B b1 = { value_of_a, value_of_b };
</code></pre>
<p>I tried to do this in next ways, but it didn't compile:</p>
<pre><code>D d1 = { { value_of_a, value_of_b } , value_of_c };
D d2 = { value_of_a, value_of_b , value_of_c };
</code></pre>
<p>If I change the struct to:</p>
<pre><code>struct D
{
B bb;
int c;
};
</code></pre>
<p>it compiles with "d1" and "d2" initialization.</p>
<p>So, the question is how I can initialize the derived struct?
And if there is now rule for initializing derived struct, what is the reasons?</p>
<p>Thank you.</p>
| c++ | [6] |
4,973,473 | 4,973,474 | how to get mail via imap in c#? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/670183/accessing-imap-in-c">Accessing Imap in C#</a> </p>
</blockquote>
<p>I need code c# to get mail with IMAP protocol.</p>
| c# | [0] |
571,422 | 571,423 | jquery function shorthand | <p>Is there any shorthand for this?</p>
<pre><code>(function($) {
$.fn.DoStuff= function() {
// do stuff
};
})(jQuery);
</code></pre>
<p>This will be placed in separate file. </p>
<p>And than to be called like that from another file from inside $(document).ready( function(){});:</p>
<pre><code>$('element').DoStuff();
</code></pre>
<p>?</p>
| jquery | [5] |
1,553,021 | 1,553,022 | How do you write good PHP code without the use of a framework? | <p>Other than standard OO concepts, what are some other strategies that allow for producing good, clean PHP code when a framework is not being used?</p>
| php | [2] |
4,831,140 | 4,831,141 | Can I parse the directory listing of an external webpage? | <p>Is it possible to parse the directory listing of a webpage which is external given the webpage is accessible and it shows a list of the files when I access it. I only want to know is it possible to parse the files dynamically in PHP and how? -thank you</p>
<p>Sorry for being not clear. I mean a directory listing such as:
<a href="http://www.ibiblio.org/pub/" rel="nofollow">http://www.ibiblio.org/pub/</a> (Index of /..) and ability to read the content as array or something easy to manipulate in my script</p>
| php | [2] |
2,566,800 | 2,566,801 | Use JavaScript string as function name? | <p>I need to call a function in the following fashion:</p>
<pre><code>var f = 'fadeOut';
$(v).f(s, function(){
$(v).css('visibility', 'hidden').css('position', 'absolute');
});
</code></pre>
<p>Is this possible to do simply?</p>
| javascript | [3] |
1,389,147 | 1,389,148 | is there a way to run a JQuery function even the DOMs are not yet loaded | <p>im thinking if there is a way to run a jquery function like $.post even if the DOM's are not yet loaded..</p>
| jquery | [5] |
371,613 | 371,614 | Any tool to find out what functions are not used in a PHP Application? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/11532/how-can-i-find-unused-functions-in-a-php-project">How can I find unused functions in a PHP project</a> </p>
</blockquote>
<p>I find that sometimes, after developing for sometime, some functions that are not used are still in the code. Its hard to track these, some IDE's will highlight unused variables, but functions?</p>
<p>It will be something like Code Coverage but not for unit tests</p>
| php | [2] |
2,571,093 | 2,571,094 | use javascript to change <li> style | <p>I have defined styles for <code><li></code></p>
<pre><code>#mainNav{clear:both;background-image: url(../images/bg_menu.jpg);width:975px;height:43px;color:#fff;margin-top:-25px;}
#mainNav ul{list-style: none;padding: 0;margin: 0;}
#mainNav ul li{line-height:43px;float:left;background-image: url(../images/bg_menu.jpg);font-size:15px;font-weight:normal;text-align:center;cursor:default;padding:0px 15px;}
#mainNav ul li:hover{background:#332a03;color:#f7df84;}
<div id="mainNav">
<ul>
<li>Home</li>
<li>Training and Workshops</li>
<li>Community Consultations</li>
<li>Community Surveys</li>
<li>Program and Facility Assesments</li>
<li>Reports</li>
</ul>
</div>
</code></pre>
<p>I now want to go back and change the padding for the <code><li></code> to '0px 14px' because for some reason it doesn't render right only on Firefox on Mac. So I have this script so far...</p>
<pre><code>var browser = "other";
var OpSys = "other";
if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) {
browser = "Firefox";
}
if (navigator.userAgent.indexOf('Win') != -1) {
OpSys = "Macintosh";
}
// if its a Mac and Firefox, then change the padding
if (OpSys == "Macintosh" && browser == "Firefox") {
// how do I change the padding for each <li> ?
}
</code></pre>
| javascript | [3] |
3,138,880 | 3,138,881 | PropertyInfo.CanRead and PropertyInfo.CanWrite | <p>I'm a little confused as to how PropertyInfo.CanRead/Write works. </p>
<p>I've got one particular property on a class where CanRead returns true and CanWrite returns false. However, if I try to do property.GetValue(myObject,null) on this property, I get an exception message, "Exception has been thrown by the target of an invocation."</p>
<p>If I'm able to read this property, why would GetValue() fail?</p>
<p>Thanks very much.</p>
| c# | [0] |
3,793,347 | 3,793,348 | Static variables in Android | <p>I defined static variables in Activities in order to pass complex data between Activities.</p>
<p>Many people suggest not to use any static variables in Android. Some people suggest to store global data in a custom android.app.Application. I don't think there is any difference between static variable and custom Application.</p>
<p>I'd like to know your thoughts on static variables. Any suggestions?</p>
<p>Thanks.</p>
| android | [4] |
12,706 | 12,707 | Asynchronous external aplication execution in PHP | <p>I was wondering if is is possible to send output from application ran by php to client.</p>
<p>For example i have application that outputs:</p>
<pre><code>Hello world
</code></pre>
<p>And after 10 seconds it outputs</p>
<pre><code>10 seconds passed
</code></pre>
<p>I'd like to know if it is possible to send "Hello word" and "10 seconds passed" to client without waiting until whole program finishes its job. Client would receive "Hello world" first and after 10 seconds second output.</p>
<p>Thank you.</p>
| php | [2] |
129,826 | 129,827 | How to get nick name from phone number in android | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2174048/how-to-look-up-a-contacts-name-from-their-phone-number-on-android">How to look-up a contact's name from their phone number on Android?</a> </p>
</blockquote>
<p>How to get nick name from phone number in android.What are content provider used.</p>
| android | [4] |
5,875,889 | 5,875,890 | store looped data in separate variables in python? | <p>i want to store looped data from a returned function into separate variables. here is my code
Please correct me if wrong</p>
<p>function:</p>
<pre><code> def rawi():
a = raw_input("enter value of a")
b = raw_input("enter value of b")
return a, b
#calling the above function:
c = rawi()
for i in c:
print i
</code></pre>
<p>my desired output should be like :
variable1 should have the value returned from a
variable2 should have the value returned from b</p>
<p>thank</p>
| python | [7] |
347,558 | 347,559 | Is there a thing as visual JAVA? Like Visual C++? If so what are the best resources to learn it? | <p>Preferably please provide me resources with as many exercises as possible. Any response and help is much appreciated.</p>
| java | [1] |
5,215,874 | 5,215,875 | Can we launch the android application every time we open it in the mobile | <p>When I closed my app and re-opened it in the mobile,it is opening with the same page which I closed with. But my requirement is that, when I close my app and re-open it ,it should start from the beginning(launched) instead of starting from where I closed it.
Please help me solve this..</p>
| android | [4] |
4,704,325 | 4,704,326 | Why IEnumerable<T> returns null here? | <p>Can anyone please tell me why method parameter IEnumerable returns null even though it is assigned at the callee method.
We all know interface is an reference type. </p>
<p>Dont consider the logic. I just replaced my business logic to suit the scenario</p>
<pre><code>static void Main()
{
IEnumerable<int> gEnumerable = null;
Foo(gEnumerable); //here param gEnumerable always returns null even if i assign value at my Foo(), why is it so???
}
static IEnumerable<int> Bar(List<int> lst)
{
return lst.Select(k => k);
}
private static void Foo(IEnumerable<int> response)
{
response = Bar(new List<int> { 1, 2, 3, 4, 5, 6 });
}
</code></pre>
<p>Kindly explain me regarding this</p>
| c# | [0] |
5,584,234 | 5,584,235 | how to print object list to file with formatting in table format using java | <p>I have to print list of objects to a text file with table format. For example, if I have list of Person(has getName,getAge and getAddress methods)objects, the text file should look like as below. </p>
<pre><code>Name Age Address
Abc 20 some address1
Def 30 some address2
</code></pre>
<p>I can do this by manually writing some code, where I have to take care of spaces and formatting issues. </p>
<p>I am just curious whether are they APIs or tools to do this formatting work?</p>
| java | [1] |
2,315,445 | 2,315,446 | fetch read and unread mails of gmail into my c#.net application | <p>i'm creating project like gmail using gmail's SMTP and POP3......in my project i want to display all read and unread mails which are already present in my gmail account and i want to fetch all mails from gmail to my c#.net Grid view control..how can i??? plz give me code. if u have suggestion than help me..............Sagar Patel.......plz send me code at :"<em>removed</em>" if possible and send it ass soon as possible bcz i hav very few days to complete my project............</p>
| c# | [0] |
2,467,387 | 2,467,388 | how to run ActiveX object on Mozilla Firefox | <p>I want to run code of javascript having ActiveX object on Mozilla firefox, can anyone tell me how to do</p>
| javascript | [3] |
636,346 | 636,347 | wins on average | <p>I am just learning python (first language ever) and am implementing what I find in ways that I find fun. I built a pseudo slot machine odds calculator. However, it stops at one Grand prize win. Is there a way to make it run over and over to give an average number of attempts for n amount of games to get the grand prize?</p>
<p>Here's my code</p>
<pre><code>#!/usr/bin/env python
import random
a = 1
while a >0 :
l1 = random.randrange(36)
l2 = random.randrange(36)
l3 = random.randrange(36)
print l1, l2, l3
if l1 == l2 == l3 == 7:
print 'grand prize winner!!!'
break
elif l1 == l2 == l3:
print 'you won! congratulations'
print 'it took', a, 'attempts to win'
else:
a += 1
print 'sorry... try again'
print 'attempt', a
</code></pre>
<p>Also, is there a way to tell me how many normal wins there were during the course of winning that grand prize</p>
| python | [7] |
3,395,625 | 3,395,626 | How to programmatically find an ASP.NET App_Data folder path | <p>I need to read a file there. I tried Assembly.ExecutingAssembly etc but that doesnt work.</p>
| asp.net | [9] |
244,912 | 244,913 | How to execute a remote page? | <p>How do I exexcute python script found on a website?
For e.g. following seems to work. But is it the right way?</p>
<pre><code>curl http://www.ics.uci.edu/~eppstein/PADS/UnionFind.py | python
</code></pre>
<p>I will like to know if I can import a webpage from python command prompt >>></p>
| python | [7] |
4,183,213 | 4,183,214 | ASP.NET Web.Config Hidden Features? | <p>Yesterday I found a very useful article on MSDN about Enabling Application-Level Tracing
<a href="http://msdn.microsoft.com/en-us/library/1y89ed7z%28VS.85%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/1y89ed7z(VS.85).aspx</a></p>
<pre><code><configuration>
<system.web>
<trace enabled="true" requestLimit="40" localOnly="false"/>
</system.web>
</configuration>
</code></pre>
<p>So I would to ask if there are other useful config settings that you recommend learning about? </p>
| asp.net | [9] |
3,137,050 | 3,137,051 | how to access mysql from iphone | <p>i'm a beginner to iphone.i want to create a login page for my application.i cant figure out how to connect to a php page and retrieve corresponding data from mysql database to the iphone.could any one guide me how to go about it.</p>
| iphone | [8] |
4,192,211 | 4,192,212 | How to detect browser minimize and maximize state in javascript | <p>I am trying to find the browser minimize and maximize states, as I want to hit the AJAX request accordingly the browser state.</p>
<p>Does anyone know how do I detect the browser state using JavaScript.</p>
| javascript | [3] |
5,393,151 | 5,393,152 | How to load/save a txt file to richtextbox according to specific date from monthcalendar | <p>i have the date selected in a textbox </p>
<pre><code>// Create a SelectionRange object and set its Start and End properties.
SelectionRange sr = new SelectionRange();
sr.Start = DateTime.Parse(this.richTextBox1.Text);
sr.End = DateTime.Parse(this.textBox3.Text);
/* Assign the SelectionRange object to the
SelectionRange property of the MonthCalendar control. */
this.monthCalendar1.SelectionRange = sr;
this.richTextBox1.LoadFile(@"C:\a.txt", RichTextBoxStreamType.PlainText);
</code></pre>
<p>and i would like to load a specific text file for each date(example 25/5/2013 --2552013.txt</p>
<p>how can i do it?
i am thinking to take out the / from</p>
<pre><code> this.richTextBox1.Text = monthCalendar1.SelectionRange.Start.Date.ToShortDateString();
</code></pre>
<p>and later load it from the local folder with a button click, and save it with another button.</p>
| c# | [0] |
1,891,879 | 1,891,880 | Android SDK and fresh install | <p>I'm looking into buying an Android phone and I'd like to do some development on it as well. Is it possible to perform a fresh clean install on any Android device via the SDK? In other words, is it possible to remove the preloaded OS (i.e. with additional provider software) and install the standard Android OS?</p>
<p>Thanks</p>
| android | [4] |
2,947,011 | 2,947,012 | Android ExpandableListView with 2 sub levels | <p>How can i achieve ExpandableListView with 2 sub levels ? Can anyone help me out ?</p>
| android | [4] |
1,254,364 | 1,254,365 | Any standalone converter from Java Class to C#? | <p>I found these two - <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=46bea47e-d47f-4349-9b4f-904b0a973174&displaylang=en" rel="nofollow">Java Language Conversion Assistant</a> and <a href="http://developer.db4o.com/blogs/product%5Fnews/archive/2008/05/20/smart-java-to-c-conversion-for-the-masses-with-sharpen.aspx" rel="nofollow">sharpen</a>. But the first one depends on Visual Studio, the second on Eclipse.</p>
<p>I would prefer something standalone with command line if possible, even if very primitive.</p>
| c# | [0] |
1,303,022 | 1,303,023 | Selection list cut off in AutoCompleteTextView in Dialog | <p>I have a dialog window that covers 1/3 of the entire screen height and is displayed on top of my activity. The dialog holds two AutoCompleteTextView fields.</p>
<p>The problem I'm facing is that when the user starts typing something into the AutoCompleteTextView, the list with all suggestions only shows up to the bottom end of the dialog, but doesn't go beyond that even the list is longer. It looks like it's cut off. (screenshot left)</p>
<p>Only after I long-press an item from the suggestion list, the list will be shown in full length. (screenshot right)</p>
<p>Screenhot is at: <a href="http://img704.imageshack.us/i/dialogdropdown.png/" rel="nofollow">http://img704.imageshack.us/i/dialogdropdown.png/</a>
<img src="http://img704.imageshack.us/img704/1893/dialogdropdown.png" alt="screenshot"></p>
<p><strong>How to fix this behaviour so that the list shows in full length right from the beginning, when the user starts typing something?</strong></p>
<p>Code-wise there's nothing special, all I do is:</p>
<pre><code>ArrayAdapter<String> adapter = new ArrayAdapter<String>(this.getContext(), R.layout.nav_route_autocomplete_row, locStrings);
AutoCompleteTextView txtStartPos = (AutoCompleteTextView) findViewById(R.id.txtStartPos);
txtStartPos.setAdapter(adapter);
...
</code></pre>
<p>One workaround idea is to somehow dispatch a motion event to simulate a touch (but then not selecting though) one of the list items. Any concrete idea in code for a solution, anybody?</p>
| android | [4] |
4,969,370 | 4,969,371 | valueOf() vs. toString() in Javascript | <p>In Javascript every object has a valueOf() and toString() method. I would have thought that the toString() method got invoked whenever a string conversion is called for, but apparently it is trumped by valueOf().</p>
<p>For example, the code</p>
<pre><code>var x = {toString: function() {return "foo"; },
valueOf: function() {return 42; }};
window.console.log ("x="+x);
window.console.log ("x="+x.toString());
</code></pre>
<p>will print</p>
<pre><code>x=42
x=foo
</code></pre>
<p>This strikes me as backwards .. if x were a complex number, for example, I would want valueOf() to give me its magnitude (so that zero would become special), but whenever I wanted to convert to a string I would want something like "a+bi". And I wouldn't want to have to call toString() explicitly in contexts that implied a string.</p>
<p>Is this just the way it is? </p>
| javascript | [3] |
2,788,827 | 2,788,828 | How to set target folder in JavaScript | <p>How can I set the root folder in JavaScript when using Ajax?</p>
<p>This is my code?</p>
<pre><code>var url="../../ajax_permission_data.php"
url=url+"?opp="+operation+"&userid="+userId;
url=url+"&sid="+Math.random()
</code></pre>
<p>But I am getting error file not found. If I am putting this file in same folder then it will work. But I don't want to all the files in same folder. So please help me how to set the path.</p>
| javascript | [3] |
2,447,428 | 2,447,429 | jquery doing two ajax calls under on function | <p>if have the following two scripts, when a button is clicked i wish for them both to be loaded, at the moment they are conflicting? any suggestions? the first needs to run before the second. I have tried calling two separate function but still i get a conflict </p>
<pre><code>function showUser3(str)
{
if (str=="")
{
document.getElementById("basketShow").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("basketShow").innerHTML=xmlhttp.responseText;
}
}
var Id = str;
var qty = $("#"+Id).find("#qty").val();
var productID = $("#"+Id).find("#productID").val();
var categoryID = $("#"+Id).find("#categoryID").val();
var priceID = $("#"+Id).find("#priceID").val();
var url = 'ajaxAddBasket.php?productID='+productID+'&categoryID='+categoryID+'&qty='+qty+'&priceID='+priceID+'&Id='+Id;
xmlhttp.open("GET",url,true);
xmlhttp.send();
if (str=="")
{
document.getElementById("ajaxPallet").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("ajaxPallet").innerHTML=xmlhttp.responseText;
}
}
var url = 'ajaxPallet.php';
xmlhttp.open("GET",url,true);
xmlhttp.send();
}
</code></pre>
| jquery | [5] |
2,023,289 | 2,023,290 | What technique would you recomend when reviewing C++ for an interview? | <p>I've got about 2/3 years C++ experience but I've spent most of my career doing Java. I'm about to go for an interview for a C++ programming role and I've been thinking about the best way to brush up my C++ to make sure I don't get caught out by any awkward questions. What would you recommend?</p>
| c++ | [6] |
1,228,584 | 1,228,585 | how to configure php curl_init function | <p>How exactly do I initiate curl_init function?</p>
| php | [2] |
5,750,647 | 5,750,648 | script for query a db help needed | <p>i have the following code in php:</p>
<pre><code>$host="localhost"; // Host name
$username="***"; // username
$password="***"; // password
$db_name="***"; // Database name
//$rc_profile_table="rc_profile_table"; // Table name
//$rc_profile_relation_table="rc_profile_relation_table"; // Table name
mysql_connect("$host", "$username", "$password");
mysql_select_db("$db_name");
$sql="SELECT created_at FROM rc_profile_table where created_at > 2011-04-19 08:00:00";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
$sql="SELECT created_at FROM rc_profile_relation_table where created_at > 2011-04-19 08:00:00";
$result2=mysql_query($sql);
$count2=mysql_num_rows($result);
mysql_close();
</code></pre>
| php | [2] |
559,462 | 559,463 | How can i check if an external page exists? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/981954/how-can-one-check-to-see-if-a-remote-file-exists-using-php">How can one check to see if a remote file exists using PHP?</a><br>
<a href="http://stackoverflow.com/questions/4437223/what-is-the-best-way-to-check-if-a-url-exists-in-php">What is the best way to check if a URL exists in PHP?</a> </p>
</blockquote>
<p>i m displaying some RSS articles on my site, and i want to display a 404 error message in case the external article has been removed or archived. how can i do this with php?</p>
<p>thanx</p>
| php | [2] |
1,176,210 | 1,176,211 | how can i write my name with asterisks in java? | <p>My name is mehmet.I could not write it by using stars in java.</p>
| java | [1] |
5,121,159 | 5,121,160 | "Field has incomplete type" | <p>There is an error in my header file: "field "ui" has incomplete type."</p>
<p>I have tried making ui a pointer, but that doesn't work; I don't think I need to do that because I have already defined my <code>MainWindowClass</code> in the namespace Ui. I don't know what else I can tell you. This is my mainwindow.h.</p>
<pre><code>#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QtGui/QMainWindow>
#include "ui_mainwindow.h"
namespace Ui {
class MainWindowClass;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0, Qt::WFlags flags=0);
~MainWindow();
public slots:
void slideValue(int);
private:
Ui::MainWindowClass ui; //error line
};
#endif // MAINWINDOW_H
</code></pre>
| c++ | [6] |
157,671 | 157,672 | jquery make selection | <p>I have a drop down.
One of the selections is Please Enter.</p>
<p>How do I force it to go to Please Enter</p>
<p>The id of the selectlist is called makeSelection</p>
<pre><code> $('select.makeSelection').val("Please Enter").attr('selected', 'selected');
</code></pre>
| jquery | [5] |
5,267,057 | 5,267,058 | What makes javascript dangerous? What uses that javascript can be used as? | <p>I have been dabbling around with javascript for fun. I keep wondering why there are some people that do not like javascript because it can be easily abused or badly written. Then there are some people that love javascript because it is a powerful language and very useful for various purposes.</p>
| javascript | [3] |
62,012 | 62,013 | activate events onclick of browser's back button in jquery | <p>Im looking for a simple cross-browser plugin or method that can help me do this :</p>
<pre><code>$('#clear_window').click(function(){
$('#window').fadeOut(50);
var activeTab = $("ul.tabs li.active").find("a").attr("href");
$(activeTab).fadeIn(50);
});
</code></pre>
<p>but on the click of the browsers back button not on the #clear_window click</p>
| jquery | [5] |
3,751,041 | 3,751,042 | How to alert variable name, not a value | <p>How to alert variable name, not a value of variable?</p>
<pre><code>var color = 'red';
alert(color); // Will alert 'red'
alert(/* magic */); // Will alert 'color'
</code></pre>
| javascript | [3] |
4,281,562 | 4,281,563 | Choose value for $_FILES[<filename>]["tmp_name"] | <p>Is there a way to client-side choose the value for <code>$_FILES[<filename>]["tmp_name"]</code> instead of having it be randomly generated? For example, is there some type of attribute I can somehow append to the file itself, called "tmp_name", so that when it's uploaded the receiving PHP script reads <strong>my</strong> <code>tmp_name</code> rather than generating a random one?</p>
| php | [2] |
2,024,067 | 2,024,068 | What are some blogs for php practices? | <p>I am a beginner learning PHP codes with a book for myself. I believe in adventures more than rules, and I wanted to know some blogs or web resources which gives real time examples because I am bit tired about learning just the syntax and structures.</p>
| php | [2] |
4,702,446 | 4,702,447 | Why this setTimeout() methods not working in this function? | <pre><code>function SlideShow(area)
{
var SlideImg = new Array('img1', 'img2');
var SlideArea = document.getElementById(area);
for(i=0;i<SlideImg.length;i++)
{
var html = '<img src="images/room/' + SlideImg[i] + '.jpg" id="' + SlideImg[i] + '" class="not-active" />';
SlideArea.innerHTML += html;
}
var a = 0;
function RunSlide()
{
document.getElementById(SlideImg[a]).className = 'active';
a++;
}
var run = setTimeout('RunSlide()', 5000);
}
</code></pre>
<p>This function not working after I add the setTimeout() method there. Can anybody help me?</p>
| javascript | [3] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.