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 |
---|---|---|---|---|---|
5,403,232 | 5,403,233 | CodeIgniter Standards for Coding | <p>I just want to ask if is it okay that I use native PHP language?</p>
<p>Example:</p>
<pre><code>public function updatePost(){
if(!empty($_POST['name'])){
return true;
}else{
return false;
}
}
</code></pre>
<p>CodeIgniter:</p>
<pre><code>public function updatePost{
$this->form_validation->set_rules("name","Name","trim|required");
if($this->form_validation->run()==false){
return false;
}else{
return true;
}
}
</code></pre>
<p>Thanks in advance!</p>
| php | [2] |
3,023,123 | 3,023,124 | Javascript: Remove Child when using document.write | <p>I want to have something like this:</p>
<pre><code>var abc1 = document.write('<html>HTMLPAGECONTENTHERE</html>');
function removepage(){
abc1.parentNode.removeChild(abc1);
}
removepage();
</code></pre>
| javascript | [3] |
507,734 | 507,735 | Fast incrementation when clicking a button | <p>How would I go about implementing a fast incrementation when I hold on a button in an Android Activity. So for example when I hold on a button, a number that I have already set in an EditText increases at a fast pace.</p>
<p>Your help would be most appreciated.</p>
| android | [4] |
2,826,071 | 2,826,072 | Changing private method/variables to public using setters and getters | <p>How do I change private variables from superclass to public so they can be inherited by the subclass? I've tried <code>public void setDetails</code>, but didnt work.</p>
| java | [1] |
886,910 | 886,911 | How to ensure exception safety in c++? | <p>In a highly secure system, how to ensure exception safety?</p>
| c++ | [6] |
1,217,598 | 1,217,599 | Best way to check that a variable is only an integer in JavaScript | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3885817/how-to-check-if-a-number-is-float-or-integer">How to check if a number is float or integer?</a> </p>
</blockquote>
<p>What is the bet way to check that a variable is an integer?</p>
<p>in Python you can do:</p>
<pre><code> if type(x) == int
</code></pre>
<p>Is there an equally elegant equivalent in JS?</p>
| javascript | [3] |
3,199,807 | 3,199,808 | Access Static member | <p>I know that we can access Static member just with class name like this</p>
<pre><code>Myclass.MyStaticMember
</code></pre>
<p>and no need to initialize this</p>
<p>but my question is why we cant access Static member from initialize object</p>
<pre><code>Myclass.MyStaticMember obj =new Myclass.MyStaticMember()
obj.MyStaticMember
</code></pre>
<p>is there related via <code>CLR</code> or .net framework architecture or compiler</p>
| c# | [0] |
5,090,664 | 5,090,665 | How can I choose better Android developing phone? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3513966/developing-an-android-smartphone-app-on-which-devices-would-you-suggest-to-che">Developing an Android smartphone app - on which devices would YOU suggest to check the app?</a> </p>
</blockquote>
<p>This is the first time I ask in Stack overflow.
For some reason I have a chance to get one of these Android phones for testing apps :</p>
<ul>
<li>Samsung Galaxy Nexus</li>
<li>Samsung Galaxy S 2</li>
</ul>
<p>After days searching for information, I see that a good Android developer's phone should be :</p>
<ol>
<li>a "with Google" phone, so it has the most original Android OS, and often get updated OS early among Android phones.</li>
<li>has a stable, or upgradable to, Android 2.3 or nearby on it, since the market of 2.3 is the largest at this time.</li>
</ol>
<p>When it come to the point, an experienced friend of mine say "Yes" with S2, though I love Nexus more... But still I can't decide on which one I should take, since there's something not clearly :</p>
<ul>
<li><p>If choosing S2, will the theme "Touch Wiz 4.0" on S2 affect my testing and debugging process later ?</p></li>
<li><p>If choosing Nexus, can I safely, easily downgrade the Ice Scream Sandwich (4.0) to Ginger Bread (2.3) ?</p></li>
</ul>
<p>So... can you help me deciding this ?
It would be great if you explain your reason, too. Thank you ^^</p>
| android | [4] |
1,192,703 | 1,192,704 | C# database retrieval | <p>Again I can't get the answer for my query. I have written the code to retrieve the data from the database and load it into a textbox by selecting the dropdown list. If I have selected my data in dropdown list it will not give the answer exactly, instead it'll show selected index 0. I mean it'll show "-Select-". there is nothing done into the textbox. I have checked my asp page for OnSelectedIndex and AutoPostBack=True. Please correct me..
Here is my code:</p>
<pre><code>//This is for retrieval of data to dropdown list.
public void engi()
{
DropDownList1.Items.Clear();
ListItem l = new ListItem();
l.Text = "-Select-";
DropDownList1.Items.Add(l);
DropDownList1.SelectedIndex = 0;
Conhr.Open();
SqlCommand cmd = new SqlCommand("select EmployeeName from tbl_EmploeeDetails where Designation like('%Engineer') ", Conhr);
//SqlCommand cmd=new SqlCommand("select Sitecode from MRsite where Sitealiasname in (select Componetcode from tbl_Component where Sitecode='" + TextBox1.Text.Trim() + "'");
SqlDataReader dr;
dr = cmd.ExecuteReader();
while (dr.Read())
{
ListItem n = new ListItem();
n.Text = dr["EmployeeName"].ToString().Trim();
DropDownList1.Items.Add(n);
}
dr.Close();
Conhr.Close();
}
//This is for retrieval data for text box by selecting DropDown List
public void des()
{
Conhr.Open();
string s3;
s3 = "select Designation from tbl_EmploeeDetails where EmployeeName='" + DropDownList1.SelectedItem.Text + "'";
SqlCommand c3 = new SqlCommand(s3, Conhr);
SqlDataReader d3;
d3 = c3.ExecuteReader();
while (d3.Read())
{
TextBox1.Text = d3["Designation"].ToString().Trim();
}
d3.Close();
Conhr.Close();
}
//Called the method for data retrieval for Textbox
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
des();
}
</code></pre>
| c# | [0] |
5,294,631 | 5,294,632 | Should I use Android programming books before Android training? | <p>Is it advisable to start first from android pdf books instead of the developers website because the developer.android.com Android training because they seem to go way too fast for me to comprehend and I have java knowledge</p>
| android | [4] |
2,514,304 | 2,514,305 | How many elements will be in the array? | <pre><code>char a [] = "EFG\r\n" ;
</code></pre>
<p>How many elements will be in the array created by the declaration above? </p>
| c++ | [6] |
1,704,730 | 1,704,731 | Motion detection using iPhone | <p>I saw at least 6 apps in AppStore that take photos when detect motion (i.e. a kind of Spy stuff). Does anybody know what is a general way to do such thing using iPhone SDK? </p>
<p>I guess their apps take photos each X seconds and compare current image with previous to determine if there any difference (read "motion"). Any better ideas? </p>
<p>Thank you!</p>
| iphone | [8] |
974,919 | 974,920 | JQuery Animation overshooting | <p>Example: <a href="http://wispinternet.com/glencoe/" rel="nofollow">http://wispinternet.com/glencoe/</a></p>
<p>When the page is first loaded, the first time you mouse over one of the tabs in the top right, the tab moves out further than intended, then moves back to the intended position. After that, it works as intended.</p>
<p>Not sure what's causing this, as it all looks ok. I tried changing the easing style to linear, but it has no effect. I'm no JQuery expert, although I guess it could be a problem with my CSS.</p>
<p>Apologies if viewing the source shows the HTML inline, seems to be a bug with Dreamweaver.</p>
| jquery | [5] |
3,956,010 | 3,956,011 | WorkflowApplication generate unhandle exception in ASP.NET | <p>am using simple persistence workflow application in ASP.NET when i try start workflow using
WorkflowApplication invoker the .NET framework generate unhandled exception.</p>
<p>the exception is:</p>
<pre><code>Type 'VacationRequestWorkflow.VacationRequestModel' in Assembly 'VacationRequestWorkflow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=84fad1a74027a4c8' is not marked as serializable.
</code></pre>
<p>i used</p>
<pre><code>ActivityXamlServices.Load(
ActivityXamlServices.CreateReader(
new XamlXmlReader("*XAML path*",
new XamlXmlReaderSettings { LocalAssembly = Assembly.GetExecutingAssembly() })));
</code></pre>
<p>to resolve this issue but didn't work.</p>
<p>please advice.</p>
| asp.net | [9] |
5,173,815 | 5,173,816 | Android source compilation issue | <p>While compiling source code I am using android support v13 jar file. In <code>Android.mk</code> I have given like,</p>
<pre><code>LOCAL_STATIC_JAVA_LIBRARIES := libnetty
include $(BUILD_PACKAGE)
include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := libnetty:lib/android-support-v13.jar
include $(BUILD_MULTI_PREBUILT)
</code></pre>
<p>while using <code>make -j4</code> I am getting </p>
<p>below error</p>
<pre><code>Warning: android.support.v13.app.FragmentStatePagerAdapter: can't find referenced class android.app.Fragment
Warning: android.support.v13.app.FragmentStatePagerAdapter: can't find referenced class android.app.Fragment$SavedState
Warning: android.support.v13.app.FragmentStatePagerAdapter: can't find referenced class android.app.Fragment
Warning: android.support.v13.app.FragmentStatePagerAdapter: can't find referenced class android.app.Fragment
target Java: CtsJniTestCases (out/target/common/obj/APPS/CtsJniTestCases_intermediates/classes)
Warning: there were 48 unresolved references to classes or interfaces.
You may need to specify additional library jars (using '-libraryjars'),
or perhaps the '-dontskipnonpubliclibraryclasses' option.
Warning: there were 3 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile them and try again.
Alternatively, you may have to specify the options
'-dontskipnonpubliclibraryclasses' and/or
'-dontskipnonpubliclibraryclassmembers'.
</code></pre>
<p>Please help to solve this problem.</p>
| android | [4] |
1,295,173 | 1,295,174 | UINib not found when iOS target is 3.1.3 | <p>Hi
I am using SDK 4.1 to build an iPhone app and I set the target OS to 3.1.3.
When I install the app on devices running iOS4.1. everything goes smoothly.
When I try to run the app on devices running 3.1.3 I get the stacktrace below.</p>
<pre><code>dyld: Symbol not found: _OBJC_CLASS_$_UINib
Referenced from: /var/mobile/Applications/BDD67A1E-9B40-43E7-A012-7D92036B2E24/ThisIsMy.app/ThisIsMy
Expected in: /System/Library/Frameworks/UIKit.framework/UIKit
in /var/mobile/Applications/BDD67A1E-9B40-43E7-A012-7D92036B2E24/ThisIsMy.app/ThisIsMy
</code></pre>
<p>My guess is that it's because UINib was only added to the SDK in 4.0. </p>
<p>What I would like to know is how you mitigate this problem. What should I do to support 3.1.3?</p>
<p>Cheers..</p>
| iphone | [8] |
4,058,988 | 4,058,989 | prevAll() TD in a table | <p>How can I count the total of TD elements before a specific TD ?</p>
<pre><code>var eq = $('td.input.current').prevAll('td.input').length;
</code></pre>
<p>eq is the position of the TD that have the class current but this position is relative to his containing TR, in other word prevAll() is only usefull for the TD brothers but not cousins =/</p>
| jquery | [5] |
4,889,092 | 4,889,093 | App where users can send images to each other | <p>I am thinking about making an android app in which you can send pictures to your contacts (grabbed from you address book). Sort of what the app WhatsApp does.
I was wondering, how is something like that achieved? I mean what would be the general design for it?</p>
<p>Any help/tip is appreciated</p>
<p>Thank you</p>
<p>EDIT: As a clarification, I am not looking for general answer of how to do this app from A to Z. I want to know specifically of the design architecture in terms how to link to users together using phone number. Would I have a server that stores all phone numbers of my users? Or is there som android functionality that can piggy back on phone number </p>
| android | [4] |
3,715,679 | 3,715,680 | How to convert a String into an SortedMap<String,SortedMap<String,Object>>? | <p>I have a situation were I want to convert a string into an <code>SortedMap<String,SortedMap<String,Object>></code>. In my string can have an number of word which I want to be added into an sorted Map.</p>
<pre><code>String s2="{ age={}, city={City=1.4054651}, phoneno={}, zip={Zip=0.30685282}, name={}}";
</code></pre>
<p>please help me.</p>
| java | [1] |
2,147,075 | 2,147,076 | set the activity in android according to different screens types in android | <p>Hello i have created an activity in XML code in android for 3.7 In WVGA(Nexus One)screen. Now when i tried to see it in different layouts the activity appears different in different screens.I want to adjust it in that manner that it will look same in all screens.</p>
| android | [4] |
287,696 | 287,697 | Why does ASP.NET create an array called Page_validators when I submit my form? | <p>Why has ASP.NET added this JavaScript code, that is run on form submission?</p>
<pre><code>var Page_Validators = new Array(document.getElementById("rfvOthers"));
</code></pre>
| asp.net | [9] |
1,367,198 | 1,367,199 | get full client details in client | <p>I want to get full details of a client who visits my site. I know I can get his/her ip by $_SERVER but I want to know where exactly his/her ip is reserved by. For example, I want to know which university visited my website. I used <a href="http://www.geobytes.com/IpLocator.htm" rel="nofollow">http://www.geobytes.com/IpLocator.htm</a> but it just tells city, country and another things but it doesn't show what I need.
Thanx</p>
| php | [2] |
68,959 | 68,960 | How to pick contacts only from google contacts (not facebook etc) with phone numbers? | <p>I need to fix a bug in an old app of mine. Part of the bug is how I select contacts. Here is what I need:</p>
<ol>
<li>The contact must be from the
'normal' google contacts list, i.e.
I don't want to get any contacts
from facebook or similar.</li>
<li>The contact must have at least one phone number.</li>
<li>The contact must be from the old <code>android.provider.Contacts</code> provider.</li>
<li>If I can use an Intent to fetch the contact URI without having to create the selection list etc myself, then that is a bonus.</li>
</ol>
<p>Sounds simple, but I am really struggling. This is what I am trying:</p>
<pre><code>@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent(Intent.ACTION_PICK, Contacts.People.CONTENT_URI);
startActivityForResult(intent, PICK_CONTACT_REQUEST);
}
</code></pre>
<p>That works OK. I still see contacts without phone numbers, but I can live with that. Worse though is that I still see facebook contacts in the list! This seems to be in contradiction to the following quote found at the <a href="http://developer.android.com/reference/android/provider/Contacts.html">Froyo API for the deprecated Contacts content provider</a>:</p>
<blockquote>
<p>The APIs have been superseded by ContactsContract. The newer APIs allow access multiple accounts and support aggregation of similar contacts. These APIs continue to work but will only return data for the first Google account created, which matches the original behavior. </p>
</blockquote>
<p>That sounds like exactly what I wanted, but alas, not what I got. </p>
<p>Finally, here are my concrete questions that I hope someone can answer:</p>
<ol>
<li>Why am I seeing Facebook contacts when using the android.provider.Contacts content provider?</li>
<li>If this doesn't work, how else can I get the user to select a google contact with a phone number?</li>
</ol>
<p>Many thanks.
Gustav</p>
| android | [4] |
2,331,935 | 2,331,936 | jQuery image rotator plugin | <p>I am looking for a suggestion on which jquery plugin will achieve what I want. </p>
<p>Basically I want to have 5 images on the page which change (fade in/out) automatically and when clicked on the image it goes to a page relative to the image. </p>
<p>For example: <a href="http://www.lorigrahamdesign.com/index.php" rel="nofollow">http://www.lorigrahamdesign.com/index.php</a>?</p>
<p>In the page above there are images that fade/in/out automatically and there is a difference of some time so the transition looks good.</p>
<p>What is the best way to achieve this using jquery?</p>
| jquery | [5] |
4,465,041 | 4,465,042 | Get lat,long points on a line | <p>How could you get the lat,long of <strong>four points</strong>(equal distance apart) on a line from 27,-82 to 28,-81?</p>
<p><em>*EDIT after close</em>* Got better help from the mathematics exchange. <a href="http://math.stackexchange.com/questions/74647/latitude-and-longitude-of-points-on-a-line/74698#74698">Latitude and longitude of points on a line</a></p>
| php | [2] |
215,712 | 215,713 | Runtime Exception Incorrect Syntax Near '=' | <pre><code><%@ Page Language="C#" AutoEventWireup="true" CodeFile="postreplyadmin.aspx.cs" Inherits="postreplay" MasterPageFile="~/AdminMaster.master" Title="Post-Reply Page"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<%
String postid = Request.QueryString["id"];
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["civilRegDB"].ConnectionString);
con.Open();
String sql = "select * from Forumthread where PostID=" + postid;
SqlDataAdapter da=new SqlDataAdapter(sql,con);
DataSet ds=new DataSet();
da.Fill(ds);
DataRow drow = ds.Tables[0].Rows[0];
String name = drow["Name"].ToString();
String desc = drow["Description"].ToString();
DateTime dt = Convert.ToDateTime(drow["PostDate"].ToString());
String postdate = dt.ToString("dd/MM/yyyy",System.Globalization.CultureInfo.InvariantCulture );
String mailid = drow["Email"].ToString();
%>
</asp:content>
</code></pre>
<p>I'm getting a sqlexception while i'm trying to Reply to post. The error: Incorrect syntax near '='. I've looked around to find other questions similar to mine, but I can't find anything worth to me.</p>
<p>I'm getting Error on "da.fill(ds);". Anyone can help me out on this...:( </p>
| asp.net | [9] |
237,217 | 237,218 | Clear data does not remove getExternalStorageDirectory() | <p>Clear data option from application settings does not remove data from sd card located in getExternalStorageDirectory()
It does compute it size but does not clear!</p>
<p>What I'm doing wrong?</p>
| android | [4] |
5,461,687 | 5,461,688 | jquery select elements in a loop | <p>Currently I have this hidden input in a loop and it works: </p>
<pre><code><input type="hidden" class="md" name="business-222" value="11|55|some name| some address|800-444-8800|somepage.html" />
<input type="hidden" class="results" name="business-222" value="22|77|other name| other address|800-444-8800|otherpage.html" />
$(".results").each(function(){
var text = $(this).attr('value').split('|');
var name = text[2];
...
});
</code></pre>
<p>I was womndering what would be a good way to get the data from this structure below without using hidden elements..</p>
<pre><code><tr>
<td><a href="/somepage.html">some name</a></td>
<td>some address</td>
<td>some phone</td>
</tr>
<tr>
<td><a href="/otherpage.html">other name</a></td>
<td>other address</td>
<td>other phone</td>
</tr>
</code></pre>
<p>I was thinking to make it and somehow select first second third td ?</p>
<p>Thanks !!</p>
| jquery | [5] |
2,934,499 | 2,934,500 | crop a character from an image using java | <p>How can crop and display a character in an image without using mouse?
The image contain only a one charater and nothing else.
Example a scanned copy of a paper, which contain a character drawn on it.</p>
| java | [1] |
5,000,701 | 5,000,702 | Auto-centring Block UI dynamically on a number of multiple resolutions | <p>I'm trying to centre Block UI (http://www.malsup.com/jquery/block/) automatically in the dead centre (vertically and horizontally) on a number of multiple resolutions (from 800x600 to 1280x1024) but with no luck. </p>
<p>I've so far tinkered with this: </p>
<pre><code>css: {
padding: 0,
margin: 0,
top: 'auto',
left: '40%',
width: '30%',
color: '#000',
border: '3px solid #aaa',
backgroundColor:'#fff',
cursor: 'wait'
},
</code></pre>
<p>But I can't get the windows I've created (example at <a href="http://jsfiddle.net/styson/qt9EZ/" rel="nofollow">http://jsfiddle.net/styson/qt9EZ/</a>) with a width of 500px to sit dead centre. </p>
<p>Any suggestions?</p>
| jquery | [5] |
3,308,594 | 3,308,595 | Practical: deployment of application with .sql files | <p>I am developing an application that will make heavy use of .sql files. While I am just at the beginning of development, I want to make sure I am going in the right direction to avoid re-coding later. Much like java source code is not meant for the end user to be seen, neither are .sql files and commands. My main goal is to hide them from the end user. My approach is as follows, and I am seeking alternative approaches and suggestions:</p>
<p>Write a small program that loops through all .sql files in a directory and stores the contents into a java.util.map using bufferedInputStream. The Map will be constructed with = new HashMap(, ). (I believe this is correct syntax). The key will be the .sql file name and value will be the .sql file contents. Then, serialize the Map object into a single file (say "SQLBin.bin") using ObjectOutputStream. Place the SQLBin.bin file into the resources folder of the main project and then use .getResourceAsStream() to access it and recreate a Map object in the main application. This will then allow me to access the SQL commands by simply referring to the .sql file by name in the Map object.</p>
<p>PS: I am relatively new to java. So please be extra clear.</p>
| java | [1] |
3,548,259 | 3,548,260 | Call new JVM from existing JVM | <p>I am writing GUI application, and I want to perform a restart of the application in case the user did some changes.</p>
<p>Currenty I have once main call with the method <code>startGui</code> which initialises the gui.
I want to know how I can call this method again but with a new JVM from the existing JVM.</p>
| java | [1] |
473,222 | 473,223 | non static variable data_in cannot be referenced from a static context | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2559527/non-static-variable-cannot-be-referenced-from-a-static-context-java">non-static variable cannot be referenced from a static context (java)</a> </p>
</blockquote>
<p>i got the above error while compiling the following java code.
i am new to this language and i am not so sure about the code.i can clear normal errors but this one i dont understand what it is.please help me</p>
<pre><code>public class Kari_Server
{
ServerSocket server_socket=new ServerSocket(666);
Socket soc=server_socket.accept();
DataInputStream data_in=new DataInputStream(soc.getInputStream());
DataOutputStreamdata_out=newDataOutputStream(soc.getOutputStream());
int a=1;
int i;
public void screen()throws Exception
{
Robot robo=new Robot();
BufferedImage screen_shot=robo.createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
ImageIO.write(screen_shot,"JPG",new File("C:\\windows\\temp\\screen_shot"+a+".jpg"));
FileInputStream file_in=new FileInputStream("C:\\windows\\temp\\screen_shot"+a+".jpg");
byte[] mybyte=new byte[1024];
try
{
while((i=file_in.read(mybyte))>-1)
data_out.writeUTF(mybyte,0,i);
}
catch(Exception e) {}
}
public static void main(String args[])throws Exception
{
Kari_Server kari=new Kari_Server();
while(true)
{
String s1=" ";
s1=data_in.readUTF();
if(s1=="attack")
kari.screen();
else
System.exit(0);
}
}
}
</code></pre>
| java | [1] |
4,982,850 | 4,982,851 | Making sure an uploaded file meets requirements | <p>I have a website where I allow users to upload photos. For security purposes, I only want users to be able to upload either a jpeg, gif, or png file type. How would I go about writing these conditions?</p>
<p>What I have so far:</p>
<pre><code>if ($_FILES['media']['size'] != 0 && //tests file type) {
//the file is good, upload the file
}
</code></pre>
<p>Thanks!</p>
| php | [2] |
5,595,867 | 5,595,868 | Apply CSS if date older than today in php file | <p>I have a table in php fed by mysql that displays upcoming events. Would it be possible to apply css to a table cell or row if the date is older than today or maybe if date is today? I would like to maybe colour the row red id date is older than today?</p>
<p>A typical example of my table row which displays the dates is <code><td><abbr class="timeago" title="<?php echo $row_rsEventChase['start_date']; ?>"></abbr></td></code></p>
<p>Any help much appreciated..</p>
| php | [2] |
4,989,822 | 4,989,823 | Getting caller name in JS function | <p>Please help me with below problem.</p>
<pre><code>var test = new Object();
test.testInner = new Object();
test.testInner.main = function ()
{
Hello();
}
function Hello()
{
/**** Question: currently I am getting blank string with below code,
**** Is there any way to get function name as "test.testInner.main" over here? */
console.log(arguments.callee.caller.name);
}
test.testInner.main();
</code></pre>
| javascript | [3] |
380,613 | 380,614 | Android apk genration | <p>Is it possible to generate .apk file from our application?</p>
<p>If yes then please give me some guidance</p>
| android | [4] |
1,718,740 | 1,718,741 | display values in a drop downlists in a form entered from another form in php | <p>An user enters values in an input feild in a form that value should be displayed in a drop down lists in another form and again when enters value in the same input feild of first form then the previous value which is displayed in the drop down list in second form should not be deleted.Both values should be there in the drop downlist of second table.</p>
| php | [2] |
4,743,334 | 4,743,335 | How to retain all instances of of a single subclass from a general ArrayList | <p>I'm having a problem and I can't figure out a clean solution.</p>
<p>I have this superclass "Creature" with subclasses "Human" and "Zombie"
I have constructed a series of humans and zombies and saved them in an ArrayList
Now I want to get the subArrayList that only contains the constructed humans.
I thought I could use the "retainAll" but it turns out it doesn't do what I thought it would do.</p>
<p>Any suggestions how to create a new ArrayList with only the objects of subclass Zombie in it?</p>
| java | [1] |
3,363,063 | 3,363,064 | How to use new API elements like Switch so, that the app is compatible with older Android version? | <p>I want to use new UI elements like Switch for new Android devices, and by older devices I would use something else like Button.</p>
<p>I have created to layouts</p>
<pre><code>~/res/
layout/main.xml
layout-v14/main.xml
</code></pre>
<p>that has different elements like Button in <code>layout/main.xml</code> and Switch in <code>layout-v14/main.xml</code></p>
<p>But how can I add different elements in the Activity, without to get Exception like</p>
<pre><code>Could not find class 'android.widget.Switch' ...
</code></pre>
| android | [4] |
3,091,749 | 3,091,750 | Shouldn't else be indented in the below code | <p>In the <a href="http://docs.python.org/tutorial/controlflow.html#break-and-continue-statements-and-else-clauses-on-loops" rel="nofollow">python tutorial</a> is an example (copied below), shouldn't <code>else</code> be indented? I ran the code and it didn't work but I indented it (<code>else</code>) and it worked. Is, what I am saying right? If the documentation is wrong, then how do I report it as a bug to python doc guys?</p>
<pre><code>>>> for n in range(2, 10):
... for x in range(2, n):
... if n % x == 0:
... print n, 'equals', x, '*', n/x
... break
... else:
... # loop fell through without finding a factor
... print n, 'is a prime number'
...
</code></pre>
| python | [7] |
5,294,909 | 5,294,910 | how to parse the image which is in very big size? | <p>i am using json parsing in my url a very big size images are there and i want get those images but not downloaded .....can any body help me to get those images
my code is as follows<code>enter code here</code></p>
<p>public class Image extends Activity{</p>
<pre><code>String imageBaseDirectory = "http://www.dha.com.tr/newpics/news/";
Bitmap bit;
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.image);
ImageView img=(ImageView)findViewById(R.id.ImageView01);
img.setImageBitmap(convertImage(imageBaseDirectory));
}
</code></pre>
<p>public Bitmap convertImage(String s)
{</p>
<pre><code> URL aURL = null;
try
{
final String imageUrl =s.replaceAll(" ","%20");
Log.e("Image Url",imageUrl);
aURL = new URL(imageUrl);
URLConnection conn = aURL.openConnection();
InputStream is = conn.getInputStream();
//@SuppressWarnings("unused")
BufferedInputStream bis = new BufferedInputStream(is);
Bitmap bm = BitmapFactory.decodeStream(new PatchInputStream(bis));
if(bm==null){}
else
bit=Bitmap.createScaledBitmap(bm,60, 60, true);
return bit;
}
catch(Exception e)
{
e.printStackTrace();
return null;
}
}
</code></pre>
| android | [4] |
13,067 | 13,068 | Change the width of area, in which the browser shows the title, is it possible? | <p>Let's assume i have a <code>a</code> tag with title attribute</p>
<p><code><a title="some text here"></code>;</p>
<p>is it possible to change the width of area, in which the title shown?</p>
<p>Thanks much</p>
| jquery | [5] |
6,000,421 | 6,000,422 | reinterpret signed long as unsigned in Python | <p>A 64-bit number is unpacked by <a href="http://msgpack.org/" rel="nofollow">msgpack</a> as signed; how can I reinterpret it as unsigned?</p>
| python | [7] |
1,542,199 | 1,542,200 | Do you consider foreach((array)$foo as $bar) a code smell? | <p>Do you consider this a code smell?</p>
<pre><code>foreach((array)$foo as $bar)
{
$bar->doStuff();
}
</code></pre>
<p>Should i use that instead?</p>
<pre><code>if (isset($foo) && is_array($foo))
{
foreach($foo as $bar)
{
$bar->doStuff();
}
}
</code></pre>
<p>Any other good practices to cover not set variables and assert an array?</p>
| php | [2] |
2,946,693 | 2,946,694 | PHP Read CSV and filter by date | <p>I have the following CSV</p>
<pre><code>Date,Event,Description
24/01/2010,Football,Football practice for all Years.
24/01/2010,Cricket,Cricket Practice for all Years.
25/01/2010,Piano Lessons,Paino lessons for Year 10.
</code></pre>
<p><code>Date, Event and Description</code> are the headers that I want to filter by.</p>
<p>I'm getting todays date and then I want to read the CSV and output the event/s that match todays date. I also want to get tomorrows events as well.</p>
| php | [2] |
3,149,293 | 3,149,294 | Add icon before the preference | <p>I'm doing a android app. I want to add icon before the preference. I want to add icon before the title of the inner preferencescreen, checkboxpreference,... like icon|title
Thank you for your help.
like that picture:</p>
<p><a href="http://2.bp.blogspot.com/_bbZoRtK3YH8/S0QbkvWxSiI/AAAAAAAAAwI/jU9vRI50ZDw/s320/Top+Android+App+Quick+Settings+Dialogue+View.png" rel="nofollow">Top Android App: Quick Settings Dialogue View</a></p>
| android | [4] |
2,259,042 | 2,259,043 | How to Filter specific values against specific words from text file and store it in list? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/5341764/how-to-filter-specific-values-against-specific-words-from-text-file-and-store-it">How to Filter specific values against specific words from text file and store it in list ?</a> </p>
</blockquote>
<p>i want to take out the words to one string which are one space after my given word in textfile.kindly tell me how to do it</p>
| python | [7] |
1,373,192 | 1,373,193 | I have one java problem for moving files one by one by name | <p>I would like to copy my image file by name From <code>E:\Tejas\FM_Operations\source</code> to <code>E:\Tejas\FM_Operations\destination</code> in a such way that if I call the <code>MovePhoto(source,destination,filename)</code> method, then my image will copied to the destination folder in Java.</p>
| java | [1] |
1,479,593 | 1,479,594 | Android - display Mocean advertisements | <p>I am using the <a href="http://developer.moceanmobile.com/Mocean_Ad_Request_API" rel="nofollow">Mocean Ad request API</a> in my Android application, but it doesn't show the advertisement.</p>
<p>I have referenced the sample example given by the <a href="http://developer.mojiva.com/Mojiva_SDKs" rel="nofollow">Mojiva SDK</a>. I have set the site id and zone id which I get after registering my application on the Mojiva site.</p>
| android | [4] |
4,601,596 | 4,601,597 | Clearing vector of vector elements | <p>I've a piece of code that needs to define <code>vector</code> of vectors. I use them in a loop ad populate it each time, the snippet looks like:</p>
<pre><code>vector < vector<T> > buckets;
for ( i = 0 -> N) {
buckets.clear();
....
}
</code></pre>
<p>My question is even after performing <code>.clear()</code> operation on <code>bucket</code>, on next iteration I see old values being present, is this usual?</p>
<p>Thanks in advance!</p>
| c++ | [6] |
893,584 | 893,585 | How to inherit a constructor from a sub class | <p>I am writing an abstract base class. I want all the classes that inherit from it to inherit a constructor that basically does the same things for all the classes. Is this possible?</p>
| c# | [0] |
4,055,569 | 4,055,570 | Problems with android GridView | <p>I am trying to display 2 columns of text in a GridView in android. I create a TextView for each cell of the grid. Everything seems to work well until the TextView tries to wrap the text to a second (or more) line. When this happens, sometimes the second line of text overwrites the next cell, rather than causing the cell to expand to fit the text. All I have to do to get the text to display properly is click one of the cells in the grid. This seems to cause the grid to repaint and then everything gets displayed properly. I have tried any number of things to fix this problem but nothing seems to help.</p>
<p>Is there some property that I have to set on the TextView or the GridView to allow the cells to expand to fit the text? Or is this just a glitch in GridView that I have to live with?</p>
<p>BTW, setting android:singleLine="true" prevents the word wrap and solves the problem but it isn't an ideal solution because I really don't want the text to be truncated.</p>
| android | [4] |
55,311 | 55,312 | ListView with tow Buttons | <p>Hello I am trying to make a listView with tow buttons on each row.I have an adapter where the buttons and the rest views of my list are declared. My problem is that I can not fire the buttons from my main activity.I thought the code below should work but it didn't.</p>
<pre><code> public class Zmenu extends Activity {
final EfficientAdapter Myadapter=new EfficientAdapter(this);
final ListView l1 = (ListView) findViewById(R.id.ListView01);
l1.setAdapter(Myadapter);
l1.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
switch(arg1.getId()) {
case R.id.Button1 :
//do this block
break;
case R.id.Button2 :
//do this block
break;
}
}});
}
</code></pre>
<p>Can anyone helps me on what I am doing wrong in how could I fire the key listener in my main activity?</p>
| android | [4] |
3,262,279 | 3,262,280 | Display Route On map according to current location | <p>I m facing a problem in android ,I m searching from last many days but yet did not get any appropriate answer I want show my current location on Google maps and drop First pin on current location using GPS and After That draw path on Google maps according to as Person moves to any direction and 2nd pin moves on maps with person, I see many on answer on stack overflow but all the answer almost same and just draw straight line between two geo points
You can check apk File on this link I need like this </p>
<p><a href="https://code.google.com/p/open-gpstracker/downloads/list" rel="nofollow">https://code.google.com/p/open-gpstracker/downloads/list</a></p>
| android | [4] |
5,243,288 | 5,243,289 | jQuery get below element | <p>I need to retrieve the element with specific class which is placed below in DOM. For example:</p>
<pre><code><div>
<a onclick="someMethod(this)">
</div>
<div class="specificClass">
</div>
</code></pre>
<p>In someMethod I have the anchor but need to retrieve the first element with class "specificClass" which is placed below.</p>
<p><strong>Update.</strong> The position of <code><div class="specificClass"></code> is not specified. The only thing I know - it is placed below</p>
| jquery | [5] |
665,643 | 665,644 | matrix data in python | <p>I was trying to progressively subtract values of a 3D matrix. The matrix looks like:</p>
<pre><code>ATOM 1223 ZX SOD A 11 2.11 -1.33 12.33
ATOM 1224 ZY SOD A 11 -2.99 -2.92 20.22
ATOM 1225 XH HEL A 12 -3.67 9.55 21.54
ATOM 1226 SS ARG A 13 -6.55 -3.09 42.11
...
</code></pre>
<p>here the last three columns are representing values for axes x,y,z respectively.
now I what I wanted to do is, take the values of x,y,z for 1st line and subtract with 2nd,3rd,4th line in a iterative way and print the values for each axes.
I was using:</p>
<pre><code>for line in map(str.split,inp):
x = line[-3]
y = line[-2]
z = line[-1]
</code></pre>
<p>for separating the values, but how to do in iterative way. should I do it by using <code>Counter</code>.<br>
Expected output:<br>
for line1 vs line2: <code>5.1 1.59 -7.89</code><br>
for line1 vs line3: <code>5.78 -10.88 -9.21</code><br>
...so on.</p>
| python | [7] |
3,997,910 | 3,997,911 | Nexus 7 - mysterious blank search screen when orientation change | <p>When finishing an activity (landscape), going back to another activity (portrait), the below screen appears. Why? There is no error message. </p>
<p><img src="http://i.stack.imgur.com/fya1J.jpg" alt="mysterious search screen"></p>
| android | [4] |
4,276,129 | 4,276,130 | PHP scripts to calculate technical indicators | <p>I am tasked to write a web application that can plot stock charts, with technical analysis like exponential moving averages, RSI etc. Plotting charts is not an issue. The issue is generating all those complex technical indicators.</p>
<p>Does anyone know if there is any library, free or paid, available that provides PHP scripts to calculate a host of technical indicators?</p>
| php | [2] |
430,889 | 430,890 | How to get to apple iphone discussion forums? | <p>I logged into my account and is reaching this page.
<a href="http://developer.apple.com/devforums/" rel="nofollow">http://developer.apple.com/devforums/</a>
After that when i click login and give the details, it redirects to the same page.
Where can I see the discussions and post questions? </p>
<p>I know its a simple question but dont know what I am missing here.</p>
| iphone | [8] |
5,955,206 | 5,955,207 | How do you create optional arguments in php? | <p>In the php manual they describe functions like so: </p>
<p>string <strong>date</strong> ( string $format [, int $timestamp ] )</p>
<p>How would this function look when you define it?</p>
| php | [2] |
2,026,907 | 2,026,908 | Protecting my website from being "included"? | <p>I have a website that provides whois information.
How can I prevent that other websites use that information as a service? (using includes, string manipulation or whatever)</p>
<p>And if this is not possible, how can I tell which websites are using/including that information?</p>
| php | [2] |
4,103,842 | 4,103,843 | Java hashcode: Object vs composite | <p>I've stumbled on this method in some code whose only purpose is to create a String <code>Key</code> for a <code>HashMap</code> (EDIT: In my case all of X, Y and Z will be numeric, consider them co-ordinates if that makes it easier):</p>
<pre><code>protected String createMappingKey(String x, String y, String z) {
return x+":"+y+":"+z;
}
</code></pre>
<p>Something about this code is not sitting right and I think it would be better to be replaced with an object like so (note that this code has been generated by my IDE so you can change the implementation however you'd like):</p>
<pre><code>public static class MyKey {
String x,y,z;
// Constructor(s), maybe getters and setters too here
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MyKey myKey = (MyKey) o;
if (x != null ? !x.equals(myKey.x) : myKey.x != null) return false;
if (y != null ? !y.equals(myKey.y) : myKey.y != null) return false;
if (z != null ? !z.equals(myKey.z) : myKey.z != null) return false;
return true;
}
@Override
public int hashCode() {
int result = x != null ? x.hashCode() : 0;
result = 31 * result + (y != null ? y.hashCode() : 0);
result = 31 * result + (z != null ? z.hashCode() : 0);
return result;
}
}
</code></pre>
<p>But this seems like an awful lot of code for not a lot of value. I'm pretty sure there will only be a negligible difference in the number of collisions between these two approaches.</p>
<p>Which of these approaches would you prefer and why? Is there a better approach that I'm missing? </p>
<p>If one of these approaches will have a significant number of collisions more than the other then that would also interest me and I'll open a separate question to deal with that. </p>
| java | [1] |
796,426 | 796,427 | option[selected=true] doesn't work | <p>I have this command (visibleSelect is jquery variable that holds multiple select list):</p>
<pre><code>var selectedOption = visibleSelect.find('option[selected=true]');
</code></pre>
<p>From the watch window I can see that <code>selectedOption.length</code> is 0, but <code>visibleSelect.get(0)[1].selected</code> is <code>true</code>.</p>
<p>Why <code>selectedOption</code> doesn't containt the selected option? What is wrong?</p>
| jquery | [5] |
5,663,232 | 5,663,233 | prime_factorize(1) -> ? (Pythonic error signalling) | <p>I have a <code>prime_factorize</code> function that returns a dictionary mapping from prime divisors to their powers. E.g., 50 = 2^1 * 5^2, so <code>prime_factorize(50)</code> returns <code>{2 : 1, 5 : 2}</code>. </p>
<p>Assuming this is the documented behavior, what would be the least surprising way to signal an error if called 0, 1, or a negative number? Throw <code>ValueError</code>? Return something that looks like correct output (e.g., <code>prime_factorize(-5) -> {-1: 1, 5: 1}</code>)? return an empty dict?</p>
<p><sub>And if you have a better format for returning a prime factorization, I'd love to hear that too.</sub></p>
| python | [7] |
5,563,890 | 5,563,891 | How to put appwidget-provider declaration for android widget | <p>I am studying android's sample Wiktonary in how to create a widget for android.</p>
<p>My questions is why it puts</p>
<pre><code><appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="146dip"
android:minHeight="72dip"
android:updatePeriodMillis="86400000"
android:initialLayout="@layout/widget_message" />
</code></pre>
<p>in a file called wdiget_word.xml under res/xml? Instead of putting it under AndroidManifest file?</p>
| android | [4] |
2,274,220 | 2,274,221 | Android listview position and click event handle problem | <p>I have shown a dynamic listview in my Screen. In listview there are two buttons in eack row. I want to handle click event on both button. I have 50-60 rows in my listview. now when i clicked on any of the row's button it will take the position of very first row of listview. so my problem is that i have to get perfect position of clicked row. i used baseadapter but i can only able to handle one click event on each row.</p>
<p>so give some hint about this problem.</p>
| android | [4] |
1,473,021 | 1,473,022 | How to change policy file for applet printing | <p>Printing is not supported in Java applets by default. How can I change the java.policy file for applet printing? I want to print from the applet. </p>
<p>Also, this method returns NULL for me:</p>
<pre><code>PrintServiceLookup.lookupDefaultPrintService()
</code></pre>
<p>Please provide references and sample code.</p>
| java | [1] |
5,291,901 | 5,291,902 | How do I download the Honeycomb SDK preview? | <p>I keep getting a "File not found" error in the SDK Manager when I try to download the SDK Preview for Honeycomb. Same thing happens with both http and https. Any advice?</p>
<p>Thanks in advance!</p>
| android | [4] |
4,278,720 | 4,278,721 | How to parse a resume using c# | <p>HOW to parse a doc resume using c#. I want to fetch records like name,address,skills,mobile no from a resume into a textbox.</p>
| asp.net | [9] |
5,377,927 | 5,377,928 | Are the bundles in android permanent in saving activity states ? | <p>When I want to save some state behavior of the activity, The docs says that we should implement OnSaveInstanceState and OnReceiveInstanceState.</p>
<p>They say that this will save the activity state even after destroy or restarts. I care more about destroy (the activity is completely gone) , does that mean the bundles are considered persistent ? </p>
<p>when I open a pdf reader, clost it and open it again i see that it opens in the same page I was in. is this implemented using Bundles or oth</p>
| android | [4] |
4,214,513 | 4,214,514 | Restrict image size while uploading in jQuery | <p>I want to restrict image size while uploading. Is there any jQuery plugin to check size of uploaded image?</p>
| jquery | [5] |
5,406,704 | 5,406,705 | How to execute "del data.txt" using Process? | <p>The following trivial code is just an example that does not reflect my real scenario.
I have tried it and it did not work. </p>
<p>I want to delete <code>data.txt</code> using <code>Process</code> rather than using <code>File</code> class.</p>
<pre><code>using System;
using System.Diagnostics;
namespace Tester
{
class Program
{
static void Main(string[] args)
{
Process p = new Process();
p.StartInfo.FileName = "cmd";
p.StartInfo.Arguments = "del data.txt";
p.StartInfo.UseShellExecute=false;
p.EnableRaisingEvents = true;
p.Exited += (sender, e) => { Console.WriteLine("Finished"); };
p.Start();
p.WaitForExit();
}
}
}
</code></pre>
<p>How to execute <code>del data.txt</code> using <code>Process</code>?</p>
| c# | [0] |
1,337,533 | 1,337,534 | find images in div except certain child div | <p>Here is the fiddle: <a href="http://jsfiddle.net/Xhqz9/" rel="nofollow">http://jsfiddle.net/Xhqz9/</a></p>
<p>I'm trying to find all images inside <code><div id="primary" /></code> except the images located inside any <code><div class="nohover" /></code>, which is always a child element, and do a hover effect on those images.</p>
<pre><code><div id="primary">
<img src="http://placehold.it/75x75">
<div class="nohover">
<img src="http://placehold.it/75x75">
</div>
<img src="http://placehold.it/75x75">
<div class="nohover">
<img src="http://placehold.it/75x75">
</div>
</div>
</code></pre>
<p>jQuery:</p>
<pre><code>var postImgsRed = $('#primary').find('img');
postImgsRed.each(function() {
$(this).css('border', '1px solid red');
});
var postImgsHover = $("#primary > :not(.nohover)").find("img");
postImgsHover.each(function() {
$(this).hover(function() {
$(this).fadeOut(100);
$(this).fadeIn(500);
})
});
</code></pre>
<p>My hover function is not executing correctly. it won't do the effect on the 1st or 3rd image, as I want to do. What am I doing wrong?</p>
| jquery | [5] |
411,811 | 411,812 | Why is my browser echoing this text backwards? | <p>I have this written in PHP:</p>
<pre><code><?php global $current_user;
get_currentuserinfo();
?>
<div style="float: right; text-align: right;">
<h4>
<?php
if ( is_user_logged_in() ) {
echo 'Welcome: ' . $current_user->user_login;
?>
</h4>
<p>
<?php
echo '<a>My Classes</a> &nbsp;&brvbar;&nbsp; <a>Logout</a>';
} else {
?>
</p>
<h4>
<?php
echo 'Welcome, guest!';
?>
</h4>
<p>
<?php
echo '<a>Login</a> | <a>Register</a>';
}
?>
</p>
</div>
</code></pre>
<p>And my browser is showing this:</p>
<pre><code>Welcome: Admin
| LogoutMy Classes
</code></pre>
<p>Why is that?</p>
| php | [2] |
1,670,067 | 1,670,068 | How is it possible to protect PHP code? | <p>Is it possible to protect PHP code without using a compiled module (.so/.dll)?</p>
<p>What software can help with this?</p>
| php | [2] |
1,457,603 | 1,457,604 | play downloaded Gif image in android | <p>i am downloading GIF image in my app from server . and then i am showing it with ImageView but it is not animated .<br>
is there any other way to play downloaded animated GIF image .
Thanks in advance .</p>
| android | [4] |
645,500 | 645,501 | How do I get rid of this weird gray drop shadow thing on my EditTexts? | <p>I'm not even sure what it's actually called.. but it looks really bad on some devices.</p>
<p><img src="http://i.stack.imgur.com/YZGrJ.png" alt="weird gray thingy"></p>
| android | [4] |
918,022 | 918,023 | Jquery csspie pie.js does not work in IE8? | <p>Trying to get IE8 to work with csspie and its pie.js file.
Does not seem to work that well.</p>
<pre><code> if (window.PIE) {
$('.jspDrag').each(function() { PIE.attach(this); });
}
</code></pre>
<p>It doesn't even start the loop. Making me crazy..</p>
| jquery | [5] |
2,713,711 | 2,713,712 | Does a union always have default value of zero? | <p>Please let us consider following code:</p>
<pre><code>#include <iostream>
using namespace std;
union{
int i;
}u;
int main(){
int k=5;
cout<<k+u.i<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
</code></pre>
<p>This code shows me output 5,what means to me is that,variable i in union structure has default value=0, but the same code on ideone.com shows warning like this</p>
<pre><code>prog.cpp:6: warning: non-local variable ‘<anonymous union> u’ uses anonymous type and then prints 5 as well, and last one core of this problem comes from algorithm calculate
</code></pre>
<p>Reciprocal of the square root and here is code</p>
<pre><code>#include<iostream>
#include<math.h>
using namespace std;
float invsqrt(float x){
float xhalf=0.5f*x;
union{
float x;
int i;
}u;
u.x=x;
u.i=0x5f3759df-(u.i>>1);
x=u.x*(1.5f-xhalf*u.x*u.x);
return x;
}
int main(){
float x=234;
cout<<invsqrt(x)<<endl;
return 0;
}
</code></pre>
<p>It shows me output also,but my question is that is it a this code good?i meant that because int i is not initailized ,can any compiler consider it's value as zero?i am curious and please tell me something about this,also if something is not clear from my question say me,i am not English native speaker.</p>
| c++ | [6] |
4,315,336 | 4,315,337 | login into local FTP server with ip | <p>I am trying to log into a FTP server that I am only running locally in my network. To do this I have to use my ip address to use as the server address (see code below). However each time I get a <strong><em>gaierror: [Errno 11004] getaddrinfo failed</em></strong> error. </p>
<p>Can anyone look at my code and see if I am making any error that may be the cause of this address issue? Also I can log into the ftp server fine from my browser so I know the server is up and running correctly, also anonymous login to the server is allowed .</p>
<pre><code>#import the ftp lib.
from ftplib import FTP
#enter the address of the ftp server to use, use ip address since server is ran locally
ftp = FTP('ftp://192.168.1.130')
#logs into the ftp server
ftp.login()
</code></pre>
| python | [7] |
2,111,831 | 2,111,832 | Does ASIHTTP support multi threads? | <p>Does ASIHTTP support multi thread?
If sure, I hope each thread link to aUIProgressbar, how can I construct the codes?</p>
<p>Thanks</p>
<p>interdev</p>
| iphone | [8] |
1,118,581 | 1,118,582 | unicode problem File.WriteAllText | <p>I have some raw data (xml) which I definately receive containing unicode. I write them to a file using:</p>
<pre><code>File.WriteAllText
</code></pre>
<p>This seems to remove/change unicode characters. Is there a way to prevent this?</p>
<p>Thanks.</p>
<p>Christian</p>
| c# | [0] |
34,719 | 34,720 | Include External Libraries in Packaged Python Application | <p>I have just picked up Python to develop a tool and I am so far really enjoying the language, however have one issue I am not entirely sure how to solve.</p>
<p>I am looking to use a few external libraries in my project, at the moment cherryPy and Cheetah however I am not sure how to package up my application so that these libraries are included. Coming from a .NET world the compiler used to do pretty much everything for me.</p>
<p>Have done a bit of googling but have not been able to find any solution, so I must be missing something fundamental. Is this something I need to configure distutils for? Do I need to copy the libs in to my application folder structure anywhere? Both?</p>
<p>Appreciate any advice please. :)</p>
| python | [7] |
2,901,145 | 2,901,146 | voice classification api for android | <p>I want to develop an android application which interacts with the user using voice. I looked at google's speech to text API at <a href="http://developer.android.com/reference/android/speech/RecognizerIntent.html" rel="nofollow">http://developer.android.com/reference/android/speech/RecognizerIntent.html</a></p>
<p>I could not find anything which provides a classification service.
Recognition is much more difficult than classification.
In my usecase, my app will give user the options(eg: say left or right). So, instead of solving the harder of problem of what recognizing what the user said, I only need to decide whether he/she said left or right. I believe that the currrent state of the art in speech classification can solve the latter binary-classification problem with almost 99% accuracy.</p>
<p>Is their an API which is optimized for classifying voice into few(2-3) classes(words/phrases), rather than full blown recognition?</p>
<p>(I have significant Java/C++/machine learning experience, but no android experience)</p>
<p>(recognition, as described above can also be viewed as classification into infinitely many sentences ; hence it is a harder problem(2 vs countably-infinite classes))</p>
| android | [4] |
5,431,741 | 5,431,742 | convert title into capitalize using java regular expression | <p>I want a regular expression in java to convert title into capitalize while preserving method signature</p>
<p>An example is following</p>
<blockquote>
<p>how to use dispatchEvent(AWTEvent event) method?</p>
</blockquote>
<p>changed to</p>
<blockquote>
<p>How To Use dispatchEvent(AWTEvent event) Method?</p>
</blockquote>
<p>Here the part "dispatchEvent(AWTEvent event)" is not changed.</p>
| java | [1] |
4,041,491 | 4,041,492 | how can i know my application is in not working mode? | <p>i have one application in that i want to know that is this in idle mode ?</p>
<p>how can i know this ?</p>
<p>in my application when it go in idle mode i want to stop one java script. or you can say when no one using application for long time .</p>
| iphone | [8] |
2,548,334 | 2,548,335 | removing dot symbol from a string | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2390789/how-to-replace-all-points-in-a-string-in-javascript">How to replace all points in a string in JavaScript</a> </p>
</blockquote>
<p>I am trying to remove '.'(dot) symbol from my string. and The code that Ive used is </p>
<pre><code>checkedNew = checked.replace('.', "");
</code></pre>
<p>Bt when I try to alert the value of checkedNew, for example if the checkedNew has original value U.S. Marshal, the output that I get is US. Marshal, it will not remove the second dot in that string. How do remove all dot symbols?</p>
| javascript | [3] |
675,637 | 675,638 | Best way to show/hide .NET application using a keyboard shortcut? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/604410/global-keyboard-capture-in-c-application">Global keyboard capture in C# application</a> </p>
</blockquote>
<p>Hi all,</p>
<p>I am making a .NET application (Window Forms) which is written by C# and I get a problem. How to hide my personal .NET application using a keyboard shortcut and then displaying it back from same keyboard shortcut. </p>
<p>Thanks !</p>
| c# | [0] |
831,364 | 831,365 | handling Application_Error in ASP.NET app's global.asax | <p>I wish to send mail to an administrator when the application crashes.
So I simply do this in <code>global.asax</code>:</p>
<pre><code>void Application_error(object sender, EventArgs e)
{
SendMessageToAdministarator(Server.GetLastError().ToString());
}
</code></pre>
<p>But actually many times <code>Application_Error</code> is called even though the application won't crash.</p>
<p>And I wish to send mail to admin ONLY when the application crashed.</p>
<p>Also, do I have a simple way to lift the application back on?</p>
<p>I'm looking for the simplest solution.</p>
| asp.net | [9] |
1,616,281 | 1,616,282 | datepicker-style calculator for text field input | <p>Has anyone got a code for a little icon that I can place in/near text fields if the user wishes to add up some numbers and then have the results populate the text field? </p>
<p>Datepicker is exactly what I am looking for, but a standard calculator should pop up instead of a calendar.</p>
<p>Thanks!</p>
<pre><code> // datepicker
$("#Datepicker").datepicker({
showOn: "button",
buttonImage: "images/datepicker.png",
buttonImageOnly: true,
numberOfMonths: 2,
altField: "#actualDate",
altFormat: "yy-mm-dd"
});
</code></pre>
<p>CSS:</p>
| jquery | [5] |
5,396,067 | 5,396,068 | Image capture and display in activities | <p>I have an activity A. Starting an activity B from A. In activity B, I capture an image with camera present in the device and at the end of that activity come back to Activity A. In this activity have to display the captured image. How to accomplish this task? Running on version 2.3.3...Have had a look here <a href="http://stackoverflow.com/questions/5991319/capture-image-from-camera-and-display-in-activity">Capture Image from Camera and Display in Activity</a> but the same NullPointerException...Running on LG device.</p>
| android | [4] |
427,005 | 427,006 | Java Variable Initialization | <p>Here's a piece of code I wrote.</p>
<pre><code>public class cube {
private int length;
private int breadth;
private int height;
private int volume;
private int density;
private int weight;
public cube(int l,int b,int h, int d) {
length=l;
breadth=b;
height=h;
density=d;
}
public void volmeShow(){
volume=length*breadth*height;
System.out.println("The Volume of the cube is "+this.volume);
</code></pre>
<p>So if I implement the above cube class like this, </p>
<pre><code>public class cubeApp {
public static void main(String[] args){
cube mycube = new cube(5,6,9,2);
mycube.volumeShow();
</code></pre>
<p>I get an output that tells me Volume is 270.</p>
<p>But I get an output that says Volume is 0 if I define the volume variable like this:</p>
<pre><code>public class cube {
private int length;
private int breadth;
private int height;
private int volume=length*breadth*height;
private int density;
private int weight;
public cube(int l,int b,int h, int d) {
length=l;
breadth=b;
height=h;
density=d;
}
public void volmeShow(){
System.out.println("The Volume of the cube is "+this.volume);
</code></pre>
<p>Can somebody please explain why this is happening?</p>
<p>Thanks,
Samuel.</p>
| java | [1] |
1,271,366 | 1,271,367 | What is the best way to start C# for a C, COBOL programmer? | <p><p>I know C,C++,COBOL.
<p>Now I am trying to learn C# and I want to do some hobby projects with C#.
<p>So can you suggest where do I start from.
<p>I searched on google but I want to start from a book which gives me more practice problems for a new comer to .net
<p>Can anybody suggest a great book online which I should really start from?</p>
| c# | [0] |
3,111,124 | 3,111,125 | Count unique digits one liner (efficiently) | <p>I'm searching for a way to count unique digits efficiently with a one liner.</p>
<p>For example: given the integer <code>623562</code>, return value would be <code>4</code>.</p>
<p>My current way of doing it is, given integer <code>i</code>, im using <code>len(set(str(i)))</code>.
Creating a set is time consuming. I'm going over alot of numbers so I need an efficient way.</p>
<p>Also, if someone can find a way to go over all the numbers with <code>x</code> digits without using
<code>range()</code> (and in a one liner..), I'll be glad. Memory limits me when using <code>range</code> because a list is created (I assume).</p>
| python | [7] |
4,574,986 | 4,574,987 | Implementing multiple Interfaces | <p>In interface ONE I have a method <code>A</code> and in interface TWO I have method <code>B</code>. Both the methods are implemented in class <code>Three</code>. Now I assign an instance of Three to ONE, but still can I call method <code>B</code> of SECOND?</p>
<p>Even if this is possbile, is it correct?</p>
| java | [1] |
2,656,242 | 2,656,243 | customized Action bar with layout as background | <p>I have a requirement that I need to display Action bar with home button icon on left side of bar and activity title on middle of the bar with application logo..</p>
<p>So I have designed a layout with these requirements... </p>
<p>I want to set this layout to my element so that I can set it as a theme..</p>
<p>but I am unable to add my layout to my element..</p>
<p>Below is the code..</p>
<pre><code> <style name="Theme.MySherlockCustom" parent="@style/Theme.Sherlock.Light">
<item name="actionBarSize">100dp</item>
<item name="android:windowNoTitle">true</item>
<item name="android:textSize">11sp</item>
</style>
</code></pre>
<p>Please help what can be done to achieve my target.</p>
| android | [4] |
287,407 | 287,408 | android viewPager implementation | <p>My Task is to make clean scroll right to another screen then press on icon and show popup,
I want to use <code>ViewPager</code> to make clean scroll right(swipe) between two pages, and then use <code>Dialog</code> to show the popup,
I couldn't find any working sample on how to implement <code>ViewPager</code> between two layouts,
someone has working sample??<br>
Thanks.
David</p>
| android | [4] |
6,003,763 | 6,003,764 | how to append the following data in a xml tag to get xml file as output? | <pre><code>{
"attrs": {
"width": 578,
"height": 200
},
"nodeType": "Stage",
"children": [
{
"attrs": {},
"nodeType": "Layer",
"children": [
{
"attrs": {
"x": 289,
"y": 100,
"sides": 6,
"radius": 70,
"fill": "red",
"stroke": "black",
"strokeWidth": 4
},
"nodeType": "Shape",
"shapeType": "RegularPolygon"
}
]
}
]
}
</code></pre>
<p>I have parsed the above json data but i dont know how to append the data to xml tag.thanks for any help.I want the xml tags with exact parent and child nodes using jquery.</p>
| jquery | [5] |
27,166 | 27,167 | Easy way of subtracting in javascript to make change | <p>I am using this code for my form</p>
<pre><code>Total: <input name="total" id="total" type="text" readonly="readonly" style="background-color:#eee;" value="<? echo $total; ?>" /><br /><br />
Cash: <input name="cash" id="cash" type="text" /><br /><br />
Change: <input name="change" id="change" type="text" readonly="readonly" style="background-color:#FF0;"/>
</code></pre>
<p>The total comes from php e.g 25.00, i want to be able to put a number e.g 30.00 in cash and then the change says e.g. 5.00 and i want it to change on key up so if i change the amount it re-calculates, </p>
<p>Can anyone help with the JavaScript to make the calculation work,thanks</p>
| javascript | [3] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.