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 |
---|---|---|---|---|---|
621,545 | 621,546 | C# join 2 or more classes together? | <p>So this might sounds like a n00b question, but I want to take 2 classes and merge them together. </p>
<p>Like so :</p>
<pre><code>Ball oneBall = new Ball("red", 20);
Ball anotherBall = new Ball("blue",40);
Ball BigBall = new Ball(oneBall + anotherBall);
BigBall.size() //should say 60 right?
</code></pre>
<p>I know you would have something like this</p>
<pre><code>class Ball{
public Ball(string Name , int size){}
// But to merge to of them?
public Ball(Ball firstBall, Ball secondBall){} //I know the arguments have to be added
{}
}
</code></pre>
<p>So my question is what is the overload(right?) suppose to look like?</p>
<p>Thanks,</p>
| c# | [0] |
3,107,493 | 3,107,494 | Can we make custom progressdialog in android? | <p>I need to make custom ProgressDialog for my project.. The default one is very simple.. Can we do it?</p>
| android | [4] |
4,271,450 | 4,271,451 | Have you Guys Heard of C++ Server Pages? | <p>I have been looking for a ways to maximize speed in my web application. Came across an interesting application called CSP. Have you guys ever heard of them? They claim that you can program web application in c++. Is it worth it?</p>
<p><a href="http://www.micronovae.com/CSP.html" rel="nofollow">http://www.micronovae.com/CSP.html</a></p>
| c++ | [6] |
1,552,967 | 1,552,968 | Question related to array | <p>I'm trying to print array. All code working fine.But at last I'm getting `ArrayArray'. Can any one solve this problem. many many thanks</p>
<p>here is my array</p>
<pre><code>Array
(
[Post1] => Array
(
[id] => 1
[title] => hi
)
[Post2] => Array
(
[0] => Array
(
[id] => 1
)
)
[Post3] => Array
(
[0] => Array
(
[id] => 1
)
)
)
</code></pre>
<p>Here is my PHP Code</p>
<pre><code>foreach($post as $key => $value) {
foreach($value as $print => $key) {
echo "<br>".$key;
}
}
</code></pre>
<p>here is output</p>
<pre><code>ID
Array
Array
</code></pre>
| php | [2] |
3,508,218 | 3,508,219 | I get T_CONSTANT_ENCAPSED_STRING error | <p>Somebody kindly posted this code for me:</p>
<pre><code> $output = '<select name="module" class="modulesDrop">'.PHP_EOL;
foreach ($courseData['Modules'] as $moduleId => $moduleData) {
$output .= "<option value=".$moduleId.">".$moduleData."</option>".PHP_EOL; }
}
$output .= '</select>';
</code></pre>
<p>Something I forgot to mention in my last post was that I want the first option to be blank. So I included </p>
<pre><code>$output .= "<option value="">"" ""</option>".PHP_EOL;
</code></pre>
<p>problem is that it is not letting me do this as that I keep getting an error on this line stating:</p>
<p>T_CONSTANT_ENCAPSED_STRING error</p>
<p>I researched this and looked at my line of code but I can't see problem with this line of code. Why is it giving me this error?</p>
| php | [2] |
3,683,271 | 3,683,272 | Is it OK to lock on System.Collections.Generic.List<t>? | <p>I have been reading about the syncroot element but I can't find it in the List type.
So how should the multithreading synchronization be done with the System.Collections.Generic.List<> type?</p>
| c# | [0] |
5,847,604 | 5,847,605 | Android : Make image opaque / transparent | <p>Greetings, </p>
<p>I would like to place an image over a surfaceview. However I would like the image to be transparent so you can see the image and also the undlying surfaceview. Can anyone suggest how I could do this?</p>
| android | [4] |
646,701 | 646,702 | Created folder shows on device but not on PC | <p>I am trying to create a folder that users can put stuff in and use in the app so I do this</p>
<pre><code>File exportDir = new File(Environment.getExternalStorageDirectory()+"/BCAData");
if (!exportDir.exists()) {
exportDir.mkdirs();
}
File file = new File(exportDir, dbFile.getName());
file.createNewFile();
</code></pre>
<p>If I use a file explorer program like <code>Astro File Manager</code> I see the folder fine but when I plug the device into my PC the folder is not there to put stuff in.</p>
<p>is there something else that I have to do for it to be used on a PC?</p>
| android | [4] |
3,161,740 | 3,161,741 | how to pass the javascript variable to textbox? | <p>i would like to ask a question.</p>
<p>how can i pass the javascript generated code to the textbox "code" ?</p>
<p>I surf the internet but I cannot find the answer</p>
<p>I hope all of you can help me.</p>
<p>thanks!!</p>
<pre><code> <form><input name="code" type="text" value="" >
<script>
function makeid()
{
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for( var i=0; i < 6; i++ )
text += possible.charAt(Math.floor(Math.random() * possible.length));
alert(text);
return text;
}
</script>
<input type="button" style="font-size:9pt" value="Generate Code" onclick="makeid()">
</input></form>
</code></pre>
| javascript | [3] |
5,683,867 | 5,683,868 | What is the use of getDrawingCache() method | <p>I dont know how to use <code>getDrawingCache()</code> method.please give me any example.Please explain me the method,its use and advantages.</p>
| android | [4] |
4,813,231 | 4,813,232 | Is it fine to customize C++? | <p>For my projects, I usually define a lot of aliases for types like unsigned int, char and double as well as std::string and others.</p>
<p>I also aliased and to &&, or to ||, not to !, etc.</p>
<ul>
<li>Is this considered bad practice or okay to do?</li>
</ul>
| c++ | [6] |
2,842,468 | 2,842,469 | Quick guru interpretation of beginner android tutorial instructions! | <p>I am following this tutorial:</p>
<p><a href="http://knol.google.com/k/suk-woo-heo/creating-user-interfaces/1oqzmo14sfklf/20#" rel="nofollow">http://knol.google.com/k/suk-woo-heo/creating-user-interfaces/1oqzmo14sfklf/20#</a></p>
<p>Have got to step 4 where it says:
4. With the resources defined, you’re ready to customize the TodoListItemView appearance.
Create new private instance variables to store the Paint objects you’ll use to draw the paper background and margin. Also create variables for the paper color and margin width values. Fill in the init method to get instances of the resources you created in the last two steps and create the Paint objects. </p>
<p>Can anyone tell me what this means?
'Create new private instance variables to store the Paint objects'</p>
<p>Should this be created as a new class in eclipse under src? My existing class I had already calls lots of these things like init(), so it starts spitting errors if I put it in there...</p>
| android | [4] |
1,782,820 | 1,782,821 | PHP: word check for 30 chars | <p>I would like to check that if $_POST[msg] contains a word that are longer than 30 chars(without no spaces) so you wouldnt be able to write:</p>
<p>example1 :</p>
<p>asdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsdsddsasdsdsdsdsd</p>
<p>example2:
hello my name is asdoksdosdkokosdkosdkodskodskodksosdkosdkokodsdskosdkosdkodkoskosdkosdkosdkosdsdksdoksd</p>
<p>(notice no spaces).</p>
<p>How can I do that?</p>
| php | [2] |
4,903,734 | 4,903,735 | Webservice call not working after switching between Wifi to 3G or 3G to Wifi | <p>I written a service in my app that will send lat longs to the server for every 15 seconds . the problem is:</p>
<p>When service started i am using wifi and making calls to server with latest lat longs for every 15 seconds it is working fine.after some time I switch off the wifi and switch on the 3g (mobile network) now the service is not reporting latest lat longs to the server.But it is working fine when switch off wifi for some time and again switch on wifi. </p>
<p>The service also not working fine in the vice versa that is when we are switching between 3g to wifi. But it is also not working when I am switching between 3G to 3G ie use 3G initially and switch off for some time and then switch on the 3G again ( but wifi to wifi change service is working fine.) </p>
<p>I don't why this abnormal scenario happening to my service. </p>
<p>Looking for help if any body knows about this problem.Immediate response would be appreciable.</p>
<p>Regards,
Kiran. </p>
| android | [4] |
1,475,760 | 1,475,761 | Stop PHP STRPOS function from ignoring zeros | <p>I am creating a script that will find files from an input file (right now I am working on a jpg).</p>
<p>I use common file headers/trailers/structure to find the data that needs to be extracted. I use STRPOS to find these commonalities and find the parts of the file that need to be copied from the rest of the data etc etc.</p>
<p>Anyways, I am running into an issue, STRPOS is supposed to be looking for the string, "FFD9"... however it is finding it in incorrect positions!</p>
<p>For example, my hex in my JPG file looks as such,</p>
<p><img src="http://i.stack.imgur.com/SjXZs.png" alt="Wrong String!"></p>
<p>See the FF and the D9 on each side of the zero? STRPOS seems to be ignoring that 00 in-between! I need this to stop for my script to work correctly.</p>
<p>Any idea or suggestions? Thank you very much!</p>
| php | [2] |
1,294,472 | 1,294,473 | JavaScript object method name for setTimeout | <p>my object has a function that i want to call recurseively.
my problem is how do i use setTimeout to point to the method of that instance of the object?</p>
<pre><code>MyObject.prototype.Play = function() {
// do some stuff
setTimeout(thecurrentmethodnameHERE, 1000);
}
var test = new MyObject();
test.Play();
</code></pre>
| javascript | [3] |
2,963,992 | 2,963,993 | Correlating parallel arrays in C# | <p>How can I associate two unidentical( arrays of different types) string arrays using C#? </p>
| c# | [0] |
4,173,352 | 4,173,353 | How to build only the selected class library project in Visual Studio, not any dependencies | <p>We have a <em>very</em> large solution. I'd like to find a way to select a C# class library project in Visual Studio and build only that project.</p>
<p>The solution is composed of non-managed C++, managed C++, and C# projects.</p>
<p>Turning on "Only build startup projects and dependencies on Run" results in very good performance with executables, it only compiles the executable assembly.</p>
<p>But selecting a C# class library project and selecting Build Project still goes off and builds all these C++ projects.</p>
| c# | [0] |
2,436,714 | 2,436,715 | Elegant solution to retrieve custom date and time? | <p>I am currently using a date and time picker to retrieve a user-submitted date and time, and then I set a control's text to the date and time selected. </p>
<p>I am using the following code:</p>
<pre><code>new DatePickerDialog(newlog3.this, d, calDT.get(Calendar.YEAR), calDT.get(Calendar.MONTH), calDT.get(Calendar.DAY_OF_MONTH)).show();
new TimePickerDialog(newlog3.this, t, calDT.get(Calendar.HOUR_OF_DAY), calDT.get(Calendar.MINUTE), true).show();
optCustom.setText(fmtDT.format(calDT.getTime()));
</code></pre>
<p>Now, while the above code block does bring up the date and time widgets and sets the text, the code block is being executed in full before the user can select the date.. ie: It brings up the date box first, then the time box over that, and then updates the text, all without any user interaction. I would like the date widget to wait to execute the time selector until the date selection is done, and i would like the settext to execute only after the time widget is done. </p>
<p>How is this possible? Or is there is a more elegant solution that is escaping me?</p>
<p>Edit: This is the code for DatePickerDialog/TimePickerDialog which is located within the class:</p>
<pre><code> DatePickerDialog.OnDateSetListener d=new DatePickerDialog.OnDateSetListener() {
public void onDateSet(DatePicker view, int year, int monthOfYear,
int dayOfMonth) {
calDT.set(Calendar.YEAR, year);
calDT.set(Calendar.MONTH, monthOfYear);
calDT.set(Calendar.DAY_OF_MONTH, dayOfMonth);
//updateLabel();
}
};
TimePickerDialog.OnTimeSetListener t=new TimePickerDialog.OnTimeSetListener() {
public void onTimeSet(TimePicker view, int hourOfDay,
int minute) {
calDT.set(Calendar.HOUR_OF_DAY, hourOfDay);
calDT.set(Calendar.MINUTE, minute);
//updateLabel();
}
};
</code></pre>
<p>Thanks in advance</p>
| android | [4] |
4,930,789 | 4,930,790 | How do you check if a website is online in C#? | <p>I want my program in C# to check if a website is online prior to executing, how would I make my program ping the website and check for a response in C#?</p>
| c# | [0] |
1,436,862 | 1,436,863 | How to integrate GoogleMaps in android | <p>How to integrate GoogleMaps in android,the problem is that i am unable to get the MD5 fingerprint.
Unable to get MD5 fingerprint using this path.</p>
<pre><code>$ keytool -list -alias alias_name -keystore my-release-key.keystore
</code></pre>
| android | [4] |
3,147,554 | 3,147,555 | jquery convert serialized form inputs to xml string | <p>I'm trying to get all my form inputs and then create with them an xml string containing there values in order to send them via ajax.</p>
<p>i want this :</p>
<pre><code><form id="formtest">
<input type="text" name="test1" id="test1"/>
<input type="text" name="test2" id="test2"/>
<input type="text" name="test3" id="test3"/>
<input type="text" name="test4" id="test4"/>
<input type="text" name="test5" id="test5"/>
</form>
</code></pre>
<p>to become: </p>
<pre><code><formtest>
<test1></test1>
<test2></test2>
<test3></test3>
<test4></test4>
<test5></test5>
</formtest>
</code></pre>
<p>How can this be done?</p>
<p>Thank's In Advance.</p>
| jquery | [5] |
1,869,871 | 1,869,872 | Why does Response.Write("<someting>") not work in ASP.NET code-behind? | <p>I have this code in my ASP.NET code-behind file:</p>
<pre><code>Response.Write("<someting>")
</code></pre>
<p>But it doesn't work. If I remove the <code><</code> tag delimiter, then it writes the content to the page. </p>
<p>My question is: how can I write an XML string to the page from a code-behind?</p>
| asp.net | [9] |
933,827 | 933,828 | Can't access $_POST variables when using multipart/form-data | <p><strong>What is the problem?</strong></p>
<p>When I add a file using my form the $_POST variables are undefined. When I don't add a file the $_POST variables are defined.</p>
<p><strong>What errors do you receive?</strong></p>
<pre><code>Notice: Undefined index: bbmpin in C:\...\addpin.php on line 6
Notice: Undefined index: usermsg in C:\...\addpin.php on line 7
</code></pre>
<p><strong>Source Code</strong></p>
<p>index.html</p>
<pre><code><form method="POST" action="addpin.php" enctype="multipart/form-data">
<div>
<label for="bbmpin">Your BBM Pin</label>
<input type="text" name="bbmpin" placeholder="Enter Your BBM Pin">
</div>
<div>
<label for="usermsg">Message</label>
<input type="text" name="usermsg" placeholder="(optional) Add a short message" maxlength="255">
</div>
<div>
<label for="image">Upload Image <small>(optional)</small></label>
<input type="file" name="image">
</div>
<button type="submit">Submit</button>
</form>
</code></pre>
<p>addpin.php</p>
<pre><code><?php
session_start();
require_once('config/config.php');
$pin = $_POST['bbmpin'];
$msg = $_POST['usermsg'];
$ip = $_SERVER['REMOTE_ADDR'];
print_r($_POST);
print_r($_FILES);
exit;
...
?>
</code></pre>
| php | [2] |
4,418,801 | 4,418,802 | What's the difference in this condition : STRING.equals("myValue") vs STRING == "myValue"? | <p>What's the difference in <code>STRING.equals("myValue")</code> vs <code>STRING == "myValue"</code>?</p>
<p>I first used <code>STRING == "myValue"</code> but my IDE recommends to switch to using <code>.equals()</code>. Is there a specific benefit to doing this?</p>
| java | [1] |
3,039,286 | 3,039,287 | Make image link with the same href using jQuery | <p>Im trying to make my img link to this same image. Unfortunately it is not working.</p>
<pre><code><img src="someimage.jpg" width="120" height="120" />
</code></pre>
<p>and this is what im trying to acheave:</p>
<pre><code><a href="someimage.jpg">
<img src="images/6208606.jpg" width="120" height="120" />
</a>
</code></pre>
<p>but this don't seems to be working</p>
<pre><code>var ImgScr = $('.gallery img').attr('scr');
$('.gallery img').wrap('<a></a>').attr('href', ImgScr);
</code></pre>
<p>Any help very appreciate</p>
| jquery | [5] |
4,816,595 | 4,816,596 | A curious occurrence in Python | <p>For some reason in Python 2.7 expressions of the form <code>tuple > list</code> return <code>True</code>, but <code>tuple < list</code> and <code>tuple == list</code> return <code>False</code>. Why is that?</p>
<p>This observation is not original to me by any means.</p>
| python | [7] |
4,540,627 | 4,540,628 | calendar view android | <p>I want to use calendar in my android application in grid view format and it will show events and images on a specific date.</p>
<p>Is there any calendar jar that I could use?</p>
| android | [4] |
1,756,903 | 1,756,904 | is there a "double" type in PHP | <p>if not, then how to declare a double type of number?</p>
<pre><code>function testFloat(float $f)
{
return $f;
}
echo testFloat(1.2);
</code></pre>
<blockquote>
<p>Catchable fatal error: Argument 1 passed to testFloat() must be an instance of float, double given</p>
</blockquote>
| php | [2] |
4,768,326 | 4,768,327 | java "boolean" not woking with integer | <p>Why doesn't this work. (I'm really sorry, I just learned java.)</p>
<p>public class Test {</p>
<pre><code>public static void main(String[] args){
int b;
b = 250;
b = 250;
boolean trueFalse = true;{
b = true (b + 5);
}
boolean False;{
False = ( b +5 );
b = False (b - 5);
}
</code></pre>
<p>}
}</p>
| java | [1] |
6,011,336 | 6,011,337 | How to remove unwanted character in php using preg_replace? | <p>im using this code</p>
<pre><code>$output = preg_replace('/[^(\x20-\x7F)]*/','', $output);
</code></pre>
<p>my goal is to remove this character but the code removed all unwanted characters.</p>
<p>Please help me to remove that character.</p>
<p>Thanks.</p>
| php | [2] |
3,351,825 | 3,351,826 | Convert Console.WriteLine into text box | <p>I checked on the net and I didn't find concrete examples for my situation... </p>
<p>What I want, is to have these Console.WriteLine displayed in a text box . </p>
<pre><code> // Show data before change
Console.WriteLine("name before change: {0}",
thisDataSet.Tables["Customers"].Rows[9]["CompanyName"]);
// Change data in Customers table, row 9, CompanyName column
thisDataSet.Tables["Customers"].Rows[9]["CompanyName"] = "Acme, Inc.";
// Call Update command to mark change in table
thisAdapter.Update(thisDataSet, "Customers");
Console.WriteLine("name after change: {0}",
thisDataSet.Tables["Customers"].Rows[9]["CompanyName"]);
</code></pre>
<p>I tried this;</p>
<pre><code> string1=("name before change: {0}",
thisDataSet.Tables["Customers"].Rows[9]["CompanyName"]);
thisDataSet.Tables["Customers"].Rows[9]["CompanyName"] = "Acme, Inc.";
thisAdapter.Update(thisDataSet, "Customers");
string2=("name after change: {0}",
thisDataSet.Tables["Customers"].Rows[9]["CompanyName"].ToString());
thisConnection.Close();
textBox1.Text = string1() + string2();
</code></pre>
| c# | [0] |
450,559 | 450,560 | Suspend the application | <p>How can I suspend my application or send a suspend message to my applicatio? </p>
<p>I want simulate pressing the home button.</p>
<p>Thanks</p>
| iphone | [8] |
1,352,244 | 1,352,245 | Raise an exception at import if conditions not met | <p>I have a module that depends on some system settings. For example, to work properly it needs to have an environment variable FOO set. I would like the module to raise an Exception if this condition is not met at import time.</p>
<pre><code># mymodule.py
if 'FOO' not in sys.environ:
raise SomeException('ensure that FOO is provided')
</code></pre>
<p>I would like to know:</p>
<ol>
<li>Is it the best practice to check those conditions at import time, or maybe it would be better to do it later (when)</li>
<li>What type of exception should I raise? Should it be my own <code>class MyModuleImportError(Exception)</code> or maybe some built-in exceptions are more suitable and commonly used? One candidate would be <a href="http://docs.python.org/2/library/exceptions.html#exceptions.ImportError" rel="nofollow">ImportError</a>, but it seems to be reserved for situation when python <em>"fails to find the module definition"</em></li>
</ol>
| python | [7] |
5,081,005 | 5,081,006 | Passing CalendarContract.Events.CONTENT_URI as a param to getContentResolver().query does not retrieve Calendar events from all calendars | <p>I am trying to retrieve calendar events and event instances from all the calendars that are on the device (not just 1 of the calendars). To do this, I created a cursor as follows - </p>
<pre><code>mCursor = getContentResolver().query(CalendarContract.Events.CONTENT_URI, COLS, null, null, null);
</code></pre>
<p>Thereafter, I move it to the first position as follows : </p>
<pre><code>mCursor.moveToFirst();
</code></pre>
<p>However, when I iterate over mCursor, as follows : </p>
<pre><code>mCursor.moveToNext();
</code></pre>
<p>It only iterates through the Events that are in the default calendar (holidays) and not the events and appointments in the user's calendar. </p>
<p>I have initialized COLS as follows : </p>
<pre><code> private static final String[] COLS = new String[]
{ CalendarContract.Events.TITLE, CalendarContract.Events.DTSTART };
</code></pre>
<p>Please let me know how I can initialize mCursor to query the results of events on all calendars, and not just the default calendar. </p>
<p>I am running ICS on the target device and minSDK is set to 14 for the project.</p>
| android | [4] |
3,190,712 | 3,190,713 | Python stops reading file using read | <p>I'm trying to read a binary file and am getting confusing results.</p>
<pre><code>f = open('foo.dat','r')
data = f.read()
print len(data), f.tell()
</code></pre>
<p>The output is:</p>
<pre><code>61, 600
</code></pre>
<p>What is going on here? Only the first 61 bytes are read, but the file object is telling me that I'm at the end of the file (the file is 600 bytes long). What happened to the rest of the file?</p>
<p>I just tried reading it in Matlab and it read it in fine so I'm pretty sure the data file is ok.</p>
<p>The documentation mentions something about blocking: "Notice that when in non-blocking mode, less data than what was requested may be returned, even if no size parameter was given." Am I in non-blocking mode? Seems like that shouldn't matter for a file. How do I switch to blocking mode?</p>
<p><strong>UPDATE</strong>
@John Machin - Yup! Thank you! Looks like that is indeed what was going on. Here's the output:</p>
<pre><code>600, 600
'm\x1aN\x16\x8d\x1e\x96\x10h\x1a'
</code></pre>
<p>The '\x1a' is definitely in there.</p>
| python | [7] |
5,146,576 | 5,146,577 | JavaScript : Check if variable exists and if equal to value | <p>I have three pages utilizing the same code and on one of the pages this variable doesn't exist, on the other two the variable ticketType has a value of 1 or 2. I need to first check if ticketType exists and isn't undefined and secondly, need to determine if it's one or 2.</p>
<p>This if statement generates an error:</p>
<pre><code>if(typeof ticketType != undefined && ticketType == 1){}
</code></pre>
<p>It's saying <code>ticketType isn't defined</code>. I tried nesting the if statements to check if it was defined first thinking it wouldn't go and try the inner if statement but firebug still generates an error.</p>
<p>Any ideas? There has to be a way to do this...</p>
| javascript | [3] |
4,918,043 | 4,918,044 | about import FBReader project | <p>After i import the FBReader, The project got problems.</p>
<p>All the aidl file got problem,</p>
<p>Like ApiInterface , This aidl interface in class ApiClientImplementation got problem is:</p>
<p>ApiInterface cannot be resolved to a type.</p>
<p>what's wrong with aidl file? how to fix it?</p>
<p>Pls help</p>
<p>Thanks very much.</p>
| android | [4] |
2,368,367 | 2,368,368 | How can I reset a sequence's value to 1 for every new year in C# | <p>I'm using the sequence to generate an identifier in the format YYYY-"sequence value" and the sequence value has to be reset to 1 for every new year. for example: for this year's value will be like 2011-3456. when new year comes, it should be set to like: 2012-0001.
Thanks in advance!</p>
| c# | [0] |
4,289,918 | 4,289,919 | upload fail when finding a special characters | <p>When uploading a csv file in php, the upload fail when the file contain letters like french letters (letters with accents), can someone help me please with this issue?
thank you</p>
| php | [2] |
711,446 | 711,447 | Android app accesses web service | <p>I need to create an Android application, I'm not sure which is a better way of doing this by better I mean should I use the <code>WebView</code> or create an application .</p>
<p>I need to implement the existing application which is a ASP.NET application which mainly consists of a login screen, once the user logs in he will see a list a items in probably a gridview based on the selection from the gridview. He then will be shown more detailed info about the selected item.</p>
<p>The above is a web application I need to implement this as a app on Android phone.</p>
<p>Also there will be a need to use the GPS where based on the GPS values the department will be selected and also use the camera to take a picture and save it on to the server .</p>
<p>A solution which I was thinking of was to expose .NET web services and then access it in the android phone!</p>
<p>But I am very new to Android development and really do not how to go about this. Is there any better solution?</p>
<p>Can anyone help me as to how do I go about this ?</p>
| android | [4] |
373,889 | 373,890 | sending data from a dataset to a email body having problems populating the body | <p>hello I'm working on a project for school any help would be great
I'm trying to email data from a dataset, but I'm having a hard time customizing the body of the email. Thank you!!!</p>
<p>what i have so far.</p>
<p>it works however i can't customize the body. For example i would like the body to populate with data from the dataset (DataSet theTask = getSpecificTaskFromEmail(emails[i]);)</p>
<p>msg.body = (row data) + ": " + " is past due";</p>
<pre><code>public void sendEmail()
{
try
{
NetworkCredential loginInfo = new NetworkCredential("****@gmail.com", "*******");
MailMessage msg = new MailMessage();
string[] emails = getEmails();
msg.From = new MailAddress("******@gmail.com");
for (int i = 0; i < emails.Length; i++)
{
msg.To.Add(new MailAddress(emails[i].ToString()));
msg.Subject = "Reminder that your Task is past Due";
DataSet theTask = getSpecificTaskFromEmail(emails[i]);
msg.Body = theTask.GetXmlSchema();
msg.IsBodyHtml = true;
SmtpClient client = new SmtpClient("smtp.gmail.com");
string userState = String.Format("Message for sent");
client.EnableSsl = true;
client.UseDefaultCredentials = false;
client.Credentials = loginInfo;
client.SendAsync(msg, userState);
}
}
catch (SqlException sqe)
{
throw sqe;
}
catch (Exception exes)
{
throw exes;
}
}
</code></pre>
| c# | [0] |
2,066,163 | 2,066,164 | TreeSet is not working properly | <p>The output does not sort in ascending order. Here is the code and the output I am getting.</p>
<p>The actual output is:</p>
<pre>
Amy Jose Jeremy Alice Patrick
Alan Amy Jeremy Helen Alexi
</pre>
<p>While the expected output is:</p>
<pre>
Amy, Alice, Jeremy, jose, Patrick
Alan, Amy, Alexi, Helen, Jeremy
</pre>
<p>The code is:</p>
<pre><code>public class MyFriends
{
static Set<String> names = new TreeSet<String>();
public MyFriends()
{
super();
names = new TreeSet<String>();
}
public static void exampleMethod()
{
String[] name1 = {"Amy", "Jose", "Jeremy", "Alice", "Patrick"};
String[] name2 = { "Alan", "Amy", "Jeremy", "Helen", "Alexi"};
for (int i = 0; i < name1.length; i++)
{
names.add(name1[i]);
}
for (String aString : name1)
{
System.out.print(" " + aString);
}
for (int i = 0; i < name2.length; i++)
{
names.add(name2[i]);
}
for (String bString : name2)
{
System.out.print(" " + bString);
}
}
</code></pre>
| java | [1] |
237,632 | 237,633 | jQuery - My slideToggle is laggy | <p>Im creating this jquery action, but it is laggy at the slideDown, not on the slideUp of the SLideToggle action. How come this is happening? I am having other slideToggle's which is perfectly smooth.</p>
<pre><code>$('.getGoingBtn').click(function(){
$(this).next('.getGoingDesc').slideToggle();
});
</code></pre>
<p>On this HTML: </p>
<pre><code><ul>
<li class='getGoingBtn'>Udfyld din profil</li>
<li class='getGoingDesc'>En udfyldt profil er et trin på trappen over troværdigheden mellem mennesker på internettet. Derfor råder vi til, at du udfylder din profil med det samme (Kontrolpanel &raquo; Indstillinger)</li>
<li class='getGoingBtn'>Opret dig som udbyder</li>
<li class='getGoingDesc'>Her skal der være en beskrivelse</li>
</ul>
</code></pre>
<p>With this CSS:</p>
<pre><code>.sideBarContent li.getGoingDesc{
display:none;
background:#fff;
margin:0px 0 1px 3.5%;
width:97%;
border-top:0 solid #c3c3c3;
}
</code></pre>
<p><strong>* This only happens when theres text inside *</strong> </p>
| jquery | [5] |
2,761,609 | 2,761,610 | C# resolving DNS aliases for a host | <p>I'm trying to query the DNS server for DNS aliases (CNAME records) and gethostentry always returns no aliases. Which I believe is explained by MSDN ("The Aliases property of the IPHostEntry instance returned is not populated by this method and will always be empty.")</p>
<p>So the question is, how do I get the aliases for my code?</p>
<pre><code> IPAddress hostIPAddress = IPAddress.Parse("192.168.1.2");
IPHostEntry myHost = Dns.GetHostEntry(hostIPAddress);
String[] myAliases = myHost.Aliases;
</code></pre>
| c# | [0] |
4,997,919 | 4,997,920 | Why is determining the cost of a java operation so unclear? | <p>I have tried several times to search the answer to what java operation is more demanding form my CPU time or RAM usage, because i do not always have a lot of RAM to spare of CPU time to give. So when i ask anyone or try to find what operations are more heavy i get a real vague answer like that is undecidable. </p>
<p>examples:</p>
<p>What is more efficient?<br>
try / catch or 4-5 if-statements?<br>
making a few new objects or store everything in 4 to 5 list and or maps in a static way?<br>
What is most RAM consuming and how do i avoid using that operation?</p>
<p>My question is why is this so undecidable?</p>
<p>Thank you in advance!</p>
| java | [1] |
1,536,637 | 1,536,638 | jQuery - can't get dialog popups to pop up, they appear on the page instead | <p>I have a couple small divs that I am trying to pop up when something happens, but they are not popping up, but instead appearing within the content of the page.</p>
<p>Would anyone know why that happens? Also, the jQuery is supposed to show a spinner gif to indicate you should wait, but it doesn't render that either.</p>
<p>Thanks in advance!</p>
| jquery | [5] |
896,605 | 896,606 | How to make compareTo sort a list alphabetically? | <p>How do I change my code so that it lists the elements in alphabetical order from a to z. Right now it's ordering from z to a. I can't figure it out and am stuck :-/</p>
<pre><code> String sName1 = ((Address)o).getSurname().toLowerCase();
String sName2 = (this.surname).toLowerCase();
int result = (sName1).compareTo(sName2);
return result;
</code></pre>
<p>Thanks :)</p>
| java | [1] |
1,464,979 | 1,464,980 | Call function from another function | <p>I'm writing a calendar in Javascript, and I want to know how to get the calendar to call itself depending on which link the user clicks. At the moment the function has the name foo()</p>
<p>At the bottom, there are three different div links which are displayed depending on given circumstances. The (working) calendar was written in PHP, so I'm trying to port it into Javascript. Doing pretty well with that, but there's a few bugs that need ironing out. The problem is I just have to mimic the behavior of the PHP calendar, which sent POST values to the next or previous buttons to use as information for which month to display (etc).</p>
<p>I have tried this in two different ways with the Javascript calendar, first using a javascript void (onclick) link which called the calendar function, but apparently you can't pass variables to a function with onclick. The other way was using dom objects, but I faced a new dilemma: you can't call a function within itself.</p>
<p>So, how would I go about calling a function, by making another function and then calling the calendar from inside that one?
Thanks.</p>
<p>SystemError</p>
<p>An example:</p>
<pre><code> function cal()
{
document.write("<td align='left' colspan=7><div id='calendar'></div></td>");
(function()
{
var lastday = cal[month];
DOMcalendar = document.getElementById("calendar"),
div = document.createElement("div");
div.innerHTML = "<a href='javascript:void(0)'>Next</a>";
div.onclick = function()
{
cal(lastday);
}
DOMcalendar.appendChild(div);
})()
}
cal();
</code></pre>
| javascript | [3] |
1,055,758 | 1,055,759 | What is context in android? | <p>Why we really need to pass context in some elements and what is the difference between <code>getApplicationContext()</code>, <code>getBaseContext()</code>, <code>MainActivity.this</code> ?</p>
| android | [4] |
4,309,989 | 4,309,990 | Warning: file_exists(): open_basedir restriction in effect | <p>I am using cPanel to edit a PHP file. When I replace the existing <code>index.php</code> file, I get the following error as I login through administration.</p>
<blockquote>
<p>Warning: file_exists(): open_basedir restriction in effect.
File(/home/myagdico/public_html/uitsAdmin/lib/plugins/createThisDir.txt/plugin.php)
is not within the allowed path(s): (/home:/tmp) in
/home/myagdico/public_html/uitsAdmin/lib/admin_functions.php on line
53 Warning: Cannot modify header information - headers already sent by
(output started at
/home/myagdico/public_html/uitsAdmin/lib/admin_functions.php:53) in
/home/myagdico/public_html/uitsAdmin/lib/menus/header.php on line 3</p>
</blockquote>
| php | [2] |
3,502,758 | 3,502,759 | How do I bind an event to any clickwith jQuery | <p>When the user clicks on a <code>.popup_link</code>, a little popup window is displayed and any other popup windows are removed:</p>
<pre><code>$("a.popup_link").click(function(){
hide_all_popups()
make_popup($(this).id)
});
</code></pre>
<p>But I want it to also <code>hide_all_popups()</code> when the user clicks anywhere else on the page thats <em>not</em> the popup. I need something like this:</p>
<pre><code>$("[ANY]:not(a.popup_link)").click(function(){
hide_all_popups()
});
</code></pre>
<p>How do I do this?</p>
| jquery | [5] |
4,827,246 | 4,827,247 | VPN protocol Android | <p>Is it possible to create a VPN connection but also setting the VPN protocol such as PPTP or L2TP programatically for Android 4+? I searche a lot but didn't find a real solution to this.</p>
| android | [4] |
436,559 | 436,560 | Jquery find all images on a website link | <p>I'm trying to create an jquery "inside" bookmarklet to my website like facebook share. </p>
<p>I need to get all images on a link. I mean if I give www.domain.com in my form, ajax request is needed to get all image links in that webpage and images should be shown in the form to select by user. </p>
<p>I'm sure there is a jquery plugin in order to do this, but I couldn't find any. I hope anyone can help me with this.</p>
| jquery | [5] |
1,496,423 | 1,496,424 | android different versions compatability | <p>I have developed an application for android 2.3. Now I want to test it under android 2.1. Do I have to create a new project with target set to android 2.1 and copy all the code across or is there any other method? Also how to make this application compatible with different android versions as a single program?</p>
| android | [4] |
1,357,714 | 1,357,715 | printdialog.showdialog(); not showing the print dialog in windows 7 with 64 bit | <p>I have custom control with print toolbar item.when print the control the
dialog is not coming in windows 7 with 64 bit os in other system os working
fine. problem only in windows 7 with 64 bit.</p>
<p>my problem printdialog is not coming in windows 7 os with 64 bit.</p>
<p>i have checked and anlyaed -->PrintDialog.ShowDialog() returns immeaditely
cancel instaed of showing the dialog thats the problem.</p>
<p>i have found the solution for the problem by searched following links:</p>
<p><a href="http://social.msdn.microsoft.com/Forums/en/netfx64bit/thread/8760fb6c-ae63-444e-9606-cd3295ce6b5d" rel="nofollow">http://social.msdn.microsoft.com/Forums/en/netfx64bit/thread/8760fb6c-ae63-444e-9606-cd3295ce6b5d</a></p>
<p><a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.printdialog.useexdialog.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.windows.forms.printdialog.useexdialog.aspx</a></p>
<p>by setting true to UseExDialog property of printdialog the dialog comes and
working fine.but this dialog style is like windows XP not windows7 style.so
this is not excat solution.</p>
<p>UseExDialog property sets to true means working fine.but the print dialog
style looks like windows XP print not like windows 7. i need some other
solution for showing print dialog in windows 7 os with 64 bit.</p>
<p>please provide complete solution for this problem</p>
<p>Thanks</p>
<p>Siva</p>
| c# | [0] |
1,603,411 | 1,603,412 | Cookies in asp.net [inmemory cookie, persistent cookie] | <p>How can I delete the cookie in persistent cookie not abandon()?</p>
| asp.net | [9] |
3,558,616 | 3,558,617 | How to store data into an xml file on my website and extract the data out of it in my iphone app | <p>In my application i need to create and save data into an xml file on my webspace and then i want to parse that xml into my iphone app. The question here is this is being done by two different parties a sender and a receiver.
But i don;t know how to parse that xml file into my app when i don't have the excat url of that xml because there will be number of people who will be using this app so how i can allocate the xml a specific url and pass that url at receiver end.</p>
<p>Thanks,</p>
| iphone | [8] |
5,672,268 | 5,672,269 | Jribbble Jquery Paging | <p>I'm working on a (web)App for the famous community Dribbble. (3rd party, not their app.)
but using Jquery to get the posts right now. The plugin I use: Jribbble works but hasn't good paging. The Code I'm using right now:</p>
<pre><code> $(document).ready(function () {
$.jribbble.getShotsByList('popular', function (listDetails) {
var html = [];
$.each(listDetails.shots, function (i, shot) {
html.push('<div class="shot">');
html.push('<li><h3>' + shot.title + '</h3>');
html.push('<h4>by ' + shot.player.name + '</h4><a href="' + shot.url + '">');
html.push('<img src="' + shot.image_teaser_url + '" ');
html.push('alt="' + shot.title + '"></a></li>');
html.push('</div>');
});
$('#shotsByList').html(html.join(''));
}, {page: 2, per_page: 10});
});
</code></pre>
<p>So is there a possibility to do, for example:
Page3
and that it adjusts the Javascript or something?
Or perhaps Ajax Reloading, if it isn't that hard.</p>
<p>I've got barely Jquery Experience. Someone who could help me out?</p>
| jquery | [5] |
4,034,434 | 4,034,435 | PHP, get web-page content words | <p>I am building a website that recommend other good website. </p>
<p>Therefore, I collected a lot websites by using crawling system.</p>
<p>Now, I am trying to distinguish whether the website has good words or not by using PHP.</p>
<pre><code>$page_content = file_get_contents($url);
$bad_word = 'damn';
if(strstr($page_content, $bad_word)):
$result = 'YES';
else:
$result = 'NO';
endif;
</code></pre>
<p>My code is something like this.</p>
<p>I use Codeigniter and get this message.</p>
<pre><code>An Error Was Encountered
Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.
</code></pre>
<p>It works fine some website, but it doesn't work for the other website.</p>
<p>Is there other way to retrieve content of the website?</p>
| php | [2] |
432,754 | 432,755 | Android TabActivity Back key Event | <p>I tried to go back when pressing back button in tabActivity. previously i did </p>
<pre><code> public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK)
showDialog(DIALOG_REALLY_EXIT_ID);
return true;
}
private void showlist() {
// TODO Auto-generated method stub
}
</code></pre>
<p>But this event never called in TabActivity. i dont know how to get back from tabActivity, I am new to android, can anyone give me pls. </p>
| android | [4] |
5,415,423 | 5,415,424 | PHP Try Catch Exceptions how does it work | <p>I'm new to try catch in php, and I was playing around with it.</p>
<p>when I try this one, it works fine</p>
<pre><code>try {
if (!$connect)
{
throw new Exception("it's not working");
}
} catch (Exception $e) {
$e->getMessage();
}
</code></pre>
<p>When I try this one, it doesn't work</p>
<pre><code>try {
if (!$connect) {
throw new MyException("it's not working");
}
} catch (MyException $e) {
echo $e->getMessage();
}
</code></pre>
<p>I have only changed the name of the exception, can someone explain where I went wrong pls.
thanks</p>
| php | [2] |
3,275,960 | 3,275,961 | How to hide div onclick in unordered List | <p>In an onclick event, I would like to hide the "closed" <code>li</code> and show the "open" and vice versa.
can I do this in Javascript?</p>
<p>I have the following html:</p>
<pre><code><ul>
<li> link</li>
<li> Liink</li>
</ul>
</code></pre>
| javascript | [3] |
1,958,847 | 1,958,848 | Can you help me with this python exercise? | <p>I want to write a function that takes a list of numbers and returns the cumulative sum; that is, a new list where the ith element is the sum of the first i+1 elements from the original list. For example, the cumulative sum of [1, 2, 3] is [1, 3, 6].</p>
<p>Here is my code so far:</p>
<pre><code> def count(list1):
x = 0
total = 0
while x < len(list1):
if x == 0:
total = list1[0]
print total
x = x +1
else:
total = list1[x] + list1[x -1]
print total
x = x + 1
return total
print count([1, 2, 3, 4, 7])
</code></pre>
<p>HOWEVER, it is not working. </p>
<p>Can you tell me what I am doing wrong? I worked on this for quite some time now. </p>
<p>thanks so much!</p>
<p>Luke</p>
| python | [7] |
4,272,126 | 4,272,127 | if i define something in a class, how do i call in within the class? | <p>i have something like</p>
<pre><code> define("__ROOT_PATH__", "http://{$_SERVER['HTTP_HOST']}/admin");
</code></pre>
<p>within a class. how do i call it from within functions is it with a cologn? i tried looking it up on google but nothing. </p>
<p>thanks</p>
| php | [2] |
5,857,880 | 5,857,881 | Multiple Base64 encoded parameters that appear as 1 in a URL query string | <p>I need to pass 2 parameters in a query string but would like them to appear as a single parameter to the user. At a low level, how can I concatinate these two values and then later separate them? Both values are Base64 encoded.</p>
<pre><code>?Name=abcyxz
</code></pre>
<p>where both abc and xyz are separate Base64 encoded strings. </p>
| asp.net | [9] |
5,390,451 | 5,390,452 | Buttons inside an Android custom listview | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/5846385/how-to-update-android-listview-with-dynamic-data-in-real-time">How to update Android ListView with dynamic data in real time?</a> </p>
</blockquote>
<p>I have a custom <code>listview</code> working with a <code>time value</code> and some <code>buttons</code> to click in it. I currently have the time updated every second via <code>notifyDataSetChanged()</code> in a one second handler method. </p>
<p>This works nicely in updating the time. Unfortunately though it means the views are recreated every second. This means my button press operation isn't very responsive as each time the view is regenerated the button is reset. So if you are pressing a button while the view changes, the press becomes invalid and you have to release the button and then press it again. With a long press the problem is even worse as there isn't enough time to register a long press before the view is regenerated. So a long press never happens. </p>
<p>Is there a way to change data within the listview without have to regenerate the whole view? </p>
<p>Thanks</p>
<p>Trev</p>
| android | [4] |
5,401,570 | 5,401,571 | How to find checked radiobuttons in jQuery from a list of radiobuttons | <p>In the below example I wish to select all the ":checked" radio buttons of the "radios" list. How to?</p>
<pre><code>var radios = someDiv.find("input[type=radio]");
if (radios.length > 0)
{
// I wish to find all the checked radio buttons in the
// "radios" list - this doesn't work:
var checkedRadios = radios.find(":checked");
if (checkedRadios.length == 0)
alert("You have to select an option stoopid");
}
</code></pre>
| jquery | [5] |
5,092,213 | 5,092,214 | Application trust level issue with XmlRpcClientProtocol object Invoke function | <p>We have a web application that uses the XML-RPC.NET library. When I call the Invoke function of the XmlRpcClientProtocol object, I get a permission error. </p>
<p>This only happens on our shared hosting server because we have to run the site in medium trust environment. If I run it on my local machine with full trust it works just fine. The error that is retured is when on a medium trust level is:</p>
<p>Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.</p>
| asp.net | [9] |
5,233,941 | 5,233,942 | Client-Server architechture | <p>I have to create an application that based on repository of something, and when there is new update n the repository do something to the registred user.
something like inverse client-server (as the server open contant the users).
i hope it's clear enought.
the code is written in C# 4.0.
What is the best architecture to do such thing?
Thanks</p>
| c# | [0] |
3,954,393 | 3,954,394 | detecting Android WebView from Javascript/HTML | <p>I'm working on a web application which will normally be accessed from the Android browser, but I need it to display alternate content if it is loaded in a WebView from an Android app. I've been looking for any telltale differences in the UA string or the DOM, but I haven't been able to find any. (Note: I do not control the third-party Android apps, so I cannot make changes to their code.) Are there any ways to detect the WebView from Javascript?</p>
| android | [4] |
4,766,825 | 4,766,826 | How to display tabbar in whole app in android? | <p>Hi I am creating an application. In this I need to display a TabBar in all Activities. I set the TabBar bottom using 4 tabs; <code>home, contact, about and call us</code>.<br>
Inside home tab I have some buttons. When I click inside home any button that time I need to move some other Activity. Using intent I moved to another Activity but here the TabBar was not displayed. However, I need to display the same TabBar in all Activities. If any one knows how to do this, please suggest a solution to me. </p>
<pre><code> DefenceLaywer.java:
public class DefenceLaywer extends TabActivity {
TabHost tabhost;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tabhost = (TabHost)findViewById(android.R.id.tabhost);
TabSpec firstTabSpec = tabhost.newTabSpec("Home");
TabSpec secondTabSpec = tabhost.newTabSpec("Claimonline");
TabSpec thirdTabSpec = tabhost.newTabSpec("CallUs");
TabSpec fourthTabSpec = tabhost.newTabSpec("AboutUs");
// TabSpec thirdTabSpec = tabhost.newTabSpec("Interactive");
firstTabSpec.setIndicator("Home", getResources().getDrawable(R.drawable.home));
secondTabSpec.setIndicator("ContactUs", getResources().getDrawable(R.drawable.contactus));
thirdTabSpec.setIndicator("CallUs", getResources().getDrawable(R.drawable.callus));
fourthTabSpec.setIndicator("AboutUs", getResources().getDrawable(R.drawable.aboutus));
firstTabSpec.setContent(new Intent(this,HomeTab.class));
secondTabSpec.setContent(new Intent(this,ContactUs.class));
thirdTabSpec.setContent(new Intent(this,CallUs.class));
fourthTabSpec.setContent(new Intent(this,AboutUs.class));
tabhost.addTab(firstTabSpec);
tabhost.addTab(secondTabSpec);
tabhost.addTab(thirdTabSpec);
tabhost.addTab(fourthTabSpec);
}
}
</code></pre>
| android | [4] |
1,377,019 | 1,377,020 | What if data: is not used when submitting a form? | <p>When submitting a form using post, what if I dont want it serialized (or going as a string, which i feel is not safe) and want it to be submitted the same way as it would be if I wasn't using jquery? How could I do that?</p>
<pre><code>$.ajax({
type: "POST",
data: $("#sform").serialize(), //don't want to use this part. Want it go just like it would without using jquery
</code></pre>
<p>Is this data: something that "has to be" used? What are the alternatives to this?</p>
| jquery | [5] |
2,747,800 | 2,747,801 | Making a browser and node compatible Javascript library | <p>I am attempting to make a javascript library which I would prefer to be compatible with both browsers and node. However, there is some functionality offered in the node API that isn't offered in browsers (such as compression). I know it would be possible to code this functionality in javascript so it would be cross-compatible, but the node native compression will probably perform much better as it is much lower level.</p>
<p>How should I split between browser-compatible code and code that uses node API?</p>
<p>The way I see it, I could do one of the following:</p>
<ul>
<li>make 2 separate scripts, one for node and one for browsers</li>
<li>make my code figure out the environment it is in and act accordingly</li>
<li>make all my code the same, but lose some performance improvements I would have had in node</li>
</ul>
<p>What should I do to solve this?</p>
| javascript | [3] |
3,942,432 | 3,942,433 | javascript google maps remove icon | <p>I am attempting to remove the custom icons from the google map and reset the map to the default zoom and lat lng. </p>
<p>here is my function:</p>
<pre><code>function clearLocations() {
infoWindow.close();
for (var i = 0; i < markers.length; i++) {
markers[i].setMap(null);
}
markers.length = 0;
sidebar.innerHTML = "";
map.setCenter(new google.maps.LatLng(36.1611, -116.4775), 6);
}
</code></pre>
<p>the map will reset to the default latlng, zoom level stays the same, and the sidebar htmk us removed. however the icons stay on the map. not undestanding why this is ocurring.
many thanks,
--matt</p>
<p>EDIT -- my apologies for not including the markers</p>
<pre><code>function createMarker(latlng, name, address, city, state, zipcode, telephone, images, url) {
var html = "<div>stuff here</div>";
var marker = new google.maps.Marker({
icon: icon,
map: map,
position: latlng
});
google.maps.event.addListener(marker, 'click', function() {
infoWindow.setContent(html);
infoWindow.open(map, marker);
});
return marker;
}
</code></pre>
| javascript | [3] |
2,904,544 | 2,904,545 | Array sort keys numerically help | <pre><code>$test1[2] = "one";
$test2[1] = "two";
$test2[3] = "three";
$test = $test1 + $test2;
print_r($test);
</code></pre>
<p>I've used the array union operator but when i print the array it is in the wrong order.</p>
<pre><code>Array ( [2] => one [1] => two [3] => three )
</code></pre>
<p>How do i sort the keys numerically in the array?; so i get the below result.</p>
<pre><code>Array ( [1] => two [2] => one [3] => three )
</code></pre>
| php | [2] |
2,139,093 | 2,139,094 | formatting a string in java | <p>I would like to know how to provide a formatting capabilities that enable the user to specify the number of digits of precision to the right of a decimal number. so instead of using the classical formatting .2f or .3f etc.. I want the user to be able to enter the precision of the decimal number.</p>
<p>i have a code written as follows</p>
<pre><code>Scanner input = new Scanner (System.in);
int precision = input.nextInt();
addNumbers.numberRepresentaiton(int precision);
</code></pre>
<p>The method is defined as below</p>
<pre><code>private String numberRepresentation(int precision)
{
return String.format("%.precisionf", add);
}
</code></pre>
<p>executing the above results in conversion formatting error.
Thank you for your time.</p>
| java | [1] |
4,138,896 | 4,138,897 | parsing primitive types using java.util.Scanner | <p>I'm new to java so forgive the noob question.</p>
<p>I have created a swing application that basically has three input strings in JTextFields:
loanAmount, interestRate and loanYears and a single submit button with the EventAction.</p>
<p>I'm trying to use the java.util.Scanner to parse the input to primitive types that I can use in calculations.</p>
<p>I'm getting an error in NetBeans indicating that my variables are not recognized?
should I not be calling System.in?</p>
<pre><code>private void submitButtonActionPerformed(java.awt.event.ActionEvent evt) {
Scanner keyInput = new Scanner(System.in);
while (true)
try{
double amount = keyInput.nextDouble(loanAmount.getText());
double interest = keyInput.nextDouble(interestRate.getText());
int years = keyInput.nextInt(loanYears.getText());
} catch (NumberFormatException nfe){
}
}
</code></pre>
| java | [1] |
5,799,791 | 5,799,792 | How can I work with a database in Android? | <p>How can I connect to and insert and select data from a database in Android?</p>
| android | [4] |
4,778,829 | 4,778,830 | Read Data from text file on server using $.ajax to call a php script | <p>This is my first time posting on this site. I have looked over several of the previous postings related to this topic, but did not find anything that works for me. I am trying to use javascript and jquery $.ajax to call a php script on the server and return the contents of the file. Thus far I am not getting any data back. I am able to update the .txt file on the server using the $.ajax, but could use some help in finding out what I am doing wrong to retrieve it. I do not see any errors being generated from the php script and the events.txt file is not blank. vb.net and c# are my native languages so this is a bit foreign to me.</p>
<p>My js is:</p>
<pre><code>function readText() {
var url = "readdata.php";
var result = "";
$.ajax({
url: url,
type: 'get',
dataType: 'text',
success: function (data) {
result = data;
alert(result);
},
async: false
});
}
</code></pre>
<p>and my readdata.php script is:</p>
<pre><code><?
$file=fopen("events.txt","r");
$read=fread($file,filesize("events.txt"));
fclose($file);
echo $read;
?>
</code></pre>
<p>Any advise is welcome. Thanks!</p>
| jquery | [5] |
1,586,872 | 1,586,873 | Get error messages when I have a syntax error? | <p>I have a class and the commented line is failing (clearly because I don't need the <code>$</code> before <code>displayname</code>), however I ended up having to put a bunch of <code>echo</code> statements in to figure that out because an error isn't being thrown.</p>
<p>I'm hoping there is a way.</p>
<pre><code>class RegisterModel {
var $displayname;
...
function RegisterModel() {
try {
if (empty($_POST) === false) {
// THIS LINE IS FAILING ... BUT I'M NOT GETTING AN ERROR
// I KNOW WHY IT'S FAILING ... BUT I WANT AN ERROR TO THROW
$this->$displayname = $_POST['displayname'];
...
}
}
catch (Exception $e) {
echo $e->getMessage();
}
}
}
</code></pre>
<p>Should the error be getting thrown into the <code>catch</code> and I'm just not using it right? Is there some global setting I need to set so that the errors are thrown?</p>
| php | [2] |
4,350,826 | 4,350,827 | Reload View only when application is opened Again | <p>My application has tab bar with one of the tabs having a segmented control on navigation bar.
Based on segment clicked different view is displayed using a url.
I am calling the url in viewdidload method.I do not want to use viewwillAppear to call the url as it will be called each time the view is displayed.
I only want to call the url again whenever user closes the application and comes back.</p>
<p>Whats the best way to do this.Should I remove the view controller from and reload it again once the application is opened.</p>
| iphone | [8] |
2,255,521 | 2,255,522 | Create 7zip file in parts using sevenzip Library c# | <p>I want to 7zip the directory and creates parts of lets say 100mb each with names test001.7zip , test002.7zip , ... and so on.</p>
<pre><code>string sevenzip = System.Configuration.ConfigurationManager.AppSettings["7zippath"].ToString();
SevenZip.SevenZipCompressor.SetLibraryPath(sevenzip);
SevenZip.SevenZipCompressor Compress = new SevenZipCompressor(sFilePath);
Compress.ArchiveFormat = OutArchiveFormat.SevenZip;
Compress.CompressDirectory(sFilePath, "Zip.7zip");
</code></pre>
<p>this code creates the 7zip file of the directory successfully, but it doesnot create file in parts, I want to create the file in parts because I have to upload this file in parts of 100mb each ?</p>
| c# | [0] |
2,466,583 | 2,466,584 | How do I Install .apk files in the android emulator? | <p>I want to install my .apk file in android emulator.But I have multiple emulators opened(5554,5556) and i don't want to close any one of the emulator how to install a .apk file in an emulator when there is multiple emulators are opened?</p>
| android | [4] |
4,333,527 | 4,333,528 | Expression is a value and therefore cannot be the target of an assignment - asp.net | <p>I'm getting the above error. It is working in Dev mode but not on live, any ideas?</p>
<p>There are proper values in the reader as I've written them to a text file....</p>
<pre><code> Do While reader.Read()
personList.Add(New Person() With {.ID = reader("user_id"), .Name = reader("person")})
Loop
</code></pre>
<p>Thanks,</p>
<pre><code>Public Class Person
Private m_ID As Integer
Public Property ID() As Integer
Get
Return m_ID
End Get
Set(ByVal value As Integer)
m_ID = value
End Set
End Property
Private m_Name As String
Public Property Name() As String
Get
Return m_Name
End Get
Set(ByVal value As String)
m_Name = value
End Set
End Property
</code></pre>
| asp.net | [9] |
5,197,510 | 5,197,511 | How to extend this jQuery function | <p>I want to extend this function and make my own, this new function should have same functions as the old one but additionalOkClicked should be overwritten with my own function.</p>
<p>How do I do this?</p>
<pre><code> (function ($) {
$.LocationDialog = {
mainInit: function()
{
//some code here
},
init: function(callingNum)
{
//some code here
},
additionalOkClicked: function()
{
//i want to override this function
}
};
})(jQuery);
</code></pre>
| jquery | [5] |
1,416,484 | 1,416,485 | Convert from Bool to boolean | <p>I calling to method with get.bool and getting bool value and
I need to update other method which needs to get type of boolean(
Value.setValue( )) ,</p>
<pre><code>Bool aa = Entry.getBool();
Value.setValue(aa );
</code></pre>
<p>since I using aa i getting message
The method setValue(Boolean) in the type BooleanValue is not applicable for the arguments (Bool)</p>
<p>how should i do this casting?</p>
| java | [1] |
338,384 | 338,385 | How to set focus to a web control in ASP.NET | <p>Question: What is the best way to set focus to a web control in ASP .NET.</p>
<p>I can do it, but it's ugly. I have a web control wrapped in a web control hosted on a web page. So, if you do a view | source on the page the id is something like WrapperControl_Control_TextBox.</p>
<p>I've tried the "tried and true" Javascript methods of grabbing the element and setting it's focus: document.getElementByID( "WrapperControl_Control_TextBox" ).focus(); and it didn't work. I'm not sure why.</p>
<p>I know I could possibly do:
document.getElementById( "<%= TextBox.ClientID %>" ).focus(); too, I think. This won't work because of another totally separate error based on the fact you can't dynamically add controls to a header if there is a "<% %>" in the page. GAH.</p>
<p>In the "bottom-most" control, I've tried setting the focus (TextBox.Focus() in Page_Load) and that doesn't work either.</p>
<p>Anyway, the way that works is by simply taking the ControlsCollection of the Page, grabbing the control I need from that, getting it's collection, grabbing the next lower control and so forth.</p>
<p>I only have to do this seven times. So I have eight foreach loops.</p>
<p>Basically, my code is like this:</p>
<p>///////////////////////////////
// On the page
///////////////////////////////</p>
<pre><code>ControlCollection controls = Controls;
foreach( Control control in controls)
{
if ( string.Equals( control.ID, "FormID", StringComparison.InvariantCultureIgnore ) )
{
ControlCollection nextControls = control.Controls;
foreach( Control nextControl in nextControls )
{
if ( string.Equals( nextControl.ID, "DivICareAboutInTheForm", StringComparison.InvariantCultureIgnor ) )
{
ControlCollection nextNextControls = nextControl.Controls;
//:
//:
//Yes, it's that bad and so forth.
//:
//:
}
}
}
}
</code></pre>
| asp.net | [9] |
3,188,326 | 3,188,327 | DataKey names in Form view | <p>How to access dataKey values</p>
<pre><code> <asp:FormView ID="FormView1" runat="server" Style="margin-right: 65px"
DataKeyNames="MMBProfileID"
<ItemTemplate>
<table id="FormViewTable" style="width: 100%;">
<tr>
<td>
Name:
</td>
<td>
<%# Eval("MMB_Name") %>
</td>
</code></pre>
<p></p>
<pre><code> protected void Page_Load(object sender, EventArgs e)
{
MMBProfileId = Convert.ToInt32(FormView1.DataKey["MMBProfileID"]);
FormView1.DataSource = objBLL.Execute_ViewBusinessProfile(MMBProfileId);
</code></pre>
<p>}
This is giving me an error.
Input string not in correct format at (FormView1.DataKey["MMBProfileID"]);</p>
<p>Any hints will be appreciated
Thanks
Sun</p>
| asp.net | [9] |
5,011,570 | 5,011,571 | How do I access the contents of a variable from a file imported in a console? | <p>I have a file, light.py that I'm trying to debug. In the python console, I type "import light" and it runs the program. But I want to check the contents of some variables by typing the variables. How do I do that? </p>
| python | [7] |
5,558,541 | 5,558,542 | on slideup can I clear out the input text field in jQuery? | <p>I have this little snippet in jQuery </p>
<pre><code> $('.cake_checkboxes').click(function(){
$(this).nextAll('.quantity').first().slideToggle();
});
</code></pre>
<p>here is my html</p>
<pre><code><input id="option-value-24" class="cake_checkboxes" type="checkbox" value="24" name="option[232][]" style="vertical-align: bottom;">
<label for="option-value-24"> Vanilla </label>
<div class="quantity" style="">
<span>
<input class="cake_quantities" type="text" name="quantity_24" size="3">
</code></pre>
<p>and I was wondering how to on slideUp how can i clear the value of the next cake_quantities input field...any ideas</p>
| jquery | [5] |
3,088,272 | 3,088,273 | Could someone with Python expertise check this code please? | <p>When I run <a href="http://gunslingerc0de.wordpress.com/2010/06/04/381/" rel="nofollow">this</a> prog it doesn't run for some reason. The author's notes at the top of the code on the link provided show example output, like for example "encode/decode" doesn't appear in place of <code>%sencode%s</code> / <code>%sdecode%s</code>, so not sure what the problem is.</p>
<pre><code>#!/usr/bin/python
import binascii, sys, time
RED = '\033[31m'
WHITE = '\033[37m'
RESET = '\033[0;0m'
def main():
print "shellcode hex encode decoder"
print "programmer : gunslinger_ <yudha.gunslinger[at]gmail.com>"
print "what do you want to do ? %sencode%s / %sdecode%s" % (RED, RESET, WHITE, RESET)
q = raw_input("=> ")
if q == "encode":
inputtype = raw_input("Please input data : ")
print "shellcode => ",
for encoded in inputtype:
print "\b\\x"+encoded.encode("hex"),
sys.stdout.flush()
time.sleep(0.5)
print RESET
elif q == "decode":
inputtype = raw_input("Please input data : ")
cleaninput = inputtype.replace("\\x","")
print "hex => ",cleaninput
print "plaintext => ",
print "\b"+cleaninput.decode("hex")
else:
print "wrong answer ! your choice is %sencode%s or %sdecode%s" % (RED, RESET, WHITE, RESET)
sys.exit(1)
if __name__ == '__main__':
main()
</code></pre>
| python | [7] |
1,461,306 | 1,461,307 | ToogleButton align text label on the right | <p>I want to align the text in a <code>ToogleButton</code> on the right of that bar that became green/white when pressing it.</p>
<p>To be more explicit I will post the code and also the result I have now.</p>
<pre><code> <ToggleButton android:id="@+id/ToggleButton01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout_gravity="center_vertical"
android:textOff="Off"
android:textOn="On"/>
ToggleButton onOffButton = (ToggleButton) findViewById(R.id.ToggleButton01);
onOffButton.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
onOffButton.setPadding(0, 0, 5, 0);
</code></pre>
<p>and the result:
<img src="http://i.stack.imgur.com/CDoZ0.png" alt="enter image description here"></p>
<p>I want the bar and the text to not be overlapped.</p>
| android | [4] |
532,474 | 532,475 | How to create an in-memory zip file with directories without touching the disk? | <p>In a python web application, I'm packaging up some stuff in a zip-file. I want to do this completely on the fly, in memory, without touching the disk. This goes fine using ZipFile.writestr as long as I'm creating a flat directory structure, but how do I create directories inside the zip?</p>
<p>I'm using python2.4.</p>
<p><a href="http://docs.python.org/library/zipfile.html" rel="nofollow">http://docs.python.org/library/zipfile.html</a></p>
| python | [7] |
3,118,561 | 3,118,562 | How can I flatten lists without splitting strings? | <p>I'd like to flatten lists that may contain other lists <em>without</em> breaking strings apart. For example:</p>
<pre><code>In [39]: list( itertools.chain(*["cat", ["dog","bird"]]) )
Out[39]: ['c', 'a', 't', 'dog', 'bird']
</code></pre>
<p>and I would like</p>
<pre><code>['cat', 'dog', 'bird']
</code></pre>
| python | [7] |
2,083,216 | 2,083,217 | How to call void function in other class? | <p>I want to call one void function into many view controllers so how can i do it? please suggest me some idea. </p>
| iphone | [8] |
4,685,460 | 4,685,461 | Failure delivering result ResultInfo{who=null, request=0, result=-1, data=null} to activity | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3275749/im-getting-a-nullpointerexception-when-i-use-action-image-capture-to-take-a-pict">I'm getting a NullPointerException when I use ACTION_IMAGE_CAPTURE to take a picture</a> </p>
</blockquote>
<p>I have some code. </p>
<pre><code>Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
File photo = new File(CamDir, filename);
imageUri = Uri.fromFile(photo);
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo));
startActivityForResult(intent, 0);
public void onActivityResult(int requestCode, int resultCode, Intent data) {
Bitmap bitmap = null;
if (resultCode == Activity.RESULT_OK && requestCode == 0) {
Uri selectedImage = imageUri;
ContentResolver cr = getContentResolver();
bitmap = android.provider.MediaStore.Images.Media.getBitmap(cr, selectedImage);
}
</code></pre>
<p>1.the phone in vertical position.<br>
2.start the application.<br>
3.press the button to take a photo.<br>
4.press Ok. (save photo)<br>
Everything fine.</p>
<p>1.the phone in vertical position.<br>
2.start the application.<br>
3.press the button to take a photo.<br>
4.rotate the phone to horizontal position.<br>
5.press Ok. (save photo)<br>
Have error </p>
<pre><code>E/AndroidRuntime(22779): java.lang.RuntimeException: Failure delivering result
ResultInfo{who=null, request=0, result=-1, data=null} to activity
com.photo/com.photo.PhotoActivity}:
java.lang.NullPointerException
</code></pre>
<p>I think when I rotate the phone to horizontal position intent was reloaded, and camera not<br>
know where to send results.<br>
How to fix this problem.</p>
| android | [4] |
4,372,445 | 4,372,446 | What does this JS do? | <pre><code>var passwordArray = pwd.replace(/\s+/g, '').split(/\s*/);
</code></pre>
<p>I found the above line of code is a rather poorly documented JavaScript file, and I don't know exactly what it does. I think it splits a string into an array of characters, similar to PHP's str_split. Am I correct, and if so, is there a better way of doing this?</p>
| javascript | [3] |
3,214,061 | 3,214,062 | Need to set a variable based on the value of the selected item in a dropdown | <p>I'm trying to set a variable to the value of the selected item in a dropdown but can't get it to work properly. Here is the html:</p>
<pre><code><select id="locationChoice" name="WorkflowList">
<option value=" ">-- Please Select --</option>
<option value="14643">Item A</option>
<option value="14644">Item B</option>
<option value="14645">Item C</option>
</select>
</code></pre>
<p>Here's the jquery:</p>
<pre><code> var rfiSchooldropdown = $('#locationChoice:selected').val();
$("#locationChoice").change(function() {
alert(rfiSchooldropdown);
});
</code></pre>
<p>I know I'm close but it's not grabbing the value properly. I'm using "alert" to test, FYI.</p>
<p>Any help is appreciated!</p>
| jquery | [5] |
37,669 | 37,670 | android google map view | <p>i am using android Google map, the map is displayed in emulator but not in the device.. can any one help me to solve the problem.</p>
| android | [4] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.