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 |
|---|---|---|---|---|---|
821,680 | 821,681 | Making Asynchronous Service Calls in Android | <p>I am trying to make asynchronous service-call in my android app using AsyncTask Class, but for each and every service call in my activity i need to have a subclass in my Application which Extends AsyncTask. Can anyone Suggest me a better way of doing this???</p>
<p>In My Scenario Service Calls have different return-type,then i need to return an object for all service calls and typecast it according, Is there any better way of doing this ??? </p>
| android | [4] |
1,105,649 | 1,105,650 | How to serialize Dictionary into base64 | <p>I need to serialize the <code>headers</code> object to store it in string format, probably base64.
The <code>Dictionary<String, Object></code> will only have String or Int values, so there should be no problem. </p>
<pre><code> Dictionary<String, Object> headers = RequestHeaders.ProcessHeaders(HttpContext.Current);
</code></pre>
<p>Also, of course the point is to be able to deserialize the base64 string back to Dictionary.</p>
| c# | [0] |
4,503,672 | 4,503,673 | Have a Javascript which works in Chrome and Firefox but not IE | <p>I've created a simple javascript to select all check boxes. It works in two browsers but not one. Can anyone help me with this script to make it compatible with IE8 or above.</p>
<pre><code><script language="JavaScript">
function toggle(source) {
checkboxes = document.getElementsByName('marked[]');
for(var i in checkboxes)
checkboxes[i].checked = source.checked;
}
</script>
<p>
<input type="checkbox" onClick="toggle(this)" /> Select All
</p>
</code></pre>
<p>Thanks,</p>
<p>Jonah</p>
| javascript | [3] |
68,587 | 68,588 | Refresh screen from within BillingReceiver | <p>I have an app comprised of multiple activities. There are multiple items that may be purchased. What is displayed within each activity may vary depending on what has been purchased. I have a <code>BillingReceiver</code> with a <code>purchaseStateChanged()</code> method. What I need to do inside <code>purchaseStateChanged()</code> is to say, whichever activity is running, please invalidate?/refresh? the screen. Is there a standard way of doing this?</p>
<p><strong>EDIT:</strong> Looking at Simon's comment and just to make it easier to answer, let us say that when the BillingReceiver receives a call to purchaseStateChanged() one of two activities could be running, ActivityA or ActivtyB. These activities both contain methods <code>void redraw_everything()</code> which are both declared as: </p>
<pre><code>void redraw_everything()
{
getWindow().getDecorView().invalidate();
}
</code></pre>
<p>I don't know the syntax for setting up a callback, but I guess the answer may look something like:</p>
<p>In onCreate of both activities we should say something like:</p>
<pre><code>BillingReceiver.setupcallback(redraw_everything()); // ??
</code></pre>
<p>and in the onDestroy() methods have something like:</p>
<pre><code>BillingReceiver.setupcallback(null); // ??
</code></pre>
<p>Then in BillingReceiver make a method something like:</p>
<pre><code>??? stored_method_to_call;
void setupcallback(???? method_to_call)
{
stored_method_to_call = method_to_call;
}
</code></pre>
<p>then inside purchaseStateChanged() have some code like:</p>
<pre><code>if (stored_method_to_call != null) // ?? not sure about syntax
{
stored_method_to_call(); // ?? not sure about syntax
}
</code></pre>
| android | [4] |
740,259 | 740,260 | C++: call class method from a non-class function | <p>I want to write a help function which calls a class method:</p>
<p>foo.h</p>
<pre><code>class cls{
public:
void fun();
void fun1();
};
</code></pre>
<p>foo.cpp</p>
<pre><code>void cls::fun(){
helperFun();
}
void helperFun(){
fun1();//how to call fun1() here?
}
</code></pre>
<p>How should I do it, or what's the best way of doing it?</p>
| c++ | [6] |
4,067,305 | 4,067,306 | How do I create a node class with a pointer to a parent node that I can make null | <p>Never mind I am an idiot </p>
<p>My current node class </p>
<pre><code>class node
{
public:
int xCoord; // current position
int yCoord;
int gCost; //Cost to travel to node
int hCost;
int parentX; // parent coordinates
int parentY;
node* parentNode;
node(int x, int y, int g , int h, int pX, int pY, node* parent)
{xCoord=x; yCoord = y; gCost = g; hCost = h; parentX = pX; parentY = pY; parentNode = parent;}
int getxCoord() const {return xCoord;}
int getyCoord() const {return yCoord;}
int getgCost() const {return gCost;}
int getfCost() const {return hCost;}
int getparentX() const {return parentX;}
int getparentY() const {return parentY;}
</code></pre>
<p>I want to create a node like this </p>
<pre><code>node* startNode = new node(startX, startY, 0, 0, 0, 0, null)
</code></pre>
<p>However it is giving me an identifier 'null' is undefined error</p>
| c++ | [6] |
1,605,167 | 1,605,168 | Highlight the words in files( doc, excel, pdf etc) using java | <p>I have a web application in which i have a searc functionality. Search results will be different types of files.</p>
<p>While opening the file i want to highlight the search words.</p>
<p>Can anybody please help me. </p>
| java | [1] |
5,845,550 | 5,845,551 | Searching for an image element whose src contains a keyword, in an iFrame's HTML using jQuery | <p>I am digging deep into a page's DOM to manipulate a certain image attribute. I have a web page which contains an iFrame. The iFrame contains an image. The image has no id attribute so I am going to locate it using it's src. The src contains the unique keyword 'planet'. How do I locate this image using jQuery?</p>
<p><strong>ADDITION:</strong></p>
<p>I can't reference anything in the iFrame's DOM. Is there a special way to reference an element inside an iFrame?</p>
<p>Example: alert( $(myIframe).find('html').length ) reports 0, expecting 1.</p>
| jquery | [5] |
3,558,836 | 3,558,837 | PHPmailer's AddEmbeddedImage method not working | <p>I'm trying to test the PHPmailer class to embed image (http://www.google.gr/intl/en_com/images/srpr/logo1w.png) inside an e-mail</p>
<p>I'm using this code (along with standard one, that 100% works, mail is delivered):</p>
<p><code>$mail->AddEmbeddedImage($src, 'test', basename($src));</code></p>
<p>and this is placed the e-mail body:</p>
<p><code><img src="cid:test"></code></p>
<p>Image is not showing up. What may I doing wrong?</p>
| php | [2] |
578,430 | 578,431 | is there a way to exclude certain chars from encodeURIComponent | <p>i am building a query string for my url and need to exclude certain chars from the encode.</p>
<p>I want to exclude the "&" and the "=" so that I can make a statement as such:</p>
<p>first=blah&second=blah and so on....</p>
<p>I guess the best way to put it is how do I stop them from being encoded?</p>
<p>some code:</p>
<pre><code> else if (array[i].nodeName == "SELECT") {
if (array[i].id == "multiple") {
var selected = $.map($('#multiple option:selected'),
function (e) {
return $(e).val();
});
$.each(selected, function (index, value) {
name = array[i].name;
values += app + "\&" + key + "=";
});
} else {
name = arr[i].name;
values = arr[i].value;
}
}
key = encodeURIComponent(name);
value = encodeURIComponent(values);
queryString += name + "=" + values + "&";
</code></pre>
| javascript | [3] |
4,701,408 | 4,701,409 | How to capture an event when touching the external buttons of my android device? | <p>I want do an action when the user press the external button of a device.</p>
<p>I've googled and don't find many help.</p>
<p>Anyone have some idea?</p>
| android | [4] |
4,742,672 | 4,742,673 | JQuery: Check whether an Element is Hidden from the user | <p>How to check whether a particular element is hidden from the user? In my code, under certain conditions, this code will be called:</p>
<pre><code>$("#VersionSelectField").hide('fast');
</code></pre>
<p>So I have to make sure that if <code>$("#VersionSelectField")</code> is hidden, then I would not have to validate the value inside it when I submit the form ( I use <a href="http://docs.jquery.com/Plugins/Validation/validate" rel="nofollow">JQuery Validate library</a> for this purpose).</p>
<p>Any ideas?</p>
| jquery | [5] |
1,344,124 | 1,344,125 | Evaluate a simple string mathmatical expression | <p>I've just taken a test for a graduate C++ developer with the question below. It didn't go too well as I couldn't decide on a clear way of completing the task. Time limit didn't help either. I'm interested in how experienced developers would have tackled the follow problem - in pseudo or sample code:</p>
<pre><code>Evaluate
Write a function in C or C++ that evaluates the result of a simple expression.
The function should ignore whitespace, but stop at the first non valid character.
Valid tokens are listed in the table below:
0-9 - Only integers are allowed in expressions
() - Nested expressions should be evaluated first.
+, -, *, / - Basic operators are addition, subtraction, multiplication and division.
The expression should be parsed from left to right. It is not necessary to consider operator precedence in your solution (e.g. 1 + 3 * 4 = 16). If there is an error in the expression, the function should return false.
Suggested prototype for function:
Example:
bool evaluate(const char *expression, int &result)
{
...
}
**Input**
1+3
(1 + (12 * 2)
**Result**
4
N/A
**Return code**
true
false (missing bracket)
</code></pre>
<p>In addition, this is the 2nd C++ that I've failed to complete successfully. Have had 1 year intership experiece and 1 year academic experiece using C++, but I'm not prepared for some of these tests. Are there any recommended resources where I can attept to solve problems such as this one in order to gain more 'testing' experience?</p>
| c++ | [6] |
2,785,264 | 2,785,265 | Jquery Phone number mask | <p>I am using jquery.maskedinput-1.3.js for masking phone number.
But I want it to add minus sign dynamically
I am using mask
<code>$("#phone").mask("999-999-9999",{placeholder:" "});</code></p>
| jquery | [5] |
2,158,990 | 2,158,991 | Facing Force Close and the problem is in InnerClasses attribute | <p>I built an API and facing a force close in it and this is the following waring that i am getting at console side.</p>
<pre><code>[2011-02-04 17:49:05 - RMALiteTesting] warning: Ignoring InnerClasses attribute for an anonymous inner class that doesn't come with an associated EnclosingMethod attribute. (This class was probably produced by a broken compiler.)
</code></pre>
| android | [4] |
1,653,462 | 1,653,463 | How to print Serial port incomming data to lable | <pre><code> private void cliButton_Click(object sender, EventArgs e)
{
sp = new SerialPort();
sp.PortName = "COM14";
sp.BaudRate = 19200;
sp.Parity = Parity.None;
sp.DataBits = 8;
sp.StopBits = StopBits.One;
sp.Handshake = Handshake.RequestToSend;
sp.DtrEnable = true;
sp.RtsEnable = true;
sp.Open();
if (!sp.IsOpen)
{
MessageBox.Show("Serial port is not opened");
return;
}
sp.WriteLine("AT" + Environment.NewLine);
sp.WriteLine("AT+CLIP=1" + Environment.NewLine);
byte [] data= new byte [sp.BytesToRead];
sp.Read(data, 0, data.Length);
}
</code></pre>
<p>Here is my code.
it is use to communicate with the mobile phone through serial port.
Here im sending AT command (AT+CLIP=1 this command use to take CLI of the incomming call) to serialport. Then i read the data of the serial port. My problem is How can i print this readed data in the label.</p>
| c# | [0] |
5,995,013 | 5,995,014 | what does the '[0]' mean with $('#div')[0]? | <p>What does the [0] mean? Also is there a reference/manual that i can use to prevent asking simple questions like this..</p>
<pre><code> var height = $('.string-parent-container')[0].scrollHeight;
$('.string-parent-container').scrollTop(height);
</code></pre>
| jquery | [5] |
3,065,615 | 3,065,616 | customize listview Rows | <p>I would like if it's possible to customize each row of listview?. i need to remove the separator line from list box when list box has submenus items and list box does not contains any submenus that time i want show the lines. could you please help me on this.
Regards
Thilag.</p>
| android | [4] |
3,081,723 | 3,081,724 | Is !$page == false or $page in php? | <p>I saw the following code which uses if ($page!==false).
What are the differences if I use if ($page)?</p>
<pre><code>if($id){ // check that page exists
$page=dbRow("SELECT * FROM pages WHERE id=$id");
if($page!==false){
$page_vars=json_decode($page['vars'],true);
$edit=true;
}
</code></pre>
<p>Thanks in advance.</p>
| php | [2] |
2,236,253 | 2,236,254 | how to call an Activity through TabBars | <p>I'm making an application in which m using Tab Bars.
Now what i need to know is, how to open other Tab through <code>setOnTabChangedListener()</code> in my code</p>
<p>for example. i am currently in tab and when i click on the 2nd tab it should call the activity of 2nd tab.</p>
| android | [4] |
1,807,556 | 1,807,557 | jQuery extend $.fn and calling method syntax | <p>I understand that you call a method like this when you are extending <code>$.fn</code>.</p>
<p>( <code>$ == jQuery</code> )</p>
<pre><code>//$("div").myMethod();
$.fn.extend({
myMethod: function(){...}
});
</code></pre>
<p>And like this when you extend the jQuery Object:</p>
<pre><code>//$.myMethod2();
$.extend({
myMethod2: function(){...}
});
</code></pre>
<p>But I don't quite understand what the <code>$()</code> is doing here:</p>
<p>// There are a few methods being called here. Some with the same method name (initiate) which is bad.</p>
<p>// But maybe that is why the blank jQuery object is needed so the method names don't clash</p>
<pre><code>$(function() {
$().functionName({
something: 'something'
}).myMethod();
$().func1({
x: 1
}).initiate();
$().func2({
y: 2
}).initiate();
});
</code></pre>
<p>Does it have to do with the fact the method is being called including the function name?</p>
<p>Thanks in advance and hope this makes sense.</p>
| jquery | [5] |
3,995,794 | 3,995,795 | Converting an uint64 into a (full)hex string, C++ | <p>I've been trying to get a <code>uint64</code> number into a string, in hex format. But it should include zeros. Example:</p>
<pre><code>uint i = 1;
std::ostringstream message;
message << "0x" << std::hex << i << std::dec;
...
</code></pre>
<p>This will generate:</p>
<pre><code>0x1
</code></pre>
<p>But this is not what I want. I want:</p>
<pre><code>0x0000000000000001
</code></pre>
<p>Or however many zeros a <code>uint64</code> needs.</p>
| c++ | [6] |
2,947,271 | 2,947,272 | PhoneSateIntentReceiver.NotifyPhoneCallState in android | <p>Hello can anyone explain the use of <strong>PhoneSateIntentReceiver.NotifyPhoneCallState in android</strong> and when this can be used...?? </p>
<p>It would be great if you can give some example also.</p>
<p>thanks a lot.</p>
| android | [4] |
1,071,898 | 1,071,899 | ASP.Net PostBack & Button Internal | <p>i worked for long time with windows apps using .net. for last 2 year i am working with asp.net. we often work with asp.net button control. when we click on button then postback occur and right server side event called by asp.net engine. i how link & image button causes postback when user click on those button.</p>
<p>when we work with link & image button then __doPostback js function is called and that causes form submit to server and request the same page and asp.net engine detect which control causes the postback from the hidden input control called eventTarget and invoke right event handler for that control.</p>
<p>but i dont know when we work with asp.net button control like</p>
<pre><code><asp:Button ID="SampleButton" runat="server"
Text="Submit"
OnClick="ButtonClick" />
</code></pre>
<p>when we click button then also form submit but how. i know that in this case <code>__doPostback</code> does not invoke because for button <code>__doPostback</code> is never rendered in the page. so in this case form submit but how asp.net engine detect which button causes postback and invoke right event handler?</p>
<p>how we get the data from textbox like txt1.text when postback occur. is it extracted from viewstate....am i right.</p>
<p>please answer for my 2 question. try to explain here instead of giving any url...thanks.</p>
| asp.net | [9] |
752,864 | 752,865 | jQuery bounce effect | <p>Hi I'm looking to make a modal div appear on a page using a bounce effect like seen on the iPhone for its pop-up messages.</p>
<p>By bounce I mean like scale bigger than normal and then become the actual size in an elasticated way whilst fading into view.</p>
<p>Any ideas on where to start with this?</p>
| jquery | [5] |
5,554,804 | 5,554,805 | Should a sync provider be an Android library or application? | <p>Regarding Android >= 2.0.1.</p>
<p>This speaks for Application type of project:</p>
<ul>
<li>The provided sample code makes it an
application.</li>
<li>Easy testing in dev tools.</li>
</ul>
<p>This speaks for Library type of project:</p>
<ul>
<li>From another application wanting to
trigger a sync, I would like to
include it as a library dependency.</li>
</ul>
<p>What other benefits/drawbacks can you see with either type of project ?</p>
| android | [4] |
172,232 | 172,233 | How to include assets for xhdpi devices on Android 2.1 application? | <p>I have a Android application using 2.1. I've gone ahead and created a drawable-xhdpi folder and put assets in it. I've set targetSdk=15, but the drawable in that folder is not being used. Is it not possible to support newer devices and keep an minimum sdk of 7?</p>
| android | [4] |
1,462,085 | 1,462,086 | Program received signal: “0” | <p>Want to implement the application like Season's Greeting <a href="http://itunes.apple.com/us/app/seasons-greeting/id345499393?mt=8" rel="nofollow">http://itunes.apple.com/us/app/seasons-greeting/id345499393?mt=8</a></p>
<p>But i am getting the following error when i have added multiple imagesViews in UIScrollView:</p>
<p>Program received signal: “0” warning: check_safe_call: could not restore current frame</p>
<p>I have already added images as a .png files and i have also used</p>
<pre><code>[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"Template1"]
ofType:@"png"];
UIImage* templateImg = [UIImage imageWithContentsOfFile:templateName];
[templateArray addObject:templateImg];
UIImageView* imgView = [[UIImageView alloc] initwithimage:templateImg];
[scrollView addSubview:imgView];
</code></pre>
<p>When i added 25 imgView as above my app is crashed on iPhone Simulator and iPhone.</p>
<p>Looking at the crash log it appears the device is complaining about low memory. The code that is showing this behavior only shows it on 3.0, for me. This never happened on 2.x with the exact same code.</p>
| iphone | [8] |
3,079,589 | 3,079,590 | Jquery: Getting the number from ID | <p>You mentioned this in another question: <a href="http://stackoverflow.com/questions/2427853/jquery-get-number-from-id">jquery get number from id</a></p>
<p>You should get in the habit of using delimiters in your attribute names (ie, button-1, button_1). One of the advantages, of many, is that it makes it easier to extract a number, or some other information, from the field (ie, by splitting the string at '-').</p>
<p>How would you extract the number if you are using a delimiter in your attribute names?</p>
<p>Thanks!</p>
| jquery | [5] |
5,370,748 | 5,370,749 | php: timing a script | <p>When running a micro time and catching it at the start of the a script then at the end of a script why does the time change every time you run the script?</p>
<p>Does it have to do with other items running?
How it was processed?</p>
| php | [2] |
2,557,724 | 2,557,725 | Android: Working with the Android Calendar | <p>I am trying to add entry to the Android Calendar(2.2),but i have ever got some error.
I tried a lot of test but without success.What is wrong please?
Sorry for my english.</p>
<p>Source code:</p>
<pre><code>String calName;
String calId = null;
String[] projection = new String[] { "_id", "name" };
Uri calendars = Uri.parse("content://com.android.calendar/calendars");
Cursor managedCursor = managedQuery(calendars, projection, "selected=1", null, null);
ContentValues event = new ContentValues();
DateFormat date = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
long time = System.currentTimeMillis();
String timeStr = date.format(time);
Log.d(TAG, "Value of timeStr: " + timeStr);
if (managedCursor.moveToNext()) {
calName = managedCursor.getString(managedCursor.getColumnIndex("name"));
calId = managedCursor.getString(managedCursor.getColumnIndex("_id"));
event.put("calendar_id", calId);
event.put("title", "Event Title");
event.put("description", "Description");
event.put("eventLocation", "New York");
event.put("dtstart", timeStr );
event.put("dtend", timeStr);
Uri eventsUri = Uri.parse("content://com.android.calendar/events");
Uri url = getContentResolver().insert(eventsUri, event);
}
</code></pre>
| android | [4] |
5,032,966 | 5,032,967 | Count matching brackets in python string | <p>A user types a string containing regular expressions like this one:</p>
<pre><code>'I have the string "(.*)"'
</code></pre>
<p>or</p>
<pre><code>'when user enters (\d+) times text "(.*)" truncate spaces'
</code></pre>
<p>I need to count each matching brackets' occurrence as user types, so above texts would return count one for the first text and 2 for the second. On the other hand a bracket without a matching one shouldn't be counted:</p>
<pre><code>'I am in the middle of writing this ('
</code></pre>
<p>Also I would like to avoid counting nested brackets.
As this code will be executed in certain circumstances on <em>every</em> keystroke in vim (it's a part of a snippet for UltiSnips, so when I create the snippet and enter given placeholder this count function should evaluate what I type on each new char) it needs to be fast ;)</p>
<p>To sum up requirements:</p>
<ol>
<li>Count bracket pairs</li>
<li>Do not count bracket without a matching one</li>
<li>Do not count nested brackets</li>
<li>Count fast ;)</li>
</ol>
<p>As requested - here is my initial effort to make this work:
<a href="https://gist.github.com/3142334" rel="nofollow">https://gist.github.com/3142334</a></p>
<p>It works, but unfortunately it counts inner brackets too, so I need to tweak it more.</p>
<p>Here is another solution that counts only outer brackets:</p>
<pre><code>def fb(string, c=0):
left_bracket = string.find("(")
if left_bracket > -1:
string = string[left_bracket + 1:]
right_bracket = string.find(")")
if right_bracket > -1:
if string[:right_bracket].find("(") == -1:
c += 1
string = string[right_bracket + 1:]
return fb(string, c)
else:
return c
</code></pre>
| python | [7] |
1,455,916 | 1,455,917 | jQuery delay/disable overlay on hover | <p>I'm working with a simple thumbnail overlay script:</p>
<pre><code> // Hover thumbnail overlay
$('li.carouselBlock a').hover( function () {
// Display the overlay
$(this).find('span.carousel-description').stop( false, true ).delay(500).animate( {'top':'0px'}, 500 ).show();
},
function () {
// Hide the overlay
$(this).find('span.carousel-description').stop( false, true ).animate( {'top':'-100px'}, 500 );
});
</code></pre>
<p>I'd like it so if the user glances their mouse over the thumbnail (or off it in fact) the JS doesn't kick in unless the hover has been consistent for around half a second.</p>
<p>Initially I thought this could be solved with jQuery's <code>.delay()</code> method like the other answers I've come across, but then I discovered this will only "delay" the animation (it <em>always</em> kicks in even if the user glances across it) rather than prevent it from kicking in unless the user has hovered for a specified amount of time.</p>
| jquery | [5] |
693,274 | 693,275 | deactivate button on gallery slider | <p>I'm am trying to make my javascript/jquery slider button deactivated when it reaches the the end of the scrolling images( when the images have moved all the way to the right, the MoveRight button must be deactivated and only leave MoveLeft button active, same for the move LeftButton), can anybody help with this ? Im not sure if im using
.attr() and removeAttr() correctly. I have pasted my code below.</p>
<pre><code><script type="text/javascript">
$(document).ready(function(){
//Check width of Gallery div
var galleryWidth = $("#Gallery").innerWidth();
//Check width of GalleryItem
var NoListed = $("ul.GalleryItem li").length;
var galleryItemWidth = 1881;
$('.MoveRight')
$('.GalleryItem').css('width', galleryItemWidth);
//Check width of Gallery div on resize
$(window).resize(function(){
var galleryWidth = $("#Gallery").innerWidth();
});
$('.MoveLeft').click(function() {
$(".GalleryItem2").animate({"left": "-=350px"}, "slow");
$(".GalleryItem3").animate({"left": "-=280px"}, "slow");
$(".GalleryItem").animate({
left: '-=230',
}, "slow", function() {
position = $(".GalleryItem").position();
galleryItemLeft = position.left;
if(galleryItemLeft <= galleryWidth - galleryItemWidth) {
$('.MoveLeft').removeAttr('disabled');}
else{
$('.MoveLeft').attr('disabled','disabled');
$('.MoveRight').attr('disabled','disabled');
}
});
});
$('.MoveRight').click(function() {
$(".GalleryItem2").animate({"left": "+=350px"}, "slow");
$(".GalleryItem3").animate({"left": "+=280px"}, "slow");
$(".GalleryItem").animate({
left: '+=230',
}, "slow", function() {
position = $(".GalleryItem").position();
galleryItemLeft = position.left;
if(galleryItemLeft >= "0") {
$('.MoveLeft').removeAttr('disabled');}
else{
$('.MoveLeft').attr('disabled','disabled');
$('.MoveRight').attr('disabled','disabled');
}
});
});
});
</script>
</code></pre>
| javascript | [3] |
5,551,849 | 5,551,850 | In Python, given a URL to a text file, what is the simplest way to read the contents of the text file? | <p>In Python, when given the URL for a text file, what is the simplest way to access the contents off the text file and print the contents of the file out locally line-by-line without saving a local copy of the text file? </p>
<pre><code>TargetURL=http://www.myhost.com/SomeFile.txt
#read the file
#print first line
#print second line
#etc
</code></pre>
| python | [7] |
4,126,214 | 4,126,215 | ASP.Net PostBack & Button Internal | <p>i worked for long time with windows apps using .net. for last 2 year i am working with asp.net. we often work with asp.net button control. when we click on button then postback occur and right server side event called by asp.net engine. i how link & image button causes postback when user click on those button.</p>
<p>when we work with link & image button then __doPostback js function is called and that causes form submit to server and request the same page and asp.net engine detect which control causes the postback from the hidden input control called eventTarget and invoke right event handler for that control.</p>
<p>but i dont know when we work with asp.net button control like</p>
<pre><code><asp:Button ID="SampleButton" runat="server"
Text="Submit"
OnClick="ButtonClick" />
</code></pre>
<p>when we click button then also form submit but how. i know that in this case <code>__doPostback</code> does not invoke because for button <code>__doPostback</code> is never rendered in the page. so in this case form submit but how asp.net engine detect which button causes postback and invoke right event handler?</p>
<p>how we get the data from textbox like txt1.text when postback occur. is it extracted from viewstate....am i right.</p>
<p>please answer for my 2 question. try to explain here instead of giving any url...thanks.</p>
| asp.net | [9] |
2,598,714 | 2,598,715 | Make javascript unobtrusive | <p>We all work hard when it comes to javascript and unfortunately there is no way to just hide the js in the browsers, but nevertheless we don't want other people to immediately be able to copy what we have accomplished in hours of work. When I look at Facebook script tags, its just a spaghetti-load of single letter variables and functions that no one could decipher in a jiffy. Is there something like a program of script that just "anonymizes" / "deciphers" / "encodes" my js so noone can really immediately see whats going on?</p>
<p>Example (be it far from perfect and full of errors):</p>
<pre><code>function convertTimeToString(time) {
var seconds = 0;
var minutes = 0;
if(time % 60 >= 10) {
seconds = time % 60;
else {
seconds = "0" + time % 60;
}
minutes = Math.floor(time/60);
return minutes + ":" + seconds;
}
</code></pre>
<p>becomes something like this</p>
<pre><code>function s(t){var a=0;var b=0;if(t%60>=10){a=t%60;}else{a="0"+t%60;}b=Math.floor(t%60);return b+":"+a;}
</code></pre>
<p>I guess you see the difference, it would take a good js coder a bit more time to make sense out of what this script is actually doing. Any ideas how to do it automatically?</p>
| javascript | [3] |
5,376,951 | 5,376,952 | Call Class From Python Script | <p>How would you call the below MLStripper class from another Python script? </p>
<p><strong>Main Python Script:</strong></p>
<pre><code> import ConfigParser
import os
from HTMLParser import HTMLParser
c = imaplib_connect.open_connection()
try:
config = ConfigParser.ConfigParser()
config.read([os.path.expanduser('~/reader.config')])
test = MLStripper.strip_tags("<br>testing</br>")
print test
</code></pre>
<p><strong>Class I Want to Call:</strong></p>
<pre><code> class MLStripper(HTMLParser):
def __init__(self):
self.reset()
self.fed = []
def handle_data(self, d):
self.fed.append(d)
def get_data(self):
return ''.join(self.fed)
def strip_tags(html):
s = MLStripper()
s.feed(html)
return s.get_data()
</code></pre>
| python | [7] |
1,425,028 | 1,425,029 | Perform the same action on multiple elements | <p>I have this line:</p>
<pre><code>$("#clients-edit-wrapper").height($(window).height()-150);
</code></pre>
<p>I would like to apply that height function to more than just that specific ID in one line of jQuery. Is there a way to chain elements together and apply that height function once for multiple elements? Basically, I want to apply that height function to 3 or 4 other DIVs but I would rather not have 3 or 4 more lines of jQuery to accomplish this.</p>
<p>Is this possible?</p>
<hr>
<p><strong>Answer from VisioN below (shows how much of a jQuery newbie I am!):</strong></p>
<p>You can use either multiple selector:</p>
<pre><code>$("#clients-edit-wrapper, #div2, #div3").height($(window).height() - 150);
</code></pre>
<p>Or class selector (which is certainly better!):</p>
<pre><code><!-- HTML -->
<div id="clients-edit-wrapper" class="myClass"></div>
<div id="div2" class="myClass"></div>
<div id="div3" class="myClass"></div>
// JavaScript
$(".myClass").height($(window).height() - 150);
</code></pre>
| jquery | [5] |
4,132,012 | 4,132,013 | What's a suitable html parser for Android? | <p>What's a suitable html parser for Android?</p>
| android | [4] |
447,818 | 447,819 | PHP $_SERVER['REQUEST_URI'] returning a 404'd file | <p>I'm having a strange issue here. </p>
<p>I'm setting a session variable to the value of <code>$_SERVER['REQUEST_URI']</code> on every page of my site except the login page. This way I can redirect the user back to whatever page they were on before logging in. </p>
<p>It works fine in every case, except recently I broke an image in my footer and the image <code>404</code>'s. Now, <code>$_SERVER['REQUEST_URI']</code> seems to be grabbing the URL of the image that's failing to load instead of the page the user was on, thus that my login form is now trying to redirect the user to the nonexistent image. </p>
<p>Obviously having files that fail to load is not ideal, but does anyone know why this server variable would be taking the value of the last failed request instead of the current page?</p>
| php | [2] |
1,982,868 | 1,982,869 | Parse error: syntax error, unexpected T_VARIABLE in C:\Program Files (x86)\EasyPHP-5.3.9\www\Inventory\addavaya.php on line 20 | <p>I'm new to PHP and get the message Parse error: syntax error, unexpected T_VARIABLE in .. on line 20. I would be ever so grateful if someone could help me with this error as it's really started to stress me out. Been on dreamweaver and it says error where it says $Username=... But I just can't seem to fix it </p>
<pre><code><?php
$host="localhost"; // Host name
$username="xxx"; // Mysql username
$password="xxx"; // Mysql password
$db_name="xxx"; // Database name
$tbl_name="avaya"; // Table name
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("inventory", $con)
$addavaya="INSERT INTO avaya_pabx(critical_spare_id, serial_no, ,comcode, version, circuit_pack, classification, location, availability, date, client)
VALUES ('$_POST[critical_spare_id]', '$_POST[serial_no]', '$_POST[comcode]', '$_POST[version]', '$_POST[circuit_pack]',
'$_POST[classification]', '$_POST[location]' , '$_POST[availability]', '$_POST[date]', '$_POST[client]')";
mysql_query($addavaya,$con)
if (!mysql_query($addavaya,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con);
?>
</code></pre>
| php | [2] |
2,780,177 | 2,780,178 | Android Help! I want to completely finish my activity, and after activity.finish no further code will execute? | <p>Android Help! I want to completely finish my activity, and after activity.finish no further code will execute?</p>
<p>exp:</p>
<pre><code>Intent scoringOpponentTeam = new Intent(this,TestActivitySecond.class);
startActivity(scoringOpponentTeam);
this.finish();
Log.i("after Finish Called", "after Finish Called--------"+"after Finish Called");
</code></pre>
<p>In Above Example, i want that no Log.i() line will execute. Kindly help me urgently.</p>
| android | [4] |
3,015,464 | 3,015,465 | problem to store data into sdcard | <p>i have problem to store image into sd car, there are not display file in sdcard which i want.
this is code.</p>
<pre><code>package com.sdcard;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import android.app.Activity;
import android.os.Bundle;
import android.os.Environment;
public class SdcardActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
try{
URL url = new URL ("http://www.coolpctips.com/wp-content/uploads/2011/05/top-30-android- games.jpg");
InputStream input = url.openStream();
try {
OutputStream output = new FileOutputStream (Environment.getExternalStorageDirectory()+"/top-30-android-games.jpg");
try {
int aReasonableSize = 10;
byte[] buffer = new byte[aReasonableSize];
int bytesRead = 0;
while ((bytesRead = input.read(buffer, 0, buffer.length)) >= 0) {
output.write(buffer, 0, buffer.length);
}
} finally {
output.close();
}
} finally {
input.close();
}
}catch (Exception e) {
e.printStackTrace();
}
}}
</code></pre>
| android | [4] |
2,667,112 | 2,667,113 | Why does my JavaScript not execute in order? | <p>I don't understand why my code isn't running in order... The code below doesn't execute the document.write part, but it executes the part after it just fine. I think it has something to do with the timing, giving the browser to execute the . I tried using setTimeout in some parts, but it's either not working, or I'm doing it wrong.</p>
<pre><code>function isBrowserMobile()
{
var iPadAgent = navigator.userAgent.match(/iPad/i) != null;
var iPodAgent = navigator.userAgent.match(/iPhone/i) != null;
var AndroidAgent = navigator.userAgent.match(/Android/i) != null;
var webOSAgent = navigator.userAgent.match(/webOS/i) != null;
if (iPadAgent || iPodAgent || AndroidAgent || webOSAgent)
{
document.write("<body bgcolor='Orange'><b>Mobile browser detected!</b></body>");
var choice = confirm("Do you want to visit the mobile site?")
if (choice)
mobile();
else
desktop();
}
}
</code></pre>
| javascript | [3] |
5,744,593 | 5,744,594 | Correct approach to update UI in Android | <p>I'm new to Android stuff. Currently I have someone else code in my hand and I'm trying to understand the functionality. Whoever wrote the code, used Handler and messages in it. For example, if a button is clicked, onClick listener is called which then posts a message to handler. Inside the handler there is a switch case statement which calls different methods based on a data passed in Message what attribute.</p>
<p>My question is, is this a correct approach or we should just call our method directly in the onClick handler.</p>
<p>As i understand, handler should be used to post a message to the main UI thread, from some other thread (worker thread which pulls data from server).</p>
| android | [4] |
1,327,179 | 1,327,180 | flash effect with jquery | <p>i want to fadein and fadeout <strong>backgroud-color</strong> using jquery
but, i tried bellow code, it's affect the full div content , i need to add flash effect only for backgroud-color.</p>
<pre><code> $('.countbox').css("background-color","#FF0000").fadeIn("fast").delay(800)
.fadeout("fast");
<div class="countbox">checkout</div>
</code></pre>
<p>i tried this on also but it's not working </p>
<pre><code>$('.countbox').css("background-color","#FF0000").fadeIn("fast").delay(800).css("background-color","#FFFFFF");
</code></pre>
<p>What's the problem anyone can help me !</p>
<p><strong>Edit</strong></p>
<p>oops!
my answer not applying to all window . which one only giving flash effect for current window but i need to get the flash effect for all window..
for example :-
When i click a button it should give me flash effect for div for all windows</p>
<p>exactly like this
<a href="http://www.beezid.com/" rel="nofollow">http://www.beezid.com/</a></p>
| jquery | [5] |
5,500,194 | 5,500,195 | LinearLayout and GestureDetector | <p>I'm trying to figure out, if it's possible to use GestureDetector for LinearLayout or just ScrollEvent?</p>
<p>Any Examples?</p>
<p>Thank you,</p>
<p>Mur</p>
| android | [4] |
3,286,523 | 3,286,524 | Loop and comparing each element of array? | <p>I am trying to compare each element from two array <code>$min</code> and <code>$max</code></p>
<pre><code>$test = false;
$min = array(2,3,3,55,556);
$max = array(22,32,4,56,557);
foreach($min as $key=>$val){
foreach($max as $k=>$v){
if($val >= $v){
$test=true;
break;
}
}
}
if($test){
echo "A NOT GREATER THAN or EQUAL B";
}else{
echo "YOU CAN SAVE NOW";
}
</code></pre>
<p>What I am wrong?because I got the message here</p>
<pre><code> A NOT GREATER THAN or EQUAL B
</code></pre>
<p>thanks</p>
| php | [2] |
1,596,034 | 1,596,035 | Java direct download link | <p>is there a direct download link to the JDKs and JREs? Maybe even a stable link to the latest JDK? I need to download Java at the command line and don't want to click through the Oracle homepage.</p>
| java | [1] |
2,858,396 | 2,858,397 | Returning an array from a method with user input in java | <p>I'm getting an illegal start of expression error next to <code>public static double getAverage (double average) {</code></p>
<p>I'm also getting an error stating "Variable average is not used" next to <code>double average = sum /(double) arr.length;</code></p>
<p>I've been working it for a while, I'm not sure what to do anymore.
Any suggestions?</p>
<pre><code>import java.util.Scanner;
public class Average {
public static void main(String [] args){
Scanner input = new Scanner(System.in);
System.out.print("How many numbers you want to display: ");
int n=input.nextInt();
System.out.println("Enter array values: ");
int arr [] = new int[n];
int sum=0;
for(int i = 0; i < arr.length; i++) {
arr[i] = input.nextInt();
sum+=arr[i];
double average = sum / (double) arr.length;
public static double getAverage(double average){
System.out.println("Average value of array: " + average);
{
return average;
}
}
}
</code></pre>
| java | [1] |
3,074,007 | 3,074,008 | Start android app without launching main gui? | <p>I just want an app that runs some code to shortcut to a certain part of ics. How can I run this code at run time without having to launch the main.xml? I see the manifest launches the main.xml but that is about all I know. </p>
| android | [4] |
4,559,744 | 4,559,745 | run php script after every 100ms | <p>Is it possible to run a php script after every 100ms ? This script will check a database for changes and then the changes will be reflected into some other database. I am already doing it using Triggers. But I want to know if there is any other way to do it without using Cron and Triggers. I will be using Linux for this purpose.
Thanks</p>
| php | [2] |
3,699,498 | 3,699,499 | Is there any difference between if(a==5) or if(5==a) in C#? | <p>Just I would like to know, is there any difference between </p>
<blockquote>
<p>if (a==5) or if (5==a) </p>
</blockquote>
<p>in C#, Which one is better? </p>
| c# | [0] |
1,947,969 | 1,947,970 | How to count with jquery number of elements on remote page? | <p>I would like to count number of elements on remote page:
For example remote page:</p>
<p>test.html with following structure</p>
<pre><code><div id="Layout">
<div class="product">...</div>
<div class="product">...</div>
<div class="product">...</div>
</div>
</code></pre>
<p>Then I would like call from test2.html</p>
<pre><code> <script type="text/javascript">
$(document).ready(function(){
$('#result').load('/test.html #Layout product').length();
});
</script>
</code></pre>
<p>This code is not working. What is the right way to do it?
Thank you.</p>
| jquery | [5] |
5,018,964 | 5,018,965 | Should I use a static class for global variables or just use static properties? | <p>I'm building a class to hold some global variables.</p>
<p>I'm just curios what would make the diference in using a static or a non-static class for this purpose.</p>
<p>Example </p>
<pre><code> public class Modules
{
public static int Modul1{ get { return 1; } }
}
</code></pre>
<p>or </p>
<pre><code> public static class Modules
{
public static int Modul1{ get { return 1; } }
}
</code></pre>
| c# | [0] |
5,030,915 | 5,030,916 | Code Review Services | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://programmers.stackexchange.com/questions/104975/website-for-code-review">Website for code review</a> </p>
</blockquote>
<p>As a sole developer on a Sharp Architecture project, I'd like to find a way to get some code review. How do people do this? Are there services that people can recommend? </p>
<p>Edit: Specifically, I need code review for the overall project - a big task.</p>
| c# | [0] |
2,357,254 | 2,357,255 | How to get parent object from child object dynamically | <p>Is it possible to get the parent object from a child object dynamically? Essentially, all I'm trying to accomplish is to dynamically retrieve the value of a property belonging to a child objects' parent. For example, something along the lines of the following:</p>
<pre><code>public T GetParentProperty<T>(object oChildObject, string sPropertyName)
{
??? oOwner;
PropertyInfo oOwnerInfo;
T oPropertyValue;
try
{
oPropertyValue = null;
if (oChildObject != null)
{
oOwner = oChildObject.GetType().???;
oOwnerInfo = oOwner.GetType().GetProperty(sPropertyName);
if (oOwnerInfo != null)
oPropertyValue = oOwnerInfo.GetValue(oOwner, null) as T;
}
}
catch(Exception oEx)
{
Console.WriteLine(oEx);
}
return oPropertyValue;
}
</code></pre>
<p>Many thanks in advance!</p>
| c# | [0] |
2,130,982 | 2,130,983 | PHP - Date returning the wrong value | <p>I have a little bit of code, and it doesnt seem to be working correctly.</p>
<p>Im trying to put it into the correct format for my database, what im doing is as follows</p>
<pre><code>date('Y-m-d H:i:s', strtotime('24/05/2011'));
</code></pre>
<p>But everytime i echo it, it returns:</p>
<pre><code>1970-01-01 10:00:00
</code></pre>
<p>Could someone please let me know where im going wrong.</p>
<p>Cheeers</p>
| php | [2] |
107,393 | 107,394 | Android SDK Setup Problems | <p>Im new to android and am just trying to install the SDK. I have everything else done. When i run the SDK Setup.exe (ive added the ./tools to the path already.) It gives me the famous cannot fetch URL error.</p>
<p>Failed to fetch URL <a href="https://dl-ssl.google.com/android/repository/repository.xml" rel="nofollow">https://dl-ssl.google.com/android/repository/repository.xml</a>, reason: Permission denied: connect</p>
<p>I tried the force http option and also manually adding a http:// version of the above url. It does not work at all. I am working on a windows 7 64 bit pc. Any help would be appreciated.
Ramesh</p>
| android | [4] |
1,845,221 | 1,845,222 | How to copy file from app package path to sdcard? | <p>i want copy pdf file from application path(/data/data/package name) to sdcard.for that i have prepared following ,</p>
<pre><code>try {
source = new FileInputStream(sourceFile).getChannel();
destination = new FileOutputStream(destFile).getChannel();
destination.transferFrom(source, 0, source.size());
}
finally {
if(source != null) {
source.close();
}
if(destination != null) {
destination.close();
}
}
</code></pre>
<p>it is not working .PLease help.</p>
| android | [4] |
445,275 | 445,276 | barebone asp.net | <p>Is it possible to do Web form without using server control or set runat attribute on html control? How do you call the code behind function?</p>
| asp.net | [9] |
2,537,403 | 2,537,404 | function in python | <p>In a function, I need to perform some logic that requires me to call a funtion inside a function. what i did with this , like :</p>
<pre><code>def dfs(problem):
stack.push(bache)
search(root)
while stack.isEmpty() != 0:
def search(vertex):
closed.add(vertex)
for index in sars:
stack.push(index)
return stack
</code></pre>
<p>In the function, dfs, i am using search(root), is this is the correct way to do it?</p>
<p>I am getting an error: <strong>local variable 'search' referenced before assignment</strong></p>
| python | [7] |
3,918,316 | 3,918,317 | Java "\u0001something" doesn't return expected results | <p>I'm trying to put together a string that starts with the ascii "Start of Header" character (0x01).
I did this on my home computer simple enough with:</p>
<pre><code>String out = "\u0001this";
System.out.println(out);
</code></pre>
<p>prints a square to the terminal.. Copy and paste to hex editor and I have my 0x01;</p>
<p>Now at work.. I do the same thing but anything below 0x20 just prints 0x00 to the terminal.
As soon as I do "\u0020" I get a space printed to output..
Any idea whats going on.</p>
| java | [1] |
641,842 | 641,843 | Deleting an array of classes | <p>Would the following properly destroy everything (all appropriate destructors called and all memory freed)?</p>
<pre><code>Class* var[50];
var[0] = new SubClass();
delete[] *var;
</code></pre>
<p>Similar to</p>
<pre><code>Class** var = new Class*[50];
var[0] = new SubClass();
delete[] var;
</code></pre>
<p>Or should I be iterating over the array and delete each individual object (which is what I thought delete[] did).</p>
| c++ | [6] |
1,824,465 | 1,824,466 | ContentURI cannot be resolved to a type | <p>I am trying to follow an eclipse and android tutorial from ibm. The source code from the tutorial is giving me an error that says ContentURI cannot be resolved to a type..</p>
<p>here is the source code line...</p>
<p>ContentURI theContact = new ContentURI(android.provider.Contacts.ContactMethods.CONTENT_URI.toURI());</p>
<p>eclipse wanted me to fix it by either creating a class an interface or changing it to ContentUris </p>
<p>I tried the last one w/no luck so was looking for some advice.</p>
| android | [4] |
1,455,006 | 1,455,007 | How to lock and unlock a folder in android | <p>I am just starting with Android. And my boss told me to find some good way to lock/unlock a folder with password in Android. Does anybody know how to implement this.
Any help will be greatly appreciated.</p>
<p>Thank you</p>
| android | [4] |
5,393,366 | 5,393,367 | convert string to preexisting variable names | <p>How do i convert a string to the variable name in python?</p>
<p>e.g. </p>
<p>if the program contains a object named, self.post,that contains a variable named, i want to do something like,</p>
<pre><code>somefunction("self.post.id") = |Value of self.post.id|
</code></pre>
| python | [7] |
552,765 | 552,766 | How to calculate the total value of input boxes using jquery | <p>I have a list of input boxes, now I need to calculate the total of all values entered in input boxes with the following naming convention pre[0],pre[1],pre[2] etc.</p>
<p>Is this possible with Jquery and how?</p>
| jquery | [5] |
4,693,867 | 4,693,868 | Array inside a Struct in C++ | <p>I've been trying to figure out how to add an array into a struct... a struct of ints for example would look like this:</p>
<pre><code>struct test{
int a;
int b;
int c;
} test = {0,1,2};
</code></pre>
<p>but if I want to have an array for example:</p>
<pre><code>struct test{
int a;
int b;
int c;
int deck[52];
} test;
</code></pre>
<p>is this doable? the initialization of the deck (of cards) happens in a different function. when I do it like this, I don't get an error in the <code>struct</code> but I get it when I try to use it... for example if I do this <code>test.deck[i] = 1;</code> it gives me this error:</p>
<pre><code>Error C2143 Syntax Error missing ';' before '.'
</code></pre>
<p>if I were to use <code>a</code> , I could write <code>test.a = 1;</code></p>
<p>Could anyone write a simple struct where a variable in it is an array and then just use it for a simple command?</p>
| c++ | [6] |
1,508,242 | 1,508,243 | jvisualvm Does not list Jboss 5.1.0GA when running as service | <p>jvisualvm does not monitor the jboss when I run it as service? what changes i need to make so that jvisualvm start monitoring the java application (specifically jboss) when running as window service.
Moreover, When I run the jboss through command prompt (run.bat) jvisualvm start monitoring it.
Please suggest..</p>
| java | [1] |
5,160,477 | 5,160,478 | MediaPlayer Android Increment on button click | <p>I have created a button and need to increment mp3 tunes on click. </p>
<p>So far I have the mp3 playing like: </p>
<pre><code> final MediaPlayer sentence = MediaPlayer.create(Options.this, R.raw.indra);
</code></pre>
<p>and then calling sentence.start(); in onclick. </p>
<p>Is it possible to increment more tunes in onclick?</p>
<p>Thanks. </p>
| android | [4] |
5,682,107 | 5,682,108 | Android Application Dashboard with pin/password to exit | <p>Here I'm trying to implement an Android Application Dashboard where user press the exit button to be asked for a pin or a password to exit the application, or go to the home page. </p>
| android | [4] |
4,602,823 | 4,602,824 | android app keywords | <p>I've already added my app to google play, I used the android develop console and everything is right.</p>
<p>But right now you only can access to my app using the name, but I would like to add some keywords, and my app apears easily.</p>
<p>how can I do that?</p>
<p>Thank you in advance</p>
| android | [4] |
1,778,477 | 1,778,478 | is there any DC-Hull code in java | <p>Hi
I know its algorithm ,is there any code in java for it?there is a code for quick hull in java but there is not any code for this one ,is there?
thanks</p>
| java | [1] |
3,400,871 | 3,400,872 | Get time difference between two specific time zones in iPhone? | <p>e.g. I want the time difference between <strong>asia/kolkata</strong> time and <strong>asia/dubai</strong>.</p>
| iphone | [8] |
1,933,992 | 1,933,993 | displays float into Text View | <p>I want to display a float into Text View</p>
| android | [4] |
3,767,770 | 3,767,771 | Want to implement boost like signal template which takes function type as a parameter | <p>Sorry if the question is very basis. I am unable to find somehow to see one simple example code for template implementation as <strong>Boost.signals</strong>
like:</p>
<pre><code> boost::signal<void ()> sig;
</code></pre>
<p>What i know is the below:</p>
<pre><code> template <class T>
TemplateClass {
T t;
};
TemplateClass<int> a;
</code></pre>
<p>Kindly provide few pointers on it?</p>
| c++ | [6] |
4,770,705 | 4,770,706 | by using UIImagePickerController, i can crop the picture and also save it in iphone directory? | <p>Can any body tell me about how UIIMAGEPICKER can crop picture, and save this crop picture in iphone directory in order to save path of the image in databse and re-use it?</p>
| iphone | [8] |
5,056,972 | 5,056,973 | How to get IPV6 address from hostname | <p>Can anyone please suggest me how to get IPV6 address fro hostname which contains both IPV4 and IPV6 addresses.</p>
<p>I tried to get it using <code>java.net.InetAddress.getHostAddress</code>, but it is only giving me the ipv4.</p>
| java | [1] |
726,610 | 726,611 | sync android with google biz apps calender | <p>A buddy of mine got a new android phone (i use iphone so im a little new to it) but he can sync his gmail calender but not his google biz apps calender that we use for works.</p>
<p>is there any trick to getting it to sync with his phone so he can make edits and have them reflected in his "work" calender</p>
| android | [4] |
4,499,642 | 4,499,643 | Need help for jQuery | <pre><code><body>
<button> Change </button>
<div id="mydiv" style="margin:25% 0% 0% 37%">
<a href="#" onclick="alert('buhaha');" style="width:50px; height:50px; background-color:#99CC99; padding:10px; margin:5px">One</a>
<a href="#" onclick="alert('buhaha');" style="width:50px; height:50px; background-color: #FF9900;padding:10px; margin:5px"> Two</a>
</div>
</body>
</code></pre>
<p>When I click my "Change" button, onclick event must disable. After I click "Change" button again, onclick event must enable. How do I do these two actions from one button?</p>
<p>I used jquery-1.4.1.min.js. Answer code must work with jquery-1.4.1.min.js file.</p>
| jquery | [5] |
5,388,011 | 5,388,012 | How do you find out how much data has been transferred over Wifi, 3G or EDGE on Android? | <p>I'm trying to write an Android widget that shows how much data has been transferred over 3G/WIFI/EDGE but I can't seem to find the API call, even though other widgets do this. Does anyone know what the API calls are to get the data usage?</p>
| android | [4] |
5,541,949 | 5,541,950 | How to validate whether the given email address belongs to a corporate company? | <p>How can I validate the email address entered belongs to a corporate company when the user enters his/her mail address.</p>
<p>The requirement is not to accept the public emails like gmail or yahoo etc, and to only accept the email id of a CORPORATE(xyx@companyname.com) </p>
| java | [1] |
2,643,502 | 2,643,503 | RESTful Client API in C++ | <p>Is there any open source library available that implements RESTful Client(library for interpreting HTTP requests as REST service calls) in C++ ?</p>
<p>My requirement is to connect to Amazon Web Services and get the list of EC2 instances(and their details) available for given user account in C++. </p>
<p>I know Amazon provides API's for this in Java, C#. But I want in C++. If Amazon provides in C++ too, that would be fine, Please guide me.</p>
<p>Your help is much appreciated.</p>
<p>Regards</p>
<p>Bharatha Selvan.</p>
| c++ | [6] |
3,748,176 | 3,748,177 | How can I get pixel for rescale bitmap? | <p>I want to rescale bitmap size that suitable to size of ImageView which is place to hold this bitmap but I don't know what pixel that I should fill in method Bitmap.createScaledBitmap.</p>
<p>For example my ImageView is set width is fill parent and height is 250dp.</p>
<p>How can I calculate pixels from this size ?</p>
<p>Thanks.</p>
| android | [4] |
1,559,121 | 1,559,122 | Design a Javascript object to output to console.log as a string as per new Date() | <p>How is it that <code>console.log(new Date());</code> shows a string at the console?</p>
<p>How do I imitate that behaviour in my objects?</p>
| javascript | [3] |
1,642,167 | 1,642,168 | How do I display consecutive AlertDialogs in Android? | <p>I'm trying to port one of my iPhone apps over to the Android. It was all going along swimmingly until I came to AlertDialogs. In the iPhone app, sometimes there will be more than one alert to pass to the user. When this happens, the first alert dialog will come up, and when they click it away the next one will come up.
I can't seem to get more than one dialog box to come up like that in Android. Is it possible to display back to back AlertDialogs where a second one pops up as soon as the first is finished? </p>
| android | [4] |
3,663,696 | 3,663,697 | How can you remove the last character from a wchar_t*? | <p>How can I delete the last character of a wchar_t* and resize accordingly? For example, having the string "test" and bringing it down to "tes"</p>
| c++ | [6] |
834,215 | 834,216 | how to change values between loop | <p>I extracted the values of the array on the foreach loop, but I want when it retrieves a certain <code>'br_title'</code> changed href link to <code><a href="http://noorresults.moe.sa</code>..how to do that with simple code?..</p>
<pre><code> <ul class="riMenu">
<?php foreach ($last_branches as $last) { ?>
<li><a href="<?= base_url(); ?>branches/show/<?php if (!empty($last['br_id'])) echo $last['br_id'] ?>"> <?php if (!empty($last['br_title'])) echo $last['br_title'] ?></a></li>
<?php }; ?>
</ul>
</div>
</div><!-- Menu E
</code></pre>
| php | [2] |
167,081 | 167,082 | How to ensure video is played from website, not a cached version | <p>I have used the below code(read a video from a website and play it on a panel) its working, but this video is stored on my computer.</p>
<pre><code>using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.DirectX.AudioVideoPlayback;
namespace webplayer
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
try
{
int width = panel1.Width;
int height = panel1.Height;
System.Uri u = new Uri("http://cassfordinfo.com/Testmovie.avi"); Video video;
video = Video.FromUrl(u);
video.Owner = panel1;
video.Stop();
video.Play();
// resize the video to the size original size of the panel
panel1.Size = new Size(width, height);
}catch(Exception gh)
{
MessageBox.Show(gh.ToString());
}
}
}
}
</code></pre>
<p>Once I run the exe it will read from the website but I have unplugged the internet connection and run it. It runs the same video without a connection. I have restarted my computer and again if I run the exe file I can view the video.</p>
<p>Whenever I need to run this program it should read it from my website not from temporary file. How can I achieve this?</p>
| c# | [0] |
5,219,703 | 5,219,704 | In jquery animate, how do I use a custom object instead of a div? | <p>My situation started like this: I wanted to animate the background image of a div, but it seems, with jquery I can't retrieve the individual positions of the background images(background-position). So I thought why not create a object and animate it's values then just put this values in the css, but i can't figure out how to quite do it yet. Here's what I tried.</p>
<pre><code>var obj={t:0};
$("#wrapper").animate({
obj:100 //I tried obj.t & t as well
},1000,'linear',function(){},function(){
$("#wrapper").css({
'background-position':obj.t+"% 0%"
});
});
</code></pre>
<p>Also another question I need to ask is, if the picture is really big, I mean about 4000x4000px, would it be better to set it as a background image and change the background position, or move around the div itself?</p>
| jquery | [5] |
1,285,679 | 1,285,680 | fstream doesn't read the input | <p>Somehow fstream doesn't read my input from a file.</p>
<pre><code>int main()
{
ifstream fin("duomenys.txt");
ofstream fout("rezultatas.txt");
int n = 0;
fin >> n;
cout << n << endl;
fout.close();
fin.close();
return 0;
}
</code></pre>
<p>duomenys.txt</p>
<blockquote>
<p>24</p>
</blockquote>
<p>The output here is 0. I can't figure out why this doesn't work..</p>
| c++ | [6] |
266,375 | 266,376 | Delete a dropped item by delete key press | <p>I have created a page droppable and am trying to delete the dragged elements. But I have a problem that I don't know how delete the selected elements from the keyboard delete key.
here is my code:</p>
<pre><code>$canvasElement.click(function() {
jQuery('.canvas-element').removeClass('selectedItem');
jQuery($canvasElement).addClass('selectedItem');
jQuery('#button').removeClass('delete');
jQuery('#button').addClass('showButton');
})
jQuery(".deleteButton").click(function () {
jQuery(".selectedItem").remove();
jQuery('#button').removeClass('showButton');
jQuery('#button').addClass('delete');
});
</code></pre>
<p>HTML:</p>
<pre><code><li>
<p id="button" class="delete"><button class="deleteButton">Delete</button></p>
</li>
</code></pre>
<p>CSS:</p>
<pre class="lang-css prettyprint-override"><code>.selectedItem {
border: 2px solid #5C3B84!important;
}
.showButton {
display:block!important;
}
.delete {
display:none;
}
</code></pre>
<p>But I have to delete the element from the keyboard delete key.</p>
| jquery | [5] |
843,800 | 843,801 | Subtotaling in jquery function (.click issues?) | <p>This function only subtotals my last value clicked when I use the .hasVal class with a radio button. Any ideas? </p>
<p>Update: Here's the jsfiddle link: <a href="http://jsfiddle.net/SUKsM/4/" rel="nofollow">http://jsfiddle.net/SUKsM/4/</a></p>
<p>Essentially my HTML form has a fieldset with values:</p>
<pre><code><fieldset id="breadOptions" class="hidden">
<legend>Select one</legend>
<input type="radio" name="breadType" id="breadWhite" class="hasVal" value=".5,260" /> White (260 calories)<br />
<input type="radio" name="breadType" id="breadWheat" class="hasVal" value=".5,360" /> Wheat (360 calories)<br />
</fieldset>
</code></pre>
<p>An here's the script:</p>
<pre><code>$(function () {
var basePrice = 3;
var totalCal = 0;
var taxRate = .07;
$('#total').text(basePrice.toFixed(2));
$('#sub').text(basePrice.toFixed(2));
$('#cal').text(totalCal);
$('#tax').text((taxRate * 100).toFixed(2));
$('.hasVal').click(function () {
var price = 0;
var totalCal = 0;
var tar = event.currentTarget;
var optArr = tar.value.split(','); //cost,calorie
price += parseFloat(optArr[0]);
totalCal += parseInt(optArr[1]);
$(':checked').each(function () {
totalPrice = (price + basePrice);
});
$('#sub').text(totalPrice.toFixed(2));
$('#cal').text(totalCal);
totalTax = totalPrice + (totalPrice * taxRate);
$('#total').text(totalTax.toFixed(2));
});
});
</code></pre>
| jquery | [5] |
5,198,628 | 5,198,629 | Using Datapager in case of paged results | <p>Before I explain the problem, let me set the context. I have a stored procedure which returns me paged results. So if I mentioned the page number as 1, I get the first 10 records and if the page number is 2 I get the next 10 set of records and so on.</p>
<p>Now in my Asp.Net page I need to show 10 items at a time and I want the pagination to be in numbered style. The same like Google pagination.</p>
<p>The problem now is that, since I get only 10 records at a time from the DB, the numbers don't show up. I've come across a solution at: <a href="http://stackoverflow.com/questions/2447130/how-to-use-datapager-with-database-paged">How to use DataPager with Database Paged</a>, however since my total number of records can run into 100's or 1000's, running the loop for so long is again a performance issue.</p>
<p>It would be great if you can let me know how this issue can be fixed.</p>
<p>Thanks in advance.</p>
| asp.net | [9] |
2,096,963 | 2,096,964 | Redirect page when Javascript is disabled | <p>I need to redirect to another page when the client script is disabled on the browser. Can anyone please help?</p>
<p>Thanks</p>
| asp.net | [9] |
5,277,830 | 5,277,831 | how to auto enable bluetooth base on the android simple code? | <p>This is the code that I'm trying to use. Could you please tell me what the problem is with it??</p>
<p>My code:</p>
<pre><code> public void onStart() {
super.onStart();
if(D) Log.e(TAG, "++ ON START ++");
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (!mBluetoothAdapter.isEnabled()) {
}else{
mBluetoothAdapter.enable();
} ;
} {
if (mChatService == null) setupChat();
}
</code></pre>
| android | [4] |
616,316 | 616,317 | How do I delete an item from my custom base adapter? | <p>I am extending BaseAdapter to make a custom listview row. I have context menu that opens everytime a user holds on the row and prompts if he wants to delete it. However how do I remove the row? The hashmap is only test data.</p>
<pre><code>private MyListAdapter myListAdapter;
private ArrayList<HashMap<String, String>> items;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
items = new ArrayList<HashMap<String,String>>();
HashMap<String, String> map1 = new HashMap<String, String>();
map1.put("date", "10/09/2011");
map1.put("distance", "309 km");
map1.put("duration", "1t 45min");
items.add(map1);
myListAdapter = new MyListAdapter(this, items);
setListAdapter(myListAdapter);
getListView().setOnCreateContextMenuListener(this);
}
private class MyListAdapter extends BaseAdapter {
private Context context;
private ArrayList<HashMap<String, String>> items;
public MyListAdapter(Context context, ArrayList<HashMap<String, String>> items) {
this.context = context;
this.items = items;
}
@Override
public int getCount() {
return items.size();
}
@Override
public Object getItem(int position) {
return items.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = convertView;
if (view == null) {
LayoutInflater layoutInflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = layoutInflater.inflate(R.layout.row_log, null);
}
TextView rowLogOverview = (TextView) view.findViewById(R.id.rowLogOverview);
HashMap<String, String> item = items.get(position);
rowLogOverview.setText(item.get("date"));
return view;
}
}
</code></pre>
| android | [4] |
5,460,345 | 5,460,346 | Why does this not work? javascript | <p>I have this in Javascript:</p>
<pre><code>var inx=[2,3,4,5];
var valarray=[];
for (i=0; i<inx.length; i++) {
valarray[i]==inx[i];
}
for (i=0; i<inx.length; i++) {
var posi=inx.indexOf(3);
var valy=valarray[posi-1]+1;
valarray[i]=valy;
}
alert(valarray);
</code></pre>
<p>valarray keeps returning nan,nan,nan,nan instead of numbers...</p>
<p>How can I fix this?</p>
| javascript | [3] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.