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 |
---|---|---|---|---|---|
4,260,223 | 4,260,224 |
Parse string value to datetime value
|
<p>I need to parse string value to date time value, I have date in this format:</p>
<pre><code>DD.MM.YYYY
</code></pre>
<p>I want to parse value in this format:</p>
<pre><code>YYYY-MM-DD
</code></pre>
<p>I tried to do it like this:</p>
<pre><code>DateTime.ParseExact(date_req, "yyyy-MM-dd", CultureInfo.InvariantCulture);
</code></pre>
<p>But i have an error: String was not recognized as a valid DateTime.</p>
<p>Is there a way to do this?</p>
|
c#
|
[0]
|
5,279,612 | 5,279,613 |
How to Read a csv or text file and put into list
|
<p>I am new to android programming, I am trying to read a simple list , like a grocery list, from a text file (.txt) to put it into a list for an app I am making I was wondering how I would do this I or if anyone knows any tutorials for a simple tutorial. I am also working this through with fragments.</p>
|
android
|
[4]
|
4,956,571 | 4,956,572 |
Why do we need apply method inside the constructor to invoke any method defined on the prototype object?
|
<p>Why do we need apply method inside the constructor to invoke any method defined on the prototype object?</p>
<p>Code working:</p>
<pre><code> function Test(){
this.x = [];
this.add.apply(this,arguments);
}
Test.prototype.add = function(){
for(var i=0; i < arguments.length; i++){
this.x.push(arguments[i]);
}
}
var t = new Test(11,12)
t.x //[11,12] this is fine
t.x.length //2 this is also fine
</code></pre>
<p>But when i directly call add inside constructor</p>
<p>Code not working:</p>
<pre><code> function Test(){
this.x = [];
this.add(arguments);
}
Test.prototype.add = function(){
for(var i=0; i < arguments.length; i++){
this.x.push(arguments[i]);
}
}
var t = new Test(11,12);
t.x.length; //1 Not added all elements why?
</code></pre>
<p><img src="http://i.stack.imgur.com/g4EeM.png" alt="enter image description here"></p>
|
javascript
|
[3]
|
5,514,162 | 5,514,163 |
JQuery, $(this) not correct in fadeIn, fadeOut callback function?
|
<p>I would like to fadeOut() an image on the page and remove it from the DOM after the animation is finished. Sounds easy enough?</p>
<p>Example code (image has the id "img1"):</p>
<pre>
$("#img1").fadeOut("slow", function() { $(this).remove() });
</pre>
<p>This does does not work. When I inspect the page with Firebug the image is still there. It is just hidden.</p>
<p>Second example which should kind of flash the image:</p>
<pre>
$("#img1").fadeOut("slow", function() { $(this).fadeIn() });
</pre>
<p>Strange.</p>
<hr>
<p>Thanks for the example pages which work great and as expected.</p>
<p>The problem must be something else and only occurs in my project environment.</p>
<p>Side note: when I do a simple console.log($(this)) in my callback function the result is the window object itself?!</p>
<p>When I find out what side effects create the problem I'll update this question.</p>
|
jquery
|
[5]
|
1,563,136 | 1,563,137 |
Shared Assembly - Is Signing Required?
|
<p>If I want to build a shared assembly, does that require the overhead of signing and managing key pairs? If so, is there a best practice approach to doing so?</p>
|
c#
|
[0]
|
2,669,233 | 2,669,234 |
Merge android.graphics.Path instances?
|
<p>Is it possible to merge several paths?</p>
<p>In the following example, I add 3 paths to the resulting 'p4'.
Drawing with Paint.Style.STROKE works.
So it seems to be a problem with the Path.FillType ?</p>
<pre><code> public void drawTest3(Canvas canvas){
Path p1,p2,p3,p4;
p1 = new Path();
p2 = new Path();
p3 = new Path();
p4 = new Path();
// create 3 coordinates that form a triangle
float[] start = new float[]{(float)getWidth()/2,(float)getHeight()/2};
float[] point1 = new float[]{0.0f,(float)getHeight()};
float[] point2 = new float[]{(float)getWidth(),(float)getHeight()};
p1.moveTo(start[0], start[1]);
p1.lineTo(point1[0], point1[1]);
p2.moveTo(point1[0], point1[1]);
p2.lineTo(point2[0], point2[1]);
p3.moveTo(point2[0], point2[1]);
p3.lineTo(start[0], start[1]);
// add all 3 paths to p4
p4.addPath(p1);
p4.addPath(p2);
p4.addPath(p3);
// draw
canvas.drawARGB(0xff, 0xdd, 0xdd, 0xdd);
Paint paint = new Paint();
paint.setColor(0x33333333);
canvas.drawPath(p4, paint);
}
</code></pre>
<p>Regards, Roland</p>
|
android
|
[4]
|
2,342,532 | 2,342,533 |
Why is my arguments array only having a size of 1?
|
<p>Why am I getting a size of 1 returned by <code>my_game.size()</code>? I thought the arguments from <code>make_game</code> would get inserted into <code>game</code> and so <code>arguments.length</code> would be 3, but apparently it's not. What is the reason for this?</p>
<pre><code>function game()
{
var args = arguments;
this.size = function() { return args.length; };
}
function make_game()
{
return new game(arguments);
}
var my_game = make_game(4, 'a', true);
console.log(my_game.size()); // 1
</code></pre>
|
javascript
|
[3]
|
4,301,902 | 4,301,903 |
Not defining function directly in Event listener
|
<p>This is a simple listener:</p>
<pre><code>$("#target").keypress(function(event) {
alert("test");
});
</code></pre>
<p>I want to take separate function out but it won't work:</p>
<pre><code>$("#target").keypress(doAlert(event));
function doAlert(event)
{
alert("test");
}
</code></pre>
<p>What am I missing?</p>
|
jquery
|
[5]
|
5,915,728 | 5,915,729 |
Highlight specific text in specific order
|
<p>I've got this but need it to highlight in order without hovering, so more like an animation. Any ideas?</p>
<p><a href="http://jsfiddle.net/3QG3w/" rel="nofollow">http://jsfiddle.net/3QG3w/</a></p>
<p>In more detail: When the page loads I want "Client 1" to highlight and with it "Benefit 1" and "Benefit 3". Then I want it to un-highlight and "Client 2" and Benefit 2, 3 & 4 to highlight" and so on.. So it cycles through each Client highlighting the benefit for each. An animation of sorts.</p>
<p>Sorry, I'm fairly new to coding but trying my best.</p>
|
jquery
|
[5]
|
820,681 | 820,682 |
Send email to unique person based on drop-down selection
|
<p>I have a form that needs to go to different owners depending on the location that the user selects in the contact form. I'm using a template and have been able to edit the fields to have them be the values I want, but having difficulty trying to figure out how to get it to the correct person.</p>
<pre><code><?php
if(!$_POST) exit;
$email = $_POST['email'];
//$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS';
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z] {2,}"."$",$email )){
$error.="Invalid email address entered";
$errors=1;
}
if($errors==1) echo $error;
else{
$values = array ('location','name','email','phone','message');
$required = array('location','name','email','phone','message');
$your_email = "jhutchins@sealkc.com";
$email_subject = "New Message: ".$_POST['subject'];
$email_content = "new message:\n";
foreach($values as $key => $value){
if(in_array($value,$required)){
if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; }
$email_content .= $value.': '.$_POST[$value]."\n";
}
}
if(
if(@mail($your_email,$email_subject,$email_content)) {
echo 'Message sent!';
} else {
echo 'ERROR!';
}
}
?>
</code></pre>
<p>I would like to change who the $your_email is pointed to based on the Location drop down menu. And always CC one specific person as well.</p>
<p>The form is at:
<a href="http://amazinggaragefloors-net.si-sv3641.com/contactus.html" rel="nofollow">http://amazinggaragefloors-net.si-sv3641.com/contactus.html</a></p>
|
php
|
[2]
|
680,459 | 680,460 |
How do I add an image where user clicks?
|
<p>I want to add an image exactly where a user clicks. I have this so far, but it just adds the image to the top and just keeps adding it there...not where the user is clicking</p>
<pre><code> <html>
<head>
<script type="text/javascript">
function stamp(d,e)
{
var i = new Image();
i.src = 'smiley.jpg';
document.getElementById('target').appendChild(i);
//document.getElementById('target').style.left = "100px"; //e.clientX ;
//document.getElementById('target').style.right = "1000px"; //e.clientY;
}
</script>
</head>
<body id="target" onclick="javascript:stamp(this,event);" style="left: 100px">
</body>
</html>
</code></pre>
|
javascript
|
[3]
|
4,964,469 | 4,964,470 |
about jQuery fn declaration
|
<p>my two js files (<code>file1.js & file2.js</code>) works but when i made some changes in <code>file2.js</code> then it doesn't work, why?.</p>
<pre><code>/* file1.js */
$(function() {
$(".some").click(function() {
...
});
});
/* file2.js */
window.onload = test();
function test() {
$(".dragfile").draggable(function() {
...
});
$(".resize").resizable(function() {
....
});
}
</code></pre>
<p>Now i make changes in <code>file2.js</code> and some functions are not working. <code>file1.js</code> remains same</p>
<pre><code>/* file2.js */
// window.onload = test(); function test() { }
$(function() { // modified
$(".dragfile").draggable(function() { // this function works
...
});
$(".resize").resizable(function() { // this isn't working
...
});
});
</code></pre>
|
jquery
|
[5]
|
4,643,819 | 4,643,820 |
question related to Autorotation
|
<p>hi when i delete the application and then on first page if i rotate from portrait landscape then it rotates but on second time it not
why?</p>
|
iphone
|
[8]
|
2,197,724 | 2,197,725 |
Confusing Java Class concept
|
<p>New to java and a concept is confusing me a lot.</p>
<p>As a c++ programmer when we declare a class we can not have a property having an object of same class like lets say we have a class name Foo as belows</p>
<pre><code>class Foo {
int age;
Foo someName;
}
</code></pre>
<p>the above code will give error. While in java i can do it. Is there a special reason behind it? And how does it happen. Any good read will be helpful. </p>
|
java
|
[1]
|
606,686 | 606,687 |
How to getBackground() in constructor of CursorAdapter while parent View is absent in it?
|
<p>I need to get <code>background</code> (<code>Drawable</code>) which is defined for my <code>layout</code> created to be an <code>item</code> of my <code>ListView</code>. The requirement is to do this in my <code>Adapter</code> constructor, but I lack parent <code>Viewgroup</code> to <code>inflate</code> it. Any other ways to do it?</p>
<pre><code>private class MAdapter extends CursorAdapter {
private Drawable defaultDrawable;
public MAdapter(Context context, Cursor c, boolean autoRequery) {
super(context, c, autoRequery);
this.defaultDrawable = // here I need to get Drawable which is defined as background for the view which is going to be used for `View` for the list row item
}
</code></pre>
|
android
|
[4]
|
1,632,933 | 1,632,934 |
Making my color set to a variable
|
<p>I am trying to set my color in a span style to a variable...anyone know why this is wrong?</p>
<pre><code><span style="font-weight:bold; color:"<%= AccountWarningStyle %>"; font-size:14px;"></span>
</code></pre>
<p>AccountWarningStyle is my c# variable</p>
|
c#
|
[0]
|
2,385,527 | 2,385,528 |
Read from Array in C#
|
<p>I have a string array as shown below:
How do I write each one of them to the console?
Below is the code from my c# program: From the below code I have to write all the cats to the console</p>
<pre><code>using (RegistryKey ic = clsidKey.OpenSubKey("Implemented Categories"))
{
string[] cats = ic.GetSubKeyNames();
}
</code></pre>
|
c#
|
[0]
|
330,036 | 330,037 |
Why does DateFormat#format accept int parameter?
|
<p>I have this class:</p>
<pre><code>import java.text.DateFormat;
import java.text.SimpleDateFormat;
public class Test {
public static void main(String[] argv) {
DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
String h = df.format(1);
System.out.println(h);//output:
}
}
</code></pre>
<p>It compiles without problems with openjdk 7.</p>
<p>AFAIK there's no DateFormat#format(int).</p>
<p>Is there any implicit cast that converts 1 to Date? </p>
|
java
|
[1]
|
3,830,334 | 3,830,335 |
Error compiling ASMX while accessing the web service
|
<p>I have a ASMX web service. When I access it from a client the ASMX get compiled but I get this error:</p>
<p>Looking at csc.exe command line from the error detail the System.Windows.Forms asseembly is not referenced.</p>
<p><strong>Compilation Error</strong> </p>
<hr>
<p>Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. </p>
<pre><code>Compiler Error Message: CS0234: The type or namespace name 'Windows' does not exist in the namespace 'System' (are you missing an assembly reference?)
Source Error:
Line 3: using System.ComponentModel;
Line 4: using System.Drawing;
Line 5: using System.Windows.Forms;
Line 6: using System.Xml;
Line 7: using Idp.Core.Configuration;
</code></pre>
|
asp.net
|
[9]
|
3,539,923 | 3,539,924 |
Jquery: Checking to see if div contains <a href class="nodeSel">, then add style to div
|
<p>I'm tring to add class to div, which contains <code><a href class="nodeSel"></code> marker:</p>
<ol>
<li><p>no active inside
<code><div id="menufirst" class="dtNode"><img src="empty.gif"><img alt="" src="empty.gif"><img asrc="empty.gif"><a href="http://www.sample1.com" class="node">title1</a> </div></code></p></li>
<li><p>active inside
<code><div id="menufirst" class="dtNode"><img src="empty.gif"><img alt="" src="empty.gif"><img src="empty.gif"><a href="http://www.sample2.com" class="nodeSel" >title2/a> </div></code></p></li>
</ol>
<p>I tried:
<code>$('div.dtNode:has(a)').css('background','red').addClass("test");
$('div#menufirst:has(a)').addClass("test2").css('background','red');
</code></p>
<p>and css:
<code>div.dtNode[class*="nodeSel"] { background:green; }</code></p>
<p>No effect. Could you please let me know what is wrong?</p>
|
jquery
|
[5]
|
5,165,955 | 5,165,956 |
How to display char in grid lines using c#
|
<p>I am working on a desktop application develop in C#. what i want to do is to:</p>
<p>Open a text file(.txt) Read Data Line By Line Create a grid type structure(i.e combination of
horizontal and vertical line) Then take first line and display its each char in single cell And the take second line and display its each char in single cell and so on.</p>
<p>Since i am beginner so i don't have any idea that how to acheive this. I only want some suggestions and guidance.</p>
|
c#
|
[0]
|
958,351 | 958,352 |
get the integer between the dates
|
<p>i am programming in c# and i have question:
how can i get the integer value between a date.
for example : 12/6/2010 and 12/18/2010
how can i get at 1st i=6 and in the second i=18</p>
|
c#
|
[0]
|
1,911,932 | 1,911,933 |
Javascript Detect 'Shift' Key Down Within Another Function
|
<p>I am calling a Javascript function in my html page from a Flash movie (using ExternalInterface) and I want to know if the user has the Shift key down when the function is called.</p>
<p>It seems straight forward if, for example, I call the function from a mouse click because I can pass the event and check 'if (event.shiftKey)'. I don't have an event to check!</p>
<p>Many thanks</p>
<p>Chris</p>
|
javascript
|
[3]
|
3,174,110 | 3,174,111 |
Should <?php echo '<' ?> echo anything?
|
<p>basically I have this file (testing.php) with this in it</p>
<pre><code><?php echo "<hi"; ?>
</code></pre>
<p>If I view the source of this file in a browser (chrome, mac os x lion) I get absolutely no output. However if I remove the <code><</code> I get <code>hi</code>.</p>
<p>Is this normal? Because I can't find any reference to escaping greater/less than signs in the php docs (I know about using <code>\"</code> for instance).</p>
<p>I may be missing something <strong>really</strong> stupid here but I cannot for the life of me work out why I can't do that.</p>
<p>The files are being accessed from a debian server with apache (phpinfo: <a href="http://things.felixfennell.co.uk/0h2Q1q1G0T300w1N473W" rel="nofollow">http://things.felixfennell.co.uk/0h2Q1q1G0T300w1N473W</a>)</p>
<p>This is the page I'm testing: <a href="http://lyra-sh.me/testing/test.php" rel="nofollow">http://lyra-sh.me/testing/test.php</a></p>
|
php
|
[2]
|
4,791,462 | 4,791,463 |
Reading word file and saving it as odt
|
<p>I have downloaded ODFToolkit, and I don't have to setup OpenOffice.</p>
<p>I can create odt file as following.</p>
<p>And my question is:</p>
<p>May I read .doc and .docx files and save them as .odt ?</p>
<p>Could you help me please?</p>
<p>Here is the code:</p>
<pre><code>import org.odftoolkit.odfdom.doc.OdfTextDocument;
import java.net.URI;
public class QuickOdt {
public static void main(String[] args) {
OdfTextDocument outputDocument;
try
{
outputDocument =
OdfTextDocument.newTextDocument();
outputDocument.addText("I'm using the ODFDOM toolkit!");
outputDocument.newParagraph();
outputDocument.newImage(new URI("images/odf-community.jpg"));
outputDocument.newParagraph("Bu bir taze paragrafdyr");
outputDocument.save("quick.odt");
}
catch (Exception e)
{
System.err.println("Unable to create output file.");
System.err.println(e.getMessage());
}
}
}
</code></pre>
|
java
|
[1]
|
4,275,143 | 4,275,144 |
Jquery Ajax and the use of $.toJSON() function
|
<p>what is the use of $.toJSON() function. it seems that it convert the data in json format.
here is the code snippet</p>
<pre><code>data: $.toJSON({ name: $("input[type=text]").val() })
</code></pre>
<p>without using $.toJSON() function we can supply data manually in josn format like</p>
<pre><code>data: { name: $("input[type=text]").val() }
</code></pre>
<p>it will also work i think. please discuss. thanks</p>
|
jquery
|
[5]
|
537,726 | 537,727 |
To underscore or to not to underscore, that is the question
|
<p>Are there any problems with not prefixing private fields with an underscore in C# if the binary version is going to be consumed by other framework languages? For example since C# is case-sensitive you can call a field "foo" and the public property "Foo" and it works fine.</p>
<p>Would this have <strong>any</strong> effect on a case-insensitive language such as VB.NET, will there by any CLS-compliance (or other) problems if the names are only distinguishable by casing?</p>
|
c#
|
[0]
|
206,739 | 206,740 |
What is the exactly RUM do?
|
<p>I read a document from <a href="https://newrelic.com/docs/features/how-does-real-user-monitoring-work" rel="nofollow">https://newrelic.com/docs/features/how-does-real-user-monitoring-work</a>
And in this code:</p>
<pre><code><script type="text/javascript">
if (!NREUMQ.f) NREUMQ.f=function() {
NREUMQ.push(["load",new Date().getTime()]);
var e=document.createElement("script");
e.type="text/javascript";e.async=true;e.src="https://d7p9czrvs14ne.cloudfront.net/11/eum/rum.js";
document.body.appendChild(e);
if(NREUMQ.a)NREUMQ.a();
};
if(window.onload!==NREUMQ.f){NREUMQ.a=window.onload;window.onload=NREUMQ.f;};
NREUMQ.push(["nrf2","beacon-1.newrelic.com","api-key",appID,"cV5eEkBfCF1WRBgECFZEQwNAbwVBQ1peAgdGWF8IQR8LR1ZEQQgDRQ==",6,707, new Date().getTime()]);
</script>
</code></pre>
<p>In this line: </p>
<blockquote>
<p>NREUMQ.push(["nrf2","beacon-1.newrelic.com","api-key",appID,"cV5eEkBfCF1WRBgECFZEQwNAbwVBQ1peAgdGWF8IQR8LR1ZEQQgDRQ==",6,707, new Date().getTime()]);</p>
</blockquote>
<p>What is the cV5eEkBfCF1WRBgECFZEQwNAbwVBQ1peAgdGWF8IQR8LR1ZEQQgDRQ== mean and what use for?</p>
<p>Any help?</p>
|
javascript
|
[3]
|
1,992,293 | 1,992,294 |
Android - cleaned project, R file will not regenerate
|
<p>Help, I'm occasionally encountered this randomly with Android, but this time seems pervasive and I want to know how to fix this once and for all - in this situation</p>
<p>I cleaned my project because I added a new ID and reference in the XML and a new drawable asset, yet the project was giving an error on the ID reference (so this is why I cleaned it).</p>
<p>Now the R file isn't recognized, and it doesn't regenerate when I clean the project, or close the project, or close/open eclipse</p>
<p>R cannot be resolved to variable, now I can't compile, le sigh</p>
<p>solutions and pinpoint the cause of this problem?</p>
|
android
|
[4]
|
1,153,134 | 1,153,135 |
Editext validation for button click
|
<p>I have an edittext and when the button is clicked it allows only Strings. </p>
<p>I do this by using an if statement to show a dialog with this condition: <code>(str.matches("[0-9]*")</code></p>
<p>but when I enter this ttttt12323 and press the button it allows string and int to go through. </p>
<p>I want to put validation for not allowing string and text together specifically only Strings. </p>
<p>Can this be done. Thanks</p>
|
android
|
[4]
|
2,481,074 | 2,481,075 |
Does PHP have the equivilant to Java 'synchronized' , or is this not required?
|
<p>I am familiar with Java and at the moment I am teaching myself PHP. To prevent race conditions and deadlocks, Java uses the keyword 'synchronized'.</p>
<p>From Oracle docs:</p>
<pre><code>public synchronized void increment() {
c++;
}
</code></pre>
<p>I am using prepared statements within a separate class to access my database. I wish to avoid race conditions, deadlocks etc, but I cannot see how PHP handles this.</p>
<p>Does PHP have the equivalent to Java, and is it operating system specific? I am using Windows. What would best practices be?</p>
|
php
|
[2]
|
1,156,382 | 1,156,383 |
method of UIView calling from UIViewcontroller problem?
|
<p>i have done the following...tran is a UIView...doSomething is a methos in UIView.but i cant
call that method from viewdidload? any help please?</p>
<pre><code>- (void)viewDidLoad
tran *m_view = [[tran alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
[self.view addSubview:m_view];
[m_view release];
tran *s = (tran *)self.view;
[s doSomthing];
[super viewDidLoad];
</code></pre>
<p>}</p>
|
iphone
|
[8]
|
1,530,538 | 1,530,539 |
How pass reference to "this" on href javascript function?
|
<p>I have a link with this href:</p>
<pre><code>href="javascript:foo(this);"
</code></pre>
<p>when I call it "this" points to the window object, not the link. How do I pass a reference to the link?</p>
<p><a href="http://jsfiddle.net/xMGKz/" rel="nofollow">http://jsfiddle.net/xMGKz/</a></p>
<p><strong>Edit note</strong>: The question is how to pass with href, not generally - I know about onclick!</p>
<p>And not copying id and make getElementById, that's not "this", it's DOM search for certain element, no need to make it inline in HTML.</p>
<p>The anwer is: not possible.</p>
|
javascript
|
[3]
|
5,806,061 | 5,806,062 |
What faults are there to coding a character sheet as an enumeration?
|
<p>I am working on creating a character sheet for a RPG I'm tinkering with. I figure out all the data I need the character sheet to keep, but I am not sure if the way I am doing it is most economical in the sense of speed and resources. Right now I have an enumeration with three types: NPC, MONSTER, PLAYER. Inside the enumeration I have a class that will store and handle all getting/setting for the stats and derived attributes. Are there any disadvantages to writing it this way? Does anyone have any suggestions?</p>
<p>TFYT ~Aedon</p>
|
java
|
[1]
|
2,075,368 | 2,075,369 |
how does android app find res.layout.main.xml
|
<p>I'm new... just finished my first eclipse/adt tutorial. </p>
<p>I don't see see anything in the manifest that points to res.layout.main.xml or res.values.strings.xml.</p>
<p>QUESTION: how does android find these xml's?</p>
<p>thanks,
Shannon</p>
|
android
|
[4]
|
3,127,561 | 3,127,562 |
Getting exception while calculating the total of gridview cells
|
<p>while calculating the total of gridview cells i am getting this exception:
<strong>Input string is not in correct format.</strong></p>
<p>Here is my code: any help pls:</p>
<pre><code> public decimal GetTotal()
{
decimal total = 0;
foreach (GridViewRow _row in GridView1.Rows)
{
TextBox txt = (TextBox)_row.FindControl("TextBox1");
total +=decimal.Parse( txt.Text);
}
return total;
}
</code></pre>
|
c#
|
[0]
|
4,530,564 | 4,530,565 |
Why button is not centered vertically in LinearLayout?
|
<p>I have a LinearLayout, which only contains one button. I want this button to be centered vertically and aligned to the right. I tried many ways, but I couldn't make this button centered vertically. It is always aligned to the top. I also tried to put a button in RelativeLayout, the button can not be centered vertically either. </p>
<p>The XML is as below. Is there anything wrong with this layout? Thanks.</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:background="#E8E3E4">
<Button
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="More" android:layout_gravity="right" />
</LinearLayout>
</code></pre>
<hr>
<p>Changing android:layout_gravity="right" to android:layout_gravity="right|center_vertical" didn't resolve the problem in my question. </p>
|
android
|
[4]
|
2,229,656 | 2,229,657 |
How to catch a click event on a button?
|
<p>Hey everyone. .NET Developer here just getting started with Eclipse and Android.</p>
<p>Can someone show me in the simplest way possible, with the absolute fewest lines of code, how to DO something when a button is clicked?</p>
<p>My button has id <code>button1</code> and I just want to see where/how to write the <code>onClick()</code> handler.</p>
<p>So let's say I have <code>imageview1</code> set to invisible. How would I make it visible when the button is clicked?</p>
<p>EDIT:</p>
<p>Thanks everyone, but since not a single one of your examples work for me, I'll try this: Can someone please post the ENTIRE code to make this work? Not just the method, becuase when I try to use ANY of your methods I get errors all over the place so obviously something else is missing. I need to see everything, beginning with all the imports. Thank you.</p>
|
android
|
[4]
|
2,815,304 | 2,815,305 |
Binder Thread failed
|
<p><code>08-27 22:17:20.980: INFO/AndroidRuntime(299): NOTE: attach of thread 'Binder Thread #3' failed</code>
This is LogCat information please help me.</p>
|
android
|
[4]
|
2,855,245 | 2,855,246 |
Issue with pointer to character array C++
|
<p>I have what I thought should be a very simple snippet of code to write, though I'm unable to compile for a reason which I do not understand.</p>
<p>The following simplified code will not compile:
</p>
<pre><code>char buffer[9] = "12345678";
char* pBuffer = &buffer;
</code></pre>
<p>Compiler (g++) throws the following error:</p>
<p><code>error: cannot convert 'char (*)[9]' to 'char*' in initialization</code></p>
<p>C++ isn't exactly my "native" language, but everywhere I've looked tells me this should work. Any ideas or advice is greatly appreciated.</p>
|
c++
|
[6]
|
3,654,346 | 3,654,347 |
Javascript convert string into function name
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/496961/call-a-javascript-function-name-using-a-string">Call a JavaScript function name using a string?</a><br>
<a href="http://stackoverflow.com/questions/4639837/javascript-string-to-variable">javascript string to variable</a> </p>
</blockquote>
<p>I have this code:</p>
<pre><code>var Functionify = function() {
return {
init: function(el, t) {
var els = document.getElementsByClassName(el);
var elsL = els.length;
while(elsL--){
//els[elsL].onclick = els[elsL].getAttribute(t);
els[elsL].addEventListener('click', els[elsL].getAttribute(t), false);
}
}
};
}();
</code></pre>
<p>Where <code>el = 'myClassName'</code> and <code>t = 'data-id'</code></p>
<p>Now, 't' is a string, how can tell the addEventListener function to use 't' (a string) as a function name?</p>
|
javascript
|
[3]
|
5,704,260 | 5,704,261 |
Have jQuery actively select divs whose classes live update?
|
<p>I am working my way through a jQuery book right now, and I am trying to make some basic markup for my website as practice. </p>
<p>What would be the best way to actively select the class containing lets say the word "active" at the end of it. I was going to use the live() method but after looking that up on jQuery's website, they say it's now obsolete? How else can I tell jQuery to keep looking for the class that ends with the word "active" within a parent div after the DOM finishes initially loading? </p>
<p>The reason why it needs to keep looking is, I am using some open-source jQuery slider for my front page, and it adds the word "active" onto the end of the class of the div that's currently displaying the shown image.</p>
|
jquery
|
[5]
|
2,944,739 | 2,944,740 |
validate the formatString - of Type.ToString(formatString), Is there a builtin provision for this in C#?
|
<p>for example </p>
<p>DateTime dateTime= System.DateTime.Now;</p>
<p>//Get the formatString from user , example formatString = "dddd - d - mmmm";</p>
<p>//validate the formatStrong provided by the user.</p>
<p>if the format string is valid</p>
<p>string result = dateTime.ToString(formatString);</p>
<p>i know that one way would be to catch the expection while formatting.but i want to know if there is any class/method provided by .Net for this purpose.</p>
<p>Thanks.</p>
|
c#
|
[0]
|
4,788,216 | 4,788,217 |
C++ function call with the parameters unknown at compile time
|
<p>As weird as it sounds, I need to call a function in C++, for which I do not know the signature. Basically, I want to let the user specify a list of arguments, and argument types, and then attempt to call a given function with these arguments. I would then like to know if the function call worked or not, and if it (miraculously) did, what is the return value (provided that the return type is not void). Is there any way to achieve that? Thanks.</p>
|
c++
|
[6]
|
4,285,101 | 4,285,102 |
Smooth transition for fade effect on tabs
|
<p>I've added a fade effect to the <a href="http://www.inside-guides.co.uk/brentwood/home-and-garden/carpets-and-flooring/harley-carpets-416.html" rel="nofollow">following tabs here</a>, but the transition isn't smooth, especially on the last 2 tabs.</p>
<p>I'd like it be like <a href="http://www.inside-guides.co.uk/brentwood/pages/advertise.html" rel="nofollow">this page here</a>.</p>
<p>Here's the Javascipt if someone could help:</p>
<pre><code>$(window).load(function(){
$('.tab:not(.aboutus)').fadeOut();
$('.tabs li').click(function(){
var thisAd = $(this).parent().parent();
$(thisAd).children('.tab').fadeOut();
$(thisAd).children('.'+$(this).attr('class').replace('tab','')).fadeIn();
$('.tabs li').removeClass('active');
$(this).addClass('active');
});
newContent.hide();
currentContent.fadeOut(0, function() {
newContent.fadeIn();
currentContent.removeClass('current-content');
newContent.addClass('current-content');
});
if(window.location.hash) {
if (window.location.hash == "#map") {
$(".Advert").children('.tab').fadeOut();
$(".Advert").children('.map').fadeIn();
$('.tabs li').removeClass('active');
$('.maptab').addClass('active');
}
if (window.location.hash == "#voucher") {
$(".Advert").children('.tab').fadeOut();
$(".Advert").children('.vouchers').fadeIn();
}
}
});
</code></pre>
|
javascript
|
[3]
|
279,401 | 279,402 |
What can JavaScript do?
|
<p>Hey, I am a newbie to JavaScript. I really don't know what it does. </p>
<ul>
<li>What can I do with JavaScript?</li>
<li>What are the possibilities of JavaScript?</li>
<li>What tools will I require to develop in JavaScript? </li>
<li>Is there some plugin available in Eclipse? </li>
</ul>
<p>Thanks!</p>
|
javascript
|
[3]
|
837,973 | 837,974 |
Is there a Java quivalent to C#'s "new static" or "static new"?
|
<p>Is there a Java quivalent to C#'s <a href="http://msdn.microsoft.com/en-us/library/435f1dw2.aspx" rel="nofollow">new Modifier</a>?</p>
|
java
|
[1]
|
1,041,227 | 1,041,228 |
Jquery .load() and page refreshes
|
<p>I've been trying to figure out what is wrong with this for the last 2 days. I have a drop down that uses autocomplete for Ids. That works fine. When an Id is selected, I'm trying to get it to load a small table that is displayed with the Id information (the <code>onSelect</code> portion below).</p>
<p>However when the Id is selected, the page is refreshed, as if I clicked on a link. I realize this is probably something small, I just can't seem to figure it out.</p>
<pre><code>var options, a;
$(document).ready(function(){
options = {
serviceUrl:'jsonExceptionRequest.cfm',
onSelect: function(value, data){
$("#claimData").load('ajaxExceptionRequest.cfm?Id=' + value);
}
};
a = $('#query').autocomplete(options);
return false;
});
<span id="claimData"></span>
</code></pre>
|
jquery
|
[5]
|
5,603,975 | 5,603,976 |
How can I resize a DIV by dragging just ONE side of it?
|
<p>Let me be more specific... I don't want the DIV to resize WHILE I'm dragging. I want to drag it out (and maybe a vertical line follows my cursor) and when I release, it resizes the div.</p>
<p>This is in <a href="http://stackoverflow.com/questions/tagged/jquery">jQuery</a> btw</p>
|
jquery
|
[5]
|
4,192,833 | 4,192,834 |
How to split a comma separated string and process in a loop using JavaScript
|
<p>How to split a comma separated string and process in a loop using JavaScript?</p>
|
javascript
|
[3]
|
4,145,852 | 4,145,853 |
What's wrong with this code?
|
<p>I just started experimenting with java today (have experience with javascript and PHP) and am having trouble compiling this code.</p>
<p>I am using NewBeans IDE 6.8 on Mac.</p>
<p>It just says "One or more projects were compiled with errors."</p>
<p>The problem began when I tried adding a custom function in.</p>
<p>Here's the code (ignore all the comments):</p>
<pre><code>import java.io.*;
import java.net.*;
public class simpleServer
{
public static void main(String args[])
{
}
public void clientLoop()
{
// Message terminator
char EOF = (char)0x00;
try
{
// create a serverSocket connection on port 9999
ServerSocket s = new ServerSocket(4041);
System.out.println("Server started. Listening for connections...");
// wait for incoming connections
Socket incoming = s.accept();
BufferedReader data_in = new BufferedReader(
new InputStreamReader(incoming.getInputStream()));
PrintWriter data_out = new PrintWriter(incoming.getOutputStream());
data_out.println("Connected to Shipz Server." + EOF);
data_out.flush();
boolean quit = false;
while (!quit)
{
String msg = data_in.readLine();
if (msg == null) quit = true;
if (!msg.trim().equals("EXIT"))
{
if(msg.trim().equals("hShipzClient"))
{
System.out.println("Client Connected");
}
if(msg.trim().equals("c")){
System.out.println("Player collision");
data_out.println("You crashed!");
}
data_out.flush();
}
else
{
quit = true;
}
}
}
catch (Exception e)
{
System.out.println("Connection lost");
}
}
</code></pre>
<p>Thanks</p>
|
java
|
[1]
|
4,727,422 | 4,727,423 |
How to make application for purchasing an application through iphone?
|
<p>I want to implement application in which I want to purchase other application from my application. Can you provide me guidance about that or any sample code for that?</p>
<p>I have made one application and suppose right now is in the apple store. Now every month I want collect payment from the client for this application. Then how to make this type of appliation. Is it possible? If yes then please advise me or give me some idea or ant samele code.</p>
|
iphone
|
[8]
|
5,841,259 | 5,841,260 |
how to read Rss News image <media:thumbnail> in android
|
<p>Not able to display image in my RSS news reader.</p>
<p>How to read rss news image <code><media:thumbnail></code> in android please help me this problem</p>
<p>the tag goes like this</p>
<pre><code><media:thumbnail>http://www.bedfordshirenews.co.uk/imagelibrary/ClientImages/Client00004/00082000/00082068.jpg</media:thumbnail>
</code></pre>
<p>i have seen examples to parse
but havent seen any thing to parse the one which i have given above.</p>
|
android
|
[4]
|
250,152 | 250,153 |
Help Me Understand C++ Header files and Classes
|
<p>OK, So I am trying to transition from intermediate Delphi to C++ Object Oriented programing. I have read Ivar Horton's book on visual C++ 2010. I can pull off the simple console applications no problem. I get the language itself (kinda). Where I am struggling is with headers and classes. </p>
<p>I also understand what header files and classes do in general. What I am not getting is the implementation when do I use a header or a class? Do I need to create classes for everything I do? Do my actual work functions need to be in header files or in CPP files? I'm lost on the proper uses of these and could use some real world guidance from more experienced programmers.</p>
<p>I am trying to transition to windows applications using the MFC if that is helpful. </p>
|
c++
|
[6]
|
1,928,902 | 1,928,903 |
Using endResponse in a Response.Redirect
|
<p>While performing a response.redirect in an ASP.NET page, I received the error:
<br /><strong>error: cannot obtain value</strong>
<br />for two of the variables being passed in (one value being retrieved from the querystring, the other from viewstate)
<br />
<br />
I've never seen this error before, so I did some investigating and found recommendations to use the "False" value for "endResponse"
<br />
<br />
e.g. Response.Redirect("mypage.aspx", False)
<br />
<br />
This worked.
<br />
<br />
My question is: what are the side-effects of using "False" for the "endResponse" value in a response.redirect?
<br />
i.e. are there any effects on the server's cache? Does the page remain resident in memory for a period? Will it affect different users viewing the same page? etc.
<br />
<br />
Thanks!</p>
|
asp.net
|
[9]
|
4,267,222 | 4,267,223 |
Uploading a bitmap to the server with http protocol
|
<p>i have a camera Activity after which i take a picture and saving it to gallery and uploading to the server My upload code is not working, i need help on this?</p>
<p>// image capture</p>
<pre><code> Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 0);
</code></pre>
<p>//image Saving</p>
<pre><code> if (requestCode == 0 && resultCode == RESULT_OK)
{
Bundle extras = data.getExtras();
Bitmap b = (Bitmap) extras.get("data");
ImageView mImg;
mImg = (ImageView) findViewById(R.id.head);
mImg.setImageBitmap(b);
// save image to gallery
Shot = "HeadShot"; //Long.toString(System.currentTimeMillis());
MediaStore.Images.Media.insertImage(getContentResolver(), b, Shot, NAME);
}
</code></pre>
<p>//Upload to the server</p>
<pre><code> public void Upload(String url, HttpEntity imgdata) throws Exception, Exception {
DefaultHttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(url);
post.setHeader("Content-Type", "bitmap; charset=utf-8");
post.setURI(new URI(url));
post.setEntity(imgdata);
HttpUriRequest request = post;
HttpResponse response = client.execute(request);
HttpEntity entity = response.getEntity();
return entity.getContent();
}
</code></pre>
|
android
|
[4]
|
3,981,541 | 3,981,542 |
Ajax Requests Saved on Browser's History
|
<p>Is there an easy way to save ajax requests into a browser's history so that when you use the back button it will preserve the last state of the DOM?</p>
<p>Websites like twitter and digg that use an ajax pager have a usability flaw where if you click next page several times then click away from the site and then return using the back button, you lose your place in the viewport since the DOM is restored to the first initial request.</p>
<p>I noticed safari actually preserves the dom after a few ajax requests on some sites.<br>
Here is an example, Goto <a href="http://13gb.com" rel="nofollow">http://13gb.com</a>, Click next a few times then click on an image and then click your back button. On webkit it preserved the last DOM state, but on gecko and ie it does not. </p>
<p>What would be the easiest way to replicate this functionality on other browsers?</p>
|
javascript
|
[3]
|
1,879,382 | 1,879,383 |
Javascript Regular Expression for RGB color validator
|
<p>I am trying to using this RegEx for color validation.</p>
<pre><code>colorPattern = /\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})/
</code></pre>
<p>but it return always true</p>
<p>e.g</p>
<pre><code>colorPattern.test("#FF0000")
colorPattern.test("#FF0000000")
colorPattern.test("#FF0000mmm000")
</code></pre>
<p>are always true.</p>
<p>Any suggestion?</p>
|
javascript
|
[3]
|
537,786 | 537,787 |
Anyone know an elegant function to fix name cases?
|
<p>Kindergarten 101 teaches some of us that: "The letters in your name should be lowercase, with uppercase first letters." Yet in this post-literate era, how people enter their names in web forms seems to depend on their mood, or solar flares or whatnot: All uppercase, all lowercase, mixed, upside down...</p>
<p>Philosophically, I say whatever! Occupy your name, who cares. But I have OCD clients that prefer to see data normalized, standardized, predictable. So I'm asking you guys if you've seen any well-thought-out PHP functions for case-fixing names, that take into consideration the various exceptions that <code>ucwords()</code> would totally butcher, such as:</p>
<ul>
<li>Sven-Alex Crumpet</li>
<li>Ronaldo McDonaldo</li>
<li>Boopsie O'Brien</li>
<li>J.R. Bob Dobbs</li>
<li>Francesca de los Gatos</li>
<li>YungCheng Li</li>
</ul>
<p>Any functions out there that attempt to accommodate these alphabet rebels?</p>
<p><b>UPDATE</b><br>
From Robin v. G.'s point of van-tage, there can be no script to rule them all. But I've decided that names entered entirely in lower or uppercase are likely candidates for a good scrubbing. So for these, I will do ...</p>
<pre><code> if ($name == strtoupper($name) || $name == strtolower($name)) {
$name = ucwords(strtolower($name));
}
</code></pre>
<p>It would be easy enough to modify this to fix a few likely exceptions: dashes, apostrophes, 'McD', etc. Mistakes will be made, but who will complain? Not the meek bastard who entered their name in lowercase.</p>
<p>Oh wait, my name is in lowercase...</p>
|
php
|
[2]
|
5,469,532 | 5,469,533 |
new Number() / Is there a better way to cast?
|
<p>This is for the code below which I got from <a href="http://www.javascriptkit.com/javatutors/navigator.shtml" rel="nofollow">here</a>. I'm trying to make it a bit more robust by running it through <a href="http://www.jshint.com" rel="nofollow">jshint</a> which reports that you should not use new Number().</p>
<pre><code>else if ( /Firefox[\/\s](\d+\.\d+)/.test( navigator.userAgent ) ) {
name = 'Firefox ';
version = new Number( RegExp.$1 );
if( version < 10 ) {
f_value = [ name, version ];
document.body.innerHTML = 'You are Running - ' + f_value[0] + ' ' + f_value[1] + message;
return false;
}
}
</code></pre>
|
javascript
|
[3]
|
1,711,880 | 1,711,881 |
how to fetch ID from other site?
|
<p>Just let me know how one site fetch Logged in ID of other site?
e.g. If i already logged-in in Gmail,then how any other site fetch gmail email ID into their user name textbox?</p>
<p>Thanks</p>
|
php
|
[2]
|
4,506,421 | 4,506,422 |
Centering the image with jQuery
|
<p>I have this code:</p>
<pre><code>// gets the image size and position in order to make it fullscreen and centered.
getImageDim = function(img) {
var $img = new Image();
$img.src = img;
var $win = $(window),
w_w = $win.width(),
w_h = $win.height(),
r_w = w_h / w_w,
i_w = $img.width,
i_h = $img.height,
r_i = i_h / i_w,
new_w, new_h, new_left, new_top;
if (r_w > r_i) {
new_h = w_h;
new_w = w_h / r_i;
}
else {
new_h = w_w * r_i;
new_w = w_w;
}
return {
width: new_w,
height: new_h,
left: (w_w - new_w) / 2,
top: (w_h - new_h) / 2
};
}
</code></pre>
<p>Can anybody help to slice this in order to fully understand? What is <code>r_w</code>? What is <code>r_i</code>? Why we are evaluating <code>r_w > r_i</code>? I see the return function at the end, but to which element these <code>width</code>, <code>height</code>, <code>left</code> and <code>top</code> values will be assigned? What is the point of assigning this <code>$img.src = img;</code> ? Thanks in advance!</p>
|
jquery
|
[5]
|
660,852 | 660,853 |
How to refresh particular part of my web page?
|
<p>I want to refresh only a single part of my page not the whole.
How ?</p>
|
asp.net
|
[9]
|
1,975,618 | 1,975,619 |
just started learning Java and wan to know how to run my first application
|
<p>I have written the following code (was a puzzle from "<a href="http://rads.stackoverflow.com/amzn/click/0596009208" rel="nofollow">head first Java</a>")</p>
<p><a href="http://pastebin.com/9RmyUqZr" rel="nofollow">http://pastebin.com/9RmyUqZr</a></p>
<p>The goal is for it to print out DooBeeDooBeeDo which I think I got right. I want to run this program now though and see it work how would I go about doing so? I have the JDK installed and working so dont worry about telling me that part. The book I am reading shows something like this (assuming you enter these commands in the cmd):</p>
<pre><code>save: doobee.java
compile: javac doobee.java
run: %java DooBee
</code></pre>
<p>When I follow those instructions I get this in the cmd:</p>
<pre><code>Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\James>javac -version
javac 1.6.0_25
C:\Users\James>javac doobee.java
doobee.java:1: class DooBee is public, should be declared in a file named DooBee
.java
public class DooBee {
^
doobee.java:8: package system does not exist
system.out.print("Doo");
^
doobee.java:9: package system does not exist
system.out.print("Bee");
^
doobee.java:14: package system does not exist
system.out.print("Do");
^
4 errors
C:\Users\James>%java doobee
'%java' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\James>
</code></pre>
<p>So how can I get my very simple first program to run?</p>
|
java
|
[1]
|
5,413,113 | 5,413,114 |
how to convert an int to a char C++
|
<p>Im having trouble with an assignment where I have to convert three variables of a clock (int hour, int minutes, and bool afternoon) to be converted to a string in a method. I tried converting the int to a char and then replacing each string with the char. The function is suppose to return T/F if the conversion worked or not. Here is what I have so far:</p>
<pre><code>class Time
{
private:
int hour;
int minutes;
bool afternoon;
public:
void setHour(int hr);
void setMinutes(int min);
void setAfternoon(bool aft);
int getHour();
int getMinutes();
bool getAfternoon();
bool setAsString(string time);
string getAsString();
Time(void);
~Time(void);
};
</code></pre>
<p>and</p>
<pre><code>bool Time::setAsString(string time){
char min = minutes;
char hr = hour;
char hr[0] = time[0];
char hr[1]= time[1];
char min[0] = time[3];
char min[1] = time[4];
char afternoon = time[6];
if ((hourTens > 1) || (minTens > 5)) {
return false;
} else {
return true;
}
}
string Time::getAsString(){
return false;
}
</code></pre>
|
c++
|
[6]
|
5,500,987 | 5,500,988 |
Regarding Audio Play From Message Queue In Android
|
<p>My problem is the audio playing part.
I am recording the audio through mic into a buffer and than passing the data into a message queue and than again taking the data from message queue into a buufer and than playing it from the buffer directly.the recording part is working fine,but playing part is not working.The data from message queue is not getting copied into the buffer.So,plaese can anyone help me.</p>
<p>Regards,
Kashmir</p>
|
android
|
[4]
|
5,450,444 | 5,450,445 |
If i enter run keyword through command line three boxes should show in the display
|
<p>I am a novice in Java. I want to implement a core Java program in which when I enter the "run" keyword as a command line argument, three boxes should show in the display. I should differentiate the boxes as box1, box2, and box3. kindl</p>
|
java
|
[1]
|
1,146,027 | 1,146,028 |
Python: Mock side_effect on object attribute
|
<p>Is it possible to have a side_effect on a property? If I look at the Mock documentation it seems it's only possible on object methods.</p>
<p>I am trying to test the following:</p>
<pre><code>def get_object(self):
try:
return self.request.user.shop
except Shop.DoesNotExist:
return None
</code></pre>
<p>I want Shop to raise a DoesNotExist exception.</p>
<p>Guess maybe I wasn't clear enough but I am talking about the voidspace mock library.</p>
<p><a href="http://www.voidspace.org.uk/python/mock/index.html" rel="nofollow">http://www.voidspace.org.uk/python/mock/index.html</a></p>
|
python
|
[7]
|
326,652 | 326,653 |
need help clearing touch events between activities
|
<p><strong>Scenario:</strong></p>
<p>There are two activities...
Activity A has an imagebutton to launch an intent to show Activity B on screen.
Activity B has an imagebutton to finish() itself and cause Activity A to be shown.
These buttons are at the same location on each activity</p>
<p><strong>Problem:</strong></p>
<p>in Activity B, when I double-tap the button (instead of single tap), Activity A becomes visible but quickly shows Activity B again !</p>
<p>the second touch event seems to carry through to Activity A and it would seem that I could fix this problem by clearing some touch buffer in onCreate() of Activity A.</p>
<p>How can this be done? Or is there another fix ?</p>
<p>I've reproduced this on the emulator (2.2) and on the phone (2.3.3)</p>
|
android
|
[4]
|
1,440,391 | 1,440,392 |
NullPointerException in ActivityThread.handleBindApplication
|
<p>I have received this stack trace report that does not mention my app at all:</p>
<pre><code>java.lang.NullPointerException
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3979)
at android.app.ActivityThread.access$1300(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1255)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
</code></pre>
<p>Does anybody have any idea how to prevent this exception?</p>
|
android
|
[4]
|
4,195,715 | 4,195,716 |
Pure function given strictly equal arguments yielding non-strictly equal results
|
<p>Below is a <a href="http://en.wikipedia.org/wiki/Pure_function" rel="nofollow">pure function</a> <code>f</code> for which <code>f(a) !== f(b)</code> despite <code>a === b</code> (notice the <em>strict</em> equalities) for some values of <code>a</code> and <code>b</code>:</p>
<pre><code>var f = function (x) {
return 1 / x;
}
+0 === -0 // true
f(+0) === f(-0) // false
</code></pre>
<p>The existence of such functions can lead to difficult-to-find bugs. Are there other examples I should be weary of?</p>
|
javascript
|
[3]
|
5,709,908 | 5,709,909 |
Data type for holding different values C++
|
<p>I'm wondering how to load a number of images in a function and assign it to one variable so i can call on them and also hold information for those images.</p>
<p>For example :</p>
<pre><code>src = tile1.png
x = 10
y = 11
</code></pre>
<p>What kind of data type would i need ?</p>
<p>My goal is to loop through lines in a text file, load each image with its relevant information so the images are pre-loaded and ready to be displayed on the screen. I just a little stuck on how it would be done.</p>
|
c++
|
[6]
|
5,121,499 | 5,121,500 |
Substring go to End of String
|
<p>I am trying to get have one Substring go from the beginning of a string to a certain position and another Substring go from the end of the last position to the end of the string. But I don't know what the end will be. it will be multiple lengths. Is there a way to just go to the end of the string without giving a specific character position, something like below?</p>
<pre><code>StartVariable.Substring(0, 14)
EndVariable.Substring(15, Substring.Length)
</code></pre>
<p>Thanks!</p>
|
c#
|
[0]
|
4,568,476 | 4,568,477 |
strange behaviour of jquery 'click' event
|
<p>I had an anchor tag</p>
<pre><code><li><a href="#" class="institution">Click me</a></li>
<li><a href="#" class="department">Click me</a></li>
<li><a href="#" class="branch">Click me</a></li>
</code></pre>
<p>i wanted to execute some code by clicking on the anchor tag.so i used </p>
<pre><code>$('a').click(function(){
//do something..
});
</code></pre>
<p>but it did not work out. So I used </p>
<pre><code>$('a').on('click',function(){
//do something..
});
</code></pre>
<p>also i used</p>
<pre><code>$('a').bind('click',function(){
//do something..
});
</code></pre>
<p>but they did not work either. what worked for me was</p>
<pre><code>$('a').live('click',function(){
//do something..
});
</code></pre>
<p>why is this so..when all of them are supposed to show same behaviour.</p>
|
jquery
|
[5]
|
2,900,797 | 2,900,798 |
Custom Analog Timer in Android
|
<p>Someone please help me in creating Custom Analog Timer.
Say if the time span is 30 minutes the clock should show only 30 minutes and start reducing as time reduces.</p>
<p>Thanks in Advance.</p>
|
android
|
[4]
|
1,431,360 | 1,431,361 |
Using jQuery functions .each() and .live()
|
<p>I am using following jquery code for table calculations....</p>
<pre><code>$(document).ready(function() {
var totalregfee = 0;
$('.reg_fee').each(function(){
totalregfee+= parseFloat($(this).html());
});
$('.total_regfee').html(totalregfee);
});
</code></pre>
<p>It works perfect when page loads, but if i go to next page or increase data rows on page using tablesorter.pager, total doesn't get updated, how can i use jquery <code>.live()</code> at above code. Please suggest. thanks.</p>
<p>Please ask if you need more details, thanks for support.</p>
|
jquery
|
[5]
|
933,673 | 933,674 |
Function overloading and function pointers
|
<p>The name of a function is a pointer to the function...<br>
But in case of function overloading the names of two functions are the same...<br>
So which function does the name point to?</p>
|
c++
|
[6]
|
2,549,139 | 2,549,140 |
Grab the Nth column in a table using Jquery along with colspan
|
<p>I have a dynamic table, and it may contain colspan in the column, So if i want to load the nth column in the row i want to consider colspan also on the selection.</p>
<p>For Example : </p>
<pre><code> <table>
<tr class="trow">
<td>Column1</td>
<td>Column2</td> <!-- included -->
<td>Column3</td>
</tr>
<tr class="trow">
<td>Cell-1-1</td>
<td>Cell-1-2</td> <!-- included -->
<td>Cell-1-3</td>
</tr>
<tr class="trow">
<td colspan="2">Cell-2-1</td>
<td>Cell-2-3</td>
</tr>
</table>
</code></pre>
<p>In this case if i give any column index it should give the list as below. </p>
<p><strong>Column 1 : (index 1)</strong></p>
<p>Cell-1-1 and Cell-2-1</p>
<p><strong>Column 2 : (index 2)</strong></p>
<p>Cell-1-2 and Cell-2-1</p>
<p><strong>Column 3 : (index 3)</strong></p>
<p>Cell-1-3 and Cell-2-3</p>
<p>how to achieve this using jquery. </p>
|
jquery
|
[5]
|
2,431,213 | 2,431,214 |
Run function if user close browser
|
<p>I have problem with this function. I will explain -
I must execute function if user closes browser. This function is write in JavaScript- saveCookieScriptPrefOnLogOut().</p>
<p>I have this solutions (I writed this using info from StackOverFlow):</p>
<pre><code>var inFormOrLink;
$('a').live('click', function() { inFormOrLink = true; });
$('form').bind('submit', function() { inFormOrLink = true; });
$(window).bind('beforeunload', function(eventObject) {
var returnValue = undefined;
if (! inFormOrLink) {
saveCookieScriptPrefOnLogOut();
}
saveCookieScriptPrefOnLogOut();
return true;
});
</code></pre>
<p>Problems with this solution is: every browser display windows with question "Do you really want to close?"</p>
<p>I have to hide this information/window. Second problem (less important but still) - FF and IE runs this function when I click on Link or form submit. I need to ignore a links and form submit.</p>
<p>solution must be crossbrowser solution (IE, Chrome, FF on windows. The most important is IE). I can use PHP and javascript.</p>
<p>Can you give me any answer how I solve these problems?</p>
|
javascript
|
[3]
|
4,007,679 | 4,007,680 |
Why does the map size returns 0
|
<pre><code> using namespace std;
class A {
public:
A() {}
~A() {}
map<int, string*>& getMap() {
return mapStr;
}
void setMap(const map<int,string*> m) {
mapStr = m;
}
private:
map <int, string*> mapStr;
};
class B {
public:
A getA() {
return a;
}
private:
A a;
};
int main(int argc, char*argv[]) {
map<int, string*> mm;
mm.insert(std::make_pair(1, new string("abc")));
mm.insert(std::make_pair(2, new string("def")));
B b;
b.getA().setMap(mm);
cout << "Size " << b.getA().getMap().size() << std::endl;
return 0;
}
</code></pre>
<p>Output:
Size 0</p>
<p>Any ideas as to why does this return the map size to be 0 and what needs to be done to be fixed</p>
|
c++
|
[6]
|
2,578,339 | 2,578,340 |
Send one message to multiple social media networks
|
<p>I'm developing an app where users can send a message to multiple social media networks. Before they do, they have to fill in their user credentials.</p>
<p>Is there any smart library which I can use in PHP to simply send one message to multiple social media platforms (twitter, facebook, linkedin etc.)? I can achieve this by adding all the functionality separately, but I assume there must be a faster way.</p>
|
php
|
[2]
|
1,617,710 | 1,617,711 |
Let $(window).blur and $('#id').click perform same function
|
<p>I've got 2 different events that I want to have the same functions performed on. How do I 'merge' them?</p>
<pre><code>$(window).blur(function(e) {
e.preventDefault();
togglebackground();
});
$("#show-wall-link, #maximage, iframe").click(function (e) {
e.preventDefault();
togglebackground();
});
</code></pre>
|
jquery
|
[5]
|
4,569,440 | 4,569,441 |
Pass an array into jquery attr(), for one property
|
<p>Can I Pass an array into jquery attr for one property, such as follow</p>
<pre><code>$("th[id={x,y}]")
</code></pre>
<p>it look like "where in" condination at SQL. My wants such as it, $("th[id={x,y}]") is th's id equal one of these? I want to ask it! Do you use any where-in condition in sql.. My wants like it.</p>
|
jquery
|
[5]
|
4,615,505 | 4,615,506 |
Cloning Input Boxes
|
<p>Hi I have a input box that needs to be cloned up to six times, according to the .clone() function, i can do this, but if the input name has to be changed, how to do this.</p>
<p><a href="http://api.jquery.com/clone/" rel="nofollow">http://api.jquery.com/clone/</a></p>
<pre><code><label for="input">
<input name="input" id="input" type="text">
</label>
<a href="#" onClick="cloneInput()">Add Another Input</a>
</code></pre>
<p>So let's say when a new input is created it should add an increment to the name and id, ie: <code>name="input2"</code> <code>id="input2"</code> and so on, each time the object is cloned. </p>
<p>Anyone have any suggestions on the best/easiest way to do this with jQuery? </p>
|
jquery
|
[5]
|
5,555,716 | 5,555,717 |
How to use logical operators in preg_replace() & preg_match in php
|
<p>How to use "&&" and "||" in php functions like preg_replace & preg_match.</p>
|
php
|
[2]
|
2,826,566 | 2,826,567 |
Android Device install new font
|
<p>I need to install Tamil font in to my Android device. is it possible to install new Unicode font in to the android device?</p>
<p>Thanks,
Chandnaa</p>
|
android
|
[4]
|
3,498,066 | 3,498,067 |
How exactly does Java wait() method work?
|
<p>Consider that thread 1 is running following code:</p>
<pre><code>while (true) {
synchronized (this) {
wait();
...Do Something ...
}
}
</code></pre>
<p>And lets say we have thread 2 that notifies thread 1, ie:</p>
<pre><code>synchronized (thread1)
thread1.notify();
}
</code></pre>
<p>My question is lets say thread 1 got woken up, and is doing something (so its running currently). Then lets say thread2 does notify on thread1 while thread1 is running.
Will thread1 run again when it finishes "do something"? Or will it just sleep instead?</p>
<p>Is my question clear enough?</p>
<p>Thank you.</p>
|
java
|
[1]
|
2,517,482 | 2,517,483 |
Enabling and disabling vibration in android programmatically
|
<p>In one of my android apps, I need to enable or disable the vibration completely irrespective of the mode (i.e. silent or general or loud).</p>
<p>I am currently using the following code with the help of the <strong>deprecated function
setVibrateSetting</strong></p>
<p>// For turning on the vibration mode</p>
<pre><code>audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER,
AudioManager.VIBRATE_SETTING_ON);
audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION,
AudioManager.VIBRATE_SETTING_ON);
</code></pre>
<p>// For turning off the vibration mode</p>
<pre><code>audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER,
AudioManager.VIBRATE_SETTING_OFF);
audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION,
AudioManager.VIBRATE_SETTING_OFF);
</code></pre>
<p>But I am wondering if there is a clear way to do this.</p>
<p>And suggestions are most welcome :)</p>
<p>Regards,
Jujare</p>
|
android
|
[4]
|
5,460,570 | 5,460,571 |
Clicking on an icon to open and close the tooltip
|
<p>I'm trying to figure out how you can open the tooltip by clicking on the icon as well as closing it. I've been looking at some of the discussion here, but none of them doesn't seem to work at my end. Here is what I have so far:</p>
<p><strong>HTML</strong></p>
<pre><code><span class="info">
<img alt="aImage" src="images/aImage.png" />
<span style="display: none;" class="stuff">something something</span>
</span>
</code></pre>
<p><strong>Javascript</strong></p>
<pre><code>$(document).ready(function(){
$(".info").tooltip({tooltipcontentclass:"stuff"})
});
</code></pre>
<p>For this, of course, this will only show the tooltip if the mouse is hovering over it and closes it if you hover it away. I know it's not much, but this is the best I can do here. Please let me know if there is a way for opening and closing it by clicking.</p>
|
jquery
|
[5]
|
791,262 | 791,263 |
Problem with printing values
|
<p>I have created this basic program for cryptography Deffie Hellman. I want s to be a randomly generated prime number, and q to be a randomly generated integer. sk1 and sk2 are shared keys which are also generated randomly. pk1 and pk2 are modulus calculated values which I have to prove are equal to each other. I think my formula is correct but I am not sure how to print the values of s, q, sk1, sk2, pk1 and pk2 to verify my requirements. My code is pasted below and I would really appreciate if anyone could help me with the print statements.</p>
<pre><code>/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication1;
import java.util.Random;
import java.math.*;
/**
*
* @author Hash
*/
public class DH {
public static void main(String [] arg) {
int s, q;
double sk1, sk2, pk1 = 0, pk2 = 0;
Random generator = new Random();
s = generator.nextInt(50000);
q = generator.nextInt(50000);
sk1 = generator.nextInt();
sk2 = generator.nextInt();
if(s==1 || s==2) {
for(int i = 2; i< (int)(s/2); i++) {
if(s/i != (int)(s/i)) {
double a= Math.pow(q,sk1);
pk1 = a%s;
double b= Math.pow(q, sk2);
pk2 = b%s;
if(pk1==pk2) {
System.out.println("true");
}
System.out.println(s);
System.out.println(q);
System.out.println(sk1);
System.out.println(sk2);
System.out.println(pk1);
System.out.println(pk2);
}
}
}
}
}
</code></pre>
|
java
|
[1]
|
4,733,097 | 4,733,098 |
Inserting a element with Jquery
|
<p>I have an application that uses a series of functions to render and populate form fields. I need to insert an arbitrary div underneath one of the form fields, but I'd rather not make any changes to the form code. Is there a way that I can just insert the field where I want it with Jquery? Thanks.</p>
|
jquery
|
[5]
|
2,302,746 | 2,302,747 |
How to install a Python module via its setup.py in Windows?
|
<p>I downloaded dateutil which comes with a setup.py file but it throws an error when I try to open it. What's the proper way to install this module?</p>
<p>This is the error:</p>
<pre><code> error: no commands supplied
</code></pre>
|
python
|
[7]
|
3,952,086 | 3,952,087 |
Read single line from a big text file
|
<p>I have a 10MB text file.<br>
The length of the lines may vary.</p>
<p>Which is the most efficient way (fast and memory friendly) to read just one specific line from this file? e.g. <code>get_me_the_line($nr, $file_resource)</code></p>
|
php
|
[2]
|
745,322 | 745,323 |
Error building apk using apktool
|
<p>I am trying to decompile and then recompile an apk using apktool.
I used apktool like this:
<img src="http://i.stack.imgur.com/oQtk4.jpg" alt="enter image description here"></p>
<p>No changes made to the files. I just decompiled and recompiled them but apktool is showing error. The problem persists when i do make some changes to the xml files.
What should I do now?</p>
<p>Regards</p>
|
android
|
[4]
|
3,573,425 | 3,573,426 |
digital signature on android
|
<p>I am developing an android application which generates a type of document and this document requires a signature. need to know how I can capture a digital signature by a person for this document.</p>
|
android
|
[4]
|
3,217,825 | 3,217,826 |
Private method parameters
|
<p>I have this method with an optional parameter.</p>
<pre><code>public static Test(String connection, Int32 retryInfiniteLoopGuard = 0)
</code></pre>
<p>Is there a way to somehow mark the <code>retryInfiniteLoopGuard</code> as <code>private</code> so that it will become invisible when calling the method from outside of the class? </p>
<p>If you wonder why, <code>retryInfiniteLoopGuard</code> is for recursion execution and should not be visible to the users...</p>
<p>Today I use overloading, but is there any other way?</p>
|
c#
|
[0]
|
4,451,933 | 4,451,934 |
how can we add a doctype using javascript
|
<p>i want to add doctype using javascript. when a doctype already exist i am able to modify it. but when it is null, not able to add new doctype.. how can i do it in JS</p>
|
javascript
|
[3]
|
4,522,300 | 4,522,301 |
How do you escape parentheses in jquery selector?
|
<p>I am trying to check if a td innertext contains parentheses (). The reason is I display negative numbers as (1000) and I need to convert them to -1000 to do math. I've tried a couple different ways but can't seem to get it right. I know there are non-jquery ways to do this but at this point it's just bugging me.</p>
<pre><code>$(tdElement[i]).find("\\(").length > 0
</code></pre>
<p>This doesn't throw error, but it doesn't find an innertext of (1000):</p>
<pre><code>$(tdElement[i]).find("\\(")
{...}
context: {object}
jquery: "1.3.1"
length: 0
prevObject: {...}
selector: "\("
</code></pre>
<p>Another method I tried was:</p>
<pre><code>$("#fscaTotals td").filter(":contains('\\(')")
</code></pre>
<p>This throws error "Exception thrown and not caught". It seems to work for other characters though. example: . , ; < > </p>
<p>so, how do you escape parentheses in jquery?</p>
|
jquery
|
[5]
|
4,704,499 | 4,704,500 |
how does ArrayList dynamically increases its capacity
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3626140/arraylist-capacity-increment-equation">ArrayList capacity increment equation</a> </p>
</blockquote>
<p>I could not get a clear picture about the fact.
Can you please explain. I know that this question can be a duplicate, but please explain.</p>
|
java
|
[1]
|
3,214,983 | 3,214,984 |
Unable to type in textbox even with focus set
|
<p>I have a flash keyboard (not written by me and I know no flash) which is used by the users to type in to the web forms. The keyboard works fine and I am able to fill the fields properly. </p>
<p>When the keyboard obscures any field, I am scrolling the document (in EnsureNotObscured() method) so that input field is not obscured. This is where I am getting the issue. After scrolling the document, I can see that the input field still has the focus (cursor blinks) but when I type nothing appears.</p>
<p>IF I click the mouse in that field again then I am able to type in that field. What could be the reason for this behavior? I even tried explicitly setting focus using
document.getElementById(field.id).focus() after scrolling the document in EnsureNotObscured() and still it doesnt work. I even tried doing blur of the field and then setting focus back but no success. </p>
|
javascript
|
[3]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.