Unnamed: 0
int64
302
6.03M
Id
int64
303
6.03M
Title
stringlengths
12
149
input
stringlengths
25
3.08k
output
stringclasses
181 values
Tag_Number
stringclasses
181 values
1,148,949
1,148,950
How to redirect the page according to user when I login in ASP.net?
<p>I have four different modules in my website: customer, operator, engineer and admin.</p> <p>When I click on the login button at that time if that is customer the page should be redirected to the customer.aspx.</p> <p>Ff engineer login then the page should be redirected to the engineer.aspx and so on..</p> <p>How can I achieve this?</p>
c# asp.net
[0, 9]
1,242,179
1,242,180
Special characters replacement function
<p>I have a JavaScript function that replaces special characters with normal characters.</p> <p>When I type a period <code>.</code> it's changed to <code>a</code></p> <p>Example : <code>[email protected]</code> is changed to <code>info@exampleacom</code></p> <p>What am I doing wrong?</p> <pre><code>function retiraAcento(palavra, obj) { com_acento = 'áàãâäéèêëíìîïóòõôöúùûüçÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÖÔÚÙÛÜÇ'; sem_acento = 'aaaaaeeeeiiiiooooouuuucAAAAAEEEEIIIIOOOOOUUUUC'; nova = ''; for (i = 0; i &lt; palavra.length; i++) { if (com_acento.search(palavra.substr(i, 1)) &gt;= 0) { nova += sem_acento.substr(com_acento.search(palavra.substr(i, 1)), 1); } else { nova += palavra.substr(i, 1); } } //obj.value = nova.toUpperCase(); obj.value = nova } $(document).ready(function () { $(":input").live('blur', function () { retiraAcento(this.value, this); }); }); </code></pre>
javascript jquery
[3, 5]
5,628,766
5,628,767
Bug with Asp.Net 3.5? - Is it fixed in 4.0 or still need reporting?
<p>If I have a Request.PathInfo such as the url </p> <p><code>http://localhost/default.aspx/test</code> </p> <p>and a Button with no PostBackUrl set (aka it is "") and I click it, </p> <p>it changes the url to <code>http://localhost/default.aspx/default.aspx</code></p> <p>Is this a bug/feature and if it is a bug, was it fixed in 4.0?</p> <p>Edit: was a Button control not LinkButton</p> <p>Run this page, put in /test after the page name and click the button. The /test is removed and exchanged with the name of the page.</p> <pre><code>&lt;%@ Page Language="C#" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;script runat="server"&gt; &lt;/script&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:Button ID="Button1" runat="server" Text="Button" /&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
c# asp.net
[0, 9]
6,749
6,750
Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/ref/FinalReference
<p>I am a student in IT and i'm still learning java and android developement.<br> i'm testing with some udp traffic between a desktop app and a android app. but every time I try to run the android app it gives this error message :</p> <p>Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/ref/FinalReference</p> <p>this is the code of the UDP client </p> <pre><code> import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.SocketAddress; import android.app.Activity; import android.util.Log; public class Client extends Activity { public static void main(String[] args) throws IOException { try { int bufSize = 4096; int port = 12345; DatagramSocket sock = new DatagramSocket(port); sock.setReceiveBufferSize(bufSize); byte[] buffer = new byte[bufSize]; while (true) { DatagramPacket p = new DatagramPacket(buffer, bufSize); sock.receive(p); Log.d("Client", "Received: " + new String(p.getData())); } }finally{} } } </code></pre> <p>the code may contain some parts that may not work, but it gives no errors. </p> <p>I just want to know why the VM won't start.</p> <p>grtz</p>
java android
[1, 4]
417,046
417,047
if users press the browser's back button to reach the prior page..then page should display a message like "web page expired" in asp.net
<p>if users press the browser's back button to reach the prior page..then page should display a message like "web page expired" in asp.net</p> <p>can i use javascript for this???</p> <p>for example..</p> <p>there are 4 pages in web sites. 1,2 and 3 can be back. but when the 4th page run then 4th page can not be back... when the user press browser's back button , diaplay ma message "weg page expired".</p>
javascript asp.net
[3, 9]
3,719,600
3,719,601
Prevent some code from being executed in program flow
<p>In my onCreate method in main activity i have some code which is checking if wifi connection is enabled. If it isn't i'm trying to automatically enabled it (very important now ) <strong>and after that</strong> i want to make other stuff ( starting service ..and other things). Its very important that it must be enabled <strong>before proceeding</strong> with execution !</p> <p>I already tried AsyncTask , but with no luck. (code is still executing down below, before task in AsyncTask is completed ).</p> <p>How to achive that some code will execute <strong>AFTER</strong> certain task is completed? </p> <p>EDIT:</p> <p>my onCreate in main activity</p> <pre><code>wifiManager = (WifiManager) getSystemService(WIFI_SERVICE); if(!wifiManager.isWifiEnabled()) { new Asyn(this, progress, wifiManager); } startService(new Intent(intentt)); </code></pre> <p>Asyn Class</p> <pre><code>public class Asyn extends AsyncTask&lt;Context, Integer, Long&gt; { private Context context; private ProgressDialog pd; private WifiManager wm; public Asyn(Context context, ProgressDialog pd, WifiManager wm) { this.context = context; this.pd = pd; this.wm = wm; } @Override protected void onPreExecute() { // TODO Auto-generated method stub super.onPreExecute(); pd = ProgressDialog.show(context, "", "Enabling wifi"); } @Override protected Long doInBackground(Context... params) { wm.setWifiEnabled(true); return null; } @Override protected void onPostExecute(Long result) { // TODO Auto-generated method stub super.onPostExecute(result); pd.dismiss(); } </code></pre> <p>}</p> <p>I dont want to execute "startService" until wifi is not fully enabled!</p>
java android
[1, 4]
595,195
595,196
Dropdown List SelectedItems Postback Not there
<p>I'm not sure what to do here, I might have to use viewstates, but I need help.</p> <p>I have a dropdown list, I am not databinding. I would know if I was I should do a <code>Page.IsPostBack</code> and not databind.</p> <pre><code>&lt;asp:DropDownList ID="ddlWeeklyWeightIn" runat="server"&gt; &lt;asp:ListItem&gt;1&lt;/asp:ListItem&gt; &lt;asp:ListItem&gt;2&lt;/asp:ListItem&gt; &lt;asp:ListItem&gt;3&lt;/asp:ListItem&gt; &lt;asp:ListItem&gt;4&lt;/asp:ListItem&gt; &lt;/asp:DropDownList&gt; </code></pre> <p>Now in my code behind I have this:</p> <pre><code> protected void Button1_Click(object sender, EventArgs e) { string wwin = ""; wwin = ddlWeeklyWeightIn.SelectedItem.Text; } </code></pre> <p>On the button click is always "1", never the selected item.</p> <p>Thank you</p>
c# asp.net
[0, 9]
3,317,750
3,317,751
how to wait for sendBroadcast to finish
<p>I am doing a media file scan using sendBroadcast. Then I need to wait till it's complete after doing sendBroadcast. How do I do this in Android ?</p> <p>I know I can use a simple while logic here but I am looking for a better approach</p> <pre><code>context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory()))); // wait here till till do something completed </code></pre> <p>Receiver</p> <pre><code>private BroadcastReceiver mediaScanner = new BroadcastReceiver(){ @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action.equals(Intent.ACTION_MEDIA_SCANNER_FINISHED)) { // Do some thing here. } } } </code></pre>
java android
[1, 4]
197,070
197,071
Android - entry nember
<p>how would i go about adding an entry number at the start of a saved line of text to a .txt file. eg.</p> <ul> <li>01, entry one</li> <li>02, entry two</li> <li>03, entry three</li> </ul> <p>and so on</p> <p>here is my code to write to the file</p> <pre><code>public void onClick(View v) {try { BufferedWriter out = new BufferedWriter(new FileWriter("/sdcard/input_data.txt", true)); out.write(txtData.getText() + "," + dateFormat.format(new Date())); out.close(); </code></pre>
java android
[1, 4]
5,458,589
5,458,590
Directing animation to correct place
<p>In my word game there is a grid with 3 letter words.</p> <p>The aim of the game is to spell the words by clicking on the corresponding letters on the side.</p> <p>When an area in the grid is highlighted it indicates to the user the word to spell. The user clicks the letters on the side of the grid and they should move to the highlighted area.</p> <p>I have recently changed "drop-box" to a div in the following piece of code and now the animation takes the letter to the top corner of the grid before taking it to the correct position.</p> <pre><code> var row = '&lt;tr&gt;'; var spaceAvailInRow = numLetters; while (spaceAvailInRow) { var word = getWordToFitIn(spaceAvailInRow, unusedShuffledWords); guesses[word] = []; spaceAvailInRow -= word.length; for (var k = 0; k &lt; word.length; ++k) { row += '&lt;td data-letter="' + word[k] + '" data-word="' + word + '"&gt;&lt;div class="drop-box"&gt;&lt;/div&gt;&lt;/td&gt;'; } } row += '&lt;/tr&gt;'; tbl.append(row); } $(".container").append(tbl); </code></pre> <p>Can someone tell me why the animation has broke now I have changed this?</p> <p>Fiddle: <a href="http://jsfiddle.net/7Y7A5/27/" rel="nofollow">http://jsfiddle.net/7Y7A5/27/</a></p>
javascript jquery
[3, 5]
788,669
788,670
Calling a Function in Javascript
<p>I have declared a function for showing a dialog box in jQuery</p> <pre><code>&lt;script type="text/javascript"&gt; function showDialog(str,strtitle) { if(!strtitle) strtitle='Error message'; $('#dialog').dialog('destroy'); $('#dialog').show(); $('#dialog').html(str); $("#dialog").dialog({ resizable: false, width: 400, color: '#BF5E04', open: function () { $(this).parents(".ui-dialog:first").find(".ui-dialog titlebar").addClass("ui-state-error");}, buttons: {"Ok": function() { $(this).dialog("close"); }}, overlay: { opacity: 0.2, background: "cyan" },title:strtitle});} &lt;/script&gt; </code></pre> <p>And I'm calling this function, in another javascript code:</p> <pre><code> &lt;script type="text/javascript"&gt; var myFile = document.getElementById('myfile'); //binds to onchange event of the input field myFile.addEventListener('change', function() { //this.files[0].size gets the size of your file. var size = this.files[0].size; document.write(showDialog('size','File Size Exceeds')); }); &lt;/script&gt; </code></pre> <p>When I execute the function, it writes Undefined, Why the dialog box is not showing. The first function is declred in the head, and the second in the body portion.</p>
javascript jquery
[3, 5]
2,194,302
2,194,303
Select all previous elements within a container?
<p>I have this code:</p> <pre><code>&lt;div id="whatever"&gt; &lt;span&gt;1&lt;/span&gt; &lt;span&gt;2&lt;/span&gt; &lt;span&gt;3&lt;/span&gt; &lt;span&gt;4&lt;/span&gt; &lt;/div&gt; &lt;div id="whatever2"&gt; &lt;span&gt;1&lt;/span&gt; &lt;span&gt;2&lt;/span&gt; &lt;span&gt;3&lt;/span&gt; &lt;span&gt;4&lt;/span&gt; &lt;/div&gt; </code></pre> <p>And I need to select with jQuery all the previous spans from the one that I hover within the same div. </p> <p>Does anyone know how I can do this?</p>
javascript jquery
[3, 5]
2,550,754
2,550,755
How to include jQuery in ASP.Net project?
<p>I've read that Microsoft now <a href="http://weblogs.asp.net/scottgu/archive/2008/09/28/jquery-and-microsoft.aspx" rel="nofollow">bundles jQuery with Visual Studio</a>. How then do I "include" the jQuery source in my ASP.Net project?</p>
asp.net jquery
[9, 5]
504,157
504,158
How to "control" a call in android?
<p>im developing an app where one should be able to call and "reject" a call from the desktop using a small socket program to communicate with the phone over USB.</p> <p>I got most of it in place, I can call a number from my desktop application, however, when a call is being made it is not under control of the application.</p> <p>I run a service which starts a server socket thread, and then I bind the local listen port to my computer with <code>adb forward tcp</code>. When I send a <code>CALL:123123</code> it will start a new call intent that calls the number "123123".</p> <p>How would I go about making a call and then at some point ending it again?</p>
java android
[1, 4]
2,095,020
2,095,021
Java EditText Validation Not Working
<p>I am trying to validate user input from a form before submit but it is allowing all empty fields to go through... any ideas? I tried "" instead of null as well...</p> <pre><code> public void onClick(View v) { EditText agencyname = (EditText) findViewById(R.id.agencyname); String agency = agencyname.getText().toString(); EditText firstname = (EditText) findViewById(R.id.firstname); String first = firstname.getText().toString(); EditText lastname = (EditText) findViewById(R.id.lastname); String last = lastname.getText().toString(); EditText phone = (EditText) findViewById(R.id.phone); String agencyphone = phone.getText().toString(); EditText email = (EditText) findViewById(R.id.email); String agencyemail = email.getText().toString(); if(agency != null || first != null || last != null || agencyphone != null || agencyemail != null){ Intent i = new Intent(); i.setClassName("android.com.smartchoice", "android.com.smartchoice.AgencyRecieve"); i.putExtra("agencyname", agency); i.putExtra("phone", agencyphone); i.putExtra("email", agencyemail); i.putExtra("firstname", first); i.putExtra("lastname", last); startActivity(i); } else { Toast.makeText(NewAgencyActivity.this, "Must Input All Fields", Toast.LENGTH_LONG).show(); }; } </code></pre>
java android
[1, 4]
2,856,249
2,856,250
Do C# and java does support static types?
<p>I have been using Singleton classes and static method for a while and always used to wonder how nice it would have been to have a seperate type which is a static type and cannot be instantiated but have only static methods!</p> <p>It will be easy for readability and also to maintain.</p> <p>for Ex</p> <pre><code>public UtilType MyUtility { public void Calculate(int x,int y) { return x+y; } } </code></pre> <p>Here <code>MyUtility</code> should not be allowed to be instantiated only its methods can be accessed in static way.</p>
c# java
[0, 1]
245,823
245,824
Access current running script error log
<p>Is it possible to capture all of the PHP errors that occur during a site execution, save them to a variable and print them out into a javascript section to print?</p> <p>i.e.</p> <p>
php javascript
[2, 3]
4,920,533
4,920,534
Exception handling and executing remaining code in document.ready function
<pre><code>$(document).ready(function() { 1) some code here 2) some code here }); </code></pre> <p>If for some reason if my code at line1 breaks , all the bindings which are at line2 are not happening. May i know if there is anyway i can complete my bindings like click event , mouseover events etc.</p> <p>Recently luckly with firebug i found something broke at line1 and that is the reason why my bindings after line1 are not working.</p> <p>Appreciate your inputs.</p>
javascript jquery
[3, 5]
2,641,956
2,641,957
How to disable/enable custom click event for an img element in JavaScript
<p>I have an ASP.NET datepicker control (no source available ) which produces an image element, which when clicked shows a calendar. I want to disable or enable on demand the image through JavaScript. When I added the 'disabled' attribute to the img element, some script in the page always goes in a busy state and the page never finishes rendering. My guess the disabled attribute is causing a conflict in some way.</p> <p>My next attempt now is to disable the custom click event which the ASP.NET control adds unoptrusively. How do I disable the click event? How do I re-enable it so that the img works back as normal. I am also using jQuery 1.4.</p>
javascript jquery
[3, 5]
2,988,862
2,988,863
How to count all elements where custom attribute has a certain value?
<p>How can I determine the total amount of <code>div</code>'s in this <code>td</code> where <code>data-something</code> is "yes"?</p> <pre><code>&lt;td id='tableData'&gt; &lt;div class="test" data-something="yes"&gt;&lt;/div&gt; &lt;div class="test" data-something="no"&gt;&lt;/div&gt; &lt;div class="test" data-something="yes"&gt;&lt;/div&gt; &lt;/td&gt; </code></pre>
javascript jquery
[3, 5]
2,383,985
2,383,986
Catch php querystring values from .aspx file
<p>I write a code to get parameters from SMS Gateway.But SMS gateway only accept php files.But our application is Asp.net, I wanted to get 4 parameters from gateway via php &amp; send it to .aspx file.here is the scenario</p> <p><img src="http://i.stack.imgur.com/kg3Ye.png" alt="enter image description here"></p> <p>Here i written the code for php file &amp; aspx file.</p> <p>PHP FILE</p> <pre><code>&lt;?php //Get Vidamo &amp; Post aspx $source = isset($_GET['msisdn']); $dest = isset($_GET['shortcode']); $messageIn = isset($_GET['msg']); $operatorNew = isset($_GET['operator']); $source = $_POST['msisdn']; $dest = $_POST['shortcode']; $messageIn = $_POST['msg']; $operatorNew = $_POST['operator']; ?&gt; </code></pre> <p>Then i'm going to received it via .aspx file</p> <pre><code> int source = int.Parse(Request.QueryString["msisdn"].ToString()); int dest = int.Parse(Request.QueryString["shortcode"].ToString()); string messageIn = Request.QueryString["msg"]; string operatorNew = Request.QueryString["operator"]; </code></pre> <p>I wanted to know using $GET i can received parameters via gateway &amp; using $post can i send parameters via Query string or need any other steps to do..</p>
c# php
[0, 2]
916,511
916,512
how can i convert bitmap image to drawable image so that it will be show over another bitmap image
<p><strong>i've a class which extends view ...in which i have two bitmap images to show one over another ....for this im am trying to convert one bitmap image to a drawable image but it dsnt show over the first one what i'm trying this is.....</strong></p> <pre><code>public class ShowCanvas extends View { Bitmap CanvasBitmap; Bitmap ScaledBitmap; Bitmap smallbitmap; private static final int INVALID_POINTER_ID = -1; private Drawable mImage; private float mPosX; private float mPosY; private float mLastTouchX; private float mLastTouchY; private int mActivePointerId = INVALID_POINTER_ID; private ScaleGestureDetector mScaleDetector; private float mScaleFactor = 1.f; public ShowCanvas(Context context) { super(context); // TODO Auto-generated constructor stub ScaledBitmap = DrawView.scaled; **when i get the image from drawable it shows over the first one...** </code></pre> <p>mImage = getResources().getDrawable(R.drawable.dress01); </p> <p><strong>but when i'm using this it dsnt shows image...</strong></p> <p>mImage = new BitmapDrawable(getResources(), Dress.bitmap);</p> <pre><code> System.out.println("Drawable" + mImage); int X = mImage.getMinimumWidth(); int Y = mImage.getIntrinsicHeight(); System.out.println(" Rough" + X + "\t" + Y); mImage.setBounds(0, 0, mImage.getIntrinsicWidth(), mImage.getIntrinsicHeight()); } public void setBitmap(Bitmap bitmap) { // TODO Auto-generated method stub CanvasBitmap = bitmap; System.out.println("CanvasBitmap" + CanvasBitmap); int X = CanvasBitmap.getHeight(); int Y = CanvasBitmap.getWidth(); System.out.println("CanvasBitmap " + X + "\t" + Y); } @Override protected void onDraw(Canvas canvas) { // TODO Auto-generated method stub Paint mpaint = new Paint(); canvas.save(); canvas.drawBitmap(ScaledBitmap, 0, 0, mpaint); mImage.draw(canvas); Log.i("Debug", "mImage.draw(canvas)"); canvas.restore(); } </code></pre> <p>}</p>
java android
[1, 4]
2,737,157
2,737,158
How to disable the hover event when I hover over the text inside the image?
<p>I have a problem in my code, when I hover over the image, the image will become 50% larger and it will display a text over the image, but when I hover over the text, the image will enter the state of mouseout, mouseover, mouseout, mouseover. So it will flicker a lot. How can I disable this hovering event when the mouse is over the text of the image? I tried <code>event.stopPropagation</code> in the text but it isn't working.</p> <p>Here's the <a href="http://jsfiddle.net/Z7C4b/" rel="nofollow">jsFiddle</a>. Try to hover over the image, then try to hover over the text. That's the effect I'm talking about. I want to disable the text hover event. Please help me.</p>
javascript jquery
[3, 5]
4,905,381
4,905,382
Type Cannot refer to a non-final variable Asortiment inside an inner class defined in a different method
<p>I add simple class to my application:</p> <pre><code>public class Nomenklatura implements Serializable { private Boolean SmenaIsOpen=false; public Nomenklatura() { SmenaIsOpen=false; } public String OpenSmena() { SmenaIsOpen=true; return "ok"; } public String CloseSmena() { return "ok"; } public Boolean GetSmenaIsOen() { return SmenaIsOpen; } public void SetSmenaIsOen(Boolean val) { SmenaIsOpen=val; } } </code></pre> <p>Application should work with one object this class. When I use it in activity:</p> <pre><code>@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.presmena); Nomenklatura Asortiment; Asortiment=(Nomenklatura) getIntent().getExtras().getSerializable("Nomenklatura"); Button but1=(Button) findViewById(R.id.button1); but1.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { if(Asortiment.GetSmenaIsOen()) Asortiment.CloseSmena(); else Asortiment.OpenSmena(); } }); } </code></pre> <p>I get error: Cannot refer to a non-final variable Asortiment inside an inner class defined in a different method Presmena.java. Help to understand, what is wrong</p>
java android
[1, 4]
5,116,037
5,116,038
Accessing properties of SelectedRow during SelectedIndexChanged event in dynamically generated GridView
<p>I have an empty GridView object on a page that I bind to a LINQ qry result at run time. The GridView has a 'Select" button that fires the SelectedIndexChanged event and it's inside of this event that I'd like to access the data of one of the fields in the selected row.</p> <p>So far, I can only find one way to do this, and it seems suboptimal:</p> <pre><code>protected void GridView2_SelectedIndexChanged(object sender, EventArgs e) { GridViewRow row = GridView2.SelectedRow; string UserID = row.Cells[1].Text; //Do stuff with the userID } </code></pre> <p>So this just access the cell data directly based on the cell index. The UserID just happens to be in the second cell and so it works. But later down the road, the UserID may not be in that same column. It seems like I'd be better off looking up the value of this cell by accessing by the cell's header name, or by any method other than the cell index itself.</p> <p>Any ideas?</p> <p>Thanks!</p>
c# asp.net
[0, 9]
5,304,494
5,304,495
Clearing all textboxes in WebForms
<p>I am having a number of text boxes in my page. I need to clear all text boxes after the values are stored. Clearing all text boxes one by one is a time taking process. Can anybody suggest me a way to clear all text boxes in single function.</p>
c# asp.net
[0, 9]
2,728,106
2,728,107
Get top of current window position relative to the document body
<p>I am developing a model box jQuery plugin, and I need to know how to get some window properties. </p> <p>The box and its shader div fade over top of the page, and the shader div covers the complete body, not just the window (Important for pages that have horizontal scroll bars). When the model div fades in, it centers itself horizontally and vertically based on the window. However, this won't work if the user scrolled down the page some ( the box will be at the top of the page since it centers based on the window size alone).</p> <p>Is there a way to get the window top and left position relative to the body.<br /> For example, the user has scrolled down the page and clicked whatever to open the model box, what can I do to get the number of pixels the top of the window is down from the top of the body.</p>
javascript jquery
[3, 5]
62,569
62,570
When I rotate my Android device, the XML changes back to main.xml
<p>I'm writing an Android application. I have two important XML files - main.xml, and new.xml. Here is my Java Activity source code:</p> <pre><code>// package declarations, imports, etc public class MainActivity extends Activity { @Override public void onCreate(savedInstanceState) { super.onCreate(savedInstancestate); setContentView(R.layout.main); } // as you can see, the content of the initial layout is found in main.xml // I want to change the layout so it has the content of new.xml (when I press a button) public void ButtonAction(View view) { setContentView(R.layout.new); } } </code></pre> <p>So it goes like this: in my main.xml file, there is a button. As dictated in the main.xml file, when I press that button, it calls the method ButtonAction. When the button is pressed and ButtonAction is called, I want to change the content of the layout to be the contents of new.xml.</p> <p>The above code works, but only kind of - it's not permanent. When I rotate my device, it appears to refresh the activity with the contents of main.xml. So I can get it to do what I want, but when I rotate the device and view it in a Landscape layout instead of the typical Portrait layout, it reverts.</p> <p>How do I fix this?</p>
java android
[1, 4]
476,592
476,593
jQuery: What's the meaning of comparison in following code block - callback && function() {callback.call();}
<p>Seeing this block from <code>jQuery.scrollTo.js</code> library (in <a href="http://flesler-plugins.googlecode.com/files/jquery.scrollTo-1.4.2.js" rel="nofollow">v1.4</a> at line 184).</p> <pre><code>function animate( callback ){ $elem.animate( attr, duration, settings.easing, callback &amp;&amp; function(){ callback.call(this, target, settings); }); }; </code></pre> <p>Curious to know how the comparison is going to work with </p> <pre><code>callback &amp;&amp; function() {callback.call(...)}; </code></pre> <p>and what's exactly the meaning behind this. Thanks in advance.</p>
javascript jquery
[3, 5]
593,743
593,744
div fades out if mouse does not hover over it
<p>I want code in which a div fades out if mouse does not hover over it. This is the code which makes the div visible. As soon as it is displayed it fades out. I want that if a user hovers over it while it is fading out it stops fading and becoming as it was initially. And then as user hovers out of it it fades again.</p> <pre><code>$('#popuup_div').css({left:leftVal,top:topVal}).show().fadeOut(2000); </code></pre>
javascript jquery
[3, 5]
3,496,419
3,496,420
do postback after enter hit on changing text in textbox
<p>How can I make postback after user changes textbox text and hits enter ? Is only javascript real solution. Doesnt asp.net give any out from box solution for such a problem ? Thank You for any hints. </p>
javascript asp.net
[3, 9]
5,439,956
5,439,957
Refresh button for an iframe jquery or javascript
<p>Hello i have a problem. I have a page in which i have inside an iframe. In the parent page (not in the iframe), i want to build the browser buttons back, fw, refresh and home page. The back, fw, home page buttons are almost ok. The refresh button doesnt work. The code is below:</p> <pre><code>&lt;a href="javascript:;" onClick="parent.document.getElementById('my_frame').location.reload();"&gt; </code></pre> <p>I also have to tell that my url is not changing i mean i have used post method and the url is always the same. Any answers of jquery or javascript???</p> <p>Thanks in advence, i m really desperate</p>
javascript jquery
[3, 5]
1,316,107
1,316,108
jquery get request returning document instead of XML
<p>I have a peice of code that i call inside of $("document).ready() in jquery that tries to open an xml file and parse it. </p> <pre><code>$.get('cal.xml', function(data){ alert(data); var xmlDoc = $.parseXML(data); var $xml = $(xmlDoc); }); </code></pre> <p>the alert that pops up is "[object Document]" rather than the actual text of the xml which then throws a problem with $.parseXML(data) saying that "Uncaught Invalid XML: undefined" (implying that data is undefined).</p> <p>here is the XML file </p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;cal&gt; &lt;today&gt; &lt;event&gt; &lt;time&gt; 6:30pm EST &lt;/time&gt; &lt;title&gt; nothing &lt;/title&gt; &lt;/event&gt; &lt;/today&gt; &lt;/cal&gt; </code></pre> <p>Could someone help me simply read in this XML file and set it up for parsing?</p>
javascript jquery
[3, 5]
2,352,305
2,352,306
php include unterminated string literal message
<p>The following works just fine:</p> <pre><code>var sFirstText=&lt;?php include("first2.html"); ?&gt;; </code></pre> <p>when first2.html looks like this INCLUDING the double quotes:</p> <pre><code>"&lt;p&gt;sentence one&lt;/p&gt;&lt;p&gt;sentence two&lt;/p&gt;" </code></pre> <p>However, if first2.html looks like:</p> <pre><code>"&lt;p&gt;sentence one&lt;/p&gt; &lt;p&gt;sentence two&lt;/p&gt;" </code></pre> <p>I get an unterminated string literal message. I hope to figure out how I can include the html without first having to remove the carriage return/line feed sequences.</p> <p>Also, if I remove the double quotes and do:</p> <pre><code>var sFirstText="&lt;?php include("first2.html"); ?&gt;"; </code></pre> <p>that won't work, returning a message I haven't yet been able to comprehend.</p> <p>Basically I want to get simple html formatting into a field without having to remove the cr/lf sequences.</p>
php javascript
[2, 3]
2,689,782
2,689,783
Can any one tell what's wrong with the following script in disabling the list of dates
<p>I used <a href="http://keith-wood.name/datepick.html" rel="nofollow">Keith-Wood</a> calendar for that i added some script as follows</p> <pre><code> &lt;script type="text/javascript"&gt; $function(){ var holidays = ['12-2-2010', '12-7-2010', '12-10-2010', '12-18-2010']; $('#txtDateofBirth').datepick({onDate: function(date) { for (var i = 0; i &lt; holidays.length; i++) { if (date.toString('MM-dd-yyyy')==holidays[i]) { return {selectable: false, dateClass: 'holiday'}; } } return $.datepick.noWeekends(date); }}); &lt;/script&gt; </code></pre> <p>I am also having this too to disable <code>weekends</code></p> <pre><code>&lt;script type="text/javascript"&gt; $(function () { $('#txtDateofBirth').datepick({ onDate: $.datepick.noWeekends, showTrigger: '#Img1' }); }); &lt;/script&gt; </code></pre> <p>But i am unable to disable the dates as per in the list can any one tell what's wrong i am doing</p> <p>My design is as follows</p> <pre><code>&lt;asp:TextBox ID="txtDateofBirth" runat="server" Style="left: 398px; position: absolute; top: 131px" /&gt; &lt;div style="display: none;"&gt; &lt;img id="Img1" src="images/calendar.gif" alt="Popup" class="trigger" style="left: 568px; position: absolute; top: 136px" /&gt; &amp;nbsp; &lt;/div&gt; </code></pre>
jquery asp.net
[5, 9]
1,098,265
1,098,266
Python in java, is it possible
<p>I have a class that is written in Java.<br> Can it be used in Python so i dont have to rewrite it?</p>
java python
[1, 7]
4,396,181
4,396,182
jquery.localize doesnt work
<p>i have followed instructions found on <a href="https://github.com/coderifous/jquery-localize" rel="nofollow">https://github.com/coderifous/jquery-localize</a>, and for testing purpose i have created this test file:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"/&gt; &lt;title&gt;Test&lt;/title&gt; &lt;script src="jquery-1.6.1.min.js" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt; &lt;script src="jquery.localize.js" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;p rel="localize[greeting]"&gt;some text&lt;/p&gt; &lt;script type="text/javascript" charset="utf-8"&gt; $(function(){ $("[rel*=localize]").localize("test", "en") }) &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>and test-en.json</p> <pre><code>{ "greeting": "welcome stranger.." } </code></pre> <p>locally it is working with IE8 and Firefox, but with chrome it is not working. what i get is an error in console log: XMLHttpRequest cannot load file:///C:/../test/examples/test-en.json. Origin null is not allowed by Access-Control-Allow-Origin.</p> <p>how can i set it up correctly? are they any incompqtibilites with jquery 1.6.. or web browsers?</p> <p>thanks</p>
javascript jquery
[3, 5]
4,596,308
4,596,309
$.getScript(): Loading js scripts conditionally
<p>Is it possible in $.getScript() to create a condition where if the first js script fails to load - for whatever reason - then run the second js? Like a backup? </p> <p>Any way to make this work with jQuery 1.2 and/or 1.4?</p> <p>Thanks a lot!</p>
javascript jquery
[3, 5]
24,584
24,585
Create a custom PrincipalPermission for ASP.Net
<p>I have to build a web application with form authentications and I have my own roles and permissions for each user (Add, Update, Delete, View). PrincipalPermission is very useful in denying any user without permissions to from running a specific method, but I don't want to use a membership — I have my own permissions and roles.</p> <p>How I can create my own PrincipalPermission to check my custom privileges? I think it must be like this <code>[CustomPrincipalPermission(SecurityAction.Demand,UserPrivilege=currentUser.x)]</code> Where <code>currentUser.x</code> is bool to indicate if user have to access this method.</p> <p>Is this possible, and if so how?</p>
c# asp.net
[0, 9]
4,049,200
4,049,201
Remove querystring from URL
<p>What is an easy way to remove the querystring from a Path in Javascript? I have seen a plugin for Jquery that uses window.location.search. I can not do that: The URL in my case is a variable that is set from AJAX.</p> <pre><code>var testURL = '/Products/List?SortDirection=dsc&amp;Sort=price&amp;Page=3&amp;Page2=3&amp;SortOrder=dsc' </code></pre>
javascript jquery
[3, 5]
5,038,744
5,038,745
whats wrong with this simple snippet (parsing string into array)?
<p>Assuming element with id 'id2' is a textarea with the following entries:</p> <p>[email protected], [email protected], [email protected]</p> <p>When I run this, I am getting values 0, 1 and 2 - why?</p> <pre><code>jQuery('#myid').submit(function() { var temp = jQuery('#id2').serializeArray(); var email_arr = temp[0].value.split(','); for (e in email_arr) alert(e); return false; }); </code></pre>
javascript jquery
[3, 5]
1,971,768
1,971,769
What is the php equivalent for Encoding.ASCII.GetBytes(vstrEncryptionKey.ToCharArray())
<p>What is the PHP equivalent for the following C# code</p> <pre><code>Encoding.ASCII.GetBytes(vstrEncryptionKey.ToCharArray()) </code></pre> <p>where <code>vstrEncryptionKey</code> is a variable?</p>
c# php
[0, 2]
1,497,630
1,497,631
jQuery - how to check if an element exists?
<p>I know that you can test for <code>width()</code> or <code>height()</code> but what if the element's display property is set to none? What other value is there to check to make sure the element exists?</p>
javascript jquery
[3, 5]
663,510
663,511
Setting Navigation url to hyperlink dynamically
<p>Im trying to set navigation url to a hyperlink which is inside a gridview.</p> <p>Im creating the table inside the gridview using a literal in backend c# code.</p> <p>The code now look like inside GridviewRowDataBound(object sender, GridViewRowEventArgs e)</p> <pre><code>Literal.Text += "&lt;asp:HyperLink ID='hlContact' runat='server' NavigateUrl='#'&gt;Contact &lt;/asp:HyperLink&gt;"; </code></pre> <p>I want to set the navidation inside this code</p> <p>If anyone have an idea it will be helpful</p> <p>Thanks</p>
c# asp.net
[0, 9]
2,264,318
2,264,319
Doing something with the ID of each checked box
<p>I've just learned that we can iterate through all checkboxes in a document, but I'm unclear on how to do anything with the values or properties of the checkboxes found.</p> <p>Here's my code:</p> <pre><code> function buildrow(){ $("input[type=checkbox][checked]").each( function() { alert($this.attr('id');//This doesn't work } ); } </code></pre> <p>How do we do pull a value out and do something with it? Such as pull the value for the ID and set it as a variable?</p> <p>Thanks</p>
javascript jquery
[3, 5]
4,530,643
4,530,644
jQuery, delay ctrl+c to focus and highlight text
<p>I know it's possible to prevent ctrl+c from working on websites with <code>jQuery</code>. So this led me to think that maybe it is possible to pause or interrupt the process so you can focus and highlight some text, and then let it continue.</p> <p>The idea would be to specify what is sent to the clipboard when ctrl+c is pressed. So the flow would be: </p> <ol> <li>User presses ctrl+c.</li> <li>jQuery intercepts the key press.</li> <li>jQuery adds and then highlights some text on the page.</li> <li>jQuery then lets the ctrl+c process continue so the highlighted text is now copied.</li> </ol> <p>Sound possible?</p>
javascript jquery
[3, 5]
5,238,353
5,238,354
manipulating radio box selection with javascript
<p>i'm trying to do a poll but i designed it without any radio box in it. So i decided to make the selection being highlighted with a different background color, all is done with jquery.</p> <p>I set the display of the radio box to none so that it wouldn't show, gave each a unique ID. Here's the script.</p> <pre><code>&lt;form action="v_poll.php" method="post"&gt; &lt;ul class="voting"&gt; &lt;li class="voting votetext"&gt;&lt;input type="radio" name="voting" value="a1" style="display:none;" id="a1"&gt;&lt;a onClick="vote('a1')"Answer 1&lt;/a&gt;&lt;/li&gt; &lt;li class="voting votetext"&gt;&lt;input type="radio" name="voting" value="a2" style="display:none;" id="a2"&gt;&lt;a onClick="vote('a2')"&gt;Answer 2&lt;/a&gt;&lt;/li&gt; &lt;li class="voting votetext"&gt;&lt;input type="radio" name="voting" value="a3" style="display:none;" id="a3"&gt;&lt;a onClick="vote('a3')"&gt;Answer 3&lt;/a&gt;&lt;/li&gt; &lt;input type="hidden" value="1" name="id" /&gt; &lt;input type="submit" value="submit"&gt; &lt;/ul&gt; &lt;/form&gt; &lt;script type="text/javascript"&gt; function vote(TheValue) { GetElementById(TheValue).checked=true; } &lt;/script&gt; </code></pre> <p>But when i checked the value of the radio box with $_POST['voting'], it is blank. Not the value assigned to the radio box. Anything i'm doing wrong?</p> <p>Please help. Thanks.</p>
php javascript
[2, 3]
4,224,603
4,224,604
How can I scroll to an element so that it's at the bottom of the scrolling div?
<p>I want to automatically scroll to an element but I can't get it to scroll so that #elem is at the bottom of the #crm_corp_scroll div. I tried using</p> <pre><code>$j('#crm_corp_scroll').animate({scrollTop: $j('#'+elem).offset().top},'fast'); </code></pre> <p>but it scrolls the div so that the element is at the top and out of view.</p> <p>I tried the native scrollIntoView but it scrolls me to the middle of the element. I want the full element to be into view.</p> <p><a href="http://jsfiddle.net/HLxGM/" rel="nofollow">jsFiddle for how it works right now</a>. I want it to scroll so row6 is at the bottom of #crm_corp_scroll.</p> <p>Figured out a sollution: </p> <pre><code>$j('#crm_corp_scroll').animate({scrollTop: ($j('#'+elem).offset().top - $j('#crm_corp_scroll').height() + $j('#'+elem).height() * 2) },'fast'); </code></pre> <p>this scroll elem into view at the bottom of the #crm_corp_scroll div.</p>
javascript jquery
[3, 5]
1,648,853
1,648,854
Can I pass a .net Object via querystring?
<p>I stucked at a condition , where i need to share values between the pages. I want to share value from Codebehind via little or no javascript. I already have a question here on SO , but using JS. Still did'nt got any result so another approach i am asking.</p> <p>So I want to know can i pass any .net object in query string. SO that i can unbox it on other end conveniently.</p> <p><strong>Update</strong></p> <p><strong>Or is there any JavaScript approach, by passing it to windows modal dialog. or something like that.</strong></p> <p>What I am doing</p> <p>What i was doing is that on my parent page load. I am extracting the properties from my class that has values fetched from db. and put it in a <code>Session["mySession"]</code>. Some thing like this. </p> <pre><code>Session["mySession"] = myClass.myStatus which is List&lt;int&gt;; </code></pre> <p>Now on one my event that checkbox click event from client side, i am opening a popup. and on its page load, extracting the list and filling the checkbox list on the child page. </p> <p>Now from here user can modify its selection and close this page. Close is done via a button called save , on which i am iterating through the checked items and again sending it in Session["mySession"]. </p> <p>But the problem is here , when ever i again click on radio button to view the updated values , it displays the previous one. That is , If my total count of list is 3 from the db, and after modification it is 1. After reopening it still displays 3 instead of 1.</p>
c# asp.net
[0, 9]
5,149,357
5,149,358
How to convert integer type to amount type in javascript?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/149055/how-can-i-format-numbers-as-money-in-javascript">How can I format numbers as money in JavaScript?</a> </p> </blockquote> <p>In JavaScript I accessed a variable like this:</p> <pre><code>amount= document.getElementById('&lt;%= DataItemValue1.ClientID%&gt;').firstChild.nodeValue; </code></pre> <p>Now if the amount is <code>10945</code> I want it as <code>$10,945</code>; if <code>1098</code> as <code>$1,098</code></p> <p>How can I do this in javascript and pass it to a label?</p> <p>Thanks a lot.</p>
javascript asp.net
[3, 9]
4,245,609
4,245,610
Multiple click events on one element
<p><a href="http://jsfiddle.net/rHVcX/1/" rel="nofollow">http://jsfiddle.net/rHVcX/1/</a></p> <p>Is it possible to have multiple click events on one elements, when using different selectors?</p> <pre><code>&lt;button id="test" class="testclass"&gt;test&lt;/button&gt; &lt;button id="test2" class="testclass2"&gt;test 2&lt;/button&gt; //only B $('.testclass')[0].click(function(){alert('A');}); $('#test').click(function(){alert('B');}); // A and B $('#test2').click(function(){alert('A2');}); $('#test2').click(function(){alert('B2');}); </code></pre>
javascript jquery
[3, 5]
5,426,108
5,426,109
highlight div on page load?
<p>I want to highlight a div on page load. i could find a solution. But the issue is that it fades out entire content of the div. what i used</p> <pre><code>$('#searchdiv .highligth').fadeOut(1000); </code></pre> <p>and the html i have written</p> <pre><code> &lt;div id="searchdiv"&gt; &lt;div class="highligth"&gt; &lt;table cellspacing="2"&gt; &lt;tr&gt; &lt;td&gt; &lt;a class="anchorText"&gt;Filter By:&lt;/a&gt; &lt;/td&gt; &lt;td&gt; &lt;asp:ObjectDataSource ID="objLanguage" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetLanguage" TypeName="Lang.Repositories.LanguageRepository"&gt; &lt;/asp:ObjectDataSource&gt; &lt;asp:DropDownList ID="dlFilter" runat="server" DataSourceID="objLanguage" DataTextField="LanguageType" DataValueField="LanguageId" Width="150px" AppendDataBoundItems="True" OnDataBinding="dlFilter_DataBinding" OnDataBound="dlFilter_DataBound"&gt; &lt;/asp:DropDownList&gt; &lt;/td&gt; &lt;td&gt; &lt;asp:Button ID="btnFilter" runat="server" Width="90px" Text="Filter" OnClick="btnFilter_Click" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>for few seconds the div is highlighted and as fadeout is mentioned so the content also fade out and the div becomes empty. How to let those control be visible??</p> <p>Thanks.</p>
jquery asp.net
[5, 9]
1,134,110
1,134,111
Run script when div is visible in browser window
<p>I need to run some JavaScript when a <code>div</code> is visible in the browser window, for example, when it is scrolled to, even repeatedly. How would I go about doing so? </p> <p>Basic structure: </p> <pre><code>&lt;div class='page1'&gt;&lt;/div&gt; &lt;div class='page2'&gt;&lt;/div&gt; &lt;div class='page3'&gt;&lt;/div&gt; &lt;div class='page4'&gt;&lt;/div&gt; </code></pre> <p>CSS:</p> <pre><code>div { float: left; height: 500px; width: 500px; margin: 50px 0; background: grey; } </code></pre> <p>Fiddle: <a href="http://jsfiddle.net/Q5BUe/1/" rel="nofollow">http://jsfiddle.net/Q5BUe/1/</a></p>
javascript jquery
[3, 5]
2,728,674
2,728,675
jQuery check detection, hiding previous (jsFiddle enclosed)
<p>I am trying to remove text fields with checkboxes as shown in the jsFiddle. However, as you can see, one of the boxes is checked but its corresponding text field exists. Can someone help me edit this to get this to hide the corresponding text fields for already checked items on load?</p> <p>Thanks!</p> <p><a href="http://jsfiddle.net/masedesign/jdbmK/1/" rel="nofollow">http://jsfiddle.net/masedesign/jdbmK/1/</a></p>
javascript jquery
[3, 5]
5,588,757
5,588,758
prepend a div and hide it with this object
<pre><code>&lt;div id="newsSubmit"&gt;&lt;b&gt;Add random snippet&lt;/b&gt;&lt;/div&gt; &lt;script&gt; $("#newsSubmit").click(function(){ $("body").append("&lt;div class='lol'&gt;Ok, DELETE this snippet (click here)&lt;/div&gt;"); }); $(".lol").click(function(){ $(this).fadeOut(); }); &lt;/script&gt; </code></pre> <p><a href="http://jsfiddle.net/apzdt/6/" rel="nofollow">http://jsfiddle.net/apzdt/6/</a></p> <p>How can I fix it? It's not working</p>
javascript jquery
[3, 5]
2,001,928
2,001,929
String, Pattern match
<p>I can build the string like this:</p> <pre><code>String str = "Phone number %s just texted about property %s"; String.format(str, "(714) 321-2620", "690 Warwick Avenue (679871)"); //Output: Phone number (714) 321-2620 just texted about property 690 Warwick Avenue (679871) </code></pre> <p>What I want to achieve is reverse of this. Input will be following string</p> <p><em>Phone number (714) 321-2620 just texted about property 690 Warwick Avenue (679871)</em></p> <p>And I want to retrieve, "<em>(714) 321-2620</em>" &amp; "<em>690 Warwick Avenue (679871)</em>" from input</p> <p>Can any one please give pointer, how to achieve this in Java or Android?</p> <p>Thank you in advance.</p>
java android
[1, 4]
2,694,905
2,694,906
If grade is below 75 change color to red
<p>I need help about jQuery. How I can I make the font color of the 74 into red. I mean once grade is below 75 font color will change to red or else green if passed.</p> <pre><code>$("document").ready( function(){ //alert("working"); var passing_grade = parseInt("75"); var grade = parseInt($(".grade").val()); if( grade &lt; passing_grade ){ $(".grade").css("color","#ff000"); } else { $(".grade").css("color","#066d06"); } } ); </code></pre>
javascript jquery
[3, 5]
3,656,180
3,656,181
PHP SQL and Android
<p>i create a program in Android (login) that send id to a php page then the phppage check if that id in the database or not.the php page send acknowledgement to the android application then compare the received data with null if it not null then the login successful. but i have a problem with the compare step i convert the received data to string then do the compare operation ,if i receive null and compare it to null the if statement can not catch it. the my php page :</p> <pre><code>&lt;?php $data = file_get_contents('php://input'); $json = json_decode($data); $id=$json-&gt;{'im'}; $con = mysql_connect('localhost','root','1111'); mysql_select_db('root') or die(' '); $sql = "SELECT name FROM chiled WHERE `im` LIKE $id "; $query = mysql_query( $sql ); $a=mysql_fetch_row($query); print(json_encode($a[0])); mysql_close(); ?&gt; </code></pre> <p>This is the android app :</p> <pre><code>try { HttpPost post = new HttpPost(path); json.put("im", id); Toast.makeText( getApplicationContext(),"after put the data in json ",Toast.LENGTH_SHORT).show(); // Log.i("jason Object", json.toString()); post.setHeader("json", json.toString()); StringEntity se = new StringEntity(json.toString()); se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE,"application/json")); post.setEntity(se); response = client.execute(post); /* Checking response */ if (response != null) {// the response can not be null even if i did not send a data InputStream in = response.getEntity().getContent(); // String recievedData = convertStreamToString(in); if (!recievedData .equals(null)){ Toast.makeText( getApplicationContext(),"**LOGIN SUCCESSFUL YOU CAN DO ANYTHING***",Toast.LENGTH_SHORT).show(); } else { Toast.makeText( getApplicationContext(),"&lt;&lt;&lt;&lt; LOGIN FAILD GOODBY &gt;&gt;&gt;&gt;",Toast.LENGTH_SHORT).show(); } </code></pre>
php android
[2, 4]
4,241,198
4,241,199
jQuery find if div with id=X exists inside a DOM string
<p>I'm trying to check if a div with an id exists in a string holding some html, so I'm looking for a function that returns true or false. </p> <p>There's a function hasClass that checks if a div has a certain class</p> <pre><code>$('#mydiv').hasClass('bar') </code></pre> <p>I guess what I'm looking for is something like</p> <pre><code>var mystring = "some string with html"; mystring.hasId('lookingforthisid'); </code></pre> <p>How can I check this?</p>
javascript jquery
[3, 5]
4,969,171
4,969,172
select the #targetElem siblings(div class="content") animate
<p>the html is</p> <pre><code>&lt;a class="minimize" href="#targetElem" &gt;Min&lt;/a&gt; &lt;div id="targetElem"&gt; &lt;p class="handler"&gt;&lt;/p&gt; &lt;div class="content"&gt; content area &lt;/div&gt; &lt;/div&gt; </code></pre> <p>the javascript is the following code</p> <pre><code>$(document).ready(function(){ $('a.minimize').click(function() { $($(this).attr('href')).siblings(".content").slideToggle("slow"); }); }); </code></pre> <p>what i want is when click on the a href class minimize , the target of the href (#targetElem)no change, but select the #targetElem siblings(div class="content") animate, bcos i want to use them over and over,i don't want to add a lot of code to the .js file like the following code:</p> <pre><code>$(document).ready(function(){ $('a.minimize').click(function() { $('#targetElem').siblings(".content").slideToggle("slow"); }); $('a.minimize1').click(function() { $('#targetElem1').siblings(".content").slideToggle("slow"); }); $('a.minimize2').click(function() { $('#targetElem2').siblings(".content").slideToggle("slow"); }); $('a.minimize3').click(function() { $('#targetElem3').siblings(".content").slideToggle("slow"); }); }); </code></pre> <p>so how can i do this???</p>
javascript jquery
[3, 5]
2,090,046
2,090,047
Getting a class instance after set context of the class
<p>i was wondering how i can call a int value from the Gameview class after i do this : <code>setContentView(new GameView(this, this));</code>. Setting a new instance like <code>GameView game = new GameView(this , this );</code> after setting the content view will just crash my program. is there any way else to retrieve my int value?</p>
java android
[1, 4]
4,058,945
4,058,946
add <br/> after third space of a string
<p>I am trying to add <code>&lt;br /&gt;</code> after the third space of a string, for example:</p> <p><code>'an apple a day keeps the doctor away'</code></p> <p>I want the string like:</p> <pre><code>'an apple a day keeps the doctor away' </code></pre> <p>Any help?</p>
javascript jquery
[3, 5]
4,014,044
4,014,045
Insert value into TEXTAREA where cursor was
<p>I have a textarea and a div with values. When I click on a value I insert it into textarea. I need it to be inserted where my cursor was in textarea. Why do I say WAS? Because when I move it out and click on a value to insert, I assume it looses focus in the text area. </p> <p>So, my question is, is there a way to "remember" the latest cursor position within textarea and then insert my values at that position?</p> <p>Perhaps it could be a char number in a string?.. Currently I add it like this: </p> <pre><code>input.val( function( i, val ) { return val + " " + myInsert + " "; } ); </code></pre> <p>Also I use jQuery, perhaps I could use it?</p>
javascript jquery
[3, 5]
4,289,829
4,289,830
Masking the file input CSS and javaScript
<p>I'm able to mask the file input with the following code.</p> <pre><code>&lt;div class="new_Btn" &gt;Choose from computer&lt;/div&gt; &lt;input type="file" name="pic" id="html_btn" style="display:none;" /&gt; </code></pre> <p>Then I use javascript</p> <pre><code> $('.new_Btn').bind("click" , function () { $('#html_btn').click(); }); </code></pre> <p>I would like to change the button when the user chooses a file, like print "Image Added" or a tick image.</p> <p>How would I check that?</p>
javascript jquery
[3, 5]
5,061,280
5,061,281
how to pass javascript array to php
<p></p> <p>I want to pass array myWorkout to 'play_workout.php'. I want 'play_workout.php' to open and display the contents of myWorkout (for this example). <em>(Once I see that this is working I will parse the data from myWorkout and write it back to a database).</em> I'm not getting any errors in firebug, but play_workout is not being opened nor is is capturing the array object myWorkout.</p> <p>I would appreciate a second glance at this. Thanks as always!</p> <p><strong>page workout_now.php</strong></p> <pre><code>&lt;div id="playworkout"&gt;&lt;button onClick="playWorkout()"&gt;Play Workout&lt;/button&gt;&lt;/div&gt; </code></pre> <p><strong>JAVASCRIPT</strong></p> <pre><code>function playWorkout(){ var arr = $("#dropTargetframe &gt; li").map(function(){ return $(this).attr('data-id');}).get(); var myRoutine = arr; var myWorkout = new Array(); for (var i in myRoutine){ if (myRoutine[i]) myWorkout.push(myRoutine[i]); } //array appears like ["4", "5", "1", "4"] JSON.stringify(myWorkout); encodeURIComponent(myWorkout); var url = "http://localhost/RealCardio/play_workout.php"; $.get(url, myWorkout); </code></pre> <p><strong>page play_workout.php</strong></p> <pre><code>&lt;?php ... $arrayWorkout = json_decode($_REQUEST['myWorkout']); print_r($arrayWorkout); ... ?&gt; </code></pre>
php javascript
[2, 3]
3,332,464
3,332,465
.text() function does not show HTML tags like I want. How do I fix this?
<p>I am trying to limit 300 charecters to show in a container and using this</p> <pre><code>&lt;script&gt; $(function () { $('.shippingMessage').append($('#forQuickViewOnly')); var myDiv = $('#firstPara'); myDiv.text(myDiv.text().substring(0, 300)); $('.productdetailtopquickview .productdetailshopnowform').appendTo($('.infoHolder')); }); &lt;/script&gt; </code></pre> <p><strong>I am trying to show <code>&lt;ul&gt;&lt;li&gt;&lt;li&gt;&lt;/ul&gt;</code> structure but i am getting a paragraph.</strong> In other words, the list formatting is getting stripped. Any idea how to prevent that? </p>
javascript jquery
[3, 5]
1,402,056
1,402,057
App with media Player forces down
<pre><code>case R.id.btn7: if (mp != null &amp;&amp; mp.isPlaying()) mp.stop(); mp = MediaPlayer.create(a.this, R.raw.aaaa); mp.start(); break; case R.id.btn8: if (mp != null &amp;&amp; mp.isPlaying()) mp.stop(); mp = MediaPlayer.create(a.this, R.raw.bbbb); mp.start(); break; </code></pre> <p>How could I use setDataSource in order to stop my app for force close? Please help! If I use it like this, eclipse highlights red the setDataSource;</p> <pre><code>public void onClick(View v) { switch(v.getId()) { case R.id.btn: if (mp != null &amp;&amp; mp.isPlaying()) mp.stop(); mp.setDataSource(zoo.this,R.raw.gata); mp.prepare(); mp.start(); break; </code></pre>
java android
[1, 4]
4,181,314
4,181,315
URL split? in C#?
<p>I have a url like "site.com/page?a=1&amp;ret=/user/page2" I was using string.split('/') to figure out the paths but this case you can see it isnt very useful. How do i split the url so i can get the page path? (if no one gives me an answer i'll split yet again using '?')</p>
c# asp.net
[0, 9]
5,979,130
5,979,131
Jquery datetimepicker in ASP.NET
<p>I am trying to implement the jQuery datetimepicker in my ASP.NET webpage. </p> <ol> <li><p>Followed the link <a href="http://www.projectcodegen.com/JQueryDateTimePicker.aspx" rel="nofollow">http://www.projectcodegen.com/JQueryDateTimePicker.aspx</a></p></li> <li><p>I am trying to implement the sample in my code.</p></li> <li>I did add the js and the css files to my application.</li> </ol> <p>The pop-up calender with time is not displayed when I run the application.</p> <pre><code>&lt;link rel="Stylesheet" href="jquery.ui.datetimepicker.css" type="text/css" /&gt; &lt;script src="Scripts/jquery.ui.datetimepicker.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="Scripts/jquery.ui.datetimepicker.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(function(){ $('TextBox1').datetimepicker(); }); &lt;/script&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;input type="text" id="TextBox1" /&gt; &lt;/div&gt; </code></pre>
jquery asp.net
[5, 9]
3,878,203
3,878,204
Using object identifier as variable name
<p>Just wondering ...</p> <p>Playing around with C++, I found that if you create a class called <code>circle</code>, and then declare a variable named exactly as the name of the class, the compiler does not complain. For example:</p> <pre><code>class circle { // whatever it does in here }; circle circle; // is a valid statement, but circle *circle = new circle(); // gives you a 'circle' is not a type complain </code></pre> <p>It turns out that this goes for string string = "string"; as well. And tried it with Java, possible also. I guess it might work on C# too, but I haven't tried.</p> <p>Can anyone tell me the reason behind this and whether this is an intentional feature?</p>
java c++
[1, 6]
5,508,837
5,508,838
How to create popup box on header and when click on close button then not display in the site using jquery or php?
<p>I want to create functionality using <code>jquery</code>, <code>PHP</code> or <code>Javascript</code>:</p> <blockquote> <p>When website is loaded then display popupbox on the header with close button, when click on close button then popup is closed. If not click on close button then that popup is display in all the pages in the website.</p> </blockquote> <p>Could you please give me suggestion for that? I have no idea about it.</p>
php javascript jquery
[2, 3, 5]
1,910,695
1,910,696
Find all classes in a package in Android
<p>How can i find all classes inside a package on Android? I use PathClassLoader, but it always returns an empty enumeration?</p> <p>Additional info</p> <p>Tried the suggested Reflections approach. Couple of important points about reflections library. The library available through maven central is not compatible with Android and gives dex errors. I had to include source and compile dom4j, java-assist. </p> <p>The problem with reflections, and my original solution is that PathClassLoader in android returns an empty enumeration for package. </p> <p>The issue with approach is that getResource in Android is always returning empty enumeration.</p> <pre><code>final String resourceName = aClass.getName().replace(".", "/") + ".class"; for (ClassLoader classLoader : loaders) { try { final URL url = classLoader.getResource(resourceName); if (url != null) { final String normalizedUrl = url.toExternalForm().substring(0, url.toExternalForm().lastIndexOf(aClass.getPackage().getName().replace(".", "/"))); return new URL(normalizedUrl); } } catch (MalformedURLException e) { e.printStackTrace(); } } </code></pre>
java android
[1, 4]
3,573,613
3,573,614
PHP/JQuery Input Boxes for an image upload
<p>I am currently working with multiple php image uploading but using this <a href="http://dondedeportes.es/uploader-previewer/" rel="nofollow">SITE</a> I am unable to figure out, if I can increase from 3 to 4 inputs for file upload? i have looked through all the files but havent found anything relevant. Any one used this <a href="http://dondedeportes.es/uploader-previewer/" rel="nofollow">SITE</a> example before can help me?</p> <p><strong>Jquery</strong> </p> <pre><code>(function($) { $(document).ready(function() { // it must be checked if there are div.imageForms because the // uploaderPreviewer javascript may be not included and produce an error if ($('div.imageForms').length) { $('div.imageForms').append($.uploaderPreviewer.createImageForms()); // the images are populated if the admin form is to edit, and not // to insert if ($('div.imageForms[images]').length) { var imageFilenames = $('div.imageForms[images]').attr('images').split(','); $.uploaderPreviewer.populateImages(imageFilenames); $('div.imageForms[images]').removeAttr('images'); } } $('#buttonSave').click(function() { var itemId = $(this).attr('itemId'); if (itemId) { $.itemForm.update(itemId); } else { $.itemForm.insert(); } }); }); })(jQuery); &lt;/script&gt; </code></pre> <p><strong>HTML</strong></p> <pre><code>&lt;html&gt; &lt;div class="imageForms"&gt;&lt;/div&gt; &lt;div class="buttonSave"&gt; &lt;button id="buttonSave"&gt;Upload&lt;/button&gt; &lt;/div&gt; &lt;/div&gt; &lt;/html&gt; </code></pre>
php jquery
[2, 5]
2,670,457
2,670,458
How to implement this function of all dataviewers in ASP.NET C#?
<p>I am displaying four records at a time, each having a check box.</p> <p>The design is static. I would like to know a way to find out, if a check box clicked, then extract the name displayed in label to its left.</p> <p>How would the code know what lies to its left?</p> <p>That is, find out in which row the click occurred?</p>
c# asp.net
[0, 9]
132,047
132,048
Send device token with HTTP POST
<p>we need to send an http post from an iphone device to our server with some info which the device token (APNS) which we want to store. How on the server do you read the HTTP post and store what is in it? We just have a standard ISP hosted server which currently just has a website.</p> <p>Thanks</p>
php iphone
[2, 8]
1,509,840
1,509,841
selection index change is not working of drop down list
<p>i have only one element in drop downlist so selection index change is not working... the datasource is given to run time... if it was on designing time i can give the select one list item... but at run time what should i do????????</p>
c# asp.net
[0, 9]
1,244,914
1,244,915
How to take a picture of in panaroma mode?
<p>I want to make an application that allow the user to take a picture of text either from android device Gallery or from android Camera application in a Panorama mode .But i can not find any source or tutorial to do this.How can i do this in my application? how to make an application that take picture from android camera application in a panaroma mode?</p> <p>Thanks in advance.</p>
java android
[1, 4]
669,302
669,303
jQuery: Adding HTML inside a dynamic list
<p>Hi I have a piece of jquery that dynamically creates an unordered list:</p> <pre><code>var get_url = "&lt;?php echo base_url(); ?&gt;index.php/notes/get/"+&lt;?php echo $id;?&gt;; $.get(get_url, function(data) { $.each(data,function(index, arr) { var opt = $('&lt;li /&gt;'); opt.text(arr['body']); $('#notes-list').append(opt); }); }); </code></pre> <p>This produces the correct list but I want to add &lt; pre> tags around the text in the list item.</p> <p>Can someone point me in the right direction?</p> <p>I've tried opt.innerHTML = "&lt; pre />"; but no luck.</p> <p>Thanks,</p> <p>Billy</p>
javascript jquery
[3, 5]
6,004,459
6,004,460
How to highlight only the text on hover, not whitespace? (javascript)
<p>I am using jquery to highlight on hover, but it highlights entire div instead of just text. I tried using an "a tag" but do not want a reference link obviously. im sure this is simple, but im wasting too much time on trial and error. tia</p>
javascript jquery
[3, 5]
891,618
891,619
Validating DOM Elements
<p>I have some input HTML elements which I want to validate whether they are filled up or not. Basically, they are mandatory. I am doing something like this:</p> <pre><code> var displayNames new Array(); displayNames[0] = "Name"; displayNames[1] = "Address"; displayNames[2] = "Age"; function validForm() { var Name = document.getElementById(txtName).value; if(!Name) { alert(displayName[0] is required); }} </code></pre> <p>How should I make the validations easy in JS?</p>
javascript jquery
[3, 5]
150,044
150,045
Using jQuery, how do I disable the click effect on the current tab?
<p>I have a menu with an animation going on, but I want to disable the click while the animation is happening.</p> <pre><code>&lt;div&gt;&lt;/div&gt; &lt;div&gt;&lt;/div&gt; &lt;div&gt;&lt;/div&gt; $("div").click(function() { $(this).animate({height: "200px"}, 2000); return false; }); </code></pre> <p>However, I want to disable all the buttons while the event is happening, AND disable the div that was clicked. </p> <p>I was thinking of adding a class to the div that's clicked and putting the click only on the divs without that class:</p> <pre><code>$("div").not("clicked").click(function() { $(this).animate({height: "200px"}, 2000).addClass("clicked"); return false; }); </code></pre> <p>But this doesn't appear to work (I think it does logically)?</p> <p>Any help appreciated.</p> <p>Cheers,<br /> Steve</p>
javascript jquery
[3, 5]
1,536,752
1,536,753
User credentials are sent in clear text in asp.net website
<p>I run an Audit on my website and it shows that "User credentials are sent in clear text"</p> <p>Form authentication is enabled in my website and it should be accessed from anywhere.</p> <p>How to send password in encrypted format?</p> <p>is SSL the only option, I read around and found that enabling Digest authentication can do this also, is there any disadvantage if I change Basic to digest in IIS?</p>
c# php asp.net
[0, 2, 9]
4,988,848
4,988,849
Jquery: Slide up div if last
<p>I have this friend request page, and i want my div </p> <pre><code>echo "&lt;div style=' font-weight: bold; background: #283b43; border-bottom: 1px dashed #719dab;'&gt;"; echo "&lt;img src='images/NewFriend_small.png' style='float: left; margin-left: 25px; margin-right: 10px;'&gt;"; echo "Friend requests"; echo "&lt;/div&gt;"; </code></pre> <p>To disappear too if it's the last friend request the user have. Right now it doesnt do it, and only slide up the actual request (username, picture and so)</p> <p>How should i check for if its the last friendrequest?</p> <p>Right now its my code is like this</p> <pre><code> $friendsWaiting = mysql_query("SELECT * FROM users_friends where uID = '$v[id]' AND type = 'friend' AND accepted = '0'"); while($showW = mysql_fetch_array($friendsWaiting)){ echo "id: $showU[bID]"; } </code></pre> <p>JS when they accept/deny friend:</p> <pre><code>function MeYouFriendNB(confirm){ var c = confirm ? 'confirm' : 'ignore'; var fID = $('#fID').val(); $.ajax({ type: "POST", url: "misc/AddFriend.php", data: { mode: 'ajax', friend: c, uID : $('#uID').val(), fID : $('#fID').val(), bID : $('#bID').val() }, success: function(msg){ $('#friend'+fID).slideUp('slow'); $('#Friendlist').prepend(msg); $('#theNewFriend').slideDown('slow'); } }); } </code></pre>
php javascript jquery
[2, 3, 5]
4,247,377
4,247,378
ButtonX.Visible = false; Hangs the browser
<p>Asp.Net C# web application I have a <code>Button X</code>,<br> On the Server side C# <code>(ButtonX.Visible = false;)</code> Button goes away (good), but on the next post the page never renders. I debugged all works fine, debugger returns control, but the page never renders. If I comment out the<br> <code>(ButtonX.Visible = false;)</code> all works fine, except for the <code>buttonX</code> being visible in the Browser</p> <p>Whats up with that? Any help would be appreciated. Thanks </p>
c# asp.net
[0, 9]
1,371,544
1,371,545
change asp.net panel rendered tag from div to span
<p>I have an <code>&lt;asp:Panel&gt;</code> inside an <code>li</code>, so the problem is the html will not validate.</p> <p>Any help in changing the rendered <code>div</code> to a <code>span</code>?</p> <p>I'm doing this in a ASP.NET 4.0 website using c# code.</p>
c# asp.net
[0, 9]
3,152,023
3,152,024
Prevent element from animating based on previous class
<pre><code>$('.example').hover( function () { $(this).css('background','red'); }, function () { $(this).css('background','yellow'); } ); $('.test').click(function(){ $(this).css('marginTop','+=20px').removeClass('example'); } ); &lt;div class="text example"&gt;&lt;/div&gt; </code></pre> <p>Although the class <code>example</code> was seemingly removed, the <code>hover</code> actions for it are still being applied to the element that once had that class. How can I prevent this?</p> <p><a href="http://jsfiddle.net/gSfc3/" rel="nofollow">http://jsfiddle.net/gSfc3/</a></p> <p>Here it is in jsFiddle. As you can see, after executing the <code>click</code> function to remove the class, the background still changes on hover.</p>
javascript jquery
[3, 5]
1,905,365
1,905,366
For loop error checking
<p>Everything works, the one thing that is not working is it is making a note for every single account even if nothing was done/found for that account.</p> <pre><code>for (int j = 0; j &lt; accounts.Length; j++) { SqlConnection connection = new SqlConnection(SqlDataSource1.ConnectionString); SqlCommand SqlComm = new SqlCommand("insert into TableHistory (id, startDate, dueDate, userid, amount, number, needsReview, offer, dateAdded, dateRejected, rejectedBy) " + "select (select max(id) + 1 from Table1), startDate, dueDate, userid, amount, number, needsReview, offer, dateAdded, GETDATE(), @userID from Table1 where number = @number " + "delete from Table1 where number = @number", connection); SqlComm.Parameters.Add("@number", SqlDbType.Int).Value = Convert.ToInt32(accounts[j].ToString()); SqlComm.Parameters.Add("@userID", SqlDbType.Int).Value = userID; connection.Open(); SqlComm.ExecuteNonQuery(); connection.Close(); NoteAccount note = new NoteAccount("Personal Note", accounts[j].ToString(), userID); note.makeNote(); } </code></pre> <p>Lets say Account 11 does not have anything in <code>Table1</code>. Nothing will fail, because the insert statement won't fire because the select statement returns nothing from <code>Table1</code>, this is fine.</p> <p>But the <code>note.makeNote();</code> fires and adds a "personal" note to the account when doesn't need to be added. Is there an easy way to only add the note if the account exists in <code>Table1</code>?</p>
c# asp.net
[0, 9]
121,645
121,646
if isset statement with javascript?
<p>În php I would use this to see if a variable is set and then use that value, otherwise make it a zero:</p> <pre><code> $pic_action = isset($_POST['pic_action']) ? $_POST['pic_action'] : 0; </code></pre> <p>But what is the equivalent in javascript?</p> <p>I want to check if an element exists in the document, and then if it does, add it to the variable, otherwise add some other value to it, here is what I have so far:</p> <pre><code> var areaOption = document.getElementById("element"); </code></pre> <p>Thanks</p>
php javascript
[2, 3]
1,659,010
1,659,011
Using php information in jQuery
<p>I am trying to get a variable from the php code and put it in jquery i have tryed this and it does not work can anyone help me?</p> <pre><code>&lt; script type="text/javascript" src="js/jquery.query-2.1.6.js"&gt;&lt;/script&gt; &lt;? $next_exp = 123; ?&gt; $(document).ready(function() { var next_exp = $.query.get('next_exp'); $("#pb5").progressBar({ max: next_exp, textFormat: 'fraction',barImage: 'images/progressbg_orange.gif' }); </code></pre> <p>});</p>
php jquery
[2, 5]
153,619
153,620
How to know which page is redirected? in javascript
<p>how to determine which page is redirected? </p> <p>i am using this code but this is not helping what i am looking for: </p> <pre><code> $(function () { //var locate = window.location; //var t = window.location.hash; var pagename = location.pathname.substr(location.pathname.lastIndexOf("/") + 1, location.pathname.length).toLowerCase(); if (pagename == "toppages.aspx") { $('#back_to_your_list').show(); } else { $('#back_to_your_list').hide(); } }); </code></pre> <p>EDIT:</p> <p>So, I have a link on my home page (<code>mydomain.com/employee/default.aspx</code>) and once the user click on it then this will redirect to another page (<code>mydomain.com/employee/toppages.aspx</code>) from it there are other links and say the user click on a link called <code>Background check</code> and this will redirect to a different page and this time the url of this page will be (<code>mydomain.com/employee/toppages.aspx?id=123</code>) </p> <p>the logic should be.</p> <p>if the page is coming from <code>mydomain.com/employee/toppages.aspx?id=123</code> then <code>$('#back_to_your_list').show();</code> otherwise <code>hide</code></p> <p>i hope it make sense and confused :)</p>
javascript jquery
[3, 5]
5,571,409
5,571,410
Make delete button procedurally
<p>I have HTML:</p> <pre><code>&lt;button id='pusher'&gt;pusher&lt;/button&gt; &lt;ul id="sortable"&gt; &lt;li&gt;things here&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>And JavaScript:</p> <pre><code>$(".del").click(function(e) { $(this).parent().remove(); }); $("#pusher").click(function(e) { var text = "test"; var lix = $("&lt;li class='uix' /&gt;").text(text); lix.append($('&lt;button class="del"&gt;xx&lt;/button&gt;')); lix.appendTo($("#sortable")); }); </code></pre> <p>I'm trying to make the pusher button make new <code>&lt;li&gt;</code> elements with a delete button inside, then when delete button is pressed it deletes its <code>&lt;li&gt;</code> element...</p> <p>But it is not deleting.</p> <p>Any ideas?</p>
javascript jquery
[3, 5]
636,882
636,883
Working with associative arrays in javascript
<p>I want to use a variable as index of my associative array</p> <pre><code>var usersName = []; // Just defining userName[socket.id] = socket.name; // socket.id is an alphanumeric string </code></pre> <p>I want to use that <code>socket.id</code>(string) as the custom index of <code>usersName</code> array, so I can get a list of all the users connected to the socket. The problem is the way I'm escaping the variable ( I guess).</p> <p>I've tried this but didn't work:</p> <pre><code>usersName ['\''+socket.id+'\''] = socket.name; </code></pre> <p>This works in PHP but, I just can't get it to work in javascript</p> <p>Thanks for the help.</p>
javascript jquery
[3, 5]
4,884,243
4,884,244
jquery dynamic url
<p>I have a form and the url for submitting the form will generated dynamicly </p> <pre><code>var Var1 = new Array(); var Var2 = new Array(); if(Var1.length === 0) $(this).attr('action', 'http://localhost/Method' ).submit(); if(Var1.length != 0 &amp;&amp; Var2.length === 0) $(this).attr('action', 'http://localhost/Method/Var1').submit(); if(Var1.length != 0 &amp;&amp; Var2.length != 0) $(this).attr('action', 'http://localhost/Method/Var1/Var2').submit(); </code></pre> <p>and all that URLs fires one method in the server and it is </p> <pre><code>public function Method(){} public function Method(Var1){} public function Method(Var1 , Var2){} </code></pre> <p>is there anyway to make all the last 3 methods as one method? something like this:</p> <pre><code>public function Method(Var1, Var2){ if( condition for Var1 ){// doSomthing} if( condition for Var2 ){// doSomthing} } </code></pre>
php jquery
[2, 5]
4,111,933
4,111,934
How to compare 2 voice in Android
<p>I need some way to compare 2 voices if they match or not but can't use Google service because I need it to work in offline mode. Thank so much for watch or help.</p>
java android
[1, 4]
5,486,269
5,486,270
Show Div When Dates Match Using .Each
<p>I have a list of job postings and would like to display a div that say 'New' when the date is equal to today's date.</p> <p>To create this I have created a javascript code that will execute on a loop for each set of outer div's, but I am having trouble correctly running the .each function.</p> <p><strong>Here is the link to a JSFiddle: <a href="http://jsfiddle.net/jeremyccrane/2p9f7/" rel="nofollow">http://jsfiddle.net/jeremyccrane/2p9f7/</a></strong></p> <p>Here is the HTML Code:</p> <pre><code>&lt;div class="outer"&gt; &lt;div class="job-date"&gt;07-Feb-13&lt;/div&gt; &lt;div class="new" style="display:none;"&gt;NEW&lt;/div&gt; &lt;div class="value"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="outer"&gt; &lt;div class="job-date"&gt;12-Feb-13&lt;/div&gt; &lt;div class="new" style="display:none;"&gt;NEW&lt;/div&gt; &lt;div class="value"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>Here is the Javascript code:</p> <pre><code>$( ".outer" ).each(function(i) { var jd = $(".job-date").text(); j = jd.substr(0,2); var today = new Date(); var dd = ( '0' + (today.getDate()) ).slice( -2 ) $('.value').html(dd + "/" + j); if(dd === j) { $('.new').show(); } else { $('.new').show(); } return false; }); </code></pre>
javascript jquery
[3, 5]
68,853
68,854
Jquery: mouseover and mouseout strangeness
<pre><code>$(document) .mouseover(function(event) { if ($(event.target).parents('#myunique').length){ event.preventDefault(); }else{ $(event.target).addClass('myoutlineElement'); } }) .mouseout(function(event) { if ($(event.target).parents('#myunique').length){ event.preventDefault(); }else{ $(event.target).removeClass('myoutlineElement'); } }) </code></pre> <p>I basically have a red border highlight on all elements on a given page (externally loaded via proxy).</p> <p>Observing through firebug, it seems that addClass is not triggered properly. it adds an empty class (class="") in the given element. </p> <p>Figured it out. Use .css() instead of addClass</p>
javascript jquery
[3, 5]
1,862,436
1,862,437
How to add jquery selections together without sorting in DOM order
<p>I have a jQuery element, I'd like to search all of it's next siblings looking for a possible match and if that fails search all the previous ones.</p> <p>I would have thought I could do something like:</p> <pre><code>myDiv.nextAll("li").add(myDiv.prevAll("li")).each(function() { if (match) { return this; } } </code></pre> <p>However, this does not work. When I call jquery Add it seems to sort the collection in the order they appear in the DOM meaning that I always go back to the first matching element. I can't think of a simple way to fix this, any ideas?</p>
javascript jquery
[3, 5]
16,394
16,395
Create Auto adjustable divs based on mouse over behavior
<p>So I've been looking all over and seen a couple of similar posts but nothing that truly answers my question. I want to be able to resize divs and the content within it similar to the style of the new <a href="https://www.lafitness.com/Pages/Default.aspx" rel="nofollow">lafitness.com website</a>. I notice they are using silverlight for this function. I was curious if anyone knew how to do this in Javascript? Thank you so much for your help.</p>
javascript jquery
[3, 5]
1,034,321
1,034,322
problem when Java and C++ talk with each other
<p>Hey Guys, I have a program in C++ and it writes a binary file on disk. Then I use a Java program to read the number. The problem is the number read is different from the number written... Say, I write an integer 4 using c++ and get back 67108864 when use JAVA to read it ( using readint() ) ... I suspect its due to big or small endian. Do you have any simple solutions to solve this?</p> <p>Thanks a lot!!!</p>
java c++
[1, 6]
2,859,446
2,859,447
cropping and ajax uploading
<p>i want to upload profile pic like facebook and ajax upload the image and crop with the fix size and ajax upload to server . in jquery ,php ,</p> <p>how can i do it ?</p> <p>thanks rahul </p>
php jquery
[2, 5]