Unnamed: 0
int64 65
6.03M
| Id
int64 66
6.03M
| Title
stringlengths 10
191
| input
stringlengths 23
4.18k
| output
stringclasses 10
values | Tag_Number
stringclasses 10
values |
---|---|---|---|---|---|
4,430,403 | 4,430,404 | 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] |
2,603,417 | 2,603,418 | HttpUrlConnection behaving different in Android 2.3 Gingerbread | <p>I'm stumped here. I've been using the same HttpUrlConnection code to retrieve JSON from my server since Android 1.5. Suddenly, with 2.3 it won't work and I can't understand why.</p>
<p>Here's my code:</p>
<pre><code> try {
HttpURLConnection conn =
(HttpURLConnection)(new URL(Constants.SERVER_URL + path)).openConnection();
conn.setAllowUserInteraction(false); // no user interact [like pop up]
conn.setDoOutput(true); // want to send
conn.setDoInput(true);
conn.setRequestMethod( "POST" );
conn.setRequestProperty( "Content-type", "application/x-www-form-urlencoded" );
conn.setRequestProperty( "Accept", "application/json,text/html,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" );
conn.setRequestProperty( "Accept-Charset", "UTF-8" );
conn.setRequestProperty("Connection", "Keep-Alive");
DataOutputStream pw = new DataOutputStream (conn.getOutputStream());
pw.writeBytes(requestString);
pw.flush();
pw.close();
if (conn.getResponseCode() == 200) {
InputStream in = new BufferedInputStream(conn.getInputStream());
BufferedReader br = new BufferedReader(new InputStreamReader(in));
StringBuffer stringBuffer = new StringBuffer();
while(br.ready()){
stringBuffer.append(br.readLine());
}
br.close();
in.close();
return stringBuffer.toString();
} else {
return badResponse;
}
} catch (Exception ioe) {
return ERROR_MAKING_CONNECTION;
}
</code></pre>
<p>The response comes back with a code of 200, however, when I run conn.getInputStream().available() the result is -1. On every other android api besides 2.3 the conn.getInputStream().available() returns a significant response.</p>
<p>Any ideas?</p>
| android | [4] |
863,735 | 863,736 | Cookies seen by everyone | <p>Ok, so I want to store some user options in $_COOKIES after form submit.
My code is this:
<code></p>
<pre><code> $reason=array_values(array_filter($_POST['reasontext']));
$str=implode('|',$reason);
if(!isset($_COOKIE['reason'])){
setcookie('reason',$str,time()+86400*30*12);
}elseif(isset($_COOKIE['reason2'])){
setcookie("reason", "", time()-3600);
setcookie("reason",$_COOKIE['reason2'],time()+86400*30*12);
setcookie('reason2', "", time()-3600);
}else{
setcookie("reason", "", time()-3600);
setcookie('reason',$str,time()+86400*30*12);
}
</code></pre>
<p></code></p>
<p>Basically, for an array of let`s say: '1'=>'Test1', '2'=>'Test2', '3'=>'Test3'</p>
<p>The select tool should have had 3 options different for each user, depending on what the user submited as $_POST['reasontext'].</p>
<p>Well this isn`t so, <strong>each user can clearly see what the other one has submited and stored in the cookie which should have been Personal</strong>.</p>
<p>What I want is that each cookie 'reason' to be stored on each users computer and from there to load the different user-customised options. </p>
<p>Any tips? </p>
<p>Thanks in advance for the heads up :)</p>
| php | [2] |
570,012 | 570,013 | Python - Google App Engine | <p>I'm just starting learning google app engine.</p>
<p>When I enter the following code below, all I got is "Hello world!"
I think the desired result is "Hello, webapp World!"</p>
<p>What am I missing? I even try copying the google framework folder to live in the same folder as my app.</p>
<p>Thanks.</p>
<pre><code>from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
class MainPage(webapp.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write('Hello, webapp World!')
application = webapp.WSGIApplication(
[('/', MainPage)],
debug=True)
def main():
run_wsgi_app(application)
if __name__ == "__main__":
main()
</code></pre>
| python | [7] |
4,407,009 | 4,407,010 | reference type variable initialisation and storage | <p>Is this legal?</p>
<pre><code>int& foo = 0x00000000;
</code></pre>
<p>I don't know if 'int' is the right data type. If you wanted to store an address what data type would you use? Or do you have to use a pointer?</p>
<p>in addition to this, is this legal?</p>
<pre><code>int foo = 5;
int bar = &foo;
</code></pre>
<p>Essentially what I'm asking is, is there a way of storing addresses without the use of pointers?</p>
| c++ | [6] |
4,901,348 | 4,901,349 | Transformer in apache collection15 | <p>What is the use of the Transformer function in the apache commons collection ?</p>
<p>How do I use it in programs and at what times?</p>
| java | [1] |
3,831,512 | 3,831,513 | whether I should go for a service or handlers? in android | <p>I am creating a app that would fetch data from a website every 2 minutes ..</p>
<p>I need to know whether I can go for a service ?</p>
<p>I tried using handlers and threads but it stops after 3 or 4 hrs I already tried using Async task but it's not working out..</p>
| android | [4] |
2,019,118 | 2,019,119 | Service:which book to refer? | <p>I am learning android service. I was referring to oreillys android development book. It does not have meterial on android service.</p>
<p>Can suggest a book or chapter to understand android service and a good example of service code.</p>
<p>I know see blogs and google. But I want to reference a book on this topic .</p>
| android | [4] |
1,443,996 | 1,443,997 | Getting the weekday for a certain day in the next 6 months | <p>Is it possible to get the weekday of the 21st of the next 6 months in PHP?</p>
<p>For example, say the 21st falls on a Tuesday next month, then I want "Tuesday" to be returned. But I want this for each of the next 6 months. What is the most elegant solution to this?</p>
| php | [2] |
4,386,760 | 4,386,761 | Adding click event to empy span block | <p>I have some html form</p>
<pre><code><div id="1">
<div>
<span class="checkbox" style="background-position: 0pt -34px;"></span>
<input type="checkbox" value="Adelaide" class="styled" name="sidecity" id="sidecity-control-name-0">
<label for="sidecity-control-name-0">Adelaide</label>
</div>
</div>
</code></pre>
<p>How to add click event handler to empty span block ?</p>
| jquery | [5] |
589,515 | 589,516 | Tower of hanoi problem | <p>Hi Guys I am faced with a problem on tower of hanoi:<br>
we are given a stack of cylinders of alternate colors stacked over one another alternately.<br>The job is to separate the two stacks of same colour<br>
I could write the code(algorithm) for a regular tower of hanoi using recursion, but I am not able to figure out this part. Can some one help?<br>
Code for regular hanoi problem:<br></p>
<pre><code>#include<iostream>
using namespace std;
int count=0;
void hanoi(char a,char b,char c,int x)
{
if(x>1)
{
hanoi(a,c,b,x-1);
hanoi(a,b,c,1);
hanoi(c,b,a,x-1);
}
else
{
cout<<"Move a Disk from "<<a<<" to "<<b<<endl; count++;
}
}
int main()
{
int n;
cout<<"Enter the height of stack";
cin>>n;
hanoi('A','B','C',n);
cout<<"\nNo. of changes done:"<<count;
return 0;
}
</code></pre>
| c++ | [6] |
3,421,664 | 3,421,665 | Large bitmap for background giving OOM error | <p>I have a bitmap that I'm loading into the surfaceView that is around 75kb (give or take) </p>
<p>The code I'm using to call it or decode it is </p>
<pre><code>bmLargeImage = BitmapFactory.decodeResource(getResources(),R.drawable.campplan);
</code></pre>
<p>nothing fancy really. The size of the image is 1000x500 pix. Which load fine when I want to. Problem is I want it to be 2000x1000 which is double that size.</p>
<p>I tried the resize with this code</p>
<pre><code>bmLargeImage = Bitmap.createScaledBitmap(bmLargeImage, 2000, 1000, true);
</code></pre>
<p>but it gives me a OOM error. I tried saving the png file as a 2000x1000 pix image and again it gives the OOM exception. This is tested in an emulator so far. But I think the size should be enough to load, what am I missing?</p>
<p>Note: I want it this big cause it's a background to a game (think like farmvile or smurf's village game background) so it should be big and scrollable, yet I only manage the 1000x500 size.</p>
| android | [4] |
850,135 | 850,136 | Web Scraper Not Producing Results Using Python | <p>I am a young grasshopper in need of your help. I've done a lot of research and can't seem to find the solution. I written the following code below. When ran it doesn't pull any of the titles. I believe my regular expressions are correct. Not sure what the problem is. Probably obvious to a seasoned sensei. Thanks in advance.</p>
<pre><code>from urllib import urlopen
import re
url = urlopen('http://www.realclearpolitics.com/epolls/2012/senate/ma/massachusetts_senate_brown_vs_warren-2093.html#polls').read()
'''
a href="http://multimedia.heraldinteractive.com/misc/umlrvnov2012final.pdf">Title a>
'''
A = 'a href.*pdf">(expression to pull everything) a>'
B = re.compile(A)
C = re.findall(B,url)
print C
</code></pre>
| python | [7] |
2,847,231 | 2,847,232 | Are there any standard android attribute which specifies color of text to be white | <p>Can you please tell me if there is any standard android textColor which specifies the color of the text to be white? </p>
<p>I have tried either textColorPrimary or textColorSecondary, but both are black.</p>
<pre><code><Button
android:textColor="?android:attr/textColorPrimary
/>
</code></pre>
| android | [4] |
5,078,277 | 5,078,278 | How to save the image into sqlite database? | <p>iam developing one application.In that i plce the images in 3 views.And first 2 views are worked well.But in third view images are not saved in database.Below one is my code for updating the images.</p>
<pre><code>-(void)updateStaff:(DataBaseFields*)databasefields
{
if(stfupdateStmt == nil) {
const char *sql = "update FoodBlogger Set update_date_time = ?, Stf_Mgr_Image = ?, Stf_Mgr_Text = ?, Stf_Srvr_Image = ?, Stf_Chf_Image = ?, Stf_Owr_Image= ? Where insert_date_time = ?";
if(sqlite3_prepare_v2(database, sql, -1, &stfupdateStmt, NULL) != SQLITE_OK)
NSAssert1(0, @"Error while creating update statement. '%s'", sqlite3_errmsg(database));
}
sqlite3_bind_text(stfupdateStmt, 1, [databasefields.update_datetime UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_blob(stfupdateStmt, 2, [databasefields.mgrImage bytes], [databasefields.mgrImage length], SQLITE_TRANSIENT);
sqlite3_bind_blob(stfupdateStmt, 3, [databasefields.srvrImage bytes], [databasefields.srvrImage length], SQLITE_TRANSIENT);
sqlite3_bind_blob(stfupdateStmt, 4, [databasefields.chfImage bytes], [databasefields.chfImage length], SQLITE_TRANSIENT);
sqlite3_bind_blob(stfupdateStmt, 5, [databasefields.owrImage bytes], [databasefields.owrImage length], SQLITE_TRANSIENT);
sqlite3_bind_text(stfupdateStmt, 6, [databasefields.insert_datetime UTF8String], -1, SQLITE_TRANSIENT);
if(SQLITE_DONE != sqlite3_step(stfupdateStmt))
NSAssert1(0, @"Error while updating. '%s'", sqlite3_errmsg(database));
sqlite3_reset(stfupdateStmt);
</code></pre>
<p>}</p>
<p>And image varaible in database type is varchar.Before 2 views are worked correctly.But this view was not working.So please help me how to solve this one.</p>
| iphone | [8] |
1,840,282 | 1,840,283 | Addressing first/last item in an ul, li | <p>How do you check whether a DOM element being clicked is either the 'first' li element or the 'last' li element in an unordered list item??</p>
| jquery | [5] |
659,639 | 659,640 | Selecting and deselecting radio buttons | <p>I am developing a quiz application which consists of a question and three options and I am using radio buttons for these options.My query is,I click on one of the options and whenever i want to click another option, the previous option remains in the checked state and it does the same whenever I click on the third option too.
I need a solution where in it behaves as a natural radio button,only one option is checked at any point of time.</p>
| android | [4] |
4,152,780 | 4,152,781 | is there any way to know extends screen in javascript | <p>is there any way to know extends screen in javascript?</p>
<p>by <code>screen.availWidth</code> and <code>screen.availHeight</code> you can only know the width and height just for the main screen </p>
| javascript | [3] |
4,479,118 | 4,479,119 | Cannot push a file to virtual android device for testing | <p>I am trying to push an mp3 file using the DDMS to the android device but I get the following error</p>
<pre><code>[2013-02-20 00:09:04 - ddms] transfer error: Read-only file system
[2013-02-20 00:09:04] Failed to push selection: Read-only file system
</code></pre>
<p>how can I push the file to the device so that it is available for my code ? Any suggestions ?</p>
| android | [4] |
1,010,816 | 1,010,817 | What is the best jdbc connection pooling tool? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/520585/connection-pooling-options-with-jdbc-dbcp-vs-c3p0">Connection pooling options with JDBC: DBCP vs C3P0</a> </p>
</blockquote>
<p>I need to use best jdbc connection pooling in my application. Please suggest me which is the best ? Oracle or apache or c3p0 or any other than this.</p>
| java | [1] |
130,303 | 130,304 | fopen error, null property | <p>I am trying to write to a file from javacript in an aspx page and i get an error. Here is my code and the error.</p>
<pre><code> var fh = fopen("c:\temp\MyFile.txt", 3); // Open the file for writing
if (fh != -1) // If the file has been successfully opened
{
fwrite(fh, saveData); // Write the string to a file
fclose(fh); // Close the file
}
</code></pre>
<p>The value of the property 'fopen' is null or undefined, not a Function object.</p>
<p>Any help?</p>
| javascript | [3] |
228,554 | 228,555 | Is there any API for LinkedIn and Plaxo like facebook API? | <p>I need to access linkedin and plaxo social networks in my application. If I need to use this, I would lke to have the API for access linkedin and plaxo like Facebook API.</p>
<p>Is there any API for linkedIn and Plaxo?</p>
<p>Thanks
R.Eswaran.</p>
| asp.net | [9] |
4,433,344 | 4,433,345 | Add a MenuItem to Other applications Option/Action menu (Android) | <p>Is it possible to add a new Menu Item to other application's Option/Action menu?</p>
<p>For example:
In phone's contacts menu, I want to add a new menu item "Share on Orkut (example)".</p>
<p>Is it possible in Android?</p>
<p>Thanks
Souvik</p>
| android | [4] |
5,008,024 | 5,008,025 | Javascript modal box to show a form through php | <p>I want to add a modal window (created with css and javascript) to pop-up a form when a user clicks "add quote" button on one of my php script.
I have created a form in q1.html file, with required div settings. There is a modal.css file to hide/unhide form. There is modal.js file to make the modal box out of this html and css. This html file on its own shows a poping up modal window with it's own "show window" button.</p>
<p>Now, I want to include this html file in one of the php script. If I use a link with an anchor tag pointing to q1.html file, it opens up in an entire new window. That is of no use to use a poping up modal form.</p>
<p>If I use "include('q1.html') file in php, the form stops working. The modal.css applies to the main page where I'm including this file. SO, how do I do it?</p>
<p>I think the problem comes from DOM, as modal.js file asks for elements in html file. But I don't understand how to resolve it.
I was searching on Internet, and all of it returns jquery solutions. At this point I don't want to use jqueary, as I want to learn javascript first.</p>
| javascript | [3] |
2,750,002 | 2,750,003 | c# report problem | <pre><code>protected void Page_Load(object sender, EventArgs e)
{
//--Sql string
string strId1;
strId1=Request["empid"].ToString();
string strId2;
strId2 = Request["empid1"].ToString();
String strCmd = "";
strCmd += "Select YKCODE,NAME,RNAME,TICODE,MADKBN,MKCODE,TANKBN,YOUKBN,KOUCODE ";
strCmd += "From GMYAKU ";
if(strId1!="" && strId2!="")
{
strCmd += "where YKCODE BETWEEN " + strId1 + " AND " + strId2;
}
//--Opening Sql Connection
string strConn = ConfigurationManager.AppSettings["ConnectionString"];
SqlConnection sqlConn = new SqlConnection(strConn);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(strCmd, sqlConn);
//--this statement is very important, here the table name should
//--match with the XML Schema table name
da.Fill(ds, "GMYAKU");
//--Closing Sql Connection
sqlConn.Close();
//--(Optional) I have used it to disable the properties
//CrystalReportViewer1.DisplayGroupTree = false;
//CrystalReportViewer1.HasCrystalLogo = false;
//--Initializing CrystalReport
// ReportDocument myReportDocument;
//myReportDocument = new ReportDocument();
ReportViewer1.LocalReport("Report1.rdlc");
//--Binding report with CrystalReportViewer
ReportViewer1.ReportSource = ReportViewer1;
ReportViewer1.DataBind();
}*/ here i am using ordinary report.how to change for ordinary report
</code></pre>
| c# | [0] |
2,328,201 | 2,328,202 | Determine which element comes first in the HTML/DOM? | <p>I need to determine which element comes first in my markup, such as an <code>input</code> or <code>select</code>. For example</p>
<pre><code><body>
<input type="text" />
<select><option>Test</option></select>
<body>
</code></pre>
<p>In this case, the <code>input</code> comes first in the DOM whereas</p>
<pre><code><body>
<select><option>Test</option></select>
<input type="text" />
<body>
</code></pre>
<p>in this case, <code>select</code> comes first. Any way to do this using jQuery? Thanks</p>
<p>EDIT: Just to clarify, I don't want the very first element, I ONLY want to know if between the input and select element, which comes first. There could be other elements before the <code>select</code> and <code>input</code> elements.</p>
| jquery | [5] |
4,075,349 | 4,075,350 | OOP, Constructor not working | <p>I am trying to call constructor but it is not working. Code is something like this:</p>
<h1>// Event.h</h1>
<pre><code>class Event
{
private:
int Time;
int Date;
public:
Event();
Event(int t, int d)
}
</code></pre>
<h1>// Event.cpp</h1>
<pre><code>Event::Event(){}
Event::Event(int time, int date){
Time=time;
Date=date;
}
</code></pre>
<hr>
<p>//Now in another .cpp file I am trying to call constructor something like this:</p>
<pre><code>Event eve;
eve(inputTime,inputDate); // inputTime and inputDate are inputs 4m user.
//Error is: no match for call to â(Event) (Time&, Date&)â
</code></pre>
<p>Any suggestions..............</p>
| c++ | [6] |
1,777,985 | 1,777,986 | Custom authentication module inheriting IHttpModule issue | <p>LoginPage.aspx:-</p>
<pre><code>protected void Button1_Click(object sender, EventArgs e)
{
Context.Items["Username"] = txtUserId.Text;
Context.Items["Password"] = txtPassword.Text;
//
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, Context.Items["Username"].ToString(), DateTime.Now, DateTime.Now.AddMinutes(10), true, "users", FormsAuthentication.FormsCookiePath);
// Encrypt the cookie using the machine key for secure transport
string hash = FormsAuthentication.Encrypt(ticket);
HttpCookie cookie = new HttpCookie(
FormsAuthentication.FormsCookieName, // Name of auth cookie
hash); // Hashed ticket
// Set the cookie's expiration time to the tickets expiration time
if (ticket.IsPersistent) cookie.Expires = ticket.Expiration;
Response.Cookies.Add(cookie);
Response.Redirect("Default.aspx");
}
</code></pre>
<p>Global.asax file:-</p>
<pre><code>void Application_AuthenticateRequest(object sender, EventArgs e)
{
if (HttpContext.Current.User != null)
{
if (HttpContext.Current.User.Identity.IsAuthenticated)
{
if (HttpContext.Current.User.Identity is FormsIdentity)
{
FormsIdentity id =
(FormsIdentity)HttpContext.Current.User.Identity;
FormsAuthenticationTicket ticket = id.Ticket;
// Get the stored user-data, in this case, our roles
string userData = ticket.UserData;
string[] roles = userData.Split(',');
HttpContext.Current.User = new System.Security.Principal.GenericPrincipal(id, roles);
Response.Write(HttpContext.Current.User.Identity.Name);
Response.Redirect("Default.aspx");
}
}
}
}
</code></pre>
<p>I get the following error after signing in</p>
<pre><code>This webpage has a redirect loop.
The webpage at http://localhost:1067/Default.aspx has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.
</code></pre>
| asp.net | [9] |
2,795,431 | 2,795,432 | How to implement slideToggle functionality after load an external page with load() | <p>I want to implement slideToggle functionality after load an external page inside a DIV using load(). The idea is I have three different tabs each upon click will load three different content from three external pages inside that mentioned DIV. When I will click one tab it will load the one external page after that if I click to the same tab it will slide up the content. Next if I click to the second tab it will load its related content with load() and accordingly the first open tab content will be slide up. Please give any suggestion.</p>
| jquery | [5] |
610,980 | 610,981 | Need java test cases to test MarkSweep Garbage collector | <p>Can anyone provide me test cases in java in which objects are being incrementally created so that i can use those to test my MarkSweep garbage collection code.</p>
| java | [1] |
4,502,562 | 4,502,563 | jQuery .eq() only works on first element in table | <p>This only works on the 4th element in the first row of a 200 row table.</p>
<pre><code>$('.CSSTableGenerator tr td').eq(4)
</code></pre>
<p><strong>How do I get it to work for every 4th "td" in a table row?</strong></p>
| jquery | [5] |
936,645 | 936,646 | Different height for alternative cell in UITableView | <p>How to make a alternate cell with a different height?</p>
<p>I need height for cell1 is 60 and cell2 is 30....</p>
<p>how can i do this?</p>
<p>Thanks in advance.</p>
| iphone | [8] |
2,936,280 | 2,936,281 | Problem in converting a generic list<string> or string[] array to datatable | <p>I have the below function</p>
<pre><code>public static DataTable ToTable<T>(this IEnumerable<T> listItem)
{
//Return null if the list is empty
if (listItem == null || listItem.Count() == 0) return null;
//Gets the type of the object
var listType = listItem.First().GetType();
//Initialize a new datatable
var dataTable = new DataTable(listType.Name);
//Create the datatable column names and types
listType.GetProperties().ToList().ForEach(col => dataTable.Columns.Add(col.Name, col.PropertyType));
//Get the datatable column names
var dataTableColumnNames = dataTable.GetDatatableColumnNames();
listItem.ToList().ForEach(item =>
{
//create a new datarow
var dataRow = dataTable.NewRow();
dataTableColumnNames
.Where(propName => listType.GetProperty(propName) != null)
.ToList()
.ForEach(columnName =>
//Exception happens here in the next line
dataRow[columnName] = listType.GetProperty(columnName).GetValue(item, null));
//Add the row to the data table
dataTable.Rows.Add(dataRow);
});
//Commit the changes to the datatable
dataTable.AcceptChanges();
return dataTable;
}
</code></pre>
<p>It works great for dictionary object and generic list as <code>List<MyClass></code> .. but not for
<code>List<string></code> or <code>string[]</code>.</p>
<p>For those I am getting an exception as <strong>Parameter count mismatch.</strong></p>
<p>The error is coming at </p>
<pre><code>dataRow[columnName] = listType.GetProperty(columnName).GetValue(item, null));
</code></pre>
<p>What is the mistake that is happening?</p>
<p>Please help</p>
| c# | [0] |
4,886,714 | 4,886,715 | How do I simulate a mouse click event in JQUery | <p>I apologize in advance, I am a designer primarily, but am trying to do some animation w/out Flash. I basically need a logo to load then shake then stop. I need it to happen on load (the shaking is a client request...). </p>
<p>Right now, this works when you click it, but I need it to run automatically.</p>
<p>Here is the code</p>
<pre><code><script type='text/javascript'>//<![CDATA[
$(window).load(function(){
jQuery.fn.shake = function() {
this.each(function(i) {
$(this).css({ "position" : "absolute" });
for (var x = 1; x <= 3; x++) {
$(this).animate({ left: 43 }, 10).animate({ left: 23 }, 50).animate({ left:23},10).animate({ left: 13 }, 50).animate({ left: 43 }, 50).animate({ left: 33 },50).animate({ left: 43 }, 50);
}
});
return this;
}
$("#logo").click(function() {
$(this).shake();
});
});//]]>
</script>
</code></pre>
<h1>logo is the DIV that contains the image. Any help would be greatly appreciated!!</h1>
| jquery | [5] |
3,531,757 | 3,531,758 | Android - Is it possible to use ui api in the other class and thread expect Activity? | <p>I have some questions about android ui api.</p>
<p>Give a example, that I want to implement.</p>
<p>Main_UI_Thread.java :</p>
<pre><code>public class Main_UI_Thread extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
/*** do something about layout ***/
...
DisplayClass dc = new DisplayClass();
Thread th = new Thread(dc);
th.start();
}
}
</code></pre>
<p>DisplayClass.java :</p>
<pre><code>public class DisplayClass extends Thread{
@Override
public void run() {
if( something happen ) {
to display Dialog or Toast show
and handle the ui listener
}
}
}
</code></pre>
<p>I know the message passing can be do that;</p>
<p>But I want the ui program is be implemented in DisplayClass.java</p>
<p>Is it possible??</p>
<p>My English is not well.^^" </p>
<p>Thanks everybody to give me some suggestions. :P</p>
| android | [4] |
3,036,482 | 3,036,483 | PHP Function to shorten string to exactly 3 characters | <p>The fact that I don't know how to do this is a good example of how elementary my PHP skills are.</p>
<p>How can I shorten a string <code>$fr_month</code> to 3 characters as a function"<code>short_fr_month()</code>"?</p>
| php | [2] |
4,377,375 | 4,377,376 | Load image from folder in solution? | <p>I'm trying to load an image from a folder in the solution, but I only get a error message that it's not found. What have I done wrong? The code below is in the MainForm.cs that is at the same level as the Resource folder. Help is preciated! Thanks!</p>
<pre><code> // Images
Image imageCircle = Image.FromFile("Resources/circle.png");
// Set deafult picture on start
pictureBox1.Image = imageCircle;
</code></pre>
| c# | [0] |
5,213,636 | 5,213,637 | Getting User signature | <p>Him what would be the best way to provide a view where a user can provide their signature, i.e a drawing platform?</p>
<p>Well, how would it be implemented in a view using OpenGL ES?</p>
| iphone | [8] |
1,834,858 | 1,834,859 | Unknown error perhaps caused by naming conflict? | <p>I wrote a very simple c++ code, where I defined a function called sqrt which just calls
std::sqrt. Unexpectedly, I got a segmentation fault. The problem doesn't exist if I rename
the function sqrt as something else. However, I can not see any naming conflict since
the sqrt function I defined is not in the namespace std so the two should be perfectly
separated. So what is the real cause of the problem? Thanks!</p>
<pre><code>#include<iostream>
#include<cmath>
double sqrt(double d);
double sqrt(double d) {
return std::sqrt(d);
}
int main() {
double x = 3.0;
std::cout << "The square root of " << x << " is " << sqrt(x) << '\n';
return 0;
}
</code></pre>
| c++ | [6] |
2,685,332 | 2,685,333 | jQuery image rotator | <p>I'm trying to make this simple image rotator but, as usual, my code doesn't work. I want to swap between 2 images ("image1" and "image2")</p>
<pre><code>$x = 0;
function rotateImage(){
if($x == 0){ //if function is being called for the first time
$x = 1;
}
$(".window").html("<img src=\"../images/image" + $x + ".png\" />");
$x = $x + 1;
if($x > 2)
$x = 1; //reset x to 1 if last image has been reached
}
rotateImage(); //first function call
setInterval("rotateImage()", 1000); //call function every second
</code></pre>
<p>Image1 shows up but there is no swapping going on.</p>
<p>Thanks in advance,</p>
<p>Matt</p>
| jquery | [5] |
5,885,281 | 5,885,282 | Use jQuery getScript to load a script that loads another script | <p>I have the following jQuery function:</p>
<pre><code><script>
$(document).ready(function(){
$.getScript("http://my.cdn.ext/adsense.js");
});
</script>
</code></pre>
<p>Inside adsense.js, there is:</p>
<pre><code><script type="text/javascript"><!--
google_ad_client = "pub-xxxxxxxxxxxxx";
google_ad_slot = "xxxxxxxx";
google_ad_width = 250;
google_ad_height = 250;
//-->
</script>
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</code></pre>
<p>The script gives me the following error on firebug;</p>
<pre><code>SyntaxError: missing ; before statement
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js
</code></pre>
<p>Since it’s a js file, I tried deleting the tags and I get no response. What’s the way around this?</p>
| jquery | [5] |
4,711,246 | 4,711,247 | Capture the previous value when onkeydown is executed | <p>Need help in event handling. In my scenario, I have a textbox with default value 35 and cursor is set to before the 3. There is a event for this text box which is onkeydown. When I press 4, IE and Safari captures the previous value of the text which is 35. But Mozilla and Chrome captures the new value which is 435.</p>
<p>I need the javascript code which can capture the previous value of the textbox when onkeydown is fired. </p>
<p>Need your hands :(</p>
| javascript | [3] |
5,533,824 | 5,533,825 | jQuery - Click Event is not Working as a Blur Event fires And Changes Dom Heights | <p>Please take a look at the fiddle: <a href="http://jsfiddle.net/Fyc5d/" rel="nofollow">http://jsfiddle.net/Fyc5d/</a></p>
<p>Click a gray box, and you'll see the textarea box open. Now click another. Click going up and then click going down the boxes.</p>
<p>You'll notice it works fine going up from the last gray box to the top gray box. but it break when going top/down. It appears this is occurring because when because the elements are bluring first, which is changing their dimensions.</p>
<p>Specific use case to reproduce:</p>
<ul>
<li>Click Box 1</li>
<li>Notice the textarea shows</li>
<li>Click Box 2</li>
<li>Notice box 1 was hidden which is good. But box 2 did not open, which was the expected behavior.</li>
</ul>
<p>Ideas, thoughts? Any elegant way to solve for this without a bunch of timeouts? Thanks</p>
| jquery | [5] |
2,683,768 | 2,683,769 | How to run JQuery in a JavaScript function | <p>I am trying to make a dynamic function but i am having trouble because i cant seem to run my JQuery code inside of a JS function. I have a working example <a href="http://jsfiddle.net/UpEvK/1/" rel="nofollow">here</a>. </p>
<p>I have a second example <a href="http://jsfiddle.net/UpEvK/" rel="nofollow">here</a>. the only difference between the two JsFiddle's is that i switched the call function from:</p>
<pre><code>$('#btnAdd').click(function() {
</code></pre>
<p>to this calling function:</p>
<pre><code>function addBtn(){
</code></pre>
<p>and the same on the delBtn. the reason i want to do this is so i can pass an argument so i know if i want to add another question field or an answer field.</p>
| jquery | [5] |
2,744,433 | 2,744,434 | How to disable screen timeout on NativeActivity | <p>I am developing app on NativeActivity(only C/C++).<br>
I want to disable screen timeout.<br></p>
<p>Do you know how to do it?</p>
| android | [4] |
934,766 | 934,767 | SQL stored procedure parameters when calling from code | <p>Does the order of parameters being passed to a stored procedure matter from the C# function?</p>
<p>Thank you</p>
| c# | [0] |
720,169 | 720,170 | Android Intent usage (Call_action & new_task_launch) | <p>I have faced the following error while running my application.
The code of my app is</p>
<pre><code>public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
final Button callButton = (Button) findViewById(R.id. callButton);
callButton.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View v)
{
Intent callIntent = new Intent(Intent.CALL_ACTION,Uri.parse("tel:123456789"));
callIntent.setLaunchFlags(Intent.NEW_TASK_LAUNCH);
startActivity(callIntent);
}
});
}
</code></pre>
<p>the problem that I am facing is, the CALL_ACTION and the NEW_TASK_LAUNCH are giving me an error informing me that they are not fields. Could any one please resolve this.</p>
<p>Thanks in advance.</p>
| android | [4] |
3,089,995 | 3,089,996 | Looking for a standard Java method (or, UDF if necessary) to check if one hashset is a subset of another | <p>It should return true if one HashSet A is a subset of another HashSet B, false otherwise. </p>
| java | [1] |
357,784 | 357,785 | How to display a certain portion of a site depending on a javascript variable? | <p>Suppose I have a javascript variable "is_valid"</p>
<p>If the variable is 1, I'd like to display:</p>
<pre><code><div>It's valid!</div> ...and a big chunk of other code
</code></pre>
<p>Otherwise...</p>
<pre><code><div>NOT valid</div>...and a big chunk of other code
</code></pre>
<p>I do NOT want to use INNERHTML. I want to do it like this:</p>
<pre><code><script type="text/javascript">
if(is_valid == 1){
</script>
It's valid!
<script type="text/javascript">
}else{
</script>
It's not valid
<script type="text/javascript">
}
</script>
</code></pre>
| javascript | [3] |
5,052,798 | 5,052,799 | How to take a file as argument? | <p>I realize that was not a very descriptive question, but I wasn't sure how else to state it..</p>
<p>I wrote an interpreter, Tiny_Int.java, for a made up language called "tiny". All I need to know is how to run the interpreter with a specified tiny file like so: </p>
<pre><code>java Tiny_Int <Sample.tiny
</code></pre>
<p>It may be helpful to know I am using this to read the tiny file </p>
<pre><code>FileReader fileReader = new FileReader(file); //file being the Sample.tiny
BufferedReader bufferedReader = new BufferedReader(fileReader);
</code></pre>
| java | [1] |
934,188 | 934,189 | How to change namespace name in an asp.net webform | <p>How to change the namespace name in an asp.net webform
For example in my project i have created 3 folders Master,Transaction,Reports in Master folder there are 10 forms by default th namespace comes ProjectName.Master,but when i manually change the name by adding my formname it doesn't work eg:-ProjectName.Master.MasterFormName.And moreover when i double click on a button then it doesn't go in the code behind.</p>
| asp.net | [9] |
4,905,523 | 4,905,524 | Implementation of BeginUpdate and EndUpdate | <p>1) I'm working on a project and I saw this piece of code, I don't understand what is the point of the Monitor.Lock statement. Can someone explain what its trying to do?</p>
<p>2) the postscript underscroll in the parameter name is really annoying, anyone else seen this naming convention?</p>
<pre><code>public class FieldsChangeableHelper<T> : IFieldsChangeable<T>
{
object _lock;
int _lockCount;
FieldChanges<T> _changes;
public FieldsChangeableHelper()
{
_lock = new object();
_lockCount = 0;
}
public void AddChange(T field_, object oldValue_)
{
if (_changes == null)
_changes = new FieldChanges<T>(field_, oldValue_);
else
_changes.AddChange(field_, oldValue_);
if (RaiseEvent(_changes))
_changes = null;
}
#region IFieldsChangeable Members
public void BeginUpdate()
{
if (System.Threading.Interlocked.Increment(ref _lockCount) == 1)
Monitor.Enter(_lock);
}
public void EndUpdate()
{
if (System.Threading.Interlocked.Decrement(ref _lockCount) == 0)
{
FieldChanges<T> changes = _changes;
_changes = null;
Monitor.Exit(_lock);
RaiseEvent(changes);
}
}
protected bool RaiseEvent(FieldChanges<T> changes_)
{
if (_lockCount == 0 && Changed != null && changes_ != null)
{
Changed(this, changes_);
return true;
}
return false;
}
public event FieldsChanged<T> Changed;
#endregion
}
</code></pre>
| c# | [0] |
4,760,420 | 4,760,421 | scandir fail to open directory | <p>I am having trouble with <code>scandir()</code>. I am trying to display the files in my <code>snaps</code>-directory on a page under the subdomain in my cloud.</p>
<p>This is the PHP I used.</p>
<pre><code>$files = scandir('./snaps');
print_r($files);
</code></pre>
<p>and this is the error.</p>
<pre><code>Warning: scandir(./snaps) [function.scandir]: failed to open dir: No such file or directory in /home/u703778423/public_html/cloud/index.php on line 39
Warning: scandir() [function.scandir]: (errno 2): No such file or directory in /home/u703778423/public_html/cloud/index.php on line 39
</code></pre>
<p>I have no idea what else to do.</p>
| php | [2] |
4,141,829 | 4,141,830 | Find labels of multiple select boxes with jQuery | <p>I have <a href="http://jsfiddle.net/XWr4W/1/" rel="nofollow">this script</a></p>
<p>I want to reach this html:</p>
<pre><code>City
Paris
Bern
Sex
Male
Female
</code></pre>
<p>But with my script, labels replace each other on change. How can I get above html?
Thanks in advance</p>
<p>Script:</p>
<pre><code>$("select").change(function () {
var str = "";
var id = $(this).attr('id');
var label = '<li><b>'+$("label[for='" + id + "']").text()+'</b> </li>';
$("select option:selected").each(function () {
str += '<li>'+$(this).text()+'</li>';
});
$("ul").html(label + str);
})
.trigger('change');
</code></pre>
<p>HTML:</p>
<pre><code><label for="sex">sex</label>
<select id="sex" multiple="multiple">
<option>Male</option>
<option>Female</option>
</select>
<label for="city">City</label>
<select id="city" multiple="multiple">
<option>Paris</option>
<option>Bern</option>
</select>
<ul></ul>
</code></pre>
| jquery | [5] |
1,952,200 | 1,952,201 | PropertyPlaceholderConfigurer: can i have a dynamic location value | <p>right now i have this in my xml file:</p>
<pre><code> <bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/dashboardsupervisor" />
<property name="username" value="root" />
<property name="password" value="${jdbc.password}" />
</bean>
</code></pre>
<p>and</p>
<pre><code> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>file:C:/jdbc.properties</value>
</property>
</bean>
</code></pre>
<p>Now , my problem is that i do not know the exact location of this file(jdbc.properties) , as this application will going to run on different computers , in some places its installed in c: ,sometimes may be on f:.. So if i dont know the path of this file , if there is anyway i could find it .</p>
<p>thanks</p>
| java | [1] |
3,060,777 | 3,060,778 | illegal character in path | <p>I am trying to get to a file located in </p>
<pre><code>C:\Program Files (x86)\test software\myapp\demo.exe
</code></pre>
<p>In VS debugger i see the path as:</p>
<pre><code>"\"C:\\\Program Files (x86)\\\test software\\\myapp\\\demo.exe\""
</code></pre>
<p>when i print it out i see in console :</p>
<pre><code>"C:\Program Files (x86)\test software\myapp\demo.exe"
</code></pre>
<p>but when i try something like </p>
<pre><code>FileInfo fi = new FileInfo(PathMentionedAbove);
</code></pre>
<p>i get Illegal character in path.</p>
<p>What is wrong? the file exists and path is correct. what's illegal above this path? </p>
<p>any help would be appreciated.</p>
| c# | [0] |
995,640 | 995,641 | How to create/set remainder in Android application? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/5976098/how-to-set-reminder-in-android">How to set reminder in android?</a> </p>
</blockquote>
<p>I want to make application which is create remainder. But I dont know hoe to set/create remainder? I want to know how to create remainder in Android? For more specific I want to make a text, audio, video remainder.</p>
<p>Can anyone help me? Please give the example so I can understood properly.</p>
<p>Thanks.</p>
| android | [4] |
2,254,975 | 2,254,976 | Method prints table incorrectly | <p>I was wondering if someone could help me with a small problem I'm having.</p>
<p>I am trying to print out an array of 100 items, every row needs 10 items, after which it starts a new row. I have done this successfully, however, every row in every column displays the same number. For example. My output would be:</p>
<pre><code>1 1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 2 2
</code></pre>
<p>When it should be appearing as something along the lines of:</p>
<pre><code>1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
</code></pre>
<p>Here is the following method I am using to print the table:</p>
<pre><code>public static void printTable(int[] emirps) {
for (int i = 0; i < 100; i++) {
for (int j = 0; j < 10; j++) {
// After 10 go to a new line
System.out.printf("%d\t", emirps[i]);
}
System.out.println("");
}
}
</code></pre>
<p>If anyone can help me pinpoint where I have goofed I'd greatly appreciate it.</p>
| java | [1] |
1,685,945 | 1,685,946 | Library for Image Filters In Android | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4280162/android-image-filter-libraries">Android image filter libraries</a> </p>
</blockquote>
<p>Can Anyone provide me the library file to filter image in Android like Black & White, Sepia,vintage, polaroid etc....</p>
| android | [4] |
681,404 | 681,405 | Eventlet and locking | <p>Since Eventlet uses green threading and asynchronous I/O, do I still need to set locks before accessing objects? My understanding is that greenlets are all part of one thread and locking isn't necessary. Can anyone confirm or deny this?</p>
| python | [7] |
2,851,395 | 2,851,396 | Using a string to reference an object name | <p>I'm trying to replicate a "feature" of PHP (And in most languages) in Javascript.</p>
<p>Here it is in PHP:</p>
<pre><code>$objectName = 'ObjectA';
$someObject->$objectName->someMethod();
</code></pre>
<p>Basically using a string variable to reference an object variable.</p>
<p>So in Javascript, I was hoping to do something like:</p>
<pre><code>var objectName = "ObjectA";
someObject.[objectName].someMethod();
</code></pre>
<p>Anyone know how to do this? Or if its even possible?</p>
| javascript | [3] |
3,363,890 | 3,363,891 | Array's lastIndexOf returns -1 when start is undefined | <p>in javascript,Array instance has two methods,</p>
<pre><code>[].indexOf(searchvalue [,start])
</code></pre>
<p>and</p>
<pre><code>[].lastIndexOf(searchvalue [,start])
</code></pre>
<p>is behaves strange if the "start" param is undefined:</p>
<pre><code>[1,2,3].lastIndexOf(2) // 1
[1,2,3].lastIndexOf(2,undefined) // -1
[1,2,3].indexOf(2,undefined) // 1
</code></pre>
<p>this happens in chrome and firefox,so what's the theory of the indexOf and lastIndexOf treat "undefined" differently </p>
| javascript | [3] |
2,392,039 | 2,392,040 | Palindrome check JAVASCRIPT | <p>i have the following:</p>
<pre><code>function checkPalindrom(palindrom)
{
for( var i = palindrom.length; i > 0; i-- )
{
if( palindrom[i] = palindrom.charAt(palindrom.length)-1 )
{
document.write('the word is palindrome.');
}else{
document.write('the word is not palindrome!');
}
}
}
checkPalindrom('wordthatwillbechecked');
</code></pre>
<p>What is wrong with my code? i want to check if the word is palindrome.</p>
| javascript | [3] |
4,969,661 | 4,969,662 | Attempt to include a core class (java.* or javax.*) in something other than a core library | <p>Hi i'm new android. i'm working through the samples and have an error when running the HelloGridView app. Eclipse is giving the following error. Has anyone had the following error? Thanks.</p>
<p>[2010-12-06 14:38:16 - HelloGridView]
trouble processing "javax/net/ServerSocketFactory.class":
[2010-12-06 14:38:16 - HelloGridView]
Attempt to include a core class (java.* or javax.*) in something other
than a core library. It is likely that you have attempted to include
in an application the core library (or a part thereof) from a desktop
virtual machine. This will most assuredly not work. At a minimum, it
jeopardizes the compatibility of your app with future versions of the
platform. It is also often of questionable legality.</p>
<p>If you really intend to build a core library -- which is only
appropriate as part of creating a full virtual machine distribution,
as opposed to compiling an application -- then use the
"--core-library" option to suppress this error message.</p>
<p>If you go ahead and use "--core-library" but are in fact building an
application, then be forewarned that your application will still fail
to build or run, at some point. Please be prepared for angry customers
who find, for example, that your application ceases to function once
they upgrade their operating system. You will be to blame for this
problem.</p>
<p>If you are legitimately using some code that happens to be in a core
package, then the easiest safe alternative you have is to repackage
that code. That is, move the classes in question into your own package
namespace. This means that they will never be in conflict with core
system classes. If you find that you cannot do this, then that is an
indication that the path you are on will ultimately lead to pain,
suffering, grief, and lamentation.</p>
<p>[2010-12-06 14:38:16 - HelloGridView] 1 error; aborting
[2010-12-06 14:38:16 - HelloGridView] Conversion to Dalvik format failed with error 1</p>
| android | [4] |
1,597,922 | 1,597,923 | Runtime.exec() gives Error: Could not find or load main class | <p>'Street.class' in my Eclipse project is under \bin in package trafficcircle. The error below is from stderror of the created process; I thought Runtime.exec would complain first if it wasn't found...what's up with this?</p>
<p>Code that runs 'Street' process:</p>
<pre><code> Process process = runtime.exec("java -classpath \\bin trafficcircle.Street 1 2");
</code></pre>
<p>Where 'Street' is:</p>
<pre><code>public class Street {
/**
* @param args
* 0 - Simulation run time
* 1 - Flow time interval
*/
public static void main(String[] args) {
System.out.println(args[0]);
System.out.println(args[1]);
System.out.flush();
}
}
</code></pre>
<p>Process prints out:</p>
<p>Error: Could not find or load main class trafficcircle.Street</p>
<p>Process exitValue: 1</p>
<p>And yes, this works on cmd line:</p>
<p>C:\Users\Brent>java -classpath "D:\Java Programs\IPCTrafficCircle\bin" trafficcircle.Street 1 2</p>
| java | [1] |
2,936,179 | 2,936,180 | create a transparent image programmatically in android | <p>i am getting an image from web server (<strong>which has transparent background</strong>).now i need to save this image on my sdcard and show it to user.but when i save the image to sdcard.. it saves with a black background..i need this image with background..</p>
<p>i hv tried following methods to save the image ---</p>
<p>Method 1:</p>
<pre><code>Bitmap bitmap = BitmapFactory.decodeStream(is);
byte[] b;
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 75, bytes);
b = bytes.toByteArray();
try {
File myFile = new File("/sdcard/" + image_id + ".jpg");
myFile.createNewFile();
OutputStream filoutputStream = new FileOutputStream(myFile);
filoutputStream.write(b);
filoutputStream.flush();
filoutputStream.close();
}catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.d("file", "not created");
}
</code></pre>
<p>Method 2:</p>
<pre><code>MediaStore.Images.Media.insertImage(getContentResolver(),
bitmap, "sample", "image/png");
</code></pre>
<p>plz help...</p>
| android | [4] |
4,889,655 | 4,889,656 | JSure Javascript Static Analysis Tool | <p>Does JSure, a Javascript Static Analysis Tool, run on Windows ?</p>
| javascript | [3] |
4,517,251 | 4,517,252 | On every visit, new session (please)? | <p>Im on a website, I close all windows and I go back again, and of course Im logged in.</p>
<p>What I need is for website to do otherwise. When I go back not to be logged in - to create a new session on every visit shortly and to hold it all the time (no timeout).</p>
<p>Is there a logical explanation on what things I should watch out when I do this since I managed to do it on local apache, but it doesnt work online?</p>
<p>And thanks :)</p>
| php | [2] |
144,454 | 144,455 | why use virtual destructor in inheritance | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/461203/when-to-use-virtual-destructors">When to use virtual destructors?</a> </p>
</blockquote>
<p>let's say i have an abstract class Animal</p>
<pre><code>class Animal {
public:
Animal(const std::string &name) : _name(name)
{
}
virtual void Print() const = 0;
virtual ~Animal() {}
protected:
std::string _name;
};
</code></pre>
<p>and i have Dog and Cat that inherit this class.
In a book i'm reading it is recommended to define a virtual destructor in base-class.
I tried to create objects without the definition of virtual des' and the program runs fine, without leaks (checked with valgrind).
So my question is why use virtual destructor (with empty implementation)? what is the benefit from it?</p>
<p>thank you! </p>
| c++ | [6] |
2,427,288 | 2,427,289 | Order vs. Associativity | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2129230/cout-order-of-call-to-functions-it-prints">cout << order of call to functions it prints?</a> </p>
</blockquote>
<p>What is the difference between order and associativity when evaluating a compound expression?</p>
<p>In the following example, I don't see the effect of order on the <code>result</code> of expression. The <code>result</code> is always <code>3</code> like the functions would have been called from left to right as arithmetic operators being left associative.</p>
<pre><code>#include <iostream>
using std::cout;
using std::endl;
int Func1(int &i)
{
return i;
}
int Func2(int &i)
{
return i++;
}
int main()
{
for (int index = 0; index < 999999999; index++)
{
int i = 0;
int result = (Func2(i) + Func1(i) + Func1(i) + Func2(i));
cout << result << endl;
}
}
</code></pre>
| c++ | [6] |
1,557,738 | 1,557,739 | Try/Catch exception continue from line that caused the exception | <p>When an exception is thrown, how can I catch it and then continue execution starting from the line that caused the error?</p>
<p>EDIT:
Our program communicates with Indesign Server which crashes all the time and throws random COM related errors (these errors have to do with bugs in the Server itself). Indesign Server also takes a very long time to process commands so when it crashes, we want to avoid restarting execution. Instead, we want to continue from the line that caused the exception. Any line in the program can cause an exception. So technically, we cannot use a loop.</p>
| c# | [0] |
1,753,114 | 1,753,115 | Firing the mouseleave event only when the mouse moves in a vertical direction | <p>I have a ul which functions as the main navigation. I have one li inside that ul which, when hovered on, slides down a hidden div with a bunch of information. This div appears right below the main nav. I would like to have the div hide itself if the user moves their mouse vertically, outside the main nav. I need it to stay if they mover their mouse over the div so they can click links located there.</p>
<p>Here's some of the code:</p>
<pre><code><ul>
<li> <a href="#">item one </a></li>
<li id="locations"> <a href="#">item two </a> </li>
<li> <a href="#">item three </a> </li>
</ul>
<div id="superNav"> div content is here </div>
</code></pre>
<p>Here is the current jQuery:</p>
<pre><code>$('li#locations a').hover(function(){
$('#locationsSuperNav').slideDown();
});
$('#locationsSuperNav').mouseleave(function(){
$(this).slideUp();
});
</code></pre>
<p>Is there any way to use a y coordinate to also trigger the mouseleave event?</p>
<p>Thanks in advance for any help.</p>
| jquery | [5] |
5,021,564 | 5,021,565 | Moving files from source folder to an archive folder which dont match with entered ids | <p>for my project perpose,
I want to move files from folder structure to
an archive folder based on the files
whose names are <strong>not matching</strong> with the "filename" column values of a table.</p>
<p>Means i need to find all file names which are not present in the database then move these files into another folder.</p>
| c# | [0] |
3,023,016 | 3,023,017 | How "focus" , "make active" , "insert cursor" into textarea at end | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4715762/javascript-move-caret-to-last-character">Javascript: Move caret to last character</a> </p>
</blockquote>
<p>Welcome,</p>
<p>I have some link's inside my webpage.</p>
<p>Is there any function in jquery / javascript what allow me to put cursor into textarea at end ?</p>
<p>When user click at link above textarea, i would like move cursor back where he came from.</p>
<p>Now he have to stop typing and click into textarea back. </p>
<p>Just like here, when he click for example "bold".</p>
<p>Now i use </p>
<pre><code>$('#textarea').focus();
</code></pre>
<p>But it move cursor at beginning.
I would like at end.</p>
| jquery | [5] |
2,176,479 | 2,176,480 | Convert List Type to IEnumerable Interface Type | <p>I have a </p>
<pre><code>List<Person> personlist;
</code></pre>
<p>How can I convert to </p>
<pre><code>IEnumerable<IPerson> iPersonList
</code></pre>
<p>Person Implements IPerson interface</p>
| c# | [0] |
5,139,956 | 5,139,957 | Making a c++ based program to show a web page on windows | <p>Every single windows computer has ie installed by default so i want to make a program that uses ie to show a web page!
I want the program to be just a simple window without adressbar! Also i want to add a close , maximize and minimize buttons to the program.
Also i want to add icon for the program to!
Any idea how can i do that?</p>
| c++ | [6] |
3,556,322 | 3,556,323 | error using function from another class | <p>I have a Class called CustomTemplateField which contains a function called GetDdlListItems
In another page's code behind I am trying to call that function to populate a dropdownlist using the syntax CustomTemplateField.GetDdlListItems("paramater"). I am getting a "Cannot resolve symbol" error. It is a Public Shared Function.</p>
| asp.net | [9] |
3,942,863 | 3,942,864 | How to transparently track line numbers from a character stream in C#? | <p>I'd like to seek to an arbitrary point in a character stream and then get the corresponding line number. In Java, this can be handled transparently with the java.io.LineNumberReader.getLineNumber() method. </p>
<p>What's the best way to go about this in C#?</p>
| c# | [0] |
5,943,669 | 5,943,670 | Getting notified when virtual keyboard shown / dismissed for an EditText? | <p>I'd like to get notified when the virtual keyboard is shown / dismissed. This does not seem to be possible, other than by using some layout resizing listener tricks:</p>
<p><a href="http://stackoverflow.com/questions/2150078/android-is-software-keyboard-shown">Android: Is software keyboard shown?</a></p>
<p>My activity has a single EditText. I could make it <em>not</em> have focus at activity startup, then add a focuschangelistener to it. When it gains focus, I can do my onVirtualKeyboardShown() stuff. If I could just listen for the back key being pressed in the EditText, I could then interpret that as the virtual keyboard being hidden. Something like:</p>
<pre><code>EditText et = ...;
et.setOnFocusChangedListener(new OnFocusChangedListener() {
public void onFocusChanged(boolean focused) {
if (focused) {
// virtual keyboard probably showing.
}
}
});
et.setKeyListener(new KeyListener() {
public void onKeyPressed(int code) {
if (code == BACK_KEY) [
if (et.isFocused()) {
// virtual keyboard probably hiding.
// lose focus to set up for next time.
et.setFocused(false);
}
}
}
});
</code></pre>
<p>Seems like any approach is fraught with problems given all the differences between virtual keyboards, then we also have to deal with physical keyboards too,</p>
<p>Thanks</p>
| android | [4] |
5,833,763 | 5,833,764 | Big picture of Java SE 6.0 | <p>I am learning Java SE 6.0.
Is there a big picture or chart to illustrate all the classes of Java 6.0 and the relation between them?
Thanks in advance.</p>
<hr>
<p>Dear developers and programmers of stackoverflow.</p>
<p>Hello. Thanks a lot for your excellent answers to Panguea, Zengr, Bemace, Thorbjørn, Duffymo, Oswald, Hilal, Skaffman, Starcom and Andy.</p>
<p>Now I have a big picture documented with posters of the Java SE 5/6 with the practical refcards, such as Java Reference Card, Core Java, Java GUI development, Java Collections and JDBC Best practices, etc.
Other interesting answers waere to start with java I/O stream because the programs need data input and data output and Javadoc to have the big picture.</p>
<p>I want to clarify the reason of my question.
I finished the courses, “Java SE 5.0” and “Java EE 5 basic” in the javaPassion website.
Of course, these courses are basic with simple examples, but I had and introduction to Java SE and Java EE.
Today, I feel that I know parts without conection of Java SE and Java EE because they have vast resources.</p>
<p>I want to start to solve simple projects but I have many problems to localize the packages and classes of Java SE to help me solve a simple project.
Also, I can not evaluate if I need only Java SE to solve a project or I would need Java EE to solve the project.
I do not know if I need a methodology to solve a project, or I need more experience and practice and practice with test and error to adquire the ability.</p>
<p>Now my original question change to the next:
How can I solve a project using a programming language such as C, C++ or Java?
Can you give me your opinion or some tips about this question?</p>
<p>Merry Christams and Happy New Year to everyone in stackoverflow site.</p>
<p>Thanks in advance. </p>
| java | [1] |
3,354,548 | 3,354,549 | How does this "days in month" function work? | <pre><code> function GetDaysInMonth(month, year)
{
return 32 - new Date(year, month, 32).getDate();
}
</code></pre>
<p>Ok, I don't see what this is doing specifically, this part:</p>
<pre><code> new Date(year, month, 32).getDate();
</code></pre>
<p>I know what <code>getDate()</code> does, but then I looked up <code>Date</code> in JavaScript but in this particular example, I don't see why you'd pass 32 here. How can this be returning the number of days in whatever month and year you're passing to it?</p>
| javascript | [3] |
1,397,551 | 1,397,552 | Use byte[] as key in Dictionary | <p>I need to use a <code>byte[]</code> as a key in a <code>Dictionary</code>. Since <code>byte[]</code> doesn't override the default <code>GetHashCode</code> method, two separate <code>byte[]</code> objects that contain the same data will use two separate slots in the dictionary. Basically what I want is this:</p>
<pre><code>Dictionary<byte[], string> dict = new Dictionary<byte[], string>();
dict[new byte[] {1,2,3}] = "my string";
string str = dict[new byte[] {1,2,3}];
// I'd like str to be set to "my string" at this point
</code></pre>
<p>Is there a simple way to do this? The only thing I can think of would be to build a wrapper class that just contains a <code>byte[]</code> and override <code>GetHashCode</code> based on the contents of the <code>byte[]</code>, but this seems error prone.</p>
| c# | [0] |
1,392,162 | 1,392,163 | Identify android intent type, from another method/class? | <p>I create an Intent in one class then it's returned to another class. I need to check the type of intent it is. I need to ensure it's not a specific class of intent.</p>
<p>How to do this?</p>
<pre><code>if( newIntent == ActivityName.class )
</code></pre>
<p>Edit:
So I would need to know if the new intent would equal an intent of a certain type:</p>
<pre><code>newIntent = new Intent(context, ActivityName.class);
return newIntent;
</code></pre>
<p>In another class:</p>
<pre><code>if( newIntent == ActivityName.class ) // do something
</code></pre>
<p>Hope this clarifies a bit.</p>
| android | [4] |
4,424,602 | 4,424,603 | While condition not getting terminated | <pre><code>if(childrens are present) {
while(childrens.length ! ==0) {
do something
}
}
// Execute this function fnName()
</code></pre>
<p>My problem here is the while condition is getting executed, but when the length becomes zero... it does not come out... and execute the fnName()</p>
| javascript | [3] |
3,353,078 | 3,353,079 | how can i display images using grid | <p>How to display images in a grid in asp.net .These images are stored in a folder in project directory(Images).I want to show these images in grid and show images description from database .Description should show just under the image.please help</p>
| asp.net | [9] |
5,021,866 | 5,021,867 | ASP.NET :What advantage if i use using when creating an object | <p>in ASP.NET, I have seen people coding like this</p>
<pre><code>using (SqlConnection myConnection = new SqlConnection(AppConfiguration.ConnectionString))
{
// Do the datatbase transactions
}
</code></pre>
<p>How does it differ from this one</p>
<pre><code> SqlConnection myConnection = new SqlConnection(AppConfiguration.ConnectionString)
// Do the datatbase transactions
</code></pre>
<p>Is there any performance/speed improvements in using one over the other ?</p>
| asp.net | [9] |
3,029,204 | 3,029,205 | How to read variables comma separated varibals from a text file into a javascript array? | <p>I want to read text file's comma separated variables in a java script array
right now i have hard coded values like this</p>
<pre><code>var arrUserTags = new Array('{{Name}}','{{Address}}','{{Company}}');
</code></pre>
<p>but i want to read it from a text file dynamically on page load
how can i read it?</p>
<hr>
<p>I am done with below solution but now i am facing 1 more problem.
When i do changes to text file that don't become effective, while the browser takes the old values only? How to sort it out?</p>
| javascript | [3] |
821,420 | 821,421 | What is the fastest way to convert a string into an array of 1 item | <p>Let's say I would like something like this:</p>
<pre><code>string s = "hello";
string[] array = s.ToStringArray()
</code></pre>
<p>and <code>array[0]</code> (the only element) holds the value >> "hello"</p>
| c# | [0] |
1,616,747 | 1,616,748 | VTABLE for abstract classes C++ | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2592438/does-an-abstact-classes-have-a-vtable">Does an abstact classes have a VTABLE?</a> </p>
</blockquote>
<p>Does a vtable gets created for an abstract class that have pure virtual functions and virtual functions ?</p>
<pre><code>class Abstarct {
public:
virtual void f() = 0;
virtual void g() {}
};
</code></pre>
<p>Thanks.</p>
| c++ | [6] |
3,645,969 | 3,645,970 | Please tell what approach should be used for desktop application | <p>I am planing to develop desktop application that will have multiple logins and according to that login type options/From view will be displayed.</p>
<p>I have done database login part now its turn of view</p>
<p>How can i establish that what i have in my mind that</p>
<ol>
<li>Drag and drop all required controls and make them visible = false and check which type of login is that and display accordingly </li>
<li>Create separate forms and display one by one as required</li>
</ol>
| c# | [0] |
2,790,454 | 2,790,455 | Graphics dont appear | <p>Whatever I do, I can not display rectangle/line/oval on the screen. I checked other sources where they paint graphics, but when I even execute those codes, I don't get any graphics displayed on the windows. Below is the example from the text book. </p>
<pre><code>import java.awt.*;
import javax.swing.*;
class PlotGraph
{
public static void main (String [] args) {
JFrame win;
Container contentPane;
Graphics g;
win = new JFrame("testing");
win.setSize(300,200);
win.setLocation(100,100);
win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
win.setVisible(true);
contentPane = win.getContentPane();
g = contentPane.getGraphics();
g.drawRect(10, 30, 50, 50);
}
}
</code></pre>
| java | [1] |
4,849,673 | 4,849,674 | Widget wag = *new Widget() | <p>I just came across a C++ SDK that makes heavy use of this really weird <code>*new</code> pattern. I dont understand why they do it like that at all.</p>
<p>What's the point of constructing objects with *new, e.g. <code>Widget wag = *new Widget();</code>?</p>
<p>Update: Interesting, they are actually doing <code>XPtr<T> p = *new T;</code> - must be the semantics of some smart pointer magic. Still doesn't make much sense. I do trust the SDK is high quality.</p>
| c++ | [6] |
2,309,692 | 2,309,693 | Android ImageView return getWidth, getHeight zero | <p>I am having problem withh the getWidth / getheight function of ImageView.
My xml is as follows:</p>
<pre><code><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/bonus_popup"
android:visibility="gone"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:id="@+id/todaybonus"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:adjustViewBounds="true"
android:src="@drawable/startscreen_todaybonus" />
<ImageView android:id="@+id/ok_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="acceptBonus"
android:background="#000000"></ImageView>
</RelativeLayout>
</code></pre>
<p>and my code is as follows:</p>
<pre><code>if (isDisplayBonus){
set_blur_background();
bonusPopup.setVisibility(0);
Log.i(TAG, "Bonus width: " + todayBonus.getWidth());
Log.i(TAG, "Bonus height: " + todayBonus.getHeight());
}
</code></pre>
<p>Please help me solve this proble,. Thank you in advance.</p>
| android | [4] |
92,563 | 92,564 | How to do Text Animations using Android SDK? | <p>So i have a code developed where when some button from the app is pressed it should get displayed in the Textview with some Animation(to add some fun). Is it possible to have text animations in Textview or should i use Canvas or SurfaceView for drawing this aplhabets with animation? </p>
<p>Any help in this regard with some code sample will be great. </p>
| android | [4] |
1,837,388 | 1,837,389 | n = n +1 is faster than n++ or ++n, why? | <p>Check this test case: <a href="http://jsperf.com/n-n-1-or-n">http://jsperf.com/n-n-1-or-n</a></p>
<pre><code>n = n + 1;
</code></pre>
<p>is faster than</p>
<pre><code>n++;
</code></pre>
<p>and</p>
<pre><code>++n;
</code></pre>
<p>Any clue about why the first writing is so much faster on many browsers ?</p>
| javascript | [3] |
4,481,443 | 4,481,444 | How to check Image is there in the ImageView | <p>I have am ImageView in my page. It get the image while i have browse it using a button. On another button I need to check whether image is placed in the ImageView.</p>
<p>The problem is, how can I check image is there in the ImageView? I have placed only .png file as image in the ImageView?</p>
| android | [4] |
3,338,116 | 3,338,117 | View my android app rating in my app | <p>I want to load rating of my app uploaded in android market in some app.
how to do this?
thanks</p>
| android | [4] |
4,029,955 | 4,029,956 | how do i validate a textbox in asp for unbalanced parentheses | <p>I want to validate an ASP textbox for unbalanced parenthesis. Like i want to display an error if the user starts a curly bracket but does not end it in a textbox.</p>
<p>Thanks</p>
| asp.net | [9] |
4,658,299 | 4,658,300 | is there any API to forbid user capture app screen as image? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1586592/disabling-iphone-screenshot-feature">Disabling iPhone screenshot feature</a> </p>
</blockquote>
<p>as topic...</p>
<p>how to forbid user capture app screen (press power key + how key) ?</p>
<p>just want protect the content of the app ....</p>
<p>thanks for tip </p>
| iphone | [8] |
1,708,790 | 1,708,791 | Android count size of INT Array | <p>I have an Array like:</p>
<pre><code> private static int[] f_arme = {
R.drawable.frankiearmevor_0001,
R.drawable.frankiearmevor_0002,
R.drawable.frankiearmevor_0003,
R.drawable.frankiearmevor_0004,
R.drawable.frankiearmevor_0005
</code></pre>
<p>}</p>
<p>how Do I get the Size of that array (f_arme) ?? = 5
I tried f_arme.size() but get "cannot invoke size() on the array type int[]</p>
<p>thx
chris</p>
| android | [4] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.