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 |
---|---|---|---|---|---|
510,559 | 510,560 |
Filtering integers out of python command line arguments
|
<p>so I wrote a program and I want to pass it either a filename and an integer or just an integer. Whats the best way to determine which argument is the integer? This is what I have:</p>
<pre><code>import sys
if len(sys.argv) > 1):
for e in sys.argv:
try:
bio = map(e, int)
except:
pass
</code></pre>
<p>thanks in advance</p>
|
python
|
[7]
|
3,578,298 | 3,578,299 |
Missing Locales in Java?
|
<p>I've found a number of missing countries in java locales- If I print out a list of available locales, </p>
<pre><code>TreeSet< String > m = new TreeSet< String >();
for ( Locale l : Locale.getAvailableLocales() ) {
m.add( l.getDisplayCountry() );
}
for ( String s : m ) {
System.out.println( s );
}
</code></pre>
<p>I'm missing a number of countries, including Nigeria, Iran, Kyrgyzstan, and Pakistan. Can anyone shed any light on this, or is there a better(more comprehensive) way of getting a country list in java?</p>
<p>1.6.0_16-b01</p>
|
java
|
[1]
|
2,783,325 | 2,783,326 |
How can I make use of PHP data cache in export to csv or txt
|
<p>What is the advantage of PHP data cache ?</p>
<p>Where i can use that , is it good only for browser search or</p>
<p>it is good for data export to csv or text also .</p>
<p>How can i achieve data cache using PHP?</p>
|
php
|
[2]
|
4,676,157 | 4,676,158 |
Attribute value is URI encoded on set
|
<p>I want to set an <code>attribute</code> of a DOM element using <code>element["attribute"]</code>, but the value is <code>URI encoded</code>. For instance, if the value is <code>q=test&r=123&s=456</code> and after I append it into the DOM, the value becomes <code>q=test&amp;r=123&amp;s=456</code>.</p>
<p>Now, view <b>RENDERED source</b>, or <b>Copy HTML</b> of the script tag using Firebug...</p>
<p><em>Please copy paste the code below on a new HTML file for your valuable investigation.</em></p>
<pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<a href="javascript: injectTag();">Inject Tag</a>
<div id="status"></div>
<script>
var injectTag = function () {
var scriptTag = document.createElement("script");
scriptTag["src"] = "http://www.google.com/search?q=US+Geological+Survey&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a";
scriptTag["type"] = "text/javascript";
var head = document.getElementsByTagName("head")[0];
head.appendChild(scriptTag);
document.getElementById("status").innerHTML = "Now, view <b>RENDERED source</b>, or <b>Copy HTML</b> of the script tag using Firebug...";
}
</script>
</body>
</html>
</code></pre>
<p><em>With thanks and Regards,<br>
Munim</em></p>
|
javascript
|
[3]
|
5,852,468 | 5,852,469 |
phpfox ;_How to give href to variable in php
|
<p>I want to display the variable with hyperlink. Does anyone know how to give? I have applied the below method for href:</p>
<pre><code><div style="width:50px;height:20px;float:right">
<a href="#" onclick="$.ajaxCall('forum.UnFlag', 'user_id={$aThread.user_id} &thread_id={$aThread.thread_id} &rate_value=i', 'GET'); return false;">
<button class="button" name="val[button]" value="">$i </button>
</a>
<?php
for ($i=0; $i <= 10; $i++)
{
echo "The number is ".$i."<br />";
}
?>
</div>
</code></pre>
<p>if you need anything regarding this ask me..</p>
|
php
|
[2]
|
5,363,088 | 5,363,089 |
how to Disable multiple selected dropdown values in javascript
|
<p>I have one add button if i click it then it generates one new line having one dropdown(Multiple selection allowed) ,now if i ve selected some value in the dropdown next time if i press add button again it will generate
the same dropdown in a new line but i want user should not able to select the previously selected items in the newly created dropdown.i.e each and every dropdown should have unique values selected.</p>
<pre><code><select multiple="true" id="mySelect[0]">
<option value="1" >Apple</option>
<option value="2">Pear</option>
<option value="3">Banana</option>
<option value="4">Orange</option>
</select>
<select multiple="true" id="mySelect[1]">
<option value="1" >Apple</option>
<option value="2">Pear</option>
<option value="3">Banana</option>
<option value="4">Orange</option>
</select>
<select multiple="true" id="mySelect[2]">
<option value="1" >Apple</option>
<option value="2">Pear</option>
<option value="3">Banana</option>
<option value="4">Orange</option>
</select>
</code></pre>
<p>if apple,pear is seleted in the 1st drop down then in next two dropdown apple option should be disabled and colored with red.</p>
|
javascript
|
[3]
|
1,909,564 | 1,909,565 |
Converting back from toString to Object
|
<p>Is there any way to convert from toString back to the object in Java?</p>
<p>For example:</p>
<pre><code>Map<String, String> myMap = new HashMap<String, String>();
myMap.put("value1", "test1");
myMap.put("value2", "test2");
String str = myMap.toString();
</code></pre>
<p>Is there any way to convert this String back to the Map?</p>
|
java
|
[1]
|
3,900,847 | 3,900,848 |
Is there any way to exit the application when home button is pressed on Android?
|
<p>I want to kill the app when user presses the home button. Is there any way to do this on Android?</p>
|
android
|
[4]
|
2,850,044 | 2,850,045 |
#ifdef in C#
|
<p>I would like to do the below but in C# instead of C++</p>
<pre><code>#ifdef _DEBUG
bool bypassCheck=TRUE_OR_FALSE;//i will decide depending on what i am debugging
#else
bool bypassCheck = false; //NEVER bypass it
#endif
</code></pre>
|
c#
|
[0]
|
955,409 | 955,410 |
Gathering data from other website via an api
|
<p>Let's start with some quick info. I am a student doing an internship at a semi-big company as a web developer. Now I got an assignment to find a way to make scraping of websites cleaner.</p>
<p>This company hosts a pretty big website (at least, they hope to get big) and have a page where you can see info from other websites that sponsor them in a way, this is done via scraping. Since the scraping is kinda error sensitive they want to collaborate with the other companies and offer a easy, universal way to supply data to us so we can show it on the website, so the scraping doesn't error and it is done in a 'smart' way.</p>
<p>As a example I got <a href="http://www.openarchives.org/pmh/" rel="nofollow">this</a>, it's a protocol that was last updated in 2002, so I don't know if it's too old. Also, I can't find any info on how to actually use it, only about how it works, which is a little odd to me.</p>
<p>I hope there is someone who can push me in the right direction because I'm stuck and I have limited time at this company to actually achieve something.</p>
|
php
|
[2]
|
1,484,858 | 1,484,859 |
dateFromString returning wrongDate
|
<p>I am converting an NSString like @"12:25 AM May 27 2011" into NSDate.But as I convert it using the following code</p>
<pre><code>NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"hh:mm a MMM dd YYYY"];
NSDate *date = [[dateFormatter dateFromString:@"12:25 AM May 27 2011"] copy];
[dateFormatter release];
</code></pre>
<p>I get the wrong Date as 2010-12-25 19:25:00 +0000</p>
<p>Can anyone please help me around here</p>
|
iphone
|
[8]
|
5,191,405 | 5,191,406 |
how to define a data source method
|
<p>How to define data source method.</p>
|
iphone
|
[8]
|
5,036,814 | 5,036,815 |
How the int.TryParse actually works
|
<p>I've looked for int.TryParse method implementation, how it works actually, but I haven't found. I have to know, about a string, whether it's a numeric value, but I don't want to convert it at the this time.
So I need only the bool result from tryparse. So the questions are:</p>
<p>1, Is there any function wich can provide only the bool result,
and </p>
<p>2, I'd like to know, how the tryparse actually works (is there a try catch inside or iterates through the characters of input string)?</p>
<p>Thanks for the answers!</p>
|
c#
|
[0]
|
1,723,040 | 1,723,041 |
Is ASP.NET still worth learning or is it being replaced by frameworks like JQuery
|
<p>We have been using ASP.NET for a big project for > 5 years.
Recently, we find that JavaScript is a preferred way of rendering data on the page.
So I would like to ask if others are also moving in the direction of JavaScript / WebServices / JSON and thus ASP.NET is becoming irrelevant ?</p>
<p>Also, does anybody ever use ASP.NET Server Controls or is it completely obsolete by now ?</p>
<p>Thanks !</p>
|
asp.net
|
[9]
|
2,026,747 | 2,026,748 |
How to export the contents of the string or textbox to txt file that remains the same format (If string has 5 lines, txt file will has 5 lines)?
|
<pre><code>if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
FileInfo Myfile = new FileInfo(saveFileDialog1.FileName);
StreamWriter wri = Myfile.CreateText();
wri.WriteLine(Richtextbox.Text);
wri.Close();
}
</code></pre>
<p>When I export to a text file, all the lines in richtextbox stick into one line. I donnot know how to keep file txt'content same as in richtextbox'content. </p>
|
c#
|
[0]
|
3,464,410 | 3,464,411 |
How do you get JQuery to wait until an effect is finished?
|
<p>I am sure I read about this the other day but I can't seem to find where. I have a fadeOut event after which I remove the element and JQuery is removing the elemnt before it has a chance to finish fading out. What is the solution to this again?</p>
|
jquery
|
[5]
|
5,002,037 | 5,002,038 |
jQuery .val() returns empty string
|
<p>It feels like jQuery is messing with me, although it's probably a simple issue. My code get's to the DOM-element that i want to get the value of, but when i add .val() it returns an empty string.</p>
<pre><code>$('tr.invoice td[data-attr=Payed] div.true').closest('tr').find('td[data-attr=Expiration]')
Returns this:
[<td data-attr=​"Expiration">​2012-04-22​</td>​,<td data-attr=​"Expiration">​2012-05-21​</td>​,<td data-attr=​"Expiration">​2012-06-18​</td>​]
</code></pre>
<p>As you can see the DOM-elements has values, but if i add .val() to the JS-string it returns empty strings only (not undefined, empty)</p>
|
jquery
|
[5]
|
1,249,063 | 1,249,064 |
Reverse of number in PHP not showing correct output
|
<p>I have made a program to reverse the number but every time <code>0</code> gets appended to the result.</p>
<pre><code>$num = 675;
$rev = 0;
while($num > 0) {
$temp = $num % 10;
$rev = ($rev * 10) + $temp;
$num = (int) $num / 10;
}
echo $rev; //result is 5760
</code></pre>
|
php
|
[2]
|
5,988,730 | 5,988,731 |
Animating from offscreen with TranslateAnimation causes adjacent view to be clipped
|
<p>Right now I have a view that I'm just popping onto the screen by changing the view from GONE to VISIBLE, and I instead want to have a TranslateAnimation that shifts the view onto the screen. As soon as the animation starts the view on the right becomes clipped though. I assume this is because the parent view is taking the width of the view on the left and factoring that into the view calculation? Is there any way to not have that happen, so it looks like both views are shifting onto and off of the screen? Setting </p>
<pre><code>android:clipChildren="false" android:clipToPadding="false"
</code></pre>
<p>didn't seem to help</p>
|
android
|
[4]
|
3,933,246 | 3,933,247 |
java apache poi importing into netbeans 6.9
|
<p>i downloaded apache.poi-src-3.7-20101029.zip and i want to use this package in my java application using netbeans 6.9 to get use of doc files.</p>
<p>How to configure that zip file into netbeans to get use of the package into java application</p>
|
java
|
[1]
|
4,506,989 | 4,506,990 |
Why can't I appendChild to the specified DIV?
|
<p>In some cases it is possible for me to use appendChild() to add to a div, but in other cases it does not work and I am trying to understand why:</p>
<p><strong>Works:</strong> I have other code examples where something like the following code works fine:</p>
<pre><code>function fnAppend(){
var oNewNode = document.createElement("LI");
oList.appendChild(oNewNode);
oNewNode.innerText="List node 5";
}
</code></pre>
<p><strong>Does not Work:</strong> I know this is a totally different example, but I presume the difference is subtle. I am pulling this code from an existing project I am working in, so I can not change the <strong>FieldSet function</strong> in anyway, rather I am trying to understand how to make it work. </p>
<pre><code><html>
<head>
<script type="text/javascript">
function Fieldset() {
this.id = "";
this.content = document.createElement("DIV");
this.content.id = "content";
this.title = "Title";
this.getFieldset = function() {
var div = document.createElement("DIV");
div.id = this.id;
var span = document.createElement("SPAN");
//var fieldset = document.createElement("DIV");
//fieldset.id = "fieldset";
var header = document.createElement("DIV");
header.id = "header";
span.appendChild(document.createTextNode(this.title));
header.appendChild(span);
div.appendChild(header);
div.appendChild(this.content);
//div.appendChild(fieldset);
return div;
}
}
var fieldset = new Fieldset();
fieldset.id = "newid";
fieldset.title = "new title";
org_div1.appendChild(fieldset.getFieldset());
</script>
</head>
<body onload="fieldset()">
<div id='org_div1'> The text above has been created dynamically.</div>
</body>
</html>
</code></pre>
|
javascript
|
[3]
|
5,005,751 | 5,005,752 |
PHP get first few charactors and remove from string
|
<p>Does anyone know how to remove the first few characters from a string and remove them in PHP.</p>
<p>Like in the string "str_filename" I need to remove the "str_" and save the "filename".</p>
<p>But it has to remove as many charactors as it takes to get to the "_".</p>
<p>In other words, i need to remove all the characters up until and including the first "_" in the string.</p>
|
php
|
[2]
|
1,785,548 | 1,785,549 |
android - How to integrate magnifying glass to my app
|
<p>I want to integrate "magnifying glass" in my android app.The Magnifying glass should appear when long pressed on a certain point on image then particular part of image should appear in magnifying glass with zooming that touched area.I searched many websites about this magnifier but i don't found any useful link/data about magnifying glass. Is it possible to implement in android? </p>
|
android
|
[4]
|
5,031,966 | 5,031,967 |
outlook start time to java calendar?
|
<p>How to change the outlook start time to java calendar</p>
<p>In outlook I set start time = Tue 7/13/2010 5:00 p.m. When i parse the ics file it gives the data like this </p>
<pre><code> ......
BEGIN:VEVENT
DTSTART:20100713T113000Z
DTEND:20100714T120000Z
........
..........
</code></pre>
<p>i have to set start time to google calendar's event add start time.How to make this time to java calendar time</p>
|
java
|
[1]
|
5,634,893 | 5,634,894 |
Retrieve Button value with jQuery
|
<p>A simple one, I'm trying to retrieve the value attribute of a button when its been pressed using jQuery, here's what I have:</p>
<pre><code><script type="text/javascript">
$(document).ready(function() {
$('.my_button').click(function() {
alert($(this).val());
});
});
</script>
<button class="my_button" name="buttonName" value="buttonValue">
Button Label</button>
</code></pre>
<p>In Firefox my alert displays 'buttonValue' which is great but in IE7 it displays 'Button Label'.</p>
<p>What jQuery should I use to always get the button's value? Or should I be using a different approach?</p>
<p>Many thanks.</p>
<p>ANSWER:
I'm now using</p>
<pre><code><input class="my_button" type="image" src="whatever.png" value="buttonValue" />
</code></pre>
|
jquery
|
[5]
|
4,652,373 | 4,652,374 |
Efficiency: Creating an array of doubles incrementally?
|
<p>Consider the following code:</p>
<pre><code>List<double> l = new List<double>();
//add unknown number of values to the list
l.Add(0.1); //assume we don't have these values ahead of time.
l.Add(0.11);
l.Add(0.1);
l.ToArray(); //ultimately we want an array of doubles
</code></pre>
<p>Anything wrong with this approach? Is there a more appropriate way to build an array, without knowing the size, or elements ahead of time?</p>
|
c#
|
[0]
|
2,222,155 | 2,222,156 |
Find position and get before and after?
|
<pre><code>$x = "P-29042011386693";
$array = "P-28042011135870,P-28042011132333,P-28042011384621,P-29042011386693,P-29042011384190,P-29042011388434,P-29042011382454,P-29042011385512,P-29042011383902";
$array = explode(",", $array);
$count = count($array);
$search = array_search($x, $array);
if (($search > 0) && ($search < $count)){
$before = $array[$search-1];
$after = $array[$search+1];
}elseif ($search == 0){
$before = NULL;
$after = $array[1];
}elseif ($search == $count){
$before = $array[$count-1];
$after = NULL;
}
</code></pre>
<p>What is the best way to detect the value before $x and the value after $x, and display $before or $after as blank if there is no result before/after $x?</p>
<p>So if $x was P-29042011383902 - $after would be blank and $before would be P-29042011385512</p>
<p>If $x was P-28042011135870 $before would be blank and $after would be P-28042011132333</p>
<p>Is my code above right?</p>
|
php
|
[2]
|
5,776,997 | 5,776,998 |
Javascript file uploads
|
<p>Any alternate thing in javascript to make a file upload control ?</p>
<hr>
<p>actually the problem was, i am creating file upload control dynamically using htmlwriter, and when i use request.form[fileuplodctrl].tostring() , i am getting only the file name not path... </p>
<p>can any one suggest me any other ways to get full file path :)</p>
<p>Kishh</p>
|
javascript
|
[3]
|
3,970,565 | 3,970,566 |
How fix Fatal error: Out of memory (allocated ) (tried to allocate bytes) in php
|
<p>I read value of a file csv as:</p>
<pre><code> //$mypath . '/' . $filename <=> ../abc.csv
$val = file_get_contents($mypath . '/' . $filename);
$escaped = pg_escape_bytea($val);
$model->addFileImport($tmp, $data['email'], $escaped);
</code></pre>
<p>My file ia about 100MB.
In php.ini setting :
memory_limit = 128M</p>
<p>But it still show errort<code>:Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 133120 bytes) in...</code> at row: <code>$val = file_get_contents($mypath . '/' . $filename);</code> </p>
<p>I had fixed by add <code>ini_set('memory_limit', '-1');</code>: </p>
<pre><code> //$mypath . '/' . $filename <=> ../abc.csv
ini_set('memory_limit', '-1');
$val = file_get_contents($mypath . '/' . $filename);
$escaped = pg_escape_bytea($val);
$model->addFileImport($tmp, $data['email'], $escaped);
</code></pre>
<p>But it show error :<code>Fatal error: Out of memory (allocated 230686720) (tried to allocate 657099991 bytes) in C:\wamp\www\joomlandk\components\com_servicemanager\views\i0701\view.html.php on line 112</code> at row <code>$escaped = pg_escape_bytea($val);</code>
Why? How fix that error?</p>
|
php
|
[2]
|
4,562,333 | 4,562,334 |
what is the purpose of double implying?
|
<p>for example:</p>
<pre><code>const decimal dollars = 25.50M;
</code></pre>
<p>why do we have to add that <code>M</code>?</p>
<p>why not just do:</p>
<pre><code>const decimal dollars = 25.50;
</code></pre>
<p>since it already says <code>decimal</code>, doesnt it imply that <code>25.50</code> is a decimal?</p>
|
c#
|
[0]
|
654,813 | 654,814 |
why doesn't this code loop?
|
<pre><code>var fadeCounter = 0;
function fadeNext() {
window.fadeCounter++;
s = '#slide' + window.fadeCounter;
$(s).fadeIn(1000,fadeNext);
//forgive typos above, code works, what doesn't:
if (window.fadeCounter == 8) window.fadeCounter = 0;
//code will loop up to 8, then stop. why?
}
//initiate loop
fadeNext();
</code></pre>
<p><strong>edit:</strong></p>
<p>Demo added, at <a href="http://jsfiddle.net/AXRBh/2/" rel="nofollow">http://jsfiddle.net/AXRBh/2/</a>
In demo, loop should reset at 20 but halts. Why?</p>
|
jquery
|
[5]
|
5,080,215 | 5,080,216 |
Identifying App Installations
|
<p>so there a nice blog to Identifying App Installations using the following code</p>
<pre><code>public class Installation {
private static String sID = null;
private static final String INSTALLATION = "INSTALLATION";
public synchronized static String id(Context context) {
if (sID == null) {
File installation = new File(context.getFilesDir(), INSTALLATION);
try {
if (!installation.exists())
writeInstallationFile(installation);
sID = readInstallationFile(installation);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return sID;
}
private static String readInstallationFile(File installation) throws IOException {
RandomAccessFile f = new RandomAccessFile(installation, "r");
byte[] bytes = new byte[(int) f.length()];
f.readFully(bytes);
f.close();
return new String(bytes);
}
private static void writeInstallationFile(File installation) throws IOException {
FileOutputStream out = new FileOutputStream(installation);
String id = UUID.randomUUID().toString();
out.write(id.getBytes());
out.close();
}
}
</code></pre>
<p>in a different java class i have a WebView going to a URL as shown</p>
<pre><code>public class Notes extends Activity {
WebView mWebView;
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.timsnotes);
mWebView = (WebView) findViewById(R.id.webview3);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("http://www.somedomain.com/notes.php?phoneid=" + "sID" + "");
mWebView.setWebViewClient(new HelloWebViewClient());
}
</code></pre>
<p>but all it passes is the text sID. is there a uses-permission I'm missing to access the sID?</p>
|
android
|
[4]
|
5,519,850 | 5,519,851 |
jQuery error in using css function after get function
|
<p>It seems the syntax below is wrong because I am getting an error "css is not a function" in Firefox. What's the correct syntax? I am trying to add a css property to the first object in the set.</p>
<pre><code>$("div[id$='rvReport']").get(0).css("overflow", "auto");
</code></pre>
|
jquery
|
[5]
|
4,099,699 | 4,099,700 |
KEY CHAIN export for iphone sdk (puplic keys and privates key and certficates,...)
|
<p>I have all Key chain configuration details in my old laptop for the iphone sdk
now i have a new labtop to make my iphone development applications
how can i move all Key chain details to the new labtop
how the export,import works .</p>
<p>Many thanks,</p>
|
iphone
|
[8]
|
4,538,366 | 4,538,367 |
Can classes be referenced outside App_Code?
|
<p>I know this seems pretty basic, but I've been working with MVC for awhile and I'm not sure what works with asp.net. </p>
<p>Is it possible to organize code outside the App_Code directory or into separate projects? How would this be done?</p>
|
asp.net
|
[9]
|
4,252,756 | 4,252,757 |
getElementsByTagName returning strings
|
<p>My ultimate goal here is to get a list of radiobuttons and check/uncheck them. Here is my code:</p>
<pre><code> for (var radio in document.getElementsByTagName('input')) {
if(typeof (radio) != "string")
alert(radio);
}
</code></pre>
<p>The <code>alert</code> never gets called.</p>
<p>The call to document.getElementsByTagName returns a list of strings numbered from 0 to the length of the list, so all of their properties (type, id, etc) are undefined and I can't really do much with them.</p>
<p>Am I doing something wrong here? Why aren't objects being returned for these elements?</p>
<p>This is in firefox 4 and chrome, if that helps.</p>
|
javascript
|
[3]
|
2,127,622 | 2,127,623 |
which return comply with C++ standard
|
<pre><code>class A {};
class B
{
public:
B(const A& a, int i = 10) : m_a(a), m_i(i) {}
private:
int m_i;
A m_a;
};
B getB(void)
{
//return B(A()); // Method one
//return A(); // Method two
}
</code></pre>
<p>Both method one and method two pass the compilation of VS2010.</p>
<p><strong>Question 1</strong>> Which one is better?</p>
<p><strong>Question 2</strong>> Is it true that an implicit constructor supports more than one pass-in parameters if all except the first parameters have default values?</p>
<p>Thank you</p>
|
c++
|
[6]
|
5,776,050 | 5,776,051 |
I need the seekbar thumb in center of seekbar height
|
<p>I am using the one seek bar In my Application and I set the one custom drawable (shape) to set thumb. </p>
<p>Following is my drawable(seekbar_circle_normal.xml) code snippet : </p>
<p></p>
<pre><code><item>
<shape android:shape="rectangle" >
<solid android:color="#FDC300" />
<size
android:height="16dp"
android:width="16dp" />
<padding
/>
<corners
android:bottomLeftRadius="23dp"
android:bottomRightRadius="23dp"
android:topLeftRadius="23dp"
android:topRightRadius="23dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle" >
<corners
android:bottomLeftRadius="23dp"
android:bottomRightRadius="23dp"
android:topLeftRadius="23dp"
android:topRightRadius="23dp" />
<gradient
android:angle="270"
android:endColor="#33B7E7"
android:gradientRadius="1"
android:startColor="#33B7E7" >
</gradient>
<size
android:height="3dp"
android:width="3dp" />
<stroke
android:width="0.5dp"
android:color="#1DA6AE" />
</shape>
</item>
</code></pre>
<p></p>
<p>My xml file code as follows : </p>
<p></p>
<p>I wants to display the thumb in to the center of seek bar. How I can show this. </p>
<p>Thanks in advance.</p>
|
android
|
[4]
|
690,914 | 690,915 |
converting a Tree to newick format. java
|
<p>I'm having problems converting a binary rooted tree to newick format.
The full explanation for such a format can be found: <a href="http://code.google.com/p/mrsrf/wiki/NewickTree" rel="nofollow">http://code.google.com/p/mrsrf/wiki/NewickTree</a></p>
<p>An example of a newick format would be as follows:</p>
<p>for a tree T such as <a href="http://www.cs.mcgill.ca/~cs251/OldCourses/1997/topic8/images/completetreetwo.gif" rel="nofollow">http://www.cs.mcgill.ca/~cs251/OldCourses/1997/topic8/images/completetreetwo.gif</a>
the newick representation would be: (((8,9),(10,11)),((12,13),(14,15)))</p>
<p>the internal node will become the commas while the leaves will be retained.</p>
<p>such trees have internal nodes which will always have 2 children.</p>
<p>I have a problem using recursion to come out with this newick format.
The output contains far too many nodes and braces.</p>
<p>Any comments to resolve this problem is appreciated or even an iterative algorithm would be welcomed</p>
<p><code>
import java.util.Stack;</p>
<p>public class Tree {</p>
<p>....</p>
<pre>public String inOrderNewick(Node root, String output) throws ItemNotFoundException {
if (root.hasChild()) {
output += "(";
output += inOrderNewick(root.child1, output);
output += ",";
output += inOrderNewick(root.child2, output);
output += ")";
return output;
} else {
return root.getSeq();
}
</code></pre>
<p>}</p>
<p>
//edit: implemented the change as advised.
but the desired output for a tree is ((S3,(S1,S2)),(S4,S5))
where the actual output is (((S3,((S3,(S1,S2)),(((S3,((S3,(S1,S2)),(S4,S5))</p>
<p>This tells me that there are logic errors.
Perhaps there is a need to have flags?</p>
|
java
|
[1]
|
4,460,065 | 4,460,066 |
Android Intent for media player plays mp3 but does not display information(Title, Artist, Album Art)
|
<p>It is very easy to call an intent for the native Android Media Player to play an MP3 file. e.g.</p>
<pre><code>Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
Uri data = Uri.parse("file:///sdcard/bigTune.mp3");
intent.setDataAndType(data,"audio/mp3");
try {
startActivity(intent);
}
catch (ActivityNotFoundException e) {
e.printStackTrace();
}
</code></pre>
<p>The Problem is that when the player starts the file plays and the album art CD is blank and the player shows NO song Information.</p>
<p>If the same was to be done through a file manager like Astro file Manager, I would see the song Information (Title, Artist Album Art)</p>
<p>Is there any thing else that i need to know to add to the Intent or something else that I need to do to enable the Media Player to show the mp3's Info ???</p>
<p>Thanks is advance</p>
|
android
|
[4]
|
2,826,635 | 2,826,636 |
How to modify the framework to support muti-skin?
|
<p>How to modify the frmework to support muti-skin? The effect is like HTC desire HD which can change the skin dynamically. The skin is from a separate apk. Who can give me some precious advice? Thank you very much!</p>
|
android
|
[4]
|
807,648 | 807,649 |
Frame by Frame Animation Optimization
|
<p>I am getting an <code>OutOfMemoryException</code> when I try to load all the frames needed for a one-time animation. The frames (when combined) is about 1.5MB, each frame is 320x480 in size. It's a same picture across all frames, varying in size and position. I am wondering if i could just do the animation for the ImageView (only contains a static image) and not to animate it frame by frame. Please refer to the image below:</p>
<p><img src="http://i.stack.imgur.com/vYKIt.png" alt="enter image description here"></p>
|
android
|
[4]
|
5,531,579 | 5,531,580 |
How can I change the unselected item to selected item from dropdown list without using the iterator function in Jquery?
|
<p>How can I change the unselected item to selected item from dropdown list without using the iterator function in Jquery?</p>
|
jquery
|
[5]
|
2,767,076 | 2,767,077 |
Please help me to sort out this java.awt.BoxLayout can't be shared or NullPointerException
|
<p>The below code "Boxlayout example complies well but throws me the below exception at runtime:</p>
<pre><code>Exception in thread "main" java.lang.NullPointerException
at java.awt.Container.addImpl(Container.java: 1027)
at java.awt.Container.add(Container.java: 935)
at javax.swing.JFrame.addImpl(JFrame.java: 545)
at java.awt.Container.add(Container.java: 352)
at BoxExample.launchFrame(BoxExample.java:26)
at BoxExample.main(BoxExample.java:40)
</code></pre>
<p>Please help me out to sort out this as it wasted nearly 1 day of my life..</p>
<pre><code>//Boxlayout example
import java.awt.*;
import javax.swing.*;
public class BoxExample
{
public JFrame f;
public JButton b1, b2,b3,b4,b5;
public BoxExample()
{
f=new JFrame("Box example");
f.setTitle("Box Layout Example");
f.setSize(150, 150);
JButton b1=new JButton("Button 1");
JButton b2=new JButton("Button 2");
JButton b3=new JButton("Button 3");
JButton b4=new JButton("Button 4");
JButton b5=new JButton("Button 5");
}
public void launchFrame()
{
System.out.println("inside lf");
f.setLayout(new BoxLayout(f,BoxLayout.Y_AXIS));
System.out.println("after layset");
f.add(b1);
f.add(b2);
f.add(b3);
f.add(b4);
f.add(b5);
f.pack();
f.setVisible(true);
}
public static void main(String args[])
{
BoxExample guiWindow=new BoxExample();
System.out.println("main");
guiWindow.launchFrame();
}
}
</code></pre>
|
java
|
[1]
|
5,462,485 | 5,462,486 |
Play AVAudioPlayer From A Sleeping iPhone
|
<p>I am creating a alarm application.
I am using Audio Session in my main delegate class.</p>
<pre><code>OSStatus result = AudioSessionInitialize(NULL, NULL, interruptionListenerCallback, self);
UInt32 category = kAudioSessionCategory_MediaPlayback;
result = AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(category), &category);
AudioSessionSetActive(YES);
</code></pre>
<p>I am using a separate class for audio playing.But i am not able to play audio when iPhone is sleeping.</p>
<p>could any one tell me how to use a audio session so that i can play audio file even when iPhone is sleeping.</p>
<p>Thank You</p>
|
iphone
|
[8]
|
5,660,373 | 5,660,374 |
Adding dynamic value to a function
|
<p>I am trying to implement a plugin:</p>
<pre><code>$(".myTbl th:nth-child(1)").truncate({
width: "200",
after: "&hellip;",
center: false,
addtitle: true
});
</code></pre>
<p>Instead of using a fixed value for width, I have a script that calculates it dynamically and sets it into a a variable, but when I plug it in the code breaks. What am I missing? it is all withing PHP code</p>
<pre><code>echo '
var myWidth = 150;
$(".myTbl th:nth-child(1)").truncate({
width: myWidth ,
after: "&hellip;",
center: false,
addtitle: true
}); ';
</code></pre>
|
jquery
|
[5]
|
2,339,333 | 2,339,334 |
Google's Mobile View from Android
|
<p>How is there always mobile view whenever I go to google page through my Android emulator. What decides that the request is coming from mobile apps.</p>
|
android
|
[4]
|
2,787,296 | 2,787,297 |
AIM client on android
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3840095/aol-im-api-for-android">AOL IM api for android</a> </p>
</blockquote>
<p>Hi All,
i want to develop AIM client application in android ,is there any AIM api for android released?...</p>
<p>Thanks in advance....</p>
|
android
|
[4]
|
3,848,561 | 3,848,562 |
Pass custom parameters to subactivity
|
<p>Is there any way to pass custom parameters from a activity to a sub-activity?</p>
<p>I tried to do it via a constructor by creating a object of the sub-activity in the main-activity and passing the desired parameters. But when i start the sub-activity via a Intent the program fails.</p>
<p>The parameter I'm trying to pass is the main-activity.</p>
<p>Thanks for all response!</p>
|
android
|
[4]
|
1,621,959 | 1,621,960 |
C++ Memory Management diffrences with Heap Allocation and Frame Allocation
|
<p>I am slightly confused about how memory management works in C++, I understand when you use pointers (new/delete) but I'm lost when it comes to Frame allocation.</p>
<p>Say I have a simple class (Using QT Classes)</p>
<pre><code>class Demo {
public:
Demo();
~Demo();
QString AString() const;
void setAString(const QString &value);
private:
QString aString;
};
</code></pre>
<p>And I Allocate it using a pointer</p>
<pre><code>Demo *testInst = new Demo();
</code></pre>
<p>Now I understand when i call "delete testInst;" That is freed, but I'm confused about the out of scope part on Frame Allocations. Does that mean when I call delete, all those in the class that are not pointers are automatically freed, or do i have to do specific memory management within the deconstructor of the Demo class? Or does it mean if I leave the class those variables are freed?</p>
<p>I'm new to C++ and came from a .NET background so I'm not 100% understanding of manual memory management.</p>
|
c++
|
[6]
|
3,946,259 | 3,946,260 |
Returning an empty list with 'or' syntax using Parsley
|
<p>I'm trying to match a word using Parsley. The grammar that I'm using only works when I make a rule for a generic word. However, I would like to know why it doesn't work the way it is shown from Allen Short's presentation and sample code here (<a href="http://bit.ly/1025Qxo" rel="nofollow">http://bit.ly/1025Qxo</a>) and here (<a href="http://bit.ly/17wzUYg" rel="nofollow">http://bit.ly/17wzUYg</a>). </p>
<p>In his code, he has:</p>
<pre><code>rule = (expr1 -> returnval) | -> []
</code></pre>
<p>But the only way I got it to work was:</p>
<pre><code>rule = (expr1 -> returnval) | (expr2) -> []
</code></pre>
<p>Here's my code:</p>
<pre class="lang-python prettyprint-override"><code>import parsley
grammar = r"""
myword = "hello"
myrule = (myword:word -> word) | -> []
"""
MyPar = parsley.makeGrammar(grammar,{})
print MyPar("hello").myrule() # works, returns myword
print MyPar("bye").myrule() # doesn't work, throws exception
</code></pre>
<p>The only way I got it to work was to make a rule for a generic word string using the built-in 'letter' variable.</p>
<pre class="lang-python prettyprint-override"><code>import parsley
grammar = r"""
myword = "hello"
anyword = <letter+>
myrule = (myword:word -> word) | anyword -> []
"""
MyPar = parsley.makeGrammar(grammar,{})
print MyPar("hello").myrule() # works
print MyPar("bye").myrule() # works, returns empty list
</code></pre>
<p>Any help would be appreciated. Thank you.</p>
<p>Paul</p>
|
python
|
[7]
|
1,553,768 | 1,553,769 |
Looping forward items in an array
|
<p>I'm trying to create a job roster for my Boy Scout Troop, and I'm having a bit of an issue generating jobs.</p>
<p>I've got an array that contains jobs for the people. I then use a loop to display a job associated with a person.</p>
<p>Is there any way I could have the job move one up?</p>
<p>For example:</p>
<pre><code>Person 1 - Job 1
Person 2 - Job 2
Person 3 - Job 3
</code></pre>
<p>That then goes to:</p>
<pre><code>Person 1 - Job 2
Person 2 - Job 3
Person 3 - Job 1
</code></pre>
<p>And then</p>
<pre><code>Person 1 - Job 3
Person 2 - Job 2
Person 3 - Job 1
</code></pre>
<p>But because users can change the number of people in a group (from 2 - 20), how could I make this process happen without hard-coding it?</p>
|
php
|
[2]
|
4,514,029 | 4,514,030 |
Can we display Notifications in our activity other than status bar?
|
<p>I wanted to display latest messages and incoming call alerts in my activity.
Can I override that in my activity inside a list view?</p>
|
android
|
[4]
|
3,146,297 | 3,146,298 |
Screen orientation not working in android GingerBread
|
<p>I am trying to implement Accelerometer sensors for android2.3.3 ,
i am able to get successfully get the accelerometer X,Y,Z values, but
when i am trying to rotate the screen from portrait to landscape mode
i am not able to view the display properly.Althought the
functrionalaities are working(i.e. If i am touching and dragging at
the top i am able to observe in the logs that notifications bar is
getting opened)</p>
<p>Kindly find the logcat details"</p>
<pre><code>I/WindowManager( 1474): Setting rotation to 3, animFlags=0
E/libEGL ( 1474): eglDestroyImageKHR:1811 error 300c
(EGL_BAD_PARAMETER)
I/ActivityManager( 1474): Config changed: { scale=1.0 imsi=0/0
loc=en_US touch=3 keys=1/1/2 nav=1/1 orien=1 layout=34 uiMode=17
seq=6}
D/dalvikvm( 1556): GC_EXTERNAL_ALLOC freed 154K, 48% free 2963K/5639K,
external 5050K/5062K, paused 29ms
D/dalvikvm( 1556): GC_EXTERNAL_ALLOC freed 55K, 48% free 2959K/5639K,
external 3527K/3887K, paused 37ms
[ 117.071594] mcde_display_dpi mcde_display_dpi.0:
try_video_mode:Failed to find video mode x=480, y=800
E/gralloc ( 1474): FBIOPUT_VSCREENINFO failed
</code></pre>
<p>Can you kindly let me know what might be the possible reason behind
this.</p>
|
android
|
[4]
|
2,915,882 | 2,915,883 |
ImportError: /path/pyexpat.so not defined in file libexpat.so.0
|
<p>I am getting this error when trying to run a classic python code written by x-colleagues. </p>
<p>Can u anyone help me out with solving this issue. I have googled throughly and couldn't find any solution.</p>
<p><code>Python version : 2.4.3</code></p>
<p><code>ImportError: /usr/lib/python2.4/lib-dynload/pyexpat.so: symbol XML_SetHashSalt, version EXPAT_1_95_8_RH not defined in file libexpat.so.0 with link time reference</code></p>
|
python
|
[7]
|
3,210,412 | 3,210,413 |
Cannot refer to a template name nested in a template parameter
|
<p>I have the following code:</p>
<pre><code>template <typename Provider>
inline void use()
{
typedef Provider::Data<int> D;
}
</code></pre>
<p>Where I'm basically trying to use a template class member 'Data' of some 'Provider' class, applied to 'int', but I get the following errors: </p>
<pre><code>util.cpp:5: error: expected init-declarator before '<' token
util.cpp:5: error: expected `,' or `;' before '<' token
</code></pre>
<p>I'm using GCC 4.3.3 on a Solaris System.</p>
|
c++
|
[6]
|
4,811,320 | 4,811,321 |
PHP - Removing Duplicate Punctuation?
|
<p>Suppose you have the following string: <code>Hello... how are you!!?? I'm bored!!</code></p>
<p>I want back-to-back punctuation to be removed wherever possible, and for question marks to be retained in the event of a situation similar to "!?". The filtered string should appear as follows:</p>
<p><code>Hello. how are you? I'm bored!</code></p>
<p>Best answer goes to the most concise solution that solves this problem. I expect regular expressions will be the best way to go about solving this, but my knowledge of regular expressions is very, very limited at best, and I have no idea how to go about solving this. I'm more than fine with non-regex solutions, however! An explanation of any code you provide--unless devilishly simple--would also be nice.</p>
<p>Thank you!</p>
|
php
|
[2]
|
720,136 | 720,137 |
Javascript Prompt displaying executed value
|
<p>I've this code:</p>
<pre><code><input type="button" value="Test Short URL" onClick="javascript:void(location.href='http://taimoorsultan.com/y/yourls-api.php?signature=05e2685fc7&format=simple&action=shorturl&url='+escape(location.href))&prompt('Shorten URL', 'shorturl');">
</code></pre>
<p>Actually this code takes url and process it and show a shorten url on next blank page. I was trying to display that shorten url on the same page through prompt().
Using the above code is bit confusing for me.
How I can process the short url without allowing it to display the result on next page?</p>
<p>I think I should first process the action="" and then do something to show results within a prompt box. But don't know how to do this.
Help please!</p>
|
javascript
|
[3]
|
430,454 | 430,455 |
Files type to upload aiff
|
<p>In a form used to upload music I check the files type, I want to allow people to upload mp3, wav and aiff. I found $_FILES['music']['type'] == 'audio/wav' and $_FILES['music']['type'] == 'audio/mp3' but I can't manage to find the appropriate type for the aiff files. Can anybody help me please?</p>
<p>Thanks</p>
|
php
|
[2]
|
5,918,960 | 5,918,961 |
ASP.NET Web Service ONLY returns Documentation Page for all calls
|
<p>A client has a ASP.NET web service on a shared server (hosted environment). You can go to the web service URL and view the documentation page (xxxxx/service.asmx?WSDL) and see all the methods. Using a tool such as SoapSonar you can execute any of the methods, but the response is always as if you sent (xxxxx/service.asmx) - in other words the web service documentation page. </p>
<p>Is this a medium trust environment? - I don't know, they don't know, don't ask</p>
<p>There are no errors returned or logged.
This is on a Win2k3 server with 3.5 Framework installed and II6. The webservice was build with Visual Studio 2008 and works locally, just not in this environment.</p>
<p>The client has no access to the server, the third party server provider is trying but of limited experience using ASP.NET web services. </p>
<p>Any thoughts on what could cause this type of behavior? What to look for? </p>
|
asp.net
|
[9]
|
3,206,291 | 3,206,292 |
replace callback function with matches
|
<p>need to replace <code><wiki>this page</wiki></code> to <code><a href='wiki/this_page'>this page</a></code><br>
using callback function:</p>
<pre><code>text = text.replace(/<wiki>(.+?)<\/wiki>/g, function(match)
{
return "<a href='wiki/"+match.replace(/ /g, '_')+"'>"+match+"</a>";
}
);
</code></pre>
<p>result is that tag <code><wiki></code> is preserved (full match) - <code><a href='wiki/<wiki>this_page</wiki>'><wiki>this page</wiki></a></code></p>
<p>Is there a way to get matches[0], matches[1] as in PHP's <code>preg_replace_callback()</code>?</p>
|
javascript
|
[3]
|
1,760,582 | 1,760,583 |
Why did i get this error?
|
<p>here's the code: </p>
<pre><code>class Acount
{ int sum ; String owner ; //these seem to make sense
//a constructor or two
public Acount ()
{ this.sum = 0 ; this.owner = "John Doe" ; }
public Acount (String name)
{this.sum = 0 ; this.owner = name ; }
public Acount (String name, int sum)
{this.sum = sum ; this.owner = name ; }
//prints an acount in the format "owner" "sum"
public static void printAcount (Acount Acount)
{System.out.print (Acount.owner) ; System.out.print (" ") ; System.out.println (Acount.sum) ; }
public static void main (String[]arg)
{
Acount Acount1 = new Acount ("david", 100) ;
System.out.println ("heres the first acount as it was created:") ;
printAcount (Acount1) ;
System.out.println ("now i changed one of its instance varaibles with a static method") ;
upOne (Acount1) ;
printAcount (Acount1) ;
}
public static Acount upOne (Acount Acount)
{
Acount.sum = Acount.sum + 1 ;
return Acount ;
}
}
</code></pre>
<p>here's the error: </p>
<pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: Acount/java
</code></pre>
<p>What went wrong and why? </p>
|
java
|
[1]
|
1,238,229 | 1,238,230 |
Android Emulator and MMS
|
<p>does android emulator supports MMS messaging? im looking for a solution for my app, please some help.</p>
|
android
|
[4]
|
1,634,277 | 1,634,278 |
setContentView in a different thread
|
<p>I am writing a server client on android platform. If one of the client send a message one of them, firstly message goes to server and server sends it to client. When a receiver client receive the message, i have to <code>setContentView</code> so I need to open messaging screen. But it takes the messages in a different thread and I pass as a reference my activity class. </p>
<pre><code>Thread my = new MyThread(this);
</code></pre>
<p>and in the thread class ı cant set content view because give an error like <code>ViewRoot CalledFromWrongThread</code> what can I do?</p>
|
android
|
[4]
|
2,043,976 | 2,043,977 |
PHP 5.4 not available for windows + Apache?
|
<p>I'd like to install the new PHP 5.4 on my Windows machine. I'm running Apache 2.2 on it. Reading the info on <a href="http://windows.php.net/download/" rel="nofollow">http://windows.php.net/download/</a>, it says "If you are using PHP with Apache 1 or Apache2 from apache.org you need to use the VC6 versions of PHP". I guess I'm in that case, I just donloaded Apache from apache.org. </p>
<p>However, there are no VC6 versions available of PHP 5.4, not even of PHP 5.3. How can I install PHP 5.4 on my Windows machine then ? </p>
|
php
|
[2]
|
58,237 | 58,238 |
How can I stop a HTML page after the <head>...</head> loads using javascript?
|
<p>I have a URL rewriting proxy server (EZproxy) that can be set up like this to provide one-click access to target URL's, providing an authentication challenge when needed but getting out of the way when it's not needed. </p>
<p><a href="http://url-rewriting-proxy-server.com/login?url=http://target-url.com" rel="nofollow">http://url-rewriting-proxy-server.com/login?url=http://target-url.com</a></p>
<p>I would like load a URL like above and then stop the page, only loading the <code><head></head></code>.</p>
<p>I would like to use a bookmarklet (server side code is OK) to accomplish this.</p>
<p>Can I do this programmatically with Javascript? If so, how? If Javascript is a bad idea, are there alternatives?</p>
<p>Will your solution work in Mobile Safari?</p>
|
javascript
|
[3]
|
358,538 | 358,539 |
how to get grand total dynamically using jquery
|
<p>I have dropdown of nationality with its related price for rooms of hotel.Now I want to dynamically add the prices shown and output it.</p>
<pre><code><div class="Total"></div>
<div class="rum_name">Room name</div>
<div class="nationality">
<select class="sel_nationality" name="nationality">
<option roomprice="30" value="63">SAARC</option>
<option roomprice="50" selected="selected" value="65">American/ European</option>
<option roomprice="45" value="67">Japnese/ Korean</option>
<option roomprice="38" value="69">All Others</option>
</select>
<div class="Price">
Price:
<span class="selectedPrice"></span>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
var total = 0;
$('.sel_nationality').change(function(){
$price = $('option:selected', this).attr('roomprice');
$parent = $(this).parents('.nationality');
$parent.find('span.selectedPrice').text($price);
$tot_price = $(this).val();
$(this).each(function(){
total += parseInt(this.value);
})
$('.Total').text(total);
})
})
</script>
</code></pre>
<p>There may be more than 1 rooms and the above option for each.Now I want to dynamically change the total as perthe price outputted.
Thanks</p>
|
jquery
|
[5]
|
2,763,336 | 2,763,337 |
targeting specific jQuery element with identical class name
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4868599/how-to-select-an-element-by-class-inside-this-in-jquery">How to select an element by class inside “this” in Jquery</a> </p>
</blockquote>
<p>I'm newer to jQuery...I think this has something to do with using a 'this" command but not sure.</p>
<p>I have a page that is programmatically creating several divs like this:</p>
<pre><code><div class="moreinfolink">Click For More Information
<div class="moreinfotext">Additional Info Here</div>
</div>
</code></pre>
<p>So there are several .moreinfolink and .moreinfotext classes on a page.</p>
<p>I used this code to toggle showing the moreinfotext div:</p>
<pre><code>$('.moreinfolink').click(function() {
$('.moreinfotext').toggle('slow', function() {
});
</code></pre>
<p>But this obviously does a toggle for ALL of the moreinfotext divs that exist on the page.</p>
<p>Two questions:
How can I do it for the specific child div that is inside the parent moreinfolink div?
Is there a better way to do it than the direciton I'm going?</p>
<p>Thanks!</p>
|
jquery
|
[5]
|
541,827 | 541,828 |
google api calendar add event
|
<p>i tried to insret event to my google calenadr trow javaScript code :</p>
<pre><code><script>
var apiKey = 'AIraSyDFMA8t3fTM6cqflPEDys1rXhPffARFiEs';
var clientId = '---------';
var scopes = 'https://www.googleapis.com/auth/calendar';
// The Calendar entry to create
var resource = {
"summary": "Appointment",
"location": "Somewhere",
"start": {
"dateTime": "2012-12-16T10:00:00.000-07:00"
},
"end": {
"dateTime": "2012-12-16T10:25:00.000-07:00"
}
};
function init() {
gapi.client.setApiKey(apiKey);
gapi.auth.init(load);
}
function load() {
gapi.client.load('calendar', 'v3', auth);
}
function auth() {
gapi.auth.authorize({
'client_id': clientId,
'scope': scopes,
'immediate': false
});
}
function makeRpcRequest() {
var request = gapi.client.calendar.events.insert({
'calendarId': 'primary',
'resource': resource
});
request.execute(writeResponse);
}
function makeRestRequest() {
gapi.client.request({
'path': '/calendar/v3/calendars/primary/events',
'method': 'POST',
'body': resource,
'callback': writeResponse
});
}
function writeResponse(response) {
console.log(response);
var creator = response.creator.email;
var calendarEntry = response.htmlLink;
var infoDiv = document.getElementById('info');
var infoMsg = document.createElement('P');
infoMsg.appendChild(document.createTextNode('Calendar entry ' +
'successfully created by ' + creator));
infoDiv.appendChild(infoMsg);
var entryLink = document.createElement('A');
entryLink.href = calendarEntry;
entryLink.appendChild(
document.createTextNode('View the Calendar entry'));
infoDiv.appendChild(entryLink);
}
</script>
</code></pre>
<p>it's not working pleas help </p>
|
javascript
|
[3]
|
1,766,935 | 1,766,936 |
How to using GetChanges() in DataTable
|
<p>I have been developing some application with DataGridView binded to DataTable. So, now I need to do 1 thing: user can edit some fields, and when he clicks by "Save" the application must change some fields programmatically. I'm trying to use this code, but it doesn't work:</p>
<pre><code>private void toolStripMenuItemSaveChanges_Click(object sender, EventArgs e)
{
try
{
dataGridViewPersons.BindingContext[table].EndCurrentEdit();
//
DataTable changes = table.GetChanges();
if (changes != null)
{
Console.WriteLine("edited rows=" + table.GetChanges().Rows.Count);
foreach (DataRow row in changes.Rows)
{
row[29] = getRightBody(row, 7, 18);
row[30] = "-";
row[31] = getRightBody(row, 23, 25);
row[32] = getRightBody(row, 26, 28);
}
}
else
{
Console.WriteLine("edited rows=0");
}
adapter.Update(table);
}
catch (Exception exeption)
{
this.Text = exeption.Message;
}
}
</code></pre>
<p>If there is edited rows, this code won't change fields in the binded DataTable; I thought that GetChanges() return DataTable with relations to the original DataTable, but now I know it's false. Please, tell me the decision. Thank you in advance. </p>
|
c#
|
[0]
|
3,606,866 | 3,606,867 |
get position (index) of td element identified by class name
|
<p><br/>
i have this code</p>
<pre><code><tr id="3" class="gradeA odd focus row_selected">
<td class="center">Kids Footwear 2</td>
<td class="sorting_1 center focus">200</td>
<td class="center">50</td>
<td class="center">200</td>
<td class="center">30-34</td>
<td class="center">234-343</td>
<td class="center">200</td>
<td class="center">25</td>
<td class="center">1.23</td>
</tr>
</code></pre>
<p>i want to fetch the index value of <code><td></code> element which contains the class <code>focus</code></p>
<p>so if within the <code><td></code> element the focus class is set on </p>
<pre><code>first `<td>` then return 0
second `<td>` then return 1
third `<td>` then return 2
</code></pre>
<p>and so on.how do i go with this in jQuery?</p>
<p>thank you.</p>
|
jquery
|
[5]
|
2,989,486 | 2,989,487 |
Javascript disabled, short questions
|
<p>Just some short Q regarding javascript and websites.</p>
<p>1- By javascript enabled, does it mean to have 'sun java' installed and enabled in the browser settings? Or does every browser have javascript enabled always?</p>
<p>2- If javascript is disabled, my website for example wouldn't work at all, so what does major developers do in these situations, if the only way to achieve their goal is to use javascript?</p>
<p>3- Is ajax also disabled if javascript is disabled? Also, same for Jquery because its a javascript library ?</p>
<p>Thanks guys</p>
|
javascript
|
[3]
|
6,000,798 | 6,000,799 |
php dynamic array checking
|
<p>Hy,</p>
<p>I have a multidimensional array with sub arrays and stuff like this :</p>
<pre><code> [21] => Array
(
[80] =>
[83] =>
[A4] => Array
(
[80] =>
)
[85] =>
[A6] => Array
(
[80] =>
)
[87] =>
[88] =>
[A9] => Array
(
[A0] => Array
(
[80] =>
)
)
[8B] =>
[AC] => Array
(
[30] => Array
(
[81] =>
[82] =>
[83] =>
[84] =>
[85] =>
[86] =>
[88] =>
)
)
[8D] =>
[8E] =>
[8F] =>
[91] =>
[92] =>
[93] =>
[94] =>
[9B] =>
[96] =>
[97] =>
[9D] =>
)
</code></pre>
<p>I want to create a function to pass a level to check array_keys_exist</p>
<p>If the level is <code>0</code> then it should <code>array_keys_exist($array['21']);</code>
If the level is <code>1</code> then is should <code>array_keys_exist($array['21'][])</code> but the problem is I cannot use <code>$array[21][]</code> and only ckech the <code>80,80,A0 and 30</code>.</p>
<p>Is this possible ? </p>
<p>Thank you</p>
|
php
|
[2]
|
5,840,911 | 5,840,912 |
How do you implement Lazy Loading images in listView
|
<p>I'm referring to this popular marked answer: <a href="http://stackoverflow.com/questions/541966/android-how-do-i-do-a-lazy-load-of-images-in-listview">Android - How do I do a lazy load of images in ListView</a></p>
<p>Perhaps, I don't fully understand the code, but how exactly would I apply it to my getView in my adapter?</p>
<p>I know there is another answer there that has an example, but supposedly that requires an sd card? Not all phones have cd cards.</p>
|
android
|
[4]
|
1,177,975 | 1,177,976 |
which is better way to get an xml returned from web request for parsing
|
<p><em><strong>I need to read an xml output returned from a php file through a web request in my android app.</em></strong></p>
<p>Hence, I have used Asynctask to read the xml file as byte by byte storing in a byte type array in background
thread and then put the array in a text file. After completing the async task, I have used SAX perser to parse
the xml reading from the text file.</p>
<p>There is another way to do the same thing as below where complete xml is stored in a String variable:</p>
<pre><code>DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost("http://www.abcdefgh./abc/efg.php");
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
String line = EntityUtils.toString(httpEntity);
</code></pre>
<p>Here line variable contains the whole xml as a long string. <strong>Could any one explain which one is better/effecient from above two procedure to do the job ......?</strong></p>
|
android
|
[4]
|
5,509,405 | 5,509,406 |
hide default keyboard on click in android
|
<p>i want to hide the soft keyboard when i click out side of editbox in a screen. how can i do this?</p>
|
android
|
[4]
|
1,319,334 | 1,319,335 |
Jquery statement that won't J
|
<p>Can anyone help me with my jquery statement... </p>
<p>I have a 'share' box - on submit I want to 'force' the 'share' (user, date and message) to the screen below my cl_share_hide_me class ...so that the user does not have to reload the page to see his/her share.</p>
<p>I have gotten this far but not able to go further</p>
<p>Merci!</p>
<pre><code> <span class='cl_share_hide_me'>
<br />
<textarea spellcheck='false' class='class_share_a_post' rows="3" cols="58" id='slick-show'></textarea>
<br/>
<br />
<input type='submit' value='Share' class='cl_share_button' data-share-nid= "2749" data-share-type="field_school" /><br />
<br />
</span>
var sometext = "<div class='shared_content_background'> oy voy</div>";
var placeToPutData = $(this).parent().parent().find('.cl_share_hide_me');
placeToPutData.after(sometext);
</code></pre>
|
jquery
|
[5]
|
1,587,369 | 1,587,370 |
View state vs Hidden field in asp.net
|
<p>How can we take decision for viewstate and hidden field in ASP.NET.</p>
<p>In my case i am using page cross post back and by using public properties of first page i am accessing them in second aspx page. </p>
<p>After getting public variable in second aspx page i need to access those value in second page but as soon as i do postback in second page, i am not able to find those value.</p>
<p>Hence to solve this issue i have two solution either use viewstate in second page or using hidden field in second page.</p>
<p>I am not able to decide which one should i use?</p>
|
asp.net
|
[9]
|
3,154,810 | 3,154,811 |
How to load class at runtime in android app?
|
<p>In my android project I've two layouts in that first layout having one button if i click that button I need to display the second layout in the same layout for this I created a view by using <code>LayoutInflater</code> and attached it to "Table Layout" which is present in first layout.</p>
<p>Everything should be fine but the corresponding class file for the second layout is not loading. Without loading I'm not able to call events like click and some other loader events so any one help me how can I load the corresponding class file when i click button in first layout?</p>
|
android
|
[4]
|
3,122,691 | 3,122,692 |
what is the difference between -> and =>? what is ::?
|
<p>Im a bit new to javascript and I am trying to understand how backbone.js and understand how it works, however there are times that I run into lines like this: </p>
<pre><code>"admin"=>password_hash("pass",PASSWORD_BCRYPT)
</code></pre>
<p>I understand this code is crypting the pass however i dont understand the => symbol. </p>
<p>Furthermore, I have encountered the :: and I dont understand it either. </p>
<p>Anyone know where I can read about this better? I have been searching but I have been unsuccessful to find any tutorial that explains it clearly. </p>
<p>Thanks! </p>
|
php
|
[2]
|
4,044,023 | 4,044,024 |
Protect code/content by domain name
|
<p>I am writing a javascript product but it will be licensed to individual domain names. So in order to protect it from copy and pasted from the demo or from one site to another the code should only allow itself to run properly when it's on the right domain.</p>
<p>The encryption can be done server side by php when a user purchases the item and keys in the domain he wants to use it on. So it goes something like this:</p>
<pre><code>var encryptedtext = "My text here";
function decrypt(){
//decrypt using domain name.
}
print( decrypt(encryptedtext) );
</code></pre>
<p>I don't need it to be strong. The product will cost only a few dollars and the protection should be enough to demotivate any cracking.</p>
<p>The biggest weakness I find is it is very obvious that it's taking the domain name as the decryption key. What would be the best way to mitigate this?</p>
|
javascript
|
[3]
|
2,491,717 | 2,491,718 |
Will a nested function always have to be redefined?
|
<p>For architecture and namespacing purposes, I want to do this:</p>
<pre><code>function outer (arr) {
function inner(arrElement) {
return doStuffTo(arrElement);
}
var results = [];
arr.forEach(element, index, array) {
results.push(inner(element));
}
return results;
}
</code></pre>
<p>So basically, a function within a function. Simple stuff. But <code>outer()</code> is something that will be executed <em>a lot</em>. Does this mean the overhead of defining a function (on top of evaluating it) will apply every time <code>outer()</code> is called? For this to be efficient, must I define <code>inner()</code> outside?</p>
|
javascript
|
[3]
|
2,821,823 | 2,821,824 |
Python exclusive loop
|
<p>I want to loop through a <code>list</code> and separate the current element from others.
Like this : </p>
<pre><code>for e in the_list:
function_call(e, <the_list but e>)
</code></pre>
<p>Is there an elegant way to do that ?</p>
|
python
|
[7]
|
5,486,299 | 5,486,300 |
stack trace when debug on android device
|
<p>when I debug my android app using emulator, the stacktraces and error messages are shown in Eclipse's Logcat.<br>
However, when I debug on my physical android device, when app crashes there is no stacktrace shown in eclipse. Is there anything i need to configurate in order to get stacktrace when debugging on physical device??</p>
|
android
|
[4]
|
2,866,625 | 2,866,626 |
Is it a good idea to use static type?
|
<p>I know the difference between static type and other types but I am not sure which is to used where. Now I am using static types in all places to avoid object instantiation. Is it a good idea to use it that way ? Is there any particular disadvantage in using static type in all places ??</p>
<p>EDIT</p>
<p>What do you call this as <code>static String staff</code> ?</p>
|
java
|
[1]
|
3,201,642 | 3,201,643 |
What is [] + [] in javascript
|
<p>What are the values of []+[], []+{}, {}+[], {}+{}? And How?</p>
<p>This my console log</p>
<pre><code>>{} + {}
>NaN
>[] + []
>''
>{} + []
>0
>[] + {}
>[Object object]
</code></pre>
<p>Also</p>
<pre><code>>var a = [] + {}
>a
>[Object object]
>var b = {} + []
>b
>[Object object]
</code></pre>
<p>How did the value change on assignment?</p>
<p>SRC: <a href="https://www.destroyallsoftware.com/talks/wat" rel="nofollow">video</a></p>
|
javascript
|
[3]
|
2,065,166 | 2,065,167 |
"with" keyword in javascript
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/61552/are-there-legitimate-uses-for-javascripts-with-statement">Are there legitimate uses for JavaScript’s “with” statement?</a> </p>
</blockquote>
<p>I recently discovered that in javascript, one can do something like the following:</p>
<pre><code>with document{
write('foo');
body.scrollTop = x;
}
</code></pre>
<p>The down side of this is that each variable needs to be checked to see if it belongs to the document object, creating a significant overhead.</p>
<p>Alternatively, one could do something like this:</p>
<pre><code>var d = document;
d.write('foo');
d.body.scrollTop = x;
</code></pre>
<p>Are there any situations where the use of the 'with' keyword is justified?</p>
|
javascript
|
[3]
|
3,207,339 | 3,207,340 |
window.onbeforeunload message localization
|
<p>I'm using a page unload trigger to warn the user of unsaved changes while leaving the page/closing the tab/etc... and this works fine.</p>
<pre><code>//Exit event
if (!changes_saved) {
window.onbeforeunload = confirmExit;
}
function confirmExit()
{
return "Your changes will be lost if you leave this page!";
}
</code></pre>
<p>My problem is that the browser (both Firefox and IE) enwraps the custom message with
"Are you sure you want to navigate away from this page" in the beginning and with "Press OK to continue, or Cancel to stay on current page." at the end.</p>
<p>My question:
is there any way to avoid this and completely customize the message in the dialog?
Need for this isn't abstract, I'm developing a multi language interface and localized message mixed with the enforced one just looks silly.</p>
<p>Thank you.</p>
|
javascript
|
[3]
|
5,485,893 | 5,485,894 |
What datatype is the output?
|
<pre><code> pos_tag(word_tokenize("John's big idea isn't all that bad."))
[('John', 'NNP'), ("'s", 'POS'), ('big', 'JJ'), ('idea', 'NN'), ('is',
'VBZ'), ("n't", 'RB'), ('all', 'DT'), ('that', 'DT'), ('bad', 'JJ'),
('.', '.')]
</code></pre>
<p>Don't recognize the syntax at all. How would I iterate over this checking for <code>JJ</code> in 2nd value in the pairs.</p>
|
python
|
[7]
|
3,378,175 | 3,378,176 |
system properties
|
<p>can anybody tell how to get system properties of a remote computer in a network ?</p>
<p>i would like write a code in c#</p>
|
c#
|
[0]
|
5,646,137 | 5,646,138 |
Javascript - Debugging window.print()
|
<p>I am being forced to abuse HTML. I am creating an html webpage that is actually a form meant for print output. In other words, this should be a PDF. It isn't. It won't be cause the 3rd party stuff costs too much and at this point I do not have time to convert it all. </p>
<p>It is all HTML and I print it via js "window.print()". In the latest FF The print comes out one way. In IE 7 another. Both are wrong.</p>
<p>I don't seem to have any way to perform a print-preview so I am burning through trees like a forest fire. Does anyone have any tips for troubleshooting the print functionality? I mean, I may have to start exploring the damn postscript or something. I'm clueless.</p>
|
javascript
|
[3]
|
1,614,766 | 1,614,767 |
How do I get all elements of a particular type in javascript?
|
<p>I need to hide all elements of type 'section' in my document apart from one with a particular ID.</p>
<p>In jquery this would be easy</p>
<pre><code>$("section").hide();
$("section#myId").show();
</code></pre>
<p>How would I do this without jquery??</p>
<p>(I need it to happen as soon as the page loads and to not be noticable). I also need it to work cross browser.</p>
<p>Thanks.</p>
|
javascript
|
[3]
|
306,500 | 306,501 |
List.Count resets to zero
|
<p>I want to create a list with 11 entries, but <code>List.Count</code> resets to zero after this code. </p>
<p>There are no entries added to the list. What is wrong?</p>
<pre><code>List<Animation> animations = new List<Animation>();
animations[0] = new Animation(new List<Rectangle>(10),
Content.Load<Texture2D>("pictures"),
TimeSpan.FromSeconds(2),
Animation.Animationsablaeufe.vorrück);
</code></pre>
|
c#
|
[0]
|
4,066,736 | 4,066,737 |
c# problem with mediaplayer
|
<p>my media player is not working i have imported dll of windows player. And i have a folder name called upload in my application itself.In the first button i will upload the audio and in the second button im getting the filename using session and using it in the second button when ever i click second button media player is getting disappeared and im getting the fullpath with filename in the second button dont know why media player getting disappeared and i want this website too host also please help its very urgent.</p>
<pre><code>protected void Button1_Click(object sender, EventArgs e)
{
string sr = Server.MapPath("./upload/");
if (FileUpload1.HasFile)
try
{
FileUpload1.SaveAs(Server.MapPath("./upload/") +
FileUpload1.FileName);
Label1.Text = "File name: " +
FileUpload1.PostedFile.FileName + "<br>" +
FileUpload1.PostedFile.ContentLength + " kb<br>" +
"Content type: " +
FileUpload1.PostedFile.ContentType;
Session["v"] = FileUpload1.PostedFile.FileName;
}
catch (Exception ex)
{
Label1.Text = "ERROR: " + ex.Message.ToString();
}
else
{
Label1.Text = "You have not specified a file.";
}
}
protected void Button2_Click(object sender, EventArgs e)
{
string dr1 = Session["v"].ToString();
string dr2 = Server.MapPath("./upload/" + dr1);
MediaPlayer1.Filename = dr2;
}
</code></pre>
|
c#
|
[0]
|
2,419,491 | 2,419,492 |
Get cell by column name using xlrd
|
<p>If I have two rows in an excel (.xls) sheet, like a key-value pair, is there a way to get the value (row1) by entering in the key (row0) in xlrd?</p>
<p>For example, if I have <code>(0,0) = COLOR</code> and <code>(1,0) = RED</code>, how would I do something like:</p>
<pre><code>value = sh.col_values("COLOR") ?
</code></pre>
<p>The closest I have been able to find is <code>sh.col_values(int)</code>, but that only allows me to enter in an index.</p>
|
python
|
[7]
|
2,865,445 | 2,865,446 |
Group data by frequency
|
<p>I am trying create a trending system that displays which keywords are trending by checking the occurrence of their usage. I have able to get the count of occurences of the keywords into an array like this</p>
<pre><code>$keyword_occurences = array("pheed"=>5, "php"=>7, "love" => 700);
</code></pre>
<p>How do I display this in descending order of occurrence?</p>
|
php
|
[2]
|
2,747,959 | 2,747,960 |
Viewing all photos in a folder in android on the web
|
<p>I am running a web server and storing all my photos at a folder called photos. Now I want the android application to list all the photos under that particular folder(It can be a slide show or a grid view). I know how to load an image from a url . But I am really unsure about how to view all the images stored on a folder. Could someone please point me in the right direction. </p>
|
android
|
[4]
|
5,404,807 | 5,404,808 |
jquery child element problem
|
<p>I have a list, with each list element having a textarea and an img. When I hover over one of the list's textareas, I want the respective img to change src. </p>
<p>The problem is that when I hover over a textarea on one of the lists, all the imgs on the list change, not just the one on that list item.</p>
<pre><code>$('.rightMainP').hover(function() {
$('#rightMain').find('img:first-child').attr('src', '../Images/whiteSidewaysNub.png');
}, function() {
$('#rightMain').find('img:first-child').attr('src', '../Images/graySidewaysNub.png');
});
</code></pre>
<p>In my code, there are multiple imgs in each list item, and my jquery can not specify to only change the one in the list item that has the textarea that is being hovered over.</p>
|
jquery
|
[5]
|
5,024,469 | 5,024,470 |
Hindi Font Support
|
<p>I am developing an android application that is in Hindi. </p>
<p>The major issue with that application is that it is working on Samsung devices, but fails to work on Motorola devices. </p>
<p>Please suggest me solution for this issue.</p>
|
android
|
[4]
|
1,241,253 | 1,241,254 |
addClass/removeClass
|
<p>{I want to be able to add a class to the body then remove that class and replace it with the new class on click of the 'a tag' html element, this is as far as I've got, adding the class, each click adds another class:</p>
<p>Can this be done by checking the a link for a class of selected instead of .click</p>
<p>html:</p>
<pre><code><ul id="dates">
<li><a href="#" class="selected">link1</a></li>
<li><a href="#">link1</a></li>
<li><a href="#">link1</a></li>
<li><a href="#">link1</a></li>
</ul>
</code></pre>
<p>jQuery:</p>
<pre><code>$('ul#dates li a.selected').bind(function() }
var htmlStr = $(this).html();
$('body').attr('class', htmlStr);
});
</code></pre>
|
jquery
|
[5]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.