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,750,522 | 2,750,523 | Java initialize question | <p>What does the below code do when you instantiate the StudentRegistrar class?</p>
<pre><code>public class StudentRegistrar
{
public StudentRegistrar ();
{
new RecordManager().Initialize();
}
}
</code></pre>
| java | [1] |
4,447,002 | 4,447,003 | MPMediaPlaylist play specfic song | <p>i have to play particular song from a MPMediaPlaylist.when user click on the on particular song.right now i am getting the complete playlist and song get played in oder.so i want that after the song get played it will remain in order how to do that any help let me know thanks in advance !!!! </p>
| iphone | [8] |
3,626,919 | 3,626,920 | Compilation Error in g++ 4.3.4 compiler | <pre><code>#include <iostream>
#include <string.h>
char* basename(const char* filname);
int main()
{
return 0;
}
char *basename(const char* filename)
{
char* base = (char *)filename;
return base ;
}
</code></pre>
<p>compiling on g++ 4.1.2 20070115 (SUSE 10): No issue</p>
<p>compiling on g++ 4.3.4 (SUSE 11) gives following error</p>
<p>fileName : 9 :error:declaration of char* basename(const char*) throws different exception</p>
<p>fileName:3:error: from previous declaration char* basename(const char*) throw () .</p>
<p>Kindly tell me why this is happening , Is there is any Interface changed in g++ between these two release (if I remove inclusion of string.h then compilation success on both version of g++ ,Is any Interface change in string.h).</p>
| c++ | [6] |
4,895,264 | 4,895,265 | Activity starts Remote service, Starts another activity and finish() initial activity. Is this a problem? | <p>My initial activiy is basically a splash screen while preforming initialization and login in to network server. To save memory I want to finish() the splash activity once it starts the main menu activity. I still want the remote service to operate. Testing shows it does. But am I going to get into trouble doing this?</p>
<p>I know I can restart the remote from the main menu activity but I am trying to save overhead by not starting it twice. The remote service is required by the splash activity.</p>
| android | [4] |
3,554,730 | 3,554,731 | Php: Why is this code not working? Is it cookies problem? | <p>I wrote some code to manage my wordpress mu website, but it seems to not work... It uses libcurl and is supposed to login and create new blog. After i load this script in my browser it only logs me in but no new blog is created and all urls on wp-admin are wrong (when i click on them, for example 'admin' or 'blogs' or 'users', etc i get 404). When i login manually, without this script, all urls are clickable. I think that this login part might be the problem... could someone help me with this? I'll paste code here, it's longer than what usually people are pasting into questions, but i would be really glad for any help...</p>
<p>Here's the code:</p>
<p>makeblog.php</p>
<p>baseconf.php</p>
<p>scrape-nonce.php</p>
| php | [2] |
3,184,195 | 3,184,196 | php url to absolute function now work with spaces and arabic chars | <p>i have these functions <a href="http://code.google.com/p/archivepress/source/browse/trunk/archivepress_plugin/archivepress/classes/url_to_absolute/?r=93" rel="nofollow">url_to_absolute</a> its work good but not work if the image url has space or arabic chars</p>
<p><strong>this working example</strong></p>
<pre><code><?php
require_once('url_to_absolute.php');
$url = 'http://site.com/news/view.aspx?id=23032012';
echo url_to_absolute($url, '/uploadedimages/Sections/Politics/Arabic_World/original/Administrative-detention.jpg'), "\n";
?>
look here if we have space in "Arabic World"
<?php
require_once('url_to_absolute.php');
$url = 'http://site.com/news/view.aspx?id=23032012';
echo url_to_absolute($url, '/uploadedimages/Sections/Politics/Arabic World/original/Administrative-detention.jpg'), "\n";
?>
</code></pre>
<p>it will not work and if there is arabic chars too</p>
| php | [2] |
3,162,173 | 3,162,174 | Install and use new font in iPhone Interface Builder? | <p>I need to install a new font and use it iPhone.I did the following steps:</p>
<ol>
<li>Install a Font in Fonts Folder.</li>
<li>Add Font in iPhone project file. test.otf.</li>
<li><p>Added font name "Fonts provided by application" in Plist file.</p>
<p>I check this font TextEdit. It is working fine, it is not affect in Interface Builder.</p>
<p>If i double click the Label to edit text, font is assigned and displaying with font but it is not displaying in normal mode.</p></li>
</ol>
| iphone | [8] |
83,488 | 83,489 | how to get defined variables and its values in php? | <p>here....i have problem in creating a language translation concepts without using db...
so here, i have 3 diff. files which contain diff. arrays which has a respective language value, now i have to fetch the value of this variables and print it.</p>
| php | [2] |
3,703,478 | 3,703,479 | JQuery’s $(document).ready is not always being called, is it a known issue? | <p>I am testing my script in IE9. I noticed that $(document).ready is not always being called. That means 1 out of 8 times the function referred by $(document).ready is not being called.</p>
<p>As soon as I move the $(document).ready call to the end of the document, it works perfectly. The problem arises only if I move the $(document).ready call to the section.</p>
<p>I read through the blog post that confirms this problem in IE6:
<a href="http://webbugtrack.blogspot.ca/2007/08/bug-153-self-closing-script-tag-issues.html" rel="nofollow">http://webbugtrack.blogspot.ca/2007/08/bug-153-self-closing-script-tag-issues.html</a></p>
<p>Considering the reputation of JQuery, I am surprised by the issue. Is this a known issue/bug and workaround for JQuery? Or am I missing anything?</p>
<p>Thank you,</p>
<p>UPDATE:</p>
<p>I just wanted to update with regards to this issue:</p>
<p>The script was working fine on the other browsers (Chrome and FF), only my dev machine's IE was problematic. Once I reset IE (reset and restore on the IS settings’ advanced tab) $(document).ready started to work as expected. So I know the solution, but I like to know the root cause.</p>
<p>While I am disappointed on IE’s shaky behavior, this case is left with an unanswered question:
One of IE’s setting changes the way that $(document).ready behaves, and it causes the problem I explained in this post. Does anybody know which setting cased this issue?</p>
| jquery | [5] |
4,391,594 | 4,391,595 | create array with form data which groups and sorts data | <p>I have some input fields than I want as an array so that I can view them in a table on my page. I have been able to create an array using <a href="http://api.jquery.com/serializeArray/" rel="nofollow">.serializeArray()</a></p>
<p>In <a href="http://jsfiddle.net/aaronk85/VNSam/3/" rel="nofollow">this fiddle</a> I have been able to output my array however I want the data to appear as it does in the table I have hard coded at the bottom of the fiddle, where it groups all the instances of Tom and Jerry into one row per id. Accumalating all sales values for that id etc. And I want to sort it by the total sale price column. I am aware of server side techniques to do this however in this case I am looking for a jquery solution. What is the best way to acheive this?</p>
| jquery | [5] |
918,570 | 918,571 | Android: How to use an xml string value to determine layout orientation | <p>I have a simple linear layout that I would like to change based on the screen size of the device. What I am trying to do is something like</p>
<p><code>
LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"<br>
android:orientation="@string/cover_orientation"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</code></p>
<p>I have created different dimen.xml files under values and values-xlarge so that the <code>cover_orientation</code> variable will take on a different value (either 'vertical' or 'horizontal') based on the screen size. </p>
<p><code>
string name="cover_orientation">"vertical"
</code></p>
<p>But this doesn't work. I have found a temporary work around that involves checking the screen size and changing the orientation manually:</p>
<p><code>
if(getResources().getString(R.string.screen_size) == "xlarge"){
((LinearLayout)convertView).setOrientation(1);
}
</code></p>
<p>but it seems like you should be able to do it the first way (much more elegant/less code).</p>
<p>I considered just having a different layout for each screen size, but the layout is actually quite big and this is the only change I need for the different screen sizes. So it didn't make much sense to me to duplicate the entire layout.</p>
<p>Thanks!</p>
| android | [4] |
1,602,372 | 1,602,373 | Access control on other page in asp.net | <p>How to access control in other aspx page from other aspx page in asp.net</p>
| asp.net | [9] |
4,970,082 | 4,970,083 | Confused about Python's with statement | <p>I saw some code in the Whoosh documentation:</p>
<pre><code>with ix.searcher() as searcher:
query = QueryParser("content", ix.schema).parse(u"ship")
results = searcher.search(query)
</code></pre>
<p>I read that the with statement executes __ enter__ and __ exit__ methods and they are really useful in the forms "with file_pointer:" or "with lock:". But no literature is ever enlightening. And the various examples shows inconsistency when <strong>translating between the "with" form and the conventional form</strong> (yes its subjective).</p>
<p>Please explain </p>
<ul>
<li>what is the with statement</li>
<li>and the "as" statement here</li>
<li>and best practices to translate between both forms</li>
<li>what kinds of classes lend them to with blocks</li>
</ul>
<hr>
<p><strong>Epilogue</strong></p>
<p>The article on <a href="http://effbot.org/zone/python-with-statement.htm" rel="nofollow">http://effbot.org/zone/python-with-statement.htm</a> has the best explanation. It all became clear when I scrolled to the bottom of the page and saw a familiar file operation done in with. <a href="http://stackoverflow.com/users/190597/unutbu">http://stackoverflow.com/users/190597/unutbu</a> ,wish you had answered instead of commented. </p>
| python | [7] |
2,114,625 | 2,114,626 | Reuse inflated views | <p>I am building a complex view based on dynamic data. Depending on the number of data elements in collections I am adding more views. Each of these subviews are complex and get inflated in the loop through the data collection.</p>
<p>This is of course inefficient and I would like to figure out a way to inflate the subview only once and then reusing them instead. Is this possible somehow?</p>
<p>PS: I do not want to build up the subviews in code (I know I could) because that would make things even messier due to the complexities and number of subviews, but if the performance would increase considerably I might take a look at that.</p>
<p>PPS: There is no visible performance problem but traceview that most of the time is spent inflating and if I can make it faster I would love to ;-)</p>
| android | [4] |
5,214,804 | 5,214,805 | Is it ok to abuse webview? | <p>With webview you can make a layout using plain html, posing that you do not need to alter anything by code is it ok to just use webview?Overall performances are the same of native component or decrease?</p>
| android | [4] |
65,552 | 65,553 | system.linq.strings is inaccessible due to its protection level | <p>I am having a problem with the last line of code because of the strings. It is giving me the error <code>system.linq.strings is inaccessible due to its protection level</code> even though I am
using the <code>Microsoft.VisualBasic</code> namespace.</p>
<pre><code>private byte[] CreateKey(string strPassword)
{
//Convert strPassword to an array and store in chrData.
char[] chrData = strPassword.ToCharArray();
//Use intLength to get strPassword size.
int intLength = chrData.GetUpperBound(0);
//Declare bytDataToHash and make it the same size as chrData.
byte[] bytDataToHash = new byte[intLength + 1];
//Use For Next to convert and store chrData into bytDataToHash.
for (int i = 0; i <= chrData.GetUpperBound(0); i++) {
bytDataToHash[i] = Convert.ToByte(Strings.Asc(chrData[i]));
}
}
</code></pre>
| c# | [0] |
956,445 | 956,446 | php number_format() where formating string is a variable | <p>I get the following error when I try to use number format in php:</p>
<p>Notice: A non well formed numeric value encountered</p>
<pre><code>$number = 10345.34543;
$format = "0, ',', '.'";
echo number_format($number, $format);
</code></pre>
<p>I am almost positive it is because I'm holding the formating part in a string, but is there any way around this?</p>
<p>Thanks.</p>
| php | [2] |
5,314,657 | 5,314,658 | ASP.net simulate browser back button | <p>I'm working on my ASP.NET web project using VS2010, C#, I'm inserting a hyperlink in my page, labeled as BACK, and I want it to act like browser back button, how should I implement it? what is the easiest way?
how should I set its navigateURL property?
thanks</p>
| asp.net | [9] |
2,675,611 | 2,675,612 | android-application for study words | <p>I want to do an application for study words.</p>
<p>So, I want to make like a presentation of words-one follow one after 5 seconds.
What is the best way to do that?</p>
| android | [4] |
5,097,318 | 5,097,319 | Login failed for user 'sa'. in connection string | <p>i m getting error of "Login failed for user 'sa' " while i try to connect server by setting value through string variable </p>
<pre><code>private SqlConnection getDbConnection = new SqlConnection("Data Source="+dbname+";Initial Catalog="+catname+";User Id=sa;Password=sa;Integrated Security=false");
</code></pre>
<p>and then i use normal connection string with no string variable its work well like below. </p>
<pre><code>private SqlConnection getDbConnection = new SqlConnection("Data Source=Ali-pc\\;Initial Catalog=master;User Id=sa;Password=sa;Integrated Security=false");
</code></pre>
| c# | [0] |
4,479,355 | 4,479,356 | Initialize properties at the load event or in the constructor? | <p>I have a property that references a service layer object and I need it every time I use a form.
What is the best pratice: initialize a property in the constructor or in the form's load event?</p>
| c# | [0] |
200,601 | 200,602 | How to set the default XML namespace for an XDocument | <p>How can I set the default namespace of an existing XDocument (so I can deserialize it with DataContractSerializer). I tried the following:</p>
<pre><code>var doc = XDocument.Parse("<widget/>");
var attrib = new XAttribute("xmlns",
"http://schemas.datacontract.org/2004/07/Widgets");
doc.Root.Add(attrib);
</code></pre>
<p>The exception I get is is <code>The prefix '' cannot be redefined from '' to 'http://schemas.datacontract.org/2004/07/Widgets' within the same start element tag.</code> </p>
<p>Any ideas?</p>
| c# | [0] |
437,327 | 437,328 | dictionary library in C++ | <p>I have to use write a program in which the dictionary should be used to check whether one string is a valid word in it. Is there any dictionary library I could use? If not, how could I construct a dictionary for query?</p>
<p>Thanks!</p>
| c++ | [6] |
990,526 | 990,527 | which tool should I use in order to create python API documentation? | <p>I am new in python and I am wondering which tool python developers use
in order to generate API. I have searched <a href="http://stackoverflow.com">here</a> but all the posts
that I found are not from 2011-2012 and I am wondering if a new tool has risen.</p>
<p>I have found Sphinx but as I understood Sphinx doesn't embed documentation
inside the code. Is there any tool like doxygen and if there is do you recommend it?</p>
| python | [7] |
3,200,091 | 3,200,092 | How to block iframe cookies? | <p>Is there a way to block iframe cookies,the solution should not be browser specific, I have got to allow/block third party cookies from getting downloaded to the users system depending on his/her consent. Is there any way this can be done.</p>
| javascript | [3] |
4,516,487 | 4,516,488 | Incomplete type named in nested name specifier | <p>I was compiling the following code:</p>
<pre><code>class B;
class A {
A();
friend A B::newAObject();
};
class B {
friend A::A();
public:
A newAObject();
};
</code></pre>
<p>This may seem strange, but the idea was to have a class <code>A</code> that could only be produced by an object of type <code>B</code> (who would probably be a singleton).</p>
<p>The problem is that I've created a circular dependency between these objects. <code>A</code> must be defined before <code>B</code>, and <code>B</code> must be defined before <code>A</code>. Apparently forward declaring <code>B</code> is not good enough, <code>B</code> must actually be fully defined before <code>A</code> (and vice versa).</p>
<p>How do I get around this?</p>
<p>Edit: the actual error is: Incomplete type 'B' named in nested name specifier.</p>
<p>Note: there is another post that is similar to this here: <a href="http://stackoverflow.com/questions/4572483/error-incomplete-type-used-in-nested-name-specifier-g">Error: incomplete type used in nested name specifier, g++</a>, but it's heavily templatized and that was confusing me, hence this post.</p>
| c++ | [6] |
5,860,785 | 5,860,786 | java : Parsing An ArrayList and setting them into a Object | <p>I have these two classes:</p>
<pre><code>class Student
{
String name;
String age ;
}
class Person
{
String name;
String age ;
String grade ;
}
</code></pre>
<p>In the code below, I am creating <code>Student</code> objects and setting them inside the <code>ArrayList</code>. Once the data is set in the <code>ArrayList</code>, I need to parse that <code>ArrayList</code> and set the values in another object:</p>
<pre><code>public class Work {
public static void main(String args[]) {
List StudentItems = new ArrayList();
Student stud1 = new Student();
Student stud2 = new Student();
stud1.name = "ABC";
stud1.age = "28";
stud2.name = "XYZ";
stud2.age = "38";
StudentItems.add(stud1);
StudentItems.add(stud2);
Person[] pers = new Person[StudentItems.size()];
for (int i = 0; i < StudentItems.size(); i++) {
pers[i] = new Person();
// I am confused here , could anyone please help
}
}
}
</code></pre>
| java | [1] |
1,023,982 | 1,023,983 | How to setup a textarea with auto suggest from Dictionary | <p>This Question is bit broad, I did enough research and asking here so that I can get at least some suggestions. </p>
<p>I am trying to set up auto complete textbox/textarea dictionary suggestions. I have tried to setup auto-complete from <code>JSON data from server</code> and I am able to do that.. But here my question is, Can I set up a textarea with auto suggest from dictionary words like when we are entering some text in Word processor. Is it possible through any API available? </p>
| javascript | [3] |
3,026,933 | 3,026,934 | What does Python's dir() function stand for? | <p>I know that the dir() function gives you back either the names defined in the current scope or the names defined in an object. But why is it called dir()? Is it some mysterious acronyms like LISP's CAR and CDR?</p>
| python | [7] |
3,869,730 | 3,869,731 | Clearing screen in Python (when using Pythonwin) | <p>When I use something like Pythonwin I always have to highlight everything in the debugging window and press delete to get rid of everything. Is there a way to make the program autoclear the debug window?</p>
| python | [7] |
2,466,533 | 2,466,534 | fingerprint reader | <p>i have a fingerprint reader device for pc but now i want to connect that fingerprint reader to my android mobile ?anyone help me which is the usb connector for this???</p>
| android | [4] |
1,365,304 | 1,365,305 | how to save images displayed in webview? | <p>I want to save the images displayed in webview into local storage, and webview should have cached the images it displays ,how can i access the cached images and save them into storage?</p>
| android | [4] |
4,851,779 | 4,851,780 | Destroy consume memory | <p><strong>hello friends</strong> </p>
<p>i have develop one application in which i have lots of <strong>images and sound</strong>, </p>
<p>i can release sound easily by <code>release()</code> method but i can't able to release image.<br>
can you tell me how can i release image ?<br>
earlier i have use <code>system.gc()</code> function but it is not working for image i thing it is garbage collector.<br>
second thing is that can you give me precaution step against <code>memory management</code> (<strong><em>regarding of image,sound & codeing part also</em></strong>) </p>
<p><strong>Thanks<br>
nik</strong> </p>
| android | [4] |
4,826,065 | 4,826,066 | get sibling that has id | <p>So I have the following structure:</p>
<pre><code><div id="some id">
<div>
<input id="some other id" ....>
.....bunch of other inputs with no id field....
<select onclick="findSiblingWithId()">
</div>
<div>
<input id="some other id" ....>
.....bunch of other inputs with no id field....
<select onclick="findSiblingWithId()">
</div>
<div>
<input id="some other id" ....>
.....bunch of other inputs with no id field....
<select onclick="findSiblingWithId()">
</div>
</code></pre>
<p>So in my findSiblingWithId i don't know the id I'm looking for, all I know is that for the other components in the same div, only one will have an id. How can I get that ? </p>
<p>Edit:
Since it seems I didnt explain well enough I'll try to add more info. So I want for example when the select component changes (here it could be a button or anything, it doesnt matter) to get the corresponding <code><input id="some other id" ..></code> from the same div.</p>
<p>Like I tried to explain above, I have one huge div, the <code><div id="some id"></code>, now this contains a number of smaller <code><div></code> without ids. </p>
<p>Each of these smaller divs will have ONE inputfield with an ID and a bunch of other without an ID. Now on an action, doesn't matter if a button click or whatever, from a component located IN THE SAME div (I thought the correct work would be 'sibling') is there a way I can find the input that has an ID attribute?</p>
<p>Regards,
Bogdan</p>
| javascript | [3] |
3,498,639 | 3,498,640 | Remove elements from one List<T> that are found in another | <p>I have two lists</p>
<pre><code> List<T> list1 = new List<T>();
List<T> list2 = new List<T>();
</code></pre>
<p>I want remove all elements from list1, which also exist in list2. Of course I can loop through the first loop looking for each element in list2, but I am looking for elegant solution.</p>
<p>Thanks!</p>
| c# | [0] |
3,139,409 | 3,139,410 | how to explode a string and make an echo of a chosen attribute | <p>I have a string containing ; subdivided by , and would like to make an echo of a chosen value.</p>
<p>My string is <code>$string='Width,10;Height,5;Size,1,2,3'</code></p>
<p>I want to make an echo of the Height value (echo result must be 5)</p>
| php | [2] |
5,256,301 | 5,256,302 | java inventory checker with contains with method | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/6881596/android-game-rpg-inventory-system">Android game rpg inventory system</a> </p>
</blockquote>
<p>Still stuck on making my rpg in java, there's one method I don't know how to implement. Right now, I want to make an inventory checker for the game, like for example it checks how many herbs are in my pack...how many candies I have in my pack and so on. </p>
<p>How can I implement an inventory for my game and how can I show the players what items are in the inventory present?</p>
<p>Is contains method necessary?</p>
| java | [1] |
2,040,967 | 2,040,968 | iphone doesn't refresh the localized icon after you change language setting ! | <p>I manage to localized app icon and app name for different languages.I found the icon changes depending on the language setting on the iphone only when the first time when you install the app from xcode. </p>
<p>after that, if i change the language setting, the app icon stay the same but only the app name changes to the localized one. </p>
<p>Anyone has an idea is there is way of solving the problem? it seems iphone doens't refresh the icon after you change the language setting. </p>
<p>Tony</p>
| iphone | [8] |
4,395,407 | 4,395,408 | Convert REST url in javascript literal | <p>I want to convert a REST style url into a javascript literal, like this:</p>
<p>from:</p>
<pre><code>var url = "/a/b/c/d";
</code></pre>
<p>to:</p>
<pre><code>var obj = {
a:{
b:{
c:{
d:{}
}
}
}
};
</code></pre>
<p>How would you do this?</p>
| javascript | [3] |
1,672,542 | 1,672,543 | Embbeding console application inside my application | <p>I have a console application who start two other console application (not written in C#).</p>
<p>Can I direct the output of the applications to the same CMD window of my application?</p>
<p>Or even just disable them from showing?</p>
| c# | [0] |
2,616,866 | 2,616,867 | What is the quickest way to translate char* to number? | <p>What is the quickest way to translate char* to number ? I need to convert 4 chars to int, or two chars to short int.
I tried like</p>
<pre><code>char* ar;
//fill ar with values
int x= ar[1]+1[2]<<8+ar[3]<<16+ar[4]<<24; // ar[0] number of chars for number (short 2, int 4)
</code></pre>
<p>but result is always zero.( to explain I convert numbers to char* and than send over network, on another side I am trying to reverse process).</p>
| c++ | [6] |
4,644,358 | 4,644,359 | defineGetter & defineSetter on CSSStyleDeclaration.prototype | <p>I want to implement a fake style named <code>myColor</code> on all elements. When setting <code>myColor</code> style on the element, the actual <code>color</code> should be set with the same value. The apparent way of doing this is to use <code>__defineSetter__</code> and <code>__defineGetter__</code> on <code>CSSStyleDeclaration.prototype</code>.</p>
<p>Here is my implementation <a href="http://jsfiddle.net/ghostoy/jJ2GC/" rel="nofollow">http://jsfiddle.net/ghostoy/jJ2GC/</a> and the expected result is once clicked <strong>SetMyColor</strong> button, the color of the text changed to red and show me "Set color to: red". However, the setter is not invoked as expected.</p>
<p><strong>== Updated ==</strong></p>
<p>On different browsers (webkit/mozilla/msie), they use different prefixed style names for non-standard styles. For example, Chrome uses <code>webkitTransition</code>, Firefox uses <code>mozTransition</code> and MSIE use <code>msTransition</code>. However, I want apps that use <code>msTransition</code> can run correctly on Chrome with <code>webkitTransition</code> without modification.</p>
<p>My question is:</p>
<ol>
<li>Why my setter is not invoked?</li>
<li>How to implement such fake style?</li>
</ol>
| javascript | [3] |
4,702,230 | 4,702,231 | C#, How do events differ from delegates? | <p>What does the event keyword do really?</p>
<p><a href="http://msdn.microsoft.com/en-us/library/8627sbea.aspx" rel="nofollow">msdn</a> says it is used to declare an event in a publisher class</p>
<pre><code>// Declare the event.
public event SampleEventHandler SampleEvent;
</code></pre>
<p>Would that mean the SampleEvent is any less of a SampleEventHandler if I don't put event in front of it? </p>
<p>Besides the super awesome -= and += operators what do I get out of events/eventhandlers that I wouldn't get from List<MyDelegate>? When should I use one over the other?</p>
| c# | [0] |
1,592,654 | 1,592,655 | Issues around converting ASP Website to ASP Web Application | <p>We have a web site built as an 'ASP.NET Website' type project, rather than the 'ASP.NET Web Application' type. </p>
<p>Aside from the obvious debugging advantages that the app type offers and access to the designer files for each page: </p>
<ol>
<li><p>What, if anything, can be gained by switching from website project type to app? </p></li>
<li><p>Are there performance losses with one over the other? </p></li>
<li><p>How much work is involved in switching an existing (dev) site from website to app? Is it as simple as creating another site as app type and adding these existing aspx files and libraries to it? </p>
<p>This question (<a href="http://stackoverflow.com/questions/735054/how-to-convert-asp-net-website-to-asp-net-web-application">http://stackoverflow.com/questions/735054/how-to-convert-asp-net-website-to-asp-net-web-application</a>) seems to cover the steps. </p>
<ul>
<li><p>What are the risks (if any?)</p></li>
<li><p>How much work should we plan on?</p></li>
</ul></li>
<li><p>Are there differences in how HTTP Application deals with requests or how handlers work between the two types? </p></li>
</ol>
<p>Anything we forgot to think of?</p>
| asp.net | [9] |
5,105,791 | 5,105,792 | Why send mail received into spam folder in asp.net c#? | <p>I used below setting for send mail then why its send mails received in spam folder in asp.net c#</p>
<pre><code>System.Net.Mail.SmtpClient smtpclient = new SmtpClient();
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
smtpclient.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
smtpclient.Host = Server;
smtpclient.EnableSsl = false;
smtpclient.Credentials = new System.Net.NetworkCredential(Username, Password);
</code></pre>
<p>Above Server,Username and Password comes from web.config file.</p>
| asp.net | [9] |
2,909,143 | 2,909,144 | Python equivalent to atoi / atof | <p>Python loves raising exceptions, which is usually great. But I'm facing some strings I desperately want to convert to integers using C's atoi / atof semantics - e.g. atoi of "3 of 12", "3/12", "3 / 12", should all become 3; atof("3.14 seconds") should become 3.14; atoi(" -99 score") should become -99. Python of course has atoi and atof functions, which behave nothing like atoi and atof and exactly like Python's own int and float constructors.</p>
<p>The best I have so far, which is really ugly and hard to extend to the various float formats available:</p>
<pre><code>value = 1
s = str(s).strip()
if s.startswith("-"):
value = -1
s = s[1:]
elif s.startswith("+"):
s = s[1:]
try:
mul = int("".join(itertools.takewhile(str.isdigit, s)))
except (TypeError, ValueError, AttributeError):
mul = 0
return mul * value
</code></pre>
| python | [7] |
567,119 | 567,120 | reading file from web with android programmatically | <p>How to read file saved from web with android programmatic ally? Not view source. I tried , but get view source. Please help me.</p>
| android | [4] |
1,641,846 | 1,641,847 | jQuery filter class that contains certain value | <p>in jQuery, how do i filter all contents that contain certain class?</p>
<p>HTML:</p>
<pre><code><div class='item 10'>10</div>
<div class='item 20'>20</div>
<div class='item 30'>30</div>
<div class='item 40'>40</div>
<div class='not-an-item 50'>50</div>
</code></pre>
<p>what i've tried:</p>
<pre><code>var classList = $(".item").attr('class').split(/\s+/);
if(classList[1] == '10' || lassList[1] == '30'){
$(".item").hide();
}
</code></pre>
<p>correct output: </p>
<pre><code><div class='item 20'>20</div>
<div class='item 40'>40</div>
<div class='not-an-item 50'>50</div>
</code></pre>
| jquery | [5] |
5,884,271 | 5,884,272 | How does this code work for JUnit in JAVA? | <p>I have the following code for JUnit testing:</p>
<pre><code>import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
public class JUnitHelloWorld {
protected String s;
@Before
public void setup() {
s = "HELLO WORLD";
}
@Test
public void testHelloWorldSuccess() {
s = s.toLowerCase();
assertEquals("hello world", s);
}
// will fail even if testHelloWorldSuccess is called first
@Test
public void testHelloWorldFail() {
assertEquals("hello world", s);
}
}
</code></pre>
<p>Now, according to the comment, why will the second method fail even if the first method is called first? isn't the first method changing the value of s to lowercase?</p>
| java | [1] |
5,868,224 | 5,868,225 | Properties added to object are undefined? | <p>I'm trying to create an object that acts similarly to a hash or dictionary in other languages. I'm doing this with a <code>for</code> loop and assigning a key and value from an array but if I have more than one property the others become undefined. I'm trying to create key value pairs of from data (<code>i</code>). Any help would be appreciated, thanks!</p>
<pre><code>arrayOfRecievedHTML = recievedHTML.split('<endOfCommentInformation>');
for(j = 0; j < i.length - 1; j++) {
arrayOfIndividualComment = arrayOfRecievedHTML[j].split('<commentSeperator>');
arrayOfComments[arrayOfIndividualComment[0]] = arrayOfIndividualComment[1];
}
</code></pre>
<p>Edit: Example of what e would be is:</p>
<pre><code>3<commentSeperator>Intersting<endOfCommentInformation>
5<commentSeperator>Nice<endOfCommentInformation>
</code></pre>
| javascript | [3] |
2,232,052 | 2,232,053 | tinyMCE - Check which tab is currently selected | <p>Does tinyMCE have a function to check the currently active tab between "Visual" and "Text"? I have external buttons that add source into the textarea..</p>
<pre><code>tinyMCE.execInstanceCommand("template-source","mceInsertRawHTML", false, $(select).val());
</code></pre>
<p>This function only adds text to the "Visual" tab, but not the source. I want to be able to add HTML source to the textarea regardless of which tab is currently selected..</p>
| javascript | [3] |
682,761 | 682,762 | Delete Buttons with list items | <p>I can't tell what is wrong with this jQuery code. I'm receiving no errors from the debugger. I'm at a lost with what is wrong.</p>
<pre><code><ul id="list"></ul>
<script>
$(document).ready(function() {
$('#show_place_on_screen').click(function () {
var address = $('#address').val();
$("#list").append('<li>' + address + '<input type="button"
id="delete" value="Delete"/></li>');
});
$("#delete").click(function() {
$(this).parent().remove();
});});
</script>
</code></pre>
| jquery | [5] |
5,835,143 | 5,835,144 | What does ? (question mark) after a type name mean in C#? | <blockquote>
<p><strong>Possible Duplicates:</strong><br>
<a href="http://stackoverflow.com/questions/2079334/what-does-the-mean-after-a-type">What does the ? mean after a type?</a><br>
<a href="http://stackoverflow.com/questions/2699373/c-basic-question-what-is">C# - Basic question: What is '?' ?</a> </p>
</blockquote>
<p>What kind of statement is the one below? What does the question mark mean in that statement? How many bytes? Where would I want to use it?</p>
<code>
char? name = null;
</code>
| c# | [0] |
2,669,519 | 2,669,520 | Content of a .aspx file replaced by clinet side HTML | <p>I have hosted a site on server. Problem is, content of a particular .aspx file (index.aspx/content.aspx) is periodically replaced by clinet side HTML code(the source we see in browser by right click>view source).</p>
<p>What can be reason behind this?</p>
<p>Thanks</p>
<p>Suren </p>
| asp.net | [9] |
858,866 | 858,867 | Show constant URL for site in asp.net | <p>I have a web site with number of pages, developing in asp.net.
I have a page URL's like:
example: </p>
<pre><code>1) http://www.xyz.com/Home.aspx
2) http://www.xyz.com/Index.aspx
3) http://www.xyz.com/viewMember?Name=abc&id=1
</code></pre>
<p>But the end user is at any page, i would like to show the URL like <code>"http://www.xyz.ie"</code>.</p>
<p>Is there any setting in web.config ? If not, is there any other way ?</p>
<p>Please help me...</p>
<p>Thanks in advance.
Jagadi</p>
| asp.net | [9] |
2,888,374 | 2,888,375 | How to treat a php file as directory | <p>I wanted to know if it is possible to treat a php file as a directory so that <code>index.php/abc/def</code> really calls index.php. The index.php should then know the subdirectory path (ie <code>/abc/def</code>). </p>
<p>I'm searching a plain php solution. I know that I could use mod_rewrite to map the directory to GET-parameters. </p>
| php | [2] |
2,878,180 | 2,878,181 | AdView missing requied xml attribute adSize in android using google adds | <p>here i need to display adds using google admob.i tried below code but am getting "AdView missing requied xml attribute adSize" error.</p>
<pre><code> jarfile:GoogleAdMobAdsSdk-4.3.1.jar
main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res/com.jms.AdmobExample"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="a14f1d807e488dd"/>
</LinearLayout>
attrs.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="com.google.ads.AdView">
<attr name="adSize">
<enum name="BANNER" value="1"/>
<enum name="IAB_MRECT" value="2"/>
<enum name="IAB_BANNER" value="3"/>
<enum name="IAB_LEADERBOARD" value="4"/>
</attr>
<attr name="adUnitId" format="string"/>
</declare-styleable>
</resources>
</code></pre>
<p>where i did the the wrong plese help me.</p>
| android | [4] |
2,828,967 | 2,828,968 | Module appears in module list but can't be imported | <p>I'm getting an error because the <code>ssl</code> module isn't available</p>
<p>If I run <code>help('modules')</code> from the python interpreter it is listed there</p>
<p>When I try to import it from the interpreter, I get </p>
<pre><code>>>> import ssl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/ssl.py", line 60, in <module>
import _ssl # if we can't import it, let the error propagate
</code></pre>
| python | [7] |
2,749,394 | 2,749,395 | fill edit text to the complete screen android | <p>Hello
In my android application on click of image i would like to display a page which could provide a notepad facility to user.
I placed a edit text with fill parent but the cursor starts from the middle of the screen.
Is there any way that i can start the cursor from the beginning.</p>
<p>Please share your valuable suggestions.</p>
<p>Thanks in advance:)</p>
| android | [4] |
5,282,436 | 5,282,437 | A big integer input in java | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/849813/large-numbers-in-java">Large Numbers in Java</a> </p>
</blockquote>
<p>I need to take and manipulate an integer input with <= 500 digits. How can it be done in java? Any help would be appreciated. </p>
| java | [1] |
1,267,660 | 1,267,661 | Reading Java command line arguments on Unix | <p>I am trying to read a folder name from command line for a Java application on Unix.</p>
<p>I have a ksh script (test.ksh) and it has the line:</p>
<pre><code>java SomApp $*
</code></pre>
<p>I am trying to execute this as below:</p>
<pre><code>test.ksh ../folder
</code></pre>
<p>But this fails; I mean my Java application says there is nothing under "../folder" though there are some files.</p>
<p>How to read such relative paths on Unix?</p>
| java | [1] |
742,386 | 742,387 | Initialization Vector in encryption | <p>I've never done any encryption before, but I've been all over MSDN and google. I finally got something working. </p>
<p>I've seen this a ton of times:</p>
<pre><code>Dim IV() As Byte = {&H12, &H34, &H56, &H78, &H90, &HAB, &HCD, &HEF}.
</code></pre>
<p>My question is this - do the hex digits inside the array have any significance? I just find it terribly odd that these particular numbers would be used SO often otherwise.</p>
| asp.net | [9] |
3,099,185 | 3,099,186 | How to add the Project root to the localhost path | <p>My asp.net project, currently runs from <strong>http://localhost:51143/default.aspx</strong></p>
<p>Is there anyway, I could include the root to this like <strong>http://localhost:51143/TOrders/default.aspx</strong> The reason I want to do this is because the URls that get called on the menu click events refer to "TOrders/Reports/aaa.aspx and so on and in production it would refer to intranet/TOrders/Reports/aaa.aspx and so on.</p>
| asp.net | [9] |
3,694,942 | 3,694,943 | Working with PHP objects | <p>I was previously mostly scripting in PHP and now considering getting "more serious" about it :)</p>
<p>I am working on a hiking website, and I needed to put some values into an object that I then try to pass back to the calling code.</p>
<p>I tried doing this:</p>
<pre><code>$trailhead = new Object ();
</code></pre>
<p>But the system sort of barfed at me.</p>
<p>Then I didn't declare the object at all, and started using it like this:</p>
<pre><code>$trailhead->trailhead_name = $row['trailhead_name'];
$trailhead->park_id = $row['park_id'];
</code></pre>
<p>That seemed to work reasonably ok. But there are at least 3 problems with this:</p>
<ol>
<li><p>Since that code gets executed when getting things from the database, what do I do in case there is more than one row?</p></li>
<li><p>When I passed the $trailhead back to the calling code, the variables were empty</p></li>
<li><p>I actually am maybe better off making a real object for Trailhead like this:</p>
<pre><code>class Trailhead
{
private $trailhead_name;
private $park_id;
private $trailhead_id;
public function __construct()
{
$this->trailhead_name = NULL;
$this->park_id = NULL;
$this->trailhead_id = NULL;
}
}
</code></pre></li>
</ol>
<p>What do people generally do in these situations and where am I going wrong in my approach? I know its more than one place :)</p>
| php | [2] |
4,893,086 | 4,893,087 | Passing value from one page to another using master pages | <p>my problem is i want to pass value of a label and hidden control which are resides in a datalist say in page1.aspx and i want to access these value in page2.aspx. How can i get the values to another page while clicking on submit button. Is there any better option we have without using sessions, server.transfer, request.querystrings etc. Pls. help. I am using master pages. Can we use previouspage? if so how. Suggest me a better solutions. Thanks in advance.</p>
| asp.net | [9] |
4,337,959 | 4,337,960 | What is the difference between accessing a class method via -> and via ::? | <p>What is the difference between accessing a class method via -> and via ::?</p>
| php | [2] |
1,620,747 | 1,620,748 | Editing an object in a list<objects> without creating a new instance of that object? | <p>I'm making a database in EF4.1 Code First. I have a table, MedicalPlan, with a one-to-many relationship to a CoverageLevel. CoverageLevel primary key is incrementing. When I create the MedicalPlan I declare the coveragelevels and it creates those tables, like so:</p>
<pre><code>medicalPlan.CoverageLevels = new List<CoverageLevel>();
medicalPlan.CoverageLevels.Add(new CoverageLevel() { Cost = 1200, Description = "single" });
medicalPlan.CoverageLevels.Add(new CoverageLevel() { Cost = 1500, Description = "spouse" });
medicalPlan.CoverageLevels.Add(new CoverageLevel() { Cost = 1100, Description = "family" });
</code></pre>
<p>I also have an update function in which I would update a medical plan. I would also like the functionality to update the MedicalPlan's CoverageLevels. In pseudocode, something like:</p>
<pre><code>in medicalPlan edit first item in CoverageLevels() { Cost = 1500 };
</code></pre>
<p>The kicker is that I don't actually want to <em>replace</em> the CoverageLevel, as it has a unique auto-incrementing primary key, so if I create a new one it will have a different primary key than the original. Is there a way to do this in the way that I am attempting?</p>
| c# | [0] |
4,755,336 | 4,755,337 | How to implement back functionality in a asp.net web page? | <p>I have a page which has a panel whcih contains various buttons to load different pages.
I have two butons in that panel one is "Search Products" and one is "Add Product".
When i click Add Product it loads the corresponding page , on this page I have a button
which takes me back to Serach Products page , now I want to know somehow that this page(Search Products) is opened from Add Products coz then I have to enable some buttons on Search Products page , and if i go directly to Search Page by clicking panales's button then I don't want to enable those buttons.</p>
<p>I didn't find anything , please anyone help me out.</p>
| asp.net | [9] |
5,342,537 | 5,342,538 | onOptionsMenuClosed() executed when the 'back' key pressed immediately after the menus were displayed. BUT | <p>From the onPrepareOptionsMenu(Menu) method, I stopped the thread when I was about to display the menus because background thread, which consumes lots of processng time, makes displaying and clicking one of the menus(not the menu button) nearly impossible. After the thread stops, displaying and clicking menus(not the menu button) becomes much more manageable. The problem occurred when 'back' key was pressed immediately after the menus were displayed. I need to restart the thread after when the user hits 'back' key. When I incorporated the public void onOptionsMenuClosed(Menu menu) method, the 'back' key pressed immediately after the menus were displayed did execute the void onOptionsMenuClosed(Menu menu) method. However, when I displayed the submenus from one of the menus and then hit the 'back' key, the void onOptionsMenuClosed(Menu menu) method did not get execute. I really appreciated if someone can answer this question.</p>
| android | [4] |
1,505,937 | 1,505,938 | Why web controls does not have sufficient events like windows application? | <p>Hai , An asp panel contains only 6 events. if they provide a visibilechanged event it may very useful for me. if it is in windows application ,how easy it is.I dont know why thy are not providing all these.This is same as in the case of gridView, button ,etc. </p>
<p>just think , I have an Iframe in an asp panel and two buttons. In first time it is invisible .Buttons named first and second respectively. Two another pages One.aspx,two.aspx. These two pages contains each text box. When you click on the First button . I want to set the Iframe src="One.aspx" and display "first" in the textbox on One.aspx. as same in the case , when user clicks Second button. How to do this ? </p>
| asp.net | [9] |
5,532,691 | 5,532,692 | difficulty with arrays | <p>I am a bit stuck so if anyone has a spare moment it would be a great help for me. I am using eclipse and the program is compiling and running. but there is a runtime error.
in the array {2, 1, 1, 2, 3, 3, 2, 2, 2, 1} I want to print {2, 2, 2} which is the numbers with the highest repeating times in the array. What I am getting is:
0
1
0
0
3
0
2
2
0</p>
<p>Thank you guys and here is my code.</p>
<pre><code>public class SameIndexInArray
{
public static void main(String[] args)
{
int[] array = {2, 1, 1, 2, 3, 3, 2, 2, 2, 1};
int[] subarray = new int[array.length]; //store the values should be {2, 2, 2}
int max = 1;
int total = 1;
for(int i=0; i<array.length-1; i++)
{
if(array[i] != array[i + 1])
{
max = 1;
}
else if(array[i] == array[i + 1])
{
max++;
total = max;
subarray[i] = array[i]; // here is the issue
}
System.out.println(subarray[i]);
}
//System.out.println(total);
}
}
</code></pre>
| java | [1] |
1,366,561 | 1,366,562 | controls in code behind | <p>i was working on a vb.net project and i couldn't find some controls in the code-behind file(*.vb). i was wondering is it because i was working in page_load function so controls are not loaded until after page_control event. however i was able to find them with findcontrol function of formview objective.</p>
| asp.net | [9] |
4,352,466 | 4,352,467 | Passing a reference of a base class to another function | <p>Hello stack overflowers,
Here is the problem i am facing, does anyone have solution?</p>
<pre><code>Class A: public class B
{
// I want to pass a reference of B to Function
}
void ClassC::Function(class& B)
{
//do stuff
}
</code></pre>
| c++ | [6] |
1,029,839 | 1,029,840 | Detecting end of page during scrolling in WebView | <p>first I would like to say that I have searched for my problem everywhere, but solutions I have found were not satisfactory. Secondly I'm quite new to Android SDK so please be patient :). </p>
<p>And here is my question: How I can detect if scrolling in WebView has been ended and reach edge of page (Y axis)? </p>
<p>So far I figure that:</p>
<ul>
<li><p>I can add onTouchListener and there check if event is move and with sophisticated formula check if I reach edge - however this works only if someone is touching screen</p></li>
<li><p>My second idea show following code:
<code>@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
super.onScrollChanged(l, t, oldl, oldt);
if(panel==null) return;
int offset = (int) (OFFSET*(getScale()));
if(getScrollY()+offset >= getScale()*(getContentHeight() - getHeight()) || t-offset<= 0){ panel.setVisible();
}else{
panel.setInvisible();
}
}</code></p></li>
</ul>
<p>I extend WebView and Override method onScrollChaged. This works better than previous idea however it works only sometimes. </p>
<p>If anybody can help me with that issue I will be very gratefull. </p>
| android | [4] |
3,589,250 | 3,589,251 | Checking redirect in PHP before actioning | <p>Is there a way to check if the server responds with an error code before sending a user there?</p>
<p>Currently, I am redirecting based on user editable input from the backend (client request, so they can print their own domain, but send people elsewhere), but I want to check if the URL will actually respond, and if not send them to our home page with a little message.</p>
| php | [2] |
5,685,638 | 5,685,639 | Asp.net prevent modal popup to get displayed while clikcing on browser back button | <p>GoodEvening Everyone,</p>
<p>I am having one asp.net application which contains many links. some of the link displays modal popup Now if i move to link which nabvigates me and click on browser back button so modal popup gets display which i dont want. i need the previous page should get displayed instead of modal popup if i click on browser back button</p>
<p>for example</p>
<p>i clicked on link1 - navigated to page2 </p>
<p>i clicked on link2 - displayed modal popup</p>
<p>i click on link3 - navigated to page3</p>
<p>Now if i click on browser back button so modal popup get displays instead of which i want the page2(previous page before the modal popup ) should get displayed.</p>
<p>So please let me know is this possible and how its possible.</p>
<p>It will be appreciated if some one provide me code to do this...</p>
<p>Let me know in case of more information required</p>
| asp.net | [9] |
5,578,820 | 5,578,821 | C# : How to generate unique passwords with the length of 7 or 8 characters | <p>I need to repeated generate unique password many times, Ensure that every time the generated passwords are unique, Please help me.</p>
<p>Thanks!</p>
| c# | [0] |
872,015 | 872,016 | jQuery Click Event PreventDefault | <p>If I have an <code>a</code> tag:</p>
<pre><code><a id="delete-event" href="/delete/1234">Delete</a>
</code></pre>
<p>And some javascript which prompts to confirm the delete:</p>
<pre><code> $("#delete-event").click(function(e) {
e.preventDefault();
bootbox.confirm("Are you sure you wish to delete this?", function(confirmed) {
if(confirmed) {
return true;
}
});
});
</code></pre>
<p>I thought doing <code>e.preventDefault()</code> would prevent the <code>a href</code> from firing, but its not. When I click the a tag it simply goes to the url, without executing the javascript. How can I make this work?</p>
<p>Thanks.</p>
| javascript | [3] |
661,513 | 661,514 | What does this mean in jquery $('#id', javascript_object); | <p>what does this <code>$('#id', javascript_object);</code> mean in jquery . I know that we can pass a context in the second parameter to the selector . But what happens when the second parameter is a javascript object . </p>
<p>Thanks in advance for the help .</p>
| jquery | [5] |
582,971 | 582,972 | Looping objects then deleting them | <p>Hey I have a simple loop which iterates a bunch of objects and checks if they match a variable and if they do, I want to remove it from the that list.</p>
<p>But i don't know how to do it... this is the idea of what I am trying to do :</p>
<pre><code>//my_objects is global (window.my_objects)
for(var i in my_objects){
if(my_objects[i].value == 100){
//remove it
}
}
</code></pre>
<p>Is there any option besides creating an array for it ? I could only find <code>delete</code> which only deletes the property which means the object will still be itereated through my loop next time around.</p>
<p>This function is called every X seconds.</p>
| javascript | [3] |
4,274,414 | 4,274,415 | How to use a searchbar in application? | <p>i am new in iphone application Development and i want to put search bar in my application so please give me some suggestion how to implement search bar. </p>
| iphone | [8] |
1,956,001 | 1,956,002 | What does a database structure of topic id's look like? | <p>I am creating a forum for practice but I am stuck on how to do the topics. Do I need a seperate topic table, and If yes why, cant I just check them in the posts table?</p>
<p>Also, do I record the topic id or the topic name, and if it is the Id, how do I switch them?</p>
<p>Thanks a lot, I am working in PHP</p>
| php | [2] |
1,305,343 | 1,305,344 | Cookie it's not working (hide div with script) | <p>Based on a script I saw I did a modification to fill out my needs, however it was suposed to close the alert box and not display it again as set on code below, however as soon as I refresh page the box shows up again.
Unfortunately my knowledge of jquery is almost none, actually I can't believe how I was able at least create the box lolol</p>
<pre><code><div id="alert">
<style type="text/css">
<!--
.hide {
display:none;
}
.show {
display:block;
}
-->
</style>
<script type="text/javascript">
<!--
var state;
window.onload=function() {
obj=document.getElementById('alert');
state=(state==null)?'show':state;
obj.className=state;
document.getElementById('close').onclick=function() {
obj.className=(obj.className=='show')?'hide':'show';
state=obj.className;
setCookie();
return false;
}
}
function setCookie() {
exp=new Date();
plusMonth=exp.getTime()+(31*24*60*60*1000);
exp.setTime(plusMonth);
document.cookie='State='+state+';expires='+exp.toGMTString();
}
function readCookie() {
if(document.cookie) {
var tmp = document.cookie.split(';')[0];
state = tmp.split('=')[1];
alert(state);
}
}
//-->
</script>
<?php if ( !isset($_COOKIE[ 'gb_location_preference' ] ) ) { ?>
<div id="lightbox" class="title">
<a href="onClick="closebar(); return false"><img id="close" border="0" src="http://downloads.mailchimp.com/img/closebox.png"/></a>
<?php gb_subscription_form(true,'Confirm Location','Subscribe') ?>
</div>
<div id="lightbox_sub" class="subscription">
<?php gb_e('teste')?>
</div>
<?php } ?>
</div><!-- #alert -->
</code></pre>
| javascript | [3] |
1,430,625 | 1,430,626 | how to rid "" from a string to non string | <p>I have this</p>
<pre><code>a = "'Something': False"
</code></pre>
<p>I want it to be this</p>
<pre><code>a = 'Something': False
</code></pre>
<p>How do I do it? I can strip things within the double quotation marks, but not the quotation marks itself. Have researched, cant find. I have mind block at moment. Sorry</p>
<p>Im trying to do this:</p>
<pre><code>query_results = UserProfile.objects.filter(Location: location, Gender: gender).extra(select={'rank': a > 0}, order_by=['-rank'])
</code></pre>
<p>where Location = Someplace and Gender = Male or Female.</p>
<p>But what about when i did not want a specific gender or location. The only thing i could think of to do was to do </p>
<pre><code>Location__isnull:False, Gender__isnull:False
</code></pre>
<p>But i cant have both</p>
<pre><code>Location:location, Location__isnull:False.
</code></pre>
<p>Thus i have to have the location argument as a variable.</p>
<p>How could i then do this. The information referring to Location and gender is coming from a request.GET</p>
<p>I cant post my code as i keep deleting and changing spaghetti to try make something edible.</p>
| python | [7] |
3,363,400 | 3,363,401 | Downloading file is corrupted - header | <p>I have be trying to figure out what is wrong but every time i download the image and try to open it, it says that the file is corrupt.</p>
<p>$h is the path which is pulled from the database, the $h displays the image on the page successfully but I dont get why it wont download. Any ideas ?? </p>
<pre><code>header("Pragma: public"); // required
header("Cache-Control: private",false); // required for certain browsers
header('Content-Length: '. filesize("../".$h));
header('Content-Type: application/octet-stream');
header('Content-Disposition: inline; filename="'.md5($h).$ext.'"');
header('Content-Transfer-Encoding:binary');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
readfile("../".$h);
</code></pre>
| php | [2] |
3,037,096 | 3,037,097 | How to create only a week calendar with previous and next week buttons | <p>I am really stucked at this.what i want is that there should be 6 table cells in which i should have days with date. like
Monday 4/3/2013 Tuesday 5/3/2013 and so on till saturday
.i have two more buttons,previous week and next week button.. it should automatically show next week when i click the next week button and should show the previous week whenever i press the previous button..
also the i need to take the value of days/month and year so that i can use them in where clause in my sql query..pls its urgent can anyone help me with this...</p>
<p>im providing a link you can see what exactly i want by visiting this link</p>
<p><a href="http://www.test.ginormous.in/dinesmart/Filestore/Food/Capture.png" rel="nofollow">www.test.ginormous.in/dinesmart/Filestore/Food/Capture.png</a> </p>
| asp.net | [9] |
3,178,605 | 3,178,606 | Python 3.1 Installation missing Tkinter on OS 10.6.4 | <p>Has anyone else had this problem? I have re-installed twice with the same result. The pre-install of 2.6 on the Mac had a lib-tk folder with the correct modules. Nothing like this is being created for 3.1. There is a Tkinter folder but it contains only a few obscure modules. Importing _tkinter and tkinter works but not Tkinter and all of the example programs fail. </p>
| python | [7] |
3,411,385 | 3,411,386 | How to change visibility for MenuItem dynamically? | <p>I'm developing some Android application and I have ActionBar with 2 tabs. I need to show 2 icons on ActionBar when user select the second tab. I have the following code:</p>
<pre><code>@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
mOptionsMenu=menu;
menu.getItem(0).setVisible(false);
menu.getItem(1).setVisible(false);
return true;
}
public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
mViewPager.setCurrentItem(tab.getPosition());
if (tab.getPosition()==1) {
mOptionsMenu.getItem(0).setVisible(true);
mOptionsMenu.getItem(1).setVisible(true);
}
}
</code></pre>
<p>But this code doesn't work. Please, tell me, how can I done my needs? </p>
| android | [4] |
5,076,349 | 5,076,350 | Pure virtual function vs. virtual function? | <p>I'm developing a class with some functionality that I think might need to be extended later, but not now. If the class were to be extended, then I think this would make instantiating the base class meaningless. </p>
<p>For example, let's say my base class is a tree. One approach would be to just put everything that the tree needs to do for my purposes in the tree class and leave it at that. However, this tree might be useful in other aspects of the program later on in life, so I've thought about creating a pure virtual <code>onNodeVisited</code> function. Derived classes could then implement their own version of <code>onNodeVisited</code>, and not have to worry about the specifics of the tree traversal defined in the based class.</p>
<p>Does it make sense to not use a pure virtual function and keep the tree functionality and application-specific functionality in one class (virtual <code>onNodeVisited</code>)? Or, should I make the tree class abstract and implement one sub-class for the application-specific part.</p>
| c++ | [6] |
3,943,053 | 3,943,054 | Is it possible to get the caller context in javascript? | <pre><code>var test = {
demo: function(){
//get the caller context here
}
}
//when this gets called, the caller context should be window.
test.demo();
</code></pre>
<p>I tried <code>arguments.callee</code> and <code>arguments.callee.caller</code>,and no luck...</p>
| javascript | [3] |
521,307 | 521,308 | How do I check if an image has preloaded successfully? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1977871/check-if-an-image-is-loaded-no-errors-in-javascript">Check if an image is loaded (no errors) in JavaScript</a> </p>
</blockquote>
<p>After being loaded by javascript by setting img.src.</p>
<p>Thanks...!</p>
| javascript | [3] |
3,501,611 | 3,501,612 | DLL doesn't store string C# | <p>I have an application that can be launched from the explorer context menu for a Windows drive. When you click the menu item the drive letter is passed to the new instance. I want to make sure that any old instance is closed.</p>
<p>I also want to make sure that the last drive that was selected is persisted, so that when I start the application again from the start-menu, it will remember the drive I originally selected.</p>
<p>It would be best if the already running application would receive an event so that it can update without having to kill and restart.</p>
<hr>
<p>I tried the following, but that doesn't seem to be working:</p>
<p>This is my Class library method(it is just a line that define a variable so just i have a DLL that there a variable in it and no more) </p>
<pre><code> namespace Dispatch
{
public class cls_get_drive_letter
{
public static string drive_letter;
}
}
</code></pre>
<p>This is my loading form code: (Here i will fill the DLL's variable)</p>
<pre><code> private void Frm_loading_Load(object sender, EventArgs e)
{
Dispatch.cls_get_drive_letter.drive_letter = "XXX";
Process currentProcess = Process.GetCurrentProcess();
if (Process.GetProcessesByName(currentProcess.ProcessName, currentProcess.MachineName).Length >1)
{
currentProcess.Kill();
}
}
</code></pre>
<p>So when i run this for first time the "XXX" will be stored in DLL but when the current instance of application is running and i am going to run next instance of it the application will be closed because of this code:</p>
<pre><code> Process currentProcess = Process.GetCurrentProcess();
if (Process.GetProcessesByName(currentProcess.ProcessName, currentProcess.MachineName).Length >1)
{
currentProcess.Kill();
}
</code></pre>
<p>So when closing code occurs with this code the new "XXX" will not stored in DLL and the last string will be in dll.</p>
| c# | [0] |
2,281,752 | 2,281,753 | How to bind to checked for a checkbox only? | <p>I have a checkbox and I am using jquery. I want to popup a dialog box when a user checks the checkbox. However if they uncheck the box nothing should popup.</p>
<p>How can I do this? Also I need to use jquery live or livequery as the checkbox is not displayed on page load.</p>
| jquery | [5] |
4,960,604 | 4,960,605 | Slow recursive destructor call in C++ | <p>I am using C++ do represent large graphs using reference counted objects. Something like:</p>
<pre><code>// Public class
class Pointer{
public:
// Constructors
Pointer(...){ node = ...; node->counter++;}
// Copy constructor
Pointer(Pointer& const other){ node = other.node; node->counter++;}
// Destructor
~Point(){ if(--node->counter==0) delete node;}
// Other methods
...
Node* node;
};
// Node base class
class Node{
// Constructor
Node():counter(0){}
// Destructor
virtual ~Node(){}
// public:
unsigned long counter;
};
// Node derived class
class NodeDerived : public Node{
// Constructors and other methods
...
// Destructor
virtual ~NodeDerived(){ ... }
// Children
Pointer children[2];
};
</code></pre>
<p>There is thus a public class <code>Pointer</code> which contains a pointer to a polymorphic class Node. Some classes derived from Node will contain new <code>Pointer</code> instances. Note that several <code>Pointer</code> instances may point to the same <code>Node</code> instance. </p>
<p>I use this class to build up very large graphs with millions of instances, and this works fine. The problem comes when the graph is to be deleted. With the default destructor implementation this results in a stack overflow, since in the destructor of the root node, the destructors of the children are called and in the children's destructors, the destructors of the children of the children are called and so on.</p>
<p>I solved this by implementing a destructor for the <code>NodeDerived</code> class above that avoids the recursive call by using a stack instead. This works, but is still very slow, and I am looking for a way to speed this up. Is it possible to somehow avoid declaring the destructor <code>virtual</code> without causing a memory leak?</p>
| c++ | [6] |
1,439,015 | 1,439,016 | Bit count in the following case | <p>I got the following questions in one of the interviews plz help me some ideas to solve it as am completely unaware how to proceed</p>
<p>A non-empty array A of N elements contains octal representation of a non-negative integer K, i.e. each element of A belongs to the interval [0; 7]</p>
<p>Write a function:</p>
<pre><code>int bitcount_in_big_octal(const vector<int> &A);
</code></pre>
<p>that returns the number of bits set to 1 in the binary representation of K. The function should return -1 if the number of bits set to 1 exceeds 10,000,000.</p>
<p>Assume that the array can be very large.</p>
<p>Assume that N is an integer within the range [1..100,000].</p>
| c++ | [6] |
4,075,378 | 4,075,379 | BeanUtils Copy Properties: Registering ConvertUtils | <p>I have web application written in Java. Im using <code>BeanUtils.copyProperties</code> method. If a <code>date</code> field is null, it throws an error. I solved it by using <code>ConvertUtils.register</code> method.</p>
<pre><code>ConvertUtils.register(new DateConverter(null), Date.class);
</code></pre>
<p>It works now, but what is the correct way of using <code>ConvertUtils.register</code>. Where should it be placed?</p>
| java | [1] |
3,022,036 | 3,022,037 | How to stop PHP source from being printed to my browser? | <p>I just downloaded this "PHP Code Snippet Library" scrpt from <a href="http://www.sourceforge.net/projects/php-csl/" rel="nofollow">http://www.sourceforge.net/projects/php-csl/</a> , when I try to run it from my local dev server, all the PHP on every page is output as PHP code, instead of compiling and running the code it seems to show the source of the PHP to the screen. I have never had this happen before, how can I fix this or what cause this?</p>
| php | [2] |
1,316,269 | 1,316,270 | Play any video file using asp.net in IE and mozila | <p>i have used "embed" tag for Flv file, Flash Player for "swf" file and "object tag for other files...
everything working fine with IE but in Mozilla only swf files working properly..
can anybody suggest me right way to play video of any type in IE and Mozilla both</p>
| asp.net | [9] |
16,991 | 16,992 | java Regex Question | <p>In Java - I need to search/validate an input string for a number or for a specific string. it must be one of them.
For example - If I have this input lines:</p>
<pre><code>cccccccc 123 vvvvvvvvv jhdakfksah
cccccccc ABC vvvvvvnhj yroijpotpo
cccdcdcd 234 vcbvbvbvbv lkjd dfdggf
ccccbvff ABC jflkjlkjlj fgdgfg
</code></pre>
<p>I need to find 123, ABC, 234, ABC</p>
<p>to look for the number I could use regex: "\d+" but to look for either of them How can I combine them?</p>
| java | [1] |
1,590,024 | 1,590,025 | how to display ModelPopupextender to content page from master page | <p>I am new to ASP.NET and C# and have one doubt.</p>
<p>I have one link button in master page and I have one modalpopupextender in my content page.
I need When I click that button the modal popup window will open in the content page..
Can anyone help, it's very useful for me?</p>
<p>Thank you</p>
| asp.net | [9] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.