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 |
---|---|---|---|---|---|
3,350,209 | 3,350,210 |
How to open a webpage with the built-in (stock) android browser?
|
<p>There are multiple browsers installed. How can I open <a href="http://www.google.com" rel="nofollow">http://www.google.com</a> programatically with the built-in (stock) browser?</p>
|
android
|
[4]
|
4,801,168 | 4,801,169 |
Special Character Check using java pattern?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4395441/special-character-check-using-java-pattern">Special Character Check using java pattern?</a> </p>
</blockquote>
<p>Please get me the code for saving a-z,A-Z,0-9 also below mention characters</p>
<pre><code>• . period
• , comma
• ? question mark
• ! exclamation point
• - dash ***
• _ underscore
• ( ) parentheses
• : colon
• ; semicolon
• $ dollar sign
• asterisk
• © copyright symbol
• ® registered symbol
• § section symbol
• @ ampersand
• / \ forward and back slashes
• Ó acute character
• Ç French cedille
</code></pre>
<p>please help out...</p>
|
java
|
[1]
|
975,061 | 975,062 |
I can't get results to echo in a separate part of the file
|
<p>I want to echo the results in a different part of the page and not just in the header. How do I do this? What if I want to 6 items to be echoed separately?</p>
<pre><code><?php
require_once 'facebook.php';
$appapikey = 'CENSORED';
$appsecret = 'CENSORED';
$facebook = new Facebook($appapikey, $appsecret);
$user_id = $facebook->require_login();
$user = $user_id;
$i = 0;
$fql = 'SELECT uid FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1='.$user.')';
$_friends = $facebook->api_client->fql_query($fql); // Extract the user ID's returned in the FQL request into a new array.
$friends = array();
if (is_array($_friends) && count($_friends))
{
foreach ($_friends as $friend)
{
$i++;
$friends[] = $friend['uid'];
if ($i<=6) echo $friend['uid']."@[,:m]";
}
}
?>
<br><br>HELLO
</code></pre>
|
php
|
[2]
|
3,234,669 | 3,234,670 |
resize and positioning image not working
|
<p>i am re sizing some overlay images on load according to the screensize of the user. But the problem is it does not work everytime it loads. if i refresh too many times it works once . dont know where the problem is as no errors coming too. i have checked in chrome and firefox developer tools also. here is my code can any one suggest what is wrong here.</p>
<pre><code>(function($){
$(window).load(function() {
var Height=$(window).height(); // New height
var Width=$(window).width(); // New width
$('.content-container').css('background-size', Width + 'px' + ' ' + Height + 'px');
$('.weare_map').height(Height*.54);
$('.invent_div').height(Height*.4);
var top2= ($(window).scrollTop());
$('.invent_div img').css('top',top2*.4);
$('.weare_map.map1').css('top',top2*.3);
$('.weare_map.pixels').css('top',top2*.2);
$('.weare_map.wearefaces').css('top',top2*.05);
$('.content').css('height',Height + 'px');
});
$(window).resize(function() {
// This will execute whenever the window is resized
var Height=$(window).height(); // New height
var Width=$(window).width(); // New width
$('.content-container').css('background-size', Width + 'px' + ' ' + Height + 'px');
var overlayw=$('.content-container').width();
var overlayh=$('.content-container').height();
$('.weare_map').height(Height*.54);
$('.invent_div').height(Height*.4);
var top2= ($(window).scrollTop());
$('.invent_div img').css('top',top2*.4);
$('.weare_map.map1').css('top',top2*.3);
$('.weare_map.pixels').css('top',top2*.2);
$('.weare_map.wearefaces').css('top',top2*.05);
$('.overlay').css('background-size', overlayw + 'px' + ' ' + Height + 'px');
$('.content').css('height',Height + 'px');
});
})(jQuery);
</code></pre>
|
jquery
|
[5]
|
661,797 | 661,798 |
Mask credit card number in PHP
|
<p>I have credit card number which I want to mask as below:</p>
<pre><code>$cc = 1234123412341234
echo cc_masking($cc)
1234XXXXXXXX1234
function cc_masking($number) {.....}
</code></pre>
<p>Please suggest the regular expression for this.</p>
|
php
|
[2]
|
1,968,406 | 1,968,407 |
Converting String to Int in Java using Arrays
|
<p>I'm trying to convert the string values to integers, however whenever i do this, it gives me the ASCI value of the character instead of the actual typed string. </p>
<p>Example: </p>
<p>a user inputs "11101" on there keyboard to a string variable named binary</p>
<pre><code>for(int i = 0; i < binary.length(); i++){
storage[i] = Integer.valueOf(binary.charAt(i));
}
</code></pre>
<p>if I look at the values of storage[i], i will see only the ASCI values of the numbers, and not the actual 1's or 0's</p>
|
java
|
[1]
|
994,908 | 994,909 |
Touches on UILabel
|
<p>In my program labels didnt detect touches while i testig on simulator. but it works fine on device. why does this happens?. i want to capture the video of my application when working on simulator.</p>
|
iphone
|
[8]
|
2,524,623 | 2,524,624 |
PHP: check from which page the link is directed
|
<p>lets say i have a page <code>hit.php</code> in my website and the link is to this page is available on every\many pages in the website..</p>
<p>lets say i click <code><a href"hit.php">HIT</a></code> from any page.....</p>
<p>is there a way when <code>hit.php</code> is loaded i could know that the page from which this page was..</p>
<p>meaning if i click the link to <code>hit.php</code> from 'index.php' i could check loading <code>hit.php</code> that the user is navigating here from 'index.php' or any other page...</p>
<p>i know this i could establish in site by passing variables in URL like 'hit.php?pagename=index' but is there another way</p>
<p>p.s i know its crazy but still :)</p>
|
php
|
[2]
|
2,560,869 | 2,560,870 |
Cross-Site Ajax Call
|
<p>I am able to execute a web service through the browser but when I try and execute it through xmlhttprequest in javascript I get this error: Origin [] is not allowed by Access-Control-Allow-Origin.</p>
<p>How can I call the webservice through javascript? I'd prefer not to use a framework and just use basic client-side javascript.</p>
<p>For reference this is an instance of the web service I'm trying to consume: <a href="http://musicbrainz.org/ws/1/track/?type=xml&query=track:alive" rel="nofollow">http://musicbrainz.org/ws/1/track/?type=xml&query=track:alive</a></p>
<p>Thanks.</p>
|
javascript
|
[3]
|
1,608,360 | 1,608,361 |
How i get data of datagridview in pdf in C#
|
<p>I want to save the data of datagridview in PDF file I download itextSharp.dll but i cannot understand that how i give code to PDF button i am using C Sharp and itextSharp. Please give me a code of PDF button.</p>
<p><img src="http://i.stack.imgur.com/ZjdTK.png" alt="enter image description here"></p>
|
c#
|
[0]
|
2,328,763 | 2,328,764 |
Read file change in php (linux equivalent of tail -f )
|
<p>I need to monitor the access.log of a website. I can use the unix <code>tail -f</code> in my php but the problem is that when the http server is restarted, the file is truncated and the read stops.</p>
<p>I need this feature in php.</p>
|
php
|
[2]
|
385,264 | 385,265 |
how do you know if document is ready
|
<p>I have a JavaScript that generates HTML blocks. This script is sometimes called somewhere in run time, and sometimes before document is loaded. I want a script that is able to tell if document is ready. If so, generate the HTML, otherwise, add a document.ready() function. What is jQuery's best way to know if document has been loaded?</p>
|
jquery
|
[5]
|
1,833,780 | 1,833,781 |
i want to save my information eventhought application is terminated?
|
<p>i have used segment control for distance measuring in km or Miles so if i select any option from both and application will terminate and when i start application it should show the lastly used value. </p>
|
iphone
|
[8]
|
1,872,629 | 1,872,630 |
Change body class depending on current option in select list
|
<p>Without using jQuery, how can I change the body class based on the currently selected option in a select list?</p>
<p>Thanks in advance!</p>
|
javascript
|
[3]
|
4,177,217 | 4,177,218 |
Inner function cannot access outer functions variable
|
<p>I have created the following jsfiddle which highlights my problem.
<a href="http://jsfiddle.net/UTG7U/" rel="nofollow">http://jsfiddle.net/UTG7U/</a></p>
<pre><code>var ExampleObject = function() {
var myArray = new Array();
this.example = function() {
alert(this.myArray);
};
}
var exampleObj = new ExampleObject();
exampleObj.example();
</code></pre>
<p>I am new to JavaScript and trying to create an object, field and a method.
I can't get my method to access my field variable.</p>
|
javascript
|
[3]
|
2,271,273 | 2,271,274 |
Listview changes image on number of lines when i'm trying to update one line
|
<p>I have a list of items, which i'd like to "check" with filled star when user clicks on one item in the list.</p>
<p>I have a ListView with text & image, represented in XML layout, and using simple StringAdapter.</p>
<p>I've implemented the above by doing this:</p>
<pre><code> this.listViewSub.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(final AdapterView parent, final View view, final int position,
final long id) {
ImageView img = (ImageView) view.findViewById(R.id.unchkImg);
img.setImageResource(R.drawable.starchk);
</code></pre>
<p>I guess its not the right way to do it, but i don't have any idea how else to code it.
This code for some reason changes few random items in the list, and after one click i have about 4-5 items with icon changed.</p>
<p>Any idea how to solve it correctly?
Thanks</p>
|
android
|
[4]
|
359,901 | 359,902 |
horner data structure
|
<p>Hi
I have a question that how can we use Horner data structure for showing a polynomial which is like " <code>x^100+1</code>" ?</p>
<blockquote>
<p>for example for above polynomial we
need array of size 101 which its index
shows the power of this polynomial for
example for array[100]=1 and array[0]
= 1 and unfortunately all the other indexes are 0 !!! but there is another
way which is difference from this and
helps to show a polynomial in a little
array !!! and I want to know that way</p>
</blockquote>
<p>thanks</p>
|
java
|
[1]
|
5,109,543 | 5,109,544 |
Scaling the Image [ Memory Issue ]
|
<p>I need to perform scaling operation on UIImage and following is same code. causing a memory leak.not able to debug what is getting wrong here.</p>
<pre><code>UIImage* ScaleImageWithWH(UIImage* image, CGRect aRect)
{
int kMaxResolution = 1800;
int x;
int y;
x = ( image.size.width * aRect.origin.x ) / aRect.size.width;
y = ( image.size.height * aRect.origin.y ) / aRect.size.height;
CGImageRef imgRef = CGImageCreateWithImageInRect (image.CGImage, CGRectMake (x,y,aRect.size.width,aRect.size.height));
CGFloat width = CGImageGetWidth(imgRef);
CGFloat height = CGImageGetHeight(imgRef);
CGAffineTransform transform = CGAffineTransformIdentity;
CGRect bounds = CGRectMake(aRect.origin.x, aRect.origin.y, width, height);
bounds.size.width = aRect.size.width;
bounds.size.height = aRect.size.height;
CGFloat scaleRatio = bounds.size.width / width;
CGSize imageSize = CGSizeMake(CGImageGetWidth(imgRef), CGImageGetHeight(imgRef));
UIImageOrientation orient = image.imageOrientation;
switch(orient)
{
case UIImageOrientationUp: //default
transform = CGAffineTransformIdentity;
break;
default:
[NSException raise:NSInternalInconsistencyException format:@"Invalid image orientation"];
}
UIGraphicsBeginImageContext(bounds.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextScaleCTM(context, scaleRatio, -scaleRatio);
CGContextTranslateCTM(context, 0, -height);
CGContextConcatCTM(context, transform);
CGContextDrawImage(UIGraphicsGetCurrentContext(), CGRectMake(0, 0, width, height), imgRef);
UIImage *imageCopy = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return imageCopy;
}
</code></pre>
<p>Please help on this.</p>
<p>Thanks,</p>
<p>Sagar</p>
|
iphone
|
[8]
|
5,058,439 | 5,058,440 |
Converting string to float with Python 3.2
|
<p>The purpose of this program is to display the sum, average, max, and min of use based input.</p>
<pre><code>count=0.0
Sum=0.0
average=0.0
data=float(input("Enter a number or just ENTER to quit:"))
Min=data
Max=data
while data!="":
count+=1
number=float(data)
Sum+=number
average=Sum/count
if data<Min:
Min=data
if data>Max:
Max=data
data=float(input("Enter a number or just ENTER to quit:"))
print(count,("numbers entered."))
print("Sum:",Sum)
print("Average:",average)
print("Min:",Min)
print("Max:",Max)
</code></pre>
<p>The problem is with line 20:
data=float(input("Enter a number or just ENTER to quit:"))</p>
<p>When i press ENTER to end the loop it says that it was unable to convert string to float and errors. What am I doing wrong ?????</p>
|
python
|
[7]
|
139,171 | 139,172 |
Better way to validate the value of span
|
<p>All, I am a newbie for jquery, I found sometimes I need write some code for validate the element value. like below. </p>
<pre><code>var selectedLayOutIdx=$("#spanSelectedLayout").html();
if (selectedLayOutIdx!=undefined && selectedLayOutIdx!="") {
alert("The value is null, please check it.");
return;
} else {
//keep going.
}
</code></pre>
<p>I found this code looks like verbose, I believe there must be a better way to make code work more fun in jquery. So far, I just haven't found it.</p>
<p>Please help me . thanks.</p>
|
jquery
|
[5]
|
3,941,913 | 3,941,914 |
kABSourceNameProperty returned values
|
<p>In my application i am trying to differentiate contacts from different sources like Exchange,Facebook,Native contacts,<code>iCloud</code>.</p>
<p>I used <code>ABSourceType</code> to get source type for contacts ,but contacts in different sources<br>
<strong>Ex.</strong> <code>Yahoo and iCloud</code> have same source type(value 4) but different source name (yahoo :contacts and iCloud as Card).<br>
I did extensive search to get official Apple Docs to confirm value of <code>kABSourceNameProperty</code> for different sources.
Can any one help me in this regard??</p>
<p>Thanks in advance,</p>
|
iphone
|
[8]
|
2,960,834 | 2,960,835 |
How to iterate linearly over hashtable(array) in php and print the values of it's keys and values?
|
<p>I use</p>
<pre><code>foreach($terms as $one)
{
print $one."<br>";
}
</code></pre>
<p>But this only prints the values. What about the keys?</p>
|
php
|
[2]
|
4,752,002 | 4,752,003 |
is there a jquery shortcut for triggering an input
|
<p>I have to add an input with a name of "btnupdateprice" that I first have to dynamically insert it into the page (hidden of course) and then trigger it. Is there a way to do this without inserting it into the page like the following? A shortcut perhaps?</p>
<pre><code>$("input[type='hidden'][name='ProductCode']").before('<input type="image" border="0" name="btnupdateprice" src="blank_image.gif" style="display: none;">');
$('input[name=btnupdateprice]').trigger('click');
</code></pre>
|
jquery
|
[5]
|
3,107,648 | 3,107,649 |
textview problem
|
<p>I have two uiviewcontroller and one of its has UITextView ... I want to load String to textview from both uiviewcontroller... i can able to load string to textview only one uiviewcontroller has contains textview... so how can i load string to textview from another uiviewcontroller...</p>
|
iphone
|
[8]
|
4,429,206 | 4,429,207 |
Is it possible to "symlink" a function in PHP easily - or alias the name to something else?
|
<p>For example, I hate typing things like:</p>
<pre><code>$x = mysql_escape_string(stripslashes($_GET['x']));
</code></pre>
<p>Is there a way to alias those two functions in init.php or something without writing a separate function that takes one argument and returns that argument with those functions applied to it?</p>
<p>My C/C++ is not very good, but I think this is sort of like #typedef but for functions?</p>
|
php
|
[2]
|
5,071,822 | 5,071,823 |
A project with an Output type of Class Library cannot be started directly
|
<p>I've download sample code with C#. but when I run I get this error message:</p>
<blockquote>
<p>A project with an Output type of Class Library cannot be started
directly In order to debug this project, add an executable project to
this solution which references the library project. Set the executable
project as the startup project.</p>
</blockquote>
<p>Please give me a solution.</p>
|
c#
|
[0]
|
5,769,453 | 5,769,454 |
Get Installed software list
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4146576/get-ms-windows-installed-applications-from-java">Get MS-Windows Installed Applications from Java</a> </p>
</blockquote>
<p>how to get the installed software list in windows using java.By using c# i got the solution but how to do using java?</p>
|
java
|
[1]
|
1,999,392 | 1,999,393 |
save picture into app folder
|
<p>I'm really curious if it was possible to save a taken picture into Android's specific folder structure. To be more precise: I don't want it to be saved on the user's SD card but in the internal app folder (data/data/my.package/files).
Is this possible and a reasonable step (with regard to the memory capacity of the phone)?</p>
|
android
|
[4]
|
2,297,076 | 2,297,077 |
how to make SFTP connection in android
|
<p>WIth the help of "vnd.android.cursor.dir/lysesoft.andftp.uri" API, i can done the SFTP connection between FTP server and Android client.
But I do not want to use above API.</p>
<p>Required expert help on Secure connection between android device and ftp server.</p>
|
android
|
[4]
|
2,770,166 | 2,770,167 |
Need to copy lines from one text to another based on a key item
|
<p>I am trying to copy lines from one text file to another which contains a key item in it (For example: "2011"). The following are the lines that are present in my source text.</p>
<blockquote>
<p>PensonReport: 1/11/2010 11:14:21 AM, Index and length must refer to a location within the string.
Parameter name: length, Sub ProcessDateHeader_BeforePrint, ReportRequestID: 24614361, DALBATCHDEV01</p>
<p>ReportRequest: 8/16/2011 10:02:26 AM, Procedure or function 'prcEXT602' expects parameter '@CorrespondentOfficeID', which was not supplied., Sub ExecuteStoredProc, ReportRequestID: 49474706, DALBATCHDEV01</p>
</blockquote>
<p>The problem with my code is that it is not able to identify the EOL and is printing the whole of it.
Note: each new line starts from string ReportRequest.
How do I do this?</p>
|
c#
|
[0]
|
5,885,378 | 5,885,379 |
Shorten Array in PHP?
|
<p>I want to shorten an array so it only contains 30 elements. If for example I have an array of 100 elements is it possible to take it and chop of (as to speak) 70 of those elements?</p>
|
php
|
[2]
|
1,597,703 | 1,597,704 |
Need a good way to store Name value pairs
|
<p>I often run into a situation where I want to have a set of key/value pairs. Here's a pseudo code idea:</p>
<pre><code>DataSet MyRequestStatus
{
Accepted = "ACC",
Rejected = "REJ"
}
</code></pre>
<p>Usage:</p>
<pre><code>InsertIntoTable(MyRequestStatus.Accepted.ToString())
</code></pre>
<p>I want to be able to use the friendly "MyRequestStatus.Accepted", but I want the ToString() to return the cryptic "ACC", NOT "Accepted". Bonus points, implicit conversion rather than having to call ToString().</p>
<p>I haven't found an obvious way to achieve this with Enums. What do you suggest?</p>
|
c#
|
[0]
|
383,343 | 383,344 |
How do i subtract 4 months of date today?
|
<p>Im setting up two dates, <code>$fromDate</code> and <code>$toDate</code>. They should both be of the <code>"Ymd"</code> format and the $fromDate initially be -4 from today. How do i fix this? So:</p>
<pre><code>$fromDate = ?
$toDate = Date('Ymd');
</code></pre>
<p>How do i do this?</p>
<p>-Jason</p>
|
php
|
[2]
|
2,504,307 | 2,504,308 |
Validation of viewstate MAC failed. in ASP.NET 3.5
|
<blockquote>
<p>Validation of viewstate MAC failed. If
this application is hosted by a Web
Farm or cluster, ensure that
configuration specifies
the same validationKey and validation
algorithm. AutoGenerate cannot be used
in a cluster.</p>
</blockquote>
<p>I have tried disabling viewstate on main page and on the thickbox.</p>
<p>This is happening when clicking an asp.net button on a query ui pop up box.</p>
<p>Trying to redirect back to the main page.</p>
|
asp.net
|
[9]
|
3,298,010 | 3,298,011 |
How to keep track of the change in date in Java
|
<p>I have an application that needs to do some actions every date change say at midnight. Whenever the date changes the application should be said of the same. Any help regarding how to implement the functionality would be appreciated.</p>
|
java
|
[1]
|
3,490,824 | 3,490,825 |
check or uncheck all checkboxes based on a condition
|
<p>I have this html </p>
<pre><code> @foreach (var item in Model.Options)
{
<input type="checkbox" checked="checked" name="selectedObjects" noneoption=@(item.OptionText=="None of the above" ? "true" : "false") id="@(Model.QuestionNo)_@(item.OptionNumber)_chk" value="@item.OptionNumber" onchange="checkBoxChangeNone(this);" />
}
</code></pre>
<p>My condition </p>
<p>1.when a user click on a checkbox if its contain <strong><em>noneoption=true</em></strong> then all other checkboxes are unchecked. </p>
<p>2.When a user click on checkbox that contain <strong><em>noneoption=false</em></strong> if a checkbox with <strong><em>noneoption=true</em></strong> checked it must unchecked. </p>
<p>i have written this JS but its not working.</p>
<pre><code> function checkBoxChangeNone(checkbox) {
var noneoption = $(checkbox).attr('noneoption');
var checkid = '#' + checkbox.id;
var splitstr = checkbox.id.split('_');
var formid = $('#myform_' + splitstr[0]);
if (noneoption == 'true') {
$('input[name$=_selectedobjects]:checked').each(function () {
$(this).prop("checked", false);
});
$(checkid).prop("checked", true);
}
}
</code></pre>
|
jquery
|
[5]
|
3,197,019 | 3,197,020 |
Value cannot be null.Parameter name: stream error while reading the contents of embeddded file
|
<p>I am doing an application in c#.I get the error.Value cannot be null.Parameter name: stream while reading the contentxs of embedded file in the code-Stream strm = Asm.GetManifestResourceStream(Asm.GetName().Name + "." + Name);How to solve this error?</p>
|
c#
|
[0]
|
2,961,864 | 2,961,865 |
C++ char array gives strange output
|
<p>I am trying to create a char array in a function, pass it to main, and the print it out. This is giving me a string of random characters like this: ╠╠╠╠╠╠╠╠↑</p>
<p>Also, when I check the number of characters before the '\0' terminator the first output will give me the number of characters inputted, but the second output will give me 49 (size of the buffer), so I feel this is a problem involving the NULL terminator, but Im not sure how to resolve it. . </p>
<p>I have recreated the issue outside of my real project file, so the code is less messy and shown below. </p>
<pre><code>const int BUFFER = 50;
char* getWord()
{
char word[BUFFER];
cout << "Please enter a word: ";
cin.getline(word, BUFFER);
cout << "The word is: " << word; // This prints out the word with no problems..
return word;
}
int main()
{
char* wordPtr;
wordPtr = getWord();
cout << "Your word is: " << wordPtr << "\n"; // This prints out random symbols.
system("PAUSE");
return 0;
}
</code></pre>
<p>Any help is greatly appreciated.</p>
|
c++
|
[6]
|
5,149,975 | 5,149,976 |
how limit image dragging within the screen?? Expecting suggestions
|
<p>Is there any way to restric the movement of dragging within the screen ?.If u have suggestions or useful links regarding this,plzz send.</p>
|
android
|
[4]
|
3,249,584 | 3,249,585 |
Iphone simulator 4.0 home button does not stop xcode debugger
|
<p>Can any one help me ?</p>
<p>I run my application via xcode iphone simulator 4.0 , now i want to stop my application ,so when i click my iphone simulator home button it didnt stop the debugger . I dont know why ?</p>
<p>Can anyone help me ?</p>
<p>The xcode debugger is still running ?
I didnt see such a problem in iphone os 3.0...</p>
<p>Thanks in advance...</p>
|
iphone
|
[8]
|
2,702,448 | 2,702,449 |
LinearLayout (horizontal) - Swapping button positions
|
<p>I have a horizontal <code>LinearLayout</code> which has 4 image buttons in it, all the same size with the same layout params. I would like the user to be able to swap the positions of buttons 2 and 3 over. I was thinking they could perhaps swipe over the buttons to swap them, or maybe have another small button between them with an arrow image that they pressed.</p>
<p>My problem is I'm not sure how I would swap the button positions over in the layout! I assume I need to get hold of the index of each in the layout and then add and remove them and then cause the layout to be recalculated so it is redrawn. Is this possible?</p>
<p>Also it would be nice to show some animation of the buttons moving in to position but I suspect this is just not possible.</p>
<p>Any advice?</p>
|
android
|
[4]
|
3,727,767 | 3,727,768 |
Memory address of reference variable
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1950779/is-there-any-way-to-find-the-address-of-a-reference">Is there any way to find the address of a reference?</a> </p>
</blockquote>
<p>When we print the address of actual variable and reference variable it shows same address why?</p>
|
c++
|
[6]
|
2,267,154 | 2,267,155 |
How do I use the second parameter in the JavaScript 'prompt' function?
|
<p>What is the second parameter used for in the prompt() function?</p>
<pre><code>prompt('blahblahblah', 'WHY ARE THESE HERE? '){}
</code></pre>
|
javascript
|
[3]
|
4,442,991 | 4,442,992 |
does an iphone UDID have an integrated checksum
|
<p>Do apple's iPhone / iPad UDID's contain a checksum ?
I'm asking because I'm wondering if it would be possible to add non-existant or "wrong" UDID's to the Devices list at the developer portal.</p>
<p>thanks for your help</p>
<p>sam</p>
|
iphone
|
[8]
|
3,727,584 | 3,727,585 |
Response.Redirect to remote pdf url in asp.net
|
<p>I have couple of asp.net link buttons, can't change them to asp.net hyperlinks. I want to open a pdf file when buttons are clicked while pdf files are located on a different server (example <a href="http://www.targetserver.com/sample.pdf" rel="nofollow">http://www.targetserver.com/sample.pdf</a>) from <a href="http://www.sourceserver.com" rel="nofollow">http://www.sourceserver.com</a> where link buttons are. Want to open pdfs in the same window. Can I use Response.Redirect somehow passing in pdf url which opens pdf in the same window?</p>
|
asp.net
|
[9]
|
4,903,732 | 4,903,733 |
How do I determine the highest and lowest integer in C#?
|
<p>I would like to know how to determine the highest number and the lowest number out of whatever numbers the user inputs. We're supposed to display those after the user enters 99. Everything I found is using arrays, and we've not yet learned those. Please help!</p>
<pre><code> string input;
int input2;
Console.WriteLine("Enter an integer");
input = Console.ReadLine();
input2 = Convert.ToInt32(input);
while (input2 != 99)
{
Console.WriteLine("Enter an integer");
input = Console.ReadLine();
input2 = Convert.ToInt32(input);
}
</code></pre>
|
c#
|
[0]
|
5,688,778 | 5,688,779 |
Calling a .php file
|
<p>I am what you call a developer with basic PHP scriptings, i have not yet developed complicated scripting so please bear with me.</p>
<p>I am working with a Pie Chart. This php script i found in the net creates a PNG File once it is called. </p>
<p>Example if you accessed it directly like .. </p>
<blockquote>
<p>www.url.com/generate.php</p>
</blockquote>
<p>This will create a generate.png Image of the Pie Chart</p>
<p>I want to pass values in to as to feed the SP to be used.</p>
<p>Example i like to use SP_contacts i would pass it like </p>
<blockquote>
<p>www.url.com/generate.php?foo='SP_contacts'</p>
</blockquote>
<p>it will then call the SP then after the query it will generate the Image.</p>
<p>then I would like to call the generated image and <strong>ECHO</strong> it in the <strong>HTML page</strong>.</p>
<p>i will have my <strong>Index.php</strong> page to handle the <strong>ECHO</strong>, now how will I call this <strong>generate.php</strong> inside my <strong>Index.php</strong></p>
<p>I am not sure how to make it work as I havent read any PHP Books or were trained to use PHP. I am just a go develop and learn guy and hopes that the internet is there for me. haha. Thanks in advance.</p>
|
php
|
[2]
|
418,404 | 418,405 |
Update panel, user Control and RegisterClientScriptInclude
|
<p>I have a Master page with a script manager. I have a content page with an update panel. Inside the update panel i have several User controls which initially are all visible=false. After Opening one of the User control, i have not been able to attach my js file using<br>
RegisterClientScriptInclude. I have used:</p>
<pre><code>ScriptManager.RegisterClientScriptInclude(Page, this.GetType(), "key5", ResolveClientUrl("~/js/configurator.js"));
</code></pre>
<p>on the master page, on the content page and in the user control code behind. none of which shows that the js file is being loaded. i have always been able to do this but all controls have been visible from begining.
Could someone point how to load the script so that it is available for the User Control?</p>
|
asp.net
|
[9]
|
4,309,913 | 4,309,914 |
how to exit after no input in a c++ program+
|
<p>Hi guys i am new to c++, I just wrote this code to find min/max of a array of numbers.<br>
I just want to know how can I make the no. of entries flexible(I mean the user should be able to enter as many entries as possible without specifying how many in the starting)
<br>
Here's the code, but its not working, can someone please help?
Thanks
code:</p>
<pre><code>#include <iostream>
using namespace std;
int main(){
cout<<"Program to calculate max/min/second max\n";
int *A;
A=new int[5];
bool flag=false;
int x=0,i=0;
cout<<"Enter the numbers\n";
do{
cin>>x;
if(x=='\0'){
flag=true;
}
*(A+i)=x;
i++;
}
while(!flag);
for(int j=0;j<i;j++){
cout<<*(A+j)<<"\n";
}
return 0;
}
</code></pre>
|
c++
|
[6]
|
603,404 | 603,405 |
javascript: pulse text using fade in and fade out?
|
<p>Hi i am trying to get a piece of text to fade in and out automatically without a click or hover method.</p>
<p>i'm not sure i can use an on page load function either because the text i want to fade in and out only appears after a user clicks to open another div on the page.? (I may be wrong?)</p>
<p>I am using this script but the text is static and not doing anything. Can anyone advise me where i'm going wrong? Thanks</p>
<pre><code><script>
function cycle() {
$('#morebutton-pics').fadeOut(1000, function() {
$('#morebutton-pics').fadeIn(1000);
cycle();
});
}
$(document).click(function(){
cycle();
});
</script>
</code></pre>
|
javascript
|
[3]
|
1,825,439 | 1,825,440 |
How to use the line-off function of HTML5 in Android?
|
<p>The page can realize Cache when load html5 page in webview of Android. How to submit in the case of offline, and synchronous server when it online. I know HTML5 can achieve the function, but I do not know the details. How do I achieve it? Thank you in advice.</p>
|
android
|
[4]
|
1,553,375 | 1,553,376 |
Creating own LiveWallpaperPreview?
|
<p>I would like to create my own LiveWallpaperPreview, i.e. to show the user a fullscreen preview of what the selected Live Wallpaper looks like (without the "Set Wallpaper" and "Settings" button that the stock-OS preview has).</p>
<p>Rebuilding the LivePicker-Class from 2.1 (<a href="http://android.git.kernel.org/?p=platform/packages/wallpapers/LivePicker.git;a=tree;f=src/com/android/wallpaper/livepicker;h=1557e0ae77aa8b0f8191472a204b5a7b4add31a4;hb=master" rel="nofollow">android.git.kernel.org</a>) works great, so I am able to let the user select a wallpaper to be previewed, but the actual LiveWallpaperPreview-Class tries to import the following private Interfaces/Classes:</p>
<p><code>import android.service.wallpaper.IWallpaperConnection;<br>
import android.service.wallpaper.IWallpaperService;<br>
import android.service.wallpaper.IWallpaperEngine;<br>
import android.service.wallpaper.WallpaperSettingsActivity;</code> </p>
<p>Is there any way to display a LiveWallpaper in my app without resorting to using the private APIs (which I obviously don't want to do)?</p>
<p>Thanks!</p>
<p>Nick</p>
|
android
|
[4]
|
4,848,890 | 4,848,891 |
Android R.java file
|
<p>Static id in R.java files are generated automatically but can i give then custom values to make my work easier. I have 8 Imagebuttons i need to set images on them by using this code for every button.</p>
<pre><code>ImageButton button4 = (ImageButton)findViewById(R.id.iButton4);
setImagesOnButtons(myContactList.get(3).getPhotoId(),button4);
</code></pre>
<p>instead of doing this can i change ids of button in R.java to 1,2,3...
and put the above code in a for loop like this</p>
<pre><code> for(i=0;i<8;i++)
{
ImageButton button4 = (ImageButton)findViewById(i);
setImagesOnButtons(myContactList.get(3).getPhotoId(),i);
}
</code></pre>
|
android
|
[4]
|
4,403,557 | 4,403,558 |
C++ -- Why I can return an int for class Month
|
<p>Saw the following code snippet and I have problems to understand how it works.</p>
<pre><code>class Month {
public:
static const Month Jan() { return 1; }
...
static const Month Dec() { return 12; }
int asInt() const { return monthNumber; }
private:
Month(int number) : monthNumber(number) {}
const int monthNumber;
}
</code></pre>
<p>The class is designed in this way so that the user will not get invalid month value.</p>
<p>Here is the question:
why the static function Jan can return 1 with the return value as Month?</p>
<p>Thank you</p>
<p>Based on the comments, this class can be designed as follows:</p>
<pre><code>class Month {
public:
static const Month Jan() { return Month(1); }
...
static const Month Dec() { return Month(12); }
int asInt() const { return monthNumber; }
private:
explicit Month(int number) : monthNumber(number) {}
const int monthNumber;
};
</code></pre>
|
c++
|
[6]
|
1,206,172 | 1,206,173 |
how does a php application actually run?
|
<p>Fairly new to web-programming and programming in genral.</p>
<p>In c/c++, the code is all compiled into an exe and run once. The user(s) interact with it and according decisions made by the compiled code that is running, it outputs relevant information.</p>
<p>But in web(php), the users cannot point and click or use keyboard directly to interact with the software (eg. drupal). They can only send it texts of strings (through POST etc) to which the software generates an output and sends it back.</p>
<p>Questions: How does this interpreted(php) software run on the server? How does it function with Apache? Is index.php in drupal equivalent to a .exe produced by c/c++ which runs everytime a request is made by user?</p>
|
php
|
[2]
|
4,073,724 | 4,073,725 |
Saving data to a file and retrieving it w.r.t. user id
|
<p>I'm developing an application using Java Swing. I want to save the details entered by the user in a file (and not in a database) in such a way that I should later be able to retrieve all data related to a specific id. How should I do this?</p>
<p>The user details I need are: ID, Name, Address.</p>
|
java
|
[1]
|
2,224,051 | 2,224,052 |
JQuery . after not working on class added via JQuery
|
<p>This question is in relation to a question I posted yesterday. The link -http://stackoverflow.com/questions/12636348/how-to-add-a-different-class-to-the-same-class-in-jquery . The question and problem now is that I will like to have a div added after the div with the class being added. The problem is the script that I'm using adds the div only to an existing/default class name and not the added class via JQuery. The script is below.</p>
<pre><code> $(document).ready(function(){$('.example').each(function(i){$(this).addClass("ex" + i);});
$('.ex0').after(function(){return'<div class="afterdiv"><a class="afterdiva1" href="#" title="Text."></a><a class="afterdiva2" href="#" title="Text."></a></div>'});
</code></pre>
<p>The default output is:</p>
<pre><code> <div class="example"></div>
</code></pre>
<p>The final html output should read as:</p>
<pre><code> <div class="example ex0"></div>
<div class="afterdiv">
<a class="afterdiva1"></a>
<a class="afterdiva2"></a>
</div>
</code></pre>
<p>Update- I apologize for not clarifying that each div needs to be unique to/per class. Sincere apologies (I'm new to asking for help here or anywhere else for that matter). </p>
|
jquery
|
[5]
|
4,303,119 | 4,303,120 |
How to get to a new line in Python Shell?
|
<p>In IDLE, say i want to write the following in TWO lines:</p>
<pre><code>x = 3
print x**5
</code></pre>
<p>but when i type x = 3 and press enter, it executes the assignment. How to let it execute AFTER two lines are all typed in?</p>
<p>having read first pages of Python tutorial but no answer to this "funny" question...</p>
|
python
|
[7]
|
1,946,319 | 1,946,320 |
How to attach events, only once, to elements created in the future in jQuery?
|
<p>How do I attach events to elements created in the future in jQuery, only once?</p>
<p>I understand that .live() works in attaching events for elements created in the future, but will attach events multiple times like .bind() does. But I need to attach the event only once.</p>
<p><strong>EXAMPLE:</strong></p>
<p>For my case</p>
<p><a href="http://jsfiddle.net/ppTqp/1/" rel="nofollow">http://jsfiddle.net/ppTqp/1/</a> -> Should alert "Live from test" only once. With .live method it alerts twice.</p>
|
jquery
|
[5]
|
215,196 | 215,197 |
What means construction (function () { ... } ) ()
|
<p>What means this construction in JavaScript :</p>
<pre><code> (function (){
alert("bla");
})();
</code></pre>
<p>?</p>
|
javascript
|
[3]
|
1,708,000 | 1,708,001 |
List Mutation on Python
|
<p>I tried mutating a list by swapping a common element between the list and another reference list with the first element. The implementation is as shown below: </p>
<pre><code>>>> L = [1,2,3,4,5,6,7,8,9]
>>> A = [3]
>>> L[0], L[L.index(A[0])] = L[L.index(A[0])], L[0] #want to swap 3 with 1
>>> L
[1,2,3,4,5,6,7,8,9,] #List L was not mutated
</code></pre>
<p>The list was not mutated as I anticipated. But when I modify the implementation as shown below, it worked: </p>
<pre><code>>>> L = [1,2,3,4,5,6,7,8,9]
>>> A = [3]
>>> i = L.index(A[0])
>>> L[0], L[i] = L[i], L[0]
>>> L
[3,2,1,4,5,6,7,8,9,] #Now list mutated as desired even though L[i] and L[L.index(A[0])] evaluate to same value.
</code></pre>
<p>My question is, why couldn't the first assignment mutate the list? I thought of it but my brain coudnt explain it.</p>
|
python
|
[7]
|
3,911,589 | 3,911,590 |
Are there any tutorials on how to create jpeg images or convert images into jpeg on Android?
|
<p>1.myJpegFile = new File("images/jpegImage.jpg");<br>
2.output = new BufferedOutputStream(new FileOutputStream(myJpegFile));<br>
3.encoder = JPEGCodec.createJPEGEncoder(output);<br>
4.encoder.encode(myJpegImage); </p>
<p>Please could you give me the equivalent code for line no. 3 and 4 in Android?</p>
|
android
|
[4]
|
1,496,184 | 1,496,185 |
spin image clockwise/anticlockwise on touch
|
<p>Any idea about how to spin image clockwise/anticlockwise on touch.</p>
|
iphone
|
[8]
|
916,252 | 916,253 |
Get Id of dynamically added control
|
<p>i have one html table "table "and added controls it at run time as :</p>
<pre><code>HtmlTableRow tabelrow = new HtmlTableRow();
HtmlTableCell tablecell = new HtmlTableCell();
Label lbl = new Label();
tablecell.Controls.Add(lbl);
</code></pre>
<p>then i want to get each controls by using foreach</p>
<p>such as <code>(foreach control c in table.controls)</code> or <code>(foreach control c in tablecell.controls)</code>
but its not working.</p>
|
asp.net
|
[9]
|
5,413,485 | 5,413,486 |
My <% %> not working in div. Why?
|
<p>I've tried both snippets below. Nothing. I've tried <%#, <%=, and <%. Nothing. So I'm stuck. </p>
<pre><code><div style="background-color:Gray; color:white; text-align:center; width:100%;">
<asp:HyperLink ID="HyperLink1" Target="_blank" NavigateUrl='<%= Server.HtmlEncode(String.Format("~/ShowHistory.aspx?section={0}&jobnumber={1}", "APQP Header", "101244")) %>' runat="server">Show Updated History</asp:HyperLink>&nbsp;&nbsp;
<asp:HyperLink Target="_blank" NavigateUrl="~/ShowDeletedHistory.aspx" ID="HyperLink2" runat="server">Show Deleted History</asp:HyperLink></div>
<br />
<div style="background-color:Gray; color:white; text-align:center; width:100%;">
<asp:HyperLink ID="HyperLink1" Target="_blank" NavigateUrl='<%= String.Format("~/ShowHistory.aspx?section={0}&jobnumber={1}", "APQP Header", "101244") %>' runat="server">Show Updated History</asp:HyperLink>&nbsp;&nbsp;
<asp:HyperLink Target="_blank" NavigateUrl="~/ShowDeletedHistory.aspx" ID="HyperLink2" runat="server">Show Deleted History</asp:HyperLink></div>
<br />
</code></pre>
|
asp.net
|
[9]
|
3,085,191 | 3,085,192 |
SimpleDateFormat parse does not work properly
|
<p>This is probably a very simple question but I dont see the problem or how to resolve it. Thank you for you help.</p>
<pre><code>String date = "04/11/1972"
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/YYYY");
System.out.println(sdf.format(sdf.parse(date));
</code></pre>
<p>and it displays : 03/01/1972</p>
<p>Why? How to get back my date. it seems there is a problem with the parse which does not give the proper Date object</p>
<p>Thank you</p>
|
java
|
[1]
|
801,635 | 801,636 |
jquery timeago plugin and jquery corner plugin don't work with dynamic content
|
<p>I have a list of reviews, and when you add a review it posts to a PHP page and then loads a Smarty template into the beginning of the review list to show the review you just posted.</p>
<p>That works fine. However, I use a rounded corners plugin and timeago on the review post. I tried re-calling these functions after it loads the review, but that doesn't work either.</p>
<p>I am aware that using .live is approprite for fixing this problem in many other cases, but I don't know how I could apply that here. jquery's .live only works on events. What is the event here?</p>
<p>Any ideas?</p>
<p>For reference: jquery timeago plugin: <a href="http://timeago.yarp.com/" rel="nofollow">http://timeago.yarp.com/</a>
jquery corner plugin: <a href="http://www.methvin.com/jquery/jq-corner-demo.html" rel="nofollow">http://www.methvin.com/jquery/jq-corner-demo.html</a></p>
<p>--</p>
<p>As requested, here is some elaboration: I use $.load to load the template content into the div area. There are no errors from this. It works perfectly, with the exception of the timeago/corner plugins not affecting the output.</p>
<p>I don't have the code accessible to me right now, but it goes a little something like this:</p>
<pre><code>$.load('/inc/templateLoader.php?tpl=reviews');
$('abbr.timeago').timeago();
$('.corner').corner();
</code></pre>
<p>Some people have suggested it might not be working because $.load can complete before the page loads, which would cause the issue I am experiencing.</p>
|
jquery
|
[5]
|
3,538,209 | 3,538,210 |
FilterQueryProvider not updating ListView
|
<p>Trying to use the FilterQueryProvider function to update the contents of a ListView, as characters are entered into the filter, my runQuery function does get called, and a new cursor with filtered content is returned, but the ListView does not update to show the new contents. The docs state that after runQuery returns, changeCursor is called. Isn't this enough to update the ListView display? My code to set up the filter is:</p>
<pre><code> mAdapter = new ItemAdapter(curs);
mAdapter.setFilterQueryProvider(new ItemFilter());
setListAdapter(mAdapter);
</code></pre>
<p>And my filter class is simply:</p>
<pre><code>class ItemFilter implements FilterQueryProvider {
public Cursor runQuery(CharSequence filter) {
return getNewCursor(filter);
}
}
</code></pre>
<p>The cursor from getNewCursor does correctly fetch a subset of the rows. Have I missed something in getting the ListView to update?</p>
|
android
|
[4]
|
623,563 | 623,564 |
How to put a dot after three digits of a number
|
<p>do you know how can i put a dot (.) after 3 digits of a number(starting from the end) in php?
example: the number 1254631 to be shown as 1.254.631??</p>
|
php
|
[2]
|
229,452 | 229,453 |
invalid file name in asset folder
|
<p>Error generating final archive: java.io.FileNotFoundException:C:\Users\Webrich\AndroidWorkspace\Android UK Signs\bin\resources.ap_ does not exist Android UK Signs Unknown Android Packaging Problem
how to fix this error A modern version of the traditional fingerpost may be used at some junctions on minor rural roads.png invalid filename in console </p>
|
android
|
[4]
|
1,858,653 | 1,858,654 |
ASP.net Using a Session Varriable to move a GridView SelectedDataKey to another page
|
<p>Help please!</p>
<p>I am pulling out what little hair I have left over this and can't find an answer.</p>
<p>I am attempting to move the selected row in a grid view to another page and use the SelectedDataKey or the primary key value of the selected row to indicate what data should be displayed in a grid view on another page. This is the last little bit of a school project that I can't figure out.</p>
<p>What I am doing on the first page is to use a button click event to set a session variable that looks something like this. Session["Select"] = GridView1.SelectedDataKey; The button will then send the user to the next page. Response.Redirect("CustomerAccounts.aspx");</p>
<p>Once on the next page I want to use the primary key selected on the first page to show only the data with a coresponding value on the second page by using a where statement in the next gridview. So I am setting the [CustomerID]=? Session("Session["Select"])</p>
<p>Am I setting up the where correctly in the second gridview? </p>
|
asp.net
|
[9]
|
4,340,587 | 4,340,588 |
Variable won't echo in string
|
<p>I'm trying to echo the variable <code>$theurl</code> inside of <code>$image_all</code> but it's not working.</p>
<pre><code>$theurl = OF_DIRECTORY;
$image_all = $theurl.$image_path;
</code></pre>
<p>This should be simple, right? It's only showing what <code>$image_path</code> equals, even though it will echo <code>$theurl</code> if I simply do <code><?php echo $theurl; ?></code>.</p>
<p>What am I missing?</p>
|
php
|
[2]
|
3,033,487 | 3,033,488 |
IntPtr to String and long?
|
<p>i use c#.net 2.</p>
<p>I have this method here to get a string out of a IntPtr:</p>
<pre><code> void* cfstring = __CFStringMakeConstantString(StringToCString(name));
IntPtr result = AMDeviceCopyValue_Int(device, unknown, cfstring);
if (result != IntPtr.Zero)
{
byte length = Marshal.ReadByte(result, 8);
if (length > 0)
{
string s = Marshal.PtrToStringAnsi(new IntPtr(result.ToInt64() + 9L), length);
return s;
}
}
return String.Empty;
</code></pre>
<p>It works an all data which is saved as string in my USB-Device (return data of method "AMDeviceCopyValue").</p>
<p>Now I get this:
"£\rº\0\0¨\t\0\0\0ˆ\0\0\0\0\0\0x>Ô\0\0\0\0Ũ\t\0\0\0€1ÔxÕ͸MÔ\0\0\0\0Ȩ\t\0\0\0€)\0fŒ\a\0Value\0\0˨\t\0\0\0€7fŒ\a\0Result\0Ψ\t\0\0\0ˆTÅfŒ\a\0\0Key\0\0\0\0ñ¨\t\0\0\0€+fŒ\a\0Port\0\0\0ô¨\t\0\0\0€%fŒ\a\0Key\0\0\0\0÷¨\t\0\0\0€:\0\0\0\0\0\0\0\0\0\0\0\0\0\0ú¨\t\0""</p>
<p>This is saved as "long" - so, how I can get this IntPtr into long and not string?</p>
|
c#
|
[0]
|
1,107,848 | 1,107,849 |
regarding jquery animate and opacity
|
<p>here is my code by which i am showing my div & hiding my div with grow & shrink effect. i want that when div is going to shrink then div will be fadeout before it's size is zero.
according to my code my div is fadeout when div size is 0. i mean when height & width is zero.</p>
<p>so please go through my code and tell me how can i fadeout my div before it size become zero.
suppose my div size is 300px. when height & width decrease to 150px with the help of animate function then i want that my div will be fadeout completely. so tell me what to change in my code.</p>
<p>next i saw if i click repeatedly on "click here" button then some flicker occur and also i saw div stuck for one sec or less than one sec. why it happen. how to improve the effect.
what to change in the code. here i am giving my code. please test it and if possible make it more smoother.</p>
<pre><code><div class="click">Click here</div>
<div class="grower"></div>
.click {background:#ccc; border:1px solid black; padding:10px; display:inline-block}
.grower {width:0; height:0; background:red; position:absolute; top:150px; left:150px;opacity: 0}
var grower = $('.grower');
var flag=0;
$('.click').click(function(){
var windowWidth = $(window).width();
var windowHeight = $(window).height();
var left = windowWidth/2 - 150;
var top = windowHeight/2 - 150;
if(flag==0)
{
grower.css({left:windowWidth/2, top:windowHeight/2});
grower.animate({opacity : 1,width:300, height:200, left:left, top:top},'slow');
flag=1;
}
else if(flag==1)
{
grower.animate({opacity : 0,width:0, height:0, left:(windowWidth/2 - $('#grower').width()), top:(windowHeight/2 - $('#grower').height())},'slow');
flag=0;
}
});
</code></pre>
|
jquery
|
[5]
|
3,316,638 | 3,316,639 |
Python: nearest neighbour (or closest match) filtering on data records (list of tuples)
|
<p>I am trying to write a function that will filter a list of tuples (mimicing an in-memory database), using a "nearest neighbour" or "nearest match" type algorithim.</p>
<p>I want to know the best (i.e. most Pythonic) way to go about doing this. The sample code below hopefully illustrates what I am trying to do.</p>
<pre><code>datarows = [(10,2.0,3.4,100),
(11,2.0,5.4,120),
(17,12.9,42,123)]
filter_record = (9,1.9,2.9,99) # record that we are seeking to retrieve from 'database' (or nearest match)
weights = (1,1,1,1) # weights to approportion to each field in the filter
def get_nearest_neighbour(data, criteria, weights):
for each row in data:
# calculate 'distance metric' (e.g. simple differencing) and multiply by relevant weight
# determine the row which was either an exact match or was 'least dissimilar'
# return the match (or nearest match)
pass
if __name__ == '__main__':
result = get_nearest_neighbour(datarow, filter_record, weights)
print result
</code></pre>
<p>For the snippet above, the output should be:</p>
<p><strong>(10,2.0,3.4,100)</strong></p>
<p>since it is the 'nearest' to the sample data passed to the function get_nearest_neighbour().</p>
<p>My question then is, what is the best way to implement <strong>get_nearest_neighbour()</strong>?. For the purpose of brevity etc, assume that we are only dealing with numeric values, and that the 'distance metric' we use is simply an arithmentic subtraction of the input data from the current row.</p>
|
python
|
[7]
|
3,472,172 | 3,472,173 |
for loops in object within object
|
<p>Can someone explain why doesn't this work?</p>
<p>I have two objects within an object. I use for loops to print out each property within the nested objects, one after another.</p>
<pre><code>var people = {
john: {
name: "John",
age: 20
},
bob: {
name: "Bob",
age: 40
}
};
for (var person in people) {
for (var property in person) {
console.log(property);
}
}
</code></pre>
<p>I expect it to print out:</p>
<pre><code>name
age
name
age
</code></pre>
<p>Instead I get:</p>
<pre><code>0
1
2
3
0
1
2
</code></pre>
<p>1) What am I doing wrong?</p>
<p>2) What exactly is the console doing to output the numbers above?</p>
|
javascript
|
[3]
|
5,340,912 | 5,340,913 |
How do I find date prior to another date in php
|
<p>I need to find <code>date x</code> such that it is <code>n working days</code> prior to <code>date y</code>.</p>
<p>I could use something like <code>date("Y-m-d",$def_date." -5 days");</code>, but in that case it wont take into consideration the weekend or off-date. Let's assume my working days would be Monday to Saturday, any idea how I can accomplish this?</p>
|
php
|
[2]
|
3,069,134 | 3,069,135 |
javascript casting a string of regex into a type object
|
<p>I have a box where the user inputs a regex, and in Javascript I take that value and have another string tested with it like so: (this is an abstraction of my real issue)</p>
<pre><code>var regex = $('input').val();
regex.test('some string');
</code></pre>
<p>The only way I know to make sure to cast the <code>regex</code> to a safe <code>Object</code> type, is to use <code>eval()</code>. </p>
<p>Is that the best way of casting it?</p>
|
javascript
|
[3]
|
5,846,433 | 5,846,434 |
jQuery: pass $(this) to a function
|
<p>How can I pass the $(this) object to a function that looks like this</p>
<pre><code>$('#selected').click(dosomething)
</code></pre>
<p>Where dosomething is the function. I tried doing things like...</p>
<pre><code>$('#selected').click(dosomething($(this)))
</code></pre>
<p>But it seems like I'm doing it the wrong way...</p>
|
jquery
|
[5]
|
5,162,128 | 5,162,129 |
separate numeric input android
|
<p>I need to separate the input of an Edit Text on android, the input is in this format 4589, so I want to send the 45 to a list view, and the 89 to a Edit Text, somebody can help me I will appreciate it. thanks</p>
|
android
|
[4]
|
584,396 | 584,397 |
PHP - time adjust
|
<p>I have a set of time in this format.
01:00:04</p>
<p>How can I adjust the time to deduct 4 second from it?<br>
Was trying to parse it but is the a quick way to do it using datetime or something?</p>
<p>Thanks,<br>
Tee</p>
|
php
|
[2]
|
2,919,732 | 2,919,733 |
How to get every state or province in the world based on Country using PHP?
|
<p>I am requiring users who register on my site to specify their location. For this I have 2 selects:</p>
<pre><code>Country
State/Province
</code></pre>
<p>I found snippets online that list every country in a select option format. But how can I populate the State/Province dropdown based on what the user selected in the 1st country dropdown?</p>
<p>I know I have to do it through AJAX, but I am referring to the data itself. What can I use to determine all the states/provinces for each country in the world?</p>
<p>And what would be an example of the implementation please.</p>
|
php
|
[2]
|
926,297 | 926,298 |
Javascript 'delete' doesn't work inside iteration loop
|
<p>I'm a C/C++/Java programmer working with JavaScript.</p>
<p>I'm trying to write a function that will delete all properties of an object 'obj'. I've read the posting on "<a href="http://stackoverflow.com/questions/684575/how-to-quickly-clear-a-javascript-object">How to quickly clear a Javascript Object?</a>" and saw that there are two answers: (1) creating a new 'obj' (which I don't want to do because my code is a high-performance program running in a mobile browser, and I want to minimize garbage collection); and (2) iterating over the properties of an object in a loop and deleting the properties. This latter approach doesn't work in Chrome 12.</p>
<p>Consider the following code:</p>
<pre><code>var foo = {};
foo['baz'] = 'bar';
console.log("1. foo.baz = " + foo.baz);
delete foo.baz;
console.log("2. foo.baz = " + foo.baz);
foo['baz'] = 'bar';
console.log("3. foo.baz = " + foo.baz);
for (prop in foo)
{
if (foo.hasOwnProperty(prop))
{
console.log("deleting property " + prop);
delete foo.prop;
}
}
console.log("4. foo.baz = " + foo.baz);
</code></pre>
<p>This produces the following result in my console on Chrome 12:</p>
<pre><code>1. foo.baz = bar
2. foo.baz = undefined
3. foo.baz = bar
deleting property baz
4. foo.baz = bar
</code></pre>
<p>Why doesn't foo.baz get deleted inside the loop?</p>
|
javascript
|
[3]
|
4,246,575 | 4,246,576 |
Not getting the response body for http post request in android?
|
<p>Not getting the response body for http post request in android.<br>
I am mentioning the userid, password in the name value pairs and putting in the httppost request by </p>
<pre><code>postrequest.setEntity(new UrlEncodedFormEntity(nameValuePairs));
</code></pre>
<p>but on executing i am getting the response as SC_OK(200), but the response body is <code>null</code>.</p>
<p>One more problem is if i specify header in HTTPGet or HTTPPost's request using <code>setHeader()</code> function i am getting BAD REQUEST (404) response. </p>
<p>Please help me in resolving the above issue.</p>
<p>Thanks & Regards,<br>
SSuman185</p>
|
android
|
[4]
|
586,345 | 586,346 |
go to beginning of for statement in java
|
<p>I'm very new to Java and maybe my question is a bit irritating. </p>
<p>I have two <code>for</code> loops in my code and I want to go to the beginning of each one by a <code>for</code>-<code>else</code> statement. </p>
<pre><code>public static void main(String[] args)
{
int[][] x=new int[1000][1000];
int[] Z=new int[1000];
lable1:
for(int i=1; i<=1000; i++)
{
Z[i]=rand1.nextInt(1000);
System.out.println("Z["+i +"] = " + Z[i] );
if(Z[i]>0 && Z[i]<=Nk)
{
int Z1=Z[i]-1;
lable2:
for(int j = 1; j<=Z1;j++ )
{
x[i][j]= rand2.nextInt(1000);
sum+=x[i][j];
if( sum<1000)
{
x[i][(j+1)]=1000-sum;
System.out.println("x[" + i+"][" + j + "] = " + x[i][j]);
System.out.println("Nx[" + i+"][" + (j+1) + "] = " +x[i][(j+1)]);
}
else{
// ????
//Goto lable2;
}
}
}
else{
//goto label1;
// ????
}
}
}
</code></pre>
|
java
|
[1]
|
3,762,922 | 3,762,923 |
Hide Checkbox on a particular page
|
<p>I am working on ASP.NET application where I am reusing a user control. The user control contains a checkbox and bunch of other controls. I want to display all the controls inside the user control on all the pages but on one single page I want to hide the checkbox. </p>
<p>I was thinking that I can use the databind methods and see if I am on the "pagex" then hide the checkbox. Is there any other way to solve this problem? </p>
|
asp.net
|
[9]
|
3,076,199 | 3,076,200 |
set a new id for a class in javascript
|
<p>I have a class as</p>
<pre><code> <div class="group-left article_left">
</code></pre>
<p>I need to add a id for this class dynamically using JavaScript.</p>
<p>i have added the following code </p>
<pre><code> var thediv = document.getElementByClass("#group-left");
thediv.id = "pad_id";
</code></pre>
<p>But the id is not appearing in my code.Can anyone help me.</p>
|
javascript
|
[3]
|
4,029,727 | 4,029,728 |
Getting Some Selected Text from EditText and Highlight it
|
<p>Can anybody tell me how can i get the selected text from the all edit Text and make it highlight on a button click...</p>
|
java
|
[1]
|
5,921,238 | 5,921,239 |
how to replace 2 double quotes in a file
|
<p>I have 2 double quotes that need to be replaced by a single double quote.</p>
<p>I am using this method:</p>
<pre><code>private static void ReplaceTextInFile(string originalFile, string outputFile, string searchTerm, string replaceTerm)
{
string tempLineValue;
using (FileStream inputStream = File.OpenRead(originalFile))
{
using (StreamReader inputReader = new StreamReader(inputStream))
{
using (StreamWriter outputWriter = File.AppendText(outputFile))
{
while (null != (tempLineValue = inputReader.ReadLine()))
{
outputWriter.WriteLine(tempLineValue.Replace(searchTerm, replaceTerm));
}
}
}
}
}
</code></pre>
<p>and calling it this way</p>
<pre><code>ReplaceTextInFile(file, file + "new", (char)34 + (char)34, (char)34);
</code></pre>
<p>the error i am getting is</p>
<pre><code>Error 4 Argument '3': cannot convert from 'int' to 'string'
and Error 5 Argument '4': cannot convert from 'char' to 'string'
</code></pre>
<p>what am i doing wrong?</p>
|
c#
|
[0]
|
5,477,880 | 5,477,881 |
How to print the name of an array in java
|
<p>I wanna print the name of an array within a function that I pass as an String argument:</p>
<pre><code>public static String[][] cleanCSVtable(String[][] data_table) {}
</code></pre>
<p>instead of something like this: </p>
<pre><code>[[Ljava.lang.String;@ba4539
</code></pre>
<p>For example lets assume that I have defined this array outside of the main function as </p>
<pre><code>public static String [][] XYZ = null;
</code></pre>
<p>I wanna print XYZ within this function instead of </p>
<pre><code>[[Ljava.lang.String;@ba4539.
</code></pre>
<p>Any hacks/hints/ideas?</p>
|
java
|
[1]
|
3,226,439 | 3,226,440 |
triggering an onchange event of a select box
|
<p>I have a select box, which i can populate using two methods.</p>
<p>First - Just by selecting any one of the option in the select box.</p>
<p>Second - I have a link just beside the select box.Clicking this link takes me to a page2, which has the same options but as links in page2.When i click one of them , it populates the select box.</p>
<p>Selecting the option directly from the "select" triggers an onchange event in it.
But when i click the link, select my required option from that page, it does not trigger the onchange event in the select box.
I am not sure where i am doing a mistake.</p>
<p>Thanks in advance.</p>
|
javascript
|
[3]
|
3,260,473 | 3,260,474 |
running shell scripts in c++
|
<p>Ive been writing the folowing code: </p>
<pre><code>#include <iostream>
#include <stdlib.h>
using namespace std;
int main() {
cout << "The script will be executed";
system("./simple.sh");
}
</code></pre>
<p>But when I run it the shell script is executed first.<br>
What can I do to execute "cout << "The script will be executed"" first?</p>
|
c++
|
[6]
|
2,801,062 | 2,801,063 |
Will this foreach loop call Split() each iteration in C#?
|
<p>If I have a for loop like the following:</p>
<pre><code>foreach(string email in installerEmails.Split(','))
{
Console.WriteLine(email);
}
</code></pre>
<p>Will the Split() call be made on each iteration of the loop? Do I need to store it in a temp array before iterating through it?</p>
|
c#
|
[0]
|
5,633,761 | 5,633,762 |
Java String.substring returning empty string
|
<p>I'm trying to run the following code</p>
<pre><code>int[] sbox = new int[256];
String inputString = "Thisisanexample";
String sTemp;
char cTmp;
int intLength = inputString.length();
for (a = 0; a <= 255; a++)
{
sTemp = inputString.substring(a % intLength, 1);
ctmp = sTemp.toCharArray()[0];
sbox[a] = (int)ctmp;
}
</code></pre>
<p>Every time i run the code I get a java.lang.ArrayIndexOutOfBoundsException when the counter variable = 1. Checking the code in the debugger, it appears the substring is returning an empty string when it should be returning the second character in the inputString.</p>
<p>Can anyone advise why this would be the case?</p>
|
java
|
[1]
|
2,783,689 | 2,783,690 |
Alogritm to find overlap between 2 sections
|
<p>I have 2 sections, each section contains of 2 Points and each point has X and Y.
What is the best way to find the overlap between these 2 sections? (only on the X relevant here)</p>
<pre><code>public class section
{
double leftPoint;
double rightPoint;
}
</code></pre>
|
java
|
[1]
|
1,789,743 | 1,789,744 |
what is the best way of sharing a configuration object across classes?
|
<p>Let us say that I have the classes M, A, B, C. M is the main class of my application (that is the one that does most of the job) and has this structure</p>
<pre><code>class M {
public:
// Something here.
private:
Conifg config;
A a;
std::vector<B> bs;
const C* c;
};
</code></pre>
<p>In a main I create an instance m of class M and I want to set my config object, say by reading it from a file. The configuration object is nothing special, it could be a protocol buffer or a simple struct.</p>
<p>Now, I want a, b and c to be able to access the config object, because there are some global settings that they need. These settings are global, they do not change, and are the same for each instance of A, B and C (and M). What I am currently doing, is having a static field in each class A, B and C and I am setting a copy of the configuration object for each instance of these classes. I do not want these classes to know of the existence of M. Is this the best solution? Should I perhaps think of a global config variable?</p>
|
c++
|
[6]
|
4,240,707 | 4,240,708 |
Caching Files in the Browser
|
<p>By using the below function I am caching js, css file in the browser.</p>
<p>Like wise I want to cahe the Image in the browser.</p>
<pre><code>private static void CacheOrFetchFromServer(string relativePath, string absolutePath, HttpContext context)
{
Cache cache = HttpRuntime.Cache;
string content;
if (cache[relativePath] == null)
{
Encoding encoding = Encoding.GetEncoding(DefaultEncodingCodePage);
CacheDependency dependency = new CacheDependency(absolutePath);
content = File.ReadAllText(absolutePath, encoding);
cache.Insert(relativePath, content, dependency);
}
else
{
content = cache[relativePath].ToString();
}
using (StreamWriter sw = new StreamWriter(context.Response.OutputStream))
{
sw.Write(content);
}
}
</code></pre>
<p>I had tried the below one to cache the image. But it didn't show the image.</p>
<pre><code>private static void CacheOrFetchImageFileFromServer(string relativePath, string absolutePath, HttpContext context)
{
string extension = System.IO.Path.GetExtension(relativePath);
if (extension.ToUpper() == ".JPG" || extension.ToUpper() == ".PNG" || extension.ToUpper() == ".GIF" || extension.ToUpper() == ".TIFF")
{
Cache cache = HttpRuntime.Cache;
System.Drawing.Image imgPhoto = null;
if (cache[relativePath] == null)
{
Encoding encoding = Encoding.GetEncoding(DefaultEncodingCodePage);
CacheDependency dependency = new CacheDependency(absolutePath);
FileStream fs = File.OpenRead(absolutePath);
byte[] data = new byte[fs.Length];
fs.Read(data, 0, data.Length);
MemoryStream ms = new MemoryStream(data);
Bitmap bmp = new Bitmap(ms);
imgPhoto = System.Drawing.Image.FromFile(absolutePath);
cache.Insert(relativePath, bmp, dependency);
}
else
{
imgPhoto = (Image) cache[relativePath];
}
context.Response.Write(absolutePath);
//using (StreamWriter sw = new StreamWriter(context.Response.OutputStream))
//{
// sw.Write(absolutePath);
//}
}
}
</code></pre>
|
asp.net
|
[9]
|
1,500,321 | 1,500,322 |
getting multiple attributes from a link before sending to a .load query
|
<p>The code below is supposed to grab the ?cs=bla&cat=bla values from the link attribute and post it to my .load query...does anyone know where i am going wrong?</p>
<pre><code>//Remove tab info and add gallery
$(".more").click(function () {
var $gallery = $(this).closest('.tab').find('.gallery-holder'),
cat = $(this).attr('href').split('cat=')[1];
if ($gallery.is(':empty')) {
$gallery.load('/public/themes/lbd/js/imagegallery.php', {'cat': cat}, function(){
$(this).fadeIn(function(){
$('a.customGal').zoomimage();
});
});
}
$gallery.siblings().fadeOut(function(){
$gallery.fadeIn();
});
return false;
});
</code></pre>
|
jquery
|
[5]
|
1,257,126 | 1,257,127 |
Whiteboard on android?
|
<p>I am trying to make a whiteboard in android. i am using the example suggested in here - <a href="http://stackoverflow.com/questions/3608455/whiteboard-making">Whiteboard Making</a></p>
<p>but this gives me everything in a dotted line. I want it to appear like a normal writing on a board. How can that be done.</p>
|
android
|
[4]
|
42,301 | 42,302 |
Browser Display Problem on Motorola Droid Phone
|
<p>I have the mobile page displayed fine in iPhone with the meta element set.</p>
<p></p>
<p>It also work fine in HTC G1 and G2 phone without the above meta tag.</p>
<p>However, it is totally screwed up when displayed on the HTC Droid phone such as Motorola Droid. </p>
<p>Does anyone know that what parameters I should set to display it properly? I have the background image with 320X480 which is the exact size of device resolution (320X480).</p>
|
android
|
[4]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.