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 |
---|---|---|---|---|---|
376,327 | 376,328 | PHP Warning: Module 'json' already loaded | <p>While executing my PHP code in editor (Eclipse), I am getting this error: </p>
<blockquote>
<p>PHP Warning: Module 'json' already loaded in Unknown on line 0.</p>
</blockquote>
<p>What's the problem here, and how do I fix it?</p>
| php | [2] |
1,909,357 | 1,909,358 | How to trim document.getElementbyId value in JavaScript? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/196925/what-is-the-best-way-to-trim-in-javascript">What is the best way to trim() in javascript</a> </p>
</blockquote>
<p>How to trim document.getElementbyId value in JavaScript?</p>
| javascript | [3] |
6,015,095 | 6,015,096 | Help learning C++ on unix. OS, machine, books, IDE .. the whole caboodle! | <p>I’m a C# and Java serverside windows programmer by day and want to learn C++ on Unix in my spare time. </p>
<p>I have very limited knowledge of C++ (from my university days).</p>
<p>I currently own a dell laptop running Vista. Should I create a dual boot system or buy a new machine? </p>
<p>Which Unix OS should I go for?</p>
<p>Which IDE should I use? …. NetBeans looks ok?</p>
<p>Which books should I read? I’m interested in texts covering the fundamentals, libraries, network programming, distributed systems. </p>
<p>Thanks</p>
| c++ | [6] |
3,097,574 | 3,097,575 | Creating blogs in ASP.Net | <p>How can we create blogs in ASP.Net? Please give some idea or code for implementing this functionality.</p>
| asp.net | [9] |
3,296,017 | 3,296,018 | Getting java.lang.ClassCastException: javax.swing.KeyStroke when creating a JSplitPane | <p>I'm getting a random unreproducible Error when initializing a JSplitPane in with JDK 1.5.0_08. Note that this does not occur every time, but about 80% of the time:</p>
<pre><code>Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.KeyStroke
at java.util.TreeMap.compare(TreeMap.java:1093)
at java.util.TreeMap.put(TreeMap.java:465)
at java.util.TreeSet.add(TreeSet.java:210)
at javax.swing.plaf.basic.BasicSplitPaneUI.installDefaults(BasicSplitPaneUI.java:364)
at javax.swing.plaf.basic.BasicSplitPaneUI.installUI(BasicSplitPaneUI.java:300)
at javax.swing.JComponent.setUI(JComponent.java:652)
at javax.swing.JSplitPane.setUI(JSplitPane.java:350)
at javax.swing.JSplitPane.updateUI(JSplitPane.java:378)
at javax.swing.JSplitPane.<init>(JSplitPane.java:332)
at javax.swing.JSplitPane.<init>(JSplitPane.java:287)
...
</code></pre>
<p>Thoughts? I've tried cleaning and rebuilding my project so as to minimize the probability of corrupted class files.</p>
<p><strong>Edit #1</strong> See <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6434148" rel="nofollow">http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6434148</a> - seems to be a JDK bug. Any known workarounds? None are listed on the bug entry page.</p>
| java | [1] |
3,919,780 | 3,919,781 | jQuery form not being submitted. Firebug no errors | <p>This jQuery isn't working. When i click Vote nothing happens. The div ratecontainer should disappear and nothing is inserted into MySQL when i check. In Firebug i get no errors. What did i do wrong?</p>
<pre><code>echo "<div class='ratecontainer'>
<form id='rateform' action=''>
<input type='hidden' id='rateid' value='$stackid' />
<input type='hidden' id='type' value='1' />
<a class='vote'>Vote</a>
</form>
</div>";
$(function() {
$('.vote').click(function() {
var rate= $("#rateid").val();
var type= $("#type").val();
var vote = "0";
var dataString = 'id=' + rate + '&type=' + type + '&v=' + vote;
//alert (dataString);return false;
$.ajax({
type: "POST",
url: "/rate.php",
data: dataString,
success: function() {
$('.ratecontainer').hide();
}
});
return false;
});
});
</code></pre>
| jquery | [5] |
5,610,945 | 5,610,946 | Android app doesn't close | <p>There is a point in my app where I need to kill the app completely. I use this to do so:</p>
<pre><code>protected void exitApp()
{
Dialogs.DismissAll();
finish();
int pid = android.os.Process.myPid();
android.os.Process.killProcess(pid);
}
</code></pre>
<p>My problem is that this only works sometimes. At other times when this gets called the device screen just turns black and doesn't go to the device home screen. To get to the home screen from this point I have to press the home button. Any ideas why?</p>
<p>(please don't lecture me about how this code is against Android development guidelines. I have read all the information about it and feel that this is the best approach to give the client what they want)</p>
<p>Thanks</p>
| android | [4] |
791,769 | 791,770 | Get the window height | <p>This is frustrating me. It should be something really simple but I can't get it to work in IE. I want to get the height of the current window: Not the scroll height, not the document height, but the actual window height. I've tried <code>window.innerHeight</code> which returns <code>undefined</code> and <code>document.documentElement.clientHeight</code> which gives the scroll height.</p>
| javascript | [3] |
4,176,114 | 4,176,115 | Android, Trying to embed YouTube video in webpage | <p>I’m trying to display a page of embed YouTube videos. I got the code from YouTube website. The page gets displayed correctly when I load it up in the browser but on my embedded web page the YouTube videos do not show the first frame. Its just a black box with the YouTube logo on the bottom. If you click on it, it does play the video. I tread to enable java script, still did not work.</p>
<pre><code>public class cVideos extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.videos);
WebView mWeb=(WebView) findViewById(R.id.webvideo);
mWeb.getSettings().setJavaScriptEnabled(true);
mWeb.getSettings().setJavaScriptEnabled(true);
// mWeb.loadUrl("http://www.besttechsolutions.biz/projects/bigbiz/mobvideo.php");
mWeb.loadUrl("http://www.besttechsolutions.biz/projects/bigbiz/videored.php");
}
}
</code></pre>
| android | [4] |
38,042 | 38,043 | Internet connection | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/596589/iphone-sdk-internet-connection-detection">iPhone SDK Internet connection detection</a> </p>
</blockquote>
<p>What is the best way to determine whether there is an available Internet connection for a iphone app. (Programatically of course) I want to disable/hide certain functions if the user is not connected to the Internet.</p>
<p>Can anyone help me?</p>
<p>Thanks in advance.........</p>
| iphone | [8] |
2,813,398 | 2,813,399 | What is the space efficiency of a directed acyclic word graph (dawg)? and is there a javascript implementation? | <p>I have a dictionary of keywords that I want to make available for autocomplete/suggestion on the client side of a web application. The ajax turnaround introduces too much latency, so it would nice to store the entire word list on the client.</p>
<p>The list could be hundreds of thousands of words, maybe a couple of million. I did a little bit of research, and it seams that a dawg structure would provide space and lookup efficiency, but I can't find real world numbers.</p>
<p>Also, feel free to suggest other possibilities for achieving the same functionality.</p>
| javascript | [3] |
1,598,154 | 1,598,155 | How the right associative of null coalescing operator behaves? | <blockquote>
<p>null coalescing operator is right associative, which means an expression of the form </p>
<p><strong>first ?? second ??third</strong> </p>
<p>is evaluated as </p>
<p><strong>first ?? (second ?? third)</strong></p>
</blockquote>
<p>Based on the above rule, I think the following translation is not correct.</p>
<p><strong>From:</strong></p>
<pre><code>Address contact = user.ContactAddress;
if (contact == null)
{
contact = order.ShippingAddress;
if (contact == null)
{
contact = user.BillingAddress;
}
}
</code></pre>
<p><strong>To:</strong></p>
<pre><code>Address contact = user.ContactAddress ??
order.ShippingAddress ??
user.BillingAddress;
</code></pre>
<p>Instead, I think the following is right one (Please correct me if I am wrong)</p>
<pre><code>Address contact = (user.ContactAddress ?? order.ShippingAddress) ??
user.BillingAddress;
</code></pre>
| c# | [0] |
5,510,346 | 5,510,347 | Window.location Working But Not everywhere | <pre><code>var where_to = confirm("You have locked this record. You can only leave by clicking cancel.");
if (where_to== true) {
alert(window.location);
window.location.href = window.location;
} else {
window.location.href = window.location;
}
</code></pre>
<p>This function works in IE 7 and firefox and opera 10.6. What it does is not allow a different page to load unless the user clicks a link or button that calls the token function.</p>
<p>The window.location.href is replaced with the current url unless the token function is called.</p>
<p>Thanks for your time.</p>
| javascript | [3] |
193,359 | 193,360 | How to know if the android device supports multi users? | <p>Android 4.2 supports multiple user spaces "on shareable devices such as tablets"(<a href="http://developer.android.com/about/versions/android-4.2.html#MultipleUsers" rel="nofollow">http://developer.android.com/about/versions/android-4.2.html#MultipleUsers</a>). How do I know if a specific device is a "shareable device"?</p>
<p>Can I programmatically check if the device supports multiple users?</p>
| android | [4] |
1,101,947 | 1,101,948 | My users are reporting my app is crashing - I never see this in the emulator | <p>I have a very vague questions to ask about a crashing android application.</p>
<p>Users are reporting to me that my application is crashing when they get something correct.</p>
<p>Basically it words like this: user answers the question correctly --> Display Toast--> send message to my service --> update screen from information received from the service</p>
<p>I have tested this on my G1 and have never see this on the emulator even with different screen sizes and resolutions. I tried putting try catch blocks around all my screen updating code but they are still reporting errors.</p>
<p>My guess is that the service might be terminating or something. But that is just a guess. Any ideas?</p>
<p>I am trying to get more information from the users but the Android Market commenting system is lacking in this respect.</p>
| android | [4] |
3,598,621 | 3,598,622 | test android app on lg p-690 | <p>can I test the app on this device if I don't have a data cable? I don't know how to do it or even if it is possible.</p>
<p>Do you need some specific phones in order to test the application?</p>
<p>Thank you,
Ryan</p>
| android | [4] |
481,979 | 481,980 | How to fetch all contacts of facebook and Gmail in PHP | <p>Which is the greatest, cheapest way in PHP that I can use to import Gmail, Yahoo, MSN, Facebook, Twitter contacts from my user's accounts if they wish to invite their friends?</p>
| php | [2] |
4,844,894 | 4,844,895 | What is wrong with this simple jQuery code? | <p>What is wrong with this jquery code, the error received on IE is </p>
<blockquote>
<p>Message: Expected ';'<br/>
Line: 10<br/>
Char: 10</p>
</blockquote>
<p>All I want is to move the mouse over and have an alter pop-up</p>
<pre><code><script language="javascript" type="text/javascript">
$(document).ready(function() {
$('#t').bind('onmouseover',function(){
target: '#t',
success: function(){
alert('test');
}
});
});
</script>
<div id="t">testing mouse over</div>
</code></pre>
<p>Thanks
Dave</p>
| jquery | [5] |
930,263 | 930,264 | Hiding/Showing column of a table with thead and tbody, thead shown in wrong place | <p>I have got a table with many columns (50+).</p>
<p>First of all, my examplecode: <a href="http://jsbin.com/irudo/2/" rel="nofollow">http://jsbin.com/irudo/2/</a></p>
<p>On clicking one of the th's it is said, to hide and add a new span to the page, to be shown again. The hiding works great, and the span is added to the page. But when i click the added span, nothing happens. I added non dynamically spans to the page, to see if my function works, and it does.</p>
<p>So, first question: Why do my added spans not have the click-event attached to them?</p>
<p>On showing the hidden th and td fields, my ths are not shown in the correct place where they were before hiding. They always appear beneath the table.</p>
<p>So, second question: Why do they appear at this position?</p>
| jquery | [5] |
3,302,648 | 3,302,649 | touch effect for Button in iphone | <p>how can i just change the color,of a button when i set the focus on the button in iphone.
I mean to say , for example we have 5 buttons, and i am just setting the focus on each of the button. i want those buttons to be higlighted with different color.
but when press or touch up inside the utton, the navigation is made to the respective forms, that is set for that button.</p>
| iphone | [8] |
3,654,840 | 3,654,841 | Parsing String and put this in array | <p>Can I get a method to parse a string eg: {"apple","fruit"} and put the elements in a two D array.</p>
| java | [1] |
4,604,899 | 4,604,900 | Android listview out of memory when scrolling | <p>Out of memory: Heap Size=31239KB, Allocated=28727KB, Bitmap Size=1542KB, Limit=32768KB</p>
<p>I have many items listview (1000-5000). Aftef 5-10 second fast scrolling i am getting Out of memory. </p>
<p>Method System.gc does not help.... </p>
| android | [4] |
3,601,947 | 3,601,948 | Where is the default parameter in Python function | <p>I think many people have seen the python's function which receives default parameters. For example:</p>
<pre><code>def foo(a=[]):
a.append(3)
return a
</code></pre>
<p>If we call this function using foo(), the output will append integer '3' each time after the call.</p>
<p>When this function is defined, a function object named 'foo' is defined in the current environment, and also the default parameter values are evaluated at this time. Every time when the function is called without a parameter, the evaluated parameter value will be changed according to the code.</p>
<p>My question is, <strong>where is this evaluated parameter exist?</strong>
<strong>Is it in the function object or it is in the method object when calling the function?</strong>
Since everything in python is a object, there must be some place to hold the name->value binding of 'a'-->evaluated parameter. Am I over-thinking this problem?</p>
| python | [7] |
2,177,930 | 2,177,931 | Why "throw ex;" hides original stack trace | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/178456/what-is-the-proper-way-to-re-throw-an-exception-in-c">What is the proper way to re-throw an exception in C#?</a> </p>
</blockquote>
<p>I want to understand why the "throw ex" usage hides the original stack trace? What was the fundamental philosophy behind the scene when designing c# compiler?</p>
| c# | [0] |
2,560,881 | 2,560,882 | Failed to install *.apk on device timeout Launch canceled | <p>I read all threads about this problem but the mentioned answers in the threads don't work for me. Can I find out which is the timeoutproblem with the help of a logfile? Is it possible that on my pc are drivers which have problems with the adb? How the adb works in detail if i start the debug process? Can anybody help me with this problem? I spent 16 hours of finding out what the problem is, but the only things I found out are that the problem has nothing to do with the installation of the eclipse, the adt plugin or the android sdk installation. Something with the connection between the emulator or my real device dont work.
If i create a new project and only change the appname or the text in the standard textview, then the app can be launched on the devices. If i do more changes for example create a new layout or something then the app wont work anymore. I am very frustrating in finding out whats wrong with the adb but till now i dont have luck to solve the problem. I hope someone can help me and others with the same problem. thanks.</p>
| android | [4] |
529,795 | 529,796 | Order of iterating Javascript object properties? | <p>If I have this code : </p>
<pre><code>o["a"]=1;
o["b"]=1;
o["c"]=1;
o["d"]=1;
for (var k in o)
{
alert(k)
}
</code></pre>
<ul>
<li><p>Would it <em>always</em>(cross browser) be alerted in the same order as the attribute were added ? </p></li>
<li><p>And what about this ? (same question)</p>
<p><code>var o={a:1,b:1,c:1,d:1}</code> ?</p></li>
</ul>
| javascript | [3] |
5,428,997 | 5,428,998 | How to add two possible keys in one keyboard button | <p>I've been trying to create my own android keyboard following <a href="http://android-developers.blogspot.com/2009/04/creating-input-method.html" rel="nofollow">this guide</a> and looking at the <a href="http://android.git.kernel.org/?p=platform/packages/inputmethods/LatinIME.git;a=blob;f=res/xml/kbd%5Fqwerty.xml;h=0493b99328d394a873476caf10725addd226a5f8;hb=HEAD" rel="nofollow">latinIME souce code</a>.</p>
<p>While reading the kbd_qwerty.xml file I noticed the different tags used and explained <a href="http://developer.android.com/intl/de/reference/android/inputmethodservice/Keyboard.Key.html" rel="nofollow">here</a>. I was expecting to see certain tag to reproduce what BetterKeyboard application does. They draw more than one key on each button. <a href="http://betterandroid.files.wordpress.com/2009/05/11.png" rel="nofollow">Example</a>.</p>
<p>Are they adding images or this is somehow possible from the xml?</p>
<p>Thanks for reading!</p>
| android | [4] |
268,642 | 268,643 | PHP: moving form $_FILES to $_GET | <p>I have one old function that i need to edit</p>
<pre><code>doSome($_FILES['image']);
</code></pre>
<p>my quesiton is how can i use the same function in order to get a file form GET instead of uploading it?</p>
<p>if i change to</p>
<pre><code>doSome($_GET['image']);
</code></pre>
<p>it doesn't sound to work...</p>
| php | [2] |
1,184,020 | 1,184,021 | how to read a php array from php file in python | <p>lets say we want to make a python config reader from php.</p>
<p>config.php</p>
<pre><code>$arr = array(
'a config',
'b config',
'c config => 'with values'
)
$arr2 = array(
'a config',
'b config',
'c config => 'with values'
)
</code></pre>
<p>readconfig.py</p>
<pre><code>f = open('config.php', 'r')
// somehow get the array then turns it into pythons arr1 and arr2
print arr1
# arr1 = {'a config', 'b config', 'c config': 'with values'}
print arr2
# arr2 = {'a config', 'b config', 'c config': 'with values'}
</code></pre>
<p>is this possible in python ? </p>
| python | [7] |
4,095,718 | 4,095,719 | Jquery; correctly selecting contents of a script tag | <p>I have a single page web application using jquery and a set of embedded templates. A template may contain tag like below:</p>
<pre><code><script type="html/template" id="sample">
<script type="text/javascript" charset="utf-8">alert('x');</script>
</script>
</code></pre>
<p>and a jquery code to retrive the template is</p>
<pre><code>$("#sample").html();
</code></pre>
<p>The output of above jquery command is</p>
<pre><code><script type="text/javascript" charset="utf-8">alert('x');
</code></pre>
<p>Instead of</p>
<pre><code><script type="text/javascript" charset="utf-8">alert('x');</script>
</code></pre>
<p>How can I fix this output ?</p>
| jquery | [5] |
220,824 | 220,825 | Connection through ip address | <p>I am trying to obtain the ip address from a text file so when I use the following code it does noy work..</p>
<pre><code> System.out.println("get = "+get); //get is where the ip address is stored after reading from file and it is successfully received as well
Socket client=new Socket(get,5000);
</code></pre>
<p>I have even tried the same thing through InetAddress as follows..but it does not work as well.</p>
<pre><code> InetAddress ik= InetAddress.getByName(get);
Socket client=new Socket(ik,5000);
</code></pre>
<p>but when I manually provide the ip in get it works.I dont understand where am I wrong?</p>
<pre><code> String get="192.168.1.224";
</code></pre>
| java | [1] |
1,834,916 | 1,834,917 | Kill a Thread On Dialog Close | <p>I have a thread that runs in a loop, and would like to kill a thread once a dialog that started the thread closes. What is the best way to do that?</p>
| java | [1] |
4,119,300 | 4,119,301 | Reading from a plain text file | <p>Say I have the following in a text file:</p>
<blockquote>
<p>car<br>
apple<br>
bike<br>
book</p>
</blockquote>
<p>How can I read it and put them into a dictionary or a list?</p>
| python | [7] |
3,448,543 | 3,448,544 | how to get value from expandable list view child value | <p>I want to create custome expandable list view in android but when I click on child, no value found and my click event is given below:</p>
<pre><code>mExpandableListView.setOnChildClickListener(new OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
Toast.makeText(getBaseContext(), "Child clicked",
Toast.LENGTH_SHORT).show();
return true;
}
});
</code></pre>
<p>Anyone knows? please help
Thanks In Advance</p>
| android | [4] |
2,188,749 | 2,188,750 | Javascript multiple values in variable | <p>Is there any way to have one variable with multiple values like this:</p>
<pre><code>var variable = 1, 2, 3;
var enteredVal = 1;
if (enteredVal == variable){
alert('You chose the right number');
}
</code></pre>
<p>So if the variable enteredVal is equal to 1, 2 or 3, it will alert the message.
I can't seem to get my head around it.</p>
| javascript | [3] |
3,892,624 | 3,892,625 | How can i Assign a id to view Programmatically? | <p>I know it is basic but i am curios about that.</p>
<p>in xml file, we are assigning id to view like that "android:id="@+id/
something" and we are calling findviewbyid() but when i want to
create a layout programmatically in a class and when i add a view, how
do i assign default id "android:id="@+id/something" like that.</p>
<p>I think setid() is not same to default assignment.Setid() is extra.</p>
<p>Can anybody correct me?</p>
<p>Thx.</p>
<p>Duygu Kahraman</p>
| android | [4] |
1,284,036 | 1,284,037 | page has expired IE 8 while using php codeignitor | <p>I have a login screen once user enters username and password i get a page has expired, it happens only in IE 8 and all other browsers it works fine, I have got some links where they suggest to edit the session.cache_limiter to private refer <a href="http://shiflett.org/articles/how-to-avoid-page-has-expired-warnings" rel="nofollow">http://shiflett.org/articles/how-to-avoid-page-has-expired-warnings</a> but this also dint work for me, Can anyone please help on the above, </p>
<p>Thanks a lot
MAx </p>
| php | [2] |
4,049,178 | 4,049,179 | Python: How expensive is to create a small list many times? | <p>I encounter the following small annoying dilemma over and over again in Python:</p>
<p>Option 1:</p>
<p>cleaner but slower(?) if called many times since a_list get re-created for each call of do_something()</p>
<pre><code>def do_something():
a_list = ["any", "think", "whatever"]
# read something from a_list
</code></pre>
<p>Option 2:</p>
<p>Uglier but more efficient (spare the a_list creation all over again)</p>
<pre><code>a_list = ["any", "think", "whatever"]
def do_something():
# read something from a_list
</code></pre>
<p>What do you think?</p>
| python | [7] |
5,130,477 | 5,130,478 | showing error message in php | <p>want to show a error message as a result of a form action. For example </p>
<pre><code><form action=a.php
input .....
</form>
<span.....>
<?php
$variable(Initially the value of this variable null according to the result of form value will change)
?>
</span>
</code></pre>
<p>For a specific condition I want to set a value of $variable in a.php page and return to form page using <code>header();</code> . But <code>$variable</code> does not change. How can I change $variable from a.php ?</p>
| php | [2] |
3,081,366 | 3,081,367 | Auto position textblock | <p>i'm currently trying to position my textblock in a way where it would automatically load below the next textblock after eg i click a button. (Its like a messenger , just that the text are set by me depending on events)</p>
<p>Other than scrollviewer to contain more textblock if it overshoot the screen, what do i need to make that work? or do i have to set a textblock there and hide it :( </p>
<p>I'm currently testing it out in sketch flow, would be nice if someone can tell me what to use to get this done or refer me somewhere relalted</p>
<p>Thank you!
Regards,
RAinbow</p>
| c# | [0] |
5,699,330 | 5,699,331 | Checking if assertions are enabled | <p>You can enable/disable <code>assert</code> on the <a href="http://docs.oracle.com/cd/E19683-01/806-7930/assert-5/index.html" rel="nofollow"><code>ClassLoader</code></a>.</p>
<p>But how can you determine if they are already enabled?</p>
<p>(I want to take some code paths that perform expensive checks only if the JVM is invoked with assertions enabled.)</p>
| java | [1] |
4,674,282 | 4,674,283 | Add row to a table with Jquery,but don't need its value | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3576565/how-can-i-clone-a-row-in-a-table-without-cloning-the-values-of-the-input-elements">How can I clone a row in a table without cloning the values of the input elements inside it?</a> </p>
</blockquote>
<p>i am trying to add a row to a table.i found that we can use clone . my table has two text boxes in it in two different tr's .cloning the last row is also duplicating the values in my textbox's which i don't want ?Any ideas ???</p>
<p>my code </p>
<pre><code>$("#table-1 tr:last").clone();
</code></pre>
| jquery | [5] |
1,405,104 | 1,405,105 | Line 6 of this Javascript program is confusing me | <p>In the function <code>takeNormal()</code> below, there is a line that I don't understand at all. It is: </p>
<pre><code>var end = reduce(Math.min, text.length, map(indexOrEnd, ["*", "{"]));
</code></pre>
<p>Specifically, in this function reduce, it has all these different arguments (are they arguments?). How are they processed by reduce? Are they handled one after the other? Or, for example, does <code>Math.min</code> do anything to <code>text.length</code>? How do the different parts in reduce interact and what does reduce ultimately do to them?</p>
<pre><code> function splitParagraph(text) {
function indexOrEnd(character) {
var index = text.indexOf(character);
return index == -1 ? text.length : index;
}
function takeNormal() {
var end = reduce(Math.min, text.length,
map(indexOrEnd, ["*", "{"]));
var part = text.slice(0, end);
text = text.slice(end);
return part;
}
function takeUpTo(character) {
var end = text.indexOf(character, 1);
if (end == -1)
throw new Error("Missing closing '" + character + "'");
var part = text.slice(1, end);
text = text.slice(end + 1);
return part;
}
var fragments = [];
while (text != "") {
if (text.charAt(0) == "*")
fragments.push({type: "emphasised",
content: takeUpTo("*")});
else if (text.charAt(0) == "{")
fragments.push({type: "footnote",
content: takeUpTo("}")});
else
fragments.push({type: "normal",
content: takeNormal()});
}
return fragments;
}
</code></pre>
| javascript | [3] |
1,149,691 | 1,149,692 | Should I schedule an operation performed in an Android custom Application class onCreate() method? | <p>I have an Android application which depends on the value returned by a webservice. This value changes only once a week. Clients should detect this changed value, but the exact time they detect this change is not really important, 12 to 24 hours later should be no problem.</p>
<p>My current implementation starts an IntentService in the onCreate() method of my custom Application class which retrieves the value from the webservice. I also persist the last retrieved value in the SharedPreferences, so the application does not have to wait until this value is retrieved.</p>
<p>Now my question is if it is necessary to schedule the retrieval of this value after it's first retrieval in the onCreate() method, lets say after 12 hours. I know the onCreate() method is called only once in the lifecycle of an application, but I do not know how likely it is an application will be terminated by the Android system. Is it reasonable to assume that the application will be terminated enough times so that scheduling is not necessary? And in the case I should schedule the operation, what will be the best way to achieve this?</p>
| android | [4] |
2,798,767 | 2,798,768 | jquery attr use variable? | <p>Are you able to place a variable into attr of src?</p>
<p>Example:</p>
<pre><code>$("#member-image2").attr({src : image});
</code></pre>
<p>I am using facebook connect and the "image" is their variable and "member-image2" is my img ID ..</p>
<p>Is this even possible? Because as is, it is not doing it. </p>
| jquery | [5] |
3,362,058 | 3,362,059 | SDcard only RO even after set permissions | <p>I have added <code><uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /></code> to Manifest but I still get "SDcard mounted RO" when executing the below code. What am I doing wrong here?</p>
<pre><code> if(!extState.equals(Environment.MEDIA_MOUNTED)) {
Log.d(Tag.getTag(this),
("SDcard not mounted"));
}
else if (!extState.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) {
Log.d(Tag.getTag(this),
("SDcard mounted RO"));
}
else {
Log.d(Tag.getTag(this),
("SDcard mounted RW"));
}
</code></pre>
| android | [4] |
3,247,206 | 3,247,207 | What is static_case operator in C++? | <p>I've heard of <a href="http://msdn.microsoft.com/en-us/library/c36yw7x9(VS.80).aspx" rel="nofollow"><strong>static_cast operator</strong></a></p>
<p>Recently I've come across <strong>static_case</strong>, for instance:</p>
<pre><code>*ppv = static_case<IUnknown>
</code></pre>
<p>What does this mean?</p>
| c++ | [6] |
3,858,378 | 3,858,379 | How to use iPhone Camera as Bar Code Scanner? | <p>How can I use the iPhone camera to scan bar codes? I have gone through many of the links but I'm not able to figure out a proper way to implement this.</p>
| iphone | [8] |
2,123,413 | 2,123,414 | NSLocale is mostly empty - where are the attributes? | <p>I really just want to know whether the user has set the iPhone to 12 hour mode for time display.</p>
<p>The NSLocale class seemed to be describing (in vague unspecific terms without any examples or apparently useful methods) what I was after.</p>
<p>So I have created some NSLocale objects like so:</p>
<p>NSLocale *systemLocaleApparently = [NSLocale systemLocale];
NSLocale *currentLocaleWithLotsOfGoodies = [NSLocale autoupdatingCurrentLocale];</p>
<p>When I inspect these objects using the debugger or NSLog(), the best I can get is something along these lines:</p>
<p>{type = system, identifier = ''} </p>
<p>The current locale has an ID string in it, but nothing else.</p>
<p>From the documentation, I can lookup values from the locale, and one of these is an NSCalendar object. So I get that back and have a look at it, and it tells me it is "gregorian".</p>
<p>All of which is apparently of use to somebody... but what I would really like is a nice big dictionary of attributes showing all of the actual system properties, mainly so that my NSDateFormatters don't keep blowing up when a user chooses 12 hour format even though I have forced the formatters to use en_US_POSIX locale and a fixed setDate format.</p>
<p>(I'm sure NSCalendarDate never used to have these problems...)</p>
<p>Hopefully I am missing something blatantly (and probably embarrassingly) obvious, but perhaps someone kind would share it with me. Please :)</p>
| iphone | [8] |
2,800,290 | 2,800,291 | How to add <div> in <form> using javascript | <p>Is there a way I can add <code><div></code> element to form.</p>
<p>Tx</p>
| javascript | [3] |
453,656 | 453,657 | AudioTrack class with enqueue, play, stop, pause, resume | <p>I need to create a class to handle audio AudioTrack.</p>
<p>In this class must have methods that enqueue audiotracks and play them in sequence synchronously.</p>
<p>Could anyone help me?</p>
<p>I do not know dequeue synchronously and play each part of the audio.</p>
<p>I need to use it because the data is passed to the audiotrack in byte [] is not on file. So I can not use the MediaPlayer.</p>
| android | [4] |
5,351,591 | 5,351,592 | Class in c# which gives the information about the machine | <p>I want to get the information about the the machine configuration i.e like ip address of the machine</p>
| c# | [0] |
4,334,227 | 4,334,228 | Using Script manager causes the page to load slowly | <p>I use script manager in website to use ajax, but when I host my page it loads very slowly.
When I remove the script manger it loads quickly.
So what I have to do to solve this problem</p>
| asp.net | [9] |
5,846,263 | 5,846,264 | Im having trouble writing a console application to create a simple program to solve a math equation for superannuation | <p>could some one help me with this?
ive racked my head over an hour and i cant seem to get it to work
this is in C++ and ive been learning for a little bit but im still new...</p>
<pre><code>int main()
{
double rate, amount,time, S;
cout << "Insert the time of the super: ";
cin >> time;
cout << "Insert the rate (as a decimal, eg 1% AKA 101% = 1.01): ";
cin >> rate;
cout << "Insert the amount $: ";
cin >> amount;
S =("amount * (rate ^ time - 1)", pow(rate,time));
cin >> S;
cout << "The total amount is: " << "S /(rate - 1)" << endl;
system("PAUSE");
return 0;
}
</code></pre>
<p>i dont get a compile error but i can never get an answer from it</p>
| c++ | [6] |
5,447,932 | 5,447,933 | Calendar extender is not working | <p>I have a requirement to show edit panel as second row of a datagrid upon addnew link click. for this I have taken a div which has set display:none. I am able to show as second row upon addnew link click. now the actual problem starts.</p>
<p>this div got a text box which is tied to calendar extender to behave as a claendar upon textbox click. but calendar is not showing up when the html of invisible div is inserted as second row of grid. please let me know if anyone need code for better understanding the problem. any help will be appreciated. </p>
| asp.net | [9] |
2,932,686 | 2,932,687 | Check if a date range is within a date range | <p>i have the following class:</p>
<pre><code>public class Membership
{
public DateTime StartDate { get; set; }
public DateTime? EndDate { get; set; } // If null then it lasts forever
}
</code></pre>
<p>I need to make sure when adding to the following list that the new item doesn't overlap the dates from existing item:</p>
<pre><code>var membership = new List<Membership>
{
new Membership { StartDate = DateTime.UtcNow.AddDays(-10), EndDate = DateTime.UtcNow.AddDays(-5) },
new Membership { StartDate = DateTime.UtcNow.AddDays(-5), EndDate = null }
};
</code></pre>
<p>For example doing:</p>
<pre><code>var newItem = new Membership { StartDate = DateTime.UtcNow.AddDays(-15), EndDate = DateTime.UtcNow.AddDays(-10) }; // Allowed
var newItem2 = new Membership { StartDate = DateTime.UtcNow.AddDays(-15), EndDate = null }; // Not Allowed
if (AllowededToAdd(newItem))
membership.Add(newItem);
if (AllowededToAdd(newItem2))
membership.Add(newItem2);
</code></pre>
<p>I thought this would be simple but so far my attempts have all been wrong and i'm starting to confuse myself and was hoping someone had done something similar they could share. Thanks</p>
| c# | [0] |
2,641,397 | 2,641,398 | How do I check if istream is at the end of the file | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/6283632/how-to-know-if-the-next-character-is-eof-in-c">How to know if the next character is EOF in C++</a> </p>
</blockquote>
<p>I want to find out whether or not some istream has reached to the end of file.</p>
<p>Something like</p>
<pre><code>if (my_istream.peek() == EOF) {...}
</code></pre>
<p>The documentation advice to use <code>traits::eof()</code>. How do I do that? I don't understand.</p>
| c++ | [6] |
3,406,317 | 3,406,318 | Java's installed, but getting "Could not create the Java virtual machine" | <p>Trying to install: <a href="http://syedrezaali.com/code/SuperShape2D.zip" rel="nofollow">http://syedrezaali.com/code/SuperShape2D.zip</a></p>
<p>from... <a href="http://www.syedrezaali.com/blog/?p=1119" rel="nofollow">http://www.syedrezaali.com/blog/?p=1119</a></p>
<p>...on WindowsXP and Windows7 machine and keep getting an error:
"Could not create the Java virtual machine"</p>
<p>both machines have the latest version of Java installed. </p>
<p>Anyone clues why?</p>
| java | [1] |
4,525,992 | 4,525,993 | How to select center image in gallery in android | <p>can anybody tell how to select center image in gallery in android.Is there any property to alway select center image in galllery in android while scrolling gallery in android</p>
<p>Thanks</p>
| android | [4] |
3,066,317 | 3,066,318 | Java IO Performance Issue | <p>I am using:</p>
<pre><code>PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("test.txt"),1024*1024*500))
</code></pre>
<p>to write a large file (approx. 2GB). It takes 26 seconds to write. But, when I replace 500 with 10/20, it takes 19 seconds.</p>
<p>From <a href="http://java.sun.com/developer/technicalArticles/Programming/PerfTuning/" rel="nofollow">here</a>, what I understood is buffering gives better performance. If so, then why is this happening? I checked it by running 5 times each, so system/IO load is not an issue.</p>
| java | [1] |
3,013,878 | 3,013,879 | PHP Parse error: syntax error, unexpected T_VARIABLE in C:\Inetpub\wwwroot\hotel\edres.php on line 272 | <p>I Have been facing problem as shown in title for under evinced code please help me</p>
<pre><code><?php
$sql=mysql_query("UPDATE tariff SET avroom="$norm" WHERE type="$type"");
$upd="UPDATE reservation SET r_chkindt="$cid",r_chkoutdt="$cod",r_rooms="$norm",r_name="$name",r_email="$email",r_company="$comp",r_phone="$tele",r_address="$addr",r_spanyreq="$spreq" WHERE r_email="$emailn" and r_chkindt="$cind"";
$u=mysql_query($upd);
?>
</code></pre>
| php | [2] |
294,942 | 294,943 | GridView paging while iframe is there inside the gridview | <p>I am having an ASP.Net(ASP.Net 4.0) GridView control which is having an Iframe inside it and this iFrame is showing pdf pages with it. Everything is working as expected, but when I am enabling the Paging with the gridview, then it is showing the following error:-</p>
<hr>
<h2>The GridView 'GridView1' fired event PageIndexChanging which wasn't handled.</h2>
<p>*The above error is coming when I am clicking the paging else it is only showing me the first page without any issue.</p>
<p>To resolve the above error, I then put the following code:-</p>
<pre><code>Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging
GridView1.PageIndex = e.NewPageIndex
End Sub
</code></pre>
<p>But, now the paging works, but it always shows the first page with all the paging.</p>
<p>Then I altered the above code with the following code:-</p>
<pre><code>Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging
GridView1.PageIndex = e.NewPageIndex
GridView1.DataBind()
End Sub
</code></pre>
<p>But now, it shows the first page when the gridview loads but it shows nothing with the paging.</p>
<p>Please let me know where the issue is and oblige me thereby.</p>
| asp.net | [9] |
3,649,649 | 3,649,650 | How to detect if my android application is minimized or not programmatically? | <p>I am creating chat application.So whenever my application is minimized and new message arrives at my application , notification message will be display on the screen .I am having the code for notification ,but I am not able to check my application is minimized or not???</p>
<p>Any help will be greatly appreciated</p>
| android | [4] |
5,826,853 | 5,826,854 | Problem with time zone conversion iPhone | <p>I have a date in milli seconds(EST) and a user specific time zone. I want to convert it to the user specified time zone. Following is the code I tried. Need help:</p>
<pre><code> float val = ([managedObject.lmt_ms floatValue])/(1000.0);
NSDate * dt = [NSDate dateWithTimeIntervalSince1970:val];
NSTimeZone* sourceTimeZone = [NSTimeZone timeZoneWithAbbreviation:@"PST"];
NSTimeZone* destinationTimeZone = [NSTimeZone timeZoneWithAbbreviation:usrtimezone];
NSInteger sourceGMTOffset = [sourceTimeZone secondsFromGMTForDate:dt];
NSInteger destinationGMTOffset = [destinationTimeZone secondsFromGMTForDate:dt];
NSTimeInterval interval = destinationGMTOffset - sourceGMTOffset;
NSDate* destinationDate = [[[NSDate alloc] initWithTimeInterval:interval sinceDate:dt] autorelease];
NSLog(@"Dest time is:%@",destinationDate);
</code></pre>
| iphone | [8] |
4,512,551 | 4,512,552 | Handling Android application pause on incoming call and resume after call end | <p>I want to pause my android application when the phone receives an incoming call. After the call ends, I want my applications to resume automatically.</p>
<p>How would this be implemented in an Android application?</p>
| android | [4] |
2,148,483 | 2,148,484 | Parsing inline javascript variable to script src as parameter | <p>I'm new to JS, so please bear with me if this question might not make sense.</p>
<p>Is it possible to parse an inline js value to a js src value?</p>
<p>Suppose I have this inline js.</p>
<pre><code><script>
window.foo = window.foo || {};
window.foo.cam = { 'status';'logged-out'};
</script>
</code></pre>
<p>This is the javascript src which I like to parse the above value to to %value%.</p>
<pre><code><script src="http://bar.com/js.php?position=bottom&login_status=%value%"></script>
</code></pre>
| javascript | [3] |
5,869,207 | 5,869,208 | Trying to regain access to a wordpress based website | <p>My Dad has a website based on wordpress, he went into the wordpress dashboard and modified the home page incorrectly appending an extra level to it, then when he exited it made changes resulting in website being messed up and more importantly the login to wordpress has disappeared not allowing him to change it back.</p>
<p>I manually fixed the url to display the wordpress dashboard login, yet even when login it doesnt work, it takes be back to the wrong page.</p>
<p>I don't currently have access to the wordpress database but I do have access to the files generated from the database so my plan was to edit the correct file to set the home page path back to what it should be, hoping that will then allow me to get into Wordpress dashboard.
But I have very little knowledge of Wordpress, anyone help me here please. </p>
| php | [2] |
170,084 | 170,085 | Can't I filter first 5 elements? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1865552/selecting-the-first-n-items-with-jquery">Selecting the first “n” items with jQuery</a> </p>
</blockquote>
<p><a href="http://jsfiddle.net/MUyJ7/" rel="nofollow">Code</a> :</p>
<pre><code><div class="prova">Hello</div>
<div class="prova">Hello</div>
<div class="prova">Hello</div>
<div class="prova">Hello</div>
<div class="prova">Hello</div>
<div class="prova">Hello</div>
<div class="prova">Hello</div>
<div class="prova">Hello</div>
<div class="prova">Hello</div>
<div class="prova">Hello</div>
$('.prova:gt(' + 0 + '):lt(' + 5 + ')').html("Hello Edited");
</code></pre>
<p>I'd like to edit the first 5 elements. Why it ignores the first one? (which should be index 0).</p>
| jquery | [5] |
3,017,157 | 3,017,158 | javascript inheritance and instance variables | <p>I'm trying to understand how inheritance works in JS. Suppose we have a class:</p>
<pre><code>Class = function () {
this.A = 'A';
this.B = 'B';
};
</code></pre>
<p>and we are trying to extend it</p>
<pre><code>SubClass = function () {};
SubClass.prototype = new Class();
</code></pre>
<p>Do I understance correctly that after inheritance properties <code>A</code> and <code>B</code> are common for all instances of <code>SubClass</code>, since they belong to it's prototype? If yes, how can <code>Class</code> be extended so that <code>A</code> and <code>B</code> do not be part of prototype?</p>
<p><strong>UPD:</strong> note that <code>Class</code> uses <code>A</code> and <code>B</code>, so I can't declare them in SubClass.</p>
<p>Thank you in advance!</p>
| javascript | [3] |
2,594,623 | 2,594,624 | Single Page Application and $(window).bind('load', function() {....} | <p>I use this code to load an image gallery by binding it when window has completely loaded within a Single Page Application:</p>
<pre><code>$(window).bind("load", function() {
console.log("window loaded");
$("div#gallery").slideViewerPro({
autoslide: true,
thumbsVis: false,
galBorderWidth: 1,
galBorderColor: "#003f00"
});
});
</code></pre>
<p>This event is only valid whenever the window has loaded and in the case of a Single Page Application this event has only one callback right and this is only after the window has been loaded? whenever there is a change within my page the callback of $(window).bind(......) is never been invoked again?! What is more appropriate in Single Page Applications to ask for changes in content with jQuery for instance. Is there a haschange() or a dom_has_loaded() in jQuery?</p>
<p>I hope I pointed it out clearly.</p>
| jquery | [5] |
5,234,330 | 5,234,331 | Overriding a Javascript property with a function | <p>I would like to override an object property with a function, so that whenever the object's property is called, it will invoke the function and return the result.</p>
<p>Surely this should be possible in a dynamic language such as JS?</p>
<p><em>Context:</em></p>
<p>I'm trying to port some IE-only code to other browsers. The code makes extensive use of the the "Microsoft.XMLDOM" object for parsing and querying XML docs. I'd like to use the standard DOMParser in the non-IE browsers. The problem is that the Microsoft implementation exposes a non-standard 'text' property for XML elements, and this property is used extensively in the code-base, I'd like to tack an equivalent function onto the Element prototype. </p>
<pre><code>Element.prototype.text = function() {...}
</code></pre>
<p>doesn't work since when the code-base does 'myelem.text', it doesn't actually run the function, it just returns a pointer to it.</p>
<p>What should I do to make this work?</p>
| javascript | [3] |
2,638,309 | 2,638,310 | I cannot find my app by its name on Google Play but I can find it by package name? | <p>I developed an app and uploaded it onto Google Play. When I search for it by name it does not show my app, but if I search by my package name like "com.percentage" it shows my app. Can anyone please help me. How can I make my app searchable by its name and not by package name?</p>
| android | [4] |
2,207,587 | 2,207,588 | How to stop code execution while waiting for Wifi and Bluetooth adapters to enable in Android? | <p>I had to manually turn on the network adapters in my program, and on Android this takes a while for the hardware to power up, up to a second.</p>
<pre><code>//turn on network adapters
wifiManager.setWifiEnabled(true);
bluetoothAdapter.enable();
while(wifiManager.getWifiState()!=WifiManager.WIFI_STATE_ENABLED | bluetoothAdapter.getState!=BluetoothAdapter.STATE_ON)
; //no code here, just waiting for adapters to enable
//continue execution
getDeviceInfo();
</code></pre>
<p>The above method I'm using now is not elegant at all, the CPU is locked-up in the while loop. Any ideas how to implement this in a better way?</p>
| android | [4] |
5,888,296 | 5,888,297 | how to implement file filter in java | <p>How do I implement a file filter in Java so I can limit the possible files that are shown to a user in a "select file" dialog, or limit the list of files that I see when listing the files in a directory?</p>
| java | [1] |
5,065,221 | 5,065,222 | Wrong filename by image | <p>I have in my directory six images. He shows 2 images and 1 filename. The filename is wrong but he is in the directory but he shows not that image. Can you help me? I want that he show 2 images + 2 correct filename's. </p>
<pre><code><!DOCTYPE html>
<?php
//path to directory to scan
$directory = "images1/";
//get all image files with a .jpg extension.
$images = glob($directory . "*.jpg");
shuffle($images);
?>
<html>
<meta http-equiv="refresh" content="60" >
<head>
<title>Image</title>
</head>
<body>
<ul>
<?php
for($i=0;$i<2;$i++)
echo"<img src=\"$images[$i]\"width=\"300\"height=\"400\">";
echo basename($images[$i], ".jpg");
?>
</ul>
</body>
</html>
</code></pre>
| php | [2] |
3,674,044 | 3,674,045 | Using Delay on a textbox | <p>I am trying to build a functionality where a user types text in the textbox and after a delay of 1 second, each character typed is converted to its upper case. This should happen as the user types.</p>
<p>Can i do using jquery?</p>
| jquery | [5] |
3,622,539 | 3,622,540 | Editing a Photo | From ( X by Y ) to ( A by A ) | <p>When I upload my Facebook photo there are no requirements on the x and y dimensions of the photo. However Facebook finds a way to insert a 50px by 50px photo that is not distorted into the news feed. </p>
<p>The only way you could do this, unless I am mistaken, is by cropping the image so that x and y are equal and then scaling to 50px by 50px.</p>
<p>But I never see any photos with like half a face or off-centered. So how do they determine how to do the cropping. Are they using some sort of face detection algorithm or are users required to to this centering manually?</p>
| php | [2] |
3,439,581 | 3,439,582 | Android Webview video play | <p>I'm working on a app which uses a webview to display webpages, i want to play the videos if the url is a video link(youtube) or a video contains as a part of the webpage. I've tried to add the url directly to the webview but it doesnot play even youtube links, i've already enabled plugins and javascript in webview..... can anyone help me on this issue,</p>
| android | [4] |
1,696,306 | 1,696,307 | Generating Fibonacci sequence | <pre><code>var x=0,
var y=1;
var z;
fib[0] = 0;
fib[1] = 1;
for(i=2; i<=10; i++)
{
alert(x+y);
fib[i]=x+y;
x=y;
z=y;
}
</code></pre>
<p>I'm trying to get to generate a simple Fibonacci sequence but there no output. Can anybody let me know what's wrong?</p>
| javascript | [3] |
3,157,957 | 3,157,958 | jquery get all form elements, input, textarea, select | <p>Is there an easy way (without listing them all separately) in jquery to select all form elements and only form elements.</p>
<p>I can't use children() etc because the form contains other HTML. </p>
<p>E.g:</p>
<pre><code>$("form").each(function(){
$(this, "input,textarea,select")
</code></pre>
| jquery | [5] |
2,868,650 | 2,868,651 | crreation of folders 4 diff users and open files present on server through web page | <p>1.how to open files present on server when opened from web page using <code>java</code></p>
<p>2.how the attachments are stored on the server and how their path is extracted and then<br>
stored in database--(creation of a folder , how every user is assigned a different folder
etc) using <code>java</code>.</p>
| java | [1] |
5,055,688 | 5,055,689 | side effects of using ereg_replace and its replacement | <p>I'm new to php. I have the following code:</p>
<pre><code>$this->image["format"] = ereg_replace(".*\.(.*)$", "\\1", $imgfile);
$this->image["outputformat"] = ereg_replace(".*\.(.*)$", "\\1", $save);
</code></pre>
<p>which is working fine but I'm receiving an error Deprecated: Function ereg_replace().
I want to ask if there are any side effects of using deprecated functions in php? and if there is some other replacement. I tried preg but it's not working either. Thanks in advance :)</p>
| php | [2] |
1,105,327 | 1,105,328 | For this Method is an object reference necessary | <p>I'm new to C#. I wonder why I get errors for this:</p>
<p>Error: For this method a Object-Reference is necessary (translated from the German Message). Any Ideas. Seems to be correct for me.</p>
<pre><code>namespace DNS
{
public class Core
{
Dig dig;
public Core()
{
dig = new Dig();
}
public static void startTest()
{
dig.myServer = "10.10.10.10"; <------ ERROR
</code></pre>
| c# | [0] |
1,150,174 | 1,150,175 | Meaning of class containing Main method | <p>Is there any difference if <code>Main</code> method is defined in static or non-static class or is that class is public or not and if <code>Main</code> method is public or not?</p>
| c# | [0] |
430,030 | 430,031 | How to make Apache run ASP.NET / ASP.NET 2.0 | <p>Don’t ask me why… but i’ve been asked to make Apache run ASP.NET.</p>
<p>IT Worked ! </p>
<p>Even worked with ASP.NET 2.0 Site
help me i want to learn that</p>
| asp.net | [9] |
5,450,545 | 5,450,546 | Putting a code behind a button in C# | <p>I am trying to add a code behind the add button my code is this:</p>
<pre><code>class CalculateValues
{
private int _num1;
private int _num2;
public int Num1
{
get
{
return _num1;
}
set
{
_num1 = value;
}
}
public int Num2
{
get
{
return _num2;
}
set
{
_num2 = value;
}
}
public virtual int calculate()
{
return _num1 + _num2;
}
}
</code></pre>
<p>Here is the other code that has the button on it:</p>
<pre><code>public partial class Form2 : Form
{
public Form2()
{
CalculateValues myAdd = new CalculateValues();
MulitplyValues Add = new MulitplyValues();
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int total = myadd.Add(int.Parse(textBox1.Text), int.Parse(textBox2.Text));
MessageBox.Show(total.ToString());
}
</code></pre>
<p>But everytime it tell me <code>'myAdd' does not exist in the current context</code><br>
I am not understanding why it is not working. I have even tried a few different ways.</p>
| c# | [0] |
4,095,609 | 4,095,610 | Help applying Classes as fields | <p>What I am trying to do is to implement a constructor of an Object which is a class.
I have defined the class in the fields of the class; but because it is a class I dont know how to initialize it.</p>
<p>here is my class, and the fields.</p>
<pre><code>public class Player
{
// Instance variables.
//Weapon is a class.
//The max health starts at 30 health points.
private String myPlayerName;
private Weapon myWeapon;
private int myCurrentHealth;
private int myMaxHealth;
private int myNumPotions;
/**
* Constructor initializing class Player
* Parameters of the player should be:
* player name, players initial health, the players weapon.
*/
public Player(String myPlayer, int initialHealth, Weapon currentWeapon) {
myPlayerName = myPlayer;
myWeapon = new Weapon();
myMaxHealth = 30;
initialHealth = myMaxHealth;
myCurrentHealth = initialHealth;
myNumPotions = 0;
}
</code></pre>
<p>There is something going wrong here, Im not sure what? Can anyone help me construct the currentWeapon parameter?</p>
| java | [1] |
5,044,711 | 5,044,712 | How to serialize / deserialize correct a BST(generic type) - implementation(separate class or subclass) | <p>What would be the right way of serialize/deserialze a BST(generic type) I mean I'm thinking i should write a <code>class Serialize</code> which contains all the methods over a my generic container, but what if I make a subclass in my container which contains the serialize class? which would be the proper way of doing it?(java like)</p>
<p>Must the serialisation class be a independet class or it can be a subclass for the container?</p>
| java | [1] |
3,501,414 | 3,501,415 | Should I save ints in SQLite Database? | <p>I have optional data that can be downloaded from the app.. of course I need to check in every app start which optional data has been downloaded.. The optional data is numbered from 1 to 114.. I was wondering where to store this info?<br>
Should I save it in SharedSettings? or in my sqlite database? Is database access considered a heavy thing for the app?<br>
Thanks.</p>
| android | [4] |
2,743,391 | 2,743,392 | produce a matrix of strings on the basis of a list | <p>I want to produce a matrix on the basis of this data I have:</p>
<p>[[0, 1], [1, 0], [0, 2], [1, 1], [2, 0], [0, 3], [1, 2], [2, 1], [3, 0]]</p>
<p>What I want to do, is if the sum inside the square brackets is equal to 1, produce a string variable y_n where n is the counter of lists meeting that condition,
and yxn if the sum is greater than one, where n counts the number of strings produced.
So for my data it should produce:</p>
<pre><code>y_1
y_2
yx1
yx2
</code></pre>
<p>up to</p>
<pre><code>yx7
</code></pre>
<p>So my best attempt is:</p>
<pre><code>if len(gcounter) != 0:
hg = len(gcounter[0])
else:
hg=1
LHS=Matrix(hg,1,lambda i,j:(var('yx%d' %i)))
print(LHS)
</code></pre>
<p>The data is called gcounter.</p>
<p>It's not giving me an error, but its not filling LHS up with anything</p>
| python | [7] |
3,730,151 | 3,730,152 | How I can create a complex string in Java efficiently? | <p>I want to create a string which will look like the following:</p>
<pre><code> "[{"product_id":"123","name":"stack"},{"product_id":"456","name":"overflow"}]"
</code></pre>
<p>I have the <code>product_id</code> and <code>name</code> in two arrays. How can I create the above type of string most efficiently?</p>
| java | [1] |
3,292,581 | 3,292,582 | Should I be using Malloc? Errors with large array of objects | <p>I'm using a bit of legacy type code that runs on a framework, so I can't really explain whats going on at a lower level as I don't know.</p>
<p>However my code creates an array of objectives. </p>
<pre><code>int maxSize = 20;
myObjects = new Object*[maxSize+1];
myObjects[0] = new item1(this);
myObjects[1] = new item2(this);
for(int i=2; i != maxSize+1; i++){
myObjects[i] = new item3(this);
}
myObjects[maxSize+1] = NULL;
</code></pre>
<p>If <code>maxSize</code> is larger than 30 I get a whole load of errors I've never seen. Visual Studio draws up an error in xutility highlighting:</p>
<pre><code>const _Container_base12 *_Getcont() const
{ // get owning container
return (_Myproxy == 0 ? 0 : _Myproxy->_Mycont);
}
</code></pre>
<p>I've never used Malloc before, but is this where the problem lies. Should I be assigning using it to avoid this problem? </p>
| c++ | [6] |
5,968,502 | 5,968,503 | stdout and stderr anomalies | <p>from the interactive prompt:</p>
<pre><code>>>> import sys
>>> sys.stdout.write('is the')
is the6
</code></pre>
<p>what is '6' doing there?</p>
<p>another example:</p>
<pre><code>>>> for i in range(3):
... sys.stderr.write('new black')
...
9
9
9
new blacknew blacknew black
</code></pre>
<p>where are the numbers coming from?</p>
| python | [7] |
514,419 | 514,420 | RegisterClientScriptInclude | <p>i use ScriptManager.RegisterClientScriptInclude to include js file after partial postback it works fine
here :
**</p>
<blockquote>
<p>ScriptManager.RegisterClientScriptInclude(this, typeof(test4), "1", Page.ResolveClientUrl("~/slideshow/js/slideshow.js"));</p>
</blockquote>
<p>**
but i want to load more than one js files so i did this
**</p>
<blockquote>
<p>ScriptManager.RegisterClientScriptInclude(this,typeof(test4),"one",
Page.ResolveClientUrl("~/slideshow/js/slideshow.js"));
ScriptManager.RegisterClientScriptInclude(this, typeof(test4), "two", Page.ResolveClientUrl("~/slideshow/js/slideImg.js"));</p>
</blockquote>
<p>**
with two different string keys the first one works but the second not....please any help</p>
| c# | [0] |
5,323,268 | 5,323,269 | How to force std::cin not to do any implicit conversion? | <p>I was wondering if we can force std::cin so it doesn't performs any implicit conversion between data types, for e.g:</p>
<pre><code>unsigned int number;
cout<<"Please input a number :";
if(std::cin>>number)cout<<std::endl<<"Good number";
else cout<<"Bad number";
</code></pre>
<p>So if you punch -23 or 26.3 , it will simply perform implicit conversion and store the value in <code>number</code> which isn't I want. So can we stop this?</p>
<p>Thanks</p>
| c++ | [6] |
4,324,847 | 4,324,848 | 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] |
69,218 | 69,219 | Show/Hide Multiple Divs with Jquery | <p>I want to use some buttons to show/hide multiple divs using jquery.</p>
<p>The page will initially show all divs. The idea then is that there will be a button to reset (show all) and then separate buttons to show a particular div while hiding the rest.</p>
<p>Any help would be much appreciated.</p>
<pre><code><div class="buttons">
<a class="button" id="showall">All</a>
<a class="button" id="showdiv1">Div 1</a>
<a class="button" id="showdiv2">Div 2</a>
<a class="button" id="showdiv3">Div 3</a>
<a class="button" id="showdiv4">Div 4</a>
</div>
<div id="div1">Lorum Ipsum</div>
<div id="div2">Lorum Ipsum</div>
<div id="div3">Lorum Ipsum</div>
<div id="div4">Lorum Ipsum</div>
</code></pre>
| jquery | [5] |
3,032,446 | 3,032,447 | Where is the backup project | <p>I have in error that look like this</p>
<blockquote>
<p>Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.</p>
<pre><code>ASP.NET to identify an incoming user.
<authentication mode="Forms" >
<forms name="appNameAuth" loginUrl="admin/Login.aspx" defaultUrl="admin/manage.aspx">
</forms>
</code></pre>
</blockquote>
<p>I tried to find and delete the backup file but I have not found the file. Can you help me?</p>
| asp.net | [9] |
1,523,840 | 1,523,841 | Error:ISO C++ forbids comparison between pointer and integer | <p>I have got following:</p>
<pre><code> wxIntPtr* value;
CreateRegKey();
if (regkeyexist) {
if (regKey->HasValue("LoggingStatus")) {
regKey->QueryValue("LoggingStatus", value);
if (value == 1)
</code></pre>
<p>however i get the error as the c++ forbids comparison between pointer and integer</p>
| c++ | [6] |
5,376,719 | 5,376,720 | C++ implicit conversions | <p>Several comments on a recent answer of mine, <a href="http://stackoverflow.com/questions/862858/what-other-useful-casts-can-be-used-in-c/862896#862896">http://stackoverflow.com/questions/862858/what-other-useful-casts-can-be-used-in-c/862896#862896</a>, suggest that my understanding of C++ conversions is faulty. Just to clarify the issue, consider the following code:</p>
<pre><code>#include <string>
struct A {
A( const std::string & s ) {}
};
void func( const A & a ) {
}
int main() {
func( "one" ); // error
func( A("two") ); // ok
func( std::string("three") ); // ok
}
</code></pre>
<p>My assertion was that the the first function call is an error, becauuse there is no conversion from a const char * to an A. There is a conversion from a string to an A, but using this would involve more than one conversion. My understanding is that this is not allowed, and this seems to be confirmed by g++ 4.4.0 & Comeau compilers. With Comeau, I get the following error:</p>
<pre><code>"ComeauTest.c", line 11: error: no suitable constructor exists
to convert from "const char [4]" to "A"
func( "one" ); // error
</code></pre>
<p>If you can point out, where I am wrong, either here or in the original answer, preferably with reference to the C++ Standard, please do so.</p>
<p><strong>And the answer from the C++ standard seems to be:</strong> </p>
<blockquote>
<p>At most one user-defined conversion
(constructor or conversion function)
is implicitly applied to a single value.</p>
</blockquote>
<p><strong>Thanks to Abhay for providing the quote.</strong></p>
| c++ | [6] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.