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,668,330 | 2,668,331 |
Sum of a string of one-digit numbers in javascript?
|
<p>I'm trying to write a script that adds the left side of a string and validates it against the right side.</p>
<p>For example:</p>
<pre><code>var left = "12345"
var right = "34567"
</code></pre>
<p>I need to do some sort of sum function that adds 1+2+3+4+5 and checks if it equals 3+4+5+6+7.</p>
<p>I just don't have a clue how to do it.</p>
<p>I think I need to use a for loop to iterate through the numbers such as
for (var i = 0, length = left.length; i < length; i++)</p>
<p>But I'm not sure how to add each number from there.</p>
<p><em><strong>EDIT</em></strong> the var is actually being pulled in from a field. so var left = document.blah.blah</p>
|
javascript
|
[3]
|
777,995 | 777,996 |
Using older book to learn Java
|
<p>Learning Java from the ground floor. I have gotten a book called Java a Beginner's Guide (3rd ed.) by Herbert Schildt. The book is based on J2RE5. Do you anticipate any major problems by using an older book with JRE7? THank you.</p>
|
java
|
[1]
|
4,177,334 | 4,177,335 |
ASP.NET Error: Could not load file or assembly App_Web_z9w33txs
|
<p>How did you get rid of these annoying ASP.NET errors:
Could not load file or assembly 'App_Web_z9w33txs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'</p>
<p>This has only happened to me once before. It seems like it is related to ASP.NET caching some assembly dynamically, but not recompiling it for some reason. Thoughts? How do you fix this? What causes it?</p>
<p><strong>More Info:</strong>
This is happening to a WCF Service being called via Ajax from my Default.aspx page.
The Default.aspx page loads fine.</p>
<p><strong>removed stack trace</strong></p>
<p><strong>Final Update:</strong><br />
So this is happening to me at least 5 times a day now.
I have to shutdown the app pool.<br />
Go into C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
and deleted the files here
Then restart the app pool.
Anybody else run into something like this? Should I just break down and create a support case with Microsoft.</p>
|
asp.net
|
[9]
|
3,676,119 | 3,676,120 |
Android: Center an image horizontally based on another image (not on parent)
|
<p>Is there a way to center an image horizontally based on another image? Could be from xml or coded.</p>
<p>For example one button on top and another button below (i.e. android:layout_below="@+id/button1"), but centered horizontally based on the first one.</p>
|
android
|
[4]
|
2,032,490 | 2,032,491 |
return false is not working in my submit click
|
<p>this is the code i am using for my Html.BeginForm..</p>
<pre><code> $('#PbtnSubmit').click(function() {
$('#PricingEditExceptions input[name=PMchk]').each(function() {
if ($("#PricingEditExceptions input:checkbox:checked").length > 0) {
var checked = $('#PricingEditExceptions input[type=checkbox]:checked');
var PMstrIDs = checked.map(function() {
return $(this).val();
}).get().join(',');
$('#1_exceptiontypes').attr('value', exceptiontypes)
$('#1_PMstrIDs').attr('value', PMstrIDs);
} else {
alert("Please select atleast one exception");
return false;
}
});
});
</code></pre>
<p>in else blcok my return false is not working after alert mesage also its going to my controler?</p>
<p>thanks is this right?</p>
<p>i tried like this </p>
<pre><code> $('#PbtnSubmit').click(function() {
$('#PricingEditExceptions input[name=PMchk]').each(function() {
if ($("#PricingEditExceptions input:checkbox:checked").length > 0) {
var checked = $('#PricingEditExceptions input[type=checkbox]:checked');
var PMstrIDs = checked.map(function() {
return $(this).val();
}).get().join(',');
$('#1_exceptiontypes').attr('value', exceptiontypes)
$('#1_PMstrIDs').attr('value', PMstrIDs);
} else {
alert("Please select atleast one exception");
}
});
return false;
});
</code></pre>
<p>if i do like this on submit its doing nothing.. </p>
<p>thanks</p>
|
jquery
|
[5]
|
4,286,119 | 4,286,120 |
Elegant PHP solution to replace a specific substring
|
<p>There is the string</p>
<p>"a cat is a cat, but a dog is not a cat"</p>
<p>I wish to replace only the second "cat" substring with another word, preferably using native php functions. The solution must be general, for example to be able to replace the first 'cat' string or the third.</p>
<p>Oh well, maybe somebody will find this and realise the complexity of the problem and reopen it again.</p>
|
php
|
[2]
|
605,856 | 605,857 |
Java Full Screen Program (Swing) -Tab/ALT F4
|
<p>I need a way to stop people using other programs while my Java program is running. I.E Stopping people switch tabs and pressing alt f4...</p>
<p>Thanks :)</p>
|
java
|
[1]
|
2,334,833 | 2,334,834 |
How to get title of preferencescreen in android
|
<p>I am trying to gate the title of preferencesreen in my program ..anybody tell me how can i get title?
my code of preference xml is here. i want to get the title "Show List" in my program.</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="Settings">
<PreferenceScreen android:title="Show List" android:key ="show_list" android.id="@+id/preference_screen">
<intent android:action="android.intent.action.VIEW"
android:targetPackage="com.picknext"
android:targetClass="com.picknext.PickName" />
</PreferenceScreen>
<ListPreference android:title="Remove after pick"
android:key="selection_of_Y_N_Name_Pick" android:entries="@array/selection_of_y_n_namepick"
android:entryValues="@array/value_of_y_n_naempick" android:defaultValue="Yes" />
</PreferenceCategory>
</PreferenceScreen>
</code></pre>
|
android
|
[4]
|
2,517,837 | 2,517,838 |
Java readFile from byte x to byte y
|
<p>Im trying to read a text file, x bytes at a time into a variable, process each "chunk" and write it to another file.</p>
<p>So far all I can do sucessfully is:</p>
<pre><code>// read each line at a time:
while ( ( str = in.readLine() ) != null){ ....
</code></pre>
<p>Is it possible to specify something like... str = in.readBytes( 320 up to 400 ) ... ???</p>
<p>Any thoughts or comments welcome.</p>
|
java
|
[1]
|
1,400,711 | 1,400,712 |
Module pattern | Private access to passed in reference
|
<p>Suppose I have someFunction() that has a public prototype function giveMeAccess() available to the user. </p>
<p>Now suppose I want this prototype method to have access to Private variables inside the function that returned it..</p>
<p>Is there any way to do this?</p>
<p>Yes this has an application as strange as it might seem. I need this info. to model a class hierarchy.</p>
<pre><code>var privateMaker = function ( give_me_access ) {
var Private = {},
someFunction = function(){};
someFunction.prototype = {
public_access: give_me_access
};
return someFunction;
}
</code></pre>
<p><strong>Use</strong></p>
<pre><code>var Func1 = new privateMaker();
var private_loot = Func1.public_access();
</code></pre>
<p><strong>Question</strong></p>
<p>How do I give giveMeAccess() access to Private inside of privateMaker()? </p>
<p>Note the prototype function is passed in to the outer function instead of defined in the function as usual. This is the weird caveat.</p>
<p>If this is impossible with this model...then state that as an answer.</p>
|
javascript
|
[3]
|
1,045,281 | 1,045,282 |
Missing out a number on a for loop? (Java)
|
<p>Right, before I start: this is a hw question. </p>
<p>We have to print out: -20, -15, -10, -5, 5, 10, 15, 20</p>
<pre><code>for(i = -20; i<25; i += 5)
{
System.out.println(i);
}
</code></pre>
<p>I've gotten it to output all the numbers, however, we're not allowed to output 0. </p>
<p>This question has me stumped . Any help please?</p>
|
java
|
[1]
|
3,552,413 | 3,552,414 |
Refactoring nested foreach statement
|
<p>I have a method with a nested foreach collection (iterate a set of objects and then look inside each object). I saw in a book a good pattern to make this much more elegant but cannot remember/find the code example. How else could I make this more tidy?</p>
<p>The code is just a typical nested foreach statement so I have not provided a code sample.</p>
<p>Thanks</p>
|
c#
|
[0]
|
5,594,785 | 5,594,786 |
How to use appendTo code when want to Copy same code to multiple divs?
|
<p>I have a code and when I am cloning that code then fewer values are found to be reset on its own.It worked with appendTo() function but I want to use appendTo for multiple divs<br>
For example: </p>
<pre><code><div id="allocationId"><select><option value="">Select</option><option value="A" selected>A</option></div>
<div id="modalDiv"></div>
<div id="tmpDiv"></div>
</code></pre>
<p>I want to append code defined inside allocationId to modalDiv and tmpDiv<br>
Code that doesn't work: </p>
<pre><code>$('#allocationId').find('select').clone().appendTo('#tmpDiv')
//Another Code that don't works
$('#allocationId').find('select').appendTo('#tmpDiv #modalDiv')
//Code that works but its just for only one div
$('#allocationId').find('select').appendTo('#tmpDiv ')
</code></pre>
<p>Please provide helpful suggestions..</p>
|
jquery
|
[5]
|
4,388,704 | 4,388,705 |
Return files only from specific folder
|
<p>I wrote a function in Python, that must return file from specific folder and all subfolders. File name taken from function parameter:</p>
<pre><code>def ReturnFile(fileName)
return open("C:\\folder\\" + fileName,"r")
</code></pre>
<p>But as <code>fileName</code> you can pass for example: <code>"..\\Windows\\passwords.txt</code>" or some unicode symbols for dots.</p>
<p>How to fix it? Some RegExp maybe?</p>
|
python
|
[7]
|
1,125,706 | 1,125,707 |
performance counter in c# - calculate average of sample
|
<p>hi
i am grabbing frames from ip camera and want to export via perf counters the time diff between frames. and present it as # timediff / sec.</p>
<p>i have created 2 counters one as </p>
<p>PerformanceCounterType.AverageCount64 </p>
<p>and the seconds as </p>
<p>PerformanceCounterType.AverageBase</p>
<p>i am adding them ine after the other (the base come second)</p>
<p>for every frame i am calculating the diff and increase both counters e.g </p>
<pre><code>pc.increaseby(40)
pcbase.increaseby(1)
</code></pre>
<p>on second process i want to display the counter so when i am calculating</p>
<pre><code>Single numerator = (Single)s1.RawValue - (Single)s0.RawValue;
Single denomenator = (Single)s1.BaseValue - (Single)s0.BaseValue;
Single counterValue = numerator / denomenator;
</code></pre>
<p>the basevalue is always 0 -> any ideas?</p>
|
c#
|
[0]
|
4,814,055 | 4,814,056 |
How can I share data (which is updated every minute) accoss modules in Python?
|
<p>I have read in many posts that global variables are bad, but I need them!</p>
<p>My situation:</p>
<p>I have few variables defined in a dedicated module which are updated every minute and are used by other modules in the application. (Implemented after reading <a href="http://effbot.org/pyfaq/how-do-i-share-global-variables-across-modules.htm" rel="nofollow">this</a>), Do you think its a good approach or needs any improvement or any better idea?</p>
<p>Thanks</p>
|
python
|
[7]
|
5,177,549 | 5,177,550 |
Regular expression to allow the format as YYMMDD
|
<p>I have a textbox called period which should allow the user only to enter the string as YYMMDD format. YY can be numbers from 0-99, MM from 1-12 and DD from 01-04.</p>
<p>I want to use regular expression to get this done. Please help me with the expression to achieve this.</p>
|
asp.net
|
[9]
|
64,050 | 64,051 |
How can I use a timer to delay a specific task not associated with the timer class (java.util.timer)?
|
<p>I am making a text-based RPG for a personal project in Java. In the game the protagonist will have at his/her disposal the ability to use a spell or ability. I would like to add a cool down to the aforementioned spell or ability. I have researched both the javax.swing.Timer and java.util.Timer classes but have not found a way to go about using this cool down. I am not using threads or daemons (primarily because I don't think I need to and I have zero experience with them). </p>
<p>Any help or ideas on how to go about this would be appreciated, thanks.</p>
<ul>
<li>Alumnus</li>
</ul>
|
java
|
[1]
|
5,428,076 | 5,428,077 |
How to upload the binary to app store?
|
<p>Please answer my query,my application is a server based application and only when connected to the server it can navigate to other screens,else the user will be restricted to only one screen.If i upload this binary,how could apple test it without a server.Do i give them the server also or do apple follow someother method of reviewing.</p>
<p>Please help me out.</p>
|
iphone
|
[8]
|
1,264,391 | 1,264,392 |
Alternative for PHP linter
|
<p>Basically, php -l does not detect any syntax error, given this code:</p>
<pre><code><?php
date®;
?>
</code></pre>
<p>Obviously, it's an error when you execute it.</p>
<p>Is there any alternative or additional linter to use for PHP?</p>
<p>EDIT:</p>
<p>Thanks alot guys. Apparently it <em>is</em> a valid constant name, as the documentation suggests ([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*).</p>
|
php
|
[2]
|
4,457,311 | 4,457,312 |
How can I find the parent tr of a td using jQuery?
|
<p>I have the following:</p>
<pre><code> tdToPad = tds.filter('[id^="input_Title_"]')
pad = 60;
tdToPad.css('margin-left', pad);
</code></pre>
<p>What I would like to do is to remove any class that starts with "X-" and give the row that is contained by "tdToPad" a class of "X-" + pad. </p>
<p>Something like:</p>
<pre><code><tr class='X-60'>
<td>
</td>
</tr>
</code></pre>
<p>Being that toToPad refers to the td element in a row. How can I give the parent tr the class "X-" + pad ? I think I need something like the following but if that's the correct way to do it then how can I remove elements already there with a class of "X-" somevalue and then give this element the correct class?</p>
<pre><code>tdToPad.Parent('tr')
</code></pre>
|
jquery
|
[5]
|
5,014,371 | 5,014,372 |
Why is Class.getAnnotation() requiring me to do a cast?
|
<p>I'm using Java 1.6.0_25.</p>
<p>I have an annotation defined:</p>
<pre><code>@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Resource {
String value();
}
</code></pre>
<p>And later when I use getAnnotation:</p>
<pre><code>Resource resource = (Resource)cls.getAnnotation(Resource.class);
</code></pre>
<p>the compiler and IDE agree that I must cast the result, but getAnnotation is declared in the Java 1.5 documentation as:</p>
<pre><code>public <A extends Annotation> A getAnnotation(Class<A> annotationClass);
</code></pre>
<p>Since Resource.class is of type Class, it seems to me that this means that cls.getAnnotation(Resource.class) should return type Resource, and I should need to cast.</p>
<p>All examples I've found using getAnnotation don't have a cast, so I must be doing something wrong.</p>
|
java
|
[1]
|
2,808,980 | 2,808,981 |
Injecting a response value into a textarea to subsequently post
|
<p>I have multiple notes with class=.note and unique id each inside a div.</p>
<p>On click of edit I grab the id, show hidden form #noteditor and hide all notes. </p>
<p>I am using the load function to get the response (using codeigniter so url does work) and input result in the editorfrorm Textarea id = upnote... </p>
<p>Firebug response looks ok and I have tried to inject into a div and this works fine, BUT getting this injto the text area is causing me some headaches.</p>
<p>There is also the chance that i am going around this a convoluted way due to my limited knowledge...</p>
<p>Any help or pointers v much appreciated...</p>
<pre><code>$(document).ready(function() {
$('.edit').click(function(e){
var v=$(this).attr("id");
$(".note").slideUp();
$("#noteditor").slideDown('1000');
$("#upnote" ).load('/notes/my_note/'+v);
e.preventDefault();
});
</code></pre>
|
jquery
|
[5]
|
981,534 | 981,535 |
Mapping string based on first letter
|
<p>I have a list of items that I want to obfuscate based on the letter of the item's name. For example:</p>
<pre><code>ABC_Classified
BXY_Classified
ZX_Classified
</code></pre>
<p>Key:</p>
<pre><code>A -> Adam
B -> Bale
Z -> Talking
</code></pre>
<p>Result:</p>
<pre><code>ABC_Classified ==> Adam
BXY_Classified ==> Bale
ZX_Classified ==> Talking
</code></pre>
<p>The first way to do this, which would be extremely repetitious, would be having 26 <code>if/elif</code> statements for this.</p>
<p>What would be the best and most concise way to accomplish the above?</p>
|
python
|
[7]
|
4,939,871 | 4,939,872 |
Passing Options to a Linked JavaScript File
|
<p>I noticed this method for setting options for Firebug Lite:
<a href="http://getfirebug.com/firebuglite#ScriptJSONOptions" rel="nofollow">http://getfirebug.com/firebuglite#ScriptJSONOptions</a></p>
<pre><code><script type="text/javascript" src="https://getfirebug.com/firebug-lite.js">
{
overrideConsole: false,
startInNewWindow: true,
startOpened: true,
enableTrace: true
}
</script>
</code></pre>
<p>Is there a reference anywhere for how this is supposed to work? Which browsers support it and how doe one access the options from the linked script?</p>
<p>I usually work around it by creating another tag above it with options, but this looks cleaner.</p>
|
javascript
|
[3]
|
2,106,849 | 2,106,850 |
What are the differences between java 1.5 and java 1.6
|
<blockquote>
<p><strong>Possible Duplicates:</strong><br>
<a href="http://stackoverflow.com/questions/5464725/whats-new-in-java-1-6-from-1-5">What's new in Java 1.6 from 1.5?</a><br>
<a href="http://stackoverflow.com/questions/1763136/complete-list-of-api-changes-between-1-5-and-1-6-java">Complete list of API changes between 1.5 and 1.6 Java</a> </p>
</blockquote>
<p>What are the differences between java 1.5 and java 1.6? Or what are the new features introduced in java 1.6? I tried browsing for the same but could not find a satisfying answer.</p>
|
java
|
[1]
|
2,018,386 | 2,018,387 |
IPHONE - Use multiple views
|
<p>I have to make an application with six views, which can be accessed to by bar button items on a toolbar. </p>
<p>I'm really new at this.
I have a view controller and a XIB file for each view, with six functions (goToView1, goToView2, ..., goToView6).</p>
<p>Here is an example :</p>
<pre><code>SecondViewController *secondview;
-(IBAction)goToView2 {
secondview = [[SecondViewController alloc]
initWithNibName:@"SecondViewController" bundle:nil];
[self.view addSubview:secondview.view];
}
</code></pre>
<p>But as you can see, if I want to go from view3 to view2, I'm not deleting the view3 from the stack : I'm just adding the view2 over it.
So here's my problem, how do I "delete" my view before using addSubView ?
I tried with removeFromSuperView, but I think I'm not using it right.</p>
<p>Thanks for helping, as I said I'm really new and I am aware it can be a stupid question :/</p>
|
iphone
|
[8]
|
162,573 | 162,574 |
Remove null elements from list
|
<pre><code>List<String> list = new ArrayList<String>();
list.add("One");
list.add(null);
list.add("Two!");
list.add(null);
list.add("Three");
list.add(null);
list.add("Four");
list.add(null);
</code></pre>
<p>I have a list containing <strong>null</strong> elements. Is there any way to remove the <strong>null</strong> elements from the current collection without using any iterations?</p>
|
java
|
[1]
|
4,715,112 | 4,715,113 |
jquery: add html after a group of divs
|
<p>I have something like this:
...</p>
<pre><code><div id="d120" >content</div>
<div id="d123" >content</div>
<div id="d112" >content</div>
<div id="d145" >content</div>
<div id="d134" >content</div>
//Insert here hello world
<div id="bla" >asd</div>
<div id="footer" >asd</div>
</code></pre>
<p>anybody knows how to insert html after all the divs that have id like d+number</p>
|
jquery
|
[5]
|
5,385,550 | 5,385,551 |
How android application detects two SD CARDS in a device
|
<p>If android device has two SD CARDS then how the application detects both SD CARDS in android.For example the device has "left user sdcard" & "right user sdcard". Then How android supports programmatically
Thanks , Shiv</p>
|
android
|
[4]
|
2,539,862 | 2,539,863 |
Is there a PHP class that helps to embed IPTC data into JPEG?
|
<p>Is there a PHP class that helps to embed IPTC data into JPEG?</p>
|
php
|
[2]
|
1,755,833 | 1,755,834 |
What is the best way to know if all the variables in a Class are null?
|
<p>This would mean that the class was initialized, but the variables were not set.</p>
<p>A sample Class:</p>
<pre><code>public class User {
String id = null;
String name = null;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
</code></pre>
<p>The actual class is huge that I prefer not to check if(xyz == null) for each of the variables.</p>
|
java
|
[1]
|
1,093,274 | 1,093,275 |
Link to external php file (for proprietary reasons)
|
<p>So we've got a pretty nifty little PHP app. People have been interested in "leasing" it under a different name.</p>
<p>However, with the current setup - any "top tier admin" (which they would have to be) can view the PHP files.</p>
<p>My boss is a tad concerned with that. Would it be possible (or rather, SMART) to link to external PHP files on our server instead?</p>
<p>So instead of</p>
<p><strong>index.php contents:</strong></p>
<pre><code><?php include('/lib/header.php'); ?>
</code></pre>
<p>and consequently </p>
<p><strong>header.php contents:</strong></p>
<pre><code><?php /*Stuff I don't want you seeing*/ ?>
</code></pre>
<p>would it be possible (and if so, smart) to do something like this</p>
<p><strong>index.php contents:</strong></p>
<pre><code><?php include('http://site-i-control.com/lib/header.php'); ?>
</code></pre>
<p>so they couldn't see or modify the contents of header.php?</p>
|
php
|
[2]
|
297,226 | 297,227 |
Login window waiting for 10 secs if expiration days below 10 days
|
<p>i have longin window.In that window ok and cancel buttion there.if expiration days is below 10 days then window is wait for 10 sec and ok button disable.After 10 sec ok buttion enable.i am using C#.somebody could help on this issue.how we can implement.</p>
|
c#
|
[0]
|
4,688,160 | 4,688,161 |
new SimpleDateFormat always returns same reference for a given dateFormat
|
<p><br/>
I was trying to replicate a bug by using the same instance of SimpleDateFormat across multiple threads. However I got stuck with another problem and did not find any answers to it. </p>
<p>This simple code block replicates the issues I am seeing.</p>
<pre><code>DateFormat d1 = new SimpleDateFormat("ddMMyyyy");
DateFormat d2 = new SimpleDateFormat("ddMMyyyy");
DateFormat d3 = new SimpleDateFormat("ddMMyy");
System.out.println("d1 = " + d1);
System.out.println("d2 = " + d2);
System.out.println("d3 = " + d3);
</code></pre>
<p>The results of this operations under java 7 (1.7_0_21) is as follows </p>
<pre><code>d1 = java.text.SimpleDateFormat@c5bfbc60
d2 = java.text.SimpleDateFormat@c5bfbc60
d3 = java.text.SimpleDateFormat@b049fd40
</code></pre>
<p>As you can see that although I am creating new objects for d1 and d2 they end up being the same reference. d3 ends up being a new instance as pattern is different.<br/></p>
<p>Does java compile/runtime do this optimization? Any pointers will be helpful</p>
|
java
|
[1]
|
184,060 | 184,061 |
Self executing function as object property value in javascript
|
<p>Is it possible to have a self executing function which is an objects property value assign values to other properties in the object?</p>
<p>e.g. - what I would like to do is this:</p>
<pre><code>var b={
c:'hi',
d:null,
e:new function(){this.d=5}
};
</code></pre>
<p>But the "this" inside the new function seems to refer to b.e. Is it possible to access the b.e parent (i.e. b) from inside the function?</p>
|
javascript
|
[3]
|
1,699,556 | 1,699,557 |
How can I build a custom calender control for android application?
|
<p>I have an application in which I need to use a calender control. How do I get such a control for android?</p>
<p>I have heard of Ancal , but I don't know how to use it in my application.</p>
<p>Thank you in advance.</p>
|
android
|
[4]
|
1,904,986 | 1,904,987 |
Hasclass usage in each()
|
<p>Here is my script i want to add class if the div with class <code>.field-collection-container</code>, but i want to apply this to div which class don't include <code>.field-name-field-basic-info</code>, pls read the html, </p>
<pre><code>$('.field-collection-container').each(function (index, obj) {
if (($(this).hasClass('field-name-field-basic-info')) == false) {
$(this).find('.field-items .content .field-item').each(function (index, obj) {
//alert($(this).text());
if ($(this).text() == '1') {
$(this).addClass("tick1");
} else {
$(this).addClass("tick0");
}
});
}
});
</code></pre>
<p>the html:</p>
<pre><code><div class="field-collection-container field-name-field-basic-info">not apply</div>
<div class="field-collection-container">apply</div>
</code></pre>
<p>i use hasClass try to do this but not successful.</p>
|
jquery
|
[5]
|
3,494,807 | 3,494,808 |
change cursor icon at mouse
|
<p>how can change icon mouse same windows seven mouse icon at busy mode?</p>
<p>how can set animated cursors (.ANI). to cursor?</p>
|
c#
|
[0]
|
2,347,308 | 2,347,309 |
Why new String(bytes, enc).getBytes(enc) does not return the original byte array?
|
<p>I made the following "simulation":</p>
<pre><code>byte[] b = new byte[256];
for (int i = 0; i < 256; i ++) {
b[i] = (byte) (i - 128);
}
byte[] transformed = new String(b, "cp1251").getBytes("cp1251");
for (int i = 0; i < b.length; i ++) {
if (b[i] != transformed[i]) {
System.out.println("Wrong : " + i);
}
}
</code></pre>
<p>For <code>cp1251</code> this outputs only one wrong byte - at position 25.<br>
For <code>KOI8-R</code> - all fine.<br>
For <code>cp1252</code> - 4 or 5 differences.</p>
<p>What is the reason for this and how can this be overcome?</p>
<p>I know it is <em>wrong</em> to represent byte arrays as strings in whatever encoding, but it is a requirement of the protocol of a payment provider, so I don't have a choice.</p>
<p><strong>Update:</strong> representing it in <code>ISO-8859-1</code> works, and I'll use it for the <code>byte[]</code> part, and <code>cp1251</code> for the textual part, so the question remains only out of curiousity</p>
|
java
|
[1]
|
3,083,918 | 3,083,919 |
Float value manipulation in android
|
<p>I want to separate float value from decimal point.</p>
<pre><code>for ex:
Float f = 3.5
</code></pre>
<p>than i want</p>
<pre><code>int value1 = 3
int value2 = 5
and if f = 4.0 than,
int value1 = 4
int value2 = 0
</code></pre>
<p>But please i could not do this with string manipulations. like Split</p>
<p>Thanks</p>
|
android
|
[4]
|
4,060,676 | 4,060,677 |
How to avoid image stretching in imageview
|
<p>I have a image with 320x480 and i am running the application in device with 320x480. I set Image as <code>android:background</code> then my image is stretched. but if i use <code>android:src</code> then i am getting white space behind the image as if the image didnot cover the screen. How to set image in image view so that my image will neither be stretched and it will cover the whole screen.</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
>
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/about1"/>
</LinearLayout>
</code></pre>
|
android
|
[4]
|
4,829,079 | 4,829,080 |
for in loop and the delete operator
|
<p>I noticed that when enumerating the properties of an object, that it seems like a snapshot of the current properties is taken at start of the loop, and then the snapshot is iterated. I feel this way because the following doesn't create an endless loop:</p>
<pre><code>var obj = {a:0,b:0}, i=0;
for (var k in obj) {
obj[i++] = 0;
}
alert(i) // 2
</code></pre>
<p>demo <a href="http://jsfiddle.net/kqzLG/">http://jsfiddle.net/kqzLG/</a></p>
<p>The above code demonstrates that I'm adding new properties, but the new properties won't get enumerated. </p>
<p>However, the delete operator seems to defy my snapshot theory. Here's the same code, but deleting a property before it gets enumerated.</p>
<pre><code>var obj = {a:0,b:0}, i=0;
for (var k in obj) {
i++;
delete obj.b;
}
alert(i) // 1
</code></pre>
<p>demo <a href="http://jsfiddle.net/Gs2vh/">http://jsfiddle.net/Gs2vh/</a></p>
<p>The above code demonstrates that the loop body only executed one time. It would have executed twice if the snapshot theory were true.</p>
<p>What's going on here? Does javascript have some type of hidden iterator that it uses, and the delete operator is somehow aware of it?</p>
<p>-- I realize that I'm assuming something about iteration order- specifically that iteration occurs based off of property insertion time. I believe all browsers use such an implementation.</p>
|
javascript
|
[3]
|
1,084,647 | 1,084,648 |
Preload Problem
|
<p>How can I make preload images in the slider?.</p>
<p>My Codes;</p>
<pre><code>var uploader = $('#flashUploader').pluploadQueue();
uploader.bind('FileUploaded', function(up, file, response) {
var obj = jQuery.parseJSON(response.response);
$('#slides div div').append("<img src='http://www.smyrnart.com/upl/1282314.jpg'>")
**After Upload I Want to Preload here.**
});
</code></pre>
<p>I am use <a href="https://github.com/nathansearles/Slides/blob/master/source/slides.js" rel="nofollow">https://github.com/nathansearles/Slides/blob/master/source/slides.js</a>.</p>
<p>Thank for answers.</p>
|
jquery
|
[5]
|
5,464,103 | 5,464,104 |
javascript detect user is viewing the page
|
<p>Currently my website keep auto reload a javascript function for every 10 seconds by <code>setInterval( "checklatestmsgidLive();", 10000 );</code> I think the function will still keep reloading the function even when the user is viewing other website on other tab. How to make it reload the function only when the user is viewing my website? Can javascript detect if the user is viewing my website?</p>
<p>I saw facebook.com wall also update new posts only when I am viewing the page, when I am on other tab, it won't update the new posts. How to do that?</p>
|
javascript
|
[3]
|
5,197,731 | 5,197,732 |
How to get client Screen Resolution Width/Height at Server Side
|
<p>I can get client screen resolution using client side script 'javascript' but i dnt want to do that I also tried Request.Browser.ScreenPixelsWidth but it always return fixed width 680.</p>
<p>Any Idea,</p>
<p>Thanx</p>
|
asp.net
|
[9]
|
4,018,830 | 4,018,831 |
I want to move one backgroung image sequencly in Cocos2d?
|
<p>I Have 1 image and i want to move that image in game background.And also note that i have to move only 1 image sequencly by cocos2d. </p>
|
iphone
|
[8]
|
4,452,909 | 4,452,910 |
How would I implement a tournament like this? C++
|
<p>I have an array of 16 (example below). Each match of the tournament involves displaying two restaurants, prompts to choose his favorite one, and removing the losing restaurant from the tournament.
It is like a bracket system; i.e., a restaurant does not reappear in another match until all other restaurants have also appeared in a match for that round). So start with 8 matches, then 4, then 2.
Do not allow the tournament to begin unless the number of restaurants is equal to 16.
I am pretty new to C++. Anyone have a decent outline or suggestions/paths I should look at?</p>
<pre><code>string restaurants[] = {"Texas Roadhouse,","On The Border,","Olive Garden,","Panda Express,","Cracker Barrel,","IHOP,","Panda Express,","Pei Wei"};
</code></pre>
|
c++
|
[6]
|
3,294,326 | 3,294,327 |
Write program to download .gz file in java?
|
<p>I've been trying to write a program in java that can download a number of .gz files from an ftp server online for me. Here's what I've been using:</p>
<pre><code>public static void main(String[] args) throws IOException {
URL url = new URL("ftp://ftp.ncbi.nih.gov/pub/geo/DATA/SOFT/by_series/GSE10/");
URLConnection con = url.openConnection();
BufferedInputStream in = new BufferedInputStream(con.getInputStream());
FileOutputStream out = new FileOutputStream("GSE10_family.soft.gz");
int i = 0;
byte[] bytesIn = new byte[3000000];
while ((i = in.read(bytesIn)) >= 0) {
out.write(bytesIn, 0, i);
}
out.close();
in.close();
}
</code></pre>
<p>The program runs and downloads the file just fine. However, when I try to uncompress the .gz file, it unzips as a .cpgz file which then creates an endless cycle of .cpgz to .gz and so forth.</p>
<p>When I download this file manually, it unzips and everything perfectly fine, so I know it isn't a problem with the file.</p>
<p>Any suggestions would be greatly appreciated! Thank you so much!</p>
|
java
|
[1]
|
404,684 | 404,685 |
Jquery using :after selector
|
<p>I am currently making a menu and because the menu is an oddshape with a glow around the edge I need to put a blank block over the top to hide the unwanted glow on the overlap. I am creating this using the :after selector on the li tags for the menu and the code to do so works fine. </p>
<p>My problem however is that I can only make it apply to none or all of the menu items at once by toggling the display attribute, what I want however is for the :after selector to only be applied to the current list item. </p>
<p>Each list item has a unique id but I can't seem to work out how to use the :after selector on a specific list item within jquery.</p>
<p>Thanks in advance for any help. Sorry if this is unclear.</p>
<p>HTML Code</p>
<pre><code><ul id="menu">
<li id="0">link 1</li>
<li id="1">link 2</li>
<li id="2">link 3</li>
</ul>
</code></pre>
<p>CSS for the list item</p>
<pre><code>#menu li{
float:left;
margin:0 20px 0 0;
height:87px;
z-index:1;
position:relative;
background: #f8f8f8;
cursor:pointer;
border:1px solid #CCC;
border-bottom:none;
}
#menu li:after{
display:none;
content: '';
position: absolute;
top: 0;
bottom: -5px;
left: 0;
width: 291px;
height:10px;
margin-top:109px;
background: #f8f8f8;
}
</code></pre>
<p>I thought it would be as simple as putting something like </p>
<pre><code>$$('li[id="0"]:after').show();
</code></pre>
<p>or maybe </p>
<pre><code>$$('li[id="1"]:after').css("display" : "block");
</code></pre>
<p>but these does not work.</p>
|
jquery
|
[5]
|
1,365,919 | 1,365,920 |
Too many local variables in ASP.NET
|
<p>I wrote a control, and use a tool to do the code analysis. There is a test that I didn't pass. Avoid excessive locals, <a href="http://msdn.microsoft.com/library/ms182263(VS.90).aspx" rel="nofollow">http://msdn.microsoft.com/library/ms182263(VS.90).aspx</a>.</p>
<p>In my CreateChildControls function, I built a big table with lots of field. I need to create a lot of TableRow and TableCell to construct the table. But these are not field or property of control. Thery are local variables in the function, which are created dynamically.</p>
<p>Should I make these TableCells and TableRows as fields of the control? Or I just keep them as the local variables in the CreateChildControl function?</p>
<p>Best Regards,</p>
|
asp.net
|
[9]
|
958,427 | 958,428 |
How to port forward in C++?
|
<p>I have a sockets program that requires port 1002 to be open and I wanna know how to port forward in C++ on windows so i may use this port freely?</p>
|
c++
|
[6]
|
4,323,682 | 4,323,683 |
Layout for not-pod types (because have default constructor)
|
<pre><code>struct vec3{
vec3(){x=y=z=0.0f;};
float x,y,z;
};
vec3 array[10];
char buffer[100];
memcpy(buffer, array, sizeof(array));
memcpy(array, buffer, sizeof(array));
</code></pre>
<p><strong>struct Vec3</strong> is not Plain Old Datatype (<strong>POD</strong> type).
Is it this code correct and/or is it exist some garantees about memory layout in C++2003?</p>
|
c++
|
[6]
|
3,258,426 | 3,258,427 |
System.out.print is overlapping the questions why?
|
<p>My problem is when i run the program it runs all the System.out.print right but when i run
it for the second student some of it overlaps like so:</p>
<pre><code>"Enter the second student's name: Enter the student's score: "
</code></pre>
<p>instead of</p>
<pre><code>"Enter the second students's name: "
"Enter the student's score: "
</code></pre>
<p>I also can not input data into the System.out.print method of the second student</p>
<p>My main code where the error is:</p>
<pre><code>System.out.print("Enter the first student's name: ");
name = reader.nextLine();
student1.setName(name);
for (int i = 1; i <= 3; i++){
System.out.print("Enter the students's score: ");
score = reader.nextInt();
student1.setScore(i, score);
}
System.out.print("Enter the second student's name: "); //overlaps(stays on same line)
//also wont let me enter data here
name = reader.nextLine();
student2.setName(name);
for (int i = 1; i <= 3; i++){
System.out.print("Enter the students's score: "); //program skips to here to input
//data
score = reader.nextInt();
student2.setScore(i, score);
}
</code></pre>
<p>the part that deals with the error from the class is as follows</p>
<pre><code>public void setName(String nm){
name = nm;
}
</code></pre>
|
java
|
[1]
|
3,991,668 | 3,991,669 |
Python parameters and functions
|
<p>I just started learning Python and I've just been messing around typing different codes for practice to learn, and I made this code:</p>
<pre><code>import math
def lol():
print (math.cos(math.pi))
print ("I hope this works")
def print_twice(bruce):
print bruce
print bruce
print_twice(lol())
</code></pre>
<p>When I run it, my output is:</p>
<pre><code>-1.0
I hope this works
None
None
</code></pre>
<p>How come it isn't printing the function lol() twice?</p>
|
python
|
[7]
|
2,011,114 | 2,011,115 |
Practical way to find out if SMS has been sent
|
<p>I am interested in how I can figure out if SMS has been sent from the device.</p>
<p>In order to get notification when SMS is recieved, we use a broadcaster with:</p>
<pre><code>android.provider.Telephony.SMS_RECEIVED
</code></pre>
<p>Important to mention that I do not send SMS from my app, I just should listen when SMS is sent from the device.</p>
<p>May be I should listen to some Content provider (which somehow related with SMS) and react for that change. Any ideas how I can achieve that?</p>
|
android
|
[4]
|
4,602,509 | 4,602,510 |
Should I use a class of functions or a namespace of functions?
|
<p>Say I want some functions to deal with some file, and I was considering 2 options.</p>
<p>1) Create a class like <code>SavedDataHandler</code> that a user could use like this....</p>
<pre><code>// Note that SavedDataHandler has no members. It just has functions that operate on a
// resource ( the file)
SavedDataHandler gameSave;
gameSave.SaveData( arg1, arg2 ); // to save data
gameSave.DeleteSave(); // Delete the save
...
</code></pre>
<p>2) Create a namespace of functions</p>
<pre><code>namespace SavedDataHandler {
SaveData( ... ) { ... }
DeleteSave( ... ) { ... }
...
}
</code></pre>
<p>that a user would call like </p>
<pre><code>SavedDataHandler::SaveData( arg1, arg 2 );
SavedDataHandler::DeleteSave();
</code></pre>
<p>What would be preferred? </p>
<p>P.S. I thought about this when I was thinking about Scott Meyer's recommendation to prefer non-member non-friend functions to member functions. I've run into decisions where I have a function (usually some private member function to help the class do stuff), that could easily be made into a non-member since it doesn't operate on class privates. </p>
<p>However, the function is only used by that one class. Of course, the program might evolve to a point where another class may need it, but I find it hard to find a place for these non-member functions. It's easy when you have a lot of functions with a general purpose, but I find single non-member functions hard to organize into a specific place, and find that leaving it as a member keeps things clean. Any tips regarding this issue?</p>
|
c++
|
[6]
|
4,068,385 | 4,068,386 |
How to exclude previous months of the current month?
|
<p>I have the following PHP that displays the month then an IF statement inside the foreach that says IF the month is February then do the <code>li</code>:</p>
<pre><code>$months = array('1' => 'January', '2' => 'February', '3' => 'March', '4' => 'April', '5' => 'May', '6' => 'June', '7' => 'July', '8' => 'August', '9' => 'September', '10' => 'October', '11' => 'November', '12' => 'December');
echo '<li><a class="by_month"></a><ul class="monthby" name="monthby">';
foreach($months as $month => $monthtitle):
if ($month == '2'){
echo '<li title="'.$monthtitle.'" rel="'.$month.'"><a href="#" title="'.$monthtitle.'">'.$monthtitle.'</a></li>';
}
endforeach;
echo '</ul></li>';
</code></pre>
<p>How do I modify the above code to say IF the month is February, then exclude any previous months. Basically, I want to create a list of the current month and upcoming months but exclude past months of the year.</p>
<p>So, for example, if the month was November, the list would ONLY show November and December. It would exclude all previous months.</p>
<p>How can I do this? I image I need to do something with an IF statement, like I sort of started but using <code>date('n')</code> to get the current month then ignore previous months of the current month.</p>
<p>Any help?</p>
|
php
|
[2]
|
1,587,791 | 1,587,792 |
Javascript scope help
|
<p>I am relatively new to javascript so please be patient if what i am asking is completely stupid!</p>
<p>I am trying to make a simple module. Inside the module i want to have a config object that holds settings for the module. I am also using jquery. The jquery selectors work only when in a function directly in the main object/module.</p>
<p>I understand that javascript has functional scope so I am suprised that I cannot use the jquery selectors anywhere inside the module.</p>
<p>EDIT:
I want to be able to directly set all of my configs inside the configs object using jquery selectors. This way i keep all the messy stuff inside one place and can then access configs.whatever throughout the rest of the module. At the moment jquery selectors do not work inside the configs module.</p>
<pre><code> var OB = function() {
var configs = {
'mode' : 'test',
'numOfSelects' : $('.mySelect').find('select').length, // This doesnt work
}
var getMode = function() {
return configs.mode;
}
function init() {
alert(configs.numOfSelects); // This alerts 0 until the following line
alert($('.mySelect').find('select').length); // This correctly alerts 2
};
var handlers = {
successHandler : function() {
alert("Success");
},
errorHandler : function() {
alert("error");
}
}
return {
init : init,
getMode : getMode
}
}( );
$(document).ready(function(){
OB.init();
});
</code></pre>
|
javascript
|
[3]
|
2,323,277 | 2,323,278 |
display css value for width and height display dynamically , Jquery Javascript alert function
|
<pre><code><tr><td><img src="images/C003.jpg" alt="title" class="OrignialImage" /></td></tr>
.OrignialImage
{
width:150px;
height:150px;
}
</code></pre>
<p>By using jquery, could we get width value from css class dynamically ?
Is there any way to get width value and height value dynamically, Please let me know it.</p>
|
jquery
|
[5]
|
5,939,167 | 5,939,168 |
Trying to open a file, wrong format?
|
<p>Im trying to open a file. Here is my output (string i build up in try/catch):</p>
<p>Error opening c:\Program Files (x86)\MyApp\storedUsers.txt -> System.FormatException -> Input string was not in a correct format.</p>
<p>And here is how im opening it:</p>
<pre><code>installPath = @"C:\Program Files (x86)\MyApp\";
FileStream userFile = new FileStream(installPath + "storedUsers.txt", FileMode.OpenOrCreate, FileAccess.Read);
StreamReader userStream = new StreamReader(userFile);
while (userStream.Peek() >= 0)
{
string line = userStream.ReadLine();
storedUsers.Add(line.Split(',')[0], int.Parse(line.Split(',')[0]));
}
userStream.Close();
</code></pre>
<p>My catch:</p>
<pre><code>WriteToLogFile("Error opening " + installPath + "storedUsers.txt -> " + ex.GetType() + " -> " + ex.Message);
</code></pre>
<p>I cant wrap my head around whats wrong...</p>
|
c#
|
[0]
|
2,385,175 | 2,385,176 |
remove element from vector of vectors
|
<p>I try to remove an element from vector of verctors in Java, and set this vector to the correct location.</p>
<p>So I try this, and of course it didn't work because line (2) return Integer:</p>
<p>Definition: </p>
<pre><code>Vector<Vector<Integer>> current_domain;
Vector<Integer> t = current_domain.get(k).remove(0);
current_domain.set(k, t);
</code></pre>
|
java
|
[1]
|
4,440,191 | 4,440,192 |
help me out in xml parsering
|
<p>I got xml file which contains 100 sub tags.....</p>
<p>I need to parse only 10 tags... when i click button i need to parse another 10 tags....</p>
<p>dude to my requirements i do parse the data...</p>
<p>I guess terminology is paging ...</p>
<p>Can any one help me out...</p>
<p>@thanks in advance.</p>
|
iphone
|
[8]
|
1,783,999 | 1,784,000 |
How to improve UI performace when working with heavy page
|
<p>I am developing a very heavy page using ASP.NET framework 4.0. My page contains 5 tabs(AJAX tabcontainer control). I am loading the controls dynamically when a tab is selected this improves the performance a lot but once all the tabs are loaded with the controls like RadGrid, griviews etc. My page becomes too heavy which causes lagging, slow performance when switching between the tabs. As my user will be using this application on IE 8 I have to code only for IE 8. How can i improve UI performance?</p>
|
asp.net
|
[9]
|
5,774,615 | 5,774,616 |
How can check empty url parameter in php
|
<p>I am working in php and phonegap. i am sending title, category of song using url to php page. now i want to select songs according to title and category if these both are provided in url. if url providing only title then search must be done according to title only. and if url providing category only then search must be basis on the category only.</p>
<pre><code>**this is code which i am trying**
$titletosearch = $_GET["title"];
$categorytosearch = $_GET["category"];
$artisttosearch = $_GET["artist"];
if($titletosearch !=" " && $titletosearch!=" ")
$rs = mysql_query("SELECT title,price,date,category FROM music where title like '%$titletosearch%' or category like '%$categorytosearch%' ") or die ("invalid query");
elseif($titletosearch =="" && $titletosearch!=" ")
$rs = mysql_query("SELECT title,price,date,category FROM music where category like '%$categorytosearch%' ") or die ("invalid query");
elseif($titletosearch !=" " && $titletosearch=="")
$rs = mysql_query("SELECT title,price,date,category FROM music where title like '%$titletosearch%' ") or die ("invalid query");
</code></pre>
<p>Problem with my code is this whenever i provide title only or category only in url then it searches so many records. means it work properly if i provide both title and category. if any of them is not given then i provide so many results records.</p>
<p>Please help how should i handle these conditions. ?</p>
<p>Thank you in advance.</p>
|
php
|
[2]
|
3,532,782 | 3,532,783 |
How to upgrade Android 1.5 R3 SDK to 2.2?
|
<p>I haven't worked on Android development for more than a year now. The latest SDK I have on my XP machine is 1.5 R3. I'd like to update to the 2.2 SDK but the android.com guide does not apply to the SDK I have installed. For example the AVD Manager from eclipse does not show specified dialog.</p>
<p>Any one upgraded his SDK please let me know what to do.</p>
<p>Thank you. </p>
|
android
|
[4]
|
79,030 | 79,031 |
'HTTP_HOST' not being evaluated correctly?
|
<p>I use php scripts when there are errors (like 400,404,403,etc), to email me and advise of what is being attempted.</p>
<p>I noticed on a 400 error, the 'from' and 'to' didn't contain my domain name, but another domain name. This is some of the code I use ..</p>
<p>PHP Code:</p>
<pre><code>$http_host = $_SERVER["HTTP_HOST"];
$http_host = str_replace("www.", "", $http_host);
$from = "From: webmaster@" . $http_host . "\r\n";
$to = "From: webmaster@" . $http_host . "\r\n";
</code></pre>
<p>The var $http_host had the other domain name there. Fortunately, the email bounced back, so I became aware of the problem. Here is the web access logs entry</p>
<pre><code>94.102.51.246 - - [23/Feb/2013:16:17:49 +1100] "GET http://24x7-allrequestsallowed.com/?...RWJWS_FA%40FQN HTTP/1.1" 400 2815 "-" "Mozilla/5.0 (Windows NT 6.1; rv:16.0) Gecko/20100101 Firefox/16.0"
</code></pre>
<p>It seems <code>$_SERVER["HTTP_HOST"]</code> was evaluated to '24x7-allrequestsallowed.com'</p>
<p>I'm mystified how this was parsed as a URL, but more uneasy that $_SERVER["HTTP_HOST"] wasn't set to the 'proper' domain name.</p>
|
php
|
[2]
|
1,320,656 | 1,320,657 |
Why does PHP post increment not behave as expected when in an array [ ] operation?
|
<p>My Question is why does the post increment not function on the first element but then works as expected when it is contained within an array [ ] element ? </p>
<p>Here is a snippet of what I was doing that behaves unexpectedly:</p>
<p>When I use this code ...</p>
<pre><code>$lessonIndex = 0;
$EventArray[$lessonIndex]['Title'] = 'Lesson 1';
$EventArray[$lessonIndex]['Start'] = $TimeArray[$EventArray[$lessonIndex++]['Title']]['Start'];
$EventArray[$lessonIndex]['Title'] = 'Lesson 2';
$EventArray[$lessonIndex]['Start'] = $TimeArray[$EventArray[$lessonIndex++]['Title']]['Start'];
$EventArray[$lessonIndex]['Title'] = 'Lesson 3';
$EventArray[$lessonIndex]['Start'] = $TimeArray[$EventArray[$lessonIndex++]['Title']]['Start'];
</code></pre>
<p>The $EventArray[$lessonIndex] contents will be skip index 0 then index 1 will get what was destined for index 0 and the increment proceeds as expected through the rest of the code, but with the results being off by one.</p>
<p>If I do this instead:</p>
<pre><code>$lessonIndex = 0;
$EventArray[$lessonIndex]['Title'] = 'Lesson 1';
$EventArray[$lessonIndex]['Start'] = $TimeArray[$EventArray[$lessonIndex]['Title']]['Start'];
$lessonIndex++;
$EventArray[$lessonIndex]['Title'] = 'Lesson 2';
$EventArray[$lessonIndex]['Start'] = $TimeArray[$EventArray[$lessonIndex]['Title']]['Start'];
$lessonIndex++;
$EventArray[$lessonIndex]['Title'] = 'Lesson 3';
$EventArray[$lessonIndex]['Start'] = $TimeArray[$EventArray[$lessonIndex]['Title']]['Start'];
$lessonIndex++;
</code></pre>
<p>Everything works as expected.</p>
|
php
|
[2]
|
3,703,585 | 3,703,586 |
How to do a task immediately after installation of Android applucation..?
|
<p>I'm developing an application in Android. Is there anyway that I can send SMS to destination number, saying my installation is successful - without opening the application or clicking any buttons - immediately after the installation.</p>
|
android
|
[4]
|
2,530,214 | 2,530,215 |
Share session in simple machine forum to subdomain
|
<p>I've deployed simple machine forum at smf.com domain, and than I created simple application to read session from the smf.com, but i deployed the simple application in the subdoamin, let say I put my simple application in simple.smf.com</p>
<p>In order to read session from domain, I must put ini_set("session.cookie_domain",".smf.com"); before session start. I must put it in the smf project file and also simple aplication too.</p>
<p>where I should put ini_set("session.cookie_domain",".smf.com") so it will by pass to the session start.</p>
<p>I have put the ini_set("session.cookie_domain",".smf.com") in the load.php file</p>
<pre><code>function loadSession()
{
global $HTTP_SESSION_VARS, $modSettings, $boardurl, $sc;
// Attempt to change a few PHP settings.
@ini_set("session.cookie_domain",".smf.com");
@ini_set('session.use_cookies', true);
@ini_set('session.use_only_cookies', false);
@ini_set('url_rewriter.tags', '');
@ini_set('session.use_trans_sid', false);
@ini_set('arg_separator.output', '&amp;');
}
</code></pre>
<p>while I try to read cookie form subdomain. It couldn't read the domain session. my subdomain code is:</p>
<pre><code><?php
ini_set("session.cookie_domain",".smf.com");
session_start();
print_r($_SESSION);
?>
</code></pre>
|
php
|
[2]
|
5,154,033 | 5,154,034 |
Java: Error "Incompatible datatypes"
|
<pre><code>private byte[] decode_text(byte[] image)
{
int length = 0;
int offset = 32;
for(int i=0; i<32; ++i)
{
length = (length << 1) | (image[i] & 1);
}
byte[] result = new byte[length];
for(int b=0; b<result.length; ++b )
{
for(int i=0; i<8; ++i, ++offset)
{
/* I'm getting error at the following line */
result = (byte)((result << 1) | (image[offset] & 1));
}
}
return result;
}
</code></pre>
<p>Error is incompatible datatypes...required byte[] and found byte..........</p>
|
java
|
[1]
|
2,893,736 | 2,893,737 |
Proxy Server Donn't allow to import Google Maps
|
<p>I have done all the necessary settings of proxy in my emulator using comand line as well as Graphical from the emulator's mobile settings. By doing this internet browsing is running in my emulator, but when i run my project to import google maps in my application, Only grid shown having no maps on it. I think proxy server donn't let it to download maps from the site. Any kind of help will be appreciated....</p>
|
android
|
[4]
|
3,688,024 | 3,688,025 |
windows-7: could not run android apps on device
|
<p>I'm trying to import android applications from other computers. after sometime they're running on emulator finally now but not on the device .
probably the reason is the driver I installed , because adb devices did not recognize the device so I installed this manually and still Bluetooth Peripheral Device not installed when I check in device manager!</p>
<p>at first it gave me this error : <code>the app stopped running unexpectedly !</code> </p>
<p>now the error is :</p>
<pre><code>Re-installation failed due to different application signatures.
You must perform a full uninstall of the application. WARNING: This will remove the application data!
Please execute 'adb uninstall com.newboston.aida.android2' in a shell.
Launch canceled!
</code></pre>
<p>any idea how to solve this?</p>
|
android
|
[4]
|
1,038,851 | 1,038,852 |
debug_zval_dump and refcount
|
<p>Is there any way to get the <em>refcount</em> value reported by <strong>debug_zval_dump</strong> without all the additional information returned by that function; e.g. by an alternative function or some truncation of its output? I am using the <em>refcount</em> as per the suggested solution to the problem <a href="http://stackoverflow.com/questions/4817562/detecting-whether-a-php-variable-is-a-reference-referenced">Detecting whether a PHP variable is a reference / referenced</a>. As such, all I require is the reference count. The structure I am examining is huge so (a) getting the entire structure seems like overkill and (b) I believe I've seen cases where the size has caused problems and bypassing the output buffer (NB: No *chunk_size* had been set for the ob_start).</p>
|
php
|
[2]
|
554,588 | 554,589 |
mvc3 and culture info for date and day names
|
<p>In globa.asax.cs i use this code for cultre</p>
<pre><code>protected void Application_BeginRequest(object sender, EventArgs e)
{
CultureInfo newCulture = new CultureInfo("sl-SI");
Thread.CurrentThread.CurrentCulture = newCulture;
Thread.CurrentThread.CurrentUICulture = newCulture;
}
</code></pre>
<p>but when i write </p>
<p><code>@DateTime.Today.DayOfWeek</code> i always get </p>
<blockquote>
<p>"Sunday"</p>
</blockquote>
<p>instead of our language </p>
<blockquote>
<p>"Nedelja"</p>
</blockquote>
<p>. I am using mvc3. how can i get our date and day names?</p>
|
c#
|
[0]
|
2,385,129 | 2,385,130 |
images not showing in internet explorer but in firefox no problem
|
<p>can anyone help me please why my images is not showing on internet
explorer 6;7 but in firefox, chrome,avant, IE8 no problem at all...
<a href="http://previewagency.com/index.shtml" rel="nofollow">http://previewagency.com/index.shtml</a></p>
|
javascript
|
[3]
|
4,232,943 | 4,232,944 |
Compiling Android scource code on ubuntu 9.10
|
<p>I have downloaded the android source code (1.5 Gb and appx. 5 Gb after extracting).My intention is to compile this.
1) Do i need a toolchain for arm ..if yes which one will be suitable.
2) to run simulator and to be able to debug on workstation do i need to have any specific PC -linux toolchain .</p>
|
android
|
[4]
|
3,178,546 | 3,178,547 |
Question about when a script is executed after appending it
|
<p>In my code, I have javascript that dynamically adds another script to the page:</p>
<pre><code>created_script=document.createElement('script');
created_script.src='other_script';
created_script.type='text/javascript';
document.head.appendChild(created_script);
</code></pre>
<p>in this 'other script', I have a function called reloader().</p>
<p>The problem I'm having is that right after I dynamically add the script, I try to call the function reloader(), but I'm getting a reloader is not defined error.
Here's is like what I am doing:</p>
<pre><code>created_script=document.createElement('script');
created_script.src='other_script';
created_script.type='text/javascript';
document.head.appendChild(created_script);
reloader();
</code></pre>
<p>Can someone explain to me why this doesn't work and how should I fix this so that reloader() can be called after appending the script in a single dynamic call (if possible at all)?</p>
|
javascript
|
[3]
|
3,564,460 | 3,564,461 |
Prevent orientation change when users pushes display-turn-off/on button
|
<p>I've got an activity that is in a landscape mode - it's a player. Whenever I hit display-off button activity gets recreated and the screen goes black. After that I hit display-on to bring the interface back and the activity gets recreated again.</p>
<p>I guess this is because on my samsung i9001 display button not only shuts down the display but also brings that system-desktop to the foreground - so it's the first orientation change that causes activity recreation. Furthermore, when display gets active again and the activity starts it needs to change orientation/create activity again(not sure about it).</p>
<p>My question is how do I prevent the first recreation of the activity when I hit display-off. Is it possible ?</p>
|
android
|
[4]
|
1,462,435 | 1,462,436 |
3rd party apps move to SD card automatically when app is install from android market
|
<p>i want to ask, is there anyway, when 3rd party apps from android market install on phone memory so they will auto move to SD card and from phone memory these apps delete, format, remove or uninstall automatically. by programmatically. thanx </p>
|
android
|
[4]
|
1,858,667 | 1,858,668 |
Using "google api java client" android
|
<p>I want to use "google api java client" to create event "google calendar".
In the event, I want add "Description" and Reminders
Help me.
Thanks</p>
|
android
|
[4]
|
5,625,185 | 5,625,186 |
jquery .text() or .html() not working
|
<p>I am dynamically generating a div and want to change its content via html()/text(), but its not working.</p>
<p>Here's the code:</p>
<pre><code>var div = '<div class="ps_album"><img alt="" src="images/1px.gif" class="thmb"><div class="ps_desc"><h2>title</h2></div></div>';
$(div).find('.ps_desc').html('<h1>Hello</h1>');
$(div).appendTo('body');
</code></pre>
<p>in above code, the 3rd line i.e.</p>
<pre><code>$(div).find('.ps_desc').html('<h1>Hello</h1>');
</code></pre>
<p>not working.. why??</p>
|
jquery
|
[5]
|
826,379 | 826,380 |
PHP Echo and Includes
|
<p>When I use the following PHP code:</p>
<p><code>$id = $_GET['page']; $page = include ($id.'.php'); echo $page;</code></p>
<p>The code within the $id.php file is returned, however there is a "1" appended to it, any idea why this is happening?</p>
|
php
|
[2]
|
3,698,838 | 3,698,839 |
C#: understanding event syntax
|
<p>i need some help understanding how i can create a new custom event. i read from <a href="http://osix.net/modules/article/?id=685" rel="nofollow">here</a> ... </p>
<pre><code>public delegate void ChangingHandler (object sender, CarArgs ca);
public event ChangingHandler Change;
...
private void car_Change(object sender, CarArgs ca) {
MessageBox.Show(ca.Message());
}
...
car.Change+=new Car.ChangingHandler(car_Change); // add event handler
...
Change(this,ca); // call event
</code></pre>
<p>1st, i dont really get the delegate part. in a normal variable declartion, </p>
<pre><code>protected string str1;
</code></pre>
<p>but here i have the extra (<code>ChangingHandler</code>). how do i make sense of this? i know its something like a ChangingHandler will be used for handling the event but it throws me off abit. </p>
<pre><code>public event ChangingHandler Change
</code></pre>
<p>then</p>
<pre><code>car.Change+=new Car.ChangingHandler(car_Change)
</code></pre>
<p>i dont really get the syntax <code>new Car.ChangingHandler(car_Change)</code>. </p>
|
c#
|
[0]
|
3,042,510 | 3,042,511 |
Reading tokens from file then storing into an array for output
|
<p>i have specification of a DFA in a text file as follows;</p>
<pre><code>DFA = (
{q1,q2},
{0,1},
{(q1,0)-> q1, (q1,1)-> q2, (q2,0)-> q1, (q2,1)-> q2},
q1,
{q2}
)
</code></pre>
<p>What piece of code could help me read each token (character) and store the tokens into an array then printout contents of the array</p>
|
java
|
[1]
|
4,971,309 | 4,971,310 |
Can I post comments on my Twitter account using javascript?
|
<p>Can I post comments on my Twitter account using javascript, if you have any code or phrase please suggest me... </p>
<p>Thanks!</p>
|
javascript
|
[3]
|
5,373,331 | 5,373,332 |
PHP include w/o echo
|
<p>I'm coding a web site and I have a php fonction called site_nav.php which first define a $list array and than echos it in a json form.</p>
<p>This way, I can get my web site map with ajax.</p>
<p>My problem is that now, I would like to get the $list object in php, without echoing the json object.</p>
<p>My question: Is there a way to include my php file without activation of the echo call which is in it?</p>
<p>Thanks a lot!</p>
|
php
|
[2]
|
301,367 | 301,368 |
Detect when element is less than 100px from top of window, change CSS
|
<p>I'm trying to make it so that when <code>div.projectsgrid</code> is < 100px from the top, jQuery will see if <code>div.selectedwork</code> has css background-color #ffffff. If not, it will set its background-color to #ffffff. Once the user scrolls back up and <code>div.projectsgrid</code> is more than 100px from the top, jQuery will remove the background color. I have the following code, which isn't working:</p>
<pre><code>$(window).scroll(function(e){
var el = $('.selectedwork');
var top = $('#projectsgrid').offset().top;
if ($(top) < 100 && el.css('background-color') != '#ffffff'){
$(el).css({'background-color': '#ffffff'});
}
if ($(top) > 100 && el.css('background-color') == '#ffffff'){
$(el).css({'background-color': ''});
}
});
</code></pre>
|
jquery
|
[5]
|
1,460,268 | 1,460,269 |
PHP - ImageCopyResampled max size
|
<p>What is the maximum width and height that ImageCopyResampled can handle? My code works for smaller images in terms of width and height. For larger images, it will disregard the coordinates, meaning the cropping starts from the upper left corner of the image.</p>
<p>Is there a workaround? Here's a portion:</p>
<pre><code>$trgt_width = 500;
$trgt_height = 400;
if(copy($src_file, $trgt_file)):
$src_image = imageCreateFromJpeg($src_file);
$trgt_image = imageCreateTrueColor($trgt_width, $trgt_height);
imageCopyResampled($trgt_image, $src_image, 0, 0, $x, $y, $trgt_width, $trgt_height, $width ,$height);
imageJpeg($trgt_image, $thumb_file, 75);
endif;
</code></pre>
<p>Thanks.</p>
|
php
|
[2]
|
3,585,331 | 3,585,332 |
app crashes with ProcessStartInfo arguments
|
<p>I am trying to run a process called "prog.exe" with the arguments "blah $00" (sort of a code) but whatever I try fails.</p>
<pre><code>string file = "blah $00";
string result = string.Empty;
ProcessStartInfo P = new ProcessStartInfo(@"""" + "prog.exe" + @"""");
P.Arguments = @"""" + file + @"""";
P.CreateNoWindow = true;
P.UseShellExecute = false;
P.RedirectStandardOutput = true;
Process.Start(P);
using (Process process = Process.Start(P))
{
using (StreamReader str = process.StandardOutput)
result = str.ReadToEnd();
}
MessageBox.Show(result);
</code></pre>
<p>When this code is executed, my program just crashes and I am forced to close it using the Task Manager. </p>
<p>I am not sure what's wrong with my code (am I not setting the arguments correctly?), so any help would be appreciated.</p>
|
c#
|
[0]
|
4,650,780 | 4,650,781 |
How to remove sublayers from a view afer a touch
|
<p>I am developing an app in which i have a layer </p>
<p>layer1.frame=CGRectMake(80, 100, 180, 170);</p>
<p>If a user touch the screen the layer should be swiped out the the window through animation..</p>
<p>For this i am using a timer to animate but i don't know what to write in the timer function </p>
<p>to make it remove from the window(like swiped out)...</p>
<p>Please help...</p>
|
iphone
|
[8]
|
3,649,991 | 3,649,992 |
Java: How do I check if array has been initialized?
|
<p>I want to check if a certain element in an array has been initilized, how can I do this?</p>
|
java
|
[1]
|
487,758 | 487,759 |
Delphi's like decision cube for c#
|
<p>I'm looking for a pivot table like component for winforms and c#, like the good-old decision cubes that came with Delphi decades ago. Any pointers?</p>
<p>I need one able to be used independently of the underlying database, so capable of getting data programatically and not restricted to sqlserver olap or similar</p>
|
c#
|
[0]
|
5,764,038 | 5,764,039 |
adding GNU GPL for a java application
|
<p>I am not getting where i have to put the licence file of the third party libraries while making jar through eclipse can any one please help me in this issue. While making a jar from eclipse i am getting the following warning</p>
<blockquote>
<p>The operation repacks referenced libraries.</p>
<p>Please review the licences associated with libraries you wish to
reference to make sure you are able to repack them using this
application. Note also that this operation does not copy signature
from files from original libraries to the generated jar file</p>
</blockquote>
<p>Can any one please let me know this type of error messages will lead to any problem using jar file that generate through eclipse</p>
<p>Thanks in advance</p>
|
java
|
[1]
|
5,438,837 | 5,438,838 |
How to load information on listview from txt file
|
<p>I wish to load the information from the text file onto listview. Please help me with the same code.</p>
<p>The information I am getting while reading is in following format</p>
<pre><code>1,demo,time,date:
2,sad,dad,sad:
</code></pre>
<p>I need to display the data in such a way that for int values say 0/1 there should be an image.
Next demo/sad below that time/dad and atlast date must be displayed. Please help me for the same.</p>
|
android
|
[4]
|
372,061 | 372,062 |
Read a file from a host computer
|
<p>I'm trying to read a file from the computer that is in the same folder as the source code and when I run the code is saying: File does not exist
Can you help me ?</p>
<pre><code>import java.io.*;
import java.util.*;
public class Lotto1 {
static String[][] arr;
static String name, number;
public static void main(String[] args) throws IOException {
File f = new File("D:\\Filipe\\Project Final\\src\\database_lotto.txt.txt");
Scanner s;
try {
s = new Scanner(f);
BufferedReader reader = new BufferedReader(new FileReader(f));
int lines = 0;
while(reader.readLine() != null) {
lines++;
}
reader.close();
arr = new String[lines][3];
int count = 0;
//while theres still another line
while(s.hasNextLine()) {
arr[count][0] = s.next() + "" + s.next();
arr[count][1] = s.next();
arr[count][2] = s.next();
count++;
}
} catch(FileNotFoundException ex) {
System.out.println("File does not exist");
}
</code></pre>
|
java
|
[1]
|
152,216 | 152,217 |
jQuery index of item in selector
|
<p>this is pseudo code </p>
<pre><code> var index_of_myid = $('.selection').indexOf($('#myid));
</code></pre>
<p>not sure if this is right is this possible if you can understand what I'm trying to do</p>
<p><strong>EDIT</strong></p>
<pre><code> <div>
<div class="selector"></div>
</div>
<div>
<div class="selector"></div>
</div>
<div>
<div class="selector" id="myid"></div>
</div>
<div>
<div class="selector" id="myid2"></div>
</div>
</code></pre>
<p>I just need to know what number selector is the myid</p>
|
jquery
|
[5]
|
5,918,406 | 5,918,407 |
Dynamic bulleted list
|
<p>This is what I'm trying to do but I'm a jquery rookie.</p>
<p>When the page loads I have jquery calls
<code>levelone.php</code> which print something like <code>BEACH{!}OFFICE{!}HOME{!}</code>
and creates my first bullet level.</p>
<p>When clicking on a bullet how can I call
<code>leveltwo.php?lvlone=HOME</code> which would create new bullets with
something like: <code>BED ROOM{!}KITCHEN{!}</code> and so on </p>
<p>Same on the new bullets
<code>levelthree.php?lvlone=HOME&lvltwo=KITCHEN</code> which would create new bullets with
something like: <code>TABLE{!}CHAIR{!}</code> and so on</p>
<p>My code so far:</p>
<pre><code>$(document).ready(function(){
$.get("load_locations.php", function( my_var ) {
var my_varspl = my_var.split('{!}');
$('#myDiv').append("<ul id='newList'></ul>");
for (var i = 0, e = my_varspl.length; i < e; i++) {
if(my_varspl[i]!=''){
$("#newList").append('<li>'+my_varspl[i]+'</li>');
}
}
});
});
</code></pre>
|
jquery
|
[5]
|
1,327,732 | 1,327,733 |
ASP.net-Listbox not retaining selected values between postbacks
|
<p>I have a Listbox getting populated when the page loads itself and also in postbacks. Some items are already selected in that listbox even when the page loads or postbacks. I have to select one or more items in that textbox in addition to the selected one.</p>
<p>Till this point, it works perfectly, but the problem is that when i click an "update" button to save the newly added items, then also the page postbacks and so the list box get populated again. This will loose the newly selected items and none of the newly selected items will be saved.</p>
<p>So what should i do in order not to loose the newly selected items when i click the "update" button.</p>
<p>Note:- I need to populate the listbox on postbacks also. So the population of that listbox on postbacks cannot be discarded.</p>
<p>Kindly help me. I am new to ASP.net.</p>
<p>Thanks in Advance</p>
|
asp.net
|
[9]
|
2,348,760 | 2,348,761 |
How to change tabBarItem highlighted color to a color other than blue(iphone development )
|
<p>I want to change the default selection of tabbaritem from blue to some other color ...</p>
|
iphone
|
[8]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.