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 |
---|---|---|---|---|---|
5,026,996 | 5,026,997 | Why there is no error raised by compiler? | <p>I just found my compiler allowed me to write below code and did not raised any compile time error. Could anyone please enlighten me!</p>
<pre><code>double y = arcToFindPointOn.getCenterXY().y - arcToFindPointOn.getRadius()*Math.sin(theta);;
</code></pre>
<p>Weird thing about above code line is semi-colon at the very end!</p>
<p>Thanks!</p>
| java | [1] |
5,533,217 | 5,533,218 | what is the difference between the below syntaxes? | <pre><code>1. $(function () {
function foo() { return true; }
log(bar()); // getting error
var bar = function() { return true; };
});
2. $(function () {
function foo() { return true; }
var bar = function() { return true; };
log(bar()); // Working
});
</code></pre>
<p>my confusion here is what is the difference between the below two declarations and which one is useful?</p>
<pre><code>var bar = function() { return true; };
function bar(){ return true; };
</code></pre>
| javascript | [3] |
5,926,437 | 5,926,438 | Are inline if statements efficient when used in this way? | <p>If I assign a value to a variable and then want to assign a second value to it, but only if it fulfills a condition, is it just as efficient to use a shorthand if statement? Here is an example.</p>
<p>Is this more efficient</p>
<pre><code>int x = GetInt();
if (x < 5)
x = 5;
</code></pre>
<p>Than this</p>
<pre><code>int x = GetInt();
x = x < 5 ? 5 : x;
</code></pre>
<p>I suppose that what I'm really asking is if <code>x</code> does not satisfy the condition then will the <code>x = x</code> in the else statement impact the performance?</p>
| c# | [0] |
5,274,916 | 5,274,917 | Not getting how to use the execWB method | <p>I am unable to get execWB working. Can any one show me how to initialize it or which namespace or dll file I need to include in order to use this method.
I am trying to zoom out the content on my browser.</p>
| c# | [0] |
2,743,017 | 2,743,018 | Does it make sense that there may be more than one class that conforms to the UIApplicationDelegate protocol in an iPhone App? | <p>I think I've understood what that Delegate is supposed to do. If a class conforms to that protocol, it tells the underlying system: "Hey man, I am the UIApplication object's delegate! Tell me what's up, and I may tell you what to do!".</p>
<p>What, if multiple classes implement that? Is that possible? Does that make any sense?</p>
| iphone | [8] |
1,851,614 | 1,851,615 | how to send parameter from.aspx page to.cs file[in #eval method in gridview] | <p>in my gridview item template filed i am calling an method <strong>CheckValue</strong></p>
<pre><code> <asp:Label ID="Label1" runat="server" Text='<%# CheckValue(Eval("Imagespath")+","+Eval("Imagesname")%>'>
</asp:Label>
protected string CheckValue(string strValue1,string strValue2)
{
if (strValue1=="1")
{
return "No Record Found";
}
else
{
return "No Record Found";
}
}
</code></pre>
<p>when i run my page i get errorin my .aspx page</p>
<p><strong>Text='<%# CheckValue(Eval("Imagespath")+","+Eval("Imagesname")%>'></strong></p>
<p>is there any way i can send my value CheckValue method which isa .cs file how can i send 2 paremeter from.aspx page
can anu one tell me the syntax for it </p>
<p>thank you</p>
| asp.net | [9] |
2,289,232 | 2,289,233 | Android surface flinger | <p>I want to know whether the surface flinger knows anything about the clickable regions on the current screen or surface flinger just displays the final screen and it knows nothing about the clickable regions and the windowmanagerservice dispatches the input to the window which is on the top and it does whatever it has to do with the input?</p>
| android | [4] |
4,343,625 | 4,343,626 | Unable to instantiate application when it obviously exists | <p>Since I've started developing an application I haven't received any "Unable to instantiate application" exceptions , however, after the launch there've been quite a number of bug-reports that stated this exception.</p>
<p>My application uses custom MyApplication class inherited from Application, manifest's record looks like <code>.application.MyApplication</code> and I still can't reproduce the same exception neither on 2.3 nor on 4.0. Can you suggest what might be happening there ?</p>
<p><strong>UPD</strong></p>
<p><img src="http://i.stack.imgur.com/Gydhw.jpg" alt="enter image description here"></p>
<p>Thanks.</p>
| android | [4] |
1,518,503 | 1,518,504 | How do I use same method in different Java projects | <p>I use method A in several different Java projects. Is there a way to write the method just once and then call it as required from different Java projects?</p>
| java | [1] |
426,014 | 426,015 | How do I toggle the enabled status of a radio button group in jQuery? | <p>I have a group of radio buttons with a class of "laser2" on each button. I have a checkbox with an ID of "duaL-laser". I am trying to toggle the availability of the radio button group with the checkbox. I know the class toggling works (for display purposes). Here is my code.</p>
<pre><code><script type="text/javascript">
$().ready(function() {
//$('.laser2').attr('disabled', 'disabled');
$('#dual-laser').click(function() {
$('div#power-listing2').toggleClass('disable');
$('.laser2').removeAttr('disabled');
});
if ($('#dual-laser').attr('checked', false)) {
$('.laser2').attr('disabled', true);
}
});
</script>
</code></pre>
<p>This works when I check the checkbox. But when I uncheck the checkbox, the radio buttons remain enabled. Even though the if statement is true at the bottom of the code. What gives?</p>
| jquery | [5] |
3,732,862 | 3,732,863 | error parsing in php | <pre><code><?php
/* User info to access to db */
$db_host = "";
$db_name = "";
$db_user = "root";
$db_pass = "root";
/* Create an object patient */
class patient
{
public $name;
public $surname;
public $address;
public $birth_place;
public $province;
public $birth_date;
public $sex;
public $case;
public __construct($nm,$sur,$addr,$bp,$pr,$bd,$sx,$cs) <-- line 26
{
$this->name = $nm;
$this->surname = $sur;
$this->address = $addr;
$this->birth_place = $bp;
$this->province = $pr;
$this->birth_date = $bd;
$this->sex = $sx;
$this->case = $cs;
}
}
</code></pre>
<p>?></p>
<p>I get this error:</p>
<pre><code>Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE on line 26
</code></pre>
<p>why? where is the mistake?</p>
| php | [2] |
1,967,618 | 1,967,619 | How can i call a JQuery function outside of a JQuery class? | <p>I have a class:</p>
<pre><code>var BrandDrug = Class.extend({
fun1: function() {
$.MyFunc(); //This does not work.
}
});
//Outside function
$.MyFunc = (function() {
//Code
});
</code></pre>
<p>How can i call the $.MyFunc from the BrandDrug Class?</p>
| jquery | [5] |
3,598,858 | 3,598,859 | gsmComm library Error | <p>i was checking the sample code with gsmComm library, my modem is Nokia N70 Modem and the connection was done successfuly and i am sending msg from it too but when i tried to read sms or contacts through application .. i got this message</p>
<p>"Error: Phone reports generic communication error or syntax error. (GsmComm.GsmCommunication.CommException)"</p>
<p>what's the problem ?</p>
| c# | [0] |
2,412,257 | 2,412,258 | Check whether function result value is used | <p>I was wondering whether it is possible to check whether a function is called in such a way that its return value is stored in a variable, or that it is called 'standalone'.</p>
<p>In the first case, the function should indeed return something, but otherwise it should save the value(s) to the current instance of my object.</p>
<p>To be specific, I have a <code>Vector3D</code> as follows:</p>
<pre><code>function Vector3D(x, y, z) {
this.x = parseNumber(x);
this.y = parseNumber(y);
this.z = parseNumber(z);
}
Vector3D.prototype.add = function(that) {
return new Vector3D(
this.x + that.x,
this.y + that.y,
this.z + that.z
);
};
</code></pre>
<p>As can be seen, the <code>add</code> function returns something based on the object instance itself and on another instance. As it is now, the function must be called in a way like this:</p>
<pre><code>var addedVector = vect1.add(vect2);
</code></pre>
<p>However, if I were to call it like this:</p>
<pre><code>vect1.add(vect2);
</code></pre>
<p>it should not return anything (that's quite useless), but instead store the return coordinates (<code>x</code>, <code>y</code> and <code>z</code>) in the variables of vect1. So vect1 should become what is called addedVector in the other line of code.</p>
<p>To accomplish this, I guess I'm going to need to know whether the function is called alone or that its return value is stored.</p>
<p>Is there any way to accomplish this?</p>
| javascript | [3] |
1,562,416 | 1,562,417 | Server.GetLastError() is Null in Global.asax | <p>I have a simple aspx page and am trying to handle exceptions in Global.asax (Application_Error) method. But when I do Server.GetLastError() inside this method, I get a null reference, when an exception is thrown.</p>
<p>Can somebody help?</p>
<p>Thanks,
Suresh.</p>
| asp.net | [9] |
3,556,663 | 3,556,664 | Getting a temporary file, cross-platform | <p>I'm looking for a cross-platform way of getting designated a temporary file. For example in linux that would be in the <code>/tmp</code> dir and in Windows in some crappy named Internet Explorer temp dir.</p>
<p>Does a cross-platform (Boost?) solution to this exist?</p>
<p><strong>EDIT</strong>:</p>
<p>I need this file to exist until the program terminates. <code>tmpfile()</code> does not guarantee that. Quoting from ccpreference:</p>
<blockquote>
<p>The temporary file created is automatically deleted <strong>when the stream is closed (fclose)</strong> or when the program terminates normally.</p>
</blockquote>
| c++ | [6] |
1,738,086 | 1,738,087 | Clearing and Defining an array in PHP | <p>I have defined an array in a for loop.Something like </p>
<pre><code>for($i=0;$i<5;$i++){
$an_array = array();
}
</code></pre>
<p>Please let know if the array definition will also the clear the array after the first iteration.</p>
| php | [2] |
2,109,814 | 2,109,815 | Multiple form submission | <pre><code>function saveConfig(val)
{
if(val == 1){
document.f1.submit();
document.f4.submit();
}
else if(val == 2){
document.f2.submit();
}
else if(val == 3){
document.f3.submit();
}
document.f0.submit();
}
</code></pre>
<p>Hi The above code works well in IE6, IE7, IE8, FF3.0.19, FF3.5.19 and FF3.6.20. However it doesnot work on Firefox versions > 4. Please help me in understanding what was wrong with the above code.</p>
| javascript | [3] |
1,522,045 | 1,522,046 | wrapping JavaScript tracking code | <p>I have following tracking code from Piwik.</p>
<pre><code><!-- Tracking Code -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://example.com/" : "http://example.com/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 29);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="http://example.com/piwik.php?idsite=29" style="border:0" alt="" /></p></noscript>
<!-- Tracking Code -->
</code></pre>
<p>I want to hide following code, so I think I can put this code in some js file, and load it using following code.</p>
<p>But I don't know how can I do it. Help required here.</p>
<p>Secondly, I need to change site id (in above example, is 29), which will be different for different site.</p>
<p>How can I pass site-id to custom file that I will make, and execute above code.</p>
| javascript | [3] |
637,742 | 637,743 | Finding and combining lines (Strings) together | <p>So I have a String/txt file:
<code>All purchases: blabla : 1 derp : 20 blabla : 1 herp : 30</code> </p>
<p>This is just an example, a real file will be generated based on the users input</p>
<p>So what I need to do is combine the similar strings with similar names (First part) together and make them look like this: <code>(name) : (number) x(amount of same strings)</code></p>
<p>For example lets take the file that we had:
<code>All purchases: blabla : 1 derp : 20 blabla : 1 herp : 30</code></p>
<p>After parsing it must look like: <code>All purchases: blabla : 1 x2 derp : 20 herp : 30</code></p>
<p>I have tried writing down the last value into a variable and checking it with the next value, but what if the values are in a different order? That's where I got stuck.</p>
| java | [1] |
2,260,900 | 2,260,901 | Best php practise display errors | <p>Is there best practice about display errors in during controller action executing on view? I mean, how do you display errors when 'login was not found in database' or 'input value has incorrect format', or 'field require value'?</p>
<p>Is there array with errors or anything else? Now my code looks like:</p>
<pre><code>if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$siteName = isset($_POST['SiteName']) ? trim($_POST['SiteName']) : null;
$siteUrl = isset($_POST['SiteUrl']) ? trim($_POST['SiteUrl']) : null;
if(IsNullOrEmptyString($siteName) || IsNullOrEmptyString($siteUrl)) {
exit('Site name or site url could not be empty');
} elseif (!preg_match('/^http\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?$/', $siteUrl)){
exit('Site url has wrong format');
}
$filters = array('SiteName' => $siteName, 'SiteUrl' => $siteUrl);
if($sitesRepository->select($filters)) {
exit('Site is already exist');
}
}
</code></pre>
<p>But if i use exit, my page doesn't continue to display. </p>
| php | [2] |
3,117,940 | 3,117,941 | Drag and drop of multiple rows in jqgrid | <p>I am loading data in jqGrid using follwoing method....</p>
<pre><code>JqGridHandler.ashx handler code
public class JqGridHandler : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "application/json";
string data ="proper data in jason format";
context.Response.Write(data);
}
public bool IsReusable {
get {
return false;
}
}
}
</code></pre>
<p>If I change any row using DND then how should I get chaged data on clident side....?
My aim is to save data in database from code behind file(XXX.aspx.cs).</p>
| asp.net | [9] |
2,750,431 | 2,750,432 | How expensive is .getClass() in Java? | <p>I'm in the process of porting over a certain data processing algorithm from Java to C++. The reason for re-writing the code is portability, it needs to run in environments where Java is not available. However, as a side benefit some performance improvement was expected.</p>
<p>Basically, the algorithm reads data from a graph made up of objects with pointers to each other and then computes a result. During the computation numerous object allocations are made, so perhaps this is responsible for the slowdown. The thing is, the C++ code currently runs about 10 times faster than the old Java code. This was really unexpected. I only thought I'd see an improvement of maybe 50-60%.</p>
<p>Unfortunately, I'm not at liberty to post the code here for analysis. It's several thousand lines, so I'm not sure how convenient that would be anyway.</p>
<p>The thing is, the algorithm is almost exactly the same. The only major difference I can think of is in Java there are many daughter classes of a single super class and if(object.getClass() == daughterx.class) is called many times during the computation whereas in the C++ code only one general class is used (since there are few code differences between the daughter classes) and a simple integer comparison is used eg. if(object->type == 15)</p>
<p>How expensive is the Object.getClass() method in Java? What exactly is happening at the low-level when this method is invoked?</p>
| java | [1] |
1,333,335 | 1,333,336 | Time difference while taking into a/c | <p>If we have 2 dates
Previous Date : Wed Jun 02 17:30:00 CDT 2010
Next Date : Sun Feb 13 22:00:00 CST 2011
and need to find difference in mins. between these 2 dates</p>
<p>Is there a way to accurately get it?</p>
| java | [1] |
2,404,349 | 2,404,350 | Difference between "force stop" and leaving the phone for a few hours | <p>I've had a couple of game apps on the market which attempt to save the users progress through the game with some code like this (simplified):</p>
<pre><code>public class Globals extends Application
{
public void onCreate()
{
settings = getSharedPreferences("MyPrefsFile", 0);
}
public void get_state()
{
synchronized (this)
{
game_progress = settings.getInt("progress", 1);
}
}
public void save_state()
{
synchronized (this)
{
SharedPreferences.Editor editor = settings.edit();
editor.putInt("progress",game_progress);
editor.commit();
}
}
}
</code></pre>
<p>This appears to work fine 99% of the time but every now and then I have had reports from users that their progress was lost, but nobody has ever been able to give me a sequence of actions which will enable me to repeat the bug... until now. The steps involve pressing the "home" button to exit the program and then waiting several hours. Then when they run the game again, their progress is lost. Frustratingly this sequence can not be shortened, doing a "force stop" instead of leaving the phone for several hours does not have the same effect.</p>
<p>Presumably if the phone is left for a few hours, some or all of the activities within the application may get shut down in a way which is subtly different from a force stop... but I have no idea how.</p>
<p>Any ideas?</p>
<p><strong>EDIT:</strong> I should explain how these functions are called from the various activities that comprise my games. Here's an example, but I call gs.save_state() from several other places too, just for good measure.</p>
<pre><code> public class Main_GamePlay extends Activity
{
Globals gs;
public void onCreate(Bundle savedInstanceState)
{
gs = ((Globals) getApplicationContext());
}
protected void onPause()
{
gs.save_state();
}
}
</code></pre>
| android | [4] |
1,451,265 | 1,451,266 | Reading Excel by OLEDB reads strings as DBNull | <p>I am reading Excel file using OLEDB in Csharp i have shown the sample excel data what i have</p>
<pre><code>F1 F2 F3 F4
India 23 44 4
China 4 8 Month 6
USA 45 Neg 4
</code></pre>
<p>When i read this data and check in my DataTable i get Null values for "Month 6" and "Neg"
where as i can be able get the F1 column correctly... my connection string is as shown </p>
<p>Provider=Microsoft.ACE.OLEDB.12.0;Data Source=[XLSource];Extended Properties=Excel 12.0;</p>
<pre><code>OleDbDataReader dr;
OleDbConnection conExcel = new OleDbConnection();
conExcel.ConnectionString = ConnectionString
conExcel.Open();
OleDbCommand cmdExcel = new OleDbCommand();
cmdExcel.Connection = conExcel;
cmdExcel.CommandText = "SELECT * FROM Sheet1$";
dr = cmdExcel.ExecuteReader();
DataTable dtExcel = new DataTable();
dtExcel.Load(dr);
</code></pre>
| c# | [0] |
4,813,369 | 4,813,370 | jquery date time picker | <p>could any body tell how to use Jquery calendar date time picker.</p>
| jquery | [5] |
3,516,811 | 3,516,812 | What I need to declare in this scope? | <p>I'm doing this little program in C++ but in codeblocks appears the following error: error: </p>
<blockquote>
<p>'atod' was not declared in this scope</p>
</blockquote>
<p>What I'm missing in this code? Thank you.</p>
<pre><code>#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
#include <fstream>
#include <math.h>
#include <iostream>
using namespace std;
class birth{
};
int main (void){
int pass=1;
string date, boy, aux1, aux2, aux4;
double f;
while(pass=! 0){
cout<<"Enter the name of the birthday boy"<<endl;
cin>>boy;
cout<<"Enter the date of birth" <<endl;
cin>>date;
aux1= aux1.substr(5,10);
f= atod(aux1);
f=2012-f;
cout<< "The birthday boy "<<boy<<"who born"<<date<<"now have"<<f<<"years"<<endl
cout<<"Do you want to enter more birthdays?"<<endl;
cout<<"1.- YES"<<endl;
cout<<"2.- NO"<<endl;
cin>>pass;
}
system ("pause");
return 0;
};
</code></pre>
<p>EDIT: The problem is in this line:</p>
<pre><code> f= atod(aux1);
</code></pre>
| c++ | [6] |
4,415,190 | 4,415,191 | How do I convert inline JS coding into an external style sheet? | <p>I have JS code in both the body and head portions of my page. If I wanted to have them be in an external .js file, how would I move them over and then call them back onto the page?</p>
<p>Head - </p>
<pre><code><script language="Javascript">
setInterval("settime()", 1000);
function settime () {
var curtime = new Date();
var curhour = curtime.getHours();
var curmin = curtime.getMinutes();
var cursec = curtime.getSeconds();
var time = "";
if(curhour == 0) curhour = 12;
time = (curhour > 12 ? curhour - 12 : curhour) + ":" +
(curmin < 10 ? "0" : "") + curmin + ":" +
(cursec < 10 ? "0" : "") + cursec + " " +
(curhour > 12 ? "pm" : "am");
document.date.clock.value = time;
}
</script>
</code></pre>
<p>Body - </p>
<pre><code><script language="JS" type="text/javascript">
var monthArray = new Array("January", "February", "March", "April", "May",
"June", "July", "August", "September",
"October", "November", "December");
var today = new Date();
var todayMonth = today.getMonth();
var todayDate = today.getDate();
var todayYear = today.getFullYear();
document.write(monthArray[todayMonth] + " " + todayDate + ", " + todayYear);
</script>
</code></pre>
| javascript | [3] |
3,586,016 | 3,586,017 | Difference between putback() and unget() | <p>I'm using a Standard iostream to get some input from a file, and I'm confused about <code>unget()</code> versus <code>putback(character)</code>. It seems to me from the documentation that these functions are effectively identical, where <code>unget()</code> just remembers the character put in, so I'm nervous. I've always used <code>putback(character)</code>, but <code>character</code> is always the last read character and I've been thinking about changing to <code>unget()</code>. Is <code>putback(character)</code> always identical to <code>unget()</code>, if <code>character</code> is always the last read character?</p>
| c++ | [6] |
2,612,414 | 2,612,415 | What's the complete / correct method of sending email via PHP? | <p>I've tried the <code>mail</code> function and it works fine. Now what all I need to add to it? When the content of mail is formed by user input.</p>
<p><a href="http://php.net/manual/en/function.mail.php" rel="nofollow">Doc</a> says that lines (separated by <code>\n</code>) shouldn't be larger than 70 characters. So should I do wordwrap before using the mail function? Should I take care of full stops at the start of the lines? What else?</p>
<p>The doc also recommends PEAR's mail package for complex mails and sending large volumes of mail together. I've never used PEAR, how it's? What are the alternatives and how to choose among them?</p>
| php | [2] |
2,420,372 | 2,420,373 | Unmanaged native C code to .NET compatible | <p>The entire code for the dll has written using native C and one function is below for your reference.</p>
<p>DllImport int32 FAR PASCAL swe_calc(
double tjd, int ipl, int32 iflag,
double *xx,
char *serr);</p>
<p>Most of the functions are written using FAR PASCAL and when I tried to convert this dll to compatible with .net I was endup with errors.</p>
<p>I tried by changing the Comman Runtime Support property from "No Common Runtime Support" to Common Runtime Support (ie \clr). and Changed the \MD also.</p>
<p>when I tried registering the dll using Regsvr32 from command prompt I got the error stating that "The Module "mydll.dll" was loaded by the entry point DllRegisterServer was not found".</p>
<p>I like to use this dll from my C# application, It will be really great if any one help me out with this.</p>
<p>Thanks in Advance.</p>
<p>Gan</p>
| c# | [0] |
5,568,372 | 5,568,373 | Why assign `this` to `self` and run `self.method()`? | <p>I'm reading the source from mongoose: <a href="https://github.com/LearnBoost/mongoose/blob/master/lib/collection.js#L40" rel="nofollow">https://github.com/LearnBoost/mongoose/blob/master/lib/collection.js#L40</a></p>
<pre><code>Collection.prototype.onOpen = function () {
var self = this;
this.buffer = false;
self.doQueue();
};
</code></pre>
<p>I don't understand why the author assign <code>this</code> to <code>self</code> and run <code>self.doQueue()</code>. Why don't just run:</p>
<pre><code>this.buffer = false;
this.doQueue();
</code></pre>
<p>I'm new to javascript, thanks for help.</p>
| javascript | [3] |
3,455,462 | 3,455,463 | Comparing two objects | <p>Is there any way to check if two objects have the same values, other than to iterate through their attributes and manually compare their values?</p>
<p>Thanks in advance!</p>
| python | [7] |
2,806,058 | 2,806,059 | Cursor Exception | <p>I have created a database and i want to retrieve some data from the database by using the cursor by i always get this error</p>
<pre><code>04-19 20:02:56.747: E/AndroidRuntime(301): android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 1
04-19 20:02:56.747: E/AndroidRuntime(301): at android.database.AbstractCursor.checkPosition(AbstractCursor.java:580)
04-19 20:02:56.747: E/AndroidRuntime(301): at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:214)
04-19 20:02:56.747: E/AndroidRuntime(301): at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:41)
</code></pre>
<p>here is the code of the function</p>
<pre><code>public double getlatitude(String[] i,int x) {
// TODO Auto-generated method stub
String[] columns = new String[] { KEY_SQUAREID, KEY_SQUARELATITUDE, KEY_SQUARENAME,
KEY_SQUARELONGITUDE
};
Cursor c;
c=ourDatabase.query("squares", columns,"squarename=?",i, null, null, null);
String latitude = null;
if (c.moveToFirst()) {
latitude=c.getString(0);
}
double latitude_double=Double.parseDouble(latitude);
return latitude_double;
}
</code></pre>
| android | [4] |
5,110,231 | 5,110,232 | Remove this Yellow Color from Gestures | <pre><code>mLibrary = GestureLibraries.fromRawResource(this, R.raw.spells);
if (!mLibrary.load())
{
finish();
}
GestureOverlayView gestures = (GestureOverlayView) findViewById(R.id.gestures);
gestures.addOnGesturePerformedListener(this); gestures.getGestureColor();
</code></pre>
<p>How to Remove this Yellow Color from Gestures...</p>
<p>I don't any color when i drag one start position to end. please help me for android code </p>
| android | [4] |
2,815,463 | 2,815,464 | Python: Looping through all but the last item of a list | <p>I would like to loop through a list checking each item against the one following it.</p>
<p>Is there a way I can loop through all but the last item using for x in y? I would prefer to do it without using indexes if I can.</p>
<p><strong>Note</strong></p>
<p>freespace answered my actual question, which is why I accepted the answer, but SilentGhost answered the question I should have asked.</p>
<p>Apologies for the confusion.</p>
| python | [7] |
1,980,026 | 1,980,027 | why does python os.path.isfile seem to ignore certain file types? | <p>simple script on a unix system (Mac) which seems to only return certain files True. Can't figure out why:</p>
<pre><code>workdir = '/Volumes/place/sub place'
def myFunc(bla, dir, flist):
for f in flist:
print f, os.path.isfile(f)
os.path.walk(workdir,myFunc,None)
</code></pre>
<p>Returns:</p>
<pre><code>tests.py False
utils.py False
utils.pyc False
writeXmlForMpgInPath.py False
.DS_Store True
Playout False
Playout Masters False
Projects False
ProRes Masters False
Source False
Sydney Playout Masters False
Web Preview False
.AU009644-M.xml.swp False
.DS_Store True
.DS_Store True
.DS_Store True
.DS_Store True
</code></pre>
| python | [7] |
4,632,488 | 4,632,489 | framework.jar is updated properly , but contact code is using old value | <p>let me explain my question:
I have separated contact app from ICS. which is installed in my simulator. This app uses "RawContacts.CONTENT_URI" in many places in code base, which is defined in "frameworks/base/core/java/android/provider/ContactsContract.java". Now my purpose is to change the value of of "CONTENT_URI", so that whenever it is used in Contact code base it will get this newly assigned value.</p>
<h1>So I changed the in the framework code</h1>
<p>public final class ContactsContract {
/** The authority for the<code>enter code here</code> contacts provider */
public static final String AUTHORITY = "com.android.xyz.contacts";
=========================================================================
then i full build ICS 4.0.3 and then use the framework.jar in my Separated Contact app so that when ever Contacts refers "RawContacts.CONTENT_URI" it gets updated value , i.e. "content://com.android.xyz.contacts/raw_contacts". </p>
<p>BUT the problem is When I run my separated Contact app I am getting "content://com.android.contacts/raw_contacts". as a value of "RawContacts.CONTENT_URI". though ContactsContract.class file is updated with "content://com.android.xyz.contacts/raw_contacts". I think I make u understand my problem. Thanks</p>
| android | [4] |
644,469 | 644,470 | mktime and date questions | <p>I am working on a small project and am playing with date() and mktime() in PHP. Compare the two code blocks and their output, notice the second sample adds one to the month in it's first mktime.</p>
<pre><code>$monthis = 5;
echo date('F', mktime(0,0,0,$monthis,0,0)) . " 1, 2010 is on a " . date("l F", mktime(0, 0, 0, $monthis, 1, 2010));
</code></pre>
<p>puts out</p>
<blockquote>
<p>April 1, 2010 is on a Saturday May</p>
</blockquote>
<p>but if I change it to</p>
<pre><code>$monthis = 5;
echo date('F', mktime(0,0,0,$monthis + 1,0,0)) . " 1, 2010 is on a " . date("l F", mktime(0, 0, 0, $monthis, 1, 2010));
</code></pre>
<p>puts out</p>
<blockquote>
<p>May 1, 2010 is on a Saturday May</p>
</blockquote>
<p>Why do I have to add one to the month in the first mktime so that both emit the same month?</p>
<p>Any help or clarity would be appreciated. Thanks :)</p>
| php | [2] |
4,405,535 | 4,405,536 | circular class member pointer? | <p>I am not sure if I can describe the problem, but I will try my best. Here is the situation:</p>
<p>If I can want a class1 has a pointer as a member variable pointing to another class, class2. Meanwhile, I want class2 also has a pointer as a member variable pointing to class1. Is that possible?</p>
<pre><code>class Class1
{
private:
Class2* classptr;
... ...
public:
... ...
};
class Class2
{
private:
Class1* classptr;
... ...
public:
... ...
};
</code></pre>
<p>It appears to me that none of Class1 and Class2 has been recognized as an identifier. I guess none of Class1 and Class2 is created. Correct me if I am wrong. </p>
| c++ | [6] |
2,896,141 | 2,896,142 | Javascript issue confim message | <p>I made a short Javascript function:</p>
<pre><code>function confirmMessage() {
var messages = confirm("Are you sure");
if(messages) {
//go trough
}else{
//stop, cancel the action
return false;
}
}
</code></pre>
<p>HTML:</p>
<pre><code><a href='?pagina=uitloggen' onclick="confirmMessage()">
</code></pre>
<p>When I click cancel, it returns false and jumps to the else statement. But it doesn't stop the action! What is the problem here?</p>
<p>Thanks in advance.</p>
| javascript | [3] |
3,649,365 | 3,649,366 | JQuery console log to file | <p>I'm trying to find a good jQuery plugin that will log console errors to a file so I can track any errors users are experiencing. </p>
<p>Any ideas?</p>
| jquery | [5] |
4,891,180 | 4,891,181 | Concatenation inside a parameter | <p>I'm trying to concatenate my increment variable inside the getElementById parameter. I can concatenate using createElement using the increment value, however when I try to concatenate the variable inside getElementbyId, its a no go.</p>
<pre><code>var newdiv = document.createElement("form");
newdiv.setAttribute('id', 'form' + t);//t == increment
newdiv.innerHTML = "<br/>" + t + Menu();
$("newline").appendChild(newdiv);
alert(
document.getElementById("form" + t).innerHTML //does not work
document.getElementById("form0").innerHTML //needs to "look" like
)
</code></pre>
| javascript | [3] |
657,872 | 657,873 | what does % do in javascript | <p>I'm trying to convert some JavaScript code into Java but do not know what the <code>%</code> character between two numeric variables does:</p>
<pre><code> testvalue= somevalue%anothervalue;
</code></pre>
<p>What does this mean or what would the same statement be in Java?</p>
<p>I also have this in javascript</p>
<pre><code> if(somevalue%2==1){
}
</code></pre>
<p>What does <code>%2</code> mean here?</p>
| javascript | [3] |
1,158,016 | 1,158,017 | Directory indicator on windows and on Linux. | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3548775/platform-independent-paths-in-java">Platform independent paths in Java</a> </p>
</blockquote>
<p>I make a program but it save some files in a directory that the user selects.</p>
<p>I need to make this program to work both in linux and windows , so for example on windows the directory seperator is <code>\</code> and on linux is <code>/</code> ...</p>
<p>How can I import one value that represents both depending the operating system?</p>
| java | [1] |
1,294,323 | 1,294,324 | Copy complex object hierarchy in Java | <p>I have a complex object hierarchy that has a couple of extends. </p>
<blockquote>
<p>class One {
String name;
Color color;
List clothes; }</p>
<p>class Two extends One {
Test test; }</p>
<p>class Foo { One One; Two two; }</p>
</blockquote>
<p>I want to copy all the attributes of a object of class One into a new object of class say another.
How to do this ? Is there any library available ?</p>
| java | [1] |
3,387,012 | 3,387,013 | ASP.NET: Best way to manage global resources? | <p>I've a couple of email templates and I would like to store each in a sepparate file. I'd like to avoid having to read them from disc everytime I need them. Is there any built in structure in ASP.NET that automatically loads them when needed and shares this resources throughout the application?</p>
| asp.net | [9] |
4,085,361 | 4,085,362 | How do I get 'Content-Length' via javascript? | <p>I have the following snippet:</p>
<pre><code>var size;
function getImageSize(url)
{
var xhr = new XMLHttpRequest();
xhr.open('HEAD', url, true);
xhr.onreadystatechange = function()
{
if (xhr.readyState == 4)
{
if (xhr.status == 200)
{
size = xhr.getResponseHeader('Content-Length');
alert(size);
}
}
};
xhr.send(null);
return size;
}
</code></pre>
<p>The purpose of the function is to return the file size (of a image).</p>
<p>The alert inside the function will always return the correct value, however the function itself will always return <code>undefined</code>. Why? </p>
<p>Odly, if I debug it with firebug, the function will always return correctly...</p>
| javascript | [3] |
3,122,066 | 3,122,067 | What should be the format string to print "0x0" with swprintf()? | <p>I tried with <code>swprintf(buff, 4, L"%#03x", value)</code>, but when <code>value = 0</code>, I get <code>000</code> instead of <code>0x0</code>. </p>
| c++ | [6] |
617,948 | 617,949 | HttpContext.Current.Server.HtmlEncode return Object reference not set to an instance of an object | <pre><code>string htmlEncode = HttpContext.Current.Server.HtmlEncode(value);
return Object reference not set to an instance of an object.
</code></pre>
<p>Value is number or string. I use this in console app. Why i can't use HttpContext.Current.Server.HtmlEncode?</p>
| c# | [0] |
2,695,087 | 2,695,088 | XML parsing returns null when using Android Fragments for honeycomb | <p>I am trying to parse an XML file and fetch its contents and display in a ListFragment. It is working fine for 1.6 to 2.2 SDK(Without fragments). When I try to use fragments such that on clicking one fragment listitem, it must display another ListFragment beside it by parsing an XML, I get response as null. Has anyone worked on XML parsing using Fragments in Android? If there are tutorials related to this, kindly post the link for the same</p>
| android | [4] |
3,386,999 | 3,387,000 | std::stringstream efficient way to get written data, copy to another stream | <p>Without writing a custom rdbuf is there any way to use a stringstream efficiently? That is, with these requirements:</p>
<ul>
<li>the stream can be reset and writing start again without deallocating previous memory</li>
<li>get a const char* to the data written (along with the length) without creating a temporary</li>
<li>populate the stream without creating a temporary string</li>
</ul>
<p>If somebody can give me a definitive "no" that would be great.</p>
<p>Now, I also use boost, so if somebody can provide a boost alternative which does this that would be great. It <em>has</em> to have both istream and ostream interfaces available.</p>
| c++ | [6] |
2,491,335 | 2,491,336 | How can i convert my app data into JSON object to send to server | <p>Iam new to ANDROID. I want to send some data to server in JSON format. How can i convert my data mobilenumber, and message into JSON format in my java file. Then i want to send it through "https". How can i send??? Please help me. </p>
| android | [4] |
4,896,213 | 4,896,214 | In Python is it bad to create an attribute called 'id'? | <p>I know that there's a function called id so I wouldn't create a function or a variable called id, but what about an attribute on an object?</p>
| python | [7] |
4,300,403 | 4,300,404 | Android popup dialog | <p>I'm trying to find a way to create a popup screen for some user input which includes radio button, editText, button. I don't want to start a new activity.
what would be a good option? AlertDialog? Spinner?Popup menu?
Thanks</p>
| android | [4] |
4,057,101 | 4,057,102 | public boolean onKey() called twice? | <p>Hi i am using following code </p>
<pre><code>public boolean onKey(View v, int keyCode, KeyEvent event) {
msg = (EditText)findViewById(R.id.msg);
String message = msg.getText().toString();
if(keyCode == 66)
{
//Its hitting here twice.
}
return false;
};
</code></pre>
<p>Can anyone please tell me why its hiiting twice when i press enter??</p>
| android | [4] |
85,408 | 85,409 | Simple Validate for Months with Jquery | <p>What Im trying to do is validate a text field with just jquery. So What I want it to do is basically look into an array with the month names, and lets say the person spells the month wrong it doesnt submit.</p>
<p>I'm not sure how to begin this. </p>
| jquery | [5] |
1,268,967 | 1,268,968 | PHP: Echoing Variables Error | <p>Goal: To display a category select-box and its corresponding subcategory select-box. MySQL table is set up to have id(primary key), master_id(referencing on the primary key) and name. I set 4 error code blocks and after debugging i keep getting "error 2:true". Thus, displaying a category but no subcategory. How come i keep getting this error? Is there something missing?</p>
<p><strong>PHP comparing category&value to display on the subcategory selectbox</strong>
<pre><code>if (!empty($_GET['id']) && !empty($_GET['value'])) {
$id = $_GET['id'];
$value = $_GET['value'];
try {
$objDb = new PDO("mysql:host=" . $host . ";dbname=" . $db, $user, $pass);
$sql = "SELECT * FROM `categories` WHERE `master_id`=?";
$statement = $objDb->prepare($sql);
$statement->execute(array($value));
$list = $statement->fetchAll(PDO::FETCH_ASSOC);
}
?>
</code></pre>
| php | [2] |
4,816,197 | 4,816,198 | Enum for common names in Request.Form collection | <p>Does ASP.NET contains any enumerator for common field names used in Request.Form collection such as "_<em>EVENTTARGET" and "</em>_EVENTARGUMENT"? I need to refer to those names in multiple places in my app and I would love to be able to type something like <code>this.Page.Request[CommonRequestNames.EventTarget]</code> instead of hard-coding them.</p>
| asp.net | [9] |
3,217,996 | 3,217,997 | checking condition onclick event of a button | <p>Is it possible to check if (condition) onclick of an event of a button? Because I need to check two functions which are in separate .js files. Also, both the functions should return true to continue forward.</p>
<pre><code>Example:
<input type="button" name="saveButton" onclick="" value="Save" />
Two functions are validateSelect() in one .js file and validateSave() in
another .js file.
</code></pre>
<p>validateSave() will only be called if validateSelect() returns true. So can we check onclick event of button?</p>
| javascript | [3] |
29,897 | 29,898 | Response.Redirect to another server in ASP.net 3.5 | <p>In my application i want to link the user to yahoo.com.
I wrote the following code.</p>
<p><code>Response.redirect("Yahoo.com")</code> </p>
<p>and it appends it with the application path!!!</p>
<p>Please send ur suggestions...</p>
| asp.net | [9] |
1,543,750 | 1,543,751 | Android Flip Animation between Activity and Activity Group | <p>I have an Activity with some buttons. On click of Button,Next Screen is displayed. The new Screen is displayed on a TabHost. I want to apply Flip Screen Transition between current Activity and the TabActivity.</p>
<p>Any help would be appreciated.
Thanks in Advance.</p>
| android | [4] |
106,896 | 106,897 | Condition that returns false if image has certain name? | <p>I need to make a condition with PHP that checks if an image is called "forums.citrix.com" and returns true if it doesn't.</p>
<p>The image is displayed with this code:</p>
<pre><code><img style="padding:4px; width:16px;" src="http://getfavicon.appspot.com/http://<?php echo "$urlhost[0]"?> />
</code></pre>
<p>I don't know how to do it with php. Or maybe it has to be done with javascript. How could I do it?</p>
<p>Thanks</p>
| php | [2] |
1,787,516 | 1,787,517 | Javascript: Line Break after first comma | <p>I have an address that is being pulled from database that interacts with Google Map API. When displaying results my address renders as follows:</p>
<p>456 Here Street, City, AL 36723</p>
<p>What would be a solution for entering a line break after </p>
<blockquote>
<p>465 Here Street</p>
</blockquote>
<p>So that the address would display as </p>
<pre><code>456 Here Street
City, AL 36723
</code></pre>
| javascript | [3] |
624,708 | 624,709 | Question about when a script is executed after appending it | <p>In my code, I have javascript that dynamically adds another script to the page:</p>
<pre><code>created_script=document.createElement('script');
created_script.src='other_script';
created_script.type='text/javascript';
document.head.appendChild(created_script);
</code></pre>
<p>in this 'other script', I have a function called reloader().</p>
<p>The problem I'm having is that right after I dynamically add the script, I try to call the function reloader(), but I'm getting a reloader is not defined error.
Here's is like what I am doing:</p>
<pre><code>created_script=document.createElement('script');
created_script.src='other_script';
created_script.type='text/javascript';
document.head.appendChild(created_script);
reloader();
</code></pre>
<p>Can someone explain to me why this doesn't work and how should I fix this so that reloader() can be called after appending the script in a single dynamic call (if possible at all)?</p>
| javascript | [3] |
2,625,642 | 2,625,643 | C# IsAdministrator Method | <p>I have an application that enumerates a list of services running on a server. I need to see if the user that is running the service is an administrator on the box. I'm looking to build a method that would accept a value of "domain\username" and would query to determine if the account is an administrator. The result would be a returned true/false boolean value. Every sample that I find is referencing the WindowsIdentity.GetCurrent() method. GetCurrent isn't going to work as I need to specify the user account. </p>
<p>I'm not having any luck researching other options. Any assistance would be appreciated. Thanks</p>
| asp.net | [9] |
520,772 | 520,773 | Getting Selected values off Iframe | <p>I have my dial page where i have dial with needle. Needle follows the cursor. On-click on the dial angle is given. The angle value is from js.query. I imported the dial page to my main page using iframes.I get dial image and angle within the frame but my question is how do i get the angle to appear somewhere else instead in my main page.
This is how i imported my dial image on the main page.I would appreciate your help</p>
<pre><code><iframe name="clkwise1" id="clkwise1" src="Dial1.htm" width=150 height=215 frameborder=0 scrolling="no" ></iframe>
</code></pre>
| javascript | [3] |
3,840,769 | 3,840,770 | Apprise Alert Flashes and Goes Away | <p>I have been trying to get the "Apprise" alert <a href="http://thrivingkings.com/read/Apprise-The-attractive-alert-alternative-for-jQuery" rel="nofollow">plugin</a> to work on my website. I have all of the necessary files, so that isn't the problem.</p>
<p>What happens is that when I click on a 'Submit' button, I can see the alert on the screen for a split second before it just disappears.<br>
When I use the regular <code>alert()</code>, and not <code>apprise()</code>, the alert stays there and there are no problems.</p>
<p>It seems to be a problem whenever I use the <code><a></code> tag, because I can use the "li" tag with <code>apprise()</code> and it works perfectly. Do you know why it would flash and then go away right away? </p>
<p>Any help is appreciated.</p>
| jquery | [5] |
3,144,788 | 3,144,789 | C#: Need to check if file array is empty | <p>I am checking for files in two locations. If location 1 is empty, the code should check location 2.</p>
<p>The problem is that the "files == null" condition is never met.</p>
<p>I need a better way to check if the files array is empty.</p>
<p>Here is my code:</p>
<pre><code>files = Directory.GetFiles(fileTargetFolder);
if (files == null) // if no files, check 2nd location
{
files = Directory.GetFiles(fileTargetFolder2);
}
</code></pre>
| c# | [0] |
3,437,249 | 3,437,250 | How to sort list of dicts in js? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/979256/how-to-sort-an-array-of-javascript-objects">How to sort an array of javascript objects?</a> </p>
</blockquote>
<p>How to sort list of dicts in js?</p>
<p>I have:</p>
<pre><code>[{'car': 'UAZ', 'price': 30 ,'currency': 'RUB'}, {'car': 'Mazda', 'price': 1000 ,'currency': 'USD'},{'car': 'Zaporozhec', 'price': 2 ,'currency': 'RUB'}, {'car': 'GAZ', 'price': 0 ,'currency': 'RUB'}]
</code></pre>
<p>I want to have it sorted by price and currency:</p>
<pre><code>[{'car': 'Mazda', 'price': 1000 ,'currency': 'USD'}, {'car': 'UAZ', 'price': 30 ,'currency': 'RUB'},{'car': 'Zaporozhec', 'price': 2 ,'currency': 'RUB'}, {'car': 'GAZ', 'price': 0 ,'currency': 'RUB'}]
</code></pre>
| javascript | [3] |
3,607,001 | 3,607,002 | How can i get Printer Name from PC | <p>i need to get printer name from device and printer from on windows and put it on </p>
<pre><code><select id="printerName" name="PrinterName">
<option value="Name Of Printer"> Name Of Printer</option>
....
</select>
</code></pre>
| php | [2] |
2,120,352 | 2,120,353 | Any danger of using PHP getimagesize function? | <p>I have this host that disables allow_url_fopen as they said it is a security risk which in turns prevents my use of getimagesize function because I am passing in a http.</p>
<p>My site is on Wordpress and I am using getimagesize to pull in a image within the uploads folder of a Wordpress site which obviously contains http://. </p>
<p>So my question is if this is not safe? If it is not safe, how can this be done within a Wordpress environment?</p>
<p>Thanks.</p>
| php | [2] |
4,208,352 | 4,208,353 | Return value from PHP function | <p>what is wrong with the following code? Hope you understand what i´m trying to do. Im not very familiar with functions.</p>
<pre><code>funtion test ($variable) {
$one = 3;
if ($variable == 10) {
$one = "2";
}
return $one;
}
foreach ($array as $arraypart) {
$part = explode(',',$arraypart);
test($part[0]);
echo $one;
}
</code></pre>
| php | [2] |
5,544,386 | 5,544,387 | Android images, density, and screen pixels | <p>I am confused by Android documentation about this questions so I will ask them here:
I have HTC Desire mobile on this <a href="http://en.wikipedia.org/wiki/List_of_displays_by_pixel_density" rel="nofollow">link</a> I see that it has pixels 480×800 and Density 252</p>
<ol>
<li>When I try to get Density like this getResources().getDisplayMetrics().densityDpi I get value 240 and not 252.</li>
<li>I have image with size 400x113 with Density 240(Pixels/Inch) And when I try to get size in program with getWidth and getHeight it said 600 and 170.</li>
<li>What size my image need to be for this phone HTC Desire and which Density it need to have.</li>
</ol>
<p>Thanks.</p>
| android | [4] |
5,945,845 | 5,945,846 | j2ee server setup and beginners tutorial | <p>I've got basic to intermediate knowledge of java and would like to install a j2ee server on my debian machine. Can anyone tell me what I need or point me in the right direction to a good tutorial?</p>
<p>Thanks</p>
<p>--Mark</p>
| java | [1] |
1,086,225 | 1,086,226 | help! Creating a Spreadsheet using a multidimensional array c++ | <p>I have to create a simple spreadsheet program looks like this</p>
<pre><code> A B C D E F G
0
1
2
3
4
</code></pre>
<p>that can set values to cells by user input A1 24.2 ,then set the value 24.2 in A1 and store it,the same user could enter: C3 /, A1, B2 to cause the cell C3 to contain the
quotient of the contents of cells A1 and B2, </p>
<p>i wonder know how to take a two dimensional array and be able to access the the elements of the array and Displays the spreadsheet with all values entered or calculated
the code i had so far</p>
<pre><code>class SpreadSheet{
public:
const static int nRows = 10;
const static int nCols = 10;
SpreadSheet();
ofstream myFile;
ifstream retFile;
void displaySheet();
void displayFileSheet(char *);
void refreshFile();
void inSpreadSheet();
void setSheet(const string[nRows][nCols]);
void setCell(int , int, string);
string getCell(int, int);
private:
string sheet[nRows][nCols];
};
</code></pre>
<p>then i got stuck, any one </p>
| c++ | [6] |
741,305 | 741,306 | datetime.now first and last minutes of the day | <p>Is there an easy way to get DateTime.Now's "TimeMin" and "TimeMax"</p>
<p>Thanks,
rod.</p>
| c# | [0] |
4,276,907 | 4,276,908 | message sending while pressing the button | <p>I am creating basic application in android and i am beginner of the android devloping.</p>
<p>I am creating the application which the numbers of inbuild messages in that when user click on send sms then that message deliver to user using their message box</p>
<p>in that below gives the snapsot.</p>
<p><img src="http://i.stack.imgur.com/8TuNU.png" alt="enter image description here">
Please help to slove this problem..</p>
<p>Thanx in advance
@androidTec.</p>
| android | [4] |
5,471,025 | 5,471,026 | Finding what it redirects to | <p>I'm using the "Snoopy" class to pick up HTML for phrasing.</p>
<p>The problem is that with one of the pages I need to get the html for redirects automatically because I'm using a the sites search and if it find a perfect result it will redirect.</p>
<p>Here is my snoop:</p>
<pre><code>if($snoopy->fetch("http://www.rottentomatoes.com/search/?search=$pagelink&sitesearch=rt")){
$printable = $snoopy->results;
</code></pre>
<p>If the search is exact it will place me on a page like this...</p>
<blockquote>
<p><a href="http://www.rottentomatoes.com/m/captain-america/" rel="nofollow">http://www.rottentomatoes.com/m/captain-america/</a></p>
</blockquote>
<p>I need this above link.</p>
<p>Any help would be great,</p>
<p>Thanks!</p>
| php | [2] |
4,038,684 | 4,038,685 | How do I convert an OctetString into a readable String(C#)? | <p>I'm using a SNMP library for C# and it doesn't have a good documentation.
When I request a Date it's returning me a OctetString and I'm not sure what to do with it.</p>
<p>When I convert it to String it become this:
07 DC 02 17 0F 14 0E 00 2D 02 00</p>
| c# | [0] |
924,663 | 924,664 | PHP Parse error... syntax error unexpected '(', expecting T_STRING or T_VARIABLE or '{' or '$' | <p>I can't figure out where this error is located. Line 1 is <code><?php</code> also i'm using a phpIDE app and its not showing any errors / missing braces. </p>
<p>PHP Parse error: <strong>syntax error, unexpected '(', expecting T_STRING or T_VARIABLE or '{' or '$' in /home/ratemy/public_html/kernel/parser.php(190) : eval()'d code on line 1</strong></p>
<p>code lines from 167 - 200... line 190 is marked below.</p>
<pre><code># Format replaced vars
function do_format($value,$s) {
global $en;
$value = (isset($en[$value]) ? $en[$value] : @constant($value));
$i = strtolower($s);
if (strpos($i,'echo') || strpos($i,'define')) {
$value = str_replace('"','`',$value);
$value = str_replace(chr(39),'`',$value);
}
return $value;
}
# Execute template block
function exec_block($start, $end, $jump = -2) {
$this->tpi = $start - 1;
while ($this->tpi < $end) {
$s = $this->templ_read();
$this->s = $this->template_replace_vars($s);
if ($this->act[$this->tpi] == 'continue_loop') return false;
if ($this->act[$this->tpi] == 'break_loop') {
$this->cancel_loop = true;
return false;
}
eval('$this->'.$this->act[$this->tpi].'();'); // LINE 190
}
if ($jump != -2)
$this->tpi = $jump;
}
# Echo a line
function do_print() {
echo $this->s;
}
</code></pre>
<p>... snippet</p>
<p>there is more too the file is there a way I can figure out where this error is actually at?</p>
| php | [2] |
2,664,893 | 2,664,894 | How to display badgeNumber at UIButton | <p>I am developing iphone application, I have a home page, with buttons (icons), I have an icon for notifications, I want to display a badge number on it to determine how many new notifications user has. How I can do that for UIButton? I checked the SDK and found only UITabBarItem has badge value.</p>
| iphone | [8] |
2,139,774 | 2,139,775 | ‘strcasecmp’ was not declared in this scope | <p>I am trying to build a source code called lipiTk</p>
<p>I have lots of errors like this:</p>
<pre><code>Documents/lipi/lipi/src/reco/shaperec/activedtw/ActiveDTWShapeRecognizer.cpp:1222:78:
error: ‘strcasecmp’ was not declared in this scope
</code></pre>
<p>What should I do, there is too many cpp file in the code that gives similar errors.
I do not think i can test with writing include string.h into every cpp file that gives error, might the problem be about my compiler?</p>
<p>I am on Ubuntu and GCC is 4.5.</p>
<p>My sw configuration is upper than lipitk needs as I read in manual.</p>
| c++ | [6] |
1,607,037 | 1,607,038 | iphone sdk: How to animate set of images in UIImageView using CoreAnimation? | <p>I've set of images loaded in UIImageView. How to animate the images in UIImageView using CoreAnimation? Plz give me suggesstions</p>
| iphone | [8] |
1,584,119 | 1,584,120 | Question about class/module | <pre><code>define('', 'http://' . Config::get('url.help'));
</code></pre>
<p>Where is it pulling url.help from?</p>
<p>Is this a class or a controller?</p>
<p>What is "Config::get" </p>
| php | [2] |
4,626,927 | 4,626,928 | Case insensitive Deserialization | <p>I have an XML file where
</p>
<p>We have defined classes to serialize or deserialize XML.</p>
<p>When we deserialize, if the XML contains like below where "<strong>type</strong>" attribute is in upper case, its throwing error like there is an error in xml(2,2) like that.</p>
<pre><code><document text="BlankPDF" name="BlankPDF" type="PDF" path="" />
</code></pre>
<p>...</p>
<pre><code>[DescriptionAttribute("The sharepoint's document type.")]
[XmlAttribute("type")]
public DocumentType Type
{
get;
set;
}
public enum DocumentType
{
pdf,
ppt,
pptx,
doc,
docx,
xlsx,
xls,
txt,
jpg,
bmp,
jpeg,
tiff,
icon
}
</code></pre>
<p>this is how we have defined the attribute.</p>
<p><strong>Is it possible to ignore case while deserializing XML?</strong></p>
| c# | [0] |
2,842,815 | 2,842,816 | PHP Validating decimal numbers and converting to US currency format | <p>I am working currently with PHP validation of decimal values. The function works well in determining decimals/integers from letters but my goal is to format the decimal/integer values into proper currency values such as <code>$0.00</code>. </p>
<p>How can I format the input value into currency format with the dollar sign such as <code>$0.00</code>?</p>
<p><a href="http://webprolearner.ueuo.com/dropdown-menu/test1.php" rel="nofollow">EXAMPLE</a></p>
<pre><code><?
if (isset($_POST['price'])){
$price = $_POST['price'];
$priceString = empty($price['price'])?null:trim($price['price']);
if(!empty($priceString)) {
if (preg_match('/^[+\-]?\d+(\.\d+)?$/', $price)){
echo ('<div id="price_input"><span id="resultval">'.$price.'</span></div>');
}
else {
echo ('<div id="price_input"><span id="resultval">Please input a valid decimal number.</span></div>');
}
}
else {
echo '';
}
}
?>
</code></pre>
| php | [2] |
2,338,376 | 2,338,377 | jQuery File Upload - Why the selected file's name is being translated? | <p>I'm using the <a href="http://blueimp.github.com/jQuery-File-Upload/" rel="nofollow">http://blueimp.github.com/jQuery-File-Upload/</a> plugin. After I select the file in the file dialog box, I see its name is translated on the upload list (try by yourself on that demo site, I've selected the <code>Meduza.jpg</code> file and on the list it is the <code>Jellyfish.jpg</code>). How to turn off that translation ? I want to have the original file name.</p>
<p><img src="http://i.stack.imgur.com/kOplF.png" alt="enter image description here"></p>
<h2>Edit.</h2>
<p>I've contacted with this plugin author, he says that I probably have a browser add-on installed or another plugin in my webpage which is responsible for this behavior. I'm using the FF 14.0.1</p>
| jquery | [5] |
2,552,464 | 2,552,465 | make element slide by itself after mouse out | <p>I have a text options div that's hidden off screen, the user must click or tab to and press enter on the text "tab" in order to show the text options div.</p>
<p>How can I make the div slide back off screen after the user has stopped interacting with it (I guess on mouseOut?) or when a poweruser has tabbed away from it?</p>
<p><a href="http://students.cmps.subr.edu/aaron.chauvin/misc/test.html" rel="nofollow">Test page</a></p>
| jquery | [5] |
5,150,924 | 5,150,925 | Possible to change app icon without recompiling the APK? | <p>Does anyone know if it is possible to open the APK file, access its /res/drawable directory and replace the icon.png with another icon.png image? </p>
<p>Is there any way for non-coder to change the icon.png without opening the project and recompiling?</p>
<p>So far, I had no success in this. </p>
| android | [4] |
3,925,971 | 3,925,972 | Method to get all EditTexts in a View | <p>can anyone help me with coding a method to get all EditTexts in a view? I would like to implement the solution htafoya posted here:
<a href="http://stackoverflow.com/questions/4165414/how-to-hide-soft-keyboard-on-android-after-clicking-outside-edittext/4168116#4168116">how to hide soft keyboard on android after clicking outside EditText?</a></p>
<p>Unfortunately the getFields() method is missing and htafoya did not answer our request to share his getFields() method.</p>
<p>Thank you</p>
| android | [4] |
3,446,233 | 3,446,234 | Disabling Android home button for industry application | <p>I'm writing an industry application which will be used by traffic wardens to register offences through my program using forms.</p>
<p>The app is using a webview so it is just a container for an external webpage. We don't want our users to exit the application so we have to disable all buttons. I succeeded in disabling them except for the home button.</p>
<p>I read some threads about this topic, but I don't have any solutions yet. The idea is that I am able to make the app the default home app so if the user presses the home button it launches my app and does not exit. How can I accomplish that? If we must we are able to tamper with android itself (when we install the app), but if there is some solution through configuration it would be appreciated.</p>
| android | [4] |
2,770,089 | 2,770,090 | Why can I create cast operator to every class except self | <pre><code>struct B
{
};
struct A
{
operator A&() const;
operator B&() const;
};
int main()
{
const A a;
B& br = a;
A& ar = a;
}
</code></pre>
<p>Why can I create cast operator to <code>B&</code>, but not to <code>A&</code>.</p>
<p>May be it does not have much sense (one can use it to erase <code>const</code> modifier, as in example), but it at least inconsistent!</p>
| c++ | [6] |
145,376 | 145,377 | What ID numbers to use for Notifications | <pre><code>public static final int NOTIFY_FAILED = 1;
private final Notification displayErrorNotification = new Notification(R.drawable.notification, "Communication Error", System.currentTimeMillis());
private void displayNotificationError(String message) {
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(), 0);
displayErrorNotification.number++;
displayErrorNotification.setLatestEventInfo(getApplicationContext(), "Failed x ("+displayErrorNotification.number+")", message, contentIntent);
notificationManager.notify(NOTIFY_FAILED, displayErrorNotification);
}
</code></pre>
<p>In this example I have used 1 for failed notifications but what if other programs also use the number 1 for their notifications.</p>
<p>What would happen when I do this: </p>
<pre><code>notificationManager.cancel(NOTIFY_FAILED);
</code></pre>
| android | [4] |
5,558,528 | 5,558,529 | Memory leak using multidimensional Array | <p><img src="http://i.stack.imgur.com/XU2js.png" alt="enter image description here">
i got memoery leak at that multidimensional mutable array i need to remove those leak because due to this leak app is not working in iphone,i dnt how remove this leak</p>
<blockquote>
<p>CGRect bounds =[self bounds];</p>
</blockquote>
<pre><code>UITouch* touch = [[event touchesForView:self] anyObject];
if (firstTouch) {
firstTouch = NO;
previousLocation = [touch previousLocationInView:self];
previousLocation.y = bounds.size.height - previousLocation.y;
NSMutableArray *temp=[[NSMutableArray alloc]init];
[undo addObject:temp];
/***** add 1st point *********/
[[undo objectAtIndex:[undo count] -1] addObject:[NSValue valueWithCGPoint:previousLocation]];
if(mcount==1)
{
[masking addObject:[[NSMutableArray alloc]init]];
[[masking objectAtIndex:[masking count]-1] addObject:[NSValue valueWithCGPoint:previousLocation]];
}
} else {
location = [touch locationInView:self];
location.y = bounds.size.height - location.y;
previousLocation = [touch previousLocationInView:self];
previousLocation.y = bounds.size.height - previousLocation.y;
[[undo objectAtIndex:[undo count] -1]addObject:[NSValue valueWithCGPoint:previousLocation]];
if(mcount==1)
{
[[masking objectAtIndex:[masking count]-1] addObject:[NSValue valueWithCGPoint:previousLocation]];
}
}
</code></pre>
| iphone | [8] |
5,843,403 | 5,843,404 | how to rotate an image back and forth in android | <p>hai i want to rotate an image back and forth. But now it is happening only one side.After the image reach the destination suddenly it will come back to its original position.I am using animation for rotation. Somebody help me to do this. </p>
| android | [4] |
3,489,648 | 3,489,649 | PHP type matching | <p>In PHP, can someone explain to me why this resolves to true:</p>
<pre><code>'NONE' == 0
</code></pre>
| php | [2] |
1,899,119 | 1,899,120 | Replacing Screen lock in android | <p>I would like to know is there any possibility to replace default lock screen and developing our own locking application?</p>
<p>Thanks.</p>
| android | [4] |
3,173,337 | 3,173,338 | How I get event onChange on webview in android? | <p>I am new in android app development. I am developing a app which uses WebView to load my sign-up and login page and I want to get those text entered by user and store in native database in my app. can anyone suggest me how to proceed?? </p>
| android | [4] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.