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
1,470,222
1,470,223
How to read x amount of characters from a text file
<p>How can I read 20 characters of a text file progressively, for example, If i have a function read_next, calling it the first time would return the first 20 characters in a string, calling it the second time would return the next 20 characters of the file. Please note, I don't want to read the whole file into an array then break it up.</p>
java
[1]
2,529,837
2,529,838
Global Variable Use within the Script Tag's Source Attribute
<p>I run the following javascript code which gives my the list of parameters from the client as well as calling a google fusion table sql statement which supplies its response to the callback function handleResponse.</p> <pre><code>&lt;script&gt; // get parameter list var url = window.location.toString(); url.match(/\?(.+)$/); var params = RegExp.$1; var params = params.split("&amp;"); var queryStringList = {}; for(var i=0;i&lt;params.length;i++) { var tmp = params[i].split("="); queryStringList[tmp[0]] = unescape(tmp[1]); } // callback function funtion handleRespose(response) { } &lt;/script&gt; &lt;script src="https://www.googleapis.com/fusiontables/v1/query?sql=SELECT data from table&amp;key=myKey&amp;callback=handleRespose"&gt;&lt;/script&gt; </code></pre> <p>My question is, how can I use queryStringList like this:</p> <pre><code>&lt;script src="https://www.googleapis.com/fusiontables/v1/query?sql=SELECT " + queryStringList["data1"] + "from table&amp;key=myKey&amp;callback=handleRespose"&gt;&lt;/script&gt; </code></pre>
javascript
[3]
1,788,721
1,788,722
Where are PHP model classes defined for use?
<p>I was wondering where functions and classes are defined for php...</p> <p>I remember looking at WordPress source, and they were calling functions without including files, so I'm curious where this stuff is defined. </p> <p>What I'm looking at doing putting some connection code, like mysql or like for twilio below</p> <pre><code> require "sms/Twilio.php"; $AccountSid = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; $AuthToken = "BBBBBBBBBBBBBBBBBBBBBBBBBBBBB"; $client = new Services_Twilio($AccountSid, $AuthToken); </code></pre> <p>I'm then thinking of putting just this in a file and including it in many places, but I'm curious if it can get easier than including a file. </p>
php
[2]
2,215,858
2,215,859
What is Func, how and when is it used
<p>What is <code>Func&lt;&gt;</code> and what is it used for?</p>
c#
[0]
4,475,344
4,475,345
Get the Selected value from the Drop down box in PHP
<p>I am populating a Drop Down Box using the following code.</p> <pre><code>&lt;select id="select_catalog"&gt; &lt;?php $array_all_catalogs = $db-&gt;get_all_catalogs(); foreach($array_all_catalogs as $array_catalog){?&gt; &lt;option value="&lt;?= $array_catalog['catalog_key'] ?&gt;"&gt;&lt;?= array_catalog['catalog_name'] ?&gt;&lt;/option&gt; </code></pre> <p>Now how can I get the selected option value using PHP (I have the code to get the selected item using javascript and jquery) because I want the selected value to perform a query in database.</p> <p>Any help will be much appreciated. Thank you very much... </p>
php
[2]
5,754,981
5,754,982
using global inside of function to get variable from included file. PHP
<p>Really simple I just think it's me. </p> <p>this is file 1.php</p> <pre><code>if(ctype_digit($_GET['id'])) { $item_id = "Hello"; } else { //Something } </code></pre> <p>this is file 2.php</p> <pre><code>function item_show(){ $item_query = "SELECT title FROM tbl_items WHERE id='" . mysql_real_escape_string($item_id) . "' "; } </code></pre> <p>Now my question is how do I get the value of <code>$item_id</code> from 1.php inside the function in 2.php ? </p> <p>To add file 1.php and file 2.php are both included in index.php</p>
php
[2]
131,408
131,409
Building a Student Storage server
<p>I work for a school district. I've been put in charge of building a storage server for students. A place for them to work off of from school and home. </p> <p>My challenge is getting this to work from home. At school they login, authenticate, and they get a mapped drive to their folder on the server (<code>S:\fileserver\studentname</code>).</p> <p>My question is how can I make this available to students at home? </p> <p>The server is running Windows Server 2008 R2. I've got PHP, Apache, and MySQL working together. My idea is to write a script that will "crawl" through the directory containing all of the student folders, then create an instance of every file and folder in a MySQL DB. Create a login page that will use LDAP for authentication, and once they login to the server from home, they get a page with folders a files tied to their username.</p> <p>Has anyone out there ever put something like this together??</p>
php
[2]
1,395,701
1,395,702
Can I assign a static class to a variable?
<p>My question is whether I can assign a static class to another variable (and of what type would that be) ?</p> <p>Say I have</p> <pre><code>public static class AClassWithALongNameIDontWantTotType{ public static bool methodA() { stuff } } </code></pre> <p>and then I have </p> <pre><code>class B{ } </code></pre> <p>Can I make it so that inside of <code>class B</code> I can reassign this class to something with a shorter name, like:</p> <pre><code>SomeType a = AClassWithALongNameIDontWantTotType </code></pre> <p>and then be able to do</p> <pre><code>a.methodA() </code></pre> <p>?</p> <p>I can get out a function by doing something like</p> <pre><code>Func&lt;bool&gt; a = AClassWithALongNameIDontWantTotType.methodA() </code></pre> <p>but I would prefer to have the whole class.</p> <p>Thanks!</p>
c#
[0]
399,030
399,031
Understanding java program
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/7924961/weird-java-behavior-with-casts-to-primitive-types">Weird java behavior with casts to primitive types</a> </p> </blockquote> <p>Why following prints <code>1</code>?</p> <pre><code>int i = (char) - (int) + (long) - 1; System.out.println(i); </code></pre> <p>Why above lines of code prints 1? How come the value of <code>i</code> become 1?</p>
java
[1]
42,766
42,767
get refresh event from page
<p>How to get event of page refresh. i want to detect that user has refreshed page</p>
jquery
[5]
3,242,586
3,242,587
Make button call same button's method
<p>So I have two buttons, Left and Right. Both have same </p> <pre><code>setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { } </code></pre> <p>methods inside it but I want my code reduced, so is there a possibility I can just make the Left Button call the onClick method of Right Button? instead of having duplicate methods.</p>
android
[4]
4,090,011
4,090,012
Getting PHP (Valums File Uploader) script to NOT overwrite if file exists
<p>/----FIXED THE ISSUE----/</p> <p>I'm creating a site where you can upload a zip file and we will extract it and provide a method of viewing your html site before viewing it. I can see my main problem is going to be bandwidth right now and that is due to the fact that once you access the <a href="https://github.com/valums/file-uploader" rel="nofollow">Valums File-Uploader</a> on our page you can upload infinite files.</p> <p>I've already changed the script so that it opens a session and grabs the persons username and no matter what they upload it goes in the format of:</p> <pre><code> if ($this-&gt;file-&gt;save($uploadDirectory . $_SESSION['myusername'] . '.site.' . $ext)){ </code></pre> <p>This makes it so no matter what they upload it gets created in the format of username.site.zip.</p> <p>I think I need to recode this section, but am not 100% what to change it to - I have tried everything I could think of with no avail:</p> <pre><code>if(!$replaceOldFile){ /// don't overwrite previous files that were uploaded while (file_exists($uploadDirectory . '.' . $_SESSION['myusername'] . '.site.' . $ext)) { return array('error'=&gt; 'Could not save uploaded file.' . 'The upload was cancelled, or server error encountered'); } } </code></pre> <p>Please help me out on this!</p> <p>/----THE FIX----/</p> <pre><code>while (file_exists($uploadDirectory . '.' . $_SESSION['myusername'] . '.site.' . $ext)) { </code></pre> <p>Needed to be:</p> <pre><code>while (file_exists($uploadDirectory . '' . $_SESSION['myusername'] . '.site.' . $ext)) { </code></pre> <p>The directory path was ending in / and then being followed by .username.site.zip</p> <p>Removed the . from the beginning of the file and it now works.</p>
php
[2]
2,154,492
2,154,493
Issues with OnClick Listener for Custom Dialog Box
<p>I am trying to write a custom dialog box that takes a name from the user. I am getting a "OnClickListener cannot be resolved to a type - The method setOnClickListener(View.OnClickListener) in the type View is not applicable for the arguments (new OnClickListener(){})" error in Eclipse. Anyone know what I am doing wrong?</p> <p>Here is my Code:</p> <pre><code>public void getName(){ Dialog dialog = new Dialog(main.this); dialog.setContentView(R.layout.customdialog); dialog.setTitle("New Game"); dialog.setCancelable(true); //there are a lot of settings, for dialog, check them all out! final EditText inputBox = new EditText(this); //set up text final TextView text = (TextView) dialog.findViewById(R.id.TextView01); text.setText("Enter Your Name..."); //set up button final Button button = (Button) dialog.findViewById(R.id.namebutton); button.setOnClickListener(new OnClickListener() { public void onClick() { String str = inputBox.getText().toString(); setName(str); } }); //now that the dialog is set up, it's time to show it dialog.show(); } </code></pre>
android
[4]
5,099,326
5,099,327
Maintaining medium-sized to large JS-heavy web apps
<p>What's the best way to deal with lots of JS in a web front end? Google's <a href="http://code.google.com/closure/compiler/" rel="nofollow">Closure</a> compiler can compile and minify JS, which is good for production -- but annoying to have to recompile every time I make a change, and annoying to debug.</p> <p>What's the best way to be able to organise my JS into many files?</p>
javascript
[3]
2,751,199
2,751,200
How can I change the color of a complex graphic?
<p>I have a graphic in Adobe Illustrator (lets say a cat) that I want to use in an Android application. I would like to have the user be able to change the color of the fur using a color picker. What can I save the graphic as (SVG?) to allow me to programatically control the color from with the android app? Do I have to have a separate image for each color of the cat?</p>
android
[4]
4,212,803
4,212,804
Interface decouples the client
<p>Can you please explain how interface decouples client.</p>
c#
[0]
366,140
366,141
how to get all the rows as well as the column headers from the datagrid to a list
<p>I am currently working on wingrid. In that.. after the data getting displayed in the wingrid, i want to take all the rows from the grid to new list including the column header.</p> <p>In windows datagrid we will take the column header like this.</p> <p>List cols = new List(); // populate foreach (ColumnHeader column in Datagrid.Columns) { cols.Add(column); }</p> <p>but in wingrid there is no class called columnHeader... </p> <p>Kindly tell me how to take the columns name as well as the rows from the grid to the new list..</p> <p>Regards,</p> <p>Ram N</p>
c#
[0]
5,010,350
5,010,351
python - Size limit of set data type
<p>I have a list with 7,200,000 elements in it. When I try to convert it with set() it cuts out to 4,500,000 elements. What can I do to bypass this problem?</p> <p>I'm using Python 3.2.2 x86 on Windows.</p>
python
[7]
4,921,904
4,921,905
NSArray adding elements
<p>I have to create a dynamic NSArray. That is I dont know the size of the array or what are all the elements the array is going to have. the elements need to be added to the array dynamically. I looked at the NSArray class reference. there is a method called arrayWithObejcts, which should be used at the time of initializing the array itself. But i dont know how to achieve what I need to do. please help me.</p> <p>I need to do some thing like the following:</p> <pre><code>NSArray *stringArray = [[NSArray init] alloc] ; for (int i = 0; i &lt; data.size; i++){ stringArray.at(i) = getData(i); } </code></pre>
iphone
[8]
2,604,014
2,604,015
Track restarts, shuts down, power up and power down
<p>can we get notification if user restarts, shuts down, power up or down the device</p>
android
[4]
4,101,183
4,101,184
Adding both Integer and Float values into One Map as one parameter in java
<p>I have <code>Map&lt;Integer, Integer&gt; pickupMap = new HashMap&lt;Integer, Integer&gt;();</code> Map like this. I had inserted values like this </p> <pre><code>if(null != qty_1000 &amp;&amp; !"".equals(qty_1000)) pickupMap.put(Integer.parseInt("1000"), Integer.parseInt(qty_1000)); </code></pre> <p>Now I want to insert "0.5" in the place of "1000". How to insert these both values. Please answer me.</p>
java
[1]
1,430,965
1,430,966
Navigating to a project document from a LinkButton
<p>I am trying to get an excel file to popup on a page in a new window when a user clicks an asp:linkbutton on a webform. I am setting it up to use the OnClick function and in the code behind I do a respond.redirect to the location of the excel file in the project. You can see this in the code below. For some reason it is not working, I get a blank page that pops up in my browser. Is this even best practices? I could also direct the link to shared network drive where there excel files can be stored but that just seems a little too complicated. </p> <pre><code>&lt;asp:LinkButton ID="btnCBFormat" runat="server" Text="CB Format Example" OnClick="btnCBFormat_Click" Target="_blank" /&gt; &lt;asp:LinkButton ID="btnMBFormat" runat="server" Text="MB Format Example" OnClick="btnMBFormat_Click" Target="_blank" /&gt; protected void btnCBFormat_Click(object sender, EventArgs e) { Response.Redirect("//Chargebacks/Formats/CBFormat.xsl"); } protected void btnMBFormat_Click(object sender, EventArgs e) { Response.Redirect("//Chargebacks/Formats/MBFormat.xls"); } </code></pre>
asp.net
[9]
2,538,290
2,538,291
application not running in sleep mode?
<p>my code is running fine when phone not in sleep mode</p> <p>i used broadcast receiver to call application when date going to be changed the code is as follow </p> <pre><code>public class DateReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Log.d("facebook_message", "Date Changed 1"); intent=new Intent(context, project.runningservice.SendPost.class); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); calendar.add(Calendar.HOUR_OF_DAY, 13); calendar.add(Calendar.MINUTE, 0); calendar.add(Calendar.SECOND, 0); AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); PendingIntent pi = PendingIntent.getService(context, 0, intent,PendingIntent.FLAG_UPDATE_CURRENT); try { am.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),pi); Log.d("message", "Wait"); } catch (Exception e) { // TODO: handle exception } } } </code></pre> <p>and code in manifest file is as follow </p> <pre><code>. . &lt;receiver android:name="project.datereceiver.DateReceiver" android:process=":remote"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.DATE_CHANGED"/&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; . . &lt;uses-permission android:name="android.permission.INTERNET"&gt;&lt;/uses-permission&gt; . . </code></pre> <p>and i want my service class run at 8am everyday when date changed but not working correctly when phone in sleep mode. please tell me where i am going wrong?</p>
android
[4]
2,639,994
2,639,995
What's wrong with C#?
<p><a href="http://stackoverflow.com/questions/15528/whats-wrong-with-java" rel="nofollow">Asking the same of Java</a> yielded some very interesting responses, so I thought it would be only fair to ask the same thing of C#, probably Java's closest rival.</p> <p>I actually like this sort of question because it's a lot less subjective than "why should I choose this language" or "why is this language so great."</p> <p>So.. what's wrong with C#?</p>
c#
[0]
633,645
633,646
Is my temp folder discoverable after image upload form?
<p>I have a simple php image upload form that saves the images in a temporary folder, lets call it temp, and when the image is approved by me I manually copy it to the album folder.</p> <p>My question is, if there is a way for someone or I don't know, a search engine maybe to find "guess" my temp folder and what images are inside ( before approve ).</p>
php
[2]
4,871,231
4,871,232
how do pause this loop for a fixed time frame?
<p>I do have a array which will read text file and do api call and then insert these result to mySQL. but when it run in bulk the response from API server is slow and due to this many of the results are coming blank. what I am looking is is there a way to pause this loop for each call say 5 seconds to get result from api server so it wont get blank results.</p> <p>this code is below</p> <pre><code>//connect to your database mysql_connect("localhost", "root", "password"); mysql_select_db("somedb"); //read your text file into an array, one entry per line $lines = file('filename.txt'); //loop through each website URL foreach ($lines as $website_url) { //make the request to the compete API $response = file_get_contents("http://apps.compete.com/sites/" . $website_url . "/trended/rank/?apikey=0sdf456sdf12sdf1"); //decode the request $response = json_decode($request); //get the rank from the response $rank = $response['something']; //insert the website URL and its rank mysql_query("INSERT INTO website_ranks (website_url, rank) VALUES ('" . mysql_real_escape_string($website_Url) . "', " . $rank . ")"); } </code></pre>
php
[2]
3,526,216
3,526,217
The Java classes instances do not require persistence any time
<p>Is there any java class instances, which does not require persistence. </p>
java
[1]
2,292,946
2,292,947
What is the most elegant way to map one list to another in Java?
<p>I am new in Java so please be patient.</p> <p>It is common to map (convert) lists to lists. Some languages have a <code>map</code> method, some (C#) <code>Select</code>. How is this done with Java? Is a <code>for</code> loop the only option?</p> <p>I expect to be able to do something like this:</p> <pre><code>List&lt;Customer&gt; customers = new ArrayList&lt;Customer&gt;(); ... List&lt;CustomerDto&gt; dtos = customers.convert(new Converter(){ public convert(c) { return new CustomerDto(); } }) </code></pre> <p>I have missed something? Please give me a starting point.</p>
java
[1]
5,337,615
5,337,616
Check All Checkbox with Pagination
<p>I currently have a report with pagination, that displays 20 records at a time. In total, there are 600 records.</p> <p>Within this report, I also have a checkbox column for every record. Based on this, my queries are as follows:</p> <p>1) I want to incorporate a "Check All" feature, so based on my scenario which displays 20 records (total of 600 records overall), when I press the "Check All" checkbox, I would actually like to check all 600 records and not just the 20 per pagination.</p> <p>Is this possible with javascript as the total number of records will vary? If so, any help would be appreciated?</p> <p>2) Same concept as point (1), if I have a "Submit" button, I actually want to validate that all 600 records have been checked, even though I am only looking at 20 records at a time</p> <p>Is this possible? If so, any help would be appreciated?</p> <p>Thanks. Tony.</p>
javascript
[3]
1,126,320
1,126,321
Any standalone converter from Java Class to C#?
<p>I found these two - <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=46bea47e-d47f-4349-9b4f-904b0a973174&amp;displaylang=en" rel="nofollow">Java Language Conversion Assistant</a> and <a href="http://developer.db4o.com/blogs/product%5Fnews/archive/2008/05/20/smart-java-to-c-conversion-for-the-masses-with-sharpen.aspx" rel="nofollow">sharpen</a>. But the first one depends on Visual Studio, the second on Eclipse.</p> <p>I would prefer something standalone with command line if possible, even if very primitive.</p>
c#
[0]
1,677,767
1,677,768
C++ Classes - dot notation vs pointer
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1238613/what-is-the-difference-between-the-dot-operator-and-in-c">What is the difference between the dot (.) operator and -&gt; in C++?</a> </p> </blockquote> <p>What's the difference between using dot notation and the pointer way? </p> <p>Instantiating an object with or without a pointer.</p> <p>Instantiate w/o a pointer = then use dot notation </p> <p>Instantiate w/ a pointer = then use -> </p> <p>What are the differences between both? When and why should one be used over the other? </p>
c++
[6]
3,434,750
3,434,751
Storing Java bytecode in a database
<p><a href="http://java.sun.com/docs/books/jls/second_edition/html/packages.doc.html" rel="nofollow">The Java Language Specification</a> states</p> <blockquote> <p>A package can be stored in a file system (§7.2.1) or in a database (§7.2.2). </p> </blockquote> <p>We're all familiar with packages stored in file systems, but I have not seen packages stored in a database.</p> <p>Can anyone point me at a site discussing this more thoroughly than the above html? I'd like to understand the purposes, advantages, disadvantages, etc. Note, I'm asking about packages rather than the storage of object instances.</p>
java
[1]
3,223,448
3,223,449
Difference between simple html img tag running as a server control as opposed to an asp.net Image and security?
<p>If all I want to do is just change an image dynamically, then is an img html tag with the runat="server" attribute sufficient over the asp.net Image control? My main concern is security. For example, I am also curious if using html anchor tags with the runat="server" as opposed to the asp.net HyperLink control raises security issues.</p>
asp.net
[9]
4,919,146
4,919,147
Uncaught TypeError: Cannot set property '0' of undefined "
<p>i'm getting the error </p> <blockquote> <p>Uncaught TypeError: Cannot set property '0' of undefined</p> </blockquote> <p>for some reason in this line </p> <pre><code>world_map_array[i][z]="grass.gif|ongrass.gif|collision.gif|above.gif"; </code></pre> <p>Why is this happening?</p> <p>thanks for any help</p> <pre><code>var x_world_map_tiles = 100; var y_world_map_tiles = 100; var world_map_array = new Array(x_world_map_tiles); for (i=0; i&lt;=2; i++)//create a two dimensional array so can access the map through x and y coords map_array[0][1] etc. { world_map_array[i]=new Array(y_world_map_tiles); } for (i=0; i&lt;=x_world_map_tiles; i++)//just a test { for (z=0; z&lt;=y_world_map_tiles; z++)//just a test { world_map_array[i][z]="grass.gif|ongrass.gif|collision.gif|above.gif"; } } </code></pre>
javascript
[3]
3,255,776
3,255,777
Write directly to screen with c++
<p>Hello I am new to c++ and am wondering where to go about looking to print directly to the screen? For example the HUD interface that appears on laptops when you change the volume. I'm not really looking for any fancy graphics, just, say, a variable or info from a file.</p> <p>I've tried googling but havn't come up with anything yet. So...where should I begin looking?</p> <p>Thanks!</p>
c++
[6]
2,734,714
2,734,715
Android application(.apk files) updating for an existing app in Google play
<p>At present I am having four .apk files for an android application with different version code and version 1.0 . Now I want to update my app with same four .apk files but there are now some changes in the manifest file for each apk. I a using same certificate key(existing one) and different version code with 1.1 version for each updated .apk file.</p> <p><strong>Now in my Google play account for that app, existing four apk are there in active mode. Now when I will upload my updated four apks, I have to activate them too. But my question is that should I deactivate the older ones or leave them as it is ????</strong> </p> <p><strong><em>Bcoz previously I used :</em></strong> </p> <pre><code>android:minSdkVersion="7" android:targetSdkVersion="16" </code></pre> <p><strong><em>Now using:</em></strong> </p> <pre><code> android:minSdkVersion="8" android:targetSdkVersion="16" </code></pre>
android
[4]
3,174,869
3,174,870
Java switch constant expression... Is there any clever way to get this to compile?
<p>I'm returning to Java dev after many years away from it. Is there anyway to get this code to compile?</p> <pre><code>class Mpeg4 { public static final int FourCC2Int(char aA, char aB, char aC, char aD) { return (aA &lt;&lt; 24) | (aB &lt;&lt; 16) | (aC &lt;&lt; 8) | (aD); } public static void main(String aArgs[]) throws Exception { int x = Integer.parseInt(aArgs[0]); switch (x) { case Mpeg4.FourCC2Int('f', 't', 'y', 'p'): // This won't be reduced by the compiler to a constant. // doSomething(); break; } } } </code></pre> <p>I tried also to have a class constant such as</p> <pre><code>class Mpeg4 { private static final int KFtyp = Mpeg4.FourCC2Int('f', 't', 'y', 'p'); public static void main(String aArgs[]) throws Exception { int x = Integer.parseInt(aArgs[0]); switch (x) { case KFtyp: // Foiled again. // doSomething(); break; } } } </code></pre> <p>The language has changed quite a bit, and I've done Googling. Is there any way I can keep my code tidy i.e. not manually reducing the 'macro' or having a potentially massive if-then-else-if block? Maybe compiler optimisation flags might be one route? I find this situation quite lame.</p>
java
[1]
3,505,895
3,505,896
Associate an element placed out of tab with tab items
<p>I have a tab script that works:</p> <p><a href="http://jsfiddle.net/fmqeh/8/" rel="nofollow">http://jsfiddle.net/fmqeh/8/</a></p> <p>With click on ".tab" items, ul.tab li items has class "actives". But with click on </p> <pre><code>&lt;a class="bdn" href="#tab2"&gt;Go to Tab 2&lt;/a&gt; </code></pre> <p><code>&lt;a class="bdn"&gt;</code> couldnt add <code>class="actives</code> to tab items. How can I do this with scroll to </p> <pre><code>&lt;div class="tab_content chart" id="tab2"&gt; this is the content of tab2 &lt;/div&gt; </code></pre> <p>Thanks in advance</p>
jquery
[5]
3,475,394
3,475,395
How to get value from a label in tableviewcell?
<p>I have a tableview which contains some text and I have a label inside tableviewcell as subview, in the label there is also some values. My question is, when I tap the cell I want to get the label value, I know how to get a cell value when tapping the cell but I need to get the label value, my code for getting the tablecell value is </p> <pre><code>NSString *localStringValue; localStringValue = [tableView cellForRowAtIndexPath:indexPath].textLabel.text; </code></pre> <p>and I display it in a textview <code>textview.text = self.localStringValue;</code> My label name is chapterandverse, I need to implement this label instead of <code>textlabel.text</code>. I add <code>localStringValue = [tableView cellForRowAtIndexPath:indexPath].chapterandverse.text;</code> but I got error for this code. Please help me to do this. Thanks in advance.</p>
iphone
[8]
791,020
791,021
Stopping PHP script putting URL's in address bar?
<p>I have a script that pulls in meta data from a list of URL's but when I try to out too many it it says URL is too long and wont run.</p> <p>My question is how can I stop this from happening?</p> <pre><code>&lt;?php ini_set( 'default_charset', 'UTF-8' ); error_reporting(E_ALL); //ini_set( "display_errors", 0); function parseUrl($url){ //Trim whitespace of the url to ensure proper checking. $url = trim($url); //Check if a protocol is specified at the beginning of the url. If it's not, prepend 'http://'. if (!preg_match("~^(?:f|ht)tps?://~i", $url)) { $url = "http://" . $url; } //Check if '/' is present at the end of the url. If not, append '/'. if (substr($url, -1)!=="/"){ $url .= "/"; } //Return the processed url. return $url; } //If the form was submitted if(isset($_GET['siteurl'])){ //Put every new line as a new entry in the array $urls = explode("\n",trim($_GET["siteurl"])); //Iterate through urls foreach ($urls as $url) { //Parse the url to add 'http://' at the beginning or '/' at the end if not already there, to avoid errors with the get_meta_tags function $url = parseUrl($url); //Get the meta data for each url $tags = get_meta_tags($url); //Check to see if the description tag was present and adjust output accordingly $tags = NULL; $tags = get_meta_tags($url); if($tags) echo "&lt;tr&gt;&lt;td&gt;Description($url)&lt;/td&gt;&lt;td&gt;" .$tags['description']. "&lt;/td&gt;&lt;/tr&gt;"; else echo "&lt;tr&gt;&lt;td&gt;Description($url)&lt;/td&gt;&lt;td&gt;No Meta Description&lt;/td&gt;&lt;/tr&gt;"; } } ?&gt; </code></pre>
php
[2]
1,363,873
1,363,874
Android: Programmatically change android:name attribute for Application and BroadcastReceiver
<p>Is it possible to programmatically change the <code>android:name</code> attribute in code for Application and BroadcastReceiver? I would like to change the name of my App icon and Widget names programmatically, in order to reuse our existing localization infrastructure.</p>
android
[4]
985,619
985,620
android minesweeper code
<p>I am trying to make an application for android(minesweeper) My problem is how to build the mines and how they are placed in the buttons . the interface is 5x5(25 button and 1 for new game)</p>
android
[4]
5,080,332
5,080,333
Formulating my div objects in such a way that it resembles a sine wave
<p>So the basic idea is that I have an array of 8 div rectangles with a width of 30 px and a random height through Math. rand. Right now I'm trying to arrange them such that they form a sine wave pattern. I know I have to use Math.sin somewhere, but I have no clue as to go about it. Any help with this issue will be greatly appreciated. Here is what I have so far:</p> <pre><code>var divArr = new Array(); for(i = 0; i &lt; 8; i++){ //var rand_numX = Math.floor((100-19)*Math.random()) + 20; var rand_numY = Math.floor((100-19)*Math.random()) + 20; divArr[i] = OS.dom.add_element('div', view, {position: 'absolute', width:'30px', height: rand_numY+'px', 'background-color': '#000000'}); } </code></pre>
javascript
[3]
1,910,588
1,910,589
Including huge string in our c++ programs?
<p>I am trying to include huge string in my c++ programs, Its size is 20598617 characters , I am using <code>#define</code> to achieve it. I have a header file which contains this statement</p> <pre><code>#define "&lt;huge string containing 20598617 characterd&gt;" </code></pre> <p>When I try to compile the program I get error as <code>fatal error C1060: compiler is out of heap space</code></p> <p>I tried following command line options with no success</p> <pre><code>/Zm200 /Zm1000 /Zm2000 </code></pre> <p>How can I make successful compilation of this program?</p> <p>Platform: Windows 7</p>
c++
[6]
1,388,420
1,388,421
Are classes necessary for creating methods (defs) in Python?
<p>Are classes necessary for creating methods (defs) in Python?</p>
python
[7]
4,430,525
4,430,526
No width/height set for items. This will cause an infinite loop. Aborting
<p>I am using jcarousel, and on window resizing I am getting the error:</p> <blockquote> <p>jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...</p> </blockquote> <p>How can I avoid this error?</p>
jquery
[5]
2,598,795
2,598,796
Android - Layout Height not updating
<p>I have a Scrollview inside that i have a LinearLayout. LinearLayout has some views. For ex:- My LinearLayout height is 100. After i removed all views from LinearLayout also i get the same height as 100. How to update the current height. That is 0 when no views is present.</p> <p>My code:</p> <pre><code>&lt;ScrollView android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:fillViewport="true"&gt; &lt;LinearLayout android:layout_weight="1" android:layout_width="fill_parent" android:orientation="vertical" android:layout_height="wrap_content"&gt; &lt;/LinearLayout&gt; &lt;/ScrollView&gt; </code></pre>
android
[4]
3,585,539
3,585,540
Breakout of If/Else
<p>I have an if else statement such as:</p> <pre><code>if (IsContactMatch(p.Email, "emailaddress1")) { addContact(p, lService, businessUnit, marketSegment, campaignSource, Evaluation); } else if (IsContactMatch(p.Email, "emailaddress2")) { addContact(p, lService, businessUnit, marketSegment, campaignSource, Evaluation); } else if (IsContactMatch(p.Email, "emailaddress3")) { addContact(p, lService, businessUnit, marketSegment, campaignSource, Evaluation); } else if (IsContactByNameMatch(p.FirstName, p.LastName, p.AccountName)) { addContact(p, lService, businessUnit, marketSegment, campaignSource, Evaluation); } </code></pre> <p>If one of the If statements is true I want it to break out of the if elses and not execute anymore. Is there a good way to do this such as a break; or a return?</p> <p>Thanks!</p>
c#
[0]
1,228,396
1,228,397
jQuery Plugin development Events Handlers
<p>I'm trying to learn to develop jQuery plugins. I readed the base tutorial on jQuery site, and try to understand how it works and how structure the plugin.</p> <p>I did some fast test, but i'm stuck now and i don't know how to get past.</p> <p>Here is the code:</p> <pre><code>var myElement = $("#Foo"); var myButton = $("#Bar"); (function($) { var showAlert; var mathWorks; var methods = { init : function(options) { // Declaring Default Options var defaults = { option1 : 'Default', option2 : false } // Merge Options var opt = $.extend(defaults, options); showAlert = function(txt) { alert(txt); } mathWorks = function(a,b) { alert('Result of '+a+'*'+b+' = '+ a*b); } methods.doSomething(opt.option1); }, doSomething: function(text) { alert(text); }, doMathWorks: function(a,b) { mathWorks(a,b) } }; $.fn.testPlugin = function() { var method = arguments[0]; if(methods[method]) { method = methods[method]; arguments = Array.prototype.slice.call(arguments, 1); } else if( typeof(method) == 'object' || !method ) { method = methods.init; } else { $.error( 'Method ' + method + ' does not exist on jQuery.pluginName' ); return this; } return method.apply(this, arguments); } })(jQuery); </code></pre> <p><strong>Where do i declare Events Handlers?</strong></p> <p>Like:</p> <pre><code>myButton.bind('click', function() { alert('test'); //methods.doSomething("Testing"); }); </code></pre> <p>And also, It is correct to declare elements variables before the plugin, as i did?</p>
jquery
[5]
4,216,506
4,216,507
Bindingsource error value does not fall within the expected range
<p><img src="http://i.stack.imgur.com/IKR3S.jpg" alt="enter image description here">I am trying to add BindingSource to my default.aspx. In properties window, when I click on triangle for datasource, a message box appears saying </p> <p>Value does not fall within the expected range</p> <p>Why is that? How can I set it? Thanks</p>
asp.net
[9]
2,397,017
2,397,018
How to set one select box equal to another?
<p>I have two identical select boxes (aside from their names, of course), and I need to have the value of the second select box be set equal to the value of the first when a checkbox is checked. Here's part of my code:</p> <pre><code>&lt;form id="theForm" name="theForm"&gt; &lt;select name="stateSelect" id="stateSelect"&gt; &lt;option value="AL"&gt;Alabama&lt;/option&gt; &lt;option value="AZ"&gt;Arizona&lt;/option&gt; &lt;option value="AR"&gt;Arkansas&lt;/option&gt; &lt;/select&gt; &lt;select name="stateSelect2" id="stateSelect2"&gt; &lt;option value="AL"&gt;Alabama&lt;/option&gt; &lt;option value="AZ"&gt;Arizona&lt;/option&gt; &lt;option value="AR"&gt;Arkansas&lt;/option&gt; &lt;/select&gt; &lt;input type="checkbox" name="checky" onClick="doStuff()"&gt; &lt;/form&gt; doStuff() { // change it from here } </code></pre> <p>So, I've tried a bunch of different things, including code I've found on forums and on SO, but nothing seems to work. What code should I have in my javascript function so that when the function runs the second select box is set equal to the first?</p> <p>Thanks for your help!</p>
javascript
[3]
4,096,592
4,096,593
copy std::map<int, vector<int>> to std::map<std:string, vector<int>>
<p>Can we copy contents one one map to another map with different type of key? <code>copy std::map&lt;int, vector&lt;int&gt;&gt; to std::map&lt;std:string, vector&lt;int&gt;&gt;</code> </p>
c++
[6]
34,118
34,119
How to connect facebook with c# to get friends birthdays
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/5754124/connect-to-facebook-and-working-with-api">Connect to facebook and working with api</a> </p> </blockquote> <p>I have been trying to connect with c# to my facebook account but i don't know how to go by it</p>
c#
[0]
2,834,813
2,834,814
PHP from CMD - 'C:\php\php_openssl.dl l' - The specified module could not be found
<p>First time trying to run a PHP script from CMD. When the script is run in the browser, it runs fine. But I get this error in the CMD.</p> <pre><code>PHP Warning: PHP Startup: Unable to load dynamic library 'C:\php\php_openssl.dll' - The specified module could not be found. in Unknown on line 0 PHP Fatal error: Call to undefined function mysql_connect() in C:\inetpub\wwwroot\sandbox\singleprop\cp\scripts\newprops\list.php on line 6 </code></pre>
php
[2]
2,354,858
2,354,859
Simpler way to check and call overloaded method
<pre><code>private void SomeMethod(DerivedA something) {...} private void SomeMethod(DerivedB something) {...} private void SomeMethod(DerivedC something) {...} BaseClass bc = somevariable; if (bc is DerivedA) Somemethod(bc as DerivedA) else if (bc is DerivedB) Somemethod(bc as DerivedB) else if (bc is DerivedC) Somemethod(bc as DerivedC) ... else if (bc is DerivedZZ) Somemethod(bc as DerivedZZ) </code></pre> <p>In .NET 3.5, there has got to be a simpler way, no?</p>
c#
[0]
4,927,053
4,927,054
creating an initialized string in java given input parameters
<p>is there a nice way for creating a string initialized with a number of characters given an int (counter) and the character to set. Simply put I would like a method that returns "#,#,#,#,#" when passed 5 and # as parameter.</p> <p>Any ideas?</p>
java
[1]
2,978,904
2,978,905
detecting browser scrolling
<p>How can I know when the user has scroll on the screen?</p>
javascript
[3]
831,698
831,699
Where can i learn ASP.NET
<p>I'm quit new to web programming. I know C# well, I've coding in C# for two years and when I decided to get familiar with web programming I was advised to start with ASP.NET as I knew C#, so where can I do that. Can anyone suggest anything? And which one is better classic ASP.NET or Web Form or whatever it's called or ASP.NET MVC4? I mean which one should I learn first?</p>
asp.net
[9]
4,453,619
4,453,620
How to return a list of strings that is a certain length?
<p>What I'm trying to do is create a program that returns a list of strings that are a certain length. I have a program made but I feel that it's extremely off</p> <pre><code>def lett(lst,n): res = [] for a in range(1,len(lst)): if a == n res = lst[a] return res </code></pre> <p>what I want is to take the list and return all the words that are the length of n so if I were to do lett(["boo","hello","maybe","yes","nope"], ) it would return ['boo','yes']</p> <p>thanks!</p>
python
[7]
561,289
561,290
Increasing the size of array creates some problem
<p>I tried to check, what is the largest size of array, which can be created in CPP. I declared a "int" array and kept increasing the array size. After 10^9 the program started crashing, but there was a serious error for array of size 5*10^8 and more(even when program did not crash). The code used and the problem is following :</p> <pre><code>#include&lt;iostream&gt; int ar[500000000]; int main() { printf("Here\n"); } </code></pre> <p>The above code runs successfully, if the size of array is reduced to 4*10^8 and lesser. But, for array size greater than 5*10^8, the program runs successfully but it does not print any thing, also it does not get crashed, or gave any error or warning.</p> <p>Also, if the array definition is local then there is no such error, after same limit the program gets crashed. It's when using the global definition of array, the program does not get crashed nor does print anything.</p> <p>Can anybody please explain the reason for this behavior. I've understood that the size of array will vary for different machines.</p> <p><b>I've 1.2 GB of free RAM. How am I able to create the local integer array of size 4*10^8. This requires around 1.49GB, and I don't have that much free RAM.</b></p>
c++
[6]
2,000,622
2,000,623
having problems to import javax.servelt
<p>I am trying to import this package (javax.servelet.*;) but netbeans is saying that the package does not exist. Does anyone know what might be the problem? Thx.</p>
java
[1]
5,903,011
5,903,012
How can I protect my site from being leeched?
<p>I am using the <code>header</code> function of PHP to send the file to the browser with some small code. Its work well and I have it so that if any one requests it with a referer other than my site it redirects to a page first. Unfortunately it's not working with the internet download manager.</p> <p>What I want to know is how the rabidshare and 4shared sites do this.</p>
php
[2]
4,421,425
4,421,426
C++ -- How to overload operator+=?
<p>Given the following code snippet,</p> <pre><code>class Num { public: Num(int iNumber = 0) : m_iNumber(iNumber) {} Num operator+=(const Num&amp; rhs) { this-&gt;m_iNumber = (this-&gt;m_iNumber + rhs.m_iNumber); return *this; } private: int m_iNumber; }; int _tmain(int argc, _TCHAR* argv[]) { Num a(10); Num b(100); b += a; return 0; } </code></pre> <p>I would like to know how to correctly overload the operator+=.</p> <p>Question 1> How to define the signature of this operator? Specially, what should be used for the return value?</p> <p>Question 2> How to implement the function body?</p> <p>Question 3> How to use this overload operator?</p> <p>I have provided a solution as above but I have concerns that it is not correct.</p> <p>Thank you</p>
c++
[6]
1,852,470
1,852,471
how to traverse a grid of numbers using AB-pruning in C++?
<p>Firstly I would like to accept that it is a homework question , but then I know how to code AB-pruning from the algorithm of it . The problem is how to apply it on a grid of numbers where the game can go on in any direction (right , left , up and down ) , thus how will be the tree formed . </p> <p>Sorry for being a bit vague here , if more info is required then do inquire , I will provide it . </p>
c++
[6]
4,517,579
4,517,580
navigation Controller button left
<p>In my application, i have some leftBarbutton of the navigation bar set to " retour" and some others set to "back" i would like to set all my buttons to "retour", how to do this please ? i have spend many hours to dos this.</p> <p>thanks </p>
iphone
[8]
5,673,647
5,673,648
how can I get Expiration Date of intermediate Certificate and trusted Root Certificate by C# code?
<p>how can I get Expiration Date of intermediate Certificate and trusted Root Certificate by C# code? I need to get data about certificate in internet Option (-> content -> certificates);</p>
c#
[0]
4,830,552
4,830,553
Reverting back JQuery from noConflict mode to its original state
<p>How can I revert back jQuery from noConflict mode to standard mode.</p> <p>I would like to use two versions of JQuery on one side.</p> <pre><code>&lt;script type="text/javascript"&gt; window.jqSite = jQuery.noConflict(true); &lt;/script&gt; &lt;script type="text/javascript" src="jquery.new.js" charset="utf-8"&gt;&lt;/script&gt; &lt;!-- The following code is using $ and jQuery from jquery new --&gt; &lt;script type="text/javascript" src="some-script.js" charset="utf-8"&gt;&lt;/script&gt; &lt;!-- reverting back to original jquery lib used on the site --&gt; &lt;script type="text/javascript"&gt; jQuery.noConflict(true) $ = jQuery = window.jqSite; &lt;/script&gt; </code></pre> <p>Using the above code, $ and jQuery variables are not resolved correctly and I get error "$ is not a function".</p> <p>Any ideas ?</p>
jquery
[5]
5,377,046
5,377,047
When to use Server.Transfer or Response.Rewrite?
<p>I found many topics on <code>Server.Transfer</code> VS <code>Response.Redirect</code> but none of them explained about the difference between the Server.Transfer and Response.<strong>Rewrite</strong>.</p> <p>As far as I know, they use the same type of method for navigating the user: So what is the difference between them and when should they be used?</p>
asp.net
[9]
5,300,167
5,300,168
share data between two separated applications in iPhone
<p>im developing two separted applications but there is a plist file for one of those app contains data that i need it on the other one .. is there is anyway to get data ? in case yes please show me some sample code .. and what about the NSUserDefault could it be useful ?</p>
iphone
[8]
4,175,986
4,175,987
How to convert a Persian date into a Gregorian date?
<p>I use the function below to convert Gregorian dates to Persian dates, but I've been unable to write a function to do the reverse conversion. I want a function that converts a Persian date (a string like "1390/07/18 12:00:00") into a Georgian date.</p> <pre><code>public static string GetPdate(DateTime _EnDate) { PersianCalendar pcalendar = new PersianCalendar(); string Pdate = pcalendar.GetYear(_EnDate).ToString("0000") + "/" + pcalendar.GetMonth(_EnDate).ToString("00") + "/" + pcalendar.GetDayOfMonth(_EnDate).ToString("00") + " " + pcalendar.GetHour(_EnDate).ToString("00") + ":" + pcalendar.GetMinute(_EnDate).ToString("00") + ":" + pcalendar.GetSecond(_EnDate).ToString("00"); return Pdate; } </code></pre>
c#
[0]
835,623
835,624
How to display a "loading..." dialog?
<p>I would just like to display something like a dialog (but dialogs are modal only, right?)</p> <p>when my activity is loading data in onCreate()</p> <p>and to dismiss this "dialog" when complete.</p> <p>Just to inform the user that data is loading.</p> <p>How can I do this easily?</p> <p><em>I do not want the user to be able to interact with the UI during this period.. just for him to sit and wait until data is loaded.</em></p>
android
[4]
2,377,721
2,377,722
Pull value from table
<p>Hello I have the following on a page and I would like to pull the value: 36424. the value will change thus Im trying to create a function that will pull it when i call on the function.</p> <pre><code> &lt;table cellspacing="0" cellpadding="3" rules="cols" border="1" id="OSDataCount" style="color:Black;background-color:White;border- color:#999999;border-width:1px;border-style:Solid;border-collapse:collapse;"&gt; &lt;tr style="color:White;background-color:Black;font-weight:bold;"&gt; &lt;th scope="col"&gt;COUNT(*)&lt;/th&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;36424&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>cheers</p>
javascript
[3]
4,250,225
4,250,226
How to change a class's content using jQuery
<p>Here is the div element on my page:</p> <p></p> <p>How can I change a class's content?</p> <p>So from existing which is: class="jcarousel-next jcarousel-next-horizontal"</p> <p>to class="jcarousel-next jcarousel-next-horizontal jcarousel-next- disabled jcarousel-next-disabled-horizontal"</p> <p>Do I need to completely remove it by using removeClass and then re-add?</p>
jquery
[5]
462,576
462,577
Touch inputs not work after restart of android froyo with locking applicaion
<p>I have developed locking application(kiosk mode) for the android mobile.Its working propely on android honeycomb and ice cream sandwich version. IF I set " category android:name="android.intent.category.DEFAULT" " in androidManifest.xml file then touch inputs not work after restating froyo 2.2 tablet.</p>
android
[4]
2,520,374
2,520,375
I received auth error (CODE 200) with Liberty Reserve API in my Java program, but using correct data. What it is can be?
<p>I downloaded API interface from offical web site. When I try to load balance, or account name - I recive auth erorr, but account data 100% is right.</p> <p>I found information about some API bugs. It is happen time on client is not equal with time on server. When I synch time on my PC, but it is not solved the problem.</p> <p>What it is can be?</p> <pre><code> ApiAgent.Balance balance = apiAgent.balance(); usdBalance = balance.getUsd(); euroBalance = balance.getEuro(); goldBalance = balance.getGold(); accountName = apiAgent.accountName(number); </code></pre> <p>I am use JRE 7. Maybe it is have reason.</p>
java
[1]
518,242
518,243
Check the content on change with java
<p>How to get the content of a site if it changes ?For example i have a select box, and when i change the result i want to get that changet result, without to rerun the application in java. I want that thing to be in core java.</p>
java
[1]
2,323,705
2,323,706
Android-Command to run dmtracedump
<p>how to run dmtracedump in android.what is the exact command to run it in linux.</p>
android
[4]
1,432,950
1,432,951
How to redistribute aspnet_regsql.exe?
<p>I am writing a setup program for my ASP.NET web site, and I need to incorporate the aspnet_regsql tool for registering/unregistering the membership/roles tables into my database.</p> <p>If I bundle this with my setup, what are all the dependent files I need to include to ensure it all works?</p> <p>Or is it better to not bundle this, but locate the .NET Framework folder at runtime and launch it from there?</p>
asp.net
[9]
2,015,916
2,015,917
If Statement Post Formats: No post format selected
<p>I'm working with post formats, most of my code looks similar to this:</p> <pre><code>if ( has_post_format( 'standard' )) { echo '&lt;?php get_sidebar(); ?&gt;'; } if ( has_post_format( 'aside' )) { echo 'this is an aside'; } if ( has_post_format( 'chat' )) { echo 'this is the video format'; } </code></pre> <p>But I also want one of the if statements to include how to call it if the user <strong>did not</strong> select a post format. Anybody know?</p>
php
[2]
5,994,898
5,994,899
What should be the Roadmap for JAVA EE
<p>I have done Java SE and want to start JAVA EE. But i am very confused, from where i have to start .So please tell me the roadmap from where to start Java EE ?</p>
java
[1]
5,185,769
5,185,770
Best way to make a remote database driven iphone application
<p>I have a school project that i think i can do with the concept of secure database driven application , can anybody help me how to do that because i am confused with method will be best and secure. Tutorial link will be good</p>
iphone
[8]
4,896,644
4,896,645
How to resize Image to specific size in android layout?
<p>I am trying to create a image button and I want to give the specific width and height to it, but my image size 512 x 512 and when activity starts layout is distorted because of the image.</p> <p>Is there anyway I can resize it to some specific size? </p> <pre><code> &lt;Button android:id="@+id/prev" android:text="" android:gravity="center" android:width="20dp" android:height="20dp" android:background="@drawable/go_prev" /&gt; </code></pre>
android
[4]
2,136,178
2,136,179
iscroll plugin usage in desktop browsers
<p>I wanted a scrollbar functionality for both ipad and desktop so i used iScroll-4. It works fine in ipad ,but in desktop when i drag the scrollbar down it goes up and it is noticed even in demo : <a href="http://cubiq.org/dropbox/iscroll4/examples/simple" rel="nofollow">http://cubiq.org/dropbox/iscroll4/examples/simple</a> . </p> <p>To create object i use</p> <pre><code>&lt;script type="text/javascript"&gt; var myScroll = new iScroll('wrapper'); &lt;/script&gt; </code></pre> <p>Any parameters which would work?</p>
jquery
[5]
380,518
380,519
preg_match white space
<p>I would like to ask you about regular expressions preg_match have outlined below. I wish to express their approval to add white space. For one and the other expression. I know that white space is represented by a /s But I can not deal with it. please help</p> <pre><code> 'string' =&gt; array( 'pattern' =&gt; '^([a-zA-Z ]+)$', ), 'numericString' =&gt; array( 'pattern' =&gt; '^[a-zA-Z0-9]+$', ) 'numeric' =&gt; array( 'pattern' =&gt; '^[0-9]+$', ), </code></pre> <p>Please help i need add white space to any.</p>
php
[2]
4,739,392
4,739,393
How to stop adding a number when it reaches its limit
<pre><code>&lt;?php session_start(); if(isset($_POST['sessionNum'])){ //Declare my counter for the first time $_SESSION['initial_count'] = $_POST['sessionNum']; $_SESSION['sessionNum'] = $_POST['sessionNum']; } if(!isset($_SESSION['sessionCount'])){ $_SESSION['sessionCount'] = 1; } else { $_SESSION['sessionCount']++; } $sessionMinus = $_SESSION['sessionCount']; ?&gt; </code></pre> <p>How do I get it so that if <code>$_SESSION['sessionCount']</code> is less than <code>$_SESSION['sessionNum'],</code> then add 1 to <code>$_SESSION['sessionCount']</code> and if it equals <code>$_SESSION['sessionNum']</code>, then stop adding 1 to <code>$_SESSION['sessionCount']</code>?</p> <p>Also if I go back on a previous page and I go back onto this page, I want <code>$sessionMinus</code> to go back to '1', and finally if the user refreshes the page, then whatever number <code>$sessionMinus</code> is, keep it on that number when page refreshes.</p>
php
[2]
5,178,149
5,178,150
What is causing the NullPointerException in this line?
<p>The debugger says factory is null. What should I do? The factory is set to a plain .png of a black square.</p> <p>package com.animation.learning;</p> <pre><code>import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.view.View; public class MyBringBack extends View { Bitmap gBall; public MyBringBack(Context context) { super(context); gBall = BitmapFactory.decodeResource(getResources(), R.drawable.square); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.drawColor(Color.WHITE); canvas.drawBitmap(gBall, (canvas.getWidth() / 2), 0, null); } } </code></pre>
android
[4]
1,207,399
1,207,400
jquery inserts in div
<p>i am having problem with jquery inserts i am using bbedit to inserts images links bold italic etc in my message box and jquery inserts the required html in the corresponding form but its not doing correctly. in below code </p> <p>in the below code .bbedit-toolbar and .bbedit-smileybar is getting inserted by jquery automatically but in my code its not getting inserted .here is the link for the complete bbcode example <a href="http://www.w3theme.com/jquery-bbedit/" rel="nofollow">http://www.w3theme.com/jquery-bbedit/</a></p> <p>any help will be highly appreciated.</p> <pre><code>$("#form_message").bind("change keyup", function() { $("#form_submit").removeAttr("disabled"); $("#form_submit").addClass("att_submit_active"); }); $("#form_message").keyup(function() { if ($("#attachment").val() == "status") { var max = parseInt($("#form_message").attr("maxlength")); if ($(this).val().length &gt; max) { $(this).val($(this).val().substr(0, $(this).attr("maxlength"))); } $("#charsRemaining").html("You have &lt;strong&gt;" + (max - $(this).val().length) + "&lt;/strong&gt; characters remaining"); } }) </code></pre>
jquery
[5]
2,187,996
2,187,997
output query results in html
<p>i query a database for retreiving all the columns. I will probably have many rows. Im trying to output the query results into an html table. This is what i have so far:</p> <pre><code> protected void Page_Load(Object sender, EventArgs E) { message.Text = "Welcome to your profile: " + CUser.LoginID; System.Data.SqlClient.SqlConnection con; con = new System.Data.SqlClient.SqlConnection(); con.ConnectionString = "Data Source=.\\SQLEXPRESS; AttachDbFilename=C:\\Users\\jjj\\Documents\\Visual Studio 2010\\Projects\\App_Data\\data.mdf; Integrated Security = true; Connect Timeout = 30; User Instance = True"; string id = CUser.LoginID; try { con.Open(); SqlCommand cmd = new SqlCommand("SELECT * FROM tbl WHERE loginID = 'hussein' ", con); SqlDataReader reader =cmd.ExecuteReader(); if (reader.HasRows) { //reader.Read(); while (reader.Read()) { } } } catch { } finally { con.Close(); } } </code></pre> <p>How could i store the many rows and output them using html as soon as i open a page? Im using C#</p>
asp.net
[9]
2,453,750
2,453,751
Doing something different with last sequence in a loop
<p>I am looking for the basic syntax of doing something different with the last itteration through a loop, using C#</p>
c#
[0]
5,653,924
5,653,925
visual c# problems with return in a method
<p>I found this code to search for a registry key, it works fine if i set it to void and have it pop up a window using messagebox.show , and i see the key it found. but, if i change it to return a string, the compiler fails with "not all code paths return a value" if i try to set a string in the method called "reg_result" and return it, i am returning the value to a string variable that calls the method. </p> <pre><code>string reg_result2 = Search_For_Registry_Keys(Registry.Users, search); private static string Search_For_Registry_Keys(RegistryKey rk, string search) { string reg_result = ""; if (rk.SubKeyCount &gt; 0) { foreach (var temp in rk.GetSubKeyNames()) { if (temp.ToLower().Contains(search.ToLower())) { reg_result = (String.Format(rk.Name + "\\" + temp)); MessageBox.Show(String.Format("Match Found In Registry Key {0} Present At Location {1}", temp, rk.Name + "\\" + temp)); return reg_result; } } foreach (var temp in rk.GetSubKeyNames()) { try { if (rk.OpenSubKey(temp).SubKeyCount &gt; 0) { Search_For_Registry_Keys(rk.OpenSubKey(temp), search); } } catch { } } } } </code></pre> <p>I then tried the following by putting a 2nd return after the if statement and that got rid of the compiling error about "not all code paths return a value", but that didn't seem to help as then the method would never return when i stepped through it until it reached the end of it's searching, so I'm little lost on how to fix this?? yes i am newbie. I would think i my first code would work and i only need one return for when i find the result i am looking for... :)</p>
c#
[0]
783,628
783,629
Child XIB open over Main XIB
<p>i want to open new xib(view) over the Main xib(view).</p> <p>i.e Main (Parent) xib when i click on button inside parent XIB. child xib open over parent xiB, and it should see parent xib.</p> <p>is this possible?</p>
iphone
[8]
3,043,725
3,043,726
View controller not being released by navigation controller for a long time?
<p>I'm doing some debugging and leak checking, so I've got some NSLog output in a few of my app's view controllers and such. Then I noticed one particular controller appears to be releasing quite a while after the others, even though the navigation controller is popping it off the view stack. Every other view is immediately unloaded and released. Perplexed.</p>
iphone
[8]
4,131,128
4,131,129
iPhone Event Kit : programmatically create a EKCalendar?
<p>I would like to insert events in my app, so they can be viewed in iPhone Calendar.app. But since I don't want to mix the user events with those from my app, I wanted to create a EKCalendar like "MyApp Events"</p> <p>Is this possible ? How would you filter your events otherwise ?</p> <p>Thanks !</p>
iphone
[8]
1,962,448
1,962,449
FOUND_ROWS() Fails in PHP
<p>I need to retrieve the total count of records after executing a query. I tried like this</p> <pre><code>&lt;?php include_once 'common.php'; ini_set("mysql.trace_mode", "Off"); $sql ="get_list(0, 40, 'Name', 'DESC', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)"; $con = mysqli_connect("localhost", "root", ""); mysqli_select_db( $con, "crash_table"); mysqli_query($con, $sql); $sql2= "SELECT FOUND_ROWS();"; $result = mysqli_query($con, $sql2); $count = mysqli_fetch_array($result); echo "Count=".$count[0]; ?&gt; </code></pre> <p>but the count is always 0. In the code get_list() is a procedure where 40 is the LIMIT.. Why is it so?</p>
php
[2]
1,865,529
1,865,530
get ordinal value for letter PHP
<p>I've been given a datafile where the original creator used alphabetical rather than numeric values to show order.</p> <p>For example, if there's ten items, they'd be named:</p> <pre><code>12342313A 12342313B 12342313C 12342313D 12342313E ... </code></pre> <p>I need to import these values into a mySQL table that has <code>order</code> as a required <code>int</code> column, and I need to convert the letter to a number. </p> <p>Is there a function in PHP to get a numeric value for a letter? Or will I need to do a <code>substr</code> to grab the trailing letter, and create an indexed array of letters and just do a lookup against that array?</p> <p>I'm hesitant to do the simple way above, since I don't know how many objects could potentially exist, and I could need to write an array from A-AAAA or something.</p>
php
[2]
4,716,145
4,716,146
Java Question about Copy Constructor
<p>I hope you will help me understand this <code>Copy Constructor</code> I took more then 2 hours reading reading on websites and I didn't understand anything about it.</p> <p>I know that a copy constructor is used to copy an object of a class. But I don't understand the code of the copy consturctor.</p> <p>For Example:</p> <pre><code>public class Rectangle { private double length = 10.0; private double width = 10.0; public Rectangle(double length, double width){ this.length = length; this.width = width; } //this is the copy constructor what exactly the argument here? is it the object ref it self? please explain what happening here. and the use public Rectangle(Rectangle ref){ this.length = ref.length; this.width = ref.width; } </code></pre> <p>this is what I see all the time. but I don't understand the code at all! <code>ref</code> is it going to be created in the main program?</p> <p>let say this is the main program</p> <pre><code>public class rectangleTest{ public static void main(String[] args){ //is this new_ref object going to be created here? Rectangle new_ref = new Rectangle(10.0 , 10.0); </code></pre> <p>This thing will not 100% clear to me unless if someone make a small class and main class showing me what's happening </p> <p>Thank you.</p>
java
[1]
1,537,944
1,537,945
How are strings physically stored in Javascript
<p>What I am looking for is how strings are physically treated in Javascript. Best example I can think of for what I mean is that in the Java api it describes the storage of strings as: </p> <p><code>String str = "abc";" is equivalent to: "char data[] = {'a', 'b', 'c'};</code></p> <p>To me this says it uses an array object and stores each character as its own object to be used/accessed later (I am usually wrong on these things!)...</p> <p>How does Javascript do this?</p>
javascript
[3]
286,261
286,262
Restrict cut, copy and paste in clip board manager
<p>I want to add some security to clipboard manager. I have developed an application. Inside my application i am giving the option to copy and paste but i don't want the data copied inside my application to be available outside my application, but it is available in the history of clipboard. How do i solve this?</p> <p>I have tried to solve it by setting the copy to null onpause of my application that would eliminate the paste option but the contents are still available in the history of clipboard manager.</p> <p>How do i delete the contents in clipboard?</p> <p>(or)</p> <p>How can i encrypt my data before sending it to clipboard?</p>
android
[4]
3,227,701
3,227,702
Java compare two map
<p>In java, I want to compare two maps, like below, do we have existing API to do this ?</p> <p>Thanks</p> <pre><code>Map&lt;String, String&gt; beforeMap ; beforeMap.put("a", "1"); beforeMap.put("b", "2"); beforeMap.put("c", "3"); Map&lt;String, String&gt; afterMap ; afterMap.put("a", "1"); afterMap.put("c", "333"); //--- it should give me: b is missing, c value changed from '3' to '333' </code></pre>
java
[1]
1,727,475
1,727,476
Is it possible to change the anchornode of a textnode object?
<p>Here's my code: </p> <pre><code>function moremagic() {     var txt = '';      if (window.getSelection)     {         txt = window.getSelection();              }     else if (document.getSelection)     {         txt = document.getSelection();             }     else if (document.selection)     {         txt = document.selection.createRange().text;             }     else return; if(txt=="" || txt==" "){ alert("No Text Selected"); return;} var start = txt.anchorOffset; var countstring = txt.toString(); alert(txt.anchorNode); var end = txt.anchorOffset+countstring.length; var type = prompt("Annotation Type: "); if(type=="lp-token"){ var description = prompt("Lisp Statement: ");} else if(type=="section-head-annotation"){ var description = "Section Head";} else if(type=="list-item-annotation"){ var description = "list-element";} else if(type=="sentence-annotation"){} else {var description = prompt("Description: ");} Arraystring = Arraystring+"#"+type+"#"+description+"#"+start+"#"+end; alert(Arraystring); var custom = document.getElementById("custom"); custom.value=Arraystring; } </code></pre> <p>It generates a textnode object from text highlighted by the cursor but this function is called many different times and for each different highlight the anchorNode changes. I need the anchorNode to be a constant for all of the created textnode objects. Is there any way that the anchorNode of a textobject can be changed? Thank you!</p>
javascript
[3]