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 |
---|---|---|---|---|---|
4,841,346 | 4,841,347 | Jquery moving bar and stopping 0-100 | <p>I am trying to find the right way to go about this i am trying to get a bar that move from 0 - 100 and you got a stop button and when you press it the bar will stop and display a number. i am trying to do this in jquery.</p>
| jquery | [5] |
5,379,995 | 5,379,996 | In what language is C# compiled | <p>Since I've been developing on c# this is a curiosity I have. Does anybody know that</p>
| c# | [0] |
4,095,357 | 4,095,358 | 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] |
3,367,897 | 3,367,898 | Use of python progress bar in script | <p>I want to show progress bar in my script because it takes a lots of time to execute while working on huge files.I gone through the <a href="http://code.google.com/p/python-progressbar/" rel="nofollow">python progressbar module</a></p>
<p>and examples also its good and very intresting to use but as per examples all values are predefine .As we can't guess the max execution time of programm or function.So i am not able to figure out how should i use progress bar function in my sctipt</p>
<pre><code>for data in files:
crawl_data(data)
</code></pre>
<p>this is the crawl_data function which take time so how can i set the progress bar values </p>
<pre><code>pbar = ProgressBar(widgets=[Percentage(), Bar()], maxval=300).start()
for i in range(300):
time.sleep(0.01)
pbar.update(i+1)
pbar.finish()
</code></pre>
<p>how can i define this range and maxval values in above lines of code.</p>
| python | [7] |
2,202,431 | 2,202,432 | Expand/shrink image in a div with JQuery | <p>I'm using some images as banners on my site. They're full (960px) width and I initially show a portion of the image as a teaser (say 160px high). I do this now by using a separate image which is a slice of the full size image (which is 600px high). Complicating this are shadows that I apply in Photoshop at the top and bottom of the image that make it look "inset" into the div.</p>
<p>What I would like to do is overlay the image with a small icon that says something like "see more". When the visitor clicks on this icon I'd like to div to expand (acordian style) to show the whole image and then change the icon to "see less". When the new icon is clicked I'd like the image to collapse to its original size.</p>
<p>I suspect that I will need to use a new image (960 x 600px) that I've also added shadows to so I can retail the inset look. So, this requires two images, one that is swapped out when the div is expanding and contracting and one that is swapped in when the div contracts to the original 160px height.</p>
<p>Complicating this is the fact that the image acts as a banner near the top of the page and I don't want the div to expand upwards past the window top so as to disappear off-screen and possibly add a scrollbar. A final complication is that the small "slice" can be taken at any height in the original 600px image. I select an area of the image that looks best at 160px. So, the div expansion is not constant in height. If the slice is cut from the top of the original image, the div will only expand a bit at the top and much more at the bottom. Similarly with slices cut from the bottom of the original image.</p>
<p>I realize this is a complicated question, and I did Google around quite a bit looking for solutions. I found a couple of JQuery extensions (UI and Tools) that look like they might be usable, but I could find no examples of what I'm trying to do. If the answer is too complicated to attempt in this forum, pointers to sites that do what I'm trying to accomplish would be appreciated.</p>
| jquery | [5] |
3,399,137 | 3,399,138 | How to get an outline path from an image in java? | <p>How to get an outline path from an image in java ?
I mean I want to get a a path iterator of the path surrounding the image Ignoring any transparent area in it .</p>
| java | [1] |
5,967,691 | 5,967,692 | how to print data inside a char pointer (c++)? | <p>I have a </p>
<pre><code>funtion(const char * data)
{
//how to print the data which is inside the data
}
</code></pre>
<p>when i debug i see only the address.If i print (*data) nothing is printed.</p>
<p>Any idea?</p>
| c++ | [6] |
3,253,903 | 3,253,904 | When should I use enumerations stored in the database and when an enum in the code? | <p>What is the best way to store enumerations?
For example, I have an entity Person that has a property Sex. The first option that I can think of is a table that stores the enumeration values and names (1 is for Male and 2 is for Female for example) and then in the Person table to store the int values. The second option is to have an enumeration in the code with a corresponding int values and store in the Person table the int values. The last option is to have again enumeration in the code and store the string value. For example, Person with sex 'Male'. </p>
<p>Which approach is better and when? </p>
| c# | [0] |
3,907,517 | 3,907,518 | how to bold day and time with javascript | <p>I'm trying to post hours on my website and I want the day and time to bold automatically based on javascript. Is it possible to setup some javascript so that on Monday would be bold and then on tuesday would be bold and so on?</p>
<p>Here is the code:</p>
<pre><code><div id="monday">Monday: 12:00-2:00</div>
<div id="tuesday">Tuesday: 11:00-3:00</div>
</code></pre>
<p>and so on for each day. When a user accesses the site on a Monday, I want the monday div to bold everything that is in there. When a user accesses the site on a tuesday, I want the entire tuesday div to bold.</p>
<p>Thanks</p>
| javascript | [3] |
5,760,440 | 5,760,441 | I'm trying to get a menu list with the effect fade to (jquery) | <pre><code>$(document).ready(function() {
$(".menu li a").hover(function() {
$(this).fadeTo("slow", 0.33);
});
});
</code></pre>
<p>I want to effect mouseover and mouseout but I can't do it :(</p>
| jquery | [5] |
689,373 | 689,374 | Get rid of the strip line under the TabWidget | <p>I'm using Android 3.0.</p>
<p>I've created <code>TabHost</code> with <code>TabWidget</code> in my layout and I add the tabs during runtime.
I want to get rid of the blue line under the <code>TabWidget</code> which also indicates on the active tab. I've tried to set the strip to disabled but it didn't help.
How can I do it?</p>
<p>Thanks</p>
| android | [4] |
1,224,056 | 1,224,057 | Some More Program Logic Assistance Requested | <p>I have these partial listings of two classes. A CiscoSwitch object maintains a list of SwitchConnection objects to other switches. I am trying to write the code that will walk a list of switches and return the switches that have common connections, either to each other or to the same RemoteSwitchName listed in the connection list of the other switches but it might not be in the list of CiscoSwitches I am working with. </p>
<p>for example if I have a list of 3 CiscoSwitch instances named A, B and C. A and B might be connected to each other. B and C might not be connected directly to each other but both are connected to D. A might also be connected to D. I am comparing the RemoteSwitchName attribute of each switch connection to the switchName property of the other switches in the list and to the RemoteSwitchName property of the other SwitchConnections on the other switches. </p>
<p>I'd prefer to use LINQ rather than a lot of foreach loops if possible.</p>
<pre><code>public CiscoSwitch
{
private string _SwitchName = String.Empty
public string switchName{ get{return _SwitchName;} set{_SwitchName=value;} }
...
public List<SwitchConnection> SwitchConnectionList = new List<SwitchConnection>();
...
}
public class SwitchConnection
// a switch connection is a connection to another switch
// a switch connection can have multiple portchannels
// a switch connection can exist across multiple VSANs
{
// the name of this switch
// not needed, deprecated
// private string _LocalSwitchName;
// public string LocalSwitchName { get { return _LocalSwitchName; } set { _LocalSwitchName = value; } }
// the name of the switch at the other end of the link
private string _RemoteSwitchName;
public string RemoteSwitchName { get { return _RemoteSwitchName; } set { _RemoteSwitchName = value; } }
private string _RemoteIPAddress;
public string RemoteIPAddress { get { return _RemoteIPAddress; } set { _RemoteIPAddress = value; } }
public Dictionary<int, PortChannel> LocalPortChannelList = new Dictionary<int,PortChannel>();
}
</code></pre>
| c# | [0] |
3,341,867 | 3,341,868 | send email to a bunch of users class | <pre><code>class emailer
{
private $sender;
private $recipients;
private $subject;
private $body;
function __construct($sender)
{
$this->sender = $sender;
$this->recipients = array();
}
public function addRecipients($recipient)
{
array_push($this->recipients, $recipient);
}
public function setSubject($subject)
{
$this->subject = $subject;
}
public function setBody($body)
{
$this->body = $body;
}
public function sendEmail()
{
foreach ($this->recipients as $recipient)
{
$result = mail($recipient, $this->subject, $this->body,
"From: {$this->sender}\r\n");
if ($result) echo "Mail successfully sent to
{$recipient}<br/>";
}
}
}
</code></pre>
<p>why the code write this function?</p>
<pre><code>function __construct($sender)
{
$this->sender = $sender;
$this->recipients = array();
}
</code></pre>
<p>could i delete it? thank you.</p>
| php | [2] |
943,439 | 943,440 | String Operation to get particular value inside the string using java | <p>I have a string as below.</p>
<pre><code><employees>
<emp>
<name>yaakobu</name>
<sal>$20000</sal>
<designation>Manager</designation>
</emp>
<emp>
<name>daaniyelu</name>
<sal>$2000</sal>
<designation>Operator</designation>
</emp>
<emp>
<name>paadam</name>
<sal>$7000</sal>
<designation>Engineer</designation>
</emp>
</employees>
</code></pre>
<p>The above xml i am getting as a string.i was asked not to use parsing due to performance issue.I need to get the second employee 's salary($2000) using java's string operation.Please provide me some pointers.</p>
<p>Your help appreciated.</p>
| java | [1] |
5,342,069 | 5,342,070 | Calculating inner product of an array | <pre><code>// Write a program to calculate the innerproduct of two arrays (ip of v,w = sum, for all i, of vi*wi)
var v = [1, 2, 3, 'x'];
var w = [1, 2, 3, 4];
vSum_total = 0;
wSum_total = 0;
// calculate sum of v
for(i=0; i<v.length; i++)
{
if (isNaN(v[i]))
v[i] = 0
else
vSum_total += Number(v[i]);
}
// calculate sum of w
for(i=0; i<v.length; i++)
{
if (isNaN(v[i]))
v[i] = 0
else
wSum_total += Number(w[i]);
}
alert ("Total of v: " + (vSum_total));
alert ("Total of w: " + (wSum_total));
alert ("Inner product: " + (vSum_total * wSum_total));
</code></pre>
<p>I'm trying to calculate the inner product of an array but my result isn't alerting. Any hints in the right direction would be really appreciated!</p>
| javascript | [3] |
4,861,499 | 4,861,500 | Convert military time to standard time | <pre><code>function checkTime(item) {
if((item.value == "") || (doc.findItem('warning_checkbox').value == '1'))
return true;
if(fixtime(item,true,2)) {
if(item.value/1 < "0800" || item.value > "1700") {
item.value = "";
alert("between 8 AM and 5 PM.");
return true;
}
} else {
item.value = "";
alert("Invalid Time. Time must be between 8 AM and 5 PM.");
return true;
}
if(item.value < "0800" && item.value > "1700") {
item.value = "";
alert("between 8 AM and 5 PM.");
return true;
}
fixtime(item,true,0);
}
</code></pre>
<p>I am using this function to convert standard time to military, but I can't figure out how to convert military to standard time. an example would be <code>1525 = 03:25 pm</code>. </p>
| javascript | [3] |
3,144,822 | 3,144,823 | I want to display only one item at a time in checkboxlist n provide scroll bar when we click on checkboxlist for multiselection | <p>i want a checklistbox as a dropdownlist with checkbox inside.
means it must provide scroll bars in checkboxlist n show 1 item at first.</p>
| asp.net | [9] |
3,786,978 | 3,786,979 | toggle between UIBarButtonSystemItemPlay and UIBarButtonSystemItemPause | <p>Have two UIBarButtonItems want to make it as one UIBarButtonItem and toggle between them </p>
<pre><code>UIBarButtonItem *systemItem1 = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemPlay
target:self
action:@selector(playaudio:)];
systemItem1.style = UIBarButtonItemStyleBordered;
UIBarButtonItem *systemItem2 = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemPause
target:self
action:@selector(pause:)];
systemItem2.style = UIBarButtonItemStyleBordered;
// flex item used to put space in between buttons
UIBarButtonItem *flexItem = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
target:nil
action:nil];
//Add buttons to the array
NSArray *toolbarItems = [NSArray arrayWithObjects: settingsButton, flexItem, systemItem, flexItem, systemItem1,flexItem, systemItem2, flexItem, systemItem3, flexItem, modalBarButtonItem, nil];
[toolbar setItems:toolbarItems];
[settingsButton release];
[systemItem release];
[systemItem1 release];
[systemItem2 release];
[systemItem3 release];
[modalBarButtonItem release];
[flexItem release];
-(void) playaudio: (id) sender {
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"theme"
ofType:@"mp3"];
NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:filePath];
audioPlayer = [[AVAudioPlayer alloc]
initWithContentsOfURL:fileURL error:nil];
audioPlayer.currentTime = 0;
[audioPlayer play];
[fileURL release];
}
- (void)pause: (id)sender {
if
([audioPlayer isPlaying])
{[audioPlayer pause];}
else
{[audioPlayer play];}
}
</code></pre>
<p>Any ideas how i can do that.</p>
| iphone | [8] |
2,996,824 | 2,996,825 | Java labels. To be or not to be | <p>Before I start this question I know the java 'goto' is a big no go.</p>
<p>So I've been writing a program and I have some indented Loops and statements and I need to <code>BREAK</code> multiple on command. Rather than having a load of <code>boolean</code> variables and <code>if(!<booleanName>) BREAK;</code> statements throughout these loops and statements what is everyone's opinions on using labels to break them using the <code>BREAK <label></code> statement?</p>
<p>e.g.</p>
<pre><code> for(...) {
indented_example_loops: // Label name
for(...) {
for(...) {
if(match) break indented_example_loops;
// ^ Break statement to break the 2 for loops at once
}
}
}
</code></pre>
<p>Perfectly okay? Okay to do occasionally? Completely avoid? or should i go to a corner and call the Devil to take my soul?</p>
| java | [1] |
493,263 | 493,264 | can an iPhone application create more than one button on the applications screen? | <p>I'd rather write an application with two buttons on the applications menu than use just one - and have two paths through the app.</p>
<p>Can this be done?</p>
<p>Is there some way of creating buttons on the applications screen?</p>
<p>Thanks.</p>
| iphone | [8] |
4,775,741 | 4,775,742 | Closing a ByteArrayOutputStream has no effect? | <p>What does this statement, "Closing a <code>ByteArrayOutputStream</code> has no effect" (<a href="http://java.sun.com/javase/6/docs/api/java/io/ByteArrayOutputStream.html#close()" rel="nofollow">http://java.sun.com/javase/6/docs/api/java/io/ByteArrayOutputStream.html#close()</a>) mean?</p>
<p>I want to make sure the memory in <code>ByteArrayOutputStream</code> gets released. Does <code>ByteArrayOutputStream.close()</code> really release the memory?</p>
<p>Thanks.</p>
| java | [1] |
3,914,663 | 3,914,664 | Display part in Android | <p>I am retrieving data from my database. In my database one field price with value. I retrieved data, I am displaying all data in a <code>ListView</code> (with a <code>TextView</code> inside it). I want display format as <code>Price:67787</code>. But it displaying only 67787. I searched, but I can't find the correct answer. </p>
| android | [4] |
2,501,415 | 2,501,416 | Why can I type into a disabled EditText? | <p>If I disable an <code>EditText</code> widget using</p>
<pre><code>editText.setEnabled(false);</code></pre>
<p>I can still type into it using the on-screen input method (in both the emulator and on the G1). Is this intended? How can I workaround this issue?</p>
| android | [4] |
474,691 | 474,692 | draw a rectangle using rect method from android graphics but i want the rectangle to fit any screen | <p>i want to draw a rectangle using rect method form android graphics but i want to specify the values in dp so that it can fix to any screen size. i presume by default its in pixel or just x,y coordinates.
how can i draw it to fit in any screen size using the rect method</p>
| android | [4] |
2,687,365 | 2,687,366 | How use dynamic image URl for Image button | <p>I have a Image button on the aspx page that is server side button.</p>
<p>Now I want to get image url for this from my code class. but this is not working.</p>
<pre><code><asp:ImageButton ID="total" runat="server" ImageUrl='<%=myappnamespace.Utility.GetImageURL("chckout_p.png")%>'>
</code></pre>
<p>Function <code>GetImageURl</code> is public in Utility calls and return the full image path. </p>
<p>If I used this for the following then its working fine</p>
<pre><code><img src='<%=myappnamespace.Utility.GetImageURL("chckout_p.png")%>'>
</code></pre>
<p>So what is wrong with the server side controls.</p>
| asp.net | [9] |
1,425,244 | 1,425,245 | Sort arraylist of letters and numbers | <p>I'm trying to sort an arraylist of strings made up of numbers and letters, an example of the list once sorted would be:</p>
<pre><code>name 1
name 2
name 3
name 11
name 12
name 13
</code></pre>
<p>But when I use collections.sort() it sorts this way:</p>
<pre><code>name 1
name 11
name 12
name 13
name 2
name 3
</code></pre>
<p>Any ideas what the type of sort I'm looking for would be called or how do it?</p>
| java | [1] |
5,069,738 | 5,069,739 | Using class methods as simple functions | <p>I have a class with many methods. How can I modify my methods so that they can also be accessed directly as a function without creating object of that class? Is it possible.</p>
| python | [7] |
1,746,265 | 1,746,266 | how to foreach the array in php? | <p>when i print_r($a); the output like this:</p>
<pre><code>Array
(
[0] => stdClass Object
(
[tid] => 3
[vid] => 1
[name] => cPanel
[description] =>
[format] =>
[weight] => 0
[depth] => 0
[parents] => Array
(
[0] => 0
)
)
[1] => stdClass Object
(
[tid] => 4
[vid] => 1
[name] => whm
[description] =>
[format] =>
[weight] => 0
[depth] => 0
[parents] => Array
(
[0] => 0
)
)
[2] => stdClass Object
(
[tid] => 5
[vid] => 1
[name] => test
[description] =>
[format] =>
[weight] => 0
[depth] => 0
[parents] => Array
(
[0] => 0
)
)
)
</code></pre>
<p>the array key maybe increment. now, i want to output all the <code>name'</code>s value of the array.
when i used the following code. it shows me an error.</p>
<pre><code>foreach($a as $a->name){
echo a->name;
}
</code></pre>
| php | [2] |
1,237,629 | 1,237,630 | How to check for a string is equivalent to a user input in Python? | <p>I'd like to just read input from the user until a command is executed or a certain string is entered.</p>
<p>For example:</p>
<pre><code>while "!finish" is not line:
line = input(">")
file.write(line+"\n")
</code></pre>
<p>I'd like to end the input if the user types in !finish and only that string. How can I go about doing this? Also, if there is a way to use key bindings, then that would be better.</p>
| python | [7] |
2,271,559 | 2,271,560 | Changing image color takes too much time in android | <p>I am trying to change image color dynamically in android .but it takes to much time .</p>
<p>Below function is used for changing color.</p>
<pre><code> public void greenColor(ImageView imageView,String fileName){
System.out.println("in green color method");
//initialize the Bitmap Object
Bitmap bmp = BitmapFactory.decodeFile(fileName);
// Bitmap bmp = ((BitmapDrawable)imageView.getDrawable()).getBitmap();
//Guarantees that the image is decoded in the ARGB8888 format
bmp = bmp.copy(Bitmap.Config.ARGB_8888, true);
//Initialize the intArray with the same size as the number of pixels on the image
int[] intArray = new int[bmp.getWidth()*bmp.getHeight()];
//copy pixel data from the Bitmap into the 'intArray' array
bmp.getPixels(intArray, 0, bmp.getWidth(), 0, 0, bmp.getWidth(), bmp.getHeight());
//replace the red pixels with yellow ones
try{
for (int i=0; i < intArray.length; i++)
{
//System.out.println("pixel value :"+intArray[i]);
//intArray[i] = 0xFFFF0000;
if(intArray[i] == Color.WHITE)
{
System.out.println("color white ");
} else{
System.out.println(intArray[i]);
intArray[i]=Color.GREEN;
}
}
}catch(Exception e){
System.out.println("pixel error "+e);
}
//Initialize the bitmap, with the replaced color
bmp = Bitmap.createBitmap(intArray, bmp.getWidth(), bmp.getHeight(), Bitmap.Config.ARGB_8888);
//Draw the bitmap with the replaced color
imageView.setImageBitmap(bmp);
//----end color
}
</code></pre>
<p>I've tried so much and did google search, but i am unable to solve my problem ,</p>
<p>Is there any technique to reduce image color change time in android?</p>
<p>Please help me ...</p>
| android | [4] |
3,610,683 | 3,610,684 | Could not find or load main class with a Jar File | <p>I'm trying to load a jar using</p>
<pre><code>@echo off
java -jar Test.jar
pause
</code></pre>
<p>With the manifest of </p>
<pre><code>Manifest-Version: 1.0
Main-Class: classes.TestClass
</code></pre>
<p>In the Jar directory, I can clearly see a classes\TestClass file when I extract it.</p>
<p>Edit: <code>classes.TestClass</code> does have a <code>public static void main(String[] args)</code>. </p>
<p>Package Deceleration in <code>classes.TestClass</code> is <code>package classes;</code></p>
<p>But I still keep getting the error message </p>
<pre><code>Could not find or load main class classes.TestClass
</code></pre>
<p>I've been through everything I've been able to find with this problem, and none of it seems to help.</p>
<p>I've tried editing the classpath, redoing the manifest, installing the new JRE. </p>
<p>What else should I be doing? </p>
| java | [1] |
4,173,671 | 4,173,672 | Reusing a property value from within an object initializer | <p>First of all sorry for the intriguing title of my question, hopefuly a code sample exposing my problem will clarify things.</p>
<p>Below you will find a code sample that does not compile (and I totally get why, no need to explain) but which expose what I am trying to achieve:</p>
<pre><code>public class Cmd
{
public Byte MyByte { get; set; }
public Byte MyOtherByte { get; set; }
public String MyString { get; set; }
public static Cmd FromStream(Stream stream)
{
return new Cmd
{
MyByte = (Byte)stream.ReadByte(),
MyOtherByte = (Byte)stream.ReadByte(),
MyString = SomeMethodBasedOnMyOtherByte(MyOtherByte) // Here
};
}
}
</code></pre>
<p>I hope you get the idea. Of course if the stream is seekable I could just seek back one byte and reread it for passing it as the argument of the method I am calling. But if the stream is non seekable, no way.</p>
<p>This is a very basic example of course, in my real scenario the classes on which I would like to implement FromStream have many different properties.</p>
<p>Is there any keyword that allows to do what I am trying to do, basically reusing an affected property value from within an object initializer block ?</p>
<p>If not I guess the only way for me would be not to use an object initializer in this context, and construct a new object affecting it's properties one by one (so that I can reuse affected properties if needed). And wouldn't it be nice to have (or reuse) a keyword for this specific scenario in object initializer ? If not, why ?</p>
<p>Thanks !</p>
| c# | [0] |
1,408,951 | 1,408,952 | Get All IDs Starting With "x" | <p>I'm trying to get an output of elements on a page with this:</p>
<pre><code>$('a#exportPage').on('click',function(){
ExportIds = $('[id^="appendHeading"]').attr('id');
ExportTexts = $('[id^="appendHeading"]').text();
$("#PrintIds").append("ObjectID:"+ExportIds+"Content:"+ExportTexts);
});
</code></pre>
<p>But It only gets the "last ID" but not all of them. I've been to this trouble before and needs to get it in my head!</p>
<p>I want the output to be "ObjectID:appendHeading,Content:Texts,ObjectID:appendHeading,Content:Texts" etc.,</p>
<p>Thanks in advance!</p>
| jquery | [5] |
3,955,399 | 3,955,400 | How can I dynamically unload a javascript file? | <p>I am including pages using Ajax but I also need to include their respective javascript files, which requires removing the previous javascript files from memory at the same time.</p>
<p>How can I unload the currently-loaded javascript files (as well as their code in memory) so that I can load the new page's files? They will more than likely conflict, so having multiple independent files' javascript files loaded.</p>
| javascript | [3] |
3,422,039 | 3,422,040 | First argument when doing onload=fn | <p>When I do : </p>
<p><code>img.onload=fn;</code></p>
<p>The function fn gets the <code>argument[0] [object Event]</code>.</p>
<p>How can I avoid that ?</p>
| javascript | [3] |
765,988 | 765,989 | Get a value from a string in python | <p><strong>Program Details:</strong></p>
<p>I am writing a program for python that will need to look through a text file for the line: </p>
<p>Found mode 1 of 12: EV= 1.5185449E+04, f= 19.612545, T= 0.050988.</p>
<p><strong>Problem:</strong></p>
<p>Then after the program has found that line, it will then store the line into an array and get the value 19.612545, from f = 19.612545. </p>
<p><strong>Question:</strong></p>
<p>I so far have been able to store the line into an array after I have found it. However I am having trouble as to what to use after I have stored the string to search through the string, and then extract the information from variable f. Does anyone have any suggestions or tips on how to possibly accomplish this?</p>
| python | [7] |
177,729 | 177,730 | searchings rows from table | <p>i want to select particular rows from the JTable which contains a particular string.. please help me for this..</p>
| java | [1] |
224,823 | 224,824 | Web.config 500 block ipaddress - Internal server error | <p>This is my web.config which has some tags for blocking Ipaddress</p>
<pre><code><system.webServer>
<defaultDocument enabled="true">
<files>
<clear/>
<add value="Default.aspx"/>
</files>
</defaultDocument>
<modules runAllManagedModulesForAllRequests="true"/>
<security>
<ipSecurity allowUnlisted="false">
<clear/>
<add ipAddress="21.2.22.2" allowed="true"/>
</ipSecurity>
</security>
</code></pre>
<p>
So my intention is to block any other IP except the above.
The above is the only Ip address I want the website to be accessible from .
But this is the error I am receiving</p>
<p>500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.</p>
<p>My website is hosted on lunar pages. So as per this <a href="http://www.stokia.com/support/misc/web-config-ip-address-restriction.aspx" rel="nofollow">http://www.stokia.com/support/misc/web-config-ip-address-restriction.aspx</a> which I am refering to , the IP address is the client address. So it shouldn't have anything to do with the hosting provider.</p>
<p>Thank you</p>
| asp.net | [9] |
1,704,403 | 1,704,404 | Android, synctask not showing the list after progressDialog | <p>I was using AsyncTask to display data on a List, But the loading is visible, but it dosen't show the list.. </p>
<pre><code> public void getLocations(){
Connect client = new Connect(SERVICE_URI + "/GetLocations");
client.AddHeader("Accept", "application/json");
client.AddHeader("Content-Type", "application/json");
try {
client.Execute(RequestMethod.GET);
JSONObject rootJson = new JSONObject(client.getResponse());
JSONArray jsonArray = rootJson.getJSONArray("GetLocationsResult");
String[] names = null;
if (jsonArray != null) {
names = new String[jsonArray.length()];
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject json = jsonArray.getJSONObject(i);
names[i] = json.getString("Name");
}
}
setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, names));
} catch (JSONException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
public void getLocations(){
Connect client = new Connect(SERVICE_URI + "/GetLocations");
client.AddHeader("Accept", "application/json");
client.AddHeader("Content-Type", "application/json");
try {
client.Execute(RequestMethod.GET);
JSONObject rootJson = new JSONObject(client.getResponse());
JSONArray jsonArray = rootJson.getJSONArray("GetLocationsResult");
String[] names = null;
if (jsonArray != null) {
names = new String[jsonArray.length()];
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject json = jsonArray.getJSONObject(i);
names[i] = json.getString("Name");
}
}
setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, names));
} catch (JSONException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
</code></pre>
| android | [4] |
3,279,617 | 3,279,618 | Displaying PDF file in ASP.NET without stopping the request | <p>I am providing a PDF file to the user in an ASP.NET application. I have included the code I am using the do this. This works great if that's the only thing I'm doing on that request. What I would really like to do is show provide this PDF file on Form Load without affecting any of the other stuff in the Form Load event. Can somebody point out what I'm doing wrong in the code? Thanks!!</p>
<pre><code>Response.Clear();
Response.Buffer = true;
Response.ContentType = file.ContentType;
Response.AddHeader("content-disposition", String.Format("attachment; filename=\"{0}\"", file.OriginalFileName));
Response.TransmitFile(Path.Combine("C:\", file.FileName));
Response.End();
</code></pre>
| asp.net | [9] |
106,776 | 106,777 | Scroll in TextView on User Touch | <p>I have a TextView with some long text in it. All I want to do is that once the user touches the text and "scrolls" down, the rest of the text is scrolled into view. For some reason my TextView doesn't move at all once I touch it, even though there is more text. So far I have this:</p>
<pre><code> final TextView textView = new TextView(this);
textView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
textView.setFocusable(true);
textView.setFocusableInTouchMode(true);
textView.setEllipsize(TruncateAt.MARQUEE);
textView.setTextColor(Color.WHITE);
textView.setTextSize(15);
textView.setPadding(20, 0, 20, 0);
textView.setText(Html.fromHtml(getString(R.string.alert_quickhints_html)));
alert.setTitle(R.string.alert_dialog_welcome);
alert.setView(textView);
</code></pre>
<p>Any hints? Thank!</p>
| android | [4] |
3,618,916 | 3,618,917 | Pass MotionEvent between views | <p>I have a dialog window with <code>ImageView</code>. When I'm touching image <code>Dialog</code> is dismissed, but user still pressing the screen. Problem is that this touch event isn't passed to window below my <code>Dialog</code> (for example an <code>Activity</code>).</p>
<p>Can I somehow pass this <code>MotionEvent</code> (with <code>ACTION_DOWN</code>) to <code>Activity</code> so it still be able to generate new motion events (with <code>ACTION_MOVE</code> and <code>ACTION_UP</code> accordingly)?</p>
<p><strong>EDIT</strong></p>
<p>What I'm trying to do exactly in my <code>Activity</code>:</p>
<pre><code>//Sending touch event
MotionEvent ev = MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis()+100, MotionEvent.ACTION_DOWN, 50, 50, 0);
getWindow().getDecorView().dispatchTouchEvent(ev);
</code></pre>
<p>and here is my <code>dispatchTouchEvent</code> and <code>onTouchEvent</code>:</p>
<pre><code>@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if(mDragging) {
mMainFrame.onTouchEvent(ev); //I'm passing event to some view
onTouchEvent(ev); //and then to my Activity
return true;
}
return super.dispatchTouchEvent(ev);
}
public boolean onTouchEvent(MotionEvent ev) {
return true;
}
</code></pre>
| android | [4] |
2,086,503 | 2,086,504 | Read mail and SMS from my application | <p>I was wondering if it's possible to read emails and SMS from an android application I'm developing.
Or even have the chance to add a new menu button to the default mail app in order to pass that particular mail text to my background application that can use it to perform some syntax analysis.</p>
<p>Thanks in advance</p>
| android | [4] |
2,306,006 | 2,306,007 | Printing in the console objects of an array | <p>Hi I have been trying to learn Javascript using codeacademy.com and I have reached an exercise that doesn't seem to make any sense when why the exercise I have written.This is my code:</p>
<pre><code> (function(){
var bob = {
firstName: "Bob",
lastName: "Jones",
phoneNumber: "(650) 777 - 7777",
email: "[email protected]"
};
var mary = {
firstName: "Mary",
lastName: "Johnson",
phoneNumber: "(650) 888 - 8888",
email: "[email protected]"
};
var contacts = [bob, mary];
var printPerson = function(person){
console.log(person.firstName + " " + person.lastName);
}
var list = function(){
var i = contacts.length;
for(var j= 0; j < i ; j++){
printPerson(contacts[i]);
}
};
list();
})();
</code></pre>
<p>The problem is in the list function when I try to call the printPerson() function I get that person is undefined but if I write instead of the list() function this:</p>
<pre><code> printPerson(contacts[0]);
printPerson(contacts[1]);
</code></pre>
<p>Everything works.What am I doing wrong in the list() function that it doesn't work?</p>
| javascript | [3] |
465,916 | 465,917 | What options exist to update Android app setting remotely? | <p>I have an Android device that I'm using to monitor a couple of sensors with an app that I created. What useful ways are there to update the settings in my app (while it's running at a remote location) from my computer? I'm interested in sending a message to my app to tell it to email a screenshot, change sample rate, etc. Creative workarounds are encouraged.</p>
<p>I've already looked into C2DM and unfortunately have no experience with setting up the required third-party application server.</p>
| android | [4] |
2,007,197 | 2,007,198 | find first occurance of class in div | <p>I have the below html structure, i want to find the inner html of first div with class as "popcontent" using JQUERY</p>
<pre><code><div>
<div class="popContent">1</div>
<div class="popContent">2</div>
</div>
</code></pre>
<p>thanks</p>
| jquery | [5] |
3,751,770 | 3,751,771 | Generating and adding a new class to an existing assembly in runtime | <p>According to MSDN it's possible to create a NEW assembly in runtime using, for example, <code>Reflection.Emit</code> and add a new class in it, I just would like to avoid such an overkill and create the class in an existing assembly. </p>
<p>Is it possible?</p>
| c# | [0] |
4,670,594 | 4,670,595 | HuffmanTree(java) | <p>The following method is part of HuffmanTree class. But It's a little different because it's not void. I wrote the following method but It doesn't print side way. Would you please help me? Thank you!</p>
<pre><code> public String printSideways() {
StringBuilder s = new StringBuilder("");
printSideways(overallRoot, s , 0);
return printSideways(); // I'm not sure about this part
}
private void printSideways(HuffmanNode root, StringBuilder s, int level) {
if (root != null) {
printSideways(root.right, s.append(root.toString()), level+1);
for(int i = 0; i < level; i++){
System.out.print(" ");
}
System.out.println(root.toString());
printSideways(root.left, s.append(root.toString()) , level+1);
}
}
</code></pre>
| java | [1] |
228,931 | 228,932 | Connect to remote database...online database | <p>Ive been looking for a week now...i need some help connecting to a remote database...i want my app to get data out of the database and update the database...
ive tried this <a href="http://www.helloandroid.com/tutorials/connecting-mysql-database">http://www.helloandroid.com/tutorials/connecting-mysql-database</a> but i dont understand it.</p>
<p>Please help</p>
| android | [4] |
512,259 | 512,260 | Why there is no String<T> in System.Collections.Generic of C#? | <p>C++ STL <code>string</code> is implemented by template.</p>
<p>I am learing C# at the moment, just curious what's the reason the .net designers didn't provide a generic string in System.Collections.Generic?</p>
<p>How can I have a int's string, double's string in C#? </p>
| c# | [0] |
3,683,833 | 3,683,834 | Stripping out non-numeric characters in string | <p>Hey Im looking to strip out non-numeric characters in a string in ASP.NET C#</p>
<p>So i.e 40,595 p.a.</p>
<p>would end up with 40595</p>
<p>Thanks</p>
| asp.net | [9] |
2,123,492 | 2,123,493 | Passing POST values to an Element Value | <p>As the title says how am i able to perform that this is what i got:</p>
<p>This is the container :</p>
<pre><code> <select name="entrylevel">
<options> val </option>
</code></pre>
<p>And this is how i </p>
<pre><code><?php $lvl=$_POST['entrylevel']; ?>
<input type="text" readonly="readonly" name="level" value="$lvl">
</code></pre>
<p>Currently its just spatting out $lvl at my text element. Would appreciate any help what I'm doing wrong.</p>
| php | [2] |
5,697,996 | 5,697,997 | uncertain variables in php | <pre><code>if($a == 4){
echo 'ok';
}
</code></pre>
<p>Now displays an error because $a variable is not defined.
my decision:</p>
<pre><code>if(isset($a)){
if($a == 4){
echo 'ok';
}
}
</code></pre>
<p>But maybe there are better solutions?</p>
| php | [2] |
3,969,039 | 3,969,040 | Releasing a code in visual studio 2010 C# | <p>I wrote a program in C# with visual studio 2010 an now need to ensure that my program will work on any system with XP or seven or vista windows version.
I used from .net & directX in my project.
How can i compact it with an installer on start up?</p>
| c# | [0] |
4,943,388 | 4,943,389 | modify environment variables from java | <p>Have you succeses in JNI approach in <a href="http://stackoverflow.com/questions/525212/how-to-run-unix-shell-script-from-java-code">http://stackoverflow.com/questions/525212/how-to-run-unix-shell-script-from-java-code</a>?? If yes, can you please provide me (or publish) sourcecodes for c and java?</p>
| java | [1] |
5,686,025 | 5,686,026 | c# Return value of function non-existent, when returning a dictionary | <p>I have an interesting problem, which is a function that returns a <code>Dictionary<String,HashSet<String>></code>. </p>
<p>The function converts some primitive structs to a Dictionary Class.</p>
<p>The function is called as follows:</p>
<pre><code>Dictionary<String, HashSet<String>> Myset = new Dictionary<String,HashSet<String>>();
Myset = CacheConverter.MakeDictionary(_myList);
</code></pre>
<p>Upon execution of the two lines above, Myset is non-existent to the debugger. Adding a watch results in: </p>
<blockquote>
<p>"The name 'Myset' does not exist in
the current context"</p>
</blockquote>
<pre><code>public Dictionary<String, HashSet<String>> MakeDictionary(LightWeightFetchListCollection _FetchList)
{
Dictionary<String, HashSet<String>> _temp = new Dictionary<String, HashSet<String>>();
// populate the Dictionary
// return
return _temp;
}
</code></pre>
<p>The Dictionary <code>_temp</code> is correctly populated by the called function and <code>_temp</code> contains all the expected values. </p>
<p>The problem seems to be with the dictionary not being returned at all.</p>
<p>Examples I could find on the web of functions returning primitive <code>Dictionary<string,string></code> work as expected.</p>
| c# | [0] |
519,508 | 519,509 | ArrayList: remove an object during for loop | <p>I have a little problem. I'm trying to remove an object from ArrayList, but the change doesn't occur. </p>
<p>Here is the code sample: </p>
<pre><code> List<Room> rooms = new CopyOnWriteArrayList<Room>();
rooms.addAll(fp.getRooms());
int counter = 1;
for(Room r: rooms){
for(Square s: r.getDoor()){
r.getDoor().remove(s);
String name = String.valueOf(fp.getRooms().size() + counter);
Room doorRoom = new Room(name, false, s, s);
rooms.add(doorRoom);
counter++;
}
}
fp.setRooms(rooms);
</code></pre>
<p>I'm trying to remove the object <code>s</code> and replace it with a new object <code>doorRoom</code>. </p>
<p>Output: </p>
<pre>
First> [S: 11:7; true, S: 11:15; true, S: 11:20; true]
Second> [S: 11:7; true, S: 11:15; true, S: 11:20; true]
</pre>
<p>And I'm expecting:</p>
<pre>
First> [S: 11:7; true, S: 11:15; true, S: 11:20; true]
Second> [S: 11:15; true, S: 11:20; true]
</pre>
<p>an so on... </p>
<p>What is the problem?</p>
<p>Thank you and I'll be glad to receive your response! </p>
| java | [1] |
1,036,576 | 1,036,577 | How to Handle Button Click Events in jQuery? | <p>I need to have a button and handle its event in jQuery. And I am writing this code but it'snot working. Did I miss something?</p>
<pre><code><!-- Begin Button -->
<div class="demo">
<br> <br> <br>
<input id = "btnSubmit" type="submit" value="Release"/>
<br> <br> <br>
</div>
<!-- End Button -->
</code></pre>
<p>And in the javascript file</p>
<pre><code>function btnClick()
{
// button click
$("#btnSubmit").button().click(function(){
alert("button");
});
}
</code></pre>
| jquery | [5] |
5,432,051 | 5,432,052 | Having two different sessions in same domain | <p>I run foo.com. I have two different applications that live in foo.com: one is foo.com/bar, and the other is foo.com/example. I use sessions to track information about the user while they're logged in, but if the user goes from foo.com/bar to foo.com/example, foo.com/example sees the session the user started from foo.com/bar and uses that information. My question is, how can I have two different sessions going for each directory at the same time?</p>
| php | [2] |
2,567,204 | 2,567,205 | Check a string for bad words? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/8801486/efficient-way-to-test-string-for-certain-words">Efficient way to test string for certain words</a> </p>
</blockquote>
<p>I want to check if a string contains any of these words: <em>ban, bad, user, pass, stack, name, html</em>.</p>
<p>If it contains any of the words I need to echo the number of bad words</p>
<pre><code>str = 'Hello my name is user';
</code></pre>
| php | [2] |
3,668,707 | 3,668,708 | Copying a file from withing a apk to the internal storage | <p>I would like to push a text document from the apk into the /system directory (Yes its a app for rooted users) and was wondering how i would do this :) My txt file is in the assests folder but it could be used if needed</p>
| android | [4] |
5,482,605 | 5,482,606 | why to use bind or on instead of direct event triggers in jquery? | <p>I have seen many people use bind or on functions instead of direct event triggers etc</p>
<pre><code> $(document).bind('click', function(){
alert('Fired');
});
</code></pre>
<p>instead of</p>
<pre><code> $(document).click(function(){
alert('Fired');
});
</code></pre>
<p>same thing for on function</p>
<pre><code>$('p').on('click', function()({
alert('fired');
});
</code></pre>
<p>instead of </p>
<pre><code> $('p').click(function()({
alert('fired');
});
</code></pre>
<p>can someone explain it? </p>
| jquery | [5] |
4,360,651 | 4,360,652 | Summing time in DateTime() objects | <p>I have an array of DateTime() objects in which I store some time duration (like "H:i")
How can I sum all elements in this array to get total time duration? </p>
<p>And it's also should be taken into account, that if total time duration is grater that 23:59, I have to be able to get nubmer of days.</p>
<p>is this possible?</p>
<p>I was trying to do like this:</p>
<pre><code>$duration = new DateTime('00:00');
foreach($routes as $route) {
$arrival_time = new DateTime();
$arrival_time->setTimestamp($route->arrival_time);
$departure_time = new DateTime();
$departure_time->setTimestamp($route->departure_time);
$leg_duration = $arrival_time->diff($departure_time);
$duration->add($leg_duration);
}
</code></pre>
<p>but in <code>$duration</code> I got wrong time.</p>
<p><strong>P.S.</strong></p>
<p>Using <code>$duration->add($leg_duration);</code> I got subtracted from <code>"24:00"</code> time, why?
For example if <code>$leg_duration = new DateTime('02:10');</code> the result will be <code>"21:50"</code>.</p>
<p><code>$duration->sub($leg_duration);</code> add time to <code>"24:00"</code></p>
<p>Is this right?</p>
| php | [2] |
662,232 | 662,233 | python issue regarding "LearnPythonTheHardWay" book, ex18 | <p>Im having some issues to get exercise 18 'Names, variables, code, functions' to work. And to be very honest, i dont quite understand it either, like I didnt fully understand couple previous ones, but yeah.
Here is the code i've writed:</p>
<pre><code>def print_two(*args):
arg1, arg2 = args
print "arg1: %r, arg2: %r" %(arg1, arg2)
def print_two_again(arg1, arg2):
print "arg1: %r, arg2: %r" % (arg1, arg2)
def print_one(arg1):
print "arg1: %r" % arg1
def print_none()
print "I got nothing."
print_two("Zed", "Shaw")
print_two_again("Zed", "Shaw")
print_one("First!")
print_none()
</code></pre>
<p>line 15
def print_none()
SyntaxError ^</p>
| python | [7] |
1,058,076 | 1,058,077 | Return only text after last underscore in JavaScript string | <p>If I have a string like so:</p>
<pre><code>var str = 'Arthropoda_Arachnida_Zodariidae_Habronestes_hunti';
</code></pre>
<p>How can I get just the last part of the string after the last underscore?</p>
<p>And in the case there are no underscores just return the original string.</p>
<p>In this case I want just <code>'hunti'</code></p>
| javascript | [3] |
534,247 | 534,248 | How do i find all drop down lists in a page using Jquery | <p>How do i loop thru all dropdown boxes in JQuery?</p>
| jquery | [5] |
4,150,951 | 4,150,952 | Available class events C# | <p>in c# how can I get the available events of a class in order to begin programming code inside of it. I know that in form or usercontrol you can select the control and click the events button and click on the selected event to begin coding, but I mean a derived class which I want to code its methods or events.</p>
<p>Thanks!</p>
| c# | [0] |
2,784,134 | 2,784,135 | What % and & in this code? | <p>I wonder what % and & in the following PHP code do.</p>
<pre><code>$num_one = rand() % 10;
$num_two = rand() & 10;
</code></pre>
<p>Thanks in advance.</p>
| php | [2] |
1,853,978 | 1,853,979 | windows notify icon c# change message without refresh | <p>How do I change the message displayed within the notify icon baloon tip without the baloon refreshing.</p>
<p>I want to show a countdown timer before the application carries out an event and I want to use the onclick to cancel the event when the user clicks it.</p>
<p>Thanks
Sp</p>
| c# | [0] |
3,652,921 | 3,652,922 | php variables comparison == vs === | <p>this is code:</p>
<pre><code>$s = 0;
$d = "dd";
if ($s == $d) {
var_dump($s);
die(var_dump($d));
}
</code></pre>
<p>result is:</p>
<pre><code>int 0
string 'dd' (length=2)
</code></pre>
<p>Please explain why.</p>
<p>why <code>($s == $d)</code> results as true?</p>
<p>Of course, if <code>===</code> is used it will results as false but why this situation requires <code>===</code>?
Shouldn't it be returned false in both situations?</p>
| php | [2] |
3,178,570 | 3,178,571 | unresolved external symbol error: not able to solve it | <p>I am getting below unresolved external symbol error while compiling the code. I am using third party library. so using third party library namespace while compiling the code.</p>
<blockquote>
<p>std_uss.obj : error LNK2019: unresolved external symbol "<code>__declspec(dllimport) void __cdecl os_std::os_throw_length_error(void)</code>" (<code>__imp_?os_throw_length_error@os_std@@YAXXZ</code>) referenced in function "<code>private: char * __thiscall os_std::basic_string<char,class os_std::char_traits_char,class os_std::allocator<char> >::allocate(unsigned int)</code>" (<code>?allocate@?$basic_string@DVchar_traits_char@os_std@@V?$allocator@D@2@@os_std@@AAEPADI@Z</code>)</p>
</blockquote>
<p>I found os_throw_length_error function in one of the files of third part library but did not find any function similar to ::allocator in the code. I did not used standard std namespace since I want compiler to use third party namespace.</p>
<p>If I use <code>using namespace std</code> which is standard then my compilation is successful but then some definitions like string are getting referenced to visual studio string rather than third party string function.</p>
| c++ | [6] |
426,561 | 426,562 | passing a function as a string in php | <p>I'm just starting to learn PHP and am using the W3 Schools tut. In the error handling section there is this code:</p>
<pre><code><?php
function customError($errno,$errstr) {
echo '<b>Error:</b> [$errno] $errstr<br />';
}
set_error_handler('customError');
echo($test);
?>
</code></pre>
<p>Why is the customError() function being passed as a string? Is this a mistake in the tut?
Also, why isnt <code>$test</code> defined?</p>
| php | [2] |
1,370,854 | 1,370,855 | How to create a dynamic table from cs file | <p>I am fetching a data from sql.Result is like this.Country,State,City,Count.</p>
<pre><code>India Maharashtra Mumbai 30
India MahaRashtra Pune 20
India Maharashtra Nashik 28
</code></pre>
<p>But I want to show like this in table.I am have created table from cs file.From table I am able to put into 30 in mumbai but entry for pune and nashik is going to next row.I applied logic here is if countryName is different put into next column.If state name is same,don't write more than once.In same row write for city count.But second country I am getting from second row of sql.</p>
<pre><code>Country state Mumbai Pune Nashik
India
Maharashtra 30 20 28
</code></pre>
| asp.net | [9] |
87,128 | 87,129 | PHP fmod problem | <pre><code><?php
$i = 1;
$y = 5;
?>
<?php while (have_posts()) : the_post(); ?>
<?php
if (fmod($i, $y) == 0) {
echo '<tr>';
}
?>
</code></pre>
<p>What i'm doing wrong? I want every 5 time to show the <code><tr></code>,any help?</p>
| php | [2] |
1,265,464 | 1,265,465 | Bitmap parceling | <p>When trying to save a bitmap to parcel I get this</p>
<pre><code>java.lang.RuntimeException: Tried to marshall a Parcel that contained Binder objects.
at android.os.Parcel.marshall(Native Method)
</code></pre>
<p>Does anyone know why?</p>
| android | [4] |
4,418,768 | 4,418,769 | how to open gmail and send email to specific id in a android app? | <p>how to open gmail and send email to specific id ina android app?</p>
<pre><code> Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("plain/text");
startActivity(emailIntent);
</code></pre>
<p>but its not working for me ActivityNotFoundException is shown? </p>
| android | [4] |
618,050 | 618,051 | pass argument to previous activity | <p>I would like to pass arguments from an activity B to A where B has been launched by A. Is this possible to do so ?
Thanks</p>
| android | [4] |
2,503,314 | 2,503,315 | is there a jquery plugin to show sign-up/registration progress? | <p>I'm looking for a quick and easy way of showing users position in the sign up page, in a nice way.</p>
<p>you see these things for stuff like basket->checkout->confirm details->payment, often they look a bit like a public transport map o----o----o----o if that makes sense?!</p>
<p>Any plugins to do this without me opening photoshop?</p>
| jquery | [5] |
5,629,718 | 5,629,719 | mobileconfig file and safari | <p>I've created a mobileconfig file and deployed it to webstore. To install mobileconfig file on iPhone i need to either send it in a mail or user can type webstore URL on iphone safari to install it. But my question here is: Will it be possible to create a webview interface or something else and install mobileconfig file silently on the phone? I am asking this because i already have an app where i would like to integrate this rather ask user to go to a URL and install the file. Will it be possible?</p>
| iphone | [8] |
2,182,092 | 2,182,093 | How do I define a class that can only be instantiated via new (ie not on the stack)? | <p>I want to arrange things such that for a class Foo, this works:</p>
<pre><code>Foo *f = new Foo()
</code></pre>
<p>but this does not (preferably a compile-time error):</p>
<pre><code>Foo f;
</code></pre>
<p>Can this be done?</p>
<p>The specific reason is that Foo is actually a tracking class to make another heap-allocated object appear in a script environment. Foo's internals keeps a mapping from script references to C++ objects. The tracking object would be used like this:</p>
<pre><code>Thing *t = new Thing();
(new FooThing(t))->PushToScriptStack();
</code></pre>
<p>If the tracking object is on the stack then the pointer becomes invalid at the end of scope, and I'm left with dangling pointers in my tracking data.</p>
<p>I have all this working well, I'm just looking for a little extra protection.</p>
| c++ | [6] |
2,167,773 | 2,167,774 | Whats the difference between the comparison and logical "not" operator? | <p>I'm having a hard time understanding the difference between the comparison and logical "not" operators in Javascript. And I am confused about the syntax as well. My questions are:</p>
<p>Since they are both boolean operators, are there any real differences between the two?</p>
<p>And is the syntax for both like this?
x! = 5</p>
<p>Any explanation appreciated - please post examples if you can.</p>
| javascript | [3] |
4,308,595 | 4,308,596 | How to read Varian hnd files using java | <p>I have these "Varian hnd" files in my computer and I want to know if there is a way that I can open these files using eclipse or netbeans in java?. I think that these files have some images and I want to show them on my computer but I have no idea how to proceed. Also, can anyone explain to me about the format/extension of "Varian hnd" files.
Your help will be much appreciated.</p>
| java | [1] |
2,995,822 | 2,995,823 | How to get current Region Name using Coordinates? | <p>Hi all
I just need current location details,</p>
<p>I have done the part of getting Current location Coordinates.</p>
<p>Now i want to get the region name, etc (No Maps) details using these coordinates.</p>
<p>How to do that? Any sample code available? </p>
<p>Thanks in advance.</p>
| iphone | [8] |
43,232 | 43,233 | Error in creating brand new package in android | <p>So I am fairly new to Android development so I am starting out by following <a href="http://developer.android.com/training/basics/firstapp/creating-project.html" rel="nofollow">http://developer.android.com/training/basics/firstapp/creating-project.html</a> to just get a foot hold. The problem is that when I create a project I already have an error so I can't even run hello world. I have tried searching for anyone with a similar problem but nothing seems to come up. Any insight to the problem would be much appreciated.</p>
| android | [4] |
2,321,952 | 2,321,953 | android media - mediacontrol for playing audio as a service | <p>I want to play the audio in my android app as a service so it keeps playing while the user goes to other applications. I managed to develop the core parts of the service yet now i need controls on the side of the application to start/stop the audio. I would love to use the MediaControl class yet it seems to be bound to a mediaplayer defined in the same application. So basically I am trying to find out how to connect a service based audio playback with a mediacontroller or something similar.</p>
<p>Any advice highly appreciated</p>
<p>martin</p>
| android | [4] |
4,623,445 | 4,623,446 | Retrieve Field properties in JQuery | <p>I am new to JQuery.</p>
<p>I have created many textfields,textarea fields in a DIV. Inside that div I kept separate divs for every field(which includes a label tag, and the field(text/textarea)) in an orderly manner.</p>
<p>And now I am trying to retrieve the label names and the type,size of those fields ,when clicking on save. How can I do so in JQuery?</p>
<p>Also I may not know what fields are there after that label. It may be anything text,textarea etc..Is it possible to find what tag is following label tag??</p>
<p>Here is the html:</p>
<pre><code> <div id="fb_contentarea_col1down21">
<div id="1">
<label id="label1">name</label>
<input type="text" style="width: 200px;" id="input1"/><br/>
<div id="instr1"/>
</div>
<div id="2">
<label id="label2">address</label>
<textarea id="input2" style="width: 200px;"/><br/>
<div id="instr2"/>
</div>
</div><!-- End of fb_contentarea_col1down21 -->
<div id="save"><input type="submit" value="Save Form" class="button" id="saveForm"/>
</code></pre>
| jquery | [5] |
103,367 | 103,368 | How to send data from server to android application to specific USER and to GROUP | <p>I want make an android application in which admin sends message from server.admin can select whom to send e.g. Specific User <strong>or</strong> All User Of Some Department <strong>or</strong> To All.i am thinking of <strong>google cloud messaging</strong>.i want solutions how it will be done.any help will be appreciated.</p>
| android | [4] |
2,782,509 | 2,782,510 | Java SE - a small web server program | <p>I am just curious how to implement a small server program in Java SE? </p>
<p>The program is listening on port 80 and ready to retrieve an InputStream object, but is there any function I can use to convert an InputStream into an HttpRequest object (something like Servlet)? </p>
<p>After that, how can I craft an HttpResponse object and send the data back to the browser?</p>
<p>Conclusively, I am just looking any framework that can help me parse the HTTP format into an object, or from an object into an HTTP response stream. </p>
<p>(I know Java EE will be the better solution, I just want to test something on Java SE)</p>
| java | [1] |
4,808,025 | 4,808,026 | Are there other used extension for JavaScript files other than .js? | <p>Does it happen in special cases that JavaScript file is not stored in a file with .js extension?</p>
| javascript | [3] |
3,117,704 | 3,117,705 | Expat Parser vs Dom Parser in php | <p>when should i go for Expat parser rather Dom Parser and vice versa ? What is the difference between these parsers ? </p>
| php | [2] |
1,995,917 | 1,995,918 | Maintaining dynamic textbox control values into an array in javascript onchange event | <p>I need to maintain text box values into an array in javascript <code>onchange</code> event. The text box control is created dynammically in javascript function. I have used below code. But at the end the array contains current element only. Previous values are not maintaining. How can I maintain textbox value each time entered.</p>
<pre><code><script type="text/javascript" language="javascript">
function DrawTextBox(j) {
var imgElement = document.getElementById('myimage');
var imgCoord = imgElement.getBoundingClientRect();
var cl = imgCoord.left + 20;
var x = x - cl;
var y = y - imgCoord.top;
var rect = document.getElementById(j);
if (rect == null) {
rect = document.createElement("div");
rect.id = j;
var pElement = document.getElementById("imgDiv");
pElement.appendChild(rect);
}
if (w < 0) {
w = 10;
}
if (h < 0) {
h = 10;
}
var l = parseInt(document.getElementById("hright").value) + 150 + 'px';
var style = rect.style;
// style.width = w + "px";
//style.height = h + "px";
style.left = l;
style.top = document.getElementById("htop").value;
style.backgroundColor = "Transparent";
//style.borderColor = "Blue";
style.position = "absolute";
style.borderStyle = "solid";
style.borderWidth = 2 + "px";
style.zIndex = 6000;
document.getElementById(j).innerHTML = "<textarea name=\"comments\" style=\" border:0\" Title=\"Enter Comment\" id=\"T1\" value=\"EnterComment:\" onchange=\"GetText()\" ></textarea>";
//document.getElementById(i).innerHTML = "<input type=\"Textarea\"...blah blah...></input>";
return rect;
}
function GetText() {
array1.push(document.getElementById('T1').value);
alert(array1.join(', '));
}
</script>
</code></pre>
| javascript | [3] |
4,944,911 | 4,944,912 | How to receive javascript variable in another file? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/901115/get-query-string-values-in-javascript">Get query string values in JavaScript</a> </p>
</blockquote>
<p>I am simply passing a javascript variable via URL to another html file like ?id="javascript_variable_value". I am not using any database here. Just html and javascript.</p>
<p>I need your help here. How can I receive this value in other file?</p>
| javascript | [3] |
5,517,650 | 5,517,651 | Is not a function in jquery | <p>I have a big problem, I can't execute my jQuery code correctly. </p>
<p>I edited the post to show the html...</p>
<pre><code><select id="corrector" name="availability" value="" onchange="escorrecto();" >
<option value="correcto"></option>
<option value="incorrecto"></option>
<option value="nodefinido"></option>
</select>
</code></pre>
<p>and the jQuery code...</p>
<pre><code>function escorrecto()
{
switch ($('corrector').value)
{
case 'correcto':
alert($('corrector').value)
break;
case 'incorrecto':
alert($('corrector').value)
break;
case 'nodefinido':
alert($('corrector').value)
$("#campo").prop("disabled",true);
break;
}
}
</code></pre>
| jquery | [5] |
961,889 | 961,890 | Is there a less tedious way of doing a deep copy in c#? | <p>So I have written a program in which I need to do a deep copy of several objects. In my case I cannot use serialization which would've solved this problem with ease. Is there another way to solve this problem without manually copying all the attributes in the classes?</p>
| c# | [0] |
156,300 | 156,301 | Is it possible to synchronize data members and not methods? | <p>After reading topics here about Java synchronized methods, I've tried to implement it in my multiplayer game because many threads are opened and trying to access the same resource.
I've made methods synchronized but that's doesn't help me since if I have a data member called ArrayList clientConnection; and the methods that are available are:</p>
<pre><code>int getArrayListSize() {
clientConnection.size();
}
void addConnection(ServerConnection i_connection) {
clientConnection.add(i_connection);
}
void removeConnection(ServerConnection i_connection) {
int index = clientConnections.indexOf(i_Connection);
clientConnections.remove(index);
}
ServerConnection getClientFromArrayListByIndex(int i_Index) {
ServerConnection client = this.clientConnections.get(i_Index);
}
</code></pre>
<p>I've tried to make a global synchronized method to whenever one want to use one of the methods he needs to pass in an operation type and other data and he locks the function.
The problem is that there are 2 function that return void, 1 returns int and 1 returns ServerConnection so I can't create that global method.
My question if there is a possible to lock data members and not methods in Java so I can lock the clientConnection data member?
Thanks.</p>
| java | [1] |
1,519,509 | 1,519,510 | jQuery append() is broken in IE? | <p>Is jQuery 1.6.4 <code>append()</code> is broken in IE?</p>
<p>This code works everywhere but IE6+</p>
<pre><code>$('<xml></xml>').append('<test>hello world</test>');
</code></pre>
<p>Is there a way to fix that?</p>
| jquery | [5] |
4,017,199 | 4,017,200 | setContentView(R.layout.main); Gives error from start | <p>I'm just starting to develop with android, and a followed a tutorial on google to get everything set up. I'm using eclipse and I have both the android sdk and the eclipse plugin installed, but when I create a new Android Project, I get an error on this line from the start.</p>
<pre><code>public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
</code></pre>
<p>It Says that the "R" in "R.layout.main" does not exist. Is there class that i need to create or import? I'm really confused because i have thoroughly searched and cannot find anyone else with this issue. </p>
| android | [4] |
2,436,971 | 2,436,972 | PHP lookup table | <p>I have a chart in my hand that looks something like the following. It's likely these values will never change.</p>
<pre><code>+----------------------+
|Rating | >= | <= |
+----------------------+
| 100 | 0.0 | 0.112 |
| 99 | 0.113| 0.156 |
| 98 | 0.157| 0.201 |
| 97 | 0.202| 0.309 |
| ... | ... | ... |
+----------------------+
</code></pre>
<p>What is the best way to implement a function like <code>get_rating(0.300)</code> in PHP?</p>
<p>Of course I could make a long if/else chain or a switch statement. Not sure if that is the best solution, though.</p>
| php | [2] |
1,258,437 | 1,258,438 | JPicker opens up and gets stuffed in small viewing portal for accordion | <p>In summary, Jpicker is great; however, I have the small box button in a JQuery accordion, the window opens in the accordion and the issue is that the accordion is to small.</p>
<p>Is there a way to have the jpicker open up in the document window, NOT the accordion window?</p>
| jquery | [5] |
5,970,993 | 5,970,994 | try to end a program if file no found | <p>I am trying to terminate a program if the if statement returns that the file does not exist. At the moment the method is </p>
<pre><code>public static void calcMarks()
{
String Assessment1 = null, Assessment2 = null, Assessment3 = null;
int mark1 = 0,mark2 = 0,mark3 = 0,sum = 0;
try {
File doc = new File ("marks.txt");
if(!doc.exists())
{
System.out.println ("Marks.txt Does Not Exist");
System.exit();
}
if(!marks.exists())
{
System.out.println ("TotalMarks.txt Does Not Exist");
System.exit();
}
Scanner input = new Scanner(doc);
while (input.hasNext()){
Assessment1 = input.next();
mark1 = input.nextInt();
Assessment2 = input.next();
mark2 = input.nextInt();
Assessment3 = input.next();
mark3 = input.nextInt();
}
input.close();
sum = mark1 + mark2 + mark3;
System.out.println(Assessment1 + " " +mark1 +"\n"+ Assessment2 + " "+mark2 +"\n"+ Assessment3 + " "+mark3+ "\n" + "Total" +""+ "=" + sum);
}
catch (FileNotFoundException ex) {
System.err.println("File has not been found");
}
}
</code></pre>
<p>but on the System.exit(); is the if statement, I get the error exit(int) in Jaba.lang.system. cannot be applied to ()</p>
<p>I have no idea what that means </p>
| java | [1] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.