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,890,721 | 3,890,722 | Should I use "" (quotations) While defining variable? But With/Without Works | <p>I have just started learning PHP, and here's my first doubt...</p>
<p>Both of these work:</p>
<pre><code><?php
$function1 = "Aahan";
print "Hi, $function1";
?>
</code></pre>
<p>and</p>
<pre><code><?php
$function2 = Aahan;
print "Hi, $function2";
?>
</code></pre>
<p>See the difference? In the second example I didnt use the "" (quotation marks) for the variable string. But it still works.</p>
<p>Also, the stupid author of the book (which I wont name), uses "" in some examples and doesnt use them in some, without explanation. So, what should I think? Either way is okay or what do you advise?</p>
<p>EDIT: Sorry guys, the author is a good one. I misunderstood this string <code>$x = 3;</code>, and started checking out the above examples. Just realized that constants don't need quotes. Sorry again.</p>
<p><strong>EDIT-2: it doesn't show me any error like you all have mentioned. How do I make it show the errors? or is it something wrong with my server itself? (I dont think so)</strong></p>
| php | [2] |
2,516,602 | 2,516,603 | null object in IE | <p>I'm running into an issue where the same javascript on another page works fine but for some reason on this particular page it is throwing an error with the exact same code. </p>
<p>I have a function that gets updated and passed an object of properties to update. </p>
<pre><code>function animateTo(a,t){
var speed,easing,del,cb;
speed = a.speed ? a.speed : 600;
del = a.del ? a.del : 0;
setTimeout(function() {
t.stop(true).animate( { left:a.x, top:a.y, opacity:a.opacity }, { duration: speed, easing: easeOutExpo });
}, del);
}
</code></pre>
<p>In IE its saying that a.speed is null. The object that is been passed sometimes has a speed property and sometimes not. So my guess is when its not present its being recognized in IE as null. Is their a way around this. without having to add the speed property to the object everytime. </p>
<p>I thought by saying speed = a.speed ? a.speed : 600;
it would set it to 600 if the a.speed was not present. </p>
<p>UPDATE:</p>
<p>I think it may have something to do with the setTimout.
The only difference between the two pages are the function being called 3 times at the same time. On the page that it works the calling of the animateTo function is spaced out. It seems when I call it one after another I get the speed is null or not an object only in IE.</p>
<p>Also when I moved the variables inside the setTimout I didn't get that error. But I have to leave the del variable outside the setTimout function and when I do I get an error del is null or not and object in IE.</p>
<p>It would seem on the first call the setTimout works and is able to read a.speed but the second call a.speed is null because the first setTimeout is still trying to find the local variable that's not around. At least that's my theory. Anyone got any ideas around this. </p>
| jquery | [5] |
3,762,854 | 3,762,855 | Is it possible to get the URL of the closed browser tab using c#? | <p>i've tried manipulating it using Process.GetProcessesByName("firefox"). But i can only detect the opening and closing of the browser.</p>
<p>-can somebody help me to detect the when the tabs in the browser are closed.</p>
| c# | [0] |
5,238,927 | 5,238,928 | why super.getClass() in a subclass returns subclass name | <p>I am inside a subclass and when I am trying to find the name of super class, I tried super.getClass() , but it is returning me the name of the subclass only.
Why?</p>
| java | [1] |
4,618,862 | 4,618,863 | include prevents other layout to be shown | <p>I have a layout which starts with an include to another layout and right after that there is a LinearLayout with two buttons in it.</p>
<p>The problem is that I don't see the layout with the two buttons after I added the include. But when I wrap the include with another layout, I do see the two buttons below the include and the problem is solved.</p>
<p>Can someone please tell me why I have to wrap the include?</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<include
android:id="@+id/keypad_layout"
layout="@layout/keypad_layout" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/buttonAudio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/button_audio_selector" />
<Button
android:id="@+id/buttonVideo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/button_video_selector" />
</LinearLayout>
</LinearLayout>
</code></pre>
| android | [4] |
5,339,715 | 5,339,716 | How to remove variable in img src tag? | <p>I have a sample code:</p>
<pre><code>$filename = 'http://thebox.vn/Uploaded/catmy/2013_04_23/couple_t2.jpg?maxwidth=480';
</code></pre>
<p>And I using this code to remove variable (maxwidth)</p>
<pre><code>echo preg_replace('/(\?)$/', '', $filename)
</code></pre>
<p>=> How to remove variable (maxwidth), how to fix it ?</p>
| php | [2] |
2,147,384 | 2,147,385 | Java - multidimensional array of vectors of generic type | <p>Imagine, if you will, a 10x10x10 cube made out of 1x1x1 bricks. Each brick must be accessable by an x,y,z coordinate. For each brick I also need to store a list of names of who own that 'brick'.</p>
<p>As efficiency is an absolute must, I came up with the following idea - A 3d array of vectors.
note- I have made a class which stores a name, and other info (called person)</p>
<pre><code>//declaration
protected Vector<person>[][][] position;
</code></pre>
<p>I think I must then allocate memory to the pointer <em>position</em>. I have tried this</p>
<pre><code>position = new Vector<person>[10][10][10];
</code></pre>
<p>But am getting an error 'Cannot create a generic array of Vector' I am only familiar with C++ and Java is new to me. I understand java does not like declaring arrays with generic type? Does anyone know how I can get around this problem? </p>
<p>Cheers</p>
| java | [1] |
2,795,098 | 2,795,099 | Random Value Inside Looping | <pre><code>for($i = 1; $i <= 5; $i++)
{
echo $i . ',';
}
</code></pre>
<p>Produce:
1,2,3,4,5</p>
<p>How to random the order of the result, like this:</p>
<pre><code>1,3,5,2,4 or 5,3,2,1,4 or 4,2,1,3,5 and so on..
</code></pre>
<p>1 upvote for the best answer. :-)</p>
<p>Thank you!</p>
| php | [2] |
4,218,683 | 4,218,684 | AppendAllLines alternative solution | <p>I am trying to write a txt file from C# as follows:</p>
<pre><code> File.WriteAllText("important.txt", Convert.ToString(c));
File.AppendAllLines("important.txt", (from r in rec
select r.name + " " + r.num1 + " " + r.num2 + " " + r.mult + " " + r.rel).ToArray());
</code></pre>
<p>I am getting error <code>AppendAllLInes</code> not found for system.IO.File any alternative approach or how can I include <code>AppendAllLInes</code></p>
| c# | [0] |
2,793,556 | 2,793,557 | jQuery Hover Menu - When hovering over child - menu disappears | <p>So I created a simple little hover, that uses a class from a link to show a div underneath.</p>
<p>The show/hide works fine, but I can't figure out how to set it so that if the mouse is over the div, it wont hide. I tried using (this) and .hover, with no success.</p>
<p>Here is my code:</p>
<pre><code>$(document).ready(function()
{
// hide all dropdown
$("#dropdown1").hide();
//hover show dropdown
$(".menu-level-one").hover(
function () {
$("#dropdown1").show();
},
function () {
var postTimer1 = setTimeout(function(){ $("#dropdown1").hide(); }, 1000);
}
);
});
</code></pre>
| jquery | [5] |
5,088,394 | 5,088,395 | Encoding an array with JSON; getting "illegal offset type" error | <p>I am trying to use a getJSON method in jquery to retrieve a dynamic array. I am getting an "illegal" offset error trying to encode my dynamic array. Here is the server side code (I am confident the javascript is correct because when I remove the query it runs fine):</p>
<pre><code><?php
session_start();
require_once "database.php";
db_connect();
require_once "auth.php";
$current_user = current_user();
include_once("config.php");
$westcoast_id = $_GET['westcoast_id'];
$westcoast_array = array();
$query = "SELECT city, state FROM users GROUP BY city";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
if($row['city'] != '' && $row['state'] != '') {
$westcoast_array[$row] = "location:".$row['city'].", ".$row['state'].", stopover:true";
}
}
$data = array($westcoast_id, $westcoast_array);
echo json_encode($data);
?>
</code></pre>
<p>The illegal offset is in reference to the line:</p>
<pre><code>$westcoast_array[$row] = "location:".$row['city'].", ".$row['state'].", stopover:true";
</code></pre>
<p>I cannot see what the issue is. Thank you for your help!</p>
| php | [2] |
3,168,465 | 3,168,466 | Like DOjo Does Jquery has got its own components for development | <p>a very good day to all of you .</p>
<p>I am trying to compare DOJO and JQuery .
What i observed is that , DOJO is very vast ( In package size ) and jquery isn't that much big at all.</p>
<p>DOJO provides its own components for every HTML component .</p>
<p>For example for a normal TextFiled</p>
<p>The DOJo form is </p>
<pre><code><script type="text/javascript">
dojo.require("dijit.form.TextBox");
</script>
</code></pre>
<p>Does Jquery also provides its own components ?? , Because when i googled , i didn't came across any such .</p>
| jquery | [5] |
4,661,637 | 4,661,638 | Modify Frame Scrolling From Javascript | <p>I have a frame that has scrolling disabled, I need to enable this through javascript. I can get the frame in the DOM using </p>
<p>frame = top.frmMain.id;</p>
<p>I'm struggling to work out how to then turn on scrolling. Its probably something really simple that I am missing. I guess I need to remove the scrolling=no attribute, any pointers would be great. </p>
<p>Thanks</p>
| javascript | [3] |
4,497,211 | 4,497,212 | android where System.loadLibrary loads files | <p>Some articles on the web tell me that System.loadLibrary will load files in "/data/data/{app package} directory. I wonder if this varies on each vendor implementation or fixed ?</p>
<p>Thanks</p>
| android | [4] |
4,396,831 | 4,396,832 | Loop inside oval in Java | <p>I need to examine each pixel inside an oval with Java.
For drawing, I am currently using:</p>
<pre><code>drawOval(x,y,r*2,R*2).
</code></pre>
<p>However, since I need to get each pixel inside the Oval, I would like to create a loop that iterates inside it (assuming I have x,y,r and R). Is there any built in functionality for this purpose?</p>
<p>Thanks,</p>
<p>Joel</p>
| java | [1] |
3,287,262 | 3,287,263 | Search Result displaying-like google php | <p>i have an paragraph and user will search inside that and if the search term has 3 matches inside but all are in 3 different places </p>
<p>ex</p>
<blockquote>
<p>World War II, or the Second World War[1] (often abbreviated WWII or WW2), was a global military conflict lasting from 1939 to 1945 which involved most of the world's nations, including all of the great powers, organised into two opposing military alliances: the Allies and the Axis. It was the most widespread war in history, with more than 100 million military personnel mobilised. In a state of "total war," the major participants placed their entire economic, industrial, and scientific capabilities at the service of the war effort, erasing the distinction between civilian and military resources. Marked by significant action against civilians, including the Holocaust and the only use of nuclear weapons in warfare, it was the deadliest conflict in human history,[2] with over seventy million casualties.</p>
</blockquote>
<p>i have to search "war" so that it should display like</p>
<blockquote>
<p>World <b>War</b> II, or the Second World War[1].....In a state of "total<b>war</b>,"....</p>
</blockquote>
| php | [2] |
5,133,160 | 5,133,161 | The following JavaScript code relate to Facebook | <pre><code><!--Load scripts for Facebook scraper-->
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '154617751273927',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</code></pre>
<p>What is meant by the use of the word "scraper" in the comment? This looks like an async function, and it's <a href="http://connect.facebook.net/en_US/all.js" rel="nofollow">http://connect.facebook.net/en_US/all.js</a> </p>
<p>I am not sure what this al.js does. The result of that attached to the fb-root element. </p>
<p>What does this async function do and why is it called a "scraper"?</p>
| javascript | [3] |
1,424,792 | 1,424,793 | What's the trick to pass an event to the next responder in the responder chain? | <p>Apple is really funny. I mean, they say that this works:</p>
<pre><code>- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch* touch = [touches anyObject];
NSUInteger numTaps = [touch tapCount];
if (numTaps < 2) {
[self.nextResponder touchesBegan:touches withEvent:event];
} else {
[self handleDoubleTap:touch];
}
}
</code></pre>
<p>I have a View Controller. Like you know, View Controllers inherit from UIResponder. That View Controller creates a MyView object that inherits from UIView, and adds it as a subview to it's own view.</p>
<p>So we have:</p>
<p>View Controller > has a View (automatically) > has a MyView (which is a UIView).</p>
<p>Now inside of MyView I put that code like above with a NSLog that prints "touched MyView". But I forward the event to the next responder, just like above. And inside the ViewController I have another touchesBegan method that just prints an NSLog a la "touched view controller".</p>
<p>Now guess what: When I touch the MyView, it prints "touched MyView". When I touch outside of MyView, which is the view of the VC then, I get a "touched view controller". So both work! But what doesn't work is forwarding the event. Because now, actually the next responder should be the view controller, since there's nothing else inbetween. But the event handling method of the VC is never called when I forward it.</p>
<p>%$&!§!!</p>
<p>Ideas, guys?</p>
<p><strong>Figured out weird stuff</strong>
MyView's next responder is the view of the view controller. That makes sense, because MyView is a subview of that. But I didn't modify this UIView from the view controller. it's nothing custom. And it doesn't implement any touch event handling. Shouldn't the message get passed on to the view controller? How could I just let it pass? If I remove the event handling code in MyView, then the event arrives nicely in the view controller.</p>
| iphone | [8] |
1,425,644 | 1,425,645 | What are some arugments for/against using jQuery.getScript()? | <p>I'm considering using this jquery utility as a possible solution, but I want to have a better understanding of it's use. Any thoughts?</p>
| jquery | [5] |
1,194,566 | 1,194,567 | Is it possible to automate clicking on buttons for doing testing on an Android layout? | <p>I want to test the functionality of my app and would like to automate most of the user interactions. One of them being buttons(or places where one needs user interactions). Is it possible to automate such a thing or does it go against the security? </p>
| android | [4] |
890,007 | 890,008 | In Google Play, can I transfer an app from one account to another? | <p>I have an app on Google Play. Can I transfer it to another Google Play developer account?</p>
| android | [4] |
1,694,539 | 1,694,540 | distance cost calculator | <p>Hello I am looking for a distance cost calculator like airports, taxi firms would have for example:</p>
<p>from x to xx it will cost ...</p>
<p>here is what i have made with help from some others here: <a href="http://pastebin.com/0pSF7VsA" rel="nofollow">http://pastebin.com/0pSF7VsA</a>
however i cannot work out how to get it to work e.g. do the maths when the user selects it from the form.</p>
<p>here is my form so far: <a href="http://pastebin.com/sq14eYMQ" rel="nofollow">http://pastebin.com/sq14eYMQ</a></p>
<p>thanks</p>
| php | [2] |
2,717,363 | 2,717,364 | Regarding Good C# Book for Beginner | <blockquote>
<p><strong>Possible Duplicates:</strong><br>
<a href="http://stackoverflow.com/questions/477748/what-are-the-best-c-net-books">What are the best C# .NET books?</a><br>
<a href="http://stackoverflow.com/questions/3476074/book-about-c-for-a-beginner">Book about c# for a beginner</a> </p>
</blockquote>
<p>I am a beginner in C# would need a good book. Please advise.</p>
| c# | [0] |
2,755,672 | 2,755,673 | how to import already built database to android app | <p>I am new to android and i have to built an android app which will be a quiz, in this i have to pick random question from a given table everytime.I have already built a database can anybody help me how can i import it to my app.
I am going to use an intent that will call the same activity everytime and each time in an activity an random no. is generated it will check if it is generated earlier or not, if not then it will pick tht question from database.</p>
<p>any other suggestions to implement retrieval of question from database or to implement this app are also welcome. </p>
| android | [4] |
3,627,757 | 3,627,758 | Retrieving annotated method from attribute constructor | <p>If I annotate a method of a class with an attribute, I can then retrieve custom attributes for that class and see if it has that attribute or not. For example, I'm building a message-oriented program so I have classes like</p>
<pre><code>public class ErrorHandler
{
[HandleMessage(ErrorHandling.ERROR)]
private static void OnError(string message, object context, params object[] args)
{
Exception e;
args.Extract(out e);
Console.WriteLine(e.Message + Environment.NewLine + e.StackTrace);
}
}
</code></pre>
<p>At runtime I can do this:</p>
<pre><code>public static void RegisterStaticHandlers(Type type)
{
foreach (var mInfo in type.GetMethods(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static))
{
var mAttr = mInfo.GetCustomAttribute<HandleMessageAttribute>();
if (mAttr != null)
RegisterInstanceHandler(mAttr.Message, mInfo.CreateDelegate<MessageHandler>());
}
}
</code></pre>
<p>(I have some extension methods to simplify the code, they're not relevant now.)</p>
<p>My question is: can I get rid of this <code>RegisterStaticHandlers</code> method altogether and register the handler in the attribute constructor?</p>
<pre><code>public class HandleMessageAttribute : Attribute
{
public string Message { get; private set; }
public HandleMessageAttribute(string message)
{
Message = message;
Messages.RegisterInstanceHandler(message, ... method reference here ...);
}
}
</code></pre>
<p>Is there a way to retrieve the method that is annotated by an attribute in the attribute constructor, instead of the opposite (and regular) way of having the method and getting its attributes?</p>
<p>[Edited]
I just realized that I can at least do this in the static constructor:</p>
<pre><code>static ErrorHandler()
{
Messages.RegisterStaticHandlers(typeof(ErrorHandler));
}
</code></pre>
<p>This at least keeps the registration of a class inside that class, which is great as far as I'm concerned :)</p>
| c# | [0] |
2,327,076 | 2,327,077 | Get clicked element's HTML using Javascript | <p>I am adding a class to the clicked element and getting the innerHTML of it, if the clicked element is a container. But if it is a HTML element and not a container,
For eg., if the clicked element is an image <code><img src="hello.png" /></code>(which is not a container and cannot use innerHTML), then i need to get the corresponding element tag, i.e. i need to get <code><img src="hello.png" /></code>. So anyway to do this with pure JavaScript? </p>
<p>P.S. I don't want to use any JavaScript libraries here.</p>
| javascript | [3] |
2,299,981 | 2,299,982 | Removing a table row using jquery, fading and changing color slightly | <p>I have a button that when clicked, gets the row in the table that was clicked on.</p>
<p>So I have:</p>
<pre><code>$("#someId").remove();
</code></pre>
<p>I want to highlight the row that is being deleted, and fade it out (it is being deleted).</p>
<p>Is there a way to do this with jQuery? I tried: $("#someId").fadeOut("slow").remove() but tat didn't seem to show anything.</p>
| jquery | [5] |
1,335,740 | 1,335,741 | Logout using MGTwitterEngine? | <p>How to logout using MGTwitterEngine API programmatically in iphone ? </p>
<p>THanks in advance.....</p>
| iphone | [8] |
43,120 | 43,121 | conversion of string representing HH:MM:SS.sss format into HH:MM:SS.ssssss format in python | <p>I have string which is representing time in HH:MM:SS.sss format ,Now i have to convert this sting into HH:MM:SS.ssssss format.Please let me know how to do this?</p>
| python | [7] |
5,726,394 | 5,726,395 | is it possible to create/set custom tones for an iPhone | <p>i figure you would use iTunes to do this, my brother says you can only do it for ringtones but he never has told me exactly how you do it or even showed me, what i want to do is get some sound files from my harddrive that i used to use on my old Teltra Phone before i upgraded</p>
| iphone | [8] |
5,963,001 | 5,963,002 | Can BufferedReader (Java) read next line without moving the pointer? | <p><br>
I am trying to read next next line without moving the pointer, is that possible? </p>
<pre><code>BufferedReader buf = new BufferedReader(new InputStreamReader(fileIS));
while ((readString = buf.readLine()) != null) {
}
</code></pre>
<p>the While will read line by line as i want, but i need to write the next line of the current line.</p>
<p>it is possible?</p>
<p>my file contain Http request data, the first line is the GET request,<br>
in the second line the Host name, i need to pull out the Host before the GET to be able to connect it together.<br>
Host/+the GET url, </p>
<pre><code>GET /logos/2011/family10-hp.jpg HTTP/1.1
Host: www.google.com
Accept-Encoding: gzip
</code></pre>
<p>Thanks.</p>
| java | [1] |
4,225,447 | 4,225,448 | how to get the margin-top with jquery when inline | <p>Hi this is an example of my code. I want to get the margin-top from all the "divs" contained in the div appointmentContainer.</p>
<pre><code><div class="appointmentContainer">
<div style="width: 940px; z-index: 8; background-color: yellow; position: absolute; margin-top: 0px;" class="a_162">
<a id="a_162" class="appointments">414<br/></a>
</div>
<div style="width: 940px; z-index: 8; background-color: yellow; position: absolute; margin-top: 15px;" class="a_164">
<a id="a_164" class="appointments">aaaa<br/></a>
</div>
</div>
</code></pre>
<p>so I have something like ths and I want to find the margin-top's in both of the above divs.</p>
<p>So so far I have this</p>
<pre><code>$('#a_162').parents('div:eq(0)').children('a');
</code></pre>
<p>So thats what I have so far. I want to find all the anchor tags from that parent div what is appointmentcontainer and get a list of all the margin-tops.</p>
<p>So I would like a list like</p>
<pre><code>margin-top : 0
margin-top: 15
</code></pre>
<p>or </p>
<pre><code>0
15
</code></pre>
| jquery | [5] |
1,135,979 | 1,135,980 | ASP.NET State Error | <p>I am have an asp.net page, where a list of products is shown in a drop down. When a user selects an item, corresponding price, available quantity etc. are shown in the corresponding text boxes. I have used ajax update panel to retrieve these information.</p>
<p>This approach seemed to work nicely at first, but sometimes when a product is selected, it takes too long for the price, quantities to change, and sometimes they don't even change. Then I used firebug to see what happened to the ajax request, and I found out that the response that is coming from the server is something like this - </p>
<pre><code>70|error|500|The state information is invalid for this page and might be corrupted.|
</code></pre>
<p>I have absolutely no idea what is wrong here.............</p>
| asp.net | [9] |
3,127,199 | 3,127,200 | How can i add eventListener on TabListener? | <p>I am working in android. I am designing a <code>TabHost</code>, in which I want to add <code>onclickListener()</code>.<br>
So by selecting a particular tab i can display the list of songs.</p>
<p>This is my code for create a <code>TabHost</code>:</p>
<pre><code>int number_of_tab=number_of_records/4;
for(int i=0;i<number_of_tab;i++)
{
intent = new Intent().setClass(this,Latest_MyActivity.class);
intent.putExtra("EX_START_POINT", i);
Log.v(TAG,"---album activity is called---" + "---the value of i---" + i);
spec = tabHost.newTabSpec(i+"").setIndicator("Albums",res.getDrawable(R.drawable.ic_tab_albums)).setContent(intent);
tabHost.addTab(spec);
Log.v(TAG,"---tabHost.getCurrentTabTag()--->>"+tabHost.getCurrentTabTag());
}
</code></pre>
<p>I want to know eventListener, so please suggest the code for that.</p>
<p>This is another function which is exist in second class:</p>
<pre><code> void makeListOfSongs()
{
Bundle extras=getIntent().getExtras();
display_tag=extras.getInt("EX_START_POINT");
for (int i = display_tag*10; i < display_tag+5; i++) {
musicid[i] = new TextView(this);
musicid[i].setText("Music Id = "+sitesList.getMusicId().get(i));
title[i] = new TextView(this);
title[i].setText("Title = "+sitesList.getTitle().get(i));
title_of_song[i]=sitesList.getTitle().get(i);
layout.addView(musicid[i]);
layout.addView(title[i]);
}
</code></pre>
<p>So if i select the first tab then list of song from 10 to 15 should display in list, if i select tab 2 then song from 20 to 25 should show in the list. So please suggest me what should i do to make such type of event Listener on the tabhost. </p>
<p>Thank you in advance...</p>
| android | [4] |
1,688,530 | 1,688,531 | C# - how can i limit download/upload speed within my application? | <p>I want to limit the bandwidth of all downloads and uploads to be performed in the application.</p>
<p>The reason is that the application runs code not written by me. I don't want some malicious code to over use the network resource.</p>
| c# | [0] |
2,634,641 | 2,634,642 | offset().top returning window object | <p>i can't get this through. </p>
<p>I need to get offset().top from a jquery object, this is my code</p>
<pre><code>parentLi = $(element).parents("li");
parentLiOffset = parentLi.offset();
top = parentLiOffset.top;
left = parentLiOffset.left;
console.log(parentLiOffset);
console.log(top);
console.log(left);
</code></pre>
<p>And this is what console gives back:</p>
<pre><code>Object { top=208, left=311}
Window /demo/
311
</code></pre>
<p>as you can see, I can't manage to get the "top" value. I'm usinf firefox, if that makes any difference.</p>
<p>Thanks!</p>
| jquery | [5] |
790,295 | 790,296 | Any STL doubly linked implemenations with pointer to head instead of previous | <p>Is there an doubly linked list implementation in c++ that allows modification to the previous pointer. For example instead of the previous pointer pointing to the previous node, it can be modified to point to the front of the list, and thus all one will have to do is call previous to get directly to the head of a list. </p>
| c++ | [6] |
69,953 | 69,954 | Difference between Intent.ACTION And Video View | <p>I 'm opening a video file (3gp) file using code below</p>
<pre><code> String url = "rtsp://v5.cache4.c.youtube.com/CkELENy73wIaOAliq6nKYdHZZxMYESARFEIJbXYtZ29vZ2xlSARSBWluZGV4Wgl4bF9ibGF6ZXJg7sXyzsWH3ZlMDA==/0/0/0/video.3gp";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
</code></pre>
<p>I can also play the url using MediaController and using its holder and Display. </p>
<p>What's the difference between the two methods. Both are available for Android 1.5 </p>
| android | [4] |
5,610,269 | 5,610,270 | Accessing a variable by reference in Javascript | <p>I'm trying to pass a reference to a variable and then update the contents in javascript, is that possible? For example a simple (fail) example would be...</p>
<pre><code>var globalVar = 2;
function storeThis ( target, value ) {
eval(target) = value;
}
storeThis( 'globalVar', 5);
alert('globalVar now equals ' + globalVar);
</code></pre>
<p>This of course doesn't work, can anyone help?</p>
| javascript | [3] |
613,503 | 613,504 | How to find out usage of battery in my application in android | <p>can anybody tell How to find out usage of battery in my application in android</p>
<p>Thanks</p>
| android | [4] |
646,030 | 646,031 | How to create drawable layer-list for android in Eclipse? | <p>I create resource drawable <code>layer-list</code> but i can't find?
<img src="http://i.stack.imgur.com/hyN1J.jpg" alt="enter image description here"></p>
<p>Please help me, thanks.</p>
| android | [4] |
5,240,270 | 5,240,271 | How do I read a single character with no echo in C++? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1413445/read-a-password-from-stdcin">Read a password from std::cin</a> </p>
</blockquote>
<p>I'm new to c++ programming and i have the following situation. I'm reading a char from stdin and assign it to a variable "v". Using "cin" the variable is printed to stdout before reading it. I want only to read it and store in "v", not print it.</p>
<pre><code>#include <iostream>
using namespace std;
int main()
{
char v;
cout << "Choose!\n";
cout << "a. Choose a\n";
cout << "b. Choose b\n";
cin >> v;
return 0;
}
</code></pre>
<p>Thanks in advice.</p>
| c++ | [6] |
1,045,951 | 1,045,952 | Assign same text to multiple DIV by jquery | <p>Suppose that I have many <code>DIV</code>s with different <code>ID</code>s and I want to insert a small snippet of html into all of those <code>DIV</code>s with different <code>ID</code>s. I tried</p>
<pre><code>$("#lblTopPager", "#lblBottomPager").html('hello my data');
</code></pre>
<p>but it doesn't work. Can anyone tell me the correct way to do it? </p>
| jquery | [5] |
1,411,532 | 1,411,533 | Loading external JSON file as a javascript variable | <p>I thought this question would be trivial but I just can't seem to find an answer.
A website (different origin, no control over it) is making available some JSON files. I want some variables of my script to grab the content of those files. I don't care whether it is done synchrnously or not. How would you go ?</p>
| javascript | [3] |
1,729,200 | 1,729,201 | php image loading time consumption | <p>I have a products website where in I have around 100 images of high quality. Each image is around 6-7MB in size. </p>
<p>In my database I have stored the path of all the images along with their names. The images are saved in a folder /images/product_name/, But when I go to display these images in a web page, the page takes forever to load. All I do is send the id to the table, get the image paths and display it in the products page. </p>
<p>It would be very helpful if I could get any sort of advice on how to optimize the process.</p>
| php | [2] |
4,577,225 | 4,577,226 | php M or F (male or female) | <p>I know there are more elegant ways to set up an html form to take the input of male or female; however, I am learning, and I was just wondering if this is also possible:</p>
<pre><code>//Incorporate two checks
if (empty($_POST['sex'])==FALSE && sanityCheck($_POST['sex'], 'string', 1)==TRUE)
{
// if the checks are ok for sex we assign sex to a variable
$sex = $_POST['sex'];
}
else
{
// if all is not well we echo an error message
echo 'Please enter a valid Gender';
// and exit the script
exit();
}
</code></pre>
<p>If so, how would I check this with regex?
Whether the user typed M or F.</p>
<p>I am thinking:</p>
<pre><code>function checksex($sexcheck)
{
//Some regex here to check the sex?
return preg_match(' ', $sexcheck);
}
</code></pre>
<p>And then call checksex as a third check added to the if conditional, like this:</p>
<pre><code>if (empty($_POST['sex'])==FALSE && sanityCheck($_POST['sex'], 'string', 1) != FALSE && checksex($_POST['sex'], 1) ==TRUE)
{
...
}
</code></pre>
| php | [2] |
883,471 | 883,472 | php_mod and script execution time | <p>I have a script with a long execution time.
Apache is using php_mod.</p>
<p>I start the process in the browser ( open the url ).
I close the browser and the process is still running.</p>
<p>How can I find the apache process and stop it (linux os )</p>
| php | [2] |
4,821,248 | 4,821,249 | calculating cubic root in python | <p>I'm trying to evaluate the following function in python:</p>
<pre><code>f(x) = (1 + cos(x))^(1/3)
def eval( i ):
return math.pow( (1 + math.cos( i )), 1/3)
</code></pre>
<p>why is it always returning me <code>1</code>?
I'm trying to calculate the <code>Right</code> and <code>Left</code> approximation of an integral, and latter apply <code>Simpson's Rule</code>, but <code>Python</code> does not seem to like that expression.
Help?
<strong>*Complete Code *</strong></p>
<pre><code>import math
min = 0
max = math.pi / 2
n = 4
delta = ( min + max ) / n
def eval( i ):
return math.pow( (1 + math.cos( i )), 1/3)
def right( ):
R = 0
for i in range(1, n+1):
R += eval( i )
return R
def left():
L = 0
for i in range(0, n):
print eval( i )
L += eval( i )
</code></pre>
| python | [7] |
4,991,487 | 4,991,488 | Distributing jquery licence in commercial software | <p>I’m building a commercial web application that uses jquery. I think I need to use the <strong>MIT</strong> licence for jquery because the application is commercial. When I looked at the MIT licence in Wikipedia it says: </p>
<p><em>“It is a permissive license, meaning that it permits reuse within proprietary software on the condition that the license is <strong>distributed with that software</strong>”</em></p>
<p>My question is how do you distribute the licence in a web application? Does the user have to accept the licence the first time they use the web site? Or do I include the licence in an about page?</p>
| jquery | [5] |
714,413 | 714,414 | inheritance private field in java | <p>If a subclass can't inherit private members from a super-class, but it inherits public methods from the super-class that have access to the private members that are not inherited, as mentioned here</p>
<blockquote>
<p><a href="http://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html" rel="nofollow">http://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html</a></p>
</blockquote>
<p><strong>Where are the private members of the super-class that are modified by inherited members of the subclass stored? Where do they exist?</strong></p>
| java | [1] |
4,117,372 | 4,117,373 | QuickContactBadge in ListView | <p>I have a ListView which dynamically adds QuickContactBadge and a TextView to show contact names and their photo in QuickContactBadge. I am using the following code to show photo in QuickContactBadge...</p>
<pre><code>public static Bitmap loadContactPhoto(ContentResolver cr, long id) {
Uri uri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, id);
InputStream input = ContactsContract.Contacts.openContactPhotoInputStream(cr, uri);
if (input == null) {
return null;
}
return BitmapFactory.decodeStream(input);
}
</code></pre>
<p>Then i am calling this method by saying </p>
<pre><code>quickContactBadge.setImageBitmap(loadContactPhoto(getContentResolver(), contactId));
</code></pre>
<p>I have following problem</p>
<p>1) The image is getting displayed, but it is huge. how to control size of quickcontactbadge.
2) Is this the best way to show image of a contact in quickContactBadge or if there is a preferred way, please let me know.</p>
<p>Thanks</p>
| android | [4] |
2,160,480 | 2,160,481 | can I write my Login Page redirect code in Session_End? | <p>Can I write my code in the <code>Session_End</code> method when my session is timeout and I redirect users to the Login Page?</p>
<p>I am using <b> Form Authentication </b> method.</p>
<p>Currently I have create a "<code>CheckSession()</code>" method and calling on each page...</p>
<p>please suggest...</p>
| asp.net | [9] |
1,545,875 | 1,545,876 | Is there a way to trigger the event viewDidUnload? | <p>I hope manually trigger the event viewDidUnload (unload an viewcontroller).
Is it possible?</p>
<p>Thanks</p>
<p>interdev</p>
| iphone | [8] |
1,562,597 | 1,562,598 | Which document describes which application icon sizes are needed to submit an app? | <p>It's crazy, but I can't find it. The HIG seems to talk only about system icons like "favorites", "search", etc.</p>
<p>Is there a special document that talks about this? Also, how must these icons be called and where must they be added?</p>
| iphone | [8] |
5,262,270 | 5,262,271 | JSON Framework in Iphone sdk | <p>how can we implement JSON framework in a IPhone application development </p>
| iphone | [8] |
3,827,042 | 3,827,043 | Javascript function on submit button to validate if cells are emply for a particular column of gridview | <p>I have binded a custom datatable to gridview. Now I want to validate if the value of cells of the column "DocumentsAttached" is Yes or No. If it is yes, then an alert message displaying " Documents are Attached". If No, a pop up box with message would you like to continue" Yes/No...If yes, is chosen my submit button should go through otherwise no.</p>
<p>Hope i made sense until now. Below is my aspx</p>
<pre><code> <asp:GridView ID="UploadDocs" AutoGenerateColumns="False" runat="server"
EnableViewState="true" onrowdatabound="dgdUpload_RowDataBound" style="margin-top: 0px">
<Columns>
<asp:HyperLinkField DataTextField="DocName" HeaderText="Invoice File Name" DataNavigateUrlFields="FilePath" DataNavigateUrlFormatString="{0}">
</asp:HyperLinkField>
<asp:BoundField HeaderText="Document Included" DataField="DocumentsAttached" ReadOnly="true" />
<asp:BoundField HeaderText="Identifier" DataField="Identifier" Visible="false"/>
<asp:CommandField ButtonType="Button" HeaderText="Delete" ShowDeleteButton="true"/>
</Columns>
</asp:GridView>
<asp:Button ID="btnSubmit" runat="server" Text="Save to MassUploadList" />
</code></pre>
<p>Can anyone help me to achieve this please.</p>
| asp.net | [9] |
4,066,216 | 4,066,217 | Android widget for choosing time | <p>Is there in android already some widget for choosing time which doesn't show popup like TimePicker? I have criteria for choosing time in popup so it looks weird to use Time Picker inside popup and open new.</p>
| android | [4] |
640,960 | 640,961 | How do I define a property to read an attribute from, without instantionating an object? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/5654853/how-do-i-define-a-property-to-read-an-attribute-from-without-instantionating-an">How do I define a property to read an attribute from, without instantionating an object?</a> </p>
</blockquote>
<p>Suppose I have:</p>
<pre><code>class Person
{
[ColumnAttribute("ID")]
public int Id;
[ColumnAttribute("Name")]
public string Name;
[ColumnAttribute("DateOfBirth")]
public date BirthDate;
}
</code></pre>
<p>I have a DAL which which have a method that will return a List of Person objects.<br>
Suppose that method is defined as: </p>
<pre><code>Person.GetAllByAge(int Age, ??? SortBy)
</code></pre>
<p>This method will return a list of Persons that have a given age and they will be sorted by the <code>SortBy</code> parameter which i defined as <code>???</code> because I don't know what kind of type it should be. </p>
<p>One possible example is that this function is defined as:</p>
<pre><code>Dal.Person.GetAllByAge(int Age, string SortBy)
</code></pre>
<p>so an example usage would be:</p>
<pre><code>Dal.Person.GetAllByAge(25, "DateOfBirth")
</code></pre>
<p>But this definition is not strongly typed and if I change the Column name in the Database then this will fail at runtime. </p>
<p>How can I change this to take a property on which to sort instead of it being a string? </p>
<p>For example a usage like this would be very nice:</p>
<pre><code>Dal.Person.GetAllByAge(25, BirthDate)
</code></pre>
<p>or</p>
<pre><code>Dal.Person.GetAllByAge(25, p=>p.BirthDate)
</code></pre>
<p>where <code>BirthDate</code> is the name of the property to sort on. </p>
| c# | [0] |
1,925,050 | 1,925,051 | edit data in datagrid in win applications | <p><strong>i use this code to display data in datagrid</strong> </p>
<pre><code>cs.Open();
BindingSource bsource = new BindingSource();
SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM dbo.lib_member_details", cs);
da.SelectCommand = new SqlCommand("SELECT * FROM dbo.lib_member_details", cs);
SqlCommandBuilder commandBuilder = new SqlCommandBuilder(da);
DataSet ds = new DataSet();
DataTable dt = new DataTable();
da.Fill(ds, "lib_member_details");
dataGridView1.DataSource = bsource;
</code></pre>
<p>now *<em>strong text</em>*i want that each row has edit and cancel button to edit the data from datagrid
help me i need it urgent</p>
| c# | [0] |
5,674,662 | 5,674,663 | javascript persisting changes | <p>I have an array of 20 objects BaseObjects called ArrayBaseObjects.
The user calls an object, it's loaded in the UI, and he makes changes to the properties.
Something like this:</p>
<pre><code>var ArrayBaseObjects = new Array();
var CurrentObject = null;
function OpenRecord (TheIndex) {
CurrentObject = ArrayBaseObjects[TheIndex];
}
function RecordChanges() {
// bunch of statements that make changes to CurrenObject
CurrentObject.CrazyStuff = NewValue;
}
</code></pre>
<p>The problem is that when the user makes changes to the CurrentObject, it also changes the value of the ORIGINAL object in ArrayBaseObjects.</p>
<p>I don't understand why?? When I write <code>CurrentObject = ArrayBaseObjects[TheIndex];</code> why does changing CurrentObject also affect the value of the objects in ArrayBaseObject??</p>
<p>I'm looking to compare that value between the orignal object and CurrentObject the user made changes to, but they're always the same! What changes do I need to make to get this to work the way I intend it?</p>
<p>Thanks for the explanation.</p>
| javascript | [3] |
1,839,527 | 1,839,528 | JQuery test if Div has been hidden and clear form fields if it has been hidden | <p>I have a number of div's that can be expanded using:</p>
<pre><code>$('.adddriver1').click(function(){
$("#additionaldriver1").slideToggle();
return false;
});
</code></pre>
<p>I just change the div id as I need to.
The fields in this div can then be filled out.</p>
<p>If the person clicks the button to hide the div I need to check if anything was entered and then clear the fields.
I am trying:</p>
<pre><code>$("#additionaldriver1").change(function(){
if($("#additionaldriver1").is(":hidden")){
$("#Driver2FirstName").val('');
$("#Driver2LastName").val('');
}
});
</code></pre>
<p>The html is:</p>
<pre><code> <a href="#"><img src="images/adddriver.gif" alt="" width="203" height="20" border="0" class="adddriver1" /></a>
</div>
<div id="additionaldriver1">
<h1>Section 2.2 - <span>Additonal Driver 1 Information</span></h1>
<table width="100%" border="0" cellspacing="3" cellpadding="3">
<tr>
<td width="34%" valign="middle"><strong>Additional Driver 1 </strong></td>
<td colspan="2" valign="middle">&nbsp;</td>
</tr>
</table>
</div>
</code></pre>
<p>But it does not clear the fields.
Any help would be appreciated
Thanks in advance, Warren</p>
| jquery | [5] |
2,392,262 | 2,392,263 | Turn this data value into variables? | <p>does anyone know how I can change this script around to be written into variables?
For example, OP1 = true/false, OP2, OP3 etc....</p>
<p>Here's a working fiddle that was created by a helpful member of the stack community :)
<a href="http://jsfiddle.net/SSPax/17/" rel="nofollow">http://jsfiddle.net/SSPax/17/</a></p>
<p>The HTML look like this:</p>
<pre><code><ul id="myUL">
<li><input type="checkbox" name="special[]" value="op1" />1</li>
<li><input type="checkbox" name="special[]" value="op2" />2</li>
<li><input type="checkbox" name="special[]" value="op3" />3</li>
</ul>
<input type="button" name="submit" value="Push Me First" id="nextquestion1" />
<input type="button" name="submit" value="Push Me Second" id="getStoredValues" />
</code></pre>
<p>And the script is:</p>
<pre><code>$('#nextquestion1').click(function() {
$('#myUL :checkbox').each(function () {
$this = $(this);
$.data(document.body, $this.attr('value'), $this.is(':checked'));
});
});
$('#getStoredValues').click(function () {
$.each($.data(document.body), function(key, value) {
alert('Name= '+ key + ' Value= ' + value);
});
});
</code></pre>
| jquery | [5] |
3,638,146 | 3,638,147 | remove ColorFilter / undo setColorFilter | <p>How can a ColorFilter be removed or setColorFilter on a view be undone?</p>
| android | [4] |
4,986,158 | 4,986,159 | How to display logcat values in the Terminal of Linux | <p>Iam using the Linux platform for develoment of my application I want to display my log values in the terminal so i have search a lot how to do any one please guide me</p>
| android | [4] |
1,218,879 | 1,218,880 | How to have a function pointer inside a class? | <p>"error: invalid use of non-static data member ‘thread::tfun’"</p>
<pre><code>Class thread {
typedef void* (th_fun) (void*);
th_fun *tfun;
void create(th_fun *fun=tfun) {
pthread_create(&t, NULL, fun, NULL);
}
}
</code></pre>
<p>How to have a function pointer inside a class?</p>
<p>Please note:- static deceleration will make the code compile. But my requirement is to hold the function per object.</p>
| c++ | [6] |
54,733 | 54,734 | Setting precision in Java | <p>If I want a double to have 9 decimal places, do I have to convert it to a string and then back to a double to do this (string methods are the only methods I'm seeing for setting the precision)?. In any case, what is the conventional way for setting the precision for a double if, for example, I want my method to return a double with 9 decimal places.</p>
| java | [1] |
4,713,234 | 4,713,235 | http form post change submit data | <pre><code><FORM id=loginForm name=loginForm method=post
action="http://www.example.com/login.php">
<INPUT name=username>
<INPUT name=password>
<INPUT type=submit value="Log In" name=action_login>
</FORM>
</code></pre>
<p>Is there any way of changing name=action_login to name=action_signup and post username and password to <a href="http://www.example.com/signup.php" rel="nofollow">http://www.example.com/signup.php</a></p>
<p>in the server site it has name=action_login but I would like to change this on the client side and not touch the server site.</p>
| c# | [0] |
2,389,227 | 2,389,228 | make visible ProgressBar from another class | <p>I want to display ProgressBar of MainActivity from another class.</p>
<p>Here is Layout xml file of MainActivity and java class name is main.java.</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tabBar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#0844aa"
android:orientation="horizontal" >
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:visibility="invisible" />
</LinearLayout>
</code></pre>
<p>And default is invisible for ProgressBar. But I want to make "visible" this ProgressBar from another class called <strong>"subclass.java"</strong>. </p>
| android | [4] |
2,043,847 | 2,043,848 | C#: Convert a UInt16 in string format into an integer(decimal) | <p>Here's the problem.</p>
<p>I ,for example,have a string "2500".Its converted from byte array into string.I have to convert it to decimal(int).</p>
<p>This is what I should get:</p>
<pre><code>string : "2500"
byte[] : {0x25, 0x00}
UInt16 : 0x0025 //note its reversed
int : 43 //decimal of 0x0025
</code></pre>
<p>How do I do that?</p>
| c# | [0] |
5,221,117 | 5,221,118 | How to match an element which has an attribute which "contains" a certain value using Jquery but | <p>I have an array of input controls garnered like so: </p>
<pre><code> var hiddenInputs = $("input[id^='Unanswered']")
</code></pre>
<p>Each hidden input resides in a container which has another control which I am interested in getting the value of.</p>
<p>I iterate over the array of hiddenInputs </p>
<pre><code> $.each(hiddenInputs, function(i, val) {
</code></pre>
<p>Now, the element I would like to find belongs in the same container, so I can traverse up the DOM to the parent and then I want to get at element(s) which have the id which contains the text 'mainInputControl' </p>
<pre><code> var question = $(val).parent("input[id*='mainInputControl']");
});
</code></pre>
<p>I am expecting the a shiny JQuery object to be nestling in question. What am I doing wrong? </p>
<p>Edit...
For some further insight. This is what is in the children of the parent node: [input#Unanswered, input#ctl00_ContentPlaceHolder1_renderingEngine_ctl01_0_ctl00_0_ctl00_mainInputControl.hasDatepicker] I would like to get at second of these controls! Maybe I need to do the attribute selection within the children method()....</p>
| jquery | [5] |
5,312,142 | 5,312,143 | increase get parameter value limit in php | <p>I've been seeing this error in apache error.log:
File name too long: access to /foo=bar failed</p>
<p>the value is 290 char long. After some research I found that the default max limit is set to 255 char in PHP. I tried increasing it to 512 char by using 'suhosin.get.max_value_length = 512'. I verified this change is applied by running phpinfo() from web.</p>
<p>But I'm still getting this error.</p>
<p>Question is, how do I increase the limit ?</p>
<p>I'm using CodeIgniter, php 5.3.10-1ubuntu3.5 with Suhosin-Patch on Ubuntu 12.04</p>
<p>Update:</p>
<p>I'm also doing url rewrite in apache, looks like this limit is from max file name limit in Linux system (ref: <a href="http://serverfault.com/questions/120397/max-length-of-url-257-characters-for-mod-rewrite">http://serverfault.com/questions/120397/max-length-of-url-257-characters-for-mod-rewrite</a>)</p>
<p>Can anyone please confirm this? why would the mod rewrite rule be limited by the max file name limits ? :(</p>
<p>Here is the rewrite rule:</p>
<pre><code>RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ /app/index.php\?f=$1 [L]
</code></pre>
<p>thx</p>
| php | [2] |
1,291,933 | 1,291,934 | EditText Android and inner information | <p>I need to achieve the similar behavior from the image below. I need to add extra static information inside an EditText in android that does not change according to the user's input (except for the character count).</p>
<p><img src="http://i.stack.imgur.com/BfsQi.png" alt="EditText with extra data"></p>
<p>How do I achieve this? As per I see from the focus, the data is inside the EditText and not out, so i believe this is some sort of style or a custom component. </p>
<p>Many Thanks
T</p>
| android | [4] |
2,302,602 | 2,302,603 | How to include cut,copy,paste actions in a text area? | <p>Sir,
I like to implement cut,copy,paste actions on the text area.please do forward me if u have any solutions.</p>
| java | [1] |
5,942,732 | 5,942,733 | listview for a single row? | <p>I've got an application which displays a field that can have multiple entries but I only wish to show the first entry and then give the user the option to expand that to display all items. I was thinking of making this a listview but once it's expanded I want it to retain the expansion. </p>
<p>the text field in question is part of a viewpager not a view on it's own. </p>
<p>Anyone got any good ideas or advice?
Thanks, m</p>
| android | [4] |
545,027 | 545,028 | Android Drawing chart using ACHARTENGINE | <p>I have followed the link <a href="http://www.achartengine.org/content/goodies.html" rel="nofollow">http://www.achartengine.org/content/goodies.html</a>,<br>
in Eclipse, select File / Import...
in the Import dialog, select General / Existing Projects into Workspace and hit "Next"
select the "Select archive file" radio button and hit "Browse..."
navigate to the achartengine-0.*.0-demo-source.zip file, select it and hit "Open"
in the Import dialog hit "Finish"</p>
<p>However, the project is having error and cannot be run. There just exist an error icon in the project name but I cannot find any error in detail. Can anyone try to import the project and help me to solve the problem. Thanks.</p>
| android | [4] |
2,514,598 | 2,514,599 | jQuery - is a radio button or a check-box checked? | <p>I have a UI that can either use a checkbox or a pair of radio buttons with values of 0 and 1 to allow the user to insert a boolean.</p>
<p>I have an event handler being called when the checkbox or either of the radio buttons is clicked on.</p>
<p>If the checkbox is checked, or if the radio button with a value of 1 is selected, I want to do one thing, if the checkbox is not checked, or the radio button with a value of 0 is selected, or if neither radio button is selected, I want to do another.</p>
<p>Here's the complication - I need to have the same event handler called, regardless of whether it is attached to a check box or a radio button. </p>
<p>So the question is, what is the cleanest way of structuring the code? Element.is('checked') doesn't work, because it returns true if either radio button is selected. Element.val() doesn't work, because the checkbox always has constant value.</p>
<p>Ideas?</p>
| jquery | [5] |
4,050,353 | 4,050,354 | Android similar NSUserDefaults from iPhone | <p>I like to save very simple a few Data.
best like in iPhone I can do with NSUserDefaults.</p>
<p>What is the similar command here in Android?
(just saving a few Variables, to be reused as long the application is installed)
I dont like to use a complicated Database just to do that.</p>
<p>thx
chris</p>
| android | [4] |
3,579,204 | 3,579,205 | Can we store 30mb of data in our android application? | <p>Actually my project database size is <strong>30mb</strong>. I have used only <strong>7mb</strong> of data till now. But now <strong>I need to place the complete database(30mb) in my assets folder</strong> of my project. <strong>Can we place that much data for android application?</strong> Please help me regarding this.
Will be thankful to you</p>
| android | [4] |
1,214,281 | 1,214,282 | setInterval is working once in Chrome but fine in other browsers | <p>I have the following slideshow code:</p>
<p><strong>HTML</strong></p>
<pre class="lang-html prettyprint-override"><code><div id="slideshow"><img src="common/images/background/Slide1b.jpg" />
<img src="common/images/background/Slide2b.jpg" />
<img src="common/images/background/Slide3b.jpg" />
<img src="common/images/background/Slide4b.jpg" />
</div>
</code></pre>
<p><strong>jQuery</strong></p>
<pre class="lang-js prettyprint-override"><code>var opt1 = 1;
$(document).ready(function() {
$('#slideshow').supersize();
all_images = $('#slideshow > img');
all_images.hide();
first = $('#slideshow > img:eq(0)');
first.show().attr('class', 'power');
setInterval(function() {
var total = $('#slideshow > img').length;
if(opt1 < total) {
var current = $('.power');
var next = $('.power').next();
current.removeClass('power').fadeOut('slow');
next.fadeIn('slow').addClass('power');
++opt1;
} else {
opt1 = 1;
all_images.removeClass('power').fadeOut('slow');
first.addClass('power').fadeIn('slow');
}
}, 2000);
});
</code></pre>
<p>It is working fine in all other browsers except in Google Chrome it fires only once.</p>
| javascript | [3] |
1,335,972 | 1,335,973 | counter should work on all click and function should be one | <p>i have one counter for script but i want to use the same for counter.
i am open for all changes in class and id.
here is the code:</p>
<pre><code>$(document).ready(function(){
$('#target').click(function() {
$('#output').text(function(i, val) { return val*1+1 });
});
$('#targetdown1').click(function() {
$('#output').text(function(i, val) { return val*1-1 });
});
});
</code></pre>
<p>here is the example: </p>
<p><a href="http://jsfiddle.net/cY9p7/7/" rel="nofollow">http://jsfiddle.net/cY9p7/7/</a></p>
| jquery | [5] |
5,248,784 | 5,248,785 | How to find out that Facebook App is selected when using Intent to share in Android | <p>How to find out that Facebook App is selected when using Intent to share text message in Android? Is there any way to do that? Thanks.</p>
| android | [4] |
1,572,866 | 1,572,867 | Is it possible to access another apps database if you have the device key? | <p>I am trying to access another apps database, I know it is located in </p>
<pre><code> "/data/data/jp.co.xxx.xxx.framework.database/databases/SETTING".
</code></pre>
<p>I have the device key and have signed my apk with the device key but I am still unable to <code>open the database.</code> </p>
<p>Is <code>this possible</code> with just the <code>device key,</code> I do not have the shared user id?</p>
<p>Thanks</p>
| android | [4] |
2,864,242 | 2,864,243 | How to achieve subdomain type domain names with php | <p>I am developing a site where users will have permalinks for them like <strong>user.domain.com</strong> or <strong>domain.com/user</strong> and i want to achieve this by php code. foe ex.
for username <strong>stack</strong> the permalink is <em>stack</em> and on going to <strong>stack.domain.com</strong> or <strong>domain.com/stack</strong> it should go to profile page of user!</p>
| php | [2] |
1,083,053 | 1,083,054 | Passing parameters to an anonymous method using an action in C# | <p>We are still having problems passing a parameter to an action. Here's what we have so far:</p>
<pre><code>public ActionResult Create(string ds) {
HandleException(new Action<string, ref System.Web.Mvc.ModelState>(ds,ModelState) => {
InitializeServices(ds, "0000");
vm.Account = new Account {
PartitionKey = "0000",
RowKey = "0000",
Created = DateTime.Now,
CreatedBy = User.Identity.Name
};
});
return View("CreateEdit", vm);
}
private void HandleException(Action action) {
try {
action();
}
catch (ServiceException ex) {
ModelState.Merge(ex.Errors);
}
catch (Exception e)
{
Trace.Write(e);
ModelState.AddModelError("", "Database access error: " + e.Message);
}
}
</code></pre>
<p>This gives 12 syntax errors and most are pointing to the line: </p>
<pre><code>HandleException(new Action<string,
</code></pre>
<p>We have also have syntax errors saying that "ref" is not the correct syntax</p>
| c# | [0] |
620,150 | 620,151 | Why can't C# interfaces contain fields? | <p>For example, suppose I want an ICar interface and that all implementations will contain the field Year. Does this mean that every implementation has to separately declare Year? Wouldn't it be nicer to simply define this in the interface?</p>
| c# | [0] |
4,764,734 | 4,764,735 | Why do i get error 500? | <p>for some reason i get error 500 in this file:</p>
<p><a href="http://apps.sce.ac.il/testxml/parser.php" rel="nofollow">http://apps.sce.ac.il/testxml/parser.php</a></p>
<p>this is the <code>phpinfo()</code>:
<strong>http://apps.sce.ac.il/testxml/phpinfo.php</strong></p>
<p>this is the code:</p>
<pre><code><?php
header("Content-type: text/html; charset=utf-8");
$record = array(
'event' => $_POST['event'],
'eventDate' => $_POST['eventDate'],
'desc' => $_POST['desc'],
);
$doc = new DOMDocument();
$doc->load( 'events.xml' );
$doc->formatOutput = true;
$r = $doc->getElementsByTagName("events")->item(0);
$b = $doc->createElement("record");
$event = $doc->createElement("event");
$event->appendChild(
$doc->createTextNode( $record["event"] )
);
$b->appendChild( $event );
$eventDate = $doc->createElement("eventDate");
$eventDate->appendChild(
$doc->createTextNode( $record["eventDate"] )
);
$b->appendChild( $eventDate );
$desc = $doc->createElement("desc");
$desc->appendChild(
$doc->createTextNode( $record["desc"] )
);
$b->appendChild( $desc );
$r->insertBefore( $b,$r->firstChild );
$doc->save("events.xml");
header("Location: {$_SERVER['HTTP_REFERER']}");
?>
</code></pre>
| php | [2] |
3,310,258 | 3,310,259 | redirect based on user role stored in mysql database | <p>I've made a website that users can now successfully login to but depending on which group the user is in, I would like to redirect them to different pages after logging in. I have a database with a row "training_group" and if for example, they are in group 2013_1, they would be directed to homepage_20131.php after logging in. </p>
<p>I've been looking for tutorials online and have found a possible solution with a switch function? but I am unsure of how/where to implement this. I just started learning php and would be grateful for any advice given! </p>
<p>Right now, my login page looks like this: </p>
<pre><code><?php
include 'core/init.php';
if (empty($_POST) === false) {
$username = $_POST['username'];
$password = $_POST['password'];
if (empty($username) === true || empty($password) === true) {
$errors[] = 'please input a username and password first! ';
} else if (user_exists($username) === false) {
$errors[] = 'We could not locate you in our database.';
}
$login = login($username, $password);
if ($login === false) {
$errors [] = 'That username/password combination is incorrect';
}
else {
$_SESSION['user_id'] = $login;
header('Location:logged_in/templates/logged_in_home.php');
exit ();
}
}
else {
$errors [] = 'No data received';
}
include 'includes/overall/header.php';
if (empty ($errors) === false) {
?>
<h2>We tried to log you in, but...</h2>
<?php
echo output_errors($errors);
}
include 'includes/overall/footer.php';
?>
</code></pre>
| php | [2] |
4,451,865 | 4,451,866 | how do you access anchor inside of tab | <p>We have an unordered list and on a click event we need to access a particular anchor inside of a tab. There are 7-8 anchors inside of the tab. </p>
<pre><code>var $tabs = $('#tabbed-content').tabs(); // first tab selected
$('.a-credit').click(function() { // bind click event to link
$tabs.tabs('select', 1); // switch to 2nd tab
return false;
});
<div id="tabbed-content">
<ul>
<li><a href="#deadlines">Payment Deadlines</a></li>
<li><a href="#methods">Payment Methods</a></li>
<li><a href="#installments">Pay In Installments</a></li>
</ul>
<div id="methods">
<p><a name="1"></a>Content 1</p>
<p><a name="2"></a>Content 2</p>
<p><a name="3"></a>Content 3</p>
</div>
</code></pre>
<p>If you click on an unordered list link, it should activate tab #2 and scroll to the a name. is that possible?</p>
| jquery | [5] |
5,195,781 | 5,195,782 | How to hide application from showing in menu | <p>I'm making an Android app and I would like to know how to hide its icon and title from showing in the menu. Everything I've found so far on the internet is hiding </p>
<pre><code><category android:name="android.intent.category.LAUNCHER" />
</code></pre>
<p>in AndroidManifest.xml.</p>
<p>If I do that it doesn't start after installation! Another important note: I need my app to ALWAYS be running, even after restarting the phone.</p>
| android | [4] |
2,985,616 | 2,985,617 | Array highest value or create next value? | <p>I have an array of names and id's.</p>
<pre><code>Array(
0=>array(
name=>New York,
id=>45763448349,
can=0
),
1=>array(
name=>New York2,
id=>45763464566,
can=0
),
3=>array(
name=>New York3,
id=>45763464854,
can=0
),
4=>array(
name=>New York4,
id=>45763464955,
can=0
),
5=>array(
name=>New York5,
id=>45763464745,
can=0
),
6=>array(
name=>New York6,
id=>45763464235,
can=1
)
)
</code></pre>
<p>For example (there will be different names (not all New York)) and I have an x variable with a name (for example x=New York) what I need to do is find the highest name and get the id and then make sure can is 1 otherwise specific the next highest name.</p>
<p>For example let's assume that I have x=New York so I look through the array and find that the highest array name is New York6. I see that can=1 so I just get the id. Now if can != 1 then I could specific New York7.</p>
<p>NOTE: This array will contain many different values (not all New York, I just used those for an example)</p>
<p>Now how on earth would I even get started?</p>
| php | [2] |
1,217,290 | 1,217,291 | C# windows application not closing | <p>I have a C# windows application. I placed it on a test server, whose set up is not controlled by my company and neither is the seurity context. I double click the exe. App runs and i see my form. I close the application, i open task manager and i still see a foot print of the applicatiion.</p>
<p>taskkill does not seem to remove it and it is still running in task manager. </p>
<p>how do i check if any resource is still being held?</p>
| c# | [0] |
963,861 | 963,862 | NSDictionary data not persist | <p>I have a NSDictionary object containg array of objects for particular keys, problem is that i call a funtion in a class which populate this dictiomnay and return ,when i access object for key it returns me an array containing same number of objects as i inserted but when i try to access the individual objects in this array i got an obj_msgsend error,
i would be really thankful if someone can help me out.</p>
<p>regards mohammad salman.</p>
| iphone | [8] |
483,973 | 483,974 | How many function calls does it take to create a class instance? | <p>Knowing that calling a function in python is expensive, the answer to this question has some bearing on optimization decisions, e.g. in comparing a straight one-function numeric approach to an object-oriented one. So I'd like to know</p>
<ul>
<li>What's the typical number of function calls required?</li>
<li>What's the minimum number of function calls required?</li>
<li>What increases the number of calls?</li>
<li>How does user-created classes compare to built-in classes?</li>
<li>What about object deletion (including garbage collection)?</li>
</ul>
<p>My google-fu was not up to the task of finding an answer to this question.</p>
<p><strong>EDIT:</strong> So to summarize the comments and forestall more close votes, here's some clarifications:</p>
<ul>
<li>I'm interested in the time-complexity of python instance creation compared to calling a normal python function</li>
<li>For the purposes of this question, let's limit ourselves to the newest CPython versions.</li>
</ul>
| python | [7] |
5,943,378 | 5,943,379 | can we apply .skin file themes to client controls(Html) | <p>We can apply styles through .css by giving property class name:</p>
<p>Ex: <code><input type="text" class="StyleSheet" id="txtName" /></code></p>
<p>But in server control(asp) there is a property called SkinId, by this way we can access.</p>
<p>Ex: <code><asp:TextBox SkinID="DataListColor" ID="TextBox1" runat="server"></asp:TextBox></code></p>
<p>So, can we apply styles to html controls through .skin files</p>
| asp.net | [9] |
870,163 | 870,164 | Iphone--(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation | <p>I By using this command
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation </p>
<p>I can rotate my view automatically ,Is there any way to rotate and ellabarate and fit with screen.</p>
<p>Thanks in advance,
(Deepan)</p>
| iphone | [8] |
4,379,083 | 4,379,084 | How do I load a list via a data set from SQL Server into ListView? | <p>I have what seems to be a simple question but its killing me trying to find out.</p>
<p>I have a form in which I have a ListView. In this ListView I would like to populate it with data from a SQL Server 2008 database table.</p>
<pre><code>public void LoadList()
{
DataTable dtable = budget_MainDataSetReceipt.Tables["Receipt"];
listView1.Items.Clear();
for (int i = 0; i < dtable.Rows.Count; i++)
{
DataRow drow = dtable.Rows[i];
if (drow.RowState != DataRowState.Deleted)
{
ListViewItem lvi = new ListViewItem(drow["ReceiptID"].ToString());
lvi.SubItems.Add(drow["DateCleared"].ToString());
lvi.SubItems.Add(drow["CategoryID"].ToString());
lvi.SubItems.Add(drow["Amount"].ToString());
lvi.SubItems.Add(drow["Store"].ToString());
lvi.SubItems.Add(drow["DateEntered"].ToString());
listView1.Items.Add(lvi);
}
}
}
</code></pre>
<p>I keep getting an </p>
<blockquote>
<p>Object reference not set to an instance of an object</p>
</blockquote>
<p>error, and I can't figure out why. There are about 5 rows of data in my database, so in my mind, there should be 5 rows of data within the list view.</p>
<p>Can anyone tell me what I am missing? I can post more code if that would be helpful.</p>
<p>I have tried calling the <code>LoadList()</code> method in several ways:</p>
<ul>
<li>Before the method itself</li>
<li>With the <code>InitializeComponent()</code> method</li>
<li><p>I have tried the following syntax</p>
<pre><code>this.LoadList();
this.Form1.LoadList();`
</code></pre></li>
</ul>
<p>I have also tried to initialize the DataTables type with the following:</p>
<pre><code>DataTables dt = new DataTables //did not work
</code></pre>
| c# | [0] |
5,946,515 | 5,946,516 | getattr vs. inspect.getmembers | <p>It is possible to grab an object attribute using either getattr(obj, attr) or inspect.getmembers(obj) and then filtering by name:</p>
<pre><code>import inspect
class Foo(object):
def __init__(self):
self.a = 100
def method(self): pass
foo = Foo()
method_by_getattr = getattr(foo, 'method')
foo_members = inspect.getmembers(foo)
method_by_inspect = [member[1] for member in foo_members
if member[0] == "method"][0]
print (id(method_by_getattr), method_by_getattr, type(method_by_getattr))
print (id(method_by_inspect), method_by_inspect, type(method_by_inspect))
a_by_getattr = getattr(foo, "a")
a_by_inspect = [member[1] for member in foo_members
if member[0] == "a"][0]
print (id(a_by_getattr), a_by_getattr, type(a_by_getattr))
print (id(a_by_inspect), a_by_inspect, type(a_by_inspect))
# (38842160L, <bound method Foo.method of <__main__.Foo object at 0x00000000025EF390>>, <type 'instancemethod'>)
# (39673576L, <bound method Foo.method of <__main__.Foo object at 0x00000000025EF390>>, <type 'instancemethod'>)
# (34072832L, 100, <type 'int'>)
# (34072832L, 100, <type 'int'>)
</code></pre>
<p>For the 'a' attribute getattr and inspect.getmembers are returning the same object. But for the method 'method' they are returning different objects (as can be seen by the disparate id's).</p>
<p>Why is this so?</p>
| python | [7] |
161,602 | 161,603 | Gallery's onItemSelected is called after orientan change BUT with no reference to position the first element | <p>Whenever my activity with a gallery is FIRST created the onItemSelected method is automatically called passing the 0 parameter for position and a reference to the 0th element(textview).
That is fine.
But when I change orientation and the activity is recreated, although the onItemSelected method is called again automatically the parameters are not what I'd expect. The selected position is still passed for the position but null is passed for the view parameter, in other words I can't reference the selected element.</p>
<p>I don't understand this behavior at all. Why is there no reference for the selected view?</p>
<p>(I need to change the text color of selected element based on the Bundle I get in onCreate but I don't have a reference to it.)</p>
| android | [4] |
291,351 | 291,352 | Why only 1 public class in Java file | <p>In any Java file, why can we have only one public class whose name is same as the Java file name?</p>
| java | [1] |
1,005,874 | 1,005,875 | writing to a text file in java | <p>I have the following function for writing to a file:</p>
<pre><code>public void writeToFile(String data) throws IOException {
FileWriter fstream = null;
try {
fstream = new FileWriter("out.txt");
BufferedWriter out = new BufferedWriter(fstream);
out.write(data);
//Close the output stream
out.close();
} catch (IOException ex) {
Logger.getLogger(test.class.getName()).log(Level.SEVERE, null, ex);
} finally {
try {
fstream.close();
} catch (IOException ex) {
Logger.getLogger(test.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
</code></pre>
<p>What it does every time it is called it creates a new file and writes a new line. What I want to achieve is to check whether file exist. If not create a new file and write something, if exists then open the file and add a new line without erasing existing text. How to do that? </p>
| java | [1] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.