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 |
|---|---|---|---|---|---|
2,818,907 | 2,818,908 | PHP coding practices | <p>When I get a variable and I don't know is it set or not I can write</p>
<pre><code>if(isset($a) && $a>2)
</code></pre>
<p>and I can write</p>
<pre><code>if(@$a>2)
</code></pre>
<p>which is shorter.
Is the second syntax good or not?</p>
| php | [2] |
3,087,742 | 3,087,743 | Wanted to create Fast Scrolling with front charecter to dispaly on screen when user Drag on List of Alphabet | <p>I have did the contact list, but the problem is when i click on alphabet list the charterer is not displaying, it is only displaying only when I scroll through "setFastScrollEnabled" but I don't want to display "FastScroll" on my screen : here is the screen </p>
| android | [4] |
4,736,792 | 4,736,793 | List of specific class names in Python | <p>Is there a way to flag class declarations so that later you can get a list of them flagged?</p>
<p>Or a way to get all classes starting with a certain string ?</p>
<p>Or all classes that are a subclass of a specific class?</p>
| python | [7] |
5,180,434 | 5,180,435 | How to call a method when binding a TextBox | <p>I would like to Bind() a TextBox in an EditItemTemplate but I need to pass the original value of the textbox to a function before it's displayed. My goal is to format the value before displaying it. It's a complex formatting rule so I can't use any of the built-in formatters. It's easy to do when working with Eval() but with Bind() it's another story. I know it can be done using events in the code-behind but I was trying to do it all from the aspx page. </p>
<p>Example:</p>
<pre><code><EditItemTemplate>
<asp:TextBox ID="NameTextBox" Text=<%# Bind("Name") %> MaxLength="255" runat="server" />
</EditItemTemplate>
</code></pre>
<p>Thanks...</p>
| asp.net | [9] |
1,152,334 | 1,152,335 | Does :filter work for older versions of IE? | <p>I've got the following line of code in my program:</p>
<pre><code>$('input').filter(':radio').change(function() {
</code></pre>
<p>The problem is that some of the people using Internet Explorer have stated that it's not firing (or the routine that's inside of it is not working).
I know that JavaScript is turn on for their browser because other things are working.</p>
<p>Is there a known compatibility issue with IE and the above mentioned code?
I have IE9 and it's working for me.
I'm loading the latest version of jQuery off Google's CDN.</p>
| jquery | [5] |
2,670,610 | 2,670,611 | Change input values from select list. | <p>I have two text input boxes that will need to be populated from the same selection list but each text box may have different values. What happens is that the code I have written allows you to click and change on value but when you try to do change the second value it changes both values rather than just the second value. I have looked at bind, text with no luck. </p>
<p>Input Boxes:
<code><input type="text" id="lensStyle" size="35" class="orderinput" tabindex="12"/>
<input type="text" id="lensStyleLeft" size="35" class="orderinput" tabindex="12"/></code></p>
<p>grabs the values in from:</p>
<pre><code><select class="longbox" size="14" id="lensStyleBox"></select>
</code></pre>
<p>using this Jquery</p>
<pre><code> $("#lensStyle").focus(function(){
$("#lensStyleBox").click(function(){
$("#lensStyle").val($("#lensStyleBox").val());
});
});
$("#lensStyleLeft").focus(function(){
$("#lensStyleBox").click(function(){
$("#lensStyleLeft").val($("#lensStyleBox").val());
});
});
</code></pre>
| jquery | [5] |
5,636,186 | 5,636,187 | Send multimedia commands | <p>Is there some way that i can send multimedia control commands like next song, pause, play, vol up, etc. to operating system?
Commands that are sent when pressing <kbd>Fn</kbd> + some mapped <kbd>..key</kbd>.
I am making a remote control for PC and sending those commands is essential. </p>
| c# | [0] |
5,998,625 | 5,998,626 | iPhone Application Breaks on an occurance of an even in between of UIImageView Animation? | <p>I have a situation where my code works perfectly fine on simulator but breaks while running on device.</p>
<p>There are three screens to navigate. Oncliking a button on first one we navigate to second and on clicking second we navigate to third and on a button event of third we get back to root view controller that is first screen. Now when we comeback there is a UIImageView animation. Now while this animation is in progress if we click a button application breaks, this application breaks on device but not on simulator.
what is the problem?</p>
| iphone | [8] |
5,130,450 | 5,130,451 | onChange for dropdown and timeouts | <p>I have a dropdown menu which basically sends some data back to the server via onchange. The data is stored in the database and the primary table using seconds to avoid duplicates. What happens is if I scroll the dropdown via my keyboard, for example, using the up/down keys, my script returns an error because there is a duplicate entry now in the database.</p>
<p>here is part of the code for the dropdown in html</p>
<pre><code>onchange="GetmySQLData();"
</code></pre>
<p>My question is can i just do a setTimeout and would it be correct to use it in this format:</p>
<pre><code>onchange="setTimeout('GetmySQLData();', 1750);"
</code></pre>
<p>If you have a better approach, please feel free to let me know.</p>
<p>Thanks</p>
| javascript | [3] |
227,844 | 227,845 | android TTS install language if not exist | <p>i Try to use <code>JAPANESE</code> language on my Android 4 device.</p>
<pre><code>int value = tts.setLanguage(Locale.JAPANESE);
</code></pre>
<p>but value is -2.</p>
<p>this is my code for checking</p>
<pre><code>protected void check(int requestCode, int resultCode, Intent data) {
if (requestCode == 0) {
switch (resultCode) {
case TextToSpeech.Engine.CHECK_VOICE_DATA_PASS:
tts = new TextToSpeech(this, this);
break;
case TextToSpeech.Engine.CHECK_VOICE_DATA_BAD_DATA:
case TextToSpeech.Engine.CHECK_VOICE_DATA_MISSING_DATA:
case TextToSpeech.Engine.CHECK_VOICE_DATA_MISSING_VOLUME:
Intent installIntent = new Intent();
installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
startActivity(installIntent);
break;
case TextToSpeech.Engine.CHECK_VOICE_DATA_FAIL:
default:
Log.e(TAG, "Got a failure. TTS not available");
}
}
}
</code></pre>
<p>and i want to install language if not exist. But app crashes. Is this correct wy ir what can i do? How to get japanese language?</p>
| android | [4] |
1,690,150 | 1,690,151 | Index of duplicates items in a python list | <p>Does anyone know how I can get the index position of duplicate items in a python list?
I have tried doing this and it keeps giving me only the index of the 1st occurrence of the of the item in the list.</p>
<p>List = ['A', 'B', 'A', 'C', 'E']</p>
<p>I want it to give me:</p>
<p>index 0: A<br>
index 2: A</p>
<p>Thanks</p>
| python | [7] |
524,521 | 524,522 | jQuery animate causing screen to jump | <p>So I'm learning jQuery and I think there is something that I am missing. I am using the following code on a "div" tag:</p>
<p><code>$("#faq-group-notice").animate({ height:'hide', opacity:'hide' });</code></p>
<p>It appears to be a final jump when it is finishing the animation. Any ideas about how to get rid of that?</p>
<p>EDIT: css for the div tag</p>
<p><code><div id="faq-group-notice" class="flash notice hidden"></div></code></p>
<p><code>.hidden {
display: none;
}</code></p>
<p><code>.notice {padding:0.8em;margin-bottom:1em;border:2px solid #ddd;}</code></p>
| jquery | [5] |
4,157,021 | 4,157,022 | Populating a ListBox with Javascript without Losing Values on Postback | <p>I would like to know which is the best way to do this: I have a form using ASP that is being validated firstly on client-side with jQuery.I have 2 listboxes and alot of dynamically created buttons on the page.I was successful to get the text of the buttons and write it on the listboxes.However when i try to loop through listboxitems on the server side,i lost the values which was sent to listboxes by jquery and i couldnt get the values in the serverside.I checked it in the forums hiddenfiled would be an option but i couldnt do it,can you please help below is my code. </p>
<pre><code> <asp:ListBox ID="ListBox2" runat="server" Width="111px"></asp:ListBox>
$(function () {
$('.btnplant').toggle(function (e) {
e.preventDefault();
var value = $(this).val();
$(this).css('background-color', '#6FA478');
$("[id$=ListBox2]").append('<option value="' + value + '">' + value + '</option>');
}, function (e) {
e.preventDefault();
var value = $(this).val();
$(this).css('background-color', '');
$('[id$=ListBox2] option[value="' + value + '"]').remove()
});
});
string strPlants = string.Empty;
foreach (ListItem li in ListBox2.Items)
{
if (!li.Selected)
{
strPlants += "," + li.Value + ",";
}
}
</code></pre>
| jquery | [5] |
2,879,193 | 2,879,194 | runtime/compile time polymorphism | <p>In the below code , why b1.subtract() fails . Please explain me the reason ie., what happens in JVM while invoking that method .</p>
<pre><code>class Base {
public void add() {
System.out.println("Base ADD");
}
}
class Child extends Base {
public void add(){
System.out.println("Child ADD");
}
public void subtract() {
System.out.println("Child Subtract");
}
}
class MainClass {
public static void main(String args[]) {
Base b1 = new Base();
Base b2 = new Child();
Child b3 = new Child();
b1.add();
b2.subtract(); // ?????????**previously it was b1.subtract and its wrong
b2.add();
b3.subtract();
}
}
</code></pre>
| java | [1] |
1,578,028 | 1,578,029 | How to click on a value in the table | <p>I want top click a value in the dynamic table where my values location can be anywhere depends on the login user permission. so I can't go with the index.
I need to search that value by text and need to click on it.</p>
<p>When I am doing it through IDE, it's doing type function will is not resolving my problem, when I am converting type methoc into click then it's going with .</p>
<p>Plz help me on this.</p>
| javascript | [3] |
3,947,390 | 3,947,391 | I want to display Progress Bar till the response comes from server | <p>I want to show some text from server, but till then I want to display Progress Bar.
Can anyone help me out. Response is in the form of JASON</p>
| android | [4] |
1,450,378 | 1,450,379 | copy a file from one dir to another dir | <p>How i can copy one file from one directory to another directory using php</p>
| php | [2] |
5,408,875 | 5,408,876 | How to combine this two javascript lines in just one line | <p>am trying to figure out a way of combining the below statements</p>
<pre><code>document.getElementById( 'div1' ).appendChild( document.createElement( 'div' ) ).id="div2";
document.getElementById( 'div2' ).appendChild( document.createTextNode( 'More about me' ) );
</code></pre>
| javascript | [3] |
2,243,319 | 2,243,320 | is a good practice to use array of objects in php? | <p>For example, it is a good practice to do this in php:</p>
<p>I have a class test, it is a controller class where I instantiate the view and the model class, but what if I need to instantiate if another model I would have to create another object, instead of that I create an array of objects that holds the instances of each model or view:</p>
<pre><code> class test extends Controller{
//The vars $Model and $View are arrays declared in the parent class
public function __construct(){
parent::__construct();
$this->Model["testModel"] = new testModel();
$this->Model["otherModel"] = new otherModel();
$this->View["testView"] = new testView();
}
public function index_action(){
$this->View["testView"]->assign("name", $this->getParam("name"));
$this->View["testView"]->showTestTemplate();
}
public function other_method(){
echo "Hello world";
}
}
</code></pre>
<p>is only a sample class, wanted to know if it is a good practice to do so.
thanks</p>
| php | [2] |
5,464,477 | 5,464,478 | Android and extends about two activities | <p>I have a problem. How I can extends for two activities. I have a activity which must extends two other activities, but I can't extends about two activities. How I can do this another way?
I need this because one activity extends Activity, but in this activity must extends MapActivity too because I'm using mapView.</p>
| android | [4] |
431,986 | 431,987 | How to upload my webpage (ASPX) to IIS server | <p>I created a webpage in aspx and i want use it over LAN using IIS. But i m not getting a way upload it to IIS. Please anybody tell step by step process to uploading my website to IIS.</p>
| asp.net | [9] |
1,010,556 | 1,010,557 | Slider keeps repeating over & over if i rollover multiple times | <p>I have the following code:</p>
<pre><code>$(document).ready(function() {
$('#nav li').hover(
function() {
// Show the sub menu
$('ul', this).slideDown(300);
}, function() {
//hide its submenu
$('ul', this).slideUp(200);
});
});
</code></pre>
<p>But if i rollover an Nav menu item quickly, say 50 times..it will keep showing the animation (up and down) 50 times like a loop!...</p>
<p>I tried adding <code>.stop()</code> like <code>$('ul', this).stop().slideDown(300);</code> - but it just stops the menu showing.... so any ideas where to put it in the code or another way to do it please?</p>
| jquery | [5] |
3,022,696 | 3,022,697 | how to use java mail services on linux with proxy | <p>I am in a network with proxy 192.168.1.1
when i am implementing the java mail i am getting error network not connected though i have configured the proxy also in the program.</p>
<pre><code>props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "465");
props.put("proxyHost", "192.168.1.1");
props.put("proxyPort", "8080");
</code></pre>
| java | [1] |
155,997 | 155,998 | why the cast is failing? | <p>I am trying to do this</p>
<pre><code>List<String> stringList = new ArrayList<String>();
stringList.add("one");
stringList.add("two");
stringList.add("three");
(String[]) stringList.toArray();
</code></pre>
<p>why does this gives me class cast exception ?</p>
<pre><code>Caused by: java.lang.ClassCastException: [Ljava.lang.Object;
</code></pre>
| java | [1] |
5,218,016 | 5,218,017 | PHP Dynamic HTML Question | <p>I have this piece of PHP/HTML, wrapped in a POST form. How do I pass only the ID for the row where the delete button is clicked back to the server?</p>
<pre><code> <table>
<tr>
<th>File Path</th>
<th>Expiration</th>
</tr>
<?php
$result = mysql_query ($list_query);
$row_count = mysql_numrows ($result);
for ($i = 0; $i < $row_count; $i++) {
$id = mysql_result ($result, $i, "id");
$path = mysql_result ($result, $i, "path");
$expiration = mysql_result ($result, $i, "expires");
?>
<tr>
<td width="60%">
<?php echo $path; ?>
</td>
<td>
<?php echo $expiration; ?>
</td>
<td>
<input type="submit" value="Delete Expiration" />
</td>
</tr>
<?php
}
?>
</table>
</code></pre>
| php | [2] |
4,314,633 | 4,314,634 | In C++, how do I get an int index of an iterator? | <p>I need to cout and return a deque element's index that an iterator is pointing to. How do I get an int out of an iterator?</p>
| c++ | [6] |
4,069,750 | 4,069,751 | Maintain ListView Item State | <p>My ListActivity is bound to an ArrayAdapter where I have overriden the getView() method. If I change the visibility of a widget in that method or modify the view's background color, those changes somehow get lost once that modified list item returns after being scrolled off the screen. In fact, some other view in the list is picking up the changes. </p>
<p>How do I get the modified view to look the same when it's redisplayed after scrolling?</p>
| android | [4] |
3,153,522 | 3,153,523 | Menu Items Android | <p>I have an Activity name <code>MenuActivity</code>. In that I have defined 4 Menu items. All these Menu Items call a particular Activity And then I extend this Activity in other classes. So that I can have Menus displayed in all the Activities.</p>
<p>The problem is, what I have noticed is, some times when I click on a particular Menu Item they don't go to that Activity in which they are supposed to go.
Some ID mismatching is occurring internally. Has any one came across such a problem in their life.</p>
<p>Please Help.</p>
| android | [4] |
504,285 | 504,286 | Select first TD in every row of first table w/ jQuery | <p>I need to select the first TD of every table row where the following conditions are met:</p>
<ol>
<li>TD does not have colspan</li>
<li>TD in the first table and not any of the nested ones</li>
</ol>
<p>The following does not work for me...</p>
<pre><code>$("table:first > td:first-child").not("[colspan]").css("background-color","red");
</code></pre>
| jquery | [5] |
443,247 | 443,248 | Check if there is a phone call going on from broadcast receiver | <p>I have an application that is launched from a broadcast receiver, but I don't want to launch the application if the user is currently in the middle of a phone call. How would I check from my broadcast receiver class if there is currently a phone call going on?</p>
| android | [4] |
4,662,583 | 4,662,584 | file.creation formating in c# | <p>i have a fileinfo array which loads jpegs from a folder.</p>
<p>When I add them to the list box using the creationtime property it adds both the date and time, for example: "07/07/2010 14:28"</p>
<p>Here is the code I use:</p>
<pre><code>foreach (FileInfo fi in files5)
{
sessionframeslstLISTBOX.Items.Add(fi.CreationTime);
}
</code></pre>
<p>I want it so that It just says the time, ege: "14:28"</p>
<p>How can I format the string before its added to the listbox so that it omits the date?</p>
| c# | [0] |
3,722,333 | 3,722,334 | read/write /dev/ttySDIO0 like a file? | <p>Need to read/write to a tty SDIO device in an user space program in using JNI in Android.
Is it possible to open the device (/dev/ttySDIO0) using fopen and read/write as a normal file?</p>
<p>From the terminal apps it is possible to do cat/echo to it. However I am looking for a approach which can be used in a program.</p>
<p>I don't see the .read operation defined in the SDIO UART driver.</p>
<p>Thank you. </p>
<p>EDIT: I am using Android Dev Phone 1 which has Android 1.6 (Linux Kernel Version 2.6.29). </p>
| android | [4] |
1,626,679 | 1,626,680 | Running PHP in apache | <p>Im a newbie to PHP and trying to run this code in apache webserver but for some reason its not running.</p>
<p>The file is saved under htdocs info.php. WHen I run there is no action at all..Infacts it opens the download window.</p>
<p>ANy help is appreciated</p>
<p>php code:</p>
<pre><code><?php
date_default_timezone_set('America/Los_Angeles');
echo date("F j, Y, g:i:s a");
?>
</code></pre>
| php | [2] |
1,952,053 | 1,952,054 | operations on 2-D arrays | <p>How to claculate the sum or product of each row and column separately
in a 2-d array.</p>
| c++ | [6] |
3,441,094 | 3,441,095 | How to check if list of int in the list of string? | <p>I have 2 defauldict(list); one of them only display the number and another one contain the whole line of text. </p>
<p>I have list of int (lookup)</p>
<pre><code>[112, 896, 455, 1164, 1164, 336, 386, 521, 1011, 1033]
</code></pre>
<p>and list of string (description)</p>
<pre><code>[['ZNF91', 'Q05481', 'VAR_057393', 'p.Tyr112His', 'Polymorphism', 'rs296091', '-'],
['ZNF91', 'Q05481', 'VAR_057394', 'p.Thr896Ala', 'Polymorphism', 'rs296093', '-'],...]
</code></pre>
<p>I am trying to come up with <code>if</code> statement to check while i run the program, basically, when i use number that match the line, i want to print the line of that string for example, if i use number 112, which match the first line (p.Tyr112His), i want to have it print the whole line that contains p.Tyr112His; which is:</p>
<blockquote>
<p>'ZNF91', 'Q05481', 'VAR_057393', 'p.Tyr112His', 'Polymorphism', 'rs296091', '-'.</p>
</blockquote>
| python | [7] |
4,029,522 | 4,029,523 | Convert Latin characters to Normal text in Java | <p>I have the following characters.</p>
<p>Ą¢¥ŚŠŞŤŹŽŻąľśšşťźžżÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ</p>
<p>I need to convert to </p>
<p>AcYSSSTZZZalssstzzzAAAAAAACEEEEIIIIDNOOOOOOUUUUYTSaaaaaaaceeeeiiiionoooooouuuuyty</p>
<p>I am using Java 1.4.</p>
<p>Normalizer.decompose(text, true, 0).replaceAll(
"\p{InCombiningDiacriticalMarks}+", ""); only replaces characters with diacritics. </p>
<p>Characters like ¢¥ÆÐÞßæðøþ is not getting converted.</p>
<p>How can I do that, what is the efficient way to do the conversion in JDK 1.4.</p>
<p>Please help.</p>
<p>Regards,
Sridevi</p>
| java | [1] |
632,317 | 632,318 | Why isn't my hover event firing in JQuery? | <p>I'm not sure why my event isn't firing? I simply want to change the list style type when the user hovers over an li. It doesn't look like I'm missing anything, but nothing is happening.</p>
<pre><code><%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<link href="theme.css" rel="stylesheet" type="text/css" />
</head>
<script type="text/javascript">
$(".component ol li").hover(function() {
$(this).css('list-style-type', 'disc');
}
);
</script>
<body>
<form id="form1" runat="server">
<div class="component">
<ol>
<li><a href="#"></a>&nbsp;</li>
<li><a href="#"></a>&nbsp;</li>
<li><a href="#"></a>&nbsp;</li>
<li><a href="#"></a>&nbsp;</li>
<li><a href="#"></a>&nbsp;</li>
</ol>
</div>
</form>
</body>
</html>
</code></pre>
| jquery | [5] |
5,783,505 | 5,783,506 | Android - Disable all other items on dialog when clicked on another | <p>How to disable all other items on dialog when clicked on another? Below is my code</p>
<pre><code>final CharSequence[] items = {"Red", "Green", "Blue"};
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("Select Sources");
builder.setMultiChoiceItems(items, null, new OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
if(items[which] == "Red"){
//Disabled Green and Blue items
}
}
});
AlertDialog alert = builder.create();
alert.show();
</code></pre>
| android | [4] |
2,790,591 | 2,790,592 | Manipulating a text string (for the purpose of converting a date format to custom date format) | <p>I have dates being output in this format: 14-MAR-2011 (DD-MMM-YYYY) for example.</p>
<p>Is it possible, using jQuery to convert this to: 03\11 (MM\YY) ?</p>
| jquery | [5] |
1,936,880 | 1,936,881 | linking code from a separate document to work on another page | <p>I have taken script from a webpage document I have made and I have saved onto a notepad document with the extension <em>.js</em>.</p>
<p>I would like to now know how I can reference this .js file from the current page that I have created so that the script will run on that page without the actual code being there, just the reference link.</p>
| javascript | [3] |
11,831 | 11,832 | How to locate restaurants,hospitals near user on google maps in andoid? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/8428209/show-current-location-and-nearby-places-and-route-between-two-places-using-googl">Show Current Location and Nearby Places and Route between two places using Google Maps API in Android</a> </p>
</blockquote>
<p>In my application i am able to detect user but further now I need to locate and show restaurants and hospitals on the map near user's location. So how shall i proceed with that now?</p>
| android | [4] |
2,557,858 | 2,557,859 | How I get event onChange on webview in android? | <p>I am new in android app development. I am developing a app which uses WebView to load my sign-up and login page and I want to get those text entered by user and store in native database in my app. can anyone suggest me how to proceed?? </p>
| android | [4] |
3,518,035 | 3,518,036 | How to do RLE (run length encoding) in C# on a byte array? | <p>I am trying to XOR two bitmap files (their byte arrays) to produce a byte array that can be used to change image A into image B or vice versa. I am sending this over the network so I would like to do some basic compression before this happens.</p>
<p>Is there a way to do RLE (run length encoding) in C# (using a built-in, or fast reliable 3rd party library) on a byte array for this purpose?</p>
<p>Notes:</p>
<ul>
<li>If you are going to suggest an alternative to my approach please keep in mind that the decompression and transformation on the remote machine has to be as quick and efficient as possible.</li>
</ul>
| c# | [0] |
5,306,864 | 5,306,865 | Application level variables in android getting nulled | <p>I have developed an Android Application. To keep the user logged in, I am storing their username and password in a class that extends <code>Application</code>. If the user exits the application without logging out, a backgound service will start which will use the user credentials (username and password) stored in the Application context. <br><br>This worked very well for me. But now I have installed facebook in my phone (Samsung galaxy Ace). It has a service that occupies 37 MB of the RAM. Now when I run the background service of my application. The application level variable get killed when I play a game or sometimes even when I lock the screen (the username and password become null).<br>
What is happening? What other way is there to keep the user logged in? I don't want to use sqlite database to store the username/password. You can easily see the values of the table.
<br>
<br>
<strong>Note</strong><br>
I still have 38 MB of RAM available even with this facebook running. my app uses only 544kb of memory.</p>
<p><strong>EDIT1</strong><br>
This might seem surprising but I have not made any changes in my code. But now the Apllication variables (username and password) lives on even when I open threee or four applications. In the question above I said that the <code>Application</code> vairables become null as soon as I even lock the screen. But now they seem to be persisting even when I play play a game (with another application open!). So clearly it not the memory constraint that kills the <code>Application</code> variables. <br>
What is the reason for this? What determines the killing of the application level variables?</p>
| android | [4] |
4,905,072 | 4,905,073 | how to isolate one of the two classes | <p>i have a link</p>
<pre><code><a href="" class="states state1">More Info</a>
</code></pre>
<p>and I want to get the class state1 and not states</p>
<p>I have tried this</p>
<pre><code>$(".states").attr("class")
"states state1"
</code></pre>
<p>but when i try </p>
<pre><code>>> $(".states").attr("class").not(".states")
TypeError: $(".states").attr("class").not is not a function
>>> $(".states").attr("class").not("states")
TypeError: $(".states").attr("class").not is not a function
</code></pre>
<p>any ideas how to get the other class</p>
| jquery | [5] |
197,258 | 197,259 | Why does Firefox sometimes generate "console not defined" error? | <p>Sometimes Firefox generates console not defined error when console.debug() is used. Is this some kind of timing issue with load?</p>
| javascript | [3] |
4,200,894 | 4,200,895 | android multiple alarm setting | <p>I want to set a multiple alarm in android. please help me in achieving this task.</p>
<p>Thanks &Regards
Pawan Pathak</p>
| android | [4] |
5,278,628 | 5,278,629 | How to share an HTML file with various apps via ACTION_SEND Intent | <p>I'm trying to send an HTML file to Google Docs on Android via the "Share" button. The code I'm using at the moment is basically:</p>
<pre><code>Intent share = new Intent(Intent.ACTION_SEND);
share.setType(mimeType);
share.putExtra(Intent.EXTRA_STREAM, Uri.parse(file.getPath()));
startActivity(Intent.createChooser(share, "Some Title");
</code></pre>
<p>"file" is of type File and points to some file on storage somewhere. I get the Mime Type by using the MimeTypeMap.getMimeTypeFromExtension() method (I wasn't sure what it should be, but I'm fairly sure i resolves to text/html).</p>
<p>The above code works fine for sharing the file with Dropbox, but with Google Docs I get a notification that the upload fails. Also, the default email client just force closes and the attachment fails with GMail.</p>
<p>The default file manager on the device I'm using (ASUS Transformer running 3.2) also has the "Share" option and everything works fine with the same files there (Dropbox, GDocs, Mail), so clearly I'm missing something, but I have no idea what. Any help would be appreciated.</p>
| android | [4] |
4,220,963 | 4,220,964 | UITableView clear data | <p>How to clear whole tableview data and reload with new one?</p>
| iphone | [8] |
459,271 | 459,272 | jQuery question adding more than one dropable textbox | <p><a href="http://jsfiddle.net/5DCZw/2/" rel="nofollow">http://jsfiddle.net/5DCZw/2/</a> i found this fiddle on the website here, and I cant figure out how to add multiple textboxes that would also be dropable.</p>
| jquery | [5] |
261,537 | 261,538 | how to change normal charater to password char by jquery? | <p>Suppose I have a textbox and I want that when the user types inside it then each character will be converted to a password symbol after 1 sec by jQuery.</p>
<p>The same effect that we see on modern smart-phones when we type into password textboxes.</p>
<p>Does anyone have any suggestions? I know how to capture the key press and get the character user typed.</p>
<pre><code><input type="text" id="username" name="username" />
<script type="text/javascript">
$("#username").keypress(function(event){
// Get the keypress value
// ...?
var c = String.fromCharCode(e.which);
}
});
</script>
</code></pre>
| jquery | [5] |
4,934,563 | 4,934,564 | php_mod and script execution time | <p>I have a script with a long execution time.
Apache is using php_mod.</p>
<p>I start the process in the browser ( open the url ).
I close the browser and the process is still running.</p>
<p>How can I find the apache process and stop it (linux os )</p>
| php | [2] |
335,850 | 335,851 | what is the correct type for this loop? | <p>where RoomCentreNodeVectors is a vector of vectors of ints.
roomKills is a vector of ints and level.Nodes() returns a vector of Node objects. The Node object's Room() function returns and int.</p>
<pre><code>for (std::vector<std::vector<int>>::size_type i = 0; i < level.RoomCentreNodeVectors().size(); i++)
{
RoomKills.push_back(level.Nodes()[level.RoomCentreNodeVectors()[i][0]].Room());
}
</code></pre>
<p>or</p>
<pre><code>for (std::vector<int>::size_type i = 0; i < level.RoomCentreNodeVectors().size(); i++)
{
RoomKills.push_back(level.Nodes()[level.RoomCentreNodeVectors()[i][0]].Room());
}
</code></pre>
| c++ | [6] |
5,984,372 | 5,984,373 | jQuery positioning issue | <p>I have a web form against a white background that allows the user to make certain selections. Depending on the selection that the user makes, this form could grow very long lengthwise. (Although I advised against it, the client was adamant). The form works fine and I'm happy.</p>
<p>However, at the bottom of the form is a div footer that is black and has a height of 50 pixels and the width = 100%. Is it possible to use jQuery to <em>always</em> keep it at the bottom of the form no matter what the user chooses?</p>
<p><strong><a href="https://lavaggio.net/lavagstaging/charity_page/CreditCardInfoMockup.aspx" rel="nofollow">Here is the page I am referring to.</a></strong></p>
| jquery | [5] |
4,172,648 | 4,172,649 | Listening to serial port to know whether modem installed/removed in C#? | <p>How will i continuous listen to COM for detecting modem.
if a modem is added or removed it should inform you that Modem installed or removed at COM45 etc.</p>
<p>I have tried to use a thread and check the com count but i am unable to know which com is modem.</p>
<p>If there is any specific class for this pls help me fr the code asap???</p>
| c# | [0] |
5,467,481 | 5,467,482 | Where is the java.exe that launched me? | <p>Is there some way I can find the path to the java.exe that launched me?</p>
<p>In this case I am on Windows but if there is a general solution I would welcome it.</p>
<p><strong>Added</strong></p>
<p>FYI: In most cases my tool will be launched from a full path to an unregistered java.exe. e.g. <code>C:\ABC\DEF\SDK\JRE\BIN\Java -jar MyTool.jar</code>. Can I find the <code>C:\ABC\DEF\SDK\JRE\BIN\</code>.</p>
<p>Yes it is rather self-referential. :)</p>
| java | [1] |
3,479,086 | 3,479,087 | How to calculate the android 3.0(tablet) system bar height? | <p>How to calculate the android 3.0 tablet screen bottom system bar(contain back button,menus button,etc)height?</p>
| android | [4] |
2,223,782 | 2,223,783 | How can I get the page or post language when I use wpml? | <p>I'm using <a href="http://wpml.org/" rel="nofollow">WordPress MultiLanguage Plugin</a> and I want to know what is the language of a specific element, page or post. </p>
<p>I do have the <code>id</code> but I want to obtain the language.</p>
| php | [2] |
1,291,861 | 1,291,862 | iPhone app stop rotating after few touches or sometimes stop rotating at all, other times works just fine. Any idea where to look for the problem? | <p>iPhone app stop rotating after few touches or sometimes stop rotating at all, other times works just fine. Any idea where to look for the problem?</p>
<p>My app is designed to support auto-rotate and works fine previously until I added some code that move JSOn data loading to another thread.</p>
| iphone | [8] |
1,600,919 | 1,600,920 | Alternative to using eval to call slightly different function names? | <p>My question was going to be how to do this at all but I came across <code>eval</code> which seems to work. I'm told <code>eval</code> is evil and the explanations for why went way over my head so my question is:</p>
<p>Is there anything wrong with using <code>eval</code> like this, or other ways to do it at all?</p>
<pre><code>var condition1=false;
var condition2=true;
var condition3=false;
//etc
if (condition1){x = "1"}
else if (condition2){x = "2"}
else if (condition3){x = "3"};
//etc
var thing1= 11;
var thing2= 22;
var thing3= 33;
//etc
eval ("thing" + x)
</code></pre>
| javascript | [3] |
140,726 | 140,727 | Adding Image and take out Tilte to blog page | <p>I am working on a wordpress template:
<a href="http://papergirlideas.com/blog/" rel="nofollow">http://papergirlideas.com/blog/</a></p>
<p>The client wants me to replace the red title with an image just on the blog page. I am not having much luck.
Thanks for your help!</p>
| php | [2] |
358,217 | 358,218 | Char or String? | <p>Does it matter if I use a string or char for a simple input function? (aka y/n)</p>
<p>This is what I'm using at the moment:</p>
<pre><code>using namespace std;
string somestr;
getline(cin,somestr);
if(somestr.empty())
{ //do something }
else if (somestr == "y"){
//do something else
}
else{}
</code></pre>
<p>And if it makes more sense to user char what would be the equivalent char code to this?</p>
| c++ | [6] |
1,487,387 | 1,487,388 | How do I create a help overlay like you see in a few Android apps and ICS? | <p>I am wanting to create help overlays like the ones you see when ICS loads for the first time or in apps like ES File Explorer or Apex Launcher (there are more, but I can't think of them right now). Is this just a relative layout with one view sitting on top of the other? I haven't been able to find any sample code for doing such a thing. Anyone know how this is done or have any ideas?</p>
<p><img src="http://i.stack.imgur.com/4CCh0.png" alt="ES File Explorer">
<img src="http://i.stack.imgur.com/Sx19T.png" alt="ES File Explorer"></p>
| android | [4] |
1,202,419 | 1,202,420 | how can creat function like this? | <p>i want to create function like this. please help me to complete my function
if both are +ve</p>
<pre><code>$a = 10;
$b = 6;
// do nothing just show same value 10 and 6
// if $b is negetive
$a = 10;
$b = -3;
// get the value from $a show the value 7 (10 - 3)
// 0 if $a is negative
$a = -2;
$b = 6;
// (little bit diffrent) get the double form $b of negative value and
// show the value 0 and 2(6-4)
</code></pre>
<p>i have tried with this but totally stopped at else code</p>
<pre><code>// $a = something;
// $b = something;
if ($a >0 && $b >0) {
echo $a.' , '.$b;
}else{
// what? what? what?
}
</code></pre>
| php | [2] |
3,483,838 | 3,483,839 | NSMutableArray Memory Leak Issue | <p>There are multiple memory leaks in this section of my code. Specifically with these arrays: PlaylistItem, PlaylistItemID and PlaylistItemLength. The problem is that I can't successfully release the arrays. When I attempt to use insert [xxxx release]; anywhere in this code, the app locks up. It's driving me absolutely nurtz!</p>
<pre><code>-(void)configureCueSet {
MPMediaQuery *myPlaylistsQuery = [MPMediaQuery playlistsQuery];
NSArray *playlists = [myPlaylistsQuery collections];
//Get # of items in a playlist and names -------------------------------------
NSArray *songs;
for (MPMediaPlaylist *playlist in playlists) {
NSString *playListItem = [playlist valueForProperty: MPMediaPlaylistPropertyName];
if ([playListItem isEqualToString: savedLastSelectedPlaylist]){
songs = [playlist items];
}
}
PlaylistItem = [[NSMutableArray alloc] init];
PlaylistItemID = [[NSMutableArray alloc] init];
PlaylistItemLength = [[NSMutableArray alloc] init];
for (MPMediaItem *song in songs) {
[PlaylistItem addObject:[song valueForProperty: MPMediaItemPropertyTitle]];
[PlaylistItemID addObject:[song valueForProperty: MPMediaItemPropertyPersistentID]];
[PlaylistItemLength addObject:[song valueForProperty: MPMediaItemPropertyPlaybackDuration]];
}
}
</code></pre>
| iphone | [8] |
639,924 | 639,925 | running installed web application | <p>I created a set up project and installed a web application on my local machine. The set up was completed successfuly. How to check if the application has got installed properly.</p>
| asp.net | [9] |
2,088,249 | 2,088,250 | How to make a seperate list based on certain numbers from a previous list? | <p>Hey guys trying to finish my program. Here is my code:</p>
<pre><code>lists = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
#I want to make a new list consisting of only numbers above 50 from that list
if any(list > 50 for list in list):
newlists = list
</code></pre>
<p>I don't know how to do it. I'm doing something wrong, can anyone help me?</p>
| python | [7] |
5,166,550 | 5,166,551 | Help with java script - to validate the files in a folder | <p>I have got a html web page which gets a user input in the form of a directory path in a text box. I need to provide a validate button near the text box. on clicking the button, the user should get the feedback as to whether the directory path contains the required set of files, like few images and other files in certain format. Also i would have to read certain text files in the folder to determine if the image files listed in those are also located in the folder. I dont know web programming. can i do this in java script or in any other language? The directory is located in a local netwrok share. iam not aware of the security restrictions et al. please help</p>
<p>Thanks</p>
| javascript | [3] |
3,652,904 | 3,652,905 | Operator overloading in C# | <p>I was a bit confused with Operator overloading in C# language, Can you Please tell me is Operator overloading static or dynamic in nature.</p>
| c# | [0] |
5,816,747 | 5,816,748 | In Doom3's source code, why did they use bitshift to generate the number instead of hardcoding it? | <p>Why did they do this:</p>
<pre><code>Sys_SetPhysicalWorkMemory( 192 << 20, 1024 << 20 ); //Min = 201,326,592 Max = 1,073,741,824
</code></pre>
<p>Instead of this:</p>
<pre><code>Sys_SetPhysicalWorkMemory( 201326592, 1073741824 );
</code></pre>
<p><a href="http://fabiensanglard.net/doom3/index.php" rel="nofollow">The article I got the code from</a></p>
| c++ | [6] |
4,603,094 | 4,603,095 | Illegal character in path at index 16 | <p>I am getting the following error in RAD:</p>
<pre><code>java.net.URISyntaxException: Illegal character in path at index 16: file:/E:/Program Files/IBM/SDP/runtimes/base......
</code></pre>
<p>Could you please let me know what is the error and how to resolve it?</p>
| java | [1] |
1,593,137 | 1,593,138 | Batch Process Implementation Tool | <p>I am looking for tool (API) to use for Batch Process Implementation. Do you guys suggest any?</p>
| java | [1] |
5,926,423 | 5,926,424 | How to load local html pages to android | <p>I want to load local HTML pages in to a WebView. I know how to do it in iPhone. Can any one tell me the way to do it in android.</p>
<p>How to do the below page in android?</p>
<p><img src="http://i.stack.imgur.com/AE9Lz.png" alt="enter image description here"></p>
| android | [4] |
2,231,698 | 2,231,699 | update multiple rows in table mysql | <p>im wondering if someone could point me in the right direction as im trying to update multiple rows but for some reason everytime time i do the update, variable id_employee is set with the same value for all the rows.. that´s what i figured out when i var_dumped $_POST. The rest of fields are fine.. Here is a complete view of my code. <a href="http://pastie.org/5478920" rel="nofollow">http://pastie.org/5478920</a>, also this is what i get when i var_dump <a href="http://pastie.org/5478980" rel="nofollow">http://pastie.org/5478980</a></p>
<pre><code> $query = "update project_staff
set
id_employee=?
where
id_project=?
and
id_projectemployee=?
";
$stmt = $this->dbh->prepare($query);
for ($i = 0; $i < count($_POST['id_employee']); $i++){
$employee = $_POST['id_employee'][$i];
$stmt->bindValue(1, $employee, PDO::PARAM_INT);
$stmt->bindValue(2, $_POST["id"], PDO::PARAM_INT);
$stmt->bindValue(3, $_POST["idstaff"], PDO::PARAM_INT);
$stmt->execute();
}
echo("Project" . " " . $_POST["nom"] . " ". "has been updated");
</code></pre>
| php | [2] |
5,570,251 | 5,570,252 | Partially constructed objects in non thread-safe Singleton | <p>In a multi-threaded environment, how can a thread possibly see a 'partially constructed object'? I understood that it is not thread-safe since multiple threads can create multiple instances. </p>
<pre><code>class LazyInit
{ private static Resource resource = null;
public static getInstance()
{ if (resource == null) { resource = new Resource(); }
return instance;
}
}
</code></pre>
| java | [1] |
5,826,090 | 5,826,091 | Transitive Animation From Android 2.2 to latest release | <p>I want to use animation compatible with android version 2.2 to 4.1.2. i tried using xml animation but it does not do not work under ginderbread. can someone tell me if there exist animation from left to right and right to left compatible with all android version and why ?</p>
<p>enter.xml</p>
<p>
<pre><code> android:shareInterpolator="false">
<translate android:fromXDelta="-100%" android:toXDelta="0%"
android:fromYDelta="0%" android:toYDelta="0%"
android:duration="2000"/>
</code></pre>
<p></p>
<p>leave.xml</p>
<p>
<pre><code> android:shareInterpolator="false">
<translate
android:fromXDelta="0%" android:toXDelta="100%"
android:fromYDelta="0%" android:toYDelta="0%"
android:duration="2000" />
</code></pre>
<p></p>
<p>i called it with this method but it isn't compabible with gingerbread</p>
<pre><code>overridePendingTransition(R.anim.leave,R.anim.enter);
</code></pre>
| android | [4] |
4,711,377 | 4,711,378 | define a struct inside a class in C++ | <p>Can someone give me a example about how to define a new type of struct in a class in C++.Thanks.</p>
| c++ | [6] |
1,992,679 | 1,992,680 | server side validation in asp.net? | <p>hi all as i know that asp.net provide server side validation control which has there own built-in logic, so i want to ask here can we extend built-in logic, i means suppose we use <strong>compare validator</strong> for comparing two file at this point it will validate according to there built-in logic, but i want to add some code for compare validator, is this possible.</p>
<p>According to my knowledge in asp.net every control treated as class which has data and code so according to inheritance or extend can we add some code in validation control ?</p>
| asp.net | [9] |
4,554,262 | 4,554,263 | why the following down casting is not working in Java: | <pre><code> ArrayList<classA> aList = /*I then fill this array*/
ArrayList<classB> bList = /* I then fill this array too*/
/*Now put them both in the following ArrayList of Objects*/
ArrayList<Object> myObjs = new ArrayList<Object>();
myObjs.add(aList);
myObjs.add(bList);
/*The following two lines however fails at run time*/
ArrayList<classA> x = (ArrayList<classA>) myObjs.get(0);
ArrayList<classB> x = (ArrayList<classB>) myObjs.get(1);
</code></pre>
<p>I just read from another thread that "Downcasting is allowed when there is a possibility that it succeeds at run time "</p>
<p>can any one please tell me the problem of the above code ?
thank you very much! </p>
| java | [1] |
3,428,555 | 3,428,556 | Access local variable from inner class | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/7423028/java-local-variable-visibility-in-anonymous-inner-classes-why-is-final-keywo">Java local variable visibility in anonymous inner classes - why is ‘final’ keyword required?</a> </p>
</blockquote>
<p>I have this function that creates some buttons. I'm trying to out.println <em>item</em> in the <em>doAction</em> method.</p>
<pre><code> for (int i = 0; i < itemsList.size(); i++) {
String item = itemsList.get(i);
TButton button = new TButton("" + item, 8, 415 + (25 * i), 90, 25) {
public void doAction() {
System.out.println("" + item);
}
};
this.framework.add(button);
}
</code></pre>
<p>I'm getting the error </p>
<pre><code>local variable item is accessed from within inner class
</code></pre>
<p>How do I do this the right way?</p>
| java | [1] |
4,126,838 | 4,126,839 | Display HTML Starting tag in Razor view block | <p>I want to display an HTML <code>div</code> tag in a <code>for</code> loop when two elements are true. Thus, I have to display the starting <code>div</code> like this:</p>
<pre><code>*.chtml below
Html.Raw("<div class=\"additional-options clearfix\" style=\"display: block;\">");
</code></pre>
<p>and display the end tag when the other element is true.</p>
<p>The result is that the div is NOT printed out in HTML</p>
<p>Is there other solutions?</p>
| c# | [0] |
5,440,418 | 5,440,419 | How to save new array? | <p>I am have an array:</p>
<pre><code>var data = [
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0]
];
</code></pre>
<p>And if I run my code this array changes to something like:</p>
<pre><code>var data = [
[1, 0, 0, 0, 0],
[1, 1, 0, 0, 0],
[1, 1, 1, 0, 0]
];
</code></pre>
<p>And my question: How to save or copy this new array?</p>
| javascript | [3] |
1,759,288 | 1,759,289 | memory leak issue | <p>I am loading images to <code>UITableViewCell</code> using the following function. But when I run my app with Debugger its getting crashed at <code>[pool release]</code> whenever I scroll my <code>UITableView</code>. What might I do to solve this? Thanks in advance. </p>
<pre><code>- (void) loadImage{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
imageURL = [imageURL stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
//NSLog(@"img url cell**** %@",imageURL);
self.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:imageURL]]];
//self.image = [NSData dataWithContentsOfURL:[NSURL URLWithString:imageURL]];
[pool release];
}
</code></pre>
| iphone | [8] |
5,531,520 | 5,531,521 | Accessing directories and files using python | <p>I want to analyze my data by a python script. The data are in multiple file and they are kept in different directories. Moreover, the name of the files in those directories are same but have different extension. I want to get my output just by providing a single input filename. for example</p>
<p>my filename is 'test' and this will be my input </p>
<p>the actual filenames are suppose test.data1, test.data2, test.data3, test.data4 and among them two input files such as test1.data1 and test2.data2 are kept in test1, test2 directories. The test3 and test4 are output directories.My aim is access those directories through the python script and then access those datafile. All the four directories are present in my machine but the two output files will be generated with extension .data3 and .data4 through the script. I have started with this following script but I can't complete it. Any help will be appreciating </p>
<pre><code>import re
import numpy
import os
import glob
filename =raw_input('enter the input file name: ')
lines = open(input.data1, 'r').readlines()
lines1 = open(input.data2, 'r').readlines()
outfile1=open(input.data3, 'w')
outfile2=open(input.data4, 'w')
</code></pre>
<p>Best
Sudipta</p>
| python | [7] |
1,722,805 | 1,722,806 | Java's equivalent to php.net? | <p>Where can I find useful resources to Java.</p>
<ul>
<li>all Java functions and syntax explaining (like php.net)</li>
<li>mac widgets with all functions gathered (like php function reference)</li>
</ul>
<p>Would be great if you had links to very good resources/tutorials to share.</p>
| java | [1] |
2,289,528 | 2,289,529 | C++ getenv always returns null value | <p>I have just added the environment variable "DataDir", but the getenv function still returns null value. </p>
<p>Here is my code:
const char *ret = getenv("DataDir");</p>
<p>I restarted my computer and it done.</p>
| c++ | [6] |
3,251,278 | 3,251,279 | splitting window in asp.net | <p>I want to split my web application window in two columns as 30% and 70% like we do in html,what should i do??</p>
| asp.net | [9] |
68,623 | 68,624 | How to Write Permission to System/app in Android | <p>how to give write <code>permission</code> to <code>system/app</code> folder
i have rooted my android device
i want to download the app and install in <code>system/app</code> folder</p>
<pre><code>Process p = Runtime.getRuntime().exec( "su" );
</code></pre>
<p>i had tried this command it ask for user <code>permission</code> and then it throws exception
<code>system/app</code> is read only file system</p>
| android | [4] |
1,002,761 | 1,002,762 | jquery: use (“parent > child”) with variables | <p>For example I have a <code><div class="first"></code> containig other <code><div></code> 's and selected first one and pushed him into variable</p>
<pre><code>variable = $('div.first')
</code></pre>
<p>And now I want something like this</p>
<pre><code>$(variable + " > div")
</code></pre>
<p>I know, it seems stupid but what if I had an array containig table rows and I need to access columns inside a specific row:</p>
<pre><code>var tableRows = $('table > tbody > tr');
var tableBodyCols = $(tableRows[i]+'> td'); // Doesn't work :(
</code></pre>
| jquery | [5] |
2,369,523 | 2,369,524 | Javascript-function build url | <p>I'm working on a project, and if I can get this to work it would save me a lot of time.
I want to build a url in my javascript function, with the variable as part of the url. (I'm not good at javascript so I can't explain it properly... but I can show what I've got so far). It's more complicated, but it looks something like this:</p>
<p>I have this function (I know it doesn't work :-) ):</p>
<pre><code>function art1(range) {
top.frames['infoframe'].location.href = 'http://url_part_1' + range + 'url_part_2.html';
}
</code></pre>
<p>And this in the body of my page:</p>
<pre><code><a href='some_other_url' onclick='some_other_functions();art1(C15)' >
</code></pre>
<p>So the result should be this url:</p>
<pre><code>http://url_part_1_C15_url_part_2
</code></pre>
<p>EDIT: Ok, additional problem: C15 is in another function, namely here:</p>
<pre><code>function changeText(){
var newHTML = "<td class='tas'><a href='_some_link_' target='changer'
onclick='setVisibility2();art1(C15)' (...)
</code></pre>
| javascript | [3] |
3,915,744 | 3,915,745 | UIImageView image not crisp with UIViewContentModeAspectFit | <p>I was under the impression that UIImageView scales your image accordingly, but I'm not sure if I understand it correctly. So I have an image in two places, one smaller than the other. In the area that is smaller, the picture is not crisp. What I do for this small area is:</p>
<pre><code>UIImageView *container = [[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
UIImageView *graphic = [[[UIImageView alloc] initWithFrame:CGRectMake(10, 10 , 120, 120)] autorelease];
[graphic setImage:[UIImage imageNamed:@"test.png"]];
graphic.contentMode = UIViewContentModeScaleAspectFit;
[container addSubview:graphic];
UIGraphicsBeginImageContextWithOptions(container.bounds.size, NO, 1.0);
[container.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
</code></pre>
<p>I basically have my graphic as a subview to the container. Like an image on a playing card, and then this method returns the viewImage back to me. But when I look at the image on the playing card, it is less crisp then the image elsewhere when I just have it in a larger imageview. Is there a reason for this? Thanks.</p>
<p>1st image, crisp:
<img src="http://i.stack.imgur.com/7pBb0.png" alt="enter image description here"></p>
<p>2nd image, not as crisp:
<img src="http://i.stack.imgur.com/7a9zX.png" alt="enter image description here"></p>
| iphone | [8] |
3,691,087 | 3,691,088 | How to change the UTC Time | <p>I have developed my application in c#. In this application OPC Server returns the UTC Time automatically. But the issue is I want to change this UTC Time same as System Time. (The difference between System Time & UTC Time is 5.30)</p>
| c# | [0] |
2,752,878 | 2,752,879 | Android import package error | <p>I was trying to import some android packages,
for example:</p>
<pre><code> import android.os.Tools;
import android.os.SystemProperties;
</code></pre>
<p>I found errors occured because these packages have to be built up with the entire system.</p>
<p>However, can anyone tell me how to do it and correct me if my understanding is incorrect.</p>
<p>Thanks</p>
| android | [4] |
1,265,298 | 1,265,299 | Why use Service for background tasks? | <p>An activity can use AsyncTask or Handler framework for background work. Both will continue to work even after user has moved away from the activity that started them and the onDestroy for the activity has been called. In other words, an activity is fully capable of doing background work even after its GUI has been shutdown.</p>
<p>In this scenario, use of Service for background work seems like redundancy. What does Service bring to the table that an activity can not do? Thanks.</p>
| android | [4] |
3,923,895 | 3,923,896 | MySQL Query works in phpMyAdmin but not in php script | <p>I have a query that I have run in phpMyAdmin and it returns results but if I cut and paste the query into a php script on a webpage the query seems to run but nothing is shown on the page. It also doesn't finish loading the page. The page ends where my query starts. Is it possible that the execute time for a web based query takes too long versus a query run through phpMyAdmin? Here is the query:</p>
<pre><code>$query = "SELECT DISTINCT tblCertificates.WebReportedDt, tblInsHeader.name1, tblInsHeader.name2, tblQuotes.certnum, tblQBalloons.regnum
FROM ((`tblQuotes`
INNER JOIN `tblInsHeader` ON tblQuotes.insuredid = tblInsHeader.insuredid)
INNER JOIN `tblQBalloons` ON tblQuotes.quoteid = tblQBalloons.quoteid)
INNER JOIN `tblCertificates` ON tblQuotes.quoteid = tblCertificates.QuoteID
WHERE (((tblCertificates.WebReportedDt) IS NOT NULL)AND ((tblCertificates.web) = True) AND tblCertificates.WebReportedDt >= '".$MyDate."')
ORDER BY tblCertificates.WebReportedDt DESC , tblInsHeader.name1, tblQuotes.certnum, tblQBalloons.regnum";
$results = mysql_query($query) or die("Query Timed out");
while ($r = mysql_fetch_array($results)) {
extract ($r);
echo $WebReportedDt." - ".$name1." ".$name2." - ".$certnum." - ".$regnum."<br>";
}
</code></pre>
<p>The MyDate var is the current date (YYYY-mm-dd HH:ii:ss) in DATETIME format.</p>
<p>Any ideas would be helpful.</p>
<p>Thanks!</p>
| php | [2] |
614,138 | 614,139 | Is it possible to change DOM without using append() or appendTo() | <p>I am working on a script that utilizes jQuery UI's drag/drop functionality. When i drag an item from one area to another I would like to update the DOM by associating the element with the dropped area and not the original where it was created initially. I could use appendTo() but it creates a jump when I drop the item and i need it to remain in the position where it was dragged to. </p>
<p>Is there an alternative to update the DOM?</p>
| jquery | [5] |
2,956,431 | 2,956,432 | Jquery Iteration | <p>I have coded the following which I had hoped would iterate through and display (with delays) a series of elements. If fact it does different things in IE and FireFox but neither what I wanted!</p>
<p>Bill H</p>
<p>===========================================================================================</p>
<pre><code> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"></script>
<script language="JavaScript" type="text/javascript">
<!--
$(document).ready( function() {
$('#ulId').children().each(
function(){
//access to form element via $(this)
$('#dis').hide(2000).text($(this).text()).show(2000);
});
});
//-->
</script>
</head>
<body>
<ul id='ulId'>
<li><span class='a'>Some Text1</span><img src="http://www.old-picture.com/europe/pictures/Heisterbach-ruins.jpg" alt=""></li>
<li><span class='a'>Some Text2</span><img src="http://www.theodora.com/wfb/photos/syria/roman_ruins_palmyra_syria_photo_gov.jpg" alt=""></li>
<li><span class='a'>Some Text3</span><img src="http://www.cosmos.com/Common/Images/Destinations/delphi-ruins.jpg" alt=""></li>
</ul>
<div id='dis' style='background-color: red; color: white'></div>
</body>
</html>
</code></pre>
| jquery | [5] |
2,539,868 | 2,539,869 | How to get an IP address in C# code | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1069103">How to get my own IP address in C#?</a> </p>
</blockquote>
<p>I need to get the IP address of the system, where the application is running by C# code</p>
<pre><code>IPAddress[] ip = Dns.GetHostAddresses(Dns.GetHostName());
foreach (IPAddress theaddress in ip)
{
String _ipAddress = theaddress.ToString();
}
</code></pre>
<p>I am using this code, but this is giving a different result in a different operating system. For example, in Windows 7 it is giving "fe80::e3:148d:6e5b:bcaa%14"<br>
and Windows XP it is giving "192.168.10.93".</p>
| c# | [0] |
5,419,451 | 5,419,452 | How to add an icon image as hint to EditBox in Android | <p>I need to put the search image lens as hint in EditText. is it possible to do it in Android?</p>
<p>best regards,,</p>
| android | [4] |
5,175,587 | 5,175,588 | What makes something iterable in python | <p>What makes something iterable in python?</p>
<p>Is it possible for me to create an iterable class in Python? If so, How?</p>
| python | [7] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.