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 |
---|---|---|---|---|---|
1,624,397 | 1,624,398 | Detecting user typing in a text box | <p>I am using listeners to detect when a user finishes with textbox; when the text is value is changed, I am pasting their text on to the page using innerHTML.</p>
<pre><code>document.getElementById("dateinput").addEventListener("change", function() {
myDate(document.getElementById("dateinput").value);
}, false);
</code></pre>
<p>Is there a way to listen for each key press to immediately paste the .value character by character as they type? I only want to do this while the textbox has focus.</p>
<p>Thanks.</p>
| javascript | [3] |
339,212 | 339,213 | How can I define my return type | <p>I have the following code:</p>
<pre><code> public IList<Content.Grid> GetContentGrid(string pk)
{
// How can I define result to hold the return
// data? I tried the following but it does not
// work:
var result = new IList<Content.Grid>();
var data = _contentRepository.GetPk(pk)
.Select((t, index) => new Content.Grid()
{
PartitionKey = t.PartitionKey
....
});
switch (pk.Substring(2, 2))
{
case "00":
return data
.OrderBy(item => item.Order)
.ToList();
break;
default:
return data
.OrderBy(item => item.Order)
.ToList();
break;
}
}
</code></pre>
<p>The VS2012 is telling me that the break is not needed so what I would like to do is to remove the returns from inside the switch, store the results in a variable and then after the switch is completed have:</p>
<pre><code>return result;
</code></pre>
<p>Can someone tell me how I can declare the variable called result. I tried the following but this gives a syntax error:</p>
<pre><code>var result = new IList<Content.Grid>();
</code></pre>
| c# | [0] |
2,830,839 | 2,830,840 | Jquery plugin to collapse ul/li | <p>I have created a jquery plugin to expand/collapse ul,li something like a accordion menu
My fiddle is here <a href="http://jsfiddle.net/8CyrA/" rel="nofollow">http://jsfiddle.net/8CyrA/</a> although it runs fine in pc , it
doesn't recognize the plugin code in fiddle..my question is there are 2 folders
Folder 1 , Folder 2 .. i want Folder2 to be in a collapsed state how can i do this?</p>
| jquery | [5] |
2,455,625 | 2,455,626 | Iphone getting url from push notification | <p>I have implemented ray's awesome tutorials on apns, every thing is working fine, now i have a requirement that the message of push notification will contain a web url, and i have to get that url, the format will be that first there will be a text message in the notification and at the end the url will come, for example, a sample notification message can be</p>
<p>"Hi, Every one Plz. check this video. http:\designers99.com\video\abc.mp3"</p>
<p>now the first text message can be different from this and its length can also be varied so i cant get the substring of url using string index, my requirement is to break that message and retrieve that url from it, plz. guide me in this thanx and regards Saad.</p>
| iphone | [8] |
3,068,102 | 3,068,103 | Is it important to explicitly declare properties in PHP? | <p>I have followed a tutorial to create a simple blog writing application in PHP and have modified the classes in this tutorial so that they have additional capabilities. Modifying this very bare bones app has given me a better understanding of how PHP works, however I have run across an interesting situation. </p>
<p>One of the classes in my project has about a half dozen class properties such as <code>public $id, public $author, public $post</code>. These properties are declared at the beginning of this class however I find that if I remove all but one of these properties the app still functions correctly. </p>
<p>Is it wrong to remove a property declaration such as <code>public $datePosted</code> from the beginning of a class if this class still assigns variables to this property like this: `$this->datePosted = $someVariableName;'</p>
| php | [2] |
5,535,408 | 5,535,409 | jQuery: "show all comments" click & hide at success? | <p>I have this right now:</p>
<pre><code><a href='javascript:showComments($displayWall[id]);' style='cursor: pointer;'>Show all $isThereAnyComments comments</a>
</code></pre>
<p>On success in showComments, i want it to show this div:</p>
<pre><code>#showWallCommentsFor + wallID
</code></pre>
<p>And then when it shows, then it should change "Show all" to "close" and then it should hide the div. How can i do this?</p>
| jquery | [5] |
5,313,801 | 5,313,802 | PHP - Name of first day in actual month | <p>How can i get name (~Monday) of the first day in the current month? or just value (monaday=0, tuesday=1 ...)
in PHP?</p>
<p>I have $date = getdate(), i try make a calendar, but i need to know first day
offset in calendar.</p>
<p>EDIT:
fixed question: I'm asking of 1-st day only.</p>
| php | [2] |
5,561,244 | 5,561,245 | Connecting to a database in visual studio 2010 using c# credentials | <p>I'm pretty new to c# asp.net etc so bear with me :)
I've been looking on the internet for the right syntax so I can connect to my database which is on my computer.</p>
<p>I've tried this:</p>
<pre><code> SqlConnection myConnection = new SqlConnection("server=localhost;" +
"Trusted_Connection=yes;" +
"database=mmcinfo.mdf;");
</code></pre>
<p>But i get an error on the myConnection.Open(); saying:</p>
<blockquote>
<p>SqlException was unhandled by user code A network-related or
instance-specific error occurred while establishing a connection to
SQL Server. The server was not found or was not accessible. Verify
that the instance name is correct and that SQL Server is configured to
allow remote connections. (provider: Named Pipes Provider, error: 40 -
Could not open a connection to SQL Server)</p>
</blockquote>
<p>I know im doing something wrong in calling the right database/server etc but i havent got a clue how to fix this.</p>
| asp.net | [9] |
4,957,634 | 4,957,635 | Does the Java constructor return an object or an object's ID when called? | <p>I want to know if a constructor in Java returns something. I know there is no return value like '5' or "Hello World." But if we are assigning a variable to it:</p>
<pre><code>People person = new People();
</code></pre>
<p>Then wouldn't it logically make sense for the object or ID to be returned? Is the reference in memory where the object is stored assigned to people? </p>
<p>I am just thinking about this now because I am learning python, and want to connect the <code>__new__</code> method to a constructor and then <code>__init__</code> to the body of the constructor (i.e. the initial values). My professor keeps telling me <code>__new__</code> doesn't exist, so I am hoping to get an answer to make things clearer. </p>
| java | [1] |
5,603,941 | 5,603,942 | how to call getExtra() without getIntent() in android? | <p>I am new to android and I want to <code>getExtra()</code> without the use of <code>getIntent()</code>.
Is this possible?
If yes, then how? </p>
| android | [4] |
5,905,142 | 5,905,143 | Dateformat with nullable variable | <p>I have this code:</p>
<pre><code> startWeekDate = startWeekDate == null ? DateTimeHelpers.calcMondayDate(DateTime.Now) : DateTimeHelpers.calcMondayDate(startWeekDate.Value);
DateTime endWeekDate = startWeekDate.Value.AddDays(6);
</code></pre>
<p>startWeekDate is a parameter that is nullable. This works good, but I want to format it with: String.Format("{d:0}", .... ) but when I slap that around it I get error.</p>
<p>Cannot implicitly convert type 'string' to 'System.DateTime?</p>
<p>How shall I fix this problem?</p>
<p>/M</p>
<p>EDIT:</p>
<p>I'm trying to add this to the function instead, since it should always return dateformat without clock, but I get same error there with this code:</p>
<pre><code> public static DateTime calcMondayDate(DateTime input)
{
int delta = DayOfWeek.Monday - input.DayOfWeek;
DateTime monday = String.Format("{d:0}", input.AddDays(delta));
return monday;
}
</code></pre>
<p>Cannot implicitly convert type 'string' to 'System.DateTime'</p>
<p>hmm, but input is DateTime, why does it complain about it being string?</p>
| c# | [0] |
3,978,596 | 3,978,597 | Does Webconfig in asp.net is same for Multiple Users or diffrent? | <p>Does Webconfig in asp.net is same for Multiple Users or diffrent?</p>
| asp.net | [9] |
1,477,344 | 1,477,345 | How to zero-initialize an union? | <p>Consider the following code:</p>
<pre><code>struct T {
int a;
union {
struct {
int a;
} s1;
struct {
char b[1024];
} s2;
};
};
int main() {
T x = T();
}
</code></pre>
<p>Since an explicit constructor is called, the above code ends-up zero-initializing all the data members in x.</p>
<p>But I would like to have x zero-initialized even if an explicit is not called. To do that one idea would be to initialize the data members in their declaration, which seems to be okay for T::a. But how can I zero-initialize all the memory occupied by the union by using
the same criteria?</p>
<pre><code>struct T {
int a = 0;
union {
struct {
int a;
} s1;
struct {
char b[1024];
} s2;
};
};
int main() {
T x; // I want x to be zero-initialized
}
</code></pre>
| c++ | [6] |
3,548,112 | 3,548,113 | How to sort OrderedDict in OrderedDict - Python | <p>about 3h ago I have started to sort OrderedDict in OrderedDict by <strong>'depth'</strong> key, to this time results are 000%... so i ask u for help...
Is there any solution to sort that Dictionary ? </p>
<pre><code>OrderedDict([
(2, OrderedDict([
('depth', 0),
('height', 51),
('width', 51),
('id', 100)
])),
(1, OrderedDict([
('depth', 2),
('height', 51),
('width', 51),
('id', 55)
])),
(0, OrderedDict([
('depth', 1),
('height', 51),
('width', 51),
('id', 48)
])),
])
</code></pre>
<p>Sorted dict schould look like this:</p>
<pre><code>OrderedDict([
(2, OrderedDict([
('depth', 0),
('height', 51),
('width', 51),
('id', 100)
])),
(0, OrderedDict([
('depth', 1),
('height', 51),
('width', 51),
('id', 48)
])),
(1, OrderedDict([
('depth', 2),
('height', 51),
('width', 51),
('id', 55)
])),
])
</code></pre>
<p>any idea how to get it? </p>
| python | [7] |
5,679,661 | 5,679,662 | Image overlay problem | <p>I have a problem with two image overlay. One big(from camera) and one small sign which need to be stick over the big image in the corner. This overlay image have to be shown in the gallery. My sign image is located in drawable-hdpi. </p>
<pre><code>bMap = BitmapFactory.decodeFile(bigImage);
bmSign = BitmapFactory.decodeResource(parent.getResources(), R.drawable.sign);
bmOverlay = Bitmap.createBitmap(bMap.getWidth(), bMap.getHeight(),
bMap.getConfig());
Canvas canvas = new Canvas(bmOverlay);
canvas.drawBitmap(bMap, 0, 0, null);
canvas.drawBitmap(scaleStar, 0, 0, null);
i.setImageBitmap(bmOverlay);
i.setLayoutParams(new Gallery.LayoutParams(computeWidth, imgHeight));
i.setScaleType(ImageView.ScaleType.FIT_XY);
</code></pre>
<p>Problem is the size of the sign. Because all of the images are fixed height I need fixed sized sign to be apply on every image. With my code, on different resolution I have different sign image. It can happens sign to overlay 3/4 of the image. </p>
<p>How can I fix this?</p>
| android | [4] |
2,809,202 | 2,809,203 | How can I change this code to make it work? | <p>I'm starting with Flask, and I'm having some problems with jQuery and (I think) Flask's templating system. What I wanted to do is very simple: I've included a <em>behavior.js</em> script in the layout master template <em>layout.html</em>, after the jQuery library. Its contents are:</p>
<pre><code>jQuery(document).ready(function() {
var events = $("#fake_grid td");
while(events.length > 0) {
$("#the_grid").append($("<tr/>").append(events.slice(0, 3)));
}
$("#fake_grid").remove();
});
</code></pre>
<p>When I try to execute this, my browser crashes, and I can't figure it out why and how to fix it. I've been thinking about jQuery doesn't loading properly or loading after my script, but I've checked with FireBug and everything in that matter works fine. I've tried replacing all that code with an alert() and that worked fine, too. I've tried including my .js in the child template <em>index.html</em>, in several different ways, but it wasn't that, for sure. Maybe it's something with the document readyness thing.</p>
<p>If it is something else, I'm unable to see it, and that's making me really anxious. So, any advice in what to do about this? What I'm doing wrong? Thanks in advance.</p>
| jquery | [5] |
2,910,359 | 2,910,360 | Application.EnableVisualStyles() not working | <p>I cann't make my application to apply Windows visual styles.
Application.EnableVisualStyles() in program.cs not changing RenderWithVisualStyle property to true.</p>
<pre><code> [STAThread]
public static void Main(string[] startArgument)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
.....
}
</code></pre>
<p>Interestingly if I'm debugging with "Enable visual studio hosting process", Application.EnableVisualStyles() works as expected, RenderWithVisualStyle goes to true and styles are applied. But no styles without hosting process either Debug or Release mode.
Changing target framework v.2 to v.3.5 makes nothing. </p>
<p>Any ideas please, I'm stuck with this issue and googling for 3 days with no success.</p>
<p>Many thanks</p>
| c# | [0] |
1,237,961 | 1,237,962 | Python odict: reordering keys | <p>I'd like to reorder keys in Python odict (not 2.7 OrderedDict).</p>
<p><a href="https://github.com/bluedynamics/odict" rel="nofollow">https://github.com/bluedynamics/odict</a></p>
<p>How I could implement moveAfter() and moveBefore() functions, so I could shuffle the keys around? Do any similar helper functions already exist through some Python magic?</p>
| python | [7] |
10,894 | 10,895 | Jquery's fadein 'slow' is too fast | <p>i'm using the jquery fadein fadeout with the slow option, but it's still a little too fast for me.
now i've read that you can only choose between fast and slow, but is there a way to make it slower?</p>
| jquery | [5] |
3,537,638 | 3,537,639 | Cleaning up MicroSD/Storage | <p>Are there any tools for cleaning up the storage on Android phones? Apps seem to be making folders everywhere and even when they are removed the folders still stay... </p>
<p>Can't tell which app uses or needs what directory, and manual removal feels like such a pain...</p>
| android | [4] |
1,997,203 | 1,997,204 | Array or Linked List | <p>I want to make a backup to my database, but before writing to a CSV file some data manipulation is needed.<br>
My idea is first create an array or linked list format the data (mainly insertion and calculations for specific items, including insertion in the middle of the array, the order is important), and then just write the array items to file.<br>
Each item has the same fields.
The ammount of data is really big.<br>
What is prefferable in this case? Array or Linked List?</p>
| php | [2] |
576,104 | 576,105 | Android ListView sorted by checked items | <p>I use a ListView with android.R.layout.simple_list_item_multiple_choice as list items. I want to sort the list (and maybe group the list) that checked items are on top of the list. I looked at the Comparator but it only lets me sort the list by the entries name of the list.
How could that be done in a nice way? </p>
| android | [4] |
80,008 | 80,009 | How to use Split with TryParse? | <p>I'd rather not throw an exception if the user enters one or more invalid doubles in a textbox.
This is kind of what I'd like to do but it is wrong of course.</p>
<pre><code>double myDouble[];
double.TryParse(textBox1.Text.Split(' '), out myDouble);
</code></pre>
| c# | [0] |
4,779,750 | 4,779,751 | Android show "new" image only the first time | <p>I have deployed my app and it's in use. Every month or so I update it and add new features. I would like to show "new" image only the first time when the updated app is used by the user. How can I show it just once ? Where should I start ? </p>
| android | [4] |
4,797,702 | 4,797,703 | How to avoid if/elif/else when one value corresponds with another? | <p>What's a concise way to express a direct correlation between (apple, banana) and (red, yellow). Although it gets the result I need, I'm just not happy with this...</p>
<pre><code>if value == apple:
result = red
elif value == banana:
result = yellow
else:
result = None
</code></pre>
<p>Tough to search for, or even work out what to title this question, but I'm sure it's a basic exercise. Isn't it?</p>
| python | [7] |
3,643,053 | 3,643,054 | how to make array while looping another array in javascript | <pre><code>for (var i = 0; i < input.files.length; ++i) {
name = name.push(input.files[i].name)
}
</code></pre>
<p>I want to get the name of the files and put them in a array so I can post them to a php file to upload. Please help.</p>
<p>The variable name is the array I want to post.</p>
<p>is there a loop in javascript like foreach in php</p>
| javascript | [3] |
727,022 | 727,023 | How to handle Querystring in JavaScript? | <p>I have a js code:</p>
<pre><code> window.onload = function() {
document.getElementById("Button1").onclick = function() {
var t1 = document.getElementById("Text1").value;
var t2 = document.getElementById("Text2").value;
document.URL = 'myurl?t1=' + t1 + '&t2' + t2;
}
}
</code></pre>
<p>Here i am adding t1,t2 as query param..now my question is lets say i have entered some data in Textbox1 but not in textbox2, in that case the url I am getting is
<code>'myurl?t1=' + value of textbox1 + '&t2' + This will be blank;</code>
I want to make it dynamic, i.e.if there is not value in Textbox2 then I dont want to append queryparam t2, same goes for t1 also..isit possible?</p>
| javascript | [3] |
1,145,286 | 1,145,287 | Android: Detect when another Activity is launched (or your activity loses focus) | <p>Like the title says, I need to detect when my app loses focus because another app is launched (Phone call comes in, or user hits Home etc).</p>
<p>Overriding Activity.OnStop does not work because that is called even when switching activities within my app.</p>
| android | [4] |
774,881 | 774,882 | php what happens if 2 people append at the same time? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1209688/php-simultaneous-file-writes">PHP Simultaneous File Writes</a> </p>
</blockquote>
<p>Hello,</p>
<p>If I have a php script and a text file and 2 users append a long text string to the text file at the same time, what will happen? will it still go through? does it get buffered so both get appended on, or do they get dropped?</p>
| php | [2] |
2,428,514 | 2,428,515 | convert language of a div | <p>I am recently working in a project. There I need to convert language from English to Japanese by button click event. The text is in a div. Like this:</p>
<pre><code>"<div id="sampletext"> here is the text </div>"
"<div id="normaltext"> here is the text </div>"
</code></pre>
<p>The text is come from database. How can I convert this text easily?</p>
| php | [2] |
2,487,135 | 2,487,136 | Getting invocation target exception | <p>'import android . os . Bundle;'</p>
<p>import android.app.Activity;</p>
<p>import android.view.Menu;</p>
<p>import android.widget.TextView;</p>
<p>public class MainActivity extends Activity {
public native String stringJNI();</p>
<pre><code>static {
System . loadLibrary ("Androidqw");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView myTextField = (TextView)findViewById(R.id.myTextField);
myTextField.setText(stringJNI()); //get exception
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
</code></pre>
<p>}</p>
i got invocationTargetException in myTextField.setText(stringJNI()).I don't why i am getting this......minapplevel=10 targetapplevel=11 Please help me i m new to this</p>
| android | [4] |
5,280,266 | 5,280,267 | iPhone Developer License | <p>I wanted to know if we have a iPhone Developer Enterprise License, then is it possible to distribute our apps to a limited number of users (of our choice) through App Store? In other words, we would like our iPhone apps to be visible to a limited number of users (whom we have selected to preview our apps)</p>
<p>Also, is there any other way to distribute our apps other than the App Store?</p>
<p>Thanks,</p>
| iphone | [8] |
3,626,136 | 3,626,137 | Checkboxes and Lists | <p>I'm trying to make a list of items, where all these items can be either checked or unchecked. I want this UI window to pop up on top of my current window, kind of like <a href="http://developer.android.com/images/radio_buttons.png" rel="nofollow">this</a> but with a "Submit" dialog instead.</p>
<p>Can someone point me in the right direction, please?</p>
| android | [4] |
3,934,849 | 3,934,850 | Emptying a file with php | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2563691/php-is-there-a-command-that-can-delete-the-contents-of-a-file-without-opening-it">PHP: Is there a command that can delete the contents of a file without opening it?</a> </p>
</blockquote>
<p>How do you empty a .txt file on a server with a php command?</p>
| php | [2] |
3,620,940 | 3,620,941 | In-place editing of text in UITableViewCell? | <p>I know this has to be a really simple question, but I am having trouble finding it in a simple place where there aren't so many other things going on that I can isolate the specific behavior.</p>
<p>I know I need to add a UITextField as a subview to the UITableViewCell to make it editable. What is the best way to do this? (I see an example in UICatalog, but I am confused with all of the extra things it is doing with the Dictionary.)</p>
<p>Again, please excuse the ignorance of this question. A pointer to sample code or a screencast would be much appreciated.</p>
<p>Thanks in advance,</p>
<p>Alan</p>
| iphone | [8] |
5,523,157 | 5,523,158 | Multiple RegisterClientScriptBlock's | <p>I want to call 3 javascript functions on my .cs file, I tried this:</p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
ClientScriptManager script = Page.ClientScript;
ClientScriptManager script2 = Page.ClientScript;
ClientScriptManager script3 = Page.ClientScript;
script.RegisterClientScriptBlock(this.GetType(), "key", "centerPopup1()", true);
script2.RegisterClientScriptBlock(this.GetType(), "key", "loadPopup1()", true);
script3.RegisterClientScriptBlock(this.GetType(), "key", "msg1()", true);
}
}
</code></pre>
<p>With no success, nothing happens on my Postbacks, but if I try just calling one of these functions, it works.</p>
| asp.net | [9] |
1,273,537 | 1,273,538 | Android First App unable to create | <p>"problem in creating first android application without any error"</p>
<p>I am new to android application... I have already installed eclipse Juno and used it to run simple java programs. Then I downloaded Android SDK bundled with ADT, which has eclipse attached with it. Therefore, when I opened newly installed Eclipse ...</p>
<p>I found my old files made in existing IDE also accessed via new eclipse IDE.... and new-- > android app option was too showing </p>
<p>To resolve 2 IDE issue, I deleted old existing IDE in My laptop and using Bundled eclipse, created a new android application ..</p>
<p>But on clicking finish button when i was naming the file: the first step that is now not creating any package or application ..</p>
<p>and not showing any error message.. </p>
<p>"I have searched across Google found application creation problems are with error messages...."</p>
<p>but in my case No error message is shown .. still unable to create ...</p>
<p>Not getting what is the problem here..
please help me to find the problem thanks...</p>
| android | [4] |
4,083,037 | 4,083,038 | Split text typed into a text box into labels on another form | <p>I have already been able to split a first name and a last name. But the problem I am having is if someone decides to type in a middle initial or a middle name? Anyone know how I can go about doing this?</p>
<p>Here is the code I have so far:</p>
<pre><code>//Name Split
var fullname = strTextBox;
var names = fullname.Split(' ');
label3.Text = names[0];
label5.Text = names[1] + " " + names[2];</code></pre>
<p>This code works if the person types in a middle initial and a a last name. But is the user only types in a first and last name, the <code>names[2]</code> gives me the error since it cannot find another partition.</p>
<p>I would say that I have spent at least 10 hours trying to figure out a conditional to get this to work, but have not gotten it yet.</p>
<p>Here is one of the many conditionals I have tried:</p>
<pre><code>//Name Split
var fullname = strTextBox;
var names = fullname.Split(' ');
if (fullname.Contains (> 1 (' '))
{
label3.Text = names[0]; // first
label5.Text = names[1] + " " + names[2]; // middle initial
}
else
{
label3.Text = names[0];
label5.Text = names[1];
}</code></pre>
| c# | [0] |
4,416,522 | 4,416,523 | php file_get_contents and & | <p>I'm trying to use php's file_get_content('a url');</p>
<p>The thing is if the url has '&' in it, for example</p>
<p><code>file_get_contents('http://www.google.com/?var1=1&var2=2')</code> </p>
<p>it automatically make a requests to <code>www.google.com/?var1=1&amp<no space here>;var2=2</code> </p>
<p>How do I prevent that from happening?</p>
| php | [2] |
1,105,312 | 1,105,313 | Android: Alarm Manager | <p>this is the code</p>
<pre><code>public void startAlarm(Context context) {
Intent intent = new Intent(context, SyncService.class);
PendingIntent sender = PendingIntent.getService(context, 0, intent, 0);
AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
10 min, 20 min, sender);
}
</code></pre>
<p>This is my method where i start my alarm...I use it in my main activity in onCreate method...What if i change something in settings, and I want to change a time of Repeating ? How to do that ? I should kill that one and start new one ?</p>
| android | [4] |
5,024,029 | 5,024,030 | Create new xml using python | <pre><code>import xml.etree.ElementTree as ET
doc = ET.parse("users.xml")
root = doc.getroot() #Returns the root element for this tree.
root.keys() #Returns the elements attribute names as a list. The names are returned in an arbitrary order
for child in root:
username = child.attrib['username']
password = child.attrib['password']
grant_admin_rights = child.attrib['grant_admin_rights']
create_private_share = child.attrib['create_private_share']
uid = child.attrib['uid']
root = ET.Element("users")
user = ET.SubElement(root, "user")
user.set("username",username)
user.set("password",password)
user.set("grant_admin_rights",grant_admin_rights)
user.set("create_private_share",create_private_share)
user.set("uid",uid)
tree = ET.ElementTree(root)
myxml = tree.write("new.xml")
</code></pre>
<p>output of this code :-</p>
<pre><code><users><user create_private_share="no" grant_admin_rights="no" password="sp" uid
="1000" username="us" /></users>
</code></pre>
<p>But am trying to make it like this :-</p>
<pre><code><users>
<user create_private_share="no" grant_admin_rights="no" password="sp" uid
="1000" username="us" ><group>hfhfhf</group> </user>
</users>
</code></pre>
<p>instead of this <code><user /></code>, am trying <code><user> <group>fgfg</group> </user></code> . Thanks </p>
| python | [7] |
5,617,284 | 5,617,285 | Using Jquery to open loading.gif | <p>What is the easiest way to implement a page load / loading.gif using jquery, just like any other sites.. It needs white out the page and show loading.gif in the middle of it, until the page loads..
I do not want to write it halfway down the page so it doesn't even have a purpose, i would like for this to load first thing on the page.. Is there a way i can do this without writing static divs on that page? Preferrably a .js file that does it all without any writing div's/etc to the page?</p>
| jquery | [5] |
5,224,088 | 5,224,089 | Android ksoap2 with https | <p>i want to implement ksoap2 webservice using https. i didnt found any tutorial for the same. i found the tutorial for http(i implemented it nd working fine) but not for https...</p>
<p>pls help me in this case..any code will be very helpfull.</p>
<p>thanks in advance..</p>
| android | [4] |
5,859,893 | 5,859,894 | TextView setText options | <p>Trying to set a TextView, to a certain message containing a variable.</p>
<p>for Example</p>
<pre><code>tvOddEven.setText("You have entered:", odd, "% of numbers");
</code></pre>
<p>odd is an int variable</p>
<p>it's giving me an error, that I can't use those parameters.</p>
<p>ideas?</p>
| android | [4] |
1,802,542 | 1,802,543 | how do i validate a textbox in asp for unbalanced parentheses | <p>I want to validate an ASP textbox for unbalanced parenthesis. Like i want to display an error if the user starts a curly bracket but does not end it in a textbox.</p>
<p>Thanks</p>
| asp.net | [9] |
3,772,019 | 3,772,020 | jquery check if it is clicked or not | <pre><code>$(element).click(function(){
});
</code></pre>
<p>How can i check if the element is clicked or not ? I'm doing like that </p>
<pre><code>function element(){
$("#element").click(function(){
return 0;
});
}
if(element()==0){
alert("yes");
}else{
alert("no");
}
</code></pre>
<p>But it's not returning anything.</p>
| jquery | [5] |
5,512,521 | 5,512,522 | Where to publish java articles? | <p>I have some themes I would like to talk/write about Java that would be useful for others, and I would like to know sites where I can publish those articles / monographs.</p>
<p>Any advice , suggestion ?</p>
| java | [1] |
4,195,964 | 4,195,965 | App works on real phones but no longer on emulator | <p>My app works on two different phones, but it no longer works on the emulator. I immediately get the stopped unexpectedly error on the emulator. I have rebooted my computer, and it did not change things. I am at wits end!</p>
<p>The debugger shows this:</p>
<pre><code>Thread [<1> main] (Suspended (exception RuntimeException))
ActivityThread.performLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2663
ActivityThread.handleLaunchActivity(ActivityThread$ActivityRecord, Intent) line: 2679
ActivityThread.access$2300(ActivityThread, ActivityThread$ActivityRecord, Intent) line: 125
ActivityThread$H.handleMessage(Message) line: 2033
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 123
ActivityThread.main(String[]) line: 4627
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 521
ZygoteInit$MethodAndArgsCaller.run() line: 868
ZygoteInit.main(String[]) line: 626
NativeStart.main(String[]) line: not available [native method]
</code></pre>
| android | [4] |
3,490,656 | 3,490,657 | Android WebView: Tel: Geo: Mailto: Proper Handling | <p>Can someone please help explain how to handle Tel: Geo: and Mailto: links correctly using WebView. </p>
<p>Currently all links result in a "page cannot be displayed" error.</p>
<p>Below is the code I'm using which was put together from other suggested solutions:</p>
<pre><code>mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setBuiltInZoomControls(true);
mWebView.getSettings().setUseWideViewPort(true);
mWebView.loadUrl("http://www.google.com");
mWebView.setWebViewClient(new HelloWebViewClient());
}
private class HelloWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.startsWith("tel:")) {
startActivity(new Intent(Intent.ACTION_DIAL, Uri.parse(url)));
return true;
} else if (url.startsWith("mailto:")) {
url = url.replaceFirst("mailto:", "");
url = url.trim();
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("plain/text").putExtra(Intent.EXTRA_EMAIL, new String[]{url});
startActivity(i);
return true;
} else if (url.startsWith("geo:")) {
Intent searchAddress = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(searchAddress);
return true;
} else {
view.loadUrl(url);
return true;
}
}
}
</code></pre>
<p>}</p>
| android | [4] |
516,354 | 516,355 | Retrieve functions from a global variable | <p>Is it possible to retrieve all the functions included in a global variable?</p>
<p>I'm using a very complex plugin (not written by me) that call the functions in this way:</p>
<pre><code>$GLOBALS['myplugin']->member->isActive()
</code></pre>
<p>Is there a way to retreive all the functions of <code>$GLOBALS['myplugin']->member</code>?</p>
| php | [2] |
445,833 | 445,834 | Failure delivering result ResultInfo{who=null, request=0, result=-1, data=null} to activity | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3275749/im-getting-a-nullpointerexception-when-i-use-action-image-capture-to-take-a-pict">I'm getting a NullPointerException when I use ACTION_IMAGE_CAPTURE to take a picture</a> </p>
</blockquote>
<p>I have some code. </p>
<pre><code>Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
File photo = new File(CamDir, filename);
imageUri = Uri.fromFile(photo);
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo));
startActivityForResult(intent, 0);
public void onActivityResult(int requestCode, int resultCode, Intent data) {
Bitmap bitmap = null;
if (resultCode == Activity.RESULT_OK && requestCode == 0) {
Uri selectedImage = imageUri;
ContentResolver cr = getContentResolver();
bitmap = android.provider.MediaStore.Images.Media.getBitmap(cr, selectedImage);
}
</code></pre>
<p>1.the phone in vertical position.<br>
2.start the application.<br>
3.press the button to take a photo.<br>
4.press Ok. (save photo)<br>
Everything fine.</p>
<p>1.the phone in vertical position.<br>
2.start the application.<br>
3.press the button to take a photo.<br>
4.rotate the phone to horizontal position.<br>
5.press Ok. (save photo)<br>
Have error </p>
<pre><code>E/AndroidRuntime(22779): java.lang.RuntimeException: Failure delivering result
ResultInfo{who=null, request=0, result=-1, data=null} to activity
com.photo/com.photo.PhotoActivity}:
java.lang.NullPointerException
</code></pre>
<p>I think when I rotate the phone to horizontal position intent was reloaded, and camera not<br>
know where to send results.<br>
How to fix this problem.</p>
| android | [4] |
5,038,276 | 5,038,277 | how can i auto align a div to <a> tag on document | <p>i have a div i.e</p>
<pre><code><div id="data_sprite">Jquery ajax data here</div>
</code></pre>
<p>and it is invisible....</p>
<p>now suppose i have my first <code><a></code> tag on top of document and 2nd <code><a></code> tag on bottom of document...
now what i want is that if i click on <code><a></code> on top of page the div auto align with its top right corner and when i click on <code><a></code> at bottom the div should auto align with its top right corner how can i achieve that with jquery or what ever....</p>
| jquery | [5] |
83,021 | 83,022 | How to make this in fewer keystrokes? | <p>My program is written in python and I use pythontidy and reindent to clean it. However I'd like a more efficient method than renaming the file, should I just look at the doc to know how to now get forced to rename files and make pythontidy behave more like reindent i.e. enable it to run on all files in a directory just by running it:</p>
<pre><code>$ python ./PythonTidy-1.20.py mai
mailman.py main.old.py main.py main.py.bak main.pyc
ubuntu@ubuntu:/media/Lexar/montao/montaoproject$ python ./PythonTidy-1.20.py main.py main.tidy.py
ubuntu@ubuntu:/media/Lexar/montao/montaoproject$ python ./PythonTidy-1.20.py i18n.py i18n.tidy.py
ubuntu@ubuntu:/media/Lexar/montao/montaoproject$ mv i18n.tidy.py i18n.py
ubuntu@ubuntu:/media/Lexar/montao/montaoproject$ mv main.tidy.py main.py
ubuntu@ubuntu:/media/Lexar/montao/montaoproject$ python ./reindent .
python: can't open file './reindent': [Errno 2] No such file or directory
ubuntu@ubuntu:/media/Lexar/montao/montaoproject$ python ./reindent.py .
reindented ./appengine_config.py
reindented ./i18n.py
reindented ./main.py
reindented ./util.py
reindented ./facebookapi.py
reindented ./br.py
reindented ./PythonTidy-1.20.py
reindented ./in.old.py
reindented ./login_required.py
ubuntu@ubuntu:/media/Lexar/montao/montaoproject$
</code></pre>
| python | [7] |
3,676,911 | 3,676,912 | Make a client download a file from a path that is not publicly accessible? | <p>I'm looking to implement a way to keep files private so they cant be publicly re-downloaded and only allow the server side code (like a button) to pull them from a private directory for the client on a one time basis. </p>
<p>Is that even possible?</p>
<p>Even if the folder is publicly available, What is a good way of firing an event that makes how many times the file has been downloaded so i can track that and make a service that deletes them after they've reached a download limit? I suppose i could just do a Response.redirect to the file and then the logic to track how many times its been downloaded. But is that the way you would do it?</p>
<p>EDIT: After some digging i've found a solution. I know many of you have downvoted this for not including sample code but I would appreciate if you can upvote it back for sharing the code I ended up using for it, since it works quite well.</p>
<pre><code>String FileName = "File.zip";
String FilePath = "C:/Test/" + FileName; //Replace this
System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
response.ClearContent();
response.Clear();
response.ContentType = "text/plain";
response.AddHeader("Content-Disposition", "attachment; filename=" + FileName + ";");
response.TransmitFile(FilePath);
response.Flush();
response.End();
</code></pre>
| c# | [0] |
157,294 | 157,295 | Read .bmp image and subtract 10 from 10th byte of the image and re-create the image in Java | <p>I am creating an application which will read image byte/pixel/data from an .bmp image and store it in an byte/char/int/etc array.</p>
<p>Now, from this array, I want to subtract 10 (in decimal) from the data stored in the 10th index of an array.</p>
<p>I am able to successfully store the image information in the array created. But when I try to write the array information back to .bmp image, the image created is not viewable.</p>
<p>This is the piece of code which I tried to do so.</p>
<p>In this code, I am not subtracting 10 from the 10th index of an array.</p>
<p>public class Test1 {</p>
<pre><code>public static void main(String[] args) throws IOException{
File inputFile = new File("d://test.bmp");
FileReader inputStream = new FileReader("d://test.bmp");
FileOutputStream outputStream = new FileOutputStream("d://test1.bmp");
/*
* Create byte array large enough to hold the content of the file.
* Use File.length to determine size of the file in bytes.
*/
byte fileContent[] = new byte[(int)inputFile.length()];
for(int i = 0; i < (int)inputFile.length(); i++){
fileContent[i] = (byte) inputStream.read();
}
for(int i = 0; i < (int)inputFile.length(); i++){
outputStream.write(fileContent[i]);
}
outputStream.flush();
outputStream.close();
}
</code></pre>
<p>}</p>
| java | [1] |
5,483,275 | 5,483,276 | SQLCE Subquery for smart device application | <p>I crate two tables name abc1 and xyz.
abc1 having column id, name and add. where xyz table having id, mob.</p>
<p>select name from abc1 where id =(select id from xyz)</p>
<p>getting an error There was an error parsing the query. [ Token line number = 1,Token line offset = 34,Token in error = select ]</p>
<p>please help me on this query.</p>
| c# | [0] |
5,093,895 | 5,093,896 | What datatype supports this kind of operation? | <p>I am currently writing a machine simulator, and this machine has 256 registers, each have their unique name, index and data. What kind of datatype would support this operation?</p>
<p>Below are some example operations:</p>
<pre><code>String output = Registers.RegA.data.toString(); //Returns the value of RegA
System.out.println(output);
Registers A = Registers.RegA; //points A to RegA
Registers AA = Registers.at(0) //Index access Registers, which returns RegA in this case.
A.data = new DataObj("I am a pie");
output = AA.data.toString(); //A and AA both point to RegA, therefore they share the same data
System.out.println(output);
//Expected output: "I am a pie"
output = Registers.RegA.data.toString(); //RegA data is shared across the system
System.out.println(output);
//Expected output: "I am a pie"
</code></pre>
<p>What kind data type would support above operations?</p>
| java | [1] |
5,555,739 | 5,555,740 | Assigning a function (which is assigned dynamically) along with specific parameters, to a variable. | <p>Ok, so here's the deal, say I have a function( take_action ), that calls another function. But we don't know which function take_action is going to call.</p>
<p>I had that part figured out thanks to <a href="http://stackoverflow.com/questions/4246000/python-calling-functions-dynamically">this question</a>, the thing is, on that question they deal with functions that take no arguments, my take_action could take one of several different functions that are quite different from each other, with completely different actions taken, different arguments.</p>
<p>Now for some example code:</p>
<pre><code>def take_action():
action['action']()
#does other stuff with 'other_stuff_in_the_dic'
def move(x,y):
#stuff happens
action = {'action': move, 'other_stuff_in_the_dic': 'stuff' }
</code></pre>
<p>(In this case the 'action' would be move, but like I said, that's assigned dynamically depending on certain user input)</p>
<p>What I would like to do, is something like this:</p>
<pre><code>action = { 'action': move(2,3), 'other_stuff': 'stuff' }
</code></pre>
<p>(Obviously that calls the function there, since it has the (), hence it wouldn't work)</p>
<p>I'm only a beginner programmer, and the only thing I thought of is using a list, which is in another key inside the dic, but that would just pass one list argument, instead of each content of the list being passed on as an argument.</p>
<p>What would be a way to achieve this, so the 'action' key (or the dictionary on another key?) also stores the arguments it should use when I call it on take_action?</p>
| python | [7] |
608,600 | 608,601 | Dynamically add and remove component on button click? | <p>How can i add and remove dynamically component through jquery?</p>
<p>I want on click Add on my page add one row and then in that row there will be new text box
and same in delete on click Delete button on my page selected checkbox rows must ve deleted with its components like text box</p>
<p>how would i do with jquery?</p>
| jquery | [5] |
5,845,979 | 5,845,980 | ANDROID: call many Activity from another Activity | <p>I try to call 2 Activities from the main Activity. however, the first Activity didn't work, just the second worked correctly. But when I just called one Activity, it run well. So i think the problem is that I can't call 2 Activities at the same time:</p>
<p>this is my code
the main Activity:</p>
<p>[CODE]</p>
<pre><code>package com.example.Test2;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ToggleButton;
import at.abraxas.amarino.Amarino;
import com.example.Test2.subclass;;
public class Test2Activity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final String DEVICE_ADDRESS = "00:06:66:43:9B:56";
Amarino.connect(this, DEVICE_ADDRESS);
Intent i1 = new Intent(this, subclass.class);
Intent i2 = new Intent(this, subclass1.class);
startActivity(i2);
startActivity(i1);
}
}
</code></pre>
<p>The subclass:</p>
<p>[CODE]</p>
<pre><code>package com.example.Test2;
public class subclass extends Activity implements OnCheckedChangeListener{
// subclass code
}
</code></pre>
<p>[/CODE]</p>
<p>the subclass1</p>
<p>[CODE]</p>
<pre><code>package com.example.Test2;
public class subclass1 extends Activity implements OnSeekBarChangeListener{
// subclass1 code
}
</code></pre>
<p>[/CODE]</p>
<p>I also declare 2 Activities: subclass and subclass1 in manifest file</p>
<p>thank you very much for helping </p>
| android | [4] |
2,820,883 | 2,820,884 | Open word document from ASP.NET application | <p>I use the following code snippet to open a local docx file and it runs fine when I press Ctrl+F5 in Visual Studio. I just click the button and the Word2007 on my machine is opened and the docx is displayed there. But after I publish the application to the production server, it didn't work. After I click the same button, nothing happened. Could someone tell me why? </p>
<p>What I want is to open a local stored docx in client side's Word 2007 from asp.net application. I don't want to use office COM object.</p>
<p>My code:</p>
<pre><code> ProcessStartInfo psi = new ProcessStartInfo(@"winword.exe",@"/test.docx");
Process.Start(psi);
</code></pre>
<p>Many thanks.</p>
| asp.net | [9] |
4,283,704 | 4,283,705 | Is it not necessary to define a class member function? | <p>The following code compiles and runs perfectly,</p>
<pre><code>#include <iostream>
class sam {
public:
void func1();
int func2();
};
int main() {
sam s;
}
</code></pre>
<p>Should it not produce a error for the lack of class member definition?</p>
| c++ | [6] |
5,361,466 | 5,361,467 | Asp.Net wizard Storing State | <p>I'm confuse about which method is best for storing data when we use wizard.
Is it best to use Session or Database?</p>
| asp.net | [9] |
4,472,726 | 4,472,727 | Opening a specific Android home screen page | <p>I am trying to create an Android service that causes a specific home screen page to open when the Droid is placed in the Car Dock instead of having it open the Car Home application. I cannot find any reference to how to specify a home screen page other than the center page that always gets displayed when pressing the Home button by using CATEGORY_HOME. Does anyone know how I would have my application open a specific page?</p>
| android | [4] |
3,537,415 | 3,537,416 | How to check a geopoint is within some geographical area | <p>I want to make an android application in which,i want to know my current location is within which specific police station.First tell me is it possible or not ,if possible give some idea</p>
<p>Thanks in advance.</p>
| android | [4] |
725,931 | 725,932 | Array of pairs, gibberish output (unallocated memory?) | <p>Coming from Java I was trying to implement a simple Battleships game in C++ but already got stuck at this Array:</p>
<pre><code>#include <iostream>
#include <utility>
using namespace std;
class Ship{
private:
int length;
bool direction; //false = left, true = down
pair <int,int> coords[];
public:
Ship(int x, int y, bool, int);
void printship();
};
Ship::Ship(int x, int y, bool dir, int l){
pair <int,int> coords[l];
length = l;
if (dir){
for (int i = 0; i < l; i++){
coords[i] = make_pair(x, y+i);
}
}
else{
for (int i = 0; i < l; i++){
coords[i] = make_pair(x+i, y);
}
}
}
void Ship::printship(){
for (int i = 0; i < length; i++){
cout << "x: " << coords[i].first << ", y: " << coords[i].second << endl;
}
}
int main(){
Ship tests(2,3,true,3);
tests.printship();
return 0;
}
</code></pre>
<p>What I get is:</p>
<pre><code>x: 134515168, y: 0
x: 0, y: 9938131
x: 1, y: -1080624940
</code></pre>
<p>I guess something is pointing to unallocated memory, but I can't figure out what, and why.</p>
| c++ | [6] |
2,794,158 | 2,794,159 | Get filtered row in a gridview | <p>Is there any way to get the filtered rows from a gridview control?</p>
<p>Best regards,</p>
| asp.net | [9] |
4,389,667 | 4,389,668 | Extract values of innerHTML using JQUERY | <p>FF doesn't support InnerText Property. So if i use innerHTML i get <code>"<NOBR>0057</NOBR>"</code>. I want to extract 0057 value. How can i get value of innerHTML without html tags using JQuery</p>
| jquery | [5] |
992,762 | 992,763 | Jquery: animate invalid | <p>Here is my code:</p>
<pre><code> elem.animate({ background-image: "url(" + imagedir + backgrounds[i] + ")" }, 1500 );
});
</code></pre>
<p>But apparently this is invalid, can anyone see why?</p>
| jquery | [5] |
575,934 | 575,935 | Android OpenCV on Motorola devices... | <p>I've been reading that there is a problem using the OpenCV for Android library on Motorola devices. Here is the link to the OpenCV library: <a href="http://code.opencv.org/projects/opencv/wiki/OpenCV4Android" rel="nofollow">http://code.opencv.org/projects/opencv/wiki/OpenCV4Android</a> And here is a link to the issue report: <a href="http://code.opencv.org/issues/1244" rel="nofollow">http://code.opencv.org/issues/1244</a> The issue report lists the target version for the fix to be 2.5 (currently at 2.4). Does anyone have any first hand experience with these issues and any workarounds for the current version of the library? From the OpenCV Google Group there seems to be some discussion about using the "Java Camera" instead of the "OpenCV native" camera. I'm not sure what they mean by this. Thanks for the help! --amb</p>
<p>NOTE: Posted this on gamedev a few days ago, but got zero replies so far...
<a href="http://gamedev.stackexchange.com/questions/29801/android-opencv-on-motorola-devices">http://gamedev.stackexchange.com/questions/29801/android-opencv-on-motorola-devices</a></p>
| android | [4] |
1,532,653 | 1,532,654 | Can a user modify a PHP session? | <p>Page1.php:</p>
<pre><code><?php
session_start();
if ($_POST['password'] == "testpass")
$_SESSION['authenticated'] = true;
?></code></pre>
<p>Page2.php</p>
<pre><code><?php
session_start();
if (isset($_SESSION['authenticated']) && $_SESSION['authenticated'] == true) {
echo "Super secret stuff!";
}
?></code></pre>
<p>Can a user get in without the super secure password?</p>
| php | [2] |
4,675,519 | 4,675,520 | Help in fpdf imade display | <p>Hello every one i m using fpdf libray to creat pdf files from html form.</p>
<p>i m using</p>
<pre><code>$pdf->Image('C:/DOCUME%7E1/mypic.PNG',60,140,120,0,'','');
</code></pre>
<p>to display image on pdf.</p>
<p>in its first parameter it asks for exact path.it doesn't accept anyaddress variable here.
but i want to make dynamic.i have able to get a complete path in an variable.</p>
<p>i have printed this variable.</p>
<pre><code>//////////////////////////////
echo "$path";
</code></pre>
<p>output</p>
<pre><code>////////////////////
C:/DOCUME%7E1/mypic.PNG
/////////////////////////////////////////////////////
</code></pre>
<p>but how i put that path from variable in this parameter.?
when i use this variable as in this function.it give error.</p>
<pre><code>$pdf->Image('$path',60,140,120,0,'','');
</code></pre>
<p>plz help me for this.</p>
| php | [2] |
506,055 | 506,056 | Performance issue with DictionaryEntry looping | <p>Currently I have 231556 of words collection and do below loop to check every words for duplication.</p>
<p>I am using this function :-</p>
<pre><code>public bool IsContainStringCIAI(string wordIn, HybridDictionary hd, out string wordOut)
{
int iValue = 1;
foreach (DictionaryEntry de2 in hd)
{
iValue = CultureInfo.CurrentCulture.CompareInfo.Compare(wordIn.ToLower(), de2.Key.ToString().ToLower(), CompareOptions.IgnoreNonSpace);
if (iValue == 0)
{
wordOut = de2.Key.ToString(); //Assign the existing word
return true;
}
}
wordOut = wordIn;
return false;
}
</code></pre>
<p>It take around 20 hours to finish looping, because each word will be added in to dictionary after comparing if it is not same. Anything can I do to improve this loop? Thanks before.</p>
| c# | [0] |
4,006,379 | 4,006,380 | how can I hide a popup box when the user clicks elsewhere? | <p>My popup box appears when I click on the button, and it only disappears when I click again on the button. This is my code:</p>
<pre><code> $(document).ready(function() {
$('a.signUp, a.signIn').click(function() {
//Getting the variable's value from a link
var popupBox = $(this).attr('href');
if ($(popupBox).css('display')=='none'){
// Add the mask to body
$('#mask').show();
//Fade in the Popup
$(popupBox).fadeIn(300);
} else {
//Fade out box, and hide the mask
$(popupBox).fadeOut(300 , function() {
$('#mask').hide();
});
}
return false;
});
});
</code></pre>
<p>So there are two button, made with and that is why I get the variables value from a link. How can I make the boxes disappear when I click anywhere outside the box? </p>
| jquery | [5] |
4,741,014 | 4,741,015 | How to create a uncloseable process in java | <p>Iam working on small silent program now days , But I have a small proplem I want to make my program uncloseable .</p>
<p>My Program Dosen't have a GUI ( It's Silent App ) , So I want to make my program uncloseable when the user try to close it using Ctrl + Alt + Delete [ The Task Manager in Windows ] .</p>
<p>I see many programs works in this way , so I want to know how to make it in JAVA ?!</p>
<p>At the end , make sure my program is not a virus or something dangerous !</p>
| java | [1] |
2,130,210 | 2,130,211 | What is the difference between base-, array- and cursor-adapter | <p>Should I use array adapter or base adapter or cursor adapter?
What do you use most? I found some code that uses base adapter for fragments. Can I use array adapter or cursoradapter for listfragments? </p>
<p>I know how to use listview in a simple way like using the android.r.simple. I want to know what I should use in creating a listview that uses listfragment and populating it with data that came from SQLite. </p>
<p>What is the easiest adapter to use to achieve this?</p>
| android | [4] |
2,428,481 | 2,428,482 | jQuery .offset from the bottom position not working in a scroll function? | <p>I'm having trouble setting 2 positions on a scroll function using offset.</p>
<p>I have created a fiddle so you can see... <a href="http://jsfiddle.net/motocomdigital/SGCHt/12/" rel="nofollow">http://jsfiddle.net/motocomdigital/SGCHt/12/</a></p>
<p>When you open this fiddle, reduce the fiddle preview viewport down to the similar size of the screenshot below.</p>
<p><img src="http://i.stack.imgur.com/30tsc.png" alt="enter image description here"></p>
<p><strong>MY PROBLEM</strong></p>
<p>You can see I'm using conditional statements to control the positioning of the blue tabs, depending on what scroll point they are at.</p>
<p>The yellow columns represent the tab containers, and I'm tyring to use a <code>if else</code> statement to control the bottom positioning so the blue tabs never go outside the yellow containers.</p>
<p>But I can't get this to work. My bottom positon offset does not work.</p>
<pre><code>var $tab = $('.tab-button');
$(window).bind("resize.browsersize", function() {
var windowHalf = $(window).height() / 2,
content = $("#content"),
pos = content.offset();
$(window).scroll(function(){
if ($(window).scrollTop() >= pos.top + windowHalf ){
$tab.removeAttr('style').css({ position:'fixed', top:'50%'});
} else if ($(window).scrollTop() >= pos.bottom + windowHalf ){
$tab.removeAttr('style').css({ position:'absolute', bottom:'0px'});
} else {
$tab.removeAttr('style').css({ top: $(window).height() + 'px' });
}
});
}).trigger("resize.browsersize");
</code></pre>
<p></p>
<p>Can anyone please help me understand where I'm going wrong.</p>
<p>Thanks
Josh</p>
| jquery | [5] |
5,703,829 | 5,703,830 | How to store the different timers in a dict or array in a plist to load each view | <p>I want to store the times to switch for each view in a dict or array in a plist. How i can do this. Thanks for answers</p>
| iphone | [8] |
5,531,456 | 5,531,457 | How to play video from remote URL in android? | <p>I am New to android my intention is to play video using Http.</p>
<p>But i am getting "Http Request Failed 404" Exception when iam trying to run my application in emulator.
can any one know this error?</p>
<p>plz help me Thanks in advance.</p>
| android | [4] |
2,184,117 | 2,184,118 | C# Getting an object's actual TypeDescriptionProvider or TypeDescriptor | <p>I realise that this is an unusual issue, but:</p>
<p>I have created a custom TypeDescriptionProvider that can store and return different <code>TypeDescriptors</code> based on the requested object Type. What I have noticed however is that regardless of the <code>TypeDescriptionProvider</code> associated with a Type (be-it custom or default) the <code>TypeDescriptor.GetProvider()</code> always returns an (internal class) <code>System.ComponentModel.TypeDescriptor.TypeDescriptionNode</code> object (some kind of wrapper around the actual <code>TypeDescriptionProvider</code>). In turn calling <code>GetTypeDescriptor()</code> on this object always returns a <code>System.ComponentModel.TypeDescriptor.TypeDescriptionNode.DefaultTypeDescriptor</code> object (another wrapper) and stranger still does not call the <code>TypeDescriptionProvider</code>'s actual <code>GetTypeDescriptor()</code> method.</p>
<p>Does this mean that there is really no way to get back either an object's actual <code>TypeDescriptionProvider</code> or its <code>TypeDescriptor</code> from its provider? The methods to return the classname, properties, etc. still work as expected on the <code>DefaultTypeDescriptor</code>, but I am unable to compare or find out if two objects use the same <code>TypeDescriptor</code> (which is what I need currently). </p>
<p>Does anyone know how to either get the actual <code>TypeDescriptionProvider</code>, or get the actual TypeDescriptor from the wrapped provider? </p>
<p>Thank you in advance.</p>
<p>Ex:</p>
<pre><code>public class TestTypeDescriptionProvider : TypeDescriptionProvider
{
private static Dictionary<Type, ICustomTypeDescriptor> _descriptors = new Dictionary<Type, ICustomTypeDescriptor>();
...static method to add to the cache...
public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance)
{
if (objectType == null)
return _descriptors[instance.GetType()];
return _descriptors[objectType];
}
}
...
TypeDescriptionProvider p = TypeDescriptor.GetProvider(obj.GetType()); //p is a TypeDescriptionNode
ICustomTypeDescriptor td = p.GetTypeDescriptor(obj); // td is a DefaultTypeDescriptor
</code></pre>
| c# | [0] |
526,402 | 526,403 | in constructor, no matching function call to | <p>My error</p>
<pre><code>gridlist.h: In constructor ‘GridList::GridList(WINDOW*, int, int, int, int, int)’:
gridlist.h:11:47: error: no matching function for call to ‘Window::Window()’
gridlist.h:11:47: note: candidates are:
window.h:13:3: note: Window::Window(WINDOW*, int, int, int, int, int)
</code></pre>
<p>My code</p>
<pre><code>GridList(WINDOW *parent = stdscr, int colors = MAG_WHITE, int height = GRIDLIST_HEIGHT, int width = GRIDLIST_WIDTH, int y = 0, int x = 0)
: Window(parent, colors, height, width, y, x) {
this->m_buttonCount = -1;
m_maxButtonsPerRow = ((GRIDLIST_WIDTH)/(BUTTON_WIDTH+BUTTON_SPACE_BETWEEN));
this->m_buttons = new Button *[50];
refresh();
}
</code></pre>
<p>I am a little unsure of what exactly it is trying to tell me and what I am doing wrong. I am passing the correct variable types to the class and the correct number of parameters. However it says I am trying to call <code>Window::Window()</code> with no parameters. Thanks in advance for any help.</p>
<p>The class Button compiles just fine, and is almost exactly the same.</p>
<pre><code>Button(WINDOW *parent = 0, int colors = STD_SCR, int height = BUTTON_WIDTH, int width = BUTTON_HEIGHT, int y = 0, int x = 0)
: Window(parent, colors, height, width, y, x) {
this->refresh();
}
</code></pre>
| c++ | [6] |
1,272,139 | 1,272,140 | Javascript - Change Alert Icon | <p>Is it possible change javascript alert icons? By default it is showing the warning icon.</p>
| javascript | [3] |
2,895,270 | 2,895,271 | how long will it take to overflow a long by mere increment (starting from zero)? | <p>If I have code like this</p>
<pre><code> for (long i = 0; i < Long.MAX_VALUE; i++)
{
//do something trivial
}
</code></pre>
<p>How long will it take theoretically for the loop to finish?</p>
| java | [1] |
266,509 | 266,510 | ajax slide show get images from database | <p>i had sideshow ajax and i want it get images form database
i used sql server 2000 and i had binary images</p>
<p>this is my code to select images from database</p>
<pre><code>public class SlidShow : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
using (SqlConnection con = Connection.GetConnection())
{
string Sql = "Select image from SlideShowImage Where Active=1 And Hig_Id=@Hig_Id";
System.Data.SqlClient.SqlCommand com = new SqlCommand(Sql, con);
com.CommandType= System.Data.CommandType.Text;
com.Parameters.Add(Parameter.NewInt("@Hig_Id", context.Request.QueryString["Hig_ID"].ToString()));
System.Data.SqlClient.SqlDataReader dr = com.ExecuteReader();
if (dr.Read() && dr != null)
{
Byte[] bytes1 = (Byte[])dr["image"];
context.Response.BinaryWrite(bytes1);
dr.Close();
}
}
}
</code></pre>
<hr>
<pre><code> [System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static AjaxControlToolkit.Slide[] GetSlides()
{
return new AjaxControlToolkit.Slide[] {
new AjaxControlToolkit.Slide("images/sharp_highlight_ref_img.jpg", "", ""),
new AjaxControlToolkit.Slide("images/products_fridg_img.jpg", "", ""),
new AjaxControlToolkit.Slide("images/sharp_home_highlight_img.jpg", "", "")
};
}
}
</code></pre>
| c# | [0] |
1,783,195 | 1,783,196 | Zoom Entire Screen Android | <p>Recently, I have been working on an app that requires that the entire screen be zoomed in and out by pinch zoom. In the past I have worked with zoomed singular ImageViews but I am a bit stumped on how to zoom everything on a screen.</p>
<p>For example, if a user where to pinch zoom in the center of the screen everything would stay relatively the same size of each other but it would give the appearance that the screen was zooming in.</p>
| android | [4] |
1,737,540 | 1,737,541 | App icon not showing up on emulator | <p>I created a simple splash screen application, and it works just fine only when i click the "Run" button in eclipse indigo, and I am not able to find the icon at all in the emulator.
Where is icon?! I ran it as android 4.0.3.</p>
| android | [4] |
5,423,226 | 5,423,227 | How do I paint Pictureboxes to Panel? | <p>I have 2 pictureboxes on a panel at two separate locations which will become Hidden after a certain time. I would like to paint the pictureboxes background image to the panel at the exact points in which the picturebox controls lay. I have looked at the MSDN library but I cannot seem to find out how to do this.</p>
<p>Thanks for any help</p>
| c# | [0] |
5,976,105 | 5,976,106 | Position of a character | <p>How can i get the position of a character in a string in python.</p>
<p>regards</p>
<p>Arun</p>
| python | [7] |
4,967,835 | 4,967,836 | How can I get the classname at runtime, but only the classname? | <p>How can I get the classname at runtime, but only the actual classname and not the whole "com.xyz.etc." ?</p>
<p>I mean only the part of the name after the last period</p>
| java | [1] |
605,421 | 605,422 | Factual questions about java | <p>My teacher gave out a practice exam on java recently and I'm curious to see how I did on the true/false part. I'm least confident about number one, so any explanation there would help a lot. </p>
<ol>
<li><p>In Java, a class can extend any number of abstract classes.<br/></p>
<blockquote>
<p>false. I don't quite understand why, is it just because in an inheriting class the the parent classes could cause a conflict?</p>
</blockquote></li>
<li><p>In Java, it is illegal to pass a parameter whose type is an abstract class.<br/></p>
<blockquote>
<p>False, abstract classes don't even have constructors...</p>
</blockquote></li>
<li><p>In Java, an abstract class can have any number of subclasses.<br/></p>
<blockquote>
<p>True. I can't think of anything that would restrict this.</p>
</blockquote></li>
<li><p>In Java, there is no restriction on the number of interfaces a class can implement.<br/></p>
<blockquote>
<p>True </p>
</blockquote></li>
<li><p>It is not possible to implement a stack as a doubly-linked list, because a stack requires access to only one end of the list, and a doubly-linked list provides access to both ends of the list.</p>
<blockquote>
<p>true. but it wouldn't be very efficient.</p>
</blockquote></li>
</ol>
| java | [1] |
5,548,902 | 5,548,903 | publish error in asp.net | <p>I have designed my web page successfully. I have to publish a web application.
I used this publish method; copy the file in <em>c:inetpub\wwwroot</em> all files copy
and then go to open run command inetmgr and open my web application.
The page errors are displayed.</p>
<blockquote>
<p>HTTP Error 500.19 - Internal Server Error The
requested page cannot be accessed because the related configuration
data for the page is invalid.</p>
<p>Detailed Error InformationModule IIS Web Core<br>
Notification BeginRequest
Handler Not yet determined
Error Code 0x80070021
Config Error This configuration section cannot be used at this
path. This
happens<br>
when the section is locked at a parent level. Locking is either
by default<br>
(overrideModeDefault="Deny"), or set explicitly by a location tag
with
overrideMode="Deny" or the legacy allowOverride="false". </p>
<pre><code>Config File \\?\C:\inetpub\wwwroot\sarav\sarav\web.config
Requested URL http://localhost:80/sarav/sarav/MainPage.aspx
Physical Path C:\inetpub\wwwroot\sarav\sarav\MainPage.aspx
Logon Method Not yet determined
Logon User Not yet determined
Collapse
<pre lang="xml">Config Source
121: </modules>
122: <handlers>
123: <remove
</code></pre>
<p>name="WebServiceHandlerFactory-Integrated"/></p>
</blockquote>
| asp.net | [9] |
4,263,917 | 4,263,918 | Vector of Vector of (member) function pointers | <p>I'm constructing an simple listener / callback mechanism, for my current experimental project. And i'm stuck with implementing a container structure what seems should be vector of vector of pointers. I choose this way because i want the root vector to simple have KEY of event type let's say is an enum (int), then at this key i want to store vector of pointers to available methods for this event type. In logical representation something like:</p>
<pre><code>[EVENT_TYPE_QUIT]
[ptr1]
[ptr2]
[ptr3]
[ptr4]
[....]
[EVENT_TYPE_HELLO]
[....]
[....]
typedef enum {
EVENT_TYPE_QUIT,
EVENT_TYPE_HELLO,
...
} EventType;
</code></pre>
<p>So the simplified implementation looks something like this (it's an template in reality but imagine T is any user type you can map an event).</p>
<pre><code>class EventMapper {
...
typedef void (T::*functionPtr)(); // simple pointer to T member function with no args.
std::vector< std::vector<functionPtr> > eventCallbacks;
void mapEvent(const EventType type, functionPtr callback) {
// here i need to map type to callback
// each type can have multiple callbacks
// T can have only distinct event types as "key"
// this i tried but doesn't work
eventCallbacks[type].push_back(callback);
}
...
}
</code></pre>
<p>The intended implementation would look something like:</p>
<pre><code>EventMapper<SupaDupaClass> mapper;
mapper.mapEvent(EVENT_TYPE_HELLO, &SupaDupaClass::didYouSayHello);
</code></pre>
<p>etc ... </p>
<p>I really would like to use vector instead of map for easier unique key assignment ?
Thank you</p>
| c++ | [6] |
283,741 | 283,742 | iphone- is it true that an app with push notification service needs to be on the app store? | <p>If i wanted to test an app with push notification service, does it have to be approved in the app store? </p>
| iphone | [8] |
1,099,080 | 1,099,081 | how to embed the whole <body> to a created new div with jQuery? | <p>I want to perform the sticky footer to a stand-for-a-long web project.
I'm required to create two top-level div and wrap up all the content inside of <code><body></code> into 'div-container', then to add 'div-footer' to the end of <code><body></code> or <code><html></code>
like</p>
<pre><code><body>
<div id='container'>
//all body
</div>
<div id='footer'>
</div>
</body>
</code></pre>
<p>How can i do it with jQuery? i tried but failed with the code below (coz 'container' don't know where to append),</p>
<pre><code>$(document).ready(function() {
addStikyFooter();
});
function addStikyFooter() {
$("<div id='container'></div>").append($('body'));
var footerHtml = "<div id='footer'>i'm testing!/footer>";
alert($('body').html());
}
</code></pre>
| jquery | [5] |
5,400,909 | 5,400,910 | Out of memory on long ListActivity | <p>I have a problem with a ListActivity, it loads a search result, 5 items at a time, and when it reach about 45 items, it throws an out of memory exception.</p>
<p>I load images from web server asyncronically. If I comment this, i can scroll to the bottom of the list (aprox 58 items) without problem. I Know i should call bitmap.Recycle() to gc the bitmaps i no longer use, but I dont find when i should call that.</p>
<pre><code>class ImageLoadingTask extends AsyncTask<String, Void, Bitmap> {
private final WeakReference<ImageView> imageViewReference;
String url;
public ImageLoadingTask(ImageView imageView) {
imageViewReference = new WeakReference<ImageView>(imageView);
imageViewReference.get().setImageDrawable(null);
}
@Override
protected void onPostExecute(Bitmap result) {
if (isCancelled()) {
result = null;
}
if (imageViewReference != null) {
ImageView imageView = imageViewReference.get();
if (imageView != null) {
imageView.setImageBitmap(result);
//result.recycle();
}
}
}
@Override
protected void onPreExecute() {
if (imageViewReference != null) {
ImageView imageView = imageViewReference.get();
if (imageView != null) {
imageView.setImageResource(R.drawable.icon);
}
}
}
@Override
protected Bitmap doInBackground(String... params) {
url = params[0];
return Application.get(getContext()).loadBitmap(url);
}
}
</code></pre>
<p>As you see in the onPostExecute method. if I call recycle right after the image is asigned to the imageview, it thros an exeption of tying to use a recycled image.</p>
<p>Anybody could help?</p>
<p>Thanks in advance, and sorry for my english :P</p>
| android | [4] |
1,758,272 | 1,758,273 | Custom Back Button Animation | <p>The default animation when the <code>Back</code> button is pressed is a slide from left to right. I'd like to replace that with a custom animation. I'm currently thinking that some combination of <code>onBackPressed()</code> and <code>overridePendingTransition</code> will do the trick, but I haven't been able to get it working.</p>
| android | [4] |
5,146,690 | 5,146,691 | How to use smileys in our text? | <p>I am creating a chat application wherein I want to use smileys in the chat text. I went through <a href="http://stackoverflow.com/questions/5659935/implement-emoticons-in-xcode"><strong>this</strong></a> link but was wondering if there is some other way to use smileys. Should this be done through code or is there some setting in IPhone where smileys can be shown on keyboard?<br>
Can someone help me here?<br>
Thanks,<br>
Nitish</p>
| iphone | [8] |
5,706,313 | 5,706,314 | How to draw Views on Canvas | <p>I want to load e.g. LinearLayout with some Buttons from xml and draw it on Canvas in a way that the Views behave normally (I can set onClick actions for the Buttons <em>and when I press a Button, it changes it's background drawable</em>). Can I do this?</p>
| android | [4] |
86,675 | 86,676 | Android HEX Colors | <p>I many places Android requires HEX colors, like 0X31515724. How can i convert colors like #3399ff to this ? Is there any website or tool that would allow be to convert color codes to the required values. </p>
<p>Kind Regards</p>
| android | [4] |
2,220,988 | 2,220,989 | How to use DNS hosts resolver myself when using CFReadStreamOpen | <p>I use NSInputStream to send a http request . Now I need to make the request use my customized dns server . I have read part of the source code of CFNetwork without no answer. </p>
<pre><code>CFHTTPMessageRef myRequest = CFHTTPMessageCreateRequest(kCFAllocatorDefault,
requestMethod, myUrl, kCFHTTPVersion1_1);
CFHTTPMessageSetBody(myRequest, bodyData);
CFHTTPMessageSetHeaderFieldValue(myRequest, headerField, value);
CFReadStreamRef myReadStream = CFReadStreamCreateForHTTPRequest(kCFAllocatorDefault, myRequest);
CFReadStreamOpen(myReadStream);
</code></pre>
| iphone | [8] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.