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,617,556 | 4,617,557 |
Getting the height multiple elements aplying to siblings
|
<p>I have this problem I dont know what im missing so far I have this code
I have a dropdown menu that inside has 1 big column and other 4 divs next to them, I have to make the other divs the same height of the first div.. I wrote this </p>
<pre><code>$('.dropdown div:first-child').each(function(){
$this = $(this)
var $height = $this.height()
$(".dropdown div:first-child").siblings("div").css("height", $height)
});
</code></pre>
<p>the problem is that the variable $height is returning a 0 value.. do you know why Im not getting each height?</p>
<p>Thank you in advance</p>
<p>//edit </p>
<p><a href="http://jsfiddle.net/DsBF2/" rel="nofollow">http://jsfiddle.net/DsBF2/</a></p>
<p>so you can have an Idea...</p>
|
jquery
|
[5]
|
3,906,040 | 3,906,041 |
VOICE_RECOGNITION_REQUEST_CODE cannot be resolved
|
<p>I'm working through the voice recognition sample in the android sdk. I'm getting the compiler error in the title. I've checked all of my Imports. I'm targeting Google APIs (Android 2.3.3). Am I missing an external package?</p>
|
android
|
[4]
|
1,951,172 | 1,951,173 |
Displaying iPhone StopWatch like time in my own application ,should consists of minutes seconds and hundrerth seconds
|
<p>i have to keep iphone type of stop watch on my app..if the user touches the start button in my app..</p>
<p>i already developed up to seconds. such like 00:01:45</p>
<p>and my problem is i have to get the hundredth second i.e like 01:014:48:95 ,if it crosses the 100 number the second will increase to 1 </p>
<p>THanks in Adv...</p>
|
iphone
|
[8]
|
4,544,689 | 4,544,690 |
Java polymorphism basics
|
<p>I am reading the SCJP book by Kathy Sierra. Polymorphism is little confusing. Could you please help me out with a real world example for the following: I understood that Polymorphism only works when you have overridden methods no matter if you do it via class or interface and on runtime JVM determines the method based on Object type.
<br/>Lets say Horse extends from Animal and it also overrides the eat() method.
What is the benefit of doing: <code>Animal a = new Horse();
a.eat();</code> over <code>Horse b = new Horse();
b.eat();</code> <br/> Eventually the result is going to be the same. I apologize its a very basic question but even all the senior developers in my team gave me all different answers.</p>
|
java
|
[1]
|
4,835,098 | 4,835,099 |
How to change the Video Orientation while playing the video in android?
|
<p>I have a problem that I am receiving many videos from server side uploaded by iPhone, but when I am playing it, then its gets rotated means I am receiving the videos which are rotated previously at 90 degree, but I have to play it in normal orintation means in Portrait mode.So, Is it possible to change the orieantation of the video while playing in android. Video is playing from the SDCARD.</p>
<p>Thanks in advance.</p>
|
android
|
[4]
|
2,072,793 | 2,072,794 |
overriding javascript function in a webview
|
<p>I want to integrate an existing website into my webview but also override a javascript function that exists on this website with my own version? Then I can use the java-javascript bridge. I have tried using the following but it seems to execute the function only</p>
<pre><code>webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
webView.loadUrl("javascript: (function myFunc() { "
+ "alert('overriden alert ha!');"
+ "})()");
}
});
</code></pre>
|
android
|
[4]
|
5,991,791 | 5,991,792 |
how to use single string var in url instead of multple when pushing something to php?
|
<p>how do you setup PHP to do use single string in url: ex just ?small instead of the code below</p>
<pre><code>if ( $_GET['api_img_size'] == 'small' ) { ....
</code></pre>
<p>but with ?small do the same thing as the code above</p>
|
php
|
[2]
|
952,439 | 952,440 |
How to override a method which is used in the parent constructor?
|
<p>I'm having a design problem which I don't know how to overcome in java. I want to override a method that is called from the parent constructor. Here is a very simple example of the problem: </p>
<pre><code>public class Parent {
public Parent(){
a();
}
public void a() {
// CODE
return;
}
}
public class Child extends Parent {
public Child() {
super();
}
public void a() {
super.a();
// MORE CODE
return;
}
}
</code></pre>
<p>I know that the child class wont be initialized until the parent is constructed therefore the childs a() method wont be called. What is the correct design to overcome this problem?</p>
|
java
|
[1]
|
4,156,633 | 4,156,634 |
UIView loaded from segment managing view is not resizing in landscape mode
|
<p><a href="https://download.github.com/crafterm-SegmentedControlExample-b4696ed.zip" rel="nofollow">SegmentManagingView</a></p>
<p>I am trying to do something like above link. I set the Rotation code in my segmentmanagingview</p>
<p>But it is not resizing in landscape mode.Table's width is 320 px in landscape and portrait mode.Any other way to achieve this?</p>
|
iphone
|
[8]
|
5,780,523 | 5,780,524 |
working with sqlite database in android programming
|
<p>I want a sample working demo or link to understand the database functions like insert, delete, modify etc.</p>
<p>Thanks</p>
|
android
|
[4]
|
435,006 | 435,007 |
Is it possible to start activity through adb shell?
|
<p>I want to start activity through adb shell. So that I can launch a specific activity that is needed</p>
|
android
|
[4]
|
415,997 | 415,998 |
How to create a nodes every time i go through the loop in python
|
<p>I like to create a nodes every time when i go through a loop.But presently only the last value of the loop will be used. How can i achieve this using python. following is my example.</p>
<p>My xml :-</p>
<pre><code><person>
<user name="david" password="super"></user>
<user name="alen" password="boss"></user>
<user name="windeesal" password="sp"></user>
</person>
</code></pre>
<p>The python code:</p>
<pre><code>import xml.etree.ElementTree as ET
doc = ET.parse("users.xml")
root = doc.getroot() #Returns the root element for this tree.
root.keys() #Returns the elements attribute names as a list. The names are returned in an arbitrary order
for child in root:
name = child.attrib['name']
password = child.attrib['password']
root = ET.Element("person")
user = ET.SubElement(root, "user")
user.set("username",username)
user.set("password",password)
tree = ET.ElementTree(root)
myxml = tree.write("new.xml")
print myxml
</code></pre>
<p>Out put of the code contain only last value of loop :(</p>
<pre><code><person>
<user password="sp" username="windeesal" />
</person>
</code></pre>
<p>how to create the nodes every time i go through the loop then join the results and write them to the file .? am really a beginner please give me a detail explanation. Thank you very much . </p>
|
python
|
[7]
|
3,429,262 | 3,429,263 |
Why does deny roles not work in membership?
|
<pre><code><location path="MoviesReview.aspx">
<system.web>
<authorization>
<deny roles="Users"/>
</authorization>
</system.web>
</location>
</code></pre>
<p>I am not able to restrict roles of users to this movies page.What could be the problem?</p>
|
asp.net
|
[9]
|
1,456,983 | 1,456,984 |
check for click on any child element
|
<p>I want to submit a form with JavaScript once any child element of a specific unordered list is clicked.</p>
<p>The code could will look somewhat like this but the number of list items can get very long.</p>
<pre><code><ul id="myList">
<li id="myListItem1">list item 1<li>
<li id="myListItem2">list item 2<li>
<li id="myListItem3">list item 3<li>
</ul>
</code></pre>
<p>It will not be possible to add an onclick to every li. Also,I may not be able to attach code to the ul tag so if it is possible to solve without attaching code to the ul tag that would be the best. Unfortunately libs like jquery, mootools etc. may not be used. The id of the UL will always be known and static but the id of the LI's will be unknown since they can differ in amount.</p>
|
javascript
|
[3]
|
4,510,304 | 4,510,305 |
jQuery loading screen on form submit with file response
|
<p>I have an HTML form. When submitted it creates an Excel file and returns it.
On all other forms I have a loading screen shown in the <code>onSubmit</code> function and hidden in the <code>document.ready</code> function, but when a file is returned, there is no <code>document.ready</code> and so my loading screen doesnt hide.</p>
<p>I tried jQuery form plugin with callback function, but this way I was not able to normally show the response page on the other forms. The same is the case with <code>$.post()</code> function with a callback.</p>
<p>All I want is to call my <code>loadingScreenHide</code> function when the form submit is finished and leave the rest as normal.</p>
<p>Any ideas? </p>
<p>Thanks.</p>
<p>Code i tryed is like:
with form plugin callback function (return true; doesnt seem to work) :
$('form').ajaxForm(function () {activateDeactivateScreen('hidden'); return true; });</p>
<p>or with post instead:
$.post($('form').attr('action'), $('form').serialize(), function () {activateDeactivateScreen('hidden'); return true; });</p>
<p>the 2 main problems are when i use normal submit i dont have a callback and when i get a callback i dont have the normal submit/page load</p>
<p>i also had the idea of changing my java server pages to save the file temporary and redirecting to a download, but this way i would have to change about 20-30 java sources, so i would prefer a javascript solution</p>
|
jquery
|
[5]
|
4,076,621 | 4,076,622 |
Android, How can I extract mobile information?
|
<p>I want to collect some information of mobile phone such as phone number, which brand it is, model of the device and product name.</p>
<p>I know how to extract phone number but i don't know the rest. if it's possible guide me please.</p>
<p>[EDITED]
Thank you dear friends, I did what you suggested me and now every thing is ok in Emulator and I have result. But the problem is when I want to run it on My phones (Galaxy S and Galaxy S2) both of them crash. What is the problem?</p>
<p>Thanks</p>
|
android
|
[4]
|
4,522,356 | 4,522,357 |
combing include php files
|
<p>I have separate php files. I have a master file that I use by include these files like</p>
<pre><code> /include '1.php';
/include '2.php';
/ include '3.php';
</code></pre>
<p>Now I want to combine this 3 file to one php file.How can I use them because in my master code there are 3 conditions,like condition 1 uses file 1.php condition 2 uses file 2.php and so on
thanx</p>
|
php
|
[2]
|
4,109,302 | 4,109,303 |
How to Convert symbols (acute characters in HTML above all) and keep like in acute characters in HTML
|
<p>I've been searching in google, but I've not found any answer for my trouble. </p>
<p>I was testing my Java Application and I've noticed that when I created a username with accented characters (HTML special characters such as á, é, í, ó, ú) it didn't show that characters well.
I mean, for example: a user called <code>Álvaro</code> shows <code>�lvaro</code>.</p>
<p>Do you know any function in Java that converts that special characters?</p>
|
java
|
[1]
|
4,198,382 | 4,198,383 |
$this->"variable value" OOP PHP
|
<p>I'm wondering if it's possible, and in case it is, how shoud I achive that:</p>
<p><code>$this->id</code> <-- i have such thing. but to make it more usable i'd like to have <code>$this->(and here to change the values)</code></p>
<p>for ex: I might have <code>$this->id $this->allID $this->proj_id</code></p>
<p>how can I make so that actually I have <code>$this->($myvariable here, that has a unique name in it)</code>?</p>
|
php
|
[2]
|
4,127,323 | 4,127,324 |
How do you duplicate a div tag?
|
<p>How can I duplicate the <code>#DvRefer</code> element with its contents when the user clicks on the <code>#Duplicate</code> button?</p>
<pre><code><div id='DvRefer'>
<div style="float: right; margin-right: 5px; margin-top: 8px;">name:</div>
<select id="LstRefer" runat="server" style="margin-top: 8px; margin-right: 14px;float: right; margin-left: 8px; width: 205px;">
</select>
</div>
<div style="clear:both"></div>
<div style="text-align: left">
<input id="Duplicate" type="button" runat="server" value="Duplicate" class="buttons" />
</div>
</code></pre>
|
jquery
|
[5]
|
3,891,066 | 3,891,067 |
Event Raise on Service
|
<p>Think I have a service that play musics , Also I have an actvity that bind to this service , I want when this service started a new music , raise an event and Activity shows a toast , how can I do this , like here </p>
<pre><code>Service service = new se...
BindToService();
service.OnMediaPlayerStarted(new Event(
public void run()
{
};
));
</code></pre>
<p>I want to craete a custom event like MediaPlayerStarted and when </p>
|
android
|
[4]
|
92,489 | 92,490 |
How do I clear the HTML of the first child for an array of elements in jQuery?
|
<p>Here's what I've got so far. <code>srm</code>, <code>sre</code>, <code>srd</code> are all jQuery objects. I want to clear the HTML out of the first child of each object. Not sure what I'm doing wrong but this is what I have so far.</p>
<pre><code>$([srm,sre,srd]).children(":first-child").html('');
</code></pre>
<p>Nothing really happens so I'm assuming that this is incorrect somehow.</p>
|
jquery
|
[5]
|
3,120,157 | 3,120,158 |
Adapter fetches and parses RSS feed to get its data - best practice?
|
<p>In a shared project, we have an Adapter class (extends BaseAdapter, implements ListAdapter). In its constructor, this class fetches an RSS feed from the internet and parses the returned XML document to obtain the data it will 'adapt'; the data is kept in a private class variable.</p>
<p>This is seen as the "Android way" of doing things by the author and is supported by the project lead.<br>
Can this be considered a "Best Practice"?<br>
Can it be justified on the grounds that it (may?) increase performance?<br>
Doesn't it violate the general Object Oriented Design (OOD) principle that a class should have only a "Single Responsiblity"?<br>
Are best practices for OOD or Java to be set aside in Android development?</p>
|
android
|
[4]
|
396,211 | 396,212 |
validation in wmp files
|
<p>i have windows media player in my application.i want to allow only the supported files for the player, to upload.i want to play photos,videos and audio files with windows media player.how can i do this?how can i validate the uploading files?
please help me</p>
|
asp.net
|
[9]
|
5,435,382 | 5,435,383 |
Is there UISwitch settings control in Android like iOS
|
<p>I took a look at the preference activity that Android use for settings. i'm looking for something like UISwitch as shown in below image, does Android have one like this.</p>
<p>I can see the nearest control on Android preference settings is "list preference" </p>
<p><img src="http://i.stack.imgur.com/N8V2Y.png" alt="enter image description here"> </p>
|
android
|
[4]
|
5,301,106 | 5,301,107 |
how to print $GLOBALS displaying in string?
|
<p>how to print $GLOBALS displaying in string?<br>
the is a very simpple demo bellow , sometimes I need to print $GLOBALS of a complex page , and there many html codes in vars, they display as html which I only want them to be string, how to do that?<br></p>
<pre><code><pre>
<?php
$html='<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>';
print_r($GLOBALS);
</code></pre>
<p><img src="http://i.stack.imgur.com/OeBkj.png" alt="enter image description here"></p>
|
php
|
[2]
|
1,838,314 | 1,838,315 |
Facebook Graph API Crashing My App
|
<p>he problem is when i come to use the post function a section time. The app will crash out kicking out the error below...
Program received signal: “EXC_BAD_ACCESS”.</p>
<p>I'm using the code below .But image is post to Facebook.</p>
<p>NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:2]; </p>
<pre><code>//create a UIImage (you could use the picture album or camera too)
NSData *imageData = UIImageJPEGRepresentation(imgView.image, 8.0);
UIImage *picture = [UIImage imageWithData:imageData];
//create a FbGraphFile object insance and set the picture we wish to publish on it
FbGraphFile *graph_file = [[FbGraphFile alloc] initWithImage:picture];
//finally, set the FbGraphFileobject onto our variables dictionary....
[variables setObject:graph_file forKey:@"file"];
[variables setObject:@"i'm testing my iPhone App" forKey:@"message"];
//the fbGraph object is smart enough to recognize the binary image data inside the FbGraphFile
//object and treat that is such.....
FbGraphResponse *fb_graph_response = [fbGraph doGraphPost:@"117795728310/photos" withPostVars:variables];
NSLog(@"postPictureButtonPressed: %@", fb_graph_response.htmlResponse);
NSLog(@"Now log into Facebook and look at your profile & photo albums...");
</code></pre>
<p>Plz help me for solving this problem.</p>
|
iphone
|
[8]
|
1,228,499 | 1,228,500 |
Disable start menu on LWIN keypress
|
<p>The following code is to test the LWin keyup function in C# when the form is active. It's working fine and now when the form is active I need only the function alone has to take place and whenever I click on Lwin button start menu should not open. How can I achieve this?</p>
<pre><code>private void Form1_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.LWin)
{
MessageBox.Show("Function working!");
}
}
</code></pre>
|
c#
|
[0]
|
972,045 | 972,046 |
Using Delay on a textbox
|
<p>I am trying to build a functionality where a user types text in the textbox and after a delay of 1 second, each character typed is converted to its upper case. This should happen as the user types.</p>
<p>Can i do using jquery?</p>
|
jquery
|
[5]
|
2,972,212 | 2,972,213 |
ADT installation Error
|
<p>I am using Eclipse 3.5 (Galileo), and I'm trying to install ADT plugin from remote as well as local archive.
It is not installing.
I am getting the following error for both remote as well local:</p>
<pre><code>Android Development Tools 0.9.5.v200911191123-20404 (com.android.ide.eclipse.adt.feature.group 0.9.5.v200911191123-20404)
Missing requirement: Android Development Tools 0.9.5.v200911191123-20404 (com.android.ide.eclipse.adt.feature.group 0.9.5.v200911191123-20404) requires 'org.eclipse.gef 0.0.0' but it could not be found
</code></pre>
<p>How do I solve this?
Thanks in Advance</p>
|
android
|
[4]
|
1,842,314 | 1,842,315 |
Substituting missing values in Python
|
<p>I want to substitute missing values (None) with the last previous known value. This is my code. But it doesn't work. Any suggestions for a better algorithm?</p>
<pre><code>t = [[1, 3, None, 5, None], [2, None, None, 3, 1], [4, None, 2, 1, None]]
def treat_missing_values(table):
for line in table:
for value in line:
if value == None:
value = line[line.index(value)-1]
return table
print treat_missing_values(t)
</code></pre>
|
python
|
[7]
|
990,145 | 990,146 |
HTML5 Snake Game - add multiple food
|
<p>I have followed <a href="http://blog.new-bamboo.co.uk/2009/12/30/html5-canvas-snake-game" rel="nofollow">this guide</a> to make my snake game.</p>
<p>But now I want to add more then one food into the map.</p>
<p>Well, I tried putting rows with <code>makeFoodItem();</code> instead of just the default 1 row.
So like: </p>
<pre><code>makeFoodItem();
makeFoodItem();
makeFoodItem();
makeFoodItem();
makeFoodItem();
</code></pre>
<p>Which also made 5 foods. But the score wasn't added when the snake got them, and they was just removed, and didn't added a new one when it was taken.</p>
<p>So I went into looking at the Function <code>makeFoodItem()</code>, which looks like this:</p>
<pre><code>function makeFoodItem(){
suggestedPoint = [Math.floor(Math.random()*(canvas.width/gridSize))*gridSize, Math.floor(Math.random()*(canvas.height/gridSize))*gridSize];
if (snakeBody.some(hasPoint)) {
makeFoodItem();
} else {
ctx.fillStyle = "rgb(10,100,0)";
ctx.fillRect(suggestedPoint[0], suggestedPoint[1], gridSize, gridSize);
};
}
</code></pre>
<p>but I could not really figure out what to do there.</p>
|
javascript
|
[3]
|
5,330,663 | 5,330,664 |
Event when finger leaves button
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4597513/onpress-onrelease-in-android">onPress/onRelease in Android</a> </p>
</blockquote>
<p>When a user holds a button the button changes color, and when the user leaves the button, the button returns to it's normal state. </p>
<p>Is there an event that captures this ?</p>
<p>I tried searching for something like button.onStateChanged, but no luck.. </p>
<p>EDIT:
When the user long clicks I want to start the autoincrement</p>
<pre><code>// Auto increment for a long click
increment.setOnLongClickListener(new View.OnLongClickListener() {
public boolean onLongClick(View a) {
autoIncrement = true;
repeatUpdateHandler.removeCallbacks(mRepeatUpdateHandler);
repeatUpdateHandler.post(mRepeatUpdateHandler);
return false;
}
});
</code></pre>
<p>And when the user leaves the button with his finger I want to stop the autoincrement </p>
<pre><code>increment.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_UP && autoIncrement) {
//Stop autoincrement
repeatUpdateHandler.removeCallbacks(mRepeatUpdateHandler);
autoIncrement = false;
}
return false;
}
});
</code></pre>
<p>This is the handler: </p>
<pre><code>RepetetiveUpdater mRepeatUpdateHandler = new RepetetiveUpdater();
....
class RepetetiveUpdater implements Runnable {
public void run() {
if (autoIncrement) {
increment();
repeatUpdateHandler.postDelayed(new RepetetiveUpdater(),
REPEAT_DELAY);
} else if (autoDecrement) {
decrement();
repeatUpdateHandler.postDelayed(new RepetetiveUpdater(),
REPEAT_DELAY);
}
}
}
</code></pre>
<p>But this only works when the user lifts his finger above the button, when he drags it to somewhere else on the screen, the counter keeps running, any ideas? </p>
|
android
|
[4]
|
4,889,497 | 4,889,498 |
How to save app on back button press
|
<p>How can I store the state of my app when back button is pressed.</p>
<p>When back button is pressed only <code>onPause()</code> is called but not <code>onSaveInstanceState</code> where we can store our data in outState bundle.</p>
<p>One answer may be <code>sharedPreference</code> but my problem is it will store only int and not <code>intArray</code> as bundles does.</p>
<p>Is there any way to explicitly call <code>onSaveInstanceState</code>?</p>
|
android
|
[4]
|
1,896,141 | 1,896,142 |
How to access the value of username from htpasswd file using python script
|
<p>I have created a username/ password in htpasswd file. In my python script file I would like to access the username value for further processing. How do I achieve that? I am using Linux OS.</p>
|
python
|
[7]
|
5,895,931 | 5,895,932 |
Looking for advice for refresh database that in activity1 from activity2
|
<p><code>activity1</code> has listview that fill with data from database.</p>
<p>i delete the database in <code>activity2</code> and go back to <code>activity1</code> </p>
<p>and i still see the data in the listview.</p>
|
android
|
[4]
|
5,990,254 | 5,990,255 |
Multiple variable types incorporated with int variable
|
<p>I have the below code for a simple console application in C#. Whenever I input the AIR rate for the second input I get "input string was not in correct format" as the error. What is the correct format and how do I incorporate it into the current code I have made? I am not familiar with different variable types.</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int AIR, MIR, PMT, IP, PP, ABorrowed, Term;
Console.WriteLine("Please enter the amount borrowed on your loan ");
ABorrowed = int.Parse(Console.ReadLine());
Console.WriteLine("Please enter the interest rate for your loan ");
AIR = int.Parse(Console.ReadLine());
Console.WriteLine("Please enter term of your loan in months ");
Term = int.Parse(Console.ReadLine());
MIR = AIR / 1200;
PMT = ABorrowed * (MIR/1-(1/(1+MIR)^Term));
IP = ABorrowed * MIR;
PP = PMT - IP;
Console.WriteLine("Your total payment for this month is "+PMT);
Console.WriteLine("Of that payment " + IP + " is interest rate");
Console.WriteLine("and the Payment Portion is " + PP);
Console.ReadLine();
}
}
}
</code></pre>
|
c#
|
[0]
|
2,061,278 | 2,061,279 |
Paragraph doesn't hide on click
|
<p>This Is Default</p>
<pre><code><p id="pp">
THIS DUDE IS HIDING
</code></pre>
<p></p></p>
<pre><code><script type="text/javascript" src="/Scripts/jquery-1.4.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#btn').click(function () {
$('#pp').hide('slow');
return false;
});
});
</script>
</code></pre>
<p>I am trying to hide a paragraph id=pp but on button click nothing happen, i also passed function name at button click but nothin happen.</p>
|
jquery
|
[5]
|
5,388,509 | 5,388,510 |
read and output a text file using streamreader char by char
|
<p>what i am trying to do is to read the file a.txt and output each character in a single line i am having a real difficulty to solve this problem any help will be really appreciated.if you write the code please comment so i can understand more clearly as i am beginner.thanks</p>
<pre><code>namespace ConsoleApplication13
{
class Program
{
static void Main(string[] args)
{
using (StreamReader r = new StreamReader("a.txt"))
{
string @char;
while((@char = r.ReadBlock() != null))
foreach(char i in @char)
{
Console.WriteLine(i);
}
}
}
}
}
</code></pre>
|
c#
|
[0]
|
2,441,219 | 2,441,220 |
Bring multi-dimensional array down (unnest) one level
|
<p>Althoug this works well enough, I am curious if anyone knows of a prettier way of doing this as this situation seems to come up quite often. </p>
<pre><code><?php
//Initialy, data is nested up in $some_array[0] ...
$some_array = array(array('somevar' => "someValue", "someOtherVar" => "someOtherValue"));
print_r($some_array);
</code></pre>
<p>Array ( [0] => Array ( [somevar] => someValue [someOtherVar] => someOtherValue ) )</p>
<pre><code>// Could the following line be achieved a more elegant fashion?
$some_array = $some_array[0];
print_r($some_array);
// Prints the intended result:
</code></pre>
<p>Array ( [somevar] => someValue [someOtherVar] => someOtherValue )</p>
<p>Does anyone know of a way to achieve this with a native function or in a more elegant fashion?</p>
<p>Thanks!</p>
|
php
|
[2]
|
1,912,353 | 1,912,354 |
Calling an object's function via a static function
|
<p>When might you use such a class: </p>
<pre><code>class IteratorFacadeAccess
{
public:
template<class Ret, class T>
static Ret dereference(const T& t)
{
return t.dereference();
}
};
</code></pre>
<p>I noticed it in the api I'm working with but I don't understand its purpose.</p>
|
c++
|
[6]
|
1,655,683 | 1,655,684 |
Create Directory + Sub Directories
|
<p>I've got a directory location, how can I create all the directories? e.g. C:\Match\Upload will create both Match and the sub-directory Upload if it doesn't exist.</p>
<p>Using C# 3.0</p>
<p>Thanks</p>
|
c#
|
[0]
|
4,345,762 | 4,345,763 |
jQuery prevent flickering of child on hover
|
<p>I'm having troubles when I hover an element and then hover an inside element. I don't know if its the best way to do what I'm trying to achieve. Here's my code:</p>
<p>My markup:</p>
<pre><code><div class="wrapper">
<div class="animation">
<a href="#" class="linked"><img src="#"/></a>
<h1 class="title hidden"><a href="#">blabla</a></h1>
</div>
</div>
</code></pre>
<p>My js:</p>
<pre><code>$('.animation a img').hover(function(){
$(this).parent().next().stop().fadeTo("medium", 1);
$(this).stop().fadeTo("fast", 0);
}, function(){
$(this).parent().next().stop().fadeTo("medium", 0);
$(this).stop().fadeTo("fast", 1);
});
</code></pre>
<p>CSS:</p>
<pre><code> #wrapper {margin: 0 auto; width: 960px;}
#hidden {display: none;}
h1 a {bottom: 0; float: left; font-size: 1.5em; left: 0; position: absolute; width: 460px;}
.linked {background: #666; float: left; height: 250px;}
</code></pre>
<p>The flickering starts when I hover the H1. Is there any way to disable or fix it?</p>
<p>Thanks in advance!</p>
|
jquery
|
[5]
|
1,987,024 | 1,987,025 |
JSON,array and slash escaping
|
<p>How to escape string in JSON? Seems that JSON will escape back slashes.
How do I <code>json_encode(array('name'=>'what\'s the name'))</code>?</p>
|
php
|
[2]
|
760,281 | 760,282 |
How to control the SQL limit
|
<p>I would like to know how to print 100 records then an image and then another 100 records. </p>
<p>I am trying to use the following code in order to control the sql limit, but would like to know how to do the above in the proper way.</p>
<p><strong>Total number of records are x numbers</strong></p>
<pre><code>$check_starts=0;
$check_ends=100;
$sql = mysql_query("SELECT * FROM names limit $check_starts,$check_ends")
or die(mysql_error());
</code></pre>
<p>i would like to know how to print 100 records in in every interval.</p>
<p>then I need a break after every 100 records.</p>
<p>thanks for your help.</p>
|
php
|
[2]
|
3,139,308 | 3,139,309 |
Android - app not searchable in Android store
|
<p>I have a new app that I made and put in the store yesterday.</p>
<p>I am able to see it here: <a href="https://play.google.com/store/apps/details?id=com.problemio" rel="nofollow">https://play.google.com/store/apps/details?id=com.problemio</a></p>
<p>but there is absolutely no way I can see it in the app store when I search for any terms. Any idea how I can get it to show up in the app store?</p>
<p>It says that the app IS compatible with my phone so I don't see why it wouldn't show up for me.</p>
|
android
|
[4]
|
5,090,716 | 5,090,717 |
JQuery Adding link to a table cell
|
<p>I'm trying to add an a tag to a table cell. My code is working all the way up to the final line shown here, at which point I get an exception of </p>
<p>'TypeError: Object doesn't support this property or method'</p>
<p>From what I've read, appendChild should be a method on my table cell.</p>
<pre><code> var rowId = "#rowid-" + response.id;
var actionCell = $('#itemlist').find(rowId).find(actionCellId);
//Add my Edit link
link = document.createElement('a');
link.setAttribute('href', '/MYSite/Item/Edit?itemID=' + response.id);
link.setAttribute('id', 'edit-' + response.id);
var linkText = document.createTextNode('Edit');
link.appendChild(linkText);
//Exception occurs on this line
actionCell.appendChild(link);
</code></pre>
|
jquery
|
[5]
|
120,611 | 120,612 |
Integer to Binary Conversion
|
<p>I'm calculating the conversion from an integer to a binary number wrong. I entered the integer 6 and got back the binary number 0. which is definitely wrong. Can you guys help out? I'm using python 3 by the way. </p>
<pre><code>def ConvertNtoBinary(n):
binaryStr = ''
if n < 0:
print('Value is a negative integer')
if n == 0:
print('Binary value of 0 is 0')
else:
if n > 0:
binaryStr = str(n % 2) + binaryStr
n = n > 1
return binaryStr
def main():
n = int(input('Enter a positive integer please: '))
binaryNumber = ConvertNtoBinary(n)
print('n converted to a binary number is: ',binaryNumber)
main()
</code></pre>
|
python
|
[7]
|
3,923,363 | 3,923,364 |
Taking vector size() out of loop condition to optimize
|
<p>fibs is a std::vector. Using g++, I was advised to take fibs.size() out of the loop, to save computing it each time (because the vector could change)</p>
<pre><code>int sum = 0;
for(int i = 0; i < fibs.size(); ++i){
if(fibs[i] % 2 == 0){
sum += fibs[i];
}
}
</code></pre>
<p>Surely there is some dataflow analysis in the compiler that would tell us that fibs won't change size. Is there? Or should I set some other variable to be fibs.size() and use that in the loop condition?</p>
|
c++
|
[6]
|
1,210,531 | 1,210,532 |
Dynamically add input via jQuery, however all jQuery inputs do not receive focus styling?
|
<p>I am dynamically adding inputs to a form when a user clicks on an anchor tag that has the jQuery click event attached to it.</p>
<pre><code>$(".add-input").click(function () {
$("div.form-item").append(get_input());
});
</code></pre>
<p>The above function successfully adds new inputs to the form, however I have another jQuery function that adds styling to the currently focused input like so:</p>
<pre><code>$("input, textarea").focus(function () {
$(this).parent().addClass("cur-focus");
});
</code></pre>
<p>This function works great for inputs that were apart of the original form, however all the dynamically added inputs do not have the class added by the above event handler.</p>
<p>Both of these event handlers are inside of the $(document).ready function. </p>
<p>Is there a way for the dynamically added inputs to also be bound to my focus event handler on inputs?</p>
|
jquery
|
[5]
|
5,303,266 | 5,303,267 |
How to give action on click of an image
|
<p>I am developing an app in which what i want is when a user clicks on an image in an image view</p>
<p>An Action should be fired(like when a button is clicked).</p>
<p>I don't want button image. I just want an image view and action on it.</p>
<p>Kindly help.</p>
|
iphone
|
[8]
|
3,857,126 | 3,857,127 |
How do I download files of big sizes from somewhere on the web to the web server with PHP?
|
<p>How do I download files of big sizes from somewhere on the web to the web server with PHP? Also, what should be allowed on the server in order to make this happen? Thanks.</p>
|
php
|
[2]
|
2,941,760 | 2,941,761 |
loop statement breaking
|
<p>please why is the loop statement breaking, after the multiplication it only update the last row, tried using a foreach loop for the $totalprice in the update statement it says invalid argument.</p>
<pre><code>if(array_key_exists('item', $_POST)){
// $items = $_POST['item'];
//foreach($_POST['item'] as $item){
//echo $item['Pquantity'] . ", ";
//echo $item['Pidno'] . ", ";
// }
//Loop through $_POST items, updating the database for each item
foreach ($_POST['item'] as $item) {
$Pquantity = intval($item['Pquantity']);
$Pidno = ($item['Pidno']);
//echo $Pquantity . ", ";
//echo $Pidno . ", ";
//$totalprice = intval($item['Pquantity'])
$queryreg = mysql_query("
UPDATE repplac
SET Pquantity = {$Pquantity}
WHERE
Pidno = '{$Pidno}'
AND
Uname = '{$_SESSION['username']}'
") or die(mysql_error());
}
}
$pplresult = mysql_query("SELECT * FROM repplac WHERE Uname = '{$_SESSION['username']}'") or die(mysql_error());
while ($row = mysql_fetch_assoc($pplresult))
{
$totalprice = $row['Price'] * $row['Pquantity'];
//echo "$totalprice";
//die();
$queryreg = mysql_query("
UPDATE repplac
SET Tprice = {$totalprice}
WHERE
Pidno = '{$Pidno}'
AND
Uname = '{$_SESSION['username']}'
") or die(mysql_error());
}
</code></pre>
|
php
|
[2]
|
3,944,486 | 3,944,487 |
How to use jquery Attr() to select only first attribute?
|
<p>I have a div as follows:</p>
<pre><code><DIV CLASS="variable productPopup"></DIV>
</code></pre>
<p>When assigning it to a var, how do I only select variable? Please note that variable changes, so it needs to select the first item, not literally the words "variable"</p>
<pre><code>var ID = $(this).attr("class");
</code></pre>
|
jquery
|
[5]
|
2,016,639 | 2,016,640 |
How to scan available radio stations in Android?
|
<p>We want to access all the radio frequencies available near Android device. Is there any API available for the same? Can we scan frequency without attaching headphones, given that some radios won't start up without the headphones (used as an aerial)?</p>
|
android
|
[4]
|
5,379,965 | 5,379,966 |
Standard visibility for abstract methods
|
<p>This may seem like a silly question, but I'd like to know the "best practices" when creating abstract methods. Should their visibility be public or protected?</p>
<p>Even though a child class implementing the abstract method will be public, is it still advisable to maintain the abstract method protected?</p>
|
java
|
[1]
|
1,854,512 | 1,854,513 |
Closing a web page automatically
|
<p>I've a web app wherein i need to run a some code for sending email messages everyday. I've put the code inside a web page. I was hoping to open this webpage using a batch file (and scheduling to run it everyday using windows task scheduler) and then automatically closing it once the task is done. How can i close the website automatically after the task is complete. ?
This is my first web app so please be merciful .</p>
|
asp.net
|
[9]
|
4,491,053 | 4,491,054 |
StackOverFlowError in XSLT Transformation
|
<p>I am trying to transform an xml file using a com.queplix.core.utils.xml.TransletWrapper class which is providd by QueWeb Framework.I am getting StackOverFlowError in the below code @line transletWrapper.transform(source, new StreamResult(out), transletName, transletParams);</p>
<p>any help will be appreciated.. Tanks!</p>
<pre><code>char[] data = XMLHelper.writeObject(report);
// Do XSLT.
StreamSource source = new StreamSource(new CharArrayReader(data));
CharArrayWriter out = new CharArrayWriter(data.length);
try {
transletWrapper.transform(source, new StreamResult(out), transletName, transletParams);
} catch (GenericSystemException ex) {
throw new GenericSystemException("Cannot transform source: \n", ex);
}
</code></pre>
|
java
|
[1]
|
3,736,536 | 3,736,537 |
Can a form have more than one onsubmit()?
|
<p>I have a form that posts to the page it os on and I would like to use some javascript that will make the page maintain it's scroll position when the form submits. The script that I have uses onsubmit but I already have another script using that.</p>
<p>Is it possible to use onsubmit() for more than one script eg..</p>
<pre><code>onsubmit="return validateForm(), return saveScroll()"
</code></pre>
<p>Thanks</p>
|
javascript
|
[3]
|
691,088 | 691,089 |
Why does this force close before the activity screen is drawn? (android)
|
<p>my app keeps force closing before it starts... eclipse returns no errors in my code and my xml is good. can anybody give me some insight?</p>
<pre><code>package com.mhe.test.scan;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class main extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button myScanButton = (Button) findViewById(R.id.myScanButton);
myScanButton.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "PRODUCT_MODE");
startActivityForResult(intent, 0);
}
});
}
EditText totalbox = (EditText) findViewById(R.id.totalbox);
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
String contents = intent.getStringExtra("SCAN_RESULT");
// Handle successful scan
totalbox.setText(contents);
} else if (resultCode == RESULT_CANCELED) {
// Handle cancel
totalbox.setText("@string/bummer");
}
}
}
}
</code></pre>
<p>essentially it is supposed to call zxing Barcode Scanner to scan a barcode on a button click and return the result into an EditText field... i'm a total newbie at this... </p>
|
android
|
[4]
|
48,361 | 48,362 |
What is the abbreviation of JAVA language?
|
<p>Any one know, What is the abbreviation of JAVA language? Thanks in advance..</p>
|
java
|
[1]
|
1,000,511 | 1,000,512 |
can not set up SDK
|
<p>Please help! Thanks in advance.</p>
<p>I loaded "android-sdk_r06-windows". I also install JavaSDK. When I click "SDK setup", I got:</p>
<p><<https://dl-ssl.google.com/android/repository/repository.xml, reason: HTTPS SSL error. You might want to force download through HTTP in the settings.>>></p>
<p>If I directly go to "https://dl-ssl.google.com/android/repository/repository.xml", my web page show source code:</p>
<p>I am blocked.</p>
|
android
|
[4]
|
5,304,506 | 5,304,507 |
Http Exception generated while validating viewstate
|
<p>I am getting the following error whenever I click on a postbacking control</p>
<pre><code>HttpException (0x80004005): Validation
of viewstate MAC failed. If this
application is hosted by a Web Farm
or cluster, ensure that configuration
specifies the same validationKey and
validation algorithm. AutoGenerate
cannot be used in a cluster.
</code></pre>
<p>I am not using a Web Farm or cluster server. I have even tried setting the page property <strong><em>EnableViewStateMac</em></strong> to false but it changes the error message stating</p>
<pre><code>The state information is invalid for
this page and might be corrupted.
</code></pre>
<p>What could possibly be wrong?</p>
|
asp.net
|
[9]
|
4,749,044 | 4,749,045 |
Connect Android app to remote database over internet
|
<p>i have created an android application that stores information into a mysql database, i am using PHP and JSON to achieve this, it runs very well in my emulator, my problem is when i deploy this application onto my phone it can no longer connect to the database on my machine. How do make it communicate over the Internet or network with the remote database on my machine. i am quite new to android app development and really do need your help.i have googled for days and found nothing.</p>
|
android
|
[4]
|
4,513,557 | 4,513,558 |
Refresh or reload uitabbar and my whole application in iphone when user logout
|
<p>I have login and logout feature in my application. when user logout then i switch user from my home screen to logout screen. but when i login a user with different account then previous user information displays for some seconds because i have timer in my application when timer execute then user information would update. I feel this issue is due to tabbarcontroller which is loading from .Xib file and it is not reloading when user login again. I want to refresh and reload my whole application when user logout and login again. I have already release tabbarcontroller but it is not effecting on this situation. Please if any one has any suggestion and solution then help me. </p>
<p>Regards,
Shumais-ul-haq</p>
|
iphone
|
[8]
|
349,162 | 349,163 |
Remove array indexes or create array without indexes
|
<p>So basically I have array -</p>
<pre><code>Array (
[0] => Array
(
[name] => my_name
[year] => my_year
[other] => Array
(
[0] => Yes
[1] => No
[2] => Other_values
}
)
[1] => Array
(
[name] => my_name2
[year] => my_year2
[other] => Array
(
[0] => Yes2
[1] => No2
[2] => Other_values2
}
)
)
</code></pre>
<p>So basically I would remove the indexes from the last subArray which are both [other] arrays.</p>
<p>Well basically how I would like it to be displayed is -</p>
<pre><code>Array (
[0] => Array
(
[name] => my_name
[year] => my_year
[other] => Array (Yes, No, Other_values )
)
[1] => Array
(
[name] => my_name2
[year] => my_year2
[other] => Array (Yes2, No2, Other_values2 )
)
)
</code></pre>
<p>Basically without indexes.</p>
<p>Is it even possible, and if it isn't, then maybe it's possible at the creation of the array?</p>
<p>I'm creating it with the array_push(); function.</p>
<p>If you need my PHP code of the array_push(); function, just give me a notice.</p>
<p>Hope you understood what I ment, if something is unclear, you are welcome to ask me, I'll try to explain more :)!</p>
|
php
|
[2]
|
1,841,213 | 1,841,214 |
If byte is 8 bit integer then how can we set it to 255?
|
<blockquote>
<p>The byte keyword denotes an integral
type that stores values as indicated
in the following table. It's an Unsigned 8-bit integer.</p>
</blockquote>
<p>If it's only 8 bits then how can we assign it to equal 255?</p>
<pre><code>byte myByte = 255;
</code></pre>
<p>I thought 8 bits was the same thing as just one character?</p>
|
c#
|
[0]
|
4,602,013 | 4,602,014 |
Calculate number of weekdays between two dates in Java
|
<p>Can anyone point me to some Java snippet wherein i can get business (except Sat and Sun) days between two dates.</p>
|
java
|
[1]
|
724,523 | 724,524 |
File Upload via Remote URL?
|
<p>I'm working on the avatar upload on my website and would like for users to be able to input an image using URL's.</p>
<p>How would I go about taking the image from the URL supplied in the form and checking its file format (.png, .jpg, .gif), file size (50kb max), and file dimension(100x100 max)?</p>
|
php
|
[2]
|
4,420,499 | 4,420,500 |
Javascript: Initial methods storage in prototype
|
<p>Are there any benefits from prototype methods except it's context and global availability across all instances?</p>
<p>Creating new instance of object without prototyped methods eats more memory than vice versa? </p>
<p>Just can't understand, why some developers are storing initial methods inside prototype when shared context is not required.</p>
<p>The only thing i'm thinking about is memory usage...</p>
<pre><code>// first one
function t(){
this.method1=function(){
};
this.method2=function(){
};
}
// second one
function tt(){
}
tt.prototype={
method1:function(){
}
,method2:function(){
}
}
var storage1=[];
var storage2=[];
var i=0;
while(i<10000) {
storage1.push(new t());
storage2.push(new tt());
i++;
}
</code></pre>
|
javascript
|
[3]
|
2,877,983 | 2,877,984 |
Privoxy - C# can't open forwarded file
|
<p>I write app with using <a href="http://privoxy.org" rel="nofollow">Privoxy</a></p>
<pre><code>forward /spacemap/xml/maps.php 127.0.0.1:9002
</code></pre>
<p>Next in C#</p>
<pre><code>TcpListener tcpListener = new TcpListener(IPAddress.Any, 9002);
tcpListener.Start();
while (true)
{
TcpClient tcpClient = tcpListener.AcceptTcpClient();
HTTP HTTP = new HTTP(tcpClient);
HTTP.Read();
}
</code></pre>
<p>In method <code>HTTP.Read()</code> I read all headers from request to this file(/spacemap/xml/maps.php) and it works fine.</p>
<p>But when I get requestURL(good) and I'm trying open that url nothing happens.</p>
<pre><code>WebClient webClient = new WebClient();
string download = webClient.DownloadString("http://example.com/spacemap/xml/maps.php");
Console.WriteLine(download);
</code></pre>
<p>But download variable is empty. (link in webbrowser works fine).</p>
<p>I'm trying HttpWebRequest, WebRequest, WebClient - and nothing, other links works fine.</p>
<p>Any ideas?</p>
|
c#
|
[0]
|
432,127 | 432,128 |
List with timeout/expire ability
|
<p>I need a function like this:</p>
<pre><code>AddToList(txtName, timeExpire);
</code></pre>
<p>It looks like self-descriptive, the item will automatically expire and removed from the list.</p>
<p>I couldn't imagine how to do that. Can anyone give me a clue?</p>
|
c#
|
[0]
|
4,437,627 | 4,437,628 |
Why is my method returning None?
|
<p>I have the following method call:</p>
<pre><code>NCOLS = 3
NPEGS = 4
first_guess = []
print("calling first guess method")
first_guess = firstGuess(NCOLS, NPEGS, first_guess)
print("after method call: " + str(first_guess))
</code></pre>
<p>firstGuess method:</p>
<pre><code>def firstGuess(NCOLS, NPEGS, first_guess):
"""Used for setting up the first guess of the game"""
print("in firstGuess method")
for c in range(1, NCOLS + 1):
if len(first_guess) == NPEGS:
print("about to return first guess: " + str(first_guess))
return first_guess
else:
first_guess.append(c)
print("out of for loop, first_guess len is " + str(len(first_guess)) + ", " + str(first_guess))
if len(first_guess) <= NPEGS: #there were less color options than pegs
firstGuess(NCOLS, NPEGS, first_guess)
</code></pre>
<p>This seems to be returning <code>None</code> for a reason I cannot figure out.</p>
<p>Here is my output:</p>
<pre><code>calling first guess method
in firstGuess method
out of for loop, first_guess len is 3, [1, 2, 3]
in firstGuess method
about to return first guess: [1, 2, 3, 1]
after method call: None
Traceback (most recent call last):
File "mastermind.py", line 323, in <module>
sys.exit(main())
File "mastermind.py", line 318, in main
playOnce()
File "mastermind.py", line 160, in playOnce
first_guess = first_guess + str(g[0][i])
TypeError: 'NoneType' object is not subscriptable
</code></pre>
<p>Why is it returning <code>None</code> instead of <code>[1, 2, 3, 1]</code>?</p>
|
python
|
[7]
|
1,959,815 | 1,959,816 |
Passing and returnging array to the functions
|
<p>I have created two arrays. I wanna pass these two array to any function. I am beginner with function so tried with rough code to achieve my task. As I have some values in $cntctnum and $cntcttype named array.</p>
<pre><code> $cntctnum = array();
$cntcttype = array();
$response = array();
function play_with_array($cntctnum, $cntcttype){
$contactnumber= $cntctnum[];
$cntcttype = $cntcttype[];
// some code to play with array.
return resultarray();
}
$response = play_with_array($cntctnum, $cntcttype);
</code></pre>
<p>Is this right way to pass function in array?
Is I need to declare $response as array before or when I return resultarray(), it will automatically consider it as array?</p>
|
php
|
[2]
|
1,064,392 | 1,064,393 |
Drag and Drop a card using the DragDrop method
|
<p>Below is my code for trying to drag a card from a picture box to a panel but it does not work. Can anyone please help me out. When you click on the card and try to move it the cursor changes(like when you select text and move it) but the card doesnt move and it doesnt display when you drop it on the panel.</p>
<pre><code>private void Card_MouseDown(object sender, MouseEventArgs e)
{
Card.Card source = (Card.Card)(sender);
DoDragDrop(source,DragDropEffects.Move);
}
private void panel1_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(Card.Card)))
{
e.Effect = DragDropEffects.Move;
}
else
{
e.Effect = DragDropEffects.None;
}
}
private void panel1_DragDrop(object sender, DragEventArgs e)
{
Card.Card dragCard = (Card.Card)sender;
dragCard = (Card.Card)e.Data.GetData(typeof(Card.Card));
}
</code></pre>
|
c#
|
[0]
|
3,716,859 | 3,716,860 |
How to edit php files locally?
|
<p>With HTML files, I can work locally and preview the files in my browser after I've saved and made changes (and use LiveReload), but with PHP the browser just loads the code. Do I need to run a local server to work on it locally, or is there an easier way?</p>
<p>The extent of my PHP is using include statements for headers and footers.</p>
|
php
|
[2]
|
3,992,842 | 3,992,843 |
Parse custom Date from string
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4829569/help-parsing-iso-8601-date-in-javascript">Help parsing ISO 8601 date in Javascript</a> </p>
</blockquote>
<p>I have a set of strings, all in similar form: 2012-05-31T00:00:00.0000000</p>
<p>All I want to pull from this is the year (2012), the month (05), and the day (31), then construct a javascript Date object from this data.</p>
<p>What is the best way to parse this data?</p>
|
javascript
|
[3]
|
3,413,351 | 3,413,352 |
PHP switch function doesn't recognize "less than 0"
|
<pre><code>$bytes = 0;
switch($bytes){
case $bytes == 0:
echo 'Equal to 0.';
break;
case $bytes < 0:
echo 'Less than 0.';
break;
}
</code></pre>
<p>This outputs "Less than 0."</p>
<p>Why?</p>
|
php
|
[2]
|
3,133,333 | 3,133,334 |
Java Typecasting & Calling Methods Simultaneously
|
<p>Very new to Java.</p>
<p>I have a class called <code>GraphicsObject</code> and a class <code>Bug</code> that extends it.</p>
<p>I have an ArrayList that holds all GraphicsObject in it:</p>
<pre><code>private ArrayList<GraphicsObject> gc = new ArrayList();
</code></pre>
<p>Then I have a function that gets called every frame called updateObjects().</p>
<pre><code>public void updateObjects(){
for(int i = 0; i < gc.size(); i++){
if(gc.get(i).toString().equals("Bug") ){
(Bug)gc.get(i).moveNorth();
}
}
}
</code></pre>
<p>The typecasting fails and the moveNorth() method never gets recognized because the class GraphicsObject does not have that method, only Bug does.</p>
<p>Any solutions?</p>
|
java
|
[1]
|
3,953,008 | 3,953,009 |
how to turn internet connection (GPRS/EDGE/3G) on/off
|
<p>I am trying to turn off the internet connectivity thru android app like GPRS/EDGE/3G. When needed I need to turn on the same. But I could not find how to do that.</p>
<p>What is the API which supports this. Please help me.</p>
|
android
|
[4]
|
2,371,254 | 2,371,255 |
Javascript with new or not
|
<p>I have the following function </p>
<pre><code>var myInstance = (function() {
var privateVar = 'Test';
function privateMethod () {
// ...
}
return { // public interface
publicMethod1: function () {
// all private members are accesible here
alert(privateVar);
},
publicMethod2: function () {
}
};
})();
</code></pre>
<p>what's the difference if I add a new to the function. From firebug, it seems two objects are the same. And as I understand, both should enforce the singleton pattern.</p>
<pre><code>var myInstance = new (function() {
var privateVar = 'Test';
function privateMethod () {
// ...
}
return { // public interface
publicMethod1: function () {
// all private members are accesible here
alert(privateVar);
},
publicMethod2: function () {
}
};
})();
</code></pre>
|
javascript
|
[3]
|
3,926,654 | 3,926,655 |
Error in String.replaceAll() function
|
<p>I am trying the following code:-</p>
<pre><code>String x = "asdfg/dgws";
x.replaceAll("/", "\\");
</code></pre>
<p>But this is failing. This is giving me the following error message:-</p>
<pre><code>Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 1
at java.lang.String.charAt(Unknown Source)
at java.util.regex.Matcher.appendReplacement(Unknown Source)
at java.util.regex.Matcher.replaceAll(Unknown Source)
at java.lang.String.replaceAll(Unknown Source)
at com.jai.SecLargest.main(SecLargest.java:13)
</code></pre>
<p>I am not able to figure out why this exception is coming?</p>
|
java
|
[1]
|
3,025,242 | 3,025,243 |
How to add anchor tag conditionally in ItemTemplate of Repeater
|
<p>I have Showing the Image Slider on page. To Display I have used the Repeater. Now I have not used anchor tag to image for every image. So Anchor tag is conditionally.
My code is </p>
<pre><code> <ItemTemplate>
<a id="SliderLink">
<img id="SliderImage" runat="server" alt="" />
</a>
</ItemTemplate>
</code></pre>
<p>Now I always shows the image but every image not cover with a tag. How I achieved this.</p>
|
asp.net
|
[9]
|
28,342 | 28,343 |
What does the @ character do in PHP?
|
<blockquote>
<p><strong>Possible Duplicates:</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><br>
<a href="http://stackoverflow.com/questions/3621215/what-does-mean-in-php">What does @ mean in PHP?</a> </p>
</blockquote>
<p>I have a line in my code which looks like this:</p>
<p>@mysql_select_db($dbname) or die( "Error: Unable to select database");</p>
<p>It works, but I want to know what the @ does and why it is there.</p>
|
php
|
[2]
|
5,671,088 | 5,671,089 |
How to revise java?
|
<p>Ok so this isn't 100% programming question, for which I'm really sorry, but still this is the best place I know to ask it.</p>
<p>In ~2weeks time I'll have a job interview, first they'll make me take a test from Java and I was wondering what's the best way to prepare for it? I bet it will be something similar to SCJP (but probably much easier), are there any (short) books, tutorials that are worth reading? I did order the SCJP book by Sierra/Bates but I won't be able to read it before the test.</p>
<p>Don't get me wrong I do have experience with Java etc. but I really want to get the job so I want to go there well prepared.</p>
<p>Also marry Xmas to everyone, no matter what religion you are.</p>
|
java
|
[1]
|
190,340 | 190,341 |
Specify the memory start address for a process
|
<p>I wish to know if it is possible to load the process at a user (pre)specified address? </p>
<p>Thanks,
Ashutosh</p>
|
c++
|
[6]
|
4,448,729 | 4,448,730 |
Is it safe to always use === in PHP?
|
<p>I'm new to PHP and I just ran across a day-wasting bug because I didn't realize that the PHP == operator does type coercion similar to Javascript.</p>
<p>I know that Douglas Crockford recommends never using the == operator with Javascript, and to always use the === operator.</p>
<p>If I code in a manner that never assumes type coercion, can I use the same advice in PHP, and never use the == operator? is it safe to <strong>always</strong> use the === operator, or are there gotchas that I need to be aware of?</p>
|
php
|
[2]
|
1,681,753 | 1,681,754 |
IP to location + local time?
|
<p>Currently I've been using <a href="http://www.geoiptool.com/" rel="nofollow">http://www.geoiptool.com/</a> but I can't get the local time. I don't know what to do to get the local time.</p>
<p>Can someone help me out, to display location + local time? I have a mail app and I try to display IP in location + local time.</p>
|
php
|
[2]
|
3,048,846 | 3,048,847 |
How to read object with an integer as key?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2026741/how-to-access-a-numeric-property">How to access a numeric property?</a> </p>
</blockquote>
<p>I am trying to read an object where the keys are numbers. But unfortunately, when I try reading this object:</p>
<pre><code>Salary:{
"2012_08":"5555",
"2012_09":"6666",
"2012_10":"7777"
}
var augsalary = salary.2012_08;
</code></pre>
<p>it throws an error. My question is this: "2012_08" is the year month combination and that cannot change to be stored as a string. How can I still access the value with that key?</p>
|
javascript
|
[3]
|
5,026,208 | 5,026,209 |
Get ID of a user in ASP.NET memebership
|
<p>i have just open a new website in ASP.NET Visual Studio 2010(Not using mvc). </p>
<p>i register into the asp.net membership. </p>
<p>lets say :</p>
<pre><code>my username is :admin.
email :admin@mpsiteil.com..
pass:123..
the page name : admincontrol.
</code></pre>
<p>--</p>
<p>and i want that a page will showed only to user "admin". </p>
<p>how can i do that?</p>
|
asp.net
|
[9]
|
2,058,671 | 2,058,672 |
How can I assign static pieces of information to randomly selected data with javascript?
|
<p>I've got a simple javascript program that I'm using for a project. To explain it simply, it just displays a random word on a html page from an external js file, say like Car, Bus, Train, Boat, etc. The word chosen each time is randomly selected. So, on one load it might say Bus, then another time it might say Airplane.</p>
<p>I want to assign static pieces of information to each of the words now, and I'm trying to figure out, what's the easiest way for me to implement this? For example, I still want the data to be randomly selected, but if it says Bus I want to show a picture of a bus or display some other data, but only when Bus is selected, and the same goes for all the other words.</p>
|
javascript
|
[3]
|
4,559,251 | 4,559,252 |
how the device back button lead to the previous activity?
|
<p>friends,</p>
<p>i have three activities</p>
<p>A,B,C</p>
<p>A is home screen.</p>
<p>Activities are launched as follow A->B->C</p>
<p>in activity B i am writing the following code. </p>
<pre><code> Intent i = new Intent(Intent.ACTION_DIAL);
String p = "tel:" + getString(R.string.phone_number);
i.setData(Uri.parse(p));
startActivity(i);
</code></pre>
<p>for that it goes to the dail pad and then when pressing device back button it goes to A.my requirement is go to the B.</p>
<p>please help me .
Thanks in advance.</p>
<pre><code> Intent i = new Intent(Intent.ACTION_DIAL);
String p = "tel:" + getString(R.string.phone_number);
i.setData(Uri.parse(p));
startActivity(i);
</code></pre>
|
android
|
[4]
|
3,037,712 | 3,037,713 |
Mapping enum values to a drop down (combobox) list in ASP.NET
|
<p>I have an ASP.NET page with a drop down (asp:DropDownList) control. I also have a defined ENUM</p>
<pre><code>Public Enum myEnumType As Integer
A
B
C
End Enum
</code></pre>
<p>I want to define the "value" property of each asp:ListItem with one of the ENUM value (A,B,C represented as a string of course). I also want to assign the "text" value of each to be some unrelated string (e.g "dog","cat","ant"). </p>
<p>I would like to use this syntax:</p>
<pre><code><asp:DropDownList ID="myCombo" runat="server">
<asp:ListItem Text="cat" Value="<%= myEnumType.A.toString() %>" />
<asp:ListItem Text="dog" Value="<%= myEnumType.B.toString() %>" />
<asp:ListItem Text="ant" Value="<%= myEnumType.C.toString() %>" />
</asp:DropDownList>
</code></pre>
<p>But using the <%= is not valid in this type of controls.</p>
<p>How can I do this in declarative ASP.NET (not with code behind to create each item)</p>
|
asp.net
|
[9]
|
4,894,214 | 4,894,215 |
c# read attribute value
|
<p>ich have a xml file with the following structure:</p>
<pre><code><layer1 name="this is layer1">
<messages>
<message name ="com_request">0</message>
<message name="send">1</message>
<message name="request">2</message>
</messages>
</layer1>
</code></pre>
<p>I try to collect all the message names in one indexer using the code:</p>
<pre><code>SampleCollection<string> paramCollection = new SampleCollection<string>();
string pathxml = @"C:\myXML.xml";
int j=0;
XmlTextReader xmlin = new XmlTextReader(pathxml);
XmlDocument xmldoc = new XmlDocument();
XmlNode node = xmldoc.ReadNode(xmlin);
foreach (XmlNode item in node.ChildNodes)
{
paramCollection[j] = item.Attributes["message name"].Value;
Console.WriteLine(paramCollection[j]);
j++;
}
</code></pre>
<p>However it doesn't work. Please help.</p>
|
c#
|
[0]
|
2,567,076 | 2,567,077 |
The configuration section cannot contain a CDATA or text element
|
<p>I am working on a vb.net web application project. And I was stucked by the following error. I believe there is not syntax with my web.config. Please help me. </p>
<h2>Server Error in '/TSCA' Application.</h2>
<p>Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. </p>
<p>Parser Error Message: The configuration section cannot contain a CDATA or text element.</p>
<p>Source Error: </p>
<p>Line 58: -->
Line 59:
Line 60:
Line 61:
Line 62: </p>
<p>Source File: C:\Users\310126745\Documents\TSCA\web.config Line: 60 </p>
<hr>
<p>Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929 </p>
|
asp.net
|
[9]
|
4,787,483 | 4,787,484 |
Checking if request is post back in PHP
|
<p>How can I check if the request is a post back in PHP, is the below ok?</p>
<pre><code>if (isset($_POST["submit"]))
</code></pre>
<p>where <code>submit</code> is the <code>name</code> of the <code><input type="submit" /></code></p>
|
php
|
[2]
|
5,802,588 | 5,802,589 |
Dev C++ compilation error
|
<p>I want to compile a code program using dev c++ compiler but my compiler didn't compile my code.The program consist of two files one is header and other is implementation .cpp file.
The code i want to compile is correct and working,but it didn't compiling on my pc(windows 7)
Please help</p>
<p>The error which i am getting is</p>
<pre><code> Permission denied
ld returned 1 exit status
C:\Makefile.win [Build Error] [Project1.exe] Error 1
</code></pre>
<p>here is my compile log</p>
<pre><code>Compiler: Default compiler
Building Makefile: "C:\Makefile.win"
Executing make...
make.exe -f "C:\Makefile.win" all
g++.exe -c testProgDoublyLinkedList.cpp -o testProgDoublyLinkedList.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include"
g++.exe testProgDoublyLinkedList.o -o "Project1.exe" -L"C:/Dev-Cpp/lib" -mwindows
C:\Dev-Cpp\Bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot open output file Project1.exe: Permission denied
collect2: ld returned 1 exit status
make.exe: *** [Project1.exe] Error 1
Execution terminated
</code></pre>
|
c++
|
[6]
|
3,182,460 | 3,182,461 |
Reload parent page on fancybox transitionOut
|
<p>I am using fancybox to show Iframe within it like this..</p>
<pre><code>$(document).ready(function() {
$("#button").click(function() {
$("#iframe").fancybox({
'titlePosition' : 'inside',
'transitionIn' : 'fadeIn',
'transitionOut' : 'reload()'
}).click();
});
});
</code></pre>
<p>Iframe within this fancybox has some action & my parent page shows its status.</p>
<p>So What I want is, as soon as I close <code>['transitionOut']</code> fancybox, my parent page gets reload.. </p>
<p>How can I achieve this ? </p>
<p><strong>Thanks</strong> </p>
|
jquery
|
[5]
|
525,194 | 525,195 |
In android How to track the other people using GPS?
|
<p>I want to track my friend using GPS when he is 1 or 2 km far from me. Is there any help or <strong>link</strong> to solve this problem I goggled it allot but can't be able to find more appropriate information about this please tell me how can i do this or what is the best approach (api) to solve this.</p>
<p>Thanks </p>
|
android
|
[4]
|
1,330,208 | 1,330,209 |
how to bind data to spinner control using arrayadapter in which arraylist data is there?
|
<p>I am moving from one activity to other activity in that oncreate method i am calling a webserive and get data into arraylist and assign to adapter like this</p>
<pre><code>Arrayadapter<String> adapter=new Arrayadapter<String>(this,android.R.id.layout_simpleid, arraylistobj);
</code></pre>
<p>then</p>
<pre><code>Spinner s = (Spinner) findViewById(R.id.something);
s.setAdapter(adapter);
</code></pre>
<p>but it is giving me a <code>NullPointerException</code> near <code>setAdapter(adapter)</code>.</p>
|
android
|
[4]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.