Unnamed: 0
int64 65
6.03M
| Id
int64 66
6.03M
| Title
stringlengths 10
191
| input
stringlengths 23
4.18k
| output
stringclasses 10
values | Tag_Number
stringclasses 10
values |
---|---|---|---|---|---|
1,021,843 | 1,021,844 |
loading divs that only have data in jquery
|
<p>I have a page that has some divs. I show images on these divs. Sometimes, the some divs may be emtpy and some may have values.</p>
<p>Clicking on a div, I show another div with an image. And, clicking on the div with images, should bring me back to the original location. I know this is little complicated. .group css class contain bunch of divs. I only want to show the divs that have value. Below code kinda works but since I am doing this ( $('.group').show();), it shows all the divs and the display of the full images all spread around. Is there a way to purge the emtpy divs so that only divs with images show and the others are purged. thank you.</p>
<pre><code> $(function () {
$('#individual').click(function () {
$('.aggregate').hide();
$('#aggregate').show();
});
$('#aggregate').click(function () {
$('#aggregate').hide();
$('.group').show();
});
});
</code></pre>
|
jquery
|
[5]
|
3,412,294 | 3,412,295 |
what is the error in this code
|
<p>in the code below i m trying to reverse the string there is no compile time error but ,nothing is displayed .what is wrong ?</p>
<pre><code> string string1="arunachalam";
void reverseStr()
{
for(int i=string1.length();i<0;i--)
{
cout<<string1[i];
}
}
</code></pre>
|
c++
|
[6]
|
5,260,906 | 5,260,907 |
Extract part of current url to use in javascript function
|
<p>hoping someone who knows a bit about javascript maybe able to help me. I need to extract part of the url of my pagepage to use in a javascript function and append to a url. ( it's for a power reviews setup.) the portion i need to extract is the number of the example below ie. www.mydomain.com/my-product-could-be-i950.html -- so would just need the 950 part.. the number part could be 2,3,4 characters. I then need to append this to the url www.mydomain.com/write-a-review.html?pr_page_id=950 </p>
<p>could anyone help, it's a bit beyond me this one to be honest..</p>
<p>Many thanks.. Nathan</p>
|
javascript
|
[3]
|
1,183,140 | 1,183,141 |
C# - How to use a interface for a generic list when serializing
|
<p>I have a generic list say and I want to serialize it.
I want to use a interface for the generic list which can't be serialized
so you have to use the instance. Like this
MyClass implements IMyClass.</p>
<pre><code>List<IMyClass> list = DeserializeMyClass(path); //Can't do this right
</code></pre>
<p>So have to do this</p>
<pre><code>List<MyClass> list = DeserializeMyClass(path);
</code></pre>
<p>So question is can i now cast to </p>
<pre><code>List<IMyClass> ilist = (IMyClass)list;
</code></pre>
<p>Malcolm</p>
|
c#
|
[0]
|
3,890,075 | 3,890,076 |
Manually set value Member of Combobox
|
<p>Actually I need to set the value member of combobox using Foreach loop</p>
<p>My code goes like this.</p>
<pre><code>foreach(DataRow row in dsTable.Tables["mytable"].Rows)
{
combobox1.Items.Add(row["my column"]);
}
</code></pre>
<p>how do i set value member on it?</p>
|
c#
|
[0]
|
3,756,176 | 3,756,177 |
How to select a nested element
|
<p>In this HTML:</p>
<pre><code><div class="seal">
<div class="how with"> </div>
<div class="how"> </div>
<div class="with"> </div>
</div>
</code></pre>
<p>How can I select this nested element?:</p>
<pre><code><div class="how with"> </div>
</code></pre>
|
jquery
|
[5]
|
2,429,808 | 2,429,809 |
image in Frame by Frame animation from URL
|
<p>As we know Frame by Frame animation are made by multiple images.and images are comeing from drawable folder.
<strong>Like this:</strong> </p>
<pre><code> <animation-list xmlns:android=
"http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="@drawable/renew20001" android:duration="50" />
<item android:drawable="@drawable/renew20002" android:duration="50" />
<item android:drawable="@drawable/renew20003" android:duration="50" />
<item android:drawable="@drawable/renew20004" android:duration="50" />
<item android:drawable="@drawable/renew20005" android:duration="50" />
</animation-list>
</code></pre>
<p>Now i get images from particular url.and display animation.is it possible or not?
if yes then provide solution.</p>
|
android
|
[4]
|
4,183,689 | 4,183,690 |
Select from upper level folder
|
<p>So, I've created a website and I have lots of pages in the public_html folder. Those page load the images and script from folders who are direct child of public_html folder.</p>
<p>Now I need to move all those files into a folder (let's name it sample-folder).</p>
<p>My question: Is there any way to let the pages inside "sample-folder" access the images and scripts from other folders inside the "public_html" <strong>without</strong> having to edit all the pages and add a <code>../</code>images/image.png before each link?</p>
<p>I don't know, some htacces rewrite rule? Some php config.ini edit?</p>
<p><strong>Structure:</strong></p>
<pre><code>public_html
images
scripts
sample-folder
test.php
</code></pre>
|
php
|
[2]
|
5,516,902 | 5,516,903 |
Can I change tab width (\t) in a PHP string?
|
<p>I'm not even sure if its possible, but I'd like to change the value of \t in PHP strings. For example, currently if I do this:</p>
<pre><code>echo "\t\tHello";
</code></pre>
<p>The output is 16 spaces followed by hello - so the tab width is 8 spaces. Is there a way to change this default tab width to another number when using \t in strings?</p>
<p>Its not really all that important that I do so, and there are numerous, obvious work arounds, just wondering if I'm missing out on something easy to do and can't find.</p>
|
php
|
[2]
|
3,796,859 | 3,796,860 |
mysql_free_result() expects parameter 1 to be resource
|
<p>im sending data from my android application to mySQL in localhost and I receive warning on (Warning: mysql_free_result() expects parameter 1 to be resource, Boolean given in C:\xampp\htdocs\datatest.php on line 17)</p>
<p>despite the warning i'm still able insert the data into the database.</p>
<p>i'm wondering is it ok to ignore this or how can i solve this problem?</p>
<p>i tried various forums and website by none solve my problems.</p>
<pre><code><?php
$dbcnx = mysql_connect("localhost", "root", "");
$db = "agentdatabase";
mysql_select_db($db, $dbcnx);
$user_id=$_POST['username'];
$passwd=$_POST['password'];
$query = "INSERT INTO agentable (username,password) VALUES ('".$user_id."','".$passwd."')";
echo $query;
$result = mysql_query($query) or die ("<b>Query failed:</b> " . mysql_error());
if($result){
echo '<br />','pass';
}
else echo mysql_error();
mysql_free_result($result);
mysql_close($dbcnx);
?>
</code></pre>
|
php
|
[2]
|
4,978,285 | 4,978,286 |
jQuery performance difference without "each"
|
<p><strong>Update</strong> Added jsfiddle - see bottom of post</p>
<p>I currently have a function that reenables all disabled fields on the screen. While it runs pretty quickly (<1ms according to Firebug profiler), I am in the process of tidying up all the Javascript in my screens and figured this particular function seemed to be a little redundant:</p>
<pre><code>function enableDisabledFields() {
$('[disabled]').each(function(i) {
$(this).removeAttr('disabled');
});
}
</code></pre>
<p>I was under the impression that those 3 lines could be replaced as follows, and I expected if not better than at least <em>equal</em> performance. </p>
<pre><code>function enableDisabledFields() {
$('[disabled]').removeAttr('disabled');
}
</code></pre>
<p>Apparently I'm wrong. The first performs much better and I don't quite understand why. Even adding additional selectors such as :input make no difference (and in fact make it worse). </p>
<p>Can anyone clear up my confusion? Thanks.</p>
<p><em>Edit</em> I should add that we're using an old version of jQuery - 1.3.1 I believe.</p>
<p><em>Edit2</em> Here are some jsFiddle links. Please keep in mind that I may be misunderstanding Firebug's profiler (<strong>which I'm thinking seems to be the case</strong>).</p>
<p>Option 1: <a href="http://jsfiddle.net/kcut7/" rel="nofollow">http://jsfiddle.net/kcut7/</a></p>
<p>Option 2: <a href="http://jsfiddle.net/ZgZpU/" rel="nofollow">http://jsfiddle.net/ZgZpU/</a></p>
|
jquery
|
[5]
|
1,481,115 | 1,481,116 |
How to properly display Chinese characters in PHP?
|
<p>I have these Chinese characters:</p>
<pre><code>汉字/漢字''test
</code></pre>
<p>If I do </p>
<pre><code>echo utf8_encode($chinesevar);
</code></pre>
<p>it displays</p>
<pre><code>??/??''test
</code></pre>
<p>Or even if I just do a simple</p>
<pre><code>echo $chinesevar
</code></pre>
<p>it still displays some weird characters...</p>
<p>So how am I going to display these Chinese characters without using the <meta> tag with the UTF-8 thingy .. or the ini_set UTF-8 thing or even the header() thing with UTF-8?</p>
|
php
|
[2]
|
3,360,533 | 3,360,534 |
Best way to wait for a background thread to finish processing in C#
|
<p>I have a background thread. If the background thread is busy, I want to wait for it to finish its work and then continue with next request. I have implemented it in the following way. Process is the name of the background thread.</p>
<pre><code> if (process.IsBusy)
{
do
{
isProcessBusy = process.IsBusy;
} while (isProcessBusy == false);
SetIsDirty(status, GetContext());
}
else
{
SetIsDirty(status, GetContext());
}
</code></pre>
<p>Is this the best way or are there other ways to implement this kind of logic?</p>
|
c#
|
[0]
|
2,046,172 | 2,046,173 |
undefined reference to `std::__default_alloc_template<true, 0>::deallocate(void*, unsigned int)'
|
<p>During linking code on ubuntu I get following error<br>
<code>undefined reference to 'std::__default_alloc_template<true, 0>::deallocate(void*, unsigned int)'</code>
<br>
I tried several g++ compilers but nothing changes. The reason I found in previous answers is wrong configuration if includes. Here are includes in the code:</p>
<pre><code>#pragma warning(disable:4786)
#include <stdio.h>
#include <map>
#include <string>
#include <vector>
#include <png.h>
#include <math.h>
#include <ft2build.h>
#include <gd.h>
#include FT_FREETYPE_H
using namespace std;
#ifndef WIN32
#define stricmp strcasecmp
#else
#include <io.h>
#include <fcntl.h>
#endif
</code></pre>
<p>Please help to fix those includes?</p>
|
c++
|
[6]
|
58,696 | 58,697 |
Send Email Intent
|
<pre><code>Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/html");
intent.putExtra(Intent.EXTRA_EMAIL, "emailaddress@emailaddress.com");
intent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
intent.putExtra(Intent.EXTRA_TEXT, "I'm email body.");
startActivity(Intent.createChooser(intent, "Send Email"));
</code></pre>
<p>The above code opens a dialog showing following apps:- Bluetooth, Google Docs, Yahoo Mail, Gmail, Orkut, Skype etc.</p>
<p>Actually, I want to filter these list-options. I want to show only email related apps e.g. Gmail, Yahoo Mail. How to do it?</p>
<p>I've seen such example on 'Android Market' application. </p>
<ol>
<li>Open Android Market app </li>
<li>Open any application where developer has specified his/her email address. (If you can't find such app just open my app:- market://details?id=com.becomputer06.vehicle.diary.free , OR search by 'Vehicle Diary')</li>
<li>Scroll down to 'DEVELOPER'</li>
<li>Click on 'Send Email'</li>
</ol>
<p>The dialog shows only email Apps e.g. Gmail, Yahoo Mail etc. It does not show Bluetooth, Orkut etc. What code produces such dialog?</p>
<p>Please provide an answer, so I can increase my 'accept rate'. ;)</p>
|
android
|
[4]
|
1,818,249 | 1,818,250 |
infinitly execution while send broadcast
|
<p>I want to use<br>
<code>context.sendBroadcast(intent, receiverPermission);</code> </p>
<p>in my application
but I don't know to pass receiverPermission parameter in function and also how to set in manifest file
please any body help me</p>
<p>I want to show you my source code</p>
<pre><code>public class LocationReceiver extends BroadcastReceiver {
public static final String BROADCAST_ACTION = "LOCATION_CHANGE";
@Override
public void onReceive(Context context, Intent intent) {
intent.setAction(BROADCAST_ACTION);
Bundle b = intent.getExtras();
Location loc = (Location)b.get(android.location.LocationManager.KEY_LOCATION_CHANGED);
Logger.debug("Loc:"+loc);
if(loc != null){
doBroadCast(context,intent,loc);
}
}
public void doBroadCast(final Context context,final Intent i1,final Location loc){
Handler h = new Handler();
h.post(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
Logger.debug("LocationReceiver->sendLocation update broadcast");
i1.putExtra("Latitude", loc.getLatitude());
i1.putExtra("Longitude", loc.getLongitude());
context.sendBroadcast(i1,null);
}
});
}
}
</code></pre>
<p>and on activity I have write</p>
<pre><code> @Override
protected void onResume() {
registerReceiver(broadcastReceiver, new IntentFilter(LocationReceiver.BROADCAST_ACTION));
}
private BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
UpdateUI(intent);
}
};
private void UpdateUI(Intent i){
Double Latitude = i.getDoubleExtra("Latitude",0);
Double Longitude = i.getDoubleExtra("Longitude",0);
showMap(Latitude, Longitude);
}
</code></pre>
<p>Now my problem is when it sendbroadcast it execute infinitly doBroadcast function(), please help me to come out.</p>
|
android
|
[4]
|
403,843 | 403,844 |
How to do pinch zoom for webapps using jquery for android device
|
<p>When two or more fingers are used to do pinch zoom on an android device, it is not working, but for ipad and iphone it is working. I used following jquery code:</p>
<pre><code> var ua = navigator.userAgent;
if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i)|| navigator.userAgent.match(/android/i)) {
var viewportmeta = document.querySelector('meta[name="viewport"]');
if (viewportmeta) {
viewportmeta.content = 'width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial- scale=1.0';
document.body.addEventListener('gesturestart', function () {
viewportmeta.content = 'width=device-width, minimum-scale=0.25, maximum-scale=1.6';
}, false);
}
}
</code></pre>
|
jquery
|
[5]
|
4,492,167 | 4,492,168 |
Execution of "required" code in php
|
<p>I have some files:</p>
<p><strong>core.php</strong>:</p>
<pre><code>require_once 'logger.php';
require_once 'smth_else.php';
$Logger = new Logger();
$Else = new Smth_else();
</code></pre>
<p><strong>smth_else.php</strong>:</p>
<pre><code>...
$Logger->write(...);
...
</code></pre>
<p>And get: </p>
<blockquote>
<p>Notice: Undefined variable: Logger in
smth_else.php...</p>
</blockquote>
|
php
|
[2]
|
1,392,679 | 1,392,680 |
Desktop <--> Mobile Code Sharing [Javascript]
|
<p>I couldn't find a satisfying answer so here is the question;</p>
<p>I am developing an HTML5-Websocket based application and I will be porting it to Mobile too.</p>
<p>The problem is that 2/3 of my features won't be in the mobile version and features are tightly integrated into HTML with JS.</p>
<p>If I can elegantly separate those 1/3 features, I will be DRY. However I couldn't find an easy solution for this. </p>
<p>For example, I have a function which gets the user object from node and process it in a function. For mobile, I will need the same flow but except 2/3 of the flow. I can create different functions for them and put them into the different files but this will bring a maintenance nightmare, since I will need to create tens of extra functions for even simple features.</p>
<p>Is there any good framework or way of doing these things out there for this job? </p>
|
javascript
|
[3]
|
629,604 | 629,605 |
asp.net storing images
|
<p>It's me your junior programmer extraodinaire</p>
<p>I'm trying to display an image from my database but when I try to extract the file it only contains 6 bytes of data which causes my program to throw an error. My instructor informed me that the file is too small for an image, leading me to believe that I'm not storing it properly. I would be most gracious if someone could identify any code that might cause this to happen. </p>
<p>this is my function grabbing/storing the file</p>
<pre><code>Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
Dim _image As Byte()
_image = FileUpload1.FileBytes
Dim conn As New SqlConnection
Dim cmd As New SqlCommand
Dim dr As SqlDataReader
conn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
cmd.Connection = conn
cmd.CommandText = "Insert INTO mrg_Image(Image, UserId) VALUES('@image', @id)"
cmd.Parameters.AddWithValue("@image", FileUpload1.FileBytes)
cmd.Parameters.AddWithValue("@id", 4)
conn.Open()
dr = cmd.ExecuteReader
conn.Close()
'FileUpload1.SaveAs()
End Sub
conn.Open()
</code></pre>
<p>file_bytes is the variable that contains 6 bytes as oppose to a thousand+ which an image should have</p>
<pre><code> Dim file_bytes As Byte() = cmd.ExecuteScalar()
Dim file_bytes_memory_stream As New System.IO.MemoryStream(file_bytes)
Dim file_bytes_stream As System.IO.Stream = DirectCast(file_bytes_memory_stream, System.IO.Stream)
Dim the_image As New System.Drawing.Bitmap(file_bytes_stream)
context.Response.ContentType = "image/jpg"
the_image.Save(context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg)
conn.Close()
End Sub
</code></pre>
|
asp.net
|
[9]
|
3,533,155 | 3,533,156 |
How to load WP functions?
|
<p>I have a <code>mymail.php</code> script which sends a email (I managed to do it using <code>require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-includes/class-phpmailer.php' );</code>.) and outputs a plain text string (Such as "Email is sent successfully.")</p>
<p>I want to use the functions defined in WP in this my script. The particular function I want to call is <code>get_option()</code> in order to retrieve the email user of the site owner. Which file to import for the particular <code>get_option()</code> function and which to import the entire WP core (like the context available for theme's .php files?</p>
|
php
|
[2]
|
1,344,894 | 1,344,895 |
Android: Why to choose lowest version?
|
<p>I have seen many times that android recommends to choose lower version to create a new android application. why so? or am i wrong? </p>
|
android
|
[4]
|
1,620,675 | 1,620,676 |
Javascript file pagination script
|
<p>I want a javascript for file navigation.</p>
<p>For e.g.- I have a folder named 'content' in which there are 'n' no. of html files named like content_000.html, content_001.html to content_nnn.html.</p>
<p>There should be buttons like next and previous, clicking on next button will traverse to next html file whereas previous button will show the previous html file. There should be disable functionality also i.e. if user is currently in the last html file then next button should be disabled similarly if the user is in the first page then previous link should be disabled.</p>
<p>I am instructed not to use ajax or plugins such as jquery. Just simple javascript.</p>
<p>Are there any examples available for the same..? Please help me.</p>
<p>Thanks</p>
|
javascript
|
[3]
|
4,271,674 | 4,271,675 |
python: function that will call itself
|
<p>i was wondering if i can get your help with the stucture.logic of a function that will need to call itself</p>
<pre><code>def populate_frequency5(d,data,total_compare):
freq=[]
prev = None
for row in d:
if prev is None or prev==row[11]:
freq.append(row[16])
doctor=row[10]
drug=row[11][:row[11].find(' ')].capitalize()
else:
make_image_url_doctor(freq,doctor,drug,data)
total_compare=True
del freq[:]
prev=row[11]
if total_compare:
(b1,bla,bla1)=medications_subset2(data,[drug.upper()])
data1=calculate_creat_conc4(b1)
populate_frequency5(data1,['a'],total_compare=True)
total_compare=False
</code></pre>
<ol>
<li><p>the first time the function is called i need it to run this:</p>
<pre><code>def populate_frequency5(d,data,total_compare):
freq=[]
prev = None
for row in d:
if prev is None or prev==row[11]:
freq.append(row[16])
doctor=row[10]
drug=row[11][:row[11].find(' ')].capitalize()
else:
make_image_url_doctor(freq,doctor,drug,data)
(b1,bla,bla1)=medications_subset2(data,[drug.upper()])
data1=calculate_creat_conc4(b1)
del freq[:]
prev=row[11]
</code></pre></li>
<li><p>then somehow the second time when i call it, i need it to run this way:</p>
<pre><code>def populate_frequency5(d,data,total_compare):
freq=[]
prev = None
for row in d:
if prev is None or prev==row[11]:
freq.append(row[16])
doctor=row[10]
drug=row[11][:row[11].find(' ')].capitalize()
run_another_function()
</code></pre></li>
</ol>
|
python
|
[7]
|
4,446,286 | 4,446,287 |
getElementsByClassName onclick issue
|
<p>I'm using <a href="http://robertnyman.com/2008/05/27/the-ultimate-getelementsbyclassname-anno-2008/">Robert Nyman's</a> script to get all elements with same class in document, but it doesn't work with onclick or any other event:</p>
<pre><code>var photo = document.getElementsByClassName("photo_class","img",document.getElementById("photo_wrap"));
photo.onclick = function(){alert("Finaly!");
</code></pre>
<p>Maybe you know how to fix it?
Thanks!</p>
|
javascript
|
[3]
|
291,627 | 291,628 |
Strip new lines in PHP
|
<p>I'm been working with phrases the past couple of days and the only problem I seem to be facing is stripping new lines in the html before printing it.</p>
<p>Anybody have any idea how to remove <strong>every</strong> new lines from HTML using PHP?</p>
<p>Thanks!</p>
|
php
|
[2]
|
4,291,180 | 4,291,181 |
Concepts and Design of PluginController
|
<p>I ran across a cute plugin controller on this site TinyURL.com/ns42lv and would like to find out where I can learn more about the concept/design of a plug in controller. I use Windows as my OS and do most of my programming in C++.</p>
|
c++
|
[6]
|
1,394,029 | 1,394,030 |
"Alert is bad" - really?
|
<p>There's this idea running around that "alert() is <strong>bad</strong>". </p>
<p>Acknowledgements:</p>
<ul>
<li>Sure, we rarely want to use it in an actual UI design since there are better ways to communicate with users.</li>
<li>For debugging, <code>console.log()</code> has much more value than <code>alert()</code>.</li>
<li>Certain situations (like use of <code>setTimeout</code>) run into problems when <code>alert()</code> gets in the way.</li>
<li>Actual debuggers handle pausing and resuming of execution much better than <code>alert()</code>, if that's what a developer needs.</li>
</ul>
<p>Questions:</p>
<ol>
<li>Is there a solid, logical reason to <em>never</em> use <code>alert()</code>?</li>
<li>Does the increased value of <code>console.log()</code> truly reduce the value of <code>alert()</code> so drastically that it goes from "useful in limited scenarios" to "bad"?</li>
<li>What do you say to someone who wants to use <code>alert()</code> in a brief test where logging is not setup and any side effects are irrelevant (think tutorials or quick prototypes)?</li>
</ol>
|
javascript
|
[3]
|
549,356 | 549,357 |
Slide dynamic jQuery
|
<p>I have been trying to use jQuery to create an dynamic loop in an for loop.
For some reason when clicking the link that page is opened in an new window instead of sliding down.</p>
<pre><code><script type="text/javascript">
$('a.moreDetails').click(function() {
$(this).parent().next().toggle('fast');
});
</script>
while ($row = mysql_fetch_array($res))
{
echo '<tr onMouseOver="addHighlight(this);" onMouseOut="removeHighlight(this);" onclick="setHighlighted(this);">
<td colspan="11"> <a href="includes/js/ajax_details_adres.php?id='.$row['id'].'" class="moreDetails">(details)</a><div class="details" id="details'.$row['id'].'">More details</div> </td>
</tr>';
}
</code></pre>
|
jquery
|
[5]
|
995,053 | 995,054 |
Designing Ichat balloon interface
|
<p>I am trying for chat balloon kind of interface on iphone, I am able to draw a rounded rect thing and also am able to draw the gradients. But not getting how to achieve gradient drawing in rounded rect.I'll be thankful for any help..</p>
|
iphone
|
[8]
|
4,475,854 | 4,475,855 |
iphone sinin and sinup code
|
<p>i want the solution of below question, i dont know how to store sinup information in Plist, can any one knows please help.</p>
<p>Thanks in advance </p>
<p>Use Dummy data but the dummy data must not be in the code ,it should either be in an external file (plist/xml) or in a separate constant file.This improves the code management. </p>
<blockquote>
<p>All screens must comply to Portrait and Landscape View Mode
1. The App will begin with the Login Screen, The screen should be having same functionality as any website.
a. Login
b. Sign Up
c. Maximum Tries (3) then lock the app
d. Requires Answer to secret question to unlock which will be accepted in sign up </p>
</blockquote>
|
iphone
|
[8]
|
5,694,007 | 5,694,008 |
problem with search
|
<p>Hey, I've a search in website. If i search for a particular world it works fine in all pages but not in contact us. contact us page contains validation controls. I tried with removing validation controls, then the search works fine. any help on these how to make search though validation controls, are present.</p>
function KeyPress(txt)
{
//alert(txt);
if(txt == "Search")
{
document.getElementById("ctl00_txtSearch").value = "";
}
}
function OnBlur(txt)
{
if(txt == "")
{
document.getElementById("ctl00_txtSearch").value = "Search";
// txtSearch.style.color = "silver";
}
}
function button_onclick()
{
if(document.getElementById("").value == "" || document.getElementById("").value == "Search ")
{
document.getElementById("").focus();
alert("Please Enter Text");
return false;
}
}
<p>
</p>
|
asp.net
|
[9]
|
1,593,319 | 1,593,320 |
Why does System.Web.Hosting.ApplicationHost.CreateApplicationHost throw System.IO.FileNotFoundException?
|
<p>I saw something about needing to have the assembly available for the type of the first argument passed to the function. I think it is, I can't figure out what am I missing.</p>
<p>This code is in a service. I was running the service under the 'NETWORK SERVICES' user account, when I changed the account to that of the session I was logged on with it worked ok. But, what's the difference, and how can I get it to work for the NETWORK SERVICES user.</p>
|
c#
|
[0]
|
3,661,419 | 3,661,420 |
An attempt was made to call the method \u0027GetNextImage\u0027 using a GET request, which is not allowed
|
<p>I have a webmethod GetNextImage in my client script. In aspx page I have the following code</p>
<pre><code>function slideshow() {
$.ajax({
type: "GET",
contentType: "application/json; charset=utf-8",
url: "/RollingScreen.aspx/sample",
dataType: "json",
data: "{}",
success: function (data) {
//this changes the image on the web page
$('#imgSlideShow').attr("src","~/Images/1.png");
//fires another sleep/image cycle
setTimeout(slideshow(), 5000);
},
error: function (result) {
alert(result.message);
}
});
}
$(document).ready(function () {
//Kicks the slideshow
slideshow();
});
</code></pre>
<p>I am getting the error </p>
<p>{"Message":"An attempt was made to call the method \u0027GetNextImage\u0027 using a GET request, which is not allowed.","StackTrace":" at System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData methodData, HttpContext context)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.InvalidOperationException"} </p>
<p>Please can anyone help me.
Thanks in advance</p>
|
jquery
|
[5]
|
5,256,331 | 5,256,332 |
JavaScript help needed
|
<p>hello i'm using this code for publishing important messages on my applications message wall, i'm using a checkbox for publishing important message on message wall. the problem is that after publishing important message it will again publish the important message without clicking on checkbox, means the checkbox remains true after publishing the important message. please help me for this.
and my code is:</p>
<pre><code><div class="checkbox" id="checkboxShow" name="userCheckList1" style="display:block;" onclick="importantChkBoxChange(userCheckListShow.checked);">
<input type="checkbox" name="userCheckList1" id="userCheckListShow" unchecked="unchecked"
onchange="importantChkBoxChange(userCheckList.checked);"/>
</div>
<div class="checkbox" id="checkboxHide" name="userCheckList1" style="display:none;" onclick="importantChkBoxChange(userCheckListHide.checked);">
<input type="checkbox" name="userCheckList1" id="userCheckListHide" unchecked="unchecked"
onchange="importantChkBoxChange(userCheckListHide.checked);"/>
</div>
<span class="fl" style="margin:3px 0px 0 0;" ><@spring.message "label.employee.home.Important"/></span>
</code></pre>
<p>and the script used for this is:</p>
<pre><code>function importantChkBoxChange(chkBoxStatus){
if(chkBoxStatus == true){
document.forms['messageWallForm'].elements['important'].value="checked";
}else if(chkBoxStatus == false){
document.forms['messageWallForm'].elements['important'].value="unchecked";
}
}
</code></pre>
|
javascript
|
[3]
|
5,381,140 | 5,381,141 |
Disable ScrollView Programmatically?
|
<p>Hey, I would like to enable ScrollView and disable it by a Button Click.<br>
Disable means like if the ScrollView wasnt there.. and enable it returns the ScrollView..<br>
I want that because I have a gallery with text images, and on a button click the screen orientation changes, so in Landscape the text becomes bigger.. And I want the scrollview so the image doesnt stretch it self and the text becomes unreadable..<br>
scrollview.Enabled=false / setVisibility(false) doesnt make anything.. xml:</p>
<pre><code><ScrollView
android:id="@+id/QuranGalleryScrollView"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<Gallery android:id="@+id/Gallery"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="horizontal"></Gallery>
</ScrollView>
</code></pre>
<p>Thanks</p>
<p>Edit1: I cant use Visibility(gone) since that would also hide the Gallery, what I want is to hide the effect of the scrollview.. When there is ScrollView the images in Gallery become scrollabale and do not fit in the screen so u have to scroll to see the whole image, I dont want do disable/enable that on a button click.. I tried this:</p>
<pre><code>((ScrollView)findViewById(R.id.QuranGalleryScrollView)).setOnTouchListener(null);
((ScrollView)findViewById(R.id.QuranGalleryScrollView)).setHorizontalScrollBarEnabled(false);
((ScrollView)findViewById(R.id.QuranGalleryScrollView)).setVerticalScrollBarEnabled(false);
((ScrollView)findViewById(R.id.QuranGalleryScrollView)).setEnabled(false);
</code></pre>
<p>But still the images in the Gallery are scrollable and not fit the screen.. whats the solution to this?</p>
|
android
|
[4]
|
4,840,423 | 4,840,424 |
How can i create touchevents in certain areas of the screen in android?
|
<p>I have a neat background for my app with the "buttons" already included in the background.</p>
<p>I would like to surround these "buttons" with a bounding box or rectangle somehow and then have that area respond to a touch event.</p>
<p>How can i do this in android? </p>
<p>thanks!</p>
|
android
|
[4]
|
917,613 | 917,614 |
How to use operator new to count number of times of dynamic memory allocation
|
<p>Given the following code:</p>
<pre><code>int i;
...
ostingstream os;
os<<i;
string s=os.str();
</code></pre>
<p>I want to count the number of times of dynamic memory allocation when using <code>ostringstream</code> this way. How can I do that? Maybe through <code>operator new</code>?</p>
<p>Thank you.</p>
|
c++
|
[6]
|
5,440,143 | 5,440,144 |
Which is faster, Convert.ToXX() or xx.Parse(yy.ToString())?
|
<p>I'm trying to make a method faster. Right now, it takes an <code>object obj</code> and converts it to a double with the following:</p>
<pre><code>double val = Convert.ToDouble(obj);
</code></pre>
<p>Would it be faster if I did this?</p>
<pre><code>double val = double.Parse(obj.ToString());
</code></pre>
|
c#
|
[0]
|
1,672,416 | 1,672,417 |
PHP preg_match to get a word after space, which is where it a word KG
|
<p>I have a string that is uncertain,I have the following strings:<br>
<code>ST,NT,+ 16KG ~YT,NT,+ 16KG</code><br>
<code>ST,NT) 16KG +YT,N,+ 16KG</code><br>
<code>ST,NT,+ 16KG</code> and etc.<br></p>
<p>My question is there any regex only take <strong>16KG</strong> or <strong>16</strong>, because the string output from digital scale.<br>
I'm working on an application with serial port, so I can not parsing the data there, while in the output on digital scale tool is only <code>16KG</code>.</p>
|
php
|
[2]
|
5,696,934 | 5,696,935 |
how to design datalist row have columns with different no.of rows
|
<pre><code>ExamName subject MaxMarks ObtainedMarks
Hindi 100 88
AnualExam English 100 76
Maths 100 95
Science 100 86
----------------------------------------------
</code></pre>
<p>i want to design datalist control shown above i.e i want to bind examname and its related subjects in a single row.
Exam name in column with one row and subjects,marks of examname have to bind in related columns. but these must be in a single row as shown above.</p>
<p>Please help me</p>
<p>Thanks in advance
Mahesh </p>
|
asp.net
|
[9]
|
5,688,082 | 5,688,083 |
How check javascript not to open the same window with window.open function
|
<p>In my javascript i want to open URL in new window with this method:</p>
<pre><code>var win = window.open(url...);
</code></pre>
<p>How can i check this, not to open the same window and lose all inputted data.
For example, if i opened "www.musite.com/addproduct" URL in new window, input data, leave my work place. then i click open window again, new window open and i lost all my data.</p>
|
javascript
|
[3]
|
1,213,967 | 1,213,968 |
repeat the gallery elements
|
<p>Hi I want to display the gallary elements repeatedly.that means when i move forward or backward there is no need of end of gallary images.If i take 23 elemets array to assign images to gallary then that images again repeat when i move forward or backward of the gallary.For this one please give me some suggestions.Thanks in advance</p>
|
android
|
[4]
|
1,863,507 | 1,863,508 |
include php file contaning function in a web page
|
<p>I have a php file which contains php function. I have to receive its return value in a part of my web page. Where do I put the <code>include</code>? in the <code>head</code> or in the <code>body?</code> how can i call the function inside my web page?</p>
|
php
|
[2]
|
4,440,386 | 4,440,387 |
Well readable error?
|
<p>If i have a c1.php</p>
<pre><code><?php
class C1 {
function f1($value) {
if($value == 'ok') {
echo "OK!";
} else {
throw new Exception("WRONG!");
}
}
}
?>
</code></pre>
<p>and index.php </p>
<pre><code><?php
require_once('c1.php');
$c = new C1();
$c->f1('ok');
$c->f1('asd');
?>
</code></pre>
<p>Can anybody know, how to construct a well readable error message like "Error: you have wrong value in C:\xampp\htdocs\projekt\index.php: line 5" instead of tracktracing</p>
<pre><code>OK!
Fatal error: Uncaught exception 'Exception' with message 'WRONG!' in
C:\xampp\htdocs\projekt\c1.php:7 Stack trace: #0
C:\xampp\htdocs\projekt\index.php(5): C1->f1('asd') #1 {main} thrown in
C:\xampp\htdocs\projekt\c1.php on line 7
</code></pre>
<p>that reading is a little difficult.</p>
|
php
|
[2]
|
5,844,427 | 5,844,428 |
php block start with <?php= instead of <?php
|
<p>Hi All<br>
I download a free chat script that in it's php files all of php code blocks start with <code><?php=</code> instead of <code><?php</code> or <code><?</code> for print variables and constants that causes some problems and show error messages .<br>
i want to know that how to solve this problem for php script work correctly</p>
|
php
|
[2]
|
5,154,451 | 5,154,452 |
How to use AsyncTask for updating the data for Custom ListView
|
<p>How to create and update listview using AsyncTask getting data from server.Actually i am facing the problem for updating the listview i am using the handler and after some second i got update listview but the hadler class continue and when i start new activity related to my app same time if handler is called then my app is being crashed.</p>
|
android
|
[4]
|
4,937,922 | 4,937,923 |
making multiple c# file for one asp.net page
|
<p>For my project(in asp.net) i wrote near 1000 lines of c# code for one asp.net page.It includes so many functions.The problem is,it is going complicated while i am writing more codes on one page.How can i make multiple c# files for one asp.net page?? I tried by adding new class in VS2008.But calling a function from one file to other is making error(item is not present in current file).How can i do that?? </p>
|
asp.net
|
[9]
|
3,794,343 | 3,794,344 |
How Does ASP.NET Knows Which Button Caused a PostBack?
|
<p>I'm using ASP.NET 4 to create a page with elements that are used in a <a href="http://docs.jquery.com/UI/Sortable" rel="nofollow">jQuery UI Sortable plugin</a>.</p>
<p>All of these elements contain a button (implemented as a submit button) with the name <code>SubmitButton</code>. All but one of these buttons are hidden in the page's Load event. But if I drag the element to another position, and then submit the page using that button, ASP.NET gets confused.</p>
<p>ASP.NET thinks I've clicked a different button, one that wasn't even visible on the page, but is associated with content at the position where the clicked button was before the move. (If I don't move the element, it works fine.)</p>
<p>I can't seem to determine how this is happening. As I understand it, ASP.NET knows which submit button caused a postback because the button's name and value is included in the postback data. (<code>__EVENTTARGET</code> plays no role here and is empty.) So how can it think a different button submitted the page?</p>
<p>How could ASP.NET get confused about which button submitted the page?</p>
<p><em>(Sorry, it's not possible to put this page on a public website.)</em></p>
|
asp.net
|
[9]
|
5,926,506 | 5,926,507 |
Customizing MFMailComposeViewController
|
<p>is it possible to change the language from english to deustch for title send and cancel button and also "to","cc","Bcc".</p>
|
iphone
|
[8]
|
2,973,063 | 2,973,064 |
hide/unhide textbox with fadein/fadeout effect on a click of a button
|
<p>I've read this reference<br>
<a href="http://stackoverflow.com/q/6519212/881879">Using Jquery to hide/unhide the textbox if button is clicked</a><br><br>
which led to this answer<br>
<a href="http://jsfiddle.net/x5qYz/" rel="nofollow">http://jsfiddle.net/x5qYz/</a><br><br>
however I would like to add fade in and fade out effect to the hide/unhide process<br>
how do I do it</p>
|
jquery
|
[5]
|
2,100,498 | 2,100,499 |
C# -jQuery like function chaining is possible in C#?
|
<p>As I am new to C# ,just wish to know, can i perform function chaining in C# like jQuery ?</p>
<p>Example jQuery :</p>
<pre><code>$("#gview tbody tr")
.not(":first,:last")
.filter(":odd")
.addClass("someclass")
.css("border","solid 1px grey");
</code></pre>
<p>Note : I don't mean clientside script.My only concern is <i> function chaining is possible in C# or not </i></p>
|
c#
|
[0]
|
2,088,715 | 2,088,716 |
Retrieve images name from the resources - c#
|
<p>I'd like to get the name of all the images from resources and store them in a ListBox. Should i loop through and declare it as array?</p>
|
c#
|
[0]
|
922,577 | 922,578 |
javascript broken syntax
|
<p>Alright, I or someone I work with broke the syntax here somewhere, and I'm not sure where, as the debugger is giving me some random garble as the error. Anyway here is the function, I think I'm missing a bracket somewhere, but this is just evading me for some reason.</p>
<pre><code>var sort_by = function(field, reverse, primer) {
var key = function (x) {return primer ? primer(x[field]) : x[field]};
return function (a,b) {
var A = key(a), B = key(b);
return ((A < B) ? -1 : (A > B) ? +1 : 0)) * [-1,1][+!!reverse];
}
}
</code></pre>
|
javascript
|
[3]
|
3,124,432 | 3,124,433 |
implode with array
|
<p>I have array in following format. I want to convert it into another format like below.</p>
<pre><code>Array
(
[b2] => 2
[b3] => 8
[b4] => 2
[b5] => 4
)
</code></pre>
<p>Is it possible key is converted into PHP variables and its value automatically assigned to variables?Is it possible?
<code>$b = 2;
$b3 = 8;
$b4 = 2
$b5 = 4</code>
thanks</p>
|
php
|
[2]
|
496,124 | 496,125 |
parsing string messages in c++
|
<p>I'm asking for a suggestion regarding the parsing of text messages. I have a list of messages in text format, in the format:</p>
<pre><code>dev1.comm1 param
dev1.comm2 param
dev1.comm11 param
dev2.comm1 param
dev3.comm1 param
</code></pre>
<p>I need to parse each received line of text and find out the message contained. I did a parser for binary messages with lookup tables, i.e.:</p>
<pre><code>first byte table =
{
0x01 -> table 0x01,
0x02 -> table 0x01,
0x03 -> message 0x03
}
</code></pre>
<p>where 0x01 and 0x02 are the start of messages with lenght greater than 1, while 0x03 is a message made up of only one byte. If the first byte of the received message is 0x01 i go on comparing the second byte with the content of the table 0x01, while if the first byte is 0x03 i return the id of the message 0x03 and get it in some other fucntion. Obviously I implemented this with structures and pointers, this is just some form of pseudocode. </p>
<p>I would like to have a similiar solution for text messages, but the one i outlined above seems not that good to me, also because I have long text messages, and I would end up with too many tables.
Is there a cleaner solution, in the case of text messages? A parse tree perhaps?</p>
|
c++
|
[6]
|
408,592 | 408,593 |
PreferanceActivity and custom title bar.
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4921825/set-custom-title-bar-in-preferenceacivity">Set custom title bar in PreferenceAcivity</a> </p>
</blockquote>
<p>Is it possible to add a custom title bar for a preferancActivity ?</p>
|
android
|
[4]
|
2,520,031 | 2,520,032 |
How to Trigger a Page(Not Redirect) With Javascript
|
<p>I have a page and when a client use this page,
Javascript code trigger Another Page.
I dont want to redirect another page.
Javascript must only trigger another page and First page continue to its working.</p>
<p>this is imposible?</p>
|
javascript
|
[3]
|
2,964,476 | 2,964,477 |
How to correctly display the numbers for each table row added
|
<p>I have a slight problem with my application. What is suppose to happen is that when the user selects an option and answer and submits it, it will add a new row. The problem is that the question number is suppose to be +1 every time a new row is created so that it goes question number 1 for row 1, question number 2 for row 2 and etc. Instead it is just displaying the number 1 for each row under the question number column. </p>
<p>How can I get it to display 1,2,3 etc for the question No for each row added.</p>
<p>To use the jsfiddle app do this:</p>
<p>open grid and select option "3", type in the number 1 in the "Number of Answers" text-box and select Button "A". Then click on "Add Question" and a new row is added.</p>
<p>"qnum" in the insertQuestion(form) function controls the question number and the insertQuestion(from) function can be found near the bottom of the javascript code and this function adds the new rows in the table.</p>
<p>Code is in jsfiddle, click <a href="http://jsfiddle.net/YTh5Y/4/" rel="nofollow">here</a></p>
<p>Thanks</p>
|
jquery
|
[5]
|
3,017,027 | 3,017,028 |
jQuery Plugin Namespace
|
<p>How do I create a jQuery plugin so that I can use namespaces in my plugin ?</p>
<pre><code>$("#id1").amtec.foo1();
$("#id1").amtec.foo2();
</code></pre>
<p>None of these seem to work.</p>
<pre><code>(function($) {
var amtec = {
$.fn.foo1 : function(){ return this.each(function(){}); },
$.fn.foo2 : function(){ return this.each(function(){}); }
};
})(jQuery);
</code></pre>
<pre><code>(function($) {
$.fn.amtec = function(){
var foo1 = function(){ return this.each(function(){}); };
var foo2 = function(){ return this.each(function(){}); };
}
})(jQuery);
</code></pre>
|
jquery
|
[5]
|
1,835,504 | 1,835,505 |
how to get text from another app in android?
|
<p>I want to receive in my app a text that was selected in some another android app.
I read about Intent class, but if I understood well, it need to send something from first app and after receive it in second one. But I can not control first app. Is it possible to solve this problem?</p>
<p>Thank you for advise!</p>
|
android
|
[4]
|
641,506 | 641,507 |
Returning function values based on argument?
|
<p>I am having this problem in the below program flow where func1 needs list3,list4 but I dont want to return them from func2 because it affects the sanctity of func2,is there a way we can return based on some conditions?global is one way but that wont work for me because I will calling these functions with different values,lists being returned depends on the operations performed on value..what other options I have?</p>
<pre><code>def func3 (value):
list3=[]
list4=[]
#do some operations based on value
return list3,list4
def func2 (value,flag):
list1=[]
list2=[]
value=10
#do some operations based on value
if flag:
(list3,list4)=func3(value)
return list1,list2
def func1() :
value =20
(list1,list2)= func2(value,1)
#func1 needs list3 and list4
def main():
func1()
if __name__ == '__main__':
main()
</code></pre>
|
python
|
[7]
|
5,981,847 | 5,981,848 |
Java - seperate numbers from a string
|
<p>I have a string that contains a few numbers (usually a date) and separators. The separators can either be "," or "." - or example 01.05,2000.5000</p>
<p>....now i need to separate those numbers and put into an array but I'm not sure how to do that (the separating part). Also, i need to check that the string is valid - it cannot be 01.,05.</p>
<p>I'm not asking for anyone to solve the thing for me (but if someone wants i appreciated it), just point me in the right direction :)
Thanks! :)</p>
|
java
|
[1]
|
2,643,219 | 2,643,220 |
I have to make a football scoreboard, but I can't figure out how to find the total
|
<p>this is the chunk of code that displays the menu for the scores:</p>
<pre><code>public void scoreBoard() //the score board to keep count; need to display 4 times
{
Scanner score = new Scanner (System.in);
for (int k = 1; k <= 4; k++) //repeat for the 4 quarters
{
System.out.println( "T : " );
System.out.println( touchdown * score.nextInt()); //scores of the plays made
System.out.println("F : ");
System.out.println(fieldgoal * score.nextInt());
System.out.println("E : ");
System.out.println ( extrapnt * score.nextInt());
System.out.println ("P : ");
System.out.println ( twopntcon * score.nextInt());
System.out.println("S : " );
System.out.println( safety * score.nextInt());
System.out.println ( "Q : Done with quarter " + k);
}
}
</code></pre>
<p>I can't seem to figure out how to use those values and calculate a total score. please help.</p>
|
java
|
[1]
|
3,082,699 | 3,082,700 |
Resizing view to display over hidden uitabbar in iPhone
|
<p>I have an uitabbarcontroller which contains a couple uiViewControllers.
When i show one of those controllers i am hiding the tabbar. This view has a fullscreen uiimageView. The thing is i am seeing a white rectangle over where the tabbar is hidden.</p>
<p>I have tried resizing the views but the white rectangle is still there. Any ideas? Thanks</p>
|
iphone
|
[8]
|
2,488,186 | 2,488,187 |
I don't understand the usefulness of parameter arrays?
|
<p>Parameter arrays allow a variable number of arguments to be passed into a method:</p>
<pre><code> static void Method(params int[] array)
{}
</code></pre>
<p>But I fail to see their usefulness, since same result could be achieved by specifying a parameter of particular array type:</p>
<pre><code> static void Method(int[] array)
{}
</code></pre>
<p>So what benefits ( if any ) does parameter array have over value parameter of array type? </p>
<p>thank you</p>
|
c#
|
[0]
|
2,418,837 | 2,418,838 |
Is it possible to programmatically determine which will be faster; using remainder operator or a conditional?
|
<pre><code>wraparound_counter & operator ++() {
m_count = (m_count + 1) % upper_limit;
/*if (upper == m_count)
m_count = lower;
++m_count;*/
return *this;
}
</code></pre>
<p>It is my understanding that on some systems using the remainder operator trick will be faster, but on others the conditional will be faster. Is there any way to figure out which will be faster at compile-time (or run-time)?</p>
|
c++
|
[6]
|
5,216,770 | 5,216,771 |
How to insert new HTML code into existing page?
|
<p>imagine you have simple page like this:</p>
<p>Hi everybody.
when you
<strong>click here</strong>
new text will be inserted.</p>
<p>after click :</p>
<p>Hi everybody.
when you
"ulala ... I am inserted text"
new text will be inserted.</p>
<ol>
<li>is it possible to insert this text using PHP or Javascript?</li>
<li>If only javascript is appropriate may you provide a sample code?</li>
</ol>
<p>thanx a lot</p>
|
javascript
|
[3]
|
3,245,391 | 3,245,392 |
Reducing the size of edittext in android
|
<p>I'm very new to android and I want to reduce the size of <code>EditText</code> field in my layout.</p>
<p>For example if the user only need to enter 3 digits to the text field, then the size of the <code>EditText</code> should be small enough not the one provided by default.</p>
<p>Is that possible to do so?</p>
<p>Thanks in advance.</p>
|
android
|
[4]
|
3,962,927 | 3,962,928 |
Extracting archives of multiple types
|
<p>Is there any module in <em>Python</em>, which lets me extract a variety of archives? I need to extract <em>zip</em>, <em>tar.bz2</em>, <em>tar.z</em>, <em>rar</em> and others.
Right now it looks like I have to do the archive type detection manually and also to write an extraction for every single one.</p>
<p>Pure <em>Python</em> would be prefered.</p>
|
python
|
[7]
|
5,406,053 | 5,406,054 |
How to Call redirect page using php header on main web server
|
<p>When i am testing my site on local php server using wamp the its all working fine. I am calling some of page using php file and its working fine.</p>
<pre><code>header( "Location: http://127.0.0.1/portfoliohtml5/web.php" );
</code></pre>
<p>But when i try to load my page on main web server like</p>
<pre><code>header( "Location: web.php" );
</code></pre>
<p>then its not working </p>
<p>Can you suggest me how can i access my page on main web server using PHP in my website.</p>
|
php
|
[2]
|
4,181,620 | 4,181,621 |
How to display random quotes with author name in bold?
|
<p>I got a piece of code that display a random quote from a text file. It´s working fine. However I would like to style the authors name in bold. The text file "quotes.txt" looks like this: </p>
<blockquote>
<p>Because we're friends, I'm gonna tell you something nobody else knows. I'm homophobic. Author@
Cookies, everyone! Nourishment is most important in the morning. Author@
Objection, your Honor. You can't preface your second point with "first of all." Author@
Denny Crane. Author@
You know what I'm going to do, Brian, just to show you there are no hard feelings? I'm going to sleep with your wife. Author@
Did something happen? Was I in the room when it happened? Author@ </p>
</blockquote>
<p>jQuery:</p>
<pre><code><script type="text/javascript">
$(document).ready(function() {
$.get('path/to/RandomQuote.txt', function (data) {
var quotes = data.split("\@");
var idx = Math.floor(quotes.length * Math.random());
$('.quotes').html(quotes[idx]);
});
});
</script>
</code></pre>
|
jquery
|
[5]
|
1,367,417 | 1,367,418 |
It is not ouputting values in array when echoed
|
<p>I think there is a problem when I echo $whereArray and orderByArray. If I type in a word such as "Question" and then submit it, I expect it to display in the echos "%".Question."%"; for both arrays. But instead in both echos it just displays "Array" for both echos. Does this mean that both arrays are not working when it comes to storing in the values?</p>
<pre><code> $searchquestion = $_GET['questioncontent'];
$terms = explode(" ", $searchquestion);
$whereArray = array();
$orderByArray = array();
//loop through each term
foreach ($terms as $each) {
$i++;
$whereArray[] = "%".$each."%";
$orderByArray[] = "%".$each."%";
}
echo $whereArray;
echo $orderByArray;
</code></pre>
|
php
|
[2]
|
1,565,595 | 1,565,596 |
how to get desired web result in customized webview/xml view
|
<p>I have designed few buttons which links to different different web sites. but on clicking this button it shows their respective pages. I want to view the searched site in my customized new xml view.</p>
|
android
|
[4]
|
561,157 | 561,158 |
How to make javac squawk for incorrect package names in Java source files
|
<p>Today, I ran into a java source file that had a typo in the 'package' statement at the top. The name of the package did not match the name of the directory the file was sitting in (one extra 's' at the end).</p>
<p>To my surprise, javac from 1.6, checkstyle, and pmd all passed the file as OK. The only tool that got around to complaining was javadoc, and only because it was the only file in the package, and a package with no classes in it is a fatal error to javadoc.</p>
<p>Is there some option to javac, or some other command-line tool (preferably with a maven plugin maven) that will squeal about this sort of goof?</p>
|
java
|
[1]
|
5,849,993 | 5,849,994 |
How to create PDF file in C#.Net
|
<p>I want to create pdf file in c#. Pdf file contains text files and images. I want to arrange that text files and images at runtime and after arranging I want to save it as .pdf file. Please help me. </p>
<p>Thanks in advance.</p>
|
c#
|
[0]
|
226,121 | 226,122 |
Android - How to determinate ViewFlipper children size when not displayed?
|
<p>I'm actually making an application using a ViewFlipper to display 3 differents custom views. These views are, for each one, in a ScrollView (putting the ViewFlipper in a single ScrollView isn't making my onFling gestures really efficient). And i'm actually trying to synchronize the three Scrollbars position. At this point using a single ScrollView would have been easier but i trying to not use this solution.</p>
<p>I'm using a ScrollListener for each ScrollView to set the others ScrollView scroll position like in this thread : <a href="http://stackoverflow.com/questions/3948934/synchronise-scrollview-scroll-positions-android">Synchronise ScrollView scroll positions - android</a>.</p>
<p>The problem is that this method will works but the first time. When i'm on a ScrollView, the two others are not drawn already and their height is null. So setting their scroll position isn't working.</p>
<pre><code>/*Instanciate ScollViews*/
scrollViewLeft = (ScrollableScrollView) findViewById(R.id.scroll_prev);
scrollViewCenter =(ScrollableScrollView) findViewById(R.id.scroll_current);
scrollViewRight = (ScrollableScrollView) findViewById(R.id.scroll_next);
/*Fill views with events*/
setDayEvents(calIns.getPrevCal(),leftDayView);
setDayEvents(calIns.getActualCal(),centerDayView);
setDayEvents(calIns.getNextCal(),rightDayView);
scrollViewLeft.setScrollViewListener(this);
scrollViewCenter.setScrollViewListener(this);
scrollViewRight.setScrollViewListener(this);
</code></pre>
<p>So finally my question is, should i use another method to find the scroll position of the two others views ? Or can i force the view to be drawn in a ViewFlipper ?</p>
<p>Thanks :)</p>
<p>Clement.</p>
|
android
|
[4]
|
1,400,774 | 1,400,775 |
How configure cron inside of AlarmManager ? - Android
|
<p>I have the next code:</p>
<pre><code> Calendar cal = Calendar.getInstance();
cal.add(Calendar.SECOND, 5);
Intent intent = new Intent(this, AlarmReceiver.class);
intent.putExtra("alarm_message", "Alarm Executed");
PendingIntent sender = PendingIntent.getBroadcast(this, 192837, intent, PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
am.set(AlarmManager.RTC, cal.getTimeInMillis(), sender);
</code></pre>
<p>The AlarmManager run every 5 seconds.</p>
<p>It is possible set a cron inside of AlarmManager class??
For example every 5am
Please, Help me</p>
|
android
|
[4]
|
4,455,996 | 4,455,997 |
What are the most interesting / unusual design elements used on websites that you have seen?
|
<p>I am leading a team to build a website for a client. The client is a company producing games, toys and widgets. They have specifically asked for at least 2 design features on the site which are intelligent, interesting and unusual! (I am quoting the specs I got)</p>
<p>Further, they do not want any Flash - loads of JS are OK though.</p>
<p>I thought I would ask the SO community for their opinion. So, what are some of the most interesting / unusual design elements that you have seen or used yourself?</p>
|
javascript
|
[3]
|
141,850 | 141,851 |
Error in Python's os.walk?
|
<p>The <code>os.walk</code> documentation (http://docs.python.org/library/os.html? highlight=os.walk#os.walk), says I can skip traversing unwanted directories by removing them from the dir list. The explicit example from the docs:</p>
<pre><code>import os
from os.path import join, getsize
for root, dirs, files in os.walk('python/Lib/email'):
print root, "consumes",
print sum(getsize(join(root, name)) for name in files),
print "bytes in", len(files), "non-directory files"
if 'CVS' in dirs:
dirs.remove('CVS') # don't visit CVS directories
</code></pre>
<p>I see different behavior (using ActivePython 2.6.2). Namely for the code:</p>
<pre><code>>>> for root,dirs,files in os.walk(baseline):
... if root.endswith(baseline):
... for d in dirs:
... print "DIR: %s" % d
... if not d.startswith("keep_"):
... print "Removing %s\\%s" % (root,d)
... dirs.remove(d)
...
... print "ROOT: %s" % root
...
</code></pre>
<p>I get the output:</p>
<pre><code>DIR: two
Removing: two
DIR: thr33
Removing: thr33
DIR: keep_me
DIR: keep_me_too
DIR: keep_all_of_us
ROOT: \\mach\dirs
ROOT: \\mach\dirs\ONE
ROOT: \\mach\dirs\ONE\FurtherRubbish
ROOT: \\mach\dirs\ONE\FurtherRubbish\blah
ROOT: \\mach\dirs\ONE\FurtherRubbish\blah\Extracted
ROOT: \\mach\dirs\ONE\FurtherRubbish\blah2\Extracted\Stuff_1
...
</code></pre>
<p>WTF? Why wasn't <code>\\mach\dirs\ONE</code> removed? It clearly doesn't start with "keep_".</p>
|
python
|
[7]
|
1,060,696 | 1,060,697 |
Does a C# compiler optimize programs by default?
|
<p>I have two "Hello World" programs:</p>
<pre><code>static void Main(string[] args) {
Console.WriteLine("Hello World");
}
</code></pre>
<p>and </p>
<pre><code>static void Main(string[] args) {
string hw = "Hello World";
Console.WriteLine(hw);
}
</code></pre>
<p>and the IL code produced for each of these is:</p>
<pre><code>IL_0001: ldstr "Hello World"
IL_0006: call System.Console.WriteLine
</code></pre>
<p>and </p>
<pre><code>IL_0001: ldstr "Hello World"
IL_0006: stloc.0 // hw
IL_0007: ldloc.0 // hw
IL_0008: call System.Console.WriteLine
</code></pre>
<p>My question is, why did not, the C# compiler optimize this <strong>by default</strong>?</p>
|
c#
|
[0]
|
1,825,323 | 1,825,324 |
How to force close my Android application?
|
<p>Well apparently my android application doesnt close when I finish the activity so it there a way to force close it including any activity in my app that could be opened?</p>
|
android
|
[4]
|
3,366,272 | 3,366,273 |
When should I define my own copy ctor and assignment operator
|
<p>I am reading effective C++ in Item 5, it mentioned two cases in which I must define the copy assignment operator myself. The case is a class which contain const and reference members. </p>
<p>I am writing to ask what's the general rule or case in which I must define my own copy constructor and assignment operator?</p>
<p>I would also like to know when I must define my own constructor and destructor. </p>
<p>Thanks so much!</p>
|
c++
|
[6]
|
3,287,240 | 3,287,241 |
jquery selector as a custom attribute
|
<p>I am Using jquery how can I trigger an alert when mouseover the element with the data-code=GB atribute?</p>
<p>I tried this with no luck...</p>
<pre><code> $(".jvectormap-container path[data-code='GB']").mouseover(function(){
alert('test');
});
</code></pre>
<p>Thank you</p>
|
jquery
|
[5]
|
1,912,326 | 1,912,327 |
Purpose of @ symbols in Python?
|
<p>I've noticed in several examples i see things such as this:</p>
<pre><code># Comments explaining code i think
@innerclass
</code></pre>
<p>or:</p>
<pre><code>def foo():
"""
Basic Doc String
"""
@classmethod
</code></pre>
<p>Googling doesn't get me very far, for just a general definition of what this is. Also i cant find anything really in the python documentation.</p>
<p>What do these do?</p>
|
python
|
[7]
|
4,209,230 | 4,209,231 |
android: custom dial screen
|
<p>i want to develop a screen that is similar to default dial screen.
and want to override the functionality for the call button.
Can you suggest the best method to implement this?</p>
<p>Can I use the andorid's dial screen and override the call button functionality or need to develop the entire view too?</p>
<p>If we need to develope the screen from the scratch, what layout is best suited for this..(gridview/tablelayout)?</p>
<p>Thanks in advance.</p>
|
android
|
[4]
|
4,750,797 | 4,750,798 |
PHP drop HTTP connection
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/138374/close-a-connection-early">close a connection early</a><br>
<a href="http://stackoverflow.com/questions/1481247/how-to-continue-process-after-responding-to-ajax-request-in-php">How to continue process after responding to ajax request in PHP?</a> </p>
</blockquote>
<p>I need to drop connection in ajax actions:</p>
<pre><code>$response = getResponse($params);
echo $response; // don't make user to wait
flushAndDropConnection();
someLongActionsFor5Seconds();
</code></pre>
<p>How can I do it?</p>
|
php
|
[2]
|
2,503,682 | 2,503,683 |
Display gif on imagebutton android
|
<p>I was wondering if it is possible to display a gif animation on an image button. I followed the example on Android API BitmapDecode sample and can now display animated gifs on the canvas. </p>
<p>Is it possible to display this same gif on an imagebutton. I tried using the setBackgroundDrawable() and setImageDrawable() but it gives me an empty button.</p>
<pre><code>@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.test);
ImageButton btn = (ImageButton) findViewById(R.id.ImageButton01);
SampleView p=new SampleView(this);
p.setDrawingCacheEnabled(true);
p.buildDrawingCache();
btn.setBackgroundDrawable(p.getBackground());
}
</code></pre>
<p>The SampleView() class is similar to the one provided in the <a href="http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/BitmapDecode.html" rel="nofollow">BitmapDecode sample</a> (i have removed all other code snippets and it now displays only gif animation)</p>
<p>Thanks,
New Guy.</p>
|
android
|
[4]
|
268,671 | 268,672 |
Method Groups (C# In Depth) - Need help understanding better what a Method Group is
|
<p>So I have read a number of StackOverflow questions related to "what is a method group" as well as other internet articles, they all say the same thing in the bottom line - that a method group is "a group of overloaded methods".</p>
<p>However, reading Jon Skeet's "C# In Depth (second edition)", he states the following verbiage regarding method group in the context of Lambda expressions (chapter 9.4.1)</p>
<blockquote>
<p><strong>Reasons for change: streamlining generic method calls</strong></p>
<p>Type inference occurs in a few situations. We’ve already seen it apply to implicitly
typed arrays, and it’s also required when you try to implicitly convert a method group
to a delegate type. This can be particularly confusing when the conversion occurs
when you’re using a method group as an argument to another method: with overloading
of the method being called, and overloading of methods within the method
group, and the possibility of generic methods getting involved, the set of potential
conversions may be enormous."</p>
</blockquote>
<p>Either method groups are allot more than just a group of overloaded methods, or he saying you can actually create a delegate that retains an entire method group. Or something entirely different that I am not quite grasping.</p>
<p>Can someone explain what he is stating is possible here?</p>
<p>Thanks,</p>
|
c#
|
[0]
|
4,930,149 | 4,930,150 |
Javascript: Sustaining Selected Index of a ComboBox on Search
|
<p>I have a problem with my javascript. First of all here is my code partitions:</p>
<pre><code><select class="inputTxt" style="width: 120px;" id="yearCombo" name="yearCombo">
<option value="0">2013</option>
<option value="1">2012</option>
<option value="2">2011</option>
</select>
function searchClicked() {
var operationField = document.getElementById("<%=FeedbackReportCtrl.PARAM_OPERATION%>");
operationField.value = "<%=FeedbackReportCtrl.OPERATION_SEARCH%>";
var yearFilter = document.getElementById("<%=FeedbackReportCtrl.PARAM_YEARFILTER%>");
yearFilter.value = document.getElementById("yearCombo").options[document.getElementById("yearCombo").selectedIndex].text;
var mainForm = document.getElementById("main");
mainForm.submit();
}
</code></pre>
<p>Here what goes wrong is the following;
For example, when I choose the year 2011 from the combo box and then hit the search button, it brings me the desired results;however, the selected index of the box returns back to 2013. How can I sustain my selection after search function?</p>
|
javascript
|
[3]
|
4,861,875 | 4,861,876 |
looper.prepare question
|
<p>i am trying to loop a toast inside a timer but the toast doesn't show</p>
<p>the log in logcat shows that cannot create handler inside thread that has not called looper.prepare() i am not sure what it means</p>
<pre><code> int initialDelay = 10000;
int period = 10000;
final Context context = getApplicationContext();
TimerTask task = new TimerTask()
{
public void run()
{
try
{
if (a != "")
{
Toast toast = Toast.makeText(context, "Alert Deleted!", Toast.LENGTH_SHORT);
toast.show();
}
}
catch (Exception e)
{
}
}
};
timer.scheduleAtFixedRate(task, initialDelay, period);
</code></pre>
<p>what my application does is that every 10 sec it would check if a certain variable is empty. if it is empty then it will show a toast.</p>
<p>i have no problem doing this in a service class but when i try to implement this into </p>
<pre><code> public void onCreate(Bundle savedInstanceState)
</code></pre>
<p>i get this error</p>
|
android
|
[4]
|
5,690,957 | 5,690,958 |
check if mouse is over an object
|
<p>I am working to modify a script, </p>
<p>Here is original lines;</p>
<pre><code>function JT_init(){
$("a.jTip")
.hover(function(){JT_show(this.href,this.id,this.name)},function(){$('#JT').remove()})
.click(function(){return false});
}
</code></pre>
<p>I am trying to do;</p>
<pre><code>function JT_init(){
$("a.jTip")
.hover(function(){JT_show(this.href,this.id,this.name)},function(){checkifhover()})
.click(function(){return false});
}
function checkifhover() {
//if there was a func like ismouseover i would do this...
if ismouseover(JT) {
return false;
} else {
$('#JT').remove();
}
}
</code></pre>
<p>how can i check if mouse is over ?</p>
<p>thanks</p>
|
jquery
|
[5]
|
3,765,821 | 3,765,822 |
Accelerometer sample projects
|
<p>I want some accelerometer sample projects through which i can understand how i can move my object by moving iPhone or iPod?</p>
|
iphone
|
[8]
|
4,112,324 | 4,112,325 |
Hide Utility Class Constructor : Utility classes should not have a public or default constructor
|
<p>I am getting this warning on Sonar.I want solution to remove this warning on sonar.
My class is like this :</p>
<pre><code>public class FilePathHelper {
private static String resourcesPath;
public static String getFilePath(HttpServletRequest request)
{
if(resourcesPath == null)
{
String serverpath=request.getSession().getServletContext().getRealPath("");
resourcesPath=serverpath+"/WEB-INF/classes/";
}
return resourcesPath;
}
}
</code></pre>
<p>i want proper solution to remove this warning on sonar.</p>
|
java
|
[1]
|
1,320,749 | 1,320,750 |
Object access fire event
|
<p>I have an object that I created previously.</p>
<pre><code>obj = new Object();
</code></pre>
<p>I would like to fire a function each time this one of the object child is changed.</p>
<p>ex:</p>
<pre><code>function changed()
{
alert('Object changed';)
}
obj.test = 'blabla'; //fire changed().
</code></pre>
<p>Is this possible? Thank you</p>
|
javascript
|
[3]
|
4,057,775 | 4,057,776 |
check for valid date issue
|
<p>I would like to check for a valid date in 'mm/dd/yyyy' format. When I call the function below with <code>isValidDateTime('12/10/2012')</code>, it returns false. Could you please let me know what could be wrong?</p>
<pre><code>function isValidDateTime($dateTime)
{
if (preg_match("/^(\d{2})/(\d{2})/(\d{4}) ([0-5][0-9]):([0-5][0-9]):([01][0-9]|2[0-3])$/", $dateTime, $matches)) {
if (checkdate($matches[1], $matches[3], $matches[2])) {
return true;
}
}
return false;
}
</code></pre>
|
php
|
[2]
|
5,521,498 | 5,521,499 |
Why this is required for extension methods of super classes?
|
<p>Here is a sample code showing the oddity: (code fixed based on comment)</p>
<pre><code>public class C{}
public static class E {
public static void Foo(this C o) { }
}
class D:C {
void test() {
// Foo(); // will not compile
this.Foo(); // compile ok
}
}
</code></pre>
<p><strong>naturally in a real scenario class C would be a class i do not have access to its source code</strong></p>
<p>Anyone knows why this odd requirement to use the this keyword?</p>
|
c#
|
[0]
|
2,011,380 | 2,011,381 |
jQuery storing the last input value and comparing against new
|
<p>A function called "checkUsername" executes when I focusout of a input box with the id "regUsername"</p>
<pre><code>$('#regUsername').focusout(function(){
checkUsername();
});
</code></pre>
<p>The function:</p>
<pre><code>function checkUsername(){
var form_data = { username : $('#regUsername').val() };
$.ajax({
url: "/register/validateUsername",
type: 'POST',
data: form_data,
success: function(msg) {
var obj = $.parseJSON(msg);
},
error: function(data){
dbdown();
}
});
}
</code></pre>
<p>Currently every time you focusout of the input box the ajax post function will run. This causes a slight flicker on returned validation box. I was wondering if it is possible to keep the last instance of the value which was passed in and then compare it with the new value passed in. If they are the same then there would be no need for an ajax post. </p>
<p>Any help on this would be much appreciated :)</p>
|
jquery
|
[5]
|
5,939,116 | 5,939,117 |
Is it advisable to disable the Microsoft enforced coding standards in VC# 2010?
|
<p>Coming from eclipse I've developed my own coding standards which I got used to. In Visual C# 2010 however, it appears that some coding standards that MS recommends are enforced in the default configuration. </p>
<p>E.g.: I'm used to write conditional statements like this: </p>
<pre><code>if (somecondition) {
return true;
} else {
return false;
}
</code></pre>
<p>But the braces are forced to a newline in visual c#. Is it recommended to use that standard ?</p>
|
c#
|
[0]
|
1,022,380 | 1,022,381 |
Why is property null when its value is assigned using __get()?
|
<p>I've made a class:</p>
<pre><code>class MyClass {
function __get($name) {
$this->{$name} = $_SESSION[$name];
}
public function isNull(){
return $this->MyVar === null;
}
}
</code></pre>
<p><code>var_dump($obj->isNull()) //$obj is instance of MyClass</code> always outputs <code>bool(true)</code> doesn't matter <code>$_SESSION['MyVar']</code> is set or not. But if I add <code>$this->MyVar;</code> before <code>return $this->MyVar === null;</code> works as expected.</p>
<p>Well it seems that <code>__get()</code> is executed (because <code>$MyVar</code> is not set so it's inaccessible) but property stays NULL until second usage.</p>
<p>Does it happen because it's not set at all? How can I avoid using extra line (<code>$this->MyVar;</code>)?</p>
|
php
|
[2]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.