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,541,487
2,541,488
Testing if either of two condtions are true
<p>I'm trying to test if either of two variables are true using the code below, but I the code always returns the true conditions even when the variable is blank. Have I done this correctly or is it possible the variables are always true?</p> <p>Thanks in advance for your help.</p> <pre><code>&lt;?php if (($gogo_team_member_twitter !== true) or ($gogo_team_member_facebook !== true)) { echo('class="amb-with-socal"'); } else echo('class="amb-without-socal"'); ?&gt; </code></pre>
php
[2]
3,557,171
3,557,172
How do I access javascript functions in the "object Window"
<p>I feel silly asking this in such a crude way, but in Firebug I see my current object (this) and below that a line then, "object Window," where the global namespaces seem to live (e.g., there's a <code>$</code> object, <code>jQuery</code> object ...). I have an object I created called "g" with a function called "Update" that lives in this global namespace (again, using that term loosely).</p> <p>Am I using the right terminology here? Does the jQuery object live in the "global namespace"? Furthermore, if I want to call something living here, do I just need to call, say, <code>g.Update()</code>? Would it be right to say these are the equivalent of what you'd call static variables in OO terminology?</p> <p>Thanks!</p>
javascript
[3]
5,569,858
5,569,859
Android help in voice recognition!
<p>Hey I need some help with an app.What I want is to record a sound(word...) from the MIC ,name it and save it to a list in two rows,one containing the name of the recording and the other the sound. I'm new to android so if u can give me some code to start with,an example,anyting please.</p> <p>Misu</p>
android
[4]
3,121,065
3,121,066
Add some logo to all images in folder
<p>Can I add a logo to all my images which are in the <code>Images</code> folder? If yes, how can I place the logo at the bottom left of the image?</p> <p>On this picture you can see <code>cinepicks.com</code> in the middle of the picture. I want a logo on the bottom left of a picture and I want to do this only with PHP.</p> <p><img src="http://i.stack.imgur.com/qkaAW.jpg" width="200"></p> <p>Can it be done with the imagepng() function?</p>
php
[2]
2,972,031
2,972,032
Difficulty with making a header file for C++
<p>I'm trying to make a header file called <strong>hippiewh</strong>. However, I have been running into some problems. </p> <p>here's the code for the header file:</p> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; using namespace std; #ifndef hippiewh_h #define hippiewh_h int askInt(string prompt) { int var_int; cout &lt;&lt; prompt; cin &gt;&gt; var_int; return var_int; } #endif </code></pre> <p>there are functions like that one for every data type. string, float, and so on.</p> <p>I can't get this header file working with the online IDE and compiler at <a href="http://www.compilr.com" rel="nofollow">Compilr.com</a></p> <p>The error i'm getting is:</p> <pre><code>hippiewh.h: No such file or directory </code></pre>
c++
[6]
1,457,356
1,457,357
How to specify a PHP version when using "php" command
<p>I have a server which have both PHP 5.2 and 5.3 on it, default version is 5.2 and whenever i uses command "php" it takes the 5.2 version. Is there any way i can specify the version while running command? php -v only display the version.</p> <p>For application i use .htaccess to set version, like <code>AddHandler application/x-httpd-php53 .php</code></p> <p>Is there any similar way while using command "php"</p>
php
[2]
259,206
259,207
How to get a date for a day in current week
<p>i need to set alarm for monday , Saturday ,friday etc... on every week repeatedly. </p>
iphone
[8]
4,705,466
4,705,467
How to remove multiple line breaks from RSS feed?
<p>How to remove multiple <code>&lt;br&gt;</code> tags from a RSS feed? I tried those two but it doesn't make any change.</p> <pre><code>str_replace("&lt;br/&gt;&lt;br/&gt;","&amp;",$entry-&gt;description); str_replace("&lt;br&gt;&lt;br&gt;","&amp;",$entry-&gt;description); str_replace("&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;","&amp;",$entry-&gt;description); str_replace("&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;","&amp;",$entry-&gt;description); (with space) Here is a sample </code></pre> <p><code>This is copied from feedburn RSS&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;with view page source.</code></p>
php
[2]
3,510,706
3,510,707
Where would I use a bitwise operator in JavaScript?
<p>I've read <strong><a href="http://stackoverflow.com/questions/276706/what-are-bitwise-operators">this</a></strong> (<a href="http://stackoverflow.com/questions/276706/what-are-bitwise-operators">http://stackoverflow.com/quest...</a>), so I know <strong>what</strong> bitwise operators are but I'm still not clear on how one might use them... Can anyone offer any real-world examples of where a bitwise operator would be useful in JavaScript?</p> <p>Thanks.</p> <h2>Edit:</h2> <p>Just digging into the <strong><a href="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js">jQuery source</a></strong> I've found a couple of places where bitwise operators are used, for example: (only the &amp; operator)</p> <pre><code>// Line 2756: event.which = (event.button &amp; 1 ? 1 : ( event.button &amp; 2 ? 3 : ( event.button &amp; 4 ? 2 : 0 ) )); // Line 2101 var ret = a.compareDocumentPosition(b) &amp; 4 ? -1 : a === b ? 0 : 1; </code></pre>
javascript
[3]
3,553,099
3,553,100
What is Page.LoadComplete meant for (in practice)
<p>In the ASP.NET <a href="http://msdn.microsoft.com/en-us/library/ms178472.aspx" rel="nofollow" title="MSDN Link">Page LifeCycle</a> there is the Page.LoadComplete event.</p> <p>The MSDN documentation says 'Use this event for tasks that require that all other controls on the page be loaded'. What exactly might this be? What would a 'best practice' say that LoadComplete should be used for?</p>
asp.net
[9]
3,438,405
3,438,406
Moving inline code into function, with object name generation
<p>I am customizing Denis Gritcyuk's <a href="http://javascriptkit.com/script/script2/timestamp.shtml" rel="nofollow">Popup date picker</a>.</p> <ol> <li><p>This pop-up script uses inline Javascript in a <code>href</code> link, to set the selected date into the <code>input</code> field, in the parent window, that is was called for. An example URL looks like:</p> <pre><code>&lt;a href="javascript:window.opener.document.formname.field.value='03-10-2011'; window.close();"&gt;3&lt;/a&gt; </code></pre></li> <li><p>The input field name, (e.g. <code>document.formname.field</code>), is passed to the script as a string parameter.</p></li> </ol> <p>I would like to add things done when that link is clicked (e.g. change background color of field, set flag, etc.). So while this DOES work, it's getting <strong>ugly</strong> fast.</p> <pre><code>&lt;a href="javascript:window.opener.document.formname.field.value='03-10-2011'; window.opener.document.formname.field.style.backgroundColor='#FFB6C1'; window.close();"&gt;3&lt;/a&gt; </code></pre> <p><br> How would I move these inline commands into a JS function? This would give me much cleaner URLs and code. The URL would now look something like </p> <pre><code>&lt;a href="javascript:updateField ('document.formname.field', '03-10-2011');"&gt;3&lt;/a&gt; </code></pre> <p>with a function like (this example obviously does NOT work):</p> <pre><code>function updateField (str_target, str_datetime) { var fieldName = "window.opener" + str_target; [fieldName].value = str_datetime; [fieldName].style.backgroundColor = '#FFB6C1'; // Set flag, etc. window.close(); } </code></pre> <p><br>So any suggestions on how this can be done, please?</p>
javascript
[3]
558,811
558,812
Javascript understanding
<p>This is probably a stupidly basic question for this community, but if someone could explain it to me I would be very great full, I am so confused by it. I found this tutorial on the net and this was example.</p> <pre><code>&lt;script type="text/javascript"&gt; function sports (x){ alert("I love " + x); } sports ("Football"); sports ("Rally"); sports ("Rugby"); &lt;/script&gt; </code></pre> <p>Why does this display the 3 variables: Football, Rally and Rugby?</p> <p>Is it because x = sports? So when the variables of sports are defined they get displayed? </p> <p>I think I confused myself more when writing this so I hope it kind of makes sense :(</p>
javascript
[3]
1,643,038
1,643,039
New to C# Concepts
<p>I have been doing a crash course of C# OOP and am curious to know what the "LIST" keyword represents in the code below:</p> <pre><code>var actors = new List&lt;Actor&gt;(); </code></pre> <p>Thanks</p>
c#
[0]
2,686,702
2,686,703
search page work on my pc and doesn't on net
<p>I have a search page with gridview for searching in books all things are good in my PC when i make search with any part of book title the result appear when i published the page on net the page doesn't return any result I'm sure there are books with the criteria I search for ?</p>
asp.net
[9]
3,616,021
3,616,022
Android Photo Gallery from Amazon s3
<p>Im aiming to create an Android app that allows me to gather images from my Amazon instance and then scroll horizontally through them like a photo gallery.</p> <p>Ive currently got an app that scrolls through fragments, but im not sure how to place imageviews inside these fragments </p> <p>Im relatively new to Android and so was wondering if there are any library's available that help accomplish this task? Or is there a way to download the images from the instance, place them in imageviews and then attach them to the fragments?</p>
android
[4]
1,829,422
1,829,423
How to access javascript array values within a setinterval function
<p>EDIT: The correct way to do it is self.series[0].data[self.series[0].data.length-1].x to access the last x value</p> <p>How can I access the series data from within the function defined in setinterval. When I try to access any of the values, or even the array length, it says undefined.</p> <pre><code>events: { load: function() { // set up the updating of the chart each second var series0 = this.series[0]; var series1 = this.series[1]; var series2 = this.series[2]; var series3 = this.series[3]; setInterval(function() { var y = $.ajax({url: "/index.php/control/fetch/&lt;?php echo $uid; ?&gt;",async: false}).responseText; y = y.split(" "); var x = parseInt(y[0]); //alert("x = " + series0[0]); //alert("len is " + parseInt(series0.length)); series0.addPoint([x, parseFloat(y[1])], true, true); series1.addPoint([x, parseFloat(y[2])], true, true); series2.addPoint([x, parseFloat(y[3])], true, true); series3.addPoint([x, parseFloat(y[4])], true, true); }, 5000); } } </code></pre> <p>Thanks</p>
javascript
[3]
1,522,088
1,522,089
Reloading tab activity onResume but don't want to reload on tab switch
<p>I'm not sure if my title is clear so let me explain.</p> <p>Tab A - contains a listview populated from a database Tab B - search form</p> <p>I need to update the contents of tab A after coming back from a search results screen. Using onResume() works great but this also reloads the Tab whenever I click back and forth through between tabs. Is there another method I could use here?</p> <p>EDIT: I guess it's a bit more complex than this. The search form loads a new intent that displays the results in a listview. An item can be select which then loads a item info screen. From here the user can select from a few option, one being Add. This is the action that needs to reload the original listview in Tab A.</p>
android
[4]
3,732,474
3,732,475
Android Passing Bitmap Through Activity
<p>i currently have a class that uses bitmap. however it is not serializable due to bitmap. Right now i am wondering which are the best ways to deal with it.</p> <p>Should i be storing it on the cache or sdcard? How ong does bitmap saved in cache or sdcard stays? is there any tutorial for doing those</p>
android
[4]
524,488
524,489
Multidimensional Array to String
<p>I am trying to convert a multidimensional array into a string with a particular format.</p> <pre><code>function convert_multi_array($array) { foreach($array as $value) { if(count($value) &gt; 1) { $array = implode("~", $value); } $array = implode("&amp;", $value); } print_r($array); } $arr = array(array("blue", "red", "green"), array("one", "three", "twenty")); convert_multi_array($arr); </code></pre> <p>Should Output: <code>blue~red~green&amp;one~three~twenty</code> ... and so on for more sub-arrays.</p> <p>Let me just say that I have not been able to produce any code that is remotely close to the results I want. After two hours, this is pretty much the best I can get. I don't know why the implodes are acting differently than they usually do for strings or maybe I'm just not looking at this right. Are you able to use implode for arrays values?</p>
php
[2]
5,451,058
5,451,059
Real World C++ library
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/777764/what-modern-c-libraries-should-be-in-my-toolbox">What modern C++ libraries should be in my toolbox?</a> </p> </blockquote> <p>I am starting to get serious into C++ development. To that end, I want to learn more about what C++ libraries that are actually used in the real world. The only two well known production quality libraries that I know of is <code>boost</code> and <code>stl</code>. Is there any other C++ library that is well suited and tested for real world application? A light wrapper to some existing C library does not count. </p> <p>Limited one per entry, and library specific to C++. Also give a short description to the library. </p>
c++
[6]
4,422,842
4,422,843
PHP: Most efficient way to get the number of files within a directory
<p>Consider these two folder structures:</p> <pre><code>Foo/ Folder1/ File1.txt Folder2/ Folder3/ File2.txt Bar/ Folder1/ Folder2/ Folder3/ Folder4/ </code></pre> <p>I'd like to know the most efficient way in PHP to tell me that the "Foo" folder has two files in it and that the "Bar" folder has zero files in it. Notice that it's recursive. Even though the "File1.txt" file is not <em>immediately</em> inside the "Foo" folder, I still want it to count. Also, I don't care what the names of the files are. I just want the total number of files.</p> <p>Any help would be appreciated. Thanks!</p>
php
[2]
140,854
140,855
Programming practice sites for java
<p>Can anyone of you please give me the name of the websites where one can get practice problems of core java,j2ee,jsp,servlets</p> <p>Waiting for reply.</p> <p>Regards</p>
java
[1]
113,514
113,515
Calling aspnet Membership ResetPassword stored procedure
<p>I would like to call the aspnet Membership ResetPassword stored procedure called: <code>aspnet_Membership_ResetPassword</code> within the <code>aspnetdb</code> database.</p> <p>When I look at the <code>SqlMembershipProvider</code> class there is a ResetPassword method but this is not useful as I cannot pass the parameter PasswordFormat as I can with the stored procedure.</p> <p>Can anyone advise how I can call this stored procedure explictly from the codebehind of an aspx page in c#? </p>
asp.net
[9]
230,365
230,366
Opening a file without extension
<p>I'm having a problem opening a file in C#.<br> I got a file which I need to read and when I'm trying to open it using C#, for some reason file cannot be found.<br> Here is my code:</p> <pre><code> string fullpath = Directory.GetCurrentDirectory() + string.Format(@"\FT933\FT33_1"); try { StreamReader reader = new StreamReader(fullpath); } catch(Exception e) { Console.WriteLine("The file could not be read:"); Console.WriteLine(e.Message); } </code></pre> <p>The file I'm trying to open is inside <code>Debug\FT933\FT33_1</code> and got no extension.<br> Whenever I'm trying to open a text file from the same directory I manage to do so.</p> <pre><code>EDIT: </code></pre> <p>to be more it precise i think that problem that i have is that i dont know how to open a file that has no extentions (if i change the file to have .txt extention i do manage to open it)</p>
c#
[0]
5,185,939
5,185,940
Casting return type
<p>Does casting a variable to another type return a temporary copy of that variable? if so then why can't you reference the temporary variable to a function.</p> <pre><code>void func(int &amp;i) //error converting parameter 1 from int to int&amp; { } int main() { double d = 6.8; func(int(d)); } </code></pre>
c++
[6]
5,631,281
5,631,282
jQuery doesn't work without alert
<p>I have some JavaScript below, but it doesn't work unless I have the <code>alert</code> as shown below. I know this is some sort of timing issue, but I have no idea how to go about fixing it. Any thoughts?</p> <pre><code>$(function() { $("#search_field").tokenInput("/searches/suggest_gems.json", { onAdd: function (item) { $('#search_field').val(item.name); // Doesn't work without alert("hi"); }, crossDomain: false, tokenLimit: 1, tokenValue: name }); }); </code></pre>
jquery
[5]
3,886,244
3,886,245
Change icon in android
<p>I would like to know how I can change image in imageview but in specific way. I would like to when I start application I have a default icon and when I click on them I change icon on the othe. But when I click again my icon return to default, and again.... This is what I got at this moment:</p> <pre><code> final ImageView check_box = (ImageView) rowView.findViewById(R.id.email_list_item_checkbox_icon); check_box.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { check_box.setImageResource(R.drawable.checkbox_android); } }); </code></pre> <p>How I can do next step and loop this solution?</p>
android
[4]
5,625,755
5,625,756
Is there anything inherently wrong with dynamic downcasting in C++?
<p>I've heard it said several times that if you need to dynamically downcast then there may be something wrong with the design. I see it as a similar mechanism to COMs queryinterface, querying an object at run-time to see what interfaces it supports and then invoking the appropriate method(s) accordingly. </p> <p>Is there anything wrong with this?</p>
c++
[6]
3,920,588
3,920,589
The URL-encoded form data is not valid - Solution not working in some case
<p>This is in reference to the solution posted here:</p> <p><a href="http://stackoverflow.com/a/8684879/1004522">The URL-encoded form data is not valid Solution</a></p> <p>I have added this line in my web.config in appSettings section:</p> <pre><code>&lt;add key="aspnet:MaxHttpCollectionKeys" value="3000" /&gt; </code></pre> <p>But the issue persists. Please help. Interestingly, this issue is not reproducing on my local host but on the production server, it is occuring. </p>
asp.net
[9]
4,569,190
4,569,191
Set margin in style and apply that style to TextView programmatically
<p>In my application, I want to set top and bottom margin of 8 dip to a textview. So if I do it like -</p> <pre><code>&lt;TextView android:id="@+id/tv_text1" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/settings_plain_text"/&gt; </code></pre> <p>it works fine where the style contents are -</p> <pre><code>&lt;style name="settings_plain_text"&gt; &lt;item name="android:layout_marginTop"&gt; 8dip &lt;/item&gt; &lt;item name="android:layout_marginBottom"&gt; 8dip &lt;/item&gt; &lt;item name="android:textSize"&gt; 18sp &lt;/item&gt; &lt;/style&gt; </code></pre> <p>But when I apply the same style to that textview programmatically like -</p> <pre><code>textview.setTextAppearance(context, R.style.settings_plain_text); </code></pre> <p>it does not show the top and bottom margin that I've set in style. Please help.</p>
android
[4]
922,626
922,627
how do i get index of an object in a custom class?
<p>I'm trying to an indexof method for a class that represents a list of objects.I would like to know the best approach. below is the code that I've come up with.</p> <pre><code>public int IndexOf(Product product) { Product p; for (int i = 0; i &lt; products.Count; i++) { p = products[i]; if (p == product) return i; } return -1; } </code></pre>
c#
[0]
2,101,764
2,101,765
What's the value of hw.machine for iPhone5?
<p>I used <strong>uidevice-extension</strong> to get the device type before. This is the value for iphone5 in <strong>uidevice-extension</strong>:</p> <pre><code>if ([platform isEqualToString:@"iPhone5,1"]) return @"iPhone5"; </code></pre> <p>I am not sure if the the value for iphone5 is correct since it is updated before the release date of iphone5. Thanks for any information!</p>
iphone
[8]
388,803
388,804
asp input field on click clear value
<p>I'm wanting to change the value of my inputs with my asp form fields so that when clicked it clears the content and if someone doesn't type any value and clicks another field it will re-add the default value again, if changed it leaves the new text.</p> <p>eg. field:</p> <pre><code> &lt;asp:TextBox ID="NameInfo" CssClass="NameInfo" Width="300" runat="server" text="Name" /&gt; </code></pre> <p>Thanks in advance for any responses. I'm a beginner at asp so I'm not sure how to do these types of features.</p>
asp.net
[9]
2,806,592
2,806,593
how can i add another object to an already defined IQueryable object?
<p>I have IQueryable Products. now i want to add new product to this IQueryable object. so how do i do this?</p>
c#
[0]
5,789,069
5,789,070
Check whether timestamp to present has been 3 hours - php
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/8771981/check-if-timestamp-is-x-hours-old">Check if timestamp is x hours old?</a> </p> </blockquote> <p>How do I determine whether it has been 3 hours or more from a <code>timestamp</code> (formatted like <code>2012-08-06 18:22:02</code>) to the current time, in PHP.</p>
php
[2]
865,326
865,327
Easy way to change value of bolean
<p>A lot of time I have inverse logic between my forms and data, I am looking for easiest (most elegant) way to change some boolean from true to false and vice versa.<br> I know that a lot of people will get angy if see code like this:</p> <pre><code>if (c) { return false; } else { return true; } </code></pre> <p>Or something like this</p> <p>EDIT:</p> <p>I am sorry, My mistake My code sample is not good.<br> What I need to do If I vont just to use inverse value of Boolean </p> <pre><code>myMethod(!op.checkBoxSamoSaKol.Checked) // Is this possibile </code></pre>
c#
[0]
3,992,534
3,992,535
Javascript, escape is not a function - from firefox?
<p>I'm quite puzzled by this one, getting this error from firefox.</p> <pre><code>escape is not a function </code></pre> <p><img src="http://i.stack.imgur.com/EOknY.png" alt="enter image description here"> Looking at the W3C page, it says it is supported as I thought.</p> <p>I tried <code>escapeURI</code> instead and this produced the same error.</p> <p>Any suggestions ?</p>
javascript
[3]
2,772,206
2,772,207
how can i retrieving text from input field as its entered in JavaScript??
<p>How can i retrieve the contents of an input field as they are entered with JavaScript?</p> <p>i know .onChange only works after the focus is changed from the input field? </p> <p>thanks </p>
javascript
[3]
5,503,253
5,503,254
Saving boolean return value into variable?
<p>Is there a way to save a boolean true/false value in a function to a variable?</p> <pre><code>function check() { if(1 = 1) { return false; } } $status = check(); if($status === false) { echo "sign in please"; } </code></pre> <p>As of now <code>$status</code> comes out to be null. I don't like having to use <code>if(check() === false) {}</code> since a lot of my function have a lot of arguments. And setting <code>$status</code> within the function would defeat the purpose of a universal function that can be used for multiple variables.</p> <p>How do you guys handle this?</p> <p>EDIT: I apologize, something else in my code was causing it to be null. Tried to make a test (above code) and when it failed, I thought it was a worthy question :P</p>
php
[2]
5,932,063
5,932,064
C++ question about setting class variables
<p>I'm not new to programming, but after working in Java I'm coming back to C++ and am a little confused about class variables that aren't pointers. Given the following code:</p> <pre><code>#include &lt;iostream&gt; #include &lt;map&gt; using namespace std; class Foo { public: Foo() { bars[0] = new Bar; bars[0]-&gt;id = 5; } ~Foo() { } struct Bar { int id; }; void set_bars(map&lt;int,Bar*&gt;&amp; b) { bars = b; } void hello() { cout &lt;&lt; bars[0]-&gt;id &lt;&lt; endl; } protected: map&lt;int,Bar*&gt; bars; }; int main() { Foo foo; foo.hello(); map&lt;int,Foo::Bar*&gt; testbars; testbars[0] = new Foo::Bar; testbars[0]-&gt;id = 10; foo.set_bars(testbars); foo.hello(); return(0); } </code></pre> <p>I get the expected output of 5 &amp; 10. However, my lack of understanding about references and pointers and such in C++ make me wonder if this will actually work in the wild, or if once testbars goes out of scope it will barf. Of course, here, testbars will not go out of scope before the program ends, but what if it were created in another class function as a function variable? Anyway, I guess my main question is would it better/safer for me to create the bars class variable as a pointer to the map map?</p>
c++
[6]
1,117,583
1,117,584
Building a .net 1.1 project using msbuild
<p>The Web project we are working on is built against .net 1.1 framework.We would like to automate the build process for this project by using msbuild.However MSBuild only targets 2.0 framework. So how can this be done if we like to use MSBuild or MSBEE(this asks us to convert the web project to new version by opening up in Visual studio IDE)?We cannot convert the project to suit to 2.0 framework</p>
asp.net
[9]
3,168,455
3,168,456
ASP.NET websites are compiled but with more HTML markup generated!
<p>Everytime I view the source of ASP.NET website I found alot alot of HTML markup generated. I even tried Visual web Developer and design a simple page and then do the same thing with PHP and I found ASP.NET generates more HTML! </p> <p>Now, how can ASP.NET be faster if it is generating HTML in this way! </p>
asp.net
[9]
5,157,796
5,157,797
How do you explicitly initialize a reference in c++?
<p>I have the following code:</p> <pre><code>class SomeClass {}; class SomeOtherClass { SomeClass&amp; someObj; public: SomeOtherClass() {someObj = SomeClass();} }; </code></pre> <p>And I get an error on the constructor for <code>SomeOtherClass</code> saying <code>Constructor for 'SomeOtherClass' must explicitly initialize the reference member 'someObj'</code>.</p> <p>So I guess my question is pretty strait forward. How do you initialize a reference?</p>
c++
[6]
1,336,095
1,336,096
Remove non printable characters C# multilanguage
<p>I have a multi-language application in asp.net C#. Here I have to create a zip file and use some items from the database to construct file name. I strip out special characters from file name. However if the language is German for example my trimming algorithm will remove some german characters like Umlaut.</p> <p>Could someone provide me with a language adaptable trimming algorithm.</p> <p>Here is my code:</p> <pre><code>private string RemoveSpecialCharacters(string str) { return str; StringBuilder sb = new StringBuilder(); foreach (char c in str) { if ((c &gt;= '0' &amp;&amp; c &lt;= '9') || (c &gt;= 'A' &amp;&amp; c &lt;= 'Z') || (c &gt;= 'a' &amp;&amp; c &lt;= 'z') | c == '.' || c == '_' || c == ' ' || c == '+') { sb.Append(c); } } return sb.ToString(); } </code></pre> <p>thanks</p>
c#
[0]
2,964,127
2,964,128
is it possible to write an app that is invoked by the phone ringing?
<p>I'm guessing the answer is no, but just in case, I'm curious if there's any way to write a receiver that would launch an app when the phone starts to receive a call. Even something as simple as a dialog activity that says "your phone is ringing". Or is the phone always going to suppress any other app that's trying to run?</p>
android
[4]
646,242
646,243
Base class access specification vs class member access specification
<p>How is base class access specification different from member access specification?</p>
c++
[6]
5,533,407
5,533,408
Conditional compilation in python
<p>Hi I am trying to implement conditional compilation in python similar to <a href="http://ideone.com/ttndK" rel="nofollow">this in C</a>,I have seen <a href="http://stackoverflow.com/questions/560040/conditional-compilation-in-python">this thread</a> and <a href="http://stackoverflow.com/questions/3496592/conditional-import-of-modules-in-python">this thread</a>.</p> <p>But <a href="http://ideone.com/u7BO8" rel="nofollow">this</a> is not working. I am relatively new to python,how can we fix this ?</p>
python
[7]
5,075,790
5,075,791
running a stored procedure that takes a long type argument, execute returns false
<p>My call for stored procedure is</p> <pre><code>public void executePreProcssService() { try { Connection conn = null; MasterReportUtils masterReportUtils = new MasterReportUtils(); List&lt;Model&gt; masterReportList = masterReportUtils.getPendingMasterReportList(); if (masterReportList != null &amp;&amp; masterReportList.size() &gt; 0) { conn = getConnection(); MasterReport masterReport = null; for (Model model : masterReportList) { masterReport = (MasterReport) model; CallableStatement st = conn.prepareCall("{call MasterReport_SP(?)}"); st.setLong(1, masterReport.getRecNo()); st.execute(); st.close(); } } executeReportService(conn); if (conn != null) { conn.close(); conn = null; } } catch (Exception e) { } } </code></pre>
java
[1]
1,460,096
1,460,097
Need a sample code which read content from .xls file and write to text file
<p>I Need a sample code which read content from .xls file and write to text file</p> <p>Thanks in advance</p>
javascript
[3]
2,779,484
2,779,485
Combined 2 array data
<p>I want to do something like bellow using php:</p> <pre><code>$turl=array(trim($params-&gt;get('c2'))); $tname=array(trim($params-&gt;get('cn2'))); </code></pre> <p>and want to display each <code>$turl</code> with each <code>$tname</code>.</p> <p>I tried like this:</p> <pre><code>$result=array_combine($turl,$tname); print_r($result); </code></pre> <p>but given result as:</p> <pre><code>Array ( [http://184.107.144.218:8282/,http://184.107.144.218:8082/] =&gt; ABC Radio,AHH Radio ) </code></pre> <p>But I want like this:</p> <pre><code>Array ( [http://184.107.144.218:8282/=&gt; ABC Radio, http://184.107.144.218:8082/=&gt; AHH Radio ) </code></pre> <p>Thanks in advance </p>
php
[2]
1,586,319
1,586,320
Java object error
<p>Ok I'm very new to Java and I'm trying to complete a homework assignment, but my object isn't working in my class. (Forgive me if I'm using wrong terminology, noobie here)</p> <p>So I'm making a basic stopwatch program that records 2 laps. I have gotten to the point of creating the 1st lap and it works great. Then when I call the timer.reset() object to reset the stopwatch it displays the same time as the first lap. Why isn't my timer.reset() not working?</p> <pre><code>public class StopWatch { /** * This method * * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner(System.in); System.out.println("Start stopwatch [press s]: "); System.out.println("Stop stopwatch [press q]: "); Timer timer = new Timer(); input.next(); timer.start(); input.next(); timer.stop(); int elapsedTime = timer.getElapsedTime(); System.out.print("Elapsed time: "); System.out.print(elapsedTime); System.out.println(" milliseconds"); timer.reset(); input.next(); timer.start(); input.next(); timer.stop(); System.out.print("Elapsed time: "); System.out.print(elapsedTime); System.out.println(" milliseconds"); } } </code></pre> <p>Here's the timer.java class im using in my program.</p> <pre><code>public class Timer { private long start; private long stop; private int elapsedTime; public Timer() { } public void start() { if (this.start == 0 &amp;&amp; this.stop == 0) this.start = System.currentTimeMillis(); } public void stop() { if (this.start &gt; 0 &amp;&amp; this.stop == 0) { this.stop = System.currentTimeMillis(); this.elapsedTime = (int) (stop - start); } } public int getElapsedTime() { return this.elapsedTime; } public void reset() { this.start = 0; this.stop = 0; this.elapsedTime = 0; } } </code></pre>
java
[1]
1,900,176
1,900,177
How can get CheckBox Array length in java script
<p>in my jsp form i have one checkbox Array in my form(jsp and struts).i want to know the length of checkbox Array in java script. ex: <code>&lt;input:checkbox property="chkbox[]"/&gt;</code> . in javascript i am calling <code>document.form[0].chkbox[].value.length</code> but it showing javaScript error null or undefined .</p>
javascript
[3]
136,091
136,092
onLocationChanged not getting called other than the first time for GPS
<p>I am using GPS on Android phone, and trying to get GPS coordinates from satellite. I have disabled wifi on my phone.</p> <p>I am using the following code snippet,</p> <pre><code>mlocManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, (float)0.0, mlocListener); </code></pre> <p>the <code>onLocationChanged</code> function will get called everytime as I have set my <code>minTime</code> and <code>minDistance</code> as <code>0</code>.(i am able to see this on the phone)</p> <p>However I want GPS coordinates to be updated only when I change my distance by 1m. Thus I use,</p> <pre><code>mlocManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, (float)1.0, mlocListener); </code></pre> <p>Now the <code>onLocationChanged</code> function is getting called only for the first time when application starts, however if I move my even more than 10metres the <code>onLocationChanged</code> does not get called.</p> <p>The function prototype is ,</p> <pre><code>public void requestLocationUpdates (String provider, long minTime, float minDistance, LocationListener listener) </code></pre> <p>Can someone please tell me a solution.</p> <p>Thanks</p>
android
[4]
4,466,730
4,466,731
Using DiskLruCache in android 4.0 does not provide for openCache method
<p>Have anyone worked on DiskLruCache?</p> <p><a href="http://developer.android.com/training/displaying-bitmaps/cache-bitmap.html" rel="nofollow">http://developer.android.com/training/displaying-bitmaps/cache-bitmap.html</a></p> <p>provides an example of using this caching method. But i observe the implementation for DiskLruCache in 4.0 source code does not have defined methods. Any idea how to use this?</p>
android
[4]
2,077,584
2,077,585
Why doesn't my PHP foreach work?
<pre><code>$start = true; $new = ""; foreach($array as $val) { if($start = true &amp;&amp; $val != " ") { $start = false; $new .= strtoupper($val); } elseif($val == " ") { $new .= " "; $start = true; } else { $new .= strtolower($val); } $start = false; } </code></pre> <p>Basically what happens is <code>$start</code> NEVER becomes <code>false</code> AND everything becomes capitalized. So it looks like the first <code>if</code> IS running, but for some reason NEVER SETS <code>$start</code> to <code>false</code>. </p>
php
[2]
676,462
676,463
time zone example not working in emulator
<p> </p> <p>package com.broadcastreceiver;</p> <p>import java.util.ArrayList; import android.appwidget.AppWidgetManager; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log;</p> <p>public class ExampleBroadCastReceiver extends BroadcastReceiver { </p> <pre><code>@Override public void onReceive(final Context context, final Intent intent) { // TODO Auto-generated method stub Log.d("ExmampleBroadcastReceiver", "intent=" + intent); Intent intent1 = new Intent(context,Login.class); context.startActivity(intent1); } </code></pre> <p>} </p> <p>I run this above code change the time zone in settings not calling other activity can anybody tell what is problem</p>
android
[4]
2,473,926
2,473,927
How to create a custom Caller UI using Android API
<p>Does anyone know whether Android API libraries supports to create a custom Caller UI? For instance to add a new button on the Caller UI. </p>
android
[4]
2,754,443
2,754,444
Couldn't display a second word in my database output
<p>I have a strange problem here. I'm doing a admin page to edit movie info. I have a movie for exemple called "Blood Diamonds" in my database, but on the oage it only show "Blood" without the second word "diamonds", I couldnt find whyyy.</p> <pre><code>require('../classes/movie_class.php'); $moviecinemas = movie::get_movie_info( $_GET['movie_id']); foreach ($moviecinemas as $movie) { $movie_id = $movie['movie_id']; $movie_name = $movie['movie_name']; $movie_category = $movie['movie_category']; $movie_display = $movie['movie_display']; echo "&lt;input name='movieid' type='hidden' id='movieid' value=" . $movie_id . '&gt;&lt;br/&gt;'; echo "Movie Name :"; echo "&lt;input name='moviename' type='text' id='moviename' value=" . $movie_name . '&gt;&lt;br/&gt;'; echo "Movie Category :"; echo "&lt;input name='moviecategory' type='text' id='moviecategory' value=" . $movie_category . '&gt;&lt;br/&gt;';} ?&gt; </code></pre> <p>In the class page :</p> <pre><code>public static function get_movie_info($movie_id) { $query = mysql_query( "SELECT * FROM movie WHERE movie_id = {$movie_id}" ); while( $movie = mysql_fetch_assoc( $query ) ) { $results[] = $movie; } return $results; } </code></pre>
php
[2]
1,897,240
1,897,241
android bluetooth problems
<p>i have a problem in android Bluetooth i am creating a application for controlling the power supplies by digitally. according to my application i created 3 tabs in this 3 tabs i write three activity's but in last tab i am crating a Bluetooth connection, But my problem is how can i write the data to the Bluetooth from the first and second tabs ?? </p> <p>i used Bluetooth chat application.the socket is crated and connections established successfully. data also transmitted in third tab. but i don't know how to access already established connection to other activity. </p>
android
[4]
4,339,316
4,339,317
How to retrieve the user profile information using zend gdata
<p>I have authenticated a youtube user using oauth( zend gdata library used).</p> <pre><code>$url = Zend_Gdata_AuthSub::getAuthSubTokenUri($returnUrl, $this-&gt;scope, $this-&gt;isSecure, $this-&gt;isSession); $httpClient = Zend_Gdata_AuthSub::getHttpClient(Yii::app()-&gt;user-&gt;sessionToken); </code></pre> <p>How to retrieve the user profile information (I need his/her username)? From zend gdata documentation I have found this code :</p> <pre><code>$yt = new Zend_Gdata_YouTube(); $userProfile = $yt-&gt;getUserProfile('liz'); </code></pre> <p>But, using oauth authentication, I dont know the username.</p>
php
[2]
4,662,616
4,662,617
making a textview clickable in android
<p>I am making an android application,I have 4 textviews namely ProductId,Title,description,image.I want when i click on each one of them product id should be displayed.I have a webservice for this.</p> <p>Output of webservice is </p> <pre><code>vmsc&gt; &lt;response code="0" message="Success"/&gt; − &lt;responsedata&gt; − &lt;productcategories&gt; − &lt;productcategory&gt; &lt;id&gt;1&lt;/id&gt; &lt;title&gt;Celebrities&lt;/title&gt; &lt;description&gt;Celebrities&lt;/description&gt; &lt;image&gt; &lt;/image&gt; &lt;/productcategory&gt; − &lt;productcategory&gt; &lt;id&gt;2&lt;/id&gt; &lt;title&gt;Music&lt;/title&gt; &lt;description&gt;Music&lt;/description&gt; &lt;image&gt; &lt;/image&gt; &lt;/productcategory&gt; − &lt;productcategory&gt; &lt;id&gt;3&lt;/id&gt; &lt;title&gt;Sports&lt;/title&gt; &lt;description&gt;Sports&lt;/description&gt; &lt;image&gt; &lt;/image&gt; &lt;/productcategory&gt; − &lt;productcategory&gt; &lt;id&gt;4&lt;/id&gt; &lt;title&gt;Fashion&lt;/title&gt; &lt;description&gt;Fashion&lt;/description&gt; &lt;image&gt; &lt;/image&gt; &lt;/productcategory&gt; − &lt;productcategory&gt; &lt;id&gt;5&lt;/id&gt; &lt;title&gt;Religion&lt;/title&gt; &lt;description&gt;Religion&lt;/description&gt; &lt;image&gt; &lt;/image&gt; &lt;/productcategory&gt; − &lt;productcategory&gt; &lt;id&gt;6&lt;/id&gt; &lt;title&gt;Others&lt;/title&gt; &lt;description&gt;Others&lt;/description&gt; &lt;image&gt; &lt;/image&gt; &lt;/productcategory&gt; &lt;/productcategories&gt; &lt;/responsedata&gt; &lt;/vmsc&gt; </code></pre> <p>Thanks in advance Tushar</p>
android
[4]
669,578
669,579
How can i write a function which takes number(n) as input and automatically creates (n) number of objects for a class
<pre><code>for(int i=0; i&lt;n;i++) { Node "obj"+i =new Node(); } obj1.Node_val(2,3); obj2.Node_val(9,8); </code></pre> <p>i tried this, but not works.</p> <p>Please can you help. Thank you.</p>
java
[1]
2,260,576
2,260,577
Drag and drop javascript event
<p>I'm a java guy trying my hand in javascript and need some help. I came across an amazing tutorial on image uploads here <a href="https://developer.mozilla.org/en-US/docs/Using_files_from_web_applications" rel="nofollow">Mozilla Tutorial</a> and need some help figuring it out. I am currently working on the drag and drop image upload feature. Every time I drag an image onto my area the mouse turns green so it's activated. But then when I let go it should send me an alert that says one image was found. However it always just alerts 0. So the size of the array is 0. Any ideas? Thanks for taking a look. What I've tried with no success...</p> <ol> <li>Copying and pasting the code from the tutorial into my javascript file exactly</li> <li>Moving the code to add the listeners outside of a function and into a window onload</li> <li>Every browser I have</li> </ol> <p>...</p> <pre><code>function toggleStrideMedia() { if(getDisplay("strideMediaWrapper") == "" || getDisplay("strideMediaWrapper") == "none") { show("strideMediaWrapper"); getElement("strideMediaDropZone").addEventListener("dragenter", dragenter, false); getElement("strideMediaDropZone").addEventListener("dragover", dragover, false); getElement("strideMediaDropZone").addEventListener("drop", drop, false); } else { hide("strideMediaWrapper"); } } function dragenter(e) { e.stopPropagation(); e.preventDefault(); } function dragover(e) { e.stopPropagation(); e.preventDefault(); } function drop(e) { e.stopPropagation(); e.preventDefault(); var dt = e.dataTransfer; var files = dt.files; // THIS SHOULD BE GIVING ME A ONE BUT IT ALWAYS GIVES ME A ZERO INSTEAD alert(files.length); handleFiles(files); } </code></pre> <p>.</p> <p><strong>UPDATE</strong> - Fiddle Results</p> <p><img src="http://i.stack.imgur.com/wf8Qx.png" alt="enter image description here"></p>
javascript
[3]
2,740,147
2,740,148
JavaScript Timestamp question
<p>What does these two lines do?</p> <pre><code>Math.floor(1293859512411 / 86400000) Math.ceil((new Date().getTime()) / 86400000) </code></pre> <p>I understand it is something to do with time since epoch, but please explain the two lines.</p>
javascript
[3]
1,225,688
1,225,689
How to group by in php?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2189626/php-how-to-group-a-multidimensional-array-by-a-particular-value">php how to group a multidimensional array by a particular value?</a> </p> </blockquote> <p>I have a sample code:</p> <pre><code>name | images | brand | brand_parent windows 7 | 7_1.png,7_2.png | Vostro | DELL windows 7 | 7_1.png,7_2.png | Inspison| DELL windows 7 | 7_1.png,7_2.png | Compaq | HP windows 7 | 7_1.png,7_2.png | Macbook | Apple $name=array();$images=array();$brand=array();$brand_parent=array(); foreach ($rows as $row) { $name[] = $row-&gt;name; $images[] = $row-&gt;images; $brand[] = $row-&gt;brand; $brand_parent[] = $row-&gt;brand_parent; } </code></pre> <p>How to group by column name, images with this code</p>
php
[2]
4,118
4,119
How to extend a Java class with a loaded class?
<p>I am injecting a Applet that way that it can't check on which website it is.<br /> The purpose is to load an external unmodified applet into mine so I can embed it into mine.</p> <pre><code> final URL[] appletURL = { new URL(Main.getBase() + "/loader.jar") }; final URLClassLoader classLoader = new URLClassLoader(appletURL); // gets the class final Class&lt;?&gt; loader = classLoader.loadClass("loader"); // loads the class applet = (Applet) loader.newInstance(); // creates the applet applet.setStub(new Injector()); // injects the getdocumentbase, so it thinks he is on his own website applet.init(); // start applet applet.start(); applet.setPreferredSize(new Dimension(800, 600)); // to be able to add to jframe properly </code></pre> <p>The "applet.setStub(new Injector());" part is to prevent navigating away or not loading because it's not the applet's own website.<br /> But now I want to render the external applet to a screenshot. I tried this:</p> <pre><code>@Override public void actionPerformed(final ActionEvent e) { final String s = e.getActionCommand(); if (s.equals("Screenshot")) { final BufferedImage offScreen = new BufferedImage(800, 600, BufferedImage.TYPE_INT_RGB); applet.update(offScreen.createGraphics()); try { ImageIO.write(offScreen, "PNG", new File("C:/Users/Mitchell/Pictures/screenshot.png")); } catch (Exception ex) { } } } </code></pre> <p>But it doesn't use the paint nor updat method. It uses getGraphics() instead, I got tipped to extend the applet that I want to screenshot. But the applet is dynamically loaded, so how do I extend a class with a loaded class (or applet)?</p> <p>Can someone provide a code sample? I am about to freak out because this is taking all my time and I can't continue without this.</p>
java
[1]
3,717,682
3,717,683
jQuery wrong format :(
<p>I have that code</p> <pre><code>var p = document.createElement('p'); var a = document.createElement('a'); $(a).attr('href', 'http://www.my-site.com'); $(a).attr('title', 'My Site'); $(a).attr('target', '_blank'); $(a).attr('id', 'l'); $(a).html('&lt;strong&gt;m&lt;span style="color: #D70080 !important;"&gt;Y&lt;/span&gt; site&lt;/strong&gt;'); $(p).attr('id', 'b'); $(p).attr('style', 'text-align: right'); $(p).html('Powered by ' + $(a).html()); $('#wp_phpbb_bridge_options').parent('div').append(p); </code></pre> <p>Why that return me:</p> <p>Powered by mY site</p> <p>as a text ? without link ?</p> <p>The html that I expect to return with that code is this:</p> <pre><code>&lt;p style="text-align: right;" id="b"&gt; Powered by &lt;a href="http://www.my-site.com" title="My Site" target="_blank" id="l"&gt;&lt;strong&gt;m&lt;span style="color: #D70080 !important;"&gt;Y&lt;/span&gt; site&lt;/strong&gt;&lt;/a&gt; &lt;/p&gt; </code></pre>
jquery
[5]
4,571,141
4,571,142
Check if a “run-time” multidimensional array key exists
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/6080991/check-if-a-run-time-multidimensional-array-key-exists">Check if a &ldquo;run-time&rdquo; multidimensional array key exists</a> </p> </blockquote> <p>Hi,</p> <p>I have a multidimensional array. I need a function that checks if a specified key exists and if not set the value.</p> <p>Let's take this array</p> <pre><code>$config['lib']['template']['engine'] = false; </code></pre> <p>A function should not update the value to true when i call with:</p> <pre><code>checkAndSetKey('lib template engine',true); //&gt; Checks if isset $config['lib']['template']['engine'] and if not isset $config['lib']['template']['engine'] = true; </code></pre> <p>Note that my array isn't only 3 dimensional. It should be able to check and set even with only 1 dimension:</p> <pre><code>checkAndSetKey('genericSetting',true); //&gt; In this considering there isn't any $c['genericSetting'] the function set the key to true; </code></pre> <p>At the moment I am using an awful eval code, I would like to hear suggest :)</p> <p>To dynamically check if the key exists it could be used this code:</p> <pre><code>$array = $config; $keys=explode(' ',$argument1); foreach($keys as $v) { if (!array_key_exists($v,$array)) { //&gt; [todo!] the current key doens't exist now we should set the value } $array = &amp;$array[$v]; } </code></pre>
php
[2]
3,703,294
3,703,295
member variable not an option
<p>I have many constants I need to move around in one of my classes but I'm not allowed to use member variables. What are some options?</p> <p>Here's my initial try:</p> <pre><code>private void MyConstants(out int textSize, out int paddingValue, out int borderType, ...) { //Set them here } private Method1() { int textSize = 0; int paddingValue = 0; int borderValue = 0; .... MyConstants(out textSize, out paddingValue, out borderValue) } private Method2() { int textSize = 0; int paddingValue = 0; int borderValue = 0; .... MyConstants(out textSize, out paddingValue, out borderValue) } //Many more methods...Just seems to repetitive. </code></pre>
c#
[0]
3,605,977
3,605,978
what's the benefit of defining some class inside a method?
<p>Is there any benefit to define a class inside a method. I saw someone prefer to define some listener class inside a method, any real benefit to do this?</p>
java
[1]
749,452
749,453
How can i get a value from a string with an alternating name?
<p>I have the following code:</p> <pre><code>var currentCity = db.City.Find(player.Location); switch (TravelTo) { case 1: costs = currentCity.TravelCost.City1; break; case 2: costs = currentCity.TravelCost.City2; break; case 3: costs = currentCity.TravelCost.City3; break; case 4: costs = currentCity.TravelCost.City4; break; case 5: costs = currentCity.TravelCost.City5; break; } </code></pre> <p>Is there a better way to get the cost value? Is there a way i can change the name of the string i want to call? So i could create something like</p> <pre><code>costs = currentCity.TravelCost.City[TravelTo] </code></pre> <p>Or something like that? I feel i wrote an unnecessary switch statement but my knowledge of C# is not good enough to come up with an alternative.</p> <p>Thanks,</p>
c#
[0]
5,324,363
5,324,364
How to read compressed HTML page with Content-Encoding : gzip
<p>I request a web page that sends a <strong>Content-Encoding: gzip</strong> header, but got stuck how to read it..</p> <p>My code:</p> <pre><code> try { URLConnection connection = new URL("http://jquery.org").openConnection(); String html = ""; BufferedReader in = null; connection.setReadTimeout(10000); in = new BufferedReader(new InputStreamReader(connection.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null){ html+=inputLine+"\n"; } in.close(); System.out.println(html); System.exit(0); } catch (IOException ex) { Logger.getLogger(Crawler.class.getName()).log(Level.SEVERE, null, ex); } </code></pre> <p>The output looks very messy.. (I was unable to paste it here, a sort of symbols..)</p> <p>I believe this is a compressed content, how to parse it?</p> <p><strong>Note:</strong> <br> If I change jquery.org to jquery.com (which don't send that header, my code works well)</p>
java
[1]
511,412
511,413
Parse error: syntax error, unexpected '=' (can't figure out which one)
<p>This is the line:</p> <pre><code>&lt;a href="&lt;?php the_permalink(); ?&gt;" title="&lt;?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); rel="bookmark"?&gt;" &gt;&lt;?php the_title(); ?&gt;&lt;/a&gt; </code></pre> <p>I checked and I can't see the problem.</p>
php
[2]
4,280,575
4,280,576
Providing feedback in a form using jquery
<p>I want to provide feedback to a user when they enter something into a textbox. A little tick if their input matches a RegEx and false if it does not.</p> <p>What event do I need to use for this? Key up?</p> <p>For example:</p> <pre><code>if (inputText.match(/regex/)) { document.write(input is correct); // or something else } </code></pre> <p>I want to provide them feedback as they type. Something like what Yahoo <a href="https://edit.europe.yahoo.com/registration?.intl=uk" rel="nofollow">Registration does</a>.</p>
jquery
[5]
3,354,392
3,354,393
Where can I find a list of all methods of javascript objects?
<p>I just learned that <code>alert()</code> is a method of the <code>window</code> object. I also just learned that <code>getElementById()</code> is a method of the <code>document</code> object.</p> <p>Is there a place where I can find documentation as to what methods belong to certain objects?</p>
javascript
[3]
5,724,200
5,724,201
Decode string into a list of integers
<p>How do I decode a string whose length is multiple of 4 into a list of 32-bit integers in javascript?</p> <p>Something that does the equivalent of struct.unpack('>16I, 16characterstring) in python. I'm okay with using common external libraries. I am looking for something clean and which hopefully avoids bit-shifting and manipulation.</p> <p>Example,</p> <pre><code>"deadbeef" -&gt; (1684365668, 1650812262) "dead" -&gt; [1684365668] "beef" -&gt; [1650812262] </code></pre>
javascript
[3]
5,931,333
5,931,334
iPhone:Unable to run my iPhone program which has built with iOS 4.3 SDK in iPhone 3.x
<p>I have created a new project for iPhone using Xcode 4, iOS 4.3 SDK. It has just a button in it, nothing else. I am able to install that on my iPhone 4 device. I set "iOS Deployment Target" as "3.0" and trying to install on my iPhone 3.x 3G device using the same Xcode, but it is installing, but when i launch the application, it comes back to device home screen, unable to launch my application on iPhone 3.x devices. </p> <p>Is it not possible to run any iPhone application which has built with iOS 4.3 SDK, on iPhone 3.x devices?</p> <p>Please help me.</p>
iphone
[8]
5,939,030
5,939,031
Navigate without using sub ids
<p>i am just setting up the general template for my website and the little bit of php that i am doing is to just get the users id from page to page, in other words i want the user while logged in to go from page to page, without using the sub id in the header of user_id=3 for example, and then using the get function to get it and display their information, i want to be able to do it without that.</p> <p>Here is my code but i keep getting the error </p> <pre><code>Notice: Undefined index: user_id in C:\xampp\htdocs\Arken\profile.php on line 7 </code></pre> <p>LOGIN CODE (not all of it of course, just the bit for setting the sessions tuff)</p> <pre><code>// Create session var for their raw id $user_id = $row["user_id"]; $_SESSION['user_id'] = $user_id; // Create the idx session var $_SESSION['idx'] = base64_encode("g4p3h9xfn8sq03hs2234$id"); // Create session var for their username $login_username = $row["login_username"]; $_SESSION['login_username'] = $login_username; // Create session var for their password $login_userpass = $row["login_password"]; $_SESSION['login_userpass'] = $login_userpass; </code></pre> <p>PHP for each page</p> <pre><code> session_start(); $user_id = ""; if ($_GET['user_id']) { $user_id = $_GET['user_id']; } else if (isset($_SESSION['user_id'])) { $user_id = $_SESSION['user_id']; } else { include_once "index.php"; exit(); } include 'connect_to_mysql.php'; </code></pre> <p>Thanks for your help</p>
php
[2]
2,535,169
2,535,170
Is there a way to express a generic handler in a generic way in C#?
<p>Imagine I have an interface that specifies some collection handler:</p> <pre><code>interface ICollectionHandler&lt;T&gt; where T : new() { ... } </code></pre> <p>I then have same other class that wants a collection handler, which it will use for various types, so I want to do something like:</p> <pre><code>class SomeClass&lt;T&gt; where T : ICollectionHandler&lt;&gt; ... </code></pre> <p>If I do this though, I get an error saying that the "Type argument is missing".</p> <p>So is there a way of specifying that T is a generic type, whose own type argument can be specified at runtime, or am I pushing C# beyond its (possibly sensible) boundaries here?</p>
c#
[0]
1,056,636
1,056,637
DSNLess database connection
<p>How to make a DSN less Connection in JAVA. I am trying to make SQL database connection in my java program. But i dont want to make DSN. Is there any alternative. Or how can i make DSN command line?</p>
java
[1]
196,253
196,254
Trace IP Adress in Wordpress
<p>I need to trace the ipadress (where my website access)for optional loading of my theme.Explanation: I want to add a share link to twitter and facebok in my application.i think in some countries like china;twitter blocked.Thats why i need to check from where my site is accessing.otherwise which affecting my site's performance.How can we solve this problem in PHP.If anybody have experience please help me..</p>
php
[2]
3,487,950
3,487,951
Time delay in Javascript
<p>Function PS.Tick() is called every 100 milliseconds and its job is to call AI function of NPCs so they can move:</p> <pre><code>PS.Tick = function () { "use strict"; for (NPCid = 0; NPCid &lt; NPCnumber; NPCid++) { NPCAI(NPCid); }; }; </code></pre> <p>But I want the NPCs to not move simultaneously every 100 millisecond, but do it at their own frequency, so I tried this code:</p> <pre><code>PS.Tick = function () { "use strict"; for (NPCid = 0; NPCid &lt; NPCnumber; NPCid++) { var timeout = 0; timeout = PS.Random (1000); setTimeout("NPCAI(NPCid)",timeout); }; }; </code></pre> <p>Now, they don't move at all. Why? How do I make them move at different time intervals?</p>
javascript
[3]
1,131,536
1,131,537
Monitor location provider access on android without root?
<p>Is there a way to monitor which app or when an app asks a location provider for the current position without having root access?</p>
android
[4]
5,259,069
5,259,070
Python tool to balance parentheses, quotes, and brackets
<p>Does anyone know of an already-written Python script, tool, or editor that will check for unbalanced multi-line tokens? (parentheses, quotes, {}, [], etc.)</p> <p>I've been writing Python code in IDLE, and every so often I'll get "EOF token in multi-line statement" and start swearing, because it means that somewhere in about 200 lines of code I forgot a closing parenthesis or quote and IDLE can't tell me where. This seems like a fairly straightforward thing, I just don't really have the time or headspace to work it out myself right now.</p> <p>Much thanks</p>
python
[7]
4,772,621
4,772,622
jquery drag and drop functinality
<p>iam doing drag and drop functionality using jqury.I am getting "draggable" method not found error. script follows</p> <pre><code>&lt;script src="../Scripts/jquery-1.7.2.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function () { $("#draggable").draggable({ start: function (event, ui) { // flag to indicate that we want to remove element on drag stop ui.helper.removeMe = true; }, stop: function (event, ui) { // remove draggable if flag is still true // which means it wasn't unset on drop into parent // so dragging stopped outside of parent if (ui.helper.removeMe) { ui.helper.remove(); } }, // move back if dropped into a droppable revert: 'valid' }); $("#droppable").droppable({ drop: function (event, ui) { // unset removeMe flag as child is still inside parent ui.helper.removeMe = false; } }); }); &lt;/script&gt; </code></pre> <p>this is html</p> <pre><code>&lt;div id="droppable" style="border: 1px"&gt; &lt;p id="draggable"&gt; Drag me!&lt;/p&gt; &lt;/div&gt; </code></pre>
jquery
[5]
4,772,748
4,772,749
change the image name in php
<p>hello i have the following code to change the image name of upload picture <pre> $TARGET_PATH="pics/"; $TARGET_PATH =$TARGET_PATH . basename( $_FILES['photo']).'.jpg'; while (file_exists($TARGET_PATH)) { $TARGET_PATH =$TARGET_PATH . basename( $_FILES['photo']) . uniqid() . '.jpg'; }</pre></p> <p>This change the name of image or file but dont sho the extention it just show dot(.) at end of name i.e 1=>file.<br/>2=>filefile9534803.</p>
php
[2]
3,006,542
3,006,543
how to call .js after page is loaded
<p>i need to call customFormElements.js js function after aspx page is loaded, after submit button is clicked. can i do this and if yes how?</p> <p>window.onload option is not good...</p> <p>i need to call this file after i press submit button becouse aspx ajax library clear my js file logic and i need to reload it again.</p>
c#
[0]
2,134,628
2,134,629
Best way to procedurally add Power-up items to an iPhone game
<p>To better explain this I'll use Doodle Jump as an example. Assuming that the platforms are recycled, when the character jumps up and the new platforms appear (by scrolling down) there is occasionally a propeller hat on one of them. is there a recommended method to manage this new object? Should I instantiate a single one of these power-ups in the game level's "init" method, and then set a boolean to flag whether it appears in my render method and update methods? Or should I instantiate it at the time that I want it to appear (i.e. just before the new platform scrolls down from its position just above the screen) and release it when it's a) grabbed by the character sprite or b) moves off the screen untouched?</p> <p>Thanks!</p> <ul> <li>Scott</li> </ul>
iphone
[8]
4,170,301
4,170,302
Passing a bound object method in JavaScript
<p>For a Firefox extension, I'm trying to do the following:</p> <ol> <li>Setup an object with two methods and a field/property/attribute</li> <li>One of the methods has to be able to call the other method and access the attribute</li> <li>I want to register that method as an event listener.</li> </ol> <p>Right now, I have it setup like a class:</p> <pre><code>var Obj = { field: null, a: function() { } b: function() { Obj.field = 'x'; Obj.a(); } } window.addEventListener('mouseup', Obj.b, false); </code></pre> <p>But it seems like it should be possible to have the mod not refer to the object "from the outside" (e.g. by using <code>Obj</code>), but using just <code>this</code> instead. However, I can't figure out how to get this to work correctly, pass a simple function reference to <code>addEventListener()</code> <em>and</em> (preferably) only polluting the namespace with a single name. Is that possible? I tried googling for it and found e.g. <a href="http://ejohn.org/blog/simple-class-instantiation/" rel="nofollow">http://ejohn.org/blog/simple-class-instantiation/</a>, but that didn't seem to lead to something that fits my criteria of a clean setup.</p>
javascript
[3]
793,165
793,166
Why use generic constraints in C#
<p>I've read an excellent article on MSDN regarding Generics in C#.</p> <p>The question that popped in my head was - why should i be using generic constraints?</p> <p>For example, if I use code like this:</p> <pre><code>public class MyClass&lt;T&gt; where T : ISomething { } </code></pre> <p>can't I switch ALL references of <code>T</code> in this class with <code>ISomething</code>?</p> <p>What's the benefit of using this approach?</p> <p>Thanks</p>
c#
[0]
3,486,067
3,486,068
Set a property as reference to an object
<p>I have a table that have a property named "recordsource" that will hold the name of the object that will fill the content of the table.</p> <pre><code>&lt;table id="tbl" recordsource="myobj"&gt; </code></pre> <p>Now here are my functions:</p> <pre><code>var myobj; function obj() { this.code = new Array(); this.name = new Array(); } myobj = new obj(); myobj.code = ["a","b","c"]; myobj.name = ["apple","banana","carrot"]; function populate_table() { mytable = document.getElementById("tbl"); mytableobj = mytable.getAttribute("recordsource"); //this will return a string //my problem is how to reference the recordsource to the myobj object that have //the a,b,c array } </code></pre>
javascript
[3]
1,233,072
1,233,073
Floating point arithmetic in Javascript
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/588004/is-javascripts-math-broken">Is JavaScript&#39;s Math broken?</a> </p> </blockquote> <p>I have just started playing around with Javascript in the last couple of days and I have noticed something that appears to be quite peculiar. When I add some numbers together, I end up with a marginally incorrect answer.</p> <p><code>4.99 + 0.98 = 5.970000000000001</code></p> <p>Why does this happen?</p>
javascript
[3]
1,354,743
1,354,744
google cse load after page complete loaded
<p>I have a question, how to make google cse to load after page have completely loaded.</p> <p>i have seen this on <a href="http://www.9lessons.info/" rel="nofollow">http://www.9lessons.info/</a> on top right.</p> <p>Thank you for your guidance.</p>
jquery
[5]
2,222,803
2,222,804
Can we put the lite version of any app on the app store after launching of sdk 3.0?
<p>HI all ,</p> <p>After launching the sdk 3.0 .Did apple refused to launch of the lite and the standard version of one app on the app store , i heard that apple will kill the app if any app have two version like one lite and another standard cause it is increasing the redundancy on the app store.if any one know or have reference link pls provide </p> <p>Thanks </p>
iphone
[8]
1,315,513
1,315,514
C# easy math function
<p>I`m trying to calculate a percent of successful jobs in total. Code:</p> <pre><code>int total = valid + invalid; int percent = (valid / total) * 100; if (percent == 0) { MessageBox.Show(Convert.ToString(total) + ":" + Convert.ToString(valid)); break; } </code></pre> <p>If all job are successful, the percent is 100%. If one job is bad, percent is 0 and i get messagebox with: 9:8</p> <p>8/9*100 = 88.888, not 0. </p> <pre><code>int percent = Convert.ToInt32((valid / total) * 100); </code></pre> <p>gives no result. Please, help me. I am Russian, so sorry for bad English.</p>
c#
[0]
1,743,157
1,743,158
Android: Write and Get Object
<p>I want to write a serializable object to file in internal memory. Then, I want to load that object back from that file later. How could I do this in Android?</p>
android
[4]
2,662,763
2,662,764
On image mouseover zoom
<p>Here is my jQuery code.. </p> <pre><code> $('img').live('mouseenter',function() { $(this).addClass('shown'); $('.shown').animate({width: '+=50',height: '+=50'}) }); $('img').live('mouseleave',function() { $(this).removeClass('shown'); $(this).addClass('reset'); $('.reset').animate({width: '-=50',height: '-=50'}) }); </code></pre> <p>It is removing the image after some mouse enters.. Please help me..</p>
jquery
[5]
414,717
414,718
How to run a Runnable on UI thread from a custom class
<p>How can I run a Runable on the UI thread from a custom class? The method "runOnUiThread(Runnable)" would get the job done but it is a part of an Activity. I wonder if the Application class support something similar because its easy to get an instance of it. I have read about the annotation "@UiTread" from the androidannotation framework. Does this annotation also work for a custom class?</p>
android
[4]
2,250,403
2,250,404
Processing wikipedia dump file
<p>I want to process wikipedia dump file. In other meaning i want to extract title , category and text content for each article. what i want to ask about it is there any java api/tool that can help me in doing that. thanks in advance</p>
java
[1]
1,604,573
1,604,574
how to create listview in android? how many methods?
<p>hi i begginer of android programming. i want a new about basic to create ListView. How many methos to use the create ListView. </p>
android
[4]