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,373,096 | 2,373,097 | syntax error, unexpected $end in php | <p>I am getting the following error in one of my php file
Parse error: syntax error, unexpected $end in /home/qualitet/public_html/game/create.php on line 1</p>
<p>What could be the problem? I checked all the if else. </p>
| php | [2] |
4,688 | 4,689 | meaning of 'operator' in this C++ statement | <p>What does the 'operator' mean in this C++ usage?</p>
<pre><code>char* pszVar= W2A(_bstr_t(bstrVar).operator wchar_t*());
</code></pre>
| c++ | [6] |
3,530,337 | 3,530,338 | What's the difference in these ways of determining uploaded file size in PHP? | <p>I came across this piece of code where programmer determines uploaded file size like this:</p>
<pre><code>$file_size = @filesize($_FILES[$upload_name]["tmp_name"]);
</code></pre>
<p>AFAIK one can simply do: </p>
<pre><code>$_FILES[$upload_name]["size"];
</code></pre>
<p>Are there reasons to use filesize() function over reading file size from $_FILES array?</p>
| php | [2] |
234,249 | 234,250 | Overriding generics | <p>I'm failing to create this class hirerarchy that includes a generic that is comparable. What am I missing here? This throws an error.</p>
<pre><code>public class Generics <T extends Comparable<T>>
extends Parent<T extends Comparable<T>> {
ArrayList<T> ar;
public Generics() {
ar = new ArrayList<>();
}
@Override
public void add(T elt){
ar.add(elt);
}
}
</code></pre>
<p>And the parent class is:</p>
<pre><code>public class Parent <T extends Comparable<T>>{
int size =0;
public Parent(){
size=0;
}
public void add(T elt){
size++;
}
}
</code></pre>
<p>Try "Extract Superclass" on the following. I tried extracting the ArrayList and the add(T elt). This is on the following config:</p>
<p>Product Version: NetBeans IDE 7.2 (Build 201207171143)
Java: 1.7.0_07; Java HotSpot(TM) 64-Bit Server VM 23.3-b01
System: Linux version 3.2.0-30-generic running on amd64; UTF-8; en_US (nb)</p>
<pre><code>public class Generics <T extends Comparable<T>> {
ArrayList<T> ar;
int size;
public Generics() {
ar = new ArrayList<>();
size = 0;
}
public void add(T elt){
ar.add(elt);
size++;
}
}
</code></pre>
| java | [1] |
1,856,286 | 1,856,287 | textbox replace text | <p>It give me an error, don't know why. I want to replace <code>'</code> with <code>"</code>.</p>
<pre><code>try
{
txtCS.Text.Replace("'", """);
}
catch
{
}
</code></pre>
| c# | [0] |
2,731,749 | 2,731,750 | Dynamic creation of tablelayout android | <p>I want to add rows to a tablelayout dynamically. This is my code.</p>
<pre><code> TableRow tableRow = null;
TextView textView = null;
ImageView imageView = null;
TableLayout tableLayout = (TableLayout)findViewById(R.id.tableLayout);
RelativeLayout relativeLayout = null;
for (String string: listOfStrings) {
tableRow = new TableRow(this);
relativeLayout = (RelativeLayout) View.inflate(this,
R.layout.row, null);
textView = (TextView) relativeLayout.getChildAt(0);
textView.setText(string);
imageView= (ImageView) relativeLayout.getChildAt(1);
imageView.setBackgroundColor(R.color.blue);
tableRow.addView(relativeLayout);
tableLayout.addView(tableRow);
}
</code></pre>
<p>I have created a row layout with width fill_parent, with textView on left most side and an imageView on right most side. However when I run this program the row width appears wrap_content instead of fill_parent with image overlapping text. Please help. Thanks</p>
| android | [4] |
4,255,668 | 4,255,669 | getElementsByTagName is not working Simple JS | <p>another quesion: <a href="http://jsfiddle.net/ajinkyax/qGzTY/1/" rel="nofollow">http://jsfiddle.net/ajinkyax/qGzTY/1/</a>
Above link shows a js calculator, but whn u click nothign happens</p>
<p>Im just amazed why this simple function not working!!!.</p>
<p>I even tested with a tag, still it wont wokr. getElementsByTagName("a")</p>
<pre><code><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>documentElement</title>
</head>
<body>
<p>This is 4rth child (3)</p>
<p>This is 4rth child (3)</p>
<p>This is 5th child (4) <span id="some">CHANGE THIS</span></p>
<script type="text/javascript">
var mySpan = document.getElementsByTagName('span');
mySpan.innerHTML = 'This is should change';
</script>
</body>
</html>
</code></pre>
| javascript | [3] |
30,213 | 30,214 | Trigger change on input when is changed by another input | <p>I have two inputs A nad B and in input a i have set <code>onchange=$("#B").val($(this).val())</code></p>
<p>i have set <code>$(B).change(function(){aler('ok');})</code> but nothing happend.. How this should be made ?</p>
| jquery | [5] |
3,064,483 | 3,064,484 | Explicit assignment of null | <pre><code>string s1;
string s2 = null;
if (s1 == null) // compile error
if (s2 == null) // ok
</code></pre>
<p>I don't really understand why the explicit assignment is needed. Whats the difference between a null variable and an unassigned variable? I always assumed that unassigned variables were simply assigned as null by the runtime/compiler anyway. If they're not null, then what are they?</p>
| c# | [0] |
2,941,089 | 2,941,090 | How to manipulate the "onclick" event of a html button element with JavaScript? | <pre><code>document.getElementById("RightButton").innerHTML="Back to Question";
document.getElementById("RightButton").onclick=GoBack();
</code></pre>
<p>Is the code I wrote to solve my problem. The first line successful changed the name of the button, but the second line simply doesn't work. </p>
<p>As you may have discovered, I'm totally a newbie. If you use excessive jargon, it will probably take me another question to figure out the jargon. </p>
| javascript | [3] |
4,974,972 | 4,974,973 | Get function's 'namespace path' | <p>I have some namespaces, one included in the other:</p>
<pre><code>class A:
class B:
class C:
def method(): pass
get_ns_path(A.B.C.method) # >>> 'A.B.C.method'
</code></pre>
<p>Is it possible to implement such <code>get_ns_path(func)</code> that receives a method/function and returns the 'namespace path' as a string?</p>
<p><code>A.B.C.method.im_class</code> gives <code>C</code>, great, but how to go further up?</p>
| python | [7] |
444,117 | 444,118 | c++ order of preference.. how is this expression evaluated? | <p>I am trying to understand code of some library of one simulation tool that i use..
It has the following line:</p>
<pre><code>propData->fadingStretchingFactor =
(double)(propProfile0->samplingRate) *
propProfile->dopplerFrequency /
propProfile0->baseDopplerFrequency /
(double)SECOND;
</code></pre>
<p>Now how do u figure out the order of operations if there are two consecutive division operators as in this example</p>
| c++ | [6] |
4,022,066 | 4,022,067 | How do i add a query string pair to an existing url in jquery | <p>I am aware that I can access all external links on a page using something like:</p>
<pre><code>// Get external links
$.expr[':'].external = function(obj){
return !obj.href.match(/^mailto\:/)
&& (obj.hostname != location.hostname);
};
</code></pre>
<p>does anyone know how I can add a query string pair (along the lines of <code>?aid=1234567</code>)
to the URLs in the external links? </p>
<p>Thanks in advance</p>
| jquery | [5] |
483,755 | 483,756 | Webview load html from assets directory | <p>I'm trying to load a html page from the assets directory. I tried this, but it fails.</p>
<pre><code>public class ViewWeb extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebView wv;
wv = (WebView) findViewById(R.id.webView1);
wv.loadUrl("file:///android_asset/aboutcertified.html"); // fails here
setContentView(R.layout.webview);
}
}
</code></pre>
<p>I don't really get any telling errors in LogCat...</p>
| android | [4] |
12,982 | 12,983 | Splitting GPS values using PHP | <p>I am new to PHP, and am working on a GPS tracking system. I have to split the GPS codes to store in MySQL.</p>
<pre><code>7/3/2010 5:38:18 AM Posted <!355801020193357*1*1-1*03/07/10,05:38:27*1144.4633*07921.6860*41.6*N*E*48.9*0.8*20,54,6678;47,ffff;12,ffff*1*1*0*363*0*1*27312*529#>
</code></pre>
<p>I want:</p>
<pre><code>7/3/2010
5:38:18 AM
355801020193357
1144.4633
07921.6860
48.9
</code></pre>
<p>How can I parse out those values from my input?</p>
| php | [2] |
5,001,420 | 5,001,421 | jQuery: how do i search for a specific ID tag and create that element? | <p>In jQuery, how do I search the DOM for a specific element tag by ID and create that element if the tag ID is not found?</p>
<p>Here is the element to be created if tag is not found:</p>
<pre><code><div id="foo"></div>
</code></pre>
| jquery | [5] |
3,180,685 | 3,180,686 | What is the meaning of $updateStr .= ",";? | <p>What is the meaning of this code?</p>
<pre><code>$updateStr .= ",";
</code></pre>
| php | [2] |
1,165,935 | 1,165,936 | Validate form replace text textarea | <p>I have a validation form checker -
when my checkbox has the value of 1 - i want to replace some text in the TextArea with new Text. Does anyone know the correct code to do this?</p>
<p>everything else in the form checker works, except this one.</p>
<pre><code>function validateForm(myForm){
if (getRadioSelected(myForm.myCheckBox) == 1) {
myForm.myTextArea.value.replace("Old Text","Replacement Text");
}
}
</code></pre>
| javascript | [3] |
4,567,107 | 4,567,108 | is it possible to change a text font in style | <p>I need to do a style in order to have all my bold texts in a specific font, and all my normal ones in an other. is it possible ?</p>
<p>i'm trying to build a style to do so, but there is no attribute to specify font type</p>
| android | [4] |
659,467 | 659,468 | How I can Merge two datatable into one datatable in c# | <p>I have tow datatables and i want to merge them and want the output like this;</p>
<p>Table1 values:</p>
<pre><code>FirstName LastName
AAA BBB
AAA BBB
</code></pre>
<p>Table2 values:
*</p>
<pre><code>FullName
CCC
CCC
</code></pre>
<p>*</p>
<p>now i want that FullName's value and FirstName's value merge into One column of Firstname
and out should be like that after merging....</p>
<pre><code>FirstName LastName
AAA BBB
AAA BBB
CCC
CCC
</code></pre>
<p>Both out tables have the column of FirstName and LastName from dtable1 and FullName from dtable2 </p>
<p>i have this code in my c# application</p>
<pre><code> DataSet firstGrid = new DataSet();
DataSet secondGrid = new DataSet();
DataTable table1 = dataGridView3.DataSource as DataTable;
DataTable table2 = dataGridView2.DataSource as DataTable;
DataColumn[] colunm = new DataColumn[table1.Columns.Count];
DataTable table3 = new DataTable();
// table3.;
table3 = table1.Copy();
table3.Merge(table2);
dataGridView1.DataSource = table3;
</code></pre>
| c# | [0] |
780,483 | 780,484 | What is the best way to carry data over between onPause & onResume? | <p>I'm having a hard time figuring out the best way to pass simple values from onPause and onResume in the Android activity lifecycle. I understand how to use get and put extra bundles for activity to activity data, but does that work for passing data between the same activity? Should i used SharedPreferences?</p>
| android | [4] |
3,304,026 | 3,304,027 | Detect if an iPhone app with given Apple ID and Bundle ID is already installed | <p>Is it possible to detect if an app with the given Bundle ID and Apple ID is already installed on the device? The app does not implement a custom URL Scheme.</p>
| iphone | [8] |
5,025,166 | 5,025,167 | I want to sum the total Elapsed time through input text file? | <p>I want to sum the total "Elapsed time" for "GSA Search" only, using C sharp :</p>
<p>Following is my log file :</p>
<pre><code>WX Search = Server:nomos-scanner.corp.com User:vibsharm appGUID: wx Elapsed Time:975ms SaveSearchID:361
WX Search = Server:nomos-scanner.corp.com User:vibsharm appGUID: wx Elapsed Time:875ms SaveSearchID:361
GSA Search = Server:nomos-scanner.corp.com User:gulanand appGUID: wx Elapsed Time:890ms SaveSearchID:361
GSA Search = Server:nomos-scanner.corp.com User:vibsharm appGUID: wx Elapsed Time:887ms SaveSearchID:361
GSA Search = Server:nomos-scanner.corp.com User: gulanand appGUID: wx Elapsed Time:875.5ms SaveSearchID:361
GSA Search = Server:nomos-scanner.corp.com User:vibsharm appGUID: wx Elapsed Time:877.6ms SaveSearchID:361
</code></pre>
<p>Code i have tried is :</p>
<pre><code>string searchKeyword = "WX GSA Search";
string fileName = @"C:\Users\karan\Desktop\Sample log file.txt";
string[] textLines = File.ReadAllLines(fileName);
List<string> results = new List<string>();
foreach (string line in textLines)
{
if (line.Contains(searchKeyword))
{
results.Add(line);
}
}
string x = string.Join(",", results);
List<string> time = new List<string>();
Regex regex = new Regex(@"Elapsed Time:(?<timevalue>\d+(?:\.\d)?)ms");
MatchCollection matches = regex.Matches(x);
foreach (Match match in matches)
{
var value = match.Groups["timevalue"].Value;
if (!time.Contains(value)) time.Add(value);
}
</code></pre>
| c# | [0] |
4,654,821 | 4,654,822 | Unload AppDomain Assembly | <p>I want to read some information from a .Net assembly, then modify the DLL by appending a short sequence of characters.<br>
The first part works fine, but the second step fails, as the assembly is still in use.<br>
This is the case although I loaded the assembly in its own AppDomain and after I finished step 1 unloaded the AppDomain.</p>
| c# | [0] |
1,255,035 | 1,255,036 | Is there a way to recognize the visit from user's iphone and automatically adjust web page to fit iPhone screen size? | <p>I wonder if there is a way to recognize the visit from user's iphone and automatically adjust web page to fit iPhone screen size?</p>
| iphone | [8] |
4,714,484 | 4,714,485 | Unable to post link on reddit | <p>In my app i want to post a link to Reddit. Iam using reddit api for submitting link but always get BAD_CAPTCHA error.
Ive received modhash, captcha_id, but while i submit it again, it still shows BAD_CAPTCHA error.</p>
| iphone | [8] |
598,004 | 598,005 | how to draw line with animation? | <p>I have implemented game application in which i want to draw line between two object.I have drawn line between two objects.But i want to draw with animation.can u advise me which animation i have to used between two points.</p>
<p>Edit:My excatly question is that:
Suppose there is two point like start point(100,100) and endpoint(300,300).I can draw line between this two point but i want to draw line with animation.I mean i can see line start from start point to end point with 2 secon duration.please help me about this question. </p>
| iphone | [8] |
2,503,897 | 2,503,898 | Black screen when device orientation changed | <p>I'm developing an application in android 2.2.</p>
<p>When change the device orientation (by rotate the device) an black screen is painted in the bounds of my Activity (there is no even the Activity title), it takes some seconds (7-15 seconds) and then the activity is finally painted.</p>
<p>I have tested it emulator and two different devices and the behavior is the same.</p>
<p>In LogCat I have the next output:</p>
<pre><code>02-02 09:18:06.044: WARN/WindowManager(1300): MyActivity freeze timeout expired.
02-02 09:18:06.044: WARN/WindowManager(1300): Force clearing freeze: AppWindowToken{4515af88 token=HistoryRecord{44f52458 com.project.package/.MyActivity}}
02-02 09:18:08.054: WARN/WindowManager(1300): Window freeze timeout expired.
02-02 09:18:08.054: WARN/SurfaceFlinger(1300): timeout expired mFreezeDisplay=1, mFreezeCount=0
02-02 09:18:08.054: WARN/WindowManager(1300): Force clearing orientation change: Window{45178a00 com.project.package/com.project.package.Activity paused=false}
</code></pre>
<p>I don't know why is it happening.
Thanks for the comments, suggestion, answers.</p>
| android | [4] |
5,300,760 | 5,300,761 | URL query clearing php code problem | <p>This is the code that im using for clear any queries in my url..</p>
<pre><code><?php
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
$pageURL = substr( $pageURL, 0, strrpos( $pageURL, "?"));
}
return $pageURL;
}
?>
</code></pre>
<p>this clears </p>
<blockquote>
<p>www.mydomian.com/myurl.html?<strong><em>*</em>****</strong></p>
</blockquote>
<p>result is </p>
<blockquote>
<p>www.mydomian.com/myurl.html</p>
</blockquote>
<p>Its done....but the thing it when its come with normal URL </p>
<blockquote>
<p>www.mydomian.com/myurl.html</p>
</blockquote>
<p>The result is EMPLTY,NO RESULT !
BUT i want as it is..
no change..</p>
<blockquote>
<p>www.mydomian.com/myurl.html</p>
</blockquote>
<p>i want the result normall url as it is...
Thank You! </p>
| php | [2] |
4,447,508 | 4,447,509 | Are there PHP browsers? | <p>Do browsers exist that would allow a person on a Mac to view a PHP file without uploading it and without having it enabled(And having no possibility of enabling it)?</p>
<p>I wasn't asking about how to run it without a server. I was asking about whether a file browser exists that allows me to see the output of the file instead of the source code, if installing anything is not an option.</p>
| php | [2] |
2,688,444 | 2,688,445 | Get index by specific search term with a list in c# | <p>I have a list as follows:</p>
<pre><code>Cat, Green, 10
Cat, Green, 1
Dog, Red, 4
Cat, Blue, 2
</code></pre>
<p>Each item is just a comma seperated string element in a list.</p>
<p>I would like to get all the index values of all the elements in the above list that contain cat and 10 or contain cat and 2. So basically i should get the index values 0 and 3 returned from the query on the list. Can anyone show me how i can do this?</p>
| c# | [0] |
3,202,700 | 3,202,701 | Referenced Assemblies in Web Site | <p>Am I correct in assuming that I always need to explicitly deploy referenced assemblies when their source changes?</p>
| asp.net | [9] |
3,559,110 | 3,559,111 | How to determine whether the phone is ringing or making any other sound? | <p>I'm writing a recording application for sound measurements. I need find out if the phone is making any sound (ringing, incoming sms, music playing, ...) and whether the user is dialing. In that case, the measurements are temporally stopped and automatically resumed afterwards. Also vibration may influence the measurements, so I'd like to know that as well.</p>
<p>Any ideas how this can be found out? Thanks</p>
| android | [4] |
5,639,623 | 5,639,624 | Is is possible to dynamically load a user control at runtime based on a condition within an UpdatePanel? | <p>I need to conditionally load a few nested user controls on a webpage based on a dropdown selection that fires a callback. Is this possible? Are there any best practices for such an approach?</p>
| asp.net | [9] |
3,879,187 | 3,879,188 | Integrating QRCode decoder SDK for android to eclipse | <p>please tell me the procedure for Integrating QRCode decoder SDK for android to eclipse</p>
| android | [4] |
1,811,634 | 1,811,635 | With two <form>'s on a page, how to you make jQuery only run the functions on one (without using IDs)? | <p>Now I know this sounds elementary, but I honestly can't dial this in. I have two forms on a single page. I wrote some form validating functions that are triggered as such: </p>
<pre><code>$("form").submit(function(event) {
event.preventDefault();
checkRequired();
checkLengths();
checkFormats();
checkErrors();
});
</code></pre>
<p>This is awesome, but inside the functions, I cannot use <code>$(this)</code> to identify the <code><form></code> from which the submit button was clicked.</p>
<p>Let's say I wrote <code>alert($(this).attr('id'));</code> in the <strong>checkRequired()</strong> function. It alerts "<strong>Object, object</strong>".</p>
<p>If I place the same code inside the <code>$("form").submit()</code> function, it returns my form's id.</p>
<p>The selectors inside the functions are things like <code>$("input[type='text']")</code> and similar, but the functions run on all the inputs, not just the ones in the form that was submitted.</p>
<p><strong>Sample function() used:</strong></p>
<pre><code>function checkFormats() {
alert("Checking Formats...");
$(".email").each(function(){
alert("Checking Formats: Email...");
var emailField = $(this).children("input[type='text']");
var strEmail = emailField.val();
if( strEmail.indexOf( "@" ) == -1 ) {
alert("What the hell?");
}
});
}
</code></pre>
<p>I'm sure I'll feel dumb when I hear the solution, but hey, I'm overly-tired lol... Thanks in advance!</p>
<p><strong>Thinking maybe <code>$("form",this)</code> may get me somewhere?</strong></p>
| jquery | [5] |
1,629,081 | 1,629,082 | Loading a button on page load | <p>I'm working on a site, and need help with this JavaScript notification thing I found.</p>
<p>So, basically, you click a button and a notification will appear. Here's the code:</p>
<pre><code><button id="timeout">Notification with Timeout</button><br />
</code></pre>
<p>So, instead of having to click the button anyways, I can have the Notification load with the page. Similar to the Body Onload code.</p>
<p>Edit:</p>
<p>When You Click The above Button. A Notification Will Apear On The Side of the page. Instead of clicking the button to load the notification i would like it to come up when the page is done loading.</p>
| javascript | [3] |
2,684,066 | 2,684,067 | Converting Zero to null in Dataset or DataTable | <p>I have a Dataset with 3 DataTables in which there are many fields with have zeros, now i wanted to convert the fields which have zero to NULL. Any idea pls help</p>
| c# | [0] |
1,705,392 | 1,705,393 | Sending message from a application on one mobile device to another application on another device | <p>Hi I want to send message from one application (which will be installed on android mobile) to
another application (which will be installed on another mobile). This means</p>
<p>One mobile ------------sends message-------- >to another mobile.</p>
<p>Similarly I want second mobile to send----------message ----- to first mobile.</p>
<p>If I use sms to send message I think it will be saved in the sms box and so the user can read
the message. I want to hide the message . So is there any way I can send message directly from
one application to another.</p>
| android | [4] |
2,109,758 | 2,109,759 | How do I change my new list without changing the original list? | <p>I have a list that gets filled in with some data from an operation and I am storing it in the memory cache. Now I want another list which contains some sub data from the list based on some condition. </p>
<p>As can be seen in the below code I am doing some operation on the target list. The problem is that whatever changes I am doing to the target list is also being done to the mainList. I think its because of the reference is same or something.</p>
<p>All I need is that operation on the target list not affect data inside the main list.</p>
<pre><code>List<Item> target = mainList;
SomeOperationFunction(target);
void List<Item> SomeOperationFunction(List<Item> target)
{
target.removeat(3);
return target;
}
</code></pre>
| c# | [0] |
5,612,975 | 5,612,976 | Mixed float and long calculation yields wrong answer with no compiler warning | <p>Is it surprising that the following code outputs a wrong value for startTime?</p>
<pre><code>public class Temp {
public static void main(String args[]){
float duration = (float) 2.0;
long endTime = 1353728995;
long startTime = 0;
startTime = (long) (endTime - duration);
System.out.println(startTime);
}
}
</code></pre>
| java | [1] |
402,380 | 402,381 | how to pass a variable to a UIButton action | <p>I want to pass a variable to a UIButton action, for example</p>
<pre><code>NSString *string=@"one";
[downbutton addTarget:self action:@selector(action1:string)
forControlEvents:UIControlEventTouchUpInside];
</code></pre>
<p>and my action function is like</p>
<pre><code>-(void) action1:(NSString *)string{
}
</code></pre>
<p>However, it returns a syntax error.
Can someone show me how to pass a variable to a UIButton action?</p>
| iphone | [8] |
1,315,947 | 1,315,948 | how to retreive value from div | <p>here is my html and jquery and when the page loads i'm supposed to get an alert box with the value 10 but instead i get nothing. what am i doing wrong?</p>
<pre><code><html>
<head>
<script src="js/jquery-1.4.4.min.js" type="text/javascript"></script>
<script type="text/javascript">
val = $("#t").text();
alert(val);
</script>
</head>
<body>
<div id="t">10</div>
</body>
</html>
</code></pre>
| jquery | [5] |
5,582,328 | 5,582,329 | Error While Reading the file /C:/Users/Lulzim/Cities.txt (No such file or directory) | <p>what about this code, this is not working too??
What is wrong here??</p>
<pre><code>FileInputStream fis;
final StringBuffer storedString = new StringBuffer();
try {
fis = openFileInput("C:/Users/Lulzim/Cities.txt");
DataInputStream dataIO = new DataInputStream(fis);
String strLine = null;
while ((strLine = dataIO.readLine()) != null) {
storedString.append(strLine);
System.out.println("reading...");
}
dataIO.close();
fis.close();
}
catch (Exception e) {
System.out.println("error reading file...");
}
}}
</code></pre>
<p>this one is not working as well...</p>
| android | [4] |
5,159,360 | 5,159,361 | Usb port no longer recognizes android | <p>Usb port no longer works to program android. My computer recognizes it as a wireless tether (I think because my wireless goes out whenever I plug the phone in)</p>
<p>I'm at a loss to what to do. The problem is with my eclipse or computer because I can still target my android on a friend's computer running eclipse.</p>
<p>Thank you!</p>
| android | [4] |
4,595,137 | 4,595,138 | scrolling vertically | <p>i am using the following code to scroll image on scrooll view,</p>
<pre><code>StoryViewScroller = [[[UIScrollView alloc] initWithFrame:CGRectMake(0.0f, 79.0f, 320.0f, 262)] autorelease];
StoryViewScroller.contentSize = CGSizeMake(NPAGES * 320.0f, StoryViewScroller.frame.size.height);
StoryViewScroller.pagingEnabled = YES;
StoryViewScroller.delegate = self;
StoryViewScroller.showsHorizontalScrollIndicator = NO;
StoryViewScroller.scrollsToTop = YES;
// Load in all the pages
for (i = 0; i < NPAGES; i++)
{
NSString *filename = [NSString stringWithFormat:@"%d.jpg", i+1];
UIImageView *iv = [[UIImageView alloc] initWithImage:[UIImage imageNamed:filename]];
iv.frame = CGRectMake(i * 320.0f, 0.0f, 320.0f, 262);
[StoryViewScroller addSubview:iv];
NSLog(@"I is :: %d" ,i);
[iv release];
}
[self.view addSubview:StoryViewScroller];
</code></pre>
<p>this enable mein tos scroll view from left to right and vice versa.what should i change to sroll view to top to bottom and vice versa.</p>
<p>sugggestions</p>
<p>regards</p>
| iphone | [8] |
5,763,623 | 5,763,624 | All phone numbers of one contact for startActivityForResult | <p>A contact may have many phone numbers (mobile, home, ..). I want to enable the user to pick one of the phone numbers of a specific contact.</p>
<p>With this snippet I get the list of all phone numbers for each contact.</p>
<pre><code>Intent intent = new Intent(Intent.ACTION_PICK,
ContactsContract.CommonDataKinds.Phone.CONTENT_URI);
startActivityForResult(intent, PHONE_NUMBER_PICKED);
</code></pre>
<p>How can I list only the phone numbers of one contact?</p>
<p>Edit: I know how to get all phone numbers of a contact, that's not the point. I could put all phone numbers in a listview and get the user to pick one. But this functionality exists (mentioned above), I just don't want all numbers, but only the phone numbers for one contact. </p>
| android | [4] |
1,725,787 | 1,725,788 | ASP.NET Page_Init Fired Twice! | <p>I have AutoEventWireup="true" and in my code behind</p>
<pre><code>protected void Page_Init(object sender, EventArgs e)
{
}
</code></pre>
<p>When I'm debugging, the Page_Init method is getting fired twice!</p>
<p>Whats going on?</p>
| asp.net | [9] |
1,038,715 | 1,038,716 | Issue with rules overlapping | <p>I have 2 checkbox rules that are overlapping.
This one runs first</p>
<pre><code>$("#BMFNP").change(function() {
if($(this).is(":checked") && $("#INTEF").is(":not(:checked)")) {
$("#INTEF").attr("checked", true);
alert("foo");
}
});
</code></pre>
<p>This one runs second:</p>
<pre><code>$("#BMFNP").change(function() {
if($(this).is(":checked") && $("#INTEF").is(":checked")) {
alert("bar");
}
});
</code></pre>
<p>So basically the first one runs if BMFNP is checked, and INTEF isn't it checks INTEF and runs the alert. At that time, both are checked so it runs the second function. How can I fix this? I need both to work and display different messages for each situation, if BMFNP is checked, INTEF isn't check INTEF and alert it has been added and BMFNP can only do xxxxx. If both are checked, simply alert that BMFNP can only do xxxx, no need to alert it has been added.</p>
<p>Thanks,</p>
| jquery | [5] |
3,280,263 | 3,280,264 | Is there a list of "best practices" for Android games? | <p>I'm writing my first Android game, and though the game itself is working well, I'm not too sure about some of the Android integration aspects of it. Specifically:</p>
<ul>
<li>Should I provide an in-game volume control?</li>
<li>Should I hide the status bar?</li>
<li>Is the Menu button generally used to pause the game, or should I provide an on-screen control for this?</li>
<li>etc.</li>
</ul>
<p>Basically I just want my game to do everything the "standard" way. I don't want to frustrate users. Is there some resource (official or not) that lists recommendations for such things? Alternatively, can anyone give me a few important guidelines?</p>
| android | [4] |
2,976,337 | 2,976,338 | SMS Sender's Name Shows as labuser in Default SMS App | <p>I installed the following code on my Android 2.2 phone and the sender's name shows as labuser for some messages when it is actually something else :-</p>
<pre><code>public class SMSReaderActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ListView myListView = (ListView) findViewById(R.id.myListView);
final ArrayList<String> smses = new ArrayList<String>();
final ArrayAdapter<String> aa = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, smses);
myListView.setAdapter(aa);
Context context = getApplicationContext();
Cursor cursor = context.getContentResolver().query(
Uri.parse("content://sms/inbox"),
new String[] { "address", "person", "date", "body" }, null,
null, "date desc");
cursor.moveToFirst();
int count = cursor.getCount();
for (int j = 0; j < count; j++) {
String msg = cursor.getString(0) + ", " + cursor.getString(1)
+ ", " + cursor.getLong(2) + ", " + cursor.getString(3);
Log.w("SMS", "Read SMS:" + msg);
if (cursor.getString(3).indexOf("rbs") >= 0) {
smses.add(msg);
Log.w("SMS", "Added");
}
cursor.moveToNext();
}
cursor.close();
aa.notifyDataSetChanged();
}
</code></pre>
<p>labuser is not an a/c on my development machine and this happens with only matching smses. I cannot figure out the source of this.</p>
<p>Thanks
Himanshu</p>
| android | [4] |
427,326 | 427,327 | I need to disable Home Key or perform some activity when home key is pressed in android | <p>I need perform some action on press of home key like starting activity when some one presses the home key...how to do it?</p>
| android | [4] |
3,558,718 | 3,558,719 | how to isolated string that contain TAB? | <p>i have this string:</p>
<pre><code>i[TAB]like[TAB]Stackoverflow
</code></pre>
<p>and i need to get this:</p>
<pre><code>i
like
Stackoverflow
</code></pre>
<p>how to do it in C# ?</p>
<p>thanks in advance</p>
| c# | [0] |
5,245,401 | 5,245,402 | Designing full screen graphics for different Android devices | <p>I am a experienced iOS developer but I am totally new to Android. I have to develop a Android app with a full screen background image and various images that has to fit the screen quite well. Now on iOS we live in a "protected" world where this is easy as I know the screen size of every device, but on Android that is very different I think. I have read about the small/normal/large/xlarge and ldpi/mdpi/hdpi/xhdpi structure, but I cant find anything on designing a full screen image that works well across devices with different sizes and ratios. How would I go and do that? I mean, what image size should I make for e.g. a normal+hdpi device to make it look good? The images must not be distorted (so the ratio must not be changed) but I can live with them being shrinked in size. Should I add some "space" to the image in top/bottom or sides to make it work well? How is this done best?</p>
<p>Thank you
<br>Søren</p>
| android | [4] |
1,903,868 | 1,903,869 | Prevent direct access PHP | <p>I have 2 script. That's :</p>
<ol>
<li>registration.html</li>
<li>process_registration.php</li>
</ol>
<p>Sometimes someone open the link direct into process_registration.php, so how can I prevent that ?</p>
<p>Process_registration.php function is to save the data get from input from registration.html.</p>
<p>Any idea ?</p>
| php | [2] |
399,488 | 399,489 | Jcrop in .dialog() | <p>I make Jcrop inside .dialog() function. runs great, but i can't pass my X and Y, etc. values!</p>
<p>function "updateCoords" works, but i cant passe it values throe Ajax! Fire Bug say that variables that I want to passe throe POST are not defined, but "HOW!" - i define variables in function updateCoords()! XD</p>
<pre><code>function open_original(gallery_id, image_name){
$("#image_crop_canves").dialog({
modal:true,
width:634,
height:741,
buttons:{
"SAVE":function(){
$.ajax({
url: "send.php",
type: "POST",
data: "a=crop&x="+cx+"&y="+cy+"&w="+cw+"&h="+ch+"&gid="+gallery_id+"&id="+image_name,
success: function(){
$("#image_crop_canves").dialog('close');
window.location();
}
});
},
"CLOSE":function(){
$("#image_crop_canves").dialog('close');
}
}
});
$("#image_crop").html("<div id=\"image_holder_crop\"><img id=\"cropbox\" src=\"../../pics/gallery/" + gallery_id + "/original/" + image_name + "\" /></div>");
$("#image_crop_canves").dialog('open');
function updateCoords(c) {
var cx = c.x;
var cy = c.y;
var cx2 = c.x2;
var cy2 = c.y2;
var cw = c.w;
var ch = c.h;
}
$('#cropbox').Jcrop({
aspectRatio: 140/360,
onSelect: updateCoords,
setSelect: [0, 0, 140, 360],
minSize: [140, 360]
});
}
</code></pre>
| jquery | [5] |
4,870,398 | 4,870,399 | How to save a seach Query (Copying the file and Saving ) | <p>I want to copy the file <a href="http://searchr.us/Testing/web-search.phtml?search=SEARCHED+TEXT" rel="nofollow">http://searchr.us/Testing/web-search.phtml?search=SEARCHED+TEXT</a> to
<a href="http://searchr.us/Testing/search/SEARCHED+TEXT.html" rel="nofollow">http://searchr.us/Testing/search/SEARCHED+TEXT.html</a></p>
<p>How do i do this.</p>
<p>NOTE:The source of <a href="http://searchr.us/Testing/search/SEARCHED+TEXT.html" rel="nofollow">http://searchr.us/Testing/search/SEARCHED+TEXT.html</a> should be the same as <a href="http://searchr.us/Testing/web-search.phtml?search=SEARCHED+TEXT" rel="nofollow">http://searchr.us/Testing/web-search.phtml?search=SEARCHED+TEXT</a></p>
<p>Indirectly I'm just saving a query so that i can keep a track of them !</p>
| php | [2] |
5,292,674 | 5,292,675 | Update Combobox according to co-ordinate in a GridCell | <p>I attached a <strong>combobox</strong> in a <strong>GridViewCell</strong> with <strong>combox.Location property</strong>.But,I have mutiple combobox.While updating combox item/value,Changed selected item is not seen in the GridCell.How can I update the combo according to Location?</p>
| c# | [0] |
2,253,478 | 2,253,479 | Check if redirect from other url | <p>Let's say my site is example.com people can visit by directly type in "example.com" in the browser to open it up.</p>
<p>However I want to check if people visit my site from other sources, like google or other referrals. Then I'd like to add jquery modal for those visitors. Is it doable? Thanks!</p>
| jquery | [5] |
3,616,977 | 3,616,978 | Android - Rotate Dial | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/7491579/android-rotate-image-around-center-point">Android - Rotate image around center point?</a> </p>
</blockquote>
<p>I need a dial button in my app, so the user can rotate the dial when they drag there finger across it. Does anyone have a nice example?</p>
| android | [4] |
5,298,644 | 5,298,645 | How to display the items from a dictionary in a random order but no two adjacent items being the same | <p>First of all, there is actually more restrictions than stated in the title. Plz readon.</p>
<p>say, i have a <code>dictionary<char,int></code> where key acts as the item, and value means the number of occurrence in the output. (somewhat like weighting but without replacement)
e.g. ('a',2) ('b',3) ('c',1)</p>
<p>a possible output would be 'babcab'</p>
<p>I am thinking of the following way to implement it.</p>
<ol>
<li>build a new list containing (accumulated weightings,char) as its entry.</li>
<li>randomly select an item from the list, </li>
<li>recalculate the accumulated weightings, also set the recent drawn item weighing as 0.</li>
<li>repeat.</li>
</ol>
<p>to some extent there might be a situation like such: 'bacab' is generated, but can do no further (as only 'b' left, but the weighting is set to 0 as no immediate repetition allowed). in this case i discard all the results and start over from the very beginning.</p>
<p>Is there any other good approach?</p>
<p>Also, what if i skip the "set the corresponding weighting to 0" process, instead I reject any infeasible solution. e.g. already i got 'bab'. In the next rng selection i get 'b', then i redo the draw process, until i get something that is not 'b', and then continue. Does this perform better?</p>
| c# | [0] |
1,250,593 | 1,250,594 | Why this friend function can't access a private member of the class? | <p>I am getting the following error when I try to access bins private member of the <code>GHistogram</code> class from within the <code>extractHistogram()</code> implementation:</p>
<pre><code>error: 'QVector<double> MyNamespace::GHistogram::bins' is private
error: within this context
</code></pre>
<p>Where the 'within this context' error points to the <code>extractHistogram()</code> implementation. Does anyone knows what's wrong with my friend function declaration?</p>
<p>Here's the code:</p>
<pre><code>namespace MyNamespace{
class GHistogram
{
public:
GHistogram(qint32 numberOfBins);
qint32 getNumberOfBins();
/**
* Returns the frequency of the value i.
*/
double getValueAt(qint32 i);
friend GHistogram * MyNamespace::extractHistogram(GImage *image,
qint32 numberOfBins);
private:
QVector<double> bins;
};
GHistogram * extractHistogram(GImage * image,
qint32 numberOfBins);
} // End of MyNamespace
</code></pre>
| c++ | [6] |
5,012,937 | 5,012,938 | Why can't I loop through each of the table rows loaded dynamically in Jquery? | <p>The table I am working with is loaded at runtime via ajax, I am trying to loop through all the rows in the table, using the code below:</p>
<pre><code>alert("here"+jQuery('#contentItems table.tablesorter table tbody tr')); //I get here[Object object]
jQuery('#contentItems table.tablesorter table tbody tr').each(function(){
alert("test");
});
</code></pre>
<p>I get the first alert, but no alerts for <code>test</code>. </p>
<p>Oh and this code is running from the document's mouseup event.</p>
<p>Any suggetions?</p>
| jquery | [5] |
3,558,344 | 3,558,345 | ASP simple image uploader | <p>Is there a method inside ASP.Net to let me upload images or files in a very minimum script files?</p>
<p>Basically im looking for a script that will let me upload files or script by bulk on my server but there are few constrains on my server, like I don't have access on database I also don't have an access to an FTP account and my web hosting provider just provided me a web interface to upload files one-by-one. </p>
<p>I am hoping I can override their system by uploading few ASP files on their server and running those to have my own uploader then I can use it to upload my own files in bulk.</p>
| asp.net | [9] |
5,403,293 | 5,403,294 | C# Variable Getters / Setters | <p>I'm trying to create a simple way for external programs to get/set variables within my class. What I have is a class with several variable such as this:</p>
<pre><code>class myClass
{
public int one
{
get{ /* get code here */ }
set{ /* set code here */ }
}
}
</code></pre>
<p>Rather than just variable 'one' I have close to 100 variables. All are set up the same way with get and set code. What I would like to have is a simple way to get and set the variables. Example: Instead of having to do this:</p>
<pre><code>myClass c = new myClass();
c.one = 5;
</code></pre>
<p>I would like to find a way to do something similar to this:</p>
<pre><code>myClass c = new myClass();
c.setVariable("variableName", value);
</code></pre>
<p>It would be ideal to have the "variableName" text come from an enum list so that they could be referenced like:</p>
<pre><code>c.setVariable(enumName.varName, value);
</code></pre>
<p>I am unsure how to go about this or if it is even possible. As I said i have close to 100 variables which need their own get/set code, but I'd prefer to have only one public get function and one public set function for various reasons.</p>
<p>As I don't think reflection is very efficient, I'd like to avoid it if at all possible.</p>
<p>I've seen other code in C# where something like this is used:</p>
<pre><code>this["variableName"] = value;
</code></pre>
<p>However I can't seem to find a way to make this work either...</p>
| c# | [0] |
135,965 | 135,966 | Make a custom listview | <p>I'm going to make a custom <code>ListView</code> with icon and label of applications installed on Android device I made some code but I don't know why when I run the application my <code>ListView</code> is empty here is the codes :</p>
<pre><code>public class MainActivity extends Activity {
ArrayList<String> AppLabel = new ArrayList<String>();
ArrayList<Drawable> AppIcon = new ArrayList<Drawable>();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final ListView MyListView = (android.widget.ListView) findViewById(R.id.listView1);
EditText MyEditText = (android.widget.EditText) findViewById(R.id.textView1);
CustomAdapter Adapter = new CustomAdapter(this, android.R.layout.simple_list_item_multiple_choice,
MyEditText, AppLabel);
MyListView.setAdapter(Adapter);
PackageManager pm = this.getPackageManager();
List<ApplicationInfo> apps = pm.getInstalledApplications(0);
for(ApplicationInfo app : apps) {
String Label = (String)pm.getApplicationLabel(app);
AppLabel.add(Label);
Drawable Icon = pm.getApplicationIcon(app);
AppIcon.add(Icon);
}//End for
Adapter.notifyDataSetChanged();
}//end onCreate
class CustomAdapter extends ArrayAdapter<string>{
public CustomAdapter(Context context, int resource,
EditText myEditText, ArrayList<String> appLabel) {
super(context, resource);
}
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
if (row==null) {
LayoutInflater Inflater = getLayoutInflater();
row = Inflater.inflate(R.layout.item_layout, parent, false);
}//End if
EditText MyEditText = (android.widget.EditText) findViewById(R.id.textView1);
MyEditText.setText(AppLabel.get(position));
ImageView MyImageView = (ImageView) findViewById(R.id.imageView1);
MyImageView.setImageDrawable(AppIcon.get(position));
return (row);
}//End get view
}//End CustomAdapter Class
}//end Main Class
</code></pre>
| android | [4] |
2,292,262 | 2,292,263 | adding custom library with project | <p>I have created one library with "Utility.h" file. I want to add that custom library to my another iPhone application. I have added the library to project "frameworks" and I have drag the library to "Library Search Path" it shows like "$(SRCROOT)/libUtility.a". I have imported the header file as #import "Utility.h". But I am getting below error message.</p>
<p>Utility.h No such file or directory.</p>
<p>Please any one help me to resolve this issues.</p>
<p>What is my mistake.</p>
| iphone | [8] |
327,594 | 327,595 | Why does my application keep getting "The application <ClassName> (<package.ClassName>) has stopped unexpectedly. Please try again later." error? | <p>I followed the developer guides on the Android website. It is working fine for a Hello World application but when I try and transition between Activities, my application keeps giving an "The application () has stopped unexpectedly. Please try again later." error and the application then quits. <strong>This happens when I click the button in the Subscribe Activity.</strong> </p>
<p><strong>Subscribe.java</strong></p>
<pre><code>public class Subscribe extends Activity
implements OnClickListener {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.subscribe);
Button subButton = (Button)findViewById(R.id.subscribe);
subButton.setOnClickListener(this);
}
public void onClick(View v) {
Intent subIntent = new Intent(Subscribe.this,Subscribed.class);
startActivity(subIntent);
}
}
</code></pre>
<p><strong>Subscribed.java</strong></p>
<pre><code>public class Subscribed extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.subscribed);
}
}
</code></pre>
<p><a href="http://www.cise.ufl.edu/~cheenu/logcat.rtf" rel="nofollow">Logcat Log File</a></p>
| android | [4] |
2,834,332 | 2,834,333 | how to read returned values from sql function | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/706361/getting-return-value-from-stored-procedure-in-c-sharp">Getting return value from stored procedure in C#</a> </p>
</blockquote>
<p>im using the following sql function in a c# winform application</p>
<pre><code>create function dbo.GetLookupValue(@value INT)
returns varchar(100)
as begin
declare @result varchar(100)
select
@result = somefield
from
yourtable
where
ID = @value;
return @result
end
</code></pre>
<p>my question is: how can i read the returned @result in c#? </p>
| c# | [0] |
5,665,854 | 5,665,855 | Python: truncate and pad using format specification mini language | <p>I'm currently writing code which pads a string with spaces, using Python's <a href="http://docs.python.org/2/library/string.html#formatspec" rel="nofollow">format specification mini language</a>:</p>
<pre><code>print('''{user:<10}, you're wellcome!'''.format(user='John Doe'))
</code></pre>
<p>The output is:</p>
<pre><code>John Doe , you're wellcome!
</code></pre>
<p>However, if user is something like 'Joooooooooooohn Doe', I'd like it to behave like:</p>
<pre><code>Jooooooooo, you're wellcome!
</code></pre>
<p>Is there a way to perform truncation AND padding using the format specification mini language?</p>
<p>Thanks!</p>
| python | [7] |
3,296,005 | 3,296,006 | How to figure out if two CGRect intersect? | <p>In -drawRect: I want to check if the provided rect intersects with anotherRect.</p>
<p>I'm not good at this geometry math stuff and especially at english so what I want to say is:</p>
<p>If you have two sheets of paper on the desk, and one of them covers the other either completely or just a small portion, it is rectsIntersect = YES.</p>
<p>How to check that out for <code>rect</code> and <code>anotherRect</code>?</p>
| iphone | [8] |
1,933,014 | 1,933,015 | Log statements in JAVA | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2342280/difference-between-logger-info-and-logger-debug">difference between logger.info and logger.debug</a> </p>
</blockquote>
<p>When I should use Log.INFO and Log.DEBUG to print log statements in JAVA?
Can I have some example for these Logs.
I also need a clarification with the log, while displaying Balance whether I need to use Log.INFO or Log.DEBUG</p>
<pre><code>Log.write("BALANCE"+bal, Log.INFO);
</code></pre>
| java | [1] |
2,198,663 | 2,198,664 | Giving another apps access to my app's file | <p>I'm geting a file from server, and storing it on the phone. It's a PDF. Then I need to display . Assuming that I have a PDF viewer it will open the file. </p>
<p>The question is where should I store the PDF file so my pdf reader has access to it. I don't really want use external storage since not all phones has one. Is there a way to save public file on internal storage?</p>
<p>Or there is some way to pass the necessary information using <a href="http://developer.android.com/reference/android/content/ContentProvider.html" rel="nofollow">ContentProvider</a>. Unfortunately I would need some sample code of that.</p>
| android | [4] |
2,196,251 | 2,196,252 | how do i select array elements with specific values and perform function javascript | <p>I have an array with several items inside and one of them is location .some of those locations are empty inside with no value. I want to take every one of those empty locations and perform a function . Does any know how to do that?</p>
<p>The array might look like this:</p>
<pre><code>array=[{user:a,user_id:b,date:c,profile_img:d,text:e,contentString:f,url:g,location:""},
{user:a,user_id:b,date:c,profile_img:d,text:e,contentString:f,url:g,location:""}];
</code></pre>
| javascript | [3] |
1,544,576 | 1,544,577 | Java Remote File Options | <p>I've recently started an internship and I'm having some issues with Java in the enterprise environment. I've been assigned the task of porting the functionality of an old windows shell script to java so it may be ran on one of our JVMs.</p>
<p>The shell script runs on one of the Windows servers and grabs the previous days log files from a couple of linux boxes then FTPs them to another Windows machine. </p>
<p>I'm not quite sure how to achieve this functionality using java. I only can SSH into the linux boxes. I have got the connection working for the Windows file share, just not sure of the best way to connect to the linux boxes. </p>
<p>I've considered using one of the SSH libraries, but would prefer to avoid using a third party library. </p>
<p>Any insight would be great. Thanks!</p>
| java | [1] |
2,186,093 | 2,186,094 | jQuery change property on load | <p>I have this HTML</p>
<pre><code> <div id="navContainer">
<ul>
<li class="selected"><a href="#">Home</a></li>
<li><a href="#">Services</a></li>
</ul>
</div>
</code></pre>
<p>And I want to change the top border of the li next to the selected one (in this case 'Services'). I have this jQuery but it does not work.</p>
<pre><code>$(document).ready(function(){
alert($("#navContainer .selected").next().html()); // This alerts: <a href="#">Services</a>
$("#navContainer .selected").next().css("border-top-color","#7d7d7d"); // This doesn't do anything
});
</code></pre>
<p>Am I doing something wrong?</p>
<p>Thanks in advance!</p>
| jquery | [5] |
3,129,713 | 3,129,714 | Javascript - Call a function when i send a from trought an href | <pre><code><form onSubmit="return loadingArtP();" action="./index.php?status=addarticle" enctype="multipart/form-data" method="post" name="addarticle">
// some input parameters
<a href="javascript:document.addarticle.submit()">Add</a>
</form>
</code></pre>
<p>When i click on "Add" i need to call the loadingArtP() function before send the form, but it doesnt work. How can do it?</p>
| javascript | [3] |
953,087 | 953,088 | What's a good way to provide additional decoration/metadata for Python function parameters? | <p>We're considering using Python (IronPython, but I don't think that's relevant) to provide a sort of 'macro' support for another application, which controls a piece of equipment.</p>
<p>We'd like to write fairly simple functions in Python, which take a few arguments - these would be things like times and temperatures and positions. Different functions would take different arguments, and the main application would contain user interface (something like a property grid) which allows the users to provide values for the Python function arguments.</p>
<p>So, for example function1 might take a time and a temperature, and function2 might take a position and a couple of times.</p>
<p>We'd like to be able to dynamically build the user interface from the Python code. Things which are easy to do are to find a list of functions in a module, and (using inspect.getargspec) to get a list of arguments to each function.</p>
<p>However, just a list of argument names is not really enough - ideally we'd like to be able to include some more information about each argument - for instance, it's 'type' (high-level type - time, temperature, etc, not language-level type), and perhaps a 'friendly name' or description.</p>
<p>So, the question is, what are good 'pythonic' ways of adding this sort of information to a function.</p>
<p>The two possibilities I have thought of are:</p>
<ul>
<li><p>Use a strict naming convention for arguments, and then infer stuff about them from their names (fetched using getargspec)</p></li>
<li><p>Invent our own docstring meta-language (could be little more than CSV) and use the docstring for our metadata.</p></li>
</ul>
<p>Because Python seems pretty popular for building scripting into large apps, I imagine this is a solved problem with some common conventions, but I haven't been able to find them.</p>
| python | [7] |
34,629 | 34,630 | What is the difference between add 'text' property or directly use within tags? | <p>for example :</p>
<p>what is the exact difference between following statements:</p>
<pre><code> <asp:TextBox ID="TextBox1" runat="server">hi</asp:TextBox>
</code></pre>
<p>and</p>
<pre><code> <asp:TextBox ID="TextBox1" runat="server" text="HI"></asp:TextBox>
</code></pre>
| asp.net | [9] |
2,266,460 | 2,266,461 | Can't combine strpos and !empty in PHP, why? | <p>I have two lines in PHP that if I combine causes my page to stop loading...Unfortunately, I have no error message using <code>error_reporting(E_ALL | E_STRICT); ini_set('display_errors', true);</code>, and nothing in my apache error.log file.</p>
<p><strong>this works:</strong></p>
<pre><code>$user_setup = strpos($_SESSION['user'], "@");
if (!empty($user_setup)) {....
</code></pre>
<p><strong>But, this does not:</strong></p>
<pre><code>if (!empty(strpos($_SESSION['user'], "@"))) {....
</code></pre>
<p>Is there something about the <code>strpos</code> function causing this to not work? </p>
<p>Thanks for your help!</p>
| php | [2] |
3,693,023 | 3,693,024 | Help with basic Iphone view navigation | <p>I am new to iphone development and trying to understand the concept of how to organize navigation between views. What is the simplest way to launch a new view from within your current view?</p>
| iphone | [8] |
3,254,582 | 3,254,583 | Can browse the URL in IE but unable to ping | <pre><code>public static string GetAccessErrorString(string uri)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
try
{
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
}
catch (Exception e)
{
return e.Message;
}
return null;
}
</code></pre>
<p>I am just trying to check the accesibility of a website in above code. I get below error when GetResponse method is invoked.</p>
<blockquote>
<p>at System.Net.HttpWebRequest.GetResponse()
at WebStuff.WebsiteReachable.GetAccessErrorString(String uri, WebProxy proxy)
in WebsiteReachable.cs:line 22</p>
<p><em>Error : The remote name could not be resolved: 'www.microsoft.com'</em></p>
</blockquote>
<p>I added this in host file and tried but it did not work too.</p>
<p>Actually I am able to browse the site in IE. When I give ping www.microsoft.com I get below message</p>
<blockquote>
<p>*Ping request could not find host microsoft.com. Please check the name and try
again. *</p>
</blockquote>
<p>Could you please help me figuring out the issue?.. If you could point out different possibilities that will be great.</p>
| c# | [0] |
5,644,228 | 5,644,229 | Android: HTML links inside ListView - problem with highlighting | <p>I wrote application which uses <code>ListActivity</code>. Each item of the list consists of <code>ImageView</code> and <code>TextView</code>. Long click on list entry triggers some menu and color effect because <code>onCreateContextMenu</code> was overridden. Sometimes <code>TextView</code> contains HTML links which I would like to be interactive. I read <a href="http://stackoverflow.com/questions/1697908/android-how-can-i-add-html-links-inside-a-listview">#1697908</a> and made links active, so browser/youtube player is started. Everything would be great but color effect on long click disappeared (context menu still appears). </p>
<p>Could somebody tell me how to connect these two features and get back color effect?</p>
| android | [4] |
2,715,883 | 2,715,884 | How to use Ignition HTTP classes to make Get request? | <p>The documentation for <code>[Ignition][1]</code> is rather sparse. I'm looking at the documentation for the HTTP classes, such as <a href="http://mttkay.github.com/ignition-docs/ignition-support/apidocs/" rel="nofollow">link here</a>, but I'm confused.</p>
<p>My current code looks something like this (sanitized version): </p>
<pre><code>client = AndroidHttpClient.newInstance(MyConstants.USER_AGENT);
String url = SaveConstants.MY_URL;
url += "?" + MyConstants.MY_PARAMETER + "=" + parameterValue;
HttpGet request = new HttpGet(url);
InputStream contentStream = null;
try {
HttpContext httpContext = new BasicHttpContext();
HttpResponse response = client.execute(request, httpContext);
contentStream = response.getEntity().getContent();
String content = Util.inputStreamToString(contentStream);
}
</code></pre>
<p>How can I change this over to use the Ignition classes? I have two problems:</p>
<ol>
<li>I don't see how to initialize or use IgnitedHttpRequest. There are no constructors and no documentation that seems to explain the use of this class.</li>
<li>Can IgnitedHttpRequest use GET requests, or only POST?</li>
</ol>
| android | [4] |
639,005 | 639,006 | i want to integrate paypal in my application so how it possible? | <p>I am new in iphone application and i have to implement paypal in my application so give me ideas regarding this i have not done anything regarding Paypal.</p>
| iphone | [8] |
823,467 | 823,468 | Why don't Java LinkedHashMaps have an insert() method? | <p>By <code>insert()</code>, I mean <code>insertBefore(key)</code> or <code>insertAfter(key)</code>.</p>
<p>As far as I can make out, inserting a key in the middle of the map can only be achieved by creating a new map and copying across the existing keys and the new key in the correct order.</p>
<p>Considering that LinkedHashMaps are based on double-linked lists, it would have been trivial to implement <code>insertBefore(key)</code> or <code>insertAfter(key)</code>.</p>
<p>Am I missing something here?</p>
<p><strong>Update</strong>
Thanks to everyone who pointed out the the above methods would break the contract of maintaining insertion order.</p>
<p>So let me rephrase the question: does anyone know of a class that would let me do this?</p>
<p>I looked at <code>SortedMap</code> (and its derivatives, including <code>NavigableMap</code>) but I don't want the map to be explicitly sorted. Think of a <code>nodeList</code> in the browser DOM. I just need to be able to insert elements (in this case KV pairs) in any arbitrary order.</p>
<p>Thanks</p>
| java | [1] |
1,330,552 | 1,330,553 | vector of bools not initialized correctly | <p>I have initialized a <code>vector</code> of <code>bools</code>, but for some reason
everything is set to <code>false</code>. Why can I not set a <code>vector</code> of
<code>bool</code> to <code>true</code>?</p>
<pre><code>#include <iostream>
#include <vector>
int main()
{
std::vector<bool> d_WFlag;
int d_numGrids = 4;
d_WFlag.resize(d_numGrids);
d_WFlag[0] = false;
std::cout << std::noboolalpha << d_WFlag[0] << " == " << std::boolalpha << d_WFlag[0] << std::endl;
for(int i = 1; i < (d_numGrids - 1); ++i)
{
d_WFlag.push_back(true);
std::cout << std::noboolalpha << d_WFlag[i] << " == " << std::boolalpha << d_WFlag[i] << std::endl;
}
d_WFlag[d_numGrids - 1] = false;
std::cout << std::noboolalpha << d_WFlag[d_numGrids - 1] << " == " << std::boolalpha << d_WFlag[d_numGrids - 1] << std::endl;
return 0;
}
</code></pre>
| c++ | [6] |
5,725,567 | 5,725,568 | Excluding all but a single subdirectory from a file search | <p>I have a directory structure that resembles the following:</p>
<pre><code>Dir1
Dir2
Dir3
Dir4
L SubDir4.1
L SubDir4.2
L SubDir4.3
</code></pre>
<p>I want to generate a list of files (with full paths) that include all the contents of <code>Dirs1-3</code>, but only <code>SubDir4.2</code> inside <code>Dir4</code>. The code I have so far is</p>
<pre><code>import fnmatch
import os
for root, dirs, files in os.walk( '.' )
if 'Dir4' in dirs:
if not 'SubDir4.2' in 'Dir4':
dirs.remove( 'Dir4' )
for file in files
print os.path.join( root, file )
</code></pre>
<p>My problem is that the part where I attempt to exclude any file that does not have <code>SubDir4.2</code> in it's path is excluding everything in <code>Dir4</code>, including the things I would like to remain. How should I amend that above to to do what I desire?</p>
<p><strong>Update 1</strong>: I should add that there are a lot of directories below <code>Dir4</code> so manually listing them in an excludes list isn't a practical option. I'd like to be able to specify <code>SubDur4.2</code> as the only subdirectory within <code>Dir4</code> to be read.</p>
<p><strong>Update 2</strong>: For reason outside of my control, I only have access to Python version 2.4.3.</p>
| python | [7] |
1,736,895 | 1,736,896 | tiny xml null point reference error when deserialize? | <p>I am working with C++. I have the following XML:</p>
<pre><code><data>
<name> me</name>
<street />
</data>
</code></pre>
<p>I want to deserialize this xml and i did:</p>
<pre><code>TiXMlDocument doc,
tiXmlHandle handle(&doc)
TiXmlElement* sec;
sec=handle.FirstChild("data").FirstChild("name").element;
if (sec)
{ const char* str=sec->GetText();
}
</code></pre>
<p>And when i write:</p>
<pre><code>sec=handle.FirstChild("data").FirstChild("street").element;
if (sec)
{ const char* str=sec->GetText(); //here i have a null reference. pointer error.
}
</code></pre>
<p>I need some help with that null pointer pointed out in the code above.</p>
<p>How can I resolve this?</p>
| c++ | [6] |
4,577,164 | 4,577,165 | how to validate textfield that allows two digits after | <p>i have to validate text field that allows only two digits after <code>.</code></p>
<p>eg:12.34 </p>
<p>if user enter more then two digits it won't allows text.</p>
<p>let me know is it understandable or no</p>
<p>how can i done,can any one please help me.</p>
<p>Thank u in advance. </p>
| iphone | [8] |
2,660,375 | 2,660,376 | jQuery calculate sum of values in all text fields | <p>I have an order form with about 30 text fields that contain numerical values. I'd like to calculate the sum of all those values on blur.</p>
<p>I know how to select all text fields but not how to loop through them and add up all their values?</p>
<pre><code>$(document).ready(function(){
$(".price").blur(function() {
//loop and add up every value from $(".price").val()
})
});
</code></pre>
| jquery | [5] |
1,269,992 | 1,269,993 | Set the Key of HashMap to setter | <pre><code>LinkedHashMap<String, Double> testMap = (LinkedHashMap<String, Double>) sortByValue(commands.get(commandWithMaxNegativeOffset).getDataUsageCriteria());
</code></pre>
<p>From above, <code>testMap</code> will contains something like <code>{New=30.0, Previous=70.0}</code> in ascending order of value so what I want to do is something like below in the if/else loop, as currently I have hardcoded now just to make more sense but I want to use the testMap instead of hardcoding. I want to set <code>key</code> as value if condition gets matched <code>by using key/value pair from map</code></p>
<pre><code>double percent = r.nextDouble()*100;
if(percent > 1.0 && percent < 70.0(how can I use 70 from testMap instead of hardcoding)) {
//what to put below in place of Previous
commands.get(commandWithMaxNegativeOffset).setDataCriteria(Use the Key of 70.0 i.e Previous);
} else if(percent > 71 && percent < 100){
commands.get(commandWithMaxNegativeOffset).setDataCriteria(Use the Key of 30.0 i.e New);
}
</code></pre>
| java | [1] |
701,174 | 701,175 | convert std::wstring to const *char in c++ | <p>How can i convert std::wstring to const *char in c++?</p>
| c++ | [6] |
4,537,760 | 4,537,761 | Print some code from a foreach loop at each predetermined number | <p>My code is looping through some content and outputting some code.</p>
<p>I need to work out a way of telling my code to output some predefined text every X loops. For example:</p>
<blockquote>
<p>Task: print "code here" on loop item 1
and every 4 further loops.</p>
</blockquote>
<p>So "code here" will only be outputted on foreach loop item 1, 4, 8, 12</p>
| php | [2] |
4,116,591 | 4,116,592 | removing parent icon in expandable list | <p>1) I have made an customizable expandable List .</p>
<p>2) Where I can customize the child.</p>
<p>3) But in parent(Group ID) I want to change the default icon of the parent.which look like(>).</p>
<p>4)Can anyone help me?</p>
<p>Thanks
Raj </p>
| android | [4] |
2,260,290 | 2,260,291 | Force a raw_input | <p>How would I implement the following:</p>
<pre><code>title_selection = raw_input("Please type in the number of your title and press Enter.\n%s" % (raw_input_string))
if not title:
# repeat raw_input
</code></pre>
| python | [7] |
230,979 | 230,980 | Where to put using statements in a C# .cs file | <p><strong>DUPE: <a href="http://stackoverflow.com/questions/125319/should-usings-be-inside-or-outside-the-namespace">http://stackoverflow.com/questions/125319/should-usings-be-inside-or-outside-the-namespace</a></strong></p>
<p>If I add a new class using Visual Studio to the project, It adds all the using statements before namespace but for the same project, FxCop says that put the name spaces inside namespace. Which is a better style of coding?</p>
| c# | [0] |
4,152,466 | 4,152,467 | Instruments chart for iphone | <p>i have a doubt ..i clicked on leaks and then i can see graph now <strong>should i run application to check memory leak or it will do on its own</strong>??
and the moment my apps start after 3 secs i can see blur bar of height 0.5 that keep going?? so what should i do??
is that leak permanent (cause blue bar is static ?? but my app is running good </p>
| iphone | [8] |
98,470 | 98,471 | Debugging Android RuntimeException - Before my code even executes | <p>I'm not new to Java but new to the Android platform. I'm finding one of the platforms shortcomings to be meaningful feedback on runtime crashes. Fine in user code where breakpoints apply, but I have a crash on first run that is preventing my project from starting, and I can't see a way to track it down. Can anyone shed any light?</p>
<pre><code>DalvikVM[localhost:8626]
Thread [<1> main] (Suspended (exception RuntimeException))
ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2585
ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2679
ActivityThread.access$2300(ActivityThread, ActivityThread$ActivityRecord, Intent) line: 125
ActivityThread$H.handleMessage(Message) line: 2033
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 123
ActivityThread.main(String[]) line: 4627
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 521
ZygoteInit$MethodAndArgsCaller.run() line: 868
ZygoteInit.main(String[]) line: 626
NativeStart.main(String[]) line: not available [native method]
Thread [<6> Binder Thread #2] (Running)
Thread [<5> Binder Thread #1] (Running)
</code></pre>
<p>Same on emulator and device.</p>
<p>I've seen reports of crashes like these being caused by inflation of invalid XML so I have removed all XML's and resources from my project, almost one by one, and the same error remains! Are there any tricks or instrumentation I can apply to try and get a more meaningful error message? Thanks.</p>
| android | [4] |
1,958,148 | 1,958,149 | How to minify php html output without removing IE conditional comments? | <p>I minify my HTML pages whit this PHP script:</p>
<pre><code>function compress_html($html)
{
preg_match_all('!(<(?:code|pre|script).*>[^<]+</(?:code|pre|script)>)!', $html, $pre);
$html = preg_replace('!<(?:code|pre).*>[^<]+</(?:code|pre)>!', '#pre#', $html);
$html = preg_replace('#<!–[^\[].+–>#', '', $html);
$html = preg_replace('/[\r\n\t]+/', ' ', $html);
$html = preg_replace('/>[\s]+</', '><', $html);
$html = preg_replace('/\s+/', ' ', $html);
if (!empty($pre[0])) {
foreach ($pre[0] as $tag) {
$html = preg_replace('!#pre#!', $tag, $html,1);
}
}
return $html;
}
ob_start('compress_html');
</code></pre>
<p>There is a way to remove just the "HTML comments"...and not the IE conditional comments?</p>
<p>Thanks.</p>
| php | [2] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.