Unnamed: 0
int64 65
6.03M
| Id
int64 66
6.03M
| Title
stringlengths 10
191
| input
stringlengths 23
4.18k
| output
stringclasses 10
values | Tag_Number
stringclasses 10
values |
---|---|---|---|---|---|
4,931,090 | 4,931,091 | Transfer different chunks of data to client systems using python | <p>Well i want to transfer different chunks of data to client machine , by different i mean the data sent could be either code or a particular function , i have used basic socket program in order to transfer the content , but how do i make the client system help differentiate between these contents , i am aware of the concept of metadata, but dont know how to apply it in here . </p>
<p>Example :
This following is the basic psuedo code on how it has to work</p>
<pre><code>Server side :
# basic socket program
> conn.send(data)
Slave side:
#basic socket program
> d = conn.recv(1024)
> if d is code: execute the code
> else: store the data
</code></pre>
| python | [7] |
4,133,986 | 4,133,987 | How can i store a 128 bit number in c++? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1188939/representing-128-bit-numbers-in-c">Representing 128-bit numbers in C++</a> </p>
</blockquote>
<p>I need a way to store a 128 bit number, is there something besides unsigned long long that I can use?</p>
| c++ | [6] |
339,538 | 339,539 | How can I unbind a mouseover in jQuery for a TD within a TR? | <p>Here is my HTML:</p>
<pre><code><table id="myTable">
<tr class="myTr">
<td>
CELL 1
</td>
<td>
Cell 2
</td>
<td class="notThis">
Cell 3
</td>
</tr>
<tr class="myTr">
<td>
2- CELL 1
</td>
<td>
2- Cell 2
</td>
<td>
2- Cell 3
</td>
</tr>
</table>
<div id="myDiv">CONSOLE</div>
</code></pre>
<p>And my Javascript: </p>
<pre><code>$(document).ready( function() {
$(".myTr").mouseover( function() {
$("#myDiv").html( "OVER" );
} );
});
</code></pre>
<p>I want it so that when you mouseover the "notThis" cell, the mouseover doesn't trigger. I have a fiddle set up for testing: <a href="http://jsfiddle.net/S7bfH/3/" rel="nofollow">http://jsfiddle.net/S7bfH/3/</a></p>
<p>Thanks</p>
| jquery | [5] |
2,423,000 | 2,423,001 | copy() not working from url to folder in php | <p>I am trying to copy file from a url to a folder in my system using php</p>
<pre><code><?php $image = "http://l.yimg.com/t/frontpage/10-facts-slideshow-080512-630-01.jpg";
if (!copy($image, "localfolder/mainPic1.png")) {
echo "FAILED";
}else{echo "DONE";}
</code></pre>
<p>it always end up with "Failed"</p>
<ul>
<li><p>All permissions are set to the localfolder</p></li>
<li><p>i checked the phpinfo and found that <code>allow_url_fopen =Off</code></p></li>
</ul>
<p>as it is a shared server i do not have any control over the php settings . please can you suggest an alternative.</p>
<p>Thanks,
Jay</p>
| php | [2] |
1,569,108 | 1,569,109 | How to find country and state using ip address | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1543437/is-there-any-possible-way-to-find-the-name-of-the-country-using-ip-with-scriptin">Is there any possible way to find the name of the country using IP with scripting language PHP?</a> </p>
</blockquote>
<p>Which is the simple and best way to find country and state name ,using any ip address</p>
<p>is there any API is available for this .
i am using php</p>
| php | [2] |
4,111,295 | 4,111,296 | Remove item from multidimensional array php | <p>Here is the array:</p>
<pre><code> [cart] => Array
(
[ProductId] => Array
(
[0] => P121100001
[1] => P121100002
)
[SellerId] => Array
(
[0] => S12110001
[1] => S12110001
)
[SpecifyId] => Array
(
[0] => 1
[1] => 2
)
[Quantity] => Array
(
[0] => 1
[1] => 1
)
[Price] => Array
(
[0] => 12
[1] => 29
)
[TotalPrice] => 41
)
</code></pre>
<p>I have the ProductId and I want to remove all the other items matching P121100002's key.</p>
<p>Is there an easy way to do this I can't can seem to come up with one?</p>
| php | [2] |
122,783 | 122,784 | Auto complete through c# | <p>i want to do auto complete textox in asp.net using c#.
Need code for that.</p>
| asp.net | [9] |
3,019,768 | 3,019,769 | Toast "sending message to a Handler on a dead thread" | <p>I'm trying to display a simple message via Toast, and am getting a RunTime Exception "sending message to a Handler on a dead thread". The class that is trying to show the Toast message extends IntentService. The class (C2DMReceiver) actually comes from the ChromeToPhone example for C2DM. Here is the method:</p>
<pre><code>/**
* Called when a cloud message has been received.
*/
@Override
public void onMessage(Context context, Intent intent) {
Log.i(LOG_TAG, "A message notification has occured with the cloud.");
Log.i(LOG_TAG, "Showing toast message of the broadcast...");
Toast toast = Toast.makeText(context, "Some text", Toast.LENGTH_LONG);
toast.show();
Log.i(LOG_TAG, "Sending notification of the broadcast...");
LauncherUtils.generateNotification(this, "this is where the text would go.", "Broadcast", intent);
}
}
</code></pre>
<p>I assumed since the class extends IntentService that it would be possible to request a simple Toast message from here in this manner. Isn't this correct?</p>
| android | [4] |
2,295,172 | 2,295,173 | How to generate unique ID in clustering | <p>Is there any clustering API that helps in generating the unique ID across many servers?</p>
| java | [1] |
2,223,587 | 2,223,588 | Using Page.FindControl() to get an instance of a (third party) control keeps returning null | <p>I have an ASP.NET site and on one page, there are a couple of controls (third party - Telerik).</p>
<p>If I use Page.FindControl(), and pass in the ID of the control (Which is spelt correctly), this always returns null. Why?</p>
<p>This is on an .aspx page, and the controls are not in a control of itself etc. Can't remember if there is a masterpage or, so assume yes and no for any possible answers.</p>
<p>How could I programatically get an instance of the control?</p>
<p>Thanks</p>
| asp.net | [9] |
5,253,292 | 5,253,293 | Input Japanese characters into CSV file (C#) | <p>I want to write Japanese strings (”設定" ”HELLO” "設定") as a record into CSV file.</p>
<p>I tried to do with this code but displayed incorrectly:</p>
<pre><code>StreamWriter sw_CSV = new StreamWriter(CSvFileName, false, System.Text.Encoding.Unicode);
sw_CSV.WriteLine("設定,HELLO,設定");
sw_CSV.Close();
</code></pre>
<p>Thanks,</p>
| c# | [0] |
1,959,981 | 1,959,982 | how to limit normal users to open a certain URL in javascript? | <p>Now I have a flash on my web site by using Apache, and anyone who browse this web will find my database URL through the web source code. I don't intend to let others see my database through this URL. Now I know how to configure the httpd.conf to limit the normal users to open this URL. But I hope to control this by modifying my code. What should I do with my code?
Any help appreciated.</p>
| javascript | [3] |
1,581,771 | 1,581,772 | Access class instance "name" dynamically in Python | <p>In plain english: I am creating class instances dynamically in a for loop, the class then defines a few attributes for the instance. I need to later be able to look up those values in another for loop.</p>
<p>Sample code:</p>
<pre><code>class A:
def __init__(self, name, attr):
self.name=name
self.attr=attr
names=("a1", "a2", "a3")
x=10
for name in names:
name=A(name, x)
x += 1
...
...
...
for name in names:
print name.attr
</code></pre>
<p>How can I create an identifier for these instances so they can be accessed later on by "name"?</p>
<p>I've figured a way to get this by associating "name" with the memory location:</p>
<pre><code>class A:
instances=[]
names=[]
def __init__(self, name, attr):
self.name=name
self.attr=attr
A.instances.append(self)
A.names.append(name)
names=("a1", "a2", "a3")
x=10
for name in names:
name=A(name, x)
x += 1
...
...
...
for name in names:
index=A.names.index(name)
print "name: " + name
print "att: " + str(A.instances[index].att)
</code></pre>
<p>This has had me scouring the web for 2 days now, and I have not been able to find an answer. Maybe I don't know how to ask the question properly, or maybe it can't be done (as many other posts seemed to be suggesting).</p>
<p>Now this 2nd example works, and for now I will use it. I'm just thinking there has to be an easier way than creating your own makeshift dictionary of index numbers and I'm hoping I didn't waste 2 days looking for an answer that doesn't exist. Anyone have anything?</p>
<p>Thanks in advance,
Andy</p>
<p>Update: A coworker just showed me what he thinks is the simplest way and that is to make an actual dictionary of class instances using the instance "name" as the key.</p>
| python | [7] |
3,401,792 | 3,401,793 | LoginStatus logout does not work in a masterpage | <p>LoginStatus logout does not fire any event when it is used in a masterpage or the page that includes a masterpage</p>
| asp.net | [9] |
2,525,034 | 2,525,035 | Switch between views with crossfade animation | <p>I've wrote a small activity that is able to switch between two views. Now I am trying to add some animation (fade-in/fade-out effect). Can anybody explain me how to do that right?</p>
<p>My own attempt to do this works kinda buggy (if I will click buttons very fast, my application freezes). I use code listed below:</p>
<pre><code>public class WelcomeActivity extends Activity {
private boolean isLogin = false;
private String KEY_IS_LOGIN = "KEY_IS_LOGIN";
private Animation anim_fadein;
private RelativeLayout welcome, login;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
welcome = (RelativeLayout)getLayoutInflater().inflate(R.layout.activity_welcome_menu, null);
login = (RelativeLayout)getLayoutInflater().inflate(R.layout.activity_welcome_login, null);
anim_fadein = AnimationUtils.loadAnimation(this, R.anim.anim_fadein);
if (savedInstanceState != null)
isLogin = savedInstanceState.getBoolean(KEY_IS_LOGIN, false);
if (isLogin)
setContentView(login);
else
setContentView(welcome);
}
@Override
public void onBackPressed() {
if (isLogin) {
setContentView(welcome);
welcome.startAnimation(anim_fadein);
isLogin = false;
} else {
super.onBackPressed();
}
}
@Override
public void onSaveInstanceState(Bundle outState) {
outState.putBoolean(KEY_IS_LOGIN, isLogin);
super.onSaveInstanceState(outState);
}
public void onButton1Click(View v) {
setContentView(login);
login.startAnimation(anim_fadein);
}
public void onButtonLoginClick(View v) {
Intent i = new Intent(getApplicationContext(), MainActivity.class);
startActivity(i);
}
public void onButtonBackClick(View v) {
setContentView(welcome);
welcome.startAnimation(anim_fadein);
}
</code></pre>
<p>Animation XML file:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<alpha
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:duration="800" />
</code></pre>
<p>Thanks in advance!</p>
| android | [4] |
523,142 | 523,143 | check download progress | <p>I m download by following way and its working fine.But want to check at which time each chunk is coming.</p>
<p>File file = new File(extStorageDirectory+"/"+runInBackend.count+sche.file_name);</p>
<pre><code>HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setDoOutput(true);
connection.setConnectTimeout(sche.TimeOut);
connection.setRequestMethod("POST");
String status = connection.getHeaderField(0);//getResponseMessage();
if(status != null && status.contains("200"))
{
InputStream is = connection.getInputStream();
BufferedInputStream bis = new BufferedInputStream(is);
ByteArrayBuffer baf = new ByteArrayBuffer(50);
int current = 0;
long totalBytesRead = 0;
while ((current = bis.read()) != -1)
{
baf.append((byte) current);
totalBytesRead ++;
}
FileOutputStream fos = new FileOutputStream(file);
fos.write(baf.toByteArray());
fos.close();
</code></pre>
<p>Is there any way to check download progress of any fie, that is at what time each chunk is coming.</p>
<p>plzz help...</p>
<p>Thanks</p>
| android | [4] |
123,908 | 123,909 | jquery conditional chaining | <p>Let's say I have the following jQuery. Works great, but then I need to include the <code>.after($('<div />'))</code> only if <code>var insertAfter</code> equals true. Is there an elegant jQuery way of doing this? Thanks</p>
<pre><code>$('#whatEver')
.parent()
.show()
.width(123)
.addClass('bebo')
.before($('<div />'))
.after($('<div />'))
.parent()
.addClass('bla');
</code></pre>
| jquery | [5] |
4,690,168 | 4,690,169 | Multiprocessing or os.fork, os.exec? | <p>I am using multiprocessing module to fork child processes. Since on forking, child process gets the address space of parent process, I am getting the same logger for parent and child. I want to clear the address space of child process for any values carried over from parent. I got to know that multiprocessing does fork() at lower level but not exec(). I want to know whether it is good to use multiprocessing in my situation or should I go for os.fork() and os.exec() combination or is there any other solution?</p>
<p>Thanks.</p>
| python | [7] |
658,953 | 658,954 | design a layout like book open and animation same as book reviewing time | <p>I want to display my pages as a book, and when we move from one page to another it should look like book reviewing. For an example see the below screenshot </p>
<p><img src="http://i.stack.imgur.com/unwwL.png" alt="enter image description here"></p>
<p>Can you give me some suggestions on this design and animation functionality?</p>
| android | [4] |
5,682,713 | 5,682,714 | asp.net : how to automatically identify user / returning user | <p>i see a lot of web site that.. remember when i return without using registration.
I think they save cookies or something...
So i'm asking you: in asp.net / vb.net how can i save the id of a user ?
What are the command to do this ?
Thanks in advance...</p>
| asp.net | [9] |
1,162,596 | 1,162,597 | how to writer on External SdCard (mnt/external1) | <p>i want to write on external sdcard (path: /mnt/external1/). i can read that path, but when i create a new folder on it pro grammatically it not create. i have already declare read write permission in manifeast.xml.</p>
<p>when i write code f.mkdir(); it return false;
and when i create an outputStream obj for that path and try to write something on that it through an exception Permission denied.</p>
<p>Note: My aim is to write something on external sdcrad which path is /mnt/external1 . </p>
<p>plz give me some solution .</p>
<p>my code is</p>
<pre><code>public int createFolder(String FolderName)
{
File f = new File("/mnt/external1"+FolderName);
if(!f.exists())
{
if(f.mkdirs())
{
files= getFiles(path);
imageadapter.notifyDataSetChanged();
return 1;
}
}
}
</code></pre>
| android | [4] |
3,092,899 | 3,092,900 | PHP - making a script to show entered data | <p>I am new to PHP and i need to know how to display entered data on a page. I will clarify. There is a text box on a page and when the user types something in it and clicks submit, a blank page will come up that says: You entered [ENTERED DATA HERE]. i want to do this so that i put a code in the text box, and it will automatically generate the correct iframe. </p>
<p><code><iframe marginwidth="0" marginheight="0" src="http://jb-radio.com/movies/play.php?mu=[ENTERED DATA HERE]" frameborder="0" height="360" scrolling="no" width="640"></iframe></code></p>
<p>Please help on this script (i think it is done with PHP) i think this should be fairly simple.</p>
| php | [2] |
4,034,149 | 4,034,150 | click on display and change it to the textbox | <p>I just started to develop web. I am currently stuck in a question not sure how to solve it.</p>
<p>I have 2 pages, one for me to enter the product name and the price of it. After I click the save button, it will save to the database, after successfully save the data, it load back the page for me to continue enter the data. When I click the report button I will go to the report page (Here is where the question starts.) I can see the table with colums and rows nicely displayed with the data: product name and price. What I would like to do here is to edit the data as I like. I click on the product it will change to the textbox and still keeps the data inside textbox, (meaningly, it won't be readonly anymore). The same to the price. What I previously did was: each row I have the check box, click on the checkbox, I will use the jquery something like this to change. </p>
<pre><code>$("input[name^='chk']").click(function() {
$("input[name^='chk']").each(function() {
if($(this).is(':checked')) {
var i = $(this).val();
$("#cost"+i).attr('readonly', false);
$("#qty"+i).attr('readonly', false);
}else{
var i = $(this).val();
$("#cost"+i).attr('readonly', true);
$("#qty"+i).attr('readonly', true);
}
});
});
</code></pre>
<p>But what I do not want now is do not display the data inside the textbox even in the beginning. Click on it, then it only will change to textbox. And I also do not wish to have the checkbox also. It makes my page look ugly. I've seen this way in several websites, but I don't know how to do it. If anyone can help me out to this, I really appreciate your help</p>
| jquery | [5] |
5,123,498 | 5,123,499 | Using the custom enum attributes values | <p>In my application I'm using the following custom attribute for a custom view:</p>
<pre><code><attr name="direction">
<enum name="up" value="1" />
<enum name="down" value="2" />
</attr>
</code></pre>
<p>The thing is that in my custom view I must compare the current direction with the possible
ones. Is there a way to access the values for the up & down attributes?</p>
<p>Thanks a lot,</p>
<p>Gratzi</p>
| android | [4] |
5,812,715 | 5,812,716 | What is the right way to send a watch dog request to an ASP.NET web server? | <p>I have an ASP.NET web server and I wish to have a watchdog sending it periodic requests. Currently, I am planning to add an EmptyPage.aspx and then request it periodically from a locally running watchdog application. </p>
<p>Is there a better way to implement the watchdog facility? </p>
<p>P.S.</p>
<p>The server may be deployed in an intranet without the access to Internet, hence please do not suggest using 3rd party watchdog sites.</p>
| asp.net | [9] |
5,645,448 | 5,645,449 | Limiting the searching of a large file | <p>So here is my program with some new modifications:</p>
<pre><code>datafile = open('C:\\text2.txt', 'r')
completedataset = open('C:\\bigfile.txt', 'r')
smallerdataset = open('C:\\smallerdataset.txt', 'w')
matchedLines = []
for line in datafile:
splitline = line.split()
for item in splitline:
if not item.endswith("NOVA"):
if item.startswith("JJJ") or item.startswith("KOS"):
matchedLines.append( item )
counter = 1
for line in completedataset:
print counter
counter +=1
for t in matchedLines:
if t in line:
smallerdataset.write(line)
datafile.close()
completedataset.close()
smallerdataset.close()
</code></pre>
<p>The problem that I have now is that I want to search through the "bigfile" but at a faster rate. I would like to limit the searching of each line in bigfile to the string that occurs before the first ','</p>
<p>I want to use something like index = aString.find(',') I beleive but I'm not having much luck limiting the search of the big file to the string that occurs before the first comma. </p>
| python | [7] |
5,256,088 | 5,256,089 | ASP.Net Cookie Problems | <p>I have a cookie when a User loges in:</p>
<pre><code>HttpCookie cookie = new HttpCookie("Username");
cookie.Expires = DateTime.Now.AddDays(1.0);
cookie.Value = txtUsername.Text;
Response.Cookies.Add(cookie);
</code></pre>
<p>and it reads out in the Login-Page when the user visit again:</p>
<pre><code>if (Response.Cookies["Username"] != null) txtUsername.Text = Response.Cookies["Username"].Value;
</code></pre>
<p>But when I log in, and after that I log out directly, the cookie is deleted. It has neither the exp-date nor the value saved.</p>
<p>Whot do I wrong?</p>
| asp.net | [9] |
293,646 | 293,647 | Asp.net Response.Redirect | <p>I am using response.redirect after iam deleting a particular user to have grid populated with latest values.. but it giving me error
lblError.Text=Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.</p>
<p>because of this error iam not getting confirmation of deletion any help will be appreciated</p>
<p>code:-
if (chk.Checked == true)
{</p>
<pre><code> isDeleted=oFTE.DeleteUserRoleMapDetails(row.Cells[1].Text);
if (isDeleted == 0)
{
lblError.Visible = true;
lblError.ForeColor = System.Drawing.Color.Red;
lblError.Text = "User Role Map deletion failed.";
}
else if (isDeleted == 1)
{
lblError.Visible = true;
lblError.ForeColor = System.Drawing.Color.Red;
//Response.Redirect("userRoleMap.aspx");
Session["Msg"] = "User Role Map deleted successfully.";
Response.Redirect("userRoleMap.aspx",false);
//lblError.Text = "User Role Map deleted successfully.";
break;
}
}
if (iRowCount == gridViewResults.Rows.Count)
{
lblError.Visible = true;
lblError.ForeColor = System.Drawing.Color.Red;
lblError.Text = "Please select a row to delete.";
}
}
}
}
catch (Exception ex)
{
lblError.Visible = true;
lblError.ForeColor = System.Drawing.Color.Red;
lblError.Text = ex.Message.ToString();
}
}
</code></pre>
| asp.net | [9] |
5,433,405 | 5,433,406 | Seeking FOSS user admin code | <p>It must be a fairly standard wheel, so I'd rather not reinvent it.</p>
<p>Create/modify/delete users. Ditto their passwords & maybe enforce password change every X days. Also, create groups, like "sales", "support", etc and add/remove users.</p>
<p>The only unique part should be what they have permission to do (visit certain parts of the site after login, etc)</p>
<p>And I'd like to store admin data in an ODBC compliant database (MySql to start with, but I may move on).</p>
<p>Is this a new wheel?</p>
<hr>
<p>There doesn't seem to be much of anything on SourceForge, but if I could find something established and trusted I wouldn't even mind paying a few $100 as a trade of for the time needed to develop & test it.</p>
| php | [2] |
2,611,053 | 2,611,054 | Compare and remove same characters in two Strings in java then output the remaining characters as numbers | <p>Say i have user input 2 different names. for example. firstName = "Stack Overflow"
secondName = "Stack Exchange" what i want to do is to compare them, which means the word "Stack" would be eliminated, then the remaining String characters will output as numbers. "overflow" will output as 8. same with "Exchange" which should output 8. is there a method that i can use? im just a newbie so i would appreciate a non array method or some advanced java methods.</p>
| java | [1] |
1,789,283 | 1,789,284 | Disabled the a tag (link) by using javascript | <p>Does anyone how can I disabled the a tag (link) by using javascript? </p>
<p>Example:</p>
<pre><code><div class="sub-heading">
Contact Details &nbsp; &nbsp; &nbsp;
<a href="./cust_add_edit_customer.php?action=edit_customer_details&amp;cust_code=12761">
<img class="imgVA editIconPad" src="../images/edit0.gif"
alt="Edit Contact Details" border="0" width="20" height="17">
</a>
</div>
</code></pre>
<p>I hope to disabled this a tag after a button been clicked.</p>
| javascript | [3] |
2,391,334 | 2,391,335 | Disable page refresh | <p>I need to prevent users from refreshing a page.</p>
<ol>
<li>I have scripted in such a way that there is no 'forward' or 'backward' movement required.</li>
<li>However, if one refreshes the page, 'everything' starts from the beginning.
<ul>
<li>To save everything before page refresh and restore them after is not ideal.</li>
</ul></li>
<li>In order to prevent page refresh, I could use an <code>alert();</code>, but there are chances that the user might neglect the warning.</li>
<li>Any other choices...???</li>
</ol>
| javascript | [3] |
5,932,857 | 5,932,858 | how to open input Keyboard on load of activity | <p>Actually i have an EditText box in my activity class.What i want is,whenever my activity start it automatically open input keyboard along with EditText.So how that can be done.Please anyone suggest me.if possible with example</p>
| android | [4] |
2,536,715 | 2,536,716 | Getting php data from admin panel, without inserting in database and sessions | <p>I have a website and an administrator panel. I need to take some data from the administrator panel fields and show it on the homepage.</p>
<p>For example: on the homepage there is a <code>text block</code> and on the administrator panel there is a <code>input</code> form. I fill it in, press submit, it saves everything (shows current text on form and on homepage). With a database it would be very easy, but this time I can't use database. Is there any alternative choice that I could use instead of saving it to a database?</p>
| php | [2] |
5,399,185 | 5,399,186 | Comparing numbers wrong | <p>I have the following JS which compares credit card number length:</p>
<pre><code>validate: function () {
var ccLength = $('.credit-card input[name="cc_number"]').val().length;
var cardType = parseInt($('.credit-card .credit-card-type .selected').attr('rel'));
if (!isNaN(cardType)) {
console.log(ccLength); //11
console.log(provider[cardType].validLength.split(',')); // ["16", "13"]
if (ccLength == 0 || (cardType > 0 && (ccLength < parseInt(provider[cardType].validLength)) || (!$.inArray(ccLength, provider[cardType].validLength.split(','))))) {
triggerNotification('x', 'Your credit card number isn\'t long enough');
return false;
} else {
if ($('.credit-card input[name="cc_cvv"]').val().length < 3) {
triggerNotification('x', 'You must provide a CCV');
return false;
}
}
} else {
triggerNotification('x', 'Credit card type is not recognized or accepted');
return false;
}
return true;
},
</code></pre>
<p>I've included the values of console.log() on the 5th & 6th lines. For some reason, it doesn't fail...</p>
<p><strong>update</strong></p>
<p><code>provider[cardType].validLength</code> is always either <code>'16,13'</code> or <code>'16'</code></p>
| javascript | [3] |
1,650,527 | 1,650,528 | Is there any way to get notified when some application is completely installed or uninstalled | <p>I am trying to get the notification of an application which is completely installed/uninstall
by using WMI win32_product class. Is there any other way of doing that in c#??</p>
| c# | [0] |
1,002,657 | 1,002,658 | Java : Bound mismatch error | <p>I'm learning Java and I have to create a program that implements an interface defined by the teacher to pratice ADT (using ArrayList). I got errors that I don't understand maybe new explanations can help me.</p>
<p><strong>Interface :</strong></p>
<pre><code>public interface A<T extends C> { ... }
</code></pre>
<p><strong>Class signature in error :</strong></p>
<pre><code>public class AImpl<T> implements A<T> { /*Bound mismatch error*/ ... }
</code></pre>
<p><strong>JUnit test class</strong></p>
<pre><code>//Declaration
A<Alphabet> alphaList;
//in setUp()
alphaList = new AImpl<Alphabet>;
// in one method
alphaList.size(); /* The method size() is undefined for the type A<Alphabet> */
</code></pre>
<p>Note that Alphabet is given by the teacher too and there's the signature :</p>
<pre><code>public class Alphabet implements C { ... }
</code></pre>
<p>Can someone help to point out where is my errors with some explanations ? </p>
<p>Regards.</p>
| java | [1] |
2,712,057 | 2,712,058 | verify input string is valid decimal number | <p>Can anybody provide an algorithm that checks whether an input string is a decimal number in correct shape and form?</p>
<p>Rules of correct shape and form:</p>
<ol>
<li>At most two decimal places.</li>
<li>For all practical purposes, the largest number is 99,999,999.99</li>
<li>The integral part can use a space, or a comma, or a dot for a group separator.</li>
<li>The decimal part can use a comma, or a dot for a separator.</li>
</ol>
<p>Examples of correct shape and form:</p>
<pre>
1,234,567.89 // English style
1.234.567,89 // French style
1 234 567,89 // German style
1234567.89 // English mathematical style
1234567,89 // European mathematical style
12.00
12.0
12
</pre>
<p>Please, resist your temptation to propose Decimal.Parse or Decimal.TryParse. Either method merrily accepts strings such as “1,2,3,4”, which is not what I want.</p>
| c# | [0] |
3,103,350 | 3,103,351 | How to read non-English characters in filename, using Java programme | <p>I'm trying to read mail in my outbox which usually contains one attached pdf file. If the pdf file name contains English characters, the function below works fine. But if the file name contains any non-English character (for example, <em>filename1(chinesecharacter).pdf</em>) my function is not able to read it. Can anybody tell me what changes I need to make in my function?</p>
| java | [1] |
3,208,076 | 3,208,077 | Android Layout scrteching | <p>I have following layout in my android application.</p>
<pre><code><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainlayout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bbg">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="0">
<TableRow>
<EditText
android:id="@+id/TestEdit"
android:hint="Test"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
<Button
android:id="@+id/TestButtin"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text = "Test"/>
</TableRow>
</TableLayout>
</LinearLayout>
<com.google.android.maps.MapView
android:id="@+id/MapView" android:clickable="true"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:apiKey="KEY" />
</LinearLayout>
</code></pre>
<p>The problem is, that when I change text in EditText using setText() method, if text is too long EditText scratches and pushes Button out of screen. I don't want EditText to scrath, but I want it to be also I want it to be "fill_parent" by default/</p>
<p>How can I fix it? Thanks.</p>
| android | [4] |
4,725,604 | 4,725,605 | Split 1 div into 2 separate div's? | <p>Is it possible with jQuery to split 1 Div into 2 Div's at a specified point marked with tag</p>
<p>In this code example I was thinking would it be possible to split the div at the 'em tag' to make
2 div's</p>
<pre><code><div>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit,</p>
<em></em>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit,</p>
</div>
</code></pre>
<p>to</p>
<pre><code><div>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit,</p>
</div>
<div>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit,</p>
</div>
</code></pre>
| jquery | [5] |
4,919,045 | 4,919,046 | Server Control or HTML control | <p>i want to know is there any difference between server controls and HTML controls in speed?
for example you want to create a log in page that have two textbox and a button for submitting data,you can do this with both server controls and HTML controls(client_side controls(input) ),do you prefer to use server controls or HTML controls and which one is more efficiently?
which one is faster?</p>
| asp.net | [9] |
634,018 | 634,019 | Android: embedded controls in multiply included compound control restore to same state | <p>I am customizing an <a href="https://github.com/mrn/numberpicker" rel="nofollow">Android control</a>. This control uses a merge layout containing an edit field (fluff left out):</p>
<pre><code> <merge xmlns:android="http://schemas.android.com/apk/res/android">
...
<EditText android:id="@+id/numberpicker_input">
...
/>
...
</merge>
</code></pre>
<p>This works fine for a single control. However, if I put multiple instances of this control in a layout, it results in weird behaviour when rotating a device from portrait to landscape. All controls get the same value restored and callbacks get attached to the wrong control instance.</p>
<p>Upon examination, it emerged that the embedded edit controls have the exact same id value. </p>
<p>The relevant java source looks like this:</p>
<pre><code>public class NumberPicker extends LinearLayout implements OnClickListener,
OnFocusChangeListener, OnLongClickListener, OnEditorActionListener {
private final EditText mText;
....
public NumberPicker(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs);
Log.d(TAG, "Numberpicker create, have id: " + getId() );
setOrientation(VERTICAL);
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.number_picker, this, true);
...
mText = (EditText) findViewById(R.id.numberpicker_input);
...
}
}
</code></pre>
<p>Now, consider the value of R.id.numberpicker_input, when you have three separate instances of a NumberPicker in a layout. In each instance, the edittext field will have the same id.</p>
<p>To get the custom control to work properly, I need the id's of the embedded edit controls to be unique. How can I fix this?</p>
| android | [4] |
5,140,756 | 5,140,757 | Manipulation of HTML values in a class using jQuery | <p>I have the following HTML structure</p>
<pre><code><div class="something">
<div class="amount">$10</div>
</div>
<div class="something">
<div class="amount">$20</div>
</div>
<div class="something">
<div class="amount">$30</div>
</div>
<div class="something">
<div class="amount">$40</div>
</div>
</code></pre>
<p>I want to manipulate the amount displayed on the page based on a condition. Eg: Increase the fontsize if the amount is above $25. I am able to select and manipulate the style without the condition. I tried using makeArray to store the values from the amount class but i am not sure how to do the conditional check. </p>
| jquery | [5] |
1,295,209 | 1,295,210 | BSE/NSE quote in PHP | <p>I want to display NSE/BSE quote in my PHP website. please let me know what I have to do, if I get the webservices for this then how to use it in PHP.
Please help</p>
| php | [2] |
772,938 | 772,939 | multiple arguments in a function to run through arrary_filter | <p>How can i run multiple arguments through <code>array_filter</code>? Here is my function with the multiple arguments and the <code>array_filter</code> code</p>
<pre><code>function is_txt($file, $user) {
return preg_match('/backup-[0-9]+\.[0-9]+\.[0-9]+_[0-9]{2}-[0-9]{2}-[0-9]{2}_'.$user.'.tar.gz/', $file) > 0;
}
....
$list = ftp_nlist($conn_id, $ftp_dir);
$filtered = array_filter($list, 'is_txt');
if(count($filtered)){
foreach( $filtered as $name => $file){
echo $file;
echo "<br>";
}
</code></pre>
| php | [2] |
4,016,943 | 4,016,944 | Php variable inside HTML that is a variable | <p>I can't figure out how to include a variable inside an HTML link; this link is itself a variable. My quotation marks work fine until I try to add $ou. Any ideas?</p>
<pre><code>$mout = '<img src="http://www.example-website.com/header.jpg" width="600px" height="101px" alt="header" /><br />Click on the following link to confirm your registration:<br /><a href="Http://example-website.com/coupon.php?o=' . $ou'">Confirm</a>';
</code></pre>
| php | [2] |
3,364,740 | 3,364,741 | Horizontal Scroll View | <p>I have a horizontal scroll view, and inside I have a number of image views, they go across the screen and altogether are wider than the screen.</p>
<p>I've tried to scroll through them using touch, but nothing happens, am I missing something?</p>
| android | [4] |
92,869 | 92,870 | Non consumable in-app purchse using MKstorekit4? | <p>I have an Iphone application in which i am using two types of purchases.Non consumable products and a subscription.For subscription i have to use mkstorekit4 anyway.So i need to implement the nonconsumable also in the storekit4.Anybody knows the steps to integrate nonconsumable products with mkstorekit4.Can anybody help me. </p>
| iphone | [8] |
4,007,127 | 4,007,128 | How to determine if the specific time is between given range? | <p>Problem: I have a list containg hours, for example:
08:15:00
08:45:00
09:00:00
12:00:00
...
application is allowing user to make an appointment for a specific hour let'say: 8:15:00, each meeting takes half an hour.</p>
<p>Question: How to determine if there is a slot needed for appointment like this? I know that Calendar class have methods before() nad after(), but it doesn'solve my problem. I mean if there is appointment at 12:00 and another one at 12:00, how to prevent before making another one at 12:15?</p>
<p>edit:</p>
<p>I've tried using methods I mentioned before, like:</p>
<pre><code>Calendar cal1 = Calendar.getInstance(); // for example 12:00:00
Calendar cal2 = Calendar.getInstance(); // for exmaple 12:30:00
Calendar userTime = Calendar.getInstance(); // time to test: 12:15:00
if(user.after(cal1)&& user.before(cal2)){
... // do sth
}
</code></pre>
| java | [1] |
1,673,104 | 1,673,105 | Getting Exception in thread "main" java.lang.Error: Unresolved compilation: at FileTest.main(FileTest.java:39) | <p>Im getting Exception in thread "main" java.lang.Error: Unresolved compilation: at FileTest.main(FileTest.java:39) Line 39 is <code>public static void main(String[] args){</code>what am I doing wrong?</p>
<pre><code>public class FileTest{
public static void main(String[] args){
try{
String inFileName = args[0];
String outFileName = args[1];
BufferedReader ins= new BufferedReader(new FileReader(inFileName));
BufferedReader con = new BufferedReader(new InputStreamReader(System.in));
PrintWriter outs = new PrintWriter(new FileWriter(outFileName));
String first = ins.readLine(); //read from file
while(first != null){
System.out.print("Type in a word to follow " + first + ":");
String second = con.readLine(); //read from console
//append and write
outs.println(first+ ", " + second);
first = ins.readLine(); //read from file
}
ins.close();
outs.close();
}
catch (IOException ex){
ex.printStackTrace(System.err);
System.exit(1);
}
}
}
}
</code></pre>
| java | [1] |
792,296 | 792,297 | println(char), characters turn into Chinese? | <p>Please help me to troubleshoot this problem.</p>
<p>A have an input file 'Trial.txt' with content "Thanh Le".</p>
<p>Here is the function I used in an attempt to read from the file:</p>
<pre><code> public char[] importSeq(){
File file = new File("G:\\trial.txt");
char temp_seq[] = new char[100];
try{
FileInputStream fis = new FileInputStream(file);
BufferedInputStream bis = new BufferedInputStream(fis);
DataInputStream dis = new DataInputStream(bis);
int i = 0;
//Try to read all character till the end of file
while(dis.available() != 0){
temp_seq[i]=dis.readChar();
i++;
}
System.out.println(" imported");
} catch (FileNotFoundException e){
e.printStackTrace();
} catch (IOException e){
e.printStackTrace();
}
return temp_seq;
}
</code></pre>
<p>And the main function:</p>
<pre><code>public static void main(String[] args) {
Sequence s1 = new Sequence();
char result[];
result = s1.importSeq();
int i = 0;
while(result[i] != 0){
System.out.println(result[i]);
i++;
}
}
</code></pre>
<p>And this is the output.</p>
<p>run:</p>
<pre><code> imported
瑨
慮
栠
汥
BUILD SUCCESSFUL (total time: 0 seconds)
</code></pre>
| java | [1] |
5,173,932 | 5,173,933 | Sort the date in Sqlite database | <p>I am making an iPhone application in which I am storing date and time in a column now I want to sort the date and time in the order which occurs first.</p>
<p>How can I do this? please give me some solutions.</p>
| iphone | [8] |
1,741,227 | 1,741,228 | static final vs an instance final when and why? Java interview question | <p>Suppose we have</p>
<pre><code>final double pi = 3.14159
</code></pre>
<ul>
<li><p>Should we make above statement static or not?</p></li>
<li><p>When we'd want static final vs an instance final?</p></li>
</ul>
| java | [1] |
142,506 | 142,507 | Why does this work? Object references in Javascript | <p>I've finally been curious enough to find out why javascript does its voodoo magic to learn why not all object references are created equal.</p>
<p>Given the example:</p>
<pre><code>var a, b, c, d;
a = 100; b = a;
c = {}; d = c;
b = 10; d.e = 'f';
console.log(a, b); // outputs 100, 10
console.log(c, d); // outputs object => e = 'f', object => e = 'f'
</code></pre>
<p>If all variables in javascript are objects, then what makes the use case with <code>c</code> and <code>d</code> cast explicitly as an <code>Object</code> so different than defining <code>a</code> and <code>b</code> as <code>Number</code>? Or, why will <code>c</code> and <code>d</code> be linked to one another, and not <code>a</code> and <code>b</code>?</p>
| javascript | [3] |
739,581 | 739,582 | Android "Open GL" | <p>I want to draw an Hexagon but i cant figure out how to set up the coordinates</p>
<p>right now i have something like</p>
<p>private short[] _indicesArray = {0, 1, 2, 6, 7, 8, 3, 4, 5, 2, 5, 7};</p>
<p>every three is a triangle... something like below
/\
|/|
\/</p>
| android | [4] |
1,728,416 | 1,728,417 | Create a jquery object collection from seperate jquery objects | <pre><code>$.fn.sortByDepth = function() {
var ar = [];
var result = $([]);
$(this).each(function() {
ar.push({length: $(this).parents().length, elmt: $(this)});
});
ar.sort(function(a,b) {
return b.length - a.length;
});
for (var i=0; i<ar.length; i++) {
result.add(ar[i].elmt);
};
alert(result.length);
return result;
};
</code></pre>
<p>In this function I try to create a jquery collection from seperate jquery object. How can i do that ?</p>
<p>The code below doesn't work:</p>
<pre><code>result.add(ar[i].elmt);
</code></pre>
<p>Thanks for the help.</p>
<p>The jsfiddle: <a href="http://jsfiddle.net/hze3M/14/" rel="nofollow">http://jsfiddle.net/hze3M/14/</a></p>
| jquery | [5] |
388,021 | 388,022 | Text recognition from an image in android | <p>I have to implement Text Recognition feature in our APP but I am failed to do so. I implemented many codes for the same as OCR integration. but failed to achieve the desired. Please suggest a right solution for the same.</p>
<p>Thanks in advance.</p>
| android | [4] |
4,014,795 | 4,014,796 | How can i store a session live for next work? | <p>I m new in iPhone development. i have a problem , i m using bluetooth connectivity in my application. it works good for message sending but when i want to send other data from other class using same session the session value does not go in next class.</p>
<p>Can any body tell me how can i store the same session for next data sending.</p>
<p>Thanks to all in advance. </p>
| iphone | [8] |
5,716,864 | 5,716,865 | Displaying AlertDialog when a button in listview is clicked | <p>How to display an AlertDialog when a button in listview is clicked.
NOTE : The Listview is created using Custom Adapter.</p>
<p>The listview consists of 3 TextViews and a Button.
So I need to know how to display an alertdialog when I click the button present in the listview content.</p>
<p>Thanks in advance :)</p>
| android | [4] |
588,613 | 588,614 | combining 2 if staments | <p>Jut a quick question, i have 2 if statements i want to combine into one.</p>
<p>These are the current if statements:</p>
<pre><code>if (empty($_POST['route']))
{
$formerrors[] = '<span class="error">route</span>';
} else {
$route = escape_data($_POST['route']);
}
if (mysql_num_rows($result) == 0)
{
$formerrors[] = '<span class="error">route</span>';
} else {
$route = escape_data($_POST['route']);
}
</code></pre>
<p>i need something like:</p>
<pre><code>if (empty($_POST['route'])) & (mysql_num_rows($result) == 0)
{
$formerrors[] = '<span class="error">route</span>';
} else {
$route = escape_data($_POST['route']);
}
</code></pre>
<p>but not 100% sure how to achieve this</p>
<p>Thanks in advance</p>
| php | [2] |
3,064,437 | 3,064,438 | compile error on android | <p>In file included from </p>
<pre><code>/home/imagetech/Android/android-ndk-r3/build/platforms/android-5/arch-arm/usr/include/stdio.h:55,
from test_cl.cpp:21:
/home/imagetech/Android/android-ndk-r3/build/platforms/android-5/arch-arm/usr/include/sys/types.h:88:
error: conflicting declaration 'typedef unsigned int size_t'
/home/imagetech/Android/android-ndk-r3/build/platforms/android-5/arch-arm/usr/include/machine/_types.h:44:
error: 'size_t' has a previous declaration as 'typedef long unsigned int size_t'
</code></pre>
| android | [4] |
4,082,749 | 4,082,750 | programmatically execute Touch event in android | <p>Can we execute touch event programmatically in android by some method, such as passing screen co-ordinates(x,y)? Is there any such method? Please guide me.</p>
| android | [4] |
1,376,023 | 1,376,024 | Using PHP, how do I echo a line from a text file that starts with a specific value? | <p>Lets say the text file " data1.txt" contains: </p>
<pre><code>56715||Jim||Green||19
5678||Sara||Red||92
53676||Mark||Orange||6
56787||Mike||Purple||123
56479||Sammy||Yellow||645
56580||Martha||Blue||952
ect...
.
.
</code></pre>
<p>I would like to echo only the line beginning with "5678||". "5678" is the exact $refVal or reference value. The line should display like this:</p>
<pre><code>My name is: $nameVar
My color is: $colorVar
My number is: $numVar
</code></pre>
<p>Thanks...</p>
| php | [2] |
3,966,707 | 3,966,708 | can we configure google+ in our iPhone application? | <p>Actually i need to provide google + connectivity in an universal application so is there any one who can help me or can provide me any reference to start on it.</p>
<p>As we configure facebook in our iPhone application.</p>
<p>Thank u in advance (you guys are great)</p>
| iphone | [8] |
3,833,751 | 3,833,752 | change navigation bar title's color.... but i have problem | <p>hi i know how can change color of my navigation bar title but when i write this code :</p>
<pre><code>UILabel * label = [[[UILabel alloc] initWithFrame:CGRectMake(0,0,45,45)] autorelease];
label.textColor = [UIColor yellowColor];
label.backgroundColor=[UIColor clearColor];
self.navigationItem.titleView = label;
label.text=@"Title"; //CUSTOM TITLE
[label sizeToFit];
</code></pre>
<p>i want my navigation bar shows the cell's title not custom tilte :) .
here my table view codes : </p>
<pre><code>-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return ghazalList.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SimpleTableIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SimpleTableIdentifier] autorelease];
}
NSUInteger row = [indexPath row];
cell.textLabel.text = [ghazalList objectAtIndex:row];
return cell;
}
</code></pre>
<p>sorry iam new to SDK </p>
| iphone | [8] |
61,088 | 61,089 | getting images from iphone simulator | <p>I have just created an image and saved it in iPhone simulator phone library. I want to view this image(not from Photo Library) to view its properties from document resources. But I am not able to access the contents of photo library.</p>
<p>Thanks<br>
Pankaj</p>
| iphone | [8] |
5,602,227 | 5,602,228 | asp.net 4.0 Random posting behavior | <p>At work, we are developing a complex webForms app. We are using Visual Studio 2010 to develop a framework 4.0 site in C# 4.0.</p>
<p>We have been experiencing random behavior on post. Here is what we have seen:</p>
<p><code><Button></code> tag with a runat server and a ServerClick event will SOMETIMES run the Click event twice (Average 80% twice) - Converted to asp:Button control and it always fired its click event once. So, we called that 'fixed'.</p>
<p><code><asp:DropdownList></code> control with <code>autopostback=true</code>. We are seeing similar behavior. We have two UserControls that have an <code><asp:DropdownList></code> with autopostback=true inside. When two of these UserControls are displayed at the same time, If you click one of them, it calls the OnChange event for both DropdownLists. (Average 40% both called)</p>
<p>We have determined that this is not a client side issue. Fiddler 2 shows that we are filling the EventTarget correctly and that both of the DropdownLists' values are correct on post.</p>
<p>At a guess, it seems that the __DoPostBack "part" of asp.net 4.0 has an issue since that is the only thing that these two similar issues shared. Has anyone else seen issues like these and are their any tips/tricks to solve this?</p>
<p>(BTW, converting to a older version is not an option. We are heavily using some of the new features in 4.0)</p>
| asp.net | [9] |
986,325 | 986,326 | options.inInputShareable used when downloading an image from internet | <p>I have the following code in my project:</p>
<pre><code> public void downloadFromUrl(URL url) {
try {
/* download the image */
URLConnection cn = url.openConnection();
cn.connect();
InputStream is = cn.getInputStream();
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPurgeable = true;
options.inInputShareable = true;
mImage = BitmapFactory.decodeStream(is, null, options);
is.close();
} catch (final Exception e) {
e.printStackTrace();
}
}
</code></pre>
<p>My question is, since inInputShareable is set to true, the bitmap will share a reference to the input data (inputstream). Does it mean the bitmap will always hold a reference to the InputStream? Should I call is.close() in my code? I am afraid if is.close() is called, the data in the InputStream will be lost. Thanks.</p>
| android | [4] |
5,834,713 | 5,834,714 | Duplicating / Creating a copy of the orignal file | <p>I have a file test.php in that i want to add a PHP script in such a way that whenever test.php is being exceuted/opened it should copy itself to a directory /copies/test.php
How do i do that ? and it would be better if i could rename it.</p>
<p>Thanking You</p>
| php | [2] |
1,368,082 | 1,368,083 | Jquery .load() doesn't seem to be working in firefox | <p>I've tried to find the answer to this by searching through Stackoverflow, and I've found a lot of closely related answers, but none seem to give me quite what I'm looking for. Most are much more complicated scenarios and just don't apply. Anyhow, what I'm doing is calling to a certain page of my site using the url, and then as well identifying a specific element on the page to be loaded into another div #getter. This script works flawlessly in IE and Chrome, but I'm having no luck at all with Firefox. Any ideas? Here is the code:</p>
<pre><code><script>
$("#getter").load("http://$domain/member/?show=feed .content");
</script>
</code></pre>
| jquery | [5] |
3,838,720 | 3,838,721 | Recursive function in javascript | <pre><code>var DynamicModelView = {
createModelView: function (obj,vitalslength,headerValue) {
for(vitalsCount = 0, vitalsLen = vitalslength; vitalsCount < vitalsLen; vitalsCount++) {
// Business logic... with obj and headerValue
}
I need to call this function again.
When i call `this.createModelView(arguements)` it keeps on executing...
}
}
</code></pre>
<p>I need execute the function based on the count... the for loop executes perfectly based on the count, but the function executes only once. </p>
| javascript | [3] |
4,833,059 | 4,833,060 | Combing URL component variables into a full URL | <p>I would like to combine the variables below as a new variable called $fullurl. They are components of a URL. The structure of the combined variable is shown under the variables below. How can I do this?</p>
<pre><code>$urlc = nytimes.com/business/finance/articles/2005/05/10/20100727stock-prices-declining.html
$submissiondate = 2005-07-27 2022:38:10
$submittor = mike17
$countcomments = 15
$dispurl = nytimes.com
$submission = News about A Topic
$submissionid = 125
$domainurl = http://www.domain.com/folder/subfolder/index.php?
</code></pre>
<p>The combined order:</p>
<pre><code>http://www.domain.com/folder/subfolder/index.php?submission=News+about+A+Topic++&submissionid=125&url=nytimes.com/business/finance/articles/2005/05/10/20100727stock-prices-declining.html&countcomments=15&submittor=mike17&submissiondate=2005-07-27%2022:38:10&dispurl=nytimes.com&subcheck=0
</code></pre>
| php | [2] |
1,821,609 | 1,821,610 | jQuery Facebox Dynamic Position | <p>I am using jQuery's Facebox plugin. I have a number of dynamic links on a page. These links span the entire height and some are even past the page break.</p>
<p>Each link triggers the Facebox with a send a message style form. How can I position the Facebox to be directly under the link that triggered it?</p>
<p>There are other links on the page that also trigger Facebox but these need to keep it centered.</p>
<p>Cheers!</p>
| jquery | [5] |
5,546,639 | 5,546,640 | Javascript: invoke default keydown event handler | <p>I'd like to invoke default keydown event handler from javascript. Is it possible?</p>
| javascript | [3] |
2,468,455 | 2,468,456 | Get at entire web page contents using Javascript | <p>Is there a way to load the entire contents of a page into a javascript variable? (the page is not properly formatted HTML.) Ie store the page contents as a string in a variable. It only needs to work with Firefox.</p>
<p>I have some javascript running in one firefox tab that accesses the content of a page in another tab (the target window). Normally the content of the target is an HTML page so I can get at its content like this... </p>
<pre><code>targetWindowName.document.getElementsByTagName("html")[0].innerHTML;
</code></pre>
<p>However I have come across a page that is not in proper HTML and so the above doesnt work.</p>
<p>(The actual content of this awkward page is JSON. I know this would be best loaded up with AJAX or something but I have a framework already setup to process HTML pages and it would be very handy if I can treat this particular (one off) page just like a regular HTML page.)
Thanks</p>
| javascript | [3] |
1,197,151 | 1,197,152 | trim ip address octet | <p>I need to trim the last octet from an ip address using php. Basically I'm trying to just remove any digits after the third dot. I'm wondering if there is an out of the box solution for this? as my regex abilities are basic at best. Many thanks.</p>
| php | [2] |
1,855,639 | 1,855,640 | Get list of yahoo/ google groups in asp.net application | <p>i want to get a list of google and yahoo groups on the basis of some keyword in my asp.net application.Is there any API or script to do so??thanx</p>
| asp.net | [9] |
4,329,104 | 4,329,105 | JavaScript Functional Reference Depth Limit | <p>I was wondering if there is any functional depth limit to JavaScript. I'm asking because I'm working on a complex application and unfortunately, we cannot change the data structure.</p>
<p>For example, if I try to reference a variable such as:</p>
<p><code>Thi.sIs.An.Except.ionally[345].LongF.unct.ional[z].Refer.ence.Thats[23].Sev.eral.Lay.ers[96].Deep</code></p>
<p>I can sometimes set and get the value of the <code>Deep</code> struct and its members if it's in the same window, but if I include this element in another class or attempt to reference it from another page and set Deep's members, then deep later returns null or undefined for each of its members. The browser doesn't throw an error, I just get unexpected behavior.</p>
<p>Edit: I want to add, I am trying to reference <code>Deep</code> from a nested frame at least three levels down on the same domain. For example, the frame would need to reference <code>Deep</code> in frame <code>Course</code>, two layers down from the main frame, but on a seperate branch from the frame that needs to acess it. The application we inherited uses frames, but these can be changed to iframes. Would changing these to iframes also work? </p>
<pre><code>parent.Topic.Course.Thi.sIs.An.Except.ionally[345].LongF.unct.ional[z].Refer.ence.Thats[23].Sev.eral.Lay.ers[96].Deep
</code></pre>
<p>Is there something that I'm missing here? Or some sort of reference for JavaScript functional depth?</p>
| javascript | [3] |
556,615 | 556,616 | On limiting JavaScript global variables | <p>I am reading a book that encourages the reader for a few reasons, to limit global variables. The technique they recommend is to define a global object variable, like the following:</p>
<pre><code>var myapp = {};
var myapp.another_stooge = {
'first-name': 'Lenny',
'last-name': 'George'
};
var myapp.properties = [
'first-name',
'last-name'
];
for (i = 0; i < myapp.properties.length; i += 1) {
document.writeln(myapp.properties[i] + ': ' +
myapp.another_stooge[myapp.properties[i]] +
'<BR/>');
}
</code></pre>
<p>This does not write to my html file, but implemented without using myapp, it works:</p>
<pre><code>var another_stooge = {
'first-name': 'Lenny',
'last-name': 'George'
};
var properties = [
'first-name',
'last-name'
];
for (i = 0; i < properties.length; i += 1) {
document.writeln(properties[i] + ': ' + another_stooge[properties[i]] + '<BR/>');
}
</code></pre>
<p>I must be missing something simple but could not catch it; any direction would be appreciated. Thank you!</p>
| javascript | [3] |
5,281,590 | 5,281,591 | Xcode Organizer - Devices showing yellow light | <p>Got the developer certificate to test app on iphone entered device identifier, connected iphone as a device in the organizer it shows yellow light. In software version it shows 5.1 as installed on iphone device. It displays that it does not match any of the versions of iOS supported for development with this installation of the iOS SDK. Please restore the device to a version of the OS listed below</p>
<p>Xcode Supported iOS Versions
Latest
5.0 (9A334)
4.3 (8F190)
4.3
4.2
4.1
4.0.2
4.0.1
4.0</p>
<p>Eventhough got latest version but still i restored iphone but still got yellow light not changing to green any idea how to fix this issue.</p>
<p>Thanks for help.</p>
| iphone | [8] |
4,563,240 | 4,563,241 | Set selected radio from radio group with a value | <p>Why am I struggling with this?</p>
<p>I have a value: 5</p>
<p>How do I check the radio button of group "mygroup" with the value of 5?</p>
<pre><code>$("input[name=mygroup]").val(5); // doesn't work?
</code></pre>
| jquery | [5] |
435,521 | 435,522 | android : how to make a webview fullscreen programatically | <p>I have a webview pat of my activity layout
I have a button "fullscreen" On clicking this i want the webview to occupy the full screen.</p>
<p>I have tried
elativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.FILL_PARENT);
webview.setLayoutParams(params);</p>
<p>But with this,
1. the button "fullscreen" that is specified to be aligned to bottom is still visible</p>
<ol>
<li>how can i get the minimised view back , If i click "back" arrow it goes to previous activity </li>
</ol>
<p>Is there any other way to get full screen dynamically </p>
| android | [4] |
1,711,952 | 1,711,953 | Android Html.fromHtml in TextView - align image with text | <p>I'm using Html.fromHtml to populate a textview. I want to align text right next to the img but the text seems to aligning with the bottom of the image. In html, you could assign an align attribute to the img tag and the text would align to the top of the image. But the align just seems to be ignored. Is there any way this can be achieved using the textview.
I cannot use a webview.</p>
| android | [4] |
3,856,863 | 3,856,864 | C# Encryption Functions | <p>i have table in my database that have senestive data such as password field i want to encrypt data before inserting it to table and then i want not to decrypt data but i want only to compare encrypted password with the input password without decrypting </p>
| c# | [0] |
1,434,142 | 1,434,143 | import excel flie | <p>how i can import excel file to C# project ?</p>
| c# | [0] |
3,034,963 | 3,034,964 | Fading between elements | <p>I'm really new to JavaScript and JQuery but I'd like to fade the data between my differebt tables. So if I had data that I wanted to break apart into 3 different tables, how do I go about paging through them, pausing 10 seconds, then paging to the next table, then cycle back to the beginning?</p>
<p>Could someone give me a hand or point me to something that will work?</p>
<pre><code><table>
<tr>
<td>table 1</td>
</tr>
</table>
<table>
<tr>
<td>table 2</td>
</tr>
</table>
<table>
<tr>
<td>table 3</td>
</tr>
</table>
</code></pre>
| jquery | [5] |
3,664,647 | 3,664,648 | How can I get exactly what .this is pointing to | <p>Is there a way to get the exact name of the object that <code>this</code> is referring to and not just <code>object Object</code>?</p>
| javascript | [3] |
3,504,074 | 3,504,075 | Imageview place at center on click in GallaryView layout | <p>I am using <code>GalleryView</code> layout in which have multiple <code>ImageView</code>. When i click on <code>ImageView</code> that view comes on horizontally center position of device. Is there any way to stop this, means view will not come on center on click.</p>
| android | [4] |
126,700 | 126,701 | how to realize " android:scrollbars="vertical" " programatically? | <p>i want to dynamic design scrollbars in the EditText using code, but i don't find this
api as setscrollbars, could you tell me if i can programatically? realize </p>
<pre><code>android:scrollbars="vertical"
</code></pre>
<p>if possible, how to realize?</p>
| android | [4] |
176,296 | 176,297 | trying to make a C++ program to convert a 4 digit octal number to decimal | <p>This here is my code, I have tried googling it but i can find why my code doesnt convert the number properly. however it complies fine. could you please tell me why it is not working and what i should do to fix it. </p>
<pre><code>#include <iostream>
using namespace std;
int main()
{
char a = 0;
char b = 0;
char c = 0;
char d = 0;
cout << "Enter 4 digit octal number ";
cin >> a >> b >> c >> d;
cout << "Decimal form of that number: " << (a * 512) + (b * 64) + (c * 8) + d << endl;
return 0;
}
</code></pre>
| c++ | [6] |
961,229 | 961,230 | Running curl twice in php | <p>I'm trying to send email via php mail function like below but it doesn't seem to work on IE. It works on all other browsers. Below is the code. Is there a reason why???</p>
<pre><code>$sent1 = mail($to, $subject, $message, $headers);
$sent2 = mail($clientTo, $clientSubject, $clientMessage, $clientHeaders);
if ($sent1 && $sent2){
$ch = curl_init("https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "oid=$sf_oid&first_name=$sf_first_name&last_name=$sf_last_name&company=$sf_company&phone=$sf_phone&email=$sf_email&URL=$sf_website&description=$sf_description&lead_source=$sf_leadsource");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_exec($ch);
$info = curl_getinfo($ch);
if($_SERVER['REMOTE_ADDR'] == "124.254.75.167")
//print_r($info);
curl_close($ch);
$ch = curl_init("http://www.rankreport.com.au/ajax/add_new_lead");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "lead_company_id=1&lead_business=1234&lead_first_name=asdf&lead_website=12314.com&lead_phone=1234&[email protected]&lead_package=seo");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_exec($ch);
curl_close($ch);
echo '3';
}
</code></pre>
| php | [2] |
1,298,788 | 1,298,789 | How do you make an element "flash" in jQuery | <p>I'm brand new to jQuery and have some experience using Prototype. In Prototype, there is a method to "flash" an element — ie. briefly highlight it in another color and have it fade back to normal so that the user's eye is drawn to it. Is there such a method in jQuery? I see fadeIn, fadeOut, and animate, but I don't see anything like "flash". Perhaps one of these three can be used with appropriate inputs?</p>
| jquery | [5] |
3,263,596 | 3,263,597 | c cannot convert from type A* to type B* | <p>I need to change DMapEntry::pData from a char* to a class DMapData that contains the original pointer but still be able to refer to &pData[offset] in DMapEntry without changing it. Is this possible? </p>
<pre><code>#include "stdafx.h"
class DMapData {
char* pData;
public:
char* operator->() { return pData; }
char operator[](size_t offset) { return pData[offset]; }
friend class DMapEntry;
};
class DMapEntry {
char* pStr;
public:
DMapData pData;
/*----->*/ void getStr(size_t offset) { pStr = &pData[offset]; }
};
int _tmain(int argc, _TCHAR* argv[])
{
DMapEntry a;
return 0;
}
</code></pre>
<p>Thanks,
Carl</p>
| c++ | [6] |
5,134,100 | 5,134,101 | function call from base adapter to its fragment class | <p>I am having a function in sherlock fragment class. I want to call it from its base adpater class when an item is clicked. My code bellow</p>
<p>In base adapter</p>
<pre><code>SherlockFragment obj=new TVgui()
(tvgui)obj.replace_fragment(frag,tag);
</code></pre>
<p>In sherlockFragment class</p>
<pre><code> public void replace_fragment(SherlockFragment frag,String tag)
{
frag_child = getChildFragmentManager();
ft = frag_child.beginTransaction();
ft.addToBackStack(null)
.replace(R.id.fragment_container,frag,tag);
ft.commit();
}
</code></pre>
<p>Force close with error "Activity destroyed ". pls help</p>
| android | [4] |
3,340,461 | 3,340,462 | jQuery: outer html() | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2419749/get-selected-elements-outer-html">Get selected element’s outer HTML</a> </p>
</blockquote>
<p>imagine what we have something like this:</p>
<pre><code><div id="xxx"><p>Hello World</p></div>
</code></pre>
<p>if we call .html function in this way:</p>
<pre><code>$("#xxx").html();
</code></pre>
<p>we will get:</p>
<pre><code><p>Hello World</p>
</code></pre>
<p>But i need to get:</p>
<pre><code><div id="xxx"><p>Hello World</p></div>
</code></pre>
<p>So, what i need to do? I think to add another wrapper around #xxx, but this is not a good idea.</p>
| jquery | [5] |
1,627,190 | 1,627,191 | Unzipping a .gz file using C# | <p>I have a tarred gunzip file called ZippedXmls.tar.gz which has 2 xmls inside it.
I need to programmatically unzip this file and the output should be 2 xmls copied in a folder.
How do I achieve this using C#?
Can someone help me with the code please?</p>
<p>Thanks a bunch.</p>
| c# | [0] |
3,983,130 | 3,983,131 | android-how to differentiate the small screen ldpi and mdpi | <p>I implemented the application which will supports the small screen ldpi and hdpi. It is working for only one either ldpi or hdpi. Because my application layout have some distance between the views. so i want differentiate the ldpi and mdpi. how to implement this can any body help me.</p>
<p>For this i am creating the layout-small folder in the res. is any name conventions like layout-small-ldpi (or) layout-small-mdpi or exiting or not. same like normal and large (layout-normal-ldpi or layout-normal-mdpi or layout-normal-hdpi). Please give the naming convention clearly.</p>
<p>thanks</p>
| android | [4] |
154,680 | 154,681 | How to append functions to current module from unrelated script in Python | <p>I have two python scripts in different locations. I try to import the functions of the second one in such a way that they are integrated with the globals of the first one. That works fine. However when I call functions in the first script from the second one they cant be found.</p>
<p>foo.py</p>
<pre><code>def run():
glob = {}
loc = {}
execfile("/path/to/bar.py", glob, loc)
currmodule = globals()
currmodule["func_in_bar"] = glob["func_in_bar"]
func_in_bar()
def func_in_foo_A():
print("fooA")
def func_in_foo_B():
print("fooB")
if __name__ == "__main__":
run()
</code></pre>
<p>bar.py</p>
<pre><code>def func_in_bar():
func_in_foo_A()
func_in_foo_B()
</code></pre>
<p>When foo is run it fails with: <code>NameError: global name 'func_in_foo_A' is not defined</code></p>
| python | [7] |
3,211,046 | 3,211,047 | how to style top parent element using jquery | <p>i want style top parent and it should be dynamic. i just want style top parent. we can add more parent div but style should reflect on to div. is that possible with jquery.</p>
<pre><code><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="jquery-1.7.2.js"></script>
<script type="text/javascript">
$(function(){
$('.text').parent().css('background-color','red')
})
</script>
</head>
<body>
<div>
<div>
<div class="menu">
<div class="text">hiiii</div>
</div>
</div>
</div>
</body>
</code></pre>
| jquery | [5] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.