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 |
---|---|---|---|---|---|
291,878 | 291,879 | Question with setting variables in if statements | <p>Here is the sample:</p>
<pre><code>if(($test = array('key'=>true)) && $test['key']){
// works
}
if($test = array('key'=>true) && $test['key']){
// does not work
}
</code></pre>
<p>Why is the parenthesis required? My understanding is that it computes the first conditional then the second no matter what.</p>
<p>And is it "safe" to do an assignment like this? </p>
| php | [2] |
3,881,604 | 3,881,605 | ASP.NET page maintain State after postback with EnableViewState = false | <p>In ASP.NET webpage, I have set the EnableViewState to false to the page and all the controls of the page. Still I am getting the PostBack data in the Controls. </p>
<p>Is there any way to remove this?
How do we remove the page life cycle event like restore PostBackData?
Actually _ViewState is maintained for all controls. I am not clarified from MSDN as well.</p>
| asp.net | [9] |
4,102,726 | 4,102,727 | javascript event | <p>I have an interesting question, i hope..I have a textarea in my form..when a user comes to enter values in it it displays some cached values in an autocomplete format..thats fine..I want to call an ajax function after the user selects such a cached value in it..so that the ajax call should pass this selected value..so my question is on which can i get the final selected value, so i call ajax at that time,... i tried with onblur etc, but not worked..</p>
<p>help please..
thanks in advance...</p>
| javascript | [3] |
165,816 | 165,817 | Ics features on the previous android versions | <p>I'm a Junior Android developer.
I have got a new project that have an ICS design with features like theese:</p>
<p><img src="http://i.stack.imgur.com/YEHzr.jpg" alt="enter image description here"></p>
<p><img src="http://i.stack.imgur.com/uj8nT.jpg" alt="enter image description here"></p>
<p><img src="http://i.stack.imgur.com/ierTt.jpg" alt="enter image description here"></p>
<p><img src="http://i.stack.imgur.com/ZItE9.jpg" alt="enter image description here"></p>
<p><img src="http://i.stack.imgur.com/eE4LQ.jpg" alt="enter image description here"></p>
<p><img src="http://i.stack.imgur.com/oMLfV.jpg" alt="enter image description here"></p>
<p>But it must work on the android devices since API 7
What is best way to do it?
Thank's</p>
| android | [4] |
4,305,894 | 4,305,895 | JQuery - How to fix mouseover and mouseleave auto loop a lot of times? | <p>When I faster to mouseover and leave #go in a short time, it will auto loop a lot of times.
How to fix it??</p>
<pre><code>$("#go").mouseover(function(){
$("#block").animate({ width: "900px" }, 300 );
});
$("#go").mouseleave(function(){
$("#block").animate({ width: "0px" }, 300 );
});
</code></pre>
| jquery | [5] |
5,263,614 | 5,263,615 | php can make desktop application or only make webbase application? | <p>Hello everybody
Can anybody tell me in php desktop application possible?
like a software we install in our system or run is it possible?
Thanks</p>
| php | [2] |
4,902,604 | 4,902,605 | Command Line Speech Recognition event handler issue | <p>I have this command line software that listens for speech recognition for couple of words.</p>
<p>In the main function I have this event handler:</p>
<pre><code>speechRecognitionEngine.SpeechRecognized +=
new EventHandler<SpeechRecognizedEventArgs>(engine_SpeechRecognized);
</code></pre>
<p>and the function:</p>
<pre><code>public static void engine_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
Console.WriteLine("\r" + getKnownTextOrExecute(e.Result.Text));
}
</code></pre>
<p>What can I do in the main function to keep the command line open and printing the words from the event handler ?</p>
<p>Thanks.</p>
| c# | [0] |
5,071,615 | 5,071,616 | How to set tab in the bottom of the display in android? | <p>I want to set one tab in the center bottom of the display.</p>
| android | [4] |
5,965,456 | 5,965,457 | Using object's method as callback function for $.post | <pre><code>$.Comment = function() {
this.alertme = "Alert!";
}
$.Comment.prototype.send = function() {
var self = this;
$.post(
self.url,
{
'somedata' : self.somedata
},
function(data, self) {
self.callback(data);
}
);
}
$.Comment.prototype.callback = function(data) {
alert(this.alertme);
}
</code></pre>
<p>When I'm calling $.Comment.send() debugger is saying to me that <code>self.callback(data) is not a function</code></p>
<p>What am I doing wrong?</p>
<p>Thank you</p>
| jquery | [5] |
394,626 | 394,627 | What's the correct way to save state of an Activity | <p>I have an Activity, which contains a bunch of check boxes and a submit button.</p>
<p>When the submit button is clicked, the activity will exit (finish() will be called). Before the activity exits, I want to save the states of the check boxes in the activity, so when the activity starts again, the check boxes can stay in their previous states. What's the correct way to save these states? Should I use SharedPreference.</p>
<p>Thanks.</p>
| android | [4] |
2,765,458 | 2,765,459 | array of strings as property in C# | <p>Consider the code below,</p>
<pre><code>private void Convert_Click(Object sender, RoutedEventArgs e)
{
string[] strCmdLineParams = { "str1", "str2", "str3" };
FormatterUI format = new FormatterUI();
format.CmdLineParams = strCmdLineParams;
format.ExecuteRequest();
}
public class FormatterUI
{
string[] args;
public string CmdLineParams
{
set
{
args=value;
}
}
public void ExecuteRequest()
{
//something
}
}
</code></pre>
<p>I want to pass the strings present in <strong>strCmdLineParams</strong> to <strong>ExecuteRequest</strong> method as <em>property</em>. But the above code is an error. How can I do this? Please help.</p>
| c# | [0] |
809,209 | 809,210 | Embedding Inline image in email body | <p>In my application i have to send image in body not as an attachment. I have spent more than one week and found no success. I have implemented same via Java mail API. But need to implement with intent. What i have tried is:</p>
<pre><code>Spanned emailText11 = Html.fromHtml("<body><p><img src=\"http://www.datarecoverydownloadwebsite.com/drdwebsite/image/pen-drive1.jpg\" alt=\"Smiley face\" align=\"bottom\" width=\"32\" height=\"32\" /></p></body>", new Html.ImageGetter() {
@Override
public Drawable getDrawable(String source) {
Drawable drawFromPath;
int path = Inline_Image_Gmail.this.getResources().getIdentifier(source, "drawable", "com.package...");
drawFromPath = (Drawable) Inline_Image_Gmail.this.getResources().getDrawable(path);
drawFromPath.setBounds(0, 0, drawFromPath.getIntrinsicWidth(), drawFromPath.getIntrinsicHeight());
return drawFromPath;
}
}, null);
</code></pre>
<p>emailIntent.putExtra(Intent.EXTRA_STREAM,emailText11 );</p>
<p>I googled alot and ans is it is not possible. If not can anyone clear me the reason for this.</p>
<p>Thanks.</p>
| android | [4] |
1,760,378 | 1,760,379 | How to save a python script directly from python shell? | <p>Currently, I am working on python interactive shell version 6. When i start python shell, i use to code some line. but i don't know how to store what i code. So, is there any command or or keyword to save my session on python shell as like .py </p>
| python | [7] |
377,592 | 377,593 | Php don't print if line begins with | <p>I have the below code which prints out lines of text as long as the lines aren't empty:</p>
<pre><code>$textChunk = wordwrap($value, 35, "\n");
foreach(explode("\n", $textChunk) as $textLine)
{
if ($textLine!=='')
{
$page->drawText(strip_tags(ltrim($textLine)), 75, $line, 'UTF-8');
$line -=14;
}
}
</code></pre>
<p>I would like to edit it so that it also doesn't print the line if it begins with 'T:'</p>
<p>Any ideas?</p>
| php | [2] |
5,343,362 | 5,343,363 | Is there default properties file to put configurations into? | <p>Any default properties file which java can automatcially load?</p>
| java | [1] |
139,291 | 139,292 | How is Set.toString() implemented? | <p>The <code>toString</code> method is not overridden in <code>Set</code> or its hierarchy, so how are the elements printed?</p>
<pre><code>import java.lang.Math;
import java.util.HashSet;
class Hello{
public String name= "";
Hello(String name){
this.name = name;
}
public static void main(String args[]){
Hello h1 = new Hello("first");
Hello h2 = new Hello("second");
Hello h3 = new Hello("third");
Hello h4 = new Hello("fourth");
Hello h5 = new Hello("fourth");
HashSet hs = new HashSet();
hs.add(h1);
hs.add(h2);
hs.add(h3);
hs.add(h4);
hs.add(h5);
//hs.add(h5);
//hs.add(null);
System.out.println("elements in hashset"+hs);
// System.out.println("elements in hashset"+hs.contains());
//System.out.println("elements in hashset"+hs.contains(new Hello("who")));
}
public boolean equals(Object obj){
System.out.println("In Equals");
System.out.println(name+"=====equals======"+((Hello)obj).name);
if(name.equals(((Hello)obj).name))
return true;
else
return false;
}
public int hashCode(){
System.out.println("----In Hashcode----"+name);
return name.hashCode();
}
}
</code></pre>
<p>Output :----In Hashcode----first
----In Hashcode----second
----In Hashcode----third
----In Hashcode----fourth
----In Hashcode----fourth
In Equals
fourth=====equals======fourth
----In Hashcode----fourth
----In Hashcode----second
----In Hashcode----third
----In Hashcode----first
elements in hashset[Hello@b4616a1a, Hello@c9
]</p>
<p>Also When I print hashset the hashcode method is called for each of the elements ?Does it mean the iterator calls this method ?</p>
| java | [1] |
1,116,212 | 1,116,213 | converting double/floating to integer in C# | <p>My question might looks like silly, but i struck with it.
I have a string value "155.300" and i want to convert it to integer.
I tryed but throwing System.FormatException....pls someone help me out. </p>
| c# | [0] |
1,794,016 | 1,794,017 | Google Autocomplete service for places (cities, countries, not establishment such as business) | <p>I need to offer in my application the ability to predict (auto suggest) places, as user typing. I know that Google have such service. The issue is, Google Autocomplete service predict places (business) while I need to autocomplete, places, such as cities, countries (not establishment such as business). Does Google or others offer this service?</p>
<p>thanks,,</p>
| android | [4] |
1,110,036 | 1,110,037 | How to use AsyncTask manager with this code? | <p>I have this code and i would like to use asyncTask manager with this to let the user know something is happening. How would i allow this to happen with this snippet of code. i cant seem to figure it out. I know the asyncTask will be better than using a Hanlder. Or would it?
But anyway here is an example. if anyone can help out. Please do. Thanks.</p>
<pre><code> enter.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
item = book.getText().toString();
searchForItem();
}
});
</code></pre>
<p>i would like to run this method with a progress dialog spinner letting the user know something is happening. How do i do this, and stop the spinner when the web page is loaded?</p>
<p>Here is my SearchForItem().</p>
<pre><code> public void searchForBook(){
String url = "www.example.com";
browser = (WebView)findViewById(R.id.shopView);
browser.setWebViewClient(new BookLookupbrowser());
browser.getSettings().setJavaScriptEnabled(true);
browser.loadUrl(url);
</code></pre>
| android | [4] |
1,957,459 | 1,957,460 | String Concatentation | <p>I have the following code and the return is confusing me. I am new to java and not exactly sure why it is returning the way it is. Any help would be great.</p>
<p>When the data has <code>PE846</code> and <code>A846</code> it returns <code>engine</code>, <code>ambo</code> and <code>engineambo</code>. I'm looking to return only <code>engineambo</code>.</p>
<pre><code> String soundString = "";
if (data.contains("PE846")) {
soundString += "engine";
betaString = "Engine : ";
sign = engine;
}
if (data.contains("A846")) {
soundString += "ambo";
betaString += "Ambo : ";
sign = ambo;
}
if (data.contains("MD846")) {
soundString += "medic";
betaString += "Medic";
sign = medic;
}
log.info(betaString + " Alerted");
{
new AudioPlayer("sounds/" + soundString + ".wav").start();
log.info(soundString);
}
</code></pre>
| java | [1] |
389,409 | 389,410 | jQuery function has to repeat to work | <p>I'm just getting into jQuery and notice strange behavior in the way some of my code is executed. When I execute a function based on a click action, the function runs twice, the first time with an "undefined" value for the click and the second with the expected value. The end result is the code "works" but I want to understand what I'm doing wrong that is causing this unexpected behavior.</p>
<p>Here's my jQuery code:</p>
<pre><code>$(function() {
//$('#venue').buttonset().click(function(event, ui) {
//$( '#venue' ).buttonset().live('click', function (event, ui) {
$('#venue').buttonset().unbind('click').bind('click', function(event, ui) {
var venueName = $("input[name='venue']:checked").val();
if (venueName == "venue2") {
alert("About to deselect, venue: " + venueName);
$("#meallist option[value='Dinner']").removeAttr("selected");
} else {
alert("Doing nothing, venue: " + venueName);
}
});
});
</code></pre>
<p>Note the three different ways of expressing the click action at the top, derived from jQuery docs and previous answers on this site. All have the same outcome. You can try it here:</p>
<p><a href="http://jsfiddle.net/Qaxx3/6/" rel="nofollow">http://jsfiddle.net/Qaxx3/6/</a></p>
<p>Thanks for any insight. I'm hoping it's a simple newbie mistake.</p>
| jquery | [5] |
5,798,275 | 5,798,276 | problem with printf() function | <p>i have the variable $a = 5; i want to show it in binary form, with length, equal 8, with writing * at white spaces, just like this, like this * * * * *101</p>
<hr>
<p>here the script</p>
<pre><code>$number = 5;
printf("%*8b", $number);
</code></pre>
<p>it doesn't work with *, but if "0"-s it works</p>
<pre><code> printf("%08b", $number);
//returns 00000101
</code></pre>
<p>why it doesn't work with *?</p>
<h2>EDIT:</h2>
<p>and how can i apply the floating option too? like </p>
<pre><code>`printf("%.4f", $number);`
//it returns 5.0000, but i want to return *****101.0000
</code></pre>
| php | [2] |
2,357,840 | 2,357,841 | Converting 'const char [6]' to 'WCHAR** | <p>I am new to C++, can someone please help me solve this error:
cannot convert <code>'const char [6]'</code> to <code>'WCHAR** {aka wchar_t**}'</code></p>
<p>My code is as follows:</p>
<pre><code>const char name[] = "madz";
void method1(LPCWSTR lpServer, LPWSTR* lpNameBuffer,
PNETSETUP_JOIN_STATUS BufferType)
{
lpNameBuffer = name;
return NERR_Success;
}
</code></pre>
| c++ | [6] |
4,426,015 | 4,426,016 | Which is more efficient in Python: standard imports or contextual imports? | <p>I apologize in advance if this question seems remedial.</p>
<p>Which would be considered more efficient in Python:</p>
<p><strong>Standard import</strong></p>
<pre><code>import logging
try:
...some code...
exception Exception, e:
logging.error(e)
</code></pre>
<p>...or...</p>
<p><strong>Contextual import</strong></p>
<pre><code>try:
...some code...
exception Exception, e:
import logging
logging.error(e)
</code></pre>
| python | [7] |
4,923,032 | 4,923,033 | name = "this or that" in jQuery? | <p>I have this code:</p>
<pre><code>$("input[name=foo]:checked,input[name=bar]:checked")
</code></pre>
<p>but I would like to make it smaller with something like:</p>
<pre><code>$("input[name=foo|bar]:checked")
</code></pre>
<p>Is there anything like that?</p>
| jquery | [5] |
3,927,175 | 3,927,176 | Hide element if mouse is not over it for a certain period of time | <p>I have a dropdown menu which gets fired when mouse moves over a specific link. I want that dropdown menu to fade out if the mouse is away from the dropdown for a specific period of time?</p>
<p>Is it possible?</p>
<p>This is my jQuery for opening the dropdown menu:</p>
<pre><code>$('.cartpopup').css({'display':'none'});
$('.cart-link').bind('mouseenter',function(){
$('.cartpopup').stop(true, true).show().animate({top: 100}, 200).animate({top: 44}, 500);
});
</code></pre>
<p>Now how can I make the popup close automatically if it is inactive e.g. mouse not over it for certain time.</p>
| jquery | [5] |
2,271,452 | 2,271,453 | android adb won't start | <p>I can't get the adb to run. From the dos line when I type adb I get "error: write failure during connection. I'm running Motodev's eclipse (probably Ganymede or Galileo) on windows XP. I've reinstalled eclipse and android three times from an administrator's account, and I've removed all virus software from the computer.</p>
<p>The complete error dump is:</p>
<p>_adb_connect: host:version
socket_loopback_client: port 5037 type tcp => fd 100
writex: 100 0022BB57 4: 30303063 000c
_socket_set_errno: unhandled value 10022
writex 100 -1 Invalid argument
adb_close: 100(lo-client:5037)
error: write failure during connection</p>
<p>any ideas as to what's stopping adp?</p>
| android | [4] |
4,628,215 | 4,628,216 | Personal preference on online data | <p>Thanks in advance to all. I have a pretty good grip on basic android, and I want to start incorporating databases and online storage in my app. I want to host a simple online file/server/database (not to sure the terms) with six movie titles each with a title, image, and show times. I am not looking for code as much as maybe some articles or topics you think I should read up on. Thanks again.</p>
| android | [4] |
3,905,215 | 3,905,216 | What does !!~ do? | <p>I was reading <a href="http://robertpitt.me/2012/09/5-tips-for-nodejs-in-production-mode/">this blog post</a> which mentioned using:</p>
<pre><code>!!~
</code></pre>
<p>I have no idea what this does? at first I thought it would give an error, but the code below does run:</p>
<pre><code>var _sessions = [
"_SID_1",
"_SID_2",
"_SID_3",
"_SID_4"
];
if(!!~_sessions.indexOf("_SID_5")) {
console.log('found');
} else {
console.log('!found');
}
</code></pre>
<p>output:</p>
<pre><code>node test.js
!found
</code></pre>
| javascript | [3] |
661,388 | 661,389 | How to add a column to a two dimensional array | <p>I have data in a two dimensional array with n rows and p columns.</p>
<p>For example:</p>
<pre><code>vector<vector<int> > dynamicArray(ROWS, vector<int>(COLUMNS));
for(int i = 0;i < dynamicArray.size();++i){
for(int j = 0;j < dynamicArray[i].size();++j){
dynamicArray[i][j] = i*j;
}
}
</code></pre>
<p>Now, I want to add several columns to this array. I tried the following (Add a column of all 10s to the array), but if failed:</p>
<pre><code>for(int i=0; i < dynamicArray.size(); i++){
dynamicArray[i].push_back(10);
}
</code></pre>
<p>Is there a way to do this?</p>
<p>Thanks!</p>
| c++ | [6] |
5,489,441 | 5,489,442 | Calling a method asynchronously | <p>I have a method named <code>X()</code>. I need to call that method asynchronously. Can anyone give sample code for this?</p>
| c# | [0] |
5,307,479 | 5,307,480 | is_int and GET or POST | <p>Why does <code>is_int</code> always return false in the following situation?</p>
<pre><code>echo $_GET['id']; //3
if(is_int($_GET['id']))
echo 'int'; //not executed
</code></pre>
| php | [2] |
3,777,041 | 3,777,042 | Function not being called | <p>I'm trying to test some jQuery in <a href="http://jsfiddle.net/adrianjsfiddlenetuser/WhKqZ/" rel="nofollow">this fiddle</a>:</p>
<pre><code><div id="myDiv"></div>
<input name="Button3" type="button" value="Invoke" onclick="get()">
</code></pre>
<pre class="lang-js prettyprint-override"><code>function get() {
var data = {};
data.foo = "bar";
data.stuff = {
nifty: "stuff"
};
$("#myDiv").text(JSON.stringify(data));
}
</code></pre>
<p>The <code>get()</code> function is not being called when I press 'Invoke'. What should occur is the <code>div</code> content should get updated.</p>
| jquery | [5] |
289,424 | 289,425 | Application time setting | <p>I am creating a web application.. When a user want to register with that application Local time of that user must be registered in this application.. I tried to get the browser time to register ..It is working ..Now i want to improve this.. The user can have incorrect time in his system... SO i need a solution to solve this problem.. Any suggestion.. Pls share with me..</p>
| asp.net | [9] |
4,654,018 | 4,654,019 | jQuery IE7 / IE8: Prevent change event triggering on Enter | <p>Here is sample code:</p>
<p><a href="http://jsfiddle.net/BSjGX/1/" rel="nofollow">http://jsfiddle.net/BSjGX/1/</a></p>
<pre><code><input id="testing" />
$('#testing')
.keydown(function(e){
if(e.keyCode==13) {return false;}
})
.change(function(){
$('body').append('<br />changed');
});
</code></pre>
<p>How do you ppl doing it in IE7 / IE8 etc?</p>
<p>Thanks ;)</p>
| jquery | [5] |
1,357,355 | 1,357,356 | Get the value of id from spans inside a div using jquery | <p>I want to get the id value from the spans.</p>
<p>Thanks
Jean</p>
| jquery | [5] |
6,016,309 | 6,016,310 | How to check if an object is defined? | <p>I would like to check if an object is defined or exists using C#.</p>
<p>Something like this:</p>
<pre><code>if (defined(Object)){
}
</code></pre>
| c# | [0] |
3,917,393 | 3,917,394 | I need an Arabic keyboard on iPhone without installing anything? | <p>There are already inbuilt fonts for Arabic</p>
<p>I need to use Arabic keyboard - without installing any software.</p>
<p>I don't want internal - keyboard.</p>
<p>That is => if I change my setting to iPhone =>keyboard arab & english on.</p>
<p>In textField I will have option to switch on both language.</p>
<p>What I require is => my own keyboard for my application.</p>
<p>That is. If I tap on textField (for english input) internal english keyboard should be pop up.</p>
<p>And if I tap on other textField (for arabic input) my keyboard (or any other option suggested by you) should be pop up.</p>
| iphone | [8] |
5,290,587 | 5,290,588 | php error log, how to remove the duplicates/find unique errors | <p>Is there a way to search the error log for only unique errors. Reason being I have a lot of duplicate errors and don't want to miss the rare ones. </p>
<p>How would I go about writing a custom script which parses the error log, and filters out all of the duplicates excluding the datetime.</p>
| php | [2] |
1,942,831 | 1,942,832 | Python: How do i split the file? | <p>I have this txt file which is ls -R of etc directory in a linux system. Example file: </p>
<pre><code>etc:
ArchiveSEL
xinetd.d
etc/cmm:
CMM_5085.bin
cmm_sel
storage.cfg
etc/crontabs:
root
etc/pam.d:
ftp
rsh
etc/rc.d:
eth.set.sh
rc.sysinit
etc/rc.d/init.d:
cmm
functions
userScripts
etc/security:
access.conf
console.apps
time.conf
etc/security/console.apps:
kbdrate
etc/ssh:
ssh_host_dsa_key
sshd_config
etc/var:
setUser
snmpd.conf
etc/xinetd.d:
irsh
wu-ftpd
</code></pre>
<p>I would like to split it by subdirectories into several files. example files would be like this: etc.txt, etcCmm.txt, etcCrontabs.txt, etcPamd.txt, ...<br>
Can someone give me a python code that can do that?
Notice that the subdirectory lines end with ':', but i'm just not smart enough to write the code. some examples would be appreciated.
thank you :)</p>
| python | [7] |
66,090 | 66,091 | How can i call NStimer form one viewcontroller from unother viewcontroller? | <p>At first time i call the timer like this in Third viewcontroller</p>
<pre><code>timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(targetMethod) userInfo:nil repeats:NO];
</code></pre>
<p>Then timer called the targetMethod</p>
<pre><code>-(void)targetMethod
{
First * sVC = [[First alloc] initWithNibName:@"First" bundle:[NSBundle mainBundle]];
[self presentModalViewController:sVC animated:YES];
[sVC release];
[timer invalidate];
}
</code></pre>
<p>First viewcontroller opened..
In First viewcontroller had one button.In button action
i wrote </p>
<pre><code>- (IBAction) Action:(id)sender
{
[self dismissModalViewControllerAnimated:YES];
Third *BVC=[[Third alloc]init];
[Bvc TimerStart]; //Timestart is function i start timer in this function..
//i want to call Third viewcontroller timer function this place
}
</code></pre>
<p>timer started..But view didn't open (first )viewcontroller.......</p>
<p>Please help me......</p>
| iphone | [8] |
1,092,143 | 1,092,144 | Add a leading zero until the number 10 | <p>I have a list of numbers up to the number 10:
1,2,3,4,5,6,7,8,9,10</p>
<p>I need to put a zero in front of each number except the number 10. </p>
<p>So it looks like this:
01,02,03,04,05,06,07,08,09,10</p>
<p>HTML looks like this:</p>
<pre><code><p class="number weight-400">1</p>
<p class="number weight-400">2</p>
<p class="number weight-400">3</p>
<p class="number weight-400">4</p>
<p class="number weight-400">5</p>
<p class="number weight-400">6</p>
<p class="number weight-400">7</p>
<p class="number weight-400">8</p>
<p class="number weight-400">9</p>
<p class="number weight-400">10</p>
</code></pre>
<p>I have jquery to grab them all but I need to figure out how to add a zero to only the first 9 and not the 10th one:</p>
<pre><code>$("p.number").each(function(i, index){
if (index < 10){
}
});
</code></pre>
<p>but my each function grabs all the <code><p></code> and not the integer inside the p tag.</p>
| jquery | [5] |
181,108 | 181,109 | Getting the value of an item from a SelectListItem List? | <p>I have the following class:</p>
<pre><code>public static IEnumerable<SelectListItem> GetDatastore()
{
return new[]
{
new SelectListItem { Value = "DEV", Text = "Development" },
new SelectListItem { Value = "DC1", Text = "Production" },
};
}
</code></pre>
<p>What I need is to execute a function to return the Datastore name. Something like</p>
<pre><code>var abc = getDatastoreName("DEV").
</code></pre>
<p>Do I need to do this with LINQ or is there some easy way? How could I code this function?</p>
| c# | [0] |
1,123,071 | 1,123,072 | A easier or better way of doing this? | <p>I'm currenty working on a website (which consists of cms with a forum), and I'm wanting to give each user points for doing specific tasks (++ everytime), which should eventually give them a rank.</p>
<p>E.g. if the user did a post they'd get 5 points, if the user submitted a thread/topic they'd get 20 points and so on and the ranks would be like if the points are over M and lower then MX they'd be the R rank and so on.</p>
<p>M = The minimum points needed to gain the rank.</p>
<p>MX = The maximum points needed to gain the rank. </p>
<p>R = The Rank (e.g. Beginner, Master etc).</p>
<p>Hope all is clear, its a bit like the traditional forum points system where your given points for posts - which would give them a Display Title/Rank.</p>
<p>I'm currently storing the points within a MySQL DB, and assigning a Rank via PHP with if statements like so:</p>
<pre><code>if ($points > 0 && < 100) {
$rank = 'Beginner';
}
</code></pre>
<p>Is their some sort of class, library, function, formula, method; you can suggest which could make this easier, or a better way you can think of?</p>
<p>Cheers!</p>
| php | [2] |
2,086,922 | 2,086,923 | Shortest Program in c++ | <p>I came across this code recently that compiles, but runs with segmentation fault(g++).
Here's the original link from topcoder
<a href="http://www.topcoder.com/tc?module=MemberProfile&cr=22689214&tab=alg" rel="nofollow">topcoder profile</a></p>
<pre><code>#include <iostream>
int main = ( std::cout << "Hello world!\n", 42 );
</code></pre>
<p>This also compiles</p>
<pre><code>int main=0;
</code></pre>
<p>Can someone explain what's happening in this program. Using g++</p>
| c++ | [6] |
2,141,157 | 2,141,158 | What is wrong with my attempt to do a string replace operation in Python? | <p>What am I doing wrong here?</p>
<pre><code>import re
x = "The sky is red"
r = re.compile ("red")
y = r.sub(x, "blue")
print x # Prints "The sky is red"
print y # Prints "blue"
</code></pre>
<p>How do i get it to print "The sky is blue"?</p>
| python | [7] |
2,268,948 | 2,268,949 | Use of => in PHP | <p>What does this mean in PHP and when is the time to use it?</p>
<pre><code> =>
</code></pre>
<p>Another example.</p>
<pre><code> foreach ($parent as $task_id => $todo)
</code></pre>
| php | [2] |
5,357,145 | 5,357,146 | C# Converting ListBox to String then Aggregate | <p>I have a listbox being populated from a combo box. What i need to do is string all the contents of the listbox together and then Aggregate it.</p>
<pre><code>string cols = listbox1.items.Aggregate((f, s) => f.value + "," + s.value);
</code></pre>
<p>doesnt work.</p>
| c# | [0] |
2,982,924 | 2,982,925 | Detect the specific element and scroll to vertically down | <p>I have an item page and each item has an "image link", hovering mouse over image link a tool tip is shown describing the item. My page is scrollable that indicates good amount of items are viewed. My problem is when I am at the bottom of the page, and put mouse over the "image Link" the tool-tip is not fully shown [half is covered by the window]. So What I want is as soon as I am on the image link and if I see the tool-tip will not be fully shown, I will scroll down the page by the amount of width pixel of the tool-tip. I tried this, but this happens for all image link, but I need for the last image-link in the page visibile area. [I need javascript help]</p>
<pre><code> var totalHeight, currentScroll, visibleHeight
currentScroll = GetScrollTop();
totalHeight = document.body.offsetHeight;
visibleHeight = document.documentElement.clientHeight;
if (e.pageY <= currentScroll + visibleHeight) { //This is always true
window.scrollTo(0, currentScroll + 100);
}
</code></pre>
<p>Thanks in advance.</p>
| javascript | [3] |
4,327,724 | 4,327,725 | Special Characters Validation | <p>I have a JQuery code like this:</p>
<pre><code>// Validation to avoid non alphanumeric characters from being typed
function alphanumeric(eventSource) {
var numaric = eventSource.val();
for (var j = 0; j < numaric.length; j++) {
var alphaa = numaric.charAt(j);
var hh = alphaa.charCodeAt(0);
// If the value contains non alphanumeric characters
if (!((hh > 47 && hh < 58) || (hh > 64 && hh < 91) || (hh > 96 && hh < 123))) {
eventSource.val(numaric.substring(0, j) + numaric.substring(j + 1, numaric.length));
}
}
}
</code></pre>
<p>I am trying to validate the special characters of a text box input.
But somehow, it also validates the space (space bar on keyboard), which the char code is 32.
Advice please, thanks.</p>
| jquery | [5] |
4,216,594 | 4,216,595 | context menu in asp.net | <p>HOw can i create a contextmenu for asp.net application.i want to display the contextmenu when i right click on a listbox.Please help me.</p>
| asp.net | [9] |
1,928,268 | 1,928,269 | code for desing and implement an registration form in asp.net | <p>i need the code for desing and implement the registeration form </p>
| asp.net | [9] |
3,405,931 | 3,405,932 | Python wildcard search in string | <p>Lets say that I have a list </p>
<pre><code>list = ['this','is','just','a','test']
</code></pre>
<p>how can I have a user do a wildcard search?</p>
<p>Search Word: 'th_s'</p>
<p>Would return 'this'</p>
| python | [7] |
4,039,516 | 4,039,517 | How do I send an array using jQuery and the .ajax method without escaping the brackets? | <p>I am trying to send the same parameter name with multiple destinations, but even after reading the posts on SO can't figure out how to do it...i want to have multiple destination_input:</p>
<pre><code>var myObject = {
search_zip: params.search_zip,
search_distance: params.search_distance,
filter_opts: params.filter_opts,
page: params.page,
destination_input: ['323 w concord pl #8, chicago, il','11 e hubbard, chicago, il']
};
</code></pre>
<p>but this outputs a queryString of :</p>
<pre><code>search_zip=60614&search_distance=1&filter_opts=discount_check%2Cneed_device_check%2Cauto_track_check&destination_input%5B%5D=323+w+concord+pl+%238%2C+chicago%2C+il&destination_input%5B%5D=11+e+hubbard%2C+chicago%2C+il
</code></pre>
<p>but i keeps adding: %5B%5D to the destination_input like '&destination_input%5B%5D=11+e+hubbard%2C+chicago%2C+il'</p>
<p>So on the backend everything gets messed up. Any idea?</p>
| jquery | [5] |
2,617,739 | 2,617,740 | How to find all img tags on a string? | <p>I want to find all img tags in a string of text and put a surrounding link - a tag around it.
What's the best way to do it? And I want to retrieve the src link and put in the href attribute. </p>
<p>By the way I'm doing it in C# but the way should be similar in every language. Has anybody done such filtering and replacing? Any advice would be appreciated. </p>
| c# | [0] |
1,542,218 | 1,542,219 | How do I install Python packages on Windows? | <p>I'm having a hard time setting up python packages. EasyInstall from <a href="http://pypi.python.org/pypi/setuptools">SetupTools</a> is supposed to help that, but they don't have an executable for Python 2.6.</p>
<p>For instance to install Mechanize, I'm just supposed to put the Mechanize folder in C:\Python24\Lib\site-packages according to INSTALL.txt, but runnning the tests does not work. Can someone help shed some light on this? Thanks!</p>
| python | [7] |
4,346,286 | 4,346,287 | ValueError in Python | <pre><code>Traceback (most recent call last):
File "filter_import.py", line 77, in <module>
get(sys.argv[1])
File "filter_import.py", line 35, in get
timestamp, ip, hash_value = lines.split()
ValueError: need more than 2 values to unpack
</code></pre>
<p>I got this error message when I run my code filter_import, can anyone explain a bit what the problem is?</p>
<p>Part of my code: </p>
<pre><code>if __name__ == '__main__':
import sys
if len(sys.argv) == 1:
print 'Usage: filter_import.py <filename>'
sys.exit(1)
get(sys.argv[1])
</code></pre>
| python | [7] |
5,114,066 | 5,114,067 | Storing 'struct' data to binary file | <p>I need to store a binary file with a 12 byte header composed of 4 fields. They are namely: sSamples (4-bytes integer), sSampPeriod (4-bytes integer), sSampSize (2-bytes integer), and finally sParmKind (2-bytes integer).
I'm using 'struct' to my variables to the desired fields. Now that I have them defined separately, how could I merge them all to store the '12 bytes header'?</p>
<pre><code>sSamples = struct.pack('i', nSamples) # 4-bytes integer
sSampPeriod = struct.pack('i', nSampPeriod) # 4-bytes integer
sSampSize = struct.pack('H', nSampSize) # 2-bytes integer / unsigned short
sParmKind = struct.pack('H', 9) # 2-bytes integer / unsigned short
</code></pre>
<p>In addition, I've a 'npVect' float array of dimensionality D (numpy.ndarray - float32). How could I store this vector in the same binary file, but after the header? </p>
| python | [7] |
5,322,918 | 5,322,919 | Play music in queue through Av player | <p>Please suggest me play music in queue.
Actually I have array of songs url from web. I success to play the songs through AV player on clik of songs cell. I want to play songs automatically one be one like in queue.please help me how can do this only av player...</p>
<p>Thanks..........</p>
| iphone | [8] |
3,041,311 | 3,041,312 | android detecting touch | <p>I have a webview, and a touch listener on the viewContainer. What I want is, when a touch is detected lights out mode is on, and also if that touch is on a clickable area over webview that click must do his work.</p>
<p>Now touchlistener just not working over my webview.</p>
<p>Here is my similar question, which is not answered: <a href="http://stackoverflow.com/questions/8433718/view-lights-out-mode">view lights out mode</a></p>
<p>I will be really appreciate your answer, thanks.</p>
| android | [4] |
747,542 | 747,543 | Where would I get Microsoft Chart Control sample codes? | <p>Can anyone please tell me where would I get Microsoft Chart Control sample codes ?
Link will be sufficient.</p>
| asp.net | [9] |
1,151,257 | 1,151,258 | android how to handle out of memory exception | <p>HI
in my application i have photos videos etc, in the case of image i done the scaling ,but i get out of memory exception in sometimes, how can i handle the out of memory exception efficently.</p>
| android | [4] |
1,953,130 | 1,953,131 | List<T> defined as member of class | <p>I have a list where i want the type to be definined by the call for example in the class i want something like</p>
<pre><code>public class ClassName
{
public ListType<T> ListName { get; set; }
// other class items
}
</code></pre>
<p>and then the usage to be what sets the class type like</p>
<pre><code>var className = new ClassName()
{
ListType<int> = data
};
</code></pre>
<p>so basically thats what i want, i have it working using dynamic so the class is</p>
<pre><code>public class ClassName
{
public ListType<dynamic> ListName { get; set; }
// other class items
}
</code></pre>
<p>and the call is</p>
<pre><code>var className = new ClassName()
{
ListType<dynamic> = data
};
</code></pre>
<p>this works but i would like to know if there is a better way to do this so i dont have to use dynamic</p>
<p>oh almost forgot to mention the ListType is</p>
<pre><code>public class ListType<T> : List<T>
{
}
</code></pre>
<p>and so doesnt fail by having different types passed to it</p>
<p>thanks</p>
<p>edit:
realised my usage of the code on stack overflow differed from my code</p>
<p>the ListType has a constructor that takes 3 arguments so the usage is more</p>
<pre><code>var className = new ClassName()
{
ListName = new ListType<Type>(x, y, z)
}
</code></pre>
| c# | [0] |
5,902,605 | 5,902,606 | What difference does it makes when I use '' against ""? | <p>What difference does it makes when I use <code>''</code> against <code>""</code> ?</p>
<p>For example:</p>
<pre><code>$example = 'Merry Christmas in Advance';
$eg = "Merry Christmas";
echo "$example";
echo '$example';
echo "$eg";
echo '$eg';
</code></pre>
<p>What would the output for each echo statements and what can we infer about <code>''</code> vs <code>""</code> in <code>PHP</code> ?</p>
| php | [2] |
5,808,120 | 5,808,121 | Set alarm using android manager? | <p>OK... my app needs to be set off a few times a week depending what days the user picks. I know you can use datapicker. Is there anyway that i can auto add one date on to todays date as in today is 19/04/2011 is there any way i can go +1 and it bring it up to 20/4/2011?</p>
| android | [4] |
1,342,436 | 1,342,437 | killProcess can be used in some cases? | <p>I have a logout button in my activity. In my case the killProcess do what I want to do instead of the finish(), but is it a good idea to use killProcess? I have read that is better not to use killProcess but in some cases seems to be useful. </p>
| android | [4] |
154,810 | 154,811 | twitter connectivity via iphone application | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3642129/send-images-to-twitter-through-code">Send images to twitter through code</a> </p>
</blockquote>
<p>I have to upload text and image on twitter via my iphone application.
I couldnt find sample code or any other link to do this task.
please,any one having solution on that. give me suggestion. or sample code.</p>
| iphone | [8] |
3,811,164 | 3,811,165 | The Java Web Translator library | <p>please ,can you help me for using of this library"The Java Web Translator library"
in my applicatin ,or give me an example; how i can use it in my code java?
I have seen the google api translator but i chose JWT because it's
provides automatic language translation to the client's locale.
Thank's in advance</p>
| java | [1] |
2,318,421 | 2,318,422 | How to stop the media player on a service? | <p>I have a media player inside a service which would play a beep at particular time for some seconds..</p>
<p>I want to stop it from a new activity that is launched from the service..Whether it is possible?</p>
<p>Whether I can reference the object for mediaplayer I have created and stop it?How to reference an object/variable from service?</p>
| android | [4] |
1,037,199 | 1,037,200 | Javascript, Intellisense and compiler notification | <p>Being a C# developer, I cannot grasp why in the world one would spend time designing a perfect class in javascript, when you can't get any editor today with intellisense that will fully show you your class rules. There is only one way to maintain a well designed class in JS by documenting everything, and requiring a developer that uses the class to always refer back to its documentation.</p>
<p>For me - trying to become a professional javascript developer - it's so frustrating, I feel so unproductive. why is that? why can't we get an editor that will work just like C#. or maybe we would be better off if browsers starts to support a normal OOP language?</p>
| javascript | [3] |
3,193,257 | 3,193,258 | C++ whats the difference between uint64 and *uint64? | <p>Why does:</p>
<pre><code>const char example;
</code></pre>
<p><code>(uint64*)example</code> have a value of 140734799798420</p>
<p>and</p>
<p><code>*(uint64*)example</code> have a value of 7004431430466964258</p>
<p>p.s. dont worry about the type cast, I am interested why the second <code>*</code> increases the value.</p>
<p>Thanks</p>
| c++ | [6] |
5,320,399 | 5,320,400 | Uncaught ReferenceError: Class is not defined? | <p>I'm curious to know why I'm getting this error? I've copied it exact from the website beezid.com (carousel.js) file, and I'm trying to get the same slide as them onto my website to update it.. As you can see I'm having issues with this?? Their site doesn't come up with this error? >></p>
<p>Carousel = Class.create(Abstract, {</p>
<p>carousel.js:26 Uncaught ReferenceError: Class is not defined</p>
<pre><code>initialize: function (scroller, slides, controls, options) {
this.scrolling = false;
this.scroller = $(scroller);
this.slides = slides;
this.controls = controls;
this.menu = false;
this.menuTitleLen = 20;
</code></pre>
| javascript | [3] |
3,064,514 | 3,064,515 | Adding behavior to a function in JavaScript? | <p>Say I am writing a web-app, and I'd like to add certain behavior to a function after it has been declared in multiple places without overriding the old behaviors of the function.</p>
<p>Here is some simplified code (notice the <strong>window.onmousedown</strong> function</p>
<pre><code>var createMenu = function(){
var menu = document.createElement('ul');
/* add things to the menu */
window.onmousedown = function(e){
menu.style.background = "red";
}
}
var createSidebar = function(){
var sidebar = document.createElement('div');
/* add things to the sidebar */
window.onmousedown = function(e){
sidebar.id = "clicked";
}
}
var createMenu();
var createSidebar();
</code></pre>
<p>In this case, window.onmousedown will not do both things it was meant to do - the definition it has in createSidebar will override its definition from createMenu. Is there a standard way of achieving a sort of behavior in which windows.onmousedown will retain both behaviors?</p>
| javascript | [3] |
1,544,371 | 1,544,372 | how to hook UIView's animation? | <p>I want to send my own message during UIView's animation process.
For example:</p>
<pre><code>myView.alpha = 1.0;
[UIView animateWithDuration:2.0f animations:^{myView.alpha = 0.0;} completion:^(BOOL isFinished){}];
</code></pre>
<p>I want to send the message when iOS render the specific alpha's animation frame.</p>
<pre><code>- (void) alphaChangedTo:(float) val
{
[sendMyOwnMessage:val];
}
</code></pre>
<p>as the animation is carried out by the iOS system, can I hook the function to finish my task?
Thanks!</p>
| iphone | [8] |
3,407,555 | 3,407,556 | class with changing parameters | <p>I want to define a Python class that accepts different variables as input. However I only want to declare one of them when calling the class, because the variables determine each other and in different situations I have different inputs at hand. So it should be something like a class price that I call as:</p>
<pre><code>foo = price(dollar=10)
bar = price(euro=20)
</code></pre>
<p>and I have a function inside the class that takes the different currencies and translates them into each other.
How do I do that?</p>
| python | [7] |
1,922,008 | 1,922,009 | Unable to get property 'mouse' of undefined or null | <p>What is this error :</p>
<blockquote>
<p>Line: 15 Error: Unable to get property 'mouse' of undefined or null
reference</p>
</blockquote>
<p>When I run my asp.net mvc application with IE it occurs, but no problem with firefox.</p>
| javascript | [3] |
583,435 | 583,436 | J query scroller asp.net | <p>I have to make a jquery scroller as given in <a href="http://www.isango.com/" rel="nofollow">http://www.isango.com/</a>. Look at the bottom of the site. Please Help me making this. </p>
<p>Any help will be appreciated.
Thanks</p>
| jquery | [5] |
4,935,061 | 4,935,062 | recursion cannot get this right | <p>We have triangle made of blocks. The topmost row has 1 block, the next row down has 2 blocks, the next row has 3 blocks, and so on. Compute recursively (no loops or multiplication) the total number of blocks in such a triangle with the given number of rows. </p>
<pre><code>triangle(0) → 0
triangle(1) → 1
triangle(2) → 3
</code></pre>
<p>This is my code:</p>
<pre><code>public int triangle(int rows) {
int n = 0;
if (rows == 0) {
return n;
} else {
n = n + rows;
triangle(rows - 1);
}
}
</code></pre>
| java | [1] |
4,597,394 | 4,597,395 | Get Output from my process | <p>I am querying the version of sql server using sqlcmd (from my app) and would like to display the info, say, on a rich text box, how do i go about it, here's the code:</p>
<pre><code> Process proc = new Process();
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.FileName = "sqlcmd";
proc.StartInfo.Arguments = @"-U sa -P somepassword -q 'SELECT @@VERSION' -S (localhost)\InstanceName";
proc.Start();
StringBuilder q = new StringBuilder();
while (!proc.HasExited)
{
q.Append(proc.StandardOutput.ReadToEnd());
}
string r = q.ToString();
rtbCheckVersion.Text = r;
proc.WaitForExit();
</code></pre>
| c# | [0] |
4,925,794 | 4,925,795 | how to get difference in year where dates are in yyyy-mm-dd? | <p>i want to get the difference between two dates which are give in yyyy-mm-dd format difference should be in year. </p>
<pre><code> var ds='2002-09-23';
var today_date = new Date();
alert(today_date);
Date.prototype.yyyymmdd = function() {
var mm = (this.getMonth()+1).toString(); // getMonth() is zero-based
var dd = this.getDate().toString();
var dt = yyyy +"-"+(mm[1]?mm:"0"+mm[0]) +"-"+ (dd[1]?dd:"0"+dd[0]);// padding
var num_years = diff_date/31536000000;
alert(num_years);
if (num_years>18){
alert (num_years);
}else{
alert ("i m not 18");
}
</code></pre>
<p>please help me out.</p>
| javascript | [3] |
2,118,319 | 2,118,320 | Why are my imovies imported from iphoto sometimes sideways, upside down? | <p>I finally figured out how to get my movies from my iphone to imovies - thank you - but now sometimes they are upside down or sideways in the big viewing screen top right. How do I correct this?</p>
| iphone | [8] |
4,534,814 | 4,534,815 | detail disclosure indicator on UIButton | <p>Is there a simple way to place a detail disclosure icon on a UIButton? I'm using a navigation controller and I want a button press to push a new view on the stack, so I thought a detail disclosure icon would be appropriate, but I haven't found a straightforward way to do that yet.</p>
<p>What I have in mind is something like the "When Timer Ends" button in the Timer subview of the Clock app.</p>
| iphone | [8] |
5,042,226 | 5,042,227 | Unknown server tag 'FCKeditorV2:FCKeditor | <p>So i`m getting an unknown server tag for FCKeditor in my aspx page. <a href="http://pastebin.com/SvQfXCd3" rel="nofollow">Here is the link to the source code </a></p>
<p>Among the solutions tried:</p>
<p>1) <code><%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %></code></p>
<p>2) Checked if the dll (FredCK.FCKeditorV2.dll) was in the directory.</p>
<p>Firebug gives me an: 500 Internal Server Error</p>
<p>AND</p>
<p>The actual error is: Parser Error Message: Unknown server tag 'FCKeditorV2:FCKeditor'.</p>
<p>I have a similar page with the same code and for some reason it works and this one doesn`t.</p>
| asp.net | [9] |
3,525,580 | 3,525,581 | How to get data from a method and put in a ListView? | <p>I have this class:</p>
<pre><code>public class Bookmark extends ArrayList<Bkm> {
public static Bookmark getBookmark(Context context) {
Bookmark bookmarks = new Bookmark ();
String[] titles = context.getResources().getStringArray(R.array.bookmark_titles);
String[] urls = context.getResources().getStringArray(R.array.bookmark_urls);
TypedArray icons = context.getResources().obtainTypedArray(R.array.bookmark_icons);
for (int i = 0; i < titles.length; i ++) {
bookmarks.add(titles[i], urls[i], icons.getDrawable(i));
}
return bookmarks;
}
}
</code></pre>
<p>The class has the "getBookmark" method that returns a "bookmarks" object, it contains the fields "titles", "urls" and "icons". How can I get these fields in my main class? I want to create a ListView with the "titles" items and access the corresponding url in a WebView.</p>
<p>In my main class I have this ListView</p>
<pre><code>ListView lv = (ListView) findViewById(R.id.favoritos_listView);
</code></pre>
<p>I am trying to get the data that way</p>
<pre><code>Context context = getApplicationContext();
ArrayList<Bookmark> my_array = BookmarkCollection.getTestBookmarks(context);
ArrayAdapter<Bookmark> aa = new ArrayAdapter<Bookmark>(context, R.array.bookmark_titles, android.R.layout.simple_list_item_1, my_array);
ListView lv = (ListView) findViewById(R.id.favoritos_listView);
lv.setAdapter(aa);
</code></pre>
<p>But the ListView does not appears.</p>
| android | [4] |
5,915,420 | 5,915,421 | PHP: is there a way to see "invisible" characters like \n | <p>Is there a way to see invisible characters like whitespace, newlines, and other non-printing characters in a manner like print_r() ?</p>
<p>Reason is there is some sort of character in my array that I can't see and breaking things.</p>
<pre><code>Object Object
(
[name] => name
[numbers] => Array
(
[0] => 123
[1] => 456
[2] => 789
)
[action] => nothing
)
</code></pre>
<p>See the weird whitespace between [0] and [1]? When printing out [0] a newline gets printed as well. But no where do I assign a newline to [0] so I'm quite confused. </p>
<p>Is there a built in function in php that's like <code>show_invisible(Object->numbers[0])</code> and it will show <code>123\n</code> or similar?</p>
| php | [2] |
6,027,129 | 6,027,130 | ASP.Net Master Pages and Contents | <p>I have tried my best to solve this but i cannot figure this out. Please could you assist me:</p>
<p>I have a master page with 3 containers:
</p>
<p>I created my own Login page as a start page and then it redirects after successfull login to Default.aspx wich is a web content form with master as its master page. In default i have my cphHeader container that displays user info and a menu. Now i want to display something else in container 3 cphMain.. So i have created another page called store info and i have done all the code behind i had too. how do i display this page in container 3 and also how do i load it up as part of what the user see after login?</p>
| asp.net | [9] |
4,788,884 | 4,788,885 | How do I include two versions of jquery on a single page ( one of them is minified ) | <p>I am using this code </p>
<pre><code><!-- load jQuery 1.1.3 -->
<script type="text/javascript" src="http://example.com/jquery-1.1.3.js"></script>
<script type="text/javascript">
var jQuery_1_1_3 = $.noConflict(true);
</script>
<!-- load jQuery 1.3.2 -->
<script type="text/javascript" src="http://example.com/jquery-1.3.2.js"></script>
<script type="text/javascript">
var jQuery_1_3_2 = $.noConflict(true);
</script>
</code></pre>
<p>but the above is for two uncompressed versions . </p>
<p>My page has one umcompressed(1.7.1) and one minified version (1.8.1.min) </p>
<p>how do I do this ?</p>
| jquery | [5] |
2,373,693 | 2,373,694 | Why do these custom fonts crash my Android application? | <p>My Android application was running correctly in versions 2.1, 2.2 and up to 3. The app crashes in 4.0 and 4.1 because of a custom font. How can this get resolved?</p>
<pre><code> Typeface font2 = Typeface.createFromAsset(getAssets(), "fonts/Helvitica.ttf");
TextView customText1 = (TextView)findViewById(R.id.splashtext1);
customText1.setTypeface(font2);
</code></pre>
| android | [4] |
1,733,111 | 1,733,112 | Java Question mark inside println() | <p>I'm trying to make a program that solves equations, i want the answer to be displayed in the right way, if the number is negative, to display -x and not +-x,
for example,
Eq1: 4x-3 and not 4x+-3, but when it is positive to display 4x+3. I can't use the plus sign inside the quotations.
I wanted to use the ? : operator.
I tried something like this</p>
<pre><code>System.out.println("Eq1: "+ ((a11>0) ? (+ "+" + (int)a11) : + (int)a11) +"*x1+");
</code></pre>
<p>This line is supposed to print the negative number (i.e. it will be -2*x1) and if it's positive it should display the + sign and add the number, but it gives me an error around the + "+" +</p>
<p>Any thoughts? Thanks!</p>
| java | [1] |
4,142,277 | 4,142,278 | Swap Image from jpg to swf | <p>Is there a javascript function to swap a still image(jpg) to a movie(swf)? If there is is there a disjointed swap image path?</p>
| javascript | [3] |
1,016,905 | 1,016,906 | how to implement web page mirror with jQuery? | <p>Put all contents on another web page into a fixed size div.</p>
<p>How to achieve this?</p>
| jquery | [5] |
4,397,615 | 4,397,616 | Zoom interference with move Android | <p>My specification requires me to use two fingers for both scroll and zoom movement.(ie) Pinch gesture for zooming up the canvas and simple two finger swipe for movement.However these two events interfere with each other.I tried modified the code to use single finger ( ie without using event.getPointerCount()==2) and it works great.I would like to separate the zoom gesture from the scroll swipe movement.How should i do it?</p>
| android | [4] |
4,626,302 | 4,626,303 | Jquery to accept both negative and nonnegative values | <p>I have tried this. This accepts only integers. I want both negative and non negative.</p>
<pre><code> $(function () {
$('.spinner').keyup(function () {
if (this.value.match(/[^0-9]/g)) {
this.value = this.value.replace(/[^0-9]/g, '');
}
});
});
</code></pre>
| jquery | [5] |
321,651 | 321,652 | the js immediate function exec sequence | <pre><code>var Gadget = function () {
// static variable/property
var counter = 0;
// returning the new implementation
// of the constructor
return function () {
console.log(counter += 1);
};
}(); // execute immediately
var g1 = new Gadget(); // logs 1
var g2 = new Gadget(); // logs 2
var g3 = new Gadget(); // logs 3
</code></pre>
<p>I debug this code and the <code>var counter = 0;</code> will not be executed during <code>new Gadget()</code>, and the output is <code>1,2,3</code>. </p>
<pre><code>var Gadget = function () {
// static variable/property
var counter = 0;
// returning the new implementation
// of the constructor
return function () {
console.log(counter += 1);
}();
}; // execute immediately
var g1 = new Gadget(); // logs 1
var g2 = new Gadget(); // logs 2
var g3 = new Gadget(); // logs 3
</code></pre>
<p>I debug this code the <code>var counter = 0;</code> will be executed during <code>new Gadget()</code>, and the output is <code>1,1,1</code>.</p>
<p>this demo code is in javascript pattern, private static members. I have a little trouble to understand this.</p>
| javascript | [3] |
5,277,838 | 5,277,839 | Android app-sounds | <p>Why do i get error while loading sound file into res? i used a valid name for the sound, didnt use any key or reserved words.</p>
| android | [4] |
3,465,706 | 3,465,707 | how can i change text of TextView in ListView when we click the Button? | <p><strong>I have a ListView with a Button and a TextView and i want to change text of TextView when i click in Button. I handle the click and when i click the Button <code>android:onClick="myClickHandler"</code> i change the text value of TextView but the problem is when i scroll the ListView i found the same text in other cells in ListView. how can i resolve this problem? <br/> tanx a lot.</strong><br>
this is the method to handle click <br> </p>
<pre><code>public void myClickHandler(View v)
{
//get the row the clicked button is in
LinearLayout vwParentRow = (LinearLayout)v.getParent();
TextView child = (TextView)vwParentRow.getChildAt(1);
child.setText("bma bla");
}
</code></pre>
| android | [4] |
5,759,432 | 5,759,433 | Better data structure to handle this array | <p>I have an array of data get from the server(ordered by date):</p>
<p><code>[ {date:"2012-8", name:"Tokyo"}, {date:"2012-3", name:"Beijing"}, {date:"2011-10", name:"New York"} ]</code></p>
<p>I'd like to :</p>
<ol>
<li>get the name of the first element whose date is in a given year, for example, given <code>2012</code>, I need <code>Tokyo</code> </li>
<li>get the year of a given <code>name</code></li>
<li>change the date of a <code>name</code></li>
</ol>
<p>which data structure should I use to make this effective ?</p>
<p>because the array could be large, I prefer not to loop the array to find something</p>
| javascript | [3] |
2,247,345 | 2,247,346 | Retrieve date for browsed web pages in android from browser history | <p>How do I get the date on which web pages were accesed from browser history in android.
I can get the url and title index, but am not able to get the date for the browsed web page from it, as Browser.SEARCHES_PROJECTION_DATE_INDEX is not giving the proper info wrt the current date.
Thanks.</p>
| android | [4] |
5,975,063 | 5,975,064 | jquery elementby class and set name | <p>can some one help me with code to get element by classname and also change the name </p>
<p>currently ive tried</p>
<pre><code>$('selected').attr("name", 'blah blah');
</code></pre>
<p>and also</p>
<pre><code>$('.selected').attr("name", 'blah blah');
</code></pre>
<p>noneof these work
thanks</p>
| jquery | [5] |
3,768,704 | 3,768,705 | is there a sleep() workaround for JavaScript? | <p>So that I could use a loop, and have it pause, say 250 ms after each iteration? [ without setTimeout or setInterval?]</p>
<p>Edit: Ok, so I have a for loop that uses AJAX to post data (<strong>$.ajax()</strong>) . It has lots of vars in it, like <strong>data: 'uid=' + <em>uid</em>, + '&othervars=' + <em>morevars</em></strong> etc, and <strong>each loop, the variables change</strong>.. so If put that [huge] part into a function() {} [Inside of a setTimeout(), using a counter in the loop to increment the timeout], when it executes, will the <em>actual value</em> be in place where I put the vars? </p>
| javascript | [3] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.