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 |
|---|---|---|---|---|---|
5,522,519 | 5,522,520 | android: got error on trying work with spinner | <p>i try to work with spinner on dialog</p>
<pre><code>public class data extends Dialog {
.
.
.
String[] iType = { "AA","BB","CC" };
public Spinner TypeSelect;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.data);
setTitle("My Heder");
TypeSelect = (Spinner) findViewById(R.id.spinner2);
ArrayAdapter<String> TypeAdapter = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item,iType);
TypeSelect.setAdapter(TypeAdapter);
</code></pre>
<p>but i got error on this line:</p>
<pre><code> ArrayAdapter<String> TypeAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item,iType);
</code></pre>
<p>the error:</p>
<pre><code>The constructor ArrayAdapter<String>(data, int, String[]) is undefined
</code></pre>
<p>what can be the problem ?</p>
| android | [4] |
5,309,430 | 5,309,431 | jquery: a function after some time interval only if specific condition does not occur | <p>I have a jquery function!</p>
<p>When the user clicks on a div, that function is executed! I dont want that function to execute again if the user clicks on the div within 5 seconds. </p>
<p>What could be the solution for this?</p>
<p>Help appreciated.
Thanks!</p>
| jquery | [5] |
2,236,156 | 2,236,157 | Convert text url into clickable links | <p>i have been running around in circles with this situation, i already tried all the answers that i found in stackoverflow and tried to use linkify aswell but with no success, can't make it work and i would rather NOT have to use any Javascript libraries, jquery, mootools etc...</p>
<p>So here is what i am trying to achieve;</p>
<p>I have a comment section for each of my posts and i want that each time a user posts a url in his comment:</p>
<pre><code><div id="container">
Nice, here is the respective link that you were asking for: www.linkforanywebsite.com
</div>
</code></pre>
<p>turns into this:</p>
<pre><code><div id="container">
Nice, here is the respective link that you were asking for: <a href="www.linkforanywebsite.com">www.linkforanywebsite.com</a>
</div>
</code></pre>
<p>Any guide/jsfiddle working example are very appreciated</p>
<p>Thank you for your time and help!</p>
| javascript | [3] |
5,013,785 | 5,013,786 | Prevent onCreateDialog being called when process is killed then relaunched | <p>I have an Activity with ProgressDialog being updated by an AsyncTask. I am using onCreateDialog to setup the dialog. The AsyncTask is writing to the SDCard. During normal scenarious (rotation, going to background, etc.) I have no issues.</p>
<p>The problem is that the dialog gets recreated if the process gets killed. Thus, I end up with a "newly" opened activity and a dialog that is not supposed to be shown at all because there is no AsyncTask set up to update it.</p>
<p>For example in case when SD card gets ejecter then the Reaper comes and kills the process (no onDestroy, noPause, noResume has been called by the framework). When, however, the application is resumed (for example from the recently used applications) there is no clue that there is no AsyncTask and I am forced to show the dialog. I cannot return null in onCreateDialog, because the app will crash.</p>
<p>How can I prevent a dialog to be recreated after the process is killed?</p>
<p>Example:</p>
<pre>
- Activity gets shown
- onCreateDialog/onPrepareDialog show a progress dialog
- AsyncTask gets started exporting to SD card
=> SD card gets unmounted
- Process is killed
- User selects the application from task switched
- Activity gets created as new
=> Android calls onCreateDialog/onPrepareDialog with the previously shown dialog ID
</pre>
<p>By the time the activity is recreated as new there is no AsyncTask, there is even no SD card. Still, Android insist that I show a dialog.</p>
<p>How can I prevent onCreate/PrepareDialog methods to be called during the recreate? Or the only choice is to bring up an error dialog instead.</p>
| android | [4] |
2,146,451 | 2,146,452 | How do I assign a char pointer with cin? | <p>So basically when I try to do this</p>
<pre><code>char* inputFileName;
cout<< "Filename: "; cin>>*inputFileName;
</code></pre>
<p>it lets me input the filename but when I press enter I get an unhandled exception error. Any ideas? </p>
<p>edit also if I try </p>
<pre><code>char* inputFileName;
cout<< "Filename: "; cin>>inputFileName;
</code></pre>
<p>i get a debug asseration failed when i try to run it.</p>
| c++ | [6] |
2,657,506 | 2,657,507 | How to loop a key/value object in javascript | <p>var user = {};</p>
<p>now I want to create a <code>setUsers</code> method that takes a key/value pair object and initializes the <code>user</code> variable.</p>
<pre><code>setUsers = function(data) {
// loop and init user
}
</code></pre>
<p>where data is like:</p>
<pre><code>234: "john", 23421: "smith", ....
</code></pre>
| javascript | [3] |
3,545,539 | 3,545,540 | Can this be written as a python reduce function? | <p>Can you make this more pythonic by using the map and/or reduce functions? it just sums the products of every consecutive pair of numbers.</p>
<pre><code>topo = (14,10,6,7,23,6)
result = 0
for i in range(len(topo)-1):
result += topo[i]*topo[i+1]
</code></pre>
| python | [7] |
3,142,169 | 3,142,170 | Why does the following code always go inside the if block? | <p>Could anyone please tell me how I could resolve this issue ?</p>
<pre><code>int a = 3;
if(a != 1 || a!=2 || a!=3 )
{
//Comes in here ? Why ? When a=3 ?
}
</code></pre>
| c# | [0] |
41,979 | 41,980 | How to implement a "click-anywhere-to-continue" event on my android activity? | <p>Is this possible?</p>
<p>I would display an activity that shows a welcome page, and that welcome page doesn't have any Views where I can attach an <code>onClickListener</code>.</p>
<p>EDIT: ok, the reason for this welcome kind of welcome page, is that this application is used to take something like a survey... after a customer is done with the survey, the app returns to this welcome page so another person can take the survey again.</p>
| android | [4] |
1,358,472 | 1,358,473 | jQuery logic not working properly | <p>Found a really nice code for Accordion nav and am trying implement on our website, but due to certain restrictions I cannot change the HTML codes or new version on jQuery. The example is based on div/class names but we are using ul > li listing. I am not really getting the child parent relationship. Any help is appreciated. Thanks</p>
<p>The code is set up on JSfiddle <a href="http://jsfiddle.net/rexonms/kn3t6/1/" rel="nofollow">http://jsfiddle.net/rexonms/kn3t6/1/</a></p>
| jquery | [5] |
2,141,045 | 2,141,046 | what happens when an web server control on an .aspx file is redefined in the code behind? | <pre><code>Mark Up:
<asp:Label ID="Status" runat="server" Visible="false" />
Code Behind:
public partial class Files : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Status;
protected void Page_Load(object sender, EventArgs e)
{
Status.
}
}
</code></pre>
<p>Now whenever I tried to use the label <em>Status</em> in the Page_Load handler I was warned as <em>this member is defined more than once</em>. My question is why I was not warned while redifining it as an instance member ? and actually is it possible to proceed with the control ?</p>
| asp.net | [9] |
1,961,352 | 1,961,353 | Android: How to start an Activity in the background? | <p>Is it possible to start an <code>Activity</code> in the background? I need such an <code>Activity</code> that can operate in the background and spawn other Activities as needed in response to user commands issued to my Home Screen widget.</p>
| android | [4] |
561,411 | 561,412 | Aspx controls validate TextBox based on DropDownList selection | <p>I need to validate TextBox based on Value selected in DropDownList controls. I have asp:TextBox and asp:DropDownList controls.</p>
<p>If user selects Yes option from the first dropdown he must type value in text box. How can I validate second box? Thanks for help.</p>
| asp.net | [9] |
5,691,285 | 5,691,286 | Animation anim_right.xml | <p>What should i change to get anim_right.xml from the anim_left.xml. The opposite of the code below and someone can tell me good tutorial to learn animation in android please ?</p>
<p>ani_left.xml</p>
<p>
</p>
<pre><code><translate
android:duration="2000"
android:fromXDelta="50%p"
android:interpolator="@android:anim/linear_interpolator"
android:toXDelta="0" />
<alpha
android:duration="1000"
android:fromAlpha="0.0"
android:interpolator="@android:anim/linear_interpolator"
android:toAlpha="1.0" />
</code></pre>
<p></p>
| android | [4] |
4,568,406 | 4,568,407 | Songs are not playing due to Special character in url of the song | <p>I am working in android. I am designing a music player which is playing songs from the server.</p>
<p>When the URL does not has any special character, the song plays well. But when there
are some special characters in the URL then the song does not play. For example, the following url is not working:</p>
<pre><code>http://192.168.1.214/MusicApplication/Songs/desert rose sting & enigma.mp3
</code></pre>
<p>i am using this code to play my song.</p>
<pre><code>mediaPlayer.setDataSource(songURL);
mediaPlayer.prepare();
mediaPlayer.start();
</code></pre>
<p>i have solved my problem related to the space. please tell me the solution for '&' symbol.</p>
| android | [4] |
5,813,710 | 5,813,711 | Placing controls inside a panel in C# | <pre><code>private void newThumbNail(int docType, string fileName)
{
thmbNail[thmbNailCnt] = new GroupBox();
thmbNail[thmbNailCnt].Parent = panel1;
thmbNail[thmbNailCnt].Visible = true;
thmbNail[thmbNailCnt].Location = new Point(2, 5);
thmbNail[thmbNailCnt].Size = new Size(222, 50);
picBox[thmbNailCnt] = new PictureBox();
picBox[thmbNailCnt].Parent = thmbNail[thmbNailCnt];
picBox[thmbNailCnt].Visible = true;
picBox[thmbNailCnt].Location = new Point(6, 13);
picBox[thmbNailCnt].Size = new Size(31, 31);
//picBox[thmbNailCnt].Image = new Bitmap("images/excel.png");
texBox[thmbNailCnt] = new TextBox();
texBox[thmbNailCnt].Parent = thmbNail[thmbNailCnt];
texBox[thmbNailCnt].Visible = true;
texBox[thmbNailCnt].Location = new Point(53, 24);
texBox[thmbNailCnt].Size = new Size(163, 20);
texBox[thmbNailCnt].Text = fileName;
texBox[thmbNailCnt].Enabled = false;
Controls.Add(thmbNail[thmbNailCnt]);
Controls.Add(picBox[thmbNailCnt]);
Controls.Add(texBox[thmbNailCnt]);
}
</code></pre>
<p>this is a function that dynamically adds a groupBox with some controls int it inside a panel. Unfortunately it does not appears inside the panel. The panel was created before hand using the c# design tools. It is placed directly on top of the windows form at 15,52 having a size of 279,489. Help please.</p>
| c# | [0] |
3,141,407 | 3,141,408 | When I hover over my div I don't want it effecting all the divs with the same class? | <p>when I hover over my div the pop up fades in like it should but it affects all the other divs with the same class as well. I just want it to effect the div that's being hovered on. Any help would be appreciated. Thank you! </p>
<pre><code>$(document).ready(function() {
$(".project").hover(function() {
$('.caption').fadeToggle(1000);
});
});
</code></pre>
| jquery | [5] |
235,444 | 235,445 | Android binder to service VS intent service | <p>In early android ~ version 1.5, we need to bind to service like this:</p>
<p><a href="http://developer.android.com/guide/topics/fundamentals/services.html" rel="nofollow">http://developer.android.com/guide/topics/fundamentals/services.html</a></p>
<p>But later on, android has new api called 'Intent Service'. And I don't see people talk about using binding to service as often.</p>
<p>So is it a recommend practice to use Intent service instead of binding to service?</p>
<p>Thanks you.</p>
| android | [4] |
3,388,819 | 3,388,820 | Sending email in Android | <p>Is there a way to send an email without opening an email client and without using any external libraries such as JavaMail API in Android?</p>
| android | [4] |
241,703 | 241,704 | Transfering data between forms | <p>I've got two forms. In the first, I have a textbox and a button, and in the other one I have a label. When you enter text in the textbox, and press button, a new form is opened, and the label has the same text as the textbox in the previous form. How do I do that with get/set?
I made a class "Globals", and in it get/set:</p>
<pre><code>class Globals
{
public string imena = "";
public string ime
{
get
{
return imena;
}
set
{
imena = value;
}
}
}
</code></pre>
<p>and in the first form</p>
<pre><code>private void btnplay_Click(object sender, EventArgs e)
{
//this.Hide();
Game igra = new Game();
igra.Show();
Globals promenljive = new Globals();
promenljive.ime = tbpl1.Text;
}
</code></pre>
<p>and in the second one </p>
<pre><code>private void Game_Load(object sender, EventArgs e)
{
Globals promenljive = new Globals();
lblime1.Text = promenljive.ime;
}
</code></pre>
<p>But it doesn't work? What did I do wrong??
Thank you</p>
| c# | [0] |
2,619,013 | 2,619,014 | Expire Webpage on clicking browser back button | <p>in my project say I have three pages as below</p>
<blockquote>
<p>Default.aspx -> abc.aspx -> process.aspx(final page).</p>
</blockquote>
<p>I have Back and Next button for navigating within site. What I want is, if someone is in process.aspx and clicks on browser back button he should get <code>page expired</code> and then he click browser next button he gets back to the process.aspx page.</p>
<p>So, in abc.aspx page <code>Page_Load</code> event I have this line of code</p>
<pre><code>Response.Cache.SetCacheability(System.Web.HttpCacheability.nocache);
</code></pre>
<p>So, the first part works fine and if users click browser back button from process.aspx he gets "Your web page has expired" but the problem is ... if he click on browser next button
instead of getting the process.aspx page ... it's expiring the page ... I mean process.aspx as well getting expired.</p>
<p>Can you please help me with this. I want the process.aspx page back from abc.aspx on click of browser next button instead of expiring it.</p>
<p>Thanks.</p>
| asp.net | [9] |
2,537,072 | 2,537,073 | How to apply jquery datepicker on duplicate id's in same form? | <p>I have a complex code where I need to clone same tables on dynamic call and have to apply date picker on them.The problem is that there will be duplicate id's on which I am willing to apply date picker.So, when I apply date picker,it comes and I can select only current date using Enter key.But,when I use mouse it throws error like "TypeError: f is undefined" .Please provide the solution.Thank you</p>
| jquery | [5] |
4,985,464 | 4,985,465 | Creating a Random number | <p>Is it possible to create a random number from a selection of numbers in c#. </p>
<p>For example I have an array of numbers from 1-90 and once a number has been called a propery of that number changes. I therefore only want to generate the numbers where that property has not changed.
This will therefore only randomly call the numbers between 1 and 90 one. </p>
<p>I have done this using a loop but just wanted a quiker and cleaner method if possible. </p>
<p>My current code is:</p>
<pre><code> public object GenerateNumber()
{
bool alreadyCalled = false;
while (!alreadyCalled)
{
Random randomNumber = new Random(System.DateTime.Now.Millisecond);
int RandomNumberCalled = randomNumber.Next(1, 91);
if (Numbers.ToList().Find(x => x.Number == RandomNumberCalled).IsCalled != null)
{
// change number to is called and do other things.
}
}
return false;
}
</code></pre>
| c# | [0] |
3,624,923 | 3,624,924 | Java Script: onsubmit="check_rfields();" in form tag of html. But getting failed in validation | <p>onsubmit="check_rfields();" in form tag of html. But getting failed in validation.</p>
<pre class="lang-js prettyprint-override"><code>function check_rfields() {
var name = document.getElementById("id_rname").value;
var email = document.getElementById("id_remail").value;
var cemail = document.getElementById("id_rcemail").value;
var password = document.getElementById("id_rpassword").value;
var cpassword = document.getElementById("id_rcpassword").value;
if(name=='' || name==0
&& email=='' || email==0
&& cemail=='' || cemail ==0
&& password=='' || password==0
&& cpassword=='' || cpassword==0 ) {
document.getElementById("onsubmitErr").innerHTML
= "All fields arerequired";
return false;
}
return true;
}
</code></pre>
| javascript | [3] |
4,567,323 | 4,567,324 | Check if checkbox or radio button inside div is seleted | <p>Using jQuery I want to check if checkboxes or radio button inside a div tag is selected and get the value of selected checkbox and radio buttons.</p>
<p>For Example:</p>
<pre><code> <div>
Question
<div>
What is your name?
</div>
<div>
<input type="radio" name="r1" checked/>abc<br/>
<input type="radio" name="r1"/>pqr<br/>
<input type="radio" name="r1"/>lmn<br/>
</div>
</div>
<div style="visibility: hidden">
Question
<div>
What is your company name?
</div>
<div>
<input type="checkbox" name="c1" checked/>comp1<br/>
<input type="checkbox" name="c1"/>Comp2<br/>
<input type="checkbox" name="c1"/>Comp3<br/>
</div>
</div>
</code></pre>
<p>on button click I want to show question and in front of that the answer of that question. Like as follows</p>
<p>What is your name = abc</p>
<p>What is your company name = comp1, comp2</p>
<p>Thanks.</p>
| jquery | [5] |
2,207,326 | 2,207,327 | unable to get the value of href from a tag using jquery | <p>I am trying fetch the <code>href</code> value in an <code><a></code> with a class of "title". The result here should be the path <code>"../../images/packages2/agra1.jpg"</code> but somehow it's not working. Here is my HTML:</p>
<pre><code> <div id="packgeImages">
<ul>
<li><a class="title" href="../../images/packages2/agra1.jpg" rel="shadowbox" title=""><img src="../../images/packages2/agra1thumb.jpg" alt="thumb1" /></a></li>
</ul>
</div>
</code></pre>
<p>and here is my JavaScript:</p>
<pre><code> var $title = $('.title').attr("href");
</code></pre>
<p>Then I am using alert to check the results.. but somehow it seems blank.</p>
<p>Can anybody tell me what I'm doing wrong?</p>
| jquery | [5] |
4,838,577 | 4,838,578 | iPhone SDK UISearchBar help | <p>i try to create an UISearchBar for my app base on Beginning
iPhone 3 Development book (chapter 8) , and i have 2 problem :</p>
<p>1- My Plist file is simple i mean without any <code><KEY></code> , and when i add the plist file into project and change the sortednames name to my plist file i have nothing in table !!!
i remove the table sections and index but doesn't change anything !! here is the code :</p>
<p>2-if iam going to search the Persian or arabic number , the result is nothing !!!</p>
<p>i remove these codes :</p>
<pre><code>- (NSString *)tableView:(UITableView *)tableView
titleForHeaderInSection:(NSInteger)section
{
if ([keys count] == 0)
return nil;
NSString *key = [keys objectAtIndex:section];
if (key == UITableViewIndexSearch)
return nil;
return key;
}
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
{
if (isSearching)
return nil;
return keys;
}
- (NSInteger)tableView:(UITableView *)tableView
sectionForSectionIndexTitle:(NSString *)title
atIndex:(NSInteger)index
{
NSString *key = [keys objectAtIndex:index];
if (key == UITableViewIndexSearch)
{
[tableView setContentOffset:CGPointZero animated:NO];
return NSNotFound;
}
else return index;
}
</code></pre>
| iphone | [8] |
193,994 | 193,995 | Copy Paste In JavaScript | <p>). This is an age-old question, but I'm still having trouble with it. You see, I'm trying to paste some Excel data in a Text Area, but the silly browsers freeze for long periods of time when doing this, because of God-knows-what "smart" parsing they do. I can't get rid of that (file upload is out of the question, my boss wants me to paste rows from Excel in a Text Area). </p>
<p>The good news is that pasting in a standard textbox WORKS. But I can't force them to paste there. So I am trying to catch the paste event in the Text Area and then throw the text over to the textbox. Unfortunately, I stopped short at the pasting part. I can't paste the text via JS into the simple textbox.</p>
<p>So my question is: how do you paste a text, how do you invoke it via JS? There are some solutions which only work in IE, that's not good, of course ::- ).</p>
<p>Any help is greatly appreciated ::- D.</p>
| javascript | [3] |
3,077,435 | 3,077,436 | Unable to control checkbox checked status - jquery | <p>I can't get this onClick event to control the checked status of the checkbox.. any thoughts?</p>
<pre><code> init: function () {
$('.billing input[type="checkbox"]').bind('click', function (e) {
e.preventDefault();
iKeyless.page.toggleShippingForm($(e.currentTarget));
});
},
toggleShippingForm: function (el) {
if (el.attr('checked')) {
$('.shipping').parents('.yui-u').addClass('hide');
el.attr('checked', false);
} else {
$('.shipping').parents('.yui-u').removeClass('hide');
el.attr('checked', true);
}
}
</code></pre>
<p>It loads with the checkbox checked and it stays checked regardless of what I do...</p>
| jquery | [5] |
2,269,069 | 2,269,070 | Providing an alternative to equals()? | <p>Let's say I have a class called <code>Number</code>, and I intend to do a lot of equality comparisons of <code>Number</code> objects. I am concerned about the "overhead" (class comparison, etc...) of the generic <code>Number::equals(Object o)</code> method. In this case, is it useful to provide a method such as <code>Number::isEqualTo(Number other)</code> as an alternative to <code>Number::equals(Object o)</code>? Is this a common pattern? Or do JVMs currently optimize well enough that there is no advantage to doing this?</p>
<p>Here's a code example:</p>
<pre><code>public class Number {
int _value;
Number(int value) {
_value = value;
}
@Override
public boolean equals(final Object o) {
if (o == this) return true;
if (o == null) return false;
if (o.getClass() != getClass()) return false;
return isEqualTo((Number)o);
}
public boolean isEqualTo(final Number other) {
return _value == other._value;
}
public static void main(String[] args) {
Number one = new Number(1);
Number two = new Number(2);
if (!one.isEqualTo(two)) {
System.out.println("fast comparison?");
}
if (!one.equals(two)) {
System.out.println("slow comparison?");
}
}
}
</code></pre>
| java | [1] |
5,200,018 | 5,200,019 | Multiple database operations from sql query | <p>I have two instances of <code>SQLiteDatabase</code> database. And I need to copy data from one to another.
I need to execute this query:</p>
<pre><code>INSERT INTO `toDB`.`tableName` SELECT * FROM `fromDB`.`tableName`
</code></pre>
<p>so, How can I do this my database instances? How to replace toDB and fromDB ?</p>
| android | [4] |
4,872,729 | 4,872,730 | Forwarding touch events | <p>using iphone SDK 3.1.3. I want to use the alert to choose audio routes that the MPVolumeView class gives you however i want to do it via my own button. So my plan is to put the MPVolumeView (slider and button) underneath my AudioSources button so its not visible and then forward touch events from the button to a specific co-ordinate of the MpVolumeView
ie the place where the alert button is( note this only appears when a Bluetooth headset is paired) so that it activates the button and shows the AudioRoute alert. This stops the slider from showing. How can i set this up up.</p>
<p>Why in the world Apple didn't just give us a simple API to call the alert is beyond me!</p>
<p>Thanks</p>
| iphone | [8] |
2,278,059 | 2,278,060 | php.ini open_basedir has a master value of no value, but a local value | <p>I have changed php.ini and set open_basedir to no value. However, in phpinfo(), there is a local value. I'm using a script that requires open_basedir to be no value to install. How can I remove the local value? I'm on a vps. I have also tried using .htaccess to set it.</p>
| php | [2] |
1,551,637 | 1,551,638 | Stopping python using ctrl+c | <p>I have a python script that uses threads and makes lots of HTTP requests. I think what's happening is that while a HTTP request (using urllib2) is reading, it's blocking and not responding to ctrl+c to stop the program. Is there any way around this?</p>
| python | [7] |
3,130,990 | 3,130,991 | Issue with simple text framing | <p>Basically, I'm trying to create a frame around text and on the third line where the text goes, it doesn't print out the # that's supposed to be the "padding" around it.</p>
<pre><code>******************
*################*
*#HELLO, JUSTIN!*
*################*
******************
</code></pre>
<p>That's what it looks like - after the ! in the $greeting variable, there should be a #. The code is below, could anyone explain why this happens?</p>
<pre><code><html>
<body><?php
$pad = 1;
$rows = ($pad * 2) + 3;
$greeting = "HELLO, JUSTIN!";
$col = strlen($greeting) + (2 * $pad) + 2;
for ($r = 0; $r != $rows; ++$r)
{
for ($c = 0; $c != $col; ++$c)
{
if ($r == $pad + 1 && $c == $pad + 1)
{
echo $greeting;
$c += strlen($greeting);
//echo "#";
}
else
{
if ($r == 0 || $r == $rows - 1 || $c == 0 || $c == $col - 1)
echo "*";
else
echo "#";
}
}
echo "<br />";
}
?></body>
</html>
</code></pre>
| php | [2] |
5,133,741 | 5,133,742 | How can I programatically determine that my iPhone app has been interrupted by a phone call? | <p>Is there a delegate that goes along with this like AppInteruptedByPhoneCall?</p>
| iphone | [8] |
5,106,884 | 5,106,885 | parsing json localhost android | <p>I am developing an android application in which i have to connect my android application with local host.I have done r and d,and implemented lots of codes.But didnot get success.Here is my code for establishing connection.Its showing in ddms connection to localhost refused</p>
<p><a href="http://pastebin.com/wVmzdQvA" rel="nofollow">http://pastebin.com/wVmzdQvA</a></p>
<p>when i run the url on browser its opening.Dont know where actually the problem is </p>
<p>If anyone can guide me </p>
<p>Regards
Tushar</p>
| android | [4] |
5,895,752 | 5,895,753 | Seekbar length manipulation | <p>I'm using a seekbar in my android application to set the volume. However the length of the seekbar is unesthetically too short. So is there a way to customize the length of a seek bar ? </p>
| android | [4] |
2,299,213 | 2,299,214 | Shuffle Text Effect with jQuery | <p>I am looking for Shuffle Text Effect on mouse hover. Same like below link but on mouse hover.</p>
<p><a href="http://demo.tutorialzine.com/2011/09/shuffle-letters-effect-jquery/" rel="nofollow">http://demo.tutorialzine.com/2011/09/shuffle-letters-effect-jquery/</a></p>
| jquery | [5] |
5,170,087 | 5,170,088 | Can I create a function with the same name as the class? | <p>I want to create a function with the same name as its class using C#.</p>
<p>Sample Snippet:</p>
<pre><code>public class MyCustomer
{
public MyCustomer()
{
}
public void MyCustomer()
{
}
}
</code></pre>
<p>If I try to compile it visual studio is throwing an error.</p>
| c# | [0] |
156,153 | 156,154 | Incomplete type, what does this mean? | <p>I am trying to debug my program, and I am reading values from a file called intInputFile. I was looking at my local variables and saw that it says intInputFile = incomplete type. I have tried looking it up, but no clear answers, I don't know what this means. Can anyone please explain because I think this is messing up my program. </p>
<p>Thanks. </p>
<pre><code>intInputFile >> fileInt;
cout << "check" <<endl;
while(!intInputFile.eof())
{
intNode* anotherInt;
anotherInt = new intNode;
if(intList==NULL)
{
intList = anotherInt;
lastInt = anotherInt;
lastInt->nextNode = NULL;
lastInt->nextNode = new intNode;
}
else
{
lastInt = lastInt->nextNode;
lastInt->nextNode = NULL;
lastInt->nextNode = new intNode;
}
lastInt->intValue = fileInt;
intInputFile >> fileInt;
cout << "good" <<endl;
}
</code></pre>
<p>After first execution it correctly reads in the first integer from the file , but I noticed the incomplete type when debugging. Also, I included cout <<"good"; to see if it would run to that point and when my program executed, all it did was repeatedly display "good".</p>
<p>Here are the includes:</p>
<pre><code> #include <iostream>
#include <string>
#include <fstream>
</code></pre>
<p>And I defined it as a regular ifstream type:</p>
<pre><code> int fileInt; //int read from input file
ifstream intInputFile;
</code></pre>
| c++ | [6] |
1,540,554 | 1,540,555 | TextView to send email when clicked | <p>I have a TextView with android:autoLink="email".</p>
<p>If I put my email address in there then a link appears that I can click.</p>
<p>How do I have different text appear (for example 'Send Feedback') instead of the email address but still behave the same when clicked?</p>
<p>Thanks</p>
| android | [4] |
861,875 | 861,876 | Record the voice call packets in a file | <p>I want to make an app to record voice call. I have read many relevant articles about it. I am aware that latest Galaxy comes with this feature. But wanted to know a few things:</p>
<ol>
<li>When we use the native AudioRecord::start(), where is the recorded data stored in the File System?</li>
<li>What is the format of the recorded data?</li>
<li>how to access that data to manipulate it?</li>
</ol>
<p>Thanks in advance.</p>
| android | [4] |
191,368 | 191,369 | Delay a javascript function until a css animation is complete | <p>I am trying to make a modal object library that will create and open a div, iframe, img, similar to colorbox. I am doing this in pure javascript, so please do not recommend jQuery.</p>
<p>The problem is, when a user creates a new modal using var myModal = new modal(options, width, height), I want it to check if a modal already exists, close it, wait for the close animation, then continue to create the new modal. I can already do everything, but I'm having an issue waiting to create the new modal until the old one is gone. I am aware of webkitTransisionEnd and firing custom events, but that is not the issue. I need the actual code to wait until the old modal is finished closing until it continues on to finish the rest of the function <strong>and still return the correct object to the user</strong>. Here are some of the things I've tried:</p>
<ul>
<li>Creating a transisionEnd listener waiting for the animation to end then creating the new modal. (this worked but considering it then becomes a nested function, it's hard to return the correct object).</li>
<li>Using a try, catch block. (this didn't work for my purposes)</li>
<li>Using a countless number of variations of the same thing where I use recursive functions</li>
</ul>
<p>If anyone has ideas, please feel free to post them. I have tried a lot of things, but apparently not the one thing that I need to. Thanks.</p>
<p>EDIT:</p>
<p>I was able to figure it out. All I had to do was attach a transitionEnd listener to the modal that is already open, then create an additional function outside of the class that would then recall the modal with the same constructor. The code looks a bit like this:</p>
<pre><code>function create(options, width, height) {
return new modal(options, width, height);
}
function modal(options, width, height) {
if (modal != null) {
modal.close();
modal.addEventListener('webkitTransitionEnd', function() {
create(options,width,height);
});
}
return;
}
</code></pre>
| javascript | [3] |
5,992,326 | 5,992,327 | Is it possible to add shortcut key to button in app? | <p>I wrote an application with the multiple screens, one of the screen is LoginScreen containing two TextView's two EditText's & two Buttons,</p>
<p>my question is, is it possible to add a shortcut key for Button when you device has hard keyboard present.</p>
<p>Best Regards,
Anup</p>
| android | [4] |
3,605,630 | 3,605,631 | JQuery observable Listing control | <p>Is there any free JQuery listing (you may call grid too) control which can be bind to an array as an observer such that whenever array data changes, listing control updates itself automatically eith array data?
thanks</p>
| jquery | [5] |
4,473,282 | 4,473,283 | Loading indicator not in motion | <p>I'm trying to show a GIF as a loading indicator while the page loads but the GIF is still and not in motion. I don't know why it's happening. Here is my script:</p>
<pre><code><script type="text/javascript">
$(document).ready(function() {
$(".class").click(function() {
$("#ajaxBusy").show();
});
});
</script>
</code></pre>
<p>I call this script in the <code>onClick</code> of a button.</p>
<p><img src="http://i.stack.imgur.com/lao4Q.gif" alt="enter image description here"></p>
<pre><code><div id="ajaxBusy" title="Loading" style="display:none;">
<p>
<img src="images/SmallLoader.gif" align="left">
Loading content, please wait...
</p>
</div>
</code></pre>
<p>i'm doing a c# web application</p>
| jquery | [5] |
5,409,552 | 5,409,553 | How to dynamically create and position a textbox in javascript? | <p>I would like to dynamically create a text box then dynamically position the text box. I have been able to dynamically create the text box with no problem but I have not been able to figure out how to position it. Any suggestions?</p>
| javascript | [3] |
155,891 | 155,892 | Adding objects to vectors vs adding pointers to vectors in c++? | <p>Adding objects to vectors vs adding pointers to vectors in c++.</p>
<p>Example:</p>
<pre><code>std::vector<Size> buildings;
Size building(buildingWidth, buildingHeight);
buildings.push_back(building);
</code></pre>
<p>VS</p>
<pre><code>std::vector<Size*> buildings;
Size *building = new Size(buildingWidth, buildingHeight);
buildings.push_back(building);
</code></pre>
<p>Which one is better in terms of memory/performance?</p>
<p>The first one basically creates an object on the stack and adds it to a vector.
So there is one instantiation followed by one copy into the vector.</p>
<p>The second one creates an object on the heap.
There is one instantiation, but there is no copy into the vector.</p>
<p>Am I correct?</p>
| c++ | [6] |
4,127,906 | 4,127,907 | How to access a document.doc and .txt modify the content using javascript | <p>Is it possible to access the .doc files and update in that document using javascript .</p>
<p>Thanks</p>
| javascript | [3] |
4,790,859 | 4,790,860 | How to use int.TryParse with nullable int? | <p>I am trying to use TryParse to find if the string value is an integer. If the value is an integer then skip foreach loop. Here is my code.</p>
<pre><code>string strValue = "42 "
if (int.TryParse(trim(strValue) , intVal)) == false
{
break;
}
</code></pre>
<p>intVal is a variable of type int?(nullable INT). How can I use Tryparse with nullable int?</p>
<p>Thanks..</p>
| c# | [0] |
2,139,156 | 2,139,157 | Restarting Android Application | <p>At the end of my application , i have a button to restart the application..</p>
<p>What is the way to restart an application in the onClick Listener of a button??</p>
<p>I tried doing it by creating an intent with "com.android.action.main"</p>
<p>But it doesnot work?</p>
| android | [4] |
4,727,186 | 4,727,187 | I have a condition comparing DateTime in C# using the < operator and it return's false even if it should not. Why? | <p>I have this code below and the "if ((DateTime)DataReader[0] > DateTime.Now)" condition returns false even if the datetime in the database is greater than the datetimenow.</p>
<p>I used this code before and it use to work I never changed any thing.</p>
<p>So the question is why does the condition return false?</p>
<p>Thanks,</p>
<p>Simon</p>
<pre><code>Boolean active = false;
SqlConnectionUniqueInstance.Instance.Open();
SqlCommand Command = SqlConnectionUniqueInstance.Instance.Connection.CreateCommand();
Command.CommandText = String.Format(@"SELECT [LogoutDateTime] FROM [dbo].[sessions] WHERE [sessionID] = {0}", sessionId.ToString());
SqlDataReader DataReader = Command.ExecuteReader();
while (DataReader.Read())
{
if ((DateTime)DataReader[0] > DateTime.Now)
active = true;
}
DataReader.Close();
if (active)
UpdateTime(sessionId);
Command.Dispose();
return active;
</code></pre>
| c# | [0] |
1,653,293 | 1,653,294 | Sequential output of files in python | <p>I wanted a method that would enable me to output files sequentially to a folder and give them a name that is stored in an array.</p>
<p>Here is the layout of the data:</p>
<pre><code>16837,144335,LOC516870
141961,198534,LOC100337147
223927,257577,LOC100849016
267259,273010,LOC512435
269335,277567,LOC100300061
</code></pre>
<p>I have read it in using:</p>
<pre><code>from numpy import *
x,y=genfromtxt('C:\\Users\\Mohammed\\Desktop\\positions1.txt', dtype=None, delimiter=',', usecols=[0,1],unpack=True)
z=genfromtxt('C:\\Users\\Mohammed\\Desktop\\positions1.txt', dtype='|S12', delimiter=',', usecols=[2],unpack=True)
exit
</code></pre>
<p>Now I want to construct a do loop that names the files with the variable z sequentially as </p>
<pre><code>LOC516870.txt
LOC100337147.txt
</code></pre>
<p>and so on.</p>
<p>I tried the following: </p>
<pre><code>for i in range (6):
f = open("C:\\Users\\Mohammed\\Desktop\\Sequences\\'z'.txt", 'wt')
f.write(Seq)
f.close()
</code></pre>
<p>While I know a similar code would work in Perl, it didn't work in python and it says that its an invalid syntax!</p>
<p>Your help with this would be greatly appreciated.</p>
<p>Thank you!</p>
| python | [7] |
5,018,328 | 5,018,329 | JavaScript Inheritance | <p>I am trying to implement inheritance in javascript. I came up with following minimal code to support it.</p>
<pre><code>function Base(){
this.call = function(handler, args){
handler.call(this, args);
}
}
Base.extend = function(child, parent){
parent.apply(child);
child.base = new parent;
child.base.child = child;
}
</code></pre>
<p>Experts, please let me know if this will be sufficient or any other important issue I may have missed. Based on similar issues faced please suggest other changes.</p>
<p>Here is complete test script:</p>
<pre><code>function Base(){
this.call = function(handler, args){
handler.call(this, args);
}
this.superalert = function(){
alert('tst');
}
}
Base.extend = function(child, parent){
parent.apply(child);
child.base = new parent;
child.base.child = child;
}
function Child(){
Base.extend(this, Base);
this.width = 20;
this.height = 15;
this.a = ['s',''];
this.alert = function(){
alert(this.a.length);
alert(this.height);
}
}
function Child1(){
Base.extend(this, Child);
this.depth = 'depth';
this.height = 'h';
this.alert = function(){
alert(this.height); // display current object height
alert(this.a.length); // display parents array length
this.call(this.base.alert);
// explicit call to parent alert with current objects value
this.call(this.base.superalert);
// explicit call to grandparent, parent does not have method
this.base.alert(); // call parent without overriding values
}
}
var v = new Child1();
v.alert();
alert(v.height);
alert(v.depth);
</code></pre>
| javascript | [3] |
3,364,142 | 3,364,143 | Java dates difference in milliseconds | <p>I've written the following code, but I always just get...</p>
<p>4838399999
Seconds is : 59
Minutes is : 59
Hours is : 23
Days is : 7</p>
<pre><code>Calendar xmas = Calendar.getInstance();
final Calendar now = Calendar.getInstance();
xmas.set(Calendar.YEAR, 2011);
xmas.set(Calendar.MONTH, Calendar.DECEMBER);
xmas.set(Calendar.DAY_OF_MONTH, 25);
long milliseconds1 = now.getTimeInMillis();
long milliseconds2 = xmas.getTimeInMillis();
long diff = milliseconds2 - milliseconds1;
System.out.println(diff);
diff = diff / 1000;
final long diffSeconds = diff % 60;
System.out.println("Seconds is : " + diffSeconds);
diff = diff / 60;
final long diffMinutes = diff % 60;
System.out.println("Minutes is : " + diffMinutes);
diff = diff / 60;
final long diffHours = diff % 60;
System.out.println("Hours is : " + diffHours);
diff = diff / 24;
final long diffDays = diff % 24;
System.out.println("Days is : " + diffDays);
</code></pre>
<p>Can anyone see anything wrong with this logic to find the days, hours, minutes and seconds till xmas? </p>
| java | [1] |
4,443,003 | 4,443,004 | How to retreive items from websites into android app | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/12073291/android-app-to-retreive-images-and-text-from-a-website">Android app to retreive images and text from a website</a> </p>
</blockquote>
<p>How do I retreive images and text and display it in my android application,Like getting picture of cars and the car details from a car website if I am to write an app for car dealer</p>
| android | [4] |
1,788,587 | 1,788,588 | How do I ignore lines using difflib.ndiff? | <p>According to the documentation, you can provide a linejunk function to ignore certian lines. However, I can't get it to work. Here is some sample code for discussion:</p>
<pre><code>from re import search
from difflib import ndiff
t1 = 'one 1\ntwo 2\nthree 3'
t2 = 'one 1\ntwo 29\nthree 3'
diff = ndiff(t1.splitlines(), t2.splitlines(), lambda x: search('2', x))
</code></pre>
<p>My intention is to ignore the second line and diff will be a generator that doesn't show any differences.</p>
<p>Thanks for the help.</p>
| python | [7] |
259,683 | 259,684 | file copy program in binary mode | <p>I am writing a filecopy program, but reading data from a media file such as .avi in binary mode into the string variable str throws an error related to the size of the variable str not being large enough to hold the data returned from the file read.
Here is the code through which i was trying to perform the task.</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace ConsoleApplication7
{
class Program
{
static void Main(string[] args)
{
string filename;
Console.WriteLine("enter file location");
filename=Console.ReadLine();
FileStream fs = new FileStream(filename, FileMode.Open);
BinaryReader br = new BinaryReader(fs);
string str;
str =Convert.ToString(br.Read());
while (str != null)
{
Console.WriteLine(str);
str = Convert.ToString(br.Read());
}
fs.Close();
br.Close();
}
}
}
</code></pre>
<p>what's the solution to this.</p>
| c# | [0] |
1,963,300 | 1,963,301 | work sun.misc.BASE64Encoder/Decoder for getting byte[] | <p>I am trying to use sun.misc.BASE64Encoder/Decoder, but this code:</p>
<pre><code>(new sun.misc BASE64Encoder()).encode(new
sun.misc.BASE64Decoder().decodeBuffer("test string XML:"))
</code></pre>
<p>returns "test/string/XML/"
I am embarrassed</p>
| java | [1] |
3,587,575 | 3,587,576 | javascript : can I somehow strong type function parameters? | <p>I am a newbie with Javascript and I feel the unresistible need to strong type my functions parameters for a couple of tools I am coding :</p>
<ol>
<li>That would give me autocompletion within those functions</li>
<li>Debugging/function access gets more consistent </li>
</ol>
<p>After some googling, I guess this isn't directly possible. However, are there common tools to emulate this rather simply ?</p>
<p>What are your thoughts ?</p>
| javascript | [3] |
592,014 | 592,015 | How can I get the user's IP address in PHP? | <h3>Duplicate:</h3>
<blockquote>
<p><a href="http://stackoverflow.com/questions/55768/how-do-i-find-a-users-ip-address-with-php">How do I find a user's IP address with php?</a></p>
</blockquote>
<p>Edit: Server is a Debian linux box running PHP5 through suPHP. Above post has been read. This code covers all points mentioned but still returns unknown addresses.</p>
<p>My code always requires that the remote IP address be known. It doesn't matter if we pick up the proxy address once we can get some IP address for the access.</p>
<p>Function below is what we current use however in over 20% of kits, the server falls through to the unknown case and has nothing in the $_SERVER var.</p>
<pre><code>function getip()
{
if ( $_SERVER["HTTP_CLIENT_IP"] && strcasecmp($_SERVER["HTTP_CLIENT_IP"], "unknown") )
{
$ip = $_SERVER["HTTP_CLIENT_IP"];
}
else if ( $_SERVER["HTTP_X_FORWARDED_FOR"] && strcasecmp($_SERVER["HTTP_X_FORWARDED_FOR"], "unknown") )
{
$ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
}
else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown"))
{
$ip = getenv("REMOTE_ADDR");
}
else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown"))
{
$ip = $_SERVER['REMOTE_ADDR'];
}
else
{
$ip = "unknown: ".var_dump($_SERVER, true);
}
return($ip);
}
</code></pre>
| php | [2] |
5,767,517 | 5,767,518 | How to update Android application through our application without go to android Market? | <p>I have android app, that version is 1.0. There are some updates so changed the version number to 1.1. I did not upload into android market. </p>
<p>It's a private application.
Normally update app happens like this: If there is version number which differs from installed app, then I should update. That time It don't delete my database contents</p>
<p>is it?</p>
<p>How we can update into version without publishing into android market?</p>
<p>because my applications sales person going use.when there are in the fields(on way to go shop or anywhere their-self want to update)</p>
<p>If there are new version is available then In sql server database also we mention the flag "1" (bacause of sales person can identify there are update version is available)then It should download apk & need to update the system automatically?</p>
<p>OR </p>
<p>when we launch the app,It should check the version number or update available, then should update automatically..</p>
<p>How we can do it?</p>
<p>OR give me a idea of update the android apps..</p>
<p>How we can do this?</p>
<p>Please help me..</p>
<p>Thanks in advance</p>
| android | [4] |
476,601 | 476,602 | Adding Header in ListView in android | <p>I need add header in my listview and header should always displayed even scrolling list.</p>
<p>Is it possible in android list view?</p>
| android | [4] |
725,629 | 725,630 | How can I get all my links to scroll to the top of the page by placing one function in a coldfusion code | <p>This is the function that I currently have.
Instead of one link I want all my links to scroll to the top of the page. The function is to be placed within a coldfusion code.</p>
<pre><code><script>
function ScrollClick() {
// Scroll to top
document.body.scrollTop = document.documentElement.scrollTop = 0;
// Open up a link in my iframe
document.getElementById('MainWindow').src="DocDisplayCategory.cfm?categoryID=89"
}
</script>
</li>
</code></pre>
| javascript | [3] |
1,332,091 | 1,332,092 | Elegant Solution for looping over a json hash with a fickle structure | <p>I have a json hash which has a lot of keys. I retrieve this hash from a web service at regular intervals and for different parameters etc. This has more or less fixed structure, in the sense that keys are sometimes missing.
So I end up with a lot of code of the following nature</p>
<p>Edit:
Sample <code>data</code></p>
<pre><code>data =
{
id1 : {dict...},
id2 : {dict..},
'' : {value...},
...
}
for item in data:
id = data.get("id")
if not id:
continue
...
</code></pre>
<p>I want to skip the 3rd element and move on. The structure <code>data</code> is a nested <code>dict</code> and I loop inside each of these nests. There are keys missing there as well :(</p>
<p>I was wondering if there was a more elegant solution than having 50 different <code>if</code>s and <code>continue</code>s</p>
<p>Thanks</p>
| python | [7] |
3,048,739 | 3,048,740 | How do you add extra html after an element with jQuery? | <p>I'm aware of <a href="http://api.jquery.com/append/" rel="nofollow">jQuery's append()</a> which appends html inside the selected element. I want to add more html after the selected element. For instance:</p>
<pre><code><a href="/somewhere/">Somewhere</a>
</code></pre>
<p>I want to add the html <code><h3>Hello</h3></code> after the above to become:</p>
<pre><code><a href="/somewhere/">Somewhere</a>
<h3>Hello</h3>
</code></pre>
<p>How can you achieve that in jQuery?</p>
| jquery | [5] |
2,543,069 | 2,543,070 | Android Intent like Gmail's attach Intent | <p>When I get my activity chooser for my ACTION_GET_CONTENT Intent there is applications I don't want to be there, like the ones who will first create content and then pass the URI to me, like the Voice Recorder.</p>
<p>When you use Gmail and try to attach a file you will only see the applications/activities that picks data from your SDCard like Gallery, and in my case Astro (file manager application).</p>
<p>So my question is, what kind of Intent does Gmail use for their Attach?</p>
<p>Here is my code, something must be missing since I get applications like Voice Recorder and so on.</p>
<pre><code>Intent action = new Intent(Intent.ACTION_GET_CONTENT);
action = action.setType("*/*").addCategory(Intent.CATEGORY_OPENABLE);
startActivityForResult(Intent.createChooser(action, "Upload file from..."), 1);
</code></pre>
<p>Thank you!</p>
<p>Regards<br>
Tobias</p>
| android | [4] |
2,409,438 | 2,409,439 | Compre two objects | <p>I have the below entity</p>
<pre><code>public class Employee
{
public int EmpId { get; set; }
}
</code></pre>
<p>How can I compare between the objects?
Thanks</p>
| c# | [0] |
2,978,950 | 2,978,951 | How to return to home screen from Activity | <p>as we know, android can return home screen whenever we press the Home-key,
I now want my Imagebutton to behave as the Home-key,which can inform the home screen to foreground, how should I code my onClickListener to get this done?</p>
<p>any ideas?</p>
| android | [4] |
117,768 | 117,769 | Is it possible to create a struct type based on file contents? | <p>Is it possible in C++ to create a struct type based on file contents?</p>
<pre>
STRUCT_NAME
int var1;
int var2;
string v3;
STRUCT NAME *pointer;
</pre>
<p>The first line would be the name of the struct, the other lines would be the variables</p>
| c++ | [6] |
3,640,507 | 3,640,508 | Unit Testing in PHP | <p>Do you guys do any unit testing in PHP? I'm not sure if I've ever done it... what exactly is it? Can you provide a simple example?</p>
| php | [2] |
3,581,209 | 3,581,210 | jQuery Text Field Value Change, Bind Function | <p>Is there a way to bind the change event for a text field in jQuery? I.E. whenever the value changes, call some function? I am currently using <code>keyup</code> but that doesn't hit every case, i.e. right click and paste.</p>
<p>Thanks.</p>
| jquery | [5] |
5,940,191 | 5,940,192 | jQuery - Bold all the words in a query | <p>I have a large HTML document, a book, and need to bold every occurrence of "Toronto".</p>
<p>How is this done in jQuery?</p>
| jquery | [5] |
1,010,423 | 1,010,424 | How to substring one by one in one button in php? | <p>How to substring one by one in one button in php ?
Example:
$myvar="abc";
i need one button when click 1 time=display a, click 2time display b, and click 3time
display c. click how many time ?depend on string of $myvar.</p>
<p>Best regards</p>
| php | [2] |
3,263,452 | 3,263,453 | file_get_contents not working for some sites | <p>I'm using file_get_contents to display external content.</p>
<p>It works for most websites but then I came across some it didn't.</p>
<p>Here you can see one where it doesn't: <a href="http://www.chusmix.com/game/frame.php?url=iknow.jp/home" rel="nofollow">http://www.chusmix.com/game/frame.php?url=iknow.jp/home</a> http://www.chusmix.com/game/frame.php?url=twitter.com</p>
<p>It seems the problem has to do with CSS but I cannot figure out what it is. Also I'm transforming relative paths to absolute ones. However It's not a problem with my code since I tried just the file_get_contents and I still had the issue.</p>
<p>Any ideas of what could be the problem and how to solve it?</p>
<p>Thanks!</p>
| php | [2] |
4,419,479 | 4,419,480 | Use of typedef on function | <p>In the following, how can i define my function with typedef syntax?</p>
<pre><code>typedef void F();
//declare my function
F f;
//error
F f { }
</code></pre>
| c++ | [6] |
2,408,678 | 2,408,679 | convert $var of function to string? | <p>My goal just debug</p>
<pre><code> funtion dbg($var){
echo "you have passed $var";
}
call dbg($test)
output:
you have passed test
call dbg("var")
output:
you have passed "var"
</code></pre>
<p>In php .anyone could help me to do that?</p>
| php | [2] |
3,847,991 | 3,847,992 | Pass a variable to an ajax function | <p>I'm trying to pass a variable to a javascript function, but I'm not sure what's going on as I am primarily a PHP person.</p>
<pre><code><script language="javascript" type="text/javascript">
<!--
//Browser Support Code
function ajaxFunction( str){
var ajaxRequest; // The variable that makes Ajax possible!
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
document.getElementById("emailconfirm").innerHTML= ajaxRequest.responseText;
}
}
ajaxRequest.open("GET", "Atest.php?Email="+str, true);
ajaxRequest.send(null);
}
//-->
</script>
</code></pre>
<p>the form</p>
<pre><code><form name='myForm'>
<input name="email" id="email"type="text" />
<input name="button" onclick="ajaxFunction(document.getElementById('email').value" type="button" />
</form>
</code></pre>
<p>I wanna be able once the button get clicked, the email text input will be passed to the javascript function.</p>
| javascript | [3] |
4,279,718 | 4,279,719 | Htm page to Aspx page | <p>I have an htm page.There i have a link Moreinfo.When we click that link it will go to aspx page.Means here the link Moreinfo <a href="http://localhost/akki/akki/b/reg.aspx" rel="nofollow">More Info...</a> when we click that link it has to go reg.aspx.But its not going,,error is shopwing page not found</p>
<p>Means In my project,i have index.htm.From this page when i click Moreinfo link,,it has to go reg.aspx..How i can go..I copied this proj from my collegue</p>
<p>Nothing is working .both index.htm and reg.aspx are in same site 'b'</p>
| asp.net | [9] |
5,745,572 | 5,745,573 | Javascript Date() constructor doesn't work | <p>I have an issue - </p>
<p>The javascript <code>Date("mm-dd-yyyy")</code> constructor doesn't work for FF. It works fine for IE.</p>
<ul>
<li>IE : <code>new Date("04-02-2008")</code> => <code>"Wed Apr 2 00:00:00 EDT 2008"</code></li>
<li>FF2 : <code>new Date("04-02-2008")</code> => <code>Invalid Date</code> </li>
</ul>
<p>So lets try another constructor. Trying this constructor <code>Date("yyyy", "mm", "dd")</code></p>
<ul>
<li>IE : <code>new Date("2008", "04", "02");</code> => <code>"Fri May 2 00:00:00 EDT 2008"</code></li>
<li>FF : <code>new Date("2008", "04", "02");</code> => <code>"Fri May 2 00:00:00 EDT 2008"</code></li>
<li>IE : <code>new Date("2008", "03", "02");</code> => <code>"Wed Apr 2 00:00:00 EDT 2008"</code></li>
<li>FF : <code>new Date("2008", "03", "02");</code> => <code>"Wed Apr 2 00:00:00 EDT 2008"</code></li>
</ul>
<p>So the <code>Date("yyyy", "mm", "dd")</code> constructor uses an index of <code>0</code> to represent January. </p>
<p>Has anyone dealt with this?<br>
There must be a better way than subtracting 1 from the months.</p>
| javascript | [3] |
4,493,200 | 4,493,201 | stani python editor documentation | <p>Has anybody got any idea where one can get documentation for stani python editor? The doc folder in the package is empty and I have searched the internet with no luck..</p>
| python | [7] |
3,712,987 | 3,712,988 | How to make Treeview Structure upto 4 level in Android | <p>How to make treeview structure in android like!</p>
<p>I try this Example but I want to Add 4 level.How to Add upto 4 level using this Example <a href="http://mylifewithandroid.blogspot.in/2011/02/3-level-expandable-lists.html" rel="nofollow">enter link description here</a></p>
<p><img src="http://i.stack.imgur.com/zxAmH.png" alt="enter image description here"></p>
<p>plz give me ans & thanks</p>
| android | [4] |
3,095,421 | 3,095,422 | Find first day of previous month in javascript | <p>Given a date object, how to get its previous month's first day in javascript</p>
| javascript | [3] |
1,238,339 | 1,238,340 | How to reset this JS object? | <p>Here I want to reset all properties of Data to their original values, how I do that?</p>
<pre><code>var Data{
prop1: false,
prop2: true,
prop3: null
}
Some code executes & sets Data.prop1 = "abc";
</code></pre>
<p>I never instantiated Data, is that a problem?</p>
| javascript | [3] |
5,988,427 | 5,988,428 | PreSaveAction is not firing | <p>Any idea why the PreSaveAction is not firing. I am trying to take the user to a thankyou page when they complete a survey. I added this js thru SP Designer to NewForm.aspx.</p>
<pre><code><script type="text/javascript" src="'/_layouts/jQuery/jquery-1.6.min.js"> </script>
<script type="text/javascript">
$(document).ready(function(){
// old handler:
var buttonID = document.getElementById("ctl00_m_g_f46a290b_d993_4347_a2da_868aff18de82_ctl00_toolBarTbltop_RightRptControls_ctl01_ctl00_diidIOSaveItem");
var oldHandler = function() {
if (!PreSaveItem()) return false;
WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00_m_g_f46a290b_d993_4347_a2da_868aff18de82_ctl00_toolBarTbltop_RightRptControls_ctl01_ctl00_diidIOSaveItem", "", true, "", "", false, true));
};
// remove old and add new handler:
var newHandler = function() {
if (!PreSaveItem()) return false;
<input type="button" value="Finish" name="Submit" onclick="if (!PreSaveItem()) return false;{ddwrt:GenFireServerEvent('__commit;__redirect={/thankyou.aspx}');}" />
//WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00_m_g_f46a290b_d993_4347_a2da_868aff18de82_ctl00_toolBarTbltop_RightRptControls_ctl01_ctl00_diidIOSaveItem", "", true, "", "", false, true));
//window.location.replace("/ThankYou.aspx");
return true;
};
$("#ctl00_m_g_f46a290b_d993_4347_a2da_868aff18de82_ctl00_toolBarTbltop_RightRptControls_ctl01_ctl00_diidIOSaveItem").unbind("click", oldHandler).click(newHandler);
});
</script>
</code></pre>
| javascript | [3] |
4,640,011 | 4,640,012 | Benefit of Value Types over Reference Types? | <p>Seeing as new instances of value types are created every time they are passed as arguments, I started thinking about scenarios where using the <code>ref</code> or <code>out</code> keywords can show a substantial performance improvement.</p>
<p>After a while it hit me that while I see the deficit of using value types I didn't know of any advantages.<br/>
So my question is rather straight forward - <strong>what is the purpose of having value types? what do we gain by copying a structure instead of just creating a new reference to it?</strong></p>
<p>It seems to me that it would be a lot easier to only have reference types like in Java.</p>
<p><strong>Edit:</strong> Just to clear this up, I am not referring to value types smaller than 8 bytes (max size of a reference), but rather value types that are 8 bytes or more.</p>
<p>For example - the <code>Rectangle</code> struct that contains four <code>int</code> values.</p>
| c# | [0] |
492,827 | 492,828 | What is the Best Way to Display a Non-Modal "Loading" Message on IPhone? | <p>I have an iPhone app, and sometimes when the user presses a button, the chosen operation will take a minute or two. I would like to display a message instructing the user to wait, but not block the user from using the app in the meantime. Also I would like customizable text on the message.</p>
<p>Another requirement is that I use a TabBarController as the main navigation control.</p>
<p>My idea is to have a message appear at the top of the screen, pushing the content down by 20 pixels. Note that as there would be multiple screens, this 20 pixel message would have to be independent of any single screen.</p>
<p>I have tried a few different ways, each with drawbacks.</p>
<p>1 - Have a Root View and call AddSubView with the TabBarController. Then I can resize the TabBarController and show the message on the Root View underneath. This fails because the TabBarController child views do not receive "ViewDidAppear" messages. Interestingly, if I display a modal window at some later point, the "ViewDidAppear" messages begin to work. But I would like ViewDidAppear at the start.</p>
<p>2 - Similar to #1. Have a Root View and display the TabBarController as a modal view. This allows ViewDidAppear to work, but if the screen is rotated, the rotation message doesn't propogate to the Root View. So I cannot rotate the Root View.</p>
<p>3 - Subclass TabBarController to properly handle rotation. The Apple docs say not to do this, so I worry my app would be rejected, if I can make it work.</p>
<p>4 - Add two views to the main window. One for displaying the message, and one for the app content. This suffers from the same rotation problem as option #2.</p>
<p>Any suggestions are appreciated.
Thanks.</p>
| iphone | [8] |
1,960,636 | 1,960,637 | cast child object as parent | <p>I need to be able to cast an instance of a child object to an instance of the parent object.</p>
<pre><code>public class Parent
{
public string name{get;set;}
}
public class Child : Parent{}
var myClass = new Child()
(Parent)myClass
//this doesnt seem to work and the object still has childs type.
</code></pre>
<p>is there another way to cast it?</p>
<p>thanks</p>
| c# | [0] |
4,046,658 | 4,046,659 | Search the options of a select, find the value, add selected to it and write it's html text on a div | <p>I have a simple select, a div and a prepopulate variable.</p>
<p>Here is what I want to do:</p>
<p>I have the prepopulate value, lets say:</p>
<pre><code>prepop = 2;
</code></pre>
<p>I want to search all the options in the select, add the attribute selected to the option with value 2 and write "Val two" on the div test:</p>
<pre><code><div id="test"></div>
<select>
<option value="1">Val one<option>
<option value="2">Val two</option>
</select>
</code></pre>
<p>Any ideas how?</p>
<p>Here are my thoughts:</p>
<pre><code>var $options = "get all the select options";
$options.each(function(){
if (jQuery(this).val() == prepop){
jQuery('#test').html(jQuery(this).text());
}
});
}
</code></pre>
| jquery | [5] |
1,384,340 | 1,384,341 | Notification sound not playing | <p>I know this question has been asked many times, but I'm still having issues getting it working.</p>
<p>In my application, I create a notification to prompt the user of some event and I'd like to play a sound that has been packaged as a raw resource within the application.</p>
<p>I create my notification instance:</p>
<pre><code>Notification notification = new Notification(
R.drawable.some_image,
"some meaningful name",
System.currentTimeMillis() );
notification.setLatestEventInfo(...)
</code></pre>
<p>Then set some attributes on that notification:</p>
<pre><code>notification.sound = Uri.parse( "android.resource://com.my.package/" + R.raw.some_mp3_file );
notification.flags = Notification.FLAG_INSISTENT;
</code></pre>
<p>Finally I invoke the NotificationManager to display the notification:</p>
<pre><code>notificationManager.notify( 1, notification );
</code></pre>
<p>The notification does shows up, but the sound doesn't play.</p>
<p>Am I doing something wrong? Is there a <uses-permission> I'm missing? I can't see anything that I've done differently from anyone else that seems to have gotten it working. </p>
<p>For what it's worth, I'm testing directly on a Nexus 7.</p>
| android | [4] |
3,982,760 | 3,982,761 | PHP search and Replace query | <p>i want to search the symbols \" and replace it by " </p>
<p>How can i do that , i am using the following code that is not working</p>
<pre><code>$filenew = str_replace("\\"" , """, $filenew);
</code></pre>
| php | [2] |
3,057,755 | 3,057,756 | How can obtain age by birth date | <p>I want get the exact age of the following date in var <code>$birth_date</code> by php, How is it?</p>
<p><code>$birth_date = 2011/12/16;</code></p>
<p>$birth_date => For example, this is my birth date.</p>
<p>For example output from my birth date is: <code>0 Year, 0 Month, 1 Day</code></p>
| php | [2] |
2,454,690 | 2,454,691 | difference between $(window).load(function() { and $(document).ready(function() { | <p>What is the difference between <code>$(window).load(function() {</code> and <code>$(document).ready(function() {</code> that we face when we use them in jQuery?</p>
| jquery | [5] |
2,455,126 | 2,455,127 | How to check whether table with given name exists in oracle through Java? | <p>I have csv file and i want to import that data to oracle database.
but before that i want it to check whether table 'xyz' exist in database or not.</p>
<p>I want to do it through java .. anyone knows how to do it through java ?</p>
| java | [1] |
4,536,121 | 4,536,122 | Operators overloading in other classes | <p>Can I overload operators for class A in class B in C#? For example:</p>
<pre><code>class A
{
}
class B
{
public static A operator+(A x, A y)
{
...
}
}
</code></pre>
| c# | [0] |
135,183 | 135,184 | Getting fullscreen mode to my browser using jquery | <p>I want fullscreen mode to my browser like when clicking the button f11 but without using f11 key.I want the code for the fullscreen mode. using jquery..
Please give me the answer to my question. I tried alot. but I didn't get the output</p>
| jquery | [5] |
5,023,093 | 5,023,094 | Limited splits without losing the rest of the string? | <p>Say I have:</p>
<p><code>var str = "this is a string separated by spaces";</code></p>
<p>and I did:</p>
<p><code>alert(str.split(" " , 1));</code></p>
<p>the outcome would be <code>"this"</code></p>
<p>Whereas I want the outcome to be <code>"this,is a string separated by spaces"</code></p>
<p>maybe split isn't the right method? </p>
<p>What I'm trying to do is separate a string into parts based on semicolons, unless those semicolons are in quotes. For example, I would want </p>
<p><code>randomnessstuff;morestuff;some more stuff</code></p>
<p>to be in three parts, so I've been doing:</p>
<pre><code>var str = "randomnessstuff;morestuff;some more stuff";
var parts = str.split(";");
</code></pre>
<p>Which has been working fine, but if the semicolon is in quotes, I want it to NOT be separated into another part. </p>
<p>for example, with:</p>
<p><code>var str = "randomnessstuff;morestuff and a semicolon in quotes : ";";some more stuff";</code></p>
<p>I would want part 1 to be <code>randomnessstuff</code> , part 2 to be <code>morestuff and a semicolon in quotes : ";"</code> , and part 3 to be <code>some more stuff</code></p>
<p>of course, if I just did split with the semicolon again, it would make part 3 the quote.</p>
<p>What I'm hoping to do is have a loop that checks the semicolons one by one to see if they're in quotes, and if not, to split with them. If this last bit didn't make any sense, then please just answer the first question, about using split without losing the rest of the string.</p>
| javascript | [3] |
2,682,459 | 2,682,460 | how to display previously selected value in UIPickerview selected bar | <p>I am displaying numbers from 0 to 30 in a <a href="http://www.freeimagehosting.net/uploads/82c3da83ab.png" rel="nofollow">UIPickerview</a>.</p>
<p>And call a pickerview when i tap on a button.</p>
<p>when ever i select one value in pickerview and tap on ok button to quit pickerview.</p>
<p>for the next time when ever i tap on button to open UIPickerview i need to display previous selected value <a href="http://www.freeimagehosting.net/uploads/6fa95eac9b.png" rel="nofollow">like this</a>.</p>
<p>for example previously i select 13 for the next time when i open pickerview i need to display 13 on selected bar as show in figure.</p>
<p>how can i done.</p>
<p>can any one please help me.</p>
<p>Thank u in advance.</p>
| iphone | [8] |
5,011,372 | 5,011,373 | GridView in asp.net | <p>I am bit new to Asp.net GridView, and I am facing the following problem.
I have a gridview placed in an ascx. This ascx is loaded dynamically within an aspx, in its Page_Init method
Control control = LoadControl("~/grid.ascx");
PlaceHolder1.Controls.Add(control);</p>
<p>The grid is bound to a IList (which is populated from the data access layer). I have a button field in the grid, which is used to call the delete function in DA layer for the row (performs this call in GridView1_RowCommand()).</p>
<p>My question is, I dont see the grid view getting refreshed after I perform the delete. I placed the code to re-read and bind data to gridview in many places, but none seems to work.</p>
<p>Notes:
1. The loading of ascx is done in an ajax call for the aspx
2. Delete function actually modifies the 'Status' column of 'User' to 'Deleted' which I need to see in the gridview after I do so</p>
<p>Can you please help me?</p>
<p>Edit:
It seems that RowDataBound event is fired (for each row of course) after page load, and then only the button command event fire. Though I set the modified DS and DataBind on the gridview, it never fires the RowDataBound afterwards. Any idea why?
Thanks in advance.</p>
<p>Anuruddha</p>
| asp.net | [9] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.