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 |
|---|---|---|---|---|---|
982,568 | 982,569 | After upgrading to 2.6.35-24 kernel, why does adb no longer list devices? | <p>When I first installed Ubuntu 10.10 64-bit, I was able to see a physical Android device (connected via USB) in the Android Device Chooser (launched from Eclipse). But, after upgrading my kernel from <code>2.6.35-22-generic</code> to <code>2.6.35-24-generic</code>, no devices are listed any more, and I am unable to see any results when running <code>adb devices</code> like so:</p>
<pre><code>$ ./adb devices
List of devices attached
$
</code></pre>
<p>I have tried booting in the previous kernel version, but I get some <code>udev</code> error, so I was hoping I could get it working with the newer kernel version.</p>
<p>I figured SO was the best place for this question, as it seems more developer related.</p>
| android | [4] |
5,854,326 | 5,854,327 | How to convert a SET back to a HASHMAP for display in customAdapter | <p>I am really stuck with this problem and would appreciate some help. </p>
<p>Firstly, I have a service running which contains a simple hashmap </p>
<p>ORIG_MSG_MAP is a hashmap with Integer,String key value pairs. The service has a method to return the contents of the hashmap as a set</p>
<pre><code>//get entries in the hash
public Set<Entry<String, Integer>> getNumbers() {
// TODO Auto-generated method stub
return ORIG_MSG_MAP.entrySet();
}
</code></pre>
<p>in my activity I am interacting with the service and then I call my constructor in customAdapter which needs to work with a hashmap not a SET</p>
<p>ACTIVITY</p>
<pre><code> /** Defines callbacks for service binding, passed to bindService() */
private ServiceConnection mConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName className, IBinder service) {
// We've bound to LocalService, cast the IBinder and get LocalService instance
LocalBinder binder = (LocalBinder) service;
mService = binder.getService();
mBound = true;
Set<Entry<String, Integer>> whatsup = mService.getNumbers();
</code></pre>
<p>----> The question marks should be a reference to a hash with key,value pairs <----
setListAdapter(new MyCustomAdapter(DynamicLists.this, R.layout.row, ???));</p>
<p>Constuctor for MyCustomAdapter he expects a hash</p>
<pre><code>public MyCustomAdapter(DynamicLists dynamicLists, int row, HashMap<String, Integer> map){
mData = map;
mKeys = mData.keySet().toArray(new String[map.size()]);
Log.d(TAG, "INSIDE ADAPTER constructor HELLO WORLD " + map.entrySet());
</code></pre>
<p>}</p>
<p>Can you please help me convert a set back to a hash </p>
<p>Thanks,</p>
<p>Graham </p>
| android | [4] |
1,544,111 | 1,544,112 | Opposite of finish() | <p>I know that finish() returns your activity back to your previous activity. Now I am curious if we are able to accomplish the opposite meaning forwarding back to the next activity that you backed off without doing an Intent. This is just a curiosity question.</p>
<p>Is this possible? </p>
| android | [4] |
1,149,804 | 1,149,805 | Given a cctor, can the assignment operator always be safely created by the compiler? | <p>I was thinking about the swap() idiom.</p>
<p>If we have a valid copy constructor, why cant the compiler generate a "swap" function behind the scene, by swapping the "this" pointers? </p>
<p>I am probably looking at this too simplistically, but i'm wondering why it cant be done.</p>
| c++ | [6] |
1,748,345 | 1,748,346 | android scrollview and scrollbar position | <p>i have a scrollview that contain a linearlayout ,my problem i need to give little margin on the right of the scrollbar of my scrollview ,ie scroll should visible inside the linearlayout not at the border.</p>
<pre><code><ScrollView
android:fillViewport="true"
android:orientation="vertical"
android:layout_width="match_parent"
android:scrollbarStyle="outsideOverlay"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:scrollbarTrackVertical="@drawable/scrollbattrack"
android:scrollbarThumbVertical="@drawable/scrollbarthumb"
android:fadeScrollbars="false"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/ListView"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent">
</LinearLayout>
</ScrollView>
</code></pre>
| android | [4] |
2,945,247 | 2,945,248 | Parsing Java syntax with regex | <p>I am currently developing a corrector for java in my text editor. To do so I think the best way is to use Pattern to look for element of java syntax (import or package declaration, class or method declaration...). I have already written some of these pattern:</p>
<pre><code>private String regimport = "^import(\\s+)(static |)(\\w+\\.)*(\\w+)(\\s*);(\\s*)$",
regpackage="^package(\\s+)[\\w+\\.]*[\\w+](\\s*);(\\s*)$",
regclass="^((public(\\s+)abstract)|(abstract)|(public)|(final)|(public(\\s+)final)|)(\\s+)class(\\s+)(\\w+)(((\\s+)(extends|implements)(\\s+)(\\w+))|)(\\s*)(\\{)?(\\s*)$";
</code></pre>
<p>It's not very difficult for now but I am afraid it will take a long time to achieve it. Does someone know if something similar already exists?</p>
| java | [1] |
5,873,992 | 5,873,993 | Executing a method dynamically | <p>Many times i am using code like this:</p>
<pre><code>public static void ExecuteMethod1InThread(string msg)
{
Thread t = new Thread(
new ThreadStart(
delegate
{
log(msg);
}));
t.IsBackground = true;
t.Start();
t.Join();
}
</code></pre>
<p>If you notice i am calling a method in a separate thread hoping it would be helpful in performance.</p>
<p>But I am wondering if it is possible to give the method name and parameters dynamically and have it execute it rather than creating blocks of code like above for every method call.</p>
<p>I know we could use reflection but it will affect the performance is my understanding.</p>
<p>I have also heard about anonymous delegates but i am not sure how they work.
Just wondering if anyone could enlighten.</p>
| c# | [0] |
4,268,676 | 4,268,677 | checking table rows in Javascript | <p>I'm using this JS function to dynamically add labels to a table, this function is called from a combo box selection index change, when user selects a new item, it should be added to label, I'm going to check current values of table (i.e. rows of table) and only add the new item if it is new, what should I do? how can I check existing items (labels) of table?</p>
<pre><code>var spanTag = document.createElement("span");
spanTag.id = document.getElementById('cmbDestinationUser').selectedIndex.toString();
var e = document.getElementById("cmbDestinationUser");
var strUser = e.options[e.selectedIndex].text;
spanTag.innerHTML = strUser;
var TR = document.createElement('tr');
var TD = document.createElement('td');
TD.appendChild(spanTag);
TR.appendChild(TD);
document.getElementById('tblReceivers').appendChild(TR);
</code></pre>
<p>thanks</p>
| javascript | [3] |
5,850,992 | 5,850,993 | Is there a way to open a link in a frame and suppress all popups on the external site? | <p>I'm wondering if it's possible to open a link to another site, in a frame (or by some other means), and suppress the 1-2 popups that load on the external site. </p>
| javascript | [3] |
1,828,398 | 1,828,399 | I want to pass intents to the children (items) of expandable list view using switch case. How do i do that? | <p>CODE</p>
<pre><code>public class Treklist extends Activity {
ExpandableListView treklist;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.treklist);
treklist=(ExpandableListView)findViewById(R.id.expandableListView1);
treklist.setAdapter(new MyAdapter(this));
treklist.setOnChildClickListener(new OnChildClickListener() {
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
// TODO Auto-generated method stub
String childclicked=MyAdapter.childList[groupPosition][childPosition];
return false;
}
});
}
</code></pre>
<p>My code structure is as given. Help me with a complete code. Thank you.</p>
| android | [4] |
3,331,452 | 3,331,453 | Messed up jQuery code not sending through AJAX post | <p>I am using <code>$.post()</code> to input some data into a server. Within the ajax file I want to add a 1 to a variable containing a number. However, when the data is put into the server, instead of adding a 1 it instead puts 1. I feel stumped by this. What am I doing wrong. I swear for a second I got it to work, then next thing I know it stops working. Here is the code.</p>
<pre><code>$liker = $_POST['likes'];
$likes = $liker + 1;
send_data_to_server($likes);
</code></pre>
<p>Update</p>
<p>I have figured out that the likes is not being sent through the ajax post. I will try to troubleshoot a solution since I see the jquery code is not acting right. Here is the code below if anyone wants to give it a shot while I troubleshoot it on my own.</p>
<pre><code>$('#submitter').click(function() {
var search_term = $('#band_request').val();
$.post('ajax_searchlike.php', {
search_term: search_term
}, function(data) {
/*this section is where I know the problem is
$('#like_temp_holder').append(data);
});
var likes = $('#like_temp_holder').val();
*/
$.post('ajax_send_band_request.php', {
likes: likes
}, function(data) {
$(data).appendTo("#response_from_request_verification");
});
});
< /script>
<div id="like_temp_holder"></div>
<div id = "response_from_request_verification"></div>
</code></pre>
| jquery | [5] |
122,021 | 122,022 | Is it a bad idea to search for app config file up the dir structure? | <p>I have a php app with a configuration file in its root. If I include it by it's absolute path, then I get a problem when I move the app elsewhere. If I include it by relative path, I get a problem when I move the file where the config is included. So, I've come up with something like this to search for the app config file down the directory structure. </p>
<pre><code>$relative_path = "";
for ($i=0; $i<6; $i++) {
if (file_exists($relative_path."config.php")) {
require ($relative_path."config.php");
break;
}
$relative_path .= "../";
}
</code></pre>
<p>Could this be a bad idea?</p>
| php | [2] |
4,318,469 | 4,318,470 | illegal forward reference in java | <pre><code> import java.io.*;
import jxl.*;
class Xlparsing
{
Workbook wb =wb.getWorkbook(new File(
"C:\\Documents and Settings\\kmoorthi\\Desktop\\ak\\new.xls"));
// Illegal forward reference What it means
Sheet st = wb.getSheet(0);
Cell cell1 = st.getCell(0,0);
String a1 = cell1.getContents();
public static void main(String s[])
{
System.out.println(new Xlparsing().a1);
}
}
</code></pre>
<p>Hi When i tried to extract data from excel sheet illegal forward reference error comes in the file object creation please resolve this . Thanks in Advance</p>
| java | [1] |
2,360,243 | 2,360,244 | php auto generate code on the same file | <p>The following code generates a new php file playlist.php which contains the code as in $start $result variable</p>
<pre><code>$path = "./files/";
$path2="http://".$_SERVER['SERVER_NAME'].dirname($_SERVER["PHP_SELF"])."/files/";
//echo $path2;
$folder = opendir($path);
$start="<asx version='3.0'>\n<title>Example ASX playlist</title>";
$Fnm = "./playlist.php";
$inF = fopen($Fnm,"w");
fwrite($inF,$start."\n");
while( $file = readdir($folder) ) {
if (($file != '.')&&($file != '..')&&($file != 'index.htm')){
$result="<entry>\n<title>$file</title>\n<ref href='$path2$file'/>\n<param name='image' value='preview.jpg'/>\n</entry>\n";
fwrite($inF,$result);
}
}
fwrite($inF,"</asx>");
closedir($folder);
fclose($inF);
</code></pre>
<p>I want to generate the same code in the same file which contains this code on a specified line number
is this possible ?</p>
<p>The above php script generates the following code on a new file
<a href="http://tinypaste.com/ff242cd6" rel="nofollow">http://tinypaste.com/ff242cd6</a></p>
| php | [2] |
3,507,214 | 3,507,215 | Alternative ways to instantiate a class in Python | <p>I am currently writing my python classes and instantiate them like this</p>
<pre><code>class calculations_class():
def calculate(self):
return True
Calculations = calculations_class()
</code></pre>
<p>I was wondering if I was doing this correctly, or if there were any other ways to instantiate them. Thanks!</p>
| python | [7] |
1,725,800 | 1,725,801 | css has no effect in my Masterpage | <p>I have a Masterpage and I want to bind a part of this master page to a *.css file but no success.this is my Masterpage code:</p>
<pre><code><head runat="server" >
<title></title>
<link href="~/Styles/Test.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder ID="HeadContent" runat="server" >
</asp:ContentPlaceHolder>
</head>
<body>
<form runat=server>
<body>
<table width=100% border=1>
<tr width=100%>
<td ></td>
<div class=mainbody>
<td width=80% align=center>
<asp:ContentPlaceHolder ID="MainContent" runat="server"></asp:ContentPlaceHolder>
</td>
</div>
<td ></td>
</tr>
</table>
</body>
</form>
</body>
</code></pre>
<p>and in my css file I have:</p>
<pre><code>body
{
}
mainbody
{
background-color:#a0ccff
}
</code></pre>
<p>coild you please tell me,why it doesn't work?</p>
| asp.net | [9] |
5,908,091 | 5,908,092 | jQuery, creating an HTML block that I can insert into the page | <p>I have the following html:</p>
<pre><code><div id="box">
<span>stuff.....</span>
</div>
</code></pre>
<p>What i'd like to do is create a JavaScript variable with this html... Then with jQuery be able to insert that into the page with something like <code>$('#contentCol').html(mystuff)</code></p>
<p>Is there an elegant way to do this rather than a long string of html?</p>
| jquery | [5] |
3,294,706 | 3,294,707 | BroadcastRecievers and PopUps | <p>I'm using a Broadcast Receiver to intercept a phone call. I want to overlay the default incoming call screen with the name of the caller. I have an application with a database that maintains phone numbers separately from my contacts.</p>
<p>I am intercepting the call just fine, but when I display the popup, it doesn't overlay on top of the default incoming call screen. The incoming call screen opens up, then is replaced by my application (it goes to the last activity that was open) and overlays the popup there.</p>
<p>What am I doing wrong?</p>
<p>My Call Reciver:</p>
<pre><code>public class CallReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
if (state.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
Intent i = new Intent(context, IncomingCallPopup.class);
i.putExtras(intent);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
context.startActivity(i);
}
}}
</code></pre>
<p>My popup Activity:</p>
<pre><code>public class IncomingCallPopup extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
//getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.call_popup);
String phoneNumber = getIntent().getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER);
TextView text = (TextView)findViewById(R.id.text);
text.setText("Incoming call from " + phoneNumber);
}
}
</code></pre>
<p>What am I missing?</p>
| android | [4] |
1,275,286 | 1,275,287 | Under windows , we frequently use event to coordinate threads, under java, is there any equivalent mechanism? | <p>Under windows , we frequently use event to synchronize threads. Under java, is there anything equivalent? </p>
| java | [1] |
2,389,736 | 2,389,737 | How to use new API elements like Switch so, that the app is compatible with older Android version? | <p>I want to use new UI elements like Switch for new Android devices, and by older devices I would use something else like Button.</p>
<p>I have created to layouts</p>
<pre><code>~/res/
layout/main.xml
layout-v14/main.xml
</code></pre>
<p>that has different elements like Button in <code>layout/main.xml</code> and Switch in <code>layout-v14/main.xml</code></p>
<p>But how can I add different elements in the Activity, without to get Exception like</p>
<pre><code>Could not find class 'android.widget.Switch' ...
</code></pre>
| android | [4] |
3,160,457 | 3,160,458 | Counting Number Of Classifieds In Category | <p>I have a table <code>categories</code> that has: <code>id, name, subcategory_id, parent_id</code>. Another table <code>classifieds</code> that has: <code>classified_id, title, description, category_id</code>.</p>
<p>I am trying to to pull numbers of classifieds in each category. So it will look like this.</p>
<ul>
<li>Accessories(10)</li>
<li>Cars(15)</li>
<li>Dating(12)</li>
</ul>
<p>I gave it a try like this:</p>
<pre class="lang-php prettyprint-override"><code>enter $catquery = mysql_query("SELECT * FROM categories WHERE sub_id = '0' ORDER BY name ASC"); here
enter $catrows = mysql_num_rows($catquery); here
enter $catrows = mysql_num_rows($catquery); here
enter $query = "SELECT category_id, COUNT(title) AS `total` FROM classifieds WHERE classified_id = 'category_id' "; here
enter $result = mysql_query($query); here
enter while($row = mysql_fetch_assoc($result)){ $num_items_in_category[$row['category_id']] = $row['total']; here
enter } echo "<li><a href='category.php?cat=".$row['id']."'>".$row['name']. $row['total']. "</a></li>"; here
</code></pre>
<p>Thanks fellas</p>
| php | [2] |
5,128,679 | 5,128,680 | is solving these kind of problem important in programming | <p>We're learning C++ at school, we got to <code>for</code>, <code>while</code> etc.
We always keep having questions like</p>
<p><strong>Make a program that get the next output and use for in it</strong></p>
<p><code>1 3 5 7 9 11</code></p>
<p>Would it be a problem if one knows all the codes in some language but can't think to solve this kind of problems?</p>
| c++ | [6] |
3,065,029 | 3,065,030 | asp.net LoginView keeps redirecting to default.aspx, how to change? | <p>I have a LoginView control on my homepage, when i click 'Login' it goes to the log in page. When the details are authenticated, it redirects to default.aspx, I don't have a default.aspx - where can I change this?</p>
<p>This is the only thing I can see wrong:</p>
<pre><code>FormsAuthentication.RedirectFromLoginPage(Login1.UserName, Login1.RememberMeSet);
</code></pre>
| asp.net | [9] |
431,549 | 431,550 | Autoscroll to the BOTTOM of the page in a set time window in Javascript | <p>I'm using Greasekit on Fluid.app. In other words, I'm using Javascript.</p>
<p>I would like to scroll to the <strong>bottom</strong> of the page IF the time is between 1900-1910 (i.e. between 7pm and 7:10pm)</p>
<p>So, this question has two components, would be so grateful if someone could help me make the code for this.</p>
<p>Thanks!</p>
| javascript | [3] |
5,039,320 | 5,039,321 | Get the ID of this from an onClick(this) in a button? | <p>Sorry Copy Paste error, the functions now match</p>
<p>I have some simple code and I cannot seem to get the id of the clicked item?</p>
<pre><code><input type="button" name="remove_grouping" value=Remove Group" onClick="removeGrouping(this);"/>';
</code></pre>
<p>Then a simple JS Function</p>
<pre><code>function removeGrouping(src)
{
alert(src.id);
}
</code></pre>
| javascript | [3] |
4,596,958 | 4,596,959 | Creating an accurate php search engine to search database | <p>Ok, I attempted at making my own search function which doesnt work very well. </p>
<p>It consists of eliminating useless words such as "how" "you" "to" then using a premade Stemmer class that reduces words to their root so "Appointments" searches "appoint"</p>
<p>However in the end I'm really only searching keywords and the results are not very accurate.</p>
<p>Are there open source search engines that i can implement for free?</p>
| php | [2] |
3,711,544 | 3,711,545 | BufferedReader not returning null at the last line | <p>The last line contains nothing , yet it does not return <code>null</code>. Code is as follows</p>
<p>When debug using <code>Eclipse</code>, I saw <code>line= ""</code> in debug mode, how do I prevent this from happening</p>
<pre><code>BufferedReader br = new BufferedReader(new FileReader(file));
String line;
while ((line = br.readLine()) != null) {
// process the line.
}
br.close();
</code></pre>
| java | [1] |
1,201,780 | 1,201,781 | back in navigationController | <p>When I click the table row, go back to previous view without clicking back button.</p>
<p>I try </p>
<pre><code>[self.navigationController dismissModalViewControllerAnimated:YES];
</code></pre>
<p>it's not working. How to dismiss pushViewController ?</p>
| iphone | [8] |
5,127,321 | 5,127,322 | What's wrong with this if-statement in php | <pre><code>if ((isset($post["username"]) && isset($post["password"])) && (!empty($post["username"]) && !empty($post["password"])) && ($post["username"] == "something" && $post["password"] == "something"))
{
}
</code></pre>
<blockquote>
<p>Error: syntax error, unexpected T_IF in [file_name here but I rather not expose the file path and name]</p>
</blockquote>
<p>I know it is kinda complicated but what's wrong with this if-statement as I receive the error above. Although I checked several times.</p>
| php | [2] |
2,877,897 | 2,877,898 | Detect difference between & and %26 in location.hash | <p>Analyzing the location.hash with this simple javascript code:</p>
<p><code><script type="text/javascript">alert(location.hash);</script></code></p>
<p>I have a difficult time separating out GET variables that contain a & (encoded as %26) and a & used to separate variables.</p>
<p>Example one:</p>
<ul>
<li>#code=php&age=15d</li>
</ul>
<p>Example two:</p>
<ul>
<li>#code=php%20%26%20code&age=15d</li>
</ul>
<p>As you can see, example 1 has no problems, but getting javascript to know that "code=php & code" in example two is beyond my abilities:</p>
<p>(Note: I'm not really using these variable names, and changing them to something else will only work so long as a search term does not match a search key, so I wouldn't consider that a valid solution.)</p>
| javascript | [3] |
4,746,636 | 4,746,637 | PHP Undefined offset: -1 in comparison loop | <p>I am receiving this error <strong>Undefined offset: -1.</strong> </p>
<p>I am pretty sure it is because I am comparing a value of an array index with the value of the previous index, so on the first iteration its failing because there is no -1 index.</p>
<pre><code>for ($i=0; $i<$rows_n; $i++)
{
formatTR($i, $rows, 'YEAR');
}
// Function
function formatTR($i, $rows, $year)
{
if ($rows[$year][$i] != $rows[$year][$i-1] ) {
print "<tr class='header-year-tr'><td colspan='2'>{$rows[$year][$i]}</td></tr>";
}
print "<tr>";
}
</code></pre>
<p>The function checks to see if the previous value of $rows[year][i] is the same as the previous $rows[year][i-1]. If its different, it prints out a formatted < TR >.</p>
<p>Seems like a way to avoid this error would be to first check if the value of $i is zero, but I'm wondering if there is another way. Possibly in my if conditional.</p>
| php | [2] |
3,033,294 | 3,033,295 | Is ther any way I can maintain password history of a user in ASP.Net application? | <p>I need to view users password history in ASP.net application.</p>
<p>is there any way to achieve it?</p>
| asp.net | [9] |
2,353,538 | 2,353,539 | Is android:id specific to xml file or the whole project? | <p>Is the android:id="@+id/somevalue" specific to the xml file in which it is defined, or the whole android project?</p>
<p>If it is project-wide, it seems like I have a lot of id's to come up for text fields. For example I have to name my "title" field like "title1" and "title2" etc...</p>
| android | [4] |
5,254,051 | 5,254,052 | How to group Enum values? | <p>How can I group Enum values?<br>
Assume I have an enum like</p>
<pre><code>public enum Colors
{
LightBlue,
LightGreen,
DarkGreen,
Black,
White,
LightGry,
Yellow
}
</code></pre>
<p>Now I want to define some groups of colors, e.g. the light colors (LightBlue, LightGreen, White, LightGray, Yellow) and dark colors (Black, DarkGreen).<br>
So I can ask for groups at different places in my code.<br>
If I remember correctly my Java time I just could add methods to the enums in Java. I think that is not possible in C#. But maybe there are other ways.</p>
<p>Edit1: Of course I can add a Utility class with static member like <code>IsADarkColor(Colors c)</code>. But I would like do it without an additional class because I could forget that related class when I need that feature.</p>
| c# | [0] |
4,211,798 | 4,211,799 | Can I use like this using jquery? | <pre><code> $('tr td:first-child').click(function() {
var value = $(this).text();
// $("#showgrid").load('/Product/List/Item/' + value);
$("#showgrid").load('<%= Url.Action("Item", "List") %>/' + n + "?q=" + value);
});
</code></pre>
<p>Can I use like this to execute List Item Action result? </p>
<p>what is the best way to send the value with the URL? the above commented URL working fyn for me is there any way other way to use this?></p>
<p>Thanks</p>
| jquery | [5] |
3,886,084 | 3,886,085 | in javascript, argument order of evaluation and delayed evaluation | <ol>
<li><p>if <code>function( arg1, arg2 )</code>, am I correct in believing <code>arg1</code> is guaranteed to evaluated before <code>arg2</code> (unlike classic C for example)?</p></li>
<li><p>is there any way to have a function where the arguments are not evaluated, but rather evaluated on demand? for example, <code>if( cond1 || cond2 )</code> evaluates <code>cond2</code> if and only if <code>cond1</code> is false. is it possible to write our own <code>if</code>-like function?</p></li>
</ol>
<p>for example, could I write a function like oracle's <code>nvl( arg1, arg2, ... )</code>, which returns the first non-null argument, evaluating them lazily. in a regular function call, all arguments are evaluated before the function body is executed.</p>
| javascript | [3] |
1,136,655 | 1,136,656 | after removing attribute button is still perfoming actions in jQuery | <p>It's kinda simple piece of code, so i won't explain what it does.</p>
<p>Problem here is after I click the <code>.likes.1</code> div and then clicking <code>.likes.2</code> div and then again <code>.likes.1</code> it ends up showing me the <code>.article-info</code> div.</p>
<p>So even the attribute surname removed it stills perform it's task.</p>
<p>Why is that so ?</p>
<pre><code>$(document).ready(function() {
$(".likes.1[surname|='first']").click(function() {
generate('information');
$(this).removeAttr('surname');
$(".article-info").show();
});
$(".likes.2").click(function() {
$(".article-info").hide();
});
</code></pre>
| jquery | [5] |
5,908,162 | 5,908,163 | jQuery autosuggest plugin not displaying results | <p>I'm using <a href="http://code.drewwilson.com/entry/autosuggest-jquery-plugin" rel="nofollow">the plugin by Drew Wilon</a> to search a DB table of city names when the user starts typing to a text field. Via Firebug I can see that data is returned in proper JSON format. So AFAIK everything is working ok on the PHP end. </p>
<p>When results are returned, they should be displayed in a div below the textfield. I can see this div in Firebug but it remains empty. It used to work fine so I'm thinking it's a small gotcha that I'm just not seeing.</p>
<p>How can I get the results to display in this div?</p>
<p>Test page is <a href="http://sub.domain.com/user/signup" rel="nofollow">here</a> - in the middle column is a City field. Type for example "ham" and you'll see the returned data in JSON format in Firebug.</p>
<p>JS:</p>
<pre><code>$("input#city").autoSuggest("http://sub.domain.com/survey/search_city", {
selectedItemProp: "response",
selectedValuesProp: "id",
searchObjProps: "response",
startText: "",
minChars: 2,
selectionLimit: 1,
});
</code></pre>
<p>Returned JSON sample</p>
<pre><code>[{"response":"Hamilton (Victoria, Australia)","id":"18860_14"},{"response":"Hamilton (Hamilton Municipality, Bermuda)","id":"6042_27"},{"response":"Hamilton (Ontario, Canada)","id":"3460_43"},{"response":"Hami (Xinjiang, China)","id":"6156_49"},
</code></pre>
| jquery | [5] |
780,263 | 780,264 | jQuery functions retrieving and passing data | <p>If I have a function in jQuery that holds some values:</p>
<pre><code>(function ($) {
$.fn.myFunction = function() {
var option1 = 'green';
var option2 = 'green';
var option3 = 'green';
return option1, option2, option3;
}
$.fn.myFunction2 = function(option1, option2, option3) {
}
}) (jQuery);
</code></pre>
<p>If I wanted to pass the data from <code>myFunction</code> to <code>myFunction2</code>, how do I achieve it? And if I was to call the script in the following manner <code>var data = $('div').myFunction();</code> how do I get access to each <code>option</code>?</p>
<p>Reading through a few books on the subject but its not being explained that well.</p>
<p>EDIT:</p>
<p>I would want to use the returned data in the following way:</p>
<pre><code>var options = $('article').myFunction();
$('article').myFunction2(options);
</code></pre>
<p>but I would also like to be able to pull out individual items</p>
<pre><code>var options = $('article').myFunction();
$('article').myFunction2(options[option2]);
</code></pre>
| jquery | [5] |
96,814 | 96,815 | Should extension methods have a prefix? | <p>From what I have read about extension methods, you will run into problems if the base class decides to add a method with the same name as your extension. For a specific class it is generally not to hard to pick a name to avoid clashes, however extension methods can be added to interfaces which adds infinitely more potential for conflicts.</p>
<p>In Objective-C (with their version, categories), this problem is avoided by adding a prefix before each method. I know we can define extension methods in namespaces so that we can control whether they are imported or not, but this only solves the problem of clashes between extension methods, rather than clashes between an extension method and the base class.</p>
<p><strong>Update:</strong></p>
<p>Nobody, actually mentioned this, but extension methods <a href="http://stackoverflow.com/questions/474074/overriding-extension-methods">aren't virtual</a>. That means if you can i.myExtension() on an interface i, then it will always call the interface classes method, so the subclass method (which could have different intent) won't be called. So, overall, using extension methods is quite safe.</p>
| c# | [0] |
309,693 | 309,694 | why onBackPressed() always go back previous activity when i press physical back button? | <p>After processed some activity, i want to exit the application.I implemented</p>
<pre><code> public void onBackPressed() {
System.exit (0);
}
</code></pre>
<p>But my application is back to previous activity..I need exit my application completely.How to do that?
I had searching a lot of article but it not working on that.
My android is 2.3</p>
| android | [4] |
4,320,656 | 4,320,657 | Time Code in Java | <p>I am trying to create a code that calls the system time and updates it every minute. Can anybody give me an example that will steer me in the right direction? thanks</p>
| java | [1] |
3,430,737 | 3,430,738 | How to wrap content of a li element with html tag in jQuery? | <p>How can I wrap content of li element using jQuery? My HTML code looks like this:</p>
<pre><code> <div id="ident">
<ul>
<li>lorem ipsum dolor sit amet</li>
<li>lorem ipsum dolor sit amet</li>
<li>lorem ipsum dolor sit amet</li>
<li>lorem ipsum dolor sit amet</li>
<li>lorem ipsum dolor sit amet</li>
<li>lorem ipsum dolor sit amet</li>
</ul>
</div>
</code></pre>
<p>Thanks in advance!</p>
| jquery | [5] |
2,143,017 | 2,143,018 | Make letter after apostrophe small with Javascript | <p>I'm trying to turn this text:</p>
<blockquote>
<p>She’S Saying It’S Time To 'Find A Solution'</p>
</blockquote>
<p>into this text:</p>
<blockquote>
<p>She’s Saying It’s Time To 'Find A Solution'</p>
</blockquote>
<p>only using Javascript.</p>
<p>I tried using:</p>
<pre><code>str.replace(/'S /,"'s ");
</code></pre>
<p>but it doesn't seem to work.</p>
<p>Any ideas? Please not that the whitespace after the S is an important heuristic.</p>
| javascript | [3] |
5,589,636 | 5,589,637 | Next/Previous navigation for an ASP.NET page without using Master/Detail? | <p>Let's say I have a detail record page that loads a single record (the user would have chosen this record from a GridView). The users want Next/Previous button functionality so they don't have to hit the back button to go back to the grid (the grid has a lot of records so they "forget" what position they were at); basically like an old MS Access record form with the navigation buttons at the bottom (although I'm only interested in Next/Previous, I don't need first/last/new).</p>
<p>Is there a relatively simple way to accomplish this short of stuffing the entire list of objects from the grid into the ViewState or Session (and even then, it's not ordered so I'd have no way of knowing what the "next" record is)? We do not want a Master/Detail type of setup where the detail record is below the grid, it <em>must</em> be a separate page.</p>
| asp.net | [9] |
2,746,019 | 2,746,020 | CakePHP Undefined index when looking for query string | <p>I get an error saying <code>'Undefined index: redirect'</code> </p>
<p>with this code:</p>
<pre><code> $came_from_site = $_GET['redirect'];
if($came_from_site != "true")
{
echo 'USER TYPED IN URL MANUALLY';
}
</code></pre>
<p>The error happens when the query string doesn't exist.... So I guess I need to check if a) it exists and then if it does b) check that it's value is true</p>
<p>Can anyone help?</p>
<p>Thanks</p>
| php | [2] |
276,623 | 276,624 | Initializing variable with declaration | <p>I am a C# developer and I am highly habituated to initialize a variable in the same declaration statement as </p>
<pre><code>ClassA myClass = new ClassA();
</code></pre>
<p>To my point of view, this practice is concise, more readable and looks neat.</p>
<p>Now, I am learning java for android. So far whatever java snippet I am facing, everywhere I see that the snippet writer is using code like this:</p>
<pre><code>ClassA myClass;
myClass = new ClassA();
</code></pre>
<p>Now, I understand that, my question may sound silly, but really curious to know, is there any impact of effect or is there any difference between these 2 approach ? I mean, if I compile a code in java like this :</p>
<pre><code>ClassA myClass = new ClassA();
</code></pre>
<p>is there anything about it that matters internally ? I just want to be sure that I am not doing anything wrong.</p>
| java | [1] |
925,157 | 925,158 | Assigning classes in Java | <p>I have</p>
<pre><code> SomeClass sc1 = new SomeClass();
SomeClass sc2 = sc1;
</code></pre>
<p>Will sc2 change due to sc1(when sc1 is changed) ?
If not, how to do it?</p>
| java | [1] |
5,321,134 | 5,321,135 | APC & PHP.INI for SE4 | <p>I am running Social Engine 4 and have been having a hard time getting APC installed and was wondering are there any step by step instructions as to how to do this?</p>
<p>I had my brother help me a while earlier today and I think we have got it licked except for the fact that I do not know what to put in the php.ini file to call on APC. Any thoughts or suggestions?</p>
<p>Thanks</p>
| php | [2] |
5,449,328 | 5,449,329 | loose date when change orientation | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/5618897/when-i-change-the-orientation-from-portrait-to-landscape-my-calculated-result-is">when i change the orientation from portrait to landscape my calculated result is disappearing. how to resolve it?</a><br>
<a href="http://stackoverflow.com/questions/5657828/edittext-is-losing-users-input-when-rotating-android-phone">EditText is losing users' input when rotating android phone</a> </p>
</blockquote>
<p>In my application I have for example one EditText. In portrait mode I type the letters and when I rotate my device in I am seeing empty Edittext. Is there any way to do this? Any help please?</p>
| android | [4] |
3,498,654 | 3,498,655 | Are there other Type in addition to the class to be called by hasattr | <p>For code:</p>
<pre><code>class a(object):
a='aaa'
b=a()
print hasattr(a,'a')
print hasattr(b,'a')
</code></pre>
<p>who can be called by hasattr except 'class somebody'?</p>
<p>Thanks!</p>
| python | [7] |
1,479,017 | 1,479,018 | Delete /data/data folder | <p>My application is a system application. What I need is to perform clean data for all other applications. As far as I know, data for all application store in /data/data. Is there any way to remove all folders/files in /data/data programatically?</p>
<p>I know how to do that from adb:</p>
<pre><code>adb shell
# rm -r /data/data
</code></pre>
<p>And this is how I'm trying to do it in the code:</p>
<pre><code>Process process;
try {
process = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(process.getOutputStream());
os.writeBytes("mount -o remount,rw -t rfs /dev/stl5 /data; \n");
os.writeBytes("rm -r /data/data; \n");
os.writeBytes("mount -o remount,ro -t rfs /dev/stl5 /data; \n");
return;
} catch (IOException e) {
e.printStackTrace();
}
</code></pre>
| android | [4] |
5,511,947 | 5,511,948 | Android: Switching off mobile network usage on 2.1 | <p>In Android 2.3 (and maybe 2.2) there is widget to switch off mobile network. Same widget where you can switch off WLAN or GPS. Can I somehow switch off mobile network on an Android 2.1 phone? The provider used charges like hell and mobile network is not needed.</p>
<p>Thanks, A.</p>
| android | [4] |
3,056,632 | 3,056,633 | Android , reading files from folder using relative path | <p>I am creating folder X in my android app , which has list of files .This list needs to displayed to user for selection , Whats the relative path used to access list of files located in folder X. I tried /X , ./X but it does not not return the list of files in that folder. </p>
<p>Asset can one of the option , but when i created new folders under asset folder , it did not recognize it , i.e getAssets().list("") did not return these new folders??? aren new folders allowed in asset ? do we have to stick to image ,sound and webkit?</p>
<p>Thanks
Kavitha</p>
| android | [4] |
5,351,728 | 5,351,729 | How to show on screen the cursor position on an android tablet or smartphone? | <p>I would like to be able to show on the screen something like the mouse cursor on PC's. Does anyone know how to do it with an app or by modifying the options on the device?</p>
| android | [4] |
2,809,752 | 2,809,753 | What are unused variables set to? | <p>Particularly for <code>localStorage.foo</code></p>
<p>For Safari it is set to:</p>
<pre><code>undefined
</code></pre>
<p>For Firefox it is set to:</p>
<pre><code>null
</code></pre>
<p>Does anyone know the values for Chrome and IE?</p>
<p>Why is it different? Just random choices by browser programmers?</p>
| javascript | [3] |
1,187,710 | 1,187,711 | has there ever been an iPhone 4 without retina display | <p>I'm not able to find information about that on the web. Has anyone out there seen such an iPhone 4? Or does anybody know for sure?</p>
| iphone | [8] |
5,312,297 | 5,312,298 | JQuery Unbind event when removing a class | <p>So I have a couple of divs with a class "turn". Then in Jquery I have</p>
<pre><code>$(".turn").click(function(){
...some code...
if (..) $(this).removeClass("turn");
});
</code></pre>
<p>which I expect to remove the handler, so I can't click on it anymore. But I still want to be able on the other divs that has that class.
This is not working (I believe is because JQuery doesn't remove the handlers when a class is removed)
I've also tried with </p>
<pre><code>$('.turn?).live(click,...) and $(this).die()
</code></pre>
<p>and </p>
<pre><code>$('.turn?).bind()/$(this).unbind()
</code></pre>
<p>But neither of those seems to work.
Can I get some hint about how to do this?
Thanks</p>
| jquery | [5] |
3,647,106 | 3,647,107 | Checking to see if a number ends in 5? | <p>I'm trying to define a function that takes 2 parameters, adds them up, and if the sum of the two parameters ends in 5, it reports a 2. If it doesn't end in 5, it returns 8.</p>
<p>Any ideas?</p>
<p>I was thinking of doing an if statement, but I'm confused as to how I would check if a number ends in 5( or is 5).</p>
<p>Thanks for your help, trying to teach myself how to program is so difficult yet so rewarding :)</p>
| python | [7] |
1,562,947 | 1,562,948 | Use name of object to run a function | <p>I would like to do the following in JavaScript:</p>
<pre><code>var myObject.name = myString;
function newFunction(){myObject.name}
</code></pre>
<p>Is it possible to use a string as the contents of a function? How would you convert it to be usable?</p>
| javascript | [3] |
976,344 | 976,345 | How to change the default language of ANDROID Emulator? | <p>How to change the language of the Emulator, by default i am getting Chinese while filling a form. So please HELP me to get out of this??? Thanks.</p>
| android | [4] |
3,967,184 | 3,967,185 | Using XML in Android for development | <p>Hi,</p>
<p>How to use XML code instead of Android code to be used regarding UI development? In what manner XML is different from ordinary Android code?</p>
| android | [4] |
1,197,538 | 1,197,539 | load dlls at runtime for 32 bit and 64 bit | <p>I need to load dlls at runtime for 32 bit and 64 bit. how do i determine 32bit and 64bit.</p>
<p>Thanks,
kam</p>
| c++ | [6] |
1,109,216 | 1,109,217 | TextView gravity | <p>Has anyone tried to write his own implementation of <em>ViewGroup</em> with some TextViews in it?</p>
<p>I have a problem, that TextViews in such an implementation don't respect the gravity property <code>TextView.setGravity(Gravity.CENTER)</code> and text is positioned in the top left corner.</p>
<p>Can anyone help me find out why?</p>
<p><strong>EDIT:</strong></p>
<p>Ok. nevermind, I figured it out on my own already.</p>
<p>If enyone is interested, I just overwrote method <code>onMeasure()</code> (for all my TextViews) and changed call from <code>super.onMeasure()</code> to <code>setMeasuredDimension(int, int)</code> and gravity started to work normally.</p>
<p>Basically, in my custom layout I use the following class to display text:</p>
<pre><code>private static class GravityTextView extends TextView {
public GravityTextView(Context context) {
super(context);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setMeasuredDimension(widthMeasureSpec, heightMeasureSpec);
}
}
</code></pre>
| android | [4] |
1,578,913 | 1,578,914 | Join String list elements with a delimiter in one step | <p>Is there a function like join that returns List's data as a string of
all the elements, joined by delimiter provided?</p>
<pre><code> List<String> join; ....
String join = list.join('+");
// join == "Elem 1+Elem 2";
</code></pre>
<p>or one must use an iterator to manually glue the elements?</p>
| java | [1] |
507,340 | 507,341 | How to make all numbers go to two decimal places in python? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/6149006/display-a-float-with-two-decimal-places-in-python">Display a float with two decimal places in Python</a> </p>
</blockquote>
<p>How can I force all numbers in python to output two decimal places after them?</p>
<p>E.G. </p>
<p>0.5 should be 0.50</p>
| python | [7] |
5,084,765 | 5,084,766 | How do I get the generalized screen size? | <p><a href="http://developer.android.com/guide/practices/screens_support.html">http://developer.android.com/guide/practices/screens_support.html</a> states:</p>
<blockquote>
<p>Terms and concepts</p>
<p>Screen size Actual physical size,
measured as the screen's diagonal. For
simplicity, Android groups all actual
screen sizes into four generalized
sizes: small, normal, large, and extra
large.</p>
</blockquote>
<p>How do I programmatically get the generalized size of the device screen? The method or property I am looking for will return one of: small, normal, large, and extra large. (or const/enums that can be mapped to those)</p>
<p>Thanks.</p>
<p>-mz</p>
| android | [4] |
3,649,299 | 3,649,300 | Why javascript Function.caller nequal to function this | <pre><code> function T()
{
var t = this;
function Hello()
{
alert(arguments.callee.caller == t);//false
alert(Hello.caller == t); //false
//this is a Object
//but caller just a Function.
//How?
}
Hello();
};
T();
</code></pre>
<p>//-------------------- So,i work code: but i don't like the "property(this)".so...i need like caller Object.How coding?</p>
<pre><code>function property(owner)
{
var that = this;
this.def = function (name, setFunction, getFunction)
{
Object.defineProperty(owner, name, { set: setFunction, get: getFunction });
return that;
};
this.propg = function (name, value)
{
Object.defineProperty(owner, name,
{
set: function (value)
{
ErrorLog(name + "并没有实现属性设置器。");
}
, get: function ()
{
return value;
}
});
return that;
};
this.prop = function (name, value)
{
var fieldValue = value;
Object.defineProperty(owner, name,
{
set: function (value)
{
fieldValue = value;
}
, get: function ()
{
return fieldValue;
}
});
return that;
};
return that;
}
//#endregion
using('Sofire.Data', function ()
{
DataColumn = function (columnName, displayText)
{
var displayTextChanged = new EventObject();
property(this)
.def('DisplayTextChanged'
, function (value) { displayTextChanged.Add(value); }
, function () { return displayTextChanged; })
.propg('ColumnName', columnName)
.def('DisplayText'
, function (value)
{
displayText = value;
displayTextChanged.Raise();
}
, function () { return displayText; });
}
});
</code></pre>
| javascript | [3] |
2,751,799 | 2,751,800 | What is the best way to learn php? | <p>I'm new to php and I want to learn it because i want to build web applications. For ex: Facebook apps, mobile apps, my own ideas ..etc. What would be the best efficient way to learn PHP or which direction should i take? There are so many books, tutorial and articles out there that teaches you how to learn php and everyone thinks their way is the best way to learn. Is there a standard way so that you get to learn one level at a time? So far my experience with php is that I've created an E-commerce site and integrate with 3rd party shopping cart. </p>
| php | [2] |
4,649,430 | 4,649,431 | Element that scroll vertically and horizontally in android | <p>In (Android) Suggest me that to use which Element so that i can scroll the data on the screen in vertical direction when user is in portrait orientation and able to scroll horizontally when user is in landscape orientation.</p>
<p>And tell if i have to make it customized element.</p>
| android | [4] |
3,294,296 | 3,294,297 | Where can I find more information about int % 5? | <p>I'm wondering what int id = 5%2; does exactly and also look for similar things.</p>
<p>Reason:</p>
<p>I want to calculate by a number on which row / column the item should be standing.</p>
<p><strong>[Example]</strong></p>
<p>I have a grid which is 5x5. </p>
<p>If id = 05, it should be on the 1st row and the 5th column</p>
<p>If id = 10, it should be on the 2nd row and the 5th column</p>
<p>If id = 12, it should be on the 3rd row and the 2nd column</p>
<p>How you catch my drift!</p>
<p><em>(ps: feel free to edit my tags. Not sure what to put on this question)</em></p>
| c# | [0] |
5,058,880 | 5,058,881 | Jquery slideshow nav | <p>To all the good people here at stackoverflow, please I need some help with the flow of my jquery code. I have gotten the slideshow to work and decided to go a step further and add nav buttons/images.</p>
<p>in the code below, I am testing it out with one div first, the div will later become a picture or a button. anyways i have it so that when i click the div, the slideshow goes to the first image in the slide show.</p>
<p>Now the KEY ISSUE I am having is that this code works, but it takes five seconds after the click to go to the first image, because of the timeoutfunction.</p>
<pre><code>$("#slidecontrol2").click(function(){
next.removeClass('is-showing');
$('#container').children(':first').children(':first').addClass('is-showing');
});
setTimeout(slideShow, 5000);
</code></pre>
<p>This code is contained in the function slideShow to loop.</p>
<h1>slidecontrol2 above is a div below the slideshow that i will turn into a button (this is one of 3 divs that will be buttons, but i wanted to experiment for now with just the first div)</h1>
<p>I tried calling the function again after the click() function and before the timeout function, but it still takes 5 seconds and from there everything just goes crazy. </p>
| jquery | [5] |
3,725,706 | 3,725,707 | Converting a string into an array | <p>I have a string - something like</p>
<pre><code>$string = 'key1=value1, key2=value2, key3=value3';
</code></pre>
<p>How can I get an array from the given string like the following?</p>
<pre><code>$array = array(
'key1' => 'value1',
'key2' => 'value2',
'key3' => 'value3',
);
</code></pre>
| php | [2] |
776,346 | 776,347 | How does 'this' works in javascript? | <p>hi i am a little confusion on how exactly <code>this</code> works in javascript.Based on this example:</p>
<pre><code>var myFunction = function(){
function testMe(){
console.log(this) --------> DOMwindow
}
console.log(this) ---------> myFunction
}
var myvariable = new myFunction();
</code></pre>
<p>What is happening here?</p>
| javascript | [3] |
4,245,520 | 4,245,521 | I'm trying to use the GeoCoder API but my application (in the emulator) hangs whenever the getFromLocationName() method is called | <p>My Android Virtual Device is Google API's. Platform is 2.3 and the API is 9.</p>
<p>I'm trying to calculate the lat/lon of an address. I'm also using an AlertDialog to see if the program advances to the next line (I realize there are better ways than this).</p>
<pre><code>List<Address> foundGeocode = null;
String address = "1234 Valid Street city, state 98765";
foundGeocode = new Geocoder(this).getFromLocationName(address,10);//app hangs
displayAlert("This text is never displayed");//Alert Dialog
double first = foundGeocode.get(0).getLatitude();
double second = foundGeocode.get(0).getLongitude();
//Geocoder.isPresent() returns true
</code></pre>
| android | [4] |
5,102,409 | 5,102,410 | trouble with jquery deferreds | <p>jQuery's deferred's have never liked me, and I've never been fully able to understand them. I want to be notified when a number of deferreds are ALL done. The real issue is that the number of deferreds won't be the same each time. So I can't do this:</p>
<pre><code>$.when(d1, d2, d3).done()
</code></pre>
<p>I tried <code>$.when.apply(this, [d1, d2, d3])</code> but it immediately fires when just one is completed. </p>
<p>Also, I absolutely need a way to pass an array of deferreds. This array is dynamic and will have a different number of deferreds each time my function executes.</p>
<p>I know there is probably an obvious solution, but I am oblivious to it. </p>
| jquery | [5] |
2,280,639 | 2,280,640 | jQuery.bind unbind, multiples instances of classes | <p>I have multiple elements with the same class "clickable", i'm binding all these classes with:</p>
<pre><code> $('.clickable').bind('click', function()
{
$(this.id).html('clicked');
}
</code></pre>
<p>I'm assuming the bind binds each element with the class "clickable" individually.
Then within this bind-function, I want to unbind the currently clicked element with:</p>
<pre><code> $(this.id).unbind('click');
</code></pre>
<p>So that if you click again within this element, it doesn't trigger the click-function again.
And then, after doing stuff within the element (replace the text withing these elements with an that puts the current text in it, and when you click outside it it wil alter the html for it) I want to rebind the click again, but I cant't seem to unbind the click for this.id...</p>
<p>Some fiddle for clarification:
<a href="http://jsfiddle.net/TrySpace/QZMP6/7/" rel="nofollow">http://jsfiddle.net/TrySpace/QZMP6/7/</a></p>
| jquery | [5] |
2,118,757 | 2,118,758 | Android HelloTabWidget issue | <p>I am attempting to run the HelloTabWidget example from here: </p>
<p><a href="http://developer.android.com/resources/tutorials/views/hello-tabwidget.html" rel="nofollow">http://developer.android.com/resources/tutorials/views/hello-tabwidget.html</a></p>
<p>I am able to build, but once it runs it force closes. I ran the debugger in Eclipse and it looks like the error I am getting is in the res/drawable/ic_tab_artists.xml file. </p>
<p>The error I am getting is:
<em>"org.xmlpull.v1.XmlPullParserException: Binary XML file line #4: tag requires a 'drawable' attribute or child tag defining a drawable"</em></p>
<p>This is the xml I have for it, pretty straightforward:</p>
<pre><code> <?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http//schemas.android.com/apk/res/android">
<!-- When selected, use grey -->
<item android:drawable="@drawable/ic_tab_artists_grey" android:state_selected="true" />
<!-- When not selected, use white-->
<item android:drawable="@drawable/ic_tab_artists_white" />
</selector>
</code></pre>
<p>I'm just confused because the drawable attribute is there...any ideas? The code/XML I have in my implementation is verbatim what they have in the examples, but it just won't run in the emulator.</p>
| android | [4] |
1,336,959 | 1,336,960 | Onclick show next divs | <p>I have 1000 divs and 20 of them are visible and remaining are hidden. </p>
<p>In the onClick jquery event, I want the next 20 divs to become visible and so on.</p>
| jquery | [5] |
4,781,008 | 4,781,009 | Is it ok to instantiate an exception without throwing it? | <p>Suppose I have a MyException class that subclasses Exception. I'm using this class to include contextual information when errors occur in my code.</p>
<p>I typically use it to wrap one of the "standard" exception classes. For example, if an error happens during input validation, I will do something like</p>
<pre><code>if (invalidInput())
throw new MyException(new IllegalArgumentException(), arg1, arg2, ...);
</code></pre>
<p>But my IDE (Intellij IDEA) warns me that instantiating an unchecked exception (IllegalArgumentException in this example) without throwing it is bad, but doesn't tell me why.</p>
<p>So how sinful is it to instantiate an exception without throwing it? To which circle of hell will I go?</p>
| java | [1] |
1,674,898 | 1,674,899 | How should objects be in a Java game | <p>EDIT: i just deleted the entire post and reformulated the question to be more generic.</p>
<p>I want to do a simple strategy game: map, units.</p>
<p>Map: one class. Units: another class, self drawn.</p>
<p>Simple questions:</p>
<ol>
<li>How does an unit should redraw itself on the map.</li>
<li>A unit should be a JPanel or similar Swing component (just to be able to manage them as an entity with its own mousehandlers) or can be another thing, without neglecting the fact that it should be an autonomous object with its own action handlers and fields.</li>
<li>Is this map-units model correct of a simple game that would help me to learn in a fun way Java and OOP fundamentals.</li>
</ol>
<p>Thats it!</p>
| java | [1] |
5,132,491 | 5,132,492 | jquery access to my server host var? | <p>is it possible to use</p>
<pre><code>$.post("/home/ACOUNT_NAME/ACOUNT_DOMAIN/script.php")
</code></pre>
<p>to access a php file outside the main domain BUT on the same webserver?</p>
<p>with php I can do that, wich is very good since I need to use the same file in many domains.</p>
<p>Now I need to have access to the same file but using jquery, but browser doesn't go there, he always uses</p>
<blockquote>
<p>domain/home/ACOUNT_NAME/ACOUNT_DOMAIN/script.php</p>
</blockquote>
<p>any sugestion?</p>
<p>Thanks in advance</p>
| jquery | [5] |
932,748 | 932,749 | Android moving back from activity issue | <p>I am writing an application in which there are 5 activity A,B,C,D,E,F.Activity A is a login screen when user login A invoke a screen which has four tab and each tab has a screen.I want when user move from login screen to Activity B pressing back button should not come to login screen until not logout.</p>
<p>My tab activity has four screen like first one is monitoring and other are chat,operators and controls.I want pressing back button does not come to first login screen until logout how can this possible.</p>
<p>Actually i want until the user logout pressing back button come to monitoring screen that come after login.If user close the application using home button and then again start the application come to monitoring window not the login screen.how can this possible.</p>
| android | [4] |
2,333,785 | 2,333,786 | how to open a popup windows and cause a full postback in the parent window after closing the popoup | <p>In asp.net, I want to click on a button to open a popup windows. after the popup windows, i want to cause a full postback to the parent window.</p>
<p>how can I do?</p>
<p>Thanks in advance.</p>
| asp.net | [9] |
5,221,324 | 5,221,325 | Would it be useful to include the class name and variable name in any NullPointerException message? | <p>Would it be useful to include the class name and variable name in any NullPointerException message? I know that it might not always be possible because of changes made by a JIT but is seems like the info should be available often (class members, etc).</p>
<p>From: <a href="http://jamesjava.blogspot.com/2005/04/what-was-null.html" rel="nofollow">http://jamesjava.blogspot.com/2005/04/what-was-null.html</a></p>
| java | [1] |
275,520 | 275,521 | Apply styles to dynamically created textViews | <pre><code><?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="detaileventTitle">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">#000000</item>
<item name="android:textSize">14dp</item>
<item name="android:textStyle">bold</item>
</style>
</resources>
</code></pre>
<p>I have the style above which I usually apply by adding style="@style/detaileventTitle" to my textview xml. However, my textviews are created dynamically. How do I apply this style to the textviews?</p>
| android | [4] |
1,243,457 | 1,243,458 | Writing number keypad | <p>I am writing a program that prints out telephone numbers that are to be entered by users. On the west side, I need a picture icon of 3 people. In the center, I need the keypads. On the North side, I need the numbers to be displayed. Can someone help with the layout of the buttons?</p>
| java | [1] |
3,960,257 | 3,960,258 | Jquery dropdown get value | <p>I have a drop down thas an ID, Name Pair.</p>
<p>Example</p>
<p>Jon Miller<br>
Jim Smith<br>
Jen Morsin</p>
<p>Jon MIller has ID of 101<br>
Jim Smith has ID of 102<br>
Jen Morsin has ID of 103</p>
<p>When I do the followng:</p>
<pre><code>var arNames = $('#Crd').val()
</code></pre>
<p>and I select Jon Miller, I get 101. I'd like to get Jon Miller though. </p>
| jquery | [5] |
3,126,054 | 3,126,055 | test android application in mobile | <p>I am new in android enviroment and my question may be silly.</p>
<p>I developed a small app and I want to transfer it in my mobile.</p>
<p>I follow the steps from manifest file 'Use the Export Wizard to export and sign an APK'.</p>
<p>I transfer it in my mobile but I can't install it. I use the 'easy installer' application to install the apks.</p>
<p>Am I doing something wrong?</p>
<p><strong>EDIT</strong></p>
<p>I have some 3rd party apps on my mobile and I can install them. So the settings from my mobile I assume that are correct. </p>
<p>Thanks</p>
| android | [4] |
1,624,965 | 1,624,966 | :: simple-jndi and relative path to config doesn'T work | <p><strong>My setting:</strong></p>
<p><em><strong>Environment</em></strong></p>
<ul>
<li><p>Ubuntu Linux 12.04 LTS</p></li>
<li><p>Eclipse Helios</p></li>
<li><p>GWT 2.4</p></li>
<li><p>Maven 2</p></li>
<li><p>simple-jndi</p></li>
</ul>
<p><em><strong>Project</em></strong></p>
<p>dialoguemaps-domain <em>(Java project folder)</em></p>
<p>-> src/main/resources/jndi.properties <em>(simple-jndi configuration)</em></p>
<p>-> config/dialoguemaps.properties <em>(data source configuration)</em></p>
<p><strong>My problem:</strong></p>
<p>If i use an absolute path in my jndi.properties file - it work's fine:</p>
<pre><code>org.osjava.sj.root=/home/arno/.workspaces/dialoguemaps-trunk/dialoguemaps-domain/config/
</code></pre>
<p>But if i use a relative path it doesn't work:</p>
<pre><code>org.osjava.sj.root=config/
</code></pre>
<p>I have to use an relative path, but how - what is the problem?</p>
<p>Thank you!</p>
| java | [1] |
1,804,507 | 1,804,508 | Force startup a computer automatically? | <p>We know how to force shutdown an computer using Java. For example, the following code works fine for force shutdown:</p>
<pre><code>public static void main(String arg[]) throws IOException{
Runtime runtime = Runtime.getRuntime();
Process proc = runtime.exec("shutdown -s -t 0");
System.exit(0);
}
</code></pre>
<p>Now, suppose if I want to force startup a computer (which is in shut down state), at a particular time, is it possible to do in Java or any other language?</p>
| java | [1] |
3,016,475 | 3,016,476 | How to capture browser close event in javascript? | <p>I want to capture the browser close event in my application and show a confirm box to user.
I am using JSF 2.0 and richfaces 4.0.</p>
| javascript | [3] |
3,646,566 | 3,646,567 | I want to delete all png files from server where name start with pub_ | <p>which is this that delete all png from our server but only those png that start with pub_. i don't know how to do this i were searching it on google and on stackoverflow all dy long but didn't find any help.</p>
<p>This is hwat i did so far</p>
<pre><code>$directory = "/home/html/domain.com/public/mydir/testDIR/";
$images = glob($directory . "*.png");
//print each file name
foreach ($images as $image)
{
echo $image."<br />";
}
</code></pre>
<p>it returns me all png including those with name pub_xyz.png, now i want to delete all of pub_xyz.png plz help me thanks.</p>
| php | [2] |
1,670,273 | 1,670,274 | Ways to create a Set in JavaScript? | <p>In Eloquent JavaScript, Chapter 4, a set of values is created by creating an object and storing the values as property names, assigning arbitrary values (e.g. true) as property values. To check if the value is already contained in the set, the <code>in</code> operator is used:</p>
<pre><code>var set = {};
if (!'Tom' in set) {
var.Tom = true;
}
</code></pre>
<p>Is this idiomatic JavaScript? Wouldn't be using an array even better?</p>
<pre><code>var set = [];
if (!'Tom' in set) {
set.push = 'Tom';
}
</code></pre>
| javascript | [3] |
2,867,204 | 2,867,205 | What does this operator <> mean in php? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3737139/reference-what-does-this-symbol-mean-in-php">Reference - What does this symbol mean in PHP?</a> </p>
</blockquote>
<p>What does the '<>' mean?</p>
<pre><code>if ($class->stuff <> 'specific')
</code></pre>
<p>Just working on a little project and came across a strange symbol.</p>
| php | [2] |
3,216,260 | 3,216,261 | How can I select an element with a specific inline style? | <p>Suppose there are three elements as below</p>
<pre><code><div id="tab01">tab01</div>
<div id="tab02" style="display: none;">tab02</div>
<div id="tab03" style="display: none;">tab03</div>
</code></pre>
<p>How can I use jQuery to select an element that don't have an inline style <code>display: none</code>?</p>
<p>Thanks</p>
| jquery | [5] |
2,554,694 | 2,554,695 | Python condense if/else to one line? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/394809/python-ternary-operator">Python Ternary Operator</a><br>
<a href="http://stackoverflow.com/questions/2802726/putting-a-simple-if-then-statement-on-one-line">Putting a simple if-then statement on one line</a> </p>
</blockquote>
<p>Is there a way to compress an if/else statement to one line in Python? I oftentimes see all sorts of shortcuts and suspect it can apply here too.</p>
| python | [7] |
3,894,148 | 3,894,149 | How do I simulate a scrollbar click with jQuery? | <p>How do I simulate a scrollbar click with jQuery? So, if a user clicks on a div that says "scroll down," it'll be the exact same behavior as if he/she clicked on the down arrow of the browser's scrollbar. Using the current browser's behavior would be optimal, vs. doing something like <code>$.browser.scrolldown(200,'fast')</code>. </p>
<p>Something like <code>$.browser.triggerDownArrowOnScrollBar()</code> would be sweet!</p>
| jquery | [5] |
1,476,765 | 1,476,766 | C#: What is the proper way to show a form for "frmMainForm" settings and disposing? | <p>Backdrop: There are two forms, the main application form and a form to edit various settings for the operations of main application.</p>
<p>What would be the proper way to show the frmSettings form and how to dispose it once clicked OK or Cancel in the actual frmSettings form?</p>
| c# | [0] |
2,304,527 | 2,304,528 | ASP.NET - Create custom context object? | <p>How do I create a globally accessible <code>Context</code> object similar to the <code>HttpContext</code> object?</p>
<p>I want to create a custom class library which I want to reference from a website project. In the website project I want to be able to call the following globally:</p>
<pre><code>ClassLibraryName.Context
</code></pre>
<p><strong>I cannot create a global <code>property</code> directly in my classlibrary, so how should this be implemented?</strong> (I've seen other applications/products use this approach, one of which is Sitecore which has a custom Sitecore.Context object available)</p>
<h1>Edit</h1>
<p>Might this be a 'valid' solution?</p>
<pre><code>namespace MyLibrary
{
public class Context
{
public static object ContextualObject
{
get;
set;
}
}
}
</code></pre>
| asp.net | [9] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.