Unnamed: 0 int64 65 6.03M | Id int64 66 6.03M | Title stringlengths 10 191 | input stringlengths 23 4.18k | output stringclasses 10
values | Tag_Number stringclasses 10
values |
|---|---|---|---|---|---|
2,357,912 | 2,357,913 | How to change the properties ofthe button at a Cell in a DataGridViewButton ? - c# | <p>How to change the properties ofthe button at a Cell in a DataGridViewButton?
this my code - I get error code -...us read only
(DataGridViewButtonCell)MyDGV.Rows[i].Cells[3].Visible= true;</p>
| c# | [0] |
3,936,838 | 3,936,839 | How to use data of one application into other application in Android | <p>i want to send input data in one application to the other application using "intent" or can we store user input from one application that can be used by other application.</p>
| android | [4] |
4,491,297 | 4,491,298 | What's the difference between these two lines? (C#) | <p>In the following italicized code, why don't we put "IntIndexer" in front of <em>myData = new string[size];</em> since <em>Customer cust = new Customer();</em> (assuming Customer is the name of the class): </p>
<pre><code>*Customer cust = new Customer();*
</code></pre>
<p>using System;</p>
<pre><code>/// <summary>
/// A simple indexer example.
/// </summary>
class IntIndexer
{
private string[] myData;
public IntIndexer(int size)
{
*myData = new string[size];*
for (int i = 0; i < size; i++)
{
myData[i] = "empty";
}
}
</code></pre>
| c# | [0] |
1,247,459 | 1,247,460 | ASP.net call SQL Server store procedure problem. | <p>I am trying to call a stored procedure in an ASP.NET page and get its return value. Here is my code:</p>
<pre><code>//Something
MyConnection.Open();
SqlDataReader reader = MyCommand.ExecuteReader();
if (reader.Read())
{
if (returnParameter != null)
result = Convert.ToInt32(reader[returnParameter.ParameterName]);
}
//Something else
</code></pre>
<p>Everything is working fine, except that the <code>reader.Read()</code> is always returning false, so I cannot get the return value. And the stored procedure is executed. This is confirmed from the server side. There's no exception raised.</p>
<p>What is the problem? </p>
| asp.net | [9] |
354,961 | 354,962 | android Setonclicklistener doesn't work with menu's items | <p>i have a menu that contains just one item. </p>
<pre><code>Button exit;
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// TODO Auto-generated method stub
super.onCreateOptionsMenu(menu);
MenuInflater blowUp = getMenuInflater();
blowUp.inflate(R.menu.exitmenu, menu);
return true;
}
exit=(Button)findViewById(R.id.bexitMenuExit);
</code></pre>
<p>if i add listener to exit button , i got excpetion (null pointer), i am sure that there is no syntax error, the button exit is comming from this menu</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/bexitMenuExit"
android:title="Exit"
android:icon="@android:drawable/ic_menu_close_clear_cancel"
></item>
</menu>
</code></pre>
<p>what am i doing wrong?</p>
| android | [4] |
153,546 | 153,547 | PHP: how can I convert jpeg to png and then zip (without making a copy) | <p>So what I'm trying to do is:
- given an image url -> convert image to png
- zip resulting png</p>
<p>I have the following code which successfully does the conversion and zipping (I'm going to expand it later to test the extension to auto convert formats):</p>
<pre><code>$file = "../assets/test.jpg";
$img = imagecreatefromjpeg($file);
imagePng($img, "files/temp.png" );
$zip->addFile( "files/temp.png", "test.png" );
</code></pre>
<p>What I want to know is, is it possible to do this without creating a copy of image before it's zipped</p>
| php | [2] |
2,591,423 | 2,591,424 | Stream screen to PC | <p>I'm looking for a solution to stream the android screen to PC. I tried out ashot, androidscreencast, droid@screen but their FPS are too slow (but work all fine). Did someone know another program to cast the screen with a higher rate of FPS?</p>
| android | [4] |
398,645 | 398,646 | How to add element to a generic collection | <p>I am wondering how to add a specialized object to a generic collection</p>
<p>I am using the following code</p>
<pre><code>Collection<T> c;
Class1 object1 = new Class1()
c.add((T)object1)
</code></pre>
<p>Is this the correct way?</p>
| java | [1] |
1,527,489 | 1,527,490 | Auto-rotate screen not honoured when turned off | <p>I have a rather strange situation, first of all, I don't ever specify anything for the screenOrientation value of any of my activities.</p>
<p>However, when I turn off "auto-rotate screen" in the global settings of my Xoom running Android 4.0.4, my application, and only my application, continues to auto-rotate.</p>
<p>What am I doing wrong? Why does my application continue to auto-rotate?</p>
| android | [4] |
968,553 | 968,554 | What does "Complex is better than complicated" mean? | <p>In "The Zen of Python", by Tim Peters, the sentence "Complex is better than complicated" confused me. Can anyone give a more detailed explanation or an example? </p>
| python | [7] |
5,391,142 | 5,391,143 | JS: join()-ing an array of objects | <p>Say I have an array of objects that I want to be able to access as hashes sometimes (to change their values, eh?) and sometimes print. </p>
<pre><code>var test = { members : [] };
test.addMember = function(name, value) {
this.members[name] = { name : name, value : value };
this.members[name].toString = function() {
return this.name + " has a " + this.value; };
};
test.toString = function() {
return this.members.join(" and ");
};
test.addMember("a", "a value");
test.addMember("b", "b value");
alert(test);
</code></pre>
<p>My Goal here is to have test.toString() return:</p>
<pre><code>a has a value and b has b value
</code></pre>
<p>or what-have-you. I was reading on the MDN, and it seems that JavaScript 1.8.5 (or some subrevision) will have a join() that calls toString(). Am I stuck?</p>
<p>Thanks!</p>
<p>EDIT: Here's my FINAL design, with a modify and delete function included (in case anyone was curious)!</p>
<pre><code>var test = {
members : [],
modifyMember : function(name, value) {
var index = this.members.indexOf(this.members[name]);
if(index < 0) {
return;
}
this.members[index].value = this.members[name].value = value;
},
addMember : function(name, value) {
if(this.members[name]) {
this.modifyMember(name, value);
return;
}
this.members[name] = {
name : name,
value : value,
toString : function() {
return this.name + " has " + this.value;
},
};
this.members.push(this.members[name]);
},
removeMember : function(name) {
if(!this.members[name]) return;
this.members.splice(this.members.indexOf(this.members[name]), 1);
delete this.members[name];
},
toString : function() {
return this.members.join(" AND ");
}
};
</code></pre>
| javascript | [3] |
1,948,348 | 1,948,349 | Get URL content with jquery | <p>I know get content in PHP with <code>file_get_contents('url')</code> but I don't know how to get content with jQuery. please guide me how to load content of URL: <a href="http://vnexpress.net" rel="nofollow">http://vnexpress.net</a>.</p>
| jquery | [5] |
1,892,126 | 1,892,127 | Animated image not happening after request went to server | <p>If I don't validate the field and upload the file, image getting spin up in the firefox too.
So anyone can Please help me out on the above mentioned issue.
Following is my Jquery</p>
<pre><code> jQuery(function ($) {
// Load dialog on page load
//$('#basic-modal-content').modal();
// Load dialog on click
$('#basic-modal .basic').click(function (e) {
if (document.uploadFileForm.fileData.value.length == 0 ) {
alert("Need to Select a file");
return false;
}else{
$('#basic-modal-content').modal();
}
return true;
});
});
</code></pre>
<p>Following is my Jquery plug in
script type='text/javascript' src='../js/jquery.simplemodal.js'></p>
| jquery | [5] |
5,076,432 | 5,076,433 | Convert a jquery to a jquery noConflict | <p>I have this piece of javascript code and I must convert it with jquery noConflict in order to make it work with wordpress jquery. Do you have any clue to do this?</p>
<pre><code>var initCharts = function() {
var charts = $('.percentage');
charts.easyPieChart({
animate: 2000
});
}
</code></pre>
<p>Thanks for your help</p>
| jquery | [5] |
1,980,451 | 1,980,452 | jQuery show/hide element when hovering another element | <p>I have the following HTML as an example:</p>
<pre><code><div id="header">
<div class="pagination"></div>
</div>
</code></pre>
<p>and the following jQuery which should hide the pagination by default but then fade it in when a user hovers the header and then fades it back out when they move off the header:</p>
<pre><code> $(".pagination").hide();
$("#header").mousemove(function()
{
$(".pagination").fadeIn(1500);
});
$("#header").mouseleave(function()
{
$(".pagination").fadeOut(1500);
});
</code></pre>
<p>The problem I have is that it will run through the code the same number of times a user hovers the header so for example if I hovered 5 times in a row the pagination would fade in and out 5 times. This is not the function I want, rather a simple fade in and out when a user is hovering the header.</p>
<p>Can anyone help? Thanks.</p>
| jquery | [5] |
2,291,704 | 2,291,705 | use of exception in inheritance | <pre><code>class B {
void process()throws Exception{
System.out.println("hi sh");
}
}
class C extends B {
void process(){
System.out.println("hhhhhh");
}
public static void main(String args[]){
B a=new C();
try{
a.process();
}
catch(Exception e)
{
}
}
}
</code></pre>
<p>Here while calling the process method, we have to use a try catch block. But, if I store the object of C in reference variable of C only i.e. <code>C a=new C()</code> then try catch block is not needed.</p>
<p>Can anyone tell me the reason why?</p>
| java | [1] |
2,062,734 | 2,062,735 | How to style a scroller using Javascript | <p>I have a site where on the sidebar I have some videos with a scrollbar (http://mibsoftware.us/clients/raveis), I need to figure out how style this scrollbar so it can be a different color, etc. What is best way to do this? Any help would be greatly appreciated.</p>
<p>the scroller is inside a div </p>
| javascript | [3] |
2,294,276 | 2,294,277 | how to calculate the 5th date from a date in javascript | <p>I have a date in a javascript variable </p>
<pre><code>var cDate='07/21/2012' `(mm/dd/YYY format)`
</code></pre>
<p>I need to find out the 5th day from the date in <code>cDate Variable</code> </p>
<p>ie newDate=<code>'07/26/2012'</code></p>
<p>suppose if the <code>cDate='07/28/2012' then newDate='08/2/2012'</code>
But I did know how. I have tried a lot and searched but my result is wrong.</p>
<p>Please replay </p>
<p>thanks in advance</p>
| javascript | [3] |
2,796,083 | 2,796,084 | combining hash tables and writing to file | <p>i have 2 hash tables that i have created. Of those 2 hash tables, they both have the same key, but different values. I have sorted both of the hash tables using a sorted list to have the keys in order on both tables. What i am attempting to do is have both hash tables written to a text file, and in this text file, it will have the Key (which is the same in both hash tables) with the value from hash table one and the value from hash table 2 next to it. The data is separated by a TAB and will look something like what is below:</p>
<pre><code>Key Value Value
128 123 6
143 255 4
</code></pre>
<pre><code>Hashtable frequency = new Hashtable();
Hashtable grouplist = new Hashtable();
SortedList Grp = new SortedList (grouplist);
SortedList Freg = new SortedList(frequency);
foreach (DictionaryEntry entry in Grp)
{
foreach (DictionaryEntry maxval in Freq)
{
file.Write(entry.Key);
file.Write("\t");
file.Write(entry.Value);
file.Write("\t");
if(Freq[entry.Key].Equals(Grp[maxval.Key]))
{
file.WriteLine(maxval.Value);
}
}
}
</code></pre>
<p>I have tried numerous ways to get it to write just the Key and Value from one hash table and the value from the second hash table, but it just repeats writing each Key 75 times (which is the total number of Keys both Hash Tables.</p>
<p>I have many variations of the above code and they all do the same thing (can post them if needed). Any help would be appreciated.</p>
<p>Also, the only way i can get it to work and write what is needed (75 times each) is if i put a - ! - in the if statement, even though both Keys are the same. I even checked to make sure they were the same when debugging the program.
- Thanks</p>
| c# | [0] |
5,202,014 | 5,202,015 | How to change background image on button hover in jquery? | <p>I want to change background image of button on mousehover event.<br/>
I am using following code:</p>
<pre><code> $("#btnCBI").hover(function () {
$(this).css({ "background-image": "/Tulips.jpg" });
});
</code></pre>
| jquery | [5] |
3,032,568 | 3,032,569 | Create Bitmap from Collection of BitmapSources | <p>I would like to create the Bitmap from BitmapSource Collection and Each source source should be one frame.</p>
<p>I wrote the following code</p>
<pre><code>MemoryStream memStream = new MemoryStream();
BitmapEncoder enCoder = new GifBitmapEncoder();
foreach (BitmapSource source in BitmapSources)
enCoder.Frames.Add(BitmapFrame.Create(source));
enCoder.Save(memStream);
_Bitmap = new DrawingCtrl.Bitmap(memStream);
DrawingCtrl.ImageAnimator.Animate(_Bitmap, OnFrameChanged);
</code></pre>
<p>and</p>
<pre><code>private void OnFrameChangedInMainThread()
{
DrawingCtrl.ImageAnimator.UpdateFrames(_Bitmap);
Source = GetBitmapSource(_Bitmap);
InvalidateVisual();
}
</code></pre>
<p>But it shows <code>"Exception has been thrown by the target of an invocation."</code>. Could anyone help me?</p>
| c# | [0] |
1,077,869 | 1,077,870 | how to remove the string | <pre><code>$data[2]=UploadPic/'nike--1.jpg;UploadPic/'nike--1-8221-2.jpg;UploadPic/'nike--u65B0-8221-3.jpg
</code></pre>
<p>i want to remove <code>UploadPic</code>. namely: </p>
<pre><code> $data[2]=/'nike--1.jpg;/'nike--1-8221-2.jpg;/'nike--u65B0-8221-3.jpg
</code></pre>
<p>how do i do?</p>
| php | [2] |
4,917,268 | 4,917,269 | ASP.NET All Upper Case String, bring to lower and Capitalise all words | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1943273/convert-all-first-letter-to-upper-case-rest-lower-for-each-word">Convert all first letter to upper case, rest lower for each word</a> </p>
</blockquote>
<p>Hey currently I am receiving a string i.e. company name in all caps.</p>
<p>I want to make this more userfriendly and was thinking of just bringing the first letter of all words to uppercase.</p>
<p>i.e</p>
<p>Then im just wondering how it would work for cases such as</p>
<p>SKILLSHARE INTERNATIONAL (IRELAND)</p>
<p>CITY OF DUBLIN YOUNG MEN'S CHRISTIAN ASSOCIATION LIMITED</p>
| asp.net | [9] |
4,121,385 | 4,121,386 | Android-RoundCorner for a imageView | <p>I am new to android.I what to know how to apply round corner to imageview.</p>
<p>I have applied border for the imageview but it does not draw round corner for the image.
If any one knows Please help me.Thanks in advance......</p>
<p><img src="http://i.stack.imgur.com/MFswQ.png" alt="alt text"></p>
| android | [4] |
1,681,093 | 1,681,094 | show html div if count of numbers equal 16 (cc verfication) | <p>I am beginner with javascript.</p>
<p>I am trying to make something with javascript.</p>
<p>But I have ended up with a lot of inoperative codes</p>
<p>This is my html code</p>
<pre><code><input name="cc_number">
<div id="hidee" style="display:none">
<input name="cvv2">
</div>
</code></pre>
<p>I am trying to make it shown by javascript, if the number of chars in the "cc_number input" is 16</p>
<p>My idea is counting characters and make a condition if they equals 16 then show the div.</p>
<p>but I failed to build the code.</p>
<p>Thanks</p>
| javascript | [3] |
2,838,453 | 2,838,454 | What is the time complexity of this function? | <p>I would like to ask about the time complexity of my function. Below is my function written in C++.</p>
<pre><code>void List::swap(List& other)
{
List temp;
Iterator r = begin();
Iterator i = other.begin();
while(!i.equals(other.end()))
{
temp.push_back(i.position->data);
i = other.erase(i);
}
while(!r.equals(end()))
{
other.push_back(r.position->data);
r = erase(r);
}
r = temp.begin();
for(r; !r.equals(temp.end()); r.next())
{
push_back(r.position->data);
}
}
</code></pre>
<p>The function purpose is swapping elements of two linked lists. The exercise requires this function to be executed in O(1) time. Because I used 3 loops, I wasn't sure how exactly to count the time complexity for mine function. </p>
| c++ | [6] |
2,171,781 | 2,171,782 | Saving hex values to a C++ string | <p>I have a simple question but was not able to find an answer on the internet.
I am using the native WiFi API of Windows and trying to get the MAC of an access point.</p>
<p>Inside a structure of type WLAN_BSS_ENTRY there is a field named dot11Bssid which is basically an array of 6 unsigned chars.</p>
<p>What I want to do, is to have the MAC address in an std::string like this: 'AA:AA:AA:AA:AA:AA'.</p>
<p>I can print the adress like this:</p>
<pre><code>for (k = 0; k < 6; k++)
{
wprintf(L"%02X", wBssEntry->dot11Bssid[k]);
}
</code></pre>
<p>But I am unable to find a way of moving this values to a string with the format identified above.</p>
<p>Help is appreciated, if you wonder why do i want this in a string, I have the need to compare it with a string formatted that way.
Thanks in advance for your time.</p>
| c++ | [6] |
3,212,465 | 3,212,466 | GPS application with CLCorelocation | <p>I am developing a GPS application in which I need to track the speed of the device/iPhone.<br>
I am using the CLCorelocation API's Locate me referral code provided by Apple. My problem is that the <code>LocationManager</code> does not update the current latitude and longitude thus I am unable to calculate the distance as well as the speed of the device/iPhone.</p>
<p>Any kinds of suggestions/code will be highly appreciated please suggest if I can do something with the Mapkit framework introduced in the sdk 3.0.</p>
| iphone | [8] |
3,140,033 | 3,140,034 | obtaining named attributes of self | <p>according to my understanding of concatenation this code should work:</p>
<pre><code>aList = ["first", "second", "last"]
for i in aList:
print self.i
</code></pre>
<p>My class defines the bindings <code>self.first=something</code> as well as <code>self.second</code> and <code>self.last</code>. When I write <code>print self.first</code> the code works but <code>print self.i</code> raises an exception. What am I doing wrong?</p>
| python | [7] |
1,780,399 | 1,780,400 | how to fix "'System.AggregateException' occurred in mscorlib.dll" | <p>I receive such problem in debugger and program stops executing. Debugger doesn't show me the line so I don't know what to fix.</p>
<blockquote>
<p>An unhandled exception of type 'System.AggregateException' occurred in
mscorlib.dll</p>
<p>Additional information: A Task's exception(s) were not observed either
by Waiting on the Task or accessing its Exception property. As a
result, the unobserved exception was rethrown by the finalizer thread.</p>
<p>Cannot obtain value of local or argument '' as it is not
available at this instruction pointer, possibly because it has been
optimized away. System.Threading.Tasks.TaskExceptionHolder</p>
</blockquote>
<p>How to troubleshoot my problem?</p>
<p>I also found this question which is pretty similar <a href="http://stackoverflow.com/questions/8311303/cannot-obtain-value-of-local-or-argument-as-it-is-not-available-at-this-instruct">Cannot obtain value of local or argument as it is not available at this instruction pointer, possibly because it has been optimized away</a></p>
| c# | [0] |
2,608,764 | 2,608,765 | Why does Python compile modules but not the script being run? | <p>Why does Python compile libraries that are used in a script, but not the script being called itself?</p>
<p>For instance,</p>
<p>If there is <code>main.py</code> and <code>module.py</code>, and Python is run by doing <code>python main.py</code>, there will be a compiled file <code>module.pyc</code> but not one for main. Why?</p>
<p><strong>Edit</strong></p>
<p>Adding bounty. I don't think this has been properly answered.</p>
<ol>
<li><p>If the response is potential disk permissions for the directory of <code>main.py</code>, why does Python compile modules? They are just as likely (if not more likely) to appear in a location where the user does not have write access. Python could compile <code>main</code> if it is writable, or alternatively in another directory.</p></li>
<li><p>If the reason is that benefits will be minimal, consider the situation when the script will be used a large number of times (such as in a CGI application). </p></li>
</ol>
| python | [7] |
3,796,306 | 3,796,307 | return value in javascript | <p>I am new to javascript and I am little bit confused about the syntax.</p>
<pre><code>function validateForm()
{
var x=document.forms["myForm"]["fname"].value
if (x==null || x=="")
{
alert("First name must be filled out");
return false;
}
}
<form name="myForm" action="demo_form.asp" onsubmit="return validateForm()" method="post">
First name: <input type="text" name="fname">
<input type="submit" value="Submit">
</form>
</code></pre>
<p>My question is If I write onsubmit="return validateForm()" or write onsubmit="validateForm()". What's the difference between these two syntax. So I submitted before just an example.</p>
<p>Here it is example</p>
<p>Event = function(); or Event = return function();</p>
<p>What's the difference between these two syntax</p>
| javascript | [3] |
5,411,289 | 5,411,290 | Jquery autocomplete list | <p>The jquery function that I'm using is:</p>
<pre><code>$.getJSON("rpc2.php?queryString=" +inputString+"", function(data) {
if(data.length >0) {
$.each(data, function(i, data){
var city= data.city;
var country= data.country;
$('#suggestions').show();
$('#autoSuggestionsList').html('<li>'+ city+'</li>');
});
}
});
</code></pre>
<p>The PHP looks like:</p>
<pre><code>if(strlen($queryString) >0) {
$query = "SELECT * FROM cities WHERE city_accented LIKE '$queryString%' LIMIT 5";
$result = mysql_query($query) or die("There is an error in database");
$json = array();
while($row = mysql_fetch_array($result)){
$json['city'] = $row['city_accented'];
$json['country'] = $row['country'];
$data[] = $json;
}
}
print json_encode($data);
</code></pre>
<p>The response that I'm getting from PHP is:</p>
<pre><code>[{"city":"Lors","country":"ad"},{"city":"Lo Serrat","country":"ad"},{"city":"Lobabi","country":"af"},{"city":"Lobya","country":"af"},{"city":"Locakan","country":"af"}]
</code></pre>
<p>The problem is that in autoSuggestionsList DIV only the first city is listed, not all five from PHP response. Why there is no other cities from php response in autoSuggestionsList div?</p>
| jquery | [5] |
1,603,299 | 1,603,300 | c# about struct | <p>I have a class that contains variables and lists. Ex: </p>
<pre><code>public class x:Form
{
private a=null;
private list<xy> o=null;
otherclass cl=null;
public x()
{
..code
}
...
}
</code></pre>
<p>If I want to have this multiple times. I have 2 different form application that access this members. I would like to have somethinng like this: <code>something[0].x; something[1].x.</code> What should I do? Should i create a structure? Thx for help!. I would appreciate if you can give me examples using code.</p>
| c# | [0] |
1,468,480 | 1,468,481 | notification bar - clock width? | <p>How to get the clock on notification bar size in pixel?
Do anyone know?
Thanks</p>
| android | [4] |
2,303,168 | 2,303,169 | Shifting a binary string circularly | <p>I need to shift a binary string by 3 bits circularly. How can I implement this in java?</p>
<p>What exactly does "<<" operator mean?
Thanks in advance.</p>
| java | [1] |
172,243 | 172,244 | checking space between text in javascript | <p>I want to check the gap between two or more words, i have given as an input, in a text box. If there had any space, then i want to alert user that no space is allowing. I can check the existence of text simply using "if else" statement. But can't do the desired stuff in this way. My code is given below :</p>
<pre><code><script type="text/javascript">
function checkForm()
{
var cName=document.getElementById("cName").value;
var cEmail=document.getElementById("cEmail").value;
if(cName.length<1)
{
alert("Please enter both informations");
return false;
}
if(cEmail.length<1)
{
alert("Please enter your email");
return false;
}
else
{
return true;
}
}
</code></pre>
<p>
</p>
<pre><code> Name : <input type="text" id="cName" name="cName"/>
<br/>
<br/>
Email : <input type="text" id="cEmail" name="cEmail"/>
<br/>
<br/>
<input type="submit" value="Go!"/>
</form>
</code></pre>
<p>
</p>
<ul>
<li>Thankyou</li>
</ul>
| javascript | [3] |
2,271,599 | 2,271,600 | How to populate more than one column using executescalar? | <p>I am new to c#.Here i am getting one column using execute scalar</p>
<pre><code> cmd.commandtext = "select rodeuser from customer_db_map";
string rodecustomer = cmd.executescalar;
</code></pre>
<p>But i need to get more than one column like</p>
<pre><code> cmd.commandtext = "select rodeuser,username,password from customer_db_map";
</code></pre>
<p>i need to get every single column in a string like </p>
<pre><code> string rodecustomer = cmd.executescalar;
string username= cmd.executescalar;
string password = cmd.executescalar;
</code></pre>
<p>But it is not possible.How to get these things.any suggestion?</p>
| c# | [0] |
1,566,522 | 1,566,523 | How does java compiler know of genrics type information of a code in jar? | <p>I have a quetion regrading the java generics.
As I know,generic information is only available at compile time , through a process called "type erasure" all TYPE information
goes away once the code is compiled and .class file is made </p>
<p>that is once .java file is compiled , List myList = new arrayList(), is what the .class file bytecode have, even though the list is declared as list of strings in .java file.</p>
<p>Having said that, consider below scenario.</p>
<p>I have a jar with a method with signature </p>
<pre><code>public void check(List<String> p)
</code></pre>
<p>When I call this method from another code , the compiler enforces that the argument to check method should be <code>List<String></code> only, nothing else.</p>
<p>Now since the check method exists in jar (.class files), how does compiler know about TYPE information required for <code>List<String></code>, if TYPE information
is already REMOVED when .class file is made ?</p>
| java | [1] |
2,919,689 | 2,919,690 | Random sampling from a known data set | <p>I'm trying to randomly select 6 samples from a known data set(n=35) 10,000 times. I feel like this is a basic code, but I can't find it. </p>
<p>Any suggestions?</p>
| iphone | [8] |
2,203,761 | 2,203,762 | What is better for JavaScript validation, JSLint or JavaScript Lint? | <p>The two projects seem to be trying to accomplish the same task but they both go about it in very different ways. In your opinion, which one do you think is more relevant to the everyday javascript developer? Until recently, I hadn't even heard of <a href="http://www.javascriptlint.com/" rel="nofollow">Javascript Lint</a> but have heard plenty about <a href="http://jslint.com/" rel="nofollow">JSLint</a>. If popularity is any indicator, JSLint seems to be the clear winner.</p>
<p>Thoughts?</p>
| javascript | [3] |
1,776,420 | 1,776,421 | Where to place an input .txt file for a jar of your netbeans application | <p>The problem I'm having is rather trivial. I made a simple application in netbeans Java. The application on it's start loads an input file named try.txt for uploading some data. I have placed this file in the project folder and the following code works fine for file read operation</p>
<pre><code> FileInputStream fstream = new FileInputStream("try.txt");
</code></pre>
<p>When I debug the program the application works fine. But when I build a jar of my project and run the jar through the command prompt, I get the following error</p>
<p>java.io.FileNotFoundException: try.txt (The system cannot find the file specified)</p>
<p>The problem is resolved if I use the absolute path of try.txt like</p>
<p>C:\Desktop\try.txt</p>
<p>But this is not what I want since I'm supposed to distribute the jar to other users as well. I want to know that is there any default directory of my jar where I can put the file. Or Is there any way I can include the file to the jar so it is uploaded upon execution</p>
<p>Regards</p>
| java | [1] |
4,313,664 | 4,313,665 | How to: Define theme (style) item for custom widget | <p>I've written a custom widget for a control that we use widely throughout our application. The widget class derives from ImageButton and extends it in a couple of simple ways. I've defined a style which I can apply to the widget as it's used, but I'd prefer to set this up through a theme. In R.styleables I see widget style attributes like "imageButtonStyle and "textViewStyle". Is there any way to create something like that for the custom widget I wrote?</p>
<p>Thanks,</p>
<p>J</p>
| android | [4] |
5,700,111 | 5,700,112 | jQuery selector for newer HTML5 inputs not working | <p>I have an array that outputs inputs, with a type of number, but i cant seem to get the selector to find it. Is it not supported?</p>
<pre><code>$('#container :text').each(...
$('#container input:number').each(...
$('#container :number').each(...
</code></pre>
<p>None of them find the input values. What am i missing? </p>
<p>I also looked at the selector list on the jQuery site, and did not see anything for newer HTML5 input types.</p>
| jquery | [5] |
5,904,321 | 5,904,322 | Get width of ul in jQuery | <p>I need to get the width of a <code><ul></code> which has a dynamic width, in order to set the width for its enclosing <code><li></code>s to the width of the <code><ul></code> for IE7.</p>
<p>The <code><ul></code> is styled <code>display:block</code>. Currently jQuery's <code>.width()</code> returns <code>0</code>. I tried to get the widest <code><li></code>'s width, because it sets the width for the <code><ul></code>'s but here, I get <code>0</code>, too?</p>
<p>Is there any way (or workaround) to get the width of the <code><ul></code> or its <code><li></code>s?</p>
<p>Laura</p>
| jquery | [5] |
167,771 | 167,772 | java convert integer to int array | <p>i try to convert an integer to array for example 1234 to int[] arr = {1,2,3,4}; i've wrote a function </p>
<pre><code>public static void convertInt2Array(int guess) {
String temp = Integer.toString(guess);
String temp2;
int temp3;
int [] newGuess = new int[temp.length()];
for(int i=0;i<=temp.length();i++) {
if (i!=temp.length()) {
temp2 = temp.substring(i, i+1);
} else {
temp2 = temp.substring(i);
//System.out.println(i);
}
temp3 = Integer.parseInt(temp2);
newGuess[i] = temp3;
}
for(int i=0;i<=newGuess.length;i++) {
System.out.println(newGuess[i]);
}
}
</code></pre>
<p>but that is a exception throw out</p>
<pre><code>Exception in thread "main" java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:504)
at java.lang.Integer.parseInt(Integer.java:527)
at q4.test.convertInt2Array(test.java:28)
at q4.test.main(test.java:14)
Java Result: 1
</code></pre>
<p>have any ideas? thanks</p>
| java | [1] |
5,428,015 | 5,428,016 | Control outgoing messages | <p>I'm new to android programming and I was successful to create an Auto SMS Responder,however
I want to control outgoing messages and only specified phone numbers will able to received the default message once my number received an SMS.
Thank you for your answers in advance.</p>
| android | [4] |
1,045,996 | 1,045,997 | PHP Form Question | <p>Is there a way I can check if a user enters a <code><p></code> tag inside a form using PHP?</p>
| php | [2] |
2,460,393 | 2,460,394 | Adding PNG and color to background | <p>I have LinearLayout, and I have png that I used as tiles - but i want also that the color behind it will be white.</p>
<p>Is that possible?</p>
<p>My code is:</p>
<pre><code><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical" android:id="@+id/LinearMain" android:background="@drawable/bcktiles">
</code></pre>
<p>and the drawable is:</p>
<pre><code> <?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/bgsite" android:tileMode="repeat">
</bitmap>
</code></pre>
<p>I dont know where to put #fff</p>
<p>Thanks</p>
| android | [4] |
1,051,814 | 1,051,815 | how to build a java project to be moved to a new location without changing the paths | <p>I have written a java program </p>
<ul>
<li>generates lots of files (say txt files) in different directories </li>
<li>and then reads the files and operates on them</li>
</ul>
<p>I have exported the project as a runnable jar.</p>
<p>I need to run the jar on a remote server, obviously PATHs are not the same</p>
<p>What options do I have </p>
<ul>
<li>Change path locations </li>
<li>Or is there another way out ?</li>
</ul>
<p>Additionally I use different external programs that generate more files. And my program needs to read these files too.</p>
| java | [1] |
4,463,158 | 4,463,159 | Merge UIView with UIImageView before grabbing a screenshot | <p>I wish to combine the background (UIImageView) to the overlying UIView (MyView) and then take a screenshot of the merged image. I am using the code below, but the background completely covers my UIView... Any suggestion please?</p>
<pre><code>UIImageView *ViewToBeAddedAsBackground = BackgroundImageView;
ViewToBeAddedAsBackground.frame = CGRectMake(0,0,770,410);
[MyView addSubview:ViewToBeAddedAsBackground];
UIGraphicsBeginImageContext(MyView.frame.size);
[MyView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *MyView_IMAGE = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(MyView_IMAGE, nil, nil, nil);
</code></pre>
| iphone | [8] |
1,362,714 | 1,362,715 | PHP use of what appears to be an operator "=>" | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3737139/reference-what-does-this-symbol-mean-in-php">Reference - What does this symbol mean in PHP?</a> </p>
</blockquote>
<p>Take this snippet of code for instance:</p>
<pre><code>$files[] = array('name' => $d, 'tmp_name' => $fdata['tmp_name'][$i]);
</code></pre>
<p>What is the specific definition, name and usage of what only appears to be the operator <code>=></code></p>
| php | [2] |
1,145,857 | 1,145,858 | C# How to terminate application.run() | <p>I would like to know, how to terminate a program using, for example, the escape key.
In general, what I have to do to stop it after the application.run(..)? </p>
<p>How can I insert this</p>
<p>private void myForm_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) {
if (e.KeyCode == Keys.Escape) {
Application.Exit();
}
}
in the code below</p>
<p>static void Main()
{</p>
<pre><code> using (WinForm new_form = new WinForm())
{
new_form.InitializeComponent();
new_form.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true);
new_form.InitializeDevice();
new_form.LoadSurfaces();
new_form.Set3D();
Application.Run(new_form);
}
</code></pre>
<p>}</p>
| c# | [0] |
199,253 | 199,254 | Submit form to popup window? | <p>I have a script that submits a form to a popup window but instead of displaying the form's action (process.php), it displays nothing (blank window). Heres my script:</p>
<pre><code>function redirectOutput() {
var myForm = document.getElementById('formID');
var w = window.open('about:blank','Popup_Window','toolbar=0,scrollbars=0,location=0,statusb
ar=0,menubar=0,resizable=0,width=400,height=300,left = 312,top = 234');
myForm.target = 'Popup_Window';
return true;
}
</code></pre>
| javascript | [3] |
530,827 | 530,828 | Something easy got wrong | <p>English is not my strong language, please considerate it.</p>
<p>What I'm trying to do is make a 3x3, 4x4 or 5x5 matrix of "~" signs, that would get replaced by "X" 3 times,</p>
<p>Depending on coordinates given by x and y inputs, appended in s=[]</p>
<p>So for example if I have a matrix 3x3</p>
<pre><code>~~~
~~~
~~~
</code></pre>
<p>And coordinate (0,0),</p>
<p>The result should be:</p>
<pre><code>X~~
~~~
~~~
</code></pre>
<p>As easy as it sounds it's not easy for me still, I get problem even if my code seems logical to me.</p>
<pre><code>> IndexError: list index out of range
</code></pre>
<p>This is my code:</p>
<pre><code>a = []
n=0
while n<3 or n>5:
n=int(raw_input("type matrix: "))
for i in range (n):
for j in range (n):
print "~",
print "\n",
def zdruzi(a):
for row in a:
print " ".join(row)
zdruzi(a)
s = []
for i in range(3):
x=int(raw_input("x: "))
y=int(raw_input("y: "))
s.append(int(x))
s.append(int(y))
a[int(x)][int(y)]="X"
if (x<0) or (x>(n-1)):
print "not good"
break
print a
</code></pre>
| python | [7] |
5,258,839 | 5,258,840 | javascript - string numbers - convert from 123,456 to 123456 | <p>I have an array of string numbers like the follow:
"123,556","552,255,242","2,601","242","2","4"
and I would like to convert them to int numbers but the numbers with the "," I would like to convert from "123,556" to "123556" first.
How do I do so ?</p>
| javascript | [3] |
341,967 | 341,968 | Search And Replace Special Characters PHP | <p>I am trying to search and replace special characters in strings that I am parsing from a csv file. When I open the text file with vim it shows me the character is <95> . I can't for the life of me figure out what character this is to use preg_replace with. Any help would be appreciated. </p>
<p>Thanks,</p>
<p>Chris Edwards</p>
| php | [2] |
3,650,486 | 3,650,487 | Connect to a windows process in php | <p>How can I connect to a process like the calculator provided by windows or access my page whenever I start up the windows.</p>
| php | [2] |
2,253,921 | 2,253,922 | CDMA 4G network connectivity | <p>My app doesn't connect through HTC EV0-4G. How app can access network through CDMA 4G.</p>
| android | [4] |
4,387,776 | 4,387,777 | adding headers in listview | <p>My application showing the output in a listview like this:</p>
<pre><code>item1
item2
imem3
item4
</code></pre>
<p>now i want to show the items with a date header like this</p>
<pre><code>datex
item1
datey
item2
item3
datez
item4
</code></pre>
<p>I want to categorize data under date header. How can I do this from getview? I am calling the listadapter like this:</p>
<pre><code> adapter=new FixtureAdapter(this, GameIdAry, DateAry, Date1Ary, TimeAry, VenuAry,
WeekAry, TimerAry, LteamAry, LidAry, VteamAry, VidAry, LScoreAry, VScoreAry,
LGoalAry, LBehindAry, VGoalAry, VBehindAry, StatusAry, LOddsAry, VOddsAry);
</code></pre>
<p>and the data is handling in arrayadapter </p>
<pre><code>getview(int position, View convertView, ViewGroup parent)
{
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
rowView = inflater.inflate(R.layout.fixture_row_xml, parent, false);
}
</code></pre>
<p>Please help me friends</p>
| android | [4] |
2,650,723 | 2,650,724 | jquery accordian, set slide up before sliding down | <p>I have an accordian that I have made. I would like to close the sibling open div before revealing the clicked items content.</p>
<p>here is the jquery</p>
<pre><code>$('.column h1').click(function() {
$(this).css('outline','none');
if($(this).parent().hasClass('current')) {
$(this).siblings('.toggle').slideUp('slow',function() {
$(this).parent().removeClass('current');
});
} else {
$('.current .toggle').slideUp('slow',function() {
$(this).parent().removeClass('current');
});
$(this).siblings('.toggle').slideToggle('slow',function() {
$(this).parent().toggleClass('current');
});
}
return false;
});
</code></pre>
<p>here is the html</p>
<pre><code> <section class="column" id="about">
<h1><?php the_title(); ?></h1>
<div class="toggle">
</div>
</section>
<!-- recent work -->
<section class="column" id="recent">
<h1>recent work</h1>
<div class="toggle">
</div>
</section>
</code></pre>
| jquery | [5] |
3,380,935 | 3,380,936 | Creating a Database that can be updated live | <p>This is very hard to explain but I'm going to try. </p>
<p>We run a motor shop that has a QC program. The program was coded in access97 and it's time for an upgrade, we have elected to try a PHP/MySQL approach to do this. </p>
<p>Right now the access software has several pages to the form and each box sends to the database live so when you type something in you don't have to hit a save button or next or anything and when you come back it's there. </p>
<p>Also the forms are driven by an auto-incremented job number that you can punch into a field at the top of the page and it query's the server and displays all the data in the form boxes so you can edit it. </p>
<p>I don't know how to even start this project. I got a working form and an insert.php page but I don't know how to go about the rest. </p>
<p>If I could get a pointer in the right direction that would be appreciated. Thanks!</p>
| php | [2] |
5,386,199 | 5,386,200 | How to create database for android application on remote webserver through java | <p>i am devloping an android application thr java.i want to create or place the db on remote server,but not getting idea how to do this.plz help me .any code will be apriciated,
thanks </p>
| android | [4] |
2,750,290 | 2,750,291 | Extracting pair of values from matrix using python | <p>I have matrix as follows..</p>
<pre><code> 31348 439352 6077 4619722 60825
31348 1 0.304 0.126 0.12 0.162
439352 0.304 1 0.101 0.095 0.316
6077 0.126 0.101 1 0.473 0.219
4619722 0.12 0.095 0.473 1 0.256
60825 0.162 0.316 0.219 0.256 1
</code></pre>
<p>Now i have to write python script to extract pairs which are having >0.2
the result should be as follows</p>
<pre><code>439352, 31348 0.304
60825, 439352 0.316
.....
</code></pre>
<p>Can anybody tell me how to do this..</p>
<p>Thanks in advance</p>
<p>NI</p>
| python | [7] |
3,287,563 | 3,287,564 | How can i drag an imageView from a place to another specific place? | <p>I want to be able to drag and drop images placed in a linearLayout to another linearLayout in specific places. It's actually a game to re order letters of a word.
here is the code i've done so far, it does drag the image but it became larger and i can't drop it in the other layout.</p>
<p>linearDrag.addView(imageLettre);</p>
<pre><code> imageLettre.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
layoutParams = (LayoutParams) imageLettre.getLayoutParams();
switch(event.getAction())
{
case MotionEvent.ACTION_DOWN:
break;
case MotionEvent.ACTION_MOVE:
int x_cord = (int)event.getRawX();
int y_cord = (int)event.getRawY();
if(x_cord>windowwidth){x_cord=windowwidth;}
if(y_cord>windowheight){y_cord=windowheight;}
layoutParams.width = x_cord -25;
layoutParams.height = y_cord - 75;
imageLettre.setLayoutParams(layoutParams);
break;
default:
break;
}
return true;
}
});
</code></pre>
<p>I want to understand more the drag and drop phylosophy but i need help :(
thanks a lot</p>
| android | [4] |
2,813,483 | 2,813,484 | Extract the color of a pixel of screen please | <p>I want to get the color of one pixel of screen </p>
| android | [4] |
5,971,318 | 5,971,319 | What is the difference between the head node and starting node of link list? | <p>Does the head node in a link list have any info or does it only point to the first node of a link list ?
<br/>
Can we define a head node as the starting node of the link list ?<br/>
Does a head node only point to the first node?
A linked list consists of nodes, and each node contains some data and a link to another node in the list. But is the very first node a node which contains data and a link to the second node? Or is it contain only a link (and no data) to a node? I thought that the very first node in a linked list has both data and a link to another node, but in one introductory book it is explained that the head is a node but a link that gets you to the first node. At the same time head is a variable of the type of the node. Why is it like this?</p>
| c++ | [6] |
6,006,406 | 6,006,407 | handling database connection issues | <p>I have some code that needs to retry whenever it cannot make a database connection, for example 20 times for each login. The website has dozens of users, what would be the best way to handle this? I was thinking of using a counter but as multiple users will be logged on at the same time perhaps some threading would be required, which I am unfamiliar with.</p>
<p>EDIT :</p>
<p>I get the error 'method name expected' on the line where I am instantiating the Thread object. Here is my code :</p>
<pre><code>private static List<Field.Info> FromDatabase(this Int32 _campId)
{
List<Field.Info> lstFields = new List<Field.Info>();
Field.List.Response response = new Field.List.Ticket
{
campId = _campId
}.Commit();
if (response.status == Field.List.Status.success)
{
lstFields = response.fields;
lock (campIdLock)
{
loadedCampIds.Add(_campId);
}
}
if (response.status == Field.List.Status.retry)
{
Thread th1 = new Thread(new ThreadStart(FromDatabase(_campId)));
FromDatabase(_campId);
}
return lstFields;
}
</code></pre>
| c# | [0] |
5,469,631 | 5,469,632 | convert multi dimentional array in keywise format | <pre><code>$shop = array( array( Title => "rose",
Price => 1.25,
Number => 15
),
array( Title => "daisy",
Price => 0.75,
Number => 25,
),
array( Title => "orchid",
Price => 1.15,
Number => 7
)
);
</code></pre>
<p>I have an array like this. I want to convert this array keywise like below. How can I do that?</p>
<pre><code>$shop = array ( "rose" => Price => 1.25,
Number => 15 ),
"daisy" => Price => 0.75,
Number => 25 ),
"orchid" => Title => "orchid",
Price => 1.15)
);
</code></pre>
| php | [2] |
634,472 | 634,473 | "Complete action using myApp" | <p>In the contact list you can slide the contact to the left in order to send a message. I need my application to appear in the menu when the user does this, like whatsApp or Skype. The menu is:</p>
<p>"Complete action using:</p>
<p>-messaging</p>
<p>-myApp "</p>
<p>Is this posible?
Thank you!</p>
| android | [4] |
3,716,841 | 3,716,842 | Can I use two events in a single line? | <p>I want an action to take place on keyup as well as on change.</p>
<p>The statement below works perfectly for the keyup event. I want to duplicate it on change.</p>
<p>Is there an easy way to accomplish this?</p>
<pre><code>$("#YourName").keyup(function() {
ThisValue = $(this).attr("value");
if (ThisValue.length > 0) {
ThisValue = "<b>From:</b><br /> " + ThisValue;
$("#YourNameValid").html(ThumbsUp);
} else {
ThisValue = "";
$("#YourNameValid").html("");
}
$("#YourNameText").html(ThisValue);
});
</code></pre>
| jquery | [5] |
1,408,547 | 1,408,548 | Is there a way to copy a class's source to string, in C#? | <p>I have a class:</p>
<pre><code>public class SomeClass {
// properties and methods here
}
</code></pre>
<p>Ideally I'd like to send the entire class to a string so I can render it in a view. The best way I can think of doing this, is to have a build script run and send it all to static text files, then reference those text files in the code. Is there a better way to do this? I'd like to be able to say:</p>
<pre><code>return View(SomeClass.SourceToString());
</code></pre>
<p>I'm hoping I'm not missing a really obvious way to accomplish this.</p>
| c# | [0] |
1,075,177 | 1,075,178 | How to play f4v via url? | <p>I want to stream flash video from a server. I try to use this <a href="http://www.synesthesia.it/playing-flash-flv-videos-in-android-applications" rel="nofollow">tutorial</a> but it shows me a 3D cube with strange question marks on the grains in the video. I am using this link for testing, <code>rtmp://v1.viewcity.ru/vod/sample1_150kbps.f4v</code></p>
<p>Could you please give me an example how I can play flash video in my android app?</p>
| android | [4] |
4,421,785 | 4,421,786 | Starting activity doesn't bring application to foreground | <p>I've got some strange problem with bringing the application to foreground. As it's said in Android documentation using startActivity(myIntent) should bring application from background and it worked until upgrade Android on HTC Desire HD to version 2.3.5. At this version this method doesn't work at all. Application is running in the background even if I add singleInstance flag </p>
<blockquote>
<p>Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT. </p>
</blockquote>
<p>This is the code snippet where I create the intent and launch activity</p>
<pre><code>Intent intent = new Intent();
intent.setClassName(self.ctx, "com.app.WakeUp");
ctx.startActivity(intent);
</code></pre>
<p>The ctx variable is a context passed to the object from Activity instance and com.app.WakeUp is a name of Activity to start. </p>
<p>Some ideas what is going on?</p>
| android | [4] |
2,261,609 | 2,261,610 | php function integer parameter problem | <pre><code>function is_zipcode_valid($zipcode){ ... }
</code></pre>
<p>if I call that function with <code>is_zipcode_valid(08004);</code>
my parameter 08004 gets in as 8004, basically it removed all precending 0's.</p>
<p>How can I get around that problem?</p>
<p>thanks</p>
| php | [2] |
4,087,066 | 4,087,067 | C++ using function as parameter | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/9410/how-do-you-pass-a-function-as-a-parameter-in-c">How do you pass a function as a parameter in C?</a> </p>
</blockquote>
<p>Suppose I have a function called </p>
<pre><code>void funct2(int a) {
}
void funct(int a, (void)(*funct2)(int a)) {
;
}
</code></pre>
<p>what is the proper way to call this function? What do I need to setup to get it to work?</p>
| c++ | [6] |
4,229,922 | 4,229,923 | How to insert the maximum of five elements in a list having to use Socket? | <p>The cod below is generating the error:</p>
<blockquote>
<p>Thread Type mismastch;cannot convert form String to Set</p>
</blockquote>
<p>Why is this and I how can I fix my code?</p>
<pre><code>private Set<String> LISTA_DE_NOMES = new HashSet<String>();
private Set<String>nomeCliente;
public boolean armazena(Set<String> newName){
if (nomeCliente.contains(newName)){
return false;
}
return nomeCliente.add(newName);
}
Usando conjunto !!!
public synchronized boolean armazena(Set<String>newName){
if (LISTA_DE_NOMES.contains(nomeCliente)){
return false;
}
return LISTA_DE_NOMES.addAll(nomeCliente);
}
public synchronized boolean canAddNewUser(Set<String>newName){
return (LISTA_DE_NOMES.size()<5);
}
</code></pre>
| java | [1] |
1,195,406 | 1,195,407 | python converting string to int and adding 1 | <p>im stuck, im trying to add these together but instead of getting 8+7 = 15 im getting 8+7 = 87</p>
<p>I am converting count_current to an integer but it still doesn't work:</p>
<pre><code>count_current = int(count_current)
for playlist in playlists_data:
count_current += 1
</code></pre>
<p>any help is much appreciated
thanks
J</p>
| python | [7] |
905,930 | 905,931 | Android Layout How to Set a Specific Fixed Layout Height | <p>How can I set the height of a layout to be a specific number of dp. Here is my exact situation:</p>
<p>I have a relative layout. Inside I do an include of a header layout. This header layout needs to be exactly 35dp. How do I set an exact height. Secondly I have a vertical separator image view inside the header that is a few 1 dp wide and that must be exactly 15dp high. How do I set an image view inside the header to be an exact height? I suppose I could do this indirectly by setting padding or margin? </p>
| android | [4] |
2,824,519 | 2,824,520 | How to set the Notification Area in Android? | <p>When a notification arrives it hides the network signal and battery status icons.</p>
<p>Is there any possibility to show the notification without hiding the network icons?</p>
| android | [4] |
4,633,514 | 4,633,515 | change content of a fixed div when scrolling past anchors in jquery | <p>I have a two column site layout that has the content of the left column as absolute and the div in the right column as fixed. I am trying to get it so that as I scroll down the page and the fixed div box scrolls past anchor points (on the left), the content of the fixed div will change (images will be appended). </p>
<p>The very loose weave jquery I have so far is this:</p>
<pre><code>(function ($) {
$(document).ready(function () {
var anchor = $("")
var code =
$(window).scroll(function (event) {
var y = $(this).scrollTop();
if (y >= anchor) {
$('#theDiv').append('<img id="livecodeimg" src="' + code +'.png" />')
} else {
$("#test img:last-child").remove()
}
});
});
})(jQuery);
</code></pre>
<p>I'm having trouble figuring out what to make the variables...</p>
| jquery | [5] |
2,739,155 | 2,739,156 | How does the foreach iteration happen for two dimensional System.Array? | <p>Suppose we are creating a System.Array as</p>
<p><br/></p>
<pre><code> Array _twoD = Array.CreateInstance(typeof(string), 2,2);
_twoD.SetValue("Harrish", 0, 0);
_twoD.SetValue("Goel", 0, 1);
_twoD.SetValue("Prakash", 1, 0);
_twoD.SetValue("Manish", 1, 1);
foreach (string str in _twoD)
{
Console.WriteLine(str);
}
</code></pre>
<p>How does the Enumerator automatically iterates [0,0] [0,1] ,[1,0] ,[1,1] ?</p>
<p><b>[For single simensional array,it is easy to understand,what is internally happen in 2D and 3 D ? ] </b></p>
<p>Can we create Jagged Style array using System.Array ?</p>
| c# | [0] |
925,498 | 925,499 | Print ASCII line art characters in C# console application | <p>I would like to have a C# console application print the extended ASCII Codes from <a href="http://www.asciitable.com/" rel="nofollow">http://www.asciitable.com/</a>. In particular I am looking at the line art characters: 169, 170, 179-218. Unfortunately when I tried, I ended up getting 'Ú' for 218 and expect to see the other characters from <a href="http://www.csharp411.com/ascii-table/" rel="nofollow">http://www.csharp411.com/ascii-table/</a>. </p>
<p>I'm aware that ASCII only specifies character codes 0 - 127. I found another post with a reference to SetConsoleOutputCP(), but was not able to get that to work in a C# class or find an example of how to do so.</p>
<p>Is it possible to print the line art characters in a C# console application? If it is can someone provide a URL to an example or the code?</p>
| c# | [0] |
6,015,876 | 6,015,877 | java classifieds application | <p>Does anybody know of a good classifieds application written in Java?</p>
<p><strong>Update</strong>
... by "classifieds application", I mean an application which handles buying and selling, advertisements etc., something like "http://www.ikiclassifieds.com/" but only written in Java.</p>
| java | [1] |
1,252,553 | 1,252,554 | how to set Multiple gridview in same layout in android? | <p>I want to set two grid view for same layout. I can also able to set that within same lay out but due to scrollable control its look like a "wrap_content".</p>
<p>but i want to show full grid view in a screen one after another like below fig.<img src="http://i.stack.imgur.com/suwZl.png" alt="enter image description here"></p>
<p>in above fig. grid view show full height of it.
so please help me. </p>
<p>Thank you .</p>
| android | [4] |
1,082,633 | 1,082,634 | Stuck with List<> | <p>I have this:</p>
<pre><code>public class accounts
{
private string mName;
private string mEmail;
private string mAddress;
public accounts(string Name,
string Email,
string Address)
{
this.mName = Name;
this.mEmail = Email;
this.mAddress = Address;
}
}
</code></pre>
<p>then, somewhere else, I create this:</p>
<pre><code>private static List<accounts> mlocalaccountList = new List<accounts>()
</code></pre>
<p>then I fill it like this:</p>
<pre><code>mlocalaccountList.Add(new accounts("John Smith","johnsmith@mail.com","CA USA"));
</code></pre>
<p>Now, everything is OK, except, how can I access the list<> items?? </p>
| c# | [0] |
4,370,416 | 4,370,417 | Convert Decimal value to Hours & Minutes; Also subtract two Hours/Minutes value from the another | <p>I have two decimal text boxes on the ASP.Net page:</p>
<pre><code>Balance: 200.00 (200 Hrs and 00 Minutes)
TextBox1 = 75.30 (75 Hrs and 30 Minutes)
(After entering the value in TextBox1; the function should calculate the difference between Balance - TextBox1)
TextBox2: (based on 60 min per hour) = 124.30 (124 Hrs and 30 minutes)
</code></pre>
| c# | [0] |
1,394,529 | 1,394,530 | Determine assembly that contains a class from the classname (not an instance of a type) | <p>I am trying to determine which assembly contains a particular class. I do NOT want to create an instance of a type in that assembly, but want something like this</p>
<pre><code>namespace SomeAssembly
{
class SomeClass
{
}
}
</code></pre>
<p>..and In client code I want:</p>
<pre><code>Assembly containingAssembly = GetContainingAssembly(SomeClass)
</code></pre>
| c# | [0] |
583,153 | 583,154 | Programmatically searching and choosing a network provider | <p>I'm currently developping an application that resets your connection when your signal strength is too low.</p>
<p>I'm trying to do this by searching and choosing your network operator (settings-> wireless and networks -> Mobile networks -> Network operators).
I noticed this way has a few advantages over switching to airplane mode:
- Wifi and/or bluetooth doesn't get disabled
- You don't 'loose' your reception and this can still make calls (tested this; you will still lose your data/internet connection, however)</p>
<p>I'm trying to find some way to automate this when your signal drops too low.
Does anyone know how to do this (preferably without root, but if needed, that's fine as well; Busybox shell commands are fine too)?</p>
<p>Thanks</p>
| android | [4] |
1,725,173 | 1,725,174 | Title bar color change issues | <p>I want to change the color of the title bar dynamically, ie: someone clicks a button, it changes the color. However, I can't seem to get it to fill the entire title bar. This occurs on both the emulator and a Nexus One. Any ideas?</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/title_bar" android:background="@color/title_bar_blue" android:layout_width="fill_parent" android:layout_height="fill_parent">
<TextView android:id="@+id/title_left_text" android:layout_alignParentLeft="true" style="?android:attr/windowTitleStyle" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<TextView android:id="@+id/title_right_text" android:layout_alignParentRight="true" style="?android:attr/windowTitleStyle" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
</RelativeLayout>
</code></pre>
<blockquote>
<p></p>
</blockquote>
<pre><code> requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.main);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);
titleBar = (RelativeLayout) findViewById(R.id.title_bar);
titleBar.setBackgroundResource(R.color.title_bar_green);
</code></pre>
<p><img src="http://i.stack.imgur.com/sXb1f.png" alt="title bar"></p>
| android | [4] |
242,654 | 242,655 | Try/Catch block in PHP not catching Exception | <p>I am trying to run Example #1 from this page: <a href="http://php.net/manual/en/language.exceptions.php" rel="nofollow">http://php.net/manual/en/language.exceptions.php</a></p>
<p>However instead of the desired output I get:</p>
<pre><code>0.2
Fatal error: Uncaught exception 'Exception' with message 'Division by zero.' in xxx:
7 Stack trace: #0 xxx(14): inverse(0) #1 {main} thrown in xxx on line 7
</code></pre>
<p>I have absolutely no idea, whats wrong... As a developer environment I am using UniServer 3.5 with PHP 5.2.3</p>
| php | [2] |
5,436,644 | 5,436,645 | How can I toggle between 2 images | <p>Im trying to use this code to toggle between a play and pause button but it doesn't seem to be working. How can I get it toggle between the 2 images when the are clicked </p>
<p><a href="http://jsfiddle.net/aFzG9/1/" rel="nofollow">http://jsfiddle.net/aFzG9/1/</a></p>
<pre><code>$("#infoToggler").click(function()
{
if($(this).html() == "<img src="http://tympanus.net/PausePlay/images/play.png" width="60px" height="60px"/>")
{
$(this).html("<img src="http://maraa.in/wp-content/uploads/2011/09/pause-in-times-of-conflict.png width="60px" height="60px"/>");
}
else
{
$(this).html("<img src="http://tympanus.net/PausePlay/images/play.png" width="60px" height="60px"/>");
}
});
</code></pre>
<p>Thanks</p>
| jquery | [5] |
171,254 | 171,255 | Playing An Audio File Through An App | <p>Is there anyway to store audio on an iphone app and then grab that audio file and play it through code. Does anyone have a tutorial to point me to do something like this?</p>
| iphone | [8] |
2,422,783 | 2,422,784 | Splitting up data in the form "xxx-yyyy people" into two variables php | <p>Given that I have a variable $peopleSize in the format (I've already extracted the information from the UI element):</p>
<pre><code>xxx-yyyy people
</code></pre>
<p>For example as seen in the jquery range UI:</p>
<p><a href="http://jsfiddle.net/methuselah/SLvtx/1/" rel="nofollow">http://jsfiddle.net/methuselah/SLvtx/1/</a></p>
<p>How would I get the two min and max as two seperate variables using PHP getting rid of the "-" and "people"? </p>
| php | [2] |
3,575,356 | 3,575,357 | Java, inherit classpath with Runtime.exec() | <p>I have a program that will create a child process, and I want it inherit all the classpath from its parent. In javadoc, it says:</p>
<blockquote>
<p>public Process exec(String[] cmdarray,
String[] envp)
throws IOException</p>
<p>Executes the specified command and arguments in a separate process with the specified environment.</p>
<p>Given an array of strings cmdarray, representing the tokens of a command line, and an array of strings envp, representing "environment" variable settings, this method creates a new process in which to execute the specified command.</p>
<p><em><strong>If envp is null, the subprocess inherits the environment settings of the current process.</em></strong> </p>
</blockquote>
<p>When I set envp to null, it didn't inherit anything.</p>
<p>Here is the code:</p>
<pre><code>System.out.print("Debug system path: "+System.getProperty("java.class.path"));
startTime();
Process proc = Runtime.getRuntime().exec(cmd,null);
</code></pre>
<p>I can see the path information, but these path information is not inherited by the new created process.</p>
| java | [1] |
400,489 | 400,490 | how to overload > operator for a queue | <p>i have a priority queue and i have defined like this:</p>
<pre><code>priority_queue<Node*,vector<Node*>,greater<Node*>> myQueue;
</code></pre>
<p>i have to add to queue on the basis of a parameter param and i have overloaded it like this</p>
<pre><code>bool Node::operator>(const Node& right) const
{
return param>right.param;
}
</code></pre>
<p>since the overload function doesnt take a pointer object, how should i change it so that my overloaded function is called.
i am adding to queue this way:</p>
<pre><code>Node *myNode
myQueue.add(myNode);
</code></pre>
<p>i cant pass the myNode without making as pointer object.
please guide ..</p>
<p>@Sellibitze
i have done something like this </p>
<pre><code> template<typename Node, typename Cmp = std::greater<Node> >
struct deref_compare : std::binary_function<Node*,Node*,bool>
{
deref_compare(Cmp const& cmp = Cmp())
: cmp(cmp) {}
bool operator()(Node* a, Node* b) const {
return cmp(*a,*b);
}
private:
Cmp cmp;
};
typedef deref_compare<Node,std::greater<Node> > my_comparator_t;
priority_queue<Node*,vector<Node*>,my_comparator_t> open;
</code></pre>
<p>i am filled with errors. </p>
| c++ | [6] |
5,253,443 | 5,253,444 | Member array of class is lossing data in php | <p>I'm using a History class which is defined as follows</p>
<pre><code>class History
{
private $historyArray=array();
//private $cacheFileNameArray=array();
public function __construct()
{
}
public function writeToHistory($query,$dataArray)
{
//print_r($this->historyArray);
$cacheFileName=$this->getCacheFileName();
$query=$query."|"."1"."|".$cacheFileName;
array_push($this->historyArray,$query);
print_r($this->historyArray);
}
public function checkHistoryExits($query)
{
$flag=0;
$index=0;
//print_r($this->historyArray);
foreach($this->historyArray as $historyElement)
{
$sqlQuery=@current(explode("|",$historyElement));
//echo $sqlQuery;
if($sqlQuery==$query)
{
$flag=1;
return $index;
}
$index++;
}
if($flag==0)
return "false";
else
return $index;
}
}
</code></pre>
<p>Now the problem i identified that the <code>$historyArray</code> is lossing data when i'm using different functions of the class. EG.first i call the <code>writeToHistory</code> method with proper data.in that case the data is pushed to the array (i can see that by using <code>print_r</code>) but when i'm calling the method 2nd time from the same object the value is pushed to the 0 index of the array i.e the previous data lost.Any idea why it is happening?</p>
| php | [2] |
22,841 | 22,842 | Noob javascript, why is this firing onload? | <p>So I dont understand why the console logs 1 right away onload or something when i have <code>one.onclick = alterIt(1)</code> shouldn't it wait till i click <code>one</code>. Anyway, obviously I am not ver good at javascript, thanks for your help.</p>
<pre><code>window.onload = initialize;
function initialize() {
if (1 == 1){
calculation();
}
}
function calculation() {
var one = document.getElementById('one');
one.onclick = alterIt(1);
}
function alterIt(x) {
console.log(x);
}
</code></pre>
| javascript | [3] |
1,406,428 | 1,406,429 | why protected becomes private to other classes in different package of subclass | <p>why protected becomes private to other classes in different package of subclass .but it is still protected in same package of super class.</p>
<pre><code>package a;
class A
{
protected a;
}
package b;
class B extends A
{
B()
{
System.out.println(a);
}
}
class C
{
C()
{
System.out.println(new B().a);//error
}
}
</code></pre>
| java | [1] |
5,980,939 | 5,980,940 | how to return enumerate in method | <p>Product.java</p>
<pre><code>public interface Product {
/**
* use this interface for creating your own enumerate of products
*/
public static interface Category {
enum MyCategory {vegetable, fruit, chocolate}; // i create my own enumerate
}
}
</code></pre>
<p>in my MyProduct.java i need implement getCategory() method</p>
<pre><code>public class MyProduct implements Product {
@Override
public Category getCategory() {
// ???
}
}
</code></pre>
<p>but i don't know how to access enumerate from interface Category and still returning variable of Category. Con you help me please.
Sorry for bad description of my problem, but I hope you understand what I need :)</p>
| java | [1] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.