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 |
---|---|---|---|---|---|
4,712,391 | 4,712,392 |
Get a tag that's inside a div with class
|
<p>I have the following html:</p>
<pre><code><div class="Checkbox">
<img src='../tema/default/images/CheckVerde.png' onclick="Visibilidade('41767', 'img08ptNA_41767_0', '10')" style='cursor:pointer;margin: 4px;text-align:center;' ID='img08ptNA_41767_0' />
</div>
</code></pre>
<p>I need get the src value of the img tag, via jQuery.
The img ID is dynamic</p>
<p>How can I do that ?</p>
|
jquery
|
[5]
|
4,778,501 | 4,778,502 |
PHP Rename problem!
|
<p>I have a problem using php rename function. If I use the following syntax it works fine.</p>
<pre><code><?php
rename("pages/file.php", "pages/xfile.php");
?>
</code></pre>
<p>but instead if I use this:</p>
<pre><code><?php
$val = '"pages/file.php"';
$rval = '"pages/xfile.php"';
rename($val, $rval);
?>
</code></pre>
<p>It does not work and gives an error:</p>
<pre><code>Warning: rename("pages/file.php","pages/xfile.php") [function.rename]: The system cannot find the path specified. (code: 123) in C:\wamp\www\page_rename.php on line 2
</code></pre>
|
php
|
[2]
|
3,047,210 | 3,047,211 |
Object required in validation
|
<p>I am trying to validate code in javascript. Here is my code:</p>
<pre><code>if(document.getElementById("name").value == ""){
alert("Name is a required field");
document.getElementById("name").focus();
return false;
}
</code></pre>
<p><code>name</code> is id in my html page:</p>
<pre><code><div class="app-form-box">
{% if review %}
{% if not review.name %}
<input type="text" alt="" onkeyup="return validateField(name)" tabindex="2" name="name" id="name" class="disabled inputtxtlarge" onfocus="highlightInput(this.id)" onblur="return (!validateField(name) || unhighlightInput(this.id))" maxlength="50" value="{{name|moonescape}}" disabled="disabled"/><span> </span>
{% else %}
<input type="text" alt="" onkeyup="return validateField(name)" tabindex="2" name="name" id="name" class="inputtxtlarge" onfocus="highlightInput(this.id)" onblur="return (!validateField(name) || unhighlightInput(this.id))" maxlength="50" value="{{name|moonescape}}"/><span> </span>
{% endif %}
{% else %}
<input type="text" alt="" onkeyup="return validateField(name)" tabindex="2" name="name" id="faname" class="inputtxtlarge" onfocus="highlightInput(this.id)" onblur="return (!validateField(name) || unhighlightInput(this.id))" maxlength="50" value="{{name|moonescape}}"/><span> </span>
{% endif %}
<div class="servererror">
{% if form_errors.name %}
* {{ form_errors.name|join:"| " }}<br/>
{% endif %}
</div>
</div>
</code></pre>
<p>But I am getting <code>OBJECT REQUIRED</code>. Please suggest how to put check in js file for this. Thanks </p>
|
javascript
|
[3]
|
933,338 | 933,339 |
c++ container allowing you to sort items by when they where last accessed?
|
<p>Does such a thing exist? or could anyone please recommend how I could implement such a container?</p>
<p>basically I have a std::map which uses a 64bit integer as its key and a custom datatype as the containing item.</p>
<p>I need to be able to periodically remove items that havent been accessed in a while in the most optimal way. does anyone have any suggestions for this?</p>
<p>cheers</p>
|
c++
|
[6]
|
1,798,648 | 1,798,649 |
c : /lib64/libc.so.6: version `GLIBC_2.11' not found (required by c )
|
<p>I am starting with IGPROF for memory profiling--</p>
<p>i installed it and done all the steps defined in - <a href="http://igprof.sourceforge.net/install.html" rel="nofollow">http://igprof.sourceforge.net/install.html</a></p>
<p>but when i am running:</p>
<blockquote>
<p>c++ -o vvvi-build-and-copy vvvi-build-and-copy.cc -ldl -lpthread</p>
</blockquote>
<p>i am getting error- </p>
<blockquote>
<p>c++: /lib64/libc.so.6: version `GLIBC_2.11' not found (required by c++)</p>
</blockquote>
<p>i google it but not getting what should i do?? i am using ubuntu right now.</p>
<p>Can you help me ?? plz tell me if you need any other info
Thanks in advance....</p>
|
c++
|
[6]
|
3,041,350 | 3,041,351 |
Definition of ONE asp.net application?
|
<p>How do you define <strong>ONE</strong> asp.net application? Does it have to be built under one solution or does it have to be deployed under one application under IIS? </p>
<p>Can multiple web projects be deployed under one IIS application (so that they have access to each other's session, cache etc) ?</p>
<p>This is just a theoretical question.</p>
<p><strong>Update:</strong> What I am stressing on is what makes it <strong>ONE</strong> application. </p>
|
asp.net
|
[9]
|
3,418,627 | 3,418,628 |
Grab another window by handle and show it as a preview/video in my form (C#)
|
<p>So basically I am trying to capture the output of a render window that is hidden by default to put into a controller application as a preview. I've been told by some people in my line of work that this is possible by grabbing the window handle and somehow putting that as a video on your existing form. But I have no clue how to do that currently (outside of getting the handle itself)</p>
<p>Been looking all morning and a bit yesterday and haven't found exactly what I need yet.</p>
<p>Trying to do this in C#</p>
|
c#
|
[0]
|
2,280,704 | 2,280,705 |
Android: Determine when an Activity has finished animating in to view?
|
<p>I'm trying to determine when an Activity has finished animating in to view on Android? The callback Activity.onStart() is called when an Activity is first added to the view heirarchy, but I can't seem to find a callback that happens the 300 milliseconds or so later when the activity has finished animating into view?</p>
|
android
|
[4]
|
5,999,041 | 5,999,042 |
What are the benefits of explicit type cast in C++?
|
<p>What are the benefits of explicit type cast in C++ ?</p>
|
c++
|
[6]
|
3,729,264 | 3,729,265 |
What is an easy way to create a trivial one-off Python object?
|
<p>I would like to create a trivial one-off Python object to hold some command-line options. I would like to do something like this:</p>
<pre><code>options = ??????
options.VERBOSE = True
options.IGNORE_WARNINGS = False
# Then, elsewhere in the code...
if options.VERBOSE:
...
</code></pre>
<p>Of course I could use a dictionary, but <code>options.VERBOSE</code> is more readable and easier to type than <code>options['VERBOSE']</code>.</p>
<p>I <em>thought</em> that I should be able to do</p>
<pre><code>options = object()
</code></pre>
<p>, since <code>object</code> is the base type of all class objects and therefore should be something like a class with no attributes. But it doesn't work, because an object created using <code>object()</code> doesn't have a <code>__dict__</code> member, and so one cannot add attributes to it:</p>
<pre><code>options.VERBOSE = True
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'object' object has no attribute 'VERBOSE'
</code></pre>
<p>What is the simplest "pythonic" way to create an object that can be used this way, preferably without having to create an extra helper class?</p>
|
python
|
[7]
|
1,016,969 | 1,016,970 |
how to calculate the 5th date from a date in javascript
|
<p>I have a date in a javascript variable </p>
<pre><code>var cDate='07/21/2012' `(mm/dd/YYY format)`
</code></pre>
<p>I need to find out the 5th day from the date in <code>cDate Variable</code> </p>
<p>ie newDate=<code>'07/26/2012'</code></p>
<p>suppose if the <code>cDate='07/28/2012' then newDate='08/2/2012'</code>
But I did know how. I have tried a lot and searched but my result is wrong.</p>
<p>Please replay </p>
<p>thanks in advance</p>
|
javascript
|
[3]
|
3,159,482 | 3,159,483 |
Do you still Hide from browsers that do not support JavaScript?
|
<p>Some of the examples I'm reading start with:</p>
<pre><code><script language="javascript" type="text/javascript">
<!-- Hide from browsers that do not support JavaScript
// --> Finish hiding
</script>
</code></pre>
<ol>
<li>Do you still wrap your js code in html comments?</li>
<li>Do you still include language="javascript"?</li>
<li>Do you still include type="text/javascript"?</li>
</ol>
|
javascript
|
[3]
|
233,307 | 233,308 |
list only devices using my application bluetooth android
|
<p>I want to list only devices which uses my application (bluetooth android).my purpose is to exchange data with users of my application </p>
|
android
|
[4]
|
5,263,386 | 5,263,387 |
Sensor power/notification rate issues
|
<p>I'm writing an app that extends the SensorEventListener interface to listen for changes to the barometer, which I log in a logfile. Before I start logging, I prepend a system time in milliseconds (let's call this Millisecond Timestamp 1, or MT1), and after the logging is finished, I append another system timestamp in milliseconds (let's call this Millisecond Timestamp 2, or MT2).</p>
<p>The SensorEvent has its own timestamp (which I will call Nanosecond Timestamps, or NT), which I also log, between MT1 and MT2.</p>
<p>The problem is this: If the phone goes to sleep during the logging, the SensorEvent rate seems to no longer occur at the rate which I set (for example, SENSOR_DELAY_FASTEST). Furthermore, even though the SensorEvent timestamp is supposed to represent the nanoseconds of uptime since the phone has been rebooted, there are "missing" nanoseconds--the time gap between MT2 and MT1 is often twice or more that between NTN (where N is the number of samples) and NT1.</p>
<p>I've been able to sort of resolve this issue by using PowerManager.Wakelock(), but that results in my app being a huge power hog and seems like a really clumsy hack. Is there any other way to work around this problem?</p>
|
android
|
[4]
|
3,721,817 | 3,721,818 |
Make a looping infinite scroll
|
<p>I am trying to make a scrollable <code><div></code> to contain a variable amount of items (2-20) that loop. I'd like to give it the appearance of a wheel, as in the iOS wheel selector <img src="http://i.stack.imgur.com/gZofr.jpg" alt="enter image description here"></p>
<p>I've searched about infinite scroll with jQuery but I only get results of the famous twitter and facebook functionality when it loads more content as you get closer to the bottom of the page. What I want is to replicate the items on the edges of the div, so that if you get closer to the bottom, items from the beggining would appear continually, without just appending more (it would get too big).</p>
<p>I am thinking about a way of doing this myself, without messing with the scroll when appending items at the beggining, but I'm sure there must be a plugin for this already.</p>
|
jquery
|
[5]
|
872,238 | 872,239 |
No matching function for call in library
|
<p>I have a class with the public function in a dynamic library:</p>
<pre><code>void setActiveAnimation(std::shared_ptr<MaJR::Animation> anim);
</code></pre>
<p>and when I attempt to call it like so:</p>
<pre><code> MaJR::Actor actor;
actor.setActiveAnimation(idleAnimation);
</code></pre>
<p>I get the following:</p>
<pre><code>/home/mike/NixCraft/main.cpp||In function 'int main()':|
/home/mike/NixCraft/main.cpp|12|error: no matching function for call to 'MaJR::Actor::setActiveAnimation(MaJR::Animation&)'|
/home/mike/NixCraft/main.cpp|12|note: candidate is:|
/usr/include/MaJR/Actor.hpp|16|note: void MaJR::Actor::setActiveAnimation(std::shared_ptr<MaJR::Animation>)|
/usr/include/MaJR/Actor.hpp|16|note: no known conversion for argument 1 from 'MaJR::Animation' to 'std::shared_ptr<MaJR::Animation>'|
||=== Build finished: 4 errors, 0 warnings ===|
</code></pre>
<p>What should I do?</p>
|
c++
|
[6]
|
3,369,698 | 3,369,699 |
Java - Double precision floating point
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/8103999/how-to-fix-double-precision-issue-in-java">how to fix double precision issue in java</a> </p>
</blockquote>
<p>I have a small piece of code like this:</p>
<pre><code>double number1 = 6;
double number2 = 5.99;
double result = number1 - number2;
</code></pre>
<p>However, the <code>result == 0.009999999999999787</code> instead of 0.01</p>
<p>I know it is the issue of IEEE 754 standard, but I don't understand why. Could you please explain it for me?</p>
|
java
|
[1]
|
5,655,615 | 5,655,616 |
How to use my custom library apk file in other applications
|
<p>I have my own custom library apk file (say lib.apk) & i want make it
available to other applications.
How to provide the uses-library in the android manifest.xml file in
other apps so as to use my custom library. </p>
|
android
|
[4]
|
3,120,492 | 3,120,493 |
Sending Emails get a NetworkOnMainThreadException
|
<p>I am using the following code to send emails in my app</p>
<p><a href="http://stackoverflow.com/questions/2020088/sending-email-in-android-using-javamail-api-without-using-the-default-built-in-a?lq=1">Sending Email in Android using JavaMail API without using the default/built-in app</a></p>
<p>This has worked before but now has stopped with a NetworkOnMainThreadExceoption. I know the solution is to use a AsyncTask but I do not know how to convert the class I have now to work with AsyncTask. Not used them before. </p>
<p>Below is the Send part of the class that is failing</p>
<pre><code>public class EmailProvider extends Authenticator {
private static String emailUsername = "";
private static String emailPassword = "";
private static String emailFrom = "";
private static String emailDefaultSMTPport =
private static String emailDefaultSocketFactoryPort =
private static String emailHost = "";
private boolean emailAuth;
private boolean emailDebuggable;
private Multipart emailMultipart;
public EmailProvider(Context context) {
//this.context = context;
emailDebuggable = false; // debug mode on or off - default off
emailAuth = true; // smtp authentication - default on
emailMultipart = new MimeMultipart();
}
public boolean send(String emailAddress, String pEmailSubject, String pEmailBody) throws Exception {
Properties props = setProperties();
Session session = Session.getInstance(props, this);
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(emailFrom));
msg.setRecipients(MimeMessage.RecipientType.TO, emailAddress);
msg.setSubject(pEmailSubject);
msg.setSentDate(new Date());
// setup message body
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setText(pEmailBody);
emailMultipart.addBodyPart(messageBodyPart);
// Put parts in message
msg.setContent(emailMultipart);
// send email
Transport.send(msg);
return true;
}
}
</code></pre>
<p>Thanks for your Time</p>
|
android
|
[4]
|
5,605,680 | 5,605,681 |
Python: Merging Two Lists
|
<p>I have two lists</p>
<pre><code> list1= [6, 1, 8, 1, 2]
list2= ["Mail Opened", "Mail Not Opened", "Mail Opened", "Mail Not Opened", "Mail Not Opened"]
</code></pre>
<p>I was to trying results like </p>
<pre><code>(14,"mailopened") (4,"mailnotopened")
</code></pre>
<p>First i tried to convert them Dict but it does not accept duplicate values.
is it Possible to add these lists according to the second list.</p>
|
python
|
[7]
|
5,269,722 | 5,269,723 |
Join paths in Python given operating system
|
<p>Background - I am using paramiko to put files on a bunch of remote servers, running several different operating systems, and with no Python installed on the remote systems. I need to specify remote directories for where the file should be put. Because different operating systems specify paths differently, I wanted to use some module.</p>
<p>I wanted to use <code>os.path.join</code>, but that gets its configuration from my local machine. Is there any way to specify the platform in one of the os module's methods, or something similar?</p>
<p>EDIT: Also during ssh sessions with paramiko.</p>
|
python
|
[7]
|
5,210,935 | 5,210,936 |
jQuery replacement of Prototype method
|
<p>I have the following script which will change the background image of a text box on focus and retain the previous image ob blur, if the content is emapty.The images are something like watermarks.This is making use of prototype javascript library.</p>
<pre><code> <div class="searchfield">
<asp:TextBox ID="txtStoreId" runat="server" class="username searchbg"></asp:TextBox>
<script type="text/javascript">
//<![CDATA[
var storeidLabel = new FormLabel('txtStoreId', {image:'../lib/images/store_id.gif', emptyImage:'../lib/images/bg_userpw_notext.gif'});
//]]>
</script>
</div>
</code></pre>
<p>Now i want to have the jQuery replacement of this.I am already using jQuery in my page.I want to take the prototype away from my page.</p>
|
jquery
|
[5]
|
3,162,439 | 3,162,440 |
Warning Avoid using implementation types like 'HashMap'; use the interface instead
|
<p>I am getting this warning on Sonar.
What It means.
The class in which i get this warning is as:</p>
<pre><code>class A{
private HashMap<String, String> map=new HashMap<String, String>();
//getters and setters
}
</code></pre>
<p>Please,I want Proper Solution to avoid warning on Sonar.</p>
|
java
|
[1]
|
2,142,594 | 2,142,595 |
What am I doing wrong trying to center this div? (its a little off)
|
<p>I am trying to center a div horizontally to a marker as you can see here <a href="http://jsfiddle.net/rKejG/8/" rel="nofollow">http://jsfiddle.net/rKejG/8/</a>, however it's a little more to the right than it should be.</p>
<p>This is my code</p>
<pre><code>$("#infobox").css({
marginLeft: (parseInt($("#content").width(), 10) / 2) - (parseInt($("#infobox").width(), 10) / 2) + 'px'
});
</code></pre>
<p>Then I realized that I should probably add the halves of <code>content</code> and <code>infobox</code> and put them in a negative margin, but that made it a whole lot worse:</p>
<pre><code>$("#infobox").css({
marginLeft: '-' + (parseInt($("#content").width(), 10) / 2) + (parseInt($("#infobox").width(), 10) / 2) + 'px'
});
</code></pre>
<p><code>Result: margin-left: -16110.5px</code></p>
<p>What am I doing wrong here? Thanks!</p>
|
jquery
|
[5]
|
1,557,190 | 1,557,191 |
Using indexOf() in JS - is it wise to negate null values and how?
|
<p>When searching through an array how do we deal with white spaces? Do we say a search returns false if the user types in nothing (i.e. just presses enter) or types in a blank space? </p>
<pre><code>test_pages=[
"Lorem Ipsum is simply dummy text of the printing and typesetting industry."
,
"It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout",
"There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable."
]
var find=prompt("Enter a term");
find = find.toLowerCase();
for(i=0;i<test_pages.length;i++)
{
// normalisation
test_pages[i] = test_pages[i].toLowerCase();
// use indexOf() to find the occurrences of pattern
if(test_pages[i].indexOf(find)>=0)
{
alert("true");
break;
}
else if(test_pages[i].indexOf(find)<0)
{
alert("false");
}
}
</code></pre>
|
javascript
|
[3]
|
249,499 | 249,500 |
Lightbox doesn't work on Append
|
<p>I've encountered a problem here.
After I scroll down and more pictures are append to the previous html, lightbox doesn't work. It works for the first few pictures that are loaded when users enter the site but not those which are append-ed.
I read "<a href="http://stackoverflow.com/questions/7652726/lightbox-not-working-on-ajax-load-parts">Lightbox Not Working on AJAX Load Parts</a>" and it said to use live() function. I've tried adding it in many places in the script but it doesn't work. Help guys?</p>
<pre><code> <script type="text/javascript">
$(function() {
$('#searchResults a').lightBox();
});
</script>
<script>
var loadMore = true;
var page = 1;
var loading = false;
$(window).scroll(function(){
//$(window).live('scroll', function(){
// if ($(window).scrollTop() == ($(document).height() - $(window).height()) && loadMore && !loading){
if ($(window).scrollTop() > (($(document).height() - $(window).height())-100) && loadMore && !loading){
loading = true;
page+=1;
$('#searchResults').append('<hr><div id="page' + page + '" class="content"></div>');
cloudLoad('more.php?page=' + page, 'page' + page);
}
});
</script>
function cloudLoad(url, id) {
if(id === undefined) {
$.post(url);
} else {
if(document.getElementById(id) !== undefined) {
$.getJSON(url, function(data) {
$.each(data, function(key, val) {
$('#'+id).html(val);
});
});
console.log(url);
}
}
}
</code></pre>
<p>Thanks(:</p>
|
jquery
|
[5]
|
715,287 | 715,288 |
Why does my code ignore a true if-condition?
|
<p>I've got the following code:</p>
<pre><code> private static void checkCodesInPlayerCenter(GameObject player)
{
Vector2 collisionCenter = player.GetCollisionCenter(player.PublicCollisionRectangle);
if (TileMap.GetMapSquareAtPixel(collisionCenter) == null)
{
return;
}
for (int i = 0; i < TileMap.GetMapSquareAtPixel(collisionCenter).Codes.Count; ++i )
</code></pre>
<p>It is possible that sometimes the object I get from GetMapSquareAtPixel is null. To not cause a NullReferenceException in the for-loop I decided to check is its null, and if so end the function early, however it seems to completely ignore the if-condition, even if the object returned is null.
I've set a breakpoint on the return statement but the code never goes there and instead triggers the NullReferenceException I tried to avoid.</p>
<p>Any help please? </p>
|
c#
|
[0]
|
4,345,809 | 4,345,810 |
How to install an application on an Android phone?
|
<p>I create an android application. I need the check, how my application is working on the device. How to install the application on the android device ? </p>
<p>-Thanks in advance </p>
|
android
|
[4]
|
5,036,755 | 5,036,756 |
What do @ and lambda mean in Python?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/739654/understanding-python-decorators">Understanding Python decorators</a> </p>
</blockquote>
<p>Just trying to "port" some Python code to Java, I came then across the following
funny Python line:</p>
<pre><code> @fake(lambda s, t, n: [(s.field(i+1), s) for i in range(n)])
def split(secret, threshold, num_players):
shares = []
for i in range(1, num_players+1):
# do some shares calculation
return shares
</code></pre>
<p>There are quite some interesting constructs in this one that I never noticed before. Could anyone tell me what is the deal with this @fake thingy?</p>
<pre><code>def fake(replacement):
"""Replace a function with a fake version.
def decorator(func):
fakes = os.environ.get('FUNC_FAKE', '')
if fakes == '*' or func.__name__ in fakes.split():
return replacement
else:
return func
return decorator
</code></pre>
<p>Further, does this lambda stand for a function name or what is the deal with that?</p>
|
python
|
[7]
|
1,698,471 | 1,698,472 |
making a new folder using php code
|
<p>I just wanna ask, what is the code needed in my code in order this warning will not show </p>
<blockquote>
<p>Warning: mkdir() [function.mkdir]: File exists in
C:\xampp\htdocs\php-robert\dir\dir.php</p>
</blockquote>
<p>also did my program is correct? what i want in my program is, if the folder is not exist, make a folder, if its existing just do nothing.. nothing to show, just nothing</p>
<p><strong>dir.php</strong>
</p>
<pre class="lang-php prettyprint-override"><code><?php
$var = "MyFolder";
$structure = "../../file/rep/$var";
if (!mkdir($structure, 0700)) {
}
else
{
echo"folder created";
}
?>
</code></pre>
|
php
|
[2]
|
1,875,413 | 1,875,414 |
php how to check if system commands are available for use?
|
<p>How do i check if system commands like exec() , popen() , etc are available to use ?</p>
<p>Something like this :</p>
<pre><code><?php
function($cmd)
{
if($cmd available)
{
//do nothing
}
else
{
exit();
}
}
?>
</code></pre>
<p>And check if the php file has access to a command eg. If safe mode is on it should return false.</p>
|
php
|
[2]
|
4,680,605 | 4,680,606 |
please suggest a good VIDEO PLAYING library for android
|
<p>I am looking for a good video player ( library ) for android, which would be able to play video files onto a surfaceview or something, allowing me to overlay it with my own play/pause buttons, progress bar, etc.</p>
<p>What library would you suggest?</p>
<p>Thanks! ;)</p>
|
android
|
[4]
|
5,664,898 | 5,664,899 |
How to require non-blank text on an Alert Input Dialog
|
<p>I would like to retrieve user input via an Alert Dialog... is there any way to make it so that the user cannot press Ok if the EditText is blank? I mean require that he type something in?</p>
|
android
|
[4]
|
4,406,838 | 4,406,839 |
How to split a deliminated string with encapsulation and escapes
|
<p>I would like to split a string deliminated by a character such as ‘&’, but in the case where some values contain the deliminator I would like to escape with double quotes. What is an elegant approach to splitting while ignoring the deliminating characters that have been escaped while also accounting for escape character escapes? </p>
<p>For example split this string properly</p>
<pre><code>var1=asdfasdf&var2=contain””quote&var3=”contain&delim”&var4=”contain””both&”
</code></pre>
<p>Into:</p>
<pre><code>var1=asdfasdf
var2=contain"quote
var3=contain&delim
var4=contain"both&
</code></pre>
<p>Incidentally, I am thinking Regex...</p>
|
c#
|
[0]
|
3,898,270 | 3,898,271 |
How to capitalize a word I am pulling from the name of the document
|
<p>I am getting the name of my document like this...</p>
<pre><code><?= basename($_SERVER['PHP_SELF'],'.php')?>
</code></pre>
<p>It is an all lowercase word. How to get the first letter to be capitalized when it appears on my page?</p>
|
php
|
[2]
|
5,136,638 | 5,136,639 |
what should i make for final year project using java?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/892731/computer-science-final-year-project-ideas">Computer science final year project ideas</a> </p>
</blockquote>
<p>i know core java and am in the phase of learning J2ee.i want to make a project for my final year on java language.
i donot want to make any application like-airline reservation or managememt .
please recommend what tools and platform shall i use for making project using j2ee.
any suggestion for the topic for the project ?</p>
|
java
|
[1]
|
2,714,382 | 2,714,383 |
How to validate a string which contains at least one letter and one digit in javascript?
|
<p>It doesn't matter how many letters and digits, but string should contain both.</p>
<p>Jquery function <code>$('#sample1').alphanumeric()</code> will validate given string is alphanumeric or not. I, however, want to validate that it contains both.</p>
|
javascript
|
[3]
|
2,485,578 | 2,485,579 |
Randomizing elements postion into Array
|
<p>I have a array of 4 elements. I need to randomize there position. What will be best way to do it in Java.</p>
|
java
|
[1]
|
172,997 | 172,998 |
What is the data type of vptr?
|
<p>Any class having a virtual function would get an extra hidden pointer which would point to the most derived class.</p>
<p>What is the type of this vptr?</p>
|
c++
|
[6]
|
2,440,633 | 2,440,634 |
android and itext
|
<p>I want to display pdf in android with next/previous and zoom effect,i check out the already exits the lib for that but it is too slow then, I move to itext.
I install the jar file and code to get the total number pages.
But question how i can display the pdf,i mean to say take the text view,then how i will manage the background of the pdf,so there are many query.
Can anybody help me out if some-one have gone through the steps</p>
<p>Thanks in advance and every suggestion wel come here.</p>
|
android
|
[4]
|
1,641,630 | 1,641,631 |
jQuery slider with hover navigation and pause - not using plugin
|
<p>In my later days of writing jQuery as raw as possible, and not having loads of jQuery plugins stacking up and slowing my page down - I'm trying to create my own slider.</p>
<p>I have created a fiddle of how far I have got so far.</p>
<p>My HTML markup is not dynamic - and the slide animate process is positional only.</p>
<p><br /></p>
<p>The complications I'm having is the animations have to fully run before the next animation can begin which makes my animations begin to queue up if you hover the menu lots.</p>
<p>I need an animation to stop half way though if the hover changes, and automatically run to the next animate position. Hope this makes sense, you will see what I mean in the <a href="http://jsfiddle.net/EYDtF/" rel="nofollow">fiddle</a>.</p>
<p>Also, I want the animation to automatically run through each slide and 2000ms - and if the slide itself is hovered, I would like it to pause.</p>
<p>I know I'm pretty much asking for someone to write me a custom slider script, but it would so helpful and intuitive to see how a raw one is written with out a plugin.</p>
<p>I need my slider to be lightweight, hence not generating extra markup. Like all the plugins I've tried just are to heavy and too much. I like plain jquery.</p>
<p><br /></p>
<p>Any help would be sooo appreciated. Thanks</p>
<p><br /></p>
<p>Please see my miniature fiddle example using the latest jQuery.</p>
<p><a href="http://jsfiddle.net/EYDtF/" rel="nofollow">http://jsfiddle.net/EYDtF/</a></p>
<p><img src="http://i.stack.imgur.com/v31k9.png" alt="enter image description here"></p>
|
jquery
|
[5]
|
4,948,431 | 4,948,432 |
SpannableString - setTag
|
<p>SpannableString does not have setTag, is there a possible workaround to this? It would be good to know behind the scenes which word has been clicked for extra data processing.</p>
|
android
|
[4]
|
5,656,740 | 5,656,741 |
How to determine the first element in a recursive foreach function?
|
<p>I have a function generating nested navigation menu:</p>
<pre><code>function recursive_foreach($array, $display) {
$out = '<ul>';
foreach($array as $key => $value) {
...
$out .= '<li class="'. $is_active . $is_parent . '"><a href="' . $url . '">' . $value['name'] . '</a>'; }
...
$out .= "</li>";
}
$out .= '</ul>';
return $out;
}
</code></pre>
<p>I want to add css class just to the first "ul" element. I know how to determine first element inside foreach loop but how can I get it outside of it?</p>
|
php
|
[2]
|
1,775,669 | 1,775,670 |
Contact form error PHP
|
<p>Trying to write a contact form script only my following page isnt processing...</p>
<pre><code><?php
$rpname = $_POST['name'];
$rpnumber = $_POST['phone'];
echo $rpname;
echo $rpnumber;
$rpname = $_POST['name'];
$rpnumber = $_POST['phone'];
$to = "liam@.co.uk"; // CHANGE THIS TO EMAIL YOU WANT
$subject = "Phonecall Request"
//begin of HTML message
$message = "
Phone call request -
From : $rpname,
Number: $rpnumber
";
$headers = "MIME-Version: 1.0rn";
$headers .= "Content-type: text/html; charset=iso-8859-1rn";
$headers .= "From: Website Enquiry";
if (isset($rpname))
{
// now lets send the email.
mail($to, $subject, $message, $headers);
$page='index.html';
header('Location:'.$page);
header('Location: ' . $_SERVER['HTTP_REFERER'] . '?e=Message Sent!');
} ?>
</code></pre>
<p>Ive tried to echo the variables at the top but im getting a blank page with no source...</p>
|
php
|
[2]
|
2,836,074 | 2,836,075 |
Add label to UITextField
|
<p>In question <a href="http://stackoverflow.com/questions/663830">663830</a>, Isaac asks about adding a button to a text field. Can someone show code to add a label to the .rightView property?</p>
<p>Or, is there some better way to include 'permanent' text in a text field?</p>
<p>This is for a calculator that would include units in the field (mg, kg, etc.) without having to maintain a label outside of the text field. Sort of like permanent placeholder text?</p>
<p>Thanks,
Chris</p>
|
iphone
|
[8]
|
3,765,646 | 3,765,647 |
Comparing Strings Java
|
<p>I am trying to compare a string to a string value. Seems rather simple, however, the comparison is returning null. All I want is to output the matched value and ignore the null return. But the output is showing the null value as well. I have tried this in various ways, but it keeps showing the null value.</p>
<pre><code> class ActionMovie extends cdinventoryprogram {
private String Atitle;
private double Avalue;
private double Rstock;
private String Ctitle;
public ActionMovie(String title, int itemNumber, int numberofUnits, double unitPrice ){
Atitle = title;
Avalue = numberofUnits * unitPrice;
Rstock = unitPrice * .05;}
public String getActionTitle(){
if (Atitle.equals("Matrix")){
Ctitle = Atitle;
}else if (!Atitle.equals("Matrix")){
}
return Ctitle;
}
</code></pre>
<p>}</p>
<p>public class cdinventoryprogram {</p>
<pre><code>public static void main(String[] args) {
ActionMovie myAction[] = new ActionMovie[DEFAULT_LENGTH];
myAction[0] = new ActionMovie ("The Illusionist", 1, 5, 15.99);
myAction[1] = new ActionMovie ("Matrix", 2, 3, 14.99);
myAction[2] = new ActionMovie ("Old School", 3, 6, 12.99);
for ( ActionMovie currentActionMovie : myAction ){
CAction = currentActionMovie.getActionTitle();
JOptionPane.showMessageDialog( null, "Your action movie is: " + CAction);
</code></pre>
<p>}}
}</p>
|
java
|
[1]
|
2,252,675 | 2,252,676 |
set table cell width with w/ jQuery
|
<p>Ok, here's a puzzler...</p>
<p>I have a table that is drawn dynamically. Categories labels go in YELLOW, items labels in green.</p>
<p><img src="http://i.stack.imgur.com/76YxV.gif" alt="enter image description here"></p>
<p>The area where the table is located is limited, so I need to truncate long labels inside cells using jQuery plugin. The plugin allows using either numeric value for width or "auto", however I would like to add some login to determine what the numeric values should be.</p>
<p>Table width is 700px.
I can also use jQuery to count how many category columns exist.
I also can determine what is the widest label in Green area. Here's my code:</p>
<pre><code>// widest item label (GREEN)
var w = 0;
$(".tData tr td:nth-child(1)").each(function(){
if($(this).width() > w){
w = $(this).width();
}
});
// count category columns (YELLOW)
var colCount = 0;
$(".tData tr:first th:gt(0)").each(function () {
if ($(this).attr("colspan")) {
colCount += +$(this).attr("colspan");
} else {
colCount++;
}
});
var tableWidth = 700,
minWidthCat = 30,
maxWidthCat = 100,
minWidthItem = 100
maxWidthItem = 300;
widthCat = minWidthCat;
widthItem = minWidthItem;
catWmin = Math.floor((tWidth - minWidthCard) / colCount);
catWmax = Math.floor((tWidth - maxWidthCard) / colCount);
// NEED HELP HERE!!!
if () {
}
// truncate categories
$(".tData tr:first th:gt(0)").truncate({
width: widthCat
});
// truncate items
$(".tData tr td:nth-child(1)").truncate({
width: widthItem
});
</code></pre>
<p>Need help with logic that makes the most sense. If I don't have to truncate I rather not set the width for <strong>Category columns</strong>, but they have to be <strong>all the same width</strong>. </p>
|
jquery
|
[5]
|
1,561,741 | 1,561,742 |
Javascript - EMAPI API - Pasting an array into an object
|
<p>I've got this EMAPI API for my script, and two arrays of latitudes and longtitudes from which a line should be drawn. Theres an api function for this:</p>
<pre><code>obj.push(new EMAPI.Object.PolylineObject({name:'lamana_1', label: 'Łamana 1', labelVisible: true, labelXOffset:-10, labelYOffset:-20, fontSize: 16, fontFamily: 'arial', fontColor:'#339933', lonLat:[new EMAPI.LonLat(19.457817, 51.759553), new EMAPI.LonLat(19.447817, 51.749553), new EMAPI.LonLat(19.453817, 51.744553)]}));
</code></pre>
<p>Specifically I'm concerned with this part:</p>
<pre><code>lonLat:[new EMAPI.LonLat(19.457817, 51.759553), new EMAPI.LonLat(19.447817, 51.749553), new EMAPI.LonLat(19.453817, 51.744553)]
</code></pre>
<p>How do I pass the lons and lats from the mentioned arrays in here? They all have to be in this object for a line to be drawn. I tried nesting a for loop but it gave me nothing.</p>
|
javascript
|
[3]
|
1,327,227 | 1,327,228 |
view.setId problem in Android?
|
<p>HI,
I have a imageView iv1 in my app, and i want to set a phone number as id to the imagview,so that whenever i click i need to do some operation using the phone no.
i have done like this :
<code>String res = util.removeCharacters(value, "0123456789");
Long var = Long.parseLong(res); System.out.println("Sketch"+var.intValue()); iv2.setId(var.intValue());</code>
Here removerCharacters returns String, that i was converted to long and then i was converted to integer. But i got -1 as the id when i click. Please help whats wrong with this ?</p>
|
android
|
[4]
|
3,120,800 | 3,120,801 |
display UIViewController
|
<p>Is this the right way to call UIViewController programmtically when play button is pressed</p>
<pre><code>UIBarButtonItem *systemItem1 = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemPlay
target:self
action:@selector(playaudio:)];
systemItem1.style = UIBarButtonItemStyleBordered;
-(void) playaudio: (id) sender
{
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"theme"
ofType:@"mp3"];
NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:filePath];
audioPlayer = [[AVAudioPlayer alloc]
initWithContentsOfURL:fileURL error:nil];
audioPlayer.currentTime = 0;
[audioPlayer play];
[fileURL release];
UIViewController* flipViewController = [[UIViewController alloc]init];
[self.view addSubview:flipViewController.view];
}
</code></pre>
|
iphone
|
[8]
|
3,291,627 | 3,291,628 |
How to check if a function is callable with parameters?
|
<p>I'm calling a function with call_user_func_array :</p>
<pre><code>call_user_func_array(array($this, 'myFunction'), array('param1', 'param2', 'param3'));
</code></pre>
<p>Everything is ok unless I don't know how many parameters the function needs.
If the function needs 4 parameters it sends me an error, I'd like to test if I can call the function (with an array of parameters).
is_callable() doesn't allow parameters check.
Edit : If the call fails I need to call another function, that's why I need a check.</p>
<p>Thanks!</p>
|
php
|
[2]
|
4,217,163 | 4,217,164 |
jquery performance issue
|
<p>I am running into some jquery performace issues. I am having a select dropdown with a class name as 'dropdownClass'. In some cases, I did not want to display dropdown so instead I using the hidden variable with the same class.</p>
<p>Here is the <a href="http://jsfiddle.net/S5SGt/1/" rel="nofollow">link to the sample code</a>.</p>
<p>Right now in the above example, I have only 4 rows, so everything looks fine. But on my project, I am working with lot more rows, and around 7 columns. I want to know if there is a better way I can get to select the elements with class 'dropdownClass'. I see I have no other choice than to use $('.dropdownClass') because I have two different tags using it. I am getting an error whether to stop the script on my page.</p>
|
jquery
|
[5]
|
4,137,521 | 4,137,522 |
How can I get a reference to an EditText in a ListView?
|
<p>I'm creating a form that uses a ListView. Each row in my ListView is defined by form_item.xml:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView android:id="@+id/textFormItem"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="16sp"
android:ellipsize="end" android:singleLine="true" />
<EditText android:id="@+id/editFormItem"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:scrollHorizontally="true" />
</LinearLayout>
</code></pre>
<p>I'm planning to stick this layout into a custom Adapter that subclasses <code>SimpleAdapter</code>. But I'm wondering how will I be able to access each EditText and get a reference to it.</p>
|
android
|
[4]
|
655,679 | 655,680 |
QR Reader in android
|
<p>I want to integrate QR Reader in my android app without integrating third party tool and also need auto scan feature .I reviewed few tutorials using zxing libraries but scanning is not done in them.It generally captures image to sdcard and then access it and which doesnt give result every time....
Please help experts .</p>
|
android
|
[4]
|
4,638,111 | 4,638,112 |
onMouseOver(SomeInt, SomeString) not working
|
<p>I'm creating the following div using javascript, task_id is an int and person_name is a string, why is my alert not working!
when i send 2 integers, the alert works fine, when i send 2 strings the alert still doesn't work, what am i doing wrong?</p>
<pre><code>'<div " onMouseOver="Drag(' + task_id + ',' + person_name +');"</div>'
.....
function Drag(id, name){
alert(id + " " + name);
}
</code></pre>
<p>thanks a million in advance</p>
|
javascript
|
[3]
|
5,904,286 | 5,904,287 |
Enum stubs in Interfaces?
|
<p>I've got an enum defined in one of my Enum.cs classes inside this project where these interfaces lie.</p>
<p>I've got an Interface called IPhoto and in it I need to put a property called FileType because other methods in this service expect it so I want any class implementing IPhoto to have this defined so they know about it.</p>
<p>Does this seem out of place or you just wouldn't do such a thing? How would I define this then?</p>
<p>I mean I can't just do this:</p>
<pre><code>MyEnum FileType;
</code></pre>
<p>The thing is all files have a type. And in my concrete classes I signal that using an Enum (so jpeg, etc.). So any class implementing this needs to definitely have a FileType property somehow.</p>
|
c#
|
[0]
|
4,373,733 | 4,373,734 |
How the send a webform by email
|
<p>I have a task in hand that requires me to send a form to a client by email as soon as it is submited.</p>
<p>My question is: Having an aspx(in order to reuse my form) how can I get the generated html to send it by mail?</p>
<p>Thanks in advance</p>
<p><strong>EDIT:</strong>
I know how to send emails, what I am looking for is how to get the html that is generated in my webform so i can place it in the email.</p>
|
asp.net
|
[9]
|
5,738,010 | 5,738,011 |
To Give shortcutkey to contextstrip items in run time
|
<p>I am adding a list of items to a context strip at runtime. Is it possible to add a shortcut key to these items at run time...</p>
|
c#
|
[0]
|
18,669 | 18,670 |
How to prevent execution of an event before until the last call is completed
|
<p>I have this jQuery event:</p>
<pre><code>$('#button-next').bind('click', function() {
$.ajax({
type: "GET",
dataType: "json",
url: 'index.php?route=product/category/display&cat=any&limit='+p+',1',
cache: false,
success: function(data) {
var text = data.output;
goForward('scroller', text);
p++;
}
});
});
</code></pre>
<p>That inserts a new item to the list and removes the last one. The problem is if the user starts clicking on the button so fast, it gets messed up. I need a way to prevent new calls before that last one is finished.</p>
|
jquery
|
[5]
|
1,342,579 | 1,342,580 |
Write int to text file using Writer
|
<pre><code>Writer wr = new FileWriter("123.txt");
wr.write(123);
wr.close();
</code></pre>
<p>Output file contains:<br>
<code>{</code></p>
<p>Where is the problem? How to write <code>int</code> to text file using <code>Writer</code>?</p>
|
java
|
[1]
|
888,095 | 888,096 |
python 2.7.3 already installed(but no pysqlite). how to add it to my virtualenv?
|
<p>I already installed python 2.7.3 into a directory and created virtualenvs using this python . Now, when I tried to run ipython, it said it needs sqlite for saving history. So i tried installing using pip install pysqlite, but it is returning errors. </p>
<p>src/module.c: In function ‘init_sqlite’:</p>
<p>src/module.c:426: warning: implicit declaration of function ‘sqlite3_libversion’</p>
<p>src/module.c:426: warning: passing argument 1 of ‘PyString_FromString’ makes pointer from integer without a cast</p>
<p>error: command 'gcc' failed with exit status 1</p>
|
python
|
[7]
|
546,955 | 546,956 |
parallel programming
|
<p>i wonder if its possible to use parallel programing in web applications. is it possible to have such things</p>
<p>Parallel.For(2, 20, (i) =>
{
var result = SumRootN(i);
Console.WriteLine("root {0} : {1} ", i, result);
});</p>
<p>in web?</p>
|
c#
|
[0]
|
1,357,652 | 1,357,653 |
Math.floor(Math.random()) what does +1 actually do?
|
<p>When you have <code>Math.floor(Math.random()*10)+1</code> its supposed to pick a random number between 1-10 from what I understand. </p>
<p>However, when I change the <code>+1</code> to any number higher or lower then <code>1</code> I get the same result. Why is this? What does the <code>+1</code> mean exactly?</p>
|
javascript
|
[3]
|
4,988,560 | 4,988,561 |
Login to shopping Cart in ASP.NET
|
<p>In a web application which I found it has been decided the user must have logged in or registered as a new user before they can either view the shopping cart or place an item in it. So if the user selects an item to add to the cart and they are not logged in, they must be forced to login or register. My question is, what is the main approach to handling this situation in ASP.NET?</p>
|
asp.net
|
[9]
|
4,491,153 | 4,491,154 |
Method parameters confusion
|
<p>Often time methods take more than 3 parameters which are all of the same type, eg.</p>
<pre><code>void mymethod (String param1, String param2, String param3)
</code></pre>
<p>then it's very easy for the client to mix up the parameters orders, for instance inverting param1 and param2:</p>
<pre><code>mymethod (param2, param1, param3);
</code></pre>
<p>...which can be the cause of much time spent debugging what should be a trivial matter.
Any tips on how to avoid this sort of mistake (apart from unit tests) ?</p>
|
java
|
[1]
|
5,190,262 | 5,190,263 |
mpmovieviewcontroller not working in my application
|
<p>I want to play youtube video link through my application without using webview.. MPMovie view controller is not working in my project.. </p>
<p>Is any buddy have any tutorial or example code then plz share it to me.. </p>
<p>thnx</p>
|
iphone
|
[8]
|
3,050,472 | 3,050,473 |
how to pass arguments?
|
<p>i am writing a small game and i want to pass from a method that will pass it to other method that will do something with that number. here is what i try:</p>
<pre><code> public static int MatchesStart()
{
Console.Write("how many matches do you want to play with?");
string matchesStartingNumber = Console.ReadLine();
int matchesOpeningNumber = Convert.ToInt32(matchesStartingNumber);
for (int i = 0; i < matchesOpeningNumber; i++)
{
Console.Write("|");
}
return matchesOpeningNumber;
}
public static int RemoveMatches( *** i want here: matchesOpeningNumber )
{
///to do somthing with matchesOpeningNumber.
}
</code></pre>
<p>when i try to pass it to the second method its failing.. :( why is that?</p>
|
c#
|
[0]
|
3,828,799 | 3,828,800 |
SimpleDateFormat convert
|
<pre><code>SimpleDateFormat format = new SimpleDateFormat("GD_yyyyMMdd_HHmmss");
System.out.println(format.format(new Date()));
</code></pre>
<p>I want a result like <code>'GD_20120604_164534'</code>but the result is <code>AD156_20120604_165315</code></p>
<p>how to set the param can return my willing result.thanks advance!</p>
|
java
|
[1]
|
526,594 | 526,595 |
Cascaded split for more than one separator?
|
<p>I have this code: </p>
<pre><code>"12:30-14:40".split("-")
</code></pre>
<p>Its output is: </p>
<pre><code>["12:30", "14:40"]
</code></pre>
<p>I need to have and array like this:</p>
<pre><code>[["12","30"],["14","40"]]
</code></pre>
<p>How can I do something equivalent of a <em>cascaded split</em> on the same line to get the second result?</p>
|
javascript
|
[3]
|
4,849,704 | 4,849,705 |
Android: GameGuardian doesn't find the values of my app?
|
<p>I've created a simple app, with a button and a TextView. My value starts at 100 and is stored in an integer variable. When you press the button the value decreases by 1 and the TextView is updated.</p>
<p>I installed the application on my phone and tried to find the value with GameGuardian... Fortunately for others, unfortunately for me GameGuardian doesn't find my value...</p>
<p>How do I need to change my code so GameGuardian can find it?</p>
<p>Thanks in advance!</p>
|
android
|
[4]
|
3,367,347 | 3,367,348 |
How do I make a button switch to a new activity?
|
<p>I am trying to start a new activity using a button, but the new activity only shows for about five seconds and comes back. This is what my code looks like:</p>
<pre><code>public class Splash extends Activity implements OnClickListener{
Button next, Previous, menu;
ViewFlipper vf;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
next = (Button)findViewById(R.id.Button01);
menu = (Button)findViewById(R.id.menu);
Previous = (Button)findViewById(R.id.Button02);
vf = (ViewFlipper)findViewById(R.id.ViewFlipper1);
next.setOnClickListener((OnClickListener) this);
Previous.setOnClickListener((OnClickListener) this);
menu.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(Splash.this, Menu.class);
startActivity(intent);
}
});
}
public void onClick(View v) {
// TODO Auto-generated method stub
if(v==next){
vf.showNext();
}
if(v==Previous){
vf.showPrevious();
}
}
}
</code></pre>
<p>This is the code for the Menu activity. It's incomplete, though:</p>
<pre><code>public class Menu extends AFFIRMATION implements OnClickListener{
Button about;
Button contact;
Button products;
Button cards;
//@override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.menu);
about = (Button)findViewById(R.id.button1);
contact = (Button)findViewById(R.id.button2);
products = (Button)findViewById(R.id.button3);
cards = (Button)findViewById(R.id.button4);
}
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
}
}
</code></pre>
|
android
|
[4]
|
2,187,755 | 2,187,756 |
What's the simplest way to subtract a month from a date in Python?
|
<p>If only timedelta had a month argument in it's constructor. So what's the simplest way to do this?</p>
<p><b>EDIT:</b> I wasn't thinking too hard about this as was pointed out below. Really what I wanted was any day in the last month because eventually I'm going to grab the year and month only. So given a datetime object, what's the simplest way to return <b>any datetime object that falls in the previous month</b>?</p>
|
python
|
[7]
|
817,992 | 817,993 |
Java 2d array of objects
|
<p>I have a cell object with function </p>
<pre><code>public class Cell {
static int X;
static int Y;
static int Val = 0;
static int Player = 0;
public Cell(int a, int b, int p) {
// TODO Auto-generated constructor stub
X = a;
Y = b;
Val = 0;
Player = p;
}
</code></pre>
<p>With additional function updateX, updateY, updateVal, updatePlayer and respective get functions. It is called by</p>
<pre><code> Cell[][] grid = new Cell[7][6];
for(int i = 0; i < 7; i++)
for(int j = 0; j < 6; j++)
{
grid[i][j] = new Cell(i, j, 0);
}
System.out.println("wasd");
grid[0][1].updatePlayer(1);
grid[0][1].updateVal(1);
System.out.println("grid[0][1].getval = " + grid[0][1].getVal() + " grid[1][1].getval = " + grid[1][1].getVal());
</code></pre>
<p>But the output is</p>
<pre><code>grid[0][1].getval = 1 grid[1][1].getval = 1
</code></pre>
<p>and should be </p>
<pre><code>grid[0][1].getval = 1 grid[1][1].getval = 0
</code></pre>
<p>What is causing this error?</p>
|
java
|
[1]
|
1,329,503 | 1,329,504 |
How to modify the following jQuery code so it applies to each li element?
|
<p>I have the following:</p>
<pre><code>$ul = $('#wpbdp-categories > .wpbdp-categories > li.cat-item > ul');
$('#wpbdp-categories > .wpbdp-categories > li.cat-item > ul').remove();
$('#wpbdp-categories > .wpbdp-categories > li.cat-item').wrapInner('<span>');
$('#wpbdp-categories > .wpbdp-categories > li.cat-item').append($ul);
</code></pre>
<p>Which basically turns sometimes like this:</p>
<pre><code><li>
<a></a>
(10)
<ul></ul>
</li>
</code></pre>
<p>into this:</p>
<pre><code><li>
<span>
<a></a>
(10)
</span>
<ul></ul>
</li>
</code></pre>
<p>The problem is that the page has many <code><li></li></code>.</p>
<p>How to do it so the code is only applied to each <code>li</code> without interfering with the rest?</p>
|
jquery
|
[5]
|
4,450,456 | 4,450,457 |
C++ checking available ram?
|
<p>In C++ how would I check how much available RAM i have?</p>
<p>I am on windows, but be interested for Unix answers as well as windows.</p>
|
c++
|
[6]
|
896,487 | 896,488 |
webview is not loading url inside the fragment in android
|
<p>I am new to fragment.I am loading url in webview inside fragment but its not loading .In emulator webpage may temporarily down message is coming .in samsung galaxy tab device coming blank can anybody tell what is problem How to solve</p>
<pre><code>import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
public class WebViewFragment1 extends Fragment {
WebView loadWeb;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// Tell the framework to try to keep this fragment around
// during a configuration change.
setRetainInstance(true);
// Start up the worker thread.
}
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
ViewGroup layout = (ViewGroup) inflater.inflate(R.layout.gcmweb, container, false);
loadWeb=(WebView)layout.findViewById(R.id.loadWeb);
/*String url = "http://unstructure.org/unstruc/unstruc.php?i="
+ "sample test".replaceAll(" ", "-");*/
String url="http://www.google.com/";
loadWeb.loadUrl(url);
return layout;
}
}
</code></pre>
<p>Here I am adding dynamically in activity</p>
<pre><code>FragmentTransaction ft = fm.beginTransaction();
Fragment fragReplace=new WebViewFragment1();
//fm.beginTransaction();
ft.add(R.id.replace_frag_container,fragReplace);
ft.addToBackStack(null);
ft.commit();
</code></pre>
<p>Thanks</p>
|
android
|
[4]
|
3,869,952 | 3,869,953 |
How do I assign certain scripts to different scenes in Unity 3d?
|
<p>I was wondering how I can make certain scripts apply to different scenes in Unity 3d. I have a registration form script that I want for the registration scene and a login form script that I want for the login scene. The problem is, when I start the game, it gives me one on top of another. Can anyone help me? If it makes a difference, I'm coding in C#. If its impossible to assign scripts to scenes, then is there an alternate way to do it, like maybe making one invisible while you are logging in and the other invisible when you are registering? Thanks!</p>
|
c#
|
[0]
|
5,511,453 | 5,511,454 |
Getting the result from struts.xml by using javascript
|
<p>I want to get the result in struts.xml by using javascript or jquery. For example I have these results in my struts.xml,</p>
<pre><code> <global-results>
<result name="input">error.jsp</result>
<result name="syserror">error.jsp</result>
<result name="login">loginError.jsp</result>
<result name="error">error.jsp</result>
</global-results>
</code></pre>
<p>I would like to know how to get the result name using javascript. I need to detect the return of struts.xml .</p>
|
javascript
|
[3]
|
2,831,958 | 2,831,959 |
jquery keyup misses a shift+> key event if I'm going really fast
|
<p>The follow jquery code moves the value of an input element over to an output element whenever I type in >:</p>
<pre><code>$(document).ready(function() {
var input = $("#input");
var output = $('output[name="output"]')[0];
input.keyup(function(event) {
if (event.which == 190 && event.shiftKey == true) {// 190 = key code
output.value = input.val();
}
});
});
</code></pre>
<p>If I'm really going fast, however, the event handler misses a > or two, even though it is captured properly in the input box. Is there a flaw in my code?</p>
|
jquery
|
[5]
|
1,332,907 | 1,332,908 |
Java String Special character replacement
|
<p>I have string which contains alpahanumeric and special character.
I need to replace each and every special char with some string.</p>
<p>For eg,</p>
<p>Input string = "ja*va st&ri%n@&"
Expected o/p = "jaasteriskvaspacestandripercentagenatand"</p>
<ul>
<li>= "asterisk"
& = "and"
% = "percentage"
@ = "at"</li>
</ul>
<p>thanks,</p>
|
java
|
[1]
|
2,319,508 | 2,319,509 |
Pass values to another page
|
<p>I have a page where I output some data (page1.php). Also I have another page (page2.php) where I need to pass the values as well.</p>
<pre><code>// page1.php
$myVals = '""';
foreach($values as $name) {
$myVals .= ',"'.( strlen($name) ? htmlspecialchars($name) : ' ').'"';
}
$_SESSION['myVals'] = $myVals;
</code></pre>
<p>On page2.php I need myVals to be placed into the following string:</p>
<pre><code>$xls->addRow(Array("First Name","Last Name","Website","ID"));
</code></pre>
<p>There are supposed to be separate values for xls file headers. Currently if I put my string in it, it is interpreted as a single value.</p>
<pre><code>$xls->addRow(Array($_SESSION['myVals']));
</code></pre>
<p>What am I missing?</p>
|
php
|
[2]
|
1,911,980 | 1,911,981 |
unterminated string literal
|
<p>I getting any error on a I'm creating in my client side code. The issue seems to be coming from the "onclick" that I'm adding to the row. You can see the function below. Then underneath that is what the "this.clickvalue" actually equals that on the line that is giving me the "unterminated string literal" error.</p>
<pre><code>51 var row = "<tr " + this.clickValue + ">"
52 for(i=0; i<this.count; i++) {
53
54 row += "<td>" + this.values[i] + "</td>";
55
56 }
57 row += "</tr>";
58
59 $(row).appendTo(tbl);
<tr onclick=detailDoc.openDocument('Technical Library')> //line 51 during walkthorugh
</code></pre>
<p>EDIT: Ok so it looks like I need that last line to eventually look like this:</p>
<pre><code><tr onclick="detailDoc.openDocument('Technical Library')">
</code></pre>
<p>So my now is how exactly do I do that. the "this.clickValue" is being created in a webservice and passed back to my JS function. The code looks like this:</p>
<pre><code>string click = "onclick=detailDoc.openDocument('" + result.IPT_Name + "');";
</code></pre>
<p>Not sure how to get the quotes to go over with it.</p>
|
javascript
|
[3]
|
2,760,614 | 2,760,615 |
Explode array and define Variables
|
<p>I have the following which returns </p>
<p>"soccertennisfootball"</p>
<pre><code>$interestsquery = "SELECT * FROM user_interests WHERE user_id = " . $usersClass->userID();
$result = mysql_query($interestsquery);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "{$row['interest']}";
}
</code></pre>
<p>Can somebody please explain how I can explode the data and assign it as variables? I've been looking around at tutorials but they all seem to have some sort of delimeter? </p>
<hr>
<p>Ive tried the following oly its acting very weird and printing out multiple times? </p>
<p>the following...</p>
<pre><code>$interestsquery = "SELECT * FROM user_interests WHERE user_id = " . $usersClass->userID();
$result = mysql_query($interestsquery);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$interests[] = $row['interest'];
$interest1 = $interests[0];
$interest2 = $interests[1];
$interest3 = $interests[2];
print $interest1 . " - " . $interest2 . " - " . $interest3;
}
</code></pre>
<p>Prints out </p>
<p>"Tennis - Tennis - Footy - Tennis -Soccer - Footy"</p>
|
php
|
[2]
|
3,339,777 | 3,339,778 |
JSONException: Unterminated string
|
<p>This is my code:</p>
<pre><code>JSONObject msgObject = JSONObject.fromObject(msg);
</code></pre>
<p>I then get a JSONException:</p>
<pre><code>net.sf.json.JSONException: Unterminated string at character 239 of {...}
</code></pre>
<p>What am I doing wrong?</p>
<p>Thanks.</p>
<p>edit:<br>
I create a test.txt file:<br><br>
<code>{"source":"a\n"}</code><br><br>
the test method is this:<br><br>
<code>
Scanner cin = new Scanner(new File("test1.txt"), "utf-8");<br>
JSONObject msgObject = JSONObject.fromObject(msg);<br>
</code><br>
I got this:<br>
key:source&value:a</p>
|
java
|
[1]
|
2,923,521 | 2,923,522 |
nextLine() not working after a for loop
|
<p>Does any one know why my <code>nextLine()</code> is not working after a for loop in the following code? It's always skipping the <code>nextLine()</code> and going direct to the <code>if</code> statement.</p>
<pre><code>int[] a = new int[3]
for(int i=0; i<3;i++)
{
a[i] = nextInt();
}
String b = nextLine();
if(b == "go")
{
.......
}
else
{
.....
}
</code></pre>
|
java
|
[1]
|
4,420,274 | 4,420,275 |
Delete parameter & returning back unsuccsessful Ids
|
<p>Is this possible?</p>
<p>I get comma separated IDs as a integer/string arrays as a param (ie. 100,101,102,103,104,105).</p>
<p>I need to pass into in a delete query.</p>
<p>ie. <code>delete from tablename where ID in (100,101,102,103,104,105) and status='Completed';</code></p>
<p>If 100,102,105 gets deleted & if 101 & 103 don't get deleted (for some error), then i need to return back 101 & 103 not deleted with error message(if status is not completed).</p>
<p>Pls. throw some lights on this.</p>
|
c#
|
[0]
|
1,547,590 | 1,547,591 |
class not found when extending class that implements interface in PHP
|
<pre><code><?php
class A extends B {}
class B implements C {}
interface C {}
</code></pre>
<p>the code above throws "Fatal error: Class 'B' not found"...
Is it a php bug? Or?</p>
<p>Environment: "PHP 5.3.6-13ubuntu3.2 with Suhosin-Patch (cli) (built: Oct 13 2011 23:19:13)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
"</p>
|
php
|
[2]
|
5,779,496 | 5,779,497 |
Available implementations of IEEE 754-2008 (Densely Packed Decimal)
|
<p>What are the platform independent options for decimal numbers in c++?</p>
|
c++
|
[6]
|
4,825,204 | 4,825,205 |
Do you have to call RegisterClientScriptInclude in postback?
|
<p>I need to register a javascript file from code-behind. I am interested to know whether this just needs to be called at the initial page load, or do I have to call it on each postback too ?</p>
<pre><code>string clientUrl = ResolveClientUrl("~/Includes/global.js");
if (!Page.ClientScript.IsClientScriptIncludeRegistered(GetType(), "Global"))
Page.ClientScript.RegisterClientScriptInclude(GetType(), "Global", clientUrl);
</code></pre>
|
asp.net
|
[9]
|
1,593,896 | 1,593,897 |
How do i pass an value to a function that i use as parameter?
|
<p>i want to pass a function as an parameter if an element was clicked.
But in the function that i pass i want to set an attribute information from the clicked element.</p>
<p>What is the best way to pass the attribute value to the inner of the function?</p>
<p>My JavaScript looks like this:</p>
<pre><code>$('.edit-link').livequery(function(){
$('.edit-link').click(function(){
WMT.openOverlay($('#edit'),{
relativeTo: $('.search'),
width: $('.search'),
close: $('#cancel_edit'),
fillFields: function(){
return $.getJSON("ajax/edit.php?id=" + $(clickedElement).data('id'));
}
});
});
});
</code></pre>
<p>i want to send the data attribute "id" in the json.</p>
|
javascript
|
[3]
|
5,916,676 | 5,916,677 |
UIImage view animation problem
|
<p>I have done the effect of playing lots of images like below:</p>
<pre><code>NSInteger faceNum = 12;
NSMutableArray *faceArray = [[NSMutableArray alloc] initWithCapacity:faceNum];
for (int i = 1;i<faceNum+1; i++) {
NSString *facename = [[NSBundle mainBundle]
pathForResource:[NSString stringWithFormat:@"animationFace%d",i] ofType:@"png"];
UIImage *faceImage = [UIImage imageWithContentsOfFile:facename];
[faceArray addObject:faceImage];
}
UIImageView *faceView = [[UIImageView alloc]
initWithFrame:CGRectMake(414, 157, 161, 124)];
faceView.animationImages = faceArray;
faceView.animationDuration = 30;
faceView.animationRepeatCount = 0;
[faceView startAnimating];
[self.view addSubview:faceView];
[faceView release];
[faceArray release];
</code></pre>
<p>And how to add the EaseInEaseOut effect to this.One picture disappear gradually,then another picture appear gradually.
Thanks</p>
|
iphone
|
[8]
|
3,689,994 | 3,689,995 |
Android: how to launch my app upon receiving a specific Broadcast?
|
<p>I am trying to get my app automatically launched when the phone gets connected to wifi. Here's the code I am using to both set the Broadcast receiver and to specify that once the broadcast is received I want the "Connected" activity to be launched:</p>
<pre><code>IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION);
receiver = new BroadcastReceiver(){
public void onReceive(Context context, Intent intent){
Intent intent2 = new Intent(getApplicationContext(),com.example.package.Connected.class);
startActivity(intent2);
}
};
registerReceiver(receiver,intentFilter);
</code></pre>
<p>Unfortunately it's not working. The logcat says my activity has "leaked IntentReceiver".</p>
<p>Does anyone know how I can solve this?</p>
<p><strong>EDIT</strong>: I also tried to register the receiver via the Manifest file. I added this code to the manifest:</p>
<pre><code><receiver android:name="com.example.package.receiver">
<intent-filter>
<action android:name="android.net.wifi.STATE_CHANGE" />
</intent-filter>
</receiver>
</code></pre>
<p>And then this code to my main activity:</p>
<pre><code>private BroadcastReceiver receiver = new BroadcastReceiver(){
public void onReceive(Context context, Intent intent){
Intent intent2 = new Intent(getApplicationContext(),com.example.package.Connected.class);
context.startActivity(intent2);
}
};
</code></pre>
<p>But now my app crashes once the phone connects to wifi. Logcat says "RuntimeException: Unable to instantiate receiver".</p>
<p>Any ideas how to solve it?</p>
|
android
|
[4]
|
658,050 | 658,051 |
is it possible to prevent jquery dialog box from showing when the page loads?
|
<p>Hey guys I was not really sure how to word the title to make it short, but my question is when my page loads, it includes a jquery dialog box is supposed to start off closed. It does but when the page first loads, the contents of that box briefly show before disappearing when the page is finished loading. It looks a little awkward so I was wondering if anyone knew of some sort of solution to fix this problem or smooth it over. Any help appreciated.</p>
|
jquery
|
[5]
|
5,505,771 | 5,505,772 |
I want to show a title with the H2 tag
|
<p>Could someone look at this. </p>
<p>I want to show <code>echo htmlspecialchars($title)</code> in <code><h2></code> but everything I tried I get a blank page.</p>
<pre><code><div class="adsmanager_ads_desc">
<?php $strtitle = "";
if (@$this->positions[5]->title) {
$strtitle = JText::_($this->positions[5]->title);
}
echo "<h2>" . @$strtitle . "</h2>";
if (isset($this->fDisplay[6]))
{
foreach($this->fDisplay[6] as $field) {
$c = $this->field->showFieldValue($this->content,$field);
if ($c != "") {
$title = $this->field->showFieldTitle(@$this->content->catid,$field);
if ($title != "") {
echo htmlspecialchars($title).": ";
echo "$c<br/>";
}
}
}
}
?>
</div>
</code></pre>
<p>Any suggestions?</p>
|
php
|
[2]
|
2,736,807 | 2,736,808 |
How long a desktop programmer able to convert himsleft on mastering PHP?
|
<p>i know it depends on many thing. But can anybody tell me how long it should be ? I just want to draw a boundaries between successful and failed attempt to convert myself ?</p>
|
php
|
[2]
|
1,882,705 | 1,882,706 |
Callback to parent window from child in IE?
|
<p>I have the code below which opens a child window and the child has a callback function to the parent to close the child window which is called with onLoad in the child.</p>
<p>The code works fine in Firefox and Chrome but not in IE. </p>
<p>Can anyone see where I am going wrong?</p>
<p>Parent JS</p>
<pre><code> var wnd = null;
function openWnd()
{
wnd = window.open('http://www.example.com');
}
function closeWnd()
{
if (wnd != null) {
wnd.close();
}
}
</code></pre>
<p>Child JS</p>
<pre><code> function parent_callback()
{
setTimeout(function (){ window.opener.closeWnd();}, 3000);
}
</code></pre>
<p>Why is IE always a pain for developers M$ needs to pull its fingure out :)</p>
<p>Thanks</p>
|
javascript
|
[3]
|
716,568 | 716,569 |
How to move array elements down from a certain piont?
|
<p>I have a array of variables, and I want to delete 1 of the elements and then shift the whole array down to fill that spot that was removed. Any help would be greatly appreciated, and before you ask, no this is not homework.</p>
|
java
|
[1]
|
1,417,529 | 1,417,530 |
C++ Reading Files
|
<p>What is the minimum code required to read a file and assign its contents to a string in c++?
I did read a lot of tutorials that worked but they were all different in a way so i am trying to see why, so if you could please include some explanatory comments that would be great.</p>
<p><hr /></p>
<p><strong>Related:</strong> <a href="http://stackoverflow.com/questions/116038/what-is-the-best-way-to-slurp-a-file-into-a-stdstring-in-c">http://stackoverflow.com/questions/116038/what-is-the-best-way-to-slurp-a-file-into-a-stdstring-in-c</a></p>
|
c++
|
[6]
|
2,705,628 | 2,705,629 |
How to upload a file to the server in iPhone SDK?
|
<p>I want to send a file to server in iPhone. Is there any iPhone API to implement that functionality?</p>
|
iphone
|
[8]
|
2,512,137 | 2,512,138 |
How to create another page class in a aspx c# page
|
<p>Results r = (Results)Page.LoadControl("Results.ascx");</p>
<p>In my Page i cannot access USER CONTROL CLASS(Results)
Gives error.I cannot resolve.</p>
<p>No namespaces at all.</p>
<p>Even i cannot access other aspx class in same folder's other page also..</p>
<p>Can you please help me.</p>
|
asp.net
|
[9]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.