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 |
---|---|---|---|---|---|
26,694 | 26,695 |
UIButton displaying view but not toggling to pause button
|
<p>I Have a UIButton and it has multiple actions associated with it </p>
<ol>
<li>To play audio file</li>
<li>Toggle between play pause button</li>
<li>Display views</li>
</ol>
<p>If i comment out the displayViewAction: it is working fine (i.e playing audio file and also toggling to pause button). But if I use the displayViewAction: method it is playing audio file displaying view but before displaying the view it should immediately toggle the state of the pause button, but it is not.</p>
<p>Code bellow for reference:</p>
<p>Code for UIButton:</p>
<pre><code>UIButton *playpauseButton = [UIButton buttonWithType:UIButtonTypeCustom];
[playpauseButton addTarget:self action:@selector(playpauseAction:) forControlEvents:UIControlEventTouchUpInside];
[playpauseButton addTarget:self action:@selector(displayviewsAction:) forControlEvents:UIControlEventTouchUpInside];
playpauseButton.frame = CGRectMake(0, 0, 50, 50);
[playpauseButton setImage:[UIImage imageNamed:@"play.png"] forState:UIControlStateNormal];
[playpauseButton setImage:[UIImage imageNamed:@"pause.png"] forState:UIControlStateSelected];
UIBarButtonItem *playpause = [[UIBarButtonItem alloc] initWithCustomView:playpauseButton];
</code></pre>
<p>Code for Playpause button:</p>
<pre><code>-(void)playpauseAction:(id)sender
{
if ([audioPlayer isPlaying]){
[sender setImage:[UIImage imageNamed:@"play.png"] forState:UIControlStateNormal];
[audioPlayer pause];
}
else {
[sender setImage:[UIImage imageNamed:@"pause.png"] forState:UIControlStateNormal];
[audioPlayer play];
}
}
</code></pre>
<p>Code for display view action:</p>
<pre><code>- (void)displayviewsAction:(id)sender
{
self.view = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]autorelease];
[self.view setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
PageOneViewController *viewController = [[[PageOneViewController alloc] init]autorelease];
[self.view addSubview:viewController.view];
}
</code></pre>
<p>Can anyone please advise how I can make it work this way?</p>
|
iphone
|
[8]
|
3,866,030 | 3,866,031 |
How to rotate my view-based app to the new interface orientation?
|
<p>I have a simple view-based app from that template. It has nothing else in there, only one UIButton.</p>
<p>When the device rotates, I want that button to be re-layoutet in such a way that it fits the width of the screen automatically. It has a margin of 20 points left and right, which should always remain the same.</p>
|
iphone
|
[8]
|
2,148,062 | 2,148,063 |
Change in android app to use adsense in exsisting app that using admob
|
<p>I am using admob in my android app.Should i need to change in my code to receive ads from Google AdSense?</p>
|
android
|
[4]
|
3,315,117 | 3,315,118 |
In php, how to set a define-d value in a const?
|
<p>Lets say in the very first script, which always executes first, I defined something:</p>
<pre><code>define ('ROOTDIR', dirname(__FILE__));
define ('ROOTDIR_ASSETS', ROOTDIR.'/assets');
</code></pre>
<p>now a class:</p>
<pre><code>class PictureGallery
{
const PATH = ROOTDIR.'/imgs';
</code></pre>
<p>php say: syntax error, unexpected '.' expecting ' ' or ';'.
How to work it around?</p>
|
php
|
[2]
|
5,283,107 | 5,283,108 |
Android: OnKeyListener camera button?
|
<p>I'm currently making a game for Android in which I'd like to be able to shoot using the camera button (Or a different hardware button I don't mind, just tapping the screen would be rubbish).</p>
<p>In my view I have:</p>
<pre><code>public class GameFrame extends SurfaceView implements SurfaceHolder.Callback, OnKeyListener{
public GameFrame(Context context){
...
setOnKeyListener(this);
...
}
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if(event.getAction() == KeyEvent.ACTION_DOWN)
{
shoot();
return true;
}
return false;
}
}
</code></pre>
<p>This however doesn't do anything, shoot() is never called even when I'm furiously hitting all the keys on my phone!
Is there something obvious I've missed out, or have I done it completely wrong?</p>
<p>Cheers</p>
|
android
|
[4]
|
5,176,212 | 5,176,213 |
UITabBar app and button that plays music in a tab
|
<p>I have an instance of AVAudioPlayer running inside one of my tabs. It is activated through an IBAction. </p>
<p>I would like the music to stop when a user clicks on another tab. </p>
<p>How would I go about doing this?</p>
<p>I've tried theAudio.stop; in viewDidLoad, but that didn't work.</p>
|
iphone
|
[8]
|
986,516 | 986,517 |
Managing screen flow
|
<p>To keep it simple I have 3 screens. A, B and C.
You can access Screen B or C from screen A.
You can access Screen C from screen B
You can access Screen B from screen C</p>
<p>Data from screen A is passed to B and C</p>
<p>What I am looking to do is create a button on screen B and C and where ever they are takes it back to screen A. I do not want to start a new activity of A as it requires the data it created</p>
<p>Also is there a way to overrule what the back button on the phone does. ie if on screen C it goes back to A even is the user clicked B and then C?</p>
<p>Thanks for your time</p>
|
android
|
[4]
|
4,439,210 | 4,439,211 |
Java- How to write a lobby game server
|
<p>So I'm writing a Chess matchmaking system based on a Lobby view with gaming rooms, general chat etc. So far I have a working prototype but I have big doubts regarding some things I did with the server. Writing a gaming lobby server is a new programming experience to me and so I don't have a clear nor precise programming model for it. I also couldn't find a paper that describes how it should work. I ordered "Java Network Programming 3rd edition" from Amazon and still waiting for shipment, hopefully I'll find some useful examples/information in this book.</p>
<p>Meanwhile, I'd like to gather your opinions and see how you would handle some things so I can learn how to write a server correctly. Here are a few questions off the top of my head: (may be more will come)</p>
<p>First, let's define what a server does. It's primary functionality is to hold TCP connections with clients, listen to the events they generate and dispatch them to the other players. But is there more to it than that?</p>
<p>Should I use one thread per client? If so, 300 clients = 300 threads. Isn't that too much? What hardware is needed to support that? And how much bandwidth does a lobby consume then approx?</p>
<p>What kind of data structure should be used to hold the clients' sockets? How do you protect it from concurrent modification (eg. a player enters or exists the lobby) when iterating through it to dispatch an event without hurting throughput? Is ConcurrentHashMap the correct answer here, or are there some techniques I should know?</p>
<p>When a user enters the lobby, what mechanism would you use to transfer the state of the lobby to him? And while this is happening, where do the other events bubble up?</p>
<p>Input is greatly appreciated. Thanks!</p>
<p>Screenshot : <a href="http://goo.gl/pYqM3" rel="nofollow">http://goo.gl/pYqM3</a></p>
|
java
|
[1]
|
2,669,396 | 2,669,397 |
How to redirect user to a particular app in Market?
|
<p>My Android app is trying to urge a user to upgrade a particular app from the Market. I can detect the old version of the app but how do I redirect user to the app page in Market directly with a button click?</p>
|
android
|
[4]
|
452,530 | 452,531 |
How to setHeight for a ViewGroup
|
<p>Can you please tell me how can I setHeight for a ViewGroup?
I see there is a layout(l,t,r,b);</p>
<p>But that is different form setHeight(), since I don't know where should be the top/bottom of the viewGroup. I need to set the height of the ViewGroup and return that to ListAdapter.</p>
<p>Thank you.</p>
|
android
|
[4]
|
1,782,283 | 1,782,284 |
Receding and Protruding menu tabs Jquery
|
<p>Sorry if this is a silly question but I have been on web design for 2 weeks and I am trying to make some menu tabs. Specificity ones that protrude when you mouseover and recede back to start position when mouseleave. I have made some code but it seems to act strangely.
When I mouse over its fine and the tab comes down 10px but when I leave the second time on any tab it recedes 10px then another 10px and it adds up each time incrementally, 20, 30, 40 etc.</p>
<p>I have tried popping in a stop even propergation but I am still learning. If its messy let me know.</p>
<p>Here is the code.</p>
<pre><code>$(document).ready(function(){
$('.buttons').mouseover(function(){
$(this).animate({top: '+=10'}, 200, function() {
$(this).mouseleave(function(){
$(this).animate({top: '+=-10'}, 200, function() {
});
});
});
});
});
</code></pre>
|
jquery
|
[5]
|
437,040 | 437,041 |
Android DB List Adapters: multiple columns, aligned?
|
<p>Ok I can't find a sample anywhere.</p>
<p>I've done the notepad tutorial on Google's Android site, but I would like to know how to add more fields to the list, in columns. At the moment I can add the columns no problem, but they're not aligned like you would a normal table on the layout:</p>
<pre><code>john smith
heinrich cilliers
will peck
</code></pre>
<p>I would like the first names and last names aligned proportionately, as you would in an html table.</p>
<p>It works if I use a constant value for the layout_width parameter (100dip etc), but I would prefer to use a relative percentage. However it's becoming clear that each row is on it's own, and does not know how to alighn itself with the row above.</p>
<p>Any pointers?</p>
<p>UPDATE: I've reached an experienced Android developer which advised me to use WeightSum, which brings me closer, but vertical alignment is stil not happening:</p>
<p><img src="http://i.stack.imgur.com/z7nj9.jpg" alt="Alignment Screenshot"></p>
|
android
|
[4]
|
1,976,149 | 1,976,150 |
In Javascript, Value not comming instead the variable name is displayed
|
<pre><code>function ProvideValue(){
Values = document.getElementById('HiddenValue').value;
FirstCut = Values.split("@#@"); // This will return the array ID@-@VALUE@-@TYPE
var CtrlId;
for (i = 0; i < FirstCut.length - 1; i++) {
Strings = FirstCut[i];
SecondCut = Strings.split("@-@");
if(SecondCut[2].match("TEXT")) {
CtrlId = "" + SecondCut[0];
document.getElementById(CtrlId).value = SecondCut[1];
}
}
}
</code></pre>
<p>This is my code instead of the Id, which i can print it.But CtrlId is not replaced by the actual value. Am getting error <code>document.getElementById(CtrlId).value is NULL</code>. I tried to hard code the ID then its working fine but i cannot hard code the controlsID because there are 1000s of control and everytime the ID changes.</p>
|
javascript
|
[3]
|
5,744,331 | 5,744,332 |
How to develop an Screen-Lock/Unlock functionality in my application in Android?
|
<p>actually i am developing one application...in my application i am trying to develop screen-lock n unlock application functionality..
So please help me to develop it...</p>
<p>Thanks in Advance--</p>
|
android
|
[4]
|
2,235,230 | 2,235,231 |
How can I load java class from database?
|
<p>like following source code:</p>
<pre><code>package util.abc;
public class Test{
public String out(){
return "Hello World!";
}
}
</code></pre>
<p>I can using:</p>
<pre><code>Class c = Class.forName("util.abc.Test");
</code></pre>
<p>to get this Class,but I must to put this source file(<code>Test.java</code>) in ClassPath <code>/util/abc/</code></p>
<p>I want dynamic load this class from database (store the source code as <code>string</code>,or <code>binary</code>)</p>
<p>This is possible ?</p>
<p>thanks for help :)</p>
|
java
|
[1]
|
2,535,079 | 2,535,080 |
pass by reference in java
|
<p>I am new to java. I tried to search a lot for my query but could not find. Please help me if you know. I have a function:</p>
<pre><code>boolean func(int a, int b, myclass obj1, myclass2 obj2)
{
...
}
void caller() {
int a = 0, b=0;
myclass obj1 = null;
myclass1 obj2 = null;
func(a,b,obj1,obj2);
if (a == 5 && b ==2)
{
...
}
}
</code></pre>
<p>what should i do such that all passed variables have the value in caller function which was given by function func?</p>
|
java
|
[1]
|
5,077,685 | 5,077,686 |
How to get back to default value in spinner onclick?
|
<p>My spinner coding is something like this:</p>
<pre><code> assetSpinner = (Spinner) findViewById(R.id.editAsset);
assetAdapter = ArrayAdapter.createFromResource(
this, R.array.asset_array, android.R.layout.simple_spinner_item);
assetAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
assetSpinner.setAdapter(assetAdapter);
</code></pre>
<p>Now I have a reset button in my design. So my question is when I click on reset button how to make the spinner get back to default value or reset the spinner.</p>
|
android
|
[4]
|
5,584,819 | 5,584,820 |
Check if line affected when writing a file with php
|
<p>how can i check if a line was written to a file?
I am trying something like this:</p>
<pre><code> if (fwrite($handle, $data) == FALSE) {
echo "<script>
alert('Not written');
</script>";
include ('index.html');
}
else{
echo "<script>
alert('Written');
</script>";
include ('index2.html');}
fclose($handle);
</code></pre>
<p>but it still notifies me as written even if nothing was put in the file.</p>
|
php
|
[2]
|
860,594 | 860,595 |
How can I convert an integer to string?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1035634/converting-an-integer-to-a-string-in-php">Converting an integer to a string in PHP</a> </p>
</blockquote>
<pre><code>$variable = '2011'
$temp = tostring($variable);
</code></pre>
<p>How can I convert integer to string? Is any <code>tostring()</code> method available?</p>
|
php
|
[2]
|
5,351,322 | 5,351,323 |
How to extract the real file URI or file data from a path that looks like "/content:/media/external/video/media/19"?
|
<p>I am desperately trying to send a captured video to a server. The problem is that the URI that is given by the built-in camera application is not the real file path. It looks like this - <code>/content:/media/external/video/media/19</code>. </p>
<p>How can I access the real path or the data directly from this kind of URIs?</p>
<p>After reading the android documentation I saw that it looks like a content provider's notation, but I still don't have a clue how to reach the data that I need. Please help!!!</p>
<p>thanks in advance</p>
|
android
|
[4]
|
2,300,388 | 2,300,389 |
Carousel as button not working unless slide is in first position
|
<p>I'm creating a set of controls to combine product color and patterns into one image. This is accomplished by changing the values to two drop downs and clicking on images in two bxslider carousels. Everything works until you click on a carousel in the second postion after one full rotation (left: -200px). If this one is clicked, nothing happens. Here's my code for the carousel's click function and a link to a live example. You have to click on at least one picture in each carousel for it to start.</p>
<pre><code>$(document).ready(function(){
$('ul.carousel_front li img').click(function() {
if($(this).hasClass('inactive_front'))
{
$(this).addClass('inactive_front').removeClass('active_front');
}
else
{
$("ul.carousel_front li img").removeClass("active_front");
$(this).addClass("active_front");
}
html = '<img src="images/' + $('#front_finish').val() + '_' + $('.active_front').attr("id") + '_' + $('#back_finish').val() + '_' + $('.active_back').attr("id") + '.jpg">';
$("#main-image").html(html);
}); });
</code></pre>
<p><a href="http://www.modmetal.com/test/index.html" rel="nofollow">Link to example</a></p>
|
jquery
|
[5]
|
1,051,744 | 1,051,745 |
How to get the .apk file of an application programatically
|
<p>I want to create an application which has following functionality. It should save its
<strong>.apk</strong> file to the <strong>sdcard</strong>. Imagine i have a Button. On clicking it i have to save the <strong>.apk</strong> file of the application. </p>
<p><strong>Note:</strong> Excuse me if my question is weird. But i want to know is it possible or not,because we create the application so we have all privileges regarding it.</p>
<p><strong>PS: I wholeheartedly accept your down votes.</strong>(Please explain me the reason for you down vote such that i will not repeat my mistake). </p>
|
android
|
[4]
|
1,008,895 | 1,008,896 |
prevent click happen in a children element
|
<p>I set a event to a <code>wrapper div</code>, but inside this <code>div</code>, i have some <code>buttons</code>, how can i <strong>prevent</strong> this <code>wrapper</code> event happen in the <code>buttons</code> ?</p>
<p><strong>html</strong>:</p>
<pre><code><div class="wrapper-alert"> <!-- click here will pop-up -->
<div class="somethingElse"> <!-- click here will pop-up -->
Some text
</div>
<div class="this-is-my-action">
<button class="inside-alert">Inside</button> <!-- click here will NOT pop-up-->
</div>
<div class="somethingElseTo"> <!-- click here will pop-up -->
Some text
</div>
</div>
</code></pre>
<p>i made a <a href="http://jsfiddle.net/NxnW2/37/" rel="nofollow"><strong>jsfiddle</strong></a> to be more clear.</p>
<p>so, basicly, if i click in the <code>wrapper-alert</code> some message will pop-up, but if i click in the <code>button</code> other thing will happen, <strong>the problem is that the buttons are children from wrapper, so 2 events will fire at once.</strong></p>
<p>i have try something with <code>if (e.target !== this) return;</code> but works only with one <code>children</code>, or some basic structure.</p>
|
jquery
|
[5]
|
59,375 | 59,376 |
how to combine two linq query result set into one using C#
|
<p>I want to combine two LINQ query results into one:</p>
<pre><code>var query1 = from sn in code
group sn by sn.Substring(0, 10) into g
select new
{
Key = g.Key,
Cnt = g.Count(),
Min = g.Min(v => v.Substring(10, 4)),
Max = g.Max(v => v.Substring(10, 4))
};
var query2 = from sn1 in codes
group sn1 by sn1.Substring(0, 11) into g
select new
{
key = g.Key,
Cnt = g.Count(),
Min = g.Min(v => v.Substring(11, 4)),
max = g.Max(v => v.Substring(11, 4))
};
var query3= query1.Union(query2)
</code></pre>
<p>but on compilation I get an error:</p>
<blockquote>
<p>'<code>System.Collections.Generic.IEnumerable<AnonymousType#1></code>' does not
contain a definition for '<code>Union</code>' and the best extension method
overload
'<code>System.Linq.Queryable.Union<TSource>(System.Linq.IQueryable<TSource>,
System.Collections.Generic.IEnumerable<TSource>)</code>' has some invalid
arguments</p>
</blockquote>
<p>what's wrong with my code?</p>
|
c#
|
[0]
|
5,896,537 | 5,896,538 |
using std::find on a container of a user-defined type c++
|
<p>Im trying to write a search function to get an element in std::list by suing std:find. But im stuck in the third parameter in the find argorithm, regard to this guy <a href="http://stackoverflow.com/questions/4604136/how-to-search-for-an-element-in-an-stl-list?answertab=active#tab-top">How to search for an element in an stl list?</a> I did overload the operator == pretty much but it seems still not working with the std::find.</p>
<p>This is my code:</p>
<pre><code>class Node
{
string word;
int count;
public:
Node(string _word) :word(_word), count(0) {}
~Node() {}
const string& getWord() const{
return word;
}
bool operator == (const Node& other) const {
return (this->word.compare(other.word) == 0);
}
};
const Node &getNode(const list<Node> &nodes, const string &word){
list<Node>::iterator itr;
itr = find(nodes.begin(), nodes.end(), new Node(word)); <-- no viable overload '='
return *itr;
}
</code></pre>
<p>I'm going very crazy with that issue now, please suggest me some hints. Thanks</p>
|
c++
|
[6]
|
2,613,912 | 2,613,913 |
What does =& mean in PHP?
|
<p>I realize this is a very basic question but I don't even really know what to search for to find out about it.</p>
<pre><code>$smarty =& SESmarty::getInstance();
</code></pre>
<p>What is the <strong>&</strong> for in the above?</p>
|
php
|
[2]
|
2,386,176 | 2,386,177 |
jquery issue in Chrome and Safari : working fine in Mozilla and Opera : please help
|
<p>I am having an issue with jquery in Chrome and Safari, the script is working fine in mozilla and opera.</p>
<p>Please check this link <a href="http://phpmagic.info/jquery/" rel="nofollow">http://phpmagic.info/jquery/</a></p>
<p>When you click on the button, all the boxes should go down, then the value in the textare comeup in the first box, and same should happen as many times you click on the button, This is working fine in Mozilla and Opera but not is Chrome and safari (also in IE6), In these browsers no new boxes come down, only existing</p>
<p>Please give me solution (please check the source code):</p>
<pre><code><script language="javascript" src="jquery-1.4.2.min.js"></script>
<script language="javascript">
$(document).ready(function() {
var top = 0;
$('#contents div').each(function(index, val) {
$(this).css('top', top + 'px');
top = top + 61;
});
$('#btn').bind('click', function() {
$('#contents div').each(function(index, val) {
var newtop = parseInt($(this).css('top')) + 61;
//$(this).css('top',newtop +'px');;
$(this).animate({
top: newtop + 'px'
}, 800, function() {
//
});
});
$('#contents div:first').before('<div class="link">' + document.getElementById('val').value + '</div>');
});
})
</script>
</code></pre>
|
jquery
|
[5]
|
3,225,327 | 3,225,328 |
how to resume/suspend a pthread in iphone os?
|
<p>Now i face a problem in my porting job, when i need to implement a thread class that will work in not only wince, symbian ,but also unix-like system, like iphone.</p>
<p>I own a suspend/resume interface to implement, anything is ok in wince/symbian except iphone, i use the posix pthread to finish my job, but i search the whole docsets for a resume/suspend-like interface. Things seem to be difficult, pthread in iphone own a <strong>*pthread_create_suspended_np*</strong> that can create a thread in a suspend mode. Now how can i resume or suspend a thread after the thread has run to its stuff in anytime.</p>
<p>BTW, i search Google for some help, it seems that someone else also have this problem .
Some guys suggest use the <strong><em>SIGHUP</em></strong> signal, but this will suspend the whole process, that's absolutely not ok .</p>
<p>Many thanks if you guys can tell me some solutions for this problem.</p>
|
iphone
|
[8]
|
3,616,241 | 3,616,242 |
Fade in img on mouseover - Fullscreenr - jQuery
|
<p>I am looking to fade in an img (#bgimg) on mouseover of each individual anchor in my main nav. I would like a different img for each anchor. I am using the plug-in Fullscreenr and have four different img's each relating to a link with-in my main nav. On mouseout I would like it to go back to the original img. I only want to do this on my home page. Below is a link to the page I would like to use it on and a snip-it of my mark-up:</p>
<p><a href="http://tamedia.ca/marlowe/home.html" rel="nofollow">http://tamedia.ca/marlowe/home.html</a></p>
<pre><code><body>
<img id="bgimg" src="img/bg-home.jpg" />
<div id="container">
<header>
<nav>
<ul>
<li><a href="brand.html">BRAND</a></li>
<li><a href="collection-aw12.html">COLLECTION</a></li>
<li><a href="boutiques.html">BOUTIQUES</a></li>
<li><a href="contact.html">CONTACT</a></li>
</ul>
</nav>
</header>
</div>
</body>
</code></pre>
|
jquery
|
[5]
|
3,999,364 | 3,999,365 |
how to: convert dictionary to strings in Python?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4357851/creating-or-assigning-variables-from-a-dictionary-in-python">Creating or assigning variables from a dictionary in Python</a> </p>
</blockquote>
<p>Hello</p>
<p>we have dictionary like this:</p>
<pre><code>data = {'raw':'lores ipsum', 'code': 500}
</code></pre>
<p>how to convert this dict to strings? result must be like this:</p>
<pre><code>print raw
print code
#output is
# lores ipsum
# 500
</code></pre>
<p><strong>EDIT:</strong>
OK, so what I want is to have raw and code variable available.. one more example</p>
<pre><code>data = {'raw':'lores ipsum', 'code': 500}
var1 = code
var2 = raw
</code></pre>
<p>it's becomes difficult to make tons of string operations with variable, which is dict, which is in class method...
so it's endups with this: self.data['raw'][0] , it's killing me to write this everytime so to make "raw" variable is more comfortable... (imagine join and format operation with using this on every line!!!) anyway this vars will be available only in this method, so there's no side-effects for this solution...</p>
<p><strong>EDIT: deleted, nobody understands what I want</strong></p>
|
python
|
[7]
|
4,623,104 | 4,623,105 |
How can I change paragraph order using jQuery?
|
<p>on this registration page <a href="http://energies2050.org/wp-login.php?action=register" rel="nofollow">http://energies2050.org/wp-login.php?action=register</a>
i would like to change the order of the paragraphs to be:</p>
<p>Identifiant</p>
<p>Civilite : </p>
<p>First Name: </p>
<p>Last Name:</p>
<p>E-mail</p>
<p>Telephone: </p>
<p>About Yourself: </p>
<p>Motivation pour participer au Forum: </p>
<p>Sujets que vous aimeriez voir sur le Forum: </p>
<p>Password: </p>
<p>Confirm Password: </p>
<p>Disclaimer </p>
<p>Would that be doable in jQuery?</p>
|
jquery
|
[5]
|
5,189,210 | 5,189,211 |
Multiple values for each tree record
|
<p>I have constructed a tree to hold a single string(data) for each record. How can I make it hold multiple strings for each record?</p>
<pre><code>void BinarySearchTree::insert(string d)
{
tree_node* t = new tree_node;
tree_node* parent;
t->data = d;
t->left = NULL;
t->right = NULL;
parent = NULL;
// is this a new tree?
if(isEmpty()) root = t;
else
{
//Note: ALL insertions are as leaf nodes
tree_node* curr;
curr = root;
// Find the Node's parent
while(curr)
{
parent = curr;
if(t->data > curr->data) curr = curr->right;
else curr = curr->left;
}
if(t->data < parent->data)
parent->left = t;
else
parent->right = t;
}
}
</code></pre>
|
c++
|
[6]
|
3,809,450 | 3,809,451 |
Static function in Java web application
|
<p>I have a static function in a Class which is called by a Servlet. Suppose, if 100 requests come at a time, will that function be available for all the requests?</p>
|
java
|
[1]
|
249,128 | 249,129 |
Offer access to a private page without login
|
<p>So I've been struggling with a nice and easy way to allow users to access a private page without asking them to fill out a login/password form. </p>
<p>What I'm thinking about using right now is for each private page I generate a uniqueid (using php uniqid function) and then send the URI to the user. He would access his private page as "www.mywebsite.com/private_page/13ffa2c4a". I think it's relatively safe and user friendly, without asking too much of information. I thought maybe when the user access this page it would ask for it's e-mail just to be sure, but the best would be nothing at all.</p>
<p>Is this really safe? I mean not internet banking safe, but enough for a simple access? Do you think there's a better solution? Thanks. :)</p>
|
php
|
[2]
|
1,580,521 | 1,580,522 |
Cycling through an array of form elements
|
<p>I am returning form elements into a form from ajax. I can count the number of elements returned, but I don't know how to cycle through them. I need to be able to get the value of each element returned.</p>
<p>I am pretty sure this is a basic javascript thing that I just don't know. The problem only looks more complicated with the Ajax.</p>
<p>My code looks like this:</p>
<pre><code> // The view page
<html>
<head>
<script language="javascript">
function calculateAlphaTotals(){
var length = document.myForm["alpha[]"].length;
alert( length ); // correctly outputs 3
for( var i = 0; i < length; i++ ){
try{
alert( document.myForm["alpha[]"].value ); // HTML ObjectCollection
alert( document.myForm["alpha["+i+"]"].value ); // Object Required
} catch( error ) { }
}
}
</script>
</head>
<body>
<form name="myForm" id="myFormId" method="post">
<div id="ajaxOutputId"></div>
</form>
</body>
</html>
// The Ajax page:
<input name="alpha[]" onchange="calculateAlphaTotals()" />
<input name="alpha[]" onchange="calculateAlphaTotals()" />
<input name="alpha[]" onchange="calculateAlphaTotals()" />
</code></pre>
|
javascript
|
[3]
|
4,940,353 | 4,940,354 |
when implementing interfaces get same interface as superclass
|
<p>in java i am using <code>generics</code> and in class i want to use <code>implements interface(? extends class)</code> and this interface is <code>generic interface<T></code> but i get message as</p>
<pre><code>same interface as superclass
</code></pre>
<p>code example:</p>
<pre><code>public interface ISomething<T>
{
string Name { get; set; }
string GetType(T t);
}
public class SomeClass implements ISomething<T extends SomeClass2>
</code></pre>
<p>is this possible?</p>
|
java
|
[1]
|
1,254,285 | 1,254,286 |
jQuery: Any better way to write this? Multiple each() loops
|
<pre><code>var currentTallest = 0;
if($j(".eachLateDeal").exists()){
$j(this).children().find(".resultList").each(function(i){
if($j(this).height() > currentTallest){
currentTallest = $j(this).height();
}
});
$j(this).children().find(".resultList").each(function(i){
if (!$j.support.minHeight){
$j(this).css({'height': currentTallest + 5});
}
$j(this).css({'min-height': currentTallest});
});
}
</code></pre>
<p>Updates:
After taking all the constructive comments into consideration, I have come up with the following which seems to work as desired:</p>
<pre><code>$j.fn.equalHeights = function(px) {
$j(this).each(function(){
var currentTallest = 0;
var results;
if($j(".eachLateDeal").length){
results = $j(".resultList", ".eachLateDeal");
}else{
results = $j(this).children();
}
$j.each(results, function(){
if($j(this).height() > currentTallest){
currentTallest = $j(this).height();
}
});
var cssProp = {};
if (!$j.support.minHeight){
cssProp["height"] = currentTallest + 5;
}else{
cssProp["min-height"] = currentTallest;
}
results.css(cssProp);
});
</code></pre>
<p>};</p>
<p>Thanks all!</p>
|
jquery
|
[5]
|
3,094,720 | 3,094,721 |
clickevent in javascript
|
<p>what is difference between onclick and onclientclick events?</p>
|
javascript
|
[3]
|
1,104,335 | 1,104,336 |
Why does the following PHP code fail?
|
<pre><code>define('test',2);
if(isset(test))echo 'hi';
</code></pre>
|
php
|
[2]
|
629,244 | 629,245 |
PHP: __set function behaviour different each time
|
<p>This manages to create a new property on the object. But, can someone explain, with supporting links, why <code>setAttrib</code> behaves in two different ways? Why doesn't it cause a... wait for it... stack overflow!!??</p>
<pre><code>class Test
{
public function setAttrib( $key, $value ) {
echo "setAttrib\n";
// first time: calls $this->__set($key, $value)
// second time: just sets a public property (but, when exactly was it created?)
$this->$key = $value;
}
public function __set( $key, $value ) {
echo "__set\n";
$this->setAttrib($key, $value);
}
}
$test = new Test();
$test->setAttrib('hey', 'It works');
var_dump($test);
</code></pre>
<p>produces...</p>
<pre><code>setAttrib
__set
setAttrib
object(Test)#1 (1) {
["hey"]=>
string(8) "It works"
}
</code></pre>
<p>Edit: I'm not looking for an alternative. <em>I'm looking for the reason why this works.</em></p>
|
php
|
[2]
|
113,589 | 113,590 |
how to make the background image rotate?
|
<p>When I rotate my app the background image will not rotate and
I wish that my background image will rotate.
The content do changes the orientation but the background image stays and will not rotate.</p>
<p>Any ideas on a go around?</p>
<p>Thanks.</p>
|
iphone
|
[8]
|
2,680,801 | 2,680,802 |
Javascript - Check which input element cursor is in
|
<p>If I click a random button, is there any way to define in which input element my cursor is currently in?</p>
|
javascript
|
[3]
|
5,118,505 | 5,118,506 |
how to set image in uitable view
|
<p>I download some images using an NSThread. When all the images are downloaded, I have to put them in cell.myimageview. Give me the solution for setting an image in a user-defined method.</p>
<pre><code> - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
TableCell *cell = (TableCell *)[TableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[TableCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
NSString *bedsbaths=[NSString stringWithFormat:@"Beds:%@ Baths:%@",[[AppDeleget.statuses valueForKey:@"beds"] objectAtIndex:indexPath.row],[[AppDeleget.statuses valueForKey:@"baths"] objectAtIndex:indexPath.row]];
cell.mlsno.text=[[AppDeleget.statuses valueForKey:@"mlsno"] objectAtIndex:indexPath.row];
cell.price.text=[[AppDeleget.statuses valueForKey:@"price"] objectAtIndex:indexPath.row];
cell.address.text=[[AppDeleget.statuses valueForKey:@"address"] objectAtIndex:indexPath.row];
cell.bedsbaths.text=bedsbaths;
cell.accessoryType=UITableViewCellAccessoryDetailDisclosureButton;
return cell;
}
-(void)LoadImage
{
for(int x=0;x<[ListPhotos count];x++)
{
NSData *imageData =[ListPhotos objectAtIndex:x];
id path = imageData;
NSURL *url = [NSURL URLWithString:path];
NSLog(@"%@",url);
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *img = [[UIImage alloc] initWithData:data];
[self performSelectorOnMainThread:@selector(downloadDone:) withObject:img waitUntilDone:NO];
}
}
-(void)downloadDone:(UIImage*)img {
// I have to set the cell here. How?
cell.myimageView.image=img
}
</code></pre>
|
iphone
|
[8]
|
4,753,183 | 4,753,184 |
Using Unsigned Primitive Types
|
<p>Most of time we represent concepts which can never be less than 0. For example to declare length, we write:</p>
<pre><code>int length;
</code></pre>
<p>The name expresses its purpose well but you can assign negative values to it. It seems that for some situations, you can represent your intent more clearly by writing it this way instead:</p>
<pre><code>uint length;
</code></pre>
<p>Some disadvantages that I can think of:</p>
<ul>
<li>unsigned types (uint, ulong, ushort) are not CLS compliant so you can't use it with other languages that don't support this</li>
<li>.Net classes use signed types most of the time so you have to cast</li>
</ul>
<p>Thoughts?</p>
|
c#
|
[0]
|
2,478,086 | 2,478,087 |
Eclipse auto delete apk after install apk
|
<p>my system will open the installation if user click on the button</p>
<pre><code>intent.setDataAndType(Uri.parse("file://sdcard/abc.apk"), "application/vnd.android.package-archive");
</code></pre>
<p>i am looking for the solution which the system will auto delete the apk file once the installation is done.</p>
|
android
|
[4]
|
4,093,280 | 4,093,281 |
Saving Data Privately On Device
|
<p>I have files that I want to save so they are not accessible by other applications and that are safe from updates (won't be deleted).</p>
<p><strong>My Problem</strong></p>
<p>I am not sure where to save them. I know that I can save them in the data directory using the below code to get the path but I'm not sure if this is correct.</p>
<pre><code>Environment.getDataDirectory();
</code></pre>
<p><strong>My Question</strong></p>
<p>Is the applications data directory the correct place to store my data or is it meant just for system data?</p>
<p>If it isn't the correct place, could you suggest where is?</p>
<p>Thanks in advance</p>
|
android
|
[4]
|
2,974,003 | 2,974,004 |
Function accessing itself when name is overwritten by argument
|
<p>Normally, a function can access itself like this:</p>
<pre><code>(function f() {
console.log(f); // Prints the function definition
}());
</code></pre>
<p>However, when the function <code>f</code> has an argument also called <code>f</code>, the argument takes precedence:</p>
<pre><code>(function f(f) {
console.log(f); // Prints 1
}(1));
</code></pre>
<p>In the second example, how can I access the function when one of the arguments has the same name as the function?</p>
<p>[Also, where can I find the documentation saying that the argument should take precedence over the function name?]</p>
|
javascript
|
[3]
|
1,054,906 | 1,054,907 |
Standalone application query in VSTS2008
|
<p>I have created a windows form application in VSTS2008 using C#. But when I try to run the same application from some other machine it gives an error "Unhandled exception has occurred in your application...". But when I run it on my machine,it works fine. How can I resolve it?</p>
|
c#
|
[0]
|
2,600,967 | 2,600,968 |
Slow site initial load time
|
<p>for some reason my website <code>www.gcprive.com</code> takes a very long time to respond initially but then loads all of a sudden. Any ideas why this happens?</p>
<p>I am trying to optimize speed in general but this is a profound observation. </p>
<p>thanks
Andy</p>
|
php
|
[2]
|
411,832 | 411,833 |
How to slide SlidingDrawer left to right
|
<p>I want to slide SlidingDrawer from left to right, I have an option: I can define android:rotation = 90 in SlidingDrawer tag in xml file, but rotation tag works with Android 3.0</p>
<p>So i m tired to slide this from left to right, Is there any one who helps Me for this?</p>
<p><img src="http://i.stack.imgur.com/DI21E.png" alt="enter image description here"></p>
<p><img src="http://i.stack.imgur.com/LYWDu.png" alt="enter image description here"></p>
<p>like this, Thanx in advance</p>
|
android
|
[4]
|
5,299,234 | 5,299,235 |
Retrieving entered text in field (android help)
|
<p>I have this code for a username field for an Android app. I would like to validate the field to see if it is empty. Here is my code:</p>
<pre><code>View a = findViewById(R.id.authentication);
(a.toString().equals(""))
</code></pre>
<p>I am guessing that you cannot use view to get the data entered by the user. What would be the best way to see if these fields are empty?</p>
|
android
|
[4]
|
3,158,939 | 3,158,940 |
Problem in implementing my own switch class
|
<p>I am trying to implement a custom switch case just for fun..</p>
<p>The approach is that I have created a class that inherits a dictionary object</p>
<pre><code>public class MySwitch<T> : Dictionary<string, Func<T>>
{
public T Execute(string key)
{
if (this.ContainsKey(key)) return this[key]();
else return default(T);
}
}
</code></pre>
<p>And I am using as under</p>
<pre><code> new MySwitch<int>
{
{ "case 1", ()=> MessageBox.Show("From1") },
{ "case 2..10", ()=>MessageBox.Show("From 2 to 10") },
}.Execute("case 2..10");
</code></pre>
<p>But if I specify <strong>"case 2"</strong> it gives a default value as the key is not in the dictionary.</p>
<p>The whole purpose of making <strong>"case 2..10 "</strong> is that if the user enters anything between <strong>case 2 to case 10</strong>, it will execute the same value.</p>
<p>Could anyone please help me in solving this?</p>
<p>Thanks</p>
|
c#
|
[0]
|
5,985,099 | 5,985,100 |
Why does HttpContext.Response.Cookies["foo"] add a cookie?
|
<p>I have just spent half a day tracking down a bug due to the following behaviour: -</p>
<p>Imagine that there is <strong>not</strong> a cookie called "foo" in either the Http request's or response's cookie collections. The following code returns null</p>
<pre><code>A) HttpContext.Current.Request.Cookies["foo"]
</code></pre>
<p>The following code creates a new cookie called "foo" (with path="/" and blank value), adds it to the response's cookie collection and returns that</p>
<pre><code>B) HttpContext.Current.Response.Cookies["foo"]
</code></pre>
<p>So (B) has the side effect that any pre-existing cookie called "foo" is overwritten on the client's browser.</p>
<p>This is not a bug. Someone actually coded this deliberately. Here is the disassembly of the Get method (the Item[string name] indexer delegates to this method.</p>
<pre><code> public HttpCookie Get(String name) {
HttpCookie cookie = (HttpCookie)BaseGet(name);
if (cookie == null && _response != null) {
// response cookies are created on demand
cookie = new HttpCookie(name);
AddCookie(cookie, true);
_response.OnCookieAdd(cookie);
}
return cookie;
}
</code></pre>
<p>Obviously the MSDN docs do not mention this behaviour (although some users have added comments at the bottom of the docs that describe this behaviour).</p>
<p>My question is can someone explain to me the rational why the <code>HttpCookieCollection</code> class has this behaviour.</p>
|
asp.net
|
[9]
|
3,531,608 | 3,531,609 |
Touch position in Android
|
<p>How can I save my touch position in a variable (Touching position on LCD) in Android , Is it possible ?</p>
<p>Any suggestion would be appreciated...</p>
|
android
|
[4]
|
2,357,533 | 2,357,534 |
How to "discard" form changes?
|
<p><strong>Setup:</strong></p>
<p>I have a form and a "Submit" button. Ideally the user should fill out the form, click "Submit" and then leave the tab. If he tries to leave the tab without saving the changes, I need to alert him with 3 options:</p>
<ol>
<li>Save</li>
<li>Discard: discard the form data changes, and leave the tab, as if the data was never modified. If user comes back to the same tab, he should see the "unmodified" data.</li>
<li>Cancel: Just dismiss the dialog box, keep the user on the same tab. User can either modify the data further, click save, etc.</li>
</ol>
<p><strong>Problem:</strong></p>
<p>Implementing Save and Cancel is easy. The issue is with "Discard". If the user clicks "Discard", the form data should get restored to what it was before modification.</p>
<p>Is there any way to do this? If I haven't explained issue properly, please let me know. </p>
|
jquery
|
[5]
|
5,574,889 | 5,574,890 |
Import error? (PYTHON 3.2)
|
<p>I have my own module named v_systems, and I'm trying to import that module in another python file (which is also saved in the same directory as the file v_systems is saved)
I need to import it as <code>import v_systems as vs</code> or even if I try to import as <code>import v_systems</code>.</p>
<p>However it gives me an error saying no module v_systems exists.</p>
<p>How may I fix this error? What am I doing wrong?</p>
|
python
|
[7]
|
5,858,746 | 5,858,747 |
Jquery scroll left, div not body?
|
<p>I have a jquery horizontal scroller the only thing is the whole body moves whereas I just want the list to move, how do I change it?</p>
<pre><code>$("ul#page_nav li").click(function(){
var panel_id = $(this).attr('id');
$('html, body').animate({ scrollLeft: $('ul#page_content li#'+panel_id).position().left }, 900, 'easeInOutExpo');
});
<ul id="page_nav">
<li id="one">1</li>
<li id="two">2</li>
<li id="three">3</li>
<li id="four">4</li>
</ul>
<ul id="page_content">
<li id="one">one</li>
<li id="two">two</li>
<li id="three">three</li>
<li id="four">four</li>
</ul>
</code></pre>
|
jquery
|
[5]
|
3,026,601 | 3,026,602 |
Using document.getElementsByName() isn't working?
|
<p>The code for the second alert command works as intended (displaying the value of the element "to", but the first alert command does not work (it's supposed to do the same thing). Why is this?</p>
<pre><code><html>
<head>
<script type="text/javascript">
function getValue()
{
alert(document.getElementsByName("to").value);
alert(document.forms[0].to.value);
}
</script>
</head>
<body>
<form>
<input name="to" type="hidden" value="hoolah" />
<input type="button" onclick="getValue()" value="Get Value!" />
<form/>
</body>
</html>
</code></pre>
|
javascript
|
[3]
|
544,609 | 544,610 |
Pass variable value outside out a loop
|
<p>I know that probably would be the dumbest question to ask, but its a desperate attempt from a UI guy to do something... i have getting some values from a json file, and then i am passing those values to plot a graph using jflot.</p>
<p>//Script</p>
<pre><code>function plot4() {
$.getJSON("wc.json",function(data){
$.each(data.posts, function(i,data){
var wc = data.title;
alert(wc);
});
});
function drawPlot() {
alert(wc);
// function which draws plot using jFlot using a huge dataset
}
}
</code></pre>
<p>Is it okay that i wrap the getjson file outside the drawPlot function ??.. pls advice</p>
|
javascript
|
[3]
|
903,514 | 903,515 |
Sort List<List<string>> by length in ascending order
|
<p>May I know how to sort <code>List<List<string>></code> by the length of <code>List<string></code> in ascending order?</p>
|
c#
|
[0]
|
4,325,638 | 4,325,639 |
jQuery and mouseover issue
|
<p>I have the following code:</p>
<pre><code>$('a.home-page-link').mouseover(function() {
$(this).animate({
opacity: 0.4
}, 200, function());
});
</code></pre>
<p>For some reason, this refuses to "play ball", any ideas?</p>
<p>Cheers!</p>
|
jquery
|
[5]
|
1,380,132 | 1,380,133 |
How to fetch a file on a web server using JavaScript?
|
<p>I am trying to write a small documentation tool to be used from the browser. It would need to fetch source code files from a web server. What would be the appropriate way to fetch files from JavaScript itself and then read them so they can be parsed ? The file to be fetched is on a different web server. </p>
<p>thanks in advance,
vivekian</p>
|
javascript
|
[3]
|
5,807,786 | 5,807,787 |
extracting a text from a large content using php
|
<p>I have a text and i need to find out a text which is in double quotes . foe example </p>
<pre><code>this is the "dummy text for the" content
</code></pre>
<p>i need to get the value as <code>dummy text for the</code></p>
<p>Does any one know how to get the this using php?</p>
<p>or any php functions for this ?</p>
<p>thanks </p>
|
php
|
[2]
|
5,955,235 | 5,955,236 |
C# Use a class that implements an interface without adding a reference to the assembly that defines the interface
|
<p>I have 3 assemblies written in C#, namely A.exe, B.dll, C.dll</p>
<ul>
<li>C.dll defines a public interface IfaceC.</li>
<li>A.exe defines a public class ClassA : IfaceC</li>
<li>B.dll uses ClassA but does not make explicit use of IfaceC</li>
</ul>
<p>My question: is it possible to compile B <strong>without</strong> referencing C.dll ? I do not use it and I want to prevent a developer from using it (i.e. typing "IfaceC" in the B's code accidentally). However A.exe still needs it.</p>
<p><strong>EDIT</strong></p>
<p>Given my archi, A can reference C but not B, C cannot reference nor A neither B, B can reference A <strong>but not (if possible) C</strong></p>
|
c#
|
[0]
|
5,595,601 | 5,595,602 |
php trim function trims extra Less-than/Greater-than signs
|
<p>I have a question about the PHP trim function.
Consider the following:</p>
<pre><code>$x= '<p>blah</p>';
$x= trim(trim($x, '<p>'), '</p>');
echo htmlentities($x) . "<br />";
This works as expected and prints blah
</code></pre>
<p>.</p>
<pre><code>$x= '<p><b>blah</b></p>';
$x= trim(trim($x, '<p>'), '</p>');
echo htmlentities($x) . "<br />";
This prints b>blah</b
</code></pre>
<p>I'm not looking for other ways around this.<br />
I do wonder why the trim function shows this behavior (stripping the extra Less-than/Greater-than sign).</p>
<p>Thanks in advance.</p>
|
php
|
[2]
|
2,813,104 | 2,813,105 |
Location Manager not obtaining GPS location properly
|
<p>i am supposed to obtain the current location of the user , for this i have implemented the following code:</p>
<pre><code>lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
ll = new mylocationlistener();
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, ll);
</code></pre>
<p>Here is my LocationListener class:</p>
<pre><code> private class mylocationlistener implements LocationListener {
@Override
public void onLocationChanged(Location location) {
if (location != null) {
Log.d("LOCATION CHANGED", location.getLatitude() + "");
Log.d("LOCATION CHANGED", location.getLongitude() + "");
lat = location.getLatitude();
lng = location.getLongitude();
Toast.makeText(NearActivity.this, "lng=" + lng + " lat=" + lat,
Toast.LENGTH_SHORT);
showProgress();
}
}
</code></pre>
<p>The above code is not setting the variables lat and lng which are global variables. Why is the GPS not able to provide the cordinates? </p>
<p>Thank you in advance.</p>
|
android
|
[4]
|
1,300,181 | 1,300,182 |
test the timeOut in iPhone (- (void)requestFailed:(ASIHTTPRequest *)request)
|
<p>I would like to test the timeOut error in the requestFailed, i have do like this :</p>
<pre><code>if ([[self.request error] code]== ASIRequestTimedOutErrorType){
// ...
}
</code></pre>
<p>i would like to test this in the simulator but i don't no how to do it.</p>
<p>thanks for your answers</p>
|
iphone
|
[8]
|
856,488 | 856,489 |
How can I do this programmatically?
|
<p>I don't know how can I do this programmatically:</p>
<pre><code>var a={a:"a",b:"b"};
return a.a;
|
I want to change this programmatically, how can I do that?
</code></pre>
<p>without using <code>eval()</code>?</p>
|
javascript
|
[3]
|
4,952,794 | 4,952,795 |
python palindrome
|
<p>Hi I'm working on a python function isPalindrome(x) for integers of three digits that returns True if the hundreds digit equals the ones digit and false otherwise. I know that I have to use strings here and this is what I have:</p>
<pre><code>def isPal(x):
if str(1) == str(3):
return "True"
else:
return "False"
</code></pre>
<p>the str(0) is the units place and str(2) is the hundreds place. All I'm getting is False? Thanks!</p>
|
python
|
[7]
|
907,547 | 907,548 |
What Web/application servers to use for Python
|
<p>I would like to start writing Python web apps, first start simple like servlets in Java, then move to some web frameworks. </p>
<p>What server could I use to develop the apps? Is there a Tomcat version for Python? Is Apache with mod_python the way to go or something else?</p>
<p>Thank you!</p>
<p><strong>PS:</strong> It is for Python 2.6.5, if that makes a difference</p>
|
python
|
[7]
|
5,721,309 | 5,721,310 |
POST not working inside click function
|
<p>I have this working perfectly:</p>
<pre><code>$.post("check_i.php", {value: '<?php echo md5($_SERVER['REMOTE_ADDR']);?>'},
function(result) {
if(result == 'true') {
alert('true');
} else {
$.post("update_pop_count.php", {site: '<?php echo $site;?>'});
}
});
</code></pre>
<p>However when I try to put this inside a click link function, in firebug I can see that check_i.php takes forever, and update pop count is never called (i can see in the database that the count is not updated)</p>
<p>This is my code with the click function:</p>
<pre><code>$("a").click(function() {
$.post("stats_include/ajax/check_i.php", {value: '<?php echo md5($_SERVER['REMOTE_ADDR']);?>'},
function(result) {
if(result == 'true') {
alert('true');
} else {
$.post("stats_include/ajax/update_pop_count.php", {site: '<?php echo $site;?>'});
}
});
});
</code></pre>
<p>This is all inside a document.ready function. Any ideas?</p>
|
jquery
|
[5]
|
2,900,840 | 2,900,841 |
Returning a Random Number Type Problem
|
<p>I'm trying to return a random number from a method but apparently the implicit type is not correct. It says "Cannot implicitly convert type 'Randomize.RandomNumber' to 'int'"</p>
<p>RandomNumber.cs:</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Text;
namespace Randomizer
{
class RandomNumber
{
public int RandomInRange(int l, int u)
{
Random generator = new Random();
return generator.Next(l, u);
}
}
}
</code></pre>
<p>Program.cs:</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Text;
namespace Randomizer
{
class Program
{
static void Main(string[] args)
{
Console.Out.WriteLine("Please enter the minimum range for the random number\n");
int min = int.Parse(Console.In.ReadLine());
Console.Out.WriteLine("Please enter the maximum range for the random number\n");
int max = int.Parse(Console.In.ReadLine());
int RandomInt = new RandomNumber();
Console.Out.WriteLine("Your random number is: " + RandomInt.RandomInRange(min, max));
Console.In.ReadLine();
}
}
}
</code></pre>
<p>I know it's pretty much a noob question, but I'm used to C++. Thanks for the help in advance. =]</p>
|
c#
|
[0]
|
3,167,402 | 3,167,403 |
Closures in C++
|
<p>I've found myself in a strange place, mentally. In a C++ project, I long for closures.</p>
<p>Background. There's a Document-type class with a public Render method which spawns a deep call tree. There's some transient state that only makes sense during rendering. Right now it resides in the class like regular member variables. However, this is not satisfactory on some levels - this data only makes sense during a Render call, why store it all the time? Passing it around in arguments would be ugly - there are around 15 variables there. Passing around a structure would add a lot of "RenderState->..." in the lower-level methods.</p>
<p>So what do I want? I want the world, like we all do. Specifically, a set of variables that are:</p>
<ul>
<li>available to some methods in a class (not all of them)</li>
<li>accessible by name alone (no pState->... stuff - so that refactoring is easy)</li>
<li>not copied around on every method call</li>
<li>only live during a method call and up its call tree (assuming trees grow up)</li>
<li>live on a stack</li>
</ul>
<p>I know I can have some of those properties with C++ - but not all of them. Tell me I'm not turning weird.</p>
<p>Heck, in Pascal, of all places, nested functions give you all that...</p>
<p><strong>So what is a good workaround to emulate closures in C++, getting as many of the above benefits as possible?</strong></p>
|
c++
|
[6]
|
1,031,245 | 1,031,246 |
how to add suffix with form name in javascript
|
<p>hi I have a function in javascript in which I am accessing the hidden value of a form. I want to add a suffix in javascript. I am try like this</p>
<pre><code>function add_new_certification(vid)
{
var sr=document.form_vid.hidden.value;
alert(sr);
}
</code></pre>
<p>I want to concate vid value with form name. How Can I do that</p>
|
javascript
|
[3]
|
3,594,250 | 3,594,251 |
How to gather code into one variable
|
<p>I need to be able to get all of this information (as text) into the variable $all so that I can use it later in my script. But when I echo $all later on it doesn't work. And don't anyone say anything about the use of font tags, I'm as depressed about it as you are.</p>
<pre><code> $all = <<< STOPTHISCRAZYTHING
echo "<br><br><textarea rows=\"30\" cols = \"100\">";
echo "<div align=\"center\"><font size=\"7\">I Have</font></div>";
foreach($same as $match)
{
echo "<img src=\"" . $match . "\">";
}
echo "<div align=\"center\"><font size=\"7\">I Need</font></div>";
foreach($different as $diff)
{
if(!in_array($diff, $reject))
{
echo "<img src=\"" . $diff . "\">";
}
}
echo "<div align=\"center\"><font size=\"7\">I Am Unable To Obtain</font></div>";
foreach($retired_different as $unabletoget)
{
echo "<img src=\"" . $unabletoget . "\">";
}
echo "</textarea>";
STOPTHISCRAZYTHING;
</code></pre>
|
php
|
[2]
|
4,007,419 | 4,007,420 |
pdf or word file storing & display from sql data base as attachment
|
<p>how to store files (pdf and word files) into sql database and how to display that files with an option of "save" , "open" window from sql data base when user click. i am doing project using c# + asp.net web application</p>
|
asp.net
|
[9]
|
4,922,343 | 4,922,344 |
Caching in ASP.net
|
<p>I m having a webService.
In that I m using Caching.</p>
<p>I have wrote following code to store datatable in cache.</p>
<pre><code>using System.Web.Caching;
Cache.Insert("dt", dt, null, DateTime.Now.AddHours(1), TimeSpan.Zero, System.Web.Caching.CacheItemPriority.Default, null);
</code></pre>
<p>It give me error like "An object Reference is required for non static field.</p>
<p>How can i remove this error</p>
|
asp.net
|
[9]
|
4,011,022 | 4,011,023 |
Would header statement work in inner code?
|
<p>Please see code below:</p>
<pre><code> <?php
require_once("initvars.php");
require_once("config.php");
if( !$auth->id ){
//NOT logged in
header("location: index.php"); die();
}
</code></pre>
|
php
|
[2]
|
5,712,561 | 5,712,562 |
Is it necessary to include application package prefix when defining a Custom Action string
|
<p>Is including a application package prefix while defining a custom action string is convention or mandatory?</p>
|
android
|
[4]
|
4,385,731 | 4,385,732 |
set validatorcontrol.setfocusonerror="true" for all validator controls in asp.net website
|
<p>We are about to release beta version of our website. Lately we have seen that developers have not set setfocusonerror on any of the validaor controls used.We have to set this property.</p>
<p>Now, one solution is to open every page and put this property in place. I am looking for some othe way like some configuration in web.config or some other quick solution.</p>
<p>I have usercontrols and pages. Page derive from base page.Please suggest.</p>
|
asp.net
|
[9]
|
2,450,183 | 2,450,184 |
php include breaking
|
<p>I have a php page that generates all the html and echo's it. Now I want to write a php script that I can use include to handle the footer code. that way if I need to update the footer on all the pages I can just edit the code in the included page.</p>
<p>But when I use include("footer.php"); and the footer page contains the footer code that works if it exists on the page it breaks and prints the code. Im very confused as too why?</p>
<pre><code> if(isset($_SESSION['user_cart']) && count($_SESSION['user_cart']) > 0)
</code></pre>
<p>Starts writing the code on the page if I include from 0) </p>
<p>Please help?</p>
<p>EDIT: The code in the footer is wrapped in <code><?php ?></code></p>
|
php
|
[2]
|
447,264 | 447,265 |
How can I capture a field name (not field value) with Javascript?
|
<p>I'm trying to find out how I can use javascript to capture the name of a field and assign the name to a variable. I've done a good amount of searching, but I can only find out how to capture the value of a field and not the name of the field itself.</p>
<p>For example, say I have a asp textbox named "ClientFName". I'd like to use javascript to capture the name of the textbox (ClientFName) and assign the name to a variable.</p>
<p>I'm moderately experienced with javascript but I haven't figured out a way to make this happen. Any help would be great!</p>
|
javascript
|
[3]
|
3,348,726 | 3,348,727 |
Java: static factory method and thread safe
|
<p>I want to get an object by a static factory method, such as</p>
<pre><code>Person p = Person.fromName("Jack");
class Person {
public static Person fromName(String name){
return new Person(name);
}
}
</code></pre>
<p>but fromName() method is not thread safe, (fromName() is just an example, this kind of method will occur error when it's running in my program) however, it's inefficient if synchronized this method because multiple threads should call this method concurrently. Is there any suggestion to fix it?</p>
|
java
|
[1]
|
4,176,025 | 4,176,026 |
Stop Google maps navigation programmatically
|
<p>I currently start Google navigation from my application using something like:</p>
<pre><code>Intent navigationIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("google.navigation:q=" + latLong.getLatitude() + "," + latLong.getLongitude()));
</code></pre>
<p>Does anyone know how I can stop the navigation from my own application?</p>
<p>I have tried killing it but it seems I just do not have permission, is there any other way?</p>
|
android
|
[4]
|
4,907,887 | 4,907,888 |
client side folder
|
<p>folders and files can be created on the client side by using some script?I wanted to create folders and files on client side.</p>
<pre><code>mkdir();
</code></pre>
<p>like the above which makes folders on the server</p>
|
jquery
|
[5]
|
4,574,553 | 4,574,554 |
Javascript timestamp limit to the last 8 characters
|
<p>It is simple enough to get timestamp:</p>
<pre><code>new Date().getTime();
</code></pre>
<p>but I need to limit the timestamp to 8 characters, and these need to be the last 8 rather than the first 8.</p>
<p>for example:</p>
<pre><code>new Date().getTime(); // returns: 1234567891234
</code></pre>
<p>I need it to return:</p>
<pre><code>67891234
</code></pre>
<p>can you help?</p>
<p>Thanks in advance</p>
|
javascript
|
[3]
|
1,386,956 | 1,386,957 |
need help about how to add Menu page
|
<p>i'm download DrillDownApp example project from iPhoneSDKArticles</p>
<p>i have a problem when i'm try to add menu page
before load MainWindow.</p>
<p>i can't load [window addSubview:[navigationController view]]; on other class except on DrillDownAppAppDelegate.m</p>
<p>could you explane me or give me some tutorial how to add menu page on DrillDownApp please </p>
<p>i'm new to iphone development, need some advise please , thanks all</p>
|
iphone
|
[8]
|
1,750,906 | 1,750,907 |
Most efficient method to use position to open a .java
|
<p>Sorry for the formating errors - How do you use position once you have it (or another variable for that matter) to activate a file or other task? For example I want to use position 1 to open screen1.java and position 2 to open screen2.java. I could use if/else statements but can I do it in one line rather than many? If I had 100 different screens then an if then statement would be silly. Here is what I have as an (incorrect) example. Can you help me correct it? </p>
<pre><code>public void onItemClick(AdapterView<?> parent, View v,
int position, long id){
//opens relevant game window
Intent intent = new Intent(context, "game"+(position)+"mainscreen"+".class");
startActivity(intent);
}
});
}
</code></pre>
<p>TO SUMMARIZE:-
<B> instead of using </B> game1mainscreen.class <B> I want to use something like </B> "game"+(position)+"mainscreen"+".class"</p>
|
android
|
[4]
|
4,887,605 | 4,887,606 |
Getting a still frame of a video in PHP uing Base64 then saving it as a JPEG
|
<p>Is this possible in PHP? If so does anybody have any examples of how to go about this?</p>
<p>Thanks.</p>
|
php
|
[2]
|
5,360,911 | 5,360,912 |
how to create a master design page then all other pages use that master design
|
<p>i have a backend and im sick of copying the css, and design layout each time i create a new page. how can i easily keep a master design and every new page i create i can write whatever i want and it will use the master design and tabs that ive set?</p>
<p>i dont want to get into smarty or anything related to that because its gonna take time to learn it. is there another alternative preferably something easy and fast?</p>
<p>thanks</p>
|
php
|
[2]
|
3,774,263 | 3,774,264 |
inplace_merge : why isn't inplace_merge merging the strings?
|
<p>Why isn't <code>inplace_merge</code> merging the strings in the code below?</p>
<pre><code>string src = "abc";
string new_str = "def";
src += new_str;
inplace_merge(src.begin(), src.begin()+3, src.end());
cout << src; // abcdef
</code></pre>
<p>Edit: I expected "adbecf"</p>
|
c++
|
[6]
|
3,176,721 | 3,176,722 |
Creating 'form' in javascript without html form
|
<p>I am trying to submit a form thru javascript on the fly (using jquery-form) </p>
<p>Is it possible to create 'FORM' update bunch of values in that 'FORM' using javascript without having HTML-form ?</p>
|
javascript
|
[3]
|
2,365,451 | 2,365,452 |
So confused about why vars work sometimes with or without var?
|
<p>I am really confused as to why sometimes vars will not work when "var" is declared in front of them when used in a namespaced object. Isn't adding "var" in front of every variable the correct thing to do to keep it outside the global namespace?</p>
<p>Or would creating any var without declaring "var" first in my namespaced object, ensure of this, so I don't eed to worry about "var"?</p>
<p>Here's an example of my code:</p>
<pre><code>MYNAME.DoStuff = {
initialize: function() {
var var1 = 'name'; //1
var2 = 'name'; //2
this.var3 = 'name'; //3
var $var4 = $('#' + name); //4
$var5 = $('#' + name); //5
this.$var6 = $('#' + name); //6
},
linkStuff: function() {
// then use the vars from the init above in here
}
}
MYNAME.DoStuff.initialize();
</code></pre>
<p>Can someone tell me which number (1, 2, or 3) is correct? Are there cases where I would use more than one or all? How about when I need to do DOM references with jQuery? Which way is correct (4, 5, or 6)?</p>
|
javascript
|
[3]
|
3,959,908 | 3,959,909 |
How to install android OS on SD card?
|
<p>does anyone knows if it's possible to install Android SO directly into SD Card, on a rooted phone?</p>
<p>Thanks</p>
|
android
|
[4]
|
1,705,564 | 1,705,565 |
Remove an element from an array in Javascript
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2003815/how-to-remove-first-element-of-an-array-in-javascript">How to remove first element of an array in javascript?</a> </p>
</blockquote>
<pre><code>function write() {
for (var x = 1; x <= 3; x++) {
var question = new Array("If you are goofy which is your leading foot", "Riding switch is when you do what", "On your toe side which way should you lean", "question 4", "question 5", "question 6");
var l = question.length;
var rnd = Math.floor(l * Math.random());
document.write(question[rnd]);
document.write("<br>")
}
}
</code></pre>
<p>This is my code but it outputs the same question(string) sometimes when i want the three questions to be unqique, how do i remove an element from the array after its output?</p>
|
javascript
|
[3]
|
2,957,902 | 2,957,903 |
add path into Current URL Location
|
<p>I am coding to change language by using Read with Korea Language</p>
<h1>Example:</h1>
<h1>Currently URL is:</h1>
<p><a href="http://www.domain.com/EN/index.php" rel="nofollow">http://www.domain.com/EN/index.php</a></p>
<h1>When user press onClick URL change to:</h1>
<p><a href="http://www.domain.com/KO/index.php" rel="nofollow">http://www.domain.com/KO/index.php</a></p>
<p>I mean that I just want to replace EN to KO then reload page again.</p>
<p>Appreciate for your help.</p>
|
javascript
|
[3]
|
6,030,451 | 6,030,452 |
Jquery with ASP.NET - My page method not returning all the records
|
<p>I can't get to use the asp.net jquery thing using the page method to get what i want. I have a simple table i'm getting data from but i only get one row returned from the page method in my aspx page.Code below if anyone can help Thanks in Advance</p>
<pre><code>[WebMethod] public static SComms comms() { SComms c = new SComms(); string connect = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; string query = "select * from dbo.Comms where dateadd(dd, datediff(dd, 0, created), 0) = dateadd(dd, datediff(dd, +10, getdate()), 0) order by 2"; using (SqlConnection conn = new SqlConnection(connect)) { using (SqlCommand cmd = new SqlCommand(query, conn)) { conn.Open(); SqlDataReader rdr = cmd.ExecuteReader(); if (rdr.HasRows) { while (rdr.Read()) { c.ListID = rdr["ListID"].ToString(); c.ListID = rdr["Title"].ToString(); } } } } //} return c; }
</code></pre>
<p>$(document).ready(function() { $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", data: "{}", url:"page.aspx/Comms", dataType: "json", success: function(data) { if (data.hasOwnProperty("d")) DoSomething(data.d); else DoSomething(data); } }); function DoSomething(msg) { //$("quote_wrap").append(msg); var SComms = msg; $('quote_wrap').append //I can only get one record here alert(SComms.Title); } }); </p>
<p>What i want as an output is e.g : </p>
<pre><code> <blockquote> <p>Ut eu consectetur nisi. Praesent facilisis diam nec sapien gravida non mattis justo imperdiet. Vestibulum nisl urna, euismod sit amet congue at, bibendum non risus.</p> <cite>– Quote Author (Quote 1)</cite> </blockquote>
</code></pre>
|
jquery
|
[5]
|
2,129,582 | 2,129,583 |
Access specifiers for constructors
|
<p>Suppose that there is a class A, Consider the following constructors:</p>
<pre><code>public A()
{
}
private A()
{
}
protected A()
{
}
</code></pre>
<p>Can anybody say what is the difference among the above 3 constructors? Why we need put access specifiers to constructors?</p>
<p>Thanks in advance.</p>
|
java
|
[1]
|
2,277,153 | 2,277,154 |
Programatically adding nested repeater controls upto N-levels?
|
<p>I'm creating a navigation menu. I've to render repeater control ul-li tags and menuitems can range upto N levels. I need to add a child repeater control dymnamically to parent control?</p>
<p>EDIT:
Example -
ul-li can goto n levels</p>
<pre><code><ul>
<li>
<ul>
<li>
<ul>
<li></li>
<li></li>
<li></li>
</ul>
</li>
<li></li>
<li></li>
</ul>
</li>
<li></li>
<li></li>
</ul>
</code></pre>
|
asp.net
|
[9]
|
2,483,789 | 2,483,790 |
Change JavaScript NaN Message to Something Else
|
<p>I've got an <code>input[type="text"]</code> that throws up a NaN error until another box is filled. I know why the message is appearing, that's not a problem, it's correct. I'm just wondering if I can change 'NaN' to something more descriptive for the user.</p>
|
javascript
|
[3]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.