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 |
|---|---|---|---|---|---|
19,407 | 19,408 | C++ NOT outputing... +1 negative | <p>How do i make program which outputs NOT(x)?</p>
<p>Example:</p>
<ul>
<li>12 to 3</li>
<li>0 to 1</li>
<li>2 to 1</li>
</ul>
<p>explained:</p>
<ul>
<li>1100 to 0011</li>
<li>0 to 1</li>
<li><p>01 to 10</p>
<p><code>printf("%i\n%i\n%i\n", ~12, ~0, ~2);</code></p></li>
</ul>
<p>Prints:</p>
<pre><code>-13
-1
-3
printf("%i\n%i\n%i\n", !12, !0, !2);
</code></pre>
<p>Prints:</p>
<pre><code>0
1
0
</code></pre>
| c++ | [6] |
5,368,692 | 5,368,693 | android:how to Reload the TabActivity when tab press? | <p>I have Tab Based Application where i want to Reload the Tab activity when tab are select again.. In my application when i select the Tab again the view are coming as old output It is not reloading the page..so how can i reload the page by clicking the Tab again and again without showing old view?</p>
| android | [4] |
1,009,890 | 1,009,891 | difference between call by value and call by reference in php and also $$ means? | <p>(1) I want to know what is the difference between call by value and call by reference in <code>php</code>. PHP works on call by value or call by reference?</p>
<p>(2) And also i want to know that do you mean by $$ sign in php</p>
<p>For example:-</p>
<pre><code>$a = 'name';
$$a = "Paul";
echo $name;
output is Paul
</code></pre>
<p>As above example what do u mean by $$ on PHP.</p>
| php | [2] |
5,076,944 | 5,076,945 | How to Expose Column in DataTable | <p>I created class inherited from DataTable. I want to Expose the items like "Name" , "Number"</p>
<p>from the class. Just like this </p>
<pre><code>class MyClass : DataTable
{
[Column]
Name
[Column]
Number
}
</code></pre>
<p>so that i can access like row["Name"] = "some";</p>
<p>and i going to use this data table as DataSource to Crystal Report. ( ie from Data menu->Add new DataSource --> object and select the appropriate class and this will display the Name and Number which i can add to crystal report at design time)</p>
<p>How to achieve this.</p>
| c# | [0] |
4,456,383 | 4,456,384 | Android : facebook not showing application icon | <p>I am having a problem with facebook. I have registered an application with facebook, written the code for updating status via application. But when the status is posted facebook does not shows the application's icon on the wall. It only shows the small logo and not the big icon.</p>
<p>I have re-verified that the application icon exists in the profile page of my application.</p>
<p>Any help ???????</p>
| android | [4] |
3,569,974 | 3,569,975 | Prompt only when closing browser not when clicking save button or when navigating away from page using javascript? | <p>How to prompt when user typed something in the textbox and unknowingly close the browser?Also if the user doesn't type anything in the input field and if close the browser,the browser should close without prompting.Browser should prompt only if the user changed something in the field.If I use onbeforeunload event,it promts for everthing even when saving the page. Is there anyway to solve my problem in javascript.Please help by giving me apt codes.</p>
| javascript | [3] |
5,504,940 | 5,504,941 | Changing vibration Intensity of Buttons | <p>I was creating a small app which has got only one activity with a lot of buttons and they vibrate when clicked. Later i learned there are different vibration intensity which can be changed.</p>
<p>So i want to create a Dialog Box which has got a <code>Seek Panel</code>, <code>Test Button</code> and a <code>OK</code> button. In the <code>seek panel</code> we can change the intensity of the vibration ranging from ZERO(no vibrate)i.e Extreme left to Max vibrating intensity i.e extreme right and <code>Test Button</code> to vibrate at the present selected intensity for testing purpose of course and <code>Ok</code> to confirm the setting.</p>
<p>Note: When <code>OK</code> is clicked the selected setting should be liable to all the buttons on the activity.</p>
<p>Plz help me write code for this purpose. Thnx.</p>
| android | [4] |
2,255,149 | 2,255,150 | " is getting replaced by \ in PHP | <p>The URL I am using is: <code>http://example.org/codecabana/runCode.php?code=%23include%20%3Cstdio.h%3E%0Aint%20main(void)%20%7B%0Aprintf(%22Code%20Cabana!%22)%3B%0Areturn%200%3B%0A%7D&lang=C</code>
<br>The problem is, it seems to be replacing <code>"</code> with <code>\</code>.
My PHP script is:</p>
<pre><code><?php
include "sl.php";
$code = $_GET['code'];
$lang = $_GET['lang'];
try {
$app = new slApp( $plaintext );
$result = $app -> run( $code , $lang ); //Pass the result of the request, as an array, to $result
echo $result['output'],"{BREAK}";
echo $result['compiler_errors'];
echo $code;
}catch( Exception $e ) {
echo $e -> getMessage(), "{BREAK}", "An error has occurred! CODE: " , $code , "Lang: " , $lang;
}
?>
</code></pre>
| php | [2] |
1,274,293 | 1,274,294 | I succeeded in creating a Matcher, but I'm having trouble compiling and using AbstractMatcherTest | <p>I'm new to Java and I successfully created and used a RegularExpressionMatcher based on org.hamcrest.TypeSafeMatcher. In attempt to be a good programmer, I proceeded to try to write a Unit Test. I checked out hamcrest-read-only, perused to hamcrest-read-only/hamcrest-java/hamcrest-unit-test/src/main/java/org/hamcrest/text and proceeded to base my test on StringContainsTest.java. Along the way, I realized that I was going to need to compile AbstractMatcherTest.java.</p>
<p>Unfortunately, when I tried to do so, I got:</p>
<pre><code>13:35:47-~/svn/hamcrest-read-only/hamcrest-java/hamcrest-unit-test/src/main/java/org /hamcrest$ javac AbstractMatcherTest.java
AbstractMatcherTest.java:34: cannot find symbol
symbol : method describeMismatch(T,org.hamcrest.Description)
location: interface org.hamcrest.Matcher<capture#226 of ? super T>
matcher.describeMismatch(arg, description);
^
1 error
</code></pre>
<p>my CLASSPATH contains /Users/username/Library/Java/hamcrest-library-1.3.0RC2.jar which should presumably include org.hamcrest.Matcher, etc.</p>
<p>I have tried adding the following lines to AbstractMatcherTest.java:</p>
<pre><code>import org.hamcrest.Matcher;
import org.hamcrest.StringDescription;
import org.hamcrest.Description;
</code></pre>
<p>Thank you for your help,
-Leah</p>
| java | [1] |
2,175,718 | 2,175,719 | I am trying this code for finding the missing member in a list..but it doesn't work | <pre><code>list = [['a', (1,1)], ['a', (1,2)], ['a', (1,4)], ['a', (1,5)]]
for i in list:
print "the i is ", i
print i[0] # 'a'
print i[1] # (1, 1)
n = 'a'
v = (1,1)
#n = re.search(r'[a-z]', i[0])
#v = (v[0], (v[1] + 1))
print "just", i[1]
print "trying ", v
for j in i:
if (j[0] != n):
v = (1, 1)
n = i[0]
if (i[1] != v):
print v
raise ValueError, '[%s, %s] is missing' %(i[0], (i[1][0], i[1][1]-1))
v = (v[0], (v[1] + 1))
</code></pre>
<p>The value doesn't seem to change after the first iteration i.e. it remains to <code>(1,1)</code>, which I can see however what needs to be done so that it reports the missing item in a list i.e. in this example list it is <code>['a', (1, 3)]</code>. Generally, the code starts with <code>['a', (1,1)]</code> for detection of its missing in a list and so it follows each item in a sequence</p>
| python | [7] |
1,195,501 | 1,195,502 | Custom style of expander button of an ExpandableListView | <p>I would like to replace the default button style of a grouping header in an ExpandableListView (placed as gray button with black arrow on the left side of a group) by an own style.</p>
<p>Has anyone an idea or a reference to do this?</p>
| android | [4] |
3,282,930 | 3,282,931 | jquery animate to a certain position | <p>Lets say I have a 3 column <code><table></code> or <code><div></code> with widths of <code>50%</code> <code>200px</code> and <code>empty</code></p>
<p>I want to use jQuery to animate a off screen element into view with it's ending location being relative to the left edge of the 2nd column.</p>
<p>So say I am viewing page on a large screen and the edge of the second column is <code>900px</code> from the left side of the window. I want the animation to stop <code>100px</code> from the edge of the 2nd column so at <code>800px</code> from the left</p>
<p>However the page might be viewed on a smaller screen. So the stopping location might end up being... <code>400px</code> from the left.</p>
<p>How do I get the location of the side of a element and then apply it to my animation?</p>
| jquery | [5] |
37,061 | 37,062 | Jquery date picker (select multipe hours on a particular day) | <p>I have looked up at several jquery date picker.I need a date picker that allows the user to select multiple time on a day (after every half an hour). The user is picking room reservations, multiple hours on a particular day (similar to google calendar). Therefore, I want the date picker to show such explicitly.</p>
<p>Thank you for any help!</p>
| jquery | [5] |
3,525,880 | 3,525,881 | Is ASP.Net a scripting language or a framework? | <p>I came to an article in w3schools saying that asp.net is a server side scripting language. I used to believe that ASP.Net is a framework and not some scripting language. Please clarify my doubts regarding this.</p>
| asp.net | [9] |
4,731,659 | 4,731,660 | GeoExt form and file upload | <p>I have a GeoExt form and want to do file upload here. But i never work with GeoEXT. I have this.</p>
<pre><code>buttons: [{
text: 'Загрузить',
handler: function(){
if(fp.getForm().isValid() && Ext.getCmp('opinions').getValue()=="blabla"){
form_action=1;
fp.getForm().submit({
url: '<portlet: actionURL>',
waitMsg: 'WAITING...',
success: function(fp, o) {
DO SOMETHING
}
}
}
}]
</code></pre>
<p>This is correct?<br>
What arguments use in <code>success: function(fp, o)</code>? First argument is <code>FormPanel</code> but i dont understand what is second.
Another question how to do asynchronous file upload in this case? </p>
| javascript | [3] |
423,909 | 423,910 | Java: What should be done to use TreeBidiMap? | <p>I want to use <a href="http://commons.apache.org/collections/api-release/org/apache/commons/collections/bidimap/TreeBidiMap.html" rel="nofollow">this class</a>. </p>
<p>Netbeans is rejecting the declaration:</p>
<pre><code>import org.apache.commons.collections.bidimap.TreeBidiMap;
</code></pre>
<p>What should be done?</p>
| java | [1] |
4,347,746 | 4,347,747 | how to change orientation of the iphone /ipod? | <p>HI All</p>
<p>i am using the device orientation for some functionality like as </p>
<p>in stating the as we run the app it should be in the landscape mode and in this mode if we orientate the phone in 90 angle than it should play some video than problem comes video play by default in the landscape mode but we need it in the portrait mode than for playing video in the portrait mode we put the code </p>
<pre><code>[ mPlayer setOrientation:UIDeviceOrientationPortrait animated:NO];
</code></pre>
<p>like this even this method show a warning but it do work for playing the video in the portrait mode.</p>
<p>now what is the problem :-as we start the app the screen we were showing in the starting of the app just comes and disaapper and it just starts playing the video and not come to that screen we even use the default rotation function to make it usable but it doesn't work </p>
<p>any suggestion thanks
Balraj Verma</p>
| iphone | [8] |
4,519,877 | 4,519,878 | Find and update a hash by HashKey to add record for saving | <p>Lets say I have an array of hashes:</p>
<pre><code>hash = [{"one": 1}, {"two": 2}]
</code></pre>
<p>And I want to find a hash and add to it. For example find "one" and add:</p>
<pre><code>hash = [{"one": 1, "new": new}, {"two": 2}]
</code></pre>
<p>I could do this by hash key? If so how would I do it? Or is there a much better way to do this thing in Javascript? I dont want to copy the hash, make a new one and delete the old one. Just update what is already there.</p>
| javascript | [3] |
6,005,980 | 6,005,981 | How do I make this C++ object non-copyable? | <p>See title.</p>
<p>I have:</p>
<pre><code>class Foo {
private:
Foo();
public:
static Foo* create();
}
</code></pre>
<p>What need I do from here to make Foo un-copyable?</p>
<p>Thanks!</p>
| c++ | [6] |
36,863 | 36,864 | What is the Disadvantages of saving images in Database in Android? | <p>I am making an application in which i take a picture from the camera and save in database by compressing in ByteArray but i have read that in if there is various large number of images than precessing of application may be slow by reading images from database so what is the best to store images (either in internal memory or sdcard) and display in ListView? </p>
<p>Thanks</p>
| android | [4] |
3,574,649 | 3,574,650 | add contact to a group in Android | <p>I am working on android apps. I want to add a contact in android phone group. The code I am using is below:</p>
<pre><code> ContentValues values = new ContentValues();
values.put(ContactsContract.CommonDataKinds.GroupMembership.RAW_CONTACT_ID,personId);
values.put(
ContactsContract.CommonDataKinds.GroupMembership.GROUP_ROW_ID,GROUP_ID);
values.put(
ContactsContract.CommonDataKinds.GroupMembership.MIMETYPE,ContactsContract.CommonDataKinds.GroupMembership.CONTENT_ITEM_TYPE);
Log.d("values :", ""+ values);
this.getContentResolver().insert(
ContactsContract.Data.CONTENT_URI, values);
</code></pre>
<p>Unfortunately, this is not working. Does anyone see anything obviously wrong with the above code?</p>
| android | [4] |
1,193,574 | 1,193,575 | How make my website like iphone appearence | <p>which control should i use to make my company's website to iphone look ... </p>
<p>so that when it open it iphone then it look a different that it look in normal browser... </p>
<p>actually i am an iphone developer and i have to give this answer to the web designer of my group...</p>
| iphone | [8] |
2,563,523 | 2,563,524 | How do you write two strings to a file in c++ | <pre><code>{
string vertexcharacter = "{";
string a = "}";
ofstream myfile;
myfile.open("newfile.txt");
myfile << vertexcharacter, a;
myfile.close();
system("pause");
return 0;
</code></pre>
<p>}</p>
<p>the first string is written but the second string does not show up in a text document</p>
| c++ | [6] |
827,874 | 827,875 | Handling fatal exceptions in C#? | <p>How can I execute some code when my program experiences a fatal error and crashes? For example, something goes wrong and the box pops up that say "TestApp.exe has encountered an error and needs to close." and then I want to write to a file with an error code and say a report of the last few things that were entered into the program. How would I do this in C#??</p>
| c# | [0] |
5,421,527 | 5,421,528 | capitalize words with some words inside of tags | <p>Here's what I tried:</p>
<pre>
ucwords(strtolower('<span class="lsres">retro</span> VIRUS'));
</pre>
<p>I want to get:</p>
<pre>
Retro Virus
</pre>
<p>I am getting:</p>
<pre>
retro Virus
</pre>
<p>I cannot do anything similar to:</p>
<pre>
sprintf(ucwords(strtolower('%s VIRUS')), ucwords(strtolower('retro')));
</pre>
<p>Since "retro" part happens at the beginning, in the middle, or at the end of the word/sentence totally randomly. </p>
<p>Of course "retro" is a sample only and in different cases it can be replaced by other words at random.</p>
| php | [2] |
5,207,148 | 5,207,149 | How to add the data from tableview to sql | <p>I am making an application. On one of the tab I have used tableview on which I am adding the local notifications timing by using time picker. I am also using sql database in my app. Now I want the timing which I have added in the table view must be store in database so that I can retrieve it on another tab. How Can I do this implementation. Please If anyone know it. Give me some solutions.</p>
<p>Thanks alot. </p>
| iphone | [8] |
3,762,278 | 3,762,279 | Disable auto escape in python | <p>When performing a simple open-read command from a web based document which contains text that is already escaped, python adds <code>\</code> to the escape <code>\</code>:</p>
<pre><code>href=\"http:\/\/
into
href=\\"http:\\/\\/
</code></pre>
<p>How do I disable this behavior? </p>
<h3>UPDATE</h3>
<p>Can be replicated with for example</p>
<pre><code>a= 'href=\"http:\/\/'
</code></pre>
<p>or in my case </p>
<p>I simply did a open() then a read with mechanize. </p>
<p>So how do I tell python that the string is already escaped? </p>
| python | [7] |
2,416,566 | 2,416,567 | Welcoming User to the website with his/her Username | <p>Whenever a registered user logins to the website,My website should play some sound with welcome note like For e.g, If Username is ABC Then it should play "Welcome ABC", If username is XYZ,then it should play "Welcome XYZ".</p>
| asp.net | [9] |
5,399,869 | 5,399,870 | java - multiple http requests at same time | <p>Is there a better way to send thousands of http GET requests at the same time? My code sends requests one after other. Have looked at other answers but could not figure it out. Thanks. </p>
<pre><code> for (int j=0; j<4; j++)
{
DefaultHttpClient httpclient = new DefaultHttpClient();
CookieStore cookieStore = httpclient.getCookieStore();
HttpGet httpget = new HttpGet("");
try {
HttpResponse response = httpclient.execute(httpget);
List<Cookie> cookies = cookieStore.getCookies();
} catch (Exception e) {}
httpclient.getConnectionManager().shutdown();
}
</code></pre>
| java | [1] |
5,849,454 | 5,849,455 | Using a Tiff image on a webpage | <p>I may be forced into using a tiff image on a webpage.</p>
<p>Do most modern browsers handle tiffs. Are there any gotchas? </p>
| asp.net | [9] |
3,328,940 | 3,328,941 | Is it possible to change the border color of the strip wrapper from the jQuery plugin GalleryView? | <p>I found a very nice jquery plugin: <a href="http://spaceforaname.com/gallery-light.html" rel="nofollow">http://spaceforaname.com/gallery-light.html</a></p>
<p>I want to change the border color of the strip wrapper (default is white)</p>
<pre><code>position: absolute; z-index: 1000; cursor: pointer; top: 304px; left: 74px; height: 98px; width: 98px; border: 2px solid white;
</code></pre>
<p>The problem is that the border color seems to be generated via javascript</p>
<p>any suggestions?</p>
| jquery | [5] |
4,247,124 | 4,247,125 | php delete a single file in directory | <p>I've got the php list directory script from this link <a href="http://www.gaijin.at/en/scrphpfilelist.php" rel="nofollow">http://www.gaijin.at/en/scrphpfilelist.php</a>.
How do I delete a single file from the directoy? I tried <code>unlink</code>, but it deleted all the files from that directory. this the short code what i got from the link!</p>
<pre><code>while ($file = readdir ($hDir)) {
if ( ($file != '.') && ($file != '..') && (substr($file, 0, 1) != '.') &&
(strtolower($file) != strtolower(substr($DescFile, -(strlen($file))))) &&
(!IsFileExcluded($Directory.'/'.$file))
) {
array_push($FilesArray, array('FileName' => $file,
'IsDir' => is_dir($Directory.'/'.$file),
'FileSize' => filesize($Directory.'/'.$file),
'FileTime' => filemtime($Directory.'/'.$file)
));
}
}
$BaseDir = '../_cron/backup';
$Directory = $BaseDir;
foreach($FilesArray as $file) {
$FileLink = $Directory.'/'.$file['FileName'];
if ($OpenFileInNewTab) $LinkTarget = ' target="_blank"'; else $LinkTarget = '';
echo '<a href="'.$FileLink.'">'.$FileName.'</a>';
echo '<a href="'.unlink($FileLink).'"><img src="images/icons/delete.gif"></a></td>';
}
}
</code></pre>
<p>the list directory folder call : backup.<br>
in the <code>unlink($FileLink)</code>, when i hover the link has change to another folder to admin folder?</p>
| php | [2] |
4,044,981 | 4,044,982 | Is android phone are upgradable to new vaesion platform | <p>Recently android have launch 2.1 version, so i just want to ask, can phone running on 1.6 version are upgradable to 2.1 version.</p>
| android | [4] |
382,877 | 382,878 | How to select a child in jquery? | <p>This is the sample structure!</p>
<pre><code><div id ="div1">
<div class="div1-child">
<div class="div1-sub-child">
</div>
</div>
</div>
</code></pre>
<p>Can anyone help me how to apply jquery effects on the div1-sub-child when i hover the div1?</p>
| jquery | [5] |
364,475 | 364,476 | Consuming encapsulated member event | <p>I'm trying to comsume an encapsulated member event. Let me explain. I have MyClassA, which has a private member of MyClassB _obj:</p>
<pre><code>public class MyClassA
{
private MyClassB _obj;
public MyClassA()
{
_obj = new MyClassB();
}
}
</code></pre>
<p>MyClassB has SaveProgress event. </p>
<p>For the client application, MyClassB is invisible. We need to handle its event through MyClassA:</p>
<pre><code>public partical class _Default: System.Web.UI.Page
{
protected void button1_Click(object sender, EventArgs e)
{
MyClassA objA = new MyClassA();
// We need to handle it's event through MyClassA
// objA.SaveProgress += new EventHandler<SaveProgressEventArgs>(objA_SaveProgress);
}
}
</code></pre>
<p>How can I do that? Thanks.</p>
| c# | [0] |
4,520,962 | 4,520,963 | String to hexadecimal Color Code | <p>in a project I'm making I'm using numerous color codes.
the point is not for them to be Beautiful, just differents.(I also want to be able to constantly have the same colors code for the same fields on refresh (no Random color generators))
I was thinking about taking the name of the fields and turn them to Hex color.
Is there a pre-defined function for this?</p>
<p>Exemple : </p>
<pre><code>$string = "Blablabla";
$colorCode = toColorCode($string);
function toColorCode($initial){
/*MAGIC MADNESS*/
return array("R"=>XXX,"G"=>XXX,"B"=>XXX);
}
</code></pre>
<p>FORGOT TO MENTION : it's important that the values are Numbers only.</p>
| php | [2] |
5,278,920 | 5,278,921 | How to get a reference to a control in the view? | <p>If I have a UIScrollView set up in the view via the Interface Builder, how do I get a reference to it in the ViewController implementation? I want to programmatically add labels to the scroll view.</p>
<p>For example, in C# if you have a textbox declared in the UI/form, you can access it by simply using the ID declared for that textbox. It doesn't seem this simple in objective c.</p>
<p>Thanks
Kevin</p>
| iphone | [8] |
22,268 | 22,269 | How to bind event with Grid view check box event add using jquery | <p>Will you please help me out</p>
<p>Thanks............ </p>
<p>I have following table I just needed functionality. When user click Full (Permission) then the corresponding row having following permission Read, Add, Edit, Delete all are checked. </p>
<p>When user have click on the edit, delete, add check box the read permission is automatically checked.
following is a link</p>
<p><a href="http://jsbin.com/ifapo4/2/edit" rel="nofollow">http://jsbin.com/ifapo4/2/edit</a></p>
| jquery | [5] |
478,884 | 478,885 | Absolute beginner wanting to learn iPhone dev | <p>This is my first time programming. Should I learn C first, and the start Objective-C, or just dive straight in. Either way, can you give me a few pointers about where to start e.g. sites, books etc.
Thanks</p>
| iphone | [8] |
2,182,993 | 2,182,994 | Download prices with python | <p>I have tried this before. I'm completely at a loss for ideas. </p>
<p>On this page this dialog box to qet quotes.
<a href="http://www.schwab.com/public/schwab/non_navigable/marketing/email/get_quote.html" rel="nofollow">http://www.schwab.com/public/schwab/non_navigable/marketing/email/get_quote.html</a>?</p>
<p>I used SPY, XLV, IBM, MSFT </p>
<p>The output is the above with a table. </p>
<p>If you have an account the quote are real time --- via cookie. </p>
<p>How do I get the table into python using 2.6. The data as list or dictionary</p>
| python | [7] |
5,779,031 | 5,779,032 | Trying to escape $, not working as I expected? | <p>I'm trying to escape the character <code>$</code> so that it becomes a literal within a string I'm compiling. I thought that this would do the trick, but apparently not:</p>
<pre><code>$html = $_POST['html'];
$sanitize = htmlspecialchars($html);
$sanitize = str_replace("$", "\$", $sanitize); // Addition.
</code></pre>
<p>Here's my base code posted as <code>html</code> (it was originally a sanitizer for html, the last part being an addition).</p>
<pre><code>$rp = realpath($_SERVER['DOCUMENT_ROOT']);
include($rp. "_static/inc/db_conn.php");
$conn = mysql_connect($db_host, $db_user, $db_pass); mysql_select_db($db_name);
</code></pre>
<p>It produces:</p>
<pre><code>$rp = realpath($_SERVER[\'DOCUMENT_ROOT\']);
include($rp. \"_static/inc/db_conn.php\");
$conn = mysql_connect($db_host, $db_user, $db_pass); mysql_select_db($db_name);
</code></pre>
<p>It appears thus, that <code>htmlspecialchars()</code> is working as I'd expect it to, but not <code>str_replace()</code>.</p>
<p>Any help/answers would be appreciated (heads up, I've never used <code>str_replace()</code> before, so I just went as per the PHP doc).</p>
| php | [2] |
2,233,540 | 2,233,541 | Javascript Countdown | <p>I have searched the web but all the ones readily available are where you specificy a date and it counts down to that date. What I need is something which will simply count down from "27 minutes and 43 seconds" (in that format) all the way down to 0 from whenever they land on the page, anyone got any snippets available?</p>
| javascript | [3] |
1,703,971 | 1,703,972 | accessors in java | <p>I'm wondering about why to use getter and setter methods in java. If you can read or modify values of private fields via getters and setters, why not just changing them directly to public? I know that getters and setters have to be reasonable, but what would be the straight answer that it's not possible to give up on them?</p>
| java | [1] |
2,113,872 | 2,113,873 | jQuery slideDown + Table row issue + IE browser | <p>I know its an old problem and i found many ppl hav suggested some gud solutions..
still in my case it din work..</p>
<p>I have a row like</p>
<p>----> this tr is in invisible mode.</p>
<p><code><tr id="test" >
<td>
<table>
<tr></tr>
<tr></tr>
</table>
</td>
</tr></code></p>
<p>So when i am applying slideUp/Down effect its working the same as show/hide() since it is row so animation is not supported.
So tried wrap it in div and do the same.But that also did the same as show/hide..</p>
<p>Any idea why so??or any solutions to this?</p>
| jquery | [5] |
5,572,649 | 5,572,650 | Parsing till end of string and checking for end of line in java | <p>I have the below contents from a .txt file stored into a string variable <strong>actual_text</strong></p>
<p>1 1111 47</p>
<p>2 2222 92</p>
<p>3 3333 81</p>
<p>So now <strong>actual_text</strong> will have the value</p>
<p>1 1111 47</p>
<p>2 2222 92</p>
<p>3 3333 81</p>
<p>I'm trying to achieve two objectives from the below snippet</p>
<pre><code>while(parse till end of string condition) //parse till the end actual_text
{
if(end of line condition) //checking for the "\n" string in actual_text
{
//random code
}
}
</code></pre>
<p>Can anyone tell me how to do the parsing and checking the end of line in the above program.</p>
| java | [1] |
5,283,381 | 5,283,382 | In Android---Gmail OAuthentication not open the Gmail SignIn page | <p>In Android How can i Use Gmail OAuthentication.
I import sample code from the github svn but Not open gmail Sign in page.</p>
<p><a href="https://github.com/ddewaele/AndroidOAuthFlowSample.git" rel="nofollow">Svn Rep</a>
(I also add 3 jar file signpost-commonshttp4-1.2.1.1.jar,signpost-core-1.2.1.1.jar,signpost-jetty6-1.2.1.1.jar)</p>
<p>Its not contain error but when i open apps then its display </p>
<pre><code>Responce status : Unauthorized.
</code></pre>
<p>Thankyou.</p>
| android | [4] |
4,910,530 | 4,910,531 | Add new row in table in code behind problem | <p>I have table on my asp.net page, and I want to insert new rows.I try to add on every click on button new row which contain cell with FileUpload, but it works only for first time. When I click next time, in my code behind table.</p>
<pre><code> <asp:Panel ID="pnlImages" runat="server" BackColor="Gray" Height="500">
<table id="tblImages" runat="server" width="100%">
<tr>
<td>
<asp:FileUpload ID="FileUpload1" runat="server" />
</td>
</tr>
<tr>
<td align="right" width="100">
<asp:ImageButton ID="imbAddImage" runat="server" ImageUrl="images/plus.png"
Width="48" Height="48" OnClick="imbAddImage_Click"/>
</td>
</tr>
</table>
</asp:Panel>
</code></pre>
<p>This is code on button click</p>
<pre><code>protected void imbAddImage_Click(object sender, ImageClickEventArgs e)
{
System.Web.UI.HtmlControls.HtmlTable tbl = (System.Web.UI.HtmlControls.HtmlTable)this.FindControl("tblImages");
System.Web.UI.HtmlControls.HtmlTableRow row = new System.Web.UI.HtmlControls.HtmlTableRow();
System.Web.UI.HtmlControls.HtmlTableCell cell = new System.Web.UI.HtmlControls.HtmlTableCell();
FileUpload temp = new FileUpload();
cell.Controls.Add(temp);
row.Controls.Add(cell); ;
int a=tbl.Controls.Count;
tbl.Controls.AddAt(a-1, row);
}
</code></pre>
<p>But problem is that a is always 2. Can anybody help ?</p>
| asp.net | [9] |
835,487 | 835,488 | Reinterpret_cast vs. C-style cast | <p>I hear that reinterpret_cast is implementation defined i don't know what does that really mean. Can you provide an example how can it go wrong? If it does go wrong, then is it better to use C-Style cast?</p>
| c++ | [6] |
3,793,737 | 3,793,738 | Howto run a php file from a other php file? | <p>Is it possible to launch a php file from a other php file?
I know that i can include a file but i don't mean this.</p>
<p>Small example:
i have a script which displays something from the database
and a other script which get the latest data from a other site and update the database.</p>
<p>When i include the update file, the first script will request the data from the server but i want to make it parallel so that only the update script request from server </p>
| php | [2] |
100,272 | 100,273 | Have I got the syntax incorrect for this jquery else if statement? | <p>Edit: <strong>Question resolved. Syntax error.</strong></p>
<p>Here it is (the if part omitted as I know it is correct)</p>
<pre><code>else if($('.now [name="stuff"]').val() !==''){...}
</code></pre>
<p>I want to check the value of the input field withhin the class 'now' and with the name 'stuff' and if the value is not empty, then execute the code within the braces.</p>
<p>have I made a mistake? as my code isn't working.</p>
<p>Edit here is the code in context: (NOTE - if i delete the else if part the code runs. Currently when I try to run the below code firefox tells me the function which contains the code is undefined)</p>
<pre><code>if($("#form").length==0) {
....
}
else if($('.now [name="stuff"]').val() !==''){
$.post("ajax.php", {
"action": "refresh",
"app_id": app,
"type": type,
"page": page,
"test": "test";
"refresh": "1",
"br": $("#br").val(),
"brtwo": $('.current [name="brtwo"]').val(),
}, function(data) {
$(".current").html(data);
scrollTo(0, 0);
});
}
else { ...
}
</code></pre>
| jquery | [5] |
995,994 | 995,995 | Using wildcard type in java generics | <p>I want to pass object of <code>GameObject</code> class which would also implement <code>Collidable</code> interface. How should it look like?</p>
<pre><code>private boolean isCollision(GameObject<? extends Collidable> collid) {
}
</code></pre>
<p>How should it look like? <code>collid</code> must be instance of both <code>GameObject</code> and <code>Collidable</code>.</p>
| java | [1] |
5,130,338 | 5,130,339 | hover effect jQuery | <p>I have a bunch of li elements that I want to alternate in color using odds and evens, and then highlight based on mouse hover. In order to un-highlight I need to keep track of what the color used to be, odd or even. To do this when I apply the highlight color, I first set an arbitrary attribute to it. Are there any downsides to doing it this way? Is there a better way? Here's the code:</p>
<pre><code><script type="text/javascript">
var init = function(event){
$("li:odd").css({'background-color' : '#eeeeee', 'font-weight' : 'bold'});
$("li:even").css('background-color', '#cccccc');
//initial colors setup
$("li").hover(
function () //hover over
{
var current = $(this);
current.attr('old-background', current.css('background-color'));
current.css('background-color', '#ffee99');
}
, function() //hover out
{
var current = $(this);
current.css('background-color', current.attr('old-background'));
})
}
$(document).ready(init);
</script>
</code></pre>
<p>So is there a better way to do this?</p>
| jquery | [5] |
2,967,252 | 2,967,253 | iPhone SDK: Avoid Blank screen while launching my application | <p>I am retrieving some data from server when launching my application itself. So whenever launch my application it shows a blank screen for few seconds(means it is downloading data from server) and then launches the first view. I don't want to show the blank screen to user. I want to add an image and activity indicator there.
Please route me into right direction to capture this task.</p>
<p>I appreciate your helps.</p>
<p>thanks.</p>
<p>Clave/</p>
| iphone | [8] |
1,346,154 | 1,346,155 | How to remove repetitive chars in javascript | <p>I have a file that contains words with repetitive chars, like:</p>
<ul>
<li>boooody</li>
<li>Steveeen</li>
<li>uuuuuuser</li>
<li>etccccc</li>
</ul>
<p>In Javascript(used on nodejs), how do i remove that extra chars so i get <code>body</code>, <code>user</code> etc.?</p>
| javascript | [3] |
1,353,740 | 1,353,741 | ScriptResource.axd "Access is denied" | <p>I am getting this error on my site (ASP.NET 3.5) only when I am accessing it without the "www." prefix.</p>
<p>Read here and in other places that it could be IFrame related, however I am not using one (atleast intentionally).</p>
<p>Any other options or guidelines how to resolve this?</p>
<p>Thanks</p>
| asp.net | [9] |
5,022,671 | 5,022,672 | C#, reliable way to convert a file to a byte[] | <p>I found the following code on the web:</p>
<pre><code>private byte [] StreamFile(string filename)
{
FileStream fs = new FileStream(filename, FileMode.Open,FileAccess.Read);
// Create a byte array of file stream length
byte[] ImageData = new byte[fs.Length];
//Read block of bytes from stream into the byte array
fs.Read(ImageData,0,System.Convert.ToInt32(fs.Length));
//Close the File Stream
fs.Close();
return ImageData; //return the byte data
}
</code></pre>
<p>Is it reliable enough to use to convert a file to byte[] in c#, or is there a better way to do this?</p>
| c# | [0] |
2,287,810 | 2,287,811 | How can I build config.ini for my program? | <p>Well , as you can see the title . I'm trying to build a config.ini will be located and generated in the exe path automatically .. but . I can't process it . every time I do it , I corrupt the source as a noob .</p>
<p>What am I trying to do? </p>
<p>I wanna this ini to be loaded for the program . and it will modify some options I will set like
( Auto generate path set " I created a form to launch some exes automatically , and every time I run this form , it reset the textboxes to empty fields. " )
( Setting the sql connection automatic like
sqlconnection = 1 -> when it loads , the sql connection will run automatically with the latest success connection happen in the program
sqlconnection = 0 -> when it loads , it won't load the sql connection . who ran the program should do it manually )</p>
| c# | [0] |
3,977,217 | 3,977,218 | how many objects are eligible for garbage collection when end line of main is reached? | <p>My main problem is how many object is really created at executing the line</p>
<pre><code>Dozens [] da = new Dozens[3];
</code></pre>
<p>And how many object will be eligible for garbage collection at the end of main function</p>
<pre><code>class Dozens {
int[] dz = {1,2,3,4,5,6,7,8,9,10,11,12};
}
public class Eggs {
public static void main(String[] args) {
Dozens [] da = new Dozens[3];
da[0] = new Dozens();
Dozens d = new Dozens();
da[1] = d;
d = null;
da[1] = null;
// do stuff
}
}
</code></pre>
| java | [1] |
5,438,457 | 5,438,458 | encapsulating javascript inside a namespace | <p>I'm looking to encapsulate my javascript inside a namespace like this:</p>
<pre><code>MySpace = {
SomeGlobal : 1,
A: function () { ... },
B: function () { ....; MySpace.A(); .... },
C: function () { MySpace.SomeGlobal = 2;.... }
}
</code></pre>
<p>Now imagine that instead of a few lines of code, I have about 12K lines of javascript with hundreds of functions and about 60 globals. I already know how to convert my code into a namespace but I'm wondering if there's a quicker way of doing it than going down 12K lines of code and adding <code>MySpace.</code> all over the place.</p>
<p>Please let me know if there's a faster way of doing this.
Thanks for your suggestions.</p>
| javascript | [3] |
426,006 | 426,007 | Using Marshal.PtrToStructure with an object pool | <p>Is it possible to get Marshal.PtrToStructure (or similar) to not allocate a new object but instead initialse an object from a pool?</p>
<p>The reason I want to use a object pool is to avoid garbage collector pauses as I am visualising a lot of data from a native code source.</p>
| c# | [0] |
1,427,987 | 1,427,988 | Translation UrlOpen error in python | <p>We are trying to do translation in our code written in Ruby On Rails using a python code . But i am getting the error as </p>
<pre><code> raise TranslationError, "Failed translating (getting %s failed): %s" % (e.url, e.error)
translate.TranslationError: Failed translating (getting http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=%0A&langpair=en%7Cpt-PT failed): <urlopen error [Errno -2] Name or service not known>
</code></pre>
<p>I have been connected to Wifi .ANd my browsers are working fine . I have been using Auto-detect proxy settings in my Firefox preferences.
how to resolve this.. But the same is working in other machine</p>
| python | [7] |
2,727,065 | 2,727,066 | Disguising front camera as regular camera at system level | <p>I am writing an application based on a closed-source SDK which works with regular camera. When there is no camera resource available, the SDK automatically throws an exception and stops any function call. However, perhaps due to negligence, the SDK does not consider the front camera as a valid camera. The developer of this SDK has "noticed the issue and started considering to fix it", but a few months have passed and the problem is still there. </p>
<p>I want to fix it by myself - the application will be only used on Nexus 7 (running Android 4.2), which has only one camera. I presume I can safely do that and it is possible. What is the simplest way to achieve this? </p>
| android | [4] |
5,754,742 | 5,754,743 | Cannot convert buffer[200] to str[] | <p>I have to read some text from console and then search for the text "simple" in that string. I have:</p>
<pre><code>char Buffer[200];
cin >> Buffer; //read text form keybord
char str[] = Buffer;
char * pch;
pch = strstr (str,"simple");
strncpy (pch,"sample",6);
puts (str);
</code></pre>
<p>How to convert <code>Buffer[200]</code> to <code>str[]</code> so that the program works.</p>
| c++ | [6] |
4,691,142 | 4,691,143 | My program, that uses the Java MSN Messenger library, is in error | <p>I want to develop a program using the Java MSN Messenger library (<a href="http://sourceforge.net/apps/trac/java-jml" rel="nofollow">JML</a>). I can not solve a problem where the following exeception is thrown.</p>
<pre><code>ERROR/AndroidRuntime(312): FATAL EXCEPTION: Thread-21
**ERROR/AndroidRuntime(312): java.lang.ExceptionInInitializerError
ERROR/AndroidRuntime(312): at net.sf.jml.protocol.incoming.IncomingUSR$1.getLoginTicket(IncomingUSR.java:198)
ERROR/AndroidRuntime(312): at net.sf.jml.protocol.incoming.IncomingUSR$1.run(IncomingUSR.java:247)
ERROR/AndroidRuntime(312): Caused by: java.lang.NoClassDefFoundError: sun.security.action.GetPropertyAction
ERROR/AndroidRuntime(312): at net.sf.jml.util.StringUtils.<clinit>(StringUtils.java:58)
ERROR/AndroidRuntime(312):
... 2 more**
</code></pre>
<p>How to fix it?</p>
| android | [4] |
5,742,245 | 5,742,246 | interpret signed as unsigned | <p>I have a value like this:</p>
<pre><code>int64_t s_val = SOME_SIGNED_VALUE;
</code></pre>
<p>How can I get a</p>
<pre><code>uint64_t u_val
</code></pre>
<p>that has exactly the same bit pattern as <code>s_val</code>, but is treated as unsigned?</p>
<p>This may be really simple, but after looking on Stackoverflow and elsewhere I haven't turned up the answer.</p>
| c++ | [6] |
3,466,672 | 3,466,673 | Is this the Correct way of passing the Single quotes and double quotes in the string | <pre><code>'<a href="javascript:void(0)" onClick="function(\''.$row['STUID'].'\')">Print STUDENT DETAILS</a>';
</code></pre>
<p>Is this the correct way of passing single quotes and double quotes in the statement </p>
| php | [2] |
2,452,746 | 2,452,747 | post xml from iphone to server | <p>How can I post XML data format to server?
(I only know post paramters to server)</p>
<p>Thank you!</p>
| iphone | [8] |
5,129,448 | 5,129,449 | Is it possible to set the source of an image using the javascript: pseudo-protocol? | <p>Basically, I have a context where I'm only allowed to create an image, but I want to run a script before I decide on the source, so I'm wondering if this is possible:</p>
<pre><code><img src="javascript:{load a remote script and run it to figure out the source}" />
</code></pre>
<p>The work-around that I've come up with is:</p>
<pre><code><img src="any-old-image.gif" onload="document.write('<scr' + 'ipt src=\"http://mysite-script.js\"'></scr' + 'pt>');" />
</code></pre>
<p>but I'm hoping something a little cleaner is possible.</p>
<p>P.S. I'm aware that "javascript:" is quote-unquote evil. This is a special situation.</p>
| javascript | [3] |
1,606,476 | 1,606,477 | Unexpected end of file error while opening a file via os.system | <pre><code> f = urllib.urlopen(url) #Download the file
localFile = open(url.split('/')[-1],'w')
localFile.write(f.read())
os.system("transmission %s" %localFile)
</code></pre>
<p>Error I get is this:</p>
<pre><code>sh: Syntax error: end of file unexpected
512
</code></pre>
| python | [7] |
5,922,844 | 5,922,845 | at what scene do we use this php array? | <p>at what scene do we use this php array ?
i have seen in many places like </p>
<pre><code> echo $var1[$var2[]];
</code></pre>
| php | [2] |
4,373,899 | 4,373,900 | How to show power point presentations on web, without using Inerop or PowerPoint installation on server? | <p>Need to show power point presentations on web with its animations. Is there any converter to convert Presentations to Silverlight/flash/Html without using any Interop or PowerPoint installation on web server?</p>
| asp.net | [9] |
2,283,536 | 2,283,537 | Only show form if there is PHP | <p>I'm new to PHP. Iv created a small php script. Basically I have a form and inside of it I have a function called show_sent:</p>
<pre><code> <form method="post" action="contact.php" class="formstyle">
<h2>Formulaire de contact : </h2>
<p>&nbsp;</p>
<?
function show_sent(){
?>
<p>Sent</p>
<?
} // the function finishes here
?>
</code></pre>
<p>.......</p>
<p>I was hoping that it would only show the 'Sent' text when I call that function. How could I do this?
Thanks</p>
<p>contact.php is the same page as the form</p>
| php | [2] |
1,309,431 | 1,309,432 | Facebook mobile app keeps connecting to googleplay | <p>I made a php facebook application. The app looks good on desktop facebook. But when I wanna look at it from my android phone, instead of seeing my facebook application/site it redirects me to google play, where i dont have any application.. How can i fix that?</p>
| android | [4] |
5,844,249 | 5,844,250 | Exponential function | <p>how i can convert decimal value to exponential value</p>
| android | [4] |
1,643,451 | 1,643,452 | How to detect textarea or input type="text" editing? | <p>I use this snippet to prevent the user from accidentally navigating away from the editing page:</p>
<pre><code>var warning = false;
window.onbeforeunload = function() {
if (warning) {
return '';
}
}
</code></pre>
<p>Now I want to set the variable warning to be true if any of the textarea or input type="text" has been modified, I want to use the onkeyup event such as in:</p>
<pre><code>document.getElementById('textarea_id').onkeyup = function() {
warning = true;
}
</code></pre>
<p>But it's not working. Don't quite want to use jQuery on this. Any insights?</p>
<p><strong>Update:</strong></p>
<p>Changed to this:</p>
<pre><code>var warning = false;
window.onbeforeunload = function() {
if (warning) {
return 'You have unsaved changes.';
}
}
document.getElementById('textarea_id').onkeyup = function() {
warning = true;
}
</code></pre>
<p>Yet it's still not working.</p>
<p>By the way, it's put in in the of the page. There are no javascript anywhere else. </p>
| javascript | [3] |
3,830,863 | 3,830,864 | Javascript - Dynamic grid fancy delete option | <p>I have an AJAX dynamic grid and when i want to delete an item i click a link (<code>href='javascript:void(0)'</code>) and the item's gone. That's no problem. What the problem is I don't want the item to simply disappear, I want to add a kind of special effect, like to make the item shrink, and those items around it to gradually take its place. Maybe like Digg, when you bury stuff there. I would really appreciate your help!</p>
| javascript | [3] |
2,116,834 | 2,116,835 | Can we use 'var' in this scenario | <p>Can we use var twice in the function.
e.g</p>
<pre><code>var varname= sometype;
if(true)
{
varname= type1;
}
else
{
varname=type2;
}
</code></pre>
<p>If this is not possible I would say this is a limitation of var.</p>
| c# | [0] |
2,780,088 | 2,780,089 | Delay displaying a fixed bar, but hide it instantly | <p>I currently have the following code which delays showing a fixed bar after a certain point.</p>
<p>The code hides the fixed bar if you scroll up to the top, but automatically shows the bar after 2 seconds, even though the scroll point is below 70, so it should be hidden all together.</p>
<pre><code> $(window).scroll(function() {
if($(window).scrollTop() > 70) {
$('#mini-header').delay(2000).show(0);
} else if($(window).scrollTop() < 70) {
$('#mini-header').hide();
}
});
</code></pre>
<p>A <a href="http://jsfiddle.net/fKqMN/" rel="nofollow">jsFiddle</a> shows the behaivor.</p>
| jquery | [5] |
3,174,809 | 3,174,810 | Java Multithread | <p>Can One JVM handle multiple JVM ? As One JVM handles Multiple Threads, So I mean to ask That can one JVM handle multiple JVM treating them as thread? If Possible Please share with me the soln and example as well</p>
| java | [1] |
4,366,375 | 4,366,376 | Android String Comparison Not Working | <p>I am having hard time comparing two strings in Android using Java, what I am doing is running HTTP get request which return yes or no and based on that I decide whether to launch a new activity or not.</p>
<p>I am performing the string comparison inside Async onPostExecute method and though the HTTP returned string is yes it is not working for me. </p>
<p>Here goes the code</p>
<pre><code> protected void onPostExecute(String result) {
progressDialog.dismiss();
if(result.equals("yes"))
{
Intent toDashboard = new Intent(LoginActivity.this,Dashboard.class);
startActivity(toDashboard);
Toast.makeText(LoginActivity.this, "It was yes", Toast.LENGTH_LONG).show();
}
else
{
Toast.makeText(LoginActivity.this, result, Toast.LENGTH_LONG).show();
}
}
</code></pre>
<p>Though the returned string is yes it still skips the if statement and creates a toast showing "Yes".</p>
<p>I have also tried some other ways to match a string and they all goes here</p>
<pre><code>if(result == "yes")
if(result.toString().equals("yes"))
if(result.contentEquals("yes"))
if(result.equalsIgnoreCase("yes"))
</code></pre>
<p>None of them works for me</p>
| android | [4] |
5,513,146 | 5,513,147 | Jquery add blank space | <p>I'm trying to add a blank space in the following. </p>
<pre><code>$('.post_name'+post_id+'').hide();
</code></pre>
<p>So it will render something similar to </p>
<blockquote>
<p>post_name 8</p>
</blockquote>
<p>I tried adding '' and " " but they don;t work. Can someone please help me?</p>
| jquery | [5] |
862,017 | 862,018 | Remove event with jquery | <p>I have the following at html code</p>
<pre><code><a class="toolbar" onclick="javascript: submitbutton('items')" href="#">
</code></pre>
<p>Now i want that in jquery i convert it to</p>
<pre><code> <a class="toolbar" href="javascript:history.go(-1)">
</code></pre>
<p>Any ideas</p>
| jquery | [5] |
4,112,138 | 4,112,139 | Why did this jQuery input selector require a filter workaround | <p>The following line This does NOT work in my code in firefox/firebug (but works fine in JSFIDDLE), you will see below I have a work around, just wondering if anyone knows the internal reason why?</p>
<pre><code>var checkedVal = parseInt($('input[@name=' + uniqueNamePart + 'currDim]:checked').val(), 10);
</code></pre>
<p><a href="http://jsfiddle.net/darrenshrwd/eqh2y/43/" rel="nofollow">http://jsfiddle.net/darrenshrwd/eqh2y/43/</a></p>
<pre><code><input type="radio" value="1" name="blahcurrDim">One
<input type="radio" checked="" value="2" name="blahcurrDim">Two
<input type="radio" value="3" name="blahcurrDim">Three
<input type="radio" value="4" name="blahcurrDim">Four
</code></pre>
<p>...</p>
<pre><code>$('document').ready(
function() {
var uniqueNamePart = "blah";
var dimensionClick = function() {
// This does NOT work in my code in firefox/firebug (but works fine in JSFIDDLE):
var checkedVal = parseInt($('input[@name=' + uniqueNamePart + 'currDim]:checked').val(), 10);
// This does work in both:
//var myRadio = $('input[name=' + uniqueNamePart + 'currDim]'),
// checkedVal = parseInt(myRadio.filter(':checked').val(), 10);
alert(checkedVal);
};
$('input[name=' + uniqueNamePart + 'currDim]:radio').click(dimensionClick);
});
</code></pre>
| jquery | [5] |
2,405,867 | 2,405,868 | GoogleLoginService LoginFail | <p>Has anyone experienced a GoogleLoginService fail when authenticating to use a google service (calendar in my case) through the AccountManager? I obtained an authentication token using...</p>
<pre><code>AccountManager mgr = AccountManager.get(this);
Account[] accts = mgr.getAccountsByType("com.google");
Account acct = accts[0];
AccountManagerFuture<Bundle> accountManagerFuture = mgr.getAuthToken(acct, "calendar", null, this, null, null);
Bundle authTokenBundle = null;
try {authTokenBundle = accountManagerFuture.getResult();}
catch (OperationCanceledException e) {e.printStackTrace();}
catch (AuthenticatorException e) {e.printStackTrace();}
catch (IOException e) {e.printStackTrace();}
authtoken = authTokenBundle.get(AccountManager.KEY_AUTHTOKEN).toString();
</code></pre>
<p>After obtaining my authentication token, I created a Calendar Service and tried to authenticate it...</p>
<pre><code>CalendarService myService = new CalendarService("UserCalendar");
myService.setAuthSubToken(authtoken);
</code></pre>
<p>When I use this on either a phone or emulator, it initially seems to work as expected... it brings up screen where google asks the user to 'allow' or 'deny' access by my app. However, when I click allow, it says that the password of the google account is incorrect.</p>
<p>Now, I've tried it with multiple google accounts (both of which passwords work when I use them manually to login) and it still gives the same result. Any ideas as per why I might be getting this? The debug isn't extraordinarily useful... all that I get is two lines which just tell me it failed...</p>
<pre><code>12-19 20:40:05.756: DEBUG/GoogleLoginService(245): onBind: Intent { act=android.accounts.AccountAuthenticator cmp=com.google.android.gsf/.loginservice.GoogleLoginService }
12-19 20:40:08.426: DEBUG/GoogleLoginService(245): LOGIN_FAIL
</code></pre>
<p>Has anyone else had this issue before? I'm assuming there is something simple I'm missing but just can't think of why it wouldn't authenticate... thanks!</p>
| android | [4] |
1,241,005 | 1,241,006 | Custom ListView layout crashes my activity | <p>I am starting out on Android and trying to make a custom ListView layout. I've followed some guides and have made the following code:</p>
<pre><code>public class CheckInList extends ListActivity {
...
@Override
public void onCreate(Bundle savedInstanceState) {
...
mAdapter = new ArrayAdapter<String>(this, R.layout.checkinlist_item, R.id.checkinlist_item_text, mNames);
setListAdapter(mAdapter);
...
}
}
</code></pre>
<p>This is the code for checkinlist_item.xml:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<RelativeView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/checkinlist_item_bg">
<TextView android:id="@+id/checkinlist_item_text"
style="@style/RegisterText" />
</RelativeView>
</code></pre>
<p>If I use android.R.layout.simple_list_item_1 instead of my above template then everything is fine and my ListView works, however whenever I use the above code my activity crashes. I am running things on Android 1.5.</p>
<p>Any ideas why things are crashing?</p>
| android | [4] |
1,006,102 | 1,006,103 | slidedown jquery problem | <pre>
function show_destination(country_id,airport_id){
$.ajax({
type: "POST",
url: "function.php",
data: "country_id="+country_id+"&airport_id="+airport_id+"&action=destination",
beforeSend: function() { $("#loader_destination").html(''); },
success: function(msg){
// $(".loader_destination").empty();
//$("#destination_div").html(msg);
//$("#destination_div").slideDown("slow",function(){$("#destination_div").html(msg);})
//$("#destination_div").html(msg,function(){$("#destination_div").slideDown("slow");});
$('#destination_div').slideDown(500, function() { $('#destination_div').html(msg);});
}
});
}
</pre>
<p>slideDown this effect not working ,
output simply display , am not find any effect on display output, </p>
| jquery | [5] |
3,596,182 | 3,596,183 | Is regular expression quite enough to handle script injection? | <p>What else do you think would be a great tool to prevent form injection, URL injection, or any other kind of injection?</p>
<p>Not too specific to the code, just the big picture.</p>
| php | [2] |
1,966,542 | 1,966,543 | Multiple views on top of an ImageView | <p>I'm trying to port an app from iOS to Android. In my iOS app I have an image view which displays a map, and on top of it I want to display multiple button views on certain specific positions.</p>
<p>None of the standard views in Android seem to fit my needs, but I am surely missing something. How could I achieve this?</p>
<p>Thanks</p>
| android | [4] |
5,211,131 | 5,211,132 | Binding data to gridview ? Column not found? | <p>In asp.net, while binding data to gridview it is giving eror. Saying no column exist. How can i restrict if there is no column in coding level.</p>
| asp.net | [9] |
4,962,168 | 4,962,169 | 'eGame' is an ambiguous reference between 'GameLogParser.eGame' and 'GuildStats_Shared.eGame' | <p>Is it posible to tell the compiler this is the same enum, so it can be defined both places?</p>
<pre><code>public enum eGame
{
Error,
AoC,
Rift,
}
</code></pre>
| c# | [0] |
4,752,675 | 4,752,676 | Swapping 1 with 0 and 0 with 1 in a pythonic way? | <p>In some part of my Python program I have a val variable that can be 1 or 0. If it's 1 I must change to 0, if it's 0 I must change to 1.</p>
<p>How do you do it in a Pythonic way?</p>
<pre><code>if val == 1:
val = 0
elif val == 0:
val = 1
</code></pre>
<p>it's too long!</p>
<p>I did:</p>
<pre><code>swap = {0: 1, 1:0}
</code></pre>
<p>So I can use it:</p>
<pre><code>swap[val]
</code></pre>
<p>Other ideas?</p>
| python | [7] |
3,377 | 3,378 | Session variable in C# desktop application? | <p>I am developing a C# a stand alone single user desktop application that requires the user to login to the application. I want to ensure that when there is no activity for 5 minutes or so the application will prompt the user to login again. I have several solution in mind to do this but there do not seem efficient. Previously while doing web programming i was able to do this kind of feature using session variable are there are similiar kind of features in C# that can be used for desktop application.</p>
| c# | [0] |
1,099,204 | 1,099,205 | C#: In the keydown event of a textbox, how do you detect currently pressed modifiers + keys? | <p>C#: In the keydown event of a textbox, how do you detect currently pressed modifiers + keys?</p>
<p>I did the following, but I'm not too familiar with these operators so I'm not sure if and what I'm doing wrong.</p>
<pre><code> private void txtShortcut_KeyDown(object sender, KeyEventArgs e)
{
if (e.Modifiers == (Keys.Alt || Keys.Control || Keys.Shift))
{
lbLogger.Items.Add(e.Modifiers.ToString() + " + " +
"show non-modifier key being pressed here");
}
}
</code></pre>
<p>1) How would I check if e contains any modifier keys?</p>
| c# | [0] |
3,360,359 | 3,360,360 | How to set text position programmatically in EditText class? | <p>Does smomeone know how I set the scrollbar position in an EditView programmatically.</p>
<p>I'm appending the text during special events but I want the EditView to scroll down to the latest text added so it'll be visible. But default the scrollbar does not move automatically when appending text. </p>
<p>/ Henrik</p>
| android | [4] |
221,011 | 221,012 | I extended an Application and I need data to NOT persists after application is closed | <p>It is simple I guess.</p>
<p>I have a User and some other objects that I need to use along many activities of my application, so I decided to create a class and extend Application to make these objects "globals", e.g. after the user does the login, I have the user object along all my activities to use.</p>
<p>The problem is that after the application is closed the data is not lost/reseted. So when I open my app again, it does not ask for me to do my login again. So I need to somehow close the other Application. How do I do it?</p>
<p>A palliative solution I found is to set the variables to <code>null</code> when <code>backPressed</code> is called from <code>MainActivity</code> (and my application is closed), but I know it is not right, must have a more elegant way to do it.</p>
| android | [4] |
2,465,831 | 2,465,832 | Android ImageView is cutting off | <p>I have an xml that have an imageView in it.</p>
<pre><code><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/blockingLayer"
android:layout_width="880px"
android:layout_height="600px">
<ImageView
android:layout_width="110px"
android:layout_height="60px"
android:id="@+id/fish_image_view"
android:visibility="visible"
android:layout_marginLeft="0px"
android:layout_marginTop="350px"
/>
</RelativeLayout>
</code></pre>
<p>In code i am getting this imageView and running the translateAnimation on it from X1 = 10 to x2 = ScreenWidth , Y1 & Y2 = 350px. This animation is working fine on android version 2.2 but when i run this on OS 2.3 / 4.0 ImageView will cuttoff and disappear on some points on screen during translate animation.</p>
<p>I could not understand what is going wrong with this. Response will be appreciated. </p>
| android | [4] |
1,983,477 | 1,983,478 | PHP - read date results and add style at different | <p>I have the following set of results from a query:</p>
<pre><code>name date_added
---- ---------
dan 15/11/2012
jane 15/11/2012
ted 14/11/2012
larry 13/11/2012
corben 13/11/2012
</code></pre>
<p>These results are from a simple MySQL query and I display the results e.g.</p>
<pre><code>while($users = mysql_fetch_array($result)){
echo $users[name].' -- '.$users[date_added];
}
</code></pre>
<p>This produces a simple list e.g.</p>
<pre><code>dan -- 15/11/2012
jane -- 15/11/2012
ted -- 14/11/2012
larry -- 13/11/2012
corben -- 13/11/2012
</code></pre>
<p>What I want to do is the head the results with the different dates, starting with the first one, e.g.</p>
<pre><code>15/11/2012
dan -- 15/11/2012
jane -- 15/11/2012
14/11/2012
ted -- 14/11/2012
13/11/2012
larry -- 13/11/2012
corben -- 13/11/2012
</code></pre>
<p>The dates change daily as this is a living document so nothing is hard coded.</p>
<p>Is there a simple and efficient way to do this within the while loop?</p>
| php | [2] |
5,231,295 | 5,231,296 | Convert Date MMDDYY to Date for database Insert | <p>I got an array with a date set as <code>071712</code> . no / slash characters for the date, no dash. nothing, just plain <code>071712</code> (coming from a text file).</p>
<p>I need to convert the date so I can include it in a SqlServer insert statement. I'm calling a stored procedure for the insert. So far I have this:</p>
<pre><code>// This is not working so far.
DateTime date = Convert.ToDateTime(fileLines[4]);
</code></pre>
<p>(date will be used as a parm for the stored procedure)</p>
| c# | [0] |
1,523,144 | 1,523,145 | imagettftext() not working | <pre><code>/*create watermark*/
// Create the image
$im = imagecreate(460, 50);
// Create some colors
$grey = imagecolorallocate($im, 230, 231, 232);
$dark_grey = imagecolorallocate($im, 128, 130, 133);
// The text to draw
$text = "foobar";
// Set the enviroment variable for GD
putenv('GDFONTPATH=' . realpath('.'));
$font = 'Tondu_beta';
// Add the text
imagettftext($im, 15, 0, 15, 35, $dark_grey, $font, $text);
$wm_w = imagesx($im); //get width
$wm_h = imagesy($im); //get height
$wmresource = $im; //watermark resource
//imagejpeg($wmresource);
/*end watermark*/
</code></pre>
<p>The font file is Tondu_Beta.ttf. The code above worked just fine in my local machine, but it only gave me grey box after uploading to live server. What's wrong here? Thanks ^^</p>
<p><strong>UPDATE</strong>: I remember it gave me this error: <code>Could not find/open font bla.bla..bla...</code></p>
| php | [2] |
4,126,995 | 4,126,996 | Out of Memory Error in Galaxy s3 4.0.4 | <p>my application have grid view contain lot's of images and as from the Android documentation i understand that android improve the drawable garbage collection and the chance of out of memory is very low compared to os below 3.0 . Why still i got lot of out of memory in 4.0.4 only- Except this version i won't get single OOM after 3.0</p>
| android | [4] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.