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 |
|---|---|---|---|---|---|
1,208,039 | 1,208,040 | Java endsWith() not working as expected | <p>I'm probably just overlooking something obvious, but I can't for the life of me figure out why this section of code is not working.</p>
<pre><code>if(txtFileLocation.toString().toLowerCase().endsWith(".twn")){
file = new File(txtFileLocation.getText());
} else {
file = new File(txtFileLocation.getText() + ".twn");
System.out.println(txtFileLocation.getText() + " didn't end in .twn, so appending it");
}
System.out.println(file.getPath());
</code></pre>
<p>The output is as followers:</p>
<pre><code>C:\temp\netprimaries1.twn didn't end in .twn, so appending it
C:\temp\netprimaries1.twn.twn
</code></pre>
<p>Why doesn't endsWith(".twn") return true?</p>
| java | [1] |
728,014 | 728,015 | How can i get from a directory string only the file name in the end? | <p>I have a <code>List<string></code> that contain 5 files for example in index[0] I see:</p>
<pre><code>D:\New folder (45)\converted.avi_Automatic\Lightning 2 Length 4 [276 - 280]\000276.bmp
</code></pre>
<p>The line is : </p>
<pre><code>label22.Text = files[_indx].ToString();
</code></pre>
<p>I want instead see in label22 : D:\New folder (45)\converted.avi_Automatic\Lightning 2 Length 4 [276 - 280]\000276.bmp to see only: 000276.bmp</p>
<p>Before files were _files wich is a <code>List<FileInfo></code> so I could make <code>_files[_indx].FullName</code> or <code>.Name</code></p>
<p>But now the list is <code>List<string></code> </p>
| c# | [0] |
3,422,670 | 3,422,671 | How $_POST works | <p>I am a beginner with PHP and I would really like to understand it a lot better. I know you can use $_POST to retrieve information from a form by setting method="$_POST". But why does this work exactly? Is, upon form submission, an array named $_POST created? Does the array then contain all of the element values from the form?</p>
| php | [2] |
1,647,083 | 1,647,084 | registerReceiver issue with in-app billing messages? | <p>I'm implementing in-app billing support in my application. I just realized that even though the application has been stopped, the standard billing broadcast receiver is still receiving billing messages from the market service. So, instead of declaring my receiver inside the manifest file:</p>
<pre><code> <receiver android:name=".receiver.billing.BillingReceiver">
<intent-filter>
<action android:name="com.android.vending.billing.IN_APP_NOTIFY" />
<action android:name="com.android.vending.billing.RESPONSE_CODE" />
<action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED" />
</intent-filter>
</receiver>
</code></pre>
<p>I decided to go with the Context.registerReceiver method in order to ensure that my application is actually ready to correctly handle billing messages:</p>
<pre><code> _billingReceiver = new BillingReceiver();
final IntentFilter filter = new IntentFilter("com.android.vending.billing.IN_APP_NOTIFY");
filter.addAction("com.android.vending.billing.RESPONSE_CODE");
filter.addAction("com.android.vending.billing.PURCHASE_STATE_CHANGED");
_billingService.registerReceiver(_billingReceiver, filter);
</code></pre>
<p>The problem now is that BillingReceiver.onReceive is not called anymore. Is there an issue of some kind preventing billing messages to be sent to dynamically registered receivers. I looked through Google/Android's doc and found nothing.</p>
| android | [4] |
141,909 | 141,910 | What is the benefit of using getters and setters on properties in C#? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://programmers.stackexchange.com/questions/21802/when-are-getters-and-setters-justified">When are Getters and Setters Justified</a> </p>
</blockquote>
<p>Why do we use get and set method in C#? And why do we use public and private method property?</p>
<p>For example:</p>
<pre><code>public class Date
{
private int month = 7;
public int Month
{
get
{
return month;
}
set
{
if ((value > 0) && (value < 13))
{
month = value;
}
}
}
}
</code></pre>
| c# | [0] |
4,435,852 | 4,435,853 | How to develop http handler which can handle multiple request | <p>here is my code ashx http handler which send something to client based on request. </p>
<pre><code>public void ProcessRequest(HttpContext context)
{
string startQstring = context.Request.QueryString["start"];
string nextQstring = context.Request.QueryString["next"];
//null check
if ((!string.IsNullOrWhiteSpace(startQstring)) &&
(!string.IsNullOrWhiteSpace(nextQstring)))
{
//convert string to int
int start = Convert.ToInt32(startQstring);
int next = Convert.ToInt32(nextQstring);
//setting content type
context.Response.ContentType = "text/plain";
DataClass data = new DataClass();
//writing response
context.Response.Write(data.GetAjaxContent(start, next));
}
}
</code></pre>
<p>it is working but i am not sure that does it handle multiple request at a time like 1000 request serving at a time. if not then tell me best way to write code in such way which can handle multiple request at the same time in efficient way. thanks</p>
| c# | [0] |
4,645,231 | 4,645,232 | Convert Hexa array to String | <p>I need convert this array</p>
<pre><code>data = [
#SHO
0x56, 0x0d,
#CMD
0x1, 0x00, 0x00, 0x00,
#ARG
0x1, 0x0,
#SIZE
0x02, 0x00, 0x00, 0x00,
#OPAQUE
0x01, 0x02,
#RESERVED
0x00, 0x00
]
</code></pre>
<p>and produce a string</p>
<pre><code># converted data into s
print s
</code></pre>
| python | [7] |
1,851,528 | 1,851,529 | how to remove a contact using context menu in android | <p>I try the following code to remove contact using context menu item selected by name.</p>
<pre><code>public static boolean deleteContact(Context ctx, String phone, String name) {
Uri contactUri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(phone));
Cursor cur = ctx.getContentResolver().query(contactUri, null, null, null, null);
try {
if (cur.moveToFirst()) {
do {
if (cur.getString(cur.getColumnIndex(PhoneLookup.DISPLAY_NAME)).equalsIgnoreCase(name)) {
String lookupKey = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY));
Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI, lookupKey);
ctx.getContentResolver().delete(uri, null, null);
return true;
}
} while (cur.moveToNext());
}
} catch (Exception e) {
System.out.println(e.getStackTrace());
}
return false;
}
</code></pre>
<p>But I dont know how to put this code to my context menu item selected</p>
<pre><code>public boolean onContextItemSelected(MenuItem item)
{
switch (item.getItemId())
{
case 0:
return true;
}
return super.onContextItemSelected(item);
}
</code></pre>
| android | [4] |
4,546,510 | 4,546,511 | Can someone show me how to properly write Math.cos or Math.acos for android | <p>I have tried writing this in android and I get NAN as the result.
this is my current code can someone verify this correct and if not offer me the correct equation. Thank you.</p>
<pre><code> Math.acos((((a*a)+(c*c))-(b*b))/(2*b*c));
</code></pre>
<p><img src="http://i.stack.imgur.com/L6bPJ.jpg" alt="enter image description here"></p>
| java | [1] |
998,016 | 998,017 | Writing to HTML with inline javascript in Wordpress | <p>I'm trying to display an email address mailto link on a page from an array of email addresses. </p>
<pre><code><script type="text/javascript">
var arr = ["x@temple.edu", "y@temple.edu", "z@temple.edu"]; //my test array of email addresses
var which = Math.floor(Math.random() * 2); // stores a random #, 0-2
document.write('<a href="mailto:' + arr[which] + '?Subject=Advertising">Click here to email us</a>'); // writes the mailto link
</script>
</code></pre>
<p>This code <a href="http://jsfiddle.net/HgL9W/" rel="nofollow">seems to work</a>, but it doesn't display when I add it to my Wordpress page. I'm using WP 3.5 along with <a href="http://wordpress.org/extend/plugins/inline-javascript/other_notes/" rel="nofollow">a plugin</a> called inline-javascript that seems to fill its purpose despite being really old, so I'm just not sure what the problem is. </p>
<p>It seems this should be really simple simple, but I've spent hours looking for an answer to no avail. </p>
| javascript | [3] |
2,174,650 | 2,174,651 | Tick method in a PoliceOfficer class | <p>My question deals with creating a tick procedure the original tick procedure where it makes a class called PoliceOfficer arrest everyone who is naked around him. </p>
<pre><code>def tick(self):
# next time step for all objects that tick
for t in self.__things:
obj = self.get_thing(t)
if has_method(obj, "tick"):
obj.tick()
</code></pre>
<p>This the original tick method.</p>
<p>This is my <code>PoliceOfficer</code> class and the method known as <code>arrest</code>. The arrest method arrests someone based upon them not having any clothes on when in the area of the PoliceOfficer, and when there isn't anyone to arrest he just says something else. </p>
<pre><code>class PoliceOfficer (Person):
def __init__(self, name, jail):
Person.__init__(self, name)
self.set_restlessness(0.5)
self.__jail = jail
def arrest (self, Person):
if self.location.name is Person.location.name:
self.say (Person.name + "You're under arrest!")
self.say ("You have the right to shut up and lay on the ground with your hands behind your back")
Person.name(Place("jail")
else:
return self.say (Person.name + "Ain't got nothing to do damnit")
def tick (self):
if isinstance(t, Student):
if Student.is_dressed = False:
arrest.student
else:
(Person)tick(): self.say("Shoot no one to arrest off to the 7 eleven")
</code></pre>
<p>Would this be partially correct on making my own tick method for PoliceOfficer?
If not what else would I need to do or change to make it like the tick method described, except for making the PoliceOfficer arrest any student that isn't dressed?</p>
| python | [7] |
1,800,618 | 1,800,619 | Button color should not change when I release the button in Android | <p>
</p>
<pre><code><item android:state_focused="true" >
<shape>
<gradient
android:endColor="#FF9900"
android:startColor="#FF9966"
android:angle="270" />
<stroke
android:width="3dp"
android:color="#CCCCCC" />
<corners
android:radius="3dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
<item>
<shape>
<gradient
android:endColor="#FFFFFF"
android:startColor="#FFFFFF"
android:angle="270" />
<stroke
android:width="1dp"
android:color="#666666" />
<corners
android:radius="1dp" />
<padding
android:left="3dp"
android:top="3dp"
android:right="3dp"
android:bottom="3dp" />
</shape>
</item>
</code></pre>
<p>
The above is the code I have written for filling borders of Button with black color.The same code I was using for 3 buttons by setting as background.Now, when I click button1, red color appears and goes when I releases. But I want Red color to be visible, until I press next button. Though I release Button1 after press, Red color should be visible. But Red color should only disappear when I press any other button.
<br>
Can anyone help me in solving this issue?<br>
Please anyone help me in sorting out this issue? <br>
Thanks in Advance,</p>
| android | [4] |
3,322,720 | 3,322,721 | Find out value of child custom control from parent custom control at client side | <p>How to find out the value of child custom control from parent custom control on client side.</p>
| asp.net | [9] |
4,312,152 | 4,312,153 | Need barcode reader for my own app? | <p>I am developing an application for i-phone 4 and i-pad-2, in which i need to read bar-code to compare prices different site like e bay or amazon, I listened about z bar(open source) bar code reader i read its description in app store, but i can't find that does it support i-pad-2? One thing more i need to ask do you have tutorial link to call z bar API to communicate with my application?
If someone give me any better option except z bar, but it should be open source and not external like pic2Shop?</p>
| iphone | [8] |
1,663 | 1,664 | PHP: keeping the username in field | <p>How do i do if i want to keep the username in the field if the users entered incorrect password, so the person doesnt need to retype the username? Should i use sessions for this?</p>
| php | [2] |
4,079,440 | 4,079,441 | How to get the tail of a std::string? | <p>How to retrieve the tail of a <code>std::string</code>?</p>
<p>If wishes could come true, it would work like that:</p>
<pre><code>string tailString = sourceString.right(6);
</code></pre>
<p>But this seems to be too easy, and doesn't work...</p>
<p>Any nice solution available?</p>
<p>Optional question: How to do it with the Boost string algorithm library?</p>
<p><strong>ADDED:</strong></p>
<p>The method should be save even if the original string is smaller than 6 chars.</p>
| c++ | [6] |
5,971,583 | 5,971,584 | Trying to use Toast message, but get error | <p>I'm trying to use a Toast message inside a listener method, but I get an error saying something like: Toast is not applicable for the argument.. I don't understand this and can't solve this problem without some help? Thanks!</p>
<pre><code> // Button 1
button_1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//text_1.setText("New text for first row!"); // Change text
Toast.makeText(this, "You have clicked on number 1", Toast.LENGTH_LONG).show();
if(controlImage_1)
{
image_1.setImageResource(R.drawable.android_1b); // Change image
controlImage_1 = false;
}
else
{
image_1.setImageResource(R.drawable.android_1a); // Change image
controlImage_1 = true;
}
//Toast.makeText(this, "Your download has resumed.", Toast.LENGTH_LONG).show();
}
});
</code></pre>
| android | [4] |
4,151,546 | 4,151,547 | Send file via bluetooth between two android phone | <p>I want to write a programme for sending a file/image between two android phone. If I already have the dirtectory of my file/image,how can I write the programme?</p>
| android | [4] |
1,886,016 | 1,886,017 | In Java, how to iterate on the constants of an interface? | <p>in an interface, I store constants in this way (I'd like to know what you think of this practice). This is just a dummy example.</p>
<pre><code>interface HttpConstants {
/** 2XX: generally "OK" */
public static final int HTTP_OK = 200;
public static final int HTTP_CREATED = 201;
public static final int HTTP_ACCEPTED = 202;
public static final int HTTP_NOT_AUTHORITATIVE = 203;
public static final int HTTP_NO_CONTENT = 204;
public static final int HTTP_RESET = 205;
public static final int HTTP_PARTIAL = 206;
...
}
</code></pre>
<p>Is there a way I can iterate over all constants declared in this interface ? </p>
| java | [1] |
4,537,021 | 4,537,022 | how to display spreadsheet like table in android with horizontal and vertical scrollbars | <p>I want to display excel sheet on android screen with horizontal and vertical scrollbars..plz help me.I have searched so much on net.thanks</p>
| android | [4] |
3,723,692 | 3,723,693 | Is there a way to indicate the DateTime object only has Date value? | <p>In the database, there are some field is TimeStamp and some are Date, which means some accept both Date and Time, some accept Date only.</p>
<p>I am trying to write a helper class that can generate the SQL by iternate through the data object's property, and generate proper SQL by the data type of the property.</p>
<p>So say, Table "SomeDateTimeTable" has TimeStamp field "A_TimeStamp" and Date field "A_Date"
Then my data object has two property, "public DateTime A_TimeStamp" and "public DateTime A_Date".</p>
<p>But because C# only has DateTime... My program can't distinguish is the DateTime property indicate the database field is TimeStamp or Date....</p>
<p>I wonder if there is anyway to acheive it?</p>
<p>I only can think of...either make another class that has DateTime parameter to indicate that's a Date type... Or check if the time is 00:00:00...</p>
<p>But both way seems.... not so smart? </p>
| c# | [0] |
5,093,462 | 5,093,463 | Sidescrolling UI on iPhone | <p>Please lead me in the right direction.</p>
<p>I need to provide user with small text centered on the iPhone screen. User can make quick scroll left or right in order to get the next or previous text. There can be hundreds of such text pieces. The process itself is similar to Photo application sidescrolling but much simple, no zoom.</p>
<p>As far as I can understand I need to use UIScrollView class, then call hundreds of addSubviews?
Is it the optimal way or I should always keep 3 subviews and replace them on the fly? </p>
<p>What kind of tricks should be used to achieve the "scroll and center" effect?</p>
<p>Thanks</p>
| iphone | [8] |
4,917,985 | 4,917,986 | Data storage for Android app | <p>I need to write an application with a lot of questions with 4 variant aanswer for each (tests, in short). Where to store the actual answers and the questions? Create a file, or use SQLlite, or Strinq.xml (although it seems this is the most desirable not).</p>
<p>If I use SQLlite, then for example, if somebody download app, all of my questions and answers should already be there. </p>
| android | [4] |
5,874,693 | 5,874,694 | Add class to <li> based on content of link in <li> | <p>I've added a custom JavaScript file to my header via <code>functions.php</code> and the file is linked fine when I check the source code (listed well below the main call to jQuery). Within the custom JavaScript file I have added the following:</p>
<pre><code>$(document).ready(function(){
$('li.bawmrp_manual > a:contains[href*="/project/"]').addClass('bawmrp_gallery');
});
</code></pre>
<p>I've tried numerous variations. What I'm trying to do is add the class <code>bawmrp_gallery</code> to the <code><li></code> if the link within it contains the text <code>project</code>. Can anyone help?</p>
| jquery | [5] |
1,124,013 | 1,124,014 | python string replace unknown number | <p>I am a beginner with PYTHON and useless with regex and are struggling to replace an unknown number in a file with a new number. I have looked through the python how tos and examples for re but still can't make any progress on how to create the expression.</p>
<pre><code># myfile.txt
Some text
More text
Option "BlankTime" "15"
more text
</code></pre>
<p>I want to replace "15" with another number, this line only appears once in the file, but the line number it is on is unknown, and the value of 15 is also unknown and could be any number contained in the quotation marks.</p>
<p>Best way would be to do it with python ( re ?? ) but if that can't be done then maybe sed ??</p>
| python | [7] |
4,496,404 | 4,496,405 | Where to get detail description on understanding android | <p>I found lots of books on android which give basic concept on android Example (calling Activity, Intent, service, broadcast receivers etc). But I want to know brief description on all these concept. in os level or in api level how does it work. Also how connection with wifi or 3g works in api level. </p>
<p>I want to know brief understanding on android. Can anyone suggest any tutorial or book to get detail understanding on android.</p>
<p>Thanks</p>
| android | [4] |
5,120,576 | 5,120,577 | Pass 'this' from one function to another in javascript? | <pre><code>function removeNewsItem(id,idStamp,obj){
$('#whiteCover')show();
$('#contentOfBox').html= ('Are you sure you want ot completely remove this news item?<br/><br/><div style="text-align:center;"><input type="button" class="button blue medium" onclick="removeNewsItemConfirmed(\'' + id + '\',\''+idStamp+'\','+**obj**+')" value="Yes"/> <input type="button" class="button red medium" value="No" onclick="resetContentBox();"/></div>');
$("#whiteCoverContainer").fadeIn();
}
function removeNewsItemConfirmed(id,idStamp,obj){
alert(obj);
$(obj).remove();
return;
}
<tr><td onclick=removeNewsItem('111','134234',this)></td></tr>
</code></pre>
<p>When I click on the td with the removeNewsItem on it, i cannot seem to be able to pass the 'this' element on to the next function: After the user clicks, they are shown a message asking to confirm deletion, but when they click it the 'this' is not getting passed properl, or more to the point I can't fihure out how...</p>
<p>Could somebody please help: How can I pass obj onto another inline onclick event like above?</p>
| jquery | [5] |
1,164,856 | 1,164,857 | how to get indoor map of a mall in iphone | <p>hi my requirement is show an indoor map of a mall selected by user. and then show route between two shops inside mall and also i want to show navigation path, when user moves from from one location to another inside the shop it will update on map i.e the current location of user , i have done lots of google there are many approach like google indoor map with tiled image , micello API , nokia nevteq api but all r not satisfactory , i just wana to know is this possible in iphone , if yes then wat will be the best approach to follow which will be supported by apple. </p>
<p>main requirement:
1. show indoor map of a mall i.e floor plan with all details
2.when user moves from one shop to another it will show currnt location on map and navigate user from souce</p>
| iphone | [8] |
5,485,243 | 5,485,244 | Embedding Google Maps & Changing Location every 5 seconds | <p>Im trying to create an app which tracks the ISS. From what I've determined from the internet there aren't any xml based location sites available that allow me to scrape the location from the site and use that location on google maps.</p>
<p>However there are plenty of sites that utilise Javascript applications; they basically do what I want. So is there anyway to take information from a javascript app on a site and use it in your application?</p>
<p>Thanks</p>
| android | [4] |
3,383,622 | 3,383,623 | Keeping only a certain line and deleting the rest in C# | <p>I was wondering if anyone could give me a quick example of how to do this. What I want to do is parse a .txt file and delete everything but lines containing "Type: Whisper", is there any way to achieve this with relative ease?</p>
| c# | [0] |
881,767 | 881,768 | Android Preview Format when use SetPreviewDisplay in Camera | <p>If I use 'setPreviewDisplay' in the Camera, like the api below</p>
<p>public final void setPreviewDisplay (SurfaceHolder holder)</p>
<p>What kind of format will be passed to SurfaceHolder for display? Is it NY21 or YV12?</p>
<p>Thank you.</p>
| android | [4] |
3,915,784 | 3,915,785 | Php Difference between compile time and run time polymorphism | <p>In case of php, what is the difference between runtime and compile time polymorphism</p>
| php | [2] |
5,586,868 | 5,586,869 | Monitor/logging who signs into the asp.netapp? | <p>I want to have a log file keep rows of who logs in and timestamp. is there a place to do this? And what sort of code is needed?</p>
| asp.net | [9] |
5,895,901 | 5,895,902 | Java is not showing proper Timezone conversion for CDT | <p>I tried to get time difference in java but for CDT as TimeZone in java it's not calculating daylight saving. if i am using CST as TimeZone in java then it's calculating daylight saving.can any one tell me what to do? I am getting this CST / CDT from System and can't use any other thing other than this. is there any way with CST/CDT i can get the full name of TimeZone?</p>
| java | [1] |
2,993,834 | 2,993,835 | Job queuing library/software for Java | <p>The premise is this: For asynchronous job processing I have a homemade framework that:</p>
<ul>
<li>Stores jobs in database</li>
<li>Has a simple java api to create more jobs and processors for them</li>
<li>Processing can be embedded in a web application or can run by itself in on different machines for scaling out</li>
<li>Web UI for monitoring the queue and canceling queue items</li>
</ul>
<p>I would like to replace this with some ready made library because I would expect more robustness from those and I don't want to maintain this. I've been researching the issue and figured you could use JMS for something similar. But I would still have to build a simple java API, figure out a runtime where I would put the processing when I want to scale out and build a monitoring UI. I feel like the only thing I would benefit from JMS is that I would not have to do is the database stuff.</p>
<p>Is there something similar to this that is ready made?</p>
<p><strong>UPDATE</strong></p>
<p>Basically this is the setup I would want to do:</p>
<ul>
<li>Web application runs in a Servlet container or Application Server </li>
<li>Web application uses a client api to create jobs</li>
<li>X amount of machines process those jobs</li>
<li>Monitor and manage jobs from an UI</li>
</ul>
| java | [1] |
1,417,894 | 1,417,895 | Add UIToolbar to UIViewController | <p>How to add <code>UIToolbar</code> to the below <code>UIViewController</code>.</p>
<pre><code>PageOneViewController *viewController = [[PageOneViewController alloc] init];
[self presentModalViewController:viewController animated:YES];
[viewController release];
</code></pre>
<p>This <code>UIViewController</code> is the view of the <code>mainviewcontroller</code> and <code>UIToolbar</code> is in the <code>mainviewcontroller</code>. So basically when this view is loaded i want <code>UIToolbar</code> to load as well. </p>
<p>Can someone give me an idea </p>
| iphone | [8] |
1,429,982 | 1,429,983 | Need a good way to store Name value pairs | <p>I often run into a situation where I want to have a set of key/value pairs. Here's a pseudo code idea:</p>
<pre><code>DataSet MyRequestStatus
{
Accepted = "ACC",
Rejected = "REJ"
}
</code></pre>
<p>Usage:</p>
<pre><code>InsertIntoTable(MyRequestStatus.Accepted.ToString())
</code></pre>
<p>I want to be able to use the friendly "MyRequestStatus.Accepted", but I want the ToString() to return the cryptic "ACC", NOT "Accepted". Bonus points, implicit conversion rather than having to call ToString().</p>
<p>I haven't found an obvious way to achieve this with Enums. What do you suggest?</p>
| c# | [0] |
5,844,767 | 5,844,768 | How to implement a product (video or audio) for sale in a PHP based website | <p>I'm a complete noob when it comes to php. I can implement a site and do minimal coding (trying to get better), but for what I want to do, I'm not even really sure of the correct search terms so I can research. What I'm trying to do is to allow users to go to a certain section of my site that requires them to login. And once there, they can select videos that they have to purchase to view. I'm not sure if this is something that's straight forward or not. I don't know what type of service I can use to charge them, and how to make the videos available to them once they have purchased. I really don't have a handle on how to make this happen. If anyone can give me some direction, I certainly would appreciate it. Thanks!</p>
| php | [2] |
2,695,143 | 2,695,144 | Response.Redirect and IFrames | <p>I have a Main.aspx page and a Sub.aspx page.</p>
<p>The Sub.aspx page resides in my Main.aspx page via IFrame. So the IFrame contains / loads the Sub.aspx</p>
<p>In another Third.aspx completely unrelated I've got some code that needs to redirect back to Main.aspx but then there are some querystrings that need to be passed to Sub.aspx (or put antoher way my Sub.aspx needs to get those values from the Main.aspx).</p>
<p>My Sub.aspx will check for that querystring flag and if set, run x JS scripts.</p>
| asp.net | [9] |
1,618,925 | 1,618,926 | usleep() causing everything to "sleep" | <p>I have two php scripts and when I call one that has a loop with usleep() in it, it delays the execution of complete other script?</p>
<p>Any ideas why this would be?</p>
<p>Thanks!</p>
| php | [2] |
2,450,278 | 2,450,279 | Show mp4 and 3gp files for selection in Android | <p>I have an app where i need to select video files of .3gp and .mp4 format only. I use the following code. It shows only 3gp files , how do i show mp4 files also?</p>
<pre><code>intent.setType("video/*");
intent.putExtra("only3gp", true);
</code></pre>
<p>Please help.</p>
| android | [4] |
1,085,915 | 1,085,916 | How to Stop musicplayer when I detach headphones? | <p>I want to stop the currently running MusicPlayer when the user unplugs the headphones (both wired & bluetooth).</p>
<p>I came across sevral posts where use of:</p>
<pre><code>isWiredHeadsetOn(), isBluetoothA2dpOn()
</code></pre>
<p>is suggested.</p>
<p>But Android docs says isWiredHeadsetOn() is deprecated. What alternative should I use?</p>
<p>Thanks</p>
| android | [4] |
4,919,873 | 4,919,874 | array in c#.net1 | <p>I need to understand how to scan values in to a jagged array using loops in Csharp.net. Kindly request to get the answer as fast as possible.</p>
| c# | [0] |
4,939,468 | 4,939,469 | How Do I Place Auto-generated Java Classes in a Single .java File? | <p>As everyone knows - public java classes must be placed in their own file named [ClassName].java </p>
<p>( <a href="http://stackoverflow.com/questions/3263122/when-java-class-x-required-to-be-placed-into-a-file-named-x-java">When java class X required to be placed into a file named X.java?</a> )</p>
<p>However, we are auto-generating 50+ java classes, and I'd like to put them all in the same file for our convenience. This would make it substantially easier to generate the file(s), and copy them around when we need to. </p>
<p>Is there any way I can get around this restriction? It seems like more of a stylistic concern - and something I might be able to disable with a compiler flag.</p>
<p>If not, what would you recommend?</p>
| java | [1] |
5,691,572 | 5,691,573 | Error with ckfinder fo asp.net | <p>i want a file manager for select image from host and prevent user from upload extra images.
i found ckfinder but i get error when i wanted to build project.
i didnt change anything i just copied CKFinder folder to my project, and pressed Build button</p>
<p>Error 15 The type or namespace name 'Design' does not exist in the namespace 'System.Web.UI' (are you missing an assembly reference?) C:\Users\RahaDesign\documents\visual studio 2010\Projects\Test\ckfinder_source\FileBrowserDesigner.cs 20 51 Test</p>
| asp.net | [9] |
36,278 | 36,279 | asp.net session security | <p>If I put some pretty sensitive information in a session variable, how secure is it? Can it be access by a client writing a rogue page and making an ajax call to my application? </p>
<p>Thanks.</p>
| asp.net | [9] |
1,168,266 | 1,168,267 | C++ Cout array values with upper and lower limits | <p>I have an array of prime numbers from 2 to 997. How do you display array values with upper and lower limits? For example:
Upper and lower limits: 0 20
Output:
2, 3, 5, 7, 11, 13, 17, 19</p>
| c++ | [6] |
2,506,857 | 2,506,858 | javascript: overriding (not just defining) a function in if statement | <p>I have the following javascript.</p>
<pre><code>var f = function() { ... };
if (x === 1) {
// redefine f.
f = function() {
...
};
}
</code></pre>
<p>Is that code valid ?
In other words can I redefine a javascript function inside an if statement where I actually write the code. </p>
<p>I am worried because of this:
<a href="http://stackoverflow.com/questions/10069204/function-declarations-inside-if-else-statements">Function declarations inside if/else statements?</a></p>
| javascript | [3] |
5,523,103 | 5,523,104 | java servlet programming errror | <pre><code>C:\Tomcat5.5\webapps\WEB-INF\classes>javac MyServlet.java
MyServlet.java:2: package javax.servlet does not exist
import javax.servlet.*;
^
MyServlet.java:3: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
MyServlet.java:5: cannot find symbol
symbol: class HttpServlet
public class MyServlet extends HttpServlet
^
MyServlet.java:7: cannot find symbol
symbol : class HttpServletRequest
location: class MyServlet
public void doGet(HttpServletRequest req, HttpServletResponse res) throws Serv
letException,IOException
^
MyServlet.java:7: cannot find symbol
symbol : class HttpServletResponse
location: class MyServlet
public void doGet(HttpServletRequest req, HttpServletResponse res) throws Serv
letException,IOException
^
MyServlet.java:7: cannot find symbol
symbol : class ServletException
location: class MyServlet
public void doGet(HttpServletRequest req, HttpServletResponse res) throws Serv
letException,IOException
^
6 errors
</code></pre>
| java | [1] |
5,696,568 | 5,696,569 | In jQuery, how do you select textbox that has a value of multiple spaces? | <p>I need to select such textboxes so as to validate required field. How do I go about doing it? Seems I can use a if statement, but I'm not sure how to implement.</p>
<p>I wrote the following required field validator to test for empty textboxes, but cannot detect textboxes with multiple spaces. Am I not doing validation the correct way? Should I be using a plugin for validation?</p>
<pre><code>function validate()
{
$('.LoginFormBodyRightColumn input:text[value!=""]').next('span[class*="RequiredValidator"]').hide();
$('.LoginFormBodyRightColumn input:text[value=""]').next('span[class*="RequiredValidator"]').show();
$('.LoginFormBodyRightColumn input:password[value!=""]').next('span[class*="RequiredValidator"]').hide();
$('.LoginFormBodyRightColumn input:password[value=""]').next('span[class*="RequiredValidator"]').show();
}
</code></pre>
<p>It seems to me a if statement has no place in jQuery, because in jQuery you select something and then perform something on the selector. A if statement involving selectors is meaningless.</p>
| jquery | [5] |
1,054,719 | 1,054,720 | Javascript - use class name to specify which variable to assign value to | <p>I'm trying to be clever with some efficient Javascript but it's causing me headaches and lots of fruitless searching.</p>
<p>I have a set of inputs in a table, each with a given class:</p>
<pre><code>...
<tr>
<td><input name="name" type="text" class="markertitle"/></td>
<td><input name="desc" type="text" class="markerdescription"/></td>
<td><input name="address" type="text" class="markeraddress"/></td>
<td><input name="url" type="text" class="markerurl"/></td>
</tr>
...
</code></pre>
<p>I want to take the value of those classes, use it to specify a given variable (which already exists), then assign the value of the input (using +=) to that variable.</p>
<p>This is what I've come up with, but no joy:</p>
<pre><code> var markertitle = {};
var markerdescription = {};
var markeraddress = {};
var markerurl = {};
$('#markermatrixadd input').each(function(){
var field = $(this).attr('class');
window[field] += $(this).val() + ',';
});
</code></pre>
<p>It's dead simple I'm sure, but I think my brain's a bit fried :(</p>
| javascript | [3] |
3,199,486 | 3,199,487 | How to handle null value while executing the query | <p>suppose there 5 column in my table info(id,loginid,pagename,pagecount,detail).
I am executing the query like, select the pagename when loginid=somthing and id =something.But in column that is pagecount(int) and pagename(varchar),I am not putting any thing ,so it consider as null.When execute the query,result shows the column with null value.Query's result move to else part.How to handle with that null value.</p>
<pre><code>if(table.Rows.count == 0)
{
}
else
{
Actually coding.
}
</code></pre>
| asp.net | [9] |
5,090,376 | 5,090,377 | How does operator chaining happen in C++? | <p>I have a totally basic C++ question here.</p>
<pre><code>#include <iostream>
using namespace std;
int main() {
int a = 255;
cout << hex << a << endl; // <-----
}
</code></pre>
<p><strong>In the code piece above, how is the <code>std::cout</code> statement chained?</strong></p>
<p>I understand that an implementation of <code>cout</code> would return the reference to <code>cout</code> object to allow chaining to happen, so it should be executed as:</p>
<pre><code>(((cout << hex) << a) << endl)
</code></pre>
<p>i.e. equivalent to these, in order</p>
<ol>
<li><code>cout << hex</code></li>
<li><code>cout << a</code></li>
<li><code>cout << endl</code></li>
</ol>
<p>But this cannot be the case because somehow value of <code>a</code> needs to be converted to <code>hex</code> form! </p>
<p><strong>How are operators actually chained by the compiler to make the conversion happen?</strong></p>
| c++ | [6] |
2,307,613 | 2,307,614 | How to 'copy and paste' an element in jQuery? | <p>I'm making a simple lightbox. If you click on an image, it takes that image and shows it full screen with a black background behind it.</p>
<p>Here is my code:</p>
<pre><code>$('.theContent img').live('click', function(e) {
var lbImg = $(this);
$('#lb').toggle();
$('#lb').find("#lbImg").append(lbImg);
)
</code></pre>
<p>Thing is, it takes away the variable lbImg and puts it in the lightbox. I dont want that, i just want to copy that bit of info and duplicate, rather than reposition. How would you go about that?</p>
| jquery | [5] |
2,087,128 | 2,087,129 | Python Programming | <p>this is the problem I am working on. I have been programming for a total of 9 days so I am very new. I am attempting to write a function that generates a random integer between -1,200 and 1,200, and returns a statement dependent of the number. The statements are: number generated: is greater than 800, return ‘Heidi wins’/ less than or equal to 800 and is an EVEN number, return ‘Magic wins’. / less than or equal to 800 and ends with a 3, return ‘Tally wins’. / less than or equal to 800 and ends with a 5, print ‘Chelsea wins’. Otherwise, print ‘Big Girl wins’. Here is my program so far: please help with finishing it up. thank you. </p>
<pre><code>def sillyGame(n):
mychoices=[
number=random.choice(myChoices)
inputNum=raw_input("Enter a number:")
numbers=['0','1','2','3','4','5','6','7','8','9','.']
isValidNumber=True
for ch in inputNum:
for element in numbers:
isMatch=False
if ch ==element:
isMatch=True
break
if isMatch==False:
isValidNumber==False
break
if isValidNumber==True:
print("this is a valid number")
else:
print("this is not a valid number")
</code></pre>
| python | [7] |
5,244,027 | 5,244,028 | Is this really saving allocation? | <p>I've got the following in a static Utility class:</p>
<pre><code>static int[] MonthDays = new int[] {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
public static int[] GetListOfAllDaysForMonths()
{
return MonthDays;
}
</code></pre>
<p>Is this efficient in that now by calling GetListOfAllDaysForMonths() in several places in code, that I am saving myself from having to allocate and create a new int[] each time this method is called?</p>
<p>Updated: Lets make it readonly</p>
<pre><code> static readonly int[]
</code></pre>
| c# | [0] |
3,565,223 | 3,565,224 | How can i change the path to a specific folder | <p>the folder structure is like this:</p>
<p>plugin->upload->php->files</p>
<p>list-></p>
<pre><code>'script_url' => $this->getFullUrl().'/'.basename(__FILE__),
//'upload_dir' => dirname(__FILE__).'/files/',
//'upload_url' => $this->getFullUrl().'/files/',
'upload_dir' => dirname(__FILE__).'/'.$_SESSION['username'].'/',
'upload_url' => $this->getFullUrl().'/'.$_SESSION['username'].'/',
</code></pre>
<p>How can i change this file to list folder??</p>
| php | [2] |
1,599,006 | 1,599,007 | XHTML valid way to replace text with jquery | <p>I have the following code</p>
<pre><code>$("#FOO").hover(function() {
$(this).html('<p><a href="somepage.php" target="_self">first text</a></p>');
}, function() {
$(this).html('<p><a href="somepage.php" target="_self">hovered text</a></p>');
});
</code></pre>
<p>Is it improper to put <code><p></code> & <code><a></code> tags in the .html function? It is invalid XHTML and I'd like to make it cleaner.
thanks!</p>
<p>from w3c validator:
Error Line 134, Column 83: end tag for element "A" which is not open</p>
<p>the next error is "end tag for element "p" wich is not open. its just reading those tags weird.</p>
<p><code>….html('<p><a href="somepage.php" target="_self">first text</a></p>')</code>;</p>
| jquery | [5] |
161,986 | 161,987 | JQuery popup works on load, but then reloads | <p>I am trying to make a simple popup without extensions to jquery. The popup load on page load like it should, but the problem I am having is making some way to close the popup without it automatically re-initating when I do so.Which it currently does, because it is attached to $(document).ready(. Thanks :)</p>
<pre><code> $(document).ready(function(){
$('#page').animate({"opacity":"0.4"});
$('#popup').delay(300).fadeIn('slow');
$('#close').click( function() {
$('#page').animate({"opacity":"1"});
$('#popup').fadeOut('fast');
})
})
</code></pre>
| jquery | [5] |
2,250,117 | 2,250,118 | Issues overriding onKey in View.OnKeyListener | <p>I am new to Android programming and relatively new to programming in general so please bear with me here...</p>
<p>I am trying to implement an EditText field and I am having problems with overriding onKey. </p>
<p>I found a couple of errors and fixed them but when I compile I get the following error:</p>
<pre><code>cs211d.hw03.HW03 is not abstract and does not override abstract method onKey(android.view.View,int,android.view.KeyEvent) in android.view.View.OnKeyListener
[javac] public class HW03 extends Activity implements View.OnKeyListener
</code></pre>
<p>I tried moving the <code>onKey</code> method outside of the inner class and it worked but only if I commented out <code>et.setOnKeyListener(...);</code></p>
<p>Somebody suggested in another forum that I remove the <code>OnKeyListener</code> and/or <code>implements View.OnKeyListener</code> but it seems like it should be possible to implement the interface and use the <code>OnKeyListener</code>....otherwise what is the point of it's existence?</p>
<p>Here is my code:</p>
<pre><code>import android.app.Activity;
import android.os.Bundle;
import android.view.*;
import android.widget.EditText;
public class HW03 extends Activity implements View.OnKeyListener
{
final EditText et = (EditText) findViewById(R.id.penniesField);
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle b)
{
super.onCreate(b);
setContentView(R.layout.main);
et.setOnKeyListener(
new View.OnKeyListener()
{
public boolean onKey(View v, int keyCode, KeyEvent ke)
{
if( (ke.getAction() == KeyEvent.ACTION_DOWN) &&
(keyCode == KeyEvent.KEYCODE_ENTER) )
{
String pennies = et.getText().toString();
return true;
}
return true;
}
});
}
}
</code></pre>
| android | [4] |
5,485,007 | 5,485,008 | jQuery prevent other events after a click | <p>I am trying to prevent multiple clicks on links and items, which is causing problems.</p>
<p>I am using jQuery to bind click events to buttons (jQuery UI) and image links (<code><a><img /></a></code>).</p>
<p>Is there a way to do-once-for-all prevent other events from firing after a click occurs?</p>
<p>Or do I have to maintain a global variable called _isProcessing and set it to true for each event handler? </p>
<p>Thanks</p>
<p>Edit: (clarification)
Thanks for your answers, my problem isn't preventing the bubbling of the event, but preventing multiple concurrent clicks.</p>
| jquery | [5] |
4,748,329 | 4,748,330 | android is hang while android don't find connection | <p>I am creating an android application but while(if?) server is not found, it will hang the tool kit (SDK/emulator?).
I have attached my login code. Please help me to find the solution. I just want that if server is not available, my application will stay on at the login page without hanging itself.</p>
<p>when I debugged my code I didn't get value of httpResponse and after this line </p>
<pre><code>HttpResponse httpResponse = httpclient.execute(httpPost);
</code></pre>
<p>the problem occurred</p>
<pre><code>public String login(String userName, String password){
try {
String url = URL+ "?flag="+"on"+"&user="+userName+"&pass="+password;
httpPost = new HttpPost(url);
HttpResponse httpResponse = httpclient.execute(httpPost);
int statuscode = httpResponse.getStatusLine().getStatusCode();
if (statuscode == 200) {
String responseMsg = getResponse(httpResponse);
return responseMsg;
}else{
Log.e(TAG, statuscode+"");
}
} catch (ClientProtocolException e) {
Log.e(TAG, e.getMessage(),e);
} catch (IOException e) {
Log.e(TAG, e.getMessage(),e);
}
return null;
}
</code></pre>
| android | [4] |
4,768,886 | 4,768,887 | simple create pdf file with hard code | <p>I have generated pdf programatically bt problem is text doesnt appear in pdf.
PLz provide me simple example of pdf creator.</p>
<p>This is my code :</p>
<pre><code>-(void) MyCreatePDFFile //(CGRect pageRect, const char *filename)// 1
{
CGRect pageRect=CGRectMake(10,10,400,600);
const char *filename="/Users/msoni/Desktop/my.pdf";
CGContextRef pdfContext;
CFStringRef path;
CFURLRef url;
CFMutableDictionaryRef myDictionary = NULL;
//const char *filename="a.pdf";
path = CFStringCreateWithCString (NULL, filename,kCFStringEncodingUTF8);
url = CFURLCreateWithFileSystemPath (NULL, path,kCFURLPOSIXPathStyle, 0);
CFRelease (path);
myDictionary = CFDictionaryCreateMutable(NULL, 0,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks); // 4
CFDictionarySetValue(myDictionary, kCGPDFContextTitle, CFSTR("My PDF File"));
CFDictionarySetValue(myDictionary, kCGPDFContextCreator, CFSTR("My Name"));
pdfContext = CGPDFContextCreateWithURL (url, &pageRect, myDictionary); // 5
CFRelease(myDictionary);
CFRelease(url);
CGContextBeginPage (pdfContext, &pageRect); // 6
CGContextStrokeRect(pdfContext, CGRectMake(20, 100, 200,300));
const char *text = "Sed ut perspiciatis unde omnis iste natus error sit voluptatem";
CGContextShowTextAtPoint (pdfContext, 100, 400, text, strlen(text));
//CGContextSetTextDrawingMode (pdfContext);
CGContextEndPage (pdfContext);// 8
CGContextRelease (pdfContext);// 9
}
</code></pre>
<p>waiting for reply..</p>
<p>thank</p>
| iphone | [8] |
1,980,277 | 1,980,278 | Diferent integer values | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/8427416/why-is-true-for-some-integer-objects">Why is == true for some Integer objects?</a> </p>
</blockquote>
<p>I have code fragment</p>
<pre><code>Integer i1 = new Integer(a);
Integer i2 = new Integer(b);
if (i1 == i2)
{
// ...
}
</code></pre>
<p>When 'a' and 'b' are small numbers (e.g. 0-20) then i1 == i2 return true.<br>
But when 'a' and 'b' are great then i1 == i2 rerun false!<br>
I don't understand, how can it be</p>
| java | [1] |
1,856,055 | 1,856,056 | Finding the path of resource folder? | <p>Is there any way (programmatically) that i can find the location of "Resource" folder. I want to create a new file in it at run time. </p>
| iphone | [8] |
4,216,241 | 4,216,242 | Is there a method that will check if a point intersects a rectangle? | <p>So, Apple includes a <code>CGRectIntersectsRect</code> method which checks if two rectangles are intersecting each other, but do they have a method that I can use the checks if a CGPoint intersects a CGRect? Or do I just have to implement that myself?</p>
| iphone | [8] |
5,852,793 | 5,852,794 | Empty list returned from saving function | <p>This what I asked to do:</p>
<blockquote>
<p><code>save_friends(filename, friends_list)</code> takes a file name and a friends list and writes that list to thefile in the correct format. So, for example,
save_friends('friends.csv', load_friends('friends.csv'))
should overwrite the friends le with exactly the same content.</p>
</blockquote>
<p>This is my code:</p>
<pre><code>def save_friends(filename, friends_list):
"""
take a file name and a friends list and wrients that list
to the file in the correct format
save_friend(file, list) -> list
"""
friends_list = []
f = open(filename, 'w')
for friend in friends_list:
f.write(friend+ '\n')
return friends_list
f.close()
</code></pre>
<p>The problem is when I run the text code(a code provided by school that dose some simple tests), it tells me </p>
<pre><code>>>>save_friends('friends_output.csv', d)
[ ]
Traceback (most recent call last):
File "E:\study\Yr 1\Semister1\CSSE1001\Assignment\sample_tests.py", line 84, in <module>
assert res == None, "save_friends didn't return None"
AssertionError: save_friends didn't return None
</code></pre>
<p>So, how can I return 'None' while the input is not really a list(Like the input 'd' in this circumstance)?</p>
| python | [7] |
1,205,523 | 1,205,524 | Android assest folder image attachment to email failed | <p>I'm trying to send a mail attaching assest folder image to the mail, mail is sent successfully, but when i checked it there was no image attached to the mail,
this is my code,</p>
<pre><code>Uri uri = Uri.fromFile(new File("file:///android_asset/Hat_5.png"));
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setType("image/png");
intent.putExtra(Intent.EXTRA_EMAIL , new String[] { "some@gmail.com"});
intent.putExtra(Intent.EXTRA_SUBJECT, "New Order");
intent.putExtra(Intent.EXTRA_TEXT , "Order Id :" +imageId);
intent.putExtra(Intent.EXTRA_STREAM , uri);
startActivity(Intent.createChooser(intent, "Send mail..."));
</code></pre>
<p>permission,</p>
<pre><code><uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</code></pre>
| android | [4] |
2,698,958 | 2,698,959 | Get instanceof type out of an array without if statements | <p>Note: This is an abstracted version of my problem as a lot of actual code would probably be confusing and irrelevant to the problem.</p>
<p>I have an array/ArrayList of objects that all inherit their information from another class.</p>
<p>For example</p>
<pre><code>class A
class B extends A
class C extends A
class D extends A
</code></pre>
<p>Objects of class B, C, and D all go into an array of type A.</p>
<p>Now when they come out I want to cast them back to the original type to use a specific method / variable etc. <strong>How can I do this without having to go through a set of <em>if</em> statements to try and find out what sort of sub class it is?</strong> It makes my code very inflexible as I have to write a new set of <em>if</em> statements every time I add a new class that extends class A. Is there a way to simply return to the exact name of the class that an object is?</p>
| java | [1] |
1,602,390 | 1,602,391 | python: append values to a set | <p>i have a set like this:</p>
<pre><code>keep = set(generic_drugs_mapping[drug] for drug in drug_input)
</code></pre>
<p>how do i add values <code>[0,1,2,3,4,5,6,7,8,9,10]</code> in to this set?</p>
| python | [7] |
4,977,247 | 4,977,248 | function return different objects | <p>I have a function(myFunction) with parameter v, I hope it can return different object depend the value of v.</p>
<p>something like below:</p>
<pre><code>-(NSString*)myFunction:(NSInteger)v;
-(NSNumber*)myFunction:(NSInteger)v;
</code></pre>
<p>Is it possible?</p>
<p>Welcome any comment</p>
<p>Thanks interdev</p>
| iphone | [8] |
1,986,276 | 1,986,277 | Starting service from a class extending applicaiton android | <p>I am trying to call a service from a class extending android. The service in turn is starting some threads. When i m stopping the service from list of running services, the <code>onDestroy()</code> of the service is not getting called.</p>
<p>But when i m stopping the service which is started from an activity its <code>onDestroy()</code> method is being called. </p>
<p>What is the difference ?</p>
| android | [4] |
3,511,775 | 3,511,776 | Wait for writing file | <p>I have an small app that write data to file then reading back data, </p>
<pre><code>writeData();
readData();
</code></pre>
<p>but it seems that readData() is executed before WriteData() finished its execution, is there any away to wait for writeData()?
<br>Thank you very much.</p>
| java | [1] |
1,029,271 | 1,029,272 | C# reading data from a csv file, with 8 columns, and sorting it | <p>So I am trying to read a csv file that essentially is a list of data separated by words, and I what I have done so far is used ReadAllLines and then from there separated with text.Split(',');
The only problem is I just read about this sort of list/array class method rather than creating an actual array, so I have no clue how to call it, or use it. Here is what I have so far: </p>
<pre><code>using System;
using System.IO;
public class Earthquake
{
public double Magnitude { get; set; }
public string Location { get; set; }
public double Latitude { get; set; }
public double Longitude { get; set; }
public double depth { get; set; }
public string date { get; set; }
public string EventID { get; set; }
public string URL { get; set; }
public Earthquake(double magna, string locate, double lat, double longi, double dept, string dat, string Event, string website)
{
Magnitude = magna;
Location = locate;
Latitude = lat;
Longitude= longi;
depth = dept;
date = dat;
EventID = Event;
URL = website;
}
}
public class ManageData
{
public int count;
public void getData()
{
string[] text = File.ReadAllLines(@"Earthquakes.csv");
foreach (string word in text[count].Split(','))
{
//here i want to put each data in the Earthquake class
}
}
}
</code></pre>
| c# | [0] |
206,816 | 206,817 | jquery loop functions | <pre><code>function character_1() {
$("#character_1").animate({"top": "0"}, 3000, function() {
$(this).fadeOut(2000);
character_2();
});
};
function character_2() {
$("#character_2").animate({"top": "0"},3000, function() {
$(this).fadeOut(2000);
character_3();
});
};
function character_3() {
$("#character_3").animate({"top": "0"},3000, function() {
$(this).fadeOut(2000);
character_1();
});
};
$(document).ready(function() {
character_1();
});
</code></pre>
<p>The code above. It doesn't return to character_1(); I'd like to have them running as loop. Anyone help please?</p>
| jquery | [5] |
4,552,729 | 4,552,730 | how to detect day light saving in java | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1305350/how-to-get-the-current-date-and-time-of-your-timezone-in-java">How to get the current date and time of your timezone in Java?</a> </p>
</blockquote>
<p>I have developed a Attendance System and in use for India. Our servers are in US and since they are using PDT. My code reflects time one hour ahead.</p>
<p>say its 9:00 am IST ---- I get the time as 10:00 am IST</p>
<p>other than detecting one hour from the time, which will be a temporary solution.</p>
<p>Pls suggest me some way to overcome this situation</p>
| java | [1] |
977,224 | 977,225 | How to update meta tags using jQuery | <p>I had tried using </p>
<pre><code>$('meta[name=description]').attr('content', 'new value');
</code></pre>
<p>But the above is not working in any browser.</p>
<p>Please suggest</p>
| jquery | [5] |
1,503,561 | 1,503,562 | While loop stop at first false condition | <p>I have this <code>while</code> loop:</p>
<pre><code>//All of this code is inside a for loop
positionUp = i - 1;
while ((positionUp > 0) && boardMatrix[positionUp][j] == boardMatrix[i][j]) {
//do something
positionUp--;
}
</code></pre>
<p>At some point, it is possible that <code>positionUp</code> it's assigned with the value <code>-1</code> (when <code>i=0</code>)</p>
<p>I thought that the <code>while</code>loop will stop at the first <code>false</code>evaluation thus not evaluating <code>boardMatrix[positionUp][j]</code> and not getting <code>java.lang.ArrayIndexOutOfBoundsException: -1</code></p>
<p>I'm not seeing how can I solve this. Can someone point me in the way?</p>
| java | [1] |
4,906,432 | 4,906,433 | Any Rotation cause event not to fire android | <p>I'm developing rotating layout with some image buttons over it, without rotation the Image button events works fine, but when I rotate the layout the button events keep the previous place of the button not the new place so when I click it it fire the event of another button and this is not good</p>
<p>I have tried to do it using touch event but I had the same problem, also i have tried to make a canvas and draw bitmaps over it and handle it using drawable .getBounds().contains(x, y); </p>
<p>but it didn't work also</p>
<p>can anyone advice me in this problem please?</p>
| android | [4] |
5,693,344 | 5,693,345 | Selection of a specific inline style | <p>how can I select only the divs with style "right:200px" in jquery?</p>
<p>Example:</p>
<pre><code><div class="test" style="position:absolute; right:200px; top:10px;"><p>Hello</p></div>
<div class="test" style="position:absolute; right:300px; top:20px;"><p>Hello</p></div>
<div class="test" style="position:absolute; right:400px; top:70px;"><p>Hello</p></div>
<div class="test" style="position:absolute; right:200px; top:40px;"><p>Hello</p></div>
<div class="test" style="position:absolute; right:400px; top:100px;"><p>Hello</p></div>
<div class="test" style="position:absolute; right:200px; top:140px;"><p>Hello</p></div>
var div200 = $('.test').css('right');
</code></pre>
<p>I don't know how to select only the divs with "right:200px".
I'm new to jquery. I tried hard but without any success:</p>
<p>Achim</p>
| jquery | [5] |
4,762,757 | 4,762,758 | Copy values from one object to another | <p>Anyone have a suggestion for a good utility class that maps values from one object to another? I want a utility class that uses reflection and takes two objects and copies values from the 1st object to the second if there is a public property with the same name.</p>
<p>I have two entities that are generated from a web service proxy, so I can't change the parent class or impliment an interface or anything like that. But I know that the two objects have the same public properties.</p>
| c# | [0] |
4,947,686 | 4,947,687 | how to add internal frame inside a jdialog | <p>i am using the following code :</p>
<pre><code> JDialog d=new JDialog();
JInternalFrame i=new JInternalFrame("HI",false,false,false,false);
i.setPreferredSize(new Dimension(100,100));
d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
d.setTitle("Wait dialog");
d.add(i);
d.pack();
d.setPreferredSize(new Dimension(100,100));
d.setLocation(300,300);
d.setAlwaysOnTop(true);
d.setVisible(true);
</code></pre>
<p>but instead of getting a jdialog of size 100*100, i am getting a small window with the default width and height , why is this happening?
note: I did the same with a JFrame , and i got the result.But i want it on a JDialog.</p>
<p>Thanks in advance</p>
| java | [1] |
1,642,644 | 1,642,645 | From login page text box text to be display on File page lable | <p>Please can any one help me on this. I am using c# , .net, jquery.</p>
<p>I am trying to show login page textbox user id(when user enters) on
file upload page lable. How to write jquery code here. It has to show user id on lable when file upload page load.
I know how to write code for textbox and lable are in same page.</p>
<p>I am trying to call from login page user name text("#ctl00_DefaultContent_UserName")
and display user name to be on file page lable("#ctl00_DefaultContent_lblAddUserWho")</p>
<p>Please chack this and let me how to write correct code in jquery. I am getting object expected error.</p>
<p>I added below jquery code in my file upload page using of page load.</p>
$("#ctl00_DefaultContent_lblAddUserWho").ready(function() {
$("#ctl00_DefaultContent_UserName").text();
});
<p>User
:
</p>
<p>Thanks,
Ravi</p>
| jquery | [5] |
1,492,619 | 1,492,620 | Content Sliding | <p>I have this mark up.</p>
<pre><code><ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Page</a></li>
</ul>
<section id="home">...</section>
<section id="about">...</section>
<section id="page">...</section>
</code></pre>
<p>How can I animate my content?? when about link is clicked the home section moves left and disappear, then about section comes from the right, and about the page section this animation continues. consider that I want to have the reverse animation, too i.e. when s.b click home again the animation reverse and show the home section again..</p>
<p>thanks in advance</p>
| jquery | [5] |
2,692,723 | 2,692,724 | Will two same strings read from the System.in be stored in a common memory location? | <p>Suppose we have program like this:</p>
<pre><code>import java.io.*;
public class ReadString {
public static void main (String[] args) {
// prompt the user to enter their name
System.out.print("Enter your name: ");
// open up standard input
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String userName = null;
String userNameCopy = null;
// read the username from the command-line; need to use try/catch with the
// readLine() method
try {
userName = br.readLine();
System.out.print("Enter your name once again: ");
userNameCopy = br.readLine();
} catch (IOException ioe) {
System.out.println("IO error trying to read your name!");
System.exit(1);
}
System.out.println("Thanks for the name, " + userName);
}
} // end of ReadString class
</code></pre>
<p>Now, if user types his username twice, <code>userName</code> and <code>userNameCopy</code> Strings will have the same value. Since strings are immutable, will Java compiler be smart enough to use only one memory object with the two references to it, or is this behavior reserved only for the string literals hard-coded into the program?</p>
<p>If the answer is "No, compiler will create two separate object on the heap". why is that so? Is it because searching for the exact match from the pool is slow? If it is, couldn't string pool be implemented like some sort of hash table, or something similar?</p>
| java | [1] |
1,635,616 | 1,635,617 | Run my application in background when i start device power on in android | <blockquote>
<p><strong>Possible Duplicates:</strong><br>
<a href="http://stackoverflow.com/questions/2912209/how-to-create-startup-application-in-android">how to create startup application in android?</a><br>
<a href="http://stackoverflow.com/questions/1056570/how-to-autostart-an-android-application">How to Autostart an Android Application?</a> </p>
</blockquote>
<p>Hi,</p>
<p>I am trying in one of my application when i am going to start i mean power on my google android g1 my application automatically will start but i am unable to understand how can
i do that please help......</p>
| android | [4] |
5,492,322 | 5,492,323 | const vs new const | <p>No matter what I Google, there doesn't seem to be an answer for this! In a C# class, what does the new keyword do to a const field?</p>
<p>e.g:</p>
<pre><code>private const int ConstOne = 0;
private new const int ConstTwo = 0;
</code></pre>
| c# | [0] |
1,393,579 | 1,393,580 | Access to classes and functions from outside the application | <p>consider we have a program which manages collision detection between 100 rects(Rectangles).
and we have a class or function for collision detection between two rects (CCollisionCheck or CollidsTo ... for example).
and consider for some rects , we have some conditions which affect the collision detection.
for example we wanna exclude RED rects. or check BLUE rects only against GREEN ones.
any arbitrary condition.</p>
<p>I wanna write the necessary code ,for managing the condition , using my exe classes (CCollisionCheck ) or functions (CollidsTo ...), outside the exe.</p>
<p>can any one help me please?
How can I access my classes and function from outside the application?</p>
| c++ | [6] |
4,623,305 | 4,623,306 | Loading settings from an ini/xml file | <p>How do I load a setting from an external xml file located in the same folder as my program? Or should I be using an old school .ini file? It is only the MySQL server name and a location name that I need to pass to my App.</p>
| c# | [0] |
6,009,752 | 6,009,753 | How to make medical summaries files from java application | <p>I have made a program in Java which is used to collect medical data (personal, diagnosis,treatments) from people with cancer. In this program you fill the forms and all these data are then stored to a database. </p>
<p>Now, what I want to make: if the user selects to see a patient's data, I want to give him the possibility to print the patient's record. I know how to print a file using java. But I don't know how to make such a file, how to form it. I mean it's not just printing "Hello world". It may need tables, colors, etc. How should I do this? Is there a way to make a prototype (ex. doc) file and then through the program fill just the data, or I have to fully form this file through my program? </p>
<p>Hope I was clearly understood!</p>
| java | [1] |
2,708,266 | 2,708,267 | Black status bar turns white when quitting iPhone app | <p>I gave my iPhone app a black status bar by adding the UIStatusBarStyleOpaqueBlack / UIStatusBarStyle to the Info.plist file. It works great most of the time. The black status bar shows when the app is running and when the Default.png is being shown. </p>
<p>The issue is when I quit the app by pressing the home button, the status bar becomes a white block while the iPhone's standard quit animation is taking place. I haven't seen this issue with any other apps that use a black status bar.</p>
<p>Am I missing something?</p>
| iphone | [8] |
5,405,473 | 5,405,474 | how to go to a particular part of the code to execute it in jquery? | <p>Using this snippet code below, how do I loop back to the line that says: </p>
<pre><code> var boxTextWidth = 0;
</code></pre>
<p>and continue excuting from there, like a goto type of execution.
I don't want the $.post line and lines above it to execute</p>
<pre><code> $("#left,#a-z_left").change(function()
{
var getData = $("#left").val() + "_" + $("#a-z_left").val();
$.post("v.php",{table : getData}, function(data)
{
$("#left_list_div ul").html(data).delay(5000);
var boxTextWidth = 0;
var boxWidth = $('#insertData1').innerWidth();
$("#insertData1").each(function()
{
// how to loop back to var boxTextWidth = 0 without executing the $.post line
});
});
});
</code></pre>
| jquery | [5] |
232,961 | 232,962 | PHP check IF non-empty, non-zero | <p>I get the width and height of image with getimagesize function, like below:</p>
<pre><code>list($width,$height) = getimagesize($source_pic);
</code></pre>
<p>How can I use IF condition to check that the getimagesize function executed without error and $width and $height got non-empty, non-zero values?</p>
| php | [2] |
5,068,751 | 5,068,752 | Check what error value is in ajax callback | <p>How can I check what the error value returned is in ajax callback error : </p>
<pre><code>$.ajax({
url: "myurl",
type: 'POST',
dataType : "text",
data : ({
json : myjson
}),
success : function(data) {
},
error : function() {
alert ('error');
}
});
</code></pre>
| jquery | [5] |
4,264,978 | 4,264,979 | Do I need to edit the ServerManagedPolicy in the Android licensing library? | <p>I am using the LicenseChecker and ServerManagedPolicy in the com.google.android.vending.licensing library. I am quite confused though as I review some of the code there. There are comments in ServerManagedPolicy that state the following:</p>
<p>"You must manually call PreferenceObfuscator.commit() to commit these changes to disk."</p>
<p>Am I supposed to be doing this? I don't see any call to the commit() method in the Google code. I thought that by using the ServerManagedPolicy, I would not need to manually edit code in the library.</p>
| android | [4] |
1,623,877 | 1,623,878 | How to store each row of the csv file to array in php | <p>I have data in csv file as follows.</p>
<p>Mr,Vinay,H S,Application Engineer,vinay.hs@springpeople.com,99005809800,Yes
Mr,Mahammad,Hussain,Application Engineer,vinay.hs@springpeople.com,99005809800,Yes</p>
<p>I want to store each row in each array.explain me how to do that </p>
| php | [2] |
3,760,593 | 3,760,594 | jquery toggle display | <p>I'd like to create a list and be able to toggle the display of children items on click. Should be simple but i can't get it to work. Any thoughts?</p>
<pre><code><script>
$(document).ready(function(){
$("dt a").click(function(e){
$(e.target).children("dd").toggle();
});
});
</script>
<style>
dd{display:none;}
</style>
<pre>
<dl>
<dt><a href="/">jQuery</a></dt>
<dd>
<ul>
<li><a href="/src/">Download</a></li>
<li><a href="/docs/">Documentation</a></li>
<li><a href="/blog/">Blog</a></li>
</ul>
</dd>
<dt><a href="/discuss/">Community</a></dt>
<dd>
<ul>
<li><a href="/discuss/">Mailing List</a></li>
<li><a href="/tutorials/">Tutorials</a></li>
<li><a href="/demos/">Demos</a></li>
<li><a href="/plugins/">Plugins</a></li>
</ul>
</dd>
</dl>
</pre>
</code></pre>
| jquery | [5] |
455,079 | 455,080 | ListView Adapter with Dictionary from xml | <p>I want to set an adapter to a ListView where the ListView's items are a Dictionary.
And for localization purposes, I would prefer that the items are defined in xml below the "values" folder.</p>
<p>At the moment, I use a simple list with strings, where the array is defined in \values\arrays.xml</p>
<p>But I don't want to use the index of the selected item in the list - if I sometimes change the order of the items I have to change all the code dependant on this implicit index. Using a defined key would be a lot easier.</p>
<p>How could I do this?</p>
| android | [4] |
1,498,436 | 1,498,437 | Race condition between Application onCreate and resources loaded? | <p>I have the following application class for my app. When the application starts, I want to get some settings from preferences and start a background service.</p>
<pre><code>public class MyApplication extends Application {
public void onCreate() {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
String key = getResources().getString(R.string.prefkey_updateinterval);
...
}
</code></pre>
<p>This normally works fine, but occasionally when starting my program from eclipse "Run" I get this error:</p>
<pre><code>10-10 08:25:47.016: E/AndroidRuntime(26402): Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x7f0a0004
10-10 08:25:47.016: E/AndroidRuntime(26402): at android.content.res.Resources.getText(Resources.java:216)
10-10 08:25:47.016: E/AndroidRuntime(26402): at android.content.res.Resources.getString(Resources.java:269)
10-10 08:25:47.016: E/AndroidRuntime(26402): at com.karwosts.MyApp.PortfolioStore.onCreate(PortfolioStore.java:40)
10-10 08:25:47.016: E/AndroidRuntime(26402): at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:969)
10-10 08:25:47.016: E/AndroidRuntime(26402): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3395)
</code></pre>
<p>This id is from my R.java:</p>
<pre><code>public static final int prefkey_updateinterval=0x7f0a0004;
</code></pre>
<p>Since this works fine most of the time, I have to assume that there is some kind of race condition between onCreate and the resources being loaded? </p>
<p>If that's the case, is it recommended not to read resources in Application onCreate? </p>
<p>If so, is there a better place to initialize a service when application launches? </p>
| android | [4] |
228,130 | 228,131 | find hour or minute difference between 2 java.sql.Timestamps? | <p>I store a java.sql.Timestamp in a postgresql database as Timestamp data type and I want to find out the difference in minutes or hours from the one stored in the DB to the current timestamp. What is the best way about doing this? are there built in methods for it or do I have to convert it to long or something?</p>
| java | [1] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.