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 |
---|---|---|---|---|---|
62,323 | 62,324 |
Regarding xml parsing in iphone
|
<p>I am developing an application in which I am doing XML parsing. I found an error in the <code>[xmlparse parse]</code> method.</p>
<p>Error:</p>
<pre><code>[NSCFString bytes]: unrecognized selector sent to instance 0x3df6310
2010-04-30 00:09:46.302 SPCiphone2[4234:1003] void SendDelegateMessage
(NSInvocation*): delegate (<CFNotificationCenter 0x3d09670 [0x87dca0]>)
failed to return after waiting 10 seconds. main run loop mode:
kCFRunLoopDefaultMode
</code></pre>
<p>Code snippet:</p>
<pre><code>responseOfWebResultData = [[NSMutableString alloc]
initWithData:responseData
encoding:NSUTF8StringEncoding];
NSLog(@"result: %@", responseOfWebResultData);
// starting the XML parsing
if (responseOfWebResultData) {
@try {
xmlParser = [[NSXMLParser alloc] initWithData:responseOfWebResultData];
[xmlParser setDelegate:self];
[xmlParser setShouldResolveExternalEntities:YES];
[xmlParser parse];
[responseOfWebResultData release];
}
@catch (NSException *e) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Please"
message:[e reason]
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
}
}
</code></pre>
|
iphone
|
[8]
|
709,325 | 709,326 |
Output buffering - Echo values dynamically?
|
<p>I want to echo string dynamically, not all of them at once when script finished running. Tried this one, but it echos all of them when script finished running. How can I echo values dynamically ?</p>
<pre><code><?php
ob_start();
echo "Line #1...<br>";
ob_flush();
flush();
sleep(2);
echo "Line #2...<br>";
ob_flush();
flush();
sleep(2);
echo "Line #4...<br>";
?>
</code></pre>
|
php
|
[2]
|
5,466,957 | 5,466,958 |
question regarding Echoclient program
|
<p>I am always getting the message Don't know about host: taranis. while running echoclient program. here is the program below</p>
<pre><code>import java.io.*;
import java.net.*;
public class EchoClient {
public static void main(String[] args) throws IOException {
Socket echoSocket = null;
PrintWriter out = null;
BufferedReader in = null;
try {
echoSocket = new Socket("taranis",3218);
out = new PrintWriter(echoSocket.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(
echoSocket.getInputStream()));
} catch (UnknownHostException e) {
System.err.println("Don't know about host: taranis.");
System.exit(1);
} catch (IOException e) {
System.err.println("Couldn't get I/O for "
+ "the connection to: taranis.");
System.exit(1);
}
BufferedReader stdIn = new BufferedReader(
new InputStreamReader(System.in));
String userInput;
while ((userInput = stdIn.readLine()) != null) {
out.println(userInput);
System.out.println("echo: " + in.readLine());
}
out.close();
in.close();
stdIn.close();
echoSocket.close();
}
}
</code></pre>
|
java
|
[1]
|
4,988,647 | 4,988,648 |
How to fix the invisible space problem in PHP?
|
<p>As a result,functions like <code>session_start</code> and <code>setcookie</code> can't run successfully,reporting:</p>
<blockquote>
<p>Cannot modify header information -
headers already sent by</p>
</blockquote>
<p>But the target file is like this:</p>
<pre><code>1 <?php
2 session_start();
</code></pre>
<p>How to fix it?</p>
<p><strong>FOUNDINGS</strong></p>
<p>I've found the problem,the utf-8 formated files become utf-8+BOM after uploading to the server,so I've temporarily solved the problem by saving it as utf-8 again.</p>
<p><strong>BUT</strong>,there are lots of other files with the same problem,how can I batch solve the issue?</p>
|
php
|
[2]
|
5,440,162 | 5,440,163 |
data filtering in gridview using jquery
|
<p>i have done the data filteration in gridview as like </p>
<p><a href="http://tomcoote.co.uk/wp-content/CodeBank/Demos/columnFilters/demo.html" rel="nofollow">http://tomcoote.co.uk/wp-content/CodeBank/Demos/columnFilters/demo.html</a><br>
on this page. But my requirement is some different from it. I Have a textbox outside the gridview i want to filter data according to this. please help me as soon as possible.</p>
<p>Thanks In advance.</p>
|
jquery
|
[5]
|
1,163,371 | 1,163,372 |
is it possible to make a mirror application in android
|
<p>Hey is this possible to make an application which can be used to see the image of our own like we did in the mirror ie the application should be act like a hand held mirror
dont want to use the camera but want to make screen Act as mirror</p>
|
android
|
[4]
|
1,835,537 | 1,835,538 |
Is the visibleRect method also available on iPhone? How do I find it out?
|
<p>Apple says that there is a visibleRect method on the mac (<a href="http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaViewsGuide/Coordinates/Coordinates.html" rel="nofollow">Source</a>), that helps doing graphic operations only in the visible content rectangle from an view.</p>
<p>When I try to access that method, XCode gives me no completion hint, so it seems that this one is not available on iPhone. How could I find that out?</p>
|
iphone
|
[8]
|
2,489,551 | 2,489,552 |
Using a lot of hardcoded strings in code
|
<p>When I am looking at my code and I am writing things like..</p>
<pre><code>if (role == "Customer")
{
bCustomer = true;
}
else if (role == "Branch")
{
bIsBranch = true;
}
</code></pre>
<p>Or</p>
<pre><code>foreach(DataRow as row in myDataSet.Tables[0].Rows)
{
row["someField"]=somefield.Tostring()
}
</code></pre>
<p>Are you guys doing this? When is this ok to do and when shouldn't you be doing this? What if any would be a better approach to write this if any?</p>
<p>Thanks For the Comments: I guess I should add what if (for this example purposes) I am only using this role comparison once? Is it still a better idea to make a whole new class? Also should I have 1 class called "constants" are multiple classes that that hold specific constants, like "roles" class for example?</p>
|
c#
|
[0]
|
2,060,787 | 2,060,788 |
Is there a clean way to write multiline statements in JavaScript?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/805107/multiline-strings-in-javascript">Multiline strings in Javascript</a> </p>
</blockquote>
<p>I'm a php developer very new to js. In php I use heredoc a lot for multi-line variable values or print statements. In js, is there any way to easily write these without having to resort to messy code like this:</p>
<pre><code>var animals = 'dog'+
'cat'+
'bird'+
etc...
</code></pre>
|
javascript
|
[3]
|
3,944,305 | 3,944,306 |
click - only on "direct" onclicks
|
<p>If you put a .click() on a div element and you got an input element in the div.. how can you then omit the .click() if the user clicks on the input?</p>
<p>The div.click() only has to trigger when the user click inside the div, but outside the input element</p>
<pre><code><div style="width:400px; height:200px">
<input type="text" style="width:50px" />
</div>
</code></pre>
|
jquery
|
[5]
|
3,463,698 | 3,463,699 |
What is android?
|
<p>What is android?I just want to know what actually android is and what is so hype about that??</p>
|
android
|
[4]
|
4,001,571 | 4,001,572 |
how to login to another site via PHP
|
<p>I wanted to find out how to login to another site via PHP... I don't know the proper term for it, but basically, I want a user to be able to enter their login information for another website on mine, and interact with it through mine.Is there any tutorial?
thanks</p>
|
php
|
[2]
|
2,280,553 | 2,280,554 |
PHP Function error handling and returning when foreach loop goes on a variable
|
<p>*<strong><em>problem/confusion on how to handle this type problem in the php object oriented coding *</em></strong> </p>
<p>I have customer class which i need to suspend services for customers, however when the customer has pending work types for a service, i need to return a false for the calling function to do the error handle (i cant do it here becos it could be a email,output, or html) </p>
<p>however i am confused how to handle this as if use following code it will return false only on the last condition on the foreach loop i guess, any idea on how to handle this in the coding point of view</p>
<pre><code> /**
* return false on failier
* Customer suspend all services for this customer
*
*/
public function suspendServices(){
$pending=false;
foreach ($this->services() as $service) {
$pending = $service->hasPendingWorktypes();
if($pending === true) {
return false;
}
$service->state()->changeTo(8);
}//end of foreach services
}//end of function
</code></pre>
|
php
|
[2]
|
1,513,054 | 1,513,055 |
Iterating over os.walk in linux
|
<p>We have multiple linux server and i would like to get all the details of files and directories in a particular linux server. I know this can be done with os.walk function but it is storing only single file information. Please find the below code</p>
<pre><code>import os
for d in os.walk('/'):
F = open('/home/david/Desktop/datafile.txt', 'w')
F.write(str(d) + '\n')
F.close()
</code></pre>
<p>Thanks in advance</p>
|
python
|
[7]
|
3,528,716 | 3,528,717 |
How to pass the latitude and longitude values to the ns url as a arguments?
|
<p>Iam developing one application.In that i use the google api for getting the location information.For that i use the CLLocationManager for getting the location latitude and longitude values.And my pblm is how to pass these latitude and longitude values to nsurl .ANd iam directly given the one location values to the url like below.</p>
<pre><code> NSURL *URL = [NSURL URLWithString:@"https://maps.googleapis.com/maps/api/place/search /json?location=40.7143528,-74.0059731&radius=10000&types=school&sensor=false&key=AIzaSyDbiWWIOmc08YSb9DAkdyTWXh_PirVuXpM"];
</code></pre>
<p>I write this one in below method for get and pass the latitude and longitude values.</p>
<pre><code> - (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
}
</code></pre>
<p>So please tell me how to pass the newlocation.Coordinates.latitude and newlocation.Coordinates.longitude to that url in that method.</p>
<p>With others suggestions i changed the code like below.</p>
<pre><code> - (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
NSString *address = [NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/place/search/json?location=%f, %f&radius=10000&types=school&sensor=false&key=AIzaSyDbiWWIOmc08YSb9DAkdyTWXh_PirVuXpM", newLocation.lattitude, newLocation.longitude];
NSURL *url = [NSURL URLFromString:address];
}
</code></pre>
<p>This also gives the error like Exe_Bad_Access when the first line executed.SO please tell me how to write that one.</p>
|
iphone
|
[8]
|
3,080,488 | 3,080,489 |
Is it possible to integrate the wave launcher with other applications?
|
<p>I wanted to integrate the wave launcher app with my app that I am building, so I could display the menu page of my app in that wave form. Is there any way to do it? </p>
|
android
|
[4]
|
2,585,996 | 2,585,997 |
Android POST JSON OBJECT - How to set $_POST Index
|
<p>i have a JSONObject which i want to POST to a server. </p>
<p>Here is the Code:</p>
<pre><code>JSONObject obj = new JSONObject();
for(int k = 0; k<len;k++){
obj.put("nachrichten_ids", params[k]);
}
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost("xxxxx");
HttpEntity entity;
StringEntity s = new StringEntity(obj.toString());
s.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
entity = s;
httpPost.setEntity(entity);
HttpResponse response;
response = httpClient.execute(httpPost);
</code></pre>
<p>By doing Log.i("TEST",obj) i get the JSON object:</p>
<p><strong>{"nachrichten_ids":"[2144,2138]"}</strong></p>
<p>That data is send to the server. But i cant access it:
<strong>There is no $_POST index.</strong> (PHP)</p>
<p>How to set a index, so that i can access the json object, <strong>like $_POST['nachrichten_ids']</strong>.
I had to work with that data then e.g with php json_decode()</p>
<p>Any idea ?</p>
<p>Thanks</p>
|
android
|
[4]
|
4,885,569 | 4,885,570 |
unable to create text area using javascript
|
<p>I want to design a simple text area using javascript. I am using the following function</p>
<pre><code> function add2(type) {
var element = document.createElement("input");
var label=prompt("Enter the name for lable","label");
document.getElementById('raj').innerHTML=document.getElementById('raj').innerHTML+label;
element.setAttribute("type", type);
element.setAttribute("name", type);
element.setAttribute("cols",20);
element.setAttribute("rows",50);
var rohit = document.getElementById("raj");
rohit.appendChild(element);
document.getElementById('raj').innerHTML=document.getElementById('raj').innerHTML+"<br/>";
}
</code></pre>
<p>I am using this function in my HTML code as follow : </p>
<pre><code><input type="button" value="Text Area" onclick="add2('textarea')">
</code></pre>
<p>But when I am executing this code, it is creating only a simple text box. what should I do ??</p>
<p>Thanks</p>
|
javascript
|
[3]
|
999,485 | 999,486 |
How to get website show design alignment better in iPhone and iPad without breaking its style
|
<p>thanks in advance..</p>
<p>I am working with a website that works well in most browsers (all I have tested) but in iPhone (4) with ios5 an ipad it doesn't look that nice.
How can I set this website to force iPhone (and iPads) to show without any issues?</p>
|
iphone
|
[8]
|
564,803 | 564,804 |
Specify default value for a reference type
|
<p>As I understand default(object) where 'object' is any reference type always returns null, but can I specify what a default is? For instance, I want default(object) == new object();</p>
<p>Jon Skeet, help me! :)</p>
|
c#
|
[0]
|
4,555,650 | 4,555,651 |
jQuery different click() function for an element within another element with a click()
|
<p>on my website I have a sidebar panel, which has two tabs that when clicked switch the content beneath. on the <code><li></code> for these tabs I have a jQuery <code>click()</code> event to switch the tabs. Please see the screengrab for what I mean</p>
<p><img src="http://cci.epiphanydev2.co.uk/Home_1281538687319.png" alt="alt text"></p>
<p>This was all working fine until our designer wanted the RSS feed link within the <code><li></code>, so now when I click on the RSS feed icon, it is being overridden by the <code>click()</code> function on the <code><li></code></p>
<p>My jQuery so far for the tabs is as follows:</p>
<pre><code>//NEWS PANEL
$("div.switch-tab div.listing-box").hide();
$(".news ul.tabs li:first").addClass("active").show();
$("div.switch-tab div.listing-box:first").show();
$(".news ul.tabs li").click(function() {
$(".news ul.tabs li").removeClass("active");
$(this).addClass("active");
$("div.switch-tab div.listing-box").hide();
var activeTab = $(this).find("a").attr("href");
$(activeTab).fadeIn();
return false;
});
// ATTEMPT TO OVERRIDE
$(".news ul.tabs li a.feed").click(function() {
return true;
});
//END NEWS PANEL
</code></pre>
<p>Any idea how I can get round this?</p>
|
jquery
|
[5]
|
3,427,375 | 3,427,376 |
how to set a null value for DefultValue of a property
|
<p>i have 4 properties
like these</p>
<pre><code> public string strLastName { get; set; }
public string strSpeciality { get; set; }
public string strProfession { get; set; }
public string strUserName { get; set; }
public string strPassword { get; set; }
public string strRegDate { get; set; }
</code></pre>
<p>now how can i set NULL Value for strRegDate property?
i don't want use IF statement,
thanks</p>
|
asp.net
|
[9]
|
2,591,398 | 2,591,399 |
C++ - Instantiate derived class depending on context
|
<p>let's say I have 200 classes named class1, class2, etc derived from class, and a integer between 1 and 200. Is there a way to instanciate specifically one of the derived class depending on the value of my integer? Obviously I could just manually check for every value but I am wondering is there is anything in C++ that is more flexible</p>
|
c++
|
[6]
|
905,359 | 905,360 |
Change an input field before submit
|
<p>I have to encode a domain name (IDNA) for a particular registrar using accents.</p>
<p>I have a simple input field :</p>
<pre><code><input type="text" id="idndomain" name="sld[0]" size="40" />
</code></pre>
<p>My jQuery function</p>
<pre><code>$(document).ready(function() {
$('#domainform').submit(function(){
$.getJSON("includes/idna/idna.php", {
domain: $("input#idndomain").val()
}, function(data){
$("div#result").html($('<b>' + data.encoded + '</b>'));
$('#idndomain').val(data.encoded);
});
return true;
});
});
</code></pre>
<p>So i'm sending a query to idna.php which encodes the domain name and returns a json array :</p>
<pre><code>{"encoded":"xn--caf-dma.ch"}
</code></pre>
<p>Problem is that the form is being submited with the 'original' value, not the value returned by the json query.</p>
<p>Question is : how to 'wait' for json result first, replace the input field with the encoded string and them submit ?</p>
|
jquery
|
[5]
|
5,019,209 | 5,019,210 |
PHP OOP Programming - How To Apply
|
<p>Hi I'm trying to move away from procedural programming and at the same time have a better appreciation for design patterns. I would like to know what Design Pattern can best represent the code below. It's an if else statement that basically outputs a value based on the time of day. This is just a sample of several if/else if statement I have in the code. Which OOP Pattern is appropriate (Iterator, Singleton, Factory.. )?</p>
<pre><code>if($dayval == "Sun" && $date >= 0 && $date < 18) {
$timemax = 18;
$timeleft = ($timemax - $date);
if($timeleft == 1) {
$arr = array('tstatus' => 'Trading begins today at 6:00pm (less than '. $timeleft. ' hour to go) - have a great trade week!',
'tcode' => 'closed');
}
else {
$arr = array('tstatus' => 'Trading begins today at 6:00pm (less than ' .$timeleft. ' hours to go) - have a great trade week!',
'tcode' => 'closed'
);
}
echo json_encode($arr);
}
else if($dayval == "Sun" && $date >= 18 && $date < 19) {
$timemax = 19;
$timeleft = ($timemax - $date);
if($timeleft == 1) {
$arr = array('tstatus' => 'Asian Market opening in less than ' .$timeleft. ' hour',
'tcode' => 'closed');
}
else {
$arr = array('tstatus' => 'Asian Market opening in less than ' .$timeleft. ' hours',
'tcode' => 'closed'
);
}
echo json_encode($arr);
</code></pre>
|
php
|
[2]
|
2,753,198 | 2,753,199 |
Can anyone explain this simple Javascript behaviour?
|
<pre><code>function cat() {
this.Execute = new function() {
alert('meow');
}
}
var kitty = new cat();
</code></pre>
<p><a href="http://jsfiddle.net/PaDxk/1/" rel="nofollow">http://jsfiddle.net/PaDxk/1/</a></p>
<p>Why does it do that? I haven't told it to run the function.</p>
|
javascript
|
[3]
|
1,502,219 | 1,502,220 |
Template object of different data type than template parameter
|
<p>I have a templated class, and I want a member-function takes in an object of that class with any template parameter. So it should be able to run something like:</p>
<pre><code>main(){
A<double> object1;
A<double> object2;
A<int> object3;
object1.f(object2);
object1.f(object3);
}
</code></pre>
<p>This is what I have so far, but it doesn't seem to work because it assumes that the argument must be of the exact same type as the calling object:</p>
<pre><code>template<typename T>
class A
{
void f(A<T> &a);
}
</code></pre>
<p>Any ideas? Thanks in advance.</p>
|
c++
|
[6]
|
5,501,129 | 5,501,130 |
Image Recognition ApI in android
|
<p>I am developing an app that help user to recognize image.Is there any api in android so that i can use it for image recognition.Image recognition means user take picture of any thing and application tell which image user taken .please help me.</p>
<p>Thanks in advance</p>
|
android
|
[4]
|
2,284,844 | 2,284,845 |
delete a folder in java
|
<p>The folder I need to delete is one that is created from my program. The directory is not the same on every pc so the folder code I am using is </p>
<pre><code>userprofile+"\\Downloads\\Software_Tokens"
</code></pre>
<p>There will be files in, so I guess i need to recursively delete it. I looked at some samples for that here but it never accepts my path. The path works fine in the code as an environmental variable, because i added code for it </p>
<p><code>static String userprofile = System.getenv("USERPROFILE");</code> </p>
<p>so can someone just show me the code with my path plugged please?</p>
|
java
|
[1]
|
3,407,853 | 3,407,854 |
How to write in table of an html file by clicking on a row of a table in another html file?
|
<p>I have two html files information.html and employee.html.</p>
<p>Information.html contains two tables having IDs 'top' and 'bottom'. Employee.html is included in the <code><table id='top'></code> of information.html.</p>
<p>Employee.html's code, containing just a dummy <code><table></code>, is as follows:</p>
<pre><code><!-- employee.html -->
<table align = "center" border="1" height="100px">
<tr></b><td><b>No.</b></td><td><b>Name</b></td><td><b>Age</b></td></tr>
<script type="text/javascript">
var i =0;
for (i= 0;i<20;i++)
{
document.write("<tr onclick= '---' ><td><b>" + i);
document.write("</b></td><td>Usman</td><td>56</td></tr>");
}
</script>
</table>
</code></pre>
<p>When i open information.html in my browser, i see employee.html included in the <code><table id='top'></code> of information.html.</p>
<p>Now, what should i write in <strong>onclick</strong> (in the above code) so that when user click on a row in the table appearing in the 'top' table of information.html, some arbitrary text may appear in the <code><table id='bottom'></code> of information.html.</p>
<p>Please guide me. </p>
<p>Thanks</p>
|
javascript
|
[3]
|
3,899,018 | 3,899,019 |
Is better: <a href="/test" onclick="T.actions.addFriend(profileId)">add friend</a> or ...?
|
<p>Is better: <code><a href="/test" onclick="T.actions.addFriend(profileId)">add friend</a></code> </p>
<p>or </p>
<pre><code><a href="/test" class="add-friend-button">add friend</a>
</code></pre>
<p>and then with the Javascript select the "add-friend-button" class and add a click event?</p>
|
javascript
|
[3]
|
3,246,480 | 3,246,481 |
MIPS, the Android Market, 3.0 SDK and JNI
|
<p>Not a bits, bytes, algorithm and syntax question... but a technology development and business one. Hope that's ok.</p>
<p>At CES 2011, mips.com unveiled new MIPS-processor based smart phones running Android. By what I've read, it sounds like these either might be Chinese-market only (which, lets face it... is huge) or part of a big push by MIPS to elbow into ARM's territory.</p>
<p>Here are problems I see:<br>
- Google only provide first-class support for ARM. Their SDKs are ARM-only. Does anyone know if they have plans to adopt MIPS?<br>
- The Android Market is ARM-only, as far as I can tell. It looks like companies like Velocity Micro (and their little MIPS-based Cruz tablet) have their own "Cruz Market". I think that's awful. Is the Android Market going to be the one-stop shop for Android, or are things fragmenting even more?<br>
- The JNI breaks the processor-independence of the VM. Can multiple processor-specific JNI libraries be packaged into a single app? MIPS binaries aren't exactly small.</p>
<p>Does anyone out there have a crystal ball on these things? Let the assumption be: MIPS won't just go away.</p>
<p>TL;DR: Anyone know WTF is going on with MIPS?</p>
|
android
|
[4]
|
4,438,798 | 4,438,799 |
Is there any compelling reason for me to un-static this method?
|
<p>I have this SaveCheckedStateToDB() function:</p>
<pre><code>public class oDaA_DBUtils {
// TOOD: Perhaps this should not be static, and I should force callers to instantiate the class first?
public static void SaveCheckedStateToDB(int AOptionSelected, String id, boolean AToggledOn)
{
//
}
}
</code></pre>
<p>...that I changed to "static" after getting static about calling it from here prior to adding the "static" keyword:</p>
<pre><code> cbOnDemand.setOnCheckedChangeListener(new OnCheckedChangeListener()
{
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
{
// Contact id is a string?
oDaA_DBUtils.SaveCheckedStateToDB(oDaA_Consts.ALERT_ON_DEMAND, id, isChecked);
}
});
</code></pre>
<p>Now it compiles, but is that a "wrong" way of working? Should I remove the "static" appendage/decoration and force callers to instantiate the class prior to calling SaveCheckedStateToDB()?</p>
|
android
|
[4]
|
4,904,185 | 4,904,186 |
calculating FPS in Javascript less than 1 millisecond
|
<p>Is it possible to measure time gaps less than 1 milliseconds that is supported in all browsers i know of only one way which is in Chrome.</p>
<p>The chrome method : <code>window.performance.now()</code></p>
<p>Currently i do FPS measurements in millisecond time spaces, but if less than 1ms passes i get infinity because the two numbers are rounded to nearest millisecond so they are the same value.</p>
<p>Does any one know a cross browser function calculate less than 1 millisecond time gaps in javascript?</p>
|
javascript
|
[3]
|
1,534,406 | 1,534,407 |
jCarousel: No width/height set for items. This will cause an infinite loop. Aborting
|
<p>I am using JCarousel in my websitewhich retreives the data from the database and binds dynamically....when i click on a picture inside JCarousel for the first time it works well but for the second time it throws this error :</p>
<pre><code> ****S is undefined in common.ashx****
</code></pre>
<p>But i am not at all using a file called common.ashx in my application...Exactly i dont know the reason for this error...
<strong>Is it due to JCarousel or ASP.Net</strong></p>
<p>Once this error occurs the total JCarousal is not working at all and pictures are not retreived from the data base.... :(</p>
<p>Can anyone say whats the reason for this error (or) which causes this error to occur...and provide ideas to solve this issue....</p>
|
asp.net
|
[9]
|
455,190 | 455,191 |
jQuery edit-in-place with dynamic content
|
<p>On my website I add elements to DOM this way</p>
<pre><code>$('#header').load('header.html #template');
</code></pre>
<p>So I load the contents of an external html file into the DOM. Then I call</p>
<pre><code>$('.edit').editInPlace({
callback: function(){
alert("test");
}
});
</code></pre>
<p>The loaded content contains a <code>h2 with edit css</code> class.</p>
<p>But there is no reaction at all. I tried many edit-in-place plugins. With all I had the same problem. Any ideas why? How do I solve this?</p>
|
jquery
|
[5]
|
5,841,981 | 5,841,982 |
remove new div after 5 seconds
|
<p>i want to add a div and after 5 seconds remove it.
i tried</p>
<pre><code>$("#mainContentTD").prepend("<div style='color: #038a00; padding-bottom:10px;'>Your detailes where sucsesfuly... </div>").delay(5000).remove("this:first-child");
</code></pre>
|
jquery
|
[5]
|
889,344 | 889,345 |
Python loop controler continue is not working properly
|
<p>As I know, "continue" will jump back to the top of the loop. But in my case it's not jumping back, continue don't like me :(</p>
<pre><code>for cases in files:
if ('python' in cases.split()):
execute_python_scripts(cases.split())
elif run_test_case(cases.split()):
continue
else:
logger("I am here")
break
</code></pre>
<p>In my case <code>run_test_case()</code> gives 1, 2, 3, 4 etc... But it always performs first(1) and jump to the else part. So I am getting the "I am here" message. It should not work like this. As I am using "continue", it should jump to the for loop.</p>
<p>Following is the <code>run_test_case()</code>:</p>
<pre><code>def run_test_case(job):
for x in job:
num_of_cases = num_of_cases - 1
test_type = x.split('/')
logger(log_file,"Currently "+ x +"hai!!")
if test_type[0] == 'volume':
backdoor = test_type[1].split("_")
if backdoor[0] == 'backdoor':
return get_all_nas_logs()
else:
if perform_volume_operations(x,num_of_cases) == False:
return False
else:
logger(log_file,"wrong ha!!")
</code></pre>
<p>Why is it always going to the else part, without jumping back to the for loop? Thanks in advance.</p>
|
python
|
[7]
|
1,086,411 | 1,086,412 |
JQuery toggle plus/minus button icon and animate image on click
|
<p>I have a div containing list items, a photo, and a plus/minus icon at the bottom of the div.</p>
<p>The list items are absolutely positioned behind the photo. When I click on the plus button I want it to change to minus and animate the photo 29px from the top revealing the list-items behind it. Then I want to click the minus button changing it back to plus and animate the photo back up to the top. </p>
<p>I'm trying to accomplish something very similar to what you see on <a href="http://blog.kyanmedia.com/archives/2008/12/10/easy_image_rollovers/" rel="nofollow">Kyanmedia.com</a>. Except their images animate down and up on hover. I want my image to animate down then up on click and toggle the plus/minus image. I've tried this but it doesn't work.</p>
<pre><code>$(document).ready(function() {
$('#btn_switch').click(function () {
$(this).addClass('on')
$('.photo').animate({ top: '29px'}, 500);
}, function() {
$(this).removeClass('on')
$('.photo').animate({ top: '0px'}, 500);
});
});
</code></pre>
|
jquery
|
[5]
|
213,361 | 213,362 |
jquery how to manipulate img attributes in user selection in editable iframe
|
<p>I need to make some actions with imgs in selection in editable iframe. I can do it with ALL images (here is code, for example)
<code>$(iframe).contents().find('img').attr('alt', 'new alt')</code> but I need ONLY img WITHIN user selection. Help me please. Thanks</p>
|
jquery
|
[5]
|
720,801 | 720,802 |
decoding php code?
|
<p>Can someone help me decode this :</p>
<pre><code>@preg_replace("\x26\50\x5b\136\x3e\135\x2b\51\x26\151\x73\145","\x65\166\x61\154\x28\47\x24\171\x6b\146\x3d\67\x31\65\x39\65\x3b\47\x2e\142\x61\163\x65\66\x34\137\x64\145\x63\157\x64\145\x28\151\x6d\160\x6c\157\x64\145\x28\42\x5c\156\x22\54\x66\151\x6c\145\x28\142\x61\163\x65\66\x34\137\x64\145\x63\157\x64\145\x28\42\x5c\61\x22\51\x29\51\x29\51\x3b\44\x79\153\x66\75\x37\61\x35\71\x35\73","\x4c\62\x68\166\x62\127\x55\166\x64\62\x6c\165\x62\127\x39\171\x5a\123\x39\167\x64\127\x4a\163\x61\127\x4e\146\x61\110\x52\164\x62\103\x39\63\x63\103\x31\160\x62\155\x4e\163\x64\127\x52\154\x63\171\x39\161\x63\171\x39\152\x59\127\x4e\157\x5a\123\x38\165\x4a\124\x67\171\x4f\105\x55\154\x4d\104\x41\170\x4d\171\x56\103\x4f\105\x59\172\x4a\125\x4a\104\x4d\125\x49\154\x51\152\x49\171\x51\151\x55\60\x52\152\x55\63");
</code></pre>
<p>found this on a hacked wordpress ...</p>
<p>How to decode this code ?</p>
|
php
|
[2]
|
1,389,695 | 1,389,696 |
How to use jquery next() to select next div by class
|
<p>I'm fairly new to jquery and struggling with something that should be fairly simple. I want to select the previous and next div with class "MenuItem" from the div with class "MenuItemSelected".</p>
<p>HTML</p>
<pre><code> <div id="MenuContainer" class="MenuContainer">
<div id="MainMenu" class="MainMenu">
<div class="MenuItem">
<div class="MenuItemText">Menu Item #1</div>
<div class="MenuItemImage">images/test1.jpg</div>
</div>
<div class="MenuDividerContainer">
<div class="MenuDivider"></div>
</div>
<div class="MenuItem MenuItemSelected">
<div class="MenuItemText">Menu Item #2</div>
<div class="MenuItemImage">images/test2.jpg</div>
</div>
<div class="MenuDividerContainer">
<div class="MenuDivider"></div>
</div>
<div class="MenuItem">
<div class="MenuItemText">Menu Item #3</div>
<div class="MenuItemImage">images/test3.jpg</div>
</div>
</div>
</code></pre>
<p>Here is the jquery for next that I thought should have worked.</p>
<pre><code>$('div.MenuItemSelected').next('.MenuItem');
</code></pre>
<p>I also tried</p>
<pre><code>$('div.MenuItemSelected').nextAll('.MenuItem');
</code></pre>
<p>The only thing i could get to work is </p>
<pre><code>$('div.MenuItemSelected').next().next();
</code></pre>
<p>That seems hokey, any ideas?</p>
<p>Thanks.</p>
|
jquery
|
[5]
|
2,037,784 | 2,037,785 |
PHP 6.0 - Roadmap?
|
<p><a href="http://news.php.net/php.internals/47120">With the recent announcement</a> that PHP 6 development has been halted, I'm confused as to what the PHP 5.x and 6.x road map includes.</p>
<p>The current version of PHP is 5.3.2.</p>
<p>There were quite a few significant features to come in PHP 6.0, such as:</p>
<ul>
<li>APC include for automatic bytecode caching</li>
<li>Unicode support</li>
<li>etc..</li>
</ul>
<p>Question: What is the new road map of PHP given 6.0 has been canceled? What major features will be available next and in what release?</p>
|
php
|
[2]
|
5,510,025 | 5,510,026 |
Using if statement inside for loop - Javascript
|
<p>I have a Javascript For Loop...</p>
<pre><code>var CookieName = "Tab,EduTab,EduTab,user";
var tString = CookieName.split(',');
for(i = 0; i < tString.length; i++){
if (tString[i] == "EduTab") {
document.write("<b>"+tString[i]+"<b>");
} else {
document.write(tString[i]);
}
}
</code></pre>
<p>For some reason it is failing to bold the 'EduTab'. It will either bold the entire array CookieName or none at all. Any help would be awesome. Thanks.</p>
|
javascript
|
[3]
|
5,664,380 | 5,664,381 |
How to use jweb1t API for extracting a particular word/phrase frequency.
|
<p>I need to find sentence similarity using jweb1t API for which I need to find frequency of words (unigram) and phrase (trigram). So how to use jweb1t API for extracting a particular word/phrase frequency. </p>
|
java
|
[1]
|
3,428,779 | 3,428,780 |
Android LivePerson Agent?
|
<p>Is there a liveperson agent for android? Specificly one which pushes notifications to your phone when people request a chat.</p>
|
android
|
[4]
|
998,648 | 998,649 |
Run c# .exe file without installing it (Include DLLs)
|
<p>I am using c# Desktop base application in Visual Studio 2008 which is zip maker so i want to make .exe file must run without installing it. So can anyone help me to do this?</p>
<p>I want to include all .dll file in that exe and want to run it without installing it.</p>
|
c#
|
[0]
|
4,606,796 | 4,606,797 |
Addressing multi-dimentional arraylists
|
<p>I'm attempting a radix sort but I'm having trouble addressing arraylists of arraylists. The list has 10 spaces, each with a bucket of size n. </p>
<pre><code>ArrayList<ArrayList<Integer>> list = new ArrayList<ArrayList<Integer>>(10);
ArrayList<Integer> bucket = new ArrayList<>();
bucket.add(99);
list.add(bucket);
list.add(bucket);
list.get(0).add(12); (6)
</code></pre>
<p>When I attempt to add in a value using (6) it adds 12 for each arraylist within list (presumably because they are both buckets). How can I initialize the arraylist properly such that I treat each arraylist in list independently? And would I access the elements of each arraylist in list in a similar fashion?</p>
<p>Thanks</p>
|
java
|
[1]
|
5,844,392 | 5,844,393 |
What to use thread or Services for android multiplayer game app
|
<p>Need some help. So I am creating a multiplayer game app in android. Basically I have simultaneous thread running at the same time like UI thread, gameEngine thread, connect to server thread. Right now my app is using around 80% of the CPU resource. I think the cause of this has to do with the multiple threads. Is this normal?</p>
<p>So my question is do I use services for connecting to the server? or thread is fine? What is typical CPU usage for game app specially multiplayer game app?</p>
<p>Thanks. :) </p>
|
android
|
[4]
|
3,604,789 | 3,604,790 |
Good book for programming games in C++
|
<p>i am interested in game programming. I already have a good background on java programming, and I am learing C++ during the summer. I thought of buying this book:</p>
<p><a href="http://rads.stackoverflow.com/amzn/click/1435458869" rel="nofollow">http://www.amazon.co.uk/Mathematics-Game-Programming-Computer-Graphics/dp/1435458869/ref=sr_1_1?s=books&ie=UTF8&qid=1305979849&sr=1-1</a></p>
<p>Any more suggestions? or any better books you would suggest? thanks</p>
|
c++
|
[6]
|
1,783,318 | 1,783,319 |
recover message discarded in GCM
|
<p>i want to ask about GCM. in document of google <a href="http://developer.android.com/google/gcm/adv.html#collapsible" rel="nofollow">GCM</a></p>
<p>note that 100 message stored without discard in case application is offline and i have much than 100 message from server sent to GCM my application should respond by syncing with the server to recover the discarded messages.so how to sync i should? thank you so much</p>
|
android
|
[4]
|
2,766,061 | 2,766,062 |
Get the number of unread mails on an Android Device
|
<p>Is there a way to ask the mail programms on an Android Device how many unread mails they have?</p>
|
android
|
[4]
|
1,479,057 | 1,479,058 |
Java delete and rename file issue
|
<p>Method below has function to simply move files from the "working" to the "move" directory which paths it receives through the method call. It all works, but for the case when file name has name with two extensions (like .xml.md5) where the .renameTo method returns false. Is there a way to alter the below code so it would work regardless of the OS that it's run on. (Currently it is the Windows)</p>
<pre><code>public void moveToDir(String workDir, String moveDir) throws Exception {
File tempFile = new File(workDir);
File[] filesInWorkingDir = tempFile.listFiles();
for (File file : filesInWorkingDir) {
System.out.println(file.getName());
if (new File(moveDir + File.separator + file.getName()).exists())
new File(moveDir + File.separator + file.getName()).delete();
System.out.println(moveDir + File.separator + file.getName());
Boolean renameSuccessful = file.renameTo(new File(moveDir + File.separator + file.getName()));
if (!renameSuccessful) throw new Exception("Can't move file to " + moveDir +": " + file.getPath());
}
}
</code></pre>
|
java
|
[1]
|
3,066,884 | 3,066,885 |
Contact Us JavaScript help
|
<p>im trying to create a contact us web page, the obvious choice of posting the data would be to use the mailto function this obviously has some security flaws. i was wondering if there are any good javascript i can use to send the details from the contact us page to my email. i tutorial would be helpfull as i am really new to this.</p>
|
javascript
|
[3]
|
409,045 | 409,046 |
Python switch order of elements
|
<p>I am a newbie and seeking for the Zen of Python :) Today's koan was finding the most Pythonesq way to solve the following problem:</p>
<blockquote>
<p>Permute the letters of a string pairwise, e.g.</p>
<pre><code>input: 'abcdefgh'
output: 'badcfehg'
</code></pre>
</blockquote>
|
python
|
[7]
|
566 | 567 |
How the game will search for other online users and will display the list of all users?
|
<p>I am asking this question as a small part of my question series regarding game programming .</p>
<p>Refer <a href="http://stackoverflow.com/questions/3131780/multiplayer-game-in-iphone-concept-strategy-design">this</a> question as the main one .</p>
<p>Now suppose I want to develop one small board game on iphone that is multiplayer . so how it will handle how many users are online and displaying them .</p>
<p>Suppose it is an online multiplayer casino game .</p>
<p>Then suppose it have to show currently playing tables and users on them .</p>
<p>So what can we do in iphone to do this sort of thing .</p>
<p>Thanks .</p>
|
iphone
|
[8]
|
131,837 | 131,838 |
Find out the time between two timeslots?
|
<p>I have two times start_time=2009-12-01 9.30 pm and end_time=2009-12-01 11.30 pm(YYYY-MM-DD).If the user do any activity between these times ie at 2009-12-01 10.30 pm I need to tell him you are not valid to do this activity...
The two times 2009-12-01 9.30 pm and 2009-12-01 11.30 pm is taken from database.The time 2009-12-01 10.30 is given by user.</p>
<p>My question is how can I find the time 10.30pm is occured inbetween 9.30pm to 11.30pm...</p>
<p>I do my program in PHP</p>
|
php
|
[2]
|
2,376,855 | 2,376,856 |
What iPhone APIs are available for internet-based matchmaking games?
|
<p>I have a pretty basic challenge-based iPhone game, and I wanted to know what my options are for player discovery & matchmaking. I may end up rolling my own server, but if I don't have to, even better.</p>
<p>So far, I've found <a href="http://openfeint.com" rel="nofollow">OpenFeint</a> and <a href="http://scoreloop.com" rel="nofollow">Scoreloop</a>, but I don't really care about the social part or discovering other games, I just want a simple system with matchmaking, win/loss, and global rankings. <a href="http://www.cocoslive.net/" rel="nofollow">CocosLive</a> has the global ranking part, but not the matchmaking.</p>
<p>Also just found <a href="http://www.jenkinssoftware.com/index.html" rel="nofollow">RakNet</a>.</p>
<p>Thanks.</p>
|
iphone
|
[8]
|
5,332,918 | 5,332,919 |
Page Navigation and updation of document using web browser control in c#
|
<p>Hi i'm new in using webrowser control.A website contains grid with page navigation which holds multiple links.each of that page is navigated using ajax.I couldn't able to get the page updated in that document and want to navigate the page automatically using webbrowser control in c#.</p>
<p>I'm using the below code for navigating the page.But,I can only able to navigate the links in current document.</p>
<p>My requirement is, I have to navigate all the links in that website and fetch the data.</p>
<pre><code>private void webBrowser1_DocumentCompleted(object sender,
WebBrowserDocumentCompletedEventArgs e)
{
int k = 2;
HtmlElementCollection links = webBrowser1.Document.GetElementsByTagName("A");
foreach (HtmlElement link in links)
{
string lin = Convert.ToString(k);
if ((link.InnerText == lin))
{
link.InvokeMember("Click");
while ((webBrowser1.ReadyState != WebBrowserReadyState.Complete))
{
Application.DoEvents();
}
k++;
}
}
}
</code></pre>
|
c#
|
[0]
|
2,839,851 | 2,839,852 |
Unbuffered read from process using subprocess in Python
|
<p>I am trying to read from a process that produces long and time-consuming output. However, I want to catch it's output <em>as and when</em> it is produced. But using something like the following seems to be buffering the command's output, so I end up getting the output lines all at once:</p>
<pre><code>p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, bufsize=0)
for line in p.stdout:
print line
</code></pre>
<p>I am trying this on MacOS 10.5</p>
|
python
|
[7]
|
2,676,777 | 2,676,778 |
adding a key-value pair to inner array
|
<p>I already have data in array as</p>
<pre><code> $a = array (
[2011-07-09] => array(['new'] => 12),
[2011-07-10] => array(['new'] => 15)
);
</code></pre>
<p>Now I want to add another key-value pair to inner array so that output will be like</p>
<pre><code> $a = array (
[2011-07-09] => array(['new'] => 12, ['recurring'] => 52),
[2011-07-10] => array(['new'] => 15, ['recurring'] => 80)
);
</code></pre>
<p>How can I do this?</p>
|
php
|
[2]
|
1,412,927 | 1,412,928 |
Dropdownlist value is not refreshed in mozilla
|
<p>When i load my page first time selected index of dropdownlist to 0 and I am changing the selected index of dropdownlist to 2 when i click a button but when i reload my page selected index of dropdownlist should set to 0.but it is not refreshed in mozilla.it is working fine in IE8 and chrome</p>
|
asp.net
|
[9]
|
534,486 | 534,487 |
What does *.exp file do?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2727020/what-is-use-of-exp-and-what-is-the-difference-between-lib-and-dll">what is use of .exp and what is the difference between .lib and .dll</a> </p>
</blockquote>
<p>when I link with some c++ library, for each *.lib, it is associated with a *.exp file. what does *.exp do?</p>
<pre><code>***.lib / ***.exp
</code></pre>
|
c++
|
[6]
|
3,387,956 | 3,387,957 |
Javascript set attribute using variable
|
<p>I'm unsure of the syntax here, but the code I have so far is this... (Note: I am passing the id's of three textboxes in the form '#begmile','#endmile','#totmile', and I want to set the value of the 'totmile' checkbox to endmile-bigmile)</p>
<pre><code>function subtract(begmile, endmile, totmile){
y=$(begmile).attr('value');
z=$(endmile).attr('value');
y=z-y;
$(totmile).setAttr('value',???);
</code></pre>
<p>}</p>
<p>I'm not sure if my syntax here so far is correct, but assuming it is (that y is properly set to endmile-begmile, how do I use setAttr to set the value of totmile to the value of y?</p>
|
javascript
|
[3]
|
4,200,793 | 4,200,794 |
how to set themes continuously in android
|
<p>My problem is make a function to set up themes in my application every <code>00:00 AM</code> if there are new themes. As I know, to do this problem we must use a loop. </p>
<p>Here is my code:</p>
<pre><code>private void updateThemes() {
Thread time = new Thread() {
public void run() {
int time = 0;
while(time > 86400000) {
//invoke method or start new activity
}
}
};
}
</code></pre>
<p>Please help me - Thanks.</p>
|
android
|
[4]
|
2,773,713 | 2,773,714 |
Handling empty strings in C# ?? operator
|
<p>I am using the following code:</p>
<pre><code>string x = str1 ?? str2 ?? str3 ?? "No string";
</code></pre>
<p>However what if any of these strings (str1, str2, str3) is String.Empty which is !=null?</p>
<p>How do I handle this situation?</p>
|
c#
|
[0]
|
2,700,452 | 2,700,453 |
How-to get the Application path using javascript
|
<p>If I have my application hosted in a directory. The application path is the directory name.</p>
<p>For example</p>
<p><code>http://192.168.1.2/AppName/some.html</code></p>
<p>How to get using javascript the application name like in my case <code>/AppName</code>.</p>
<p><code>document.domain</code> is returning the hostname and <code>document.URL</code> is returning the whole Url.</p>
<p><strong>EDIT</strong></p>
<p>Thr app path could be more complex, like <code>/one/two/thre/</code></p>
|
javascript
|
[3]
|
2,535,314 | 2,535,315 |
Passing data from bg thread to UI thread using Handler?
|
<p>In Handler, we can pass some data from a background thread to the UI thread like this:</p>
<pre><code>private void someBackgroundThreadOperation() {
final String data = "hello";
handler.post(new Runnable() {
public void run() {
Log.d(TAG, "Message from bg thread: " + data);
}
}
}
</code></pre>
<p>If we use the above, we cannot then use Handler.removeCallbacks(Runnable r), because we won't have references to any of the anonymous runnables we created above.</p>
<p>We could create a single Runnable instance, and post that to the handler, but it won't allow us to pass any data through:</p>
<pre><code>private void someBackgroundThreadOperation() {
String data = "hello";
handler.post(mRunnable); // can't pass 'data' through.
}
private Runnable mRunnable = new Runnable() {
public void run() {
Log.d(TAG, "What data?");
}
}
</code></pre>
<p>We can however use the Handler.removeCallbacks(mRunnable) method then, since we have a reference to it.</p>
<p>I know I can setup some synchronization myself to get the second method working, but I'm wondering if Handler offers any utility for passing data through to a single referenced Runnable, almost like in the example above?</p>
<p>The closest I can think of from browsing the docs is to use something like:</p>
<pre><code>private void someUiThreadSetup() {
mHandler = new Handler(new Callback() {
@Override
public boolean handleMessage(Message msg) {
String data = (String)msg.obj;
return false;
}
});
}
private void someBackgroundThreadOperation() {
String data = "please work";
Message msg = mHandler.obtain(0, data);
mHandler.sendMessage(msg);
}
private void cleanup() {
mHandler.removeMessages(0);
}
</code></pre>
<p>Is this the proper way of doing it?</p>
<p>Thanks</p>
|
android
|
[4]
|
1,794,653 | 1,794,654 |
Tool Kit Image loader
|
<p>i'm reading a book on java programming iv'e come to a part were i don't understand it's loading a bit image or something here's the code</p>
<pre><code>Toolkit tk = Toolkit.getDefaultToolkit();
image = tk.getImage(getURL("castle.png"));
</code></pre>
<p>what is the get URl am i suppose to tell it where the image actually is or something?</p>
<p>how can it locate the image i get this error when i run it like it is -</p>
<pre><code>Uncaught error fetching image:
java.lang.NullPointerException
</code></pre>
<p>Here's the full code -</p>
<pre><code>package randomshapes;
import java.awt.*;
import java.util.*;
import javax.swing.*;
import java.net.*;
public class RandomShapes extends JFrame{
private Image image;
public static void main(String [] args){
new RandomShapes();
}
public RandomShapes(){
super("DrawImage");
setSize(600,600);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Toolkit tk = Toolkit.getDefaultToolkit();
image = tk.getImage(getURL("castle.png"));
}
private URL getURL(String filename){
URL url = null;
try{
url = this.getClass().getResource(filename);
} catch (Exception e){ }
return url;
}
public void paint(Graphics g){
Graphics2D g2d = (Graphics2D) g;
g2d.setColor(Color.WHITE);
g2d.fillRect(0, 0, getSize().width, getSize().height);
g2d.drawImage(image, 0, 40, this);
}
}
</code></pre>
|
java
|
[1]
|
4,379,529 | 4,379,530 |
GetComponent With Reflection
|
<p>I am trying get a Form's BindingSource using Reflection. The following code is what I've tried so far although it has an error:</p>
<pre><code>public class MyClass :Form
{
BindingSource bs = new BindingSource();
}
public static class Class2
{
public static BindingSource GetBindingSource(string FieldNameP, Form FormP)
{
BindingSource Bs = null;
var info=FormP.GetType().GetField(FieldNameP);
if(info != null)
{
Bs = (BindingSource)info.GetValue(null)
}
return Bs;
}
}
</code></pre>
|
c#
|
[0]
|
130,183 | 130,184 |
How to find what range a number is in
|
<p>I have folders named like this:</p>
<pre><code>"1-500"
"501-1000"
"1001-1500"
"1501-2000"
"2501-3000"
etc....
</code></pre>
<p>Given an Id such as <code>1777</code> how can I find the name of the folder it belongs in?</p>
<p>I am using Java, but your answer can be pseudocode.</p>
<p>Thanks!</p>
|
java
|
[1]
|
1,491,577 | 1,491,578 |
PHP Configuration: It is not safe to rely on the system's timezone settings
|
<p>Here a weird one.
I just upgrade to php 5.3.0 and since the upgrade I'm getting the following warning:</p>
<blockquote>
<p>Warning: getdate() [function.getdate]:
It is not safe to rely on the system's
timezone settings. You are <em>required</em>
to use the date.timezone setting or
the date_default_timezone_set()
function. In case you used any of
those methods and you are still
getting this warning, you most likely
misspelled the timezone identifier. We
selected 'America/Chicago' for
'CST/-6.0/no DST'</p>
</blockquote>
<p>After looking in various forums, everybody says that to solve the problem, all you have to do is edit the date zone in the php.ini and restart Apache.</p>
<p>It did not work for me. </p>
<p>I tried </p>
<pre><code>date.timezone="America/New_York"
date.timezone=America/New_York
date.timezone="US/Central"
</code></pre>
<p>Restarted apache after I made the change.</p>
<p>Since I still have the older version of php install, I even made sure that I'm editing the php.ini that the current version of php uses at the time to load </p>
<p><code>/usr/local/php5/lib/php.ini</code></p>
<p>Still getting the warning. </p>
<p>Any suggestions? </p>
<p>Thanks for taking the time.</p>
|
php
|
[2]
|
1,020,945 | 1,020,946 |
Help In code template
|
<p>Given this code </p>
<pre><code>template <typename T>
typename T::ElementT at (T const &a , T const &b)
{
return a[i] ;
}
</code></pre>
<p>what do </p>
<pre><code>typename T::ElementT
</code></pre>
<p>and</p>
<pre><code>a[i]
</code></pre>
<p>mean?</p>
|
c++
|
[6]
|
3,852,441 | 3,852,442 |
How to access the color components of an UIColor?
|
<p>i.e. I want to know the value of blue. How would I get that from an UIColor?</p>
|
iphone
|
[8]
|
5,288,337 | 5,288,338 |
Passing in name/id of target div
|
<p>Is it possible to pass in to a $.ajax function the name or id of the target div?</p>
<pre><code>function getData(someurl, somedata, somediv){
$.ajax({
url:someurl,
data:somedata,
success:function(msg){
$('#id_of_div').show().html(msg);
}
});
}
</code></pre>
<p>Have been able to pass in someurl and somedata but as yet unable to pass in the id of the target div.</p>
<p>How should the target div id be passed in?</p>
|
jquery
|
[5]
|
943,105 | 943,106 |
receive and parse mails on the server via php
|
<p>maybe mine it's a bit a simple question;
I would like to instruct my server to receive mails and to parse them via a php script.
How can I do it?</p>
<p>Thanks</p>
|
php
|
[2]
|
3,567,736 | 3,567,737 |
How can i play different video files in android application?
|
<p>i am developing an android application. In my application i need to play different format video files which are coming from server. My application getting the video links from server. Those are different formats like avi,flv,mkv,mp4. I tried to played .3gp file link successfully but the remaining formats are not supported. May be android supports only .3gp.
I tried a way to play the video links in web view and got failed. Please suggest me is there any way to play the avi,flv,mkv,mp4 file formats.</p>
<p>Thanks in advance.</p>
|
android
|
[4]
|
1,189,085 | 1,189,086 |
Why can’t printf be formatted with an array of ints?
|
<p>I want to format an output string with a series of variables. When I use an array of strings, this works as expected:</p>
<pre><code>String[] myArray = new String[3];
// fill array with strings
System.out.printf("1: %s \n2: %s \n3: %s\n", myArray);
</code></pre>
<p>I want to use this to print the results of simulated dice-throws, so I use an array of ints. However, this doesn’t work:</p>
<pre><code>int[] myArray = new int[3];
// fill array with numbers
System.out.printf("1: %d \n2: %d \n3: %d\n", myArray);
Exception in thread "main" java.util.IllegalFormatConversionException: d != [I
</code></pre>
<p>Of course, I could use <code>myArray[0]</code> etc. for every element, but this doesn’t seem very elegant.</p>
<p>Why is this so and how can I achieve the desired result?</p>
|
java
|
[1]
|
4,924,916 | 4,924,917 |
What does getLine1Number() return with dual SIM phones?
|
<p>What does <code>getLine1Number()</code> method of <code>TelephonyManager</code> return with dual SIM phones like <a href="http://www.gsmarena.com/lg_optimus_net_dual-4309.php" rel="nofollow"><code>LG Optimus Net Dual</code></a>?</p>
|
android
|
[4]
|
4,458,173 | 4,458,174 |
radio buttons and php
|
<p>and thanks in advance for offering your time for reading this.
I am newbie with PHP and i am doing a project for the university.
Until now for adding boolean values i have used checkboxes. For example in my db i have a boolean record called DB_FOR_SALE that i am updating using this piece of code...</p>
<p>HTML part
<code><input type="checkbox" name="DB_FOR_SALE" value="1"<#DB_FOR_SALE#>>For</code>>For Sale</p>
<p>PHP part</p>
<pre><code> /* Update of a Record */
if($_REQUEST['DB_ID'] != '')
{
$objectid = $_REQUEST['DB_ID'];
$upd = "update " . G_DB_PREFIX . "OBJECTS set DB_FOR_SALE='" . $_REQUEST['DB_FOR_SALE'] . "' where DB_ID='" . $_REQUEST['DB_ID'] . "'";
$gupd = $conn->update($upd, G_NORMDB);
</code></pre>
<p>In the same way i can enter the value if the object is inserted for the first time.</p>
<p>How can i use that in the radio buttons case, since they have the same name.</p>
<p>Thanx for reading this!!</p>
|
php
|
[2]
|
2,623,359 | 2,623,360 |
Constructors GetInfo
|
<p>I am new to C# and am working on classes and understanding them. My problem is I am not understanding how to create a <code>Get</code> to retrieve the private variable <code>_yourname</code> and <code>Set</code> to set the private variable <code>_yourname</code>.</p>
<pre><code>namespace WindowsFormsApplication1
{
class InputClass
{
private string _yourName;
public string _banner;
public virtual void GetInfo();
public InputClass(String _banner)
{
_banner = "Enter your name";
}
}
}
</code></pre>
<p>Maybe I am using the wrong function to <code>GetInfo</code>. But I am also wondering when I have the <code>GetInfo</code> if in the <code>()</code> I should write <code>_yourname</code> in it.</p>
|
c#
|
[0]
|
779,260 | 779,261 |
How do I know where "Program Files" are?
|
<p>I'm working on a custom installer / launcher in pure Java. How can I tell the path to "Program Files" or its equivalent?</p>
|
java
|
[1]
|
2,805,249 | 2,805,250 |
How to get files with a filename starting with a certain letter?
|
<p>I wrote some code to read a text file from C drive directly given a path.</p>
<pre><code>String fileName1 = "c:\\M2011001582.TXT";
BufferedReader is = new BufferedReader(new FileReader(fileName1));
</code></pre>
<p>I want to get a list of files whose filename starts with M. How can I achieve this?</p>
|
java
|
[1]
|
817,852 | 817,853 |
assets look grainy/pixelated
|
<p>I'm using pretty high res graphics in my project. I've got different assets in my MDPI and HDPI folders. I've made sure that my manifest supports resizing, that it supports large screens, etc (though this shouldn't matter, at least not for resizing, as long as you declare a minsdk in the manifest.)</p>
<p>The problem is that, all of my assets look grainy and pixelated on devices I test them on. I've tested on a G2x (which is 480 x 800, I believe) and others and it always looks pixelated. When I compare the stock android buttons to my stretchable resources, for example, the difference is startling. My assets look terrible, but the stock android ones are sharp. </p>
<p>Anything I'm missing here to get assets to look good? </p>
|
android
|
[4]
|
5,135,991 | 5,135,992 |
compare date trimming
|
<p>I have a field (nonTimeStampDate) that has date like this </p>
<pre><code>2010-03-15
</code></pre>
<p>and I want to check it against another field (timeStampDate) which is </p>
<pre><code>2010-03-15 15:07:45
</code></pre>
<p>to see if the date matchs. But as you can see since the format is different it doesnt match even though the date is same.<br>
Any help will be appreciated.
thanks</p>
|
php
|
[2]
|
4,949,882 | 4,949,883 |
remove HTML from a string (in JSON response)
|
<pre><code>var json = {
"Item": {
"Items": {
"Body": "<SPAN style=\"LINE-HEIGHT: 115%; FONT-FAMILY: 'Arial','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA\">\"We have all been inoculated with Christianity, and are never likely to take it seriously now! You put some of the virus of some dreadful illness into a man's arm, and there is a little itchiness, some scratchiness, a slight discomfort, disagreeable, no doubt, but not the fever of the real disease, the turning and the tossing, and the ebbing strength. And we have all been inoculated with Christianity, more or less. We are on Christ's side, we wish him well, we hope that He will win, and we are even prepared to do something for Him, provided, of course, that He is reasonable, and does not make too much of an upset among our cozy comforts and our customary ways. But there is not the passion of zeal, and the burning enthusiasm, and the eagerness of self-sacrifice, of the real faith that changes character and wins the world.\"<B>A.J. Gossip<\/B><\/SPAN>",
},
}
};
var someString = json.Item.Body.replace(/<br\s*\/?\s*>/g,"\n");
alert(someString);
</code></pre>
<p>I am getting <code>HTML</code> tags in my response, which i should remove or parse it. How can i go about this. I did for <code>BR</code> tags, but now it seems there are other tags too coming in. </p>
|
javascript
|
[3]
|
1,704,312 | 1,704,313 |
On pressed button block the other buttons
|
<p>How could I make my button to do the on click action even if the button is pressed and the finger is still on the screen (the button is not released). Or I would accept the solution that when a button is pressed and is not release, the other buttons on the layout to not be blocked.</p>
|
android
|
[4]
|
1,027,009 | 1,027,010 |
Facebox beforeClose confirmation
|
<p>I am using jQuery Facebox in a project and in the facebox there is a textarea.</p>
<p>I am having trouble keeping the Facebox open if the user clicks cancel on a confirmation box which is trigger beforeClose.facebox.</p>
<p>I have the beforeClose.facebox working but if I click the cancel button on the confirmation box it still closes facebox. If I click cancel, I would like the Facebox to stay open.</p>
<p>Thanks in advance.</p>
|
jquery
|
[5]
|
5,591,655 | 5,591,656 |
while accepting socket connection
|
<pre><code>unsigned __int8 Decrypt(unsigned __int8 data[]);
for(;;)
{
if((sConnect=accept(sListen,(SOCKADDR*)&addr,&addrlen)) != INVALID_SOCKET)
{
Print("Socket Connected Successfully!");
char buf[4095];
recv(sListen,buf,sizeof(buf),0);
Decrypt(buf); // Error:IntelliSense: argument of type "char *" is incompatible with parameter of type "unsigned char *"
}
</code></pre>
<p>how can i fix this prob :-s</p>
|
c++
|
[6]
|
3,472,376 | 3,472,377 |
javascript creating object key
|
<p>Let's say I have this:</p>
<pre><code>var ObjectKey = "06.2012";
</code></pre>
<p>It's a string that represents the month. I want to use this value as the key of a new object. I have</p>
<pre><code>TheObject = {ObjectKey: null};
</code></pre>
<p>But when I go to the console, instead of the TheObject having a key named 06.2012, it has a key named ObjectKey.</p>
<p>How do I create a key that has the name of a string that I create at runtime?</p>
<p>Thanks.</p>
|
javascript
|
[3]
|
617,284 | 617,285 |
Is there a way to check, programatically, if an ASP.NET application's CustomErrors are set to Off?
|
<p>We usually catch unhandled exceptions in Global.asax, and then we redirect to a nice friendly error page. This is fine for the Live environment, but in our development environment we would like to check if CustomErrors are Off, and if so, just throw the ugly error.</p>
<p>Is there an easy way to check if CustomErrors are Off through code?</p>
|
asp.net
|
[9]
|
2,707,003 | 2,707,004 |
After app is garbage collected how to restart it from first activity
|
<p>If app is put to background and then GC'ed because of low RAM I would like the app to restart from the first activity and not the activity it was in before it was put to background.</p>
<p>I know I could NULL checks for certain objects and if they are I would just start the first activity with clear top added. </p>
<p>I am looking for a more elegant way</p>
|
android
|
[4]
|
4,907,194 | 4,907,195 |
How to make a weblink clickable when comments are made
|
<p>I need your help with making a weblink clickable when comments are made on mf website.. The code I have below does not achieve that. It only inserts (Code Not Shown), and the website is not clickable.</p>
<p>Thank you for your help.</p>
<pre><code> $reg = "/(http|https|ftp|ftps|www)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/g";
if(preg_match($reg, $comment, $url,))
{
$comment_body = preg_replace($reg, "<a href = " .$url[0]. "> $url[0] </a> ", $comment);
}
</code></pre>
|
php
|
[2]
|
1,741,630 | 1,741,631 |
Why isn't subclass constructor overriding?
|
<p>I have the code:</p>
<pre><code>class Oak extends Tree {
public Oak() {
System.out.println("Oak()");
}
}
class Tree {
public Tree() {
System.out.println("Tree()");
}
}
class mainClass {
public static void main(String[] args) {
Oak a = new Oak();
}
}
</code></pre>
<p>Why does it print</p>
<pre><code>Tree()
Oak()
</code></pre>
<p>instead of just</p>
<pre><code>Oak()
</code></pre>
<p>?</p>
|
java
|
[1]
|
2,497,050 | 2,497,051 |
Testing for value in set of tuples
|
<p>Suppose we have the following set, <code>S</code>, and the value <code>v</code>:</p>
<pre><code>S = {(0,1),(2,3),(4,5)}
v = 3
</code></pre>
<p>I want to test if <code>v</code> is the second element of any of the pairs within the set. My current approach is:</p>
<pre><code>for _, y in S:
if y == v:
return True
return False
</code></pre>
<p>I don't really like this, as I have to put it in a separate function and something is telling me there's probably a nicer way to do it. Can anyone shed some light?</p>
|
python
|
[7]
|
1,130,012 | 1,130,013 |
How do I check if all items in a 2D list are all the same?
|
<p>I need help checking if all the items in a two-dimensional list are the same (in this case, I'm checking if they are all equal to one).</p>
<p>I made a function <code>allOnes(L)</code> that checks if all items are 1's in a 1D array. I used the all() function like this:</p>
<pre><code>def allOnes(L):
"""Tests to see if the numbers in the list L are all 1's
"""
return all(x == 1 for x in L)
</code></pre>
<p>Now I need to check if all items in a 2D list are all 1's. I would like the function allOnes2d to return True when it checks a list like this: <code>[[1,1,1], [1,1,1], [1,1,1]]</code>. Is this possible using <code>all()</code>? </p>
|
python
|
[7]
|
1,955,632 | 1,955,633 |
How do you break down a new project with an existing mega PHP site?
|
<p>I've got to dive into a very large PHP site and have my first client meeting today. All they gave me so far was the URL. </p>
<p>How do you guys go about gathering/structuring/documenting and preparing for a new project in a PHP environment? What things do you ask for up front?</p>
<p>PS - I know there are other general questions about this but I want a PHP-flavored one, including tools (even if universal) and approaches.</p>
<p>Thanks!! I'm excited but also scared.</p>
|
php
|
[2]
|
86,767 | 86,768 |
I want to take backup of site folder from admin side,not using cron
|
<p>I want to take backup of site folder but not using cron.
I have used copy command,but it is taking too much time,is there any other way or script i can copy site folder?</p>
|
php
|
[2]
|
3,418,299 | 3,418,300 |
How to save times, timezone question
|
<p>I'm building an ASP web app that stores appointment times; it'll be used in different timezones. I'm currently saving an appointment in the database as a datetime field. Do I also need to add a field to save the timezone? What's the best option to solve these multi-timezone issues?</p>
<p>Thanks.</p>
|
asp.net
|
[9]
|
2,381,474 | 2,381,475 |
How to logout from facebook from the application in iphone?
|
<p>Please help me with a solution!.I have a iPhone app which uses the new facebook sdk(FBConnect).The app is related to video sharing.I should embed a logout button to sign out the current user from my app.I implemented it by calling <code>fn{currentAPICall = kAPILogout;[[facebookObject]logout:self]}</code> from my wrapper class.....tis logout shd call the logout method in facebook.m.The code is executed as expected but it does not logout from my app,again on relaunching my app it is redirected to the previous account.
Any solutions!</p>
|
iphone
|
[8]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.