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,907,890 | 2,907,891 | retrieve an image from server with a rest web service | <p>Sorry for my english.
I want to retrieve image from a server via a rest web service to android.Can someone explain me the architecture which i'll follow to do this?
thanks</p>
| android | [4] |
2,676,686 | 2,676,687 | How to handle 150 Mb of raw videos and music files in Android | <p>I've been developing this content-based app for Android which includes over 120 MB of video <code>.mp4</code>-files saved on the raw folder and in addition it includes over 20 MB of sound files also saved in the raw folder.</p>
<p>The problem is I cannot install the app on my Android phone due to limited internal memory to handle all those files. Also, I read somewhere that the app size limit on the Android market is 50MB so I won't be able to even upload the damn thing.</p>
<p>I've saved the videos on the raw folder as I was able to play them fine (using <code>VideoView</code>).</p>
<p>My question is how do i cope with such size, do I have to go through making the user download the content after installing the app or is there any other way of dealing with such sizes (~140 MB). </p>
| android | [4] |
5,837,734 | 5,837,735 | Java sever code to Push Notification to particular device in Android | <p>I am creating an Android app where in I will require the push notifications.
I have done client side application but i want server side application using java.</p>
<p>Please help me.</p>
| android | [4] |
700,749 | 700,750 | How to think of Javascript-is this accurate? | <p>I'm working through some javascript examples, and I just did this one:</p>
<pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Page title</title>
<script type="text/javascript">
function displayText()
{
document.getElementById('targetDIV').innerHTML = "You're using Javascript";
}
</script>
</head>
<body onload="displayText()">
<h2>This should be before the other text.</h2>
<div id="targetDIV">
</div>
</body>
</html>
</code></pre>
<p>OK. Very basic, I know-but I realized I was confused about the "why" of some things. Could it be accurate to say that:</p>
<p>Function=<strong>WHAT</strong> will happen.</p>
<p>The call (the body onload...)= <strong>WHEN</strong> it will happen.</p>
<p>and div id="targetDIV" = <strong>WHERE</strong> it will happen</p>
<p>I know this is the case in this example, but in general is that the way things work in Javascript?</p>
| javascript | [3] |
4,262,108 | 4,262,109 | New to C++ Please recommend some things to read based on this code | <p>Hi I'm trying to understand this program, I have a basic knowledge of c++ but this code is over my head. I just need to understand it thoroughly. Can you please take a look and recommend me what to read about or explain the syntax. </p>
<p>Thanks much </p>
<pre><code>#ifndef IQ_C
#define IQ_C
#include"iq.h"
#include<cassert>
issue_queue_t::issue_queue_t(unsigned int size) : used(size) {};
void issue_queue_t::resize(int size)
{
used.resize(size);
}
unsigned int issue_queue_t::size()
{
return used.size();
}
void issue_queue_t::clear()
{
used.assign(used.size(),IQ_ENTRY_FREE);
}
void issue_queue_t::free_iq_entry(const unsigned int entry_num)
{
assert(used[entry_num]==IQ_ENTRY_ALLOC);
used[entry_num] = IQ_ENTRY_FREE;
}
int issue_queue_t::find_iq_entry()
{
for(int i=0;i<static_cast<int>(used.size());i++)
{
if(used[i]==IQ_ENTRY_FREE)
{
return i;
}
}
return -1;
}
int issue_queue_t::alloc_iq_entry()
{
int i = find_iq_entry();
if(i==-1)
{
return -1;
}
assert(used[i]==IQ_ENTRY_FREE);
used[i]=IQ_ENTRY_ALLOC;
return i;
}
#endif
</code></pre>
| c++ | [6] |
166,489 | 166,490 | Selective AppWidgets | <p>I have a app which has 2 widgets, lets call them SimpleWidget and ListWidget.
ListWidget makes use of android 3.1 (api level 12) features. </p>
<p>What I would like to do is register both widgets if the device is 3.1 or above.
If it is not than I would only want to register SimpleWidget.</p>
<p>As the code stands now the widgets are defined in my app's AndroidManifest.xml file.
I can't figure out how I could filter this by sdk level. </p>
<p>The only solution I have found so far would still display both widgets (in android's add widget page) even on pre 3.1 devices (in which case I relegate ListWidget to a SimpleWidget).</p>
<p>Am I missing something? </p>
<p>For example can I register widgets in Java code (maybe in the app's onCreate method) instead of in the manifest file? (seems unlikely since the info is needed before the app is ever run).</p>
| android | [4] |
5,579,824 | 5,579,825 | Copying listeners/observers in a copy constructor | <p>I'm programming a class that implements the observable pattern (not the interface) and I'm thinking about whether or not the copy constructor should also copy the listeners.</p>
<p>On the one hand the copy constructor should create an instance that is as close as possible to the original instance so that it can be swapped out in the display context.</p>
<p>On the other hand this would assume the listeners can cope with that kind of thing.</p>
<p>Any thoughts? Are there any best practices?</p>
| java | [1] |
3,948,175 | 3,948,176 | Array Iteration using foreach | <p>I have something like a json array output, it comes like :</p>
<pre><code>{
"data": [
{
"color"
"size"
"id"
"weight"
},
{
"color"
"size"
"id"
"weight"
},
</code></pre>
<p>And so on.
The array name is called $cars.
I need to loop through all the array and get all car sizes.</p>
<p>something like:</p>
<pre><code>foreach ($cars as $value) {
$carsize=[data][i][size]
</code></pre>
<p>Thanks.</p>
| php | [2] |
888,431 | 888,432 | How can I activate the Arabic soft keyboard in Android 2.3? | <p>Android 2.3 supports Arabic; how can I launch the Arabic soft keyboard in Android 2.3?</p>
| android | [4] |
1,097,141 | 1,097,142 | slider/carousel with auto and continuous scrolling | <p>I'm looking for a jquery plugin to slide images horizontally in a way that the scrolling is continuous (copntent is displayed in an infinite loop) and enabled by default (autoscroll). The closest I've found is jcarousel however the "auto" property can only be set to 0 (in which case autoscroll is disabled) or 1+ which represents a pause time between the slides.</p>
<p>Have anyone already come across what I'm looking for?</p>
| jquery | [5] |
3,279,897 | 3,279,898 | Difference between http and https technique | <p>Does it need <code>Certificate/License/Registration</code> before launching the website using <code>https</code>?</p>
<p>I want to use the mentioned code in <code>Global.asax</code> file.</p>
<pre><code>protected void Application_BeginRequest(Object sender, EventArgs e)
{
Response.Redirect("https://" + Request.ServerVariables["HTTP_HOST"]
+ HttpContext.Current.Request.RawUrl);
}
</code></pre>
| asp.net | [9] |
2,966,040 | 2,966,041 | Can we communicate client and server using SOAP UI in Android? | <p>provide any related links.
If yes it's fine. If NO why? suggest me. </p>
| android | [4] |
941,746 | 941,747 | How to stack getClass() | <p>My question is why does the first line work but not the second:</p>
<pre><code>Class<? extends Class> c1 = (new Object()).getClass().getClass();
Class<? extends Class<? extends Class>> c2 = (new Object()).getClass().getClass().getClass();
</code></pre>
| java | [1] |
4,618,232 | 4,618,233 | Error in strings.xml: invalid symbol 'continue' | <p>In my strings.xml file I have </p>
<pre><code><string name="continue">Continue</string>
</code></pre>
<p>I can't build my project because of the error: "Invalid symbol: 'continue'". Why I can't use such a name?</p>
| android | [4] |
975 | 976 | How can I convert Double Date to std::string | <p>I got the Date value from the method from the following code</p>
<pre><code> DATE dDate;
hr = pADsUser->get_PasswordLastChanged(&dDate);
// pADsUser is pointer variable of IADsUser
</code></pre>
<p>Date type is discribed in the link
<a href="http://msdn.microsoft.com/en-us/library/82ab7w69%28v=vs.71%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/82ab7w69%28v=vs.71%29.aspx</a></p>
<p>How can I convert this kind of Date to string so that I can print it in console.</p>
<p>I am not using MFC Dlls for this application. so I cannot use the COleDateTime type also.</p>
<p>Is there any built in method available or Do I need to calculate the date manually?</p>
| c++ | [6] |
4,783,488 | 4,783,489 | Generating a div in asp.net | <p>I am trying to generate an html div in asp.net. </p>
<p>Since a div is considered as an HtmlGenericControl, I tried using that but don't know how to define the type of control, therefore it always generates a "span". </p>
<p>Any ideas on how I can define it as a div?</p>
| asp.net | [9] |
4,202,998 | 4,202,999 | How to build an absolute URL for the host currently in use in an ASP.NET app | <p>I am currently in a dev only phase of development, and am using the VS built-in web server, configured for a fixed port number. I am using the following code, in my <code>MembershipService</code> class, to build an email body with a confirmation link, but obviously this must change when I deploy to our prod host.</p>
<pre><code>var url = string.Format("http://localhost:59927/Account/CompleteRegistration/{0}", newMember.PendingReplyId);
</code></pre>
<p>How can I build this URL to always reflect the host that the code is running on, e.g. when deployed to prod the URL should be <code>http://our-live-domain.com/Account/..etc.</code></p>
<p><strong>MORE INFO</strong>: This URL will is included in an email to a new user busy registering an account, so I cannot use a relative URL.</p>
| asp.net | [9] |
2,545,806 | 2,545,807 | Android Orentation Changes | <p>I have a simple activity to make since of screen touches. What is strange is that the activity starts in whatever orientation i'm in but rotating the device does nothing at all.</p>
<p>I am on an Acer A100 running Android 4.0.3</p>
<p><a href="http://pastebin.com/A4KDH2e7" rel="nofollow">AndroidManifest.xml</a></p>
<p><a href="http://pastebin.com/cFx4rqQa" rel="nofollow">SingleTouchTest.java</a></p>
<p>The main activity is a listview that loads my separate system tests. I can run the SingleTouchTest activity without problems except rotation. I have tried every combination of:</p>
<p><code>android:configChanges="keyboard|keyboardHidden|orientation" android:screenOrientation="unspecified"</code> </p>
<p>and it does not auto rotate. I even removed the:</p>
<p><code>public void onConfigurationChanged</code> function and nothing happens.</p>
| android | [4] |
1,519,666 | 1,519,667 | Send keyboard event using subprocess | <p>I have two python scripts. First one is just script waiting for user keyboard input. When user presses a key it print a pressed key value.</p>
<p>Second script calls first one through subprocess using Popen like this</p>
<pre><code>p = Popen('python first_script.py', shell=True, universal_newlines=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT)
print p.communicate(input="some value paased through")[0]
</code></pre>
<p>I got it working when I send through string values. But I don't know how to send keyboard event and how to read it properly.</p>
<p>I know it is kind of a strange logic behind this. But i need this to work :P</p>
| python | [7] |
165,515 | 165,516 | PHP Match the entire word | <p>I have a list of bad words in the database. Everytime a user submit a comment, a function goes through the entire list of bad words and replace each word with <em>*</em></p>
<pre><code> $query = "SELECT * FROM bad_words ORDER BY id ASC";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$word = $row['word'];
$replacement = "***";
$userInput = str_replace(" $word ", $replacement." ", $userInput);
}
</code></pre>
<p>The problem is that str_replace does not work properly. For instance, "associated" will become "***ociated". I have also tried to use this preg_replace</p>
<pre><code>$userInput = preg_replace("|\\b$\word\\b|i",$replacement,$userInput);
</code></pre>
<p>but it is not working for some reason. Some of the bad words in the database contains characters like
<code>@ | , ! * ) . ^ ' ( @</code> </p>
<p>my guess is that these characters are causing preg_replace to fail. Is there anyway around this?</p>
| php | [2] |
3,157,026 | 3,157,027 | Android App - disappearance of app GUI | <p>I'm trying to create a simple app, whose main task is to open the browser on defined URL.
I've created first Activity:</p>
<pre><code>public class MyActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);
Intent myIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse("http://my.url.tld"));
startActivity(myIntent);
}
</code></pre>
<p>Here's my AndroidManifest.xml:</p>
<pre><code><manifest ...>
<application ...>
<activity android:name=".MyActivity" ...>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</code></pre>
<p>This code is fully functional, but before it opens the browser, it displays a black background - blank app GUI. I didn't figured out, how to go directly do the browser (without displaying the GUI).</p>
<p>Anyone knows?</p>
| android | [4] |
5,395,530 | 5,395,531 | i want to display this listview on scrolling | <p>I'm completely stumped on this one. I have three different lists that need to be displayed on the screen.
I've tried using a ScrollView with a LinearLayout child, and putting my ListViews in the LinearView, but all of the ListViews lock to a fixed height with scroll bars. Using other kinds of Layouts means no scrolling.</p>
| android | [4] |
742,808 | 742,809 | Python calling an executable program | <p>I need to call an executable program with Python, let's say: </p>
<pre><code>C:\Program Files\ANSYS Inc\v140\ansys\bin\winx64\ANSYS140.exe
</code></pre>
<p>I would need to have a txt file (<code>afshin.txt</code>) run with this executable application and then get the output file which is a txt file as well. In MATLAB for example it would be:</p>
<pre><code>dos '"C:\Program Files\Ansys Inc\v121\ANSYS\bin\intel\ansys121.exe" -p AA_T_A -b -i afshin.txt -o file01.out'
mod_1 = load('output_res.txt');
</code></pre>
<p>Would you help me to do it in Python?</p>
| python | [7] |
5,434,081 | 5,434,082 | Javascript Get URL contents | <p>I apologize up front if this question has been asked before. I tried searching for the answer but could not locate it. On my website, I have a click event that changes the url in the address bar without refreshing the page.</p>
<p>example:
<a href="http://www.plantcombos.com/html/hd_viewer.php?plant_Id=1256&tag_Id=4874&photo_Id=4570" rel="nofollow">http://www.plantcombos.com/html/hd_viewer.php?plant_Id=1256&tag_Id=4874&photo_Id=4570</a>
Changes to:
<a href="http://www.plantcombos.com/html/hd_viewer.php?plant_Id=738&tag_Id=4386&photo_Id=4120" rel="nofollow">http://www.plantcombos.com/html/hd_viewer.php?plant_Id=738&tag_Id=4386&photo_Id=4120</a></p>
<p>Now I am trying to extract the variable in the url by doing this:
var photo = getUrlVars()['photo_Id'];</p>
<pre><code>function getUrlVars() {
var vars = {};
var parts = window.location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
vars[key] = value;
});
return vars;
</code></pre>
<p>}</p>
<p>This works to an extent. when I alert out the variable "photo" I get the photo Id of the original url. No matter how many times the url in the address bar changes, I will always get photo = 4570. Can anyone help explain how I might go about getting this variable to retrieve the correct value based on the new url that is displayed. Any help would be greatly appreciated. Thanks.</p>
| javascript | [3] |
288,235 | 288,236 | javascript - can we have self invoking function modules assigned to variables | <p>Can variable be assigned self invoking function module so that the variable reference would trigger calling the function without the () operator. I want the variable to have the latest value based on the code in the function module.</p>
<p>the code could be </p>
<pre><code> count = 0
var x = function(){ return count }();
alert x; // should give 0
count = 7
alert x ; // should give 7
</code></pre>
<p>thanks</p>
| javascript | [3] |
4,920,011 | 4,920,012 | How to set multiple PHP classes intoa Debug mode? | <p>What would be the best way to set 10+ PHP classes into Debug mode easily but still keeping the classes non-dependent of other stuff?</p>
<p>If I set a Global Constant then check for it's value inside every class then every class is reliant on this constant being set. Meaning if I try to use the class in another project it is relying on a Constant from another file.</p>
| php | [2] |
2,423,311 | 2,423,312 | BroadCastReceiver calls Service | <p>Hi I am using this code to call a Service from BroadCastReceiver but its not working.
here is the code:</p>
<pre><code> public class AlarmReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
System.out.println("luli");
Intent myIntent=new Intent(context,AlarmReceiver.class);
// myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startService(myIntent);
}
}
</code></pre>
<p>then on my Service I have this code:</p>
<pre><code>public class AlarmService extends Service {
@Override
public IBinder onBind(Intent arg0) {
// TODO Auto-generated method stub
System.out.println("HEY u bastard service print at least something");
return null;
}
</code></pre>
<p>}</p>
<p>I have also declared in Manifest the service </p>
<p>What is wrong here that is not responding the Service??</p>
| android | [4] |
440,900 | 440,901 | How can I join an array of strings but first remove the elements of the array that are empty? | <p>I am using the following:</p>
<pre><code>return string.Join("\n", parts);
</code></pre>
<p>Parts has 7 entries but two of them are the empty string "". How can I first remove these two entries and then join the remaining five?</p>
| c# | [0] |
322,906 | 322,907 | strange behavior in PHP function: timezone_name_from_abbr | <p>echo timezone_name_from_abbr("", 3600*7, 0); //ok<br/>
echo timezone_name_from_abbr("", 3600*8, 0); //NOT ok! return nothing!<br/>
echo timezone_name_from_abbr("", 3600*9, 0); //ok<br/></p>
| php | [2] |
1,524,006 | 1,524,007 | Present iPhone application to the Board | <p>We have a new app for the iPhone which is to be presented to the Board. I am asking if anyone has any ideas for the most effective way to present using the actual device.</p>
<p>In reality the device is the most impractical platform to present with to a large room, but in this case it will be required. So if S.Jobs can manage it there must be an easy solution for this type of thing.</p>
<p>Is RDP the only way or is there something better?</p>
<p>Have you done this type of thing and can offer some advise?</p>
| iphone | [8] |
1,200,774 | 1,200,775 | Using Jquery to get a shortened URL established through .htaccess | <p>here is my script:</p>
<pre><code>popstate = function(url){
url = '/ajaxlinks/ajaxlink'+window.location.pathname.substr(1);
if (url == '/ajaxlinks/ajaxlink'){url = '/ajaxlinks/ajaxlinkprofile.php'}
$('#ajaxloadcontent').load(url);
$('html, body').animate({scrollTop:0}, 'medium');
}
</code></pre>
<p>The problem that I am facing is this. Lets say that the url to an account on my site is "http://www.pearlsquirrel.com/eggo." I can get the above function to work for other urls, but because this is not a direct link, and one that I have set in .htaccess, I need "if (url == '/ajaxlinks/ajaxlink')" to somehow tell me if there is anything after the slash in "http://www.pearlsquirrel.com/" and if there is then set the variable url == to /ajaxlinks/ajaxlinkprofile.php. I have no idea how to do this and hope that someone can help, thanks!</p>
| jquery | [5] |
98,065 | 98,066 | can we inherit more then on class in asp.net aspx page? | <p>I want to inherit more then one class is there any method ?</p>
<p>For instance in login.aspx page:</p>
<pre><code><%@ page language="c#" codefile="nishant.aspx.cs" autowireup="true" inherit="nishant"%>
</code></pre>
<p>now code behind file</p>
<p>nishant.aspx.cs:</p>
<pre><code>class nishant
{
//code...
}
class bill
{
//code.....
}
</code></pre>
<p>now i want to inherit bill class then how i will ?</p>
| asp.net | [9] |
5,398,962 | 5,398,963 | jquery:how to get the id of anchor tag | <p>I have 2 anchor tags</p>
<pre><code><li><a id="tab1" href="#tabs-1">Issue</a></li>
<li><a id="tab2" href="#tabs-2">Change Request</a></li>
</code></pre>
<p>I have the following jquery:</p>
<pre><code>$('a').click(function(event) {
alert($('a').attr("id"));
});
</code></pre>
<p>What happens:
I always get "tab1" in the pop up</p>
<p>What I need:
when user clicks on an anchor tag, its id needs to be displayed in the pop up</p>
| jquery | [5] |
5,692,693 | 5,692,694 | Getting information from a user-provided account list into an array in Javascript | <p>Users will paste an account list in this format, with a username, a colon, and a password on each line.</p>
<pre><code> username1:password1
username2:password2
username3:password3
username4:password4
</code></pre>
<p>What is the <strong>best</strong> way to separate each line and then each part in Javascript? I'd really like it to be as simple as accounts[1].username or accounts[3].password to retrieve data. Thanks!</p>
| javascript | [3] |
649,220 | 649,221 | How can I get "Use packet data" Settings in ICS Android | <p>I am developing an application which does some downloading depends on whether the
user has enabled the option in Settings-> Wireless and network-> Mobile networks -> Use packet data.
I need to check the user has enabled this options.</p>
<p>Please help me to find out how can i get this settings.</p>
<p>For eg to check the roaming mode I use.,</p>
<pre><code>import android.provider.Settings.Secure;
String android_id = Secure.getString(getContentResolver(),
Secure.DATA_ROAMING);
</code></pre>
<p>Thanks in advance
Deepu</p>
| android | [4] |
3,853,000 | 3,853,001 | Increase download in google play | <p>I want to optimize and increase the downloads of my created app. I recently discovered admob. But is it free? If not any other free alternatives? And can i use mobile advertising app with only one application submitted? Cause right now i have only one application published in google play. I saw appbrain sdk, but i think you must have more than one application created to promote your app cause it uses an sdk(meaning you will have to add something in your code). <a href="https://developers.appbrain.com/info/sdk" rel="nofollow">Here</a> is the link. Thank you</p>
| android | [4] |
1,164,279 | 1,164,280 | Get the android:tabs view | <p>Is there a way of getting the android:tabs view of the current TabActivity? I tried using the findViewById(int) method but it's no use.</p>
<p>Best Regards!</p>
| android | [4] |
5,623,119 | 5,623,120 | Testing if Cocoa object references are valid? | <p>I'm doing some lazy image loading for thumbnails to be displayed in a table. I have a class that loads the image for me asynchronously...but my problem (or at least, a problem) is that by the time the image loads, I have no idea whether the cell that initiated the image load even exists anymore. Is there a way for me to test to see if a particular object reference is valid before I call it?</p>
<p>Thanks.</p>
| iphone | [8] |
4,195,366 | 4,195,367 | Where to store GPS data on Android | <p>HI</p>
<p>I write app that hold route information (array of GeoPoint ) for every race.</p>
<p>At the end of each race I want to save information about race. They may have 100-200 GeoPoints (70.22222, -20 33333), each race.</p>
<p>Example for one race:</p>
<p>70.22212, -20 33253
70.25222, -20 33463
70.26232, -20 33573
70.27242, -20 33683
.
.</p>
<p>Now I store this information in this array</p>
<pre><code>List<GeoPoint> race = new ArrayList<GeoPoint>();
</code></pre>
<p>Where to save information for every race in Android (Database, internal XML ....)?</p>
<p>Thanks</p>
| android | [4] |
2,969,755 | 2,969,756 | More efficient way to get all indexes of a character in a string | <p>Instead of looping through each character to see if it's the one you want then adding the index your on to a list like so:</p>
<pre><code> var foundIndexes = new List<int>();
for (int i = 0; i < myStr.Length; i++)
{
if (myStr[i] == 'a')
foundIndexes.Add(i);
}
</code></pre>
| c# | [0] |
1,416,190 | 1,416,191 | Difference between window.location and href? | <p>What's the difference between this word and action?</p>
<pre><code><script>
window.location.href = 'index.php';
window.location = 'index.php';
</script>
</code></pre>
<p>because some instances that after clicking the button there is a milisecs thats see the way of changing the page..what is that? </p>
| javascript | [3] |
1,096,185 | 1,096,186 | Variable not found. Referencing objects from another class | <p>Background:</p>
<p>I'm creating a basic download centre on a concurrent server.</p>
<p>I create file objects in the <code>Server class</code> under a main method</p>
<pre><code>File[] files = {
new File("1. Program", "myProgram.jar"),
new File("2. Image", "myPicture.jpg"),
new File("3. Book", "myBook.txt")};
</code></pre>
<p>This references to the <code>File class</code> where I create constructors and getters.</p>
<pre><code>class File {
private String option;
private String fileName;
public File(String option, String fileName) {
this.option = option;
this.fileName= fileName;
}
public String getOption() {
return option;
}
public String getFileName() {
return fileName;
}
public void getFileOptions(File[] files) {
for (File f : files) {
System.out.printf("The option is %s\n", f.getOption());
}
}
}
</code></pre>
<p>I am attempting to call the <code>getFileOptions</code> method from my <code>ServerState class</code>. </p>
<pre><code>theOutput= File.getFileOptions(files);
</code></pre>
<p>The output is a string that is returned to a client.</p>
<p>My IDE says that <code>(files)</code> cannot be found. Any ideas where I'm going wrong? Cam I not return results to a class where the object wasn't initially created? </p>
| java | [1] |
4,058,700 | 4,058,701 | Is there a way to control execution of scripts loaded via JasonP? | <p>I recently ran into a few problems with a third party vendor integration. In order to get a piece of data from them I had to do a cross-domain request, which we implemented using Jason (via jQuery.getScript()). </p>
<p>My concern is that this is equivalent to throwing a script tag with the URL as the source and I have no chance to wrap a try/catch block around the incoming javasript. This seems pretty dangerous, basically we've gone from having a pretty strict same origin policy (with Ajax) to having a free for all load any script from any domain without any control mechanism. </p>
<p>Any way to make this more safe/robust? The issue I had is that my vendor had syntax errors in their script every once in a while, which screwed up the javascript already running on the site. They eventually fixed everything, but I'd like to know if there's a more robust mechanism for doing this.</p>
| javascript | [3] |
4,066,036 | 4,066,037 | How can i create Graph in android aplication? | <p>How to Create <strong>3d Graph(Like pie,line,scatter)</strong> in android Application?</p>
| android | [4] |
4,181,364 | 4,181,365 | Jquery , load() does not work when specific button is clicked | <p>Hello there is my problem:</p>
<p>I do a chat and I want message to be added in database after clicking a button.</p>
<p>Heres a code:</p>
<pre><code> $('button[id="czat_pisz"]').bind('click',function() {
alert("Passes");
$('#hidden').load("czat_pisanie.php?type=" + chat_type + "?message=" + text + "?nick=" + gracz_nick);
});
</code></pre>
<p>The alert is just for check. It is showing when I click a button. But the load() does not work. It works when I put it out from click function.</p>
<p>How to fix it?</p>
| jquery | [5] |
4,042,429 | 4,042,430 | How to delete all content of input.txt file after instance.save()? | <pre><code>text = "sample sample"
text_file = open("input.txt", "r+b")
text_file.write(text)
instance.src_after = File(text_file)
instance.save()
text_file.close()
</code></pre>
<p>How to delete all content of <code>input.txt</code> file after <code>instance.save()</code> ?</p>
| python | [7] |
3,869,184 | 3,869,185 | C# fieldinfo from a field? | <p>Is there anyway to get a <code>FieldInfo</code> from a field without using something like a <code>string</code> with the name? Like:</p>
<pre><code>class AClass
{
String AField;
}
GetFieldInfo(GetHandle(AField));
</code></pre>
| c# | [0] |
4,218,672 | 4,218,673 | How can I update some jQuery from a text input elsewhere on the page? | <p>I am working on little project to learn jQuery, and I have a twitter plugin which you enter a username to see the tweets of that user. Elsewhere on the site I have a simple text input field which I'm hoping can take an entry and append it to where the username is in the existing code... Is this possible? Maybe using the append string, or .text?</p>
<p>Where you can see rjames83, that's what I'd like to replace with the contents of a text field.</p>
<pre><code>$(document).ready(function(){
// Get latest 6 tweets by jQueryHowto
$.jTwitter('rjames83', 6, function(data){
$('#posts').empty();
$.each(data, function(i, post){
$('#posts').append(
'<div class="post">'
+' <div class="txt">'
// See output-demo.js file for details
+ post.text
+' </div>'
+'</div>'
);
});
});
</code></pre>
<p>});</p>
| jquery | [5] |
1,433,923 | 1,433,924 | 13 Character Timestamp | <p>I'm trying to create a 13 character timestamp within my application but after searching online I am at a loss.</p>
<p>Are these 13 character timestamps special types of timestamps? And how can one generate them?</p>
<p>Here is an example timestamp: 1330650156663</p>
| c# | [0] |
1,597,032 | 1,597,033 | No matching function call to class member | <p>I have implemented a generic list and I am trying to retrieve the data from a certain position in the list. umm... but I am getting an error: no matching function for call to 'List::retrieve(int&, Record&)'
Below is the code of main.cpp and a snippet of function retrieve from List.h.#include </p>
<p><strong>Main.cpp</strong></p>
<pre><code>#include <iostream>
#include "List.h"
#include "Key.h"
using namespace std;
typedef Key Record;
int main()
{
int n;
int p=3;
List<int> the_list;
Record data;
cout<<"Enter the number of records to be stored. "<<endl;
cin>>n;
for(int i=0;i<n;i=i++)
{
the_list.insert(i,i);
}
cout<<the_list.size();
the_list.retrieve(p, data);
cout<<"Record value: "<<data;
return 0;
}
</code></pre>
<p><strong>List.h</strong></p>
<pre><code>Error_code retrieve(int position, List_entry &x)const
{
if(empty()) return underflow;
if(position<0 || position>count) return range_error;
x=entry[position];
return success;
}
</code></pre>
<p>For full code:</p>
<p>Main.cpp: <a href="http://pastebin.com/UrBPzPvi" rel="nofollow">http://pastebin.com/UrBPzPvi</a></p>
<p>List.h: <a href="http://pastebin.com/7tcbSuQu" rel="nofollow">http://pastebin.com/7tcbSuQu</a></p>
<p>P.S I am just learning the basics and the code may not be perfect with regards to large scale reusable module. At this stage, it just needs to work.</p>
<p>Thanks</p>
| c++ | [6] |
1,035,439 | 1,035,440 | AndroidHttpClient. How do I set KeepAlive strategy? | <p>What would be syntax to do that. It's not DefaultHttpClient, it's AndroidHttpClient.</p>
<p>I noticed some exceptions with broken pipes and I want to set connections to keep alive for 10-20 seconds.</p>
| android | [4] |
1,443,904 | 1,443,905 | What is the exact difference between require() and require_once() in php? | <p>Exact difference between require() and require_once() in php?</p>
| php | [2] |
3,257,903 | 3,257,904 | C# quick question regarding "this" keyword? | <p>Is this piece of code correct:</p>
<pre><code>using (MyForm form = new MyForm { TopMost = TopMost})
{
}
</code></pre>
<p>I want to make the new Form TopMost, if the parent Form is TopMost, or should I write like this, I mean the new Form TopMost property is not self assigned to itself.</p>
<pre><code>using (MyForm form = new MyForm { TopMost = this.TopMost})
{
}
</code></pre>
| c# | [0] |
1,187,032 | 1,187,033 | Fastest way to check if a JS variable starts with a number | <p>I am using an object as a hash table and I have stuffed both regular properties and integers as keys into it. </p>
<p>I am now interested in counting the number of keys in this object which are numbers, though obviously a <code>for (x in obj) { if (typeof x === "number") { ... } }</code> will not produce the result I want because all keys are strings. </p>
<p>Therefore I determined that it is sufficient for my purposes to assume that if a key's first character is a number then it must be a number so I am not concerned if key "3a" is "wrongly" determined to be a number. </p>
<p>Given this relaxation I think i can just check it like this </p>
<pre><code>for (x in obj) {
var charCode = x.charCodeAt(0);
if (charCode < 58 && charCode > 47) { // ascii digits check
...
}
}
</code></pre>
<p>thereby avoiding a regex and <code>parseInt</code> and such. </p>
<p>Will this work? <code>charCodeAt</code> is JS 1.2 so this should be bullet-proof, yes?</p>
<p>Hint: I would love to see a jsperf comparing my function with what everyone comes up with. :) I'd do it myself but jsperf confuses me </p>
<p>Update: Thanks for starting up the JSPerf, it confirms my hope that the <code>charCodeAt</code> function would be executing a very quick piece of code reading out the int value of a character. The other approaches involve parsing. </p>
| javascript | [3] |
697,865 | 697,866 | Regex to extract a string between two delimeters WITHOUT also returning the delimeters? | <p>I want to just extract the text between the brackets -- NOT the brackets, too!</p>
<p>My code looks currently like this:</p>
<pre><code>var source = "Harley, J. Jesse Dead Game (2009) [Guard]"
// Extract role with regex
m = Regex.Match(source, @"\[(.*)\]");
var role = m.Groups[0].Value;
// role is now "[Guard]"
role = role.Substring(1, role.Length-2);
// role is now "Guard"
</code></pre>
<p>Can you help me to simplify this to just a single regex, instead of the regex, then the substring? </p>
| c# | [0] |
1,661,378 | 1,661,379 | how do you use the objects from a class if you change it to an abstract class and extend it in another class? | <p>I want to turn a class I made into an abstract class and get another class to extend it. This is because the class (particle) is leaning heavily on the class I want to make abstract (vector). </p>
<p>I am not sure how I will use all those objects I instantiated with the new keyword or if it will totally mess things up. I am willing to try it to learn something about using the abstract classes in my own example but if anyone can help me understand what I am doing that would be great! </p>
| java | [1] |
2,625,409 | 2,625,410 | ho to upload multiple images in dot net | <p>the conventional file uploader allows a single image to uplaod
i want to select multiple images when i click the "BROWSE" button</p>
<p>how is it possible???</p>
| c# | [0] |
570,614 | 570,615 | Not able to get UIImage object using imageNamed method | <p>I want to get image from IImage object from specified path location.Here is the code .</p>
<pre><code> NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *writablePath = [documentsDirectory stringByAppendingPathComponent:@"image1.png"];
NSLog(writablePath);
UIImage *image=[UIImage imageNamed:writablePath];
</code></pre>
<p>I get image object nil. so what could be the problem?
I have also varified that image1.png is there at writablePath.</p>
| iphone | [8] |
3,165,327 | 3,165,328 | creating a jquery plugin that does not break the chain | <p>I wrote this function to save headaches when I move CSS around(it converts CSS strings to objects). I would like to be able to use it as a drop in for the <code>.css()</code> function. </p>
<pre><code>jQuery.fn.cCSS = function(css) {
return this.each(function(){
var css_obj = {};
var tmx = "";
ocss = css.split(";");
$.each(ocss, function (index, elem){
tmx = elem.trim().split(':');
if (tmx[0].length > 0)
css_obj[tmx[0]] = tmx[1].trim();
});
return $(this).css(css_obj);
//return $;
});
};
})(jQuery);
</code></pre>
<p>My problem is when I use it in "fluent" notation I always get a null error.</p>
<p>Uncaught TypeError: Cannot call method 'addClass' of null</p>
<p>I'm a bit confused what has to be returned in order not to "break the chain"</p>
| jquery | [5] |
4,528,128 | 4,528,129 | Recycle bin in mobile | <p>I'm planning to make a trash which is indeed an application on Android phones, like we have recycle bin in Windows or trash in Linux. But this would be an application for Android phones. Anyone having idea regarding the same. This would help to restore back your text messages, videos, images, etc which has been deleted accidently. </p>
| android | [4] |
5,785,222 | 5,785,223 | global data, static and new | <p>Basic question from somebody coming from structured into object programming... hoping not to be too basic.</p>
<p>I want to have a large array of data that is been shared by different classes inside my application.
What's the best practice to do this?
Is this correct?</p>
<pre><code>public class LargeData {
private static long[] myData;
private static final int MAX = 100000;
public LargeData() {
myData = new long[MAX];
// ... initialize
}
public long getData(int x) {
// ... do whatever and return a long
}
}
</code></pre>
<p>And if this is correct, how is the correct way to access this data from any of my classes? Should I make a</p>
<pre><code>LargeData ld = new LargeData();
</code></pre>
<p>inside every single class that wants to access to myData?</p>
<p>Thank you and sorry for being too easy... :)</p>
| java | [1] |
5,460,020 | 5,460,021 | HashMap v/s Database . Which one is better? | <p>I want to store track_id and playlist name to display playlist name . So please help me what should i use ?</p>
<p>HashMap or database ?</p>
| android | [4] |
3,676,573 | 3,676,574 | PHP - Checking for return false; | <p>Just a quick question - and I'm sure really basic!</p>
<p>I have the following code:</p>
<pre><code>function checkThings($foo, $bar) {
...
if ($valid) {
return $results;
} else {
return false;
}
}
</code></pre>
<p>On the other end of this I am currently doing</p>
<pre><code>$check = checkThings($foo, $bar);
if ($check === false) {
echo "Error";
} else {
echo $check;
}
</code></pre>
<p>Is writing the following the same?</p>
<pre><code>$check = checkThings($foo, $bar);
if (!$check) {
echo "Error";
} else {
echo $check;
}
</code></pre>
<p>Which method is the preferred method if both are correct?</p>
<p>Thanks :)</p>
| php | [2] |
5,619,836 | 5,619,837 | use jquery to animate lines of text | <p>I have a paragragh of text.</p>
<pre><code><p>
line1
line2
line3
</p>
</code></pre>
<p>intially all the text are red
when a button is pressed
each line's color changes to black gradually (2 sec each line)</p>
<p>can this be done with only jquery?</p>
| jquery | [5] |
3,300,112 | 3,300,113 | I have got this warning: non-varargs call of varargs method with inexact argument type for last parameter; | <p>this is my sample code where i am getting the warning.</p>
<pre><code> try
{
Class aClass = Class.forName(impl);
Method method = aClass.getMethod("getInstance", null);
item = (PreferenceItem) method.invoke(null, null);
}
</code></pre>
<p>warning: non-varargs call of varargs method with inexact argument type for last parameter;
cast to java.lang.Class for a varargs call
cast to java.lang.Class[] for a non-varargs call and to suppress this warning
Method method = aClass.getMethod("getInstance", null);</p>
<p>please help me to solve this problem</p>
| java | [1] |
5,385,891 | 5,385,892 | Display Ads To % of Users | <p>I have a site that I want to display ads to 10% of my traffic. I am getting on average around 30,000 hits a day and want 10% of those users to see an ad from one of my advertisers.</p>
<p>What's the best way to go about implementing this?</p>
<p>I was thinking about counting the visitors in a database, and then every 10 people that visit 1 user gets an ad. Or is there a better way of going about it?</p>
<p>I'm no good with math, so I'm not sure what's the best approach.</p>
| php | [2] |
5,063,048 | 5,063,049 | Adding List Array item In A Data Table Using Loop Results Error .. | <p>I am trying to put the list array(res) item in to the Data Table(_Hdt) using for Loop
I have put the values in "res" list erray using loop...but this loop results in an error: "variable use asd a method ?"</p>
<p>Here _Hdt and dt are data table and res is list array,</p>
<pre><code>for (int r = 0; r < _Hdt.Rows.Count; r++)
{
foreach (DataRow row in dt.Select("DATE='" + _Hdt.Rows[r]["DATE"].ToString().Trim() + "'"))
{
DateTime date = Convert.ToDateTime(_Hdt.Rows[r]["DATE"].ToString().Trim());
string dateformat = String.Format("{0:dddd MMM d}", date);
_Hdt.Rows[r]["DATE"] = dateformat;
_Hdt.Rows[r]["MTU"] = row["MTU"].ToString().Trim();
_Hdt.Rows[r]["POWER"] = (Convert.ToDecimal(row["POWER"].ToString().Trim()) /
1000).ToString();
_Hdt.Rows[r]["COST"] = row["COST"].ToString().Trim();
_Hdt.Rows[r]["VOLTAGE"] = row["VOLTAGE"].ToString().Trim();
_Hdt.Rows[r]["KW"] = res(r);
}
}
</code></pre>
| c# | [0] |
2,012,257 | 2,012,258 | difference between true and false in javascript eventlistener | <p>i have a doubt in eventlistener concept.What is the difference between bellow two codes
i have doubt in the true/false section.no change happens when i replace the 1st code with the second code in my practice code.</p>
<pre><code>a.addEventListener("click", modifyText, true);
a.addEventListener("click", modifyText, false);
</code></pre>
| javascript | [3] |
3,738,109 | 3,738,110 | PHP Preg_replace for all instance of specific text? | <p>I have the following text and want to replace all instace which begin and end with ##, how can i prepare regular expression for preg_replace php.
Example</p>
<blockquote>
<p>We are encountering a problem ##anytext## and will update you soon
regarding this problem ##textsomethingelse##</p>
</blockquote>
<p>My question how can i replace all instance of ##anytext## with specific text?</p>
| php | [2] |
5,339,263 | 5,339,264 | Android Dev: AlarmManager Reschedule and Service | <p>please refer to
<a href="http://stackoverflow.com/questions/9935573/android-dev-timertask-and-phone-sleep-weirdness-maybe">this</a> for the issue i was facing....as suggested by the person who replied to my problem + what my additional research showed is that i need to use AlarmManager to solve my sleep & timertask issue...since, i have started changing the existing code to utilize PendingIntent along with AlarmManager with: <code>Thread thr = new Thread(null, mTask, "ServiceName");</code> in the service...</p>
<p>after reading the AlarmManager documentation several times, i dont know how to reschedule a AlarmManager... im working on a Profile Switcher application, which will various run intervals (like i described in my problem thread)...</p>
<p>Does anyone have any suggestion?</p>
| android | [4] |
343,145 | 343,146 | ASP.NET MVC, _ViewStart.cshtml content | <p>In my ASP.NET MVC application, in my <strong>_ViewStart.cshtml</strong> file, I have code like the following -</p>
<pre><code><div>SHOW THIS</div>
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
</code></pre>
<p>When the page is rendered, I expect "SHOW THIS" to be displayed <em>above</em> the content in the _Layout.cshtml page, but instead "SHOW THIS" is appearing <em>below</em> the the content in the _Layout.cshtml page. </p>
<p>Is this correct? If not, any idea why this would happen? Can you suggest how to make it show above the _Layout.cshtml content?
Thanks!</p>
| asp.net | [9] |
3,197,330 | 3,197,331 | How would I do a callback on this? | <p>I've been watching some documentation, and I'm still confused.</p>
<p>I want to do a callback function on this:</p>
<pre><code>$('.scroll-pane').jScrollPane();
</code></pre>
<p>Now the documentation shows this example</p>
<pre><code>function fn1( value ){
console.log( value );
}
</code></pre>
<p>How come the semicolon is at the end in my first example, and in the second the semicolon only seems to be at the end of another callback function as far as I can tell?</p>
<p>Thanks everyone :)</p>
| jquery | [5] |
2,952,729 | 2,952,730 | Have you ever hit an actual limit of php in web dev? | <p>Aside from scalability issues, has anyone here actually stumbled upon a web-development problem where PHP just didn't cut it and had to go for another language / platform?</p>
<p>I am interested in particular scenarios and the ways they have been handled.</p>
<p>Thanks.</p>
| php | [2] |
365,804 | 365,805 | jquery effects unit test, trying to accomplish what? | <p>Reading jQuery 1.8 <a href="https://github.com/jquery/jquery/blob/master/test/unit/effects.js" rel="nofollow">test/unit/effects.js</a> test, what is it trying to test here? </p>
<pre><code> var speeds = {
'null speed' : null,
'undefined speed': undefined,
'false speed': false
}
// make sure passing bogus arguments doesn't change state var ?
jQuery.each( speeds,
function( name, speed ) {
pass = true;
div.hide()
.show(speed)
.each( function() {
if( this.style.display == 'none' ) {
pass = false;
}
});
ok( pass, 'Show with ' + name );
});
</code></pre>
| jquery | [5] |
1,951,336 | 1,951,337 | java.lang.OutOfMemoryError | <p>how to solve this issue.... any alternative or how to increase memory??</p>
<pre><code>12-03 15:24:21.302: ERROR/AndroidRuntime(423): java.lang.OutOfMemoryError
12-03 15:24:21.302: ERROR/AndroidRuntime(423): at java.lang.String.<init>(String.java:468)
12-03 15:24:21.302: ERROR/AndroidRuntime(423): at java.lang.AbstractStringBuilder.toString(AbstractStringBuilder.java:659)
12-03 15:24:21.302: ERROR/AndroidRuntime(423): at java.lang.StringBuffer.toString(StringBuffer.java:720)
12-03 15:24:21.302: ERROR/AndroidRuntime(423): at com.example.my.Map.stringtoArray(Map.java:270)
</code></pre>
| android | [4] |
4,226,915 | 4,226,916 | How curruent location latitude longitude periodically update | <p></p>
<p>I am new to android. I want to send latitude longitude to web service which is periodically update at time interval of 15 minute. Even if my device is in spleep mode.Even if my application is not active. Even if phone is not moving for long period.Even if user is moving fast. Thanks in advance.
</p>
| android | [4] |
2,663,738 | 2,663,739 | implement SVN revision number with my ASP.NET web site dynamically | <pre><code>I want to use automatic versioning with my .NET Web Site/Application
svn:4567
how can i implement this?
</code></pre>
<p><strong>implement SVN revision number with my ASP.NET web site dynamically</strong></p>
| asp.net | [9] |
4,219,135 | 4,219,136 | B-Tree- method inorder(TreeNode<E> root) | <p>I don't understand this method.</p>
<pre><code> protected void inorder(TreeNode<E> root) {
if (root == null) return;
inorder(root.left);
System.out.print(root.element + " ");
inorder(root.right);
}
</code></pre>
<p>When <code>current node</code> comes to last node in the tree and current.left become null, what then happened? <code>current node</code> returns where? When that node is going to print?</p>
| java | [1] |
5,813,251 | 5,813,252 | Use asyncTask to load images | <p>i m loading images from rss description using</p>
<pre><code>String description2 = des.get(position).toString();
Spanned description = Html.fromHtml(description2, new ImageGetter() {
@Override
public Drawable getDrawable(String source) {
Drawable d = null;
try {
InputStream src = imageFetch(source);
d = Drawable.createFromStream(src, "src");
if(d != null){
d.setBounds(0,0,d.getIntrinsicWidth(),
d.getIntrinsicHeight());
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return d;
}
public InputStream imageFetch(String source)
throws MalformedURLException,IOException {
URL url = new URL(source);
Object o = url.getContent();
InputStream content = (InputStream)o;
// add delay here (see comment at the end)
return content;
}
},null);
</code></pre>
<p>How can i put them into an AsyncTask,in order to get a progress bar until the images download? Thanks!</p>
| android | [4] |
1,394,174 | 1,394,175 | How do I layout list items to behave like a table rows? | <p>I do not want to use <code>TableLayout</code> because my data model and UI perfectly fit into <code>ListView</code>. But I need to have fields in list items to organize in columns through hole <code>ListView</code>. I want to use two-line list item model with about 4-5 columns in a second line. I do know how to make custom layouts and custom array adapters for <code>ListView</code>. The question is about positioning <code>TextView</code>'s in a list item custom layout so that they become nicely aligned. Surely I can not use absolute widths because there are so many screen sizes, but I can not think of any other option.</p>
| android | [4] |
4,746,066 | 4,746,067 | php session_destroy browser remembering username and password | <p>I am using the php authentication method for digest authentication as shown on the <a href="http://php.net/manual/en/features.http-auth.php" rel="nofollow">php manual</a>. All is working well except for the logout part.</p>
<p>I am using <code>session_destroy()</code> to try and log my users out, which it does. However my problem is if the user goes to log back in before closing the browser out they are not prompted for a username and password and they are automatically logged back in with the last username and password they entered.</p>
<p>It seems the credentials are somehow being remembered by the browser. In Firefox if I manually clear "active logins" in the "clear browsing history" before trying to log back in then I am prompted for the username and password even though the user has been logged out with <code>session_destroy()</code>.</p>
<p>I am also using <a href="http://php.net/manual/en/function.session-destroy.php" rel="nofollow">an example from the php manual</a> to clear the cookie but that doesn't seem to help, it doesn't seem to be a cookie problem.</p>
<p>Here is my logout.php code</p>
<pre><code><?php
session_start();
$_SESSION = array();
//destroy cookie if it exists
if (ini_get("session.use_cookies")) {
$params = session_get_cookie_params();
setcookie(session_name(), '', time() - 42000,
$params["path"], $params["domain"],
$params["secure"], $params["httponly"]
);
}
//destroy session
session_destroy();
header("location:form.php");
exit();
?>
</code></pre>
<p>What am I missing? Thanks for any help!</p>
| php | [2] |
1,117,910 | 1,117,911 | How does PHP know what the last database connection is when mysql_select_db() or mysql_query() is used without the optional database parameter? | <p>Consider the following code:</p>
<pre><code><?php
$conn = mysql_connect('localhost', 'username', 'password');
mysql_select_db('database', $conn);
?>
</code></pre>
<p>This works as expected, but how does PHP know what database connection to use when calling <code>mysql_select_db()</code> in the following example?</p>
<pre><code><?php
mysql_connect('localhost', 'username', 'password');
mysql_select_db('database');
?>
</code></pre>
<p>The PHP documentation states that "If the link identifier is not specified, the last link opened by mysql_connect() is assumed." (<a href="http://us3.php.net/manual/en/function.mysql-select-db.php" rel="nofollow">PHP: mysql_select_db()</a>)</p>
<p>Where is the last connection stored or retrieved from?</p>
| php | [2] |
3,243,402 | 3,243,403 | Can't Install Android Packages: Failed to Fetch due to Connection | <p>I'm getting a problem installing Android packages. I installed it initially with no problems. But decided to switch paths and install it else where.</p>
<p>Now I get the error:</p>
<p>Fetching URL: <a href="https://dl-ssl.google.com/android/repository/repository-6.xml" rel="nofollow">https://dl-ssl.google.com/android/repository/repository-6.xml</a>
Failed to fetch URL <a href="https://dl-ssl.google.com/android/repository/repository-6.xml" rel="nofollow">https://dl-ssl.google.com/android/repository/repository-6.xml</a>, reason: Connection to <a href="http://127.0.0.1:8520" rel="nofollow">http://127.0.0.1:8520</a> refused
Done loading packages.</p>
<p>On running in Windows 7 Ultimate, installed android-sdk_r18-windows to C:\Android
I tried https and http. both don't work.</p>
<p>Thanks</p>
| android | [4] |
2,599,892 | 2,599,893 | how to evaluate and work out(5.0+8.1)*(2.0) in my java program? | <p>I'm creating an arithmetic calculator and need to be able to have it answer a question like (5.0+8.1)x(2.0) so far i have create my subclasses according to each mathematical operation i.e. +,-,x,/.
I have got it to work for 2 numbers like 2.0 + 5.0 but i do not understand how i can get it to work for the above expression.</p>
<pre><code>class Addition extends ArithmeticExpression{
Addition(double value1, double value2){
result = value1 + value2;
this.value1 = value1;
this.value2 = value2;
}
public double display() {
System.out.println("Addition Question Is");
System.out.println(value1 + " + "+ value2);
return result;
}
public double evaluate(){
System.out.println("Addition Answer Is");
System.out.println(result);
return result;
}
}
</code></pre>
| java | [1] |
2,142,239 | 2,142,240 | Basic if..elseif...else question in PHP | <p>Sorry, just a very basic question on conditionals in PHP</p>
<pre><code>If {}
elseif {}
else {}
</code></pre>
<p>If the <code>if</code> condition comes out to be true, will PHP still evaluate the <code>elseif</code> to see if that is true as well?</p>
| php | [2] |
2,187,414 | 2,187,415 | duplicate canvas in a smaller size | <p>For some reason my android game is drawing two images when i only stated for one to be drawn.</p>
| java | [1] |
823,092 | 823,093 | String formatting for a number | <p>I have the following number:</p>
<pre><code>0006.5400
0000.5400
0000.0000
</code></pre>
<p>How would I get strip all leading zero's on the left, except if the first digit is a zero. Is there a 'limit' on <code>lstrip()</code>?</p>
<p>I was able to fix this at the database level, but curious anyways.</p>
| python | [7] |
5,287,206 | 5,287,207 | What are the essential Java packages of Android Application Framework? | <p>This mostly theoretical question regarding Android and Java. I want to know which Java packages are used by Android Application Framework? I could guess maybe most of them. But I want to know those essential packages used by application framework in particular. Thanks! </p>
| android | [4] |
3,136,665 | 3,136,666 | Printing multiple pages on Button Click in ASP.net | <p>In our web application we have multiple web pages. Contacts module is One of the widely used module. The entire module consists of 3 pages. </p>
<p>The First page displays the Contact details with several Server controls, the second page is contact history with all the history about the contact and 3rd page again some more details of the contact.</p>
<p>Is there any way when a user hits one button on any of these pages, it prints all the 3 pages. With the content for this contact. Please note these are not static pages. The contact details are displayed based on the data in our Oracle DB.</p>
| asp.net | [9] |
1,726,798 | 1,726,799 | jQuery - order DIVs depending on an extracted number of a classname | <p>I have a list of DIVs, like this :</p>
<pre><code><div id="list">
<div class="classA classB SORT-4.2"><div>4</div></div>
<div class="classA SORT-3.3"><div>3</div></div>
<div class="classC classD classE SORT-5.1"><div>5</div></div>
<div class="classB classC SORT-1.5"><div>1</div></div>
<div class="classA class B class C SORT-2.4"><div>2</div></div>
</div>
</code></pre>
<p>and I want to sort them, using jQuery</p>
<p>Server-side, I can define the wanted order, and include this order in the class names :</p>
<p>SORT-<strong>4.2</strong></p>
<p>I want to be able to call either the first order (in my example this DIV will be in the 4th position), or the second order (it will be in the 2nd position) : that explains the "4.2"</p>
<p>So if I call <code>OrderDIV(1)</code> I will have this :</p>
<pre><code>1
2
3
4
5
</code></pre>
<p>and if I call <code>OrderDIV(2)</code> I will have this :</p>
<pre><code>5
4
3
2
1
</code></pre>
<p>(I will need to add more orders, like : SORT-4.2.5.6.2)</p>
<p>As you can see DIVs can have multiple classes, only the pattern <code>SORT-</code> defines the class used to sort</p>
<p>Thank you VERY MUCH for your help!</p>
| jquery | [5] |
2,763,032 | 2,763,033 | What's the difference between double quotes and single quote in C# | <p>What's the difference between double quotes and single quote in C#?</p>
<p>I coded a program to count how many words are in a file</p>
<pre><code>using System;
using System.IO;
namespace Consoleapp05
{
class Program
{
public static void Main(string[] args)
{
StreamReader sr = new StreamReader(@"C:\words.txt");
string text = sr.ReadToEnd();
int howmany = 0;
int howmany2 = 0;
for(int i = 0; i < text.Length; i++)
{
if(text[i] == " ")
{
howmany++;
}
}
howmany2 = howmany + 1;
Console.WriteLine("It is {0} words in the file", howmany2);
Console.ReadKey(true);
}
}
}
</code></pre>
<p>This gives me an error because of the double quotes. My teacher told me to use single quote instead, but he didn't tell me why. So what's the difference between double quotes and single quote in C#?</p>
| c# | [0] |
1,720,880 | 1,720,881 | unable to load mod_jk module in windows 2008 standard x64bit edition | <p>I was trying to run Apache 2.2 in my windows 2008 standard x64 bit machine and I observed that the mod_jk module is not loading and there is no error as well.</p>
<p>I have tried the same module in windows 2008 Enterprise x64 bit version and the same module worked perfectly fine.</p>
<p>Note: This is the second time I am observing this issue in a windows 2008 standard x64 bit environment and not sure if it is an issue with standard version or not.</p>
| c++ | [6] |
1,632,277 | 1,632,278 | Which STL object or memory management to be used for dynamic entities | <p>I am developing applications for large scale computing and have some specific questions regarding the choice of STL objects and/or better memory management techniques to minimize compute resources.</p>
<p>Specifically, my question is the following: I am currently using a STL vector obj to store data from a file which looks like this:</p>
<pre><code>x x x x 0 0 0; x x x 0 0 0 0; x x x x x x x;.........
</code></pre>
<p>I want to make this into:</p>
<pre><code>x x x x; x x x; x x x x x x x;............
</code></pre>
<p>Is there a memory effective and fast way to do this (want to use least amount of memory possible)? Can I make inplace changes? The size of data (including zeros) between each colon in the file is constant.</p>
| c++ | [6] |
2,284,500 | 2,284,501 | How to detect a link click with custom attributes with jQuery? | <p>I have some links like this:</p>
<pre><code><a href="#" track="yes">My Link</a>
</code></pre>
<p>How can I detect when a link with the <strong>track</strong> attribute is clicked ?</p>
<p>Thanks!</p>
| jquery | [5] |
4,143,401 | 4,143,402 | Change text property of all items in form | <p>I have many buttons and labels on my c# form. I have a button that changes all butons' and labels' text properties (change language button). Do i have to write all items in click event of button or is there a method that scans all form control items and change their text properties.</p>
<p>There are many other controls that contains labels or buttons. For example a label is added to the control of a panel and when i iterate form controls, i can't reach this label. I want to change all items' text properties at one time.</p>
<p>Thank you.</p>
| c# | [0] |
3,634,846 | 3,634,847 | Regardign implementing Custom ExpressionBuilder | <p>I want to pass the "DisplayName" column value returned from SqlDataSource's Select command to a custom function and then the return value to be assigned to "DataTextField" property of DropDownList. </p>
<p>I know, I can do this using "CustomExpressionBuilder", I have tried but if I use following:</p>
<pre><code>DataTextField="<%$ MyCustomExpressionBuilder:DisplayName %>"
</code></pre>
<p>I do not receive the value of the DisplayName field in the overriden "GetCodeExpression" method, but the literal value "DisplayName". </p>
<p>How can I do this? Please help me.</p>
<pre><code><asp:DropDownList ID="drpCourseType" runat="server" DataSourceID="sqldsCourses"
DataTextField="DisplayName" DataValueField="Type" CssClass="FilterDropdown">
</asp:DropDownList>
<asp:SqlDataSource runat="server" ID="sqldsCourses"
SelectCommand="SELECT Type,DisplayName FROM CourseTypes ORDER BY OrderID"
ConnectionString="<%$ ConnectionStrings:connectionString %>"></asp:SqlDataSource>
</code></pre>
| asp.net | [9] |
3,999,396 | 3,999,397 | C++ compiler structures such as Virtual method Table etc | <p>I am aware of the C++ Virtual Table which allows dynamic dispatch for doing things at runtime (although if I am honest I am not completely sure of the full list of things it achieves).</p>
<p>I am wondering what other "low level" aspects of C++ are there, which one doesnt usually come across when learning the C++ language?</p>
<p>Things like:</p>
<p>-How is multithreading and locking on objects performed?</p>
<p>-Overloading/overwriting functions</p>
<p>-Generics</p>
<p>Are there other "structures", similar to the vtable, which assist with these types of things on a lower level?</p>
<p>(and if anyone can help with what the VTable actually does it would be most appreciated!)</p>
| c++ | [6] |
4,050,860 | 4,050,861 | Retain Javascript objects across postbacks | <p>I use to append according to data array in table on button click, but when I click other button due to postback all the created structure goes away, is there any way that I can retain that structure inspite of postback?</p>
<p>Thanx</p>
| javascript | [3] |
4,350,785 | 4,350,786 | How am I supposed to create an Object in Javascript | <p>Thanks in advance, and sorry for being such a newb :)</p>
<p>I'm so confused. I am reading a few different books at once (probably not a good idea) and each tells me to a create a class in a different way.</p>
<p>I can tell you the way I prefer, at least for readability is:</p>
<pre><code> var myObject = {
property1 : "1",
property2 : "2",
combine : function(){
return this.property1 + this.property2;
}
}
</code></pre>
<p>But I have seen other ways.</p>
<p>I just want an up to date answer, and please keep it simple I'm totally new to this and you will lose me if you go overboard with the explanation.</p>
| javascript | [3] |
4,702,511 | 4,702,512 | Cannot run ad-hoc iPhone app | <p>I am trying to run a beta ad-hoc app on my iPhone for the first time (I am not a developer and have no prior experience with this), and I cannot get it to launch. It shows up in iTunes fine, it transfers to my phone fine, but when I tap its icon it appears to launch, then immediately quits back to the home screen. I tried downloading the SDK and adding it through there, and it gave me this error message:</p>
<p>"The Info.plist for application at [redacted].app specifies a CFBundleExecutable of [redacted].app/[app name], which is not executable"</p>
<p>Sorry I can't be more specific, but this app is still under NDA. Anyway, if anyone knows how to fix this, please let me know soon. In case it matters, I am using an iPhone 3GS with 3.1.2 and iTunes 9.02. Thank you!</p>
| iphone | [8] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.