Unnamed: 0
int64 65
6.03M
| Id
int64 66
6.03M
| Title
stringlengths 10
191
| input
stringlengths 23
4.18k
| output
stringclasses 10
values | Tag_Number
stringclasses 10
values |
---|---|---|---|---|---|
2,627,831 | 2,627,832 |
How can I get the current date and time using PHP
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/470617/get-current-date-and-time-in-php">Get current date and time in PHP</a> </p>
</blockquote>
<p>I was wondering how can I get the current date and time using PHP.</p>
|
php
|
[2]
|
3,654,427 | 3,654,428 |
preventDefault() submitting form
|
<p>Ok i am fairly new to jquery and javascript in general. I have a form, and what i want to do it have the form run a function to make sure everything is there, and all the variables are correct then submit. I have used <code>onclick</code> value to the submit button and have it run a function that uses <code>preventDefault()</code>. I am not sure if im using it correctly but it doesn't seem to be working. This is what i have and when you click submit, it just submits even if the if statement is false. </p>
<pre><code>function checkSubmitStatus() {
$("#myform").submit(function(event){
if( whatever==true)
{
event.preventDefault();
}
<input type="submit" name="submit" value="Submit" onClick="checkSubmitStatus()">
</code></pre>
<p>Thanks!</p>
|
jquery
|
[5]
|
571,904 | 571,905 |
Back button for iframes seperately
|
<p>My website contains 4 iframes . I am trying to create back button for each iframe seperately is it possible to create seperate button for iframe. please help me.....</p>
|
javascript
|
[3]
|
3,207,804 | 3,207,805 |
Issue with simple text framing
|
<p>Basically, I'm trying to create a frame around text and on the third line where the text goes, it doesn't print out the # that's supposed to be the "padding" around it.</p>
<pre><code>******************
*################*
*#HELLO, JUSTIN!*
*################*
******************
</code></pre>
<p>That's what it looks like - after the ! in the $greeting variable, there should be a #. The code is below, could anyone explain why this happens?</p>
<pre><code><html>
<body><?php
$pad = 1;
$rows = ($pad * 2) + 3;
$greeting = "HELLO, JUSTIN!";
$col = strlen($greeting) + (2 * $pad) + 2;
for ($r = 0; $r != $rows; ++$r)
{
for ($c = 0; $c != $col; ++$c)
{
if ($r == $pad + 1 && $c == $pad + 1)
{
echo $greeting;
$c += strlen($greeting);
//echo "#";
}
else
{
if ($r == 0 || $r == $rows - 1 || $c == 0 || $c == $col - 1)
echo "*";
else
echo "#";
}
}
echo "<br />";
}
?></body>
</html>
</code></pre>
|
php
|
[2]
|
5,814,198 | 5,814,199 |
Best way to custom edit records in ASP.NET?
|
<p>I'm coming from a Rails background and doing some work on a ASP.NET project (not ASP MVC). Newbie question: what's the easiest way to make a custom editor for a table of records?</p>
<p>For example: I have a bunch of data rows and want to change the "category" field on each -- maybe a dropdown, maybe a link, maybe the user types it in.</p>
<p>In Rails, I'd iterate over the rows to build a table, and would have a form for each row. The form would have an input box or dropdown, and submit the data to a controller like "/item/edit/15?category=foo" where 15 was the itemID and the new category was "foo".</p>
<p>I'm new to the ASP.NET model and am not sure of the "right" way to do this -- just the simplest way to get back the new data & save it off. Would I make a custom control and append it to each row? Any help appreciated.</p>
|
asp.net
|
[9]
|
550,661 | 550,662 |
fire a function when all image download complete
|
<p>i am downloading images in each iteration. so logic & code is there in each iterator which download image one by one. i want that when all images download gets completed then immediately i want to call a function which notify user that all images download complete.
please guide me to modify my existing code.</p>
<p>here is my code</p>
<pre><code>$(document).ready(function () {
$("table[id*=dgImages] img").each(function () {
if($(this).offset().top > $(window).scrollTop() && $(this).offset().top < $(window).scrollTop() + $(window).height()) {
$(this).attr("src", $(this).attr("original"));
$(this).removeAttr("original");
}
});
});
</code></pre>
|
jquery
|
[5]
|
1,189,260 | 1,189,261 |
Get day of week in PHP
|
<p>If I have a date, month and a year values, is there a way in PHP to calculate the day of the week?
I don't mean today's day of the week, but any date in the future of in the past.</p>
|
php
|
[2]
|
308,868 | 308,869 |
Replace just one occurrence of a sentence and wrap it with style
|
<p>My goal is to find a sentence in a html page and replace it / wrapping with
<code><span class='red'>...</span></code></p>
<p>basically the same concept of highlighting results...but instead of words i need to highlight an entire sentence</p>
<p>for some reason my code sometimes works, sometimes not...</p>
<p>here:</p>
<pre><code>$('body').each( function () {
$(this).html(function(i, html) {
return html.replace(myString, '<span class="red">'+myString+'<\/span>' );
});
});
</code></pre>
<p>also it seems to stop when it finds the first occurence of the first word of the sentence...
any help?</p>
|
javascript
|
[3]
|
3,868,848 | 3,868,849 |
Correct implementation of NSObject description method for nested classes containing collections
|
<p>With my own classes, I usually override -(NSString *)description method to ease debugging.
However when invoking description on a class that I implemented that calls recursively description method from my other classes, all formatting characters from the 'deeper' classes are escaped. That makes any pretty printing difficult to implement.
Here's an example to make it clearer: </p>
<pre><code>@interface Foo {
NSArray *barsArray;
}
@end
@implementation Foo
- (NSString *)description {
return [NSString stringWithFormat: @"foo contents: %@", barsArray];
}
@interface Bar {
NSString *s1;
NSString *s2;
}
@implementation Bar
- (NSString *)description {
return [NSString stringWithFormat: @"s1: %@\ns2: %@", s1, s2];
}
</code></pre>
<p>In this case, the \n newline characters from description of class B will get escaped in the output of class A description method. Any idea how to get rid or circumvent this behaviour? It's especially annoying when printing nested classes that all contain collections. </p>
|
iphone
|
[8]
|
208,248 | 208,249 |
Puting contact number into field
|
<p>I have this code that has one button that let's me choose an entry from contacts, and passes that choesn contact to onActivityResult function. My question is how do I select data of that single contact when all that is passed is an Intent in data variable. That data variable, if converted to string shows something like "dat: content://contacts/people/4" so I see that selected contact is somehow passed, but what now? How to get that data?</p>
<p>And also all I found by googling was examples with deprecated class People, so I don't know how too use new classes.</p>
<p>Please help.</p>
<p>Thank you.</p>
<pre><code>public class HelloAndroid extends Activity {
private static final int CONTACT_ACTIVITY = 100;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final Button contactButton = (Button) findViewById(R.id.pick_contact_button);
contactButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Uri uri = Uri.parse("content://contacts/people");
Intent contacts_intent = new Intent(Intent.ACTION_PICK, uri);
startActivityForResult(contacts_intent, CONTACT_ACTIVITY);
}
});
}
public void onActivityResult(int requestCode, int resultCode, Intent data){
super.onActivityResult(requestCode, resultCode, data);
switch(requestCode){
case(CONTACT_ACTIVITY): {
if(resultCode == Activity.RESULT_OK) {
alertText(data.toString());
}
break;
}
}
}
}
</code></pre>
|
android
|
[4]
|
1,410,242 | 1,410,243 |
when does a method return if a new thread is started inside it
|
<p>Suppose I have some code that looks like this:</p>
<pre><code>public SomeMethod() {
foreach (x...)
{
if (SomeCondition)
{
var SomeVariable = x;
Task.Factory.StartNew(() => SomeOtherMethod(SomeVariable));
}
}
return SomeValue;
}
</code></pre>
<p>If <code>SomeOtherMethod</code> is called and started in a new thread, does a) <code>SomeMethod</code> wait until that thread is finished running before returning or b) the method return and then the threads of <code>SomeOtherMethod</code> just continue on their own even after <code>SomeMethod</code> returned? </p>
<p>Reason I ask is that I need to wait until all <code>SomeOtherMethods</code> finish before exit SomeMethod.</p>
<p>Thanks.</p>
|
c#
|
[0]
|
4,747,114 | 4,747,115 |
Import variables in python
|
<p>I ran a python script to create a dict variable based on a database, and then I pickled this variable into disk file for later usage. Now I have a lot of feature classes which all need that variable to create different features. The thing is the dict variable is so large that cannot afford to import multiple times. I am wondering if there is a way I can unpickle and import that variable for only once, and then all feature class can share it?</p>
|
python
|
[7]
|
4,920,115 | 4,920,116 |
How to implement adding footer on demand to ListView when loading data
|
<p>everyone.
I want to show the footer like "Loading..." when user reaches bottom of the list.
Now I only managed to determine when we are on the last element. Then trouble comes. We need to set up footer before setting adapter, we need to hide it afterwards. Does anyone have solution to this?
May be this issue is already discussed, but I haven't found an answer.</p>
|
android
|
[4]
|
3,251,539 | 3,251,540 |
Which parts of C# .NET framework are actually parts of the language?
|
<p>I am wondering which parts of the <code>System</code> are language features (core components), and which parts are just useful filler, but aren't strictly necessary. I may be off with the wording here, so let me illustrate with an example what I mean.</p>
<p>Consider <code>System.Console</code> class it's obviously something that is used for something very particular. In essence, this thing is there to play nice with a feature of Windows / current OS. It's not what I would call a core component of the language.</p>
<p>On the other hand, take the <code>System.IDisposable</code> interface. That thing's obviously very important, as without it the <code>using()</code> statement is useless. A class needs to implement this particular interface for a language feature to kick in.</p>
<p>I could assume that the <code>mscorlib</code> is the responsible party here. A quick glance with the Object explorer shows that it indeed houses many of the components I can agree are core, while at the same time it puts the <code>Console</code> class into System namespace, which is just filler. </p>
<p>This notion of placing filler and language-specific objects into the same namespace equates them, but for a deeper understanding of C#, I would like to know which is which. So, I'm looking for a list of core components of C#. I'm assuming that there's a handy reference somewhere, but since I was asleep during the google-lecture I was unable to form the correct query to find it.</p>
<p>Thanks in advance.</p>
<p><strong>Much later EDIT</strong> I read <a href="http://blogs.msdn.com/b/ericlippert/archive/2011/06/30/following-the-pattern.aspx" rel="nofollow">this</a> Lippert blog post, it's kind-of-related. Interestingly <code>foreach</code> construct doesn't actually require <code>IEnumerable</code> interface to function.</p>
|
c#
|
[0]
|
5,865,308 | 5,865,309 |
How to set the RichTextBox curser to the end?
|
<p>I am using <code>System.Windows.Forms.RichTextBox</code> and doing something like </p>
<pre><code>RichTextBox1.Text = "Hello World";
</code></pre>
<p>But after this statement the curser position of in the RichTextBox remains in the begining. Is there any way to set it to the end?</p>
|
c#
|
[0]
|
2,202,748 | 2,202,749 |
Can't add checked property for checkbox
|
<pre><code><input type=checkbox id="chk1" name="chk" onclick="getchecked('chk1')"/>
<input type=checkbox id="chk2" name="chk" onclick="getchecked('chk2')"/>
getchecked(pId)
{
if(pId.checked==true)
alert('ok');
else
alert('not ok');
}
</code></pre>
<p>In my runtime if i checked any checkbox it does not add the checked property for that checkbox, I verified that in Developer tool bar.</p>
<p>So it always entering into else block Why?</p>
|
javascript
|
[3]
|
887,887 | 887,888 |
Java - Reference Variables
|
<blockquote>
<p>" It is important to understand that
it is the type of reference variable -
not the type of object that it refers
to - that determines what members can
be accessed. "</p>
</blockquote>
<p>What do you exactly mean by that statement ?
Is this restricted to concept of Inheritance ?
How does JVM handles it ?</p>
|
java
|
[1]
|
3,512,623 | 3,512,624 |
Why this convert into object
|
<p>Instead of string it is object</p>
<pre><code>String.prototype.foo = function () { return this; };
typeof "hello".foo() // object ???
"hello".foo().toString(); //hello
</code></pre>
<p>it should return string instead i guess. </p>
|
javascript
|
[3]
|
2,098,803 | 2,098,804 |
Using Python's ast to get attributes from a class
|
<p>I'm trying to use ast to open a .py file and for each class in the file, give me the attributes I want.</p>
<p>However, I can't get ast to behave as expected.</p>
<p>I'd expect to be able to do</p>
<pre><code>import ast
tree = ast.parse(f)
for class in tree:
for attr in class:
print class+" "+attr.key+"="+attr.value
</code></pre>
<p>For example; a bit like ElementTree with XML. Or maybe I've got the totally wrong idea behind ast, in which case, is it possible to do this another way (if not, I'll write something to do it).</p>
|
python
|
[7]
|
5,633,705 | 5,633,706 |
Temporary msg while using usleep function
|
<p>I want to delay the execution of script and i use the usleep function to make it actually calculating something before output. I want a message to be displayed while it's in delay mode. Example : Once user click submit button a message shows "Please wait we are now processing your request..." and disappear when the usleep times up and the results shows. My code :</p>
<pre><code><div>
<form id="form1" name="form1" method="post" action="">
<label>
<select name="fortune" id="fortune"><?php callcombobox('fortune',$fortune); ?></select>
</label>
<input name="submitbtn" type="submit" id="submitbtn" class="submitbutton" value="Submit" style="width:180px; height:30px;" />
</p>
</form>
</div>
<div>
<?php
echo 'Please wait while we are processing your request..';
flush();
usleep(5000000);
?>
<p class="textcolor">Your fortune is :</p>
<p class="textcolor"><?=nl2br($returnanswer)?></p>//result of fortune
</div>
</code></pre>
<p>I'm newbie to php and tried the code above it doesn't show the echo msg it only shows together with the result retrieved from database when times up. Anyone can help? Thanks.</p>
|
php
|
[2]
|
5,280,352 | 5,280,353 |
change password without enter the old password in web administration tool
|
<p>There have any chance to change the password that the user which is created for login without asking the old password.the user management created through web site administration tool.</p>
<p>if any one knows please reply.its very urgent.</p>
|
asp.net
|
[9]
|
413,984 | 413,985 |
jQuery - div resizing script works correctly when navigating within the site but not on reload?
|
<p>I have a really weird bug and cant figure out why things are not working consistently.</p>
<p>I have two content divs, eaither one of them could be shorter than the other.</p>
<p>I have a script that checks to see which one is taller, and then I make the other equal it.</p>
<p>It works when i click around within the site, so say I click on "Next" or click on a page link direcly, the script works like it should.</p>
<p>If i go to the page directly via my browser address bar, or if i refresh the page, it doesn't do it. Why on earth?!</p>
<p>here is the script:</p>
<pre><code>jQuery(function($) {
$(document).ready(function(){
var getCreditsHeight = $("#project_credits").outerHeight()-30;
var getDescriptionHeight = $("#project_description").outerHeight()-30;
if ( getCreditsHeight > getDescriptionHeight ) {
$("div#project_description").height(getCreditsHeight);
} else {
$("div#project_credits").height(getDescriptionHeight);
};
});
});
</code></pre>
<p>As you can see it's on document ready.</p>
<p>If I load a new page, then click onto the page in question for the first time, it also does it. but if i go back to the homepage and then click in again, it works...</p>
<p>Thanks,
Marc</p>
|
jquery
|
[5]
|
4,174,122 | 4,174,123 |
Python dictionary isn't updating
|
<pre><code>def mergeDict(object):
dict1 = {}
for i in range(len(object)):
dict1.update({'id': object[i].id, 'name': object[i].name, 'age': object[i].age, 'location': object[i].location})
return dict1
merged_dict = mergeDict(details_sorted)
</code></pre>
<p>But this doesn't work.</p>
<p>I want to get something like this:</p>
<pre><code>{1: {'id': 1, 'name': 'John', 'age': '25'; 'location': 'somewhere'},
2: {'id': 2, 'name': ......}}
</code></pre>
|
python
|
[7]
|
1,739,815 | 1,739,816 |
what's "this" in javascript onclick?
|
<pre><code><a onclick="javascript:func(this)" >here</a>
</code></pre>
<p>what does <code>this</code> mean in the script?</p>
|
javascript
|
[3]
|
245,628 | 245,629 |
Arrays - foreach brings ->Fatal error: Cannot use object of type
|
<p>So, I'm mad about this Arrays, 2nd day givin me pain in <em>*</em>.... </p>
<p>I'm developing an OOP PHP script.</p>
<p>I'm getting an array:</p>
<pre><code>Array ( [0] => Project Object ( [project_id] => 1 [title] => Some Name [date] => 2011-10-20 [place] => Some City [customer] => 1 [proj_budget] => [manager] => 1 [team] => 1 [currency] => 1 ) )
</code></pre>
<p>When I'm trying to do this:</p>
<pre><code><?php
$project = new Project();
$projects = $project->findAll();
print_r($projects);
foreach ($projects as $temptwo) {
echo $temptwo['title'].", \n";
}
?>
</code></pre>
<p>I'm getting this:</p>
<pre><code>Fatal error: Cannot use object of type Project as array
</code></pre>
<p>Why in the world? what does it want from me?</p>
|
php
|
[2]
|
1,742,292 | 1,742,293 |
Question regarding App.Config for class library and logging
|
<p>I have a class library for which i want to have configuration file. </p>
<p>The purpose of the configuration file is to have the path and other parameters. </p>
<p>Also i wanted to use the Enterprise logging block in Class library. </p>
<p>Here is my scenario:</p>
<ol>
<li>This is a Class library and will be deployed in GAC</li>
<li>Enterprise logging blocks uses app.Config. </li>
<li>My calling application which consumes the dll is BizTalk 2010. </li>
<li>I don't have permission to modify the BizTalk's application config file</li>
</ol>
<p>What i am trying to achieve is:</p>
<ol>
<li>My Dll needs to use a configuration file which has many configuration parameters</li>
<li>Also as i understand, I need app.config for Enterprise Logging</li>
</ol>
<p>How can i achieve this?
Any ideas?</p>
<p>Cheers,
Karthik</p>
|
c#
|
[0]
|
4,204,453 | 4,204,454 |
Android in app billing - could not bind to market billing service error while testing locally
|
<p>I have this code:</p>
<pre><code>try
{
boolean bindResult = bindService(
new Intent("com.android.vending.billing.MarketBillingService.BIND"),
this,
Context.BIND_AUTO_CREATE);
if (bindResult)
{
Log.i( "Err" , "Service bind successful.");
}
else
{
Log.e( "Err", "Could not bind to the MarketBillingService.");
}
}
catch (SecurityException e)
{
Log.e( "Err" , "Security exception: " + e);
}
</code></pre>
<p>and while testing locally, the log statement that I put with "Could not bind to the MarketBillingService" is shown - is that supposed to happen because I am working locally? If so, how do I know this won't behave similarly when I put it live?</p>
<p>Thanks!</p>
|
android
|
[4]
|
4,907,647 | 4,907,648 |
jQuery - Check if child div is visible
|
<p>I'm trying to see if the the child div of an li is visible and if so apply a class to the li. This is what I got but it's not working.</p>
<pre><code>if(jQuery('#menu li').children('div').css('display') != 'none') {
jQuery('li', this).addClass('dropHover');
}
</code></pre>
|
jquery
|
[5]
|
5,129,350 | 5,129,351 |
jQuery detect current element id
|
<p>I have some HTML codes:</p>
<pre><code><input type="button" id="btn1" class="myButton" value="Button 1"/>
<input type="button" id="btn2" class="myButton" value="Button 2"/>
</code></pre>
<p>I need to run a jQuery function whenever user click each button, and I have to do it using their class.</p>
<pre><code>$('.myButton').click(function() {
// do something
});
</code></pre>
<p>But what I should to do, depends on the current element Id.</p>
<p>My question is that how can I detect which element called this function? I need to know its id.</p>
|
jquery
|
[5]
|
653,077 | 653,078 |
Python Programme Keeps Looping When Not Meant To
|
<p>I have my code but it doesn't seem to work as expected. It needs to ask the user for input to search a file once found doesn't ask again but keeps asking. But I want it to ask the user again if the file hasn't been found. My code is as followed:</p>
<pre><code>import os, sys
from stat import *
from os.path import join
while True:
lookfor=input("\nPlease enter file name and extension for search? \n")
for root, dirs, files in os.walk("C:\\"):
print("Searching", root)
if lookfor in files:
print("Found %s" % join(root, lookfor))
break
else:
print ("File not found, please try again")
</code></pre>
|
python
|
[7]
|
4,212,502 | 4,212,503 |
iPhone Dev: Process each frame of a live recording movie for AR app?
|
<p>I'm doing research into AR on the iPhone and am trying to figure out how people are getting each frame of video? I'm wanting to figure out AR using computer vision( OpenCV ). So basically I will have a pattern on a piece of paper that I will find using OpenCV and place a graphic on top of the pattern.</p>
<p>I know about the movie class UIImagePickerController, but am unsure how you would go about getting to each frame. </p>
<p>Can someone point me in the right direction?</p>
|
iphone
|
[8]
|
3,377,527 | 3,377,528 |
How to read arguments from target
|
<p>When you right click on a program in windows(such as starcraft.exe) and look at its properties there is a text field called "target" which contains the full path of the binary. I have seen programs able to parse flags added to the target such as "C:\programfiles\myprogram\myprogram.exe -x 1280 -y 360" and the program would start up in the specified resolution. My question is how to read those arguments, if it is done by argv[] please just inform me of my stupidity.</p>
<p>C++ is the language, VS express 2012 desktop is the environment.</p>
|
c++
|
[6]
|
1,299,790 | 1,299,791 |
Gridview finding control in gridview
|
<p>How to find control of gridview in user defined Funtion
...
this throws </p>
<pre><code> DataSet ds = objSelectAll.Paging(PageSize, PageNumber, USERID, ROLEID);
if (Session["Username"].ToString() == "admin")
{
foreach (GridViewRow row in UserRoleGridView.Rows)
{
ImageButton ImgEditbtn = (ImageButton)row.FindControl("EditButton");
ImageButton ImgDelbtn = (ImageButton)row.FindControl("DeleteButton");
DataSet dsusr = objSelectAll.UserBasedPaging(PageSize, PageNumber, USERID, ROLEID);
UserRoleGridView.DataSource = dsusr.Tables[1];
UserRoleGridView.DataBind();
</code></pre>
|
asp.net
|
[9]
|
2,448,472 | 2,448,473 |
Saving hashed passwords - Safe?
|
<p>Would a Python script like this be safe to use? There would be a file "theFile" on the disk:</p>
<pre><code>myPassHash = theFile.read()
enteredPassword = raw_input("Enter your password: ")
enteredHash = hashlib.sha512(enteredPassword)
if myPassHash == enteredHash:
print "Correct!"
else:
print "Incorrect!"
</code></pre>
|
python
|
[7]
|
3,844,764 | 3,844,765 |
Uncaught ReferenceError: myFunction is not defined
|
<p>Gives an error. I have placed the code just before <code></body></code>. Still getting the error.</p>
<pre><code><form action="" method="get" id="searchform" >
<input name="q" type="text" id="search" size="32" maxlength="128" class="txt">
<input type="button" id="hit" value="Search" onclick="myFunction();return false" class="btn">
</form>
</code></pre>
<p>JS,</p>
<pre><code><script type="text/javascript">
var nexturl = "";
var lastid = "";
var param;
$(document).ready(function () {
function myFunction() {
param = $('#search').val();
alert("I am an alert box!");
if (param != "") {
$("#status").show();
var u = 'https://graph.facebook.com/search/?callback=&limit=100&q=' + param;
getResults(u);
}
}
$("#more").click(function () {
$("#status").show();
$("#more").hide();
pageTracker._trackPageview('/?q=/more');
var u = nexturl;
getResults(u);
});
});
</script>
</code></pre>
|
javascript
|
[3]
|
4,509,453 | 4,509,454 |
How to get only letters from a string in C#?
|
<p>I have a string and need the letters from said string.</p>
<pre><code>string s = "EMA123_33"; // I need "EMA"
string s = "EMADRR123_33"; // I need "EMADRR"
</code></pre>
<p>I am using C# in Visual Studio 2008.</p>
|
c#
|
[0]
|
973,744 | 973,745 |
Forms submit doesn't work in Chrome, ie
|
<p>There are many forms with a unique id</p>
<pre><code><form id='fu_edit_1' method='post' action=''>
....
</form>
<form id='fu_edit_2' method='post' action=''>
....
</form>
</code></pre>
<p>Use this js code</p>
<pre><code> var formName = 'fu_edit_'+id;
document.forms[formName].submit();
</code></pre>
<p>so here is the code works fine in ff the last version, but in chrome and ie refused to work. However, if you specify the id of the form directly it works, for example:</p>
<pre><code>document.forms["fu_edit_2"].submit();
</code></pre>
<p>What is wrong?</p>
<hr>
<p>In the console, Chrome writes : <strong>Uncaught TypeError: Object # has no method 'submit'</strong></p>
|
javascript
|
[3]
|
4,088,006 | 4,088,007 |
Uncaught SyntaxError: Unexpected token function
|
<p>I keep getting the "unexpected token function" error when trying to run the following code. The error appears at the <code>if(highPriority(priority)) {</code> line. I appreciate any help, thanks.</p>
<pre><code>$(function(){
$("input[name=task]").focus();
$("body").on("click","#add",function(){
var task = $("input[name=task]").val();
var priority = $(this).parent().children("input[name=priority]");
var doneSpan = '<span class="done">Done</span>';
if(highPriorityChecked(priority)) {
$("#todo").prepend("<p class='row high-priority'>" + task + doneSpan + "</p");
} else {$("#todo").append("<p class='row normal-priority'>" + task + doneSpan + "</p");
};
resetForm();
doneList();
});
}
function highPriorityChecked(priority){
return $("input[name=priority]").is(":checked");
};
function doneList(){
$("#todo").on("click",".done",function(){
var row = $(this).parent().detach();
$("#done").prepend(row).remove(doneSpan);
});
}
function buildRow(task, priority) {
var row = '<div class="row item ' + priority + '">' + task;
var doneSpan = '<span class="done">Done</span>';
return row + doneSpan + "</div>";
};
function resetForm() {
$("input[name=task]").val("").focus();
$("input[name=priority]").removeAttr("checked");
};
</code></pre>
|
jquery
|
[5]
|
1,015,309 | 1,015,310 |
How to get handle to replaced child?
|
<pre><code>obj.parentNode.replaceChild(elem,obj)
</code></pre>
<p>Now I want to have a handle to that inserted node.</p>
|
javascript
|
[3]
|
3,571,349 | 3,571,350 |
How to use progress bar message on the page using ajax for asp.net mvc application
|
<p>I need to show the Please wait message while doing something on the page...
while showing this mesage I need to hide entire page backgroud that is i should not give any permision to the user to do anthing on the page.. </p>
<p>using jquery for asp.net mvc application. </p>
<p>thanks</p>
|
jquery
|
[5]
|
984,018 | 984,019 |
How to get record in text box on change select option in HTML_QuickForm for PHP
|
<p>When user will select Customer Name then i want to fill Address & city of that customer at run time from the database.for that i am calling javascript function on change and from that i am calling php function addfun() and trying to pass from and keyvalue for query. I write below code but thats not working.</p>
<pre><code> <script language='javascript' type='text/javascript'>
function ILovePHP(frm, a) {
var formName = frm.name;
alert(formName);
b=<?php addfun(formName,a);?>;
alert(b);
}
</script>
<?php
$attrs = array("onChange" => "ILovePHP(this.form, this.value);");
require_once "HTML/QuickForm.php";
require_once "HTML/QuickForm/Renderer.php";
$form = new HTML_QuickForm('customer_master', 'post');
$form->addElement('select','custName','Select Customer Name',$cnameAry,$attrs);
$form->addElement('text', 'custAdd', 'Customer Address');
$form->addElement('text','custCity', 'City');
$form->addElement('text','custState', 'State');
$form->display();
function addfun($frm, $p)
{
$query="Select Address, City from entityMaster where eid=$p ";
$link = mysql_connect('localhost', 'root', '');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db('GenInsurance');
$result=mysql_query($query);
$row=mysql_fetch_array($result);
$frm->setDefaults(array( 'custAdd' => $row['Address']));
$frm->setDefaults(array( 'custCity' => $row['Address']));
print $frm;
return $frm;
}
?>
</code></pre>
|
php
|
[2]
|
2,082,187 | 2,082,188 |
remove leading 0 in exponential format in python
|
<p>I have the following code in Python 3.1</p>
<pre><code>"{0:.6E}".format(9.0387681E-8)
</code></pre>
<p>Which gives a string of 9.038768E-08 but I want the string 9.038768E-8 with the leading 0 of E-08 removed. How should I go about this?</p>
|
python
|
[7]
|
635,657 | 635,658 |
How to change the UIImagePickerControllerSourceType in iPhone
|
<p>Hey can anybody tell me how I can change the camera view in iphone where i found to buttons like 'use' and 'retake' and 'Move to Scale'message in that window I want to add some Label on top most part.How could I do that.</p>
<p>Reply soon</p>
|
iphone
|
[8]
|
1,809,883 | 1,809,884 |
jQuery check and get attribute of a child element
|
<p>If a user places HTML in a <code>textarea</code> field, how can I check if text inserted is an <code><object></code> tag?</p>
<p>If true, I want to assign the <code>src</code> attribute of the <code><object</code>> to a variable.</p>
<p>What the most efficient way to do this?</p>
<pre><code><div id="embed">
<textarea>
<object src="..."></object>
</textarea>
</div>
</code></pre>
|
jquery
|
[5]
|
5,670,111 | 5,670,112 |
Java: Variable size array of int
|
<p>Hey guys I'm trying out arraylists and I need to make a variable sized array of integers.
I don't know if I'm implementing it right.
How do I go about doing this? Can someone help me out with the syntax?</p>
<pre><code> Integer[] ints = new Integer[x];
static List<Integer> ints = new ArrayList<Integer>();
</code></pre>
<p>I want to be able to do things like ints.add(0);
etc.</p>
<p>EDIT: Code:</p>
<pre><code> Integer[] ints = new Integer[x];
static List<Integer> ints = new ArrayList<Integer>();
ints.clear();
for (int counter2 = 0; counter2 < 50; counter2++) {
if (list[counter2].userActive == true) {
if (list[counter2].getLastName().equals(lastName) || (lastName=="")) {
if ((list[counter2].getFirstName().equals(firstName))||(firstName=="")
&& (list[counter2].userActive == true))
ints.add(counter2);
</code></pre>
|
java
|
[1]
|
1,055,522 | 1,055,523 |
Why document.write doesn't wait the loading?
|
<p>Basically I have a <code>script.js</code> in my website that does this:</p>
<pre><code>if (someVar){
document.write('<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"><\/script>');
}
</code></pre>
<p>Now I would like to attack some behaviour:</p>
<pre><code>if (someVar){
document.write('<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"><\/script>');
$(document).ready(function(){
//> Do stuff
});
}
</code></pre>
<p>But I got undeclared function <code>$</code> in console </p>
|
javascript
|
[3]
|
651,932 | 651,933 |
String was not recognized as a valid DateTime
|
<p>I am converting the uk date format string to US format to save this into database but it throw me error "String was not recognized as a valid DateTime."</p>
<pre><code>string dateString = "13/06/2011";
DateTime dt = DateTime.Parse(dateString);
</code></pre>
<p>I have also tried this but same exception.</p>
<pre><code>DateTime aa = DateTime.ParseExact(dateString, "MM/dd/yyyy", new System.Globalization.CultureInfo("en-GB"));
</code></pre>
<p>Please let me know how can i convert uk format date in string to us date format.</p>
<p>Thanks.</p>
|
c#
|
[0]
|
4,685,229 | 4,685,230 |
App load screen in Android
|
<p>On iOS you create a load screen for when the app loads, is there a similar thing in Android. When my app loads, I get a black screen until it opens.</p>
|
android
|
[4]
|
1,041,443 | 1,041,444 |
Executing Java program through command window
|
<p>I have one query that Since I am using eclipse mostly to execute the java class but I want to know if I am not using eclipse and I want to execute the java program then I have to manually set the path and classpath also , I have my jdk inside java folder in C: drive and my program is inside folder named AA namded as Temp.java , Please advise how to set path and classpath for this in order to execute the java program from command window itself..!</p>
|
java
|
[1]
|
939,558 | 939,559 |
ASP.NET : Sending mail fail :_COMPlusExceptionCode = -532459699
|
<p>I tried to send mail using my outlook account;it works well before deploying the Web site on the IIS but after deploying it always fail sending mail with this exception : _COMPlusExceptionCode = -532459699</p>
<p>here my code snippet:</p>
<pre><code> public static void SendEmail(string _ToEmail, string _Subject, string _EmailBody)
{
try
{
Application oApp = new Application();
NameSpace oNS = oApp.GetNamespace("mapi");
oNS.Logon(Missing.Value, Missing.Value, false, true);
Microsoft.Office.Interop.Outlook.MailItem email = (Microsoft.Office.Interop.Outlook.MailItem)(oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem));
email.Recipients.Add(_ToEmail);
email.Subject = _Subject;
email.Body = _EmailBody;
((Microsoft.Office.Interop.Outlook.MailItem)email).Send();
}
catch (System.Exception)
{
throw;
}
}
</code></pre>
<p>any help will be appreciated!</p>
|
asp.net
|
[9]
|
2,997,101 | 2,997,102 |
Android_id to guid?
|
<p>I am using Secure.Android_Id for getting unique id of the device. But I need to pass it to as GUID for a service. Is there a easy way to create that? </p>
<p>The basic code I wrote looks something like <strong>this</strong>: </p>
<p><code>
String android_id = getAndroidId();
long leastSignificantBits = 0;
long mostSignificantBits = 0;
UUID uuid = null;</p>
<pre><code> if (android_id != null) {
String asciiConvertedText = "";
int len = android_id.length();
for (int i = 0; i < len; i++) {
asciiConvertedText += "" + ((short) android_id.charAt(i));
}
len = asciiConvertedText.length();
if (len > 16) {
leastSignificantBits = Long.parseLong(asciiConvertedText.substring(0, 15));
if (asciiConvertedText.length() > 31) {
mostSignificantBits = Long.parseLong(asciiConvertedText.substring(16, 31));
} else {
mostSignificantBits = Long.parseLong(asciiConvertedText.substring(32,
asciiConvertedText.length()));
}
uuid = new UUID(mostSignificantBits, leastSignificantBits);
} else if (len > 0) {
leastSignificantBits = Long.parseLong(asciiConvertedText);
uuid = new UUID(mostSignificantBits, leastSignificantBits);
} else {
uuid = UUID.randomUUID();
}
}
if (uuid != null) {
deviceUUID = uuid.toString();
}
</code></pre>
<p></code></p>
|
android
|
[4]
|
1,732,945 | 1,732,946 |
extract file/names from .torrent
|
<p>I have <code>.torrent</code> file and I want to extract all the file names from that file. I have tried searching but i am not having enough luck. </p>
<p>P.S:
I am writing a simple service which will watch a specific folder to upload my torrent files to my seedbox. Then another service will poll on my seedbox to download that downloaded files. There might be some torrents which i am not intrested to upload so my utility will upload specific torrents. I want to keep log of which torrent got uploaded so that i can fetch respective downloaded folder from my seedbox. </p>
<p>For reference, a torrent file may call Torrent_of_movie_2010.torrent file. But when the Torrent client would download, it will download it in a folder/or a file specified in .torrent file. </p>
|
c#
|
[0]
|
5,651,815 | 5,651,816 |
FTP upload over browser
|
<p>I wanted to know, if we can create a web based application like filezilla. if yes, any information would be helpful for me. I tried searching Google, but couldn't get proper info. All I'm getting is the sites which provide this service e.g <a href="http://www.txftp.com/" rel="nofollow">http://www.txftp.com/</a>
Not how to go about creating such a website.</p>
|
php
|
[2]
|
1,315,382 | 1,315,383 |
JS How to include a variable in a path?
|
<p>The following variable contains a string that is a path to an image.</p>
<pre><code>iconBlue.image = 'http://www.site.com/icon1.jpg';
</code></pre>
<p>How can include a variable in this path? Let me explain more detailed. Lets say there are many icons in a folder icon1.jpg icon2.jpg etc. I have a variable named iconspec that depending on its value (1 or 2 or 3 etc) points to the icon I must use. </p>
<p>How can i include variable iconspec in the path?</p>
<pre><code>iconBlue.image='http://www.site.com/icon"iconspec".jpg
</code></pre>
<p>Something like this i guess but with correct syntax.</p>
|
javascript
|
[3]
|
5,212,081 | 5,212,082 |
ServiceLeakedException while using services android
|
<p>I had a Activity That is binding with a service and is able to communicate with the service as well.</p>
<pre><code> bindService(intent,serviceConnection,Context.BIND_AUTO_CREATE);
</code></pre>
<p>My Code is running well. But when i finishes my activity A ServiceLeakedException is thrown, but that is there in the log only. no such exception is their on to the visuals and is working fine.</p>
<p>Should i ignore this or how to handle this properly.</p>
<p>Thanks
Amandeep</p>
|
android
|
[4]
|
4,856,895 | 4,856,896 |
Why Instruments report a leak?
|
<p>I am developing an iphone app. Instruments reported a leaked object ServiceTypes. Below is the relevant code. Does anyone have any ideas? Thanks a lot for your help.</p>
<pre><code>ServiceTypes *serviceTypes = [[ServiceTypes alloc] init];
if ([userConnection getServiceTypes:serviceTypes]) {
if ([serviceTypes.types length] > 0) {
NSArray *array = [[NSArray alloc] initWithArray:[serviceTypes.types componentsSeparatedByString: SERVICE_TYPE_DELIMITOR]];
serviceRequestTypes = [[NSMutableArray alloc] initWithArray:array];
[array release];
}
}
[[self typesTableView] reloadData];
[serviceTypes release];
</code></pre>
|
iphone
|
[8]
|
1,539,330 | 1,539,331 |
blocking sessions and graph display in asp.net
|
<p>I am creating application in asp.net framework 4.0.i want to block the sessions between tabs and graph should display in the same application.both senarios should work. Please hepl me on this.</p>
<p>Thanks in Advance,
Venkat</p>
|
asp.net
|
[9]
|
2,890,578 | 2,890,579 |
Initialising Instance Variables
|
<p>I was wondering what is the difference between the following and which way is the best way of doing it:</p>
<pre><code>public class ClassA
{
public ClassB myClass = new ClassB();
public void MethodA()
{
myClass.SomeMethod();
}
}
</code></pre>
<p>Or this:</p>
<pre><code>public class ClassA
{
public ClassB myClass = null;
public ClassA()
{
myClass = new ClassB();
}
public void MethodA()
{
myClass.SomeMethod();
}
}
</code></pre>
<h2>Edit</h2>
<p>I removed IDisposable, bear in mind this was just an example, my point was just to see which way is better at instantiating instance variables</p>
|
c#
|
[0]
|
4,358,710 | 4,358,711 |
Read a csv file and put the information into a .txt file
|
<p>I am trying to read a csv file that contains multiple lines and from this file I want to take only several data and put them into a txt file. For example:
I have a csv file with 5 columns but I need to put in my txt file only the first 3 columns, or only the second column from the csv.
I was thinking that an idea is to put every line into a string array and separate the values by comma, and after that, take only the values that i need, but i don't know how to do that.</p>
|
c#
|
[0]
|
2,990,961 | 2,990,962 |
Where to add a redirect in my jquery
|
<p>I have a conditional statement that I need to add a redirect depending on what conditional statement is met and I have no clue how to proceed. I am using the jquery.if plugin as well.</p>
<pre><code><div id="load"></div>
<script type="text/javascript">
// ** DEMO 1 *************
var b1 = "Wholesale";
$("#load")
.IF(b1 == "Wholesale")
.html ("window.location.href = 'http://stackoverflow.com/questions/503093/how-can-i-make-a-redirect-page-in-jquery';")
.ELSE()
.ENDIF()
</script>
</code></pre>
|
jquery
|
[5]
|
5,671,066 | 5,671,067 |
selectors in jquery
|
<p>I want to select a link which is inside <code>table tr td</code></p>
<pre><code><table>
<tr>
<td><a href=""></a></td>
</tr>
</table>
</code></pre>
<p>This is my selector, but it is not working:</p>
<pre><code>$(table#id tr>td>a.linkid);
</code></pre>
|
jquery
|
[5]
|
1,351,225 | 1,351,226 |
Different Behaviour of TRIM in php
|
<p>I have a piece of code, from this i want to remove some words from string but the <code>trim()</code> function is not showing proper output.</p>
<p>The code is below</p>
<pre><code><?php
$mystring = '/word-quotes-hope';
$findme = '/word-quotes-';
echo $str = trim($mystring, $findme);
?>
</code></pre>
<p>and its output is <code>hop</code>, but it should be <code>hope</code></p>
<p>Its working example <a href="http://codepad.viper-7.com/FxLZkp" rel="nofollow">http://codepad.viper-7.com/FxLZkp</a></p>
<p>Anybody knows why this is happening.</p>
|
php
|
[2]
|
101,630 | 101,631 |
android portrait or landscape
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2795833/check-orientation-on-android-phone">Check orientation on Android phone</a> </p>
</blockquote>
<p>how to know programatically whether screen is in portrait or landscape mode.please help me </p>
|
android
|
[4]
|
417,619 | 417,620 |
c# Serialport problem: data are send in "clumps"
|
<p>I am trying to remote control a lego mindstorms NXT robot using a bluetooth serial connection. The program connects without any problem but when i send single commands they do not appear before several other commands has been send. Then they all appear at once on the nxt. </p>
<p>I have tried everything (i can think of or google has told me to) but i cannot seam to get the buffer to flush after a command is send. </p>
<p>Anyone having a idea about what i can do?
Here is my code</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO.Ports;
namespace NXTBtRemote
{
public class BTHandler
{
SerialPort comm;
private string comPort;
public BTHandler()
{
comm = new SerialPort();
}
public Boolean Connect(string _comPort)
{
this.comPort = _comPort;
comm.PortName = comPort;
comm.Open();
if (comm.IsOpen) return true;
else return false;
}
public void sendCommand(Command command)
{
string msg = command.cmdType + "#" + command.arguments;
if (!comm.IsOpen) comm.Open();
comm.WriteLine(msg);
comm.DiscardOutBuffer();
}
}
}
</code></pre>
<p>Hope somone can help. Thanks in advance
kind regards - kenneth</p>
|
c#
|
[0]
|
2,761,849 | 2,761,850 |
Is there a method in Python to list the properties and methods of a particular object?
|
<p>Is there a method in Python to list the properties and methods of a particular object?</p>
<p>Something like:</p>
<pre><code>ShowProperties ( myObject )
-> .count
-> .size
ShowMethods ( myObject )
-> len
-> parse
</code></pre>
|
python
|
[7]
|
4,484,746 | 4,484,747 |
How to add malay language input type keyboard to android emulator?
|
<p>I am developing a dictionary application, which supports three languages(English, chinese and malay). In my android emulator there is english and chinese language are available. Now I need to add malay language keyboard. How to add this..? Please Help me..! User will type in malay keyboard.. How to proceed...? Thanks in advance..!</p>
|
android
|
[4]
|
274,793 | 274,794 |
Getting a base class pointer (parent) in a base-derived (child) class object?
|
<p>So I have this class (the parent) that creates a dialog box and fills it with controls. Within that class is another class (the child) that creates a timer that links/passes a function call to an event system to update the contents of some of the controls at regular intervals. The problem comes from the timer update function needing to know the objects it needs to update.</p>
<p>I would like to simply pass the pointer of the base class to the child some how in a way that it's all self contained. But I can't figure out a way to make that happen. Anyone have any ideas?</p>
<p>I've searched for answers but all I got was accessing variables from inside the base class from within the child class. That would work but it seems unnecessary to fire an event for every individual control... (I guess I could create all the controls in an structure but that seems unnecessary)</p>
<p>the nested classes look a bit like this:</p>
<pre><code>class CreateDialog{
class timer{
}
}
</code></pre>
|
c++
|
[6]
|
5,852,191 | 5,852,192 |
compare eval with list of dictionary on the basis of its key
|
<p>I have a string containing a list of dictionary.
I want to compare by checking their keys not value. is there any way to do that. </p>
<pre><code>data = '[{ "group1" : "T1"}, { "group1" : "T2"}, { "group2" : "T3"}]';
</code></pre>
<p>how can i compare these dictionaries on the basis of their keys. for example, i have used:</p>
<pre><code>dataObj = eval(data); //generate 3 objects for data.
</code></pre>
<p>here <code>dataObj[0]</code> will refer to object of <code>{ "group1" : "T1"}</code>
to do it i have done following code:</p>
<pre><code>for(i=0;i<dataObj.length;i++){
if (dataObj[i].key == dataObj[i].key){ //<-- i am not getting what to do to compare their keys i.e. "group1" and "group1"
//my other statements
}
}
</code></pre>
|
javascript
|
[3]
|
3,952,664 | 3,952,665 |
How to do "strtolower", "str_replace" and "preg_replace" in javascript?
|
<p>How can I do this in javascript?</p>
<pre><code>$name = $xml->name;
$file_name = strtolower($name);
$file_name = str_replace(array('-',' ',' ','å','ä','ö'), array('',' ','-','a','a','o'), $file_name);
$file_name = preg_replace("/[^a-z0-9-]+/i", "", $file_name);
</code></pre>
|
javascript
|
[3]
|
5,466,256 | 5,466,257 |
voting and commenting - how to store the rating data
|
<p>If i have an app that s a list of hotels with basic info of them (location, rating, pricing, etc), and i want to allow users of my app to vote for a specific hotel (giving it a "stars" rating and a few line comment - much like a rating in the Android Market), how and where do i store thoe rating so they will be available to other app users? i guess it should be online, but how?</p>
<p>Is it recommendable to allow the app to publish the rating online but do the calculations and add the comments on the next app update?</p>
<p>if i decide the latter, how do i control the database that has the comments stored because every comment requires its own field right? so can i have the unified DB for all the data (my info on the hotels, rating, comments) that is automatically expandable for the extra fields for comments? </p>
<p>i hope you undestand what i am asking here...</p>
|
android
|
[4]
|
4,341,328 | 4,341,329 |
Session value doesnt pass on to the next page
|
<p>Basically I want to grab an id send via the url (ex. www.website.com/?id=432432) and take it accross my website till the user hits the contact page. I created a variable and a session variable </p>
<pre><code>session_start();
$getId = $_GET["id"];
$_SESSION['session_browser_test'] = $getId;
$adv_id = $_SESSION['session_browser_test'];
</code></pre>
<p>and used </p>
<pre><code>echo $adv_id;
</code></pre>
<p>on my index.php Joomla template so it applies to all the pages. </p>
<p>But the issue is when i go to www.website.com/?id=432432 it echos the id on my web page, but if I click on the next link to go to another page (ex. www.website.com/nextPage) it doesnt hold the session value from the previous page. Why is that? and how can I carry the ID through out the site?</p>
|
php
|
[2]
|
5,425,159 | 5,425,160 |
c# stop data repeating itself in label
|
<p>How would i stop data repeating itself in a label?</p>
<p>at the moment my balance keep adding a value next to it for e.g balance: 500.000, 500.000</p>
<p>where i only want it to open once. here the code i am using</p>
<pre><code>SqlDataReader readdata;
try
{
sqlCommandbalance.Connection.Open();
sqlCommandbalance.Parameters["@accountID"].Value = show.accountID;
readdata = sqlCommandbalance.ExecuteReader();
string balanceDB = null;
string availableBalance = null;
while (readdata.Read())
{
balanceDB = readdata["balance"].ToString();
availableBalance = (Convert.ToDecimal(readdata["balance"].ToString()) + Convert.ToDecimal(readdata["overdraftlimit"])).ToString();
}
sqlCommandbalance.Connection.Close();
balanceShow.Text += " " + balanceDB.ToString();
availablebalanceShow.Text += " " + availableBalance.ToString();
</code></pre>
|
c#
|
[0]
|
3,283,761 | 3,283,762 |
scope resolution operator doesn't give compile time error in php
|
<p>i created a small PDO class and spent hours in debugging it and could not find a small typo which was causing every thing to fail. To demonstrate below is the buggy code. </p>
<pre><code> class MyPDO extends PDO
{
private static $instance = null;
function __construct(){
try{
parent::__construct("mysql:host=localhost;port=3306;dbname=blog", "root", "");
parent::setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
}catch(PDOException $e){
echo 'Exception in constructor'.print_r($e->trace(),true);
}
}
static public function getDB(){
if(self::$instance == null){
self:$instance = new MyPDO();
}
return self::$instance;
}
function selectAll($sql){
$stmt = self::$instance->prepare($sql);
$stmt->execute(array(":cat_id"=>1));
return $stmt->fetchAll(PDO::FETCH_ASSOC);
}
}
</code></pre>
<p>What i want to confirm that if any one has already seen it or is it a bug or it could be used for some thing else i have no knowledge of. </p>
<p>There is a problem with the following line i wrote. </p>
<blockquote>
<p>self:$instance = new MyPDO();</p>
</blockquote>
<p>it should be the scope resolution operator with double colon i.e. </p>
<blockquote>
<p>self::$instance = new MyPDO();</p>
</blockquote>
<p>To my surprise no warning or error is generated with a single colon .. If any one knows about this please share. </p>
|
php
|
[2]
|
5,210,246 | 5,210,247 |
Hide & show image when mouse over
|
<p>I am working on pictures inside ASP.net (VB)
and try to make this picture hide when the mouse over and show if it mouse out
How can I do this without using script or jQuery ?</p>
<p>help me please </p>
|
asp.net
|
[9]
|
1,164,556 | 1,164,557 |
how to output it?
|
<pre><code>stdClass Object
(
[nid] => 98
[body] =>.....
[field_mg] => Array
(
[0] => Array
(
[data] => Array
(
[alt] =>
[title] =>
)
[uid] => 1
[view] => 98
</code></pre>
<p>The above is the <code>print_r()</code> result. The object is <code>$test</code>, now I want to output the <code>view</code> value (98).</p>
<p>How do I output it? <code>$test->body[field_img][0][view]</code> will not work.</p>
|
php
|
[2]
|
180,768 | 180,769 |
XML + Parser + webservice issue
|
<p>Hi~ I have received XML from server(web service), but I have got my xml with "<" and ">" in it. Should I change the "<" and ">" to "<" and ">" before I parse?</p>
<p>My web service only accept the "<" ">" when I send the xml back to server, which means I have to switch them around. How to switch them around in xcode?</p>
<p>I need to send data to the server and I have found three parsers here "KissXML" , "GDATAXML" and "libxml2" which one should I use? or Should I just use the NSXML?</p>
<p>I am not sure if this is the thing i am looking for:
<a href="http://stackoverflow.com/questions/1067652/converting-amp-to-in-objective-c">Converting &amp; to & in Objective-C</a></p>
<p>Please please help~ </p>
|
iphone
|
[8]
|
4,908,686 | 4,908,687 |
What's the difference between text and html datatypes when using jQuery's ajax()
|
<p>What does jQuery do differently when you specify the datatype as html as opposed to text. I haven't seen a difference but there must be some subtleties I'm missing. If I wish to return a portion of an html page as a string does it matter which I use?</p>
|
jquery
|
[5]
|
503,199 | 503,200 |
Why do I need "out" with string in c#?
|
<p>I know string is a value type in c#.
I understand everything in c# are passed by value</p>
<p>But if its value type anyway there is no need 'out' or 'ref' ?</p>
|
c#
|
[0]
|
5,645,722 | 5,645,723 |
Is it possible to create a float type with a min and max range?
|
<p>I know this can be done in Ada but I'm new to Java and don't know if I can do this. I would like to make a radian of float subtype from 0 to 2pi. Values outside the range would be considered out of range and through a constraint error. Any help is appreciated!</p>
|
java
|
[1]
|
1,865,398 | 1,865,399 |
how to pass the javascript variable to textbox?
|
<p>i would like to ask a question.</p>
<p>how can i pass the javascript generated code to the textbox "code" ?</p>
<p>I surf the internet but I cannot find the answer</p>
<p>I hope all of you can help me.</p>
<p>thanks!!</p>
<pre><code> <form><input name="code" type="text" value="" >
<script>
function makeid()
{
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for( var i=0; i < 6; i++ )
text += possible.charAt(Math.floor(Math.random() * possible.length));
alert(text);
return text;
}
</script>
<input type="button" style="font-size:9pt" value="Generate Code" onclick="makeid()">
</input></form>
</code></pre>
|
javascript
|
[3]
|
1,321,249 | 1,321,250 |
Cannot move_uploaded_file not even executing
|
<p>I am fairly new to PHP and am trying to upload an image via the move_uploaded_file function, please look at the section of code and please help. By the way, I am using IE8 if it is nessecary:</p>
<pre><code>$name = $_FILES['fileToUpload']['name'];
$basename = @basename($name);
$msg .= " File Name: ". $_FILES['fileToUpload']['name'] .", ";
$msg .= " File Size: ". @filesize($_FILES['fileToUpload']['tmp_name']);
if (isset($_GET['id'])) {
$id = $_GET['id'];
//check and/or create dir for user images
if (!is_dir("uploads\\".$id."\\images")) {
$dir = "uploads\\".$id."\\images";
mkdir($dir, 0777);
if (!move_uploaded_file($basename, $dir)){$msg = "COULD NOT MOVE FILE";}
}
}
</code></pre>
<p>The $msg "COULD NOT MOVE FILE" does not execute and the file has not been moved
Thanks in advance.</p>
|
php
|
[2]
|
5,003,800 | 5,003,801 |
Redraw owner drawn combo on selected index changed
|
<p>This is an extension of
<a href="http://stackoverflow.com/questions/10891214/c-sharp-combobox-with-lines">C# combobox with lines</a>. </p>
<p>The e.forecolor in this line -</p>
<pre><code>using (Pen DashedPen = new Pen(e.ForeColor, 1))
</code></pre>
<p>comes from an earlier selected cmbBoxLineColor combo.<br>
Right now I am passing the color as </p>
<pre><code> private void DlgGraphOptions_Load(object sender, EventArgs e)
{
Color selCol = cmbBoxLineColor.SelectedValue
string name = GetColorName(selCol)
ComboBoxItemLineStyle itemSolid = new ComboBoxItemLineStyle ("Solid Line",Color.FromName(name));
</code></pre>
<p>}</p>
<p>Basically, the user picks a color from cmbBoxLineColor.SelectedValue combo(which is a color picker control). I am passing this selected color name as a property to the ComboBoxItemLineStyle .
The very first time both cmbBoxLineColor and cmbBoxLineStyle have blue(which is the default color for cmbBoxLineColor
If I change the color in cmbBoxLineColor, then I need the cmbBoxLineStyle to redraw with the selected color from cmbBoxLineColor</p>
<pre><code> private void cmbBoxLineColor_SelectedIndexChanged(object sender, EventArgs e)
{
// I should be changing the color of the lines. So should I redraw cmbBoxLineStyle combo? How would I tell that combo to redraw itself
}
</code></pre>
<p>Hopefully, I am making myself clear..
Thank you</p>
|
c#
|
[0]
|
5,064,540 | 5,064,541 |
How to center align text in a tab bar in Android
|
<p>I want to put only text in tab bar, no image... I want to center text in a tab bar, horizontally and vertically. Exactly in the center.</p>
|
android
|
[4]
|
5,809,710 | 5,809,711 |
page.isvalid vs this.isvalid
|
<p>Is there any difference between using This.IsValid vs Page.IsValid?</p>
|
asp.net
|
[9]
|
1,715,654 | 1,715,655 |
android: parse html from page
|
<p>i would like to parse out some text from a page.</p>
<p>Is there an easy way to save the product info in to a string for example? Example url: <a href="http://upcdata.info/upc/7310870008741" rel="nofollow">http://upcdata.info/upc/7310870008741</a></p>
<p>Thanks</p>
|
android
|
[4]
|
5,167,353 | 5,167,354 |
Class with properties but few properties not assigned
|
<p>I have c# class i have different properties.</p>
<pre><code>public class Employee
{
public int ID;
public string Name;
public int Age;
}
WebServices pp=new WebServices();
Employee emp= pp.GetEmpInfo();
//pp is an instance of webservices which is web referenced in the app.
emp.ID=100;
emp.Age=25;
</code></pre>
<p>I don't assign/get return value for name from <code>GetEmpInfo()</code>, will that throw any exception?</p>
<p>If you have a class with 10 properties and don't assign few, will it break the application?</p>
<p>Please share your thoughts. There is some code in production, i am not sure of the result, so am checking.</p>
|
c#
|
[0]
|
3,796,892 | 3,796,893 |
Using a Timer every 5 second in a service, that the service whos call by a receiver
|
<p>I make a receiver that work, and this is the code:</p>
<pre><code>public class ServicioCargado extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent)
{
if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
Intent i = new Intent();
i.setAction("mauricio.androids.smsprojects.MyService");
context.startService(i);
}
}
}
</code></pre>
<p>and this is my service, he is created by the receiver but is close automate, and i dont want that, i want the timer keep running, and execute every 5 seconds, i dont see the problem, thank for all</p>
<pre><code>public class MyService extends Service {
private MyService actual=null;
private Timer timer = new Timer();
private static final long UPDATE_INTERVAL = 5000;
//private final IBinder mBinder = new MyBinder();
@Override
public IBinder onBind(Intent arg0) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
//Hacemos un while que cada cierto tiempo haga algo o un sleep
Toast.makeText(this,"Se esta ejecutando el programa para enviar sms", Toast.LENGTH_SHORT).show();
actual=this;
Log.d("Mauricio", "Creando servicio");
Toast.makeText(this,"Antes de ejecutar el timer", Toast.LENGTH_SHORT).show();
MyTimerExecution();
Toast.makeText(this,"Despues de ejecutar el timer", Toast.LENGTH_SHORT).show();
}
private void MyTimerExecution() {
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
// Imagine here a freaking cool web access ;-)
//Toast.makeText(actual,"Service update ...", Toast.LENGTH_SHORT).show();
Log.d("Mauricio","aqui");
}
}, 0, UPDATE_INTERVAL);
}
@Override
public void onDestroy() {
super.onDestroy();
if (timer != null) {
timer.cancel();
}
Toast.makeText(this, "Service destroyed ...", Toast.LENGTH_LONG).show();
}
}
</code></pre>
|
android
|
[4]
|
996,101 | 996,102 |
Working with rename function in PHP
|
<p>There is a file within the directory and I am trying to use rename( arg1, arg2 ) to rename the arg1 file. </p>
<p>However, the arg1 file contains Asian letters and I get the message that the file is not available.</p>
<p>how can I solve this issue</p>
<p>thanks</p>
<pre><code> $elements = scandir($dir);
foreach ($elements as $key => $value)
{
rename("./$value", "$newname");
}
</code></pre>
|
php
|
[2]
|
959,649 | 959,650 |
how to call click event of class file from user control by using c#
|
<p>I had created one user control and one class file, The user control contain save button. When user click save button then i want call the Insert() using ItemClickedEventHandler from infocore class file please help me.</p>
<p>C#: User Control</p>
<pre><code>public partial class toolbar : UserControl
{
public delegate void ItemClickedEventHandler(System.Object sender, ItemClickEventArgs e);
public toolbar()
{
InitializeComponent();
inf = new IAToolBar.infocore();
}
public event ItemClickedEventHandler ItemClicked;
public class ItemClickEventArgs
{
public string flag;
public ItemClickEventArgs(string flg)
{
flag = flg;
}
}
private void btnsave_Click(object sender, EventArgs e)
{
if (ItemClicked != null)
{
ItemClicked(sender, new ItemClickEventArgs("Save"));
}
}
}
</code></pre>
<p>C#: infocore.cs</p>
<pre><code>public void Insert(System.Windows.Forms.Form f, e)
{
connection.Open();
try
{
query = "INSERT INTO " + f.Tag.ToString().Trim() + " (" + queryfields + ") VALUES (" + formvalues + ") ";
MySqlCommand cmd = new MySqlCommand(query, connection);
cmd.ExecuteNonQuery();
MessageBox.Show("Save Sucessfully", "Inventory Accountancy", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString(), "Inventory Accountancy", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
connection.Close();
}
}
</code></pre>
|
c#
|
[0]
|
2,757,490 | 2,757,491 |
Cant display the google maps when release key is used( for publishing the app)
|
<p>My app.apk file works fine with the debug key in google maps. But when i use the release key its not displaying the map properly(only grid lines seen). I created the release key by following the steps in othr posts. Also used adb to install the app ( thro cmd prompt).</p>
<p>Any Suggestions</p>
|
android
|
[4]
|
5,824,467 | 5,824,468 |
jquery find divs with id higher than some number
|
<p>is there any way to find it?
for example:</p>
<pre><code>var number=5;
$("#"+>number).remove();
</code></pre>
<p>but I dont know how do something like it and if is it posibble :)
thanks</p>
|
jquery
|
[5]
|
5,178,425 | 5,178,426 |
notification's vibrate and sound defaults are working as INSISTENT
|
<p>When an event happens my handler calls my eventAlert() function that pops up a new notification. It doesnt matter if it is set with default flags or with custom sound, when notifiing comes the sound repeats itself just like with FLAG_INSISTENT. Even with FLAG_ONLY_ALERT_ONCE. If i specify a custom sound with Uri.parse it behaves the same way. All the same with vibration. However if a make a custom vibration, calling it with the Vibrator's vibreate(long[], int) function it only vibrates once as it should. What am i doing wrong, what is the most common mistake that leads here? How can i make it to vibrate and alert with sound only once? My eventAlert() is called once, im pretty sure. thx for your help!</p>
|
android
|
[4]
|
154,801 | 154,802 |
Python converts string into tuple
|
<p>Example:</p>
<pre><code>regular_string = "%s %s" % ("foo", "bar")
result = {}
result["somekey"] = regular_string,
print result["somekey"]
# ('foo bar',)
</code></pre>
<p>Why <code>result["somekey"]</code> tuple now not string?</p>
|
python
|
[7]
|
5,131,353 | 5,131,354 |
how to check the a particular application is install or not in a machine using c#
|
<p>the requirement is "I want to a program in c# which only check that a specified program is installed or not in a machine" and show a message that the program is installed or not.</p>
<p>Actually, I have a project program in c#, I want that after loading my project first form the application first check the VSS is installed on my machine because VSS is required for my project.</p>
<p>My Operating System is Windows 7.</p>
<p>Thanks
Hussain</p>
|
c#
|
[0]
|
1,983,885 | 1,983,886 |
Javascript: Replace string in html without destroying the elements for future event handlers
|
<p>I have this code that searches for a given string of characters (<code>_aff.tractionsCode</code>) and replaces it with another string (<code>tractionsId</code>), like so:</p>
<pre><code>content = document.body.innerHTML.replace(_aff.tractionsCode, tractionsId);
document.body.innerHTML = content;
</code></pre>
<p>Here's an example:</p>
<p>Assume <code>_aff.tractionsCode</code> is equal to {tractionsCode}</p>
<pre><code><div class="affiliate" rel="{tractionsCode}">{tractionsCode}</div>
</code></pre>
<p>It would need to replace both instances of {tractionsCode}</p>
<p>However, the problem is once this happens, it is replacing the loaded html so other javascript event handlers, which I may or (most likely) may not have access to, no longer function properly.</p>
<p>Is there a way to look through the html (including attributes like rel) and run the replace without overwriting all the html?</p>
<p>Or is there a better way entirely?</p>
<p>Thanks for the help!</p>
|
javascript
|
[3]
|
4,857,083 | 4,857,084 |
efficient null evaluation in java
|
<p>i got the following method </p>
<pre><code>public Person findByAdd(String add) {
try {
final String queryString = "select p from Destinations p where p.address = :add";
Query query = em.createQuery(queryString);
query.setParameter("add", add);
return (Person) query.getSingleResult();
} catch (RuntimeException re) {
throw re;
}
}
</code></pre>
<p>which throws null-pointer exception if Person object does not exist,and i want to do something like this</p>
<pre><code>if(person.getAdd !=null){
system.out.println ("address exist");
}
else
{
system.out.println ("please enter address ");
}
</code></pre>
<p>but this throws an exception if person doesn't exist,how can i efficiently evaluate the if person is null</p>
|
java
|
[1]
|
1,781,472 | 1,781,473 |
UIDatePicker Localizatiion Problem
|
<p>How to Localized UIDatePicker according to language selection from the application.
UIDatePicker has locale property so how to use please give idea.</p>
<p>Thank You.</p>
|
iphone
|
[8]
|
2,802,183 | 2,802,184 |
fadeIn a div or form depends on click in a form
|
<p>I use a form where elements hide or show depends on click in the checkbox, it's working fine</p>
<p><a href="http://jsfiddle.net/QEG5a/9/" rel="nofollow">http://jsfiddle.net/QEG5a/9/</a></p>
<p>Now I'll try to fade in another div/form if one of the checkboxes are checked, but nothing happened, does anyone know why?</p>
<pre><code>$('input:checkbox','.checkbox_container').click(function() {
var checked = $(this).prop('checked');
$.each($(this).data("connect").toString().split(","), function(index, value) {
var item = '#item'+value;
(checked) ? $(item)
.fadeOut()
.find("input:checked")
.removeAttr("checked")
: $(item).fadeIn() ;
if (value == 1){
$('#myform')
.html(item) //just for any output
.fadeIn();
}
});
});
</code></pre>
<p>Thank's a lot</p>
<p>Pit</p>
|
jquery
|
[5]
|
2,193,869 | 2,193,870 |
Creating dynamic objects to a parent object and assigning keys and values?
|
<p>I am almost there with this but cannot seem to get this functionality going as planned. </p>
<p>I have two arrays: keyArray and ValArray;</p>
<p>What I am trying to do is to have a function pass two arguments (keyArr,valArr). Within this function, a parent object is declared and a (for-loop) loops through the passed argument's length (in this case "keyArr") creates new objects according the length of the passed argument. And then, the newly created objects are assigned the keys and values.</p>
<p>The issue is that I am able to create the parent object"mObj", and children Objects to "mObj", but am only able to assgin keys and values to the first child object "obj0" not rest of the children objects correctly. At the end of the code, this is what I would like to get:</p>
<pre><code>enter code heremObj.obj0.firstname = John;
mObj.obj0.lastname = superfly;
mObj.obj0.email = "[email protected]";
mObj.obj1.firstname = John;
mObj.obj1.lastname = superfly;
mObj.obj1.email = "[email protected]";
mObj.obj2.firstname = John;
mObj.obj2.lastname = superfly;
mObj.obj2.email = "[email protected]";
</code></pre>
<p>This is my code:</p>
<pre><code> var keyArr = ["firstname","lastname","email"];
var valArr = ["John","Superfly","[email protected]"];
function test(keys,vals) // FUNCTION TEST ACCEPTS TWO ARGS
{
var mObj = {}; // PARENT OBJECT
var len = (keys.length); //ARGUMENT KEY'S LENGTH
for(var i=0; i<len; i++)
{
mObj["obj" + i] = {}; //CHILDREN OBJECTS ARE CREATED TO PARENT "mObj" OBJECT
mObj["obj" + i][keys[i]] = vals[i]; //KEYS AND VALUES ARE ASSIGNED HERE
}
alert(mObj.obj1.firstname); // CURRENTLY RETURNS "UNDEFINED"
}
test(keyArr,valArr);
</code></pre>
<p>Any insight into this would highly be appreciated.
Thank you.</p>
|
javascript
|
[3]
|
1,859,918 | 1,859,919 |
Class properties and __setattr__
|
<p>In Python class, when I use <code>__setattr__</code> it takes precedence over properties defined in this class (or any base classes). Consider the following code:</p>
<pre><code>class Test(object):
def get_x(self):
x = self._x
print "getting x: %s" % x
return x
def set_x(self, val):
print "setting x: %s" % val
self._x = val
x = property(get_x, set_x)
def __getattr__(self, a):
print "getting attr %s" % a
return -1
def __setattr__(self, a, v):
print "setting attr %s" % a
</code></pre>
<p>When I create the class and try to set <code>x</code>, <code>__setattr__</code> is called instead of <code>set_x</code>:</p>
<pre><code>>>> test = Test()
>>> test.x = 2
setting attr x
>>> print test.x
getting attr x_
getting x: -1
-1
</code></pre>
<p>What I want to achieve is that the actual code in <code>__setattr__</code> were called only if there is no relevant property i.e. <code>test.x = 2</code> should call <code>set_x</code>. I know that I can achieve this easily by manually checking if <code>a</code> is "<em>x</em>" is <code>__setattr__</code>, however this would make a poor design. Is there a more clever way to ensure the proper behavior in <code>__setattr__</code> for every property defined in the class and all the base classes?</p>
|
python
|
[7]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.