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 |
---|---|---|---|---|---|
5,135,176 | 5,135,177 |
Asp.Net 4.0 gridview to show Display attribute value
|
<p>I have been displaying list of some class in gridview with AutoGenerateColumns = true.</p>
<p>The class has nearly 70+ properties.</p>
<p>Now I need to change the column header of the gridview. For example, class has property called "ProductName" but in the gridview I just need to show "Name".</p>
<p>One way is to remove AutoGenerateColumns and denote everything as boundfield. But it is too much of manual coding... rather a data entry!</p>
<p>I was thinking to use Display attribute of the class property to be shown as the header column in gridview. </p>
<pre><code>[Display(Name="Product")] public string ProdcutName { get; set;}
</code></pre>
<p>Is there any way to use Display attribute in Gridview?</p>
<p>Also suggest something else also... </p>
|
asp.net
|
[9]
|
870,321 | 870,322 |
What does the abbreviation “ccb" stand for when used in stream reading
|
<p>I am not native English. I am often curious about variable's real meaning when it was named in shortening. I think that may help me to understand better of the code. For example, when overriding the operator, the lhs and rhs are often used. Once I was very exciting to find out that lhs means "left hand side" and rhs means right hand side. I like the naming.</p>
<p>I see the "ccb" many times, but I could not figure out what the words behind are. I am so curious that I now register to stackoverflow and post it here. Here is the code that uses the "ccb" variable naming:</p>
<pre><code>// the below code is in a custom home-brewn chunked stream reader
public override int Read(byte[] buffer, int offset, int ccbToRead)
{
int ccbRead = StreamUtils.ReadBytes(m_s, buffer, offset, Math.Min(ccbToRead, m_ccbCurrChunkRemaining));
m_ccbCurrChunkRemaining -= ccbRead;
return ccbRead;
}
</code></pre>
|
c#
|
[0]
|
2,730,025 | 2,730,026 |
HOWTO: Fix Python Indentation
|
<p>I have some python code that have inconsistent indentation, there is a lot of mixture of tabs and spaces to make the matter even worse even space indentation is not preserve. The code works as expected but its difficult to maintain.</p>
<p>I'm looking for a tool that will fix the indentation (like html tidy but for python) and won't break the code :)</p>
|
python
|
[7]
|
5,746,184 | 5,746,185 |
PHP Variable not working the way I am sure it worked before
|
<p>Hi there I hope someone can help me</p>
<p>I have this variable</p>
<pre><code>var $page_slug = "posts";
</code></pre>
<p>and want to make insert a dynamic value into the "posts" section but for some reason I keep getting an error that the code is not formatted correctly?</p>
<pre><code>var $page_slug = $_SERVER['REQUEST_URI'];
</code></pre>
<p>Above cause error... (With the formatting)...
I have also tried</p>
<pre><code>var $page_slug = ".$_SERVER['REQUEST_URI'].";
</code></pre>
<p>I still get an error?</p>
<p>I cannot see why I cannot get to make the value dynamic, would appreciate any help!</p>
<p>This is part of the code:</p>
<pre><code>class FakePage
{
var $page_slug = "author/admin/posts";
/**
* The slug for the fake post. This is the URL for your plugin, like:
* http://site.com/about-me or http://site.com/?page_id=about-me
* @var string
*/
/**
* The title for your fake post.
* @var string
*/
var $page_title = "Test";
</code></pre>
<p>as soon as I do </p>
<pre><code>class FakePage
{
</code></pre>
<p>$page_slug = ""; <--- with a dynamic value it gives me an error...</p>
|
php
|
[2]
|
2,554,707 | 2,554,708 |
How do i Get Classes name of classes in entire solution in c#
|
<pre><code>ProcessStartInfo info = new ProcessStartInfo(@"D:\\ss\\Class1.cs");
</code></pre>
<p>i have a this type of code but i want to get "class name" like how many classes in my solution code will count the no of class and get the name by code in c#.</p>
|
c#
|
[0]
|
1,454,750 | 1,454,751 |
Check for an empty map
|
<p>I'm having an interesting issue that I'm sure is easily explained, but the explanation is eluding me.</p>
<p>An undefined or null object in javascript is equal to false.
</p>
<pre><code>var x;
alert(!x); //returns true
alert(x==true); //returns false
</code></pre>
<p>What about an empty array object? Is that the equivalent of true or false?</p>
<pre><code>var x = [];
alert (x==true); //returns false
alert (!x); //returns false
</code></pre>
<p>If it is equivalent to true, how do I check if it's non-empty? I was hoping to do</p>
<pre><code>if (!x) {
//do stuff
}
</code></pre>
<p>I tried checking <code>x.length</code>, but I'm using this object as a map:</p>
<pre><code>var x = [];
alert(x.length); //returns 0
x.prop = "hello";
alert(x.length); //still returns 0
</code></pre>
<p>How can I check if my map is empty?</p>
|
javascript
|
[3]
|
4,317,128 | 4,317,129 |
iPhone: Handle action event from webview page
|
<p>I am loading a html page using loadHTMLString.</p>
<pre><code>[myWebview loadHTMLString:myHtmlStr baseURL:nil];
</code></pre>
<p>Its loading properly. In this html web page, i'm also adding buttons, drop down(with selection) etc. I want to catch the action events in my code now for these web page controls. For example, from the drop down if user chooses an option, i need to add another 'textarea' dynamically in the same web page. and, if user clicks on a button(button from the webview), i need to handle some events. I would like to know, how to do some tasks under the events triggered for controls in web view which is generated by my string. </p>
<p>Could someone please advise me.</p>
|
iphone
|
[8]
|
2,463,962 | 2,463,963 |
similar functionality like uitableview in iphone to in android?
|
<p>can anybody please give me example of using similar functionality like uitableview in iphone to in android?</p>
|
android
|
[4]
|
2,868,392 | 2,868,393 |
How do I get the return value of DispatcherOperation inside the callback
|
<p>I am subscribing to DispatcherOperation's Completed event when the delegate finishes processing. Can any one please tell me how to get the value returned by the delegate inside the Completed event handler. I think it is only possible to not to block the main thread by accepting the return value inside the Completed event handler.</p>
<pre><code>DispatcherOperation dispOp = this.Dispatcher.BeginInvoke(balUpdater,
GlobalParams._sessionObject.UserInfo.CardData);
dispOp.Completed += new EventHandler(dispOp_Completed);
void dispOp_Completed(object sender, EventArgs e)
{
// accept return value of balUpdater here.
}
</code></pre>
|
c#
|
[0]
|
1,368,177 | 1,368,178 |
Android emulator crash on Mac osx 10.7 lion, causing kernel panic
|
<p>I am using Android emulator with an intel x86 based image for version 2.3 and developing on a Mac 10.7 lion system.
I have also installed intel hardware execution manager due to which the emulator runs at faster speed than normal. However while using the emulator it crashes randomly causing a kernel panic.
This happens quite frequently. Any clues to how I may get over this !</p>
|
android
|
[4]
|
2,382,316 | 2,382,317 |
How to find all image tags using Regular Expressions
|
<p>I need to find all the image html tags that are included in a page using PHP regular expressions</p>
<p>Example</p>
<pre><code><img src="images/image.jpg" />
</code></pre>
<p>My code</p>
<pre><code>preg_match('/<img src=\"images\/.*/',$tags,$matches);
</code></pre>
<p>The strange thing is it only finds the first occurence, not the rest of the tags in the page</p>
|
php
|
[2]
|
2,626,838 | 2,626,839 |
I need to validate a checkbox
|
<p>this is my code:</p>
<pre><code><script>
function validate(form) {
fail = validate_department(form);
if (fail == "") {
return true;
} else {
alert(fail);
return false;
}
}
</script>
<script>
function validate_department(form) {
if(!(form.operations.checked == true) && !(form.marketing.checked == true) && !(form.training.checked == true)){ return "You must enter at least one of the following: marketing, training, or operations.\n";
}
return "";
}
</script>
<form method="post" action="checkbox.php" onSubmit="return validate(this)">
<input type="checkbox" name="operations" value="operations" /> Operations <br>
<input type="checkbox" name="marketing" value="marketing" /> Marketing <br>
<input type="checkbox" name="training" value="training" /> Training
<input id="submit" type="submit" name="submit" value="Signup" />
</form>
</code></pre>
<p>If I don't check anything I want to get a message telling me that I must check at least one. </p>
|
javascript
|
[3]
|
5,664,248 | 5,664,249 |
Adjusting 1 space between two strings using python
|
<p>I have two strings:</p>
<pre><code>>>> a = "abcd"
>>> b = "xyz"
>>> c = a + b
>>> c
abcdxyz
</code></pre>
<p>How can I get <code>abcd xyz</code> as a result instead when adding <code>a</code> and <code>b</code>?</p>
|
python
|
[7]
|
798,360 | 798,361 |
Try/Catch block in PHP not catching Exception
|
<p>I am trying to run Example #1 from this page: <a href="http://php.net/manual/en/language.exceptions.php" rel="nofollow">http://php.net/manual/en/language.exceptions.php</a></p>
<p>However instead of the desired output I get:</p>
<pre><code>0.2
Fatal error: Uncaught exception 'Exception' with message 'Division by zero.' in xxx:
7 Stack trace: #0 xxx(14): inverse(0) #1 {main} thrown in xxx on line 7
</code></pre>
<p>I have absolutely no idea, whats wrong... As a developer environment I am using UniServer 3.5 with PHP 5.2.3</p>
|
php
|
[2]
|
5,330,839 | 5,330,840 |
PHP syntax for variable number of parameters to be passed to function pointer
|
<p>May I ask is there a PHP way to write a variable number of parameters to a function pointer?</p>
<p>For example (psuedocode)</p>
<pre><code>$args = $request->get_args(); // get an array of arguments
$request->$func_pointer(foreach $args write $arg);
</code></pre>
<p>My objective is to allow the API user to write functions with fixed number of parameters.
And later on pass the function name and the args which my API will execute on behalf.</p>
<p>Hope it is clear. Thank you.</p>
|
php
|
[2]
|
5,459,247 | 5,459,248 |
Make Array From Checkbox
|
<p>I wan't to make an array from checkbox.</p>
<p>I've use <code>array($_POST[test],$_POST[test1],$_POST[test2])</code>
It works, but if once of array is NULL the array also NULL</p>
<p>So what I wan't is if once of array is NULL, it's not in array</p>
<p>Like this</p>
<pre><code>$_POST['test']=NULL;
$_POST['test1']="ARAAY1";
$_POST['test2']="ARRAY2";
</code></pre>
<p>and it will be <code>array($_POST[test1],$_POST[test2])</code></p>
|
php
|
[2]
|
4,818,535 | 4,818,536 |
android converting code java to android
|
<p>I want to convert this line into Android.</p>
<pre><code>BufferedImage input=new BufferedImage();
WritableRaster raster=input.getRaster();
</code></pre>
<p>Thank you.</p>
|
android
|
[4]
|
5,910,091 | 5,910,092 |
Blocking access to Application When User leaves the company
|
<p>I am building an app which will be distributed using enterprise distribution.So we need to disable the app whenever the user leaves the company.
I can have a web service through which I can check the status of user.
What would be a nice way to disable the app.Should I stop loading my root view or should I present a modal view saying that app has been disabled.
Could someone suggest a nice way to do this.</p>
|
iphone
|
[8]
|
1,741,624 | 1,741,625 |
Peer to peer chat application in php
|
<p>I am new to PHP, I need some information about how to develop peer to peer chat for the organization.
What are the things I need to do?</p>
<p>Where do I need to store the chatting information? </p>
<p>Could you please give some suggestions on this? </p>
|
php
|
[2]
|
4,380,140 | 4,380,141 |
Using not defined variable in function body
|
<p>There is this code:</p>
<pre><code>def f():
x = m
m = 2
def g():
x = m
f() # UnboundLocalError: local variable 'm' referenced before assignment
g() # NameError: global name 'm' is not defined
</code></pre>
<p>In both function bodies there is used variable <code>m</code> which is not defined when used but the error messages are different. Do Python know what variables are defined in function before using them (like in function <code>f</code>)? Why the error messages are different?</p>
|
python
|
[7]
|
5,633,248 | 5,633,249 |
Control amount of scroll in browser, jQuery
|
<p>Is there a way to control the amount that the browser is scrolled in jquery? For example, if I wanted to add content to the bottom of a page and have it always be at the bottom, with everything else scrolling up (like a terminal)</p>
|
jquery
|
[5]
|
1,208,554 | 1,208,555 |
Understanding prototyping and augmentation
|
<p>I have a <a href="http://jsfiddle.net/zcWQ8/1/" rel="nofollow">fiddle</a> to help me in my understanding of JavaScript prototyping and inheritance. The comments tell the story. </p>
<pre><code>//From Douglas Crockford's "Javascript: the good parts": a helper to hide the "ugliness" of setting up a prototype
Function.prototype.method = function(name,func) {
this.prototype[name] = func;
return this;
}
function SomeFunc(value) {
this.setValue(value);
}
//Inherit the function (to me this conceptually the same as adding a member to a class)
SomeFunc.method('setValue', function (value) {
this.value = value;
return this;
});
try
{
SomeFunc(1);
}
catch(e)
{
alert(e);
}
</code></pre>
<p>Why do I get an exception? Are my notes correct in that what JavaScript calls inheritance is to a Classical programmer simply adding a new member to a class? What is the difference between augmentation and inheritance?</p>
|
javascript
|
[3]
|
521,103 | 521,104 |
PHP Parsing Conundrum - "Missing Symbols Listed"
|
<p>I am trying to access the Yahoo site by getting Stock quotes:</p>
<pre><code>http://de.finance.yahoo.com/d/quotes.csv?s=^DJI&f=nsl1op&e=.csv
</code></pre>
<p>and it doesn't seem to be downloading any data. I get "Missing Symbols Listed.". Weird b/c this used to work!</p>
<pre><code><?php
function market_value($s) {
$records= fopen ("http://quote.yahoo.com/d/quotes.csv?s=$s&f=nsl1&e=.csv");
$contents = fread ($records);
fclose ($records);
$data = str_replace ("\"", "", $data);
$data = explode (",", $data);
$trade= $data[2];
return (".$trade.")";
}
</code></pre>
|
php
|
[2]
|
5,876,687 | 5,876,688 |
Android Opengl-es make transparent background on a texture, how?
|
<p>I have a texture with a black background. </p>
<p>I d like to make a pixel color key transparency. </p>
<p>My picture is a png file, but the background is not transparent, it is a BLACK(or red or yellow, etc) color.</p>
<p>How can i draw that texture without my background? </p>
<p>this code not work:</p>
<pre><code>gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE);
gl.glEnable(GL10.GL_BLEND);
</code></pre>
<p>this code only work on transparent png's, </p>
<p>thanks</p>
|
android
|
[4]
|
5,770,586 | 5,770,587 |
What class parameter type should should be passed for variable arg Object array
|
<p>If I have to pass an Object... var arguments parameter as input to the <a href="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/reflect/Method.html#invoke%28java.lang.Object,%20java.lang.Object...%29" rel="nofollow">Method.invoke</a> call, what should I specify as the parameter type for the <a href="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Class.html#getMethod%28java.lang.String,%20java.lang.Class...%29" rel="nofollow">Class.getMethod</a> call</p>
|
java
|
[1]
|
2,600,871 | 2,600,872 |
javascript array within an array error
|
<p>Hey Guys my goal for this multi dimensional array is to document the answers (right or wrong) for a test that the user is taking. In the beginning the test array is set up. as the user goes throught the questions the app should add to the array. Note: the page doesnt reload, the questions come via ajax.</p>
<p>Here is what i have so far</p>
<pre><code> var test = new array();
function nextquestion(){
var result;
if (document.getElementById('rb2').checked = true){
result = 'correct' ;
}
else{
result = 'incorrect';
}
var num = document.getElementByName('rb').value;
var question =new Array();
question1[0]= document.getElementByName('rb').value; //question id
question1[1]= result;
</code></pre>
<p>I want the test array to hold the data like so</p>
<pre><code> test[0]
test[1][0] = question 1
test[1][1] = correct
test[2][0] = question 4
test[2][1] = incorrect
test[3][0] = question 17
test[3][1] = correct
test[4][0] = question 12
test[4][1] = incorrect
test[0]
test[1][0] = question 1
test[1][1] = correct
test[2][0] = question 2
test[2][1] = incorrect
test[3][0] = question 3
test[3][1] = correct
test[4][0] = question 4
test[4][1] = incorrect
</code></pre>
<p>also what must i add to the next function to get the value of the question id so that i can + 1 to get the next question from the database</p>
<p>thanks in advance!! </p>
|
javascript
|
[3]
|
3,892,571 | 3,892,572 |
Script disable in text boxes
|
<p>How can I prevent a script from executing in text boxes, by using jQuery?</p>
<p>Here is my complete problem:</p>
<p>I want to send a message to someone using jQuery; if I entered a script tags like <code>a</code>, <code>href</code>, <code>script</code>, etc. they are not appearing in the other's message. How can I prevent this?</p>
|
jquery
|
[5]
|
1,456,342 | 1,456,343 |
What's the preferred operator when comparing indexOf result with -1, "!=" or ">"?
|
<p>What's the preferred operator when comparing the result of indexOf with -1, "!=" or ">"? Is there any difference?</p>
|
javascript
|
[3]
|
3,482,312 | 3,482,313 |
Android Getspeed using maps
|
<p>i am implementing <code>getspeed</code> to get speed of the device while moving in phone.why <code>getSpeed()</code> always <code>return 0</code> on android ..?..i am using gps to get coordinates.</p>
<pre><code>if(location.hasSpeed() == true)
{
Toast.makeText(ProxAlertActivity.this, "Speed:"+ location.getSpeed(), Toast.LENGTH_LONG).show();
}
</code></pre>
|
android
|
[4]
|
1,299,575 | 1,299,576 |
what is the meaning of word this near the property in JavaScript
|
<p>Hello I'm a newcomerin JavaScript language.
I started to see some examples of JavaScript code.</p>
<p>and i cant understand the following code segment:</p>
<pre><code>function Employee(name,salary)
{
this.name=name;
this.salary=salary;
this.paycheck=function()
{
var monthly=this.salary/12;
document.write(this.name+ ": " +monthly);
};
}
var emp= new Employee("Fred",10000);
emp.paycheck();
</code></pre>
<p>My question: what is the meaning of word <strong>this</strong> near the property inside class (i.e. ,this.name=name; this.salary=salary; )?</p>
<p>Thank you in advance!</p>
|
javascript
|
[3]
|
496,347 | 496,348 |
how to hide console window of another executable?
|
<p>Our C# application will launch a console application executable by doing this: <code>Process correctionProcess = Process.Start(exePath, rawDataFileName);</code></p>
<p>Customer wants to hide that console window which is from their application. Is that possible for us to do that?</p>
|
c#
|
[0]
|
2,563,013 | 2,563,014 |
Java - try & catch in calling methods
|
<p>I have a basic question in Java:</p>
<p>I have two methods: <code>functionA</code> & <code>functionB</code>. <code>functionA</code> calls <code>functionB</code>, and <code>functionB</code> rise an exception. The call to <code>functionB</code> is in try scope of <code>functionA</code>.</p>
<p>Now I also want that <code>functionA</code> will go to it catch scope.</p>
<p>There is any way to do that?</p>
|
java
|
[1]
|
4,065,953 | 4,065,954 |
Saving Information For The Duration The User Has A Site open
|
<p>How woulld I set this up:</p>
<p>I wanna save what links a user clicks on in a website. I thought of creating a jquery function that would save the link name everytime a link is clicked , then ajax the info to the db after the user closes the site.</p>
<p>Does that sound like a proper way. Anyone have samples of that? </p>
<p>Since there are multiple pages with multpile links, I wanna create something equivalient to a Session variable in javascript so I can append info to it everytime a user clicks a link and send the info only once to the db, instead of everytime a user clicks a link open a db connection and send the info.</p>
<p>The links are products so I wanna save related products, so I wanna save related product infomation. Maybe I need a cookie instead?</p>
|
asp.net
|
[9]
|
3,170,098 | 3,170,099 |
How to get cursor position (x,y) in EditText android
|
<p>I have ploblem:get cursor position x,y in EditText android?
You can help me?</p>
|
android
|
[4]
|
3,771,055 | 3,771,056 |
Searching Outlook Global Address List
|
<p>I'm pulling up the Global Address List from Outlook like so...</p>
<pre><code> Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application();
AddressList gal = oApp.Session.GetGlobalAddressList();
</code></pre>
<p>...with the aim of eventually being able to search through this in my own application to retrieve contact information which I can then supply to a method that squirrels off an email. Unfortunately given that my own GAL has about 20K entries in (the customers much more) using a foreach or something simply doesn't work in an acceptable timeframe.</p>
<p>I want to pass a string like "Tom" to a method and have it return a list of possible contacts. Is this possible outside of actually opening up Outlook and creating the mail there?</p>
<p>Note: There are a couple of other questions similar to this but most seem to have no good answer. I'm hoping I have more luck.</p>
|
c#
|
[0]
|
3,524,904 | 3,524,905 |
Creating a list of links
|
<p>I want to create a PHP file that checks the current directory for any files ending in .jpg, and then I want to generate a page of links to all of those files.</p>
<pre><code><?php
$files = glob("./*.jpg");
if ($files) {
foreach ($files as $file) {
?>
<a href=<?php echo $file;?>"></a>
<?php }
?>
</code></pre>
<p>This is what I have, and it doesn't do anything, and I'm not quite sure why. I'm quite new to learning php, so I'm not fantastic at it at this point.</p>
|
php
|
[2]
|
6,016,942 | 6,016,943 |
which method in ASP.NET life-cycle is only called once? It is not fired during postback
|
<p>Can we avoid using</p>
<p>If (!Postback) {.....code runs once....} </p>
<p>in Page_load()</p>
|
asp.net
|
[9]
|
855,607 | 855,608 |
How can I tell what events are bound to an object?
|
<p>I am using jqGrid (<a href="http://www.trirand.com/blog/" rel="nofollow">http://www.trirand.com/blog/</a>) to display some read-only data. The resizeable columns are interfering with other draggable elements on the page (they get stuck when dragged over the region where the columns can be resized).</p>
<p>I want to unbind() whatever is allowing the columns to be resized, presumably on mouseover, but I can't figure out how to determine what callbacks the objects currently have.</p>
|
jquery
|
[5]
|
5,076,912 | 5,076,913 |
Why do I get: Invalid Syntax
|
<p>I am getting invalid syntax on the following:</p>
<pre><code>rootdir = 'c://temp/test//files//'
for subdir, dirs, files in os.walk(rootdir):
for file in files:
fileParts = file.split('.')
if len(fileParts) > 1:
stripper = fileParts([len(fileParts)-2]
print(stripper)
</code></pre>
|
python
|
[7]
|
3,517,113 | 3,517,114 |
Python's __getattr__ in Javascript
|
<p>Is there a way to simulate Python's <code>__getattr__</code> method in Javascript?</p>
<p>I want to intercept 'gets' and 'sets' of Javascript object's properties.</p>
<p>In Python I can write the following:</p>
<pre><code>class A:
def __getattr__(self, key):
return key
a = A()
print( a.b )
</code></pre>
<p>What about Javascript?</p>
|
javascript
|
[3]
|
3,901,427 | 3,901,428 |
JavaScript enumerator?
|
<p>I want to define a list of constants that have continuous integer value, for example: </p>
<pre><code>var config.type = {"RED": 0, "BLUE" : 1, "YELLO" : 2};
</code></pre>
<p>But it's boring to add a <code>"XX" : y</code> every time I need to add a new element in it.<br>
So I'm wondering is there something like <code>enumerator</code> in C so I can just write:<br>
<code>var config.type = {"RED", "BLUE", "YELLO"}</code> and they are given unique integer value automatically.</p>
|
javascript
|
[3]
|
2,118,256 | 2,118,257 |
How to Create Custom Tab In Android Application
|
<p>thanks advance..</p>
<p>when i create custom tab in android application so no one tab display in main screen</p>
<p>how to solve this problem please any one tell me?</p>
|
android
|
[4]
|
3,838,097 | 3,838,098 |
Trying to get the width of an h1 tag with Javascript
|
<pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org /TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type = "text/javascript">
var textHeadingArray = ["Bloom Defender", "Civilization Wars", "Flight", "Rebuild 2", "Wonderputt"];
var textHeadingIndex = 0;
function changeMainImage() {
textHeadingIndex++;
if (textHeadingIndex >= textHeadingArray.length) {
textHeadingIndex = 0;
}
var changeTheHeading = document.getElementById("slidehsowheading").innerHTML = textHeadingArray[textHeadingIndex];
var heading = document.getElementById("slidehsowheading").style.width;
var sizeOfHeading = heading;
alert(sizeOfHeading);
var subtraction = 75 - sizeOfHeading;
var changeTheHeadingAgain = document.getElementById("slidehsowheading").style.left = subtractionRounded + "px";
}
var mainTiming = setInterval("changeMainImage()", 5000);
</script>
</head>
<body>
<h1 id = "slidehsowheading">Bloom Defender</h1>
</body>
</html>
</code></pre>
<p>Im trying to use this code to change the heading for a slideshow, I am kinda new to javascript so my problem is that when the alert pops up it returns as null(the alert was just for debugging), so when i try to use the null width from the h1 in this equation it is wrong. The equation is supposed to get the width of the heading after it has been changed by the timer and divid by 2 and subtract that from the width of its background divided by 2 which is 75, with this formula you can center the heading in its background element</p>
|
javascript
|
[3]
|
3,283,163 | 3,283,164 |
How can I "get" the return value of a function?
|
<p>What is the syntax to find out in method2 whether method1 one returned true or false?</p>
<pre><code>class myClass{
public function method1($arg1, $arg2, $arg3){
if(($arg1 + $arg2 + $arg3) == 15){
return true;
}else{
return false;
}
}
public function method2(){
// how to find out if method1 returned true or false?
}
}
$object = new myClass();
$object->method1(5, 5, 5);
</code></pre>
|
php
|
[2]
|
3,715,202 | 3,715,203 |
c# messenger, send commands over network, protocol?
|
<p>I'm making a c# messenger application just for fun, but I wanna do it good.
I want the possibility to send commands like a chat message, kick comand etc, but i dont know a good way to control it.</p>
<p>I could send an object over the networkstream, or I could send a string like: stream.write("command##");</p>
<p>maybe you know another way to fix this things, but I'm in stackoverflow atm.
Thanks.</p>
|
c#
|
[0]
|
1,163,716 | 1,163,717 |
What can be used instead of tooltip in iphone app?
|
<p>What can be used instead of tooltip in iphone app?</p>
<p>Best alternative of tooltip in touch screen systems?</p>
|
iphone
|
[8]
|
113,874 | 113,875 |
size of Two-dimensional arrays in Java
|
<p>I want to make a loop on Two-dimensional array in Java.</p>
<p>How I do that? I wrote:</p>
<pre><code> for (int i = 0; i<=albums.size() - 1; i++){
for (int j = 0; j<=albums.size() - 1; j++){
</code></pre>
<p>But it didn't work. Thanks.</p>
|
java
|
[1]
|
3,728,938 | 3,728,939 |
Conceptual Question About Java Concurrency
|
<p>If I I have a class whose run() method sleeps for 1000 ms and then print "Thread". And I start this thread from my main program, then have my main program immediately sleep for 2000 ms, and then print "Main Thread".</p>
<p>Is it guaranteed that Thread will be printed before Main Thread?</p>
|
java
|
[1]
|
3,283,072 | 3,283,073 |
inet_pton not working
|
<p>I am trying to use to turn an IP address into a numerical string for mysql storage using the inet_pton() in the PHP code, yet this function either returns nothing or this: '�?i'
NOTE: The IP address is a standard IPv4 (and not my localhost)</p>
<p>My code is: echo inet_pton($_SERVER['REMOTE_ADDR']);</p>
|
php
|
[2]
|
3,311,261 | 3,311,262 |
points aren't aligned with the x axis on flot chart
|
<p>I've got flot data where the points on the xaxis aren't aligned with the lines. </p>
<p>specifically, take a look at this photo:<img src="http://i.stack.imgur.com/NLKKJ.png" alt="flot chart"></p>
<p>this is the raw data that I'm using:</p>
<pre><code>[0] : [1327305600000,1989],
[1] : [1327392000000,3222.33333333333],
[2] : [1327564800000,1481.5],
[3] : [1327651200000,2061],
[4] : [1327910400000,1434],
[5] : [1327996800000,1504.75],
[6] : [1328083200000,1422.4]
</code></pre>
<p>and this is the javascript that I'm passing to flot:</p>
<pre><code>$.plot($("#something"), [datapoints], {
series: {
lines: { show: true , shadowSize:0},
points: { show: true }
},
xaxis: {
mode: "time",
timeformat: "%m/%d/%y",
reserveSpace: true
},
clickable: true,
hoverable: true,
legend: {
show: true
}
});
</code></pre>
<p>specifically, look at the second point. The timestamp for it is 1327392000000, and you can see from the following code that this should be aligned with the 1/24/2012 x-axis point, but it's not. </p>
<p><strong>var d = new Date(1327392000000);</strong>
<em>=> Tue Jan 24 00:00:00 PST 2012</em> </p>
<p>If there's any way I can workaround this, I'd love to hear it. </p>
<p>Thanks!</p>
|
javascript
|
[3]
|
1,348,757 | 1,348,758 |
How to iterate over all input hidden values using $.each
|
<p>I want to do something with each hidden input value, so I coded the following javascript using <a href="http://api.jquery.com/jQuery.each/" rel="nofollow">jQuery</a>.</p>
<pre><code>$.each($("input[type='hidden']"), function (index, value) {
alert(value.val());
});
</code></pre>
<p>But I get he following execution error: <code>value.val is not a function.</code></p>
<p><strong>What am I doing wrong?</strong></p>
|
jquery
|
[5]
|
1,275,893 | 1,275,894 |
String present in Data Table or not in c#
|
<p>I want to find the specific string in specific column of data table so that it is present or not in all rows</p>
|
c#
|
[0]
|
1,301,953 | 1,301,954 |
Method inside Object undefined?
|
<p>I'm still learning how to use Javascript properly and have got stuck trying to set an interval on a function which is inside an object.</p>
<p>Here is my code: </p>
<p><a href="http://pastebin.com/hJAtaqKi" rel="nofollow">http://pastebin.com/hJAtaqKi</a></p>
<p>On line 36 I am calling the function which is further down the page.. this works fine and references the function correctly.. but when I try to wrap that function in a setinterval setInterval('homePageFunctionality.animateCarousel($pause)', 4000); </p>
<p>It does not seem to work.. I get a homePageFunctionality is not defined..</p>
<p>Any idea why I cannot seem to reference the function when using setInterval?</p>
<p>Any other general feedback on my code is welcome.</p>
<p>Thanks</p>
|
javascript
|
[3]
|
3,770,771 | 3,770,772 |
sign in view controller , iphone
|
<p>I have 2 text fields, one is for usrname and the other one is for password. </p>
<p><strong>Question</strong> : after entering a username and hit next from the keyboard, how can I jump to the password field for typing a password..</p>
<p>Any comments are welcomed here.</p>
|
iphone
|
[8]
|
394,498 | 394,499 |
Managing bidirectional associations in my java model
|
<p>I have a java model where the classes have associations (1 to 1, 1 to n, n to n) that should work in both directions.</p>
<p>Example:
class A has a collection of class B</p>
<p>All instances of B must know, who their parent (A) is. If I change the parent property of B, the association needs to be updated on the other side as well.</p>
<p>I think, writing code, that keeps the associations up to date on both ends is quite tedious and errorprone.</p>
<p>So: Is there a better way of doing this? Is there a java library that can manage bidirectional associations between two objects?</p>
|
java
|
[1]
|
210,714 | 210,715 |
What does this statement mean in Java?
|
<p>Suppose there is an array declaration:</p>
<pre><code>int [] a = new int[3];
</code></pre>
<p>I'm reading a book that says the reason we need to explicitly create arrays at runtime is because we cannot know how much space to reserve for the array at compile time. So, in this case above don't we know we need to reserve 3 times the size of int of the underlying java platform ? </p>
|
java
|
[1]
|
836,404 | 836,405 |
Using multiple forms and passing information between them
|
<p>I've been messing around with Android development.</p>
<p>I made a simple form that has two fields for numbers, and when you press the Calculate button, it multiplies them. </p>
<p>What I would like to do is when I press Calculate to open another form, and pass that multiplied number to it to display it.</p>
<p>I'm really not sure how to do this though, the whole xml and findViewById thing is pretty different from what I've done before. When I started the project in Eclipse, the main.xml and strings.xml was created for me. </p>
<p>I tried googling around but I just find tutorials using one form</p>
<p>Could someone point me to a good tutorial for this, or explain how to create a new form, create/open it, and pass some information to it? </p>
<p>Thanks</p>
|
android
|
[4]
|
1,018,580 | 1,018,581 |
mvc is not working on my host
|
<p>I`m using PDO databaseconnect
PHP programming with classes and objects in a MVC-model.</p>
<p>i made a website that works 100% on my own localhost
but when i uploaded it to my host (and ofcourse changed the database connection data),
it didn`t work. the html i include in my view.php(MVC) is not been added to the page. though i tested if the view.php file is included and it is. so is there any prep needed to make my render function work?</p>
<p>view.php</p>
<pre><code>class View{
public function render($url = "", $data = true){
include "app/views/template/header.php" ;
include "app/views/template/top.php" ;
include "app/views/template/menu.php" ;
include "app/views/" . $url . ".php";
include "app/views/template/bot.php" ;
include "app/views/template/footer.php" ;
}
}
</code></pre>
|
php
|
[2]
|
4,859,351 | 4,859,352 |
PayPal Returns empty response
|
<p>I am using PayPal in my site. Found that when we run the papal in the local server it is giving the correct response codes but the problem is when my site has been to production server the response received from the papal is empty(sometimes).</p>
<p>These empty responses are occurring only in production site.</p>
<p>These are occurring since past 1 month.</p>
<p>My Question is:
Does PayPal Returns Empty Response? If Returns why?</p>
<p>I checked in the Google it has given some of the answers but it is not useful to me.</p>
|
asp.net
|
[9]
|
5,962,297 | 5,962,298 |
How to post a photos on facebook through iPhone app?
|
<p>I am trying to post image on facebook but not successful yet,
my codes are:</p>
<pre><code>- (void)postToWall{
int im = 1;
NSData *myimgData;
myimgData = [NSData dataWithContentsOfFile:saveImagePath];
//pstimg = myimgData;
NSArray *chunks = [pstimg componentsSeparatedByString: @"."];
NSString *atch= [chunks objectAtIndex: 0];
NSString *filePath = [[NSBundle mainBundle] pathForResource:atch ofType:@"jpg"];
img = [[UIImage alloc] initWithContentsOfFile:filePath];
//start
FBDialog* dialog = [[[FBStreamDialog alloc] init] autorelease];
NSString *str = @"Hello";
str = [str stringByReplacingOccurrencesOfString:@" " withString:@"+"];
dialog.cMessage=str;
dialog.userMessagePrompt = @"Enter your message:";
[dialog show];
NSData * findata;
//edited from here
if(im==1)
{
findata = myimgData;
}
else
{
findata = (NSData *)img;
}
NSMutableDictionary * param = [NSMutableDictionary dictionaryWithObjectsAndKeys:
img, @"picture",
nil];
FBRequest *uploadPhotoRequest =[FBRequest requestWithDelegate:self] ;
[uploadPhotoRequest call:@"facebook.photos.upload" params:param dataParam:myimgData];
[img release];
</code></pre>
<p>}</p>
<p>But it not posted.</p>
|
iphone
|
[8]
|
2,734,896 | 2,734,897 |
Java input parameter from text file
|
<p>I want to know how I can get data from a text file to a java program from the command line. I am using windows.</p>
<p>I used </p>
<pre><code>Java myprogram < c:\inputfile.txt
</code></pre>
<p>it doesn't work, but when I used </p>
<pre><code>Java myprogram good
</code></pre>
<p>it works. 'good' is the word that i used it as input</p>
<p>FYI: when I used </p>
<pre><code>Java myprogram good > c:\outfile.txt
</code></pre>
<p>this is for writing output to a text file ..</p>
<p>I need to read from the text file "inputfile.txt" and write to "outputfile.txt"</p>
<p>i used this </p>
<pre><code>Java myprogram "c:\\inputfile.txt" > "c:\\outputfile.txt"
</code></pre>
<p>but not working</p>
<p>This code that i used it </p>
<pre><code>import edu.smu.tspell.wordnet.*;
public class myprogram{
public static void main (String [] args) {
System.setProperty("wordnet.database.dir", "C:\\Program Files (x86)\\WordNet\\2.1\\dict\\");
WordNetDatabase database = WordNetDatabase.getFileInstance();
String result = "";
NounSynset nounSynset;
NounSynset[] hyponyms;
Synset[] synsets = database.getSynsets(args[0]);
for (int i = 0; i < synsets.length; i++) { //iteratre over all senses
String[] wordForms = synsets[i].getWordForms();
for (int j = 0; j < wordForms.length; j++) {
System.out.println(wordForms[j]);
}
}
}
}
</code></pre>
|
java
|
[1]
|
4,714,773 | 4,714,774 |
Reading from comma or tab delimited text file
|
<p>I need to read the data from a file that can be either comma or tab delimited. I now that there is a function getcsv but it accepts only one possible delimiter.</p>
<p>Any ideas how to handle this?</p>
<p>Thanks.</p>
|
php
|
[2]
|
1,572,072 | 1,572,073 |
Visible false of button in gridivew while data binding? In Asp.net?
|
<p>In web application, i am going to disable the button while binding data, is it possible visibling false like this? </p>
<pre><code> <asp:Button ID ="btn" runat ="server" CommandArgument='<%# Eval("id").ToString() == "1"? visble false: Visible true %>' />
</code></pre>
<p>can you help me. Thank you.</p>
|
asp.net
|
[9]
|
3,013,564 | 3,013,565 |
Visual studio 2008 release build : application crashes on basic string or basic pointer operations
|
<p>I have a application compiled in Visual studio 2008,which runs fine in debug build. In release build , the application crashes when std::wstring assignment is done or when shared pointer is accessed. Any idea why this happens in release build.
crash at :
eg: m_name = name; //m_name and name are of type std::wstring</p>
|
c++
|
[6]
|
4,195,322 | 4,195,323 |
ASP.NET Cannot initiate instance object of a Class I created
|
<p>So I created a class file Persons to my website project and placed this in a folder called <code>App_Code</code>.</p>
<p>But now in my <code>default.aspx.cs</code> I cannot seem to create i.e. <code>Persons test = new Persons();</code></p>
<p>Says </p>
<blockquote>
<p>Type or Namespace Persons not found</p>
</blockquote>
<p>This is my persons class so far</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebApplication1.App_Code
{
public class Persons
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
public string DisplayFullName()
{
string info;
info = "FullName is: " + FirstName + " " + LastName;
return info;
}
public void setData(String sLine)
{
this.FirstName = "Test";
}
}
}
</code></pre>
|
asp.net
|
[9]
|
3,750,713 | 3,750,714 |
nl2br doesn't work with text from the database
|
<p>I try this:</p>
<pre><code>echo nl2br($row['content']);
</code></pre>
<p>But what I get is:</p>
<blockquote>
<p>Hello everybody\n Good luck!</p>
</blockquote>
<p>Why doesn't it convert the <code>\n</code>? the database is storing data as UTF-8.</p>
<p>In addition, I check it with a test string, and found out that if the string is with double quotes it doesn't work too.. I mean:</p>
<pre><code>echo nl2br("Hello everybody\n Good luck");
</code></pre>
|
php
|
[2]
|
4,179,902 | 4,179,903 |
Get the north pole , South Pole. using TYPE_MAGNETIC_FIELD or TYPE_GYROSCOPE
|
<p>Actually i need to get the device current position. like device is in south-west corner or device is in north-west corner. just like compass. I do not have any idea how can i get this done. I think i need to use sensor with type TYPE_MAGNETIC_FIELD. Please guide. </p>
|
android
|
[4]
|
2,569,159 | 2,569,160 |
JQuery extract subdomain and pass to a variable
|
<p>I need to extract a sub domain and pass to a variable to then add into a url so that a link will work on a number of different environments</p>
|
jquery
|
[5]
|
2,949,772 | 2,949,773 |
Converting to double is giving not accurate number
|
<p>Convert.ToDouble is adding zeros and 1 like in this picture:</p>
<p><img src="http://i.stack.imgur.com/la7QD.png" alt="enter image description here"></p>
<p>Why it is turning from 21.62 to 21.620000000000001 ?
Is this about floating point issue?</p>
|
c#
|
[0]
|
4,841,389 | 4,841,390 |
limiting number of letters for registering a new user name
|
<p>I have a forum and visitors can register user names with more than 20 letters, how can I deny those visitors to register with a (long) user names?</p>
<p>the registration form is using PHP language.</p>
<p>thanks,</p>
|
php
|
[2]
|
355,392 | 355,393 |
Doesn't search any discoverable devices
|
<p>Can any one describe what is wrong with this code. It didn't search devices, and it showed some paired devices. </p>
<p>Project hosted <a href="https://github.com/luugiathuy/Remote-Bluetooth-Android/tree/master/RemoteBluetooth" rel="nofollow">here</a> in Github.</p>
|
android
|
[4]
|
106,041 | 106,042 |
List adapter display text vs. saved text
|
<p>what I have now is a listView with 3 items in it: Audience, Choosing topics, and Interviewing strategies. I want to be able to save these items as strings to open url with associated item name in the path, but the problem comes when the path has a different item name than the one I have in the listview items; we have Audience, Choosing_topics, and Interviewing as their names. How would I go about dealing away with this conflict in name without changing the names of the url or the listViewItem? Should I refer to another string array to compare the value of the first string array to to retrieve the associated item in the new array? Here's what I have as of now:</p>
<p>setListAdapter(new ArrayAdapter(this, R.layout.list_item, GREATESTHITS));
ListView lv = getListView();
lv.setTextFilterEnabled(true);</p>
<pre><code> lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
String text = (String) ((TextView)view).getText();
((GlobalVariables)getApplication()).setGlobalVariable(text);
String str = DownloadText("http://www.jmu.edu/uwc/" + text + ".html");
static final String[] GREATESTHITS = new String[] {"Audience", "Choosing topics", "Interviewing Strategies"};
</code></pre>
|
android
|
[4]
|
2,729,244 | 2,729,245 |
Pulling an array from resource file to populate list in android
|
<p>I'm working through the listbox building example and wanted to alter it to pull an array from the arrays file (going on the separation of code and data thing)</p>
<p>So instead of declaring the array within the class like so</p>
<pre><code>private static final String[] items={"A", "B", "C","D", "E", "F"};
</code></pre>
<p>I have a string array in r.arrays.xml called exercises</p>
<pre><code><resources>
<array name="exercises">
<item>Kettlebells - Swing, Two handed</item>
<item>Kettlebells - Swing, One handed</item>
<item>Kettlebells - Squat"</item>
<item>Kettlebells - Deadlift"</item>
<item>"Kettlebells - Lunge"</item>
<item>"Kettlebells - Press</item>
</array>
</code></pre>
<p>Replaced the existing</p>
<pre><code>setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, items));
</code></pre>
<p>with</p>
<pre><code>setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, R.array.exercises));
</code></pre>
<p>However, the list doesn't seem to get populated with the array</p>
<p>All help appreciated (from a slightly confused beginner programmer)</p>
|
android
|
[4]
|
3,212,774 | 3,212,775 |
Add Project Reference vs Add DLL Reference
|
<p>I am newbie in .net.Today I have created a sample. In that sample, I have stored data in database using N Tier architecture. If I want to use to Use BL or DAL method in other project(I mean BL method in UI or DAL method in BL), I found two ways.</p>
<p><strong>First one is</strong> - Right click on project << Add Reference << Select Project in Project tab</p>
<p><strong>Second one is</strong> - Right click on project << Add Reference << Select DLL in Browse tab</p>
<p>Could anyone tell me that is there any difference between both of them as both works same.Is DLL way better then Project Reference.If yes, then what is the benefits?</p>
<p>Thanks in advance.</p>
<p>Regards,
Mohit Kumar. </p>
|
asp.net
|
[9]
|
304,654 | 304,655 |
Moving text in tableview cell iphone
|
<p>I have table view cells with cell image and text label and detailed label.
Problem is cell image is too near to edge of cell(to the left). I want to put some space between edge and cell image. i.e. wants to move image bit away from corner. I have moved that with creating subview and putting image in that. But problem is it now overcome cell text and detailed text as well. I want to move cell text and detailed label to the right as well. </p>
<p>How can i do that?</p>
<p>For moving cell image, i am using below code:</p>
<pre><code>UIImageView *imageview=[UIImageView alloc]]init];
imageView.frame=CGRectMake(10,0,40,40);
[[cell.contentView]addsubview:imageView];
</code></pre>
<p>But i want to move text and detailed text label as well. </p>
|
iphone
|
[8]
|
1,318,129 | 1,318,130 |
Expand text field when text gets close to the end
|
<p>I want to make the textfield expand when the text nearly gets to the end, it works but when i type the first letter in it shrinks and then it expands </p>
<p>i.e <a href="http://jsfiddle.net/Y3rMM/" rel="nofollow">http://jsfiddle.net/Y3rMM/</a></p>
<p>How can i keep the textfield the same size until it reaches the end and expands</p>
<p>i.e so when i type my first letter it does not shrink but it stays the same size </p>
<pre><code>//HTML
<input type="text"/>
//JQUERY
$(document).ready(function(){
$("input").keyup(function(){
contents = $(this).val();
charlength = contents.length;
newwidth = 10 + (charlength*10);
$(this).css({width:newwidth});
});
});
</code></pre>
|
jquery
|
[5]
|
5,085,664 | 5,085,665 |
Extending Linenarlayout height
|
<p>I have problem in displaying content in Linearlayout,how to extend layout height.when large number layout used for displaying content..</p>
|
android
|
[4]
|
5,940,422 | 5,940,423 |
How to convert .live to .on in jQuery
|
<p>I want to convert <code>.live</code> to <code>.on</code> method as <code>.live</code> is not used much but I am not able to convert it. Please help me to change it.</p>
<pre><code>$(".delete").live('click', function () {
var id = $(this).attr('id');
var b = $(this).parent().parent();
var dataString = 'id=' + id;
if (confirm("Sure you want to delete this update?")) {
$.ajax({
type: "POST",
url: "delete.php",
data: dataString,
cache: false,
success: function (e) {
b.hide();
e.stopImmediatePropagation();
}
});
return false;
}
});
</code></pre>
|
jquery
|
[5]
|
5,303,805 | 5,303,806 |
I cam I execute mysql functions eg $=mysql_num_raws($result) on $result on wampp? On Xampp I am doing fine
|
<pre><code>function exesql($database,$database_user,$data_password,$sql)//returns result of execution of a suplied sql
{
$con = mysql_connect("localhost",$database_user,$data_password);
mysql_select_db($database,$con);
$result = mysql_query($sql);
mysql_close($con);
return $result;
}
</code></pre>
<p>$result=exesql($database,$database_user,$data_password,$sql="SELECT * FROM tean");</p>
|
php
|
[2]
|
822,871 | 822,872 |
Unable to build Eclipse library projects after ADT update
|
<p>I have a main project (mainapp) I am developing for Android under Eclipse. It uses the facebook-android-sdk library (fblib) which is a separate Eclipse project with it's project properties checked as "Library". Under the project properties > android section for mainapp, I have fblib added as a library. everything works fine. </p>
<p>I needed to create a new version of mainapp which uses different database files (assets subdirectory). To do this, I created a new Eclipse project (newapp) and setup mainapp as a library under project properties > android. </p>
<p>Everything was working fine until the latest ADT update. I am getting errors trying to build/run newapp (Conversion to Dalvik format failed with error 1). If I go to mainapp and uncheck "Library" from project properties > android, I can build mainapp as a regular application and it seems to work just fine.</p>
<p>I've searched for multiple jar files in project directories, updated proguard to 4.8beta, deleted/added jars to the build path, removed exports, added exports, deleted dependencies, added "lib" directories, cleaned, restarted, rebooted and pretty much anything else google would turn up, but to no avail. </p>
<p>It was all working fine with ADT 16 so I'm really confused here. Has adding a library project to an application, which also incorporates a library project, become somehow deprecated? I just can't seem to get this working.</p>
|
android
|
[4]
|
5,420,409 | 5,420,410 |
Can I add a variable value to a passed function parameter in php?
|
<p>I have the following variable:</p>
<pre><code>$argument = 'blue widget';
</code></pre>
<p>Which I pass in the following function:</p>
<pre><code>widgets($argument);
</code></pre>
<p>The widgets function has two variables in it:</p>
<pre><code>$price = '5';
$demand ='low';
</code></pre>
<p>My questions is how can I do the following:</p>
<pre><code> $argument = 'blue widget'.$price.' a bunch of other text';
widgets($argument);
//now have function output argument with the $price variable inserted where I wanted.
</code></pre>
<ul>
<li>I don't want to pass $price to the function</li>
<li>price is made available once inside the function</li>
</ul>
<p>Is there any sound way I can do this or do I need to rethink my design?</p>
|
php
|
[2]
|
5,617,478 | 5,617,479 |
Android: How do I get file's last modification date?
|
<p>The application need write file's last modification date.</p>
<pre><code> void Dater(String DateFile) {
File file = new File(DateFile);
if(file.exists()){
Long lastModified = file.lastModified();
Date date = new Date(lastModified);
textView2.setText(String.valueOf(date));
}
}
</code></pre>
<p>But textView2 is empty.
The file is ok (I open it).</p>
<pre><code>Dater("n" + String.valueOf(itemname)+".txt");
</code></pre>
|
android
|
[4]
|
4,481,964 | 4,481,965 |
Remove curly bracket from a string
|
<p>I have a string as :</p>
<pre><code> $string={"name":"simon","age":"23"}
</code></pre>
<p>I want to remove the curly bracket from the string.Output should be like this :</p>
<pre><code>$string="name":"simon","age":"24"
</code></pre>
|
php
|
[2]
|
5,003,672 | 5,003,673 |
Tree panel error in extjs4
|
<p>In ExtJS4, a tree panel was created with Ext.tree.Panel. When it is clicked multiple times (around 8 to 16) to expand or collapse the tree nodes, It gives error 'event' is null or not an object at line 10708 of ext-all-debug.js. On each click it creats another node below the clicked one. This problem is seen only in IE 8 where as same code are working fine in FirFox. Can anyone fix this issue please?</p>
|
javascript
|
[3]
|
684,419 | 684,420 |
weird php behaviour with classes and static methods
|
<p>I maintain an application that uses a (to me) surprising PHP quirk/bug/feature. Consider this code:</p>
<pre><code><?php
class Bar {
// called statically
public function doStuff() {
print_r($this);
}
}
class Foo {
public function main() {
Bar::doStuff();
}
}
$foo = new Foo();
$foo->main();
</code></pre>
<p>Running on PHP 5.2.x, the output is: </p>
<pre><code>Foo Object ( )
</code></pre>
<p>That means, although <code>Bar::doStuff()</code> is called statically, it still has access to <code>$this</code> where <code>$this</code> is a reference to the object that called <code>Bar::doStuff()</code>. Never came across that behaviour until recently. Quite evil to rely on this in production code if you ask me.</p>
<p>If you add a <code>static</code> and change the method signature to <code>public static function doStuff()</code> it throws a <code>E_NOTICE: Undefined variable: this</code> - which seems right to me.</p>
<p>Anyone has an explanation for this behaviour?</p>
|
php
|
[2]
|
3,446,955 | 3,446,956 |
Android drawable folders clarification
|
<p>I got images prepared for 7 inch and 10 inch tablets now i want to put them into corresponding drawable folder.I have searched some sources and got some information that both 7inch and 10inch tablets densities are <strong>mdpi</strong>. I can't put both images of different resolution on the same mdpi folder.Can anybody suggest me some idea on how to proceed the problem.</p>
|
android
|
[4]
|
4,204,134 | 4,204,135 |
How should I be reading this code?
|
<p>So I'm trying to read this legacy code - am I reading this wrong, or is the code repeating itself multiple times? It seems like it is assigning $cuid multiple different times in multiple different ways - is it getting different values somehow? The only two ways I can see are via cookie and via GET request.</p>
<pre><code>$id = "";
$cuid = "";
session_start();
if (isset($_SESSION['id'])) {
$id = $_SESSION['id'];
$cuid = $id;
$valid_user = $_SESSION['valid_user'];
$cuname = $_SESSION['cuname'];
$website = $_SESSION['website'];
$site = $website;
$email_contact = $_SESSION['email_contact'];
}
$cuid = $_GET['cuid'];
include_once("dbfunctions.php");
if (isset($_SESSION['id'])) {
$cuid = $_SESSION['id'];
} elseif (isset($cuid)) {
$_SESSION['id'] = $cuid;
}
</code></pre>
<p>EDIT: Ok, now how would I have it use $_GET['cuid'], if $_GET['cuid'] had a value, no matter what. Basically, several sites use this, and we want a user to be able to navigate from several of them, and get a different logo each time, but if they don't navigate from other sites, to keep the same logo throughout their experience.</p>
<p>I would just check to see if $_GET['cuid'] had a value, and if it did, to do nothing else, correct, but if it did not, check for a $_SESSION['id']. Am I on the right path?</p>
|
php
|
[2]
|
5,355,970 | 5,355,971 |
Emulate Array Objects
|
<p>Question from Object-Oriented JavaScript book: <strong>Imagine Array() doesn't exist and the array literal notation doesn't exist either. Create a constructor called MyArray() that behaves as close to Array() as possible.</strong></p>
<p>I thought it would be a good challenge to test my skills. This is what I came up with, but it doesn't work and is very incomplete.. I am a bit stumped:</p>
<pre><code>function MyArray(){
// PRIVATE FIELDS -----------------------
var initialData = arguments;
var storage;
// PRIVATE METHODS ----------------------
function refresh(){ //this doesn't work :(
for(var i = 0; i < storage.length; i++){
this[i] = storage[i]
}
};
function initialize(){
storage = initialData;
refresh();
}
function count(){
var result = 0;
for(var item in this){
//console.log(item, parseInt(item), typeof item);
if(typeof item == 'number'){
result++;
}
}
return result;
};
initialize();
// PUBLIC FIELDS -------------------------
this.length = count();
// PUBLIC METHODS ------------------------
//todo:
this.push = function(item){
refresh();
}
this.pop = function(){}
this.join = function(){}
this.toString = function(){}
}
var c = new MyArray(32,132,11);
console.log(c, c.length);
</code></pre>
<p>This isn't for any production code or any project.. just to try to learn JavaScript a lot more. Can anyone try to help me with this code?</p>
|
javascript
|
[3]
|
1,842,120 | 1,842,121 |
How to iterate on GridLayout cells?
|
<p>I would like to iterate programmatically over a GridLayout cells, the iteration should be applied on the layout bounds, where each cell contains an ImageButton, i understand that the layout is a mix of LinearLayout and TableLayout.</p>
<p>Is there a way to iterate over the GridLayout cells?</p>
<p>Or, what is the equivalent code to pseudo : View v <- layout[i][j] ?</p>
|
android
|
[4]
|
2,326,298 | 2,326,299 |
Cannot understand how add operation works on decimal numbers in javascript
|
<p>I have always been coding in java and have recently started coding in javascript (node.js to be precise). One thing that's driving me crazy is add operation on decimal numbers;</p>
<p>Consider the following code</p>
<pre><code>var a=0.1, b=0.2, c=0.3;
var op1 = (a+b)+c;
var op2 = (b+c)+a;
</code></pre>
<p>To my amazement I find out <code>op1 != op2</code> ! console.logging op1 and op2 print out the following:</p>
<pre><code>console.log(op1); 0.6000000000000001
console.log(op2); 0.6
</code></pre>
<p>This does not make sense. This looks like a bug to me because javascript simply cannot ignore rules of arithmetic. Could someone please explain why this happens?</p>
|
javascript
|
[3]
|
5,430,687 | 5,430,688 |
Ajaxify not working?
|
<p>So I have the latest jQuery loaded. I've loaded Ajaxify. I gave the links the class of ajaxify and a target, but nothing happens?? I just don't know where to look anymore. Any suggestions? <a href="http://www.heinesiebrand.nl/demo/" rel="nofollow">Here's the link with source</a>.</p>
<p>Is it maybe because of Wordpress?</p>
|
jquery
|
[5]
|
4,463,296 | 4,463,297 |
image is to be aligned in right of a long text
|
<p>I have a long single text and image, and I have to align image to the left of text in a way like text is wrapping the image means when image height finished then text should start from left like there is no image problem is that blank space of image width is left through out the screen in the left side. how to break text to write it from left after image height finish. </p>
|
android
|
[4]
|
5,367,022 | 5,367,023 |
Conditionally trigger a full page postback from a link button inside an update panel
|
<p>How do I conditionally trigger a full page postback from a link button inside of an update panel?</p>
<p>I have a custom control that contains its own updatepanel with a link button nested inside of it. When the link button is pressed I want its event handler to have the option of either letting the control update as normal or doing a full postback on the page.</p>
<p><strong>Here is the control hierarchy:</strong></p>
<pre><code>Page
Custom Control
UpdatePanel
LinkButton
</code></pre>
<p><strong>Event handler Pseudo code:</strong></p>
<pre><code>LinkButton Click Handler Begin
If is a partial post back AND a full postback is needed
Page.DoFullPostback
End If
End Handler
</code></pre>
<p><strong>Note:</strong> I aways need the partial postback to happen. I was considering injecting a <code>__DoPostback</code> in the controls markup but this seems hacky to me.</p>
<p>Thanks for your help!</p>
|
asp.net
|
[9]
|
5,684,350 | 5,684,351 |
How to create a new activity and then display text in it with android programming
|
<p>I managed to have a button and then when I click on it, I go to a new activity that is called "TUTORIALONE"</p>
<p>and then I want to display some text in this new activity</p>
<p>so I have something like this</p>
<pre><code> Button b = (Button) findViewById(R.id.tutorial1);
b.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
startActivity(new Intent("my.android.TUTORIALONE"));
TextView tv = (TextView)findViewById(R.id.tutorial1);
tv.setText("this is some text);
}
});
</code></pre>
<p>the problem is that it first displays the text on my button, and then it shows me the new activity, how would I achieve displaying the text on the new activity?</p>
<p>thanks in advance</p>
|
android
|
[4]
|
4,027,159 | 4,027,160 |
CALL_PHONE vs CALL_PHONE_PRIVLEGED
|
<p>What is difference between permissions CALL_PHONE and CALL_PHONE_PRIVLEGED. After reading there definitions it appears they do more or less the same things.</p>
<p>CALL_PHONE: Allows an application to initiate a phone call without going through the Dialer user interface for the user to confirm the call being placed. </p>
<p>CALL_PRIVILEGED: Allows an application to call any phone number, including emergency numbers, without going through the Dialer user interface for the user to confirm the call being placed. </p>
<p>Can someone please explain the minute difference between the two?</p>
|
android
|
[4]
|
2,394,999 | 2,395,000 |
Android - Share browser url to app
|
<p>I am writing an app for a community, which has the ability to share URLs.</p>
<p>In the android browser, there is the possibility to forward URLs, for example from my HTC Desire to a BlueTooth Target, to Facebook, to Friend Stream, to Google Mail, to Google+, Mail, SMS and Peep. What I want to achive is to add my app into that list, providing functionality to forward the current URL from the Browser to the App, regardless on which webpage I am currently.</p>
<p>How do I achive that?</p>
|
android
|
[4]
|
6,002,312 | 6,002,313 |
Change background color when slideToggle back?
|
<p>When I click on a element to slideToggle some other elements, I also change the background color of the element that I clicked on to indicate that this is the selected. But how do I remove the background color when I click and slideToggle back the elements?</p>
<pre><code>$(".c756:eq(0)").click(function(){
$(".c756:eq(0)").css('background-color','yellow');
$("#wrapper_datorpaket").slideToggle();
});
</code></pre>
|
jquery
|
[5]
|
2,501,079 | 2,501,080 |
Jquery failing to detect change in select in IE7&8 but works in FF
|
<p>I can get this to run in IE9 and FF but does not work in IE7&8 can anybody point me in the right direction. Any ideas what to look out for?</p>
<p>JQuery</p>
<p></p>
<pre><code>$(document).ready(function() {
$('#page').change(function(){
alert('--not-calling-in-IE8-or-IE7-Mode-Works-Fine-In-FF-');
var url = 'galleryoptions.php?page=' + $('#page option:selected').val();
$.getJSON(url, function(j){
var options = '<option value="0">None</option>';
for (var i = 0; i < j.length; i++) {
options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
}
$("#proj").html(options);
});
});
});
</code></pre>
<p>HTML</p>
<pre><code><label for="page" style="margin-top:10px;padding:2px; margin-left:-15px;">P&aacute;gina</label>
<select id="page" name="page" type="text" style="width:135px; margin-top:8px;margin-bottom:8px;padding:2px; margin-left:10px;">
</code></pre>
<p>What I have tried:</p>
<p>I placed an onchange on the select and called an alert and it worked.
I placed an onchange on the select and called a function which never worked.</p>
<pre><code><select id="page" name="page" type="text" onchange="alert('This works')">
function dofn(){
alert('This fails')
}
<select id="page" name="page" type="text" onchange="dofn();">
</code></pre>
<p>Any ideas?</p>
|
jquery
|
[5]
|
665,892 | 665,893 |
Implementation of barrier in Java
|
<p>How can a barrier be implemented <strong>with semaphores</strong> in Java. Will the following pseudo code work? How can it be written using java Semaphore class.</p>
<p><code>N</code> is the number of threads to be waited for at the barrier.
<code>EveryoneHasReachedBarrier</code> is a conditional variable.</p>
<pre><code>Aquire(mutex)
m = m + 1;
if(m != N)
{
Release(mutex);
Aquire(EveryoneHasReachedBarrier);
}
else
{
m = 0;
Release(mutex);
for(i=0; i<N; i++)
{
Release(EveryoneHasReachedBarrier);
}
}
</code></pre>
|
java
|
[1]
|
3,478,529 | 3,478,530 |
unset session php
|
<p>According to the manual "Do NOT unset the whole $_SESSION with unset($_SESSION) as this will <strong>disable the registering of session variables</strong> through the $_SESSION superglobal."</p>
<pre><code><?php
session_start();
$_SESSION['name'] = 'my_name';
unset($_SESSION);
echo $_SESSION['test'] = 'ok';
</code></pre>
<p>So according to the manual, the above code should not register the last statement. But the code outputs the string 'ok'. What is going on here? </p>
|
php
|
[2]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.