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,521,690
| 4,521,691
|
Problem with Ctrl+Z and textarea
|
<p>I use this code <a href="http://www.openjs.com/scripts/events/keyboard_shortcuts/index.php" rel="nofollow">http://www.openjs.com/scripts/events/keyboard_shortcuts/index.php</a> for handling keyboard shortcuts.</p>
<pre><code> shortcut.add("Ctrl+Z",function() {
setTimeout(function() {
var val= $("textarea").val();
var length = val.split("\n").length;
alert(length);
}, 100);
},{
'type':'keydown',
'propagate':true,
'target':document.getElementById("textarea")
});
</code></pre>
<p>I have problem when ctrl+z is pressed and there is nothing to undo - the alerts 2 ,not 1.</p>
|
javascript
|
[3]
|
2,525,315
| 2,525,316
|
How to convert string to symbol in PHP
|
<p>How to convert a password string to specified symbol like <code>*</code> or something else.</p>
<p>I'm currently working on change password page.
I would like to display the password to page, and i want to avoid the password overlook by someone, so i want to covert the password's string to symbol like <code>*</code> with same lengths.
An example like <code><input type="password" /></code>.</p>
<p>Sorry for my bad english...</p>
|
php
|
[2]
|
1,738,963
| 1,738,964
|
Why doesn't C++ have virtual variables?
|
<p>This might have been asked a million times before or might be incredibly stupid but why is it not implemented?</p>
<pre><code>class A
{
public:
A(){ a = 5;}
int a;
};
class B:public A
{
public:
B(){ a = 0.5;}
float a;
};
int main()
{
A * a = new B();
cout<<a->a;
getch();
return 0;
}
</code></pre>
<p>This code will access A::a. How do I access B::a? </p>
|
c++
|
[6]
|
5,525,449
| 5,525,450
|
scale-independent pixel
|
<p>I don't know how it convert to the unit of pixels. For example, if I assign 10sp to my font size on 160 dpi device, how much px of my font size is it ? Or, if I assign 10sp to my font on 240 dpi device, how much px of my font size is it ?</p>
|
android
|
[4]
|
2,053,844
| 2,053,845
|
JQuery update javascript snippet
|
<p>The scenario is that I'd like to update a javascript snippet (that renders a widget) when a user clicks a button.</p>
<p>The idea is that a user can enter a number of parameters to configure their widget and then click a button to see a preview of it.</p>
<p>Is there a way to do this via jquery?</p>
<p>The snippet would look something like this:</p>
<pre><code><script type="text/javascript"><!--
var yoc_w_frame = "SiteName";
var yoc_home = "HomePath";
var yoc_w_width = 300;
var yoc_w_height = 250;
//--><script>
<script type="text/javascript" src="http://domain.com/js/js.js"></script>
</code></pre>
<p>I tried <code>$("#divTest").append( script );</code> where script is a var that holds the built up script string.</p>
|
jquery
|
[5]
|
3,115,860
| 3,115,861
|
Appending Date to the end of line in multiple textbox
|
<p><img src="http://i.stack.imgur.com/tMpk5.png" alt="enter image description here"></p>
<p>how could i add a date to the very end of each line with another font and size ?!
for example i want to add 1:15 AM to the end of "hello World" line.</p>
|
c#
|
[0]
|
636,107
| 636,108
|
Best way to implement Web client for existing C++ application?(i wanted to web client implement in java)
|
<p>I have existing C++ application i wanted to implement web client for that application.suggest me best way to implement.</p>
|
c++
|
[6]
|
1,730,521
| 1,730,522
|
phone to phone...unlimited SMS?
|
<p>I have an idea for an app that requires a lot of data exchange between users of the app. SMS seems like a very simple way to get this done, but is it safe to assume that all smart phone users have unlimited SMS? Otherwise this app won't be very popular due to expensive rates for SMS.</p>
<p>If this is really a bad assumption, can someone tell me what other means I should consider to accomplish this phone to phone communication? Initially I had hoped for an alternative that used data service instead of SMS. But I have read many (so many) forum posts about this sort of thing and have read nothing conclusive. </p>
<p>A bit about my app's requirements:</p>
<ul>
<li>Users build up a network of 'friends' for coordinating among them.</li>
<li>When one user creates some event on their device, all users in their network should be notified. </li>
<li>User's can also instant message other users on their network</li>
</ul>
<p>So, I need a mechanism for getting all of this done. After reading a bunch of tutorials, I can see how I would do this using SMS, just not sure if that's a good idea. Some people have said that this sort of job would require a central server, but I'm not quite sure how exactly that would work. I am not opposed to a solution that involves a server, I just need some help to get me started in the right direction. </p>
<p>Thanks in advance. </p>
|
android
|
[4]
|
694,384
| 694,385
|
Php without start/end tags?
|
<p>Is it possible to have php not to require the begin/end tags (<code><?php ?></code>) for some of the files?
The code should be interpreted as php by default.</p>
<p>I'm aware that I can leave out the end tag (<code>?></code>).</p>
|
php
|
[2]
|
4,491,114
| 4,491,115
|
cannot go to detail view from table view on iphone
|
<p>i have table view and when user click on any row then he should go to next view
but in my case its not working, what i am doing wrong here??</p>
<pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Navigation logic -- create and push a new view controller
NSLog(@" push");// is working
aDetail = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:[NSBundle mainBundle]];// not wokring
[self.navigationController pushViewController:aDetail animated:YES];//not working
}
</code></pre>
|
iphone
|
[8]
|
4,691,211
| 4,691,212
|
publishProgress from inside a function in doInBackground?
|
<p>I use an AsyncTask to perform a long process.</p>
<p>I don't want to place my long process code directly inside doInBackground. Instaid my long process code is located in another class that I call in doInBackground.</p>
<p>I would like to be able to call publishProgress from inside the longProcess function.
In C++ I would pass a callback pointer to publishProgress to my longProcess function. </p>
<p>How do I do that in java ?</p>
<p>EDIT: </p>
<p>My long process code:</p>
<pre><code>public class MyLongProcessClass
{
public static void mylongProcess(File filetoRead)
{
// some code...
// here I would like to call publishProgress
// some code...
}
}
</code></pre>
<p>My AsyncTaskcode:</p>
<pre><code>private class ReadFileTask extends AsyncTask<File, Void, Boolean>
{
ProgressDialog taskProgress;
@Override
protected Boolean doInBackground(File... configFile)
{
MyLongProcessClass.mylongProcess(configFile[0]);
return true;
}
}
</code></pre>
<p>EDIT #2
The long process methode could also be non-static and called like this:</p>
<pre><code>MyLongProcessClass fileReader = new MyLongProcessClass();
fileReader.mylongProcess(configFile[0]);
</code></pre>
<p>But that does not change my problem.</p>
|
android
|
[4]
|
5,194,453
| 5,194,454
|
JS: Events and variables
|
<p>Is there a way to raise event where some variable is changed?</p>
|
javascript
|
[3]
|
5,542,433
| 5,542,434
|
java print out a double array
|
<p>i have an array with some double value inside:</p>
<pre><code>private double speed[] = {50, 80, 120, 70.3};
public void printSpeed() {
for(int i = 0; i<=speed.length-1; i++ ) {
System.out.println(speed[i]);
}
}
output
50.0
80.0
12.0
70.3
wanted output
50
80
12
70.3
</code></pre>
<p>How to do print the exactly string of the array?</p>
|
java
|
[1]
|
1,348,729
| 1,348,730
|
base64_encode and decode escape char problem
|
<p>Hi I've made a paste bin site to share code with a school work group, the problem that I have is when I save code in the db I use <code>base64_encode(code)</code>, when I try to show with
<code>base64_decode(code)</code> it shows with escaped chars like: </p>
<pre><code>#!/bin/bash
printf \"thi is a test\"\\n
exit 0
</code></pre>
<p>How can I show it, with out escaped chars?</p>
<p>Thanks, Manolo</p>
|
php
|
[2]
|
2,350,501
| 2,350,502
|
Best way in PHP to ensure in a class that all the class functions are called only if a given condition is true
|
<p>I have a class in which each function of the class have to check the exact same condition before executing its code:</p>
<pre><code>class myObject
{
public function function1($argument)
{
if($condition === true)
{
//Do Something
}
}
public function function2($argument)
{
if($condition === true)
{
//Do Something
}
}
public function function3($argument)
{
if($condition === true)
{
//Do Something
}
}
public function function4($argument)
{
if($condition === true)
{
//Do Something
}
}
}
</code></pre>
<p>We can see that function1, function2, function3, function4 only execute their code if <code>$condition === true</code>.</p>
<p>If in the future I add another function called function5, I will have to duplicate this condition.</p>
<p><strong>So my question is, what is the best way to ensure that before call ANY function in the class, a condition is true, and if the condition is false, not call the function.</strong></p>
<p>My method is to use the magic function __call and make all the functions of the class private:</p>
<pre><code>class myObject
{
public function __call($method,$args)
{
if($condition === true)
{
call_user_func_array(array($this,$method),$args);
}
return;
}
private function function1($argument)
{
//Do Something
}
private function function2($argument)
{
//Do Something
}
private function function3($argument)
{
//Do Something
}
private function function4($argument)
{
//Do Something
}
}
</code></pre>
<p>It seems to work. However, I'm unsure that it will always work and that it is a clever way of doing it.</p>
|
php
|
[2]
|
4,725,512
| 4,725,513
|
Adding admob to Android app before or after putting it on android market?
|
<p>Do i need to put android app to market first before adding admob or some other display ads on the mobile app? As when i was signing up for admob it asks for android url. I am new to this can anyone explain in detail. How i can do this? </p>
|
android
|
[4]
|
5,599,822
| 5,599,823
|
How to get an image to appear when someone clicks a checkbox
|
<p>I want a little happy face to float up and disappear after someone clicks a checkbox. Is there a simple way to do this with jQuery?</p>
|
jquery
|
[5]
|
4,033,381
| 4,033,382
|
namespacing javascript in user control
|
<p>I have created a jquery slider usercontrol in asp.net using jquery UI slider. The user control have some javascript functions to set the value of the slider when the textbox value changes in the main page. Everything works fine if I have only usercontrol. But if I have multiple user controls, I am not sure how to namespace the javascript so that it calls the function inside the specific user control. </p>
<p>Thanks,
Sridhar.</p>
|
asp.net
|
[9]
|
5,127,626
| 5,127,627
|
how to stop media player through my application in android
|
<p>I have created one new application, from which I want to stop the media player which is already running in the background.</p>
<p>Can any one help on this please?</p>
|
android
|
[4]
|
3,567,724
| 3,567,725
|
Is it okay to use data-attributes to store Javascript 'state'
|
<p>I often use data-attributes to store configuration that I can't semantically markup so that the JS will behave in a certain way for those elements. Now this is fine for pages where the server renders them (dutifully filling out the data-attributes).</p>
<p>However, I've seen examples where the javascript writes data-attributes to save bits of data it may need later. For example, posting some data to the server. If it fails to send then storing the data in a data-attribute and providing a retry button. When the retry button is clicked it finds the appropriate data-attribute and tries again.</p>
<p>To me this feels dirty and expensive as I have to delve into the DOM to then dig this bit of data out, but it's also very easy for me to do.</p>
<p>I can see 2 alternative approaches:</p>
<p>One would be to either take advantage of the scoping of an anonymous Javascript function to keep a handle on the original bit of data, although this may not be possible and could perhaps lead to too much "magic".</p>
<p>Two, keep an object lying around that keeps a track of these things. Instead of asking the DOM for the contents of a certain data-attribute I just query my object.</p>
<p>I guess my assumptions are that the DOM should not be used to store arbitrary bits of state, and instead we should use simpler objects that have a single purpose. On top of that I assume that accessing the DOM is more expensive than a simpler, but specific object to keep track of things.</p>
<p>What do other people think with regards to, performance, clarity and ease of execution?</p>
|
javascript
|
[3]
|
1,115,179
| 1,115,180
|
File save in asp.net and save information in DB
|
<p>I am creating the user ,using asp.net + C#.there is the form (UI) who collects the information and send data to Business layer. now, while collecting the information from UI I want to also save the image of user, at file system in application domain.</p>
<p>There is function in the business layer as SaveImage, which returns the path where it is saving.
Scenario:
1) Save image first and then save other information in DB.
2) Save Information first in DB and then uploads the image.</p>
<p>Which will best scenario. If scenario 1 is better then what if the save image get crashes ? </p>
|
asp.net
|
[9]
|
1,259,274
| 1,259,275
|
Retrieve values from a pop up window to the parent window
|
<p>I have a pop up window that contains some selections. Once the user selects options, the selected options need to be displayed in the main window. The main window doesn't need to be refreshed when options are selected from the pop up window. I'm using javascript for this, but I cannot figure out how to access the <code>checkbox</code> item of the pop up window from the main window.</p>
<p>Example:</p>
<pre><code><input type="checkbox" name="vehicle[]" value="Bike" />
<input type="checkbox" name="vehicle[]" value="car" />
var chbox = document.getElementById("vehicle[]").value;
</code></pre>
<p>But this doesn't work.</p>
|
javascript
|
[3]
|
1,979,258
| 1,979,259
|
Access to Site.Master objects from an asp.net file
|
<p>I have a asp page that is using Site.Master.</p>
<p>I put a link in Site.Master, and master included default.aspx. How can I access link attribute in asp file?</p>
<p>in Site.Master :</p>
<pre><code><asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Register.aspx"
Target="_blank">Register</asp:HyperLink>
</code></pre>
|
asp.net
|
[9]
|
3,131,762
| 3,131,763
|
Remove anchor tags using jQuery
|
<p>My html:</p>
<pre><code><div class="example">
<a id="link" href="http://www.google.com">Example</a>
</div>
</code></pre>
<p>jQuery</p>
<pre><code>$('a#link').remove();
</code></pre>
<p>What I would like to do is have the html look like this after the is removed:</p>
<pre><code><div class="example">
Example
</div>
</code></pre>
<p>How do I remove just the </p>
<pre><code><a> </a>
</code></pre>
<p>part?</p>
|
jquery
|
[5]
|
465,566
| 465,567
|
Binding with collections and Lists
|
<p>Can anyone please tel me an example for how to bind the data with the Collections and Lists. I know how to bind the data with databound controls. But, binding with the collection and Lists sounds little bit tougher.</p>
<p>Thanks.</p>
<p>Regards,</p>
<p>Naren.</p>
|
asp.net
|
[9]
|
4,246,888
| 4,246,889
|
Can an event be dispatched to Activity after onDestroy?
|
<p>Consider that activity is destroyed and onDestroy was fired. Can I be sure that no other messages will be dispatched into this activity handlers like onKeyDown?</p>
|
android
|
[4]
|
3,671,112
| 3,671,113
|
How can I reload the entire page when only the url hash changes?
|
<p>How do I reload a page if the only change to the url is a hash? <code>location.href</code> doesn't work as I expect.</p>
<pre><code>location.href= CURRENT_SITE_URL . '#T_blockName';
</code></pre>
<p>This doesn't refresh the page unless I change <code>CURRENT_SITE_URL</code>. How is it possible?</p>
|
javascript
|
[3]
|
5,863,013
| 5,863,014
|
click multiple times a submit button
|
<p>I encountered a problem that I can't solve. My point is to "click" my sybmit button and every time increase a counter, while this counter reach 10. For the first time it works, but this is it!
My test code is below :</p>
<pre><code><form name="testForm" method="post">
<?php $cnt=0; ?>
<input type="submit" name="next" id="next" value="NEXT"/>
<?php
if(isset($_POST['next'])){
if($cnt< 10){
echo $cnt.' --> ';
$cnt++;
echo $cnt;
}
}
?>
</form>
</code></pre>
<p>Only 0 --> 1 is printed, every time... please help!!</p>
<p>Thanks</p>
|
php
|
[2]
|
3,766,743
| 3,766,744
|
Change Video position while playback
|
<p>Is there any way on Android to dynamically change position of VideoView or SurfaceView while playing video?<br>
I've tried to use view animators, Surface.setPosition(), View.layout(), push Surface view with ralated LinearLayout with bigger weight( this approach helps sometimes and i see that video jumps to new position while playing but i need smooth moving.) and nothing happens until video ends.</p>
<p>(Checked on Emulator (2.2) and Nexus One - results are the same)</p>
|
android
|
[4]
|
2,277,643
| 2,277,644
|
Questions every good PHP Developer should be able to answer
|
<p>I was going through <a href="http://stackoverflow.com/questions/365489/questions-every-good-net-developer-should-be-able-to-answer">Questions every good .Net developer should be able to answer</a> and was highly impressed with the content and approach of this question and so in the same spirit, I am asking this question for PHP Developer.</p>
<p><strong>What questions</strong> do you think should a good <strong>PHP programmer be able to respond to?</strong></p>
<p><strong>EDIT</strong> : I am marking this question as community wiki as it is not user specific and it aims to serve programming community at large. </p>
<p>Looking forward for some amazing responses. </p>
<p><strong>NOTE</strong> : Please answer questions too as suggested in the comments so that people could learn something new too regarding the language. </p>
|
php
|
[2]
|
596,313
| 596,314
|
How to add elements to an array( which is an element in dictionary(item) in plist)?
|
<p>In plist,I want to keep an array in each dictionary (Item).And if it is created,how I can send elements to that array.For example,If I created an account for an user,I will keep name,sex,email,password everything in a dictionary(item),in the similar way an array which contains inbox messages.Then I want to know that how I can store coming messages to that inbox array. </p>
|
iphone
|
[8]
|
2,093,246
| 2,093,247
|
Private inheritance hides base class with "inaccessible within this context" error
|
<p>I'm having a problem similar to that described in the following link where a privately inherited base class gives an "inaccessible within this context" error when I try to declare a member of the base class inside the derived class:
<a href="http://bytes.com/topic/c/answers/164246-private-inheritance-renders-class-inaccessible">http://bytes.com/topic/c/answers/164246-private-inheritance-renders-class-inaccessible</a></p>
<p>Explicitly referencing X with ::X works in the above case, but what if the code is in a function such as:</p>
<pre><code>void fooby()
{
class X {};
class Y : private X {};
class Z : public Y
{
public:
X x; // compiler "inaccessible within this context" error
};
};
</code></pre>
<p>How do you reference X in this case?</p>
<p>If fooby were a struct/class, then ::fooby::X would work, but I'm not sure how to do it in the case above.</p>
|
c++
|
[6]
|
1,524,704
| 1,524,705
|
Myspace video upload in android
|
<p>hi i am developing an application that needs to upload photos on Myspace , i had used Socialauth library for Mysapce integration and i have succesfully integrated Myspace but couldn't find any method to upload photo.Can anyone suggest me a link or tutorial for uploading photo on Myspace.
A</p>
|
android
|
[4]
|
1,580,257
| 1,580,258
|
Can we added changing image/text on android app
|
<p>Is there a way in android app that we can add some text or image and we can change that dynamically without adding new version. Like we have this text: Today's deal is: 1
then in a week if i want that text to show as: Today's deal is: 2.
Is there a way to do this, for an app which does not have a server and is stand alone app.</p>
|
android
|
[4]
|
1,984,717
| 1,984,718
|
C# remove children added by loop
|
<p>I am adding children by loop to the Main grid. But how do I remove them? I want to remove only the children I added each time the function was called and then add the new ones.</p>
<pre><code>void flcl_Selection(object sender, MyEventArgs e)
{
//remove children here
for (int i = 0; i < e.MyFirstString.Count; i ++)
{
LabelCountry lbl = new LabelCountry((string)e.MyFirstString[i]);
MainGrid.Children.Add(lbl);
}
}
</code></pre>
|
c#
|
[0]
|
2,744,692
| 2,744,693
|
Slider works fine in Firefox but not in Chrome and Safari
|
<p>My slider works fine in firefox but it does not work in Chrome or Safari. I am new to jQuery. I only ben using it for a month. I can tell that my script is creating my elements but after that I cannot tell what is tripping it up.</p>
<p>Here is my slider code. </p>
<pre class="lang-js prettyprint-override"><code>(function($){
var sliderUL = $("div.slider").css("overflow", "hidden").children("ul"),
imgs = sliderUL.find('img'),
imgsWidth = imgs.width(),
imgsLen = imgs.length,
current = 1,
totalImgsWidth = imgsWidth * imgsLen;
$("<div id='slider-nav'></div>").insertAfter('div.slider');
$("#slider-nav").prepend("<button data-dir='next'>Next</button>");
$("#slider-nav").prepend("<button data-dir='prev'>Prev</button>");
$("#slider-nav").show().find("button").on("click", function(){
var direction = $(this).data("dir");
var loc = imgsWidth;
if(direction === "next"){
current = ++current;
}else if (direction === "prev"){
current = --current;
}
if(current === 0){
current = imgsLen;
loc = totalImgsWidth - imgsWidth;
direction = "next";
}else if(current -1 === imgsLen){
current = 1;
loc = 0;
}
transition(sliderUL, loc, direction);
});
function transition( container, loc, direction){
var unit;
if(direction && loc !== 0){
unit = (direction === "next") ? "-=" : "+="
}
container.animate({
"margin-left" : unit ? (unit + loc) : loc
})
};
})(jQuery);
</code></pre>
|
jquery
|
[5]
|
4,118,925
| 4,118,926
|
Problems Scanner in Java
|
<p>I was having difficculties when trying to read from a JOPtionPane input dialog using a Scanner object (text below)</p>
<pre><code>int array[] = new int[6];
for (int i=0; i<6; i++)
{
Scanner sc = new Scanner(System.in);
JOptionPane.showInputDialog("Enter a number to fill the array: ");
array[i]=sc.nextInt(System.in);
}
</code></pre>
<p>Difficulties got solved when changed code like follows:</p>
<pre><code>String st;
int array[] = new int[6];
for (int i=0; i<6; i++)
{
st= JOptionPane.showInputDialog("Enter a number to fill the array: ");
array[i] = Integer.parseInt(st);
}
</code></pre>
<p>I would like to know why I can't fill the array using a Scanner class object :/</p>
|
java
|
[1]
|
3,170,848
| 3,170,849
|
How to read data custom attribute from DOM in jquery
|
<p>I try to read the user id from "data-user-id" using jquery "data" api but I am not able to get the value of custom data attribute</p>
<pre><code>var userId = $(".invited-user").data("user-id");
</code></pre>
<p>I try above jquery code but I am not get the user id</p>
<pre><code><div id="selected-items" style="display: block;"><div id="selected-items"><div class="selected-item"><span class="label label-info invited-user" data-user-id="51935d96db0cad4b290004c5">
<span class="invited-user-name">
Kumaran
</span>
<button class="btn btn-info remove-btn">x</button>
</span></div></div></div>
</code></pre>
<p>Please suggestion a jquery api to read the custom data attribute. </p>
|
jquery
|
[5]
|
990,304
| 990,305
|
How to upgrade android 2.2 to android 2.3?
|
<p>i have samsung galaxy ace s5830. Can some one help me with the steps to upgrade 2.2 to 2.3?</p>
|
android
|
[4]
|
3,020,576
| 3,020,577
|
Android - 4.0 is out, which version to use?
|
<p>I'm just starting to learn Android development and writing my first app. I started with V2.2 but up until now mostly wrote generic Java code. Now that I started to write Android specific code I saw that a new version was out.
After installing it, eclipse IDE lets me choose between v2.1 and v4.0. non of the others are available.</p>
<p>So should I jump to 4.0 or stay with 2.1 to have the app compatible with a greater number of older handhelds? I'm not planning on using any new technology / functionality that 4.0 might be offering.</p>
|
android
|
[4]
|
2,360,525
| 2,360,526
|
confused on how my code work and want to understand the logic in it
|
<p>Please dont discourage this question..I am very new to c++ and really want to understand the code I work on.</p>
<pre><code>// bintodec.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
int main(){
string inp;
int dec = 0;
char base;
cout << "Input a number: ";
cin >> inp;
cout << "Input the base your number is in: ";
cin >> base;
for(int i = inp.length()-1, j = 0; i >= 0; i--, ++j) dec += (inp[i]-48) * pow((float)base-48, j);
cout << "Your number in base 10 is: " << dec <<endl;
system("pause");
return 0;
}
</code></pre>
<p>I really want to understand how this FOR LOOP runs the INPUT NUMBER and BASE, to then get an answer.</p>
<p>so lets say I INPUT 110 BASE 2 PRINT: 6</p>
<p>*How the for loop is doing it</p>
<p>thanks all!</p>
|
c++
|
[6]
|
5,026,861
| 5,026,862
|
Strange sum problem
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1458633/elegant-workaround-for-javascript-floating-point-number-problem">Elegant workaround for JavaScript floating point number problem</a> </p>
</blockquote>
<pre><code>var sum = 0;
$('[id$=percentOfTotalEditor]').each(
function () {
var igEditor = $find(this.id);
var value = igEditor.get_value();
sum += value;
}
);
</code></pre>
<p>Then you'll see the magic:</p>
<p>sum == 1.1, value == 0.1. But after sum += value, sum == 1.2000000000000001</p>
<p>WTF!?</p>
|
javascript
|
[3]
|
4,485,114
| 4,485,115
|
Ellipsis doesn't work
|
<p>I have an edittext and I want to show 3 dots at the end when the text is longer than the edittext.</p>
<p>I found that there is a method setEllipsize so I've used that, but it is not working..<br>
This is my code:</p>
<pre><code> edt.setInputType(InputType.TYPE_CLASS_TEXT);
edt.setFocusable(false);
edt.setCursorVisible(false);
edt.setMaxLines(1);
edt.setHorizontallyScrolling(true);
edt.setSingleLine(true);
edt.setEllipsize(TruncateAt.END);
</code></pre>
<p>I've tried to add multiple parameters as you can see, but none of them are working.</p>
<p>Any more options I can try? </p>
|
android
|
[4]
|
981,541
| 981,542
|
android : I need a scrollbar to the activity without affecting the lists
|
<p>I'm using 2 lists in the my activity, and I have to add scroll bar but I need to see all the elements in my lists.</p>
<p>if I put all the elements in scrollbar , I can see only the first element of the list.
If I put the elements of my activity in linearlayout I can't scroll anymore to see the other elements below the list.</p>
<p>thx 4 ur suggestions.</p>
|
android
|
[4]
|
1,959,899
| 1,959,900
|
Ternary operator in varargs returning object or array is invalid
|
<p>This is puzzling me and I would like an explanation.</p>
<pre><code>public foo(EventPoint... eventPoints) {
//...
}
boolean isThisHappening;
foo(isThisHappening ? new EventPoint() : new EventPoint[]{});
</code></pre>
<p>Even though <code>foo(new EventPoint());</code> is valid and <code>foo(new EventPoint[]{});</code> is also valid. Is this the ternary operator failing due to type evaluation?</p>
<p>Using JDK 1.7.0
Getting the error:<br>
required: EventPoint[]
found: Object
reason: argument type Object does not conform to vararg element type EventPoint</p>
|
java
|
[1]
|
1,795,727
| 1,795,728
|
How to bind textbox to the datable and make it search like google for some field of datable?
|
<p>i have a populated datatable and a search textbox,
i want to bind datatable to the search text box and
want to make it search like google, how can i achive this?</p>
<p>Edited :<br>
Like i want my search box to start searching all the first name which are similar when i start typing characters it starts searching for similar records as i type more character it display below more correct record like google</p>
|
asp.net
|
[9]
|
4,854,393
| 4,854,394
|
Convert jquery function into javascript
|
<p>I have to use javascript for below mention work which is done in jquery and working perfect. Reason to use javascript is to know how it can be done with javascript.I google it but not find any clue to how get it done</p>
<p><a href="http://jsfiddle.net/2vP24/" rel="nofollow">http://jsfiddle.net/2vP24/</a></p>
<pre><code>$('.first').find('.sub1').next().css('background','#ff0000')
</code></pre>
|
javascript
|
[3]
|
5,926,361
| 5,926,362
|
Impossible to set an attribute to a string?
|
<p>Usually, you can set an arbitrary attribute to a custom object, for instance </p>
<pre><code>----------
>>> a=A()
>>> a.foo=42
>>> a.__dict__
{'foo': 42}
>>>
----------
</code></pre>
<p>On the other hand, you can't do the same binding with a string object :</p>
<pre><code>----------
>>> a=str("bar")
>>> a.foo=42
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'str' object has no attribute 'foo'
>>> a.__dict__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'str' object has no attribute '__dict__'
>>>
----------
</code></pre>
<p>Why ?</p>
|
python
|
[7]
|
100,558
| 100,559
|
<hr> with display block is adding scroll bars if I dynamically change the margin
|
<p>I have created a hr tag with below style </p>
<pre><code> hr{
/* margin:5%; */
height:10px;
display:block;
}
</code></pre>
<p><a href="http://jsfiddle.net/thKb8/4/" rel="nofollow">here</a> is the fiddle
It is displayed properly. Occupying 100% width of the screen. But if I change the margin Dynamically through JavaScript Console. It is overflowing from screen. How can I make this auto adjustable based on margins.</p>
|
javascript
|
[3]
|
3,398,221
| 3,398,222
|
Jquery mouseenter and mouseout animation
|
<p>Im trying to do an event on mouseenter and mouseout.
If i put mouseover more than one time it will repeat the number of times i did it, even if still on first animation. Im also trying to stop the animation on mouseleave and animate it back.
Thanks in advance</p>
<p>Here's the javascript</p>
<pre><code>$('.velejador').mouseenter(function(){
$('.velejador').animate({
left: '-=50',
width: '40px'
}, 2000);
}).mouseleave(function(){
$('.velejador').animate({
left: '+=50',
width: '40px'
}, 2000);
});
</code></pre>
<p>Here the html</p>
<pre><code><div id="hidden-cartoons">
<img src="<?php echo base_url().'assets/img/cartoons/velejador.png' ?>" class="cartoon velejador">
<img src="<?php echo base_url().'assets/img/cartoons/bodoleite.png' ?>" class="cartoon bodoleite">
</div>
</code></pre>
|
jquery
|
[5]
|
3,408,114
| 3,408,115
|
RE:Got an error while using Web service
|
<pre><code>import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.AndroidHttpTransport;
import org.ksoap2.transport.HttpTransportSE;
public class FirstWebActivity extends Activity {
/** Called when the activity is first created. */
String SOAP_ACTION="http://tempuri.org/HelloWorld";
String METHOD_NAME = "HelloWorld";
private static final String SumsoapAction = "http://tempuri.org/add";
private static final String methodName = "add";
private static final String UrlNamespace = "http://tempuri.org/";
private static final String URL = "http://10.10.206.105/Webservicetest/service.asmx";
TextView tv1;
EditText Ed1;
EditText Ed2;@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tv1 = (TextView)findViewById(R.id.Result);
Ed1 = (EditText)findViewById(R.id.firstValue);
Ed2 = (EditText)findViewById(R.id.SecondValue);
SoapObject sum_request = new SoapObject(UrlNamespace, methodName);
Log.d("sum_request", sum_request.toString());
//PropertyInfo pro1 = new PropertyInfo();
String strA = Ed1.getText().toString();
String strB = Ed2.getText().toString();
sum_request.addProperty("a", strA);
sum_request.addProperty("b", strB);
Log.d("sum_request", sum_request.toString());
SoapSerializationEnvelope sum_envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
Log.d("sum_envelope", sum_envelope.toString());
sum_envelope.dotNet = true;
}
</code></pre>
|
android
|
[4]
|
3,602,481
| 3,602,482
|
NFC between two different applications Android
|
<p>I new at NFC with Android, and I am beginning to develop apps using NFC to communicate each other.</p>
<p>By now, what I was doing is communication between the same Activity and so on.
Well, now, I would like to see if it is possible to communicate TWO DIFFERENT APPS through NFC. </p>
<p>So, is it possible to communicate using NFC between two different apps (that I develop) ?</p>
<p>Thanks a lot!</p>
|
android
|
[4]
|
249,202
| 249,203
|
Find first id in jquery
|
<pre><code><div class="activity" id="4">
<div class="activity" id="3">
<div class="activity" id="2">
<div class="activity" id="1">
</code></pre>
<p>and jquery code to find first id</p>
<pre><code>var ID = $('.activity:first').attr('id');
</code></pre>
<p>whats wrong there? error in firebug</p>
<p>Warnung: Unbekannte Pseudoklasse oder Pseudoelement 'first'.
Zeile: 0</p>
<p>thank you</p>
|
jquery
|
[5]
|
4,359,847
| 4,359,848
|
To access a variable in a class in Java, is it better to return its value via a method, or just acces it via myClass.variable?
|
<p>I think that the title says it all. Maybe I should ask: Is it ever bad to not use a method to return the variable, or its value? An example would be a 2-d point class with an x and a y variable.</p>
<p>Is there anything wrong with using <code>myPoint.x</code> to get the x variable of <code>myPoint</code> as opposed to <code>myPoint.xValue()</code>, which simply returns <code>mypoint.x</code>?</p>
|
java
|
[1]
|
3,019,130
| 3,019,131
|
Custom Error Page not showing
|
<p>For some reason, when I get an ASP.NET runtime error, it's not loading my custom error page</p>
<pre><code><customErrors mode="On" defaultRedirect="app_offline.htm" redirectMode="ResponseRewrite">
<error statusCode="404" redirect="app_offline.htm"/>
<error statusCode="500" redirect="app_offline.htm"/>
</customErrors>
</code></pre>
<p>That's in my web.config.</p>
<p>I'm still getting this though and it's not loading my error .htm page:</p>
<pre><code>Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
</code></pre>
|
asp.net
|
[9]
|
2,763,150
| 2,763,151
|
How do I get a sum of two numbers in C#? I can't figure out what I'm missing
|
<pre><code> //Declare three double variables. num1, num2, sum.
double num1 = 0;
double num2 = 0;
double sum = num1 + num2;
//Prompt the user to enter in the first number. Must be less than 100.
Console.Write("Please enter a number less than 100: ");
num1 = double.Parse(Console.ReadLine());
//Prompt the user to enter in the second number. Also must be less than 100.
Console.Write("Please enter a second number less than 100: ");
num2 = double.Parse(Console.ReadLine());
//Add the values of num1 and num2 together. Save the result in the variable sum.
sum = num1 + num2;
</code></pre>
|
c#
|
[0]
|
4,047,008
| 4,047,009
|
How to have accordion type of menu?
|
<p>I'm creating a folder view type of plugin and i've put my code in jsfiddle...</p>
<p><a href="http://jsfiddle.net/masnR/1/" rel="nofollow">http://jsfiddle.net/masnR/1/</a>
Basically i'm trying to have accordion type in this...</p>
<p>When i click on Folder2, folder1 should collapse and only folder2 should be visible and expanded.</p>
<p>How can i go ahead with this.. ?</p>
|
jquery
|
[5]
|
5,008,050
| 5,008,051
|
Javascript: access to an object's member by name
|
<p>I have an object called <code>themesData</code>:</p>
<pre><code>var themesData = {}
themesData.a = { key: "value" }; themesData.b = { key: "another value"};
</code></pre>
<p>...and I want to access one of the members by its name. I get a string which contains either "a" or "b" and I want to get the appropriate member's value.</p>
<p>I'd be happy to get some help on that.</p>
|
javascript
|
[3]
|
1,320,772
| 1,320,773
|
How to add a link to a particular word in a sentence?
|
<p>I have to create a link after the user enters his statement in the text box. </p>
|
jquery
|
[5]
|
1,056,742
| 1,056,743
|
How to access to Data key Row in gridview
|
<p>I have a gridview and set a DataKeyNames to ID (<code>DataKeyNames="ID"</code>).
In this GridView I crate a column to select a row by Select command.
I want to get row id by datakeyname but I can't do it.</p>
<p>Think my Gridview rows are</p>
<pre><code>1
3
4
6
9
10
15
</code></pre>
<p>Numbers are taken from the database and the gridview are used.
Please help me.
If need more details say.</p>
<p>Thanks!</p>
|
asp.net
|
[9]
|
3,284,337
| 3,284,338
|
Confused by earlier errors - Bailing out
|
<p>I am getting an unusual error when I try building or running my iphone game. </p>
<p>//GameScene.mm </p>
<pre><code>- (void) onExit
{
if(!([SimpleBox2dScrollerAppDelegate get].paused)) //error comes here
{
[SimpleBox2dScrollerAppDelegate get].paused = YES;
[super onExit];
}
}
</code></pre>
<p>// SimpleBox2dScrollerAppDelegate.mm</p>
<pre><code>+(SimpleBox2dScrollerAppDelegate *) get {
return (SimpleBox2dScrollerAppDelegate *) [[UIApplication sharedApplication] delegate];
}
</code></pre>
<p>What might be the reason?</p>
|
iphone
|
[8]
|
4,560,694
| 4,560,695
|
What's a good resource to build my first python project?
|
<p>I'm tired of books and tutorials who walk me through how to print things before I can do anything fun. I want to build simple apps or programs. Any suggestions for where to start so I can make and learn at the same time?</p>
|
python
|
[7]
|
1,248,854
| 1,248,855
|
adding html with jquery
|
<p>is there a neat way to add html with jQuery instead of </p>
<pre><code>$("#elm").html($("#elm").html() + "some text");
</code></pre>
<p>It'd be great to just do <code>$("#elm").html(+= "some text")</code> or something similar...</p>
|
jquery
|
[5]
|
4,781,968
| 4,781,969
|
breadcrumb does not display title of the nav in Php
|
<p>I recently started learning php and I'm not being able to understand why my code does not get the parent value <strong>("Clients")</strong> when I click on the sublink UX/UI.</p>
<p>$sel_subject is the Titles on the Navbar and $sel_page is the subpage titles
When I click on the Title it shows up on the breadcrumb but when I click on the subpages the Title are blank, having issue with the following code.</p>
<pre><code> **$output_sub_nav .= "<li> {$sel_subject[ 'menu_name' ]}</li>" ;**
</code></pre>
<p><strong>Navbar Image:</strong>
<img src="http://i.stack.imgur.com/3VFpT.png" alt="nav bar"></p>
<p><strong>My Code below:</strong></p>
<pre><code>function breadcrumbs ( $sel_subject ,$sel_page , $sel_rnav )
{
$output_sub_nav = "<ul class =\"breadcrumbs\">" ;
$output_sub_nav .= "<li><a href =\"index.php\">HOME</a></li>" ;
if ( ! is_null ( $sel_subject ) )
{
$output_sub_nav .= "<li> {$sel_subject[ 'menu_name' ]}</li>" ;
}
elseif ( ! is_null ( $sel_page ) )
{
**$output_sub_nav .= "<li> {$sel_subject[ 'menu_name' ]}</li>" ;**
$output_sub_nav .= "<li> {$sel_page[ 'menu_name' ]}</li>" ;
}
elseif ( ! is_null ( $sel_rnav ) )
{
$output_sub_nav .= "<li> {$sel_rnav[ 'menu_name' ]}</li>" ;
}
$output_sub_nav .= "</ul>" ;
return $output_sub_nav ;
}
</code></pre>
|
php
|
[2]
|
4,957,064
| 4,957,065
|
jquery datepicker set default date to empty string
|
<p>Is it possible to hide the initial text that the datepicker display. I do not want the user to see any text in the textbox, unless he selects the date ?</p>
|
jquery
|
[5]
|
4,325,908
| 4,325,909
|
accessing a static map from a static member function - segmentation fault - C++
|
<p>I am trying to implement factory pattern by registering the function pointers of the derived class to the factory in a static map(member of the factory)and creating objects by looking up the map. But I am getting a segmentation fault in doing this. </p>
<p>Code Snippet:</p>
<p>factory.cpp</p>
<pre><code>typedef Shape* (*Funcptr)();
std::map<int,Funcptr> Factory::funcmap;
int Factory::registerCreator(int ShapeID, Shape *(*CFuncptr)()) {
Factory::funcmap[ShapeID] = CFuncptr;
return 1;
}
Shape* Factory::CreateObject(int ShapeID) {
std::map<int,Funcptr>::iterator iter;
iter = funcmap.find(ShapeID);
if(iter != funcmap.end()){
return iter->second();
}
return NULL;
}
</code></pre>
<p>factory.h</p>
<pre><code>class Factory {
public:
Factory();
virtual ~Factory();
static int registerCreator(int, Shape *(*CFuncptr)());
Shape* CreateObject(int);
private:
static std::map<int,Funcptr> funcmap;
};
</code></pre>
<p>Square.cpp</p>
<pre><code>static Shape *SquareCreator() {
return new Square;
}
static int SquareAutoRegHook = Factory::registerCreator(1,SquareCreator);
</code></pre>
<p>On creating the object for Factory in the main file a segmentation fault occurs.
Can you please suggest if I am doing something wrong. I am using CppUTest for TDD and not sure how to debug this.</p>
|
c++
|
[6]
|
4,545,986
| 4,545,987
|
Type casting and automatic type promotion in Java
|
<p>Let's consider some simple expressions in Java.</p>
<pre><code>byte var=0;
var=(byte)(var+1);
</code></pre>
<hr>
<p>Here, in the above statement, obviously type casting is needed because of automatic type promotion. </p>
<p>The evaluation of the expression <strong>(var+1)</strong> is automatically promoted to int hence, must explicitly be cast to byte to assign the outcome of it to a byte variable on the right of the assignment which is <strong>var</strong> </p>
<hr>
<p>Now, let's consider the following statement in Java.</p>
<pre><code>var++;
</code></pre>
<p>This is somewhat equivalent to the previous statement and should have needed a cast though it works without a cast. Why?</p>
<hr>
<p>Even the following statement doesn't require a cast. Why?</p>
<pre><code>byte x=var++;
</code></pre>
|
java
|
[1]
|
993,890
| 993,891
|
Why does Java Pattern class use a factory method rather than constructor?
|
<p>There's a good discussion of this in the <a href="http://stackoverflow.com/questions/628950/constructors-vs-factory-methods">general case</a>.</p>
<p>However, I was wondering specifically why the Pattern class uses the <code>compile</code> static method to create an object, rather than the constructor?</p>
<p>Seems to me to be more intuitive to use a constructor.</p>
|
java
|
[1]
|
592,648
| 592,649
|
How to produce a unique number from combination of 2 numbers (in any order) in PHP?
|
<p>How to produce a unique number from combination of 2 numbers in PHP ? For example, combination of these two numbers; 68 and 73, produce X ( X is a unique number). It does not matter how the order of the combination numbers, it should still produce same unique number. E.g: (68,73)=X or (73,68)=X
or combination of (1,2)=Y or (2,1)=Y , Y is a different number (because it's unique) from X.</p>
<p>Let me know if you need more information.</p>
<p>I think <a href="http://stackoverflow.com/questions/4226317/generate-a-unique-value-for-a-combination-of-two-numbers">this problem</a> is similar to my problem but it is written in C#.</p>
<p>I converted this code to PHP :</p>
<pre><code>function getUnique($x, $y){
if($x>$y){
return $y | $x << 32;
} else{
return $x | $y << 32;
}
}
$list = array();
for($i=0 ; $i<100 ;$i++){
$x = rand(1,10); // I just put any random numbers from 1 to 10 so that I can read it easily.
$y = rand(1,10);
$unique = getUnique($x, $y);
$list[$i] = '('.$x.','.$y.')='.$unique;
}
//Find out the results
foreach($list as $ans){
echo $ans.'<br>';
}
</code></pre>
<p>But, it does not produce unique numbers. Example from this results:</p>
<p>(2,9)=11</p>
<p>(10,1)=11</p>
<p>(2,9) should produce different number from (10,1).</p>
|
php
|
[2]
|
4,788,808
| 4,788,809
|
Long running, polling, queueing process for Python. What's the best stuff to use?
|
<p>Feel free to close and/or redirect if this has been asked, but here's my situation:</p>
<p>I've got an application that will require doing a bunch of small units of work (polling a web service until something is done, then parsing about 1MB worth of XML and putting it in a database). I want to have a simple async queueing mechanism that'll poll for work to do in a queue, execute the units of work that need to be done, and have the flexibility to allow for spawning multiple worker processes so these units of work can be done in parallel. (Bonus if there's some kind of event framework that would also me to listen for when work is complete.)</p>
<p>I'm sure there is stuff to do this. Am I describing Twisted? I poked through the documentation, I'm just not sure exactly how my problems maps onto their framework, but I haven't spent much time with it. Should I just look at the multiprocess libraries in Python? Something else?</p>
|
python
|
[7]
|
141,567
| 141,568
|
Multithreading - StringBuffer and StringBuilder
|
<blockquote>
<p>If your text can change and will only
be accessed from a single thread, use
a StringBuilder because StringBuilder
is unsynchronized.</p>
<p>If your text can changes, and will be
accessed from multiple threads, use a
StringBuffer because StringBuffer is
synchronous.</p>
</blockquote>
<p>What does it mean by multiple threads? Can anyone explain me over this? I mean is it something two methods or two programs trying to access another method at same time.</p>
|
java
|
[1]
|
4,080,948
| 4,080,949
|
Connecting to server over WIFI reliably during bootup
|
<p>There is quite a bit of varience in how long it takes for WiFI connectivity to be established. I would like some input on what is the best way to get connectivity established. In particular I am considering how to make multiple attempts to connect to a server where one does not know ahead of time how long it will take for wifi to get established. For example is it better to make three tries spaced apart by 10 seconds. or to make on long continuous try for 30 seconds? I am trying to make this connectivity as robust as possible. Getting connected to server over wifi in a reliable best effort manner is my goal, and I would welcome any suggestions on how to make this more reliable. One environment I have is Sprint 3G and Sprint 4G/ Wireless Sierra. Another is AT&T both 3G and 4G. Thanks AM I the only one who deals with this? Really?</p>
|
android
|
[4]
|
4,216,041
| 4,216,042
|
Java random collection
|
<p>Is there a kind of Java collection that the order of my fetching is random? For example, I put integer 1, 2, 3 into the collection and when I try to print them all the result can be "1 2 3","3 2 1" or "1 3 2"?</p>
|
java
|
[1]
|
2,340,170
| 2,340,171
|
How to detect the path to the application root?
|
<p>I'm trying to dynamically detect the root directory of my page in order to direct to a specific script.</p>
<pre><code>echo ($_SERVER['DOCUMENT_ROOT']);
</code></pre>
<p>It prints /myName/folder/index.php</p>
<p>I'd like to use in a html-file to enter a certain script like this:</p>
<pre><code><a href="<?php $_SERVER['DOCUMENT_ROOT'].'lib/logout.php'?>">log out</a>
</code></pre>
<p>This seems to be in bad syntax, the path is not successfully resolved.</p>
<p>What's the proper approach to detect the path to logout.php?</p>
<p>The same question in different words:</p>
<p>How can I reliably achieve the path to the root directory (which contains my index.php) from ANY subdirectory? No matter if the html file is in /lib/subfolder or in /anotherDirectory, I want it to have a link directing to /lib/logout.php</p>
<p>On my machine it's supposed to be <a href="http://localhost/myName/folder" rel="nofollow">http://localhost/myName/folder</a> (which contains index.php and all subdirectories), on someone else's it might be <a href="http://localhost/project" rel="nofollow">http://localhost/project</a></p>
<p>How can I detect the path to application root?</p>
|
php
|
[2]
|
3,574,493
| 3,574,494
|
php add days to date in PHP
|
<p>I want to add or remove a day (or more) depending on a dynamic value. Some times i want to remove / add 4 days, and next time maybe 9. How would i be able to do this in PHP? I was hoping there was i timestamp solution so i could use number of secounds.</p>
<p>Example: 2012-04-21 + 86400 // Add one day</p>
<p>Is there any good solution for this? or is there other good methods where i can use dynamic values to remove or add any number of days i wanted.</p>
<p>Please feel free to suggest!</p>
|
php
|
[2]
|
2,604,201
| 2,604,202
|
get the publishing date of web page
|
<p>Hi in google when search I can see the publishing date of any url </p>
<p>can I do something in adnroid , I have list of urls, I want to get the publishhing date of those URL </p>
<p>any idea</p>
|
java
|
[1]
|
3,483,149
| 3,483,150
|
Python 3.3 Mysql Connector
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/384471/mysql-db-lib-for-python-3-0">MySQL-db lib for Python 3.0?</a> </p>
</blockquote>
<p>I use python3.3 and can't connect to MySQL, because I don't find module for MySQL connector.</p>
<p>How do I connect to MySQL with python3.3?</p>
|
python
|
[7]
|
5,728,771
| 5,728,772
|
Decision of Static methods vs instance methods in java?
|
<p>As per my understanding we should go for instance methods only when they are dealing with state of object i.e instance variable . If method does deal with state of object they should always be declared as class methods i.e static. But still in most of the projects
i ihave seen the methods which never not operates on instance variables they are also declared as instance methods(basically what these methods are doing they are using some of the method parametrs and doing some processing on that paremets and calling some other classes).Thats it.
<strong>Should not these methods should be declared as class method i.e static ?</strong></p>
|
java
|
[1]
|
3,106,400
| 3,106,401
|
Droid DNA Not Supported in Android Device List
|
<p>Why is my application shown as unsupported device for the new HTC Droid DNA, my manifest is This application is only available to devices with these features, as defined in your application manifest. Screen densities: NORMAL,LDPI NORMAL,XHDPI NORMAL,HDPI NORMAL,MDPI SMALL,LDPI SMALL,XHDPI SMALL,HDPI SMALL,MDPI XLARGE,LDPI XLARGE,XHDPI XLARGE,HDPI XLARGE,MDPI LARGE,LDPI LARGE,XHDPI LARGE,HDPI LARGE,MDPI LARGE,TVDPI Required device features
android.hardware.screen.portrait android.hardware.touchscreen android.hardware.wifi This application is available to over 2230 devices.</p>
|
android
|
[4]
|
2,157,708
| 2,157,709
|
Getting values from a single array
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/6126512/how-to-find-the-value-from-this-array-in-php">How to find the value from this array in php?</a> </p>
</blockquote>
<p>hello coders.I have an array like this</p>
<pre><code>Array
(
[0] => Array
(
[0] => admin/login
[1] => LoginHandler
[2] => index
)
[1] => Array
(
[0] => post
[1] => PostHandler
[2] => index
)
[2] => Array
(
[0] => post/create
[1] => postHandler
[2] => create
)
[3] => Array
(
[0] => post/update
[1] => postHandler
[2] => update
)
[4] => Array
(
[0] => post/delete
[1] => postHandler
[2] => delete
)
)
</code></pre>
<p>I want only the values like <code>admin/login, LoginHandler,index,</code>
<code>post,PostHandler,index</code>,
<code>post/create,PostHandler,create</code> and so on.So how to do that?</p>
|
php
|
[2]
|
2,350,834
| 2,350,835
|
Use Jquery to alter an item in a selectlist?
|
<p>Before: </p>
<pre><code><select id="NumberId" name="NumberId">
<option value="">ZERO</option>
<option value="4">FOUR</option>
<option value="5">FIVE</option>
</select>
</code></pre>
<p>Using JQuery, modify the value of the option with an empty value to 0 (zero).</p>
<p>After: </p>
<pre><code><select id="NumberId" name="NumberId">
<option value="0">ZERO</option>
<option value="4">FOUR</option>
<option value="5">FIVE</option>
</select>
</code></pre>
<p>How can I do that?</p>
|
jquery
|
[5]
|
2,964,254
| 2,964,255
|
Creating a simple sales calculator in Java code
|
<p>I'm trying to figure out how to write this?</p>
<p>Write a Java program that will serve as a basic sales calculator. The program should present the user with a choice of four different products of your choosing in a simple menu. After the user selects a product by entering a character corresponding to a product, the program should prompt the user for the quantity and then calculate the Subtotal, Sales Tax Amount, and Total Sale Amount. The calculations should be performed as follows:</p>
<pre><code>Subtotal = (Price * Quantity)
Sales Tax Amount = Subtotal * Sales Tax Percentage (use 6.5% for the sales tax percentage)
Total Sale Amount = Subtotal + Sales Tax Amount
</code></pre>
<p>Be sure to use variables to store temporary values. The program should output the product sold, quantity sold, and the calculated values for Subtotal, Sales Tax Amount, and Total Sale Amount. Your assignment submittal should include your java code which is properly commented, and the class file.. </p>
<p>this is what i have so far and not sure if I am on the right track?</p>
<pre><code>import java.util.scanner;
public class Sales //Defines the class
Public static void main (String args[]){
System.out.println("Welcome to Super Shopper");
System.out.println("1) Star Wars DVD");
System.out.println("2) X-box 360 ");
System.out.println("3) I-Pad 3");
System.out.println(“4) 2 liter Soda”);
System.out.println("5) Quit");
Scanner sc = new Scanner (System.in);
System.out.print("Please select item :");
int choice = keyword.nextInt();
Scanner number = new scanner (System.in);
System.out.print("Please select quantity :");
Int choice = quantity.nextInt();
String userInput;
}
}
</code></pre>
|
java
|
[1]
|
2,487,182
| 2,487,183
|
Android upgrading the existing app
|
<p>I am trying to upgrade the existing application by changing the following in the manifest file.<br>
changing From</p>
<pre><code>android:versionCode="1"
android:versionName="1.0"
</code></pre>
<p>To</p>
<pre><code>android:versionCode="2"
android:versionName="1.1" .
</code></pre>
<p>I am using the same keystore, but when I attempt to publish the app using the Google Play Developer Console, I am getting an error saying:</p>
<p><strong>"This configuration cannot be published for the following reason(s):
All devices that might receive version 1 would receive version 2.
Some devices are eligible to run multiple APKs. In such a scenario, the device will receive the APK with the higher version code."</strong></p>
<p>How can I upgrade my app. Thank you very much in advance .</p>
|
android
|
[4]
|
3,604,422
| 3,604,423
|
jQuery click target selector
|
<p>I have the following HTML in a page:</p>
<pre><code><a href="javascript:void(0)" class="move-next"><img src="/Content/images/small-next-arrow.png" height="16" width="16" alt="Next status arrow" title="Progress to next status"/></a></div>
</code></pre>
<p>and I have the following javascript that attempts to handle the click event:</p>
<pre><code>function InitProgressionSelectors() {
$(".move-next").click(function() {
moveNext(this);
});
$(".move-previous").click(function() {
movePrevious(this);
});
}
function moveNext(target) {
var sourceContainer = target.parent("td");
var targetContainer = sourceContainer.next("td");
}
</code></pre>
<p>I'm obviously missing something, because "target" in the moveNext function is returning an HTMLAnchorElement, but when I try to wrap that, or access it somehow as a jQuery object, so I can try to get a handle to it's parent container, I get errors.</p>
<p>A reference to $(target) returns null. How do I get a reference to target as a jQuery object so I can work with it in that context? What am I missing?</p>
<p>Thanks.</p>
|
jquery
|
[5]
|
2,120,884
| 2,120,885
|
Handle 8 labels on single cell in UITABLEVIEW
|
<p>I want to use different information and use different format,lines for information,when i drag down then the UITable view is not run smooth...What will i do?</p>
|
iphone
|
[8]
|
2,851,321
| 2,851,322
|
Program received signal: "EXC_BAD_ACCESS" while adding subview to main view
|
<p>i am adding two labels and two image view to subview.</p>
<p>when ever i tap on the button i add this subview to mainview.</p>
<p>I am getting images from the web server and save it in local simulator documents.</p>
<pre><code>NSMutableString *about_name_str = [[NSMutableString alloc]init];
[about_name_str appendString:[myDictionary objectForKey:@"firstname"]];
[about_name_str appendString:@" "];
[about_name_str appendString:[myDictionary objectForKey:@"lastname"]];
[about_name_label setText:about_name_str];
NSMutableString *about_addr_str = [[NSMutableString alloc]init];
[about_addr_str appendString:[myDictionary objectForKey:@"state"]];
[about_addr_str appendString:@","];
[about_addr_str appendString:[myDictionary objectForKey:@"country"]];
[about_addr_label setText:about_addr_str];
about_image.image = [UIImage imageWithContentsOfFile:imagepath];
about_logo.image = [UIImage imageWithContentsOfFile:logopath];
if ([myDictionary objectForKey:@"companyurl"]) {
[about_url_button setTitle:[myDictionary objectForKey:@"companyurl"] forState:UIControlStateNormal];
about_url_button.userInteractionEnabled = YES;
}
else {
about_url_button.userInteractionEnabled = NO;
}
[self.view addSubview:about_view];
</code></pre>
<p>this my code.</p>
<p>some times i got <code>Program received signal: "EXC_BAD_ACCESS".</code> and application quits.</p>
<p>i check by placing break points,and in debugger i did n't get where i am getting error.</p>
<p>can any one please help me,How can i resolve this.</p>
<p>Thank u in advance. </p>
|
iphone
|
[8]
|
2,815,997
| 2,815,998
|
Error 1400 Invalid window handle
|
<p>I have code:</p>
<pre><code>......
g_hWnd = CreateWindow( L"Urok6WindowClass", L"TitleWindow", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, rc.right - rc.left, rc.bottom - rc.top, NULL, NULL, hInstance,
NULL );
if( !g_hWnd )
return E_FAIL;
ShowWindow(g_hWnd, nCmdShow );
</code></pre>
<p>All works fine. But if I add:</p>
<pre><code> LPTSTR tilte_old= L"Old title";
int gettus = GetWindowText(g_hWnd, tilte_old, 100);
DWORD error = GetLastError();
WCHAR szTest[10];
swprintf_s(szTest, 10, L"%d", error);
MessageBox(NULL, szTest, L"TEST2", MB_OK);
</code></pre>
<p>MessageBox >> 1400 </p>
<p>gettus >> ''</p>
<p>Why is this happening? Why windows handle is invalid?</p>
|
c++
|
[6]
|
5,541,293
| 5,541,294
|
Reference to Function syntax - with and without &
|
<p>What's the difference between</p>
<pre><code>typedef void (&FunctionTypeR)();
</code></pre>
<p>vs</p>
<pre><code>typedef void (FunctionType)();
</code></pre>
<p>Is the second also a reference to function? Is <code>FunctionTypeR</code> equivalent to <code>FunctionType&</code> when used as the type of an argument? </p>
<p>For</p>
<pre><code>void foo(FunctionType bar)
</code></pre>
<p>Does the runtime makes a copy of the argument bar (a function) when foo is invoked?</p>
|
c++
|
[6]
|
2,888,539
| 2,888,540
|
html a click event use jquery
|
<p>hi every I writed a line like this:</p>
<pre><code><a href="#">delete</a>
</code></pre>
<p>I want do some in js function when click this,so I use jQuery, and like this</p>
<pre><code>$('a[href='#']').click(function(){
alert("test");
return false;
});
</code></pre>
<p>I use this to test, but it do best in Firefox, but can't work in IE, why? I could not find the error, could you help me thank you </p>
|
jquery
|
[5]
|
4,340,718
| 4,340,719
|
How do I pass a variable in URL using PHP?
|
<p>I have a variable called <code>$tags</code>, which just references from a database field. When the user clicks a link with the given <code>$tags</code> output in it, I want that data to be stored in a variable on the target page.</p>
<p>For instance, the user is on a <code>todolist.php</code>, that contains several tasks. They can see the parts associated with this task by clicking a link that goes to a partslist.php page. In the link, I need to contains the <code>$tags</code> data, so javascript on the <code>partslist.php</code> page knows what part to highlight. </p>
<p>So I need to know <strong>1)</strong> how do I output <code>$tags</code> in the link of todolist.php, and <strong>2)</strong> how do I receive that output and store it on a variable on the partslist.php page? </p>
<p>I have done similar POST and GET commands, but I can't quite figure this out.</p>
|
php
|
[2]
|
789,620
| 789,621
|
How to assign a string?
|
<p>I have this command for wake on the system <code>os.system('sudo sh -c "echo date \'+%s\' -d \'+ 24 hours\' > /sys/class/rtc/rtc0/wakealarm"')</code>. After executing this command i just open wakealaram file. It is empty, nothing is written.</p>
<ol>
<li>Why is it empty, shouldn't it write some date?</li>
<li>How to give a manual date to wakealaram instead of system date + 24 hours?
eg:date = "2147472000"</li>
</ol>
<p>Would <code>os.system('sudo sh -c "echo date > /sys/class/rtc/rtc0/wakealarm"')</code> work?</p>
|
python
|
[7]
|
1,219,895
| 1,219,896
|
derived class member function failed in c++
|
<p>To make long story short:</p>
<pre><code>class A {
public:
A();
~A();
void SetID(char* ID);
char* GetID();
protected:
char ID[10];
};
class B: public A {
public:
B();
~B();
protected:
...
private:
...
};
</code></pre>
<p>Then in main:</p>
<pre><code> ...
B *temp = new B;
temp->SetID("0x12345678");
...
</code></pre>
<p>Then the compiler said "Expected constructor,destructor or type conversion before -> token" where "temp->SetID("0x12345678")" lies</p>
<p>Anyone gimme some hints??</p>
<p>Whole Program as Loki suggested:</p>
<pre><code> #include <iostream>
using namespace std;
class A {
public:
A();
~A();
void SetID(char* id);
char* GetID();
protected:
char ID[10];
};
void A::SetID(char* id){
strcpy(ID,id);
}
char* A::GetID(){
return ID;
}
class B: public A {
public:
B();
~B();
protected:
int num;
};
int main(){
B *temp = new B;
B->SetID("0x12345678");
cout<<B->GetID()<<endl;
return 0;
}
</code></pre>
|
c++
|
[6]
|
3,692,611
| 3,692,612
|
How to get ASP.net (1.1) to look for the assembly.dll file in your Application Folder
|
<p>I'm running ASP.Net (vers 1.1) with code-behind that generates a assembly.dll file which it looks for in the Root/Bin folder of the WebServer. My question is .... how can I get ASP.Net to look for my assembly.dll file in the Root/ Application folder / Bin folder?
Where "Application folder" is the folder from which my application is started containing the start-up WebForm.aspx file. The reason for my request is so that all my application files, including the assembly.dll file is nicely contained in or under my "Application folder"
I hope this question makes sense and is clear and relevent
Thanks - Pierre</p>
|
asp.net
|
[9]
|
346,015
| 346,016
|
reason for using three open-close quotes when using re.verbose in python
|
<p>I'm just curious as to why most examples I've seen that make use of re.verbose when using regular expressions, use '''?</p>
<p>An example I found is shown below</p>
<pre><code>address = re.compile(
''' #THIS
[\w\d.+-]+ # username
@
([\w\d.]+\.)+ # domain name prefix
(com|org|edu) # we should support more top-level domains
''', #AND THIS
re.UNICODE | re.VERBOSE)
</code></pre>
|
python
|
[7]
|
1,674,846
| 1,674,847
|
Built in encode/decode function with support for keys, other than mcrypt
|
<p>Does php has any built-in function for encoding and decoding a string, I want it very simple, mcrypt does the job but still I dont need top of class encryption.Other than urlencode()</p>
|
php
|
[2]
|
3,802,033
| 3,802,034
|
Design Web application
|
<p>I want to build a java web application and I don't have any background how to do that.
Can you plz tell me what is the starting point to do that and where can I found useful open source codes that I can use them to design my web application.</p>
|
java
|
[1]
|
3,524,874
| 3,524,875
|
Application.EnableVisualStyles() not working
|
<p>I cann't make my application to apply Windows visual styles.
Application.EnableVisualStyles() in program.cs not changing RenderWithVisualStyle property to true.</p>
<pre><code> [STAThread]
public static void Main(string[] startArgument)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
.....
}
</code></pre>
<p>Interestingly if I'm debugging with "Enable visual studio hosting process", Application.EnableVisualStyles() works as expected, RenderWithVisualStyle goes to true and styles are applied. But no styles without hosting process either Debug or Release mode.
Changing target framework v.2 to v.3.5 makes nothing. </p>
<p>Any ideas please, I'm stuck with this issue and googling for 3 days with no success.</p>
<p>Many thanks</p>
|
c#
|
[0]
|
3,932,437
| 3,932,438
|
Jquary droppable ignore the z-index?
|
<p>My problem, the drop-function starts when i sort the list. </p>
<p><strong>js</strong></p>
<pre><code>$(document).ready(function rt()
{
$("#div1").draggable();
$("#k1").sortable({ revert: '100' });
$('#droparea').droppable({ accept: 'li', drop: function() { alert('ssss'); } });
});
</code></pre>
<p><strong>html</strong></p>
<pre><code> <div id="div1" style="z-index:5;">
<ul id="k1" style="width:350px; height:200px; background-color:#ffffff; margin:20px; padding:10px; border:1px solid #000000; ">
<li>One</li>
<li>two</li>
<li>three</li>
</ul>
</div>
<div id="droparea" style="position:absolute; top:0px; left:0px; width:100%; height:100%; background-color:#cccccc; z-index:1;"></div>
</code></pre>
<p>working example
<a href="http://www.jsfiddle.net/V9Euk/130/" rel="nofollow">http://www.jsfiddle.net/V9Euk/130/</a></p>
<p>Tabks in advance.
Peter</p>
|
jquery
|
[5]
|
3,285,411
| 3,285,412
|
If you grow a div and shrink a div in the same column of divs simultaneously, how can you keep the vertical position stable?
|
<p>Say I have a column of DIV siblings. A click on DIV 3 causes DIV 1 to "unexpand" and DIV 3 to expand (grow longer). This is usually okay if DIV 1 and DIV 3 are about the same height when expanded and unexpanded. But if DIV 1 and DIV 3 are very different heights, then the the browser viewport shifts the mouse pointer away from DIV 3, which the user just clicked on. </p>
<p>I'm not sure if I'm explaining this clearly, but I think Google reader gets around this problem somehow when you expand a feed item and then expand another one that's below that one.</p>
<p>The question, again, is how do you keep the mouse pointer in the same position relative to the div that it just clicked on when the divs around it change in size?</p>
<p>I'm using jQuery.</p>
|
jquery
|
[5]
|
3,603,900
| 3,603,901
|
Where to download a vector file of Google's green android robot?
|
<p>Does anyone know where to download a vector file of Google's green android robot?</p>
<p>The <a href="http://www.android.com/branding.html" rel="nofollow">Android Brand Guidelines page</a> does not have a link to it!</p>
<p>Thankyou, Mel</p>
|
android
|
[4]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.