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,811,211 | 3,811,212 | assignment operator in c++ | <p>let's assume I have some class A and derived from it B:
I want to write <code>operator=</code> for B (let's assume that I have <code>operator=</code> in my A class)
right way to do this:</p>
<pre><code>B& B::operator=(const B& rhs)
{
if(this == &rhs) return *this;
((A&) *this) = rhs; //<-question
//some other options
return *this
}
</code></pre>
<p>what is the difference if I write </p>
<pre><code>((A) *this) = rhs;
</code></pre>
<p>thanks in advance</p>
| c++ | [6] |
4,018,913 | 4,018,914 | java.lang.NullPointerException when loading drawable which exists in each res/drawable-"density" folder | <p>I have a drawable resource called obstacle.png which exists in each of my drawable-"density" folders. Yet, whenever I run the app, I get a null pointer exception when I am assigning the bitmap's width to my _width variable. This code will only run on mdpi and on the Galaxy TAB addon AVDs. It fails on ldpi or hdpi AVDs. Why?</p>
<pre><code>19 public Weapon(Context context) {
20 super(context);
21 _weapon = BitmapFactory.decodeResource(getResources(), R.drawable.obstacle);
22 _width = _weapon.getWidth();
23 _height = _weapon.getHeight();
24 } //constructor
LogCat:
Caused by: java.lang.NullPointerException
at com.shootball.Weapon.<init>(Weapon.java:22)
</code></pre>
| android | [4] |
3,261,310 | 3,261,311 | How can I let people login into my website with their yahoo or facebook or twitter account? | <p>I tried a lot, but wasn't able to add openid in my website using Yahoo, Twitter, and Facebook. I have added Google as open id in my website but I am not able to add Facebook, Twitter, and Yahoo.</p>
<p>So how can I let people log in into my website with their Yahoo or Facebook or Twitter accounts?</p>
| php | [2] |
3,589,005 | 3,589,006 | PHP: Using a variable that are inside a function | <p>I have:</p>
<pre><code>include ('functions.php');
check_blocked();
echo $blocked;
</code></pre>
<p>in functions.php, check_blocked(); exists. Inside check_blocked I got:</p>
<pre><code>global $blocked;
$blocked = '1234';
</code></pre>
<p>I want to echo $blocked variable, that are inside check_blocked().</p>
<p>It doesnt work, no output..</p>
<p>This is an example of my original problem, so please dont say that I could just have the echo inside the function, as I cannot have in my original code.</p>
| php | [2] |
3,014,869 | 3,014,870 | Php header: about double links | <p>I have a link to pageA. I want the user to go to pageB passing by pageA in a unique link. How is it possible? To go to pageA by clicking a link I do the following:</p>
<pre><code><?php header('Location: http://www.pageA.com/'); ?>
</code></pre>
| php | [2] |
1,546,502 | 1,546,503 | jQuery, how do I get the position of a select? | <p>I'm trying to get the value of whatever date (1-12) gets chosen in a select statement.</p>
<p>the select:</p>
<pre><code> <select id="month"></select>
</code></pre>
<p>gets populated with this:</p>
<pre><code> $(function(){
$.ajax({
type: "GET",
url: "lib/getmonth.php",
async: "false",
success: function(response){
var monthArry = response.split(",");
for(var x=0; x < [monthArry.length-1]; x++){
$("#month").append("<option>" + monthArry[x] + "</option>");
}
}
});
});
</code></pre>
<p>I'm at a loss here, I can obviously get the name,</p>
<pre><code> var month = $("#month").val();
</code></pre>
<p>but I'm not sure how to pick up on the which 'option' is selected?</p>
| jquery | [5] |
4,422,838 | 4,422,839 | Same variable name for different values in nested loops. | <p>This code is perfectly valid Python</p>
<pre><code>x=[[1,2,3,4], [11,22,33,44]]
for e in x:
for e in e:
print e
</code></pre>
<p>Can someone please tell me why, and how this works?</p>
<p>I understand that both the <code>e</code>'s are in different scopes, but how come using them together like this isn't causing an error?</p>
| python | [7] |
1,903,515 | 1,903,516 | How to pass parameters into a os.system() syntax in python? | <pre><code>os.system('python manage.py ogrinspect data/Parking.shp Parking --srid=4326 --mapping --multi > output.txt')
</code></pre>
<p>Variable A = "Parking" . </p>
<p>How can I substitute A everywhere os.system() has Parking ?</p>
| python | [7] |
355,411 | 355,412 | make a live clock with existing time in div with javascript | <p>ok lets say we have a website that need a realtime time;</p>
<p>example :</p>
<p><code><div id="updatetime">21:12:52</div></code></p>
<p>each seconds update hours:m:second.</p>
<p>what i have in minds using the <code>interval function</code> to do long pool and add the sec +1 if to 60 then add + 1 to m and same as hours. but is there a function already solving this problem?</p>
<p><strong>how do you make this <code>21:12:52</code> a moving real clock with javascript that updates each seconds?</strong></p>
<p>i have search google, stackoverflow, many of them tells us how to make the current real time datetime from javascript. but none from an existing time. if there is please do insert the link.</p>
| javascript | [3] |
4,276,971 | 4,276,972 | PHP: using $SERVER[] to return the current directory, regardless of "nice urls" | <p>I am trying to return the current directory of a file in php, regardless what it says in the browser bar. I have tried:</p>
<pre><code>echo $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
</code></pre>
<p>If the url is </p>
<pre><code>http://example.com/directory1/directory2/var1/var2/var3
</code></pre>
<p>the above code returns </p>
<pre><code>example.com/directory1/directory2/var1/var2/var3
</code></pre>
<p>even though var1/var2/var3 are <code>GET_[]</code> variables tamed by a htaccess RewriteRule. Is there a decent way to get the directory? in the case above I would like to return:</p>
<pre><code>example.com/directory1/directory2/
</code></pre>
<p>thanks.</p>
| php | [2] |
1,768,505 | 1,768,506 | iTunes Connect and Apple Developer Portal | <p>I have written an app for a client and I want to create ad hoc builds and submit to app store using his accounts.</p>
<p>Does he need to create an iTunes Connect AND a Apple Developer account - aren't they connected?</p>
| iphone | [8] |
4,843,779 | 4,843,780 | Extract values of innerHTML using JQUERY | <p>FF doesn't support InnerText Property. So if i use innerHTML i get <code>"<NOBR>0057</NOBR>"</code>. I want to extract 0057 value. How can i get value of innerHTML without html tags using JQuery</p>
| jquery | [5] |
5,037,319 | 5,037,320 | Hidden input field | <p>I have an array with 8 elements defined within a script.</p>
<p>I'd like to know how I can pass all the values of this array to a single hidden element.</p>
<p>Pls help.</p>
<pre><code><script ='text/javascript'>
function abc(){
var arr= new Array(8);
for (var i=0; i<8;i++)
{
arr[i]= ...;
}
</script>
<input type="hidden" id="arrs" name="arrs" value= ? >
</code></pre>
| javascript | [3] |
1,048,969 | 1,048,970 | who in mobile phone market allow me to upload my customly compiled linux kernel to my phone | <p>i want to add some features to linux kernel to run on my mobile (android based mobile perhaps).
but i don't know who let me to upload my custom kernel. i want to buy such mobile phone.
some restrictions about uploading custom kernel to phone:
1- replace existing kernel.
2- can use my phones functionalities: it is due to some drivers are closed source and i must use the vendor's kernel to use it's drivers.
3- ...</p>
| android | [4] |
1,554,724 | 1,554,725 | Jquery Button Click Chaining | <p>I have Created a simple Jquery Code.. </p>
<p>The Code is </p>
<pre><code><script type="text/javascript">
$('#Button1').click(function (evt) {
evt.preventDefault();
$('#Textbox1').animate({ width: '300px', height: '75px' })
})
</script>
</code></pre>
<p>Now i want to chain the result So On clicking the button another time
I get the Original Textbox Size back</p>
<p>I tried this code below but it doesnot work any suggestions guy</p>
<pre><code><script type="text/javascript">
$('#Button1').click(function (evt) {
evt.preventDefault();
$('#Textbox1').animate({ width: '300px', height: '75px' }) })
.animate({ width: '100px', height: '10px' })
});
</script>
</code></pre>
<p>Any Solutions Guys?????</p>
| jquery | [5] |
2,648,262 | 2,648,263 | How to save all changes on form after app closing | <p>Hi guys I have a winform app. I have checkbox, numericUpDown and textBoxex.
How to save all changes after closing app?</p>
| c# | [0] |
4,338,096 | 4,338,097 | How to show Spinner selected Item first in Android | <p>In my application i have one spinner with data Cart,Trolley,Lorry,Truck etc..
in a button click i am saving spinner selected item and other items in the data base.
Now in another button click i want to display all saved data,so in that i want to display previously saved spinner item first instead of default one.</p>
<p>How can i achieve this,please anyone suggest me</p>
<p>Ex:in spinner 1,2,3,4 displayed now if i select 3 and saved in data base now this time i want to show spinner data as 3,4,1,2.</p>
| android | [4] |
399,181 | 399,182 | avoid page counting when click refresh button | <p>I made a php script to counts the number of users have viewed my website's pages. This is my code</p>
<pre><code><?php
require_once ('test.php');
$institute_id = 14;
$q = "INSERT INTO page_views2 ( institute_id, views) VALUES ( $institute_id, 1)
ON DUPLICATE KEY UPDATE views=views+1"
;
$r = mysqli_query ($dbc, $q);
?>
</code></pre>
<p>I added this to top of my webpages and this is working (views incrementing) properly when I open the pages. But my problem is When I refresh the page, page views is incrementing by 1. It is okey when it is open first time. But I want to avoid from this when someone is refreshing the page. </p>
<p>so can any body tell me how can I do this?</p>
| php | [2] |
505,875 | 505,876 | how to design login panel using silverlight in asp.net? | <p>I want to design login panel using silverlight in asp.net. But I don't know how to validate users using sql database. How to do that?</p>
| asp.net | [9] |
771,167 | 771,168 | Pythonic proportion calculation of two conditions | <p>Here's a really simple question regarding pythonic coding.</p>
<p>Given a list, if you want to calculate the proportion of items satisfying (A and B), out of those satisfying (A), a natural solution would be:</p>
<p>Imagine the list is of integers, condition A is (>3), condition B is (>5)</p>
<pre><code>count = 0
correct = 0
for item in items:
if item > 3:
count += 1
if item > 5:
correct += 1
score = float(correct) / count
print '%.2f' % score
</code></pre>
<p>An alternative solution:</p>
<pre><code>count = len([1 for i in items if i > 3])
correct = len([1 for i in items if i > 5])
score = float(correct) / count
print '%.2f' % score
</code></pre>
<p>The alternative looks sexier to me, though it loops through items twice and is not efficient. Is there an accepted pythonic solution to this common scenario or is the first solution good enough?</p>
<p>Thanks.</p>
| python | [7] |
5,198,181 | 5,198,182 | How to create a custom status bar in android common for all activity in android? | <p>I am developing a small application. I want to add my own Status bar at the top of my application with black background containing the battery, 3g,network and an icon of my choice. Please guyz help me out in creating a custom status bar..Thanks in advance</p>
| android | [4] |
5,138,612 | 5,138,613 | Java : Remove empty columns in Resultset | <p>How can I remove empty columns from a Resultsets or DataList?</p>
<p>For example : I run a query then the SQL returns a Resultset</p>
<pre><code>Name Age Address Telephone
---- --- ------- ---------
Zed 23 12345456
Charlo 25 53232323
</code></pre>
<p>How can I remove the empty column "Address" in the Resultset?</p>
<p>Thanks in advance.</p>
| java | [1] |
5,188,856 | 5,188,857 | Getting wrong result for evaluation of 100 * 2.55 values | <p>I am getting wrong result using below method.</p>
<pre><code>public double evaluate(final double leftOperand, final double rightOperand) {
Double rtnValue = new Double(leftOperand * rightOperand);
return rtnValue.doubleValue();
}
</code></pre>
<p>Enter Parameter value are: leftOperand= 100 and rightOperand=2.55 </p>
<p>I am getting Wrong answer: <strong>254.99999999999997</strong></p>
<p>The correct answer is a <strong>255.0</strong></p>
| java | [1] |
1,850,574 | 1,850,575 | what are the advantage of using protocols in Objective-C, when we require them? | <p>what are the Advantages of using protocols in Objective-C, when we require them? I have read the objective-C programming guide it shows mainly 3 advantages:</p>
<ol>
<li><p>To declare methods that others are expected to implement.</p></li>
<li><p>To declare the interface to an object while concealing its class</p></li>
<li><p>To capture similarities among classes that are not hierarchically related.</p></li>
</ol>
<p>Can any one explain me (2) and (3), I am not able to get it, as I have read details of them in Obj-C programming Guide? Are there any other advantages of using protocol? How can you describe why we need protocols in Objective-C?</p>
| iphone | [8] |
5,663,019 | 5,663,020 | Android: how to mimic the pane separator from Google Reader? | <p><img src="http://i.stack.imgur.com/ctPag.png" alt="enter image description here"></p>
<p>The Google Reader app has a nice shadow used to separate the two panes. I am trying to recreate this with very limited success. I am using the below xml, which gives the screen shot that follows. Any advice on improving this?</p>
<p>vertshadowgradient.xml</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient
android:startColor="#ffffff"
android:centerColor="#e6e6e6"
android:endColor="#c8c8c8"
android:angle="0" />
</shape>
</code></pre>
<p>main.xml</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFFFF"
android:orientation="horizontal" >
<View android:id="@+id/divider"
android:background="@drawable/vertshadowgradient"
android:layout_marginLeft="200dip"
android:layout_width="10dip"
android:layout_height="fill_parent"/>
</LinearLayout>
</code></pre>
<p><img src="http://i.stack.imgur.com/0M43J.png" alt="enter image description here"></p>
| android | [4] |
3,562,874 | 3,562,875 | how to see console logs on iphone? | <p>I developed an applications on gps functionality.</p>
<p>I stuck up with some problem, i want to see the user location coordinates from the device.</p>
<p>I kept NSLogs wherever its required for me, if i connect the device to mac and if i run i </p>
<p>am able to see the logs in console,</p>
<p>But in my requirement i have to roam to some other other location and i need to get the logs.</p>
<p>how to get logs from device? </p>
<p>can we get these logs by writing them to any file?</p>
<p>if at all we are writing to any file, after connnecting the device to itunes how to get the file where i have writtern?</p>
<p>thanks in advance..... :)</p>
| iphone | [8] |
130,333 | 130,334 | How optimize this code use lambda expression | <p>I have code:</p>
<pre><code>protected void Method1(List<SomeClass> mylist)
{
foreach(var item in mylist)
{
if (!SomeClass.Validate(item))
{
continue;
}
DoStuff(item);
}
}
protected void Method2(List<SomeClass> mylist)
{
foreach(var item in mylist)
{
if (!SomeClass.Validate(item) || item.Value == 0)
{
continue;
}
DoStuff(item);
}
}
</code></pre>
<p>how to organize these two methods?</p>
<p>they have a difference of only <code>item.Value == 0</code> can use lambda expressions.</p>
<p>I have no idea</p>
| c# | [0] |
2,975,853 | 2,975,854 | isinstance() and issubclass() behavior differently | <pre><code>>>> class Hello:
pass
</code></pre>
<p>and </p>
<pre><code>>>> isinstance(Hello,object)
True
>>> issubclass(Hello,object)
False
>>> a = Hello()
>>> isinstance(a,object)
True
</code></pre>
<p>How do you explain <code>isinstance(Hello,object)</code> returns <strong>True</strong> whilst <code>issubclass(Hello,object)</code> returns <strong>False</strong></p>
| python | [7] |
783,008 | 783,009 | What is __main__.py? | <p>What is the <code>__main__.py</code> file for, what sort of code should I put into it and when should I have one at all? :)</p>
| python | [7] |
3,942,942 | 3,942,943 | Please explain the following code? | <p>While going through some of the code, i found there is written like this: </p>
<pre><code>ListViewDataItem dataItem = (ListViewDataItem)(((ImageButton)sender).Parent.Parent);
int noteId = Convert.ToInt32(((HiddenField)dataItem.FindControl("hidNoteId")).Value);
</code></pre>
<p>Please explain the meaning of these two line.</p>
| asp.net | [9] |
699,172 | 699,173 | Remove and add specific classes - Jquery | <p>I need to remove existing class of an element and add another class...or shortly I want to replace a specific class having letters 'border' as substring by another class with letters 'border' as substring. I have to toggle among 8 classes. I tried to select previous class like strClass=$("#"+styleTarget[class*='border']), but it failed. Will "toggle" help me in this. Its very urgent. Thanks</p>
| jquery | [5] |
4,328,533 | 4,328,534 | jquery show and hide buggy with hover, better coding? | <p>i know that it may be difficult to see the actual problem without looking throughout the whole script, but i'm curious if its a little buggy for anybody who has done a hover function and use show and hide.</p>
<p>My problem is that sometimes my element wouldn't show up, but when I move my mouse out and hover over again it shows. Its just not consistent of showing the element</p>
<pre><code>$('.Item').hover(function(){
var container = $(".show-element",this).attr("id");
$('#'+container ).show();
},function(){
var container = $(".show-element",this).attr("id");
$('#'+container ).fadeOut(200);
});
<div class='Item'>
<div class='show-element' id='1'>Show</div>
<div id='1'>
some stuff
</div>
<div class='show-element' id='2'>Show</div>
<div id='2'>
some stuff
</div>
<!-- and so forth !-->
</div>
</code></pre>
<p>so this HTML shows a few div elements and my page has a while loop scripting through multiple elements.</p>
<p>Is there another way to do a hover a better way for consistency? </p>
| jquery | [5] |
3,968,863 | 3,968,864 | Immediately starting a new activity from an activity | <p>When I was originally learning about Android a few months ago I swear I read something about a way to immediately launch an activity when starting a task. I am curious about this now because I need to display an intro screen on launch but I don't want the intro screen to be the root activity. Does anyone know if there is something like this and if not what is the best way to handle an intro screen?</p>
<p>I tried googling for a few hours to find it but can't for the life of me.</p>
<p>Thanks for the help.</p>
| android | [4] |
1,450,338 | 1,450,339 | Calculate difference between two values in jquery | <p>How do I calculate the difference between the top one and the bottom one with jquery?</p>
<pre><code><span class="field-content">9.75</span>
<span class="field-content">4.75</span>
</code></pre>
| jquery | [5] |
2,683,860 | 2,683,861 | Firing event for two times in a Table | <p>I am trying to fire parent click event whenever an input change happens.
Below is my code, it is firing Click event for two times. </p>
<pre><code> $('TABLE TBODY TR TD INPUT').change(function()
{
$(this).parents('TD').click();
});
$('TABLE TBODY TR TD').click(function()
{
alert("Clicked me...");
});
</code></pre>
<p>Here is my HTML Code </p>
<pre><code> <table>
<tr><td>foo<input type="radio"></td><td>foo<input type="checkbox"></td></tr>
<tr><td>foo<input type="radio"></td><td>foo<input type="checkbox"></td></tr>
<tr><td>foo<input type="radio"></td><td>foo<input type="checkbox"></td></tr>
</table>
</code></pre>
<p>Where is the mistake...</p>
| jquery | [5] |
2,451,989 | 2,451,990 | abstract class and anonymous class | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/5154533/abstract-class-and-anonymous-class">abstract class and anonymous class</a> </p>
</blockquote>
<pre><code>abstract class Two {
Two() {
System.out.println("Two()");
}
Two(String s) {
System.out.println("Two(String");
}
abstract int display();
}
class One {
public Two two(String s) {
return new Two() {
public int display() {
System.out.println("display()");
return 1;
}
};
}
}
class Ajay {
public static void main(String ...strings ){
One one=new One();
Two two=one.two("ajay");
System.out.println(two.display());
}
}
</code></pre>
<p>We cannot instantiate an abstract class then why is the method <strong>Two two(String s)</strong> in class One returns an object of abstract class <strong>Two</strong></p>
| java | [1] |
4,033,918 | 4,033,919 | Drupal/PHP - Get a specific value in an array | <p>Hi<br />
Suppose I have the code below:</p>
<pre><code> [taxonomy] => Array
(
[118] => stdClass Object
(
[tid] => 118
[vid] => 4
[name] => A
[description] =>
[weight] => 4
)
[150] => stdClass Object
(
[tid] => 150
[vid] => 5
[name] => B
[description] =>
[weight] => 0
)
)
</code></pre>
<p>How can I only get the tid number and exclude others, could someone please give me a suggestion?</p>
<p>Thanks you</p>
| php | [2] |
2,504,817 | 2,504,818 | mysql database Back-up (linux server to client m/c) automatically | <p>How can we store the mysql database Back-up from a linux server to a client windows m/c automatically in a fixed duration of time....</p>
<p>Thanking you,</p>
| php | [2] |
1,198,274 | 1,198,275 | Tool to identify which external javascript references are actually being used on a page | <p>I'm working on a website that currently has the same block of external JavaScript references on each page (added via a master page). I'd like to go through the site and identify which script files are actually necessary for each specific page to improve performance. Problem is there are a lot of pages and I'm not sure how to do it without resorting to manual trial and error process.</p>
<p>Is there a Firefox plug-in or some other tool that will identify which JavaScript references could actually be called by the page and which are not necessary?</p>
| javascript | [3] |
54,008 | 54,009 | jQuery append html element with variable string | <p>I'm a JQuery Newbie. I'm trying to append an object property( declared in an array form) to an html element like the following</p>
<p>HTML:</p>
<pre><code><div id="container">
<p>some text </p>
<p>some text </p>
<p>some text </p>
</div>
</code></pre>
<p>JQuery Script:</p>
<pre><code>var obj{
property : {'apple', 'orange', 'banana'}
}
for(i=0; i<=2; i++){
$("#container p:eq("+i+")").append(obj.property[i]);
}
</code></pre>
<p>and hope to get this:</p>
<pre><code><p>some text apple</p>
<p>some text orange</p>
<p>some text banana</p>
</code></pre>
<p>There are no appending shown at all, though my Firebug console shows no error report.</p>
<p>What am I doing wrong? Also, is there any way to replace the for loop with .each(), if it's a better practice?</p>
<p>Thank you</p>
| jquery | [5] |
5,451,766 | 5,451,767 | window.showModalDialog issue | <p>I am opening a popup window using and passing some array of parameters</p>
<pre><code>window.showModalDialog("Test.aspx", MyArgs, WinSettings);
</code></pre>
<p>in the Test.aspx i have button, on button click i have "Response.write("Test") when i click on the Test button a new window is getting opened.
Can this be avoided?</p>
<p>Please help</p>
| asp.net | [9] |
4,042,095 | 4,042,096 | Android Not Allow some symbols in Textview | <p>I am retrieving text from web server in that text & symbol is there when i try to display that data & after text is not displaying like (Android & Java) "Android" text is displaying "& Java" text is not displaying so what should i do to display all data in my text view.</p>
<p>Thanks,
Murali.</p>
| android | [4] |
988,562 | 988,563 | In Python, how can I prohibit class inheritance? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2825364/final-classes-in-python-3-x-something-guido-isnt-telling-me">Final classes in Python 3.x- something Guido isn't telling me?</a> </p>
</blockquote>
<p>I was watching a talk (<a href="http://www.youtube.com/watch?v=aAb7hSCtvGw" rel="nofollow">How to design a good API and why it matters</a>) in which it was said, literally, "<em>design and document for inheritance, else prohibit it</em>". The talk was using Java as an example, where there's the '<strong>final</strong>' keyword for prohibiting subclassing. Is it possible to prohibit subclassing in Python? If yes, it'd be great to see an example...
Thanks.</p>
| python | [7] |
445,211 | 445,212 | Youtube embedded video keeps hiding my JavaScript popup dialogs | <p>I tried playing with z-index, and also tried setting the wmode to "opaque". Nonthing worked..</p>
<p>It keeps hiding my popup dialogs..</p>
<p>Here is the current iframe code</p>
<pre><code><iframe title="YouTube video player" class="youtube-player" type="text/html" width="450" height="297" src="http://www.youtube.com/embed/glqpoDfuAwk" frameborder="0" ></iframe>
</code></pre>
<p><strong>EDIT</strong>: As pointed out below, using "embed" and opaque wmode solves the problem. But I cannot find any solution for YouTube's new style of embedding using iframe</p>
| javascript | [3] |
753,050 | 753,051 | Problems with passing of data from NSDictionary to NSMutableDictionary | <p>I'm trying to access a webservice using the json framework. </p>
<p>Code:</p>
<pre><code>NSDictionary *allData;
NSMutableDictionary *displayData;
NSString *string = [[NSString alloc] initWithFormat:@"http://localhost/Gangbucks.svc/GetDealList"];
NSURL *jsonURL = [NSURL URLWithString:string];
NSString *jsonData = [[NSString alloc] initWithContentsOfURL:jsonURL];
self.allData = [jsonData JSONValue];
NSLog(@"allData value is1:%@", self.allData);
self.displayData = [[NSMutableDictionary alloc] initWithDictionary:self.allData];
NSLog(@"displayData value is2:%@", self.displayData);
</code></pre>
<p><code>allData</code> works fine but I got an error on the <code>displayData</code></p>
<pre><code>2011-12-13 14:59:23.875 IPhone[352:207] -[__NSArrayM getObjects:andKeys:]: unrecognized selector sent to instance 0x59e1c20
2011-12-13 14:59:23.878 IPhone[352:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM getObjects:andKeys:]: unrecognized selector sent to instance 0x59e1c20'
*** Call stack at first throw:
</code></pre>
<p>Is it possible to pass data from NSDictionary to NSMutableDictionary ?</p>
| iphone | [8] |
3,622,116 | 3,622,117 | How to return two or more objects in one method? | <p>Lets say you want a method to return both a generated object and a boolean indicating the success or failure of doing so. </p>
<p>In some languages, like C, you might have a function return additional objects by having reference parameters, but you cannot do this in Java since Java is "pass-by-value", so how do you return several objects in Java?</p>
| java | [1] |
2,120,261 | 2,120,262 | Adding Column to populated DataSet | <p>I'm trying to add a column to a dataset that has my sql table data. I basically wanted to add a column after the data is loaded to keep track of which values are already in the database and which values are new in the datagrid. Then I can just know which rows to add into the database. I would appreciate any help.</p>
<p>Here is my code, I'm just trying to get the column to show up at this point, I will worry about updating the rows with this new column later.</p>
<pre><code> sqlcom.CommandText = @"INSERT INTO members (firstname, lastname) VALUES ('" + textBox1.Text +"', '"+ textBox2.Text +"')";
sqlcom.ExecuteNonQuery();
SqlDataAdapter sqladapt = new SqlDataAdapter("SELECT * FROM members", thisConnect);
DataSet ds = new DataSet();
sqladapt.Fill(ds, "members");
//add column to dataset?
ds.Tables["members"].Columns.Add("inDb");
dataGridView1.DataSource = ds;
dataGridView1.DataMember = "members";
thisConnect.Close();
</code></pre>
| c# | [0] |
3,735,595 | 3,735,596 | Problem with echoing my array data in PHP | <p>I want to create an array of numbers: 10, 9,8...to 1. But when I echo $numbers, I get "Array" as the output as to the numbers. </p>
<p>There is probably a simple thing I missed, can you please tell me. thanks!</p>
<pre><code>$numbers=array();
for ($i=10; $i>0; $i--){
array_push($numbers, $i);
}
echo $numbers;
</code></pre>
| php | [2] |
212,417 | 212,418 | Prevent images from loading | <p><br />
is there a way with javascript/jquery to prevent images from loading? I am building a slideshow from a html list with images. So I would like to collect all the src data and then prevent the images from loading. So later when the user really needs the image I would load it then.</p>
<p>I found some lazy loading script on google but couldn't find the way they prevent images from loading.</p>
<p>Thanks in advance.</p>
<p><strong>Edit1:</strong><br />
It seems from the answers that it's not possible to use javascript to prevent images from loading.
<a href="http://www.appelsiini.net/projects/lazyload/enabled_fadein.html">Here</a> is a script that does lazy loading. Could anybody explain how it works? It seems when javascript is off it just loads the images normaly and when it's on it will load them when you scroll to their location.</p>
| javascript | [3] |
3,307,948 | 3,307,949 | jQuery selectors: $('#ID1, #ID2, #ID3') vs $('1X CLASS') which is faster? | <p>Looking into selector performance between $('#ID1, #ID2, #ID3') vs $('1X CLASS'). Which is faster?</p>
| jquery | [5] |
4,313,188 | 4,313,189 | finding distance between 2 coordinates in google map in android | <p>I am developing a google map application.I have called map activity class.On the google map I have showed the current location as well as multiple markers.Now the problem i am facing is to calculate distance between 2 coordinates having there respective value....Has anyone implemented it before??It will be a great help for me.....Thanks in advance</p>
| android | [4] |
5,393,972 | 5,393,973 | Adding days to a specific date inside an array | <p>I have a TABLE <code>events</code> </p>
<pre><code>`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`data` date DEFAULT NULL,
`days` int(2) DEFAULT NULL,
PRIMARY KEY (`id`)
</code></pre>
<p>with a number of records.</p>
<p>I generate an array with all unavailable dates</p>
<pre><code>$sql = "SELECT * FROM events WHERE `data` LIKE '".$cYear."-".$cMonth."-%'";
$sql_result = mysql_query ($sql, $connection ) or die ('request "Could not execute SQL query" '.$sql);
while ($row = mysql_fetch_assoc($sql_result)) {
$unavailable[] = $row["data"];
$days[] = $row["days"];
}
</code></pre>
<p>The array $unavailable is like this: (2012-08-10, 2012-08-25)
The array $days is like this: (3, 2)</p>
<p>I need an array like this: (2012-08-10, 2012-08-11, 2012-08-12, 2012-08-25, 2012-08-26)</p>
<p>Thank you!</p>
| php | [2] |
4,902,098 | 4,902,099 | Still no solution for sending android app from Win 7 to LG Optimus V | <p>We have a Dell MT560 running Windows 7 with Eclipse, JDK, and the Android SDK. At the other end of the USB cable is an LG Optimus V Android phone. We wrote a tiny app and all it does is display "Hello Ron". This works perfectly on the emulator, but we are having no success sending the app to the phone. The phone does state that the USB connection is successful. Windows Explorer does see the phone, because it treats the phone as an "I:" disk drive, and shows in Windows the folders that exist on the phone. But DDMS on Eclipse does not list the phone as a connected device. The docs on developer.ansdroid.sdk instruct us to do a "Run" and that then a Device Chooser dialog should appear where we can choose to run the app on the phone arther than the emulator, but that does not happen. We have edited the Eclipse manifest to indicate "Debuggable=True". We also upgraded the BIOS on our Dell to the latest version, "A06". Not sure what else to try. Four people kindly responded to my post earlier today, and we tried all their suggestions, to no avail. </p>
<p>Hopefully, someone out there can help figure out what mistakes we are making, please.
Or if someone wants to walk us through it on the phone, that would be even better.
Regards,
Ron and Diane</p>
| android | [4] |
5,079,224 | 5,079,225 | How to run two 'foreach' codes together to get output as one? | <p>I have two <code>foreach</code> loops. One gives <code>image href="URL"s</code> and the other gives <code>image src="URL"s</code>.</p>
<p>How do I combine these two loops together and display images?</p>
<p>My code which gives image HREFs:</p>
<pre><code>foreach($doc->getElementsByTagName('a') as $a){
foreach($a->getElementsByTagName('img') as $img){
echo $a->getAttribute('href');
}
}
</code></pre>
<p>My code which gives image SRCs:</p>
<pre><code>foreach($html->find('img') as $e)
echo $e->src . '<br>';
</code></pre>
| php | [2] |
5,925,818 | 5,925,819 | Reloading tab activity onResume but don't want to reload on tab switch | <p>I'm not sure if my title is clear so let me explain.</p>
<p>Tab A - contains a listview populated from a database
Tab B - search form</p>
<p>I need to update the contents of tab A after coming back from a search results screen. Using onResume() works great but this also reloads the Tab whenever I click back and forth through between tabs. Is there another method I could use here?</p>
<p>EDIT: I guess it's a bit more complex than this. The search form loads a new intent that displays the results in a listview. An item can be select which then loads a item info screen. From here the user can select from a few option, one being Add. This is the action that needs to reload the original listview in Tab A.</p>
| android | [4] |
5,951,581 | 5,951,582 | three empty lines in the begin of html page | <p>i have html code inside a php variable</p>
<pre><code><?
$HTML_CODE='
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>'.$pg->pgTitle.'</title>
<link rel="stylesheet" href="'.$cssFile.'" type="text/css" />
</head>
<div id="header">
';
echo $HTML_CODE;
?>
</code></pre>
<p>When i view the source of my page by in browser ( right click-> view source )</p>
<p>The code starts in line 4</p>
<pre><code>1.
2.
3.
4.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
5.<html>
6.<head>
7.<title>page title</title>
8.<link rel="stylesheet" href="style.css" type="text/css" />
9.</head>
10.<div id="header">
</code></pre>
<p>i've used trim function, it's now start in line 3!!</p>
| php | [2] |
2,717,679 | 2,717,680 | Android apikey Not Supported for Google Map | <p>I got a fingerprint </p>
<pre><code>73:F9:85:F8:14:56:4A:E7:D1:D4:31:6F:23:AA:4D:38:EB:16:5C:EE
</code></pre>
<p>but when i used to generate api Key using this link </p>
<p><a href="http://code.google.com/android/maps-api-signup.html" rel="nofollow">http://code.google.com/android/maps-api-signup.html</a> it shows<br>
"The fingerprint you entered is not valid. Please press the Back
button on your browser and enter a valid certificate fingerprint".</p>
<p>If i omit last four Character and use </p>
<pre><code>73:F9:85:F8:14:56:4A:E7:D1:D4:31:6F:23:AA:4D:38
</code></pre>
<p>it generate api key that not support to create Google map in android Application</p>
| android | [4] |
5,990,636 | 5,990,637 | Using only native PHP function to get array values from a list array inside an array | <p>I have an array below:</p>
<pre><code>$arr = array(
array(
'name' => 'ABC'
),
array(
'name' => 'CDF'
),
array(
'name' => 'GHI'
)
)
</code></pre>
<p>How can I convert to just with native function in PHP:</p>
<pre><code>$arr = array( 'ABC', 'CDF', 'GHI');
</code></pre>
| php | [2] |
3,712,985 | 3,712,986 | PHP File Upload | <p>I'm looking to change my normal PHP file upload into a multiple file upload.</p>
<p>I have this as my single file input:</p>
<pre><code><input name="sliderfile" id="sliderfile" type="file" />
</code></pre>
<p>And this is the PHP I'm using to upload to my server/place in folder and register it into my databases:</p>
<pre><code>if($_POST[sliderurl]){
$path= "uploads/".$HTTP_POST_FILES['sliderfile']['name'];
if($ufile !=none){
if(copy($HTTP_POST_FILES['sliderfile']['tmp_name'], $path)){
date_default_timezone_set('Europe/London');
$added = date("F j, Y");
$query = mysql_query("INSERT INTO `slider` (`imgurl`, `url`, `title`, `description`, `added`) VALUES ('$path', '$_POST[sliderurl]', '$_POST[slidertitle]', '$_POST[sliderdesc]', '$added')");
?>
<div id="fademessage" style="margin-top: 13px;">
<p class="message_greenadmin">Your slide has been successfully created and added to the homepage, Thank you.</p>
</div>
<?php
}else{
?>
<div id="fademessage" style="margin-top: 13px;">
<p class="message_redadmin">Something seems to have gone wrong. Try renaming the photos file name.</p>
</div>
<?php
}
}
}else{
}
?>
</code></pre>
<p>Any help would be appreciated,</p>
<p>Thanks!</p>
| php | [2] |
5,107,690 | 5,107,691 | How to store a phone number in c++ | <p>I used the below code to store an phone number(10 digit number) in c++:</p>
<pre><code>#include<iostream.h>
void main(){
long long num;
cin>>num;
cout<<num;
}
Input:998578985
output:1395855233
</code></pre>
<p>Why is this happening? Is there any other way to store a 10 digit number. I am using turboc++ in win7.
<img src="http://i.stack.imgur.com/c5GNG.png" alt="enter image description here"></p>
| c++ | [6] |
325,473 | 325,474 | Set default value for GUI PreferenceActivity during runtime | <p>I have the following XML.</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="@string/preference_xxx_category">
<CheckBoxPreference
android:title="@string/preference_xxx_dual_mode_title"
android:summary="@string/preference_xxx_dual_mode_summary"
android:key="xxxDualModePreference" />
</PreferenceCategory>
</PreferenceScreen>
</code></pre>
<p>I use a GUI to load it as the following code</p>
<pre><code>public class Preferences extends SherlockPreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
this.getPreferenceManager().findPreference("xxxDualModePreference").setDefaultValue(Utils.isDualCoreDevice());
this.getPreferenceManager().findPreference("xxxDualModePreference").setEnabled(Utils.isDualCoreDevice());
// Once the GUI is shown, I realize my preference UI check box is not being ticked.
</code></pre>
<p><strong>The default value should depend on the number of device CPU core. That's why I cannot specific the default value in XML.</strong></p>
<p>However, if I specific the default value in Java code, I realize the UI is not reflecting it, although this is the first time I start my application.</p>
<p>Is there any other steps I had missed out?</p>
<p>Thanks.</p>
| android | [4] |
2,216,178 | 2,216,179 | Can std::find function use for our own classes? | <p>I have set of classes. Each class is inherited from another class. The relationship is as follows. (I am just posting how one class inherited from another class, just to get idea for all of you)</p>
<pre><code>class LineNumberList : public MyVector <LineNumber > //top class
class MyVector : public std::vector <Type>
class LineNumber : public ElementNumber
class ElementNumber { //this is the base class
protected:
int number;
public:
ElementNumber(int p){number=p;}
// some more codes //
}
</code></pre>
<p>Now, I want to implement a function which can be used to <code>find</code> elements inside my topclass i.e. <code>LineNumberList</code>. I tried with standard <code>find</code> function, but it doesn’t work. Can anyone help me to implement similar find function for my case, it is highly appreciated.</p>
| c++ | [6] |
2,812,961 | 2,812,962 | Help needed improving a foreach loop | <p>I have this logic written that loops out an array into <code><li></code></p>
<p>and gives #1 and every 5th a class of "alpha".</p>
<pre><code>$count = 0;
foreach($gallery->data as $row){
if ($count==0 || $count%4==0) {
echo '<li class="alpha"></li>'.PHP_EOL;
} else {
echo '<li></li>'.PHP_EOL;
}
$count++;
}
</code></pre>
<p>I need to add to this and get the code adding a class of "omega" to every 4th <code><li></code></p>
| php | [2] |
3,151,521 | 3,151,522 | How to use my custom library apk file in other applications | <p>I have my own custom library apk file (say lib.apk) & i want make it
available to other applications.
How to provide the uses-library in the android manifest.xml file in
other apps so as to use my custom library. </p>
| android | [4] |
4,936,053 | 4,936,054 | how to upload image? | <p>I want upload images in php here is my code</p>
<pre><code>if (isset($_FILES['userfile']['name'])) {
if ($_FILES['userfile']['error'] == UPLOAD_ERR_OK) {
$from = $_FILES['userfile']['tmp_name'];
$to = "/var/www/html/images/".$_FILES['userfile']['name'];
$res = move_uploaded_file($from, $to);
if($res)
{
print 'upload success';
}
else
{
print 'fail';
}
</code></pre>
<p>here i got output fail please tell me correct process </p>
<p>thanks in advance</p>
| php | [2] |
1,560,325 | 1,560,326 | NSTimer With ActivityIndicator | <p>How to add Timer Condition with ActivityIndicator View?? please make it simple to understand..
I'm only 20 days old for iPhone coding.. :P </p>
| iphone | [8] |
2,072,745 | 2,072,746 | How do I get around IE8 limitation of live('change') not firing on AJAX elements? | <p>I am using jQuery 1.3.2, and I cannot update that version because of spec limitations.</p>
<p>I am trying to fire an event, where a user goes directly to targeted pages using a 'Jump Menu'. This jump menu is AJAX based. First Country, which gets an AJAX result of States, then Cities. When user clicks on a city, they are to be directed to the relevant URL.</p>
<p>This code works fine in Mozilla, Chrome and IE9:</p>
<p><code>
$("#id-of-the-AJAXED-select-widget").live('change', function(){
jumpSubmit();
});
</code></p>
<p>But the 'change' event does not fire in IE8. From what I read in many other places, this is a combination of issues with IE8 and jQuery 1.3 - however, there were no ideas for solutions. Much as I would like, I cannot banish either of these - so kindly help me find an answer...</p>
| jquery | [5] |
3,537,489 | 3,537,490 | What is the difference between declaration and definition in Java? | <p>I'm very confused between the two terms. I checked on stackoverflow and there's a similar question for C++ but not for java. </p>
<p>Can someone explain the difference between the two terms for java?</p>
| java | [1] |
5,109,352 | 5,109,353 | Stl Set find an item c++ | <p>I have a set where i want to find items in it. Right now i have global objects that i am using to store my finds - (ItemSetMap allMusicByBand)</p>
<p>I would like to get away from this and just search the sets directly.</p>
<p>All the cd info are stored in the private section - (ItemSet allCDS;)</p>
<p>here is the library.cpp - </p>
<p>the commented code is where i was doing my search and adding to the global object...</p>
<p>I would like to do the search in the musicByBand function instead..</p>
<pre><code>#include "Library.h"
#include "book.h"
#include "cd.h"
#include "dvd.h"
#include <iostream>
//ItemSetMap allBooksByAuthor; //these are what i am trying to get away from...
ItemSetMap allmoviesByDirector;
ItemSetMap allmoviesByActor;
//ItemSetMap allMusicByBand;
ItemSetMap allMusicByMusician;
const Item* Library::addMusicCD(const string& title, const string& band, const int nSongs)
{
CD* item = new CD(title,band,nSongs);
allCDS.insert(item);
//ItemSetMap::iterator myband = allMusicByBand.find(band);
//if(myband != allMusicByBand.end())
//{
//myband->second->insert(item);
//}
//else{
//ItemSet* obj = new ItemSet();
//obj->insert(item);
//allMusicByBand.insert(make_pair(band, obj));
//}
return item;
}
const ItemSet* Library::musicByBand(const string& band) const
{
return allMusicByBand[author];
}
</code></pre>
<p>i hope i was clear enough on what i wanted. </p>
<p>I have tried to iterate through it. I have tried just about everything i can think of..
CD class is a superclass of item class.</p>
<p>Thank you..</p>
| c++ | [6] |
2,667,303 | 2,667,304 | With SAX, is it possible to exit from processing? | <p>I want to read a specific node in an xml document, and I want to do it the fastest way possible and I believe SAX is the answer.</p>
<p>I'm using xerces right now, and I understand that the actual parsing is done using events.</p>
<p>So I have setup my start/end element events etc., and I want to know if it is possible to exit processing after reading a specific element?</p>
<p>i.e. once I get to a specific xml element, and read the contents, if it meets some criteria, I want to stop processing the xml.</p>
| java | [1] |
1,091,984 | 1,091,985 | How to Send C++ Struct Message from C# Socket? | <p>This is the C++ Message that i need to pass from C#:</p>
<pre>
struct LoginMessage:public NMessage
{
char szUser[ 16 ];
char szPass[ 16 ];
LoginMessage()
{
msgId = CTRL_SESSION_LOGIN;
msgSize = sizeof( LoginMessage );
}
};
struct NMessage
{
DWORD msgSize;
union
{
DWORD msgId;
struct
{
BYTE msgId0;
BYTE msgId1;
BYTE msgId2;
BYTE msgId3;
};
};
NMessage()
{
}
BOOL IsLegal()
{
return msgSize>=sizeof(NMessage) && msgSize
</pre>
<p>What is the equivalent of this in C# so that C++ can understand this message?
Sample code is greatly appreciated.</p>
| c# | [0] |
4,259,370 | 4,259,371 | Why does negating a static member variable produce a linker error? | <p>Please consider the following mini example</p>
<pre><code>// CFoo.hpp
class CFoo{
private:
static const double VPI = 0.5;
public:
double getVpi();
};
// CFoo.cpp
#include "CFoo.hpp"
double CFoo::getVpi(){
double x = -VPI;
return x;
}
// main.cpp
#include "CFoo.hpp"
int main(){
CFoo aFoo();
return 0;
}
</code></pre>
<p>Lining the program with gcc version 4.5.1 produces the error <code>CFoo.cpp: undefined reference to CFoo::VPI</code>. The error dose <strong>not</strong> occur if</p>
<ul>
<li>VPI is not negated</li>
<li>the negation is written as <code>double x = -1 * VPI;</code></li>
<li>Declaration and definition of class CFoo happen in the same file</li>
</ul>
<p>Do you know the reason for this error?</p>
| c++ | [6] |
5,688,511 | 5,688,512 | Reformulate custom predicate as std-predicate | <p>A program I'm working on contains this predicate struct:</p>
<pre><code>struct Unlike {
Unlike(const Vertex& in) : a(in) {}
bool operator()(const Vertex& b) {
return !(a==b);
}
const Vertex& a;
};
</code></pre>
<p>Vertices are structs with (among other members) a struct coord with members X, Y, Z. Comparison is done with these functions:</p>
<pre><code>bool operator==(const Vertex& a, const Vertex& b) {
bool res = a.coord.X == b.coord.X &&
a.coord.Y == b.coord.Y &&
a.coord.Z == b.coord.Z;
return res;
}
inline bool operator!=(const Vertex& a, const Vertex& b) {
bool res = !(a==b);
return res;
}
</code></pre>
<p>Which is used like this:</p>
<pre><code>std::vector<Vertex> vertices;
// Fill and sort vertices
std::vector<Vertex>::iterator vcur, vnext;
vcur = vertices.begin();
while(vcur != vertices.end()) {
vnext = std::find_if(vcur, vertices.end(), Unlike(*vcur));
// Loop over [vcur, vnext]
vcur = vnext;
}
</code></pre>
<p>So we perform some calculations on all vertices which compare equal.</p>
<p>I'm doing some cleaning in the code, and would like to get rid of the <code>Unlike</code> struct. I tried to do it like this, which to my mind is clearer in intent:</p>
<pre><code>vnext = std::adjacent_find(vcur, vertices.end(), std::not_equal_to<Vertex>());
</code></pre>
<p>but that did not retain the same behavior, but rather goes into an infinite loop. Why? Have I misinterpreted <code>adjacent_find</code> or <code>not_equal_to</code>?</p>
| c++ | [6] |
2,443,787 | 2,443,788 | How to use functions between classes in python | <p>If I have more than one class in a python script, how do I call a function from the first class in the second class? </p>
<p>Here is an Example:</p>
<pre><code>Class class1():
def function1():
blah blah blah
Class class2():
*How do I call function1 to here from class1*
</code></pre>
| python | [7] |
4,830,516 | 4,830,517 | Has anyone ported Xerces C++ and Xalan C++ to iPhoneOS? | <p>I am looking for iPhoneOS libraries for Apache's Xerces C++ and Xalan C++. Has anyone ported Xerces C++ and Xalan C++ to iPhoneOS? Any help or tips are appreciated.</p>
| iphone | [8] |
4,605,784 | 4,605,785 | How i can find out that URL is active or inactive | <p>Hello Master Mind Friends
I have One issue i am showing information of web site using web view. Before showing it i want to know is it url link active or not if it is then i will show it in webView otherwise i will show alert message to User. Can anyone help to me. The url is like www.domainname.com:8150/imagename.jpg will it work or not. In this i want to know Will this link active or not.
Thanks in advance.</p>
| iphone | [8] |
4,425,442 | 4,425,443 | Android - View be shrink when load from memory | <p>Hi
<br/>
I have a list view with difference item layouts.
<br/>
First I inflated the view and store it memory.
When the list view get the child view (from getChildView function)) I will return the in-memory object. Everything seems ok except when I scroll the list, the view is shrink to 2/3 original size and after that it become bigger (fullsize).
<br/>
I hope that is an animation of android OS but still not found the solution now.
<br/>
The reason why I need to load it from memory is the inflate function take a lot of time (~100 miliseconds on HTC desire) and make the scrolling does not smooth (lag)
<br/>
Have you meet this?</p>
<p><br/>
I tested on android version: 2.0 and 2.2 </p>
<p><img src="http://i.stack.imgur.com/lzcJW.png" alt="alt text"></p>
| android | [4] |
177,786 | 177,787 | PHP: What does this error mean? Abstract method must be compatible? | <p>I have an abstract class. I'm extending that class. I'm getting this error:</p>
<pre><code>Fatal error: Declaration of Default_Model_FoobarMapper::_setClassVarsFromRow() must be compatible with that of Default_Model_AbstractMapper::_setClassVarsFromRow() in /location/to/models/FoobarMapper.php on line 3
</code></pre>
<p>What does this usually mean?</p>
<p><strong>Update:</strong> Found out that my type hinting was throwing an error. You can't do this:</p>
<pre><code>abstract class MyAbstractClass
{
abstract protected function _myFunction($array, $generic_class);
}
class Foobar extends MyAbstractClass
{
protected function _myFunction($array, Specific_Class $specific_class)
{
//etc.
}
}
</code></pre>
| php | [2] |
2,885,693 | 2,885,694 | How to find out if the value contained in a string is double or not | <p>In Java, I am trying to find out if the value contained in a string is double or not?</p>
| java | [1] |
3,017,869 | 3,017,870 | Can any class object be passed as test expression for any test expression such as if, while like ifstream object. | <p>In C++, can I use my objects as test expression like <code>ifstream</code> objects. If not, why?</p>
<p>e.g. </p>
<pre><code>ifstream ifs ("myfile.txt");
while( ifs ){
//read and process data..
}
</code></pre>
<p>I have a class, which operator do I need to overload to let compiler allow my object to be passed as test expression?</p>
<p>e.g.</p>
<pre><code>MyClass obj1;
if( obj1 ){
//do something..
}
while( obj1 ){
//do something repeatedly..
}
</code></pre>
<p>Both should be valid expressions.</p>
| c++ | [6] |
4,046,727 | 4,046,728 | how to check if array is equal? | <pre><code>Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 105
at HelloExample.main(jav.java:10)
</code></pre>
<p>please fix this error.
thanks in advance</p>
<pre><code>class HelloExample
{
public static void main(String[] args)
{
String str="HELLO";
char ch[]=str.toCharArray();
for(int i=0;i<ch.length;i++){
if(ch['i']=='a' || ch['i']=='e' || ch['i']=='i' || ch['i']=='o' || ch['i']=='u'){
System.out.println(ch[i]);
}
}
}
}
</code></pre>
| java | [1] |
167,195 | 167,196 | Java Swing Layout | <p>I would like the following lay out... </p>
<ul>
<li>JButtons on top along side eachother. </li>
<li>The JTextArea should be <em>under</em> the buttons.</li>
<li><p>The JTextArea should also have a <em>scrollbar</em>.<br>
...for the code below.</p>
<pre><code>JPanel jp = new JPanel();
One = new JButton("One");
Two = new JButton("Two");
TestOutput = new JTextArea();
jp.add(One);
jp.add(Two);
jp.add(TestOutput);
</code></pre></li>
</ul>
| java | [1] |
5,968,846 | 5,968,847 | Running an animation in the foreground that does not interfere with regular user input | <p>I am developing an application whereby an animation will play in the foreground without disrupting the users normal operations. The application should load at startup so there is no need for the user to actually open the Activity.</p>
<p>1) Load an application at startup.</p>
<p>2) Have an Activity running with a transparent background that does not block normal input from the user.</p>
<p>Can I get suggestions on how to do this?</p>
| android | [4] |
2,330,350 | 2,330,351 | executing a stored proc with datareader instead of dataset | <p>Can anyone explain to me how I could convert this sample function to use a DataReader instead of a DataSet?</p>
<pre><code>private void Example(int pIntValue1, pIntValue2)
{
DataSet dsExampleResults;
int i = 0;
using (var daExample = new SqlDataAccess(this.ConnectionString))
{
var cmdExample = daExample.GetStoredProcCommand("Example.dbo.GetExampleData");
daExample.AddInParameter(cmdExample, "@param1", DbType.String, name);
daExample.AddInParameter(cmdExample, "@param2", DbType.DateTime, date);
dsExampleResults = daExample.ExecuteDataSet(cmdExample);
}
if (pIntValue1 >= pIntValue2)
{
i = dsExampleResults.Tables[0].Rows.Count;
while (i > 0)
{
i--;
decExampleColumn1 = Convert.ToDecimal(dsExampleResults.Tables[0].Rows[i]["column1"]);
decExampleColumn2 = Convert.ToDecimal(dsExampleResults.Tables[0].Rows[i]["column2"]);
}
}
else
{
i = 0;
while (i < dsExampleResults.Tables[0].Rows.Count)
{
decExampleColumn3 = Convert.ToDecimal(dsExampleResults.Tables[0].Rows[i]["column3"]);
decExampleColumn2 = Convert.ToDecimal(dsExampleResults.Tables[0].Rows[i]["column2"]);
i++;
}
}
}
</code></pre>
| c# | [0] |
1,160,428 | 1,160,429 | reading first 5 fields of csv file in php | <p>I am confused on how to read a csv file in php ( only the first 4 fields) and exclude the remaining fileds.</p>
<pre><code>Sno,Name,Ph,Add,PO
1,Bob,0102,Suit22,89
2,Pop,2343,Room2,78
</code></pre>
<p>I just want to read first 3 fileds and jump to next data. cannot figure out how to do through fgetcsv</p>
<p>any help?</p>
<p>Thanks,</p>
| php | [2] |
1,113,110 | 1,113,111 | setImageResource running out of memory | <p>I have a repeated Runnable task that performs a setImageResource() every 10 seconds (the resource is a jpeg file). This is the only significant thing happening in the activity.</p>
<p>However, after a few iterations (2-4), the app crashes with the following error:</p>
<ul>
<li>VM won't let us allocate X bytes</li>
<li>Shutting down VM</li>
</ul>
<p>I did not expect this. Why isn't the GC cleaning up previous jpeg bitmaps? How do I avoid crashing the VM?</p>
<p>Thanks.</p>
| android | [4] |
977,259 | 977,260 | Literals and Objects - When to use what? | <p>I wonder when to use literals and when to use objects to create data type values.</p>
<p>Eg.</p>
<p>When do I use these:</p>
<pre><code>/regexp/
"string"
</code></pre>
<p>and when these:</p>
<pre><code>new RegExp("regexp")
new String("string")
</code></pre>
<p>Will these give me the same methods and properties?</p>
| javascript | [3] |
5,479,915 | 5,479,916 | set a video for a contact name in android | <p>I am new to android programming.now i am trying to create one small application to show videos at the time of call based on contacts.So please help me to set a video for a contact name.</p>
| android | [4] |
5,692,502 | 5,692,503 | Issue in converting px to dp for samsang galaxy tab | <p>I am creating android application using java code. we are converting DIP to PX using below code</p>
<pre><code>Px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dip, getResources().getDisplayMetrics().metrics);
</code></pre>
<p>Galaxy Tab 7inch (sdk version 3.2) :
density=1.0 width=1024, height=600 and picking the values from values-large folder</p>
<p>Galaxy Tab 7inch (sdk version 2.2) :
density=1.5 width=1024, height=600 and picking the values from values-large folder</p>
<p>That’s why in galaxyTab 2.2 value also coming from values-large folder and because of density 1.5 , its multiplying 1.5 </p>
<p>thanks
binish</p>
| android | [4] |
2,960,680 | 2,960,681 | Write a line of code that will perform affine transformation | <p>What would be the easiest way to do this in c#</p>
<p>to rotate 45 degrees on the X axis</p>
<p>and Move by 2 units in the x-direction, 3 units in the y-direction, and -1
unit in the z-direction</p>
<p>here is the code i am using</p>
<pre><code>using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
namespace MatrixExample
{
public class GameFunction : Microsoft.Xna.Framework.Game
{
Box box;
Vector3 ourVector;
float scaleAmount = 0.0f;
float rotateAmount = 0.0f;
float xPosition = 0.0f;
float yPosition = 0.0f;
float zPosition = 0.0f;
public void updateVector()
{
Matrix transformationMatrix = Matrix.Identity;
Vector3 transformedVector = Vector3.Transform(ourVector, transformationMatrix);
ourVector = transformedVector;
}
public void updateBox()
{
Matrix transformationMatrix = Matrix.Identity;
box.DrawMatrix = transformationMatrix;
}
Drawing Code
}
}
</code></pre>
<p>i dont need to touch the drawing code</p>
| c# | [0] |
5,542,587 | 5,542,588 | C# Operator overloading | <p>Will all .NET languages support operator overloading or C# and managed C++ only support it?</p>
| c# | [0] |
4,232,642 | 4,232,643 | send email content html+images | <p>i have web site that display 5 news and wont to send it to email</p>
<p>this URL :</p>
<pre><code>http://zamalkawyana.com/MailList
</code></pre>
<p>how can i send this page to email and display images and all page content</p>
<p>What is the best way to send HTML/image email?</p>
| php | [2] |
5,407,291 | 5,407,292 | Use GET variable to choose a array without using an IF statement for everything | <p>I'm doing a script that involves choosing a random string from an array and redirecting to it (using headers). I want it so that using a get variable and it will load the array with the same name as it. So, if the get variable is random, then it would load the array random and use that. </p>
<p>Does that make sense?</p>
<p>I'm using for a random avatar script, so that it will get a username then choose the array for that username, then select a random avatar URL. </p>
| php | [2] |
2,439,681 | 2,439,682 | What is the status of jQuery's multi-argument content syntax: deprecated, supported, documented? | <p>I've never seen this in any jQuery docs I've read; nor, have I ever seen it in the wild. I just observed multi-content syntax working here for the <code>after</code> modifier with jQuery 1.4.2. Is this supported syntax? Is it deprecated?</p>
<pre><code>$(".section.warranty .warranty_checks :last").after(
$('<div class="little check" />').click( function () {
alert('hi')
} )
, $('<span>OEM</span>') /*Notice this (a second) argument */
);
</code></pre>
<p>Here is the signature for after: <code>.after( content )</code>. But, as my example shows it should be <code>.after( content [, content...] )</code></p>
<p>I've never seen any indication in the jQuery grammar that any of the functions accept more than one argument (content) in such a fashion.</p>
<p><strong>UPDATE</strong>: What did it do? I left this out thinking it was obvious:</p>
<p>It inserts a <code><div class="little check" /></code> with the aforementioned callback on <code>.click()</code> and follows it up with a totally new sibling element <code><span>OEM</span></code>.</p>
<p>See <a href="http://stackoverflow.com/questions/2932796/how-do-i-rewrite-after-content-content">this follow-up</a> for a question about how to rewrite this.</p>
| jquery | [5] |
5,249,932 | 5,249,933 | Increment Counter when click on Link | <p>Dear All : Just to give more information , I have a search panel when certain criteria is given it fetch record from database and it display record . </p>
<pre><code><div id="menubar">
<ul>
<li class="current_page_item">
<a href="count.php" name="abc<?php $i; ?>">Home</a>
<?php $_SESSION['Home']=$row['ID']; echo $_SESSION['Home'];?>
</li>
</ul>
</div>
<div id="menubar">
<ul>
<li class="current_page_item">
<a href="count.php" name="abc<?php $i; ?>">Home</a>
<?php $_SESSION['Home']=$row['ID']; echo $_SESSION['Home'];?>
</li>
</ul>
</div>
</code></pre>
<p>so now what i want is either type-1 : so now if one click on 1st record home link it will take page a.php and when click on record 2nd it should take to b.php . and record are generated dynamically how we will change the page name ie is ( a.php and b.php ) OR any other solution . what i want to do is for each page that is a.php or b.php i want to store how many time the page have been visited and store that counter in database</p>
| php | [2] |
2,835,694 | 2,835,695 | C# TableLayoutPanelCellPosition transfer | <p>greetings, i need a replacement for TableLayoutPanelCellPosition. i have made this class:</p>
<pre><code>public class GridUnit
{
public GridUnit()
{
Column = 0;
Row = 0;
}
public GridUnit(int column, int row)
{
Column = column;
Row = row;
}
public int Column { get; set; }
public int Row { get; set; }
}
private TableLayoutPanelCellPosition homeLastPositionFirst = new TableLayoutPanelCellPosition(0, 0);
private GridUnit homeLastPositionLast = new GridUnit();
</code></pre>
<p>and if i do: </p>
<pre><code>homeLastPositionLast = homeLastPositionFirst
</code></pre>
<p>i get errors and this is expected. my question is what else do i need to implement so that i can do this?</p>
<p>thank you for your time and just for the record im new at this.</p>
| c# | [0] |
5,606,186 | 5,606,187 | Dynamically created form tag does not submit in IE but submits correctly on FF and Chrome | <p>I Need to submit the data on form 1 to an external application and load the http Response on to the page. So, this is a submit to an application in a new domain.</p>
<p>Modifying the form 1 action does not work for me, since there is a ton of extJS and AJAX on the page, and for some reason, if I change the form 1 action, the request DOES get submitted (I see the request parameters on the tomcat of application 2), but then the response never gets written back to the browser.. I just see a 'Loading...' this behaviour is consistent with all browsers...</p>
<p>Option2, dynamically created a NEW form, where I submit this new form to the external application. This works well in Chrome and FF, with response rendering correctly on to the browsers... However, this submit does not work in IE 8. Really strange and frustrating, as to what could be the reason behind this... Code is really simple javascript .. </p>
<p>LATEST UPDATE:
I have fixed this for now, by doing a document.write and creating a new html/form plus relevant js to submit the form after the rewrite... That worked! </p>
<p>But am still trying to figure why did the form not submit in IE? Could it have to do with the event listeners registered for that page that are interfering with the submit?? (document.write clears it up, so I guess thats why document.write worked)..</p>
| javascript | [3] |
4,928,835 | 4,928,836 | asp.net: Setting up multiple forms on a page | <p>I have a master page that contains a search box which is validated as a required field before the user can submit the search field.</p>
<p>The problem I'm having now is that one of my content pages has a DetailsView which won't let me edit a record, because the search box coming from the master page is blank.</p>
<p>The structure of the code is like this:</p>
<p>Master Page:</p>
<pre><code><form runat="server">
<asp:RequiredFieldValidator ID="SearchBoxRequiredFieldValidator"
runat="server" ControlToValidate="searchTextBox"
Display="None" ErrorMessage="Enter an employee's last name"></asp:RequiredFieldValidator>
<asp:TextBox ID="searchTextBox" autocomplete ="off" runat="server" Width="180px"></asp:TextBox>
<asp:Button ID="SearchButton" runat="server" Text="Employee Search"/>
<!--.....-->
<asp:ContentPlaceHolder ID="MainContent" runat="server"/>
</form>
</code></pre>
<p>The "MainContent" placeholder is populated with a page with only a DetailsView. How should I change my code so that I can submit forms from my MainContent pages, but also allow the Master page's search feature to function properly?</p>
<p>I'm pretty new to asp.net forms, so any help is greatly appreciated!</p>
| asp.net | [9] |
3,995,933 | 3,995,934 | My php can't find 'normalizer_normalize()' function, why? | <p>How come I can't use normalizer function?</p>
<p>I am using it exactly as I should, ie: $var = normalizer_normalize($str);</p>
<p>I get php error: no such function!</p>
<p>Here is the code:</p>
<pre><code> $headline= mysql_real_escape_string($_POST['headline']);
$ad_id_string=normalizer_normalize($headline);
</code></pre>
<p>Thanks</p>
| php | [2] |
1,050,025 | 1,050,026 | Can you copy large data files on an IPhone 4? Files > 1GB? | <p>Can you copy large data files on an IPhone 4? Files > 1GB?</p>
| iphone | [8] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.