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 |
---|---|---|---|---|---|
3,745,354 | 3,745,355 | Learning C++ right? | <p>Since I have been mostly using script languages in the past time but now want to go to the "high-performance" level I decided to learn C++ some time ago.</p>
<p>I looked at some "beginner" tutorials and bought an O'reilly C++ pocket reference book (it's really helpful). My problem is that I now know all the basics but I'm not good enought to program a more complicated game, for example, yet.</p>
<ul>
<li>Do I have to get one of those thick C++ books for further learning?</li>
<li>I'm going to use C++ on Windows mainly. What APIs beside Win32 are important for me?</li>
<li>My goal would be to write a small interpreter for a programming language I've though of - I managed that in several scripting languages already, what API/Library knowledge do I need in C++ to write one?</li>
</ul>
| c++ | [6] |
2,537,194 | 2,537,195 | Whitespace converted to rectangle | <p>When I copy the first paragraph of this page from my browser to a notepad which is under (محمد بصل), I see whitespaces replaced with rectangles in my notepad:
<a href="http://www.shorouknews.com/news/view.aspx?cdate=03092012&id=73df0e96-a9d8-44a1-83a8-77b0daf314a7" rel="nofollow">http://www.shorouknews.com/news/view.aspx?cdate=03092012&id=73df0e96-a9d8-44a1-83a8-77b0daf314a7</a>
How can I convert this in C# code to be inserted properly as whitespace in a SQL Server table?
Thanks.</p>
| c# | [0] |
1,161,252 | 1,161,253 | Android activity with multiple repeating backgrounds | <p>I'm still new to android and i'm having trouble creating a layout with two backgrounds that tile in the x direction but not y.</p>
<p>I've mocked up what I'm trying to create here...</p>
<p><a href="http://img153.imageshack.us/img153/6008/cnbackground.png" rel="nofollow">http://img153.imageshack.us/img153/6008/cnbackground.png</a></p>
<p>So the top section repeats horizontally, then there's a flat creen section in the middle in which I will center my content, then there's some horizontally repeating grass along the bottom.</p>
<p>Has anyone tried to do anything like this before?</p>
<p>Jon</p>
| android | [4] |
1,417,230 | 1,417,231 | Count number of Divs filtering on id/class | <p>Hiii,<br>
<strong>Q-></strong>
I want to count the number of <code>div</code> in a page whose id start with d </p>
<pre><code><div id="d1">D1</div>
<div id="d2">D2</div>
<div id="d3">D3</div>
</code></pre>
<p>I want to get 3 here</p>
<hr>
<p><strong>Q-></strong>
I want to count the number of <code>div</code> in a page which have the class d </p>
<pre><code><div class="d">D1</div>
<div class="d">D2</div>
</code></pre>
<p>I want to get 2 here</p>
| jquery | [5] |
3,645,742 | 3,645,743 | how to change css style from jquery | <p>my style is here</p>
<pre><code>#mybox{
display:none;
}
</code></pre>
<p>my web is here </p>
<pre><code><div id='mybox'>
...
</div>
<script type='text/javascript'>
$(document).ready(function(){
$("#mybox").css("display","visible");
})
</script>
</code></pre>
<p>mybox don't show. How to show mybox ?</p>
| jquery | [5] |
3,966,353 | 3,966,354 | NSDate getting Current day in xcode? | <p>I get how to get month,date,year from NSDate. But how i can get which day is today?</p>
| iphone | [8] |
1,670,150 | 1,670,151 | Toggle multiple element classes with jQuery | <p>I need to be able to toggle class when I click an element. It works fine for that element:</p>
<pre><code>$(".main").click(function() {
$(this).toggleClass("classA").toggleClass("classB");
});
</code></pre>
<p>But I would like to add to it to toggle classes for all elements on the page that have a particular class, say "togToo". For those elements I need to toggle between "classC" and "classD".</p>
<p>I'm almost certain there's a way to combine that into one click...</p>
<p><em><strong>^^^ UPDATED ABOVE ^^^</em></strong></p>
| jquery | [5] |
1,744,680 | 1,744,681 | iPhone - handling two XIBs for two orientations | <p>I have an app I would have two XIBs: one for portrait and one for landscape. </p>
<p>I am not sure what is the best way to do that, but my guess is...
I design both XIBs on Interface Builder and link them to UIViewControllers and create another class to manage them. But what class? UINavigationController?</p>
<p>How do I switch with animation between the two XIBs?</p>
<p>Do I have to declare both and have the switching method on the app delegate? </p>
<p>Can you guys point to some tutorial or example?</p>
<p>thanks.</p>
| iphone | [8] |
2,024,336 | 2,024,337 | about databases in android | <p>i am new in android database.i downloaded sqlite database browser.
can u give me the steps how to use already generated database in android sdk with eclips.
give me proper structure where to store database in eclips folder structure</p>
| android | [4] |
347,422 | 347,423 | book mistake php | <p>helo everyone</p>
<p>This is a code from a book i have bought. It gives me the following error.</p>
<p>syntax error, unexpected T_STRING, expecting T_PAAMAYIM_NEKUDOTAYIM in </p>
<pre><code>preg_match (‚#<!-- START ‚. $tag . ‚ -->(.+?)<!-- END ‚.$tag . ‚ -->#si', $this->content, $tor);
$tor = str_replace (‚<!-- START ‚. $tag . ‚ -->', „", $tor[0]);
$tor = str_replace (‚<!-- END ‚ . $tag . ‚ -->', „", $tor);
</code></pre>
<p>preg_match is the line. Can anyone help me fix this?</p>
| php | [2] |
2,179,979 | 2,179,980 | Rounding DOwn to nearest whole number.... am i cheating or is this more than adequate | <p>essentially if the number generated is 2.3 then if i minus .5 it will then be 1.8 but the rounding function will make it 2 which is what i want. or if the answer is 2.99999 and I - minus .5 the answer is 2.49999 which should round down to 2 which is what i want. my question is if the answer is 2 even and i minus .5 the answer is now 1.5 will it still round up to 2. </p>
<pre><code>temp1_1= Math.round(temp2_2/(360/temp_value)-.5);
</code></pre>
<p>this is my line of code for this.</p>
| java | [1] |
5,055,863 | 5,055,864 | Does cancelling a Foreground Service's notification pull the service out of the foreground? | <p>I understand that the newer Android APIs require you to start an ongoing notification when the foreground service is running to alert the user that something is running.</p>
<p>My users are asking for a way to override this default behavior and hide the notification anyway (understandably).</p>
<p>If I hold a reference to the notification and cancel it after I call startForeground(..), will Android pull the service out of the foreground? </p>
| android | [4] |
1,834,824 | 1,834,825 | Simple Javascript issue | <p>I want select all the elements with the <code>id</code> named singleFeed1 to singleFeed10;</p>
<pre><code>for (var i=0;i<10;i++){
var post=document.getElementById('singleFeed'+i);
post.style.color='blue';
if (i==4){
post.style.color='red';
}
}
</code></pre>
<p>It doesn't seem to work.</p>
<p>my html</p>
<pre><code><li id=singleFeed1>aaaaaaaaaaaa</li>
<li id=singleFeed2>vvvvvvvvvvvv</li>
<li id=singleFeed3>dddddddddddd</li>
<li id=singleFeed4>aqqqqqqqqq</li>
<li id=singleFeed5>aaaaaddddaa</li>
......
......
</code></pre>
<p>Anyone has better solutions? Thanks.</p>
| javascript | [3] |
5,129,540 | 5,129,541 | It seems that ApplicationInfo.FLAG_UPDATED_SYSTEM_APP doesn't work correctly | <p>I try to track the system app before updating and I use:</p>
<pre><code>public static boolean isSystemApplication(Context ctx, IContent content) {
android.content.pm.PackageManager pm = ctx.getPackageManager();
List<android.content.pm.ApplicationInfo> apps = pm.getInstalledApplications(0);
for (android.content.pm.ApplicationInfo app : apps) {
if (app.packageName.equals(content.getContentPackage())) {
return (app.sourceDir.startsWith("/system/app/") && ((app.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP ) != 1));
}
}
return false;
}
</code></pre>
<p>but it seems that (app.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP ) != 1) returns always true even the system app was updated.</p>
| android | [4] |
5,010,191 | 5,010,192 | Jquery color change | <p>I have an element that can have an arbitrary background colour (set via a CMS).</p>
<p>I want to highlight it by brightening it on mouse over and darkening it on mouse out.</p>
<p>I tried using .css('background-color') to get and set the value but it seemed to be a lot more fiddly than I expected.</p>
<p>What's the non-dumb way to do this?</p>
<p>Edit: Just to clarify - the fiddly bit is parsing and doing arithmetic with colour values - not coping with the events. </p>
<p>Edit: The colour plugin gave me a way to read colour values but without colour arithmetic and writing support I still had to do some donkey work.</p>
<p>In the end I went with a fast 'fadeTo' but need to confirm that opacity animation works properly in IE6.</p>
| jquery | [5] |
2,459,584 | 2,459,585 | Return type of getId() on a thread object | <p>Why does, for example, <code>Thread.currentThread().getId()</code> return a long?</p>
<p>Does this really need to be 64 bits? Like I'm going to ever have a machine running that number of threads!</p>
<p>Seriously, it's a bit of a pain since I'm writing something that keeps a track of thread identifiers along with other bits and I'd really rather not have to use such a long number, else the unique key I have to generate is enormous.</p>
<p>Perhaps there is a convention on the long return; like the first 48 bits are always zero. I had a dig about on the internet but didn't find anything. I hope so; does anyone know for sure?</p>
<p>Thanks.</p>
| java | [1] |
2,041,462 | 2,041,463 | PreferenceActivity lifecycle | <p>I read <a href="http://developer.android.com/reference/android/app/Activity.html" rel="nofollow">http://developer.android.com/reference/android/app/Activity.html</a>
but I have a question about PreferenceActivity lifecycle:</p>
<p>Does a PreferenceActivity get onStop() or onDestory() call?</p>
<p>I understand it gets onStop() called when user clicks 'Back', but what about onDestory()?
when does onDesgtory() for PreferenceActivity get called?</p>
<p>Thank you.</p>
| android | [4] |
5,658,033 | 5,658,034 | Adding text from JS var on change event using jquery | <p>Im trying to accomplish something "like" this. I want to add the text stored in some JS variables into the doc based on the value selected in a combo. i.e. how do I reference JS variables based on the selected value of a combo?</p>
<pre><code><select id="clickMe">
<option value="a">a</a>
<option value="b">b</a>
<option value="c">c</a>
</select>
<span id="attachHere"></span>
<script>
var a = "something about a";
var b = "something about b";
var c = "something about c";
$(document).ready(function() {
$("#clickMe").change(function() {
$("#attachHere").text($("#clickMe").val());
});
});
</script>
</code></pre>
| jquery | [5] |
3,045,986 | 3,045,987 | Parsing Complex JSON Javascript | <p>I am able to parse JSON that returns simple data, with JSON.parse but I am having trouble with data that returns objects, dates, strings, etc..</p>
<pre><code>var theData=JSON.parse(theData);
</code></pre>
<p>Something like this JSON.parse returns [Object] object back with no data at all (I can see the data is being successfully returned because it returns all the data as a string if I have JSON.parse turned off). </p>
<pre><code>{"AppName":"TheName","AppUrl":"https:\/\/app\/icons\/unknown.png","aGUID":"45c055d2-2edc-d4444"."DateCreated":"8\/23\/2012 11:04AM", {"ID":"yser123",Name":"User"}}
</code></pre>
<p>What is the best way to go about parsing this data in javascript(I am not able to use jquery)?</p>
<p>Note: I had wrote the JSON assume its valid</p>
<p>Here is the code I am using to retreive the data..</p>
<pre><code>var xhReq = new XMLHttpRequest();
xhReq.open("POST", "ClientService.svc/REST/GetDetail", false);
xhReq.send(null);
var serverResponse = xhReq.responseText;
alert(serverResponse);
return serverResponse;
</code></pre>
| javascript | [3] |
1,328,510 | 1,328,511 | how to create a xml file and write in android and put into raw folder | <p>can anybody tell how to create a xml file and write in android and where to put the file for aceess again is it possible to put into raw folder ?</p>
| android | [4] |
4,883,740 | 4,883,741 | What are the things Java got right? | <p>What are the things that Java (the language and platform) got categorically right? In other words, what things are more recent programming languages preserving and carrying forward? </p>
<p>Some easy answer are: garbage collection, a VM, lack of pointers, classloaders, reflection(?) </p>
<p>What about language based answers? </p>
<p>Please don't list <a href="http://stackoverflow.com/questions/457884/what-are-the-things-java-got-wrong">the things Java did wrong</a>, just right. </p>
| java | [1] |
79,742 | 79,743 | php curl_init() not working | <p>am trying to send SMS using the url but it's not working the result is empty this is my code </p>
<pre><code>$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
/**
* Ask cURL to return the contents in a variable
* instead of simply echoing them to the browser.
*/
//Using Proxy
// curl_setopt($ch, CURLOPT_PROXY, '212.138.39.84:8080');
//
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
/**
* Execute the cURL session
*/
$result = curl_exec ($ch);
/**
* Close cURL session
*/
curl_close ($ch);
$result=explode("\n",$result);
$result=$result[(count($result)-1)];
$result;
</code></pre>
<p>can anyone help me ???</p>
| php | [2] |
1,284,813 | 1,284,814 | Problem with date() and strtotime | <p>Here is what I have:</p>
<pre><code>$str = '12-25-2009';
echo date('Y-m-d', strtotime($str));
</code></pre>
<p>This produces 1969-12-31 instead of 2009-12-25. If I set the $str var to 01-01-2009, I will get 2009-01-01 which is correct. Why is this happening?</p>
| php | [2] |
286,479 | 286,480 | Set alternating row class with rowspans and jquery | <p>If I have a html table with <code><tr></code>'s, but with those tr's there are <code><td></code>'s with rowspans, I need to figure out the quickest way to set the alternating row class for coloring with jQuery. Does anyone know of a plugin that does this?</p>
| jquery | [5] |
3,633,002 | 3,633,003 | UITextField and UILabel updating problem | <p>I have two classes, one with textField and button and other is with label. These two classes have different views.
I want to fill text in textField and save it with button press. I want to show the updation on label. But it does not do it dynamically or side by side. </p>
<p>Label keep on showing same values or i have to restart the iPhone simulator. </p>
<p>Any suggestion?Thanks in advance.</p>
| iphone | [8] |
479,643 | 479,644 | How do I find out the which Android devices will run my application? | <p>Is there a standard way in Java to find out which Android devices (like tablet or phone) my application will run on?</p>
| android | [4] |
3,987,852 | 3,987,853 | Unable to identify error in JavaScript code | <p>I am learning JavaScript from the book DOM Scripting. The following code is not working:</p>
<pre><code>window.onload = prepareLinks;
function prepareLinks() {
var links = document.getElementsByTagName("a");
for (var i = 0; i < links.length; i++) {
if (links[i].getAttribute("class") == "popup") {
links[i].onclick = function () {
popUp(this.getAttribute("href"));
return false;
}
}
}
}
function popUp(winURL) {
window.open(winURL, "popup", "width=320, height=480");
}
</code></pre>
<p>Can anybody tell me what the problem is with the code?</p>
| javascript | [3] |
5,519,184 | 5,519,185 | Need to copy a file using wget in windows | <pre><code>import java.io.*;
class demo
{
public static void main(String str[]) throws Exception
{
Process p = Runtime.getRuntime().exec("wget -P C:\vignesh\Docx\docx_final\Html2Docx\src http://anbu/upload/ExportHtml.html");
p.destroy();
}
}
</code></pre>
<p>Hi all,</p>
<p>I want to copy a file from URL to my folder(src). I tried through java, i got error illegal escape character. but the above wget works in command prompt. Please help me..Thanks in advance.</p>
| java | [1] |
2,585,136 | 2,585,137 | Icon for menu inflater item | <p>about an Android app, How can I insert an icon on a Menu inflater item? (For example this (?) on a voice called "About")
Regards.</p>
| android | [4] |
2,465,154 | 2,465,155 | present a modal view from a modal view currently presented | <p>I need to implement kind of a chain of modal view,
in which a modal view is called from a modal view currently presented.
I believe I have implemented everything right,
but it crashes.</p>
<p>Is it a feasible idea?</p>
<p>this is how I'm calling the second modal view from the first modal view</p>
<pre><code>hofButton = [[UIButton alloc] init];
hofButton.frame = CGRectMake(700.0, 450.0, 300.0, 200.0);
[hofButton addTarget:self action:@selector(showHOF:)
forControlEvents:UIControlEventTouchUpInside];
-(void)showHof{
modalHallOfFame = [[hallOfFame alloc] init];
modalHallOfFame.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:modalHallOfFame animated:YES];
}
</code></pre>
| iphone | [8] |
1,307,752 | 1,307,753 | how to open row in edit mode in gridview | <p>how to make gridview ro visible false when i click on delete button because i am using static data and
i want to open the row in gridview in edit mode when i click on edit button.
How to do this in c#</p>
| asp.net | [9] |
5,018,166 | 5,018,167 | How to hide id in page routing in asp.net 4.0? | <p>Using page route i had created following URL</p>
<p><a href="http://www.domain.com/products/xyz/1.aspx" rel="nofollow">http://www.domain.com/products/xyz/1.aspx</a></p>
<p>but i want rename above url as</p>
<p><a href="http://www.domain.com/products/xyz.aspx" rel="nofollow">http://www.domain.com/products/xyz.aspx</a></p>
<p>i donot want show id in url but also able to access is in other page using Page route.</p>
<p>Thanks in advance.</p>
| asp.net | [9] |
1,494,618 | 1,494,619 | how to parse this url? | <p>if I have this url: <code>node/95/pdf/1</code>. How will I able to get the numeric/value 1? Tried the parse_url but gave me the wrong output. </p>
<p>PS: the value 1 is just an example, the id is dynamic depends on what the user click.</p>
| php | [2] |
2,542,924 | 2,542,925 | Copying ArrayList to Array of primitives - is there some bypass to this given this spec? | <p>So I'm to write a simple thing which reads an input file till EOF reached - the file consists of int-double pairs. I'm to calculate the average of all the elements in the second array and finally have both sets of data stored in respective arrays of primitive data types.</p>
<p>Of course the task is easy so the question isn't directly about it - rather, about the <em>array</em> part. As I don't know how many pairs I'll have to store, I use two ArrayLists to store it. The spec strictly points that in the end, however, both ints and doubles have to be store in primitive arrays - and here comes my question. Is there some faster way to do this than just copying the ArrayList to a primitive type array? I can't use an array from the beginning since I don't know the size or even an upper bound and using toArray() also woulnd't work as I have to have primitive int[] and double[] in the end, not objects of Integer[] and Double[].</p>
| java | [1] |
2,286,134 | 2,286,135 | how to use one decimal in jquery using regular expression | <p>I want use only one decimal and only number in input type.so i am using jquery but problem is he is taking more decimal?????
i want to like this:123.1245454<br>
not to 12345.12245.4554</p>
<pre><code>$('#edit-discount').keyup(function() {
var $th = $(this);
$th.val($th.val().replace(/[^0-9.]/g, function(str) {
$("#req-productdis").hide();
$("#alpha1").show();
return '';
}));
</code></pre>
| jquery | [5] |
3,534,080 | 3,534,081 | Why can't I see the main function implementation in my iPhone project templates in Xcode? | <p>That's strange, since apple says that there is somewhere an main function. But I really can't find any.</p>
<p>It should look somehow like this:</p>
<pre><code>#import <UIKit/UIKit.h>
int main(int argc, char *argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}
</code></pre>
<p>What file is that where I can see it? Is it hidden?</p>
| iphone | [8] |
3,883,080 | 3,883,081 | Why are these lists the same? | <p>I can't understand how x and y are the same list. I've been trying to debug it using print statements and <code>import code; code.interact(local=locals())</code> to drop into various points, but I can't figure out what on earth is going on :-(</p>
<pre><code>from collections import namedtuple, OrderedDict
coordinates_2d=["x","y"]
def virtual_container(virtual_container, objects_type):
"""Used to create a virtual object given a the type of container and what it holds.
The object_type needs to only have normal values."""
if issubclass(virtual_container, list):
class my_virtual_container_class:
"""This singleton class represents the container"""
def __init__(self):
#Define the default values
__vals__=OrderedDict([(key,list()) for key in objects_type])
print(id(__vals__["x"]), id(__vals__["y"]))#ids are different: 12911896 12911968
#Then functions to access them
d={key: lambda self: self.__vals__[key] for key in objects_type}
d["__vals__"]=__vals__
#Construct a named tuple from this
self.attr=type('attr_cl',(), d)()
print(id(self.attr.x()), id(self.attr.y()))#ids are same: 32904544 32904544
#TODO: Define the operators __del__, setitem, getitem. Also append
return my_virtual_container_class()
#Nice method of handling coordinates
coordinates=virtual_container(list, coordinates_2d)
x=coordinates.attr.x()
y=coordinates.attr.y()
x.append(1)
y.append(2)
print(x, y)#Prints [1, 2] [1, 2]
</code></pre>
| python | [7] |
4,008,981 | 4,008,982 | Design Advice on Getter or Const for String in Classes - what are others doing? | <p>I am seeking some advice on what is the recommend way to use 'constant' strings within my classes, e.g.</p>
<pre><code>public string EmployeesString { get { return "Employees"; } }
const string EmployeeString = "Employee";
</code></pre>
<p>The reason I would like to implement these, i.e. either via a const or via a getter, is because throughout my class(es), I have methods and constructors that use these strings as parameters and I was thinking to avoid typos and also to avoid using strings (weakly-typed?), I wanted to reference them strongly, e.g.</p>
<pre><code>DoSomething(this.EmployeeString, employee);
</code></pre>
<p>What are others doings? Any advice will be greatly appreciated! Is this good/bad?</p>
| c# | [0] |
5,435,919 | 5,435,920 | Configuration Error on initializeData="<app root directory>\Asptesttrace.log" /> | <p>I am following the Walkthrough: Integrating ASP.NET Tracing with System.Diagnostics Tracing document and when I get the section on Routing All Tracing Output to .NET Framework Tracing it said to add the following the to the trace section in the web.config </p>
<pre><code><add name="TestTracer"
type="System.Diagnostics.TextWriterTraceListener, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
initializeData="<app root directory>\Asptesttrace.log" />
</code></pre>
<p>The <code>initializeData="<app root directory>\Asptesttrace.log" /></code> part is giving a compile error.
In visual studio the it said the app root and directory part need tags.
When run the default.aspx page there error shown in the webpae is </p>
<h2>Server Error in '/' Application.</h2>
<p>Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. </p>
<pre><code>Parser Error Message: '<', hexadecimal value 0x3C, is an invalid attribute character. Line 25, position 27.
Source Error:
Line 23: <add name="TestTracer"
Line 24: type="System.Diagnostics.TextWriterTraceListener, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
Line 25: initializeData="<app root directory>\Asptesttrace.log" />
Line 26: </listeners>
Line 27: </trace>
</code></pre>
<p>Of I am stumped what is wrong?</p>
| asp.net | [9] |
5,092,119 | 5,092,120 | Integrate Spell Corrector/Checker on my Android App | <p>I'm a beginner and I'm trying to develop an APP for my android device.</p>
<p>But I can't finish because I don't know how I can check the words (input) that the users introduce on it. </p>
<p>There's any library or other way that I could use for checking all the words that users introduce??</p>
| android | [4] |
225,694 | 225,695 | How to use API Level 17 methods in app and complie the code for Ginger Bread? | <p>I am new to android. I've downloaded ADT and it has come with Jelly Bean ( API Level 17 ) SDK.</p>
<p>I have set the target sdk to be "9" in the AndroidManifest.xml.</p>
<p>I am able to use latest API level 17 methods and it runs great on android JB simulator.</p>
<p>But after making the build, if I try to install it in my real ginger bread device, the simplest app won't run and crash.</p>
<p>Can anyone suggest me a solution to this ?</p>
| android | [4] |
1,002,782 | 1,002,783 | UNEXPECTED T_CONSTANT_ENCAPSED_STRING Error | <p>I am getting an UNEXPECTED T_CONSTANT_ENCAPSED_STRING error in this line </p>
<pre><code> $portfolio_html.= '<li> <a href=" "><img height="54" width="60"
src="images/portfolio_uploads/orig_'.$portfolio_item['image'].'"></a></li>';
</code></pre>
<p>Can any body help??</p>
| php | [2] |
2,600,188 | 2,600,189 | Why I get "Server Error" after this PHP if conditional? | <p>I want to restrict any direct access to the results page, but I allow it if the user comes from the index.html. So I wrote the following code but it does not make the trick.</p>
<pre><code>$selected= $_POST['selected'];
if empty($selected) {
header('Location: index.html');
}
</code></pre>
| php | [2] |
3,763,424 | 3,763,425 | What is the meaning of $.fn[abcd] | <p>I am working with some old code that I did not write, and need some help understanding it. </p>
<pre><code>(function() {
var abc = "SORocks";
$.fn[abc] = function (x) {
doSomethingCool();
};
})(jQuery)
</code></pre>
<p>and elsewhere in the code are statements like
("#mydiv").SORocks(1234);</p>
<p>What does the [abc] do? Is it the same as $.fn.SORocks(x)?</p>
| jquery | [5] |
2,151,571 | 2,151,572 | Python : is there a shortcut for pattern [sth = get_sth() ; if sth: do_a_thing_on(sth)] | <p>HI !</p>
<p>I guess everything is in the question ...
I was just wondering if there is a nice way in Python to shorten this pattern :</p>
<pre><code>something = get_something()
if something:
do_a_thing_with(something)
</code></pre>
<p>Meaning that I would like to enter in the <code>if</code> context only if the variable <code>something</code> is not None (or False), and then in this context having this variable set automatically ! Is it possible with <code>with</code> statement ?</p>
<p>PS : I don't want to have to DEFINE more stuff... I am looking for some statement to use on the fly ?!</p>
| python | [7] |
2,632,572 | 2,632,573 | Android remove recent call list | <p>How to delete recent call list in Android 1.6, programmaticaly.</p>
<p>I deleted the call log using the URI (content://call_log/calls). It workes fine on 2.o and above version. I am not able to delete recent call list using this URI in 1.6 API level handsets.</p>
<p>Please let me know is there any other URI to fetch Recent Call list and method to remove the recent call list?</p>
<p>Thanks </p>
| android | [4] |
2,786,521 | 2,786,522 | PHP - Separate upper and lower case characters | <p>I want to separate upper or lower case characters.</p>
<p>In this text : "HELLO WORLD how are you"</p>
<p>I want to have in the first variable : "HELLO WORLD"
and "how are you" in the second.</p>
<p>How can I do that with php ?</p>
<p>Thanks a lot </p>
| php | [2] |
1,386,950 | 1,386,951 | Dynamically detect whether the div is slid down? | <p>I am using a div:</p>
<pre><code><div class="testDivClass" id="myDiv"></div>
</code></pre>
<p>The div will be slid down and up with <code>$("#myDiv").slideDown()</code> and <code>$("#myDiv").slideUp()</code> respectively.</p>
<p>In certain scenario I want to slide up the div if it is visible, i.e. slid down. I tried a solution like using <code>$("#myDiv").slideToggle()</code> however this won't work as this will slide down the div if it's slide up. Is there any way using jQuery to know whether the div is slid down (visible) or not?</p>
| jquery | [5] |
2,751,242 | 2,751,243 | PHP caching class | <p>I'm a AS3 coder and i do a bit of php and i am having a hard time doing a static class that can cache variables.</p>
<p>Here's what i have so far :</p>
<pre><code><?php
class Cache {
private static $obj;
public static function getInstance() {
if (is_null(self::$obj)){
$obj = new stdClass();
}
if (!self::$instance instanceof self) {
self::$instance = new self;
}
return self::$instance;
}
public static function set($key,$value){
self::$obj->$key = $value;
}
public static function get($key){
return self::$obj->$key;
}
}
?>
</code></pre>
<p>And i use the following to set my variable into an object of my static class :</p>
<pre><code><?php
include 'cache.php';
$cache = new Cache();
$cache->set("foo", "bar");
?>
</code></pre>
<p>And this is retrieve the variable</p>
<pre><code> <?php
include 'cache.php';
$cache = new Cache();
$echo = $cache->get("foo");
echo $echo //doesn't echo anything
?>
</code></pre>
<p>What am i doing wrong ? Thank you</p>
| php | [2] |
4,705,903 | 4,705,904 | Incrementing a number with JavaScript returns an error | <pre><code>var count = {
digit: 0,
increment: function() {
setInterval(function() {
count.digit++;
}, 500);
if (count == 10) {
count.increment = null;
}
}
};
document.write("The number is " + count.digit);
count.increment();
</code></pre>
<p>The result is: "The number is 0" but it does not increment. Why?</p>
| javascript | [3] |
4,417,090 | 4,417,091 | touchesBegan don't callback? | <p>I have one scrollView and there is ImageView in it but when i click on UIImageView the touchesBegan doesn't called? Please give me any idea why it happens?</p>
| iphone | [8] |
3,058,007 | 3,058,008 | Don't animate if already animating | <p>Going mad. I had this working and then stupidly overwrote my code without a backup, and now can't remember how I did it!</p>
<p>I have a drop down social yeti: <a href="http://projects.jonhudsonweb.com/work" rel="nofollow">http://projects.jonhudsonweb.com/work</a></p>
<p>However if you repeatedly run mouse over it it repeats the animation again and again. Here is my failed effort to stop this:</p>
<pre><code>$('#social-yeti').not(':animated').hoverIntent(function(){
$(this).delay(300).animate({top:"+=203"}, 1000)
}, function(){
$(this).delay(300).animate({top:"-=203"}, 1000)
}
);
</code></pre>
<p>I'm sure this is how I did it before though! Any help greatly appreciated!</p>
| jquery | [5] |
2,364,887 | 2,364,888 | token parsing in java | <p>i have created a file with printStream object as shown below.</p>
<pre><code>PrintStream outPutOffice = new PrintStream(
new BufferedOutputStream(new FileOutputStream(inDir+"/Office.txt")));
outPutOffice.print(fValue + (findx < agtOffColCount ? "|" : ""));
</code></pre>
<p>now i have to read it content and sepeate it tokens with "|" as i have written token with "|" separted. i have write code as shown below it will read line correctly but not separate token with "|" character.</p>
<pre><code>BufferedReader inPutAgent = new BufferedReader(
new InputStreamReader(new FileInputStream(inDir+"/Office.txt")));
String column=inPutAgent.readLine();
String []columnDetail = column.split("|");
</code></pre>
<p>columndetail array contains single character in each index instead i want single token in each index.
so what is the problem.</p>
<p>thanks in advance</p>
| java | [1] |
4,736,716 | 4,736,717 | Use of viewDidUnoad | <p>What is the use of viewDidUnload and didReceiveMemoryWarning methods?</p>
<p>When they actually get called?</p>
<p>what are the difference between dealloc, viewDidUnload and didrecievedmemorywarning?</p>
| iphone | [8] |
3,412,399 | 3,412,400 | Android Webview video play | <p>I'm working on a app which uses a webview to display webpages, i want to play the videos if the url is a video link(youtube) or a video contains as a part of the webpage. I've tried to add the url directly to the webview but it doesnot play even youtube links, i've already enabled plugins and javascript in webview..... can anyone help me on this issue,</p>
| android | [4] |
2,889,884 | 2,889,885 | dynamic create editbox in android? | <p>I want to create a Editbox dynamically when i click a add button and i also want to get the values typed in that Editbox when i click in save button.</p>
<p>Please Help me. Regards. Augustine</p>
| android | [4] |
4,063,346 | 4,063,347 | PHP method for replacing a certain "index" in a string (like the 3rd character for instance) with another string | <p>Say I hate the word "hat". I want a function that would work something like <code>strreplace("hat", 1, "o")</code> therefore changing it into <code>hot</code> instead of <code>hat</code>.</p>
<p>Is there a way to do this with a function? Or do I have to write my own?</p>
| php | [2] |
2,406,580 | 2,406,581 | Android Development: How do graphics work in Android? | <p>I am an android development beginner with some experience in other object oriented languages like java, python, c#. So I have created various games before in Java, using buffers and graphics to draw lines and stuff. How do I do that stuff in android? I looked at some online guides, and they all seem to create a class to extend a View object, and the class will overrule the onDraw method, where they can cause the Canvas or something to draw a line.</p>
<p>But what if you want to draw a line based on user input? That method wouldn't work then would it?</p>
<p>For example, what is the simplest code for which I could draw a circle where the user touches the screen?</p>
<p>Also, i was wondering what books people would reccomend for beginners, especially one that includes stuff on graphics? I user the developer site for android, but I feel a book would also help a lot to understand android? Any suggestoins?</p>
<p>Thank you for your time, I greatly appreciate it!</p>
| android | [4] |
4,266,262 | 4,266,263 | Function not repeating On Click? | <p>I'm trying to make a small Android game. My on click function however is not getting repeated... It adds one point the first time and then stops working. It looks correct to me.</p>
<pre><code>addButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View v) {
playerScoreField = (TextView)findViewById(R.id.playerScore);
int playerScore = 0;
if(playerScore != target){
playerScore++;
playerScoreField.setText("You are at: " + playerScore);
} else {
addButton.setClickable(false);
addButton.setEnabled(false);
countDown.onFinish();
}
}
});
</code></pre>
| android | [4] |
4,441,362 | 4,441,363 | how to use json on mac os | <p>i have encountered a very strange issue: i use json.dump to write a file and then use json.load to read the file. </p>
<p>The same code can run succeed on windows 7 but it can not do on mac os x 10.7
Below is the code: </p>
<pre><code>class Result:
def __init__(self,name,result):
self.name = name
self.result = result
def __repr__(self):
return 'Result name : %s , result : %s' % (self.name,self.result)
class MyEncoder(json.JSONEncoder):
def default(self,obj):
#convert object to a dict
d = {'CaseResult':{}}
d['CaseResult'][obj.name] = obj.result
return d
def save(name,result):
filename = 'basic.json'
obj = Result(name,result)
obj_json = MyEncoder().encode(obj)
with open(filename, mode='ab+') as fp:
json.dump(obj_json,fp)
s=json.load(fp)
save('aaa','bbb')
</code></pre>
<p>in mac os it give an error "ValueError:NO JSON object could be decoded"
who can tell me why this happen and how can i resolve it</p>
| python | [7] |
1,660,975 | 1,660,976 | javascript to add source URL | <p>I am using the following code in CEWP (content editor webpart) so after taking a survey user will be redirected to thank you page. the redirecting is not working. Am I missing something? (user able to take survey and newform.aspx never closes)</p>
<pre><code><script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="text/javascript">
function PreSaveAction(){
var URL = location.pathname.replace("NewForm.aspx","/surveys/Pages/ThankYou.aspx");
if(GetUrlKeyValue("IsDlg")==="1"){
URL+="?IsDlg=1";
}
$("#aspnetForm").attr("action",location.pathname+"?Source="+URL);
return true;
}
</script>
</code></pre>
| javascript | [3] |
695,924 | 695,925 | Comparing an URL to a given list of URL schemes in Javascript | <p>Using JavaScript I would like to check if a given URL matches a list of URL schemes. I have come this far:</p>
<pre><code>function on_wikipedia() {
// the list of allowed locations
var allowed_locations = new Array( "http://*.wikibooks.org/*"
, "http://*.wikimedia.org/*"
, "http://*.wikipedia.org/*"
, "http://*.wikiquote.org/*"
, "http://*.wikiversity.org/*"
, "http://*.wiktionary.org/*"
, "http://www.mediawiki.org/*"
, "https://secure.wikimedia.org/*"
);
// current location; e.g. "http://en.wikipedia.org/wiki/Main_Page"
var current_location = content.document.location;
var valid = false;
// compare current_location to allowed_locations and set valid to true,
// if it matches
//
// FIXME
return valid;
}
</code></pre>
<p>Maybe it is a bad idea to do it like this. Maybe I should use regular expressions to make the comparason? Unfortunately I'm lost... I have no JavaScript experience at all. Could someone please point me in the right direction?</p>
| javascript | [3] |
3,896,695 | 3,896,696 | PHP DOMDocument not loading | <p>Even though my phpinfo() shows my DOM as enabled, when I try to call it I get an error that the class was not found. I have tried this both on MAMP and on our IIS server and the same thing happens. We are running 5.2+ versions of PHP. Anyone have any thoughts about this?</p>
| php | [2] |
5,140,320 | 5,140,321 | python equivalent of Comparable | <p>Ok,</p>
<p>So here's my situation. I have a dictionary of the following form:</p>
<pre><code>{ <Category('Simulate', 'False', 'False', 'False', 'INTERMEDIATE')>: {'link': u'/story/4/tvb-adapters-simulator-simulatorAdapter/SimulatorAdapter', 'name': u'Simulate'},
<Category('View Results', 'True', 'False', 'True', 'INTERMEDIATE')>: {'link': '/story/step/3', 'name': u'View Results'},
<Category('Analyze', 'True', 'False', 'False', 'FINAL')>: {'link': '/story/step/2', 'name': u'Analyze'}}
</code></pre>
<p>Category is a class representing an instance from a database. Now I have the following instance:</p>
<pre><code> <Category('Analyze', 'True', 'False', 'False', 'FINAL')>
</code></pre>
<p>Now this is not the same instance. By this I mean, I get all the values from the database and create the dictionary. Then after a while I get an id and retrieve the instance from the database. Now they are not the same objects. I now have to check if it's in the dictionary, but:</p>
<pre><code>instance in disctionary
</code></pre>
<p>Will return false. Now I could go the ugly way and iterate over the dictionary checking if all the values match, however does Python have a more clever way to do this? I mean something like the equivalent of Comparable in Java?</p>
<p>Regards,
Bogdan</p>
| python | [7] |
3,295,456 | 3,295,457 | I want to implement the flip touch event in iPhone | <p>In my application I have two images which are arranged in circle.</p>
<p>I want to imeplement something like when user flips his finger downwards or in circle the position of the images must be swapped.</p>
<p>How to do it in iPhone.</p>
| iphone | [8] |
70,499 | 70,500 | Can I append items to a list that I am looping through in Python? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3752618/python-adding-element-to-list-while-iterating">Python: Adding element to list while iterating</a> </p>
</blockquote>
<p>This doesn't seem to work, but I am not sure why:</p>
<pre><code>for n in poss:
poss.append(n+6)
</code></pre>
<p>Is there some rule that says I can't append items to a list that I am currently looping through?</p>
| python | [7] |
4,790,494 | 4,790,495 | How to animate dynamically generated html in jquery | <p>I'm fetching tabular data from the server using jquery's ajax function. And I'm using the .html function to assign the fetched data inside a div with an id of list_forms.
How do I animate it?
I'm trying <code>$('#list_forms').html(data).show('slow');</code> but its not working.</p>
<pre><code>$.ajax({
type: "POST",
url: "item_lister.php",
data: "category=" + action,
success: function(data){
$('#list_forms').html(data);
}
});
</code></pre>
| jquery | [5] |
4,006,501 | 4,006,502 | XMLHttpRequest.open, does it work on remote websites? | <p>I'm a bit confused about this. </p>
<p>Does XMLHttpRequest work on a remote URL or does it have to be a local file? There seems to be mixed information on the net.</p>
<p>According to w3.org: <em>The XMLHttpRequest object can be used by scripts to programmatically connect to their originating server via HTTP.</em> </p>
<p>But I've seen it used to access non-local web pages (in vista gadgets for instance for rss feeds) without using a proxy...</p>
<p>Enlighten me please!</p>
| javascript | [3] |
2,837,194 | 2,837,195 | Dynamic functions in python | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/12423614/local-variables-in-python-nested-functions">Local variables in Python nested functions</a> </p>
</blockquote>
<p>Here is my problem, I need to create functions dynamically in python. I have a list in parameter and I need to create a function for each element of this list.</p>
<p>Here is an example :</p>
<pre><code>list_func = []
list_param = ['foo','bar']
for param in list_param:
def print_func():
print(param)
list_func += [print_func]
for func in list_func:
func()
</code></pre>
<p>with this code the second loop will just print the last parameter.
Here is the output :</p>
<pre><code>bar
bar
</code></pre>
<p>I need</p>
<pre><code>foo
bar
</code></pre>
<p>Thanks</p>
| python | [7] |
1,582,988 | 1,582,989 | jQuery Remove a tag, but keep innerHtml | <p>I have some simple HTML which I need to strip simple formatting.</p>
<pre><code>A nice house was found in <b>Toronto</b>.
</code></pre>
<p>I need to remove the bold, but leave the sentence intack.</p>
<p>Is this possible in jQuery?</p>
| jquery | [5] |
2,346,821 | 2,346,822 | Keep Messagebox.show() on top of other application using c# | <p>How to keep a Messagebox.show() on top of other application using c# ??</p>
| c# | [0] |
465,428 | 465,429 | UIBarButton as a backbutton style | <p>Hi
i'm displaying UIBarButton on Navigation bar as back button,how can i've the default back button style for the UIButton.</p>
<p>Regards
Sam.</p>
| iphone | [8] |
17,401 | 17,402 | Is there a free GUI software to compile Java | <p>I am a total total beginner in Java actually I am .net dev trying to fix something in java.
I think I have fixed it however I need to compile the files.
I have used the dos javac etc... but i never seem to get it right.
I have 20 files to compile.</p>
<p>Any suggestions on a gui?</p>
| java | [1] |
4,121,570 | 4,121,571 | javascript that produces functioning javascript | <p>can you write javascript that produces/writes/etc. functioning javascript?</p>
<p>for example, have a link that has a function tied to it that when clicked produces a functioning javascipt snippet? The snippet could deal with a completely other elements.</p>
<p>For example</p>
<p>Link #1(has the javascript function that produces javascript) Link #2(does absolutely nothing for now)</p>
<p>Click on link #1(produces javascript snipped that says "when link #2 is clicked document.write('hello')"</p>
<p>Clicking on link #2 now produces "hello" whereas it previously did nothing. Is that possible?</p>
| javascript | [3] |
2,567,868 | 2,567,869 | Update Android SDK manager without Internet Connection but by earlier downloading for another SDK | <p>Lets say there are many pc s and each pc has Android SDK installed.And one pc updates its SDK because it has internet connection.In this way, all downloads are installed that SDK directly. I want to know whether there is a way to download SDK updates as a separate file (and not directly update the SDK) and other pc s(which have not internet connection) are updated with that downloaded file. (In other words download one update and share it among other pc s and update all pc s by one downloaded file)</p>
| android | [4] |
3,179,882 | 3,179,883 | Custom Callback Handler | <p>I am trying to understand mechanism of callback handler. How is the handle() method invoked? Can anybody give an example of usage of custom callback handler (other than those used in Login Modules of JASS or so) in non Swing application?</p>
| java | [1] |
4,446,141 | 4,446,142 | Remove the Selected Item From ListView | <p>How can I remove a selected item from a listview?</p>
| c# | [0] |
1,889,436 | 1,889,437 | can cURL operations be inside the API server side code? | <p>I see an example server side API that has cURL operations, I thought cURL is supposedly client side request. The following class API is the server side code but inherited from newtwork class which has a bunch of uCurls operations.</p>
<blockquote>
<p>class Api extends Api\Network</p>
<pre><code>abstract class Network {
const GET = 'GET';
const POST = 'POST';
const HTTP_OK = 200;
const HTTP_CREATED = 201;
protected function curl($type, $url, $queryString = array())
{
$s = curl_init();
switch (strtoupper($type)) {
case self::POST:
echo "$url\n";
echo \http_build_query($queryString) . "\n";
die();
curl_setopt($s, CURLOPT_URL, $url);
curl_setopt($s, CURLOPT_POST, true);
curl_setopt($s, CURLOPT_POSTFIELDS, $queryString);
break;
case self::GET:
curl_setopt($s, CURLOPT_URL, $url . '?' .
</code></pre>
<p>http_build_query($queryString));
break;
}</p>
<pre><code> curl_setopt($s, CURLOPT_RETURNTRANSFER, true);
$_out = curl_exec($s);
$status = curl_getinfo($s, CURLINFO_HTTP_CODE);
curl_close($s);
switch ($status) {
case self::HTTP_OK:
case self::HTTP_CREATED:
$out = $_out;
break;
default:
throw new \Exception("http error: {$status}",
</code></pre>
<p>$status);
}
return $out;
} }</p>
</blockquote>
| php | [2] |
1,275,586 | 1,275,587 | function not working for jquery load() content tags? | <pre><code>$(function(){
$(".tiptip").tipTip();
});
</code></pre>
<p>this tooltip function is working for all links.But it doesn't work for what are loaded through jquery load() function.</p>
<p>I have experienced in live() function.I have used this function on content events(click,change,blur) loaded via load().</p>
<p>But i don't know how to use this for content loaded via load().</p>
<p>Please help me.</p>
| jquery | [5] |
1,707,699 | 1,707,700 | animation.start() or animation.startNow() does not start the animation immediately | <p>I have a strange issue - from time to time the animation that should fade out my control (ImageButton) does not kick in immediately. I am using the fadeout animation to hide it and then in myListener on its end (onAnimationEnd) I put new resource as the image on the button. </p>
<p>Somewhere in my app code:</p>
<pre><code>Animation a = AnimationUtils.loadAnimation(this,R.anim.fadeout);
a.setAnimationListener(new myListener(location));
buttons[location].setAnimation(a);
a.startNow(); // regardless if its start() or startnNow()
// it will work in most of the cases but not 100% reliable
// I actually can see in debug Log when its late, happens after few more clicks
</code></pre>
<p>Then in myListener.onAnimationEnd(Animation a):</p>
<pre><code>buttons[location].setImageResource(R.drawable.standard_button);
</code></pre>
<p>Seems there is a rule that the every 4th or 5th animation does not start ... </p>
<p>Thanks for help! </p>
| android | [4] |
3,610,983 | 3,610,984 | keyword position in google search using C# | <p>I am using a website to find a keyword position in google search ... i have two text boxes(one textbox for getting URL and another textbox for getting Keyword) and
,one label(to display the position of the keyword in the URl) and one button in my page...
When i clicked that button it have to get the URL and Keyword and search the keyword in google
and give the position.... i got that URL and Keyword and it s searching in the google properly but i have not get that Position...</p>
<p>How shall i get that position? Anyone Tell me the solutionof this... My code is</p>
<pre><code> protected void btnSubmit_Click(object sender, EventArgs e)
{
string strUrl = txtUrl.Text;
Uri newUri = new Uri("http://www.Yahoo.com");
int I = GetPosition(newUri, txtKeyword.Text);
}
public static int GetPosition(Uri url, string searchTerm)
{
string raw = "http://www.google.com/search?num=39&q={0}&btnG=Search";
string search = string.Format(raw, HttpUtility.UrlEncode(searchTerm));
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(search);
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.ASCII))
{
string html = reader.ReadToEnd();
return FindPosition(html, url);
}
}
}
private static int FindPosition(string html, Uri url)
{
string lookup = "(<a class=l href=\")(\\w+[a-zA-Z0-9.-?=/]*)";
MatchCollection matches = Regex.Matches(html, lookup);
for (int i = 0; i < matches.Count; i++)
{
string match = matches[i].Groups[2].Value;
if (match.Contains(url.Host))
return i + 1;
}
return 0;
}
</code></pre>
<p>Here i get that matches.count always 0 so it always returns Zero... How can i get matches.count</p>
| c# | [0] |
1,096,251 | 1,096,252 | IndexOutOfBoundsException: charAt: 49 >= length 69 | <p>Being getting some weird exceptions via bug reports for an Android game app.</p>
<p>The specific code that causes the problem is (mOutroTextLayout is a StaticLayout object):</p>
<pre><code>if(mOutroTextLayout != null) {
canvas.save();
canvas.translate((25 * mScale) + 0.5f, (78 * mScale) + 0.5f);
mOutroTextLayout.draw(canvas); // This is line 903
canvas.translate(-((25 * mScale) + 0.5f), -((78 * mScale) + 0.5f));
canvas.restore();
}
</code></pre>
<p>The exception error that it generates:</p>
<pre><code>java.lang.IndexOutOfBoundsException: charAt: 49 >= length 69
at android.text.SpannableStringBuilder.charAt(SpannableStringBuilder.java:112)
at android.text.Layout.getLineVisibleEnd(Layout.java:967)
at android.text.Layout.draw(Layout.java:267)
at android.text.Layout.draw(Layout.java:153)
at com.myapps.android.myapp.MapView.onDraw(MapView.java:903)
at com.myapps.android.myapp.MapThread.run(MapThread.java:83)
</code></pre>
<p>What's really confusing me is the 49 >= length 69 error message. I'm hinting towards a problem with threading/synchronization, where mOutroTextLayout is being created/modified in one thread, and accessed in another thread?? </p>
| android | [4] |
4,396,915 | 4,396,916 | Inheritance related question | <p>I have a class Base. A and B extend Base. There is also a class Relationship which contains two Base objects (source, target). Is it possible to determine whether source/target is an A or B instance?</p>
<p>Thanks.</p>
<p>Christian</p>
<p>PS: </p>
<p>Here is a little add on. I am using automapper and I would like to map the type of source/target to a string called 'Type' - GetType did not work <strong>(actually it works -s ee my comments - is and as are good solutions too)</strong>:</p>
<pre><code>Mapper.CreateMap<Item, ItemViewModel>()
.ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.ItemName == null ? "" : src.ItemName.Name))
.ForMember(dest => dest.Type, opt => opt.MapFrom(src => src.GetType().ToString()));
</code></pre>
<p>How can I use is/as in this scenario?</p>
| c# | [0] |
1,826,255 | 1,826,256 | How can I sum up the value of a field in a C# collection | <p>I have the following class:</p>
<pre><code>public class ViewEvent {
public long Elapsed { get; private set; }
public string Description { get; private set; }
}
</code></pre>
<p>In my model I have a collection of instances of these classes:</p>
<pre><code>public IList<ViewEvent> Events { get; set; }
</code></pre>
<p>How can I get the total elapsedTime of all the ViewEvents in my Events collection?</p>
| c# | [0] |
4,114,540 | 4,114,541 | jquery .live() function only works once | <p>When I run this code it performs as it should the first time however when I try the action a second time nothing happens. any help is greatly appreciated.</p>
<pre><code>$('.delete_user').live("click",function(){
var $id = $(this).attr('id');
var $form = $('#member_search').serialize();
$.post("server_code.php",{id: $id, form: $form},
function(data){
$('#member_row_container').html(data).show();
$('.row_standard:odd').addClass('row_alternate');
});
$(".div_alert").hide();
$(".overlay").hide();
return false;
});
</code></pre>
| jquery | [5] |
5,845,264 | 5,845,265 | navigation problem? | <p>I have a view A where I have a code to push it to view B using:
[navController pushViewController:SecondViewController animated:YES];</p>
<p>when I get there and press back, the button says firstViewcontroller.
But when I press the buttons again to push it to the secondview again.
instead of showing 'firstviewcontroller' the buttons says secondviewcontroller.
and for some reason, my navigation-stack is adding and adding the secondview.</p>
<p>Can someone tell me what I do wrong?
I can't find any problem in my code.</p>
<p>Edit:
I have changed my code to:</p>
<pre><code>FirstViewController *aFirstViewController = [[FirstViewController alloc] initWithNibName:@"FirstView" bundle:[NSBundle mainBundle]];
[navController pushViewController:aFirstViewController animated:YES];
[aFirstViewController release];
</code></pre>
<p>and it is still not working:S</p>
| iphone | [8] |
3,809,628 | 3,809,629 | I have a single row in treeview.How to split that into 2 r 3 rows of text? | <p>Am using ASP.NET(C#)</p>
<p>I have a single row in treeview.
Myself using asp:treeview here.
How to split that into 2 r 3 rows of text?</p>
<p>Example:</p>
<pre><code>Kalaiselvan is new to Dotnet Help him bla bla bla here goes here!!
</code></pre>
<p>I need this text as follows;</p>
<p>kalaiselvan is new to dotnet</p>
<p>Help him bla bla bla here</p>
<p>goes here!!!...</p>
| c# | [0] |
4,747,878 | 4,747,879 | how to step up my site like this? | <p>please refer to the follow up also thanku
<a href="http://stackoverflow.com/questions/3262640/foloow-up-question-and-what-does-this-mean-mail-yahoo-com">http://stackoverflow.com/questions/3262640/foloow-up-question-and-what-does-this-mean-mail-yahoo-com</a></p>
<p>this is what i want to make a sample of
<img src="http://myimgs.net/images/logh.bmp" alt="alt text"></p>
<p>have made a sample page, which has a logo page.</p>
<p>asking user to state its department according to which the page will show the department logo.</p>
<p>i want to separate the website access by copying the webpage on different computers and hosting such that each computer represent a department. (the webpage shows the text "welcome to department" which i have edited by department name for each department computer)</p>
<p>when user says. </p>
<ul>
<li>www.select_your_department.com computer1 is used as IIS server</li>
<li>user says my department is alpha</li>
<li>computer1 one does response.redirect to showmydepartment.aspx which has a page saying "welcome to alpha" (that is this page is coming from the cpu dedicated for department alpha)</li>
</ul>
<p>but how to achieve this in practical?</p>
<p>even if i copy the page on all the departments computer and edit it deparment name</p>
<p>the page still has the same name "showmydepartment" !! how to ask browser to fetch the page from particular hosting server?</p>
<p>i think its involves something like department.showmydepartment, some domain names somthing </p>
<p>help please</p>
| c# | [0] |
1,904,426 | 1,904,427 | Set the border for listview images in C# 2008 | <p>im diaplaying the images in the ListView.
I want add the border for that images.
How to do? give me an idea.</p>
<p>im using c# 2008.</p>
| c# | [0] |
148,206 | 148,207 | close current web form in asp.net | <p>How i can close current web form in web based application?
I have tried with following code:</p>
<pre><code>mybutton.Attributes.Add("onclick","window.close()")
</code></pre>
<p>But its not working
Help me. Thank you.</p>
| asp.net | [9] |
3,540,386 | 3,540,387 | DirectoryIterator::getBasename vs DirectoryIterator::getFilename | <p>Is there any difference between <a href="http://us2.php.net/manual/en/directoryiterator.getbasename.php" rel="nofollow"><code>getBaseName</code></a> and <a href="http://us2.php.net/manual/en/directoryiterator.getfilename.php" rel="nofollow"><code>getFilename</code></a> when called with no arguments?</p>
| php | [2] |
5,491,207 | 5,491,208 | concatenating fields in server tags in asp.net | <p>I want to combine the first and last names and present them in the repeater.
The following does not concatenate the string. How do i get this to work.</p>
<pre><code>Text='<%#Eval("FirstName")%>' '<%Eval("LastName")%>'
</code></pre>
| asp.net | [9] |
4,077,031 | 4,077,032 | Javascript Callback Timing | <p>I feel foolish for asking something so trivial, but I really want the best-practices answer (I'm not looking for a "setTimeout" solution unless nothing else is possible -- though I doubt that is the case).</p>
<p>The quick over-view: I have an array which I want to push to from within a callback. After I've populated the array I then want to use it, outside of the callbacks.</p>
<p>The practical use: I have an array of cities, I want to geocode them with Google's API and populate an array with all of the resulting LatLng's. Later I will create marker objects with them, add them to a clusterer, whatever.</p>
<pre><code>coder = new google.maps.Geocoder();
$places = ['Truro, NS', 'Halifax, NS', 'Sydney, NS', 'Dartmouth, NS'];
all_the_pins = Array();
for(i in $places){
var $place = $places[i];
coder.geocode({address:$place}, function(res, stat){
switch(stat){
case 'OK':
all_the_pins.push(res[0].geometry.location);
break;
}
});
}
console.log(all_the_pins);
</code></pre>
<p>EDIT: to clarify the issue:
The problem isn't a question of scope or whether or not the <code>all_the_pins</code> variable is global or not, if you were to examine <code>all_the_pins</code> within the callback you will see that it is the same variable (which is being pushed to). The problem is that because the pushes happen within the callback they don't happen before the <code>console.log</code> is run below.</p>
| javascript | [3] |
1,280,634 | 1,280,635 | Simple logic in javascript | <p>I have four variables of type integer -</p>
<pre><code>var tip_1, tip_2, tip_3, tip_4;
</code></pre>
<p>The value of these variables are getting fill by some other logic which is always between 1 to 10. I need to maintain a hash with variable name as "key" and value as "value" by following these rules -</p>
<ol>
<li><p>The variable with MAX value should be the first element in the hash and so on. e.g.
if tip_1 = 4, tip_2 = 1, tip_3 = 2, tip_4 = 10 then hash should be something like,
Hash = {tip_4, 10} {tip_1, 4} {tip_3, 2} {tip_1, 1}</p></li>
<li><p>In case of tie following order should be considered -
tip_1 > tip_2 > tip_3 > tip_4;</p></li>
</ol>
| javascript | [3] |
735,888 | 735,889 | GLSurfaceView with both context menu and a touch listener | <p>I want my GLSurfaceView to provide a context menu on a "long press". I also want to handle events like MotionEvent.ACTION_DOWN and MotionEvent.ACTION_MOVE on the GLSurfaceView. So my Activity code does the following:</p>
<p>GLSurfaceView mySurface;<br>
View.OnTouchListener myTouchListener; </p>
<p>// Register for context menu<br>
registerForContextMenu(_surface); </p>
<p>// Process MotionEvents<br>
mySurface.setOnTouchListener(myTouchListener); </p>
<p>But myTouchListener is apparently never called if I've registered mySurface for a context menu - does anyone know why?</p>
<p>Thanks,
Tom</p>
| android | [4] |
5,186,150 | 5,186,151 | How to insert data into Excel file with Python and xlrd module? | <p>I try to insert value into Excel files with Python and xlrd module as follow:</p>
<pre><code>import xlrd
data=xlrd.open_workbook('1.xls')
table=data.sheets()[0]
row = 0
col = 0
ctype = 1 # 类型 0 empty,1 string, 2 number, 3 date, 4 boolean, 5 error
value = 'abc'
xf = 0 # 扩展的格式化 (默认是0)
table.put_cell(row, col, ctype, value, xf)
</code></pre>
<p>but no new data 'abc' in the Excel file.
So anyone helps?
Thanks ahead.</p>
| python | [7] |
5,969,951 | 5,969,952 | Sending email in asp .net | <p>hii
every one,
I m creating an project
in which Admin is one user
I want code or any idea how can Admin send a quotation of any type of products to his
customer though email on their email ID</p>
<p>and this quotation has to be a print option button
bec. after clicking on print button quotation should be print</p>
<p>How can i do it? </p>
| asp.net | [9] |
2,513,083 | 2,513,084 | Jquery - infinite loop | <p>I have a webpage which has a button placed inside a div.
What i want to achieve is when users click on the div, it would trigger the button inside clicked. The code is something like:</p>
<pre><code><div id='main'>
<input id="button" type="button" onclick="javascript:dosomething();" value="submit" />
</div>
<script type="text/javascript">
$(function(){
$('#main').bind('click', function(){
$('#button').trigger('click');
})
})
</script>
</code></pre>
<p>When executed (click on the div), it would throw javascript error "too much recursion".
It kinda makes sense why its infinite loop there but I'm not sure what is the right way to achieve this action?
(plz dont ask me why i want it that way, its not my code!)</p>
<p>thanks for your kindy help! </p>
| jquery | [5] |
4,997,190 | 4,997,191 | I have google play account but dont want to share account credentials, but want to send statistics from google play acount of my app | <p>I have google play developers account and I had made some apps for client. In this account I have app statistics such as how many downloads, which devices, which countries. Clients want that app details but i don't want to give credentials of my account to client. </p>
<p>Can i send those info by mail every week?</p>
<p>Is there is way to send information of by mail all statistics and graphs?</p>
| android | [4] |
4,167,915 | 4,167,916 | .on() method in jQuery 1.9 does not work after upgrading from .live() method in version 1.8 | <p>I am trying to upgrade jQuery program from version 1.8 to 1.9. In earlier version .live() method worked fine but new .on() method does not. The parameter "KenID" sent to the web service retrieving data is "undefined" and hence no data is returned. This parameter is set as sessionStorage item so I guess the .on() method does not have an access to it. What steps should I take to make it work?</p>
<p>Working program (jQuery 1.8):</p>
<pre><code>$('#AddrList').live('pagebeforeshow', function (e, data)
{
alert(sessionStorage.KenID); // shows correct KenID
$.ajax({
// extracting required data by sending KenID to the web service
});
});
</code></pre>
<p>NOT working program (jQuery 1.9):</p>
<pre><code>$(document).on('pagebeforeshow', '#AddrList', function (e, data)
{
alert(sessionStorage.KenID); // shows "undefined"
$.ajax({
// extracting required data by sending KenID to the web service
});
});
</code></pre>
<p>Thank you,
Jacek</p>
| jquery | [5] |
Subsets and Splits