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
2,199,854
2,199,855
How to change Font of UIDatePicker?
<p>I have used UIDatePicker in my app. I want to (actually have to) change the font size (as my app needs) and font family in that datepicker.</p> <p>Please help, if any body has done that before...</p> <p>Thanks in advance...</p>
iphone
[8]
2,514,425
2,514,426
Is it possible to install android market on android sdk
<p>Is it possible to install android market on android sdk?If yes please give me steps.</p>
android
[4]
5,872,401
5,872,402
Could not connect to SMTP host: smtp.gmail.com
<p>I am a new developer in android and working on smtp mail service in my Android app. I had follow below link for references </p> <p>Link: <a href="http://mobiledevtuts.com/android/android-sdk-smtp-email-tutorial/" rel="nofollow">http://mobiledevtuts.com/android/android-sdk-smtp-email-tutorial/</a> Link: <a href="http://gafurbabu.wordpress.com/2012/01/08/sending-email-in-android-via-smtp-without-using-the-default-android-appbuiltin-email-application/" rel="nofollow">http://gafurbabu.wordpress.com/2012/01/08/sending-email-in-android-via-smtp-without-using-the-default-android-appbuiltin-email-application/</a></p> <p>But I got the below errors. I can't understand where I did wrong. Is anyone know what happening in my code. </p> <pre><code>03-13 17:49:43.041: E/SendMail(30702): Could not connect to SMTP host: smtp.gmail.com, port: 465 03-13 17:49:43.041: E/SendMail(30702): javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465; 03-13 17:49:43.041: E/SendMail(30702): javax.net.ssl.SSLException: Not trusted server certificate 03-13 17:49:43.041: E/SendMail(30702): at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1391) 03-13 17:49:43.041: E/SendMail(30702): at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412) </code></pre> <p>Thanks in advance</p>
android
[4]
784,627
784,628
How can I use JavaScript in a modular way, similar to Java classes?
<p>I'm creating a JavaScript game, previously I've always created the whole game inside a single JavaScript file. I'd like to be able to reduce coupling by separating the code into modules. Is it possible to write JavaScript in one file that is accessible from another file, using some kind of include statement?</p> <pre><code>&lt;script type="text/javascript" src="assets/scripts/asset_manager.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="assets/scripts/game.js"&gt;&lt;/script&gt; </code></pre> <p>I'd like for the javascript files to act in a similar fashion to Javas classes, e.g. within the game.js file writing something like <code>this.extends('asset_manager')</code>.</p> <p><strong>Edit:</strong> It looks like RequireJS and CommonJS are both good candidates, have you found any drawbacks or advantages of using either?</p>
javascript
[3]
2,775,455
2,775,456
update trial version database without delete old one
<p>I am implementing an android application and i can't figure out how to solve this problem</p> <p>I'm trying to deploy an application with an existing SQLite database. </p> <p>when user install application at the first time , Database will download but as trial version , with few records only , there are 10 feature extra than trial version when user select to buy one of them database should updated with new records from server , new records have the same schema of trial version database , so i want to insert purchased records to old database without delete old version and install new one with purchased feature </p>
android
[4]
5,742,188
5,742,189
Error 1 Cannot implicitly convert type 'int[]' to 'int'
<p>I am new at programing in C# and I try to make a simple program about book - I am asking how long does he/she need to read a book:</p> <pre><code>TrajanjeČasaBranjaKnjige = new int[SteviloPoglavijKjige]; NasloviPoglavijKnjige = new string[SteviloPoglavijKjige]; for (int i = 0; i &lt; SteviloPoglavijKjige; i++) { Console.Write("Vpiši naslov {0,2}. poglavij: ", i + 1); NasloviPoglavijKnjige[i] = Console.ReadLine(); while (true) { try { Console.Write("Vpiši koliko časa porabiš za branje knjige: "); TrajanjeČasaBranjaKnjige[i] = int.Parse(Console.ReadLine()); break; } catch { Console.WriteLine("Napaka pri vnosu števila: "); } } </code></pre> <p>The errors I am getting are: </p> <pre><code>Error 1 Cannot implicitly convert type 'int[]' to 'int' Error 2 Cannot apply indexing with [] to an expression of type 'int' </code></pre> <p>Should I write all in small letters? </p>
c#
[0]
5,661,116
5,661,117
Button expose effect android
<p>following link has some button at the top like :: "DISEASES" , "FOOD &amp; NUTRITION" , "PHYSICAL ACTIVITY" <a href="http://www.bam.gov/sub_yourbody/yourbody_smilestyle.html" rel="nofollow">http://www.bam.gov/sub_yourbody/yourbody_smilestyle.html</a></p> <p>when you focus it it will grow and remove from it it will small so question is how can i do it? </p>
android
[4]
3,674,766
3,674,767
Shortest PHP code for $i = $i + $x;
<p>Im trying to learn a few shorter ways of doing things in php</p> <p>Is there a shorter way of adding a number to a variable</p> <p>in this case the code i want to shorten is: <code>$num = $num + rand(1000, 100);</code></p> <p>eg: </p> <pre><code>$num = 0; $count = 10; $i = 0; while ($i &lt; $count) { $num = $num + rand(1000, 100); echo"$num&lt;br/&gt;"; $i++; } </code></pre>
php
[2]
2,863,627
2,863,628
Why is my new element wrapped in an array?
<p>Why is my new element wrapped in an array?</p> <pre><code>$('&lt;a&gt;') [&lt;a&gt;​&lt;/a&gt;​] </code></pre> <p>When I try to use it with <code>appendChild</code> I get a dom exception 8 error.</p> <p>Edit: That was an example. My exact code is </p> <pre><code>addendum = $("&lt;a&gt;", {href: download_url, text:"Download .nupkg file"}) badge = $(".nuget-badge")[0] badge.appendChild(addendum) </code></pre>
jquery
[5]
5,609,799
5,609,800
Base class Undefined WEIRD problem . Need help
<p>My CGameStateLogo which inherit from CGameState:</p> <p>CGameState.h</p> <pre><code>#pragma once #include "GameMain.h" #include "MyBitmap.h" class CGameMain; class CMyBitmap; class CGameState { public: CMyBitmap* pbmCurrent; CGameMain* pGM; int GameStateID; virtual void MessageEnter () = 0; virtual void MessageUpdate( int iKey ) = 0; virtual void MessagePaint( HDC* pDC ) = 0; void StateHandler ( int msg, HDC* pDC, int key ); public: CGameState(void); ~CGameState(void); }; </code></pre> <p>After creating and finding, problem comes from here : I've created 2 classes: CTest and CGameStateLogo</p> <pre><code> #pragma once #include "GameState.h" class CTest:CGameState { public: CTest(void); ~CTest(void); }; #pragma once #include "GameState.h" class CGameStateLogo:CGameState // Bug at this line { public: CGameStateLogo(void); ~CGameStateLogo(void); }; </code></pre> <p>Do VS has problem in naming ?</p> <p>Thanks for reading this :). Things go WEIRD, I'll update my question later. Sorry for wasting your time .</p>
c++
[6]
460,671
460,672
How to make slide to unlock button in android
<p>Hi I want a button that should work as 'slide to unlock' button of IOS</p> <p>in short I want a button that has no click effect but can slide left to right while drag and on drag completion it should considered click.</p> <p>please suggest me any sample code if possible.</p> <p>Thanks! </p>
android
[4]
4,943,510
4,943,511
Change XML root element name
<p>I have XML stored in string variable:</p> <pre><code>&lt;ItemMasterList&gt;&lt;ItemMaster&gt;&lt;fpartno&gt;xxx&lt;/fpartno&gt;&lt;frev&gt;000&lt;/frev&gt;&lt;fac&gt;Default&lt;/fac&gt;&lt;/ItemMaster&gt;&lt;/ItemMasterList&gt; </code></pre> <p>Here I want to change XML tag <code>&lt;ItemMasterList&gt;</code> to <code>&lt;Masterlist&gt;</code>. How can I do this?</p>
c#
[0]
2,425,851
2,425,852
correct class inheritance
<p>I've written some code that allows the term 'job' to be used universally to perform a unique task. The specific jobs can be chosen through setting an initial variable "job_type". From that initial variable a particulay subclass is chosen to perform the appropriate job. Maybe the code will make more sense :)</p> <pre><code>if __name__=='__main__': # these variables would normally be called in from a config file job_type = 'job1' uni_var = 10 job_select = superClass(job_type, uni_var) job_select.job() class superClass(object): def __init__(self, job_type, uni_var): self.job_type = job_type self.uni_var = uni_var if self.job_type == 'job1': self.jobChoice = option1() else: self.jobChoice = option2() # This is the definition called by the main function it then # redirects the request to the appropriate job sub class def job(self): self.jobChoice.job() class option1(superClass): def __init__(self): pass def job(self): print 'job option 1' print uni_var class option2(superClass): def __init__(self): pass def job(self): print 'job option 2' print uni_var </code></pre> <p>The thought behind this code was to allow a single/constant 'main' function, to action a variety of unique tasks based purely on the variable 'job_type'. Which it seems to be doing fine.</p> <p>My question (as a very inexperienced coder) is, have I gone about this the right way or is there a better way to do things?</p> <p>Also, have I set up the variable 'uni_var' correctly in the superClass to be correctly shared across all/any superClass subclasses?</p> <p>Thanks. </p>
python
[7]
1,104,563
1,104,564
Problem with import java.nio.file
<p>Why this line doesn't work?</p> <pre><code>import static java.nio.file.AccessMode.*; </code></pre> <p>Eclipse says:</p> <pre><code>The import java.nio.file cannot be resolved </code></pre> <p>Here is the whole program so far:</p> <pre><code>import static java.nio.file.AccessMode.*; public class CheckFileAccessibility { public static void main(String[] args) { } } </code></pre> <p>I am following the official Java tutorial here: <a href="http://java.sun.com/docs/books/tutorial/essential/io/check.html" rel="nofollow">http://java.sun.com/docs/books/tutorial/essential/io/check.html</a></p>
java
[1]
1,478,842
1,478,843
Create a Count Up Timer in Javascript/Jquery
<p>Hey, I'm just wondering if someone could tell me, or point me in the right direction, on how to make a count up timer.</p> <p>I'd like to have it constantly, from the second I put it into place count up saying the seconds, minutes, hours, days, and years.</p> <p>Thanks!</p>
javascript
[3]
93,708
93,709
How to remove a string from a string
<p>I am adding a string (a) to another string (b) before I store it in DB, when I retrieve the value from DB, I want to remove the string(b) from string (a). string (b) is a constant. How can I do it</p> <pre><code>string a= "text1"; string b="text2"; string c = a+b; </code></pre> <p>I want to remove b from c after I retrive it from db</p>
c#
[0]
1,655,809
1,655,810
installing certificate in android
<p>I want to configure L2tp/IPSEC CTR VPN on android device. But while installing certificate on device it is asking "password for extracting certificate". So which password is expected here??</p> <p>I am installing it from setting->security->install from SD card. Suggest something.</p>
android
[4]
450,640
450,641
how to load PDF file in website page using C#
<p>how to load PDF file in website page using C#</p>
c#
[0]
1,579,257
1,579,258
How can I enable and detect interrupts with hardware IO ports using interrupts
<p>My program is receiving data from hardware but I wanna get it Byte by Byte. How can I detect when datas come from IO ports? I wanted to use "Hardware Interrupts" but I couldnt do it. Would you please help me how to do it?</p>
c#
[0]
4,232,937
4,232,938
parsing xml doc with Javascript
<p>hey guys.. i was wondering what the best way to go about getting a node from an xml doc into a javascript variable would be? i dont really want to use jquery because i believe that i wont have too.. so far i have:</p> <pre><code>if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open("GET","sc2cash.xml",false); xmlhttp.send(); xmlDoc=xmlhttp.responseXML; </code></pre> <p>but now how i select the nodes? thanks </p>
javascript
[3]
3,966,299
3,966,300
how to get category name if my category got custom slug
<p>so my category got slug 'aeroplanes' and I need to get category names from it, but I can't get it with </p> <pre><code>$category = get_the_category($post-&gt;ID); echo $category[0]-&gt;cat_name; </code></pre> <p>cause it takes all posts from default category with category slug 'category'. How can I do that if I got category slug 'aerpolanes'?</p>
php
[2]
997,965
997,966
div scrollbar disappears when placed in showmodaldialog
<p>i have an aspx page where all the content is placed in a div which is having property overflow:auto; and im trying to dispaly the aspx page inside a showmodalDialog(which is resizeable)</p> <p>I made the height and width of div almost equal to showmodalDialog height and width... and the scrollbar appears properly...but when i resize the ShowmodalDialog the scrollbar Disappears...</p> <p>Please let me know how can i make the div exactly fit in ShowModalDialog eventhough i resize or maximize the Showmodaldialog ...so that even Scrollbar(in div) appears everytime... i do not want to enable scroll for showmodaldialog...</p>
javascript
[3]
4,344,356
4,344,357
Initializing struct within a class
<p>Is this allowable?</p> <pre><code>class object { public: struct st_example { int i; int j; int c[d]; st_example(int i_i, J_j, d_d) : i(i_i), j(j_j), d(d_d) {} }; object(int i_ii, int j_jj, int d_dd) { struct st_example test(i_ii, j_jj, d_dd); }; // Constructor }; </code></pre> <p>So that:</p> <pre><code>object testObj(1,2,3); </code></pre>
c++
[6]
2,205,006
2,205,007
Is it possible to get the the createTextNode method to render html tags?
<p>The following code prints</p> <p><strong>This should print</strong>(b)This should print(/b)<strong>This should print</strong></p> <pre><code>&lt;script&gt; function produceMessage(){ var msg= '&lt;b&gt;This should print&lt;/b&gt;'; return msg; } &lt;/script&gt; &lt;span id="mySpan"&gt;&lt;/span&gt; &lt;script&gt; document.body.appendChild(document.createTextNode(produceMessage())); document.write(produceMessage()); document.getElementById('mySpan').innerHTML=produceMessage(); &lt;/script&gt; </code></pre>
javascript
[3]
3,875,431
3,875,432
String Parsing in Java
<p>I am trying to parse a string something like this:</p> <p>Input "20:00" - output would be "20" Input "02:30" - output would be "2" Input "00:30" - output would be "".</p> <p>This is how I have written, I don't like the way I am doing it, looking for more efficient way to do this may be in a single scan. Any ideas?</p> <pre><code>private String getString(final String inputString) { String inputString = "20:00"; // This is just for example final String[] splittedString = inputString.split(":"); final String firstString = splittedString[0]; int i; for (i = 0; i &lt; firstString.length(); i++) { if (firstString.charAt(i) != '0') { break; } } String outputString = ""; if (i != firstString.length()) { outputString = firstString.substring(i, firstString.length()); } return outputString; } </code></pre>
java
[1]
4,152,378
4,152,379
How to determine if a file is executable?
<p>I'm writing a program that (part of what is does is) executes other programs. I want to to be able to run as many types of programs (written in different languages) as possible using <code>Process.Start</code> . So, I'm thinking I should:</p> <ol> <li>Open the file</li> <li>Read in the first line</li> <li>Check if it starts with <code>#!</code></li> <li>If so, use what follows the <code>#!</code> as the program to execute, and pass in the filename as an argument instead</li> <li>If no <code>#!</code> is found, check the file extension against a dictionary of known programs (e.g., <code>.py -&gt; python</code>) and execute that program instead</li> <li>Otherwise, just try executing the file and catch any errors</li> </ol> <p>But, I'm thinking it might be easier/more efficient to actually check if the file is executable first and if so, jump to 6. Is there a way to do this?</p>
c#
[0]
3,988,289
3,988,290
Calling constructors in c++ without new
<p>I've often seen that people create objects in C++ using</p> <pre><code>Thing myThing("asdf"); </code></pre> <p>Instead of</p> <pre><code>Thing myThing = myThing("asdf"); </code></pre> <p>This seems to work (using gcc), at least as long as there are no templates involved. My question now, is the first line correct and if so should I use it?</p>
c++
[6]
4,877,453
4,877,454
reordering of listview items by drag and drop using android
<p>How to drag and drop items in Listview for reordering in android?</p>
android
[4]
4,775,260
4,775,261
System.IO.Directory.GetFiles. No definition for GetFiles?
<p>I wrote some code to get the files in a directory. In order to do this I used the Directory.GetFiles method. I've used it before, so I know it exists and works.</p> <p>So I started using it (I'm using the System.IO namespace) and it tells me that 'System.IO.Directory' does not contain a definition for 'GetFiles'. Indeed, if I use the intellisense, there is no such method. <a href="http://msdn.microsoft.com/en-us/library/3hwtke0f.aspx" rel="nofollow">MSDN tells me that there is though</a>, and I know I've used it before, and I'm 99% sure it was System.IO.Directory.</p> <p>I do have System.IO.Directory... it just doesn't have that method. It has methods like 'GetCreationTime', 'GetDirectoryRoot', 'GetLastAccessTime', 'SetCurrentDirectory' and so on, but no 'GetFiles'.</p> <p>Can anyone offer any help?</p>
c#
[0]
4,699,171
4,699,172
I want to make a program without any visual dialog
<p>I have written a program that reads some information from a file and after processing it, writes it on another file.</p> <p>However, I don't wanna to see any window appear on my monitor when I open my program, even for a moment. Is there any way to make it invisible?</p>
c++
[6]
5,812,889
5,812,890
set with/height of embed iframe like youtube
<p>When you embed a movie from youtube, you have the opportunity to change the width and height of the iframe element. When you type in your desired values, you see that the html code inside the texarea is changed so the user can just copy paste.</p> <p>How do you make this happen?</p> <p>This is what I tried:</p> <pre><code>&lt;input type="text" id="width"&gt; &lt;textarea id="code"&gt; &lt;iframe src="..." width="224" height="144" frameborder="0" id="embed-widget"&gt;&lt;/iframe&gt; &lt;/textarea&gt; &lt;script&gt; $(function() { $('#width').keyup(function(){ var new_width = $(this).val(); $('#embed-widget').attr('width',new_width); }); }); </code></pre> <p></p> <p>This don't work inside the textarea, but the exact same code work on the iframe element itself on the page (when I put the id on to it)</p> <p>Also, is there a easy way to make the whole text marked when the user clicks the text area?</p>
javascript
[3]
2,491,842
2,491,843
Pixel travelling problem in BMP C#
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/6054486/exception-on-traveling-through-pixels-bmp-c">Exception on traveling through pixels BMP C#</a> </p> </blockquote> <p>I have <code>BMP</code> image and used two loops to access its pixels </p> <pre><code>for(int i=0;i&lt;BMP.Width;i++){ for(int j=0;BMP.Height;j++){ color=BMP.GetPixel(i,j); } } </code></pre> <p>My problem is using the above loops pixels are readed like 2nd in the bottom image but what im required is as 1st image </p> <p><img src="http://i.stack.imgur.com/NjdrA.png" alt="enter image description here"></p> <p>This what happening now </p> <p><img src="http://i.stack.imgur.com/aT5vB.png" alt="enter image description here"></p>
c#
[0]
5,155,148
5,155,149
ASP.NET Set a Global constant variable?
<p>Working on the Loginmechanism... But got problems..</p> <p>I have a UserControl (<code>LoginUserControl.ascx</code>) placed on a <code>Default.aspx</code>, which is in my Masterpage(<code>Site.Master</code>)... Over the UserControl, the User can login... Now I would like to set a <strong>global Variable</strong>, which won't change its Value, wherever I navigate...</p> <p>A Variable like, <strong>IsLogged, (true/false)</strong>. Because I got problems with Viewstate and when I change an other Site (by Example to <code>MyOtherSite.aspx</code>), IsLogged is then <strong>false</strong>...</p> <p>How can I do it?</p>
asp.net
[9]
1,819,677
1,819,678
Find the occurence of a character in a string
<p>Could someone please tell me how to find the occurence of a character in a string? I have to check the number of lines getting displayed (using the br tag) in a dynamically created div. Thanks in advance, Ashriya</p>
javascript
[3]
4,107,419
4,107,420
PHP: run linux command as sudo?
<p>I'm in a bit of trouble and need to run a linux command as sudo using php. Is this possible using php's exec()? I've tried but cannot enter the sudo password and then execute another command on the same exec() call.</p> <p>edit: i cannot access the server remotely via ssh due to own stupidity. That's why i have to run commands thru the web server.</p>
php
[2]
14,406
14,407
how to stop activity recreation on screen orientation?
<p>how i can stop the restarting or recalling of on create() on screen orientation ,i want to stop the recreation of activity on screen orientation. thanks in advance please tell me any better solution its really creating a problem. like in my program i am selecting some picture but on screen orientation the image goes off so thats why i want to stop the recreation of activity on screen orientation.</p> <pre><code>enter code here public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mainwindow); Toast.makeText(getApplicationContext(),"a", 1).show(); bitmap = (Bitmap)getLastNonConfigurationInstance(); //Toast.makeText(getApplicationContext(),"a1", 1).show(); if (savedInstanceState != null) { bitmap=BitmapFactory.decodeFile(mImageCaptureUri.getPath()); Toast.makeText(getApplicationContext(),"preview have value", 1).show(); preview.setVisibility(View.VISIBLE); From_Folder.setVisibility(View.GONE); From_Camera.setVisibility(View.GONE); preview.setImageBitmap(bitmap); } </code></pre>
android
[4]
3,144,004
3,144,005
calling a javascript function from the gridview to javascript function
<p>I have a gridview that has a linkbutton in it, on the onclientclieck event of the link button, I want to call the javascript function and pass some of the values from the gridview to the javascript function, based on the rowindex.</p> <p>Can I use the Datakeyvalues to pass the values from the gridview to javascript function. I was wondeirng if someone has any example related to this.</p> <p>any help will be appreciated.</p>
asp.net
[9]
2,643,467
2,643,468
Display images with PictureBox in c#
<p>I have write below codes in c# to display an image in <code>PictureBox</code> but when run the application, nothing shown...</p> <p>Please help me to fix that.</p> <p>here is my code:</p> <pre><code> private void button1_Click(object sender, EventArgs e) { PictureBox p =new PictureBox(); p.ImageLocation = "1.jpg" p.Location = new Point(100, 75); } </code></pre>
c#
[0]
5,126,743
5,126,744
Fancyupload 3.0 - Attach-a-file
<p>I'm trying to add some more features to this(Attach a file): <a href="http://digitarald.de/project/fancyupload/3-0/showcase/attach-a-file" rel="nofollow">http://digitarald.de/project/fancyupload/3-0/showcase/attach-a-file</a></p> <p>Does anybody know how to configure this so that you can pass in through the html page where to save the uploads? ie a folder name?</p> <p>Thank you for any help.</p>
php
[2]
551,281
551,282
WriteFile in shared hosting
<p>I have the next code, which executes inside an iframe and forces a file download:</p> <pre><code>System.IO.File.Copy(cnx.dataReader.Item("physical_path"), Server.MapPath(outputpath), True) Response.ContentType = cnx.dataReader.Item("mimetype") Response.AppendHeader("content-disposition", "attachment; filename=" &amp; cnx.dataReader.Item("name")) Response.WriteFile(Server.MapPath(ruta_outputpath)) Response.End() </code></pre> <p>This used to worked a few weeks ago but now I get an error related to security policy (it's a shared hosting, but I repeat, it was working before, they swear they didn't change anything. This is the complete error:</p> <pre><code>Security Exception Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. [SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.] System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark&amp; stackMark, Boolean isPermSet) +0 System.Security.CodeAccessPermission.Demand() +61 System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite) +164 System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite) +10 </code></pre> <p>Is this a problem with trust level or similar? do you know a solution for working in a shared hosting?</p> <p>Thank you</p> <p>PS: sorry if there's a solution already somewhere, my internet connection this days is very slow so I my search was "reduced", thank you</p>
asp.net
[9]
1,574,765
1,574,766
__globals__ in imported function is much different than __globals__ of function in main module
<p>File <strong>a.py</strong>:</p> <pre><code>def f(): pass </code></pre> <p>File <strong>main.py</strong>:</p> <pre><code>import a print("f globals") print(a.f.__globals__) def g(): pass print("g globals") print(g.__globals__) </code></pre> <p><code>a.f.__globals__</code> have much more elements than <code>g.__globals__</code>. At the first look it seems that built-in functions and types are in <code>a.f.__globals__</code>. Why these two dictionaries are different?</p>
python
[7]
2,795,747
2,795,748
Is there a way to build a C-like DLL from a Python module?
<p>I have a Python module with nothing but regular global functions. I need to call it from another business-domain scripting environment that can only call out to C DLLs. Is there anyway to build my Python modules so that to other code it can be called like a standard C function that's exported from a DLL? This is for a Windows environment. I'm aware of IronPython, but as far as I know it can only build .NET Assemblies, which are not callable as C DLL functions.</p>
python
[7]
2,623,080
2,623,081
Convert given time to GMT in java
<p>i had tried to convert the given date Mon Jul 04 00:00:00 IST 2011 in to GMT as like this 2011-07-04 18:10:47 GMT+00:00 2011 but it displays 3/7/11 6:30 PM This is my code</p> <pre><code>java.text.SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); java.text.SimpleDateFormat res_format = new SimpleDateFormat("dd/mm/yyyy HH:mm"); java.util.Date date1 = format.parse("2011-07-04 00:00:00"); DateFormat gmtFormat = new SimpleDateFormat(); TimeZone gmtTime = TimeZone.getTimeZone("GMT+00"); gmtFormat.setTimeZone(gmtTime); System.out.println("Current Time: "+date1); System.out.println("Time:"+gmtFormat.format(date1)); </code></pre>
java
[1]
2,350,751
2,350,752
how to use foreach loop in generating the result of mysql_query
<p>Im always using while loop in generating all record in my database, and some of my friend told me that it is better to use foreach in generating record from a database, but i dont know how.</p> <pre><code>&lt;?php $query = mysql_query("select * from sampleTABLE"); while($i = mysql_fetch_array){ echo $i['samplefieldName']; } ?&gt; </code></pre> <p>My question is, how to display records from my database using foreach? and can some one compare it in the while loop in terms in syntax and generating its result, thank you.</p>
php
[2]
4,403,421
4,403,422
Listview - list items updated with fetched data in background
<p>Currently i am having listview with multiple items (First time, i fetch data with the use of AsyncTask), now i want to implement the below functionalities:</p> <p>I am showing Option Dialog(With options Edit, Delete, Read) whenever user do long-click on any item, now if user select "Delete" option, at that time i want to remove item from the listview, listview should be displayed without that item meanwhile the data should also be fetched(in background) from the web.</p> <p>Anybody knows, how do i implement such?</p>
android
[4]
5,602,861
5,602,862
ListViews setSelection cancels touch event
<p>Another ListView related problem (gonna kill me someday, I swear).</p> <p>The situation is following: I have drag&amp;drop functionality in my app, and the element you are currently dragging can be dropped on the ListView item (kinda like you drag a folder into another folder on PC).</p> <p>There is also a limited amount of items at the screen at the given time (duh), so I need some kind of scrolling functionality while dragging. The idea is not new, when you drag to top or bottom border of the listview and hold there for a moment, it starts scrolling.</p> <p>The problem is, when I try to scroll with setSelection, or smoothScrollToPosition the touch event of my draggable view returns with the code 3 (ACTION_CANCELED), so the drag just freezes. </p> <p>Can anyone help me win this?</p> <p>P.S. Almost forgot. I tried to use scrollBy. scrollBy doesn't break my touch event, but it doesn't actually scroll listView either. Scrolling goes down, but the items are not recycled and reused again. It just a blank screen where elements must be.</p>
android
[4]
4,822,539
4,822,540
Auto-login, NTLM header seems to erase $_SESSION on redirect
<p>I'm trying to create an auto login script. The computers are using IE8 on XP. The code successfully retrieves the user's Windows username and places it into a session, but once redirect is complete, the session is wiped clean.</p> <p>In index.php:</p> <pre><code>session_start(); if (!isset($_SERVER["AUTH_USER"]) || $_SERVER["AUTH_USER"] == '') { header('WWW-Authenticate: NTLM', false); exit; } # Extract username $user = explode('\\',$_SERVER["AUTH_USER"]); $_SESSION['username'] = strtolower($user[1]); print_r($_SESSION); // Success! header("Location: index2.php"); </code></pre> <p>In index2.php:</p> <pre><code>session_start() print_r($_SESSION); // Fail. array() </code></pre> <p>The key problem seems to be the header part because during testing, I've removed it and put in a dummy username and it successfully passes to the next page. I need the header though, because it is needed to do the NTLM authentication (ie. Put the AUTH_USER details in the $_SERVER array.)</p> <p>EDIT I turned off anonymous authentication in IIS, then removed the header part and all worked. However, this creates loads of other problems.</p>
php
[2]
1,755,271
1,755,272
Dynamically create LI items from DIV classes with jQuery
<p>I have multiple DIVs being used to list items like so:</p> <pre><code>&lt;div class="project-item Video"&gt; &lt;p&gt;Test&lt;/p&gt; &lt;/div&gt; </code></pre> <p>Each DIV has a set of categories added to it (for example, Video).</p> <p>I want to automatically create list items from the classes, but leave out .project-item.</p> <p>Problems I'm facing are making sure the categories don't repeat. There will be multiple DIVs listed. e.g:</p> <pre><code>&lt;div class="project-item Video"&gt; &lt;p&gt;Test&lt;/p&gt; &lt;/div&gt; &lt;div class="project-item Photography"&gt; &lt;p&gt;Test&lt;/p&gt; &lt;/div&gt; &lt;div class="project-item Video Photography"&gt; &lt;p&gt;Test&lt;/p&gt; &lt;/div&gt; </code></pre> <p>There is a UL above the DIV's with the following markup:</p> <pre><code>&lt;ul id="filters" class="option-set clearfix" data-option-key="filter"&gt; &lt;li&gt;&lt;a href="#filter" data-option-value="*" class="selected"&gt;Show all&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Underneath the 'Show All' LI I want to then list each category, for example:</p> <pre><code>&lt;ul id="filters" class="option-set clearfix" data-option-key="filter"&gt; &lt;li&gt;&lt;a href="#filter" data-option-value="*" class="selected"&gt;Show all&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#filter" data-option-value="Video"&gt;Video&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Here is a jsFiddle that shows the example HTML markup without the needed lists: <a href="http://jsfiddle.net/GaExx/1/" rel="nofollow">http://jsfiddle.net/GaExx/1/</a></p>
jquery
[5]
2,607,656
2,607,657
Change the title of window.open
<p>I have a window.open function call on click, which opens an .swf albumplayer.</p> <pre><code>var win = null; function NewWindow(wizpage, wizname, w, h, scroll){ LeftPosition = (screen.width) ? (screen.width-w)-8 : 0; TopPosition = (screen.height) ? (screen.height-h)/2 : 0; settings = 'height=' + h + ',width=' + w + ',top= 100,' + TopPosition + ',left=' + LeftPosition + ',scrollbars=' + scroll + ',resizable'; win = window.open(wizpage, wizname, settings); } </code></pre> <p>I would want to change the title of the opened window, that it has some meaningful title (a constant 'Album Player' or something would be fine), so that doesn't use the default filename/application-shockwave... text.</p> <p>Thanks for the help.</p>
javascript
[3]
263,424
263,425
Summing in Javascript
<p>I have a question hope someone can help me.</p> <p>I have 3 different range inputs on my page: </p> <pre><code>&lt;input type="range" name="test1" min="0" max="50" value="0" step="5" onchange="showValue(this.value) &lt;input type="range" name="test2" min="0" max="50" value="0" step="5" onchange="showValue(this.value) &lt;input type="range" name="test3" min="0" max="50" value="0" step="5" onchange="showValue(this.value) </code></pre> <p>and I want JS to calculate the sum of the values of the inputs that the user selects, like (test1 + test2 + test3) and then display the result.</p> <p>Regards.</p>
javascript
[3]
5,946,790
5,946,791
When page is loading, display a image after 5 seconds swap with text
<p>I have a div that has content in it.</p> <pre><code>&lt;section id="latest-news"&gt; &lt;p&gt;Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.&lt;/p&gt; &lt;/section&gt; </code></pre> <p>But while the page is loading, I want a loading .gif to appear, wait about 5 seconds and the the text. With a fadeIn or slide down animation too. (The text would be hidden by default)</p> <p>I tried for an hour on this but I can't get it to work :/</p> <p>What is a way to do this?</p>
jquery
[5]
3,469,141
3,469,142
Malware Postings
<p>Someone has hacked my website recently &amp; changed the codes. I have changed the cpanel password &amp; banned some IPS. but still they are posting some content to database using a URL. punadirallu.org/newsitem.php?id=513. actually there is no newsitem with that id. &amp; even if they open that URL, the iP ban script in the header section should block them from opening the page. I don't know how it is happening. Please suggest.</p>
php
[2]
3,110,735
3,110,736
Does a PhantomReference being in a ReferenceQueue stop the PhantomReference from being GC'd?
<p>I'm using the LWJGL libraries and unfortunately I need to free up texture/vbo buffers myself whenever a node in my scene graph needs to die, I can't even use finalize() method to do this as I can't guarantee that it will be executed in the same thread the opengl libs expects it to.</p> <p>So I'm using PhantomReferences. In my scene graph nodes I've put this in the constructor:</p> <pre><code>phantomReference = new ScenePhantomReference(this, Game.phantomReferenceQueue); Game.phantomReferenceList.add(phantomReference); </code></pre> <p>As you can see in the second line I've added the phantomReference to a list in the main class. My logic is that when the node becomes dereferenced the phantomReference won't get garbage collected with it as there's still a reference in the main class.</p> <p>Is adding it to a list like this needed? Or will it be spared from the GC (maybe the Game.phantomReferenceQueue keeps a reference to it?).</p> <p>This one is a pain to test, I could just remove the list but the GC could just be processing the object that's being watched before the phantomReference and make it look like the list is redundant, when it really isn't. I'd be paranoid that any different VM implementation or version might decide to do it the other way round.</p>
java
[1]
597,956
597,957
Hello World jQuery Code not working
<p>I'm trying to get my system set-up to learn jquery and I can't even seem to get a simple hello world program to work and I'm not sure why. It seems like it should work fine.</p> <p>I'm using CI so here is my controller followed by my view. Thanks.</p> <p><code> <pre><code>class Java extends Controller{ function index(){ $this-&gt;load-&gt;view('java_view'); } } </code></pre> <p></code></p> <p>The view file: <code> </p> <pre><code>&lt;script type = "javascript" src="http://localhost/ci/JS/jquery.js"&gt;&lt;/script&gt; &lt;script type="javascript"&gt; $(document).ready(function() { $("#hi").click(function() { alert("Hello world!"); }); }); &lt;/script&gt; </code></pre> <p></p> <p></p> <pre><code>&lt;a id = "hi" href=""&gt;Link&lt;/a&gt; </code></pre> <p></p> <p> </code></p>
jquery
[5]
4,015,294
4,015,295
Access main site dll's class and create object from sub site in c#
<p>I have one dll in my main project location's bin folder at the server, and i have one sub site under the main site, </p> <p>i want to refer/access the main site's dll class and create object from my sub site. I will keep my dll's in the main site's bin location only, i dont want to copy the referred dll in the sub site bin folder. </p> <p>Can any one help how to do this?</p>
c#
[0]
5,308,296
5,308,297
Moving image from scrollView to View
<p>I have created a <code>scrollview</code> and have added it to my view controller class. Now I have items in <code>scrollview</code>. On touch I want to move image to the main view. I am trying using <code>touchesBegin</code> and <code>touchesMoved</code> but it's not working. How can I do it?</p> <pre><code>-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"touch moved"); dummyDress.frame=CGRectMake(location.x, location.y , 80, 120); } </code></pre>
iphone
[8]
1,314,161
1,314,162
Forming Communication Between Server and an iPhone application
<p>Is there any tutorial or blog or some documents which helps in learning how to communicate server from my iPhone application.</p> <p>I just want to do a simple thing. Which is a page update.</p> <p>Like I have a Label which needs to update to one particular name stored in my database and this database resides on a server.</p> <p>So how to do this.</p>
iphone
[8]
4,173,746
4,173,747
Enabling Multi-Touch/MultiClick
<p>I am simply wondering how to enable multi touch when developing applications. I've googled it and these are the only things that show up </p> <p><a href="http://www.zdnet.com/blog/burnette/how-to-use-multi-touch-in-android-2-part-2-building-the-touch-example/1763?tag=mantle_skin;content" rel="nofollow">http://www.zdnet.com/blog/burnette/how-to-use-multi-touch-in-android-2-part-2-building-the-touch-example/1763?tag=mantle_skin;content</a></p> <p><a href="http://stackoverflow.com/questions/2528160/multiple-button-presses-for-android-2-x">Multiple button presses for Android 2.x</a></p> <p>I haven't had any luck with these, and it seems like the way to enable multitouch could (Might) have changed since then. All I want to do is be able to click more than one button at a time (think of a drum pad like function, for example). Thanks in advance</p>
android
[4]
3,104,957
3,104,958
system test run error message
<p>I am trying to run this system test. I made sure that the device information is in the database. </p> <p>When I ran the test it constantly gives me an error message:</p> <blockquote> <p>Test method SystemTests.Tests.EmailNotification.TestAddDeviceToAccount threw exception: System.InvalidOperationException: Sequence contains no elements.</p> </blockquote> <p>any help please </p> <pre><code>public void TestAddDeviceToAccount()//Test to AssDeviceToAccount { //string Fccid = "OPS2"; //string SerialNumber = "101"; //string emailAddress = "m.koneru2@spectrumBridge.com"; using (WSPlusEntities dc = WSPlusEntities.GetContext()) { Device d1 = dc.Devices.Where(d =&gt; d.FCCID == "OPS2" &amp;&amp; d.SerialNumber == "101").Single(); d1.NetworkId = 1; //var deviceList = dc1.Devices.Where(d =&gt; d.FCCID == "OPS2" &amp;&amp; d.SerialNumber == "102").ToList(); //foreach (var d2 in deviceList) //d2.NetworkId = 1; dc.SaveChanges(); } } </code></pre>
c#
[0]
52,902
52,903
Copy to another div as you type in jquery
<p>I'm trying to reproduce the same thing as stackoverflow does when you start typing in the editor it copies.</p> <p>I have a input text and the text they enter I want it to be copied to another div as they type.</p>
jquery
[5]
1,536,581
1,536,582
JavaScript return method
<p>I'am new in javascript. I can't understand why the function returns T1 object (not just string 'hi') in the following example.</p> <pre><code> function T1(){ return 'hi'; } function T(){ return new T1(); } T(); </code></pre> <p>output: T1</p> <p>And returns function in the following example</p> <pre><code> function T1(){ return function(){ return 'hi'; } } function T(){ return new T1(); } T(); </code></pre> <p>output: function (){ return 'hi' }</p> <p>Why does the first example returns an object (not the string "hi", what is expected to happen) and the second returns the function body that is returned from the first function (not the expected object)? </p> <p>Please explain this result. Thank you)</p>
javascript
[3]
654,015
654,016
How to retain/recall values of tableLayoutPanel of child form from main form button in C#(Visual Studio) 2010?
<p>I have 2 questions and need your guidance</p> <p>1) Please guide me as how to retain/recall textboxes values of tablelayoutpanel of child form from the button click event of parent form in C#.,<br> Scenario is that , I have filled out the values in textboxes of tablelayoutpanel in child form and then return to parent form . What if i want to see/review the values of (previously) filled textboxes values of tablelayoutpanel of child form, can i do that? Please suggest me a solution., </p> <p>2)Can i redraw rows/columns of tablelayoutpanel dynamically upon changing user input(of rows/columns) . Please be remember in this case i need to discard the previous one and redraw the tablelayoutpanel all over again.Please suggest how to discard the previous one?</p> <p>Thanks and Regards,<br> Asad</p>
c#
[0]
509,608
509,609
problems about the attributes of a python class method
<pre><code>class test : def fn(self, i): #test.fn.f = 0 the "compiler" show "not define" errors #self.fn.f = 0 the "compiler" show "not define" errors return test.fn.f #ok return self.fn.f #ok fn.f = 1 p = test() print p.fn(1) </code></pre> <p>I am just curious about why i can't change the values of a attribute in "fn" method</p> <p>In essence, it's...</p> <p>what differences are between <code>test.fn.f</code> and <code>self.fn.f</code> ? i am sure it's ok modifing function's attribute-value , but why i can do that in a method? </p>
python
[7]
2,311,932
2,311,933
How to get IMSI and MSISDN Sim Card on iPhone?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/10583224/get-msisdn-number-through-code">Get MSISDN number through code</a> </p> </blockquote> <p>Help me please</p> <p>How to get IMSI and MSISDN Sim Card on iPhone ?</p> <p>Thanks</p>
iphone
[8]
3,205,023
3,205,024
jquery serialize not serializing inputs in a hidden div
<p>I am using serizlse on a form. I have a hidden div inside the form and I need to grab the inouts inside if that div. </p> <pre><code>&lt;form&gt; &lt;div style="display:none;"&gt; &lt;input type="text" name="one" value="one"&gt; &lt;/div&gt; &lt;div&gt; &lt;input type="text" name="two" value="two"&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p>When I view my post data I can see the value of two but not the value of one. Is their a way to use serialize on inputs inside of a hidden div?</p>
jquery
[5]
3,292,932
3,292,933
Timer Not Stopping In Android
<p><strong>THE PROBLEM</strong> I am having problems stopping the Timer whilst developing in android.</p> <p>The timer is already null when it comes to stopping it.</p> <p>I then move the timer initialisation to outside of a method just like the TimerTask which solves the null problem but still doesn't cancel when <code>timer.cancel();</code> is called upon it.</p> <p>The code below is an example of the timer already being null when it comes to stopping the recording.</p> <p><strong>TimerTask</strong></p> <p>My <code>TimerTask</code> is initialized inside the class but outside of a method and the codes below...</p> <pre><code>private TimerTask task = new TimerTask() { @Override public void run() { Log.e("TRACK_RECORDING_SERVICE","Timer Running"); } }; </code></pre> <p><strong>Timer &amp; Timer Start</strong></p> <p>I then have a startRecroding method which is called when I want to start the timer...</p> <pre><code>public void startRecording(){ timer = new Timer("Message Timer"); timer.scheduleAtFixedRate(this.task, 0, 1000); } </code></pre> <p><strong>Timer Stop</strong></p> <p>I then call the below method when I want to stop the timer...</p> <pre><code>public void stopRecording() { if (timer != null) { timer.cancel(); timer = null; } else { Log.e("TRACK_RECORDING_SERVICE","Timer already null."); } } </code></pre> <p>Any help would be much appreciated.</p>
android
[4]
2,106,995
2,106,996
empty carousel no action are enable
<p>the problem in my app it consider the carousel empty, i'm sure from the code is correct here's the main layout code:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:pj="http://schemas.android.com/apk/res/com.name.w" xmlns:bm="com.name.main" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;com.name.controls.Carousel android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/carousel" pj:UseReflection="true" pj:Items="@array/entries" pj:SelectedItem="0" android:animationDuration="200" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>and here's the mainActivity:</p> <pre><code>public class NameActivity extends Activity { /** Called when the activity is first created. */ Carousel care; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); care=(Carousel) findViewById(R.id.carousel); if(care!=null){ care.setOnItemClickListener(new OnItemClickListener(){ public void onItemClick(CarouselAdapter&lt;?&gt; parent,View view,int position,long id){ Toast.makeText(NameActivity.this, "Position=" + position, Toast.LENGTH_SHORT).show(); } });} } } </code></pre> <p>when run the photos in carousel all of them are appear but does'nt make an actoin such as click on it and move to athor page or sth plz i need know how to solve this problem?</p>
android
[4]
5,106,517
5,106,518
Dynamic views with one static xml
<p>I have an xml file right now which has a TableLayout within a LinearLayout. Within the TableLayout are TableRows with Buttons. Within my Java code, I do a setOnClickListener for each button.</p> <p>The problem is I have several xml files like this which are exactly the same, except within the xml the ID and text's of the different buttons are different. </p> <p>So one file it will be </p> <pre><code>&lt;Button android:id="@+id/one" android:text="one" /&gt; &lt;Button android:id="@+id/two" android:text="two" /&gt; </code></pre> <p>and another file it will be </p> <pre><code>&lt;Button android:id="@+id/three" android:text="three" /&gt; &lt;Button android:id="@+id/four" android:text="four" /&gt; </code></pre> <p>In Java, in one part of a switch/case statement I have a case that is:</p> <pre><code>setContentView(R.layout.a); Button bOne = (Button) findViewById(R.id.one); Button bTwo = (Button) findViewById(R.id.two); </code></pre> <p>and another I have:</p> <pre><code>setContentView(R.layout.b); Button bThree = (Button) findViewById(R.id.three); Button bFour = (Button) findViewById(R.id.four); </code></pre> <p>The redundancy goes out to more than two xml files, this is just an example.</p> <p>Is there any way to do this and not have multiple layout files, but to do this all in one layout file? The xml files are all exactly the same, but for the id and text portions of the buttons.</p> <p>I really don't care how this is done - in Java, in xml, or however. It's just that I make minor tweaks to the layout once in a while, and don't want to have to continue to tweaking every file with exactly the same layout but for the button id's and texts. I'd like to tweak the layout once and have it work across all of them when I change the layout. If I have to put the entire layout file in Java, that would be fine.</p>
android
[4]
5,569,409
5,569,410
Adding a tool bar to visual studio 2010 - windows from application
<p>i just downloaded an RSS Toolkit for .net.</p> <p>where do i need to place it? in which folder so it will become available on my visual toolbars?</p> <p>and what types of files do i need to place in this folders? is it the *.dll only or more?</p> <p>thanks.</p>
asp.net
[9]
6,017,391
6,017,392
'Simple' Jquery Page Peel function not working
<p>I have this seemingly simple Jquery page peel function, but I've tried everthing, I just cannot get it to work. I also tried in in jsfiddle here's my example: <a href="http://jsfiddle.net/xgDzX/5/" rel="nofollow">http://jsfiddle.net/xgDzX/5/</a></p> <p>Here is the original tutorial: <a href="http://www.smple.com/pagePeel/" rel="nofollow">http://www.smple.com/pagePeel/</a></p> <p>Note: I went the non-flash route...</p> <p>Any help would be so much appreciated, this thing has been keeping me busy for the last 3 hours</p> <p>Thanks</p>
jquery
[5]
1,703,285
1,703,286
Android : menu cannot be resolved to a type
<p>This is how I do : </p> <pre><code>@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.game_menu, menu); return true; } </code></pre> <p>game_menu.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:id="@+id/new_game" android:title="@string/new_game"/&gt; &lt;item android:id="@+id/help" android:title="@string/help" /&gt; &lt;/menu&gt; </code></pre> <p>But Eclipse keep telling me that menu is not a type... I tried to import R, clean my project and some others things i saw on the net.</p> <p>I cant bypass this problem with that :</p> <pre><code>@Override public boolean onCreateOptionsMenu(Menu menu) { menu.add(Menu.NONE, Menu.FIRST + 1, 5, "??").setIcon( android.R.drawable.ic_menu_delete); menu.add(Menu.NONE, Menu.FIRST + 2, 2, "??").setIcon( android.R.drawable.ic_menu_edit); return true; } </code></pre> <p>Thank you in advance and sorry for my spelling.</p>
android
[4]
3,527,504
3,527,505
Does I able to sort the gridview at page level?
<p>I have done sorting in my gridview. It is woring properly. Suppose grid has 2 pages and size of page is also 2.Page contain 4 column.Out of 4 column,one column is name. First page contain 'archana' and 'bharti' name and second page contain 'pinky' and 'shweta'.When I sorting.Sorting should be done at page level.but this is not happening.'shweta' and pinky at first page then bharti and archana.In this order,sorting done.Not happening at page level.I want like, in first page,when I sorting 'Bharti' and 'Archana' should come and vice versa.</p>
asp.net
[9]
2,131,259
2,131,260
EXE packer/EXE Compresser for application in C#/VB.net
<p>Is there any EXE packer/EXE Compresser available for application developed in C#/VB.net?</p>
c#
[0]
2,001,600
2,001,601
javascript parseInt - difference of calculation in different radix
<p>For base19 and base24 both, value of a is 10 and b is 11 that I know.</p> <p>But <code>parseInt("ab", 19) returns 201</code> and <code>parseInt("ab", 24) returns 251</code>. </p> <p>I want to know that how calculation is being done in each case.</p>
javascript
[3]
5,206,165
5,206,166
Lambda expression as function parameter
<p>I have the following code</p> <pre><code>List&lt;int&gt; GetIndices&lt;T&gt;(List&lt;T&gt; list, ?????? condition { var result = list .Select((p, index) =&gt; index) .Where(condition); return result.ToList(); } </code></pre> <p>And I would like to call it like <code>GetIndices(someList, (p, index) =&gt; (someList[index].Height &lt; someList[index - 1].Height))</code></p> <p>What is the correct type of <code>condition</code>?</p>
c#
[0]
5,591,701
5,591,702
How to list some files which are not normal files of ftp server in client side in java?
<p>Here I am using the following code to list all files of a particular directory of ftp server. This code is successfully working for normal files and showing proper result .but there are few files which are special and which are untouched from FTPClient class.</p> <pre><code>import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPFile; import org.apache.commons.io.FileUtils; import java.io.IOException; //import java.util.ArrayList; public class ListFileInServer { public static void main(String[] args) throws Exception { FTPClient client = new FTPClient(); client.connect("ftpservername"); client.enterLocalPassiveMode(); client.login("username", "Password"); System.out.println("number of file="+client.list()); if(client.changeWorkingDirectory("/upload/Test/build/classes")){ System.out.println("Dir Changed to /upload/Test/build/classes"); String[] names = client.listNames("/upload/Test/build/classes"); // if(client.removeDirectory("/upload/Test/build/classes")){ // System.out.println("Dir /upload/Test/build/classes has been deleted"); // } for (String name : names) { System.out.println("Name = " + name); } } client.logout(); client.disconnect(); } } </code></pre>
java
[1]
64,816
64,817
Set APN programmatically in android
<p>Hello In my android application i would like get all the available APN and check if the client APN is available. I would like to run my app using this client APN.</p> <p>Is there any way to achieve this in android.</p> <p>Thanks in advance :)</p>
android
[4]
5,709,813
5,709,814
Prevent activity from being destroyed. youtube player-like behaviour
<p>I've implemented a player activity but I can't make it work like youtube one. The problem is that when I hit display shutdown button, which is usually on the right side of a device, the whole activity gets recreated. Youtube player somehow prevents this behaviour - I bet this is something basic. Could you tell what should I write in my manifest ? :)</p> <p>Thanks.</p>
android
[4]
4,476,424
4,476,425
Pre and post increment/decrement operators in C#
<p>In C#, does anybody know why the following will compile:</p> <pre><code>int i = 1; ++i; i++; </code></pre> <p>but this will not compile?</p> <pre><code>int i = 1; ++i++; </code></pre> <p>(Compiler error: The operand of an increment or decrement operator must be a variable, property or indexer.)</p>
c#
[0]
2,572,630
2,572,631
Reading web.config value through javascript
<p>I have web.config with the given value:</p> <pre><code>&lt;appSettings&gt; &lt;add key="vDirectory" value="fr" /&gt; &lt;add key="BookingSummaryPage" value="/pli/forms/BookingSummary.aspx" /&gt; &lt;/appSettings&gt; </code></pre> <p>Now I want to read the value of "vDirectory" through java script.</p> <p>I am using below code:</p> <pre><code>&lt;script language="javascript" type="text/javascript"&gt; function test() { var t='&lt;%=ConfigurationManager.AppSettings("vDirectory").ToString() %&gt;' alert(t); } &lt;/script&gt; &lt;input type="button" value="Click Me" onclick="test();" /&gt; </code></pre> <p>The error generated is:</p> <pre><code>Error 'System.Configuration.ConfigurationManager.AppSettings' is a 'property' but is used like a 'method' </code></pre>
javascript
[3]
2,764,482
2,764,483
How do I handle client disconnect (epoll)
<p>I am working on a network programming using epoll. I was wondering how I can handle client disconnect. I read api document and epoll_wait had a argument for timeout. However, I was confused if the time out for the epoll_wait function or for the client that are being connected. </p> <p>Thanks in advance..</p>
c++
[6]
280,190
280,191
Is there anything wrong with this (c++)code? if so can anybody tell me where I went wrong?
<p>I'm new to C++ and was practicing with an exercise. I use the CodeBlocks IDE.</p> <pre><code>#include &lt;iostream&gt; using namespace std; int main() { double f; double m; int counter; counter = 0; for (f = 1.0, f &lt;= 100.0, f++) { // error: expected primary-expression before ')' m = f / 3.28; cout &lt;&lt; f &lt;&lt; " feet is " &lt;&lt; m &lt;&lt; " meters!\n done"; counter++; if (counter == 10) { cout &lt;&lt; "\n"; counter = 0; } } cin.ignore(); cin.get(); return 0; } </code></pre> <p>Every time I put this in my IDE I get the following error:</p> <blockquote> <p><code>error: expected primary-expression before ')' token</code></p> </blockquote> <p>Can anybody point me in the right direction?</p>
c++
[6]
3,352,136
3,352,137
How to make my login button do 2things(php please)
<p>Please i need my login button to search the database to confirm username and password and also check for the role of the user that just signed in. If the user is just a staff, i want the user to be linked to my staffdashboard but if the user is one of the administrators, it should link them to admindashboard. Please how do i go about that! Thanx </p>
php
[2]
3,058,646
3,058,647
λ and function javascript
<p>is there any way to map the λ key to the function keyword? so that these work:</p> <pre><code>var rFalse = λ() { return false; } (λ(){ var str = "i'm in a closure"; }()); window.onload = λ() { alert('window loaded'); } </code></pre> <p>I know that they are attempting to put a shortened function keyword in ecmascript v6, but I'm wondering if it is possible to do it now.</p>
javascript
[3]
2,086,901
2,086,902
How to evaluate arbitrary code in Python?
<p>I'd like to be able to evaluate arbitrary code from a string in Python, including code composed of multiple statements, and statements that span multiple lines. The approaches I've tried so far have been to use <code>exec</code> and <code>eval</code>, but these seem to only be able to evaluate expressions. I have also tried the <a href="http://docs.python.org/library/code.html" rel="nofollow">code.InteractiveInterpreter</a> class, but this also only seems to allow evaluation using <code>eval</code>, <code>exec</code>, or single-statement modes. I've tried splitting the code by line, but this fails to handle statements that span multiple lines. Is there a way to accomplish this?</p>
python
[7]
2,226,016
2,226,017
how to change the background color of a listview when clicked once and when clicked again i need to change the background color without using selector
<p>how to change the background color of a listview when clicked once and when clicked again i need to change the background color without using selector.I have worked on changing the background when i select each item.but when i click again on the item i need to change the background color as red.how can i give the condition.i will post my code here.please give suggestions.please help...</p> <p>public class ProvierActivity extends Activity {</p> <pre><code>private String text[] = { "BroadStripe-Cable (Seattle)", "BroadStripe-Digital (Seattle)", "BroadStripe-Cable (Seattle)", "Comcast king county south)", "BroadStripe-Cable (Seattle)", "Comcast king county south", "BroadStripe-Digital (Seattle)", "BroadStripe-Digital (Seattle)", "BroadStripe-Cable (Seattle)", "Comcast king county south" }; ImageView icon; public static int selectedRow; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final ListView list = (ListView) findViewById(R.id.listview_id); list.setAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.list, R.id.title, text)); list.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; adapter, View view, int position, long arg3) { for (int i = 0; i &lt; adapter.getChildCount(); i++) { if (i == position) { adapter.getChildAt(i).setBackgroundColor(Color.BLUE); } else { adapter.getChildAt(i).setBackgroundColor(Color.BLACK); } } } }); } </code></pre> <p>}</p>
android
[4]
259,593
259,594
Why isn't this jQuery script working?
<pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function(){ $("tr.reqDet").hide(); $("[title='requestType']").change(function(){ if ($("[title='requestType']").val()!=""){ $("#reqDet").hide(); } else { $("#reqDet").show(); } }); &lt;/script&gt; </code></pre> <p>I cannot get the if statement in the script to work...</p> <p>Details: I'm using SharePoint and it renders a dropdown box w/ attribute title="requestType". When the requestType box is NOT set to the initial value, which is "", I'd like for a control with the class "reqDet" to appear.</p> <hr> <p>Anyways, Thanks everyone. here's the solution that worked for me:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function(){ $("tr.reqDet").hide(); $("select[title='requestType']").change(function(){ $(".reqDet").toggle($(this).val()!== ""); }); }); &lt;/script&gt; </code></pre>
jquery
[5]
1,355,611
1,355,612
Android Non removable shortcut
<p>Is there a way to create a homescreen shortcut that can not be removed progromatically? </p>
android
[4]
3,397,578
3,397,579
Unable to Parse JSON In my application
<p>I've been trying to figure this out for the past 4 days and I am about to pull my hair out!</p> <p>I need your help, can anyone tell me what im doing wrong?</p> <p>Here is the JSON format link I am using for development: REMOVED FOR PRIVACY CONCERNS</p> <p>Here is my code:</p> <pre><code> public class JSONActivity extends Activity { TextView http; HttpClient client; JSONObject json; final static String URL = "REMOVED FOR PRIVACY CONCERNS @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); http = (TextView) findViewById(R.id.http); client = new DefaultHttpClient(); new Read().execute("firstName"); } public JSONObject getpw(String password) throws ClientProtocolException, IOException, JSONException { StringBuilder url = new StringBuilder(URL); url.append(password); HttpGet get = new HttpGet(url.toString()); HttpResponse r = client.execute(get); int status = r.getStatusLine().getStatusCode(); if (status == 200) { HttpEntity e = r.getEntity(); String data = EntityUtils.toString(e); JSONArray getname = new JSONArray(data); JSONObject last = getname.getJSONObject(3); return last; } else { Toast.makeText(JSONActivity.this, "error", Toast.LENGTH_SHORT); return null; } } public class Read extends AsyncTask&lt;String, Integer, String&gt;{ @Override protected String doInBackground(String... arg0) { // TODO Auto-generated method stub try { json=getpw("trustme"); return json.getString(arg0[0]); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } @Override protected void onPostExecute(String result) { // TODO Auto-generated method stub http.setText(result); } }} </code></pre> <p>Any help would be greatly appreciated.</p>
android
[4]
3,318,761
3,318,762
logout using cookies php
<p>This is the way i set cookies for authentication purpose, but i need a logout function to destroy those cookies...and send back to index page, please help me out??</p> <pre><code>&lt;?php require_once('Template.php'); require_once('common/common.php'); $mes=""; if($value['m']==1) { $mes="Invalid Username / Password."; setcookie("USERNAME", "", time()-3600); } $template =&amp; new Template('html/login.html'); $template-&gt;AddParam('mes',$mes); $template-&gt;EchoOutput(); ?&gt; </code></pre> <p>actually i forgot to post the login authentication code...</p> <pre><code>&lt;?php require_once('class/User.php'); require_once('common/common.php'); $user= new User(); $user-&gt;getUser($value['username'],$value['password']); if($user-&gt;ID != null){ setcookie("USERNAME", $user-&gt;USERNAME); header("Location:adminhome.php"); } else { header("Location:index.php?m=1"); } ?&gt; </code></pre>
php
[2]
574,913
574,914
UserControl: How to set Output Cache duration programaticaly?
<p>UserControl: How to set Output Cache duration programaticaly?</p>
asp.net
[9]
3,882,253
3,882,254
How to properly make jQuery hover work
<p>I have this test page: <a href="http://www.problemio.com/index_new.php" rel="nofollow">http://www.problemio.com/index_new.php</a></p> <p>and I am trying to make some jQuery for hovering functionality. But I am not exactly sure how to go about it. Have some jQuery code like this:</p> <pre><code>$('ul#environment li').hover(function() { $(this).find('ul:first-child').show(); }, function() { $(this).find('ul:first-child').hide(); }); $('ul#health li').hover(function() { $(this).find('ul:first-child').show(); }, function() { $(this).find('ul:first-child').hide(); }); </code></pre> <p>and HTML on the page like this:</p> <pre><code> &lt;div style="display:none;"&gt; &lt;ul id="environment" &gt; &lt;li&gt;Green Lifestyle&lt;/li&gt; &lt;li&gt;Energy Use&lt;/li&gt; &lt;/ul&gt; &lt;ul id="health"&gt; &lt;li&gt;Medicine&lt;/li&gt; &lt;li&gt;Diet&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>and then I have some HTML links that I want to display the appropriate hover effect when the user mouses over.</p> <p>How do I do that? I seem to have seperate pieces of the functionality, but not sure how to make it all play together.</p>
jquery
[5]
5,287,530
5,287,531
Jquery count the number of inputs on page
<p>I have a dynamic form that users can add/delete sets of input fields. I want to disable the delete form fields button when there is x amount of inputs left, so I thought I would count the number of inputs left on the onclick for the delete button, and then when there was only x amount of inputs left I would disable the delete button so they cant delete the last set of inputs.</p> <pre><code>$('#btnRemove').on('click', function() { $('.clonedInput').last().remove(); if count of inputs = 7; $('#btnRemove').attr('disabled','disabled'); }); </code></pre> <p>'if count of inputs = 7' is what I need the code for! Any help?</p>
jquery
[5]
347,932
347,933
C# Close processes minimized to tray in a graceful way?
<p>I have an application that has can display a window using a Form. The form is only shown if the application is run using a -debug flag, otherwise it is only shown in tray.</p> <pre><code>var form = new Form(); if(DebugMode) form.Show(); </code></pre> <p>The application listens to CloseMainWindow() when run in debug mode, as the form is shown. How can I make the application also listen to CloseMainWindow() without showing it? I don't want the user to be able to interact with the form if not in debug mode.</p> <p>I've tried several approaches, like displaying the window but setting the size to 0. This shows a small form, i.e. not hidden.</p> <pre><code>if (!DebugMode) { form.Show(); form.Size = new Size(0, 0); } </code></pre> <p>Also showing it, and then hiding it does not work:</p> <pre><code>if (!DebugMode) { form.Show(); form.Hide(); } </code></pre> <p>Showing it, but started minimized and not shown in taskbar does not work either:</p> <pre><code>if (!DebugMode) { form.Show(); form.WindowState = FormWindowState.Minimized; form.ShowInTaskbar = false; } </code></pre> <p>Am I missing something really obvious here, or is it not possible to close processes minimized to tray in a graceful way?</p>
c#
[0]
547,866
547,867
check terminal if open
<p>I am using Ubuntu right now and I am able to open a terminal through Java code. But my problem is that when I close my program after the terminal has been opened, I will see a message saying that the terminal I opened has been closed?</p> <p>Here is my code for opening the terminal:</p> <pre><code>String command = "gnome-terminal -x bash cd ~/Desktop"; String cmd[] = { "gnome-terminal", "-x", "bash", "-c", "sudo gedit ~/Desktop/wat.txt" }; Runtime rt = Runtime.getRuntime(); Process pr = rt.exec(cmd); </code></pre>
java
[1]
5,438,767
5,438,768
How to hide jquery ui tabs status bar URL
<p>I use the method below to hide the status bar message.</p> <pre><code>&lt;a href="javascript:void(0)" onfocus="blur()" id="test"&gt;TEST&lt;/a&gt; $('#test).click(function(){ ... } </code></pre> <p>How can I hide the tabs status bar URL while i mouseover?</p>
jquery
[5]
5,933,900
5,933,901
Suggestions for a long lasting operation for testing purpose
<p>What operation could I uses that would simulate a relatively costly process</p> <pre><code>public void SimulateLongProcess() { //Do Something that takes a few seconds to perform on a quadcode CPU } </code></pre> <p>I want to avoid any thread waiting or so, neither involve IO. Some Math operation could do...</p>
c#
[0]
5,974,745
5,974,746
What function do i use to run code when ASP.NET starts up?
<p>I want to run some basic checks when my ASP.NET server goes up. Mostly simple things like does the db exist, am i missing any bins, etc. What function do i use to call my code?</p>
asp.net
[9]
309,727
309,728
inserting and retrieving audio and video from database
<p>I did a small web application in which i have made use of windows media player dll. To play the audio and video file and i have uploaded audio and video by creating a folder in the application. </p> <p>And the media player which i have used is only possible to play audio and video if we give the path directly like</p> <p>MediaPlayer1.FileName="C:\Waka.wav";</p> <p>so please help me how to insert and retrieve audio and video in database and in a player. </p>
c#
[0]
4,864,447
4,864,448
One method for several buttons?
<p>Instead of have to call separate method for each button, would it be possible to just use one method and check which button it was that was clicked by it's id?</p> <p>I'm using the simple way like <code>android:onClick="activateButtons"</code></p> <pre><code>public void activateButtons(View v) { if(?? == btn_1) { Code for button with ID = btn_1 } if(?? == btn_1) { Code for button with ID = btn_2 } } </code></pre>
android
[4]