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 |
---|---|---|---|---|---|
730,933 | 730,934 | C# flowchart control | <p>Is there flowchart control in Visual studio components or Devexpress Component?</p>
| c# | [0] |
690,842 | 690,843 | What does $(function ()..})(jQuery); mean? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2937227/jquery-what-does-function-jquery-mean">jQuery: What does (function($) {})(jQuery); mean?</a> </p>
</blockquote>
<p>I am using the Telerik MVC controls. In the <code>telerik.examples.min.js</code> file they have the following:</p>
<pre><code>$(function () {
// other code here
})(jQuery);
</code></pre>
<p>Has this only got to do with global variables? If so, why are global variables bad?</p>
<p>What is <code>(jQuery)</code>?</p>
| javascript | [3] |
4,013,515 | 4,013,516 | Jquery check if image is loaded | <p>Is there a way to check if image is loaded by jquery? I have some images with external src and sometime
src points to 404 page. Is there a way to check if that image is loaded? and then I can remove it from dom otherwise.</p>
<p>Thanks.</p>
| jquery | [5] |
3,506,129 | 3,506,130 | How to bind data in pagingScroller | <p>I have have a pageScroller with three pages. I want to set each page with different view.
How do I do this? I would like sample code if it is possible.</p>
<p>This is my code:</p>
<pre><code>public class WetherActivity extends Activity{
Pager scroller;
PageIndicator indicator;
private static final int NUM_PAGES = 3;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.wether_tab);
scroller=(Pager)findViewById(R.id.scrollView);
indicator=(PageIndicator)findViewById(R.id.indicator);
indicator.setPager(scroller);
LayoutInflater layoutInflator =
(LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
for (int i = 0; i < NUM_PAGES; i++) {
View pageView = layoutInflator.inflate(R.layout.page,null);
((TextView) pageView.findViewById(R.id.pageText)).setText(
"Page " + (i+1));
pageView.setBackgroundColor(Color.rgb(206, 235, 255));
scroller.addPage(pageView);
}
}
}
</code></pre>
| android | [4] |
3,734,786 | 3,734,787 | How to use ThreadPool class in C# | <pre><code>namespace ThPool
{
class Program
{
private static long val = 0;
private static string obj = string.Empty;
static void Main(string[] args)
{
Thread objThread1 = new Thread(new ThreadStart(IncrementValue));
objThread1.Start();
Thread objThread2 = new Thread(new ThreadStart(IncrementValue));
objThread2.Start();
objThread1.Join();
objThread2.Join();
Console.WriteLine("val=" + val + " however it should be " + (10000000 + 10000000));
Console.ReadLine();
}
private static void IncrementValue()
{
for (int i = 0; i < 10000000; i++)
{
Monitor.Enter(obj);
val++;
Monitor.Exit(obj);
}
}
}
}
</code></pre>
<p>How do I use threadPool class in replacement of thread & monitor?Could anybody tell me plz </p>
| c# | [0] |
5,807,788 | 5,807,789 | How to use a jQuery variable in a selector | <p>I'm trying to highlight the table cell that is in row, col.</p>
<pre><code>var $tr = $('tr:eq(' + row + ')');
$($tr:nth-child(col)).addClass('highlight');
</code></pre>
| jquery | [5] |
4,378,178 | 4,378,179 | How do you write jquery to fade out all items of a certain type all the time | <p>So ... I know how to fadeout an item added to the dom (A success/error message in this case), but the way I'm doing it now is by writing the code to fadeout the specific item I need when it is loaded with the DOM, but also writing seperate fadeOut code when the item is added via AJAX.</p>
<p>Is there a more elegant way to handle this?
I looked into using the .live() handler but that requires an event be passed in as one of its parameters (not good because I just want the item to fade out after a set amount of time, no matter what).</p>
<p>tldr; I'm trying to write a piece of code that will fadeOut an item whether it loads with the DOM or is added to it (via AJAX for example). </p>
| jquery | [5] |
3,046,710 | 3,046,711 | How to Block the Dial, Home, Back and End Call button on Android | <p>I would like to know how could i block the dial, home , back and the end call button on an android device.</p>
<p>I know this is possible because there is an application : TheftAware which does block all the buttons so they have no effect at all.</p>
<p>And I also would like to know how to make a dialog window or any kind of window which would stay on top no matter what (this is also done in theftaware).</p>
<p>They are also able to block(hide) the call screen... does someone know how are they doing that ?</p>
<p>Note: Does all this means that android is not that secure after all ?</p>
| android | [4] |
1,010,010 | 1,010,011 | Cannot read text file in C++ | <p>I am stumped by this simple problem. I am reading a text file with C++: </p>
<pre><code>std::ifstream stream;
stream.open(filename);
if (!stream)
cout << "Invalid stream" << endl;
</code></pre>
<p>And <code>!stream</code> is true but there seems to be nothing wrong with the text file. Under what circumstances can <code>stream</code> be false? </p>
<p><strong>Note:</strong> is_open returns true </p>
| c++ | [6] |
3,546,725 | 3,546,726 | Android - Scaling a View with custom drawing | <p>I am wondering if it is possible to scale a View as to simulate pan or zoom. So far, the only way to do pan/zoom is with an ImageView and drawBitmap, but this is a little awkward for what I need to do (pan and zoom in a View with alot of drawing code).</p>
<p>Thanks for any advice!</p>
| android | [4] |
4,896,370 | 4,896,371 | C# Is there a way to create functions that accept anonymous function code as argument? | <p>I would like to do something like</p>
<pre><code>NameOfTheMethod(parameters){
// Code...
}
</code></pre>
<p>There's using, foreach, for, etc. that are already built-in, but I don't know if creating something similar is even possible. Is it?</p>
<p>The reason why I ask this is because sometimes that there are many different pieces of code that are wrapped by basically the same code (examples are opening a connection to the database, creating the command, settings the datareader, testing if an element exists in cache and, if not, go get it, otherwise get it from cache, etc.)</p>
| c# | [0] |
77,513 | 77,514 | Marshal exception in JAVA RMI | <p>What could be the possible reasons that may cause MARSHAL exception in <code>JAVA RMI</code>.
i cant share my code (its a long code)..
Thanks in advance..</p>
| java | [1] |
2,732,451 | 2,732,452 | How to Emulate Android Market App? | <p>I have developed 3 android applications and hosted in my own site.</p>
<p>Can someone please help me in the following questions I have:</p>
<p>A. With my own Client
1. How to do Silent Installations?
2. How to do Multiple Installations from a URL(User Checks multiple applications from the site and clicks on Download button. And it download applications one by one)?
3. How can I get the information on the uninstalled myown apps from the user mobile. Or how can I check whether one application is installed there or not?</p>
<p>B. Can I Leverage Google's Client services in the Andorid OS to do the above things (Avoiding to create my own client)</p>
| android | [4] |
4,285,688 | 4,285,689 | Pad with leading zeros | <p>How can i pad my integer variable with leading zeros.
like i have an integer abc with value 20 but i want it to be '0000020'.</p>
<p>Code:</p>
<pre><code>quarterlyReportDataCMMS.QRTrailerRecord.FileRecordCount = Convert.ToInt32(refEligibleClaimants.Count);
</code></pre>
| c# | [0] |
3,976,861 | 3,976,862 | Which Data Structure used to solve a simple math equation | <p>When taking in a expression like (10+5*15) and following orders of operations.</p>
<p>How would one best solve a problem like this? What kind of data structure is best?</p>
<p>Thanks.</p>
| c++ | [6] |
4,080,296 | 4,080,297 | php-pdf -table creation | <p>I am trying to create a table with fpdf
but the inputs of my table is quite big so its not fitting in one cell and i dont know how to push that data into next line without distorting the table structure.</p>
<p>I tried using multicell to..which did not work.</p>
<p>i used this code</p>
<pre><code>function table_2($header,$data)
{
// Colors, line width and bold font
$this->SetFillColor(255,0,0);
$this->SetTextColor(255);
$this->SetDrawColor(128,0,0);
$this->SetLineWidth(.3);
$this->SetFont('','B',5);
// Header
$w = array(8, 90, 90);
for($i=0;$i<count($header);$i++)
$this->Cell($w[$i],7,$header[$i],1,0,'C',true);
$this->Ln();
// Color and font restoration
$this->SetFillColor(224,235,255);
$this->SetTextColor(0);
$this->SetFont('');
// Data
$fill = false;
foreach($data as $row)
{
$this->Cell($w[0],6,$row[0],1,0,'L',$fill);
$this->Cell($w[1],6,$row[1],1,0,'J',$fill);
$this->Cell($w[1],6,$row[2],1,0,'J',$fill);
//$this->Cell($w[2],6,number_format($row[2]),'LR',0,'R',$fill);
//$this->Cell($w[3],6,number_format($row[3]),'LR',0,'R',$fill);
$this->Ln();
$fill = !$fill;
}
// Closing line
$this->Cell(array_sum($w),0,'','T');
}
</code></pre>
<p>can anyone help me with this?</p>
| php | [2] |
2,410,337 | 2,410,338 | How to search an item in Custom Adapter | <p>Friends I Have created a custom adapter to show contacts in phone.The adapter includes 2 TextViews and a checkbox.Now I need to search this list view,Help me guys How to do so? </p>
| android | [4] |
1,427,716 | 1,427,717 | Icon inside of button? | <p>How do i add an icon like in the screenshot below inside of a button? I cannot seem to find how to do it.</p>
<p><img src="http://i.stack.imgur.com/kWany.jpg" alt="http://i.stack.imgur.com/6HGcK.jpg"> </p>
| c# | [0] |
1,562,397 | 1,562,398 | Refreshing pages too much | <p>I've noticed in 4chan that if you refresh the page too much (e.g. filling out the form incorrectly too many times .etc) -- they show you the recaptcha page. I'm wondering how this is done, do they use an algorithm or something to decide what is suspicious behaviour? How would you about recording usage history in php (i.e. how would go about doing this in php)?</p>
<p>It would be most likely done using sessions right -- or would they store it in a database using IP address (unlikely due to dynamic IPs).</p>
| php | [2] |
1,931,848 | 1,931,849 | javascript object iterate through element for attribute | <p>Below, I am trying to iterate through each attribute in an input element. It isn't working and I'm not sure why. Is this an incorrect use of the object named input? How do I change this?</p>
<pre><code><script>
$('form.trade').submit(function(e) {
e.preventDefault();
input=$(this).find(':input:first');
value='';
$.each(input.attributes, function(i, attrib){
if (attrib.name!='type'){
value +=attrib.name + ":" + attrib.value + ";";
}
});
});
</script>
<form class="trade" id="24243">
<input type="hidden" available="4" pid="24243" cardname="something" yay="blah">
Available: <p class="available">4</p>
<input type="submit" value="add card">
</form>
<br/>
<form class="trade" id="24245">
<input type="hidden" available="7" pid="24243" cardname="somethik" yay="blakk">
Available: <p class="available">7</p>
<input type="submit" value="add card">
</form>
</code></pre>
| jquery | [5] |
93,128 | 93,129 | calling a function from another function in python | <p>I have written this function that takes to strings in order to see if they are anagrams:</p>
<pre><code>def anagram_check(str_x, str_y):
x = string1.replace(" ","")
y = string2.replace(" ","")
lower1 = x.lower()
lower2 = y.lower()
sorted1 = sorted(lower1)
sorted2 = sorted(lower2)
if sorted1 == sorted2:
return True
else:
return False
</code></pre>
<p>this function works fine, the problem is that now I need to use this function in another function in order to find anagrams in a text file. I want to print a list of tuples with all the anagrams in it. this is what i have done so far</p>
<pre><code>def anagrams_finder(words_num):
anagrams = []
f = open("words.txt")
a = list(f)
list1 = ([s.replace('\n', '') for s in a])
list2 = ([i.lower() for i in list1])
list3 = list2[0:words_num] #number of words from text that need to be checked.
for i in list3:
</code></pre>
<p>....</p>
<p>I tried using for loops, while loops, appand.... but nothing seems to work. how can I use the first function in order to help me with the second?
Please help...</p>
| python | [7] |
2,191,029 | 2,191,030 | convert NSData to UIImage in iphone | <p>I want to convert nsdata into uiimage and display in imageview.</p>
<p>data is coming from database like this</p>
<pre><code>NSData *imgdata = [[NSData alloc] initWithBytes:sqlite3_column_blob(cmp_sqlstmt,1)
length:sqlite3_column_bytes(cmp_sqlstmt,1)];
</code></pre>
<p>I tried this code</p>
<pre><code>UIImage *image=[UIImage imageWithData:imgdata];
//set image to imageview
[img setImage:image];
</code></pre>
<p>but image is not showing. How do I solve this?</p>
| iphone | [8] |
4,061,480 | 4,061,481 | Not getting the result | <p>I'm trying to connect to the database, but dont know what is the problem with this one. the code goes like this. Please help I'm very new to the php. :(
db_config.php</p>
<pre><code><?php define('DB_USER', "root");
define('DB_PASSWORD', "database password");
define('DB_DATABASE', "ews_app");
define('DB_SERVER', "Im using the 'drupal' for webhosting should I give server address or localhost");
?>
</code></pre>
<p><strong>db_connect.php</strong></p>
<pre><code> <?php
class DB_CONNECT {
function __construct() {
$this->connect();
echo "<p>server connected</p>";
}
function __destruct() {
$this->close();
}
function connect() {
require_once __DIR__ . '/db_config.php';
$con = mysql_connect(DB_SERVER, DB_USER, DB_PASSWORD) or die(mysql_error());
$db = mysql_select_db(DB_DATABASE) or die(mysql_error()) or die(mysql_error());
return $con;
}
function close() {
mysql_close();
}
}
?>
</code></pre>
<p>It should print server connected once it connect to the database. Are there any modification needed on it.</p>
| php | [2] |
3,169,763 | 3,169,764 | Displaying google map in asp.net page? | <p>Based on that user latitude and longitude values i need to display his direction in map .i am saving the user latt,lan values continuously in db.</p>
| asp.net | [9] |
710,451 | 710,452 | Stretch SurfaceView beyond visible bounds of parent? | <p>Does anyone know how I can stretch a surface view beyond the visible bounds of the parent (in this case a LinearLayout)?</p>
<p>I have a 3D video in side by side format that is not supported on non-3D handsets and I'm looking to show only the left half of the video.</p>
| android | [4] |
1,281,206 | 1,281,207 | How to detect Backdoor? | <p>NB:- I am not sure which type of question i can ask here. Because i saw nobody likes my previous question and then i deleted that. </p>
<p>I am hosting reseller. Some months before i have faced a massive defacement in my reseller hosting. All of hosted site made by wordpress, joomla and so shopping CMS.
And Recently i have faced again this kinds of problem. Although hackers just only changed the index file . And i recovered it easily.
But i think he kept a backdoor to come again .
And now how can i detect backdoor in my hosted sites. I am sure he is just using some sites to attack again. </p>
| php | [2] |
802,428 | 802,429 | PHP parameters between 2 scripts | <p>Script1:</p>
<pre><code><?php
/*
$file_url, $referer, $file_title are initialized in some way
*/
...
echo '<a href="download.php?url='.$file_url.'&referer='.$referer.'&name='.$file_title.'">Download</a>';
?>
</code></pre>
<p>Script2:</p>
<pre><code><?php
$file_url = $_GET['file_url'];
$referer = $_GET['referer'];
$file_name = $_GET['file_name']
?>
</code></pre>
<p>Since variables in script1 may be long strings. It makes problems when passing them through GET method. Which alternatives do I have in php for passing parameters between scripts?</p>
| php | [2] |
4,548,761 | 4,548,762 | can't run file extension aspx even it start server | <p>here is my code in my aspx file when i run it. it's show all code in the browser. i think it's maybe i don't import namespace but when i import it's still the same.</p>
<pre><code><% page language="VB" %>
<!DOCTYPE html PUBLIC ".......">
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.sqlClient" %>
<script language="vb" runat="server">
Private con As SqlConnection
Private command As SqlCommand
Private reader As SqlDataReader
sub Page_Load
con = New SqlConnection("data source=ASUS-PC; database=personal; user id=sa; password=xxxxx;")
con.Open()
end sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
</code></pre>
<p>
</p>
| asp.net | [9] |
4,059,845 | 4,059,846 | How to set that when installed will not show 'WIndows security' message? by c# | <p>How to set that when installed drivers will not show 'WIndows security' message
"windows can't verify the publisher of this driver software"</p>
| c# | [0] |
1,796,836 | 1,796,837 | If I override .equals(), do I need to override .hashCode() even if I don't use a HashMap? | <p>If I choose never to store my objects in the collection, do I need to override hashcode or can I have the same hashcode for my objects? Is it good or bad for performance? </p>
| java | [1] |
2,423,416 | 2,423,417 | Why don't we have ArrayAdapter's notifyDataSetChanged(row) | <p>When I am doing Swing programming, <code>javax.swing.table.AbstractTableModel</code> is having <code>fireTableCellUpdated(row, col)</code>, to let me specific which row and col of GUI I want to update.</p>
<p>However, when comes to <code>ArrayAdapter</code>, I realize they only provide <code>notifyDataSetChanged</code>. I was expecting I am having access to <code>notifyDataSetChanged(row)</code>, to let me update the item I am interested in. I do not want to update the entire list.</p>
<p>I was wondering why don't we have ArrayAdapter's notifyDataSetChanged(row). Or, am I missing something?</p>
| android | [4] |
3,710,378 | 3,710,379 | New to iphone dev any examples | <p>I got a iphone and i had a idea for a few apps that i wanted to produce</p>
<p>Does anyoen have any hits and tips</p>
<p>also i would love to see some hello world type apps that would help me getting started</p>
| iphone | [8] |
1,925,341 | 1,925,342 | how to detect tower changes in Android? | <p>Just wanted to know whether its possible to get cell tower changes in Android?
I have seen a event called onCellLocationChanged in PhoneStateListener. Can I use this to detect cell tower changes ? </p>
| android | [4] |
4,363,563 | 4,363,564 | Is calling functions from different js files slower than from one file? | <p>Is calling functions in different JavaScript files slowing down JavaScript processing by the browser?</p>
<p>In other words, can I call functions from a file to another one?
Or would it be better to call function in the same file?</p>
| javascript | [3] |
4,118,029 | 4,118,030 | Regular expression for C++ header files | <p>Can you please help me to write regular expression foe C++ header files using C#. I use like this....</p>
<p>public Regex keyWords = new Regex("expr.......");</p>
<p>Thank you</p>
<p>For more clarify, look at this... (This is currently use) </p>
<p>public Regex keyWords = new Regex("#include |#include |#include |#include |#include |#include ");</p>
<p>But, this is too lengthy. So i need short expression to identify header files.</p>
<p>Thank You....</p>
| c# | [0] |
1,177,666 | 1,177,667 | why is PHP not throwing a parse error? | <p>There are lots of "Why does PHP throw an error here?" questions. Well, this is a little different. I found the following code while reworking some code written by a coworker:</p>
<pre><code>foreach($arr as $key => $value) {http://google.com/
echo $value;
// ...
}
</code></pre>
<p>My first thought: "Umm...how embarrassing; he must have accidentally pasted that in there..." followed by: "Wait...there's no way this code actually runs...that should be a syntax error". And yet:</p>
<pre><code> $ php -l test.php
No syntax errors detected
</code></pre>
<p>And indeed, (like so much PHP code that seemingly shouldn't run) it runs in production without trouble. So I did a little testing:</p>
<pre><code>foreach($arr as $key => $value) {http://google.com/ <-- original, no error
foreach($arr as $key => $value) {http: <-- also no syntax error
foreach($arr as $key => $value) {http <-- bingo! "Unexpected T_ECHO..."
</code></pre>
<p>What little tidbit of PHP's grammar is producing such strange results?</p>
<p>(I am using PHP 5.3.5)</p>
| php | [2] |
2,748,263 | 2,748,264 | Is it possible to combine functions for different selectors like this in jquery? | <p>Just another silly thought for jquery. Is it possible to do something like this in Jquery:</p>
<p>Instead of typing all three like this:</p>
<pre><code>$('#id1').click(function(){
$('#idanother1').animate({height:'100px'},450);
$('#id1').toggleClass('my-added-class');
});
$('#id2').click(function(){
$('#idanother2').animate({height:'100px'},450);
$('#id2').toggleClass('my-added-class');
});
$('#id3').click(function(){
$('#idanother3').animate({height:'100px'},450);
$('#id3').toggleClass('my-added-class');
});
</code></pre>
<p>I would like to be able to write it something like this:</p>
<pre><code>$('#id1' / '#id2' / '#id3').click(function(){
$('#anotherid1' / '#anotherid2' / '#anotherid3').animate({height:'100px'},450);
$('#id1' / '#id2' / '#id3').toggleClass('my-added-class');
});
</code></pre>
<p>And if I don’t want to add class to id2 I simply exclude it like this:</p>
<pre><code>$('#id1' / '' / '#id3').toggleClass('my-added-class');
</code></pre>
| jquery | [5] |
1,728,333 | 1,728,334 | How to get notified on failed login attempts using the pattern lock-screen? | <p>I am familiar with the <a href="http://developer.android.com/guide/topics/admin/device-admin.html" rel="nofollow">Device Administrator API</a> which offers the ability to get informed on wrong password/pin lock-screen <strong>login attempts</strong>, but I need to <strong>get informed</strong> on the same events while using the <strong>pattern lock-screen</strong>. </p>
<p>Does anybody know how? (without creating a custom lock-screen application or requiring root-access)</p>
<p>Thanks in advance,
Ofir. </p>
| android | [4] |
5,148,829 | 5,148,830 | UISegmentControl problem | <p>i have a UISegmentControl which have 2 segment in my view,the problem is whatever segment i have choosed, it will return 1 in my selectedSegmentIndex property since i want it remain at the first view when select segment 0,the event i used in my segmentcontrol is valueChanged, and the function will be call as show below:
-(void)segmentSelect:(id)sender{</p>
<pre><code>NSInteger select=[sender selectedSegmentIndex];
if(select==0){
NSLog(@"this is 0");
}
else{
NSLog(@"this is 1");
infoViewController *viewController = [[infoViewController alloc]initWithNibName:@"infoView" bundle:[NSBundle mainBundle]];
[[self navigationController] pushViewController:viewController animated:YES];
[viewController release];
}
</code></pre>
<p>}
can anybody tell what goes wrong?</p>
| iphone | [8] |
5,068,968 | 5,068,969 | Go to a specific line in Python? | <p>I want to go to line 34 in a .txt file and read it. How would you do that in Python?</p>
| python | [7] |
5,930,386 | 5,930,387 | Having an object in a list know statistical information about that list | <p>For the sake of argument I have Person Objects</p>
<pre><code>public class Person
{
public int Age { get; set; }
public string Name { get; set; }
}
</code></pre>
<p>I need to have a List or something similar where each person can tell if they are older or younger than the average age. (Ideally I want to say top 10% and bottom 10%) but I will settle for over under median.</p>
<p>Is there a way to do this?</p>
<pre><code>List<Person> people = new List<Person>();
//Fill People
foreach(var person in people)
{
if (person.TopTenPercent)
{
Console.WriteLine(person.Name);
}
}
</code></pre>
<p>Thanks
Mark</p>
| c# | [0] |
2,466,207 | 2,466,208 | How does one submit ideas for new functions to be added to PHP? | <p>For instance, I see the question:</p>
<p><a href="http://stackoverflow.com/questions/1252693/php-str-replace-that-only-acts-on-the-first-match">PHP: str_replace that only acts on the first match?</a></p>
<p>and while its nice to find a few answers to this, it'd be cool if we could add
strn_replace() </p>
<p>with an argument that controls how many replacements to make.</p>
<p>I have no idea how to reach the PHP development team, could anyone provide some insight about the process to suggest new functionality and how it gets decided upon.</p>
| php | [2] |
5,191,916 | 5,191,917 | How to pass command-line parameters to a Perl script executed from Python | <p>I have written this code to run a Perl script from my Python script:</p>
<pre><code>#!/usr/bin/python
import subprocess
var = "/some/file/path/"
pipe = subprocess.Popen(["perl", "./SignalPktSender.pl ", var], stdin=subprocess.PIPE)
</code></pre>
<p>But my perl script needs command line arguments. How can I pass command arguments to the Perl script when it is run from my Python script? </p>
| python | [7] |
3,237,999 | 3,238,000 | How to access the property bag in Javascript? | <p>I want to access my property bag using Javascript from a
<pre><code> <CommandUIHandler
Command="FCS.Intake.Tab.Reports.TL"
CommandAction="javascript:
function getWebProperty() {
var ctx = new SP.ClientContext.get_current();
var web = ctx.get_site().get_rootweb();
this.props = web.get_allProperties();
this.props.set_item('aProperty', 'it worked!');
ctx.load(web);
ctx.executeQueryAsync(Function.createDelegate(this, gotProperty), Function.createDelegate(this, failedGettingProperty));
}
function gotProperty() {
alert(this.props.get_item('aProperty'));
}
function failedGettingProperty() {
alert('failed');
}
getWebProperty();"
/>
</code></pre>
<p>But I am getting an error saying " Object has no method 'get_rootweb'. I imagine this is because I haven't registered the sp.js library. If thats the problem, how would I register the sp.js library inside my elements.xml file? (Its all contained inside a element. If thats not the problem, is there a better way to access the property bag using javascript inside a element?</p>
| javascript | [3] |
456,184 | 456,185 | Android: How to handle Customview on savedInstancestate and resotreInstancestate | <p>How to handle Customview on savedInstancestate and resotreInstancestate?. Customview contains streaming video. Once i go to next activity and come to previous activity the streaming video is not visible. How to handle this?</p>
<pre><code>MjpegView container = (MjpegView)findViewById(R.id.video1_surface);
container.setSource(MjpegInputStream.read(Url));
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
}
</code></pre>
<p>can anyone help me.</p>
| android | [4] |
4,660,872 | 4,660,873 | How to add rotation effect when portrait to landscape | <p>How to add rotation effect when change mode portrait to landscape ? </p>
<p>I want to make it smooth .</p>
<p>Please help me.</p>
<p>I want to sleep. T-T</p>
| android | [4] |
5,861,639 | 5,861,640 | JQuery returns same charcode for capitals and lowercase | <p>i have attached this function to the key pressed event with jquery but in the eventObject it returns the same char code for capitals and lower case characters entered</p>
<pre><code>function keyPressed(delegates,eventdata){
var keyType = new KeyType();
var keycode = eventdata.which;
if((keycode === 0)&&(eventdata.keyCode === 46)){
keycode=46;
}
switch(keycode)
{
case keyType.enter:
break;
case keyType.backspace:
break;
case keyType.del:
break;
case keyType.space:
break;
default:
keycode = 1;
}
console.log(eventdata.charCode);
console.log(eventdata.which);
console.log(eventdata.keyCode);
//if a delegate is present call it
var delegate = delegates[keycode];
if(delegate !== null){
delegate(eventdata);
}
}
</code></pre>
| jquery | [5] |
5,603,413 | 5,603,414 | How to publish application update on Android market? | <p>I have to publish first update for my publish application. I want to do it right, but have no idea how :( Any help please?</p>
| android | [4] |
1,352,761 | 1,352,762 | DRY version of a list | <p>What would be the most efficient way to do the following:</p>
<pre><code>genres = [value_from_key(wb, 'Genre (1)', n),
value_from_key(wb, 'Genre (2)', n),
value_from_key(wb, 'Genre (3)', n),
value_from_key(wb, 'Genre (4)', n),]
</code></pre>
<p>I tried doing it with a list comprehension -- <code>genres = [value_from_key(wb, 'Genre (%s)'%(i), n) for i in range[1,4]]</code>, but it kept raising a TypeError saying object is unsubscriptable. What would be the DRY way of doing the above? Thank you. </p>
| python | [7] |
3,081,136 | 3,081,137 | Reading a wordpad file with 3 columns in Java | <p>I want to read a text file containing space sepearted values. Values are integers. How can I read it? I want to read each line and after go to next.</p>
<p>The contents are as the example:</p>
<p>"12/11/2012" "00.00.01" 0,100</p>
<p>"12/11/2012" "00.00.05" 0,140</p>
<p>"12/11/2012" "00.00.09" 0,240</p>
<p>"12/11/2012" "00.00.13" 0,247</p>
<p>The first column is the date, the second is second and the third is litres.
How can I do it with a Java program?</p>
<p>I think of using Scanner class. I made this program:
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;</p>
<pre><code> public class ScannerExample {
public static void main(String args[]) throws FileNotFoundException {
File text = new File("C:\Users\Desktop\test\test.txt");
Scanner scnr = new Scanner(text);
int lineNumber = 1;
while(scnr.hasNextLine()){
String line = scnr.nextLine();
System.out.println("line " + lineNumber + " :" + line);
lineNumber++;
}
}
}
</code></pre>
<p>But I haven't the result that I would like to have.
Any help?</p>
| java | [1] |
1,839,924 | 1,839,925 | Dynamic Importing in Python (Dotted statments) | <p>I'm having trouble with the following code:</p>
<pre><code>def get_module(mod_path):
mod_list = mod_path.split('.')
mod = __import__(mod_list.pop(0))
while mod_list:
mod = getattr(mod, mod_list.pop(0))
return mod
</code></pre>
<p>When I do <code>get_module('qmbpmn.common.db_parsers')</code> I get the error message:
<code>AttributeError: 'module' object has no attribute 'db_parsers'</code>.</p>
<p>However: <code>import qmbpmn.common.db_parsers</code> works perfectly fine.</p>
| python | [7] |
4,957,222 | 4,957,223 | Python: item for item until stopterm in item? | <p>Disclaimer: I'm fairly new to python!</p>
<p>If I want all the lines of a file until (edit: and including) the line containing some string <code>stopterm</code>, is there a way of using the list syntax for it? I was hoping there would be something like:</p>
<pre><code>usefullines = [line for line in file until stopterm in line]
</code></pre>
<p>For now, I've got</p>
<pre><code>usefullines = []
for line in file:
usefullines.append(line)
if stopterm in line:
break
</code></pre>
<p>It's not the end of the world, but since there rest of Python syntax is so straightforward, I was hoping for a 1 thought->1 Python line mapping.</p>
| python | [7] |
4,209,541 | 4,209,542 | Deploying and setup for windows applications project in visual studio 2010 | <p>I want to create a setup for a Windows Forms application using Visual Studio 2010
that contains 5 projects </p>
<p>I do this :</p>
<ul>
<li><p>from <strong>Solution Explorer</strong> >right-click><strong>add</strong> >and click <strong>New Project</strong> and then
expand <strong>Setup and Deployment</strong> and then select Visual Studio Installer.</p></li>
<li><p>select <strong>Setup</strong> Project </p></li>
<li><p>In the Name box, type testSetup.</p></li>
<li><p>then right-click testSetup, click <strong>Add</strong> and then <strong>Project Output</strong>.</p></li>
</ul>
<p>In the Add Project Output Group dialog box, what should I select?
Primary Output option for five time or what?</p>
| c# | [0] |
5,876,896 | 5,876,897 | Problem with my for loop. I have never used this type before and it's not working like a regular loop | <p>I have a Project class that holds a name and various other attributes. Everytime a new Project is made it is added to an ArrayList. </p>
<pre><code>ArrayList<Project> mProject = new ArrayList<Project>();
</code></pre>
<p>I have most of the code in a different question. I don't feel like I should ask it there as it has a different question on it. But if you want to check out more of the code it's here:</p>
<p><a href="http://stackoverflow.com/questions/6433576/can-i-use-a-method-from-a-different-class-that-i-have-added-to-an-arraylist">Can I use a method from a different class that I have added to an ArrayList?</a></p>
<p>And here is where I'm stuck. This is the first time I've used this type of loop before and I don't know what's going on. I have seen tutorials just pass over this loop with a "you should know what happens here" attituded. So if you could explain this loop that would be great also. </p>
<p>And on to the code:</p>
<pre><code>System.out.println("Select one of the fallowing projects:");
for (Project proj : mProject){
int i= 1;
i++;
System.out.println( i + ": " + proj.returnName());
}
</code></pre>
<p>My output is this:</p>
<p>Select one of the fallowing projects:</p>
<p>2: Greg</p>
<p>2: Mike</p>
<p>It looks like it's not going though the code. So I'd love an explanation or a tutorial with this loop. Thanks. </p>
<p>If I use a regular loop how whould I go about using the methods from the mProject arraylist?</p>
<pre><code>for ( int i = 0; i<= mProject.size() ; i++){
Project proj = mProject;// This won't compile.
if (choice == proj.returnName()){
}
}
</code></pre>
| java | [1] |
4,624,894 | 4,624,895 | jQuery to remove s but without using .html() which re-creates everything | <p>I have lots of elements within CKEditor with events hooked up to them and data bound to them using the .data() method. I would like to remove any &nbsp;s from this block of HTML. I could simply do </p>
<pre><code>$('body').html($('body').html().replace(/&nbsp\;/, ''));
</code></pre>
<p>But because this resets the HTML it effectivly re-creates all of the elements which means that I have to re-bind all of the events and data. What I am currently doing is this:</p>
<pre><code>if ($body.html().indexOf('&nbsp;') > -1) {
$body.find(':*:not(:has(*))').each(function(){
// These nodes don't have any children so contain text or nothing
$(this).html($(this).html().replace(/&nbsp\;/,''));
});
}
</code></pre>
<p>This will replace &nbsp;s in HTML like this:</p>
<pre><code> <p>Foo&nbsp;Bar</p>
</code></pre>
<p>But not in HTML like this:</p>
<pre><code> <div>Foo&nbsp;<span>Bar</span></div>
</code></pre>
<p>Can anyone think of a better way of doing this?</p>
<p>Thanks,</p>
<p>Joe</p>
| jquery | [5] |
1,525,378 | 1,525,379 | Can str() fail in Python? | <p>Are there any cases where <code>str()</code> throws an exception in Python?</p>
| python | [7] |
4,184,743 | 4,184,744 | how a string object transforms when compared? | <pre><code>console.log("20">10); //true
console.log("20a">"10"); //true
console.log("20a">10); //false
</code></pre>
<p>I want to know why the last one turns false.
And "20a" transforms to what before comparing.</p>
| javascript | [3] |
3,719,389 | 3,719,390 | Create Tabs on runtime in android | <p>Hello I want to create a tabs on runtime like browser but the i need a listview on all tabs , and we can add item on particular listview of tabs please suggest me , I am able to create tabs dynamically but at the time adding data , that data show on all tabs .. </p>
| android | [4] |
5,214,639 | 5,214,640 | javascript array objects | <p><a href="http://jsfiddle.net/gfuKS/5/" rel="nofollow">http://jsfiddle.net/gfuKS/5/</a></p>
<pre><code>var transitionInitial = {property: "none"};
var rules = ["color", "background-color"];
var transitions = [];
for ( var k = 0; k < rules.length; k++)
{
transitions[k] = transitionInitial;
transitions[k].property = rules[k];
alert(transitions[0].property);
}
</code></pre>
<p>Why at the second iteration transitions[0].property equals "background-color"?</p>
| javascript | [3] |
1,122,184 | 1,122,185 | Java threads stops running suddenly | <p>I have J2SE application running in 1.5 java VM in RHEL OS. One of the task of the application is to create 3 infinitely running user threads, during startup. The purpose is to check for a request of a particular type in backend DB table and do corresponding operations.</p>
<p>As we observed, the long running threads suddenly stops running, but still the application is alive and JVM process can be seen, in ps -ef|grep java</p>
<p>Can someone throw light on why threads which are created to run in infinite loop, stops suddenly? Any ideas on how to detect this issue and possible resolution will be of great help</p>
<p>With Regards,
Krishna</p>
| java | [1] |
984,644 | 984,645 | PHP outputting inconsistent values from same array | <p>In phpmyadmin and in the print_r of the entire array the value for template_id is 3, but when I print the value directly I get 31?</p>
<p>Any inights as to why this is happening would be greatly appreciated.</p>
<p>When I print_r from $data['resume'] I get:</p>
<blockquote>
<p>Array ( [profile_id] => 38 [name] => Amy P. Cherwim [occupation] =>
Administrative Assistant [tagline] => Administrative Assistant [phone]
=> 444-222-4339 [fax] => [email] => [email protected] [website] => [address] => 336 W. Chugalug Way Sentinel, WY 33666 [user_id] => 1
[title] => Amy's Profile [date_add] => 0000-00-00 00:00:00 [date_mod]
=> 2012-03-04 10:53:40 [resume_id] => 316 [vanity_name] => Copy of Sample of Template 3 [template_id] => 3 [scale] => 1 ) 1</p>
</blockquote>
<p>When I print_r from $data['resume']['template_id'] I get: 31</p>
| php | [2] |
937,264 | 937,265 | Automatically updating the actual parameters in javascript | <p>How to pass a primitive variable (like a string) by reference when calling a java script method?
Which is equivalent of out or ref keyword in C#.</p>
<p>I have a variable like <code>var str = "this is a string";</code> and passing the str into my function and automatically have to reflect the change in str when i change the argument value</p>
<pre><code>function myFunction(arg){
// automatically have to reflect the change in str when i change the arg value
arg = "This is new string";
// Expected value of str is "This is new string"
}
</code></pre>
| javascript | [3] |
3,133,182 | 3,133,183 | Gallery crashes on invoking from app: Android 3.0 SDK | <p>I am invoking the gallery, so that a user can select a photo to import into my app, however, the gallery just seems to crash as soon as it is invoked...</p>
<p>Any ideas if this is a known issue or would I be doing something wrong by invoking using the following:</p>
<pre><code> Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
photoPickerIntent.setType("image/*");
startActivityForResult(photoPickerIntent, ACTIVITY_SELECT_IMAGE);
</code></pre>
<p>Or the following:</p>
<pre><code> Intent i = new Intent(Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI);
startActivityForResult(i, ACTIVITY_SELECT_IMAGE);
</code></pre>
<p>Thanks,
Sonny</p>
| android | [4] |
4,608,733 | 4,608,734 | How to parse the Google search engine in android? | <p>i'm unable to parse the google map.</p>
<p>Is it require saxparser??</p>
<p>if yes can anyone sharte the </p>
| android | [4] |
2,085,499 | 2,085,500 | How to load database from file mdb ( microsoft access file) in android? | <p>I'm new to android and making a sample app to load database from package/assets/test.mdb</p>
<p>I try to follow <a href="http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/" rel="nofollow">this turorial</a>
My problem is that i don't know how to work with *.mdb.</p>
<p>Do i have to convert to specify database or just directly work with this file ?</p>
<p>And in this case database file has big amount (200 MB), so what should i do ?</p>
<p>Thanks !</p>
| android | [4] |
5,558,400 | 5,558,401 | Useful videos in YouTube for learning programming | <p>Is it possible to really find useful tutorials and videos for learning programming languages in YouTube? Could you recommend some channels?</p>
<p>I would like to learn about: Vim, Apache Subversion, and C++.</p>
| c++ | [6] |
5,372,010 | 5,372,011 | how to get signal strength in android by clicking a button not listening all the time to a listener? | <p>I want to create a method so when I wanted to call it and get the signal strength of my phone I'm totally aware of ordinary way of getting signal strength using PhoneStateListener.</p>
<p>I couldn't find way to access for my problem but I'm sure there is a way for doing that.</p>
| android | [4] |
3,175,498 | 3,175,499 | Async Task for a peroid of time after closing the activity | <p>I want to download 4 video file from web server.That i have used Asynctask to download files?what if the user leaves the application. will async task work for until the download complete? if not please send the code to manage that?</p>
| android | [4] |
3,256,516 | 3,256,517 | How can I use GLG toolkit in Java? | <p>Hello Everyone is Stack Overflow! =)</p>
<p>I am doing my 3d transformation of an arm. After looking at one example in the Internet, I found out that the programmer is using GLG Toolkit to draw the robot arm he made, then connect(?) it to Java, to code the transformation.</p>
<p>When I tried the code to my version of Java, it wouldn't work because the GLG toolkit can not be found in any of the Java Libraries. I am trying to find ways how can I use the GLG toolkit in my Java Application too.</p>
<p>Through my further searches, I found out that there is a Java version for the GLG toolkit, however, I can't find one and I don't know how to connect(?) or use it in Java programs.</p>
<p>Can you teach me how to use the GLG Java version in my application? Please send me answer if you know anything.</p>
<p>Thank you. </p>
| java | [1] |
3,337,990 | 3,337,991 | setInterval of a private function | <p>i want to do a setInterval of a function that is at the same level as the declaration of the setinterval but not global</p>
<p><strong>Example:</strong></p>
<pre><code>function a()
{
function b(){alert("hi");}
setInterval("b()",1000);
}
</code></pre>
| javascript | [3] |
2,943,311 | 2,943,312 | How to get data from a control into another ASP.net page? | <p>I'm creating a time sheet for work to learn more about asp and making database connections I am also using this time to prepare for my next C# and database design class which start on Wednesday. I'd like to know how I can get data from default.aspx and display it in timesheetdisplay.aspx, and I would also like to know how I can make it so the person doesn't have to enter the full id "100000111" as it appears in the database just the last 3. </p>
<pre><code><asp:TextBox id="xBadgeTextBox" runat="server" width="100px"></asp:TextBox>
</code></pre>
| asp.net | [9] |
2,300,614 | 2,300,615 | Required concepts for to learn Python? | <p>Can any one tell me,which concepts are required for to learn Python? </p>
<p>As of now, I'm working on Java as SE in a small company and I'm looking for job change and my friends suggested 'Python' is easy compare to all. Last week I was started to learn the Python and I've lot of doubts on this..
1. Which topics are required?
2. Which platform is the best one [ Linux, Mac Os, Windows..]
3. Is it required to learn GUI-Concepts. .like that.. </p>
<p>Please help me ... Thnx in advance.. :)</p>
| python | [7] |
2,713,019 | 2,713,020 | Adb won't start | <p>Running Vista, tried starting adb from shell as admin get daemon not running starting it<br>
now ADB server didn't ACk failed to start daemon. </p>
<p>Any help for this? </p>
| android | [4] |
2,862,454 | 2,862,455 | Playing Audio file | <p>I use the following code to play audio from sdcard. But it doesn't play, even doesn't throw error. My file is in the following path /sdcard/media/blueeye.mp3. Any suggestions.</p>
<pre><code>public void audioPlayer(){
//set up MediaPlayer
MediaPlayer mp = new MediaPlayer();
try {
mp.setDataSource(mp.setDataSource(getExternalFilesDir() + "/media/blueeye.mp3"); );
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
mp.prepare();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
mp.start();
}
</code></pre>
| android | [4] |
780,328 | 780,329 | <asp:TemplateField Boxes Disappearing | <p>I've got a text box that just disappeared. When I add another templateField anywhere on the page, this one bizarelly disappears. Anyone know what might be up?</p>
<pre><code><asp:TemplateField HeaderText="Summary" SortExpression="summary">
<ItemTemplate>
<asp:Label ID="lblSummary" runat="server" Text='<%# Bind("summary") %>'></asp:Label>
</ItemTemplate>
<ItemTemplate>
<asp:TextBox ID="txtSummary" TextMode="MultiLine" Width="500" Height="100" runat="server" Text='<%# Bind("summary") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</code></pre>
| asp.net | [9] |
2,347,865 | 2,347,866 | Is there a simple method for mkdir that is more than one directory deep unmade? | <p>Assume I only have the folder <code>/root</code>, with no subdirectories. Is there an easy method in python to create all directories for the following (in one line) <code>/root/a/b/c/d/e/f/g/foo.exe?</code></p>
| python | [7] |
3,889,399 | 3,889,400 | How do I access a class from inside another class? | <p>The next part of the assignment tells me that the Class <code>RacingCar</code> contains four wheel objects as defined by class Wheel. Implement the wheels as an array of objects on the heap.</p>
<pre><code>class RacingCar{
int speed;
public:
void Accelerate(int value) {
speed = speed + value;
}
void Brake(int value) {
speed = speed - value;
}
void Turn(int value) {
speed = value / 4;
}
void Print(){
cout << "The current KM/h of the car is: " << speed;
}
};
class Wheel {
int *ptrSize;
int pressure;
public:
Wheel() : pressure(32) {
ptrSize = new int(30);
}
Wheel (int s, int p) : pressure(p) {
ptrSize = new int(s);
}
~Wheel() {
delete ptrSize;
}
void pump(int amount) {
pressure += amount;
}
void print() {
cout << pressure;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
Wheel *heapArray = new Wheel[4];
RacingCar F1; //Creating a "Formula 1" test car
//Test parameters
F1.Accelerate(10);
F1.Brake(50);
F1.Turn(180);
F1.Print(); //Checks to see if the car changes actually worked
getch();
delete [] heapArray; //Delete when you're done
return 0;
}
</code></pre>
<p>Is it ideal to build a class like this, and then access it inside <code>RacingCar</code>? Or is there a better way to do so? I can't see a way to create it on the heap otherwise.</p>
| c++ | [6] |
4,311,077 | 4,311,078 | toggle information on and off, pulling from separate file | <p>I'm writing code that will, when a button is clicked, display some simple text (a changes log), and then when clicked again will hide it.</p>
<p>The trick here is that I'd like to keep that change log in a separate file, and call it for display. I've got code like follows:</p>
<pre><code> echo "<input type=\"button\" id=\"recentchanges\" value=\"Show/Hide Recent Changes\" /></br><span id=\"changestext\"></span>";
</code></pre>
<p>And:</p>
<pre><code>$('#recentchanges').click(function() {
$('#changestext').append(test/recentchanges.txt);
});
</code></pre>
<p>So my questions are. 1. How can I hide/show by clicks? It doesn't look like .toggle() is what I want.. but perhaps it is.. And 2. How can I call data from a separate file? (and as part of that question, should it be a txt file or an html file? Should I have the text formatted with html, or just raw text?)</p>
| jquery | [5] |
297,706 | 297,707 | Uitextfield in uitableview | <p>Hii
I am using one tableview controller having 11 textfields and 1 date picker and 1 picker.
can i save this value in this controller or should I set this values in another controller .</p>
<p>I have seen almost example and they all have two views one for entering textfield and selecting picker value and when we save it it goes back and save all data in another view.
Is This right way???? or I can use only one view????</p>
<p>If i used this in one view then cells clear values when i scroll table... plz help.</p>
| iphone | [8] |
3,212,579 | 3,212,580 | Vector made up of user defined type can't use vector::erase(); | <p>Trying to make a simple card game program. I'm having trouble with the vector::erase(); function on a vector made of of type Card. It seems that it can't use it because there isn't an overloaded function in vector::erase(); that deals with a <code><Card></code>. This confuses me because a vector is templated. Any idea what to do?</p>
<pre><code> #include <iostream>
#include <vector>
#include <algorithm>
enum card_suit {SPADE, CLUB, DIAMOND, HEART};
class Card;
class Player;
class Deck;
class Card
{
unsigned short rank;
card_suit suit;
public:
Card(unsigned short r, card_suit s)
{
rank = r;
suit = s;
}
bool operator == (Card& a)
{
if(this->rank == a.rank && this->suit == a.suit) return true;
else return false;
}
};
class Deck
{
std::vector<Card> cards;
public:
Deck& add_card(Card c)
{
cards.push_back(c);
return *this;
}
Deck& remove_card(Card c)
{
for(std::vector<Card>::iterator i=cards.begin(); i<cards.end(); i++)
{
if(*i==c) cards.erase(cards.begin()-i);
}
return *this;
}
Deck& shuffle()
{
}
};
class Player
{
Deck hand;
unsigned short points;
public:
Player()
{
points=0;
}
};
int main()
{
return 0;
}
</code></pre>
| c++ | [6] |
4,204,351 | 4,204,352 | File Upload problem, file not found | <p>From my asp.net form, I am trying to save a picture to my SQL Database. Problem is the File Upload button just takes the name of the file, not the full path. When I try to save it, it says file not found.
Is there something like OpenFileDialog in webforms, as I use that for vb.net and that works excellent.</p>
<p>Thanks</p>
| asp.net | [9] |
3,507,002 | 3,507,003 | Webcam access in c++ without openCV | <p>Can I make some c++ webcam program without using opencv (and without others external library)? My idea is to take the data from the webcam and display it on window, like a live video.
Could you show me some example?
Sorry for my bad english. Thank you very much.</p>
| c++ | [6] |
5,090,182 | 5,090,183 | Validate Call log | <p>I am new to android. Can we delete call log entries by program. in which event we write the code for to do this.</p>
| android | [4] |
277,454 | 277,455 | validate comma separated url in jquery | <p>I want to validate url with comma seperation. I have written following code but it does not execute peoperly.</p>
<pre><code>jQuery.validator.addMethod("multireview", function (value, element) {
if (this.optional(element)) {
return true;
}
var multiurl = value.split(','),
valid = true;
for (var i = 0, limit = multiurl.length; i < limit; i++) {
value = multiurl[i];
valid = valid && jQuery.validator.methods.url.call(this, value, element);
}
return valid;
}, "Invalid review format: please use a comma to separate multiple website reviews.");
</code></pre>
<p>If anybody have any solution please suggest me.</p>
<p>Thanks</p>
| jquery | [5] |
2,407,856 | 2,407,857 | Get property of object property by string in C# | <p>How to access to property of property in object instance using string ?
I would like automate changes i will made in form for example responding to object below:</p>
<pre><code>class myObject{
Vector3 position;
public myObject(){
this.position = new Vector3( 1d,2d,3d);
}
};
</code></pre>
<p>Form have eg three <code>numericUpDown</code> called respectively <code>position_X</code>,<code>position_Y</code>,<code>position_Z</code>;
Instead having three callbacks for events as: </p>
<pre><code>private void positionX_ValueChanged(object sender, EventArgs e)
{
// this.model return myObject
this.model().position.X = (double) ((NumericUpDown)sender).Value;
}
</code></pre>
<p>I would have one callback which can automatically set particular attribute in model from control name/tag</p>
<p>Below is javascript which describe purpose i want :)</p>
<pre><code>position_Changed( sender ){
var prop = sender.Tag.split('_'); ; // sender.Tag = 'position_X';
this.model[ prop[0] ] [ prop[1] ] = sender.Value;
}
</code></pre>
| c# | [0] |
4,365,225 | 4,365,226 | Asp.Net Website giving error when upgraded my server from 2.0 to 4.0 | <p>This code is working fine on my local computer which has Visual Studio 2010 and it was
working fine on .NET Framework 2.0 but when I upgraded my server from 2.0 to 4.0
it is giving this error:</p>
<blockquote>
<p>Server Error in '/' Application.</p>
<p>Compilation Error</p>
<p>Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.</p>
<p>Compiler Error Message: CS0246: The type or namespace name 'staticpage_namespace' could not be found (are you missing a using directive or an assembly reference?)</p>
<p>Source Error:</p>
<p>Line 10: using System.Web.UI.HtmlControls;</p>
<p>Line 11: using System.Data.SqlClient;</p>
<p>Line 12: using staticpage_namespace;</p>
<p>Line 13: </p>
<p>Line 14: </p>
</blockquote>
<p>Can any any body help? </p>
<p>Here is the code which i am using for class in App_code folder:--</p>
<pre><code>namespace staticpage_namespace
{
public class Staticpage
{
......
public SqlDataReader InsertHome()
{
SqlDataReader dr = SqlHelper.ExecuteReader(configclass.DbConn, CommandType.StoredProcedure, "InsertHome");
return dr;
}
public Staticpage()
{
//
// TODO: Add constructor logic here
//
}
}
}
</code></pre>
<p>And this is the code for my webform:-</p>
<pre><code>using staticpage_namespace;
public partial class _Default1 : System.Web.UI.Page
{
}
</code></pre>
| asp.net | [9] |
5,072,165 | 5,072,166 | change the option of all other select menus in page with same id | <p>I'm new to javascript and need help to figure this one.</p>
<p>I have three menus where you select and option and for each menu you select it displays a row of data. In each row (i.e. 3 row for 3 selections) another select menu is available for you to pick a provider for that product. I created another select that you select a default provider and onchange the other menus in the rows change. The problem I have is that they all have the same id because when you pick an option a function gets called. I tried to loop through all select and from those selects with id=x change selected option but only works for 1st select found with that id</p>
<pre><code>echo" function pickprovider($name, $idname){ \n";
echo" <select name='$name' id='idname'> \n";
echo" <option>1stprovider </option> \n";
echo" <option>2ndprovider </option>\n";
echo " </select>\n";
echo" }\n";
echo" function defaultprovider($name, $idname) {\n";
echo" <select name='$name' id='idname' onchange='changeDflt(this);'> \n";
echo " <option>1stprovider </option> \n";
echo " <option>2ndprovider </option> \n";
echo "</select>\n";
echo" }\n";
echo "<script type='text/javascript'>\n";
echo "function ChangeDflt(list) { \n";
echo "var x = list.options[list.selectedIndex].text;\n";
echo "var allSelects = document.getElementsByTagName('select');\n";
echo "for (var i = 0; i < allSelects.length; i++) { \n";
....
change selected options for selects
echo "}\n";
echo "}\n";
echo "</script<\n";
</code></pre>
<p>I do not know how to change the function to make a unique id everytime the function is called. ....Can I use "div" tag when I get all the select elements in page?</p>
| javascript | [3] |
1,560,511 | 1,560,512 | Is it safe to use a long running data processing function in ASP.NET | <p>I have a function that takes about 2-3 minutes to do all of the processing it needs </p>
<p>It only needs to do the calculations once daily. The processing is done inside of a background thread that is started inside Application_Start in Global.asax.cs.</p>
<p>I am worried that the application will kill the method while it is running.</p>
| asp.net | [9] |
5,961,969 | 5,961,970 | Dynamically appended scripts not downloaded in Chrome | <p>Does anybody know how to append scripts dynamically in Chrome? I copied the following code that works in FF 3.0 and IE7 but not Chrome.</p>
<pre><code> function include_dom(script_filename) {
var html_doc = document.getElementsByTagName('head').item(0);
var js = document.createElement('script');
js.setAttribute('language', 'javascript');
js.setAttribute('type', 'text/javascript');
js.setAttribute('src', script_filename);
html_doc.appendChild(js);
return false;
}
var included_files = new Array();
function include_once(script_filename) {
if (!in_array(script_filename, included_files)) {
included_files[included_files.length] = script_filename;
include_dom(script_filename);
}
}
function in_array(needle, haystack) {
for (var i = 0; i < haystack.length; i++) {
if (haystack[i] == needle) {
return true;
}
}
return false;
}
</code></pre>
<p>I can see the code appended to the head element by running:</p>
<p>`document.getElementsByTagName('head').item(0).innerHTML;</p>
<p>within Chrome's inspector, however I can't see any of the scripts being requested in my HTTP sniffer.</p>
| javascript | [3] |
5,112,743 | 5,112,744 | image magick php, install | <p>does image magick come bundled with php? if so how do i enable it, if not where and what do i have to do to integrate it.</p>
<p>many thanks</p>
| php | [2] |
5,812,453 | 5,812,454 | Do people still dislike PHP? | <p>I've ran across a number of topics on this particular exchange site, and I've seen many many comments "stop using php" and making fun of it. I'm a php user and I find it quite good and useful, I've never had some real problems with php itself, and I never thought that php encourages bad code.</p>
<p>I have seen some terrible code. But why blame the language? I mean it's not like PHP is some kind of ol-procedural style pile of mess people describe it to be. By looking at PHP frameworks, I don't really see any mess or bad code there.</p>
<p>So do these people hate PHP because of the past (procedural mess) or do they discredit OOP and popular MVC frameworks too (not fully OOP, not like Java and stuff) ?</p>
<p>I'm not very experienced in programming and I'm not saying PHP is awesome or anything, but I've seen some Python/Java/C# and I don't see how PHP is so messy vs them.</p>
<p>What is your take on this?</p>
| php | [2] |
1,988,221 | 1,988,222 | An easy way to get the sunset / sunrise times for a city in PHP | <p>Is there a way to get sunrise and sunset times in PHP without having to deal with Zenith and GMT offsets? </p>
<p>The functions <code>date_sunrise()</code> and <code>date_sun()</code> asks for zenith and GMT which I don't want to deal with.</p>
<p>Ideally I would simply write <code>someSunriseFunction(<latitude>, <longitude>, <timezone>)</code>
i.e. <code>someSunriseFunction(34.30, -118.15, 'EST')</code> would be for Los Angeles.</p>
<p>Thanks.</p>
| php | [2] |
3,997,583 | 3,997,584 | How to connect with FTP server? | <p>I want to implement one application in which i want to connect ftp server from the iphone by programming.Please help me for that.</p>
<p>Edit:
I am using below code
<a href="http://developer.apple.com/iphone/library/samplecode/SimpleFTPSample/" rel="nofollow">http://developer.apple.com/iphone/library/samplecode/SimpleFTPSample/</a></p>
<p>Its working fine.But when i am using my ftp server url at that time it gives open stream error.What is the problem can u explain me.</p>
| iphone | [8] |
2,461,364 | 2,461,365 | Enable Spanish IME on android emulator | <p>I wanted to ask if it is possible to enable spanish ime for soft keypad in android emulator ? I enabled spanish ime from settings but it doesn't show some espanol alphabets like Ñ and Ch.</p>
<p>Thanks.</p>
| android | [4] |
1,160,291 | 1,160,292 | jQuery function triggers for a button but not another? | <p><strong>EDITED</strong></p>
<p>Hi,</p>
<p>I have 2 buttons calling the same function clear_form(). In my clear_form() function I have placed an alert() at the end of the code to see if it is triggered for both buttons.</p>
<p>The stange thing is I can see the alert for both buttons but the clear_form() function only clears the form for the #clear_all_btn button.</p>
<pre><code>// Clear form trigger.
$('#clear_all_btn').click(function()
{
$('#form_id').val('0');
clear_form('#form1');
});
//Delete button trigger.
$('#delete_form_btn').click(function()
{
$('#form_id').val('0');
clear_form('#form1');
});
function clear_form(form)
{
// Remove any validation errors from last request.
$('.form_validation').remove();
$('.error').removeClass('error');
$('#wrap_escrow').hide();
$(':input',form)
.not(':button, :submit, :reset, :hidden')
.removeAttr('checked')
.removeAttr('selected');
remove_all_accounts();
alert('cleard form');
}
<form id="form1">
....
<input type="button" name="delete_form_btn" id="delete_form_btn" value="Delete" />
<input type="button" name="clear_all_btn" id="clear_all_btn" value="Clear Form" />
</form>
</code></pre>
<p>Anyone help me out on this?</p>
<p>Thanks</p>
| jquery | [5] |
2,125,352 | 2,125,353 | want to show notification in status bar after posting notification | <p>i want to show the notification in the status bar after posting the notification from the user. What should i have to do?</p>
| android | [4] |
3,368,853 | 3,368,854 | Python If statements | <p>In my python program sometimes in my if statements only the top one works</p>
<p>here is my program
<a href="http://ubuntuone.com/0u2NxROueIm9oLW9uQVXra" rel="nofollow">http://ubuntuone.com/0u2NxROueIm9oLW9uQVXra</a></p>
<p>when you run the program if you go north east west south and then it doesn't work
the problem is in the function room4():</p>
<pre><code>def room4():
"""Forest go south to small town room 1 and east to forest path room8"""
room = 4
print "Forest you can go south to small town, east to forest path, or continue to explore the forest"
cmd = raw_input('> ')
cmd = cmd.lower()
if cmd == "e" or cmd == "east" or "go east":
print room8()
if cmd == "s" or cmd == "south" or "go south":
print room1()
if cmd == "forest" or cmd == "explore" or cmd == "explore forest" or cmd == "explore the forest":
print room13()
else:
print error()
print room4()
</code></pre>
| python | [7] |
1,977,143 | 1,977,144 | How to get the instance of class | <p>I have made three classes classA, classB and classC in the same package. Now I make three objects of classA inside classB and two objects of classA inside classC. Now how can i get following things inside classA.</p>
<p>1) How many objects of classA has been used by classB and classC ?
2) How can i get the name & reference of the objects of classA which are in classB and classC?</p>
| java | [1] |
3,607,453 | 3,607,454 | Problem with content page in a different folder than master page | <p>I have put the master page in the main directory and content page in a different folder in the same directory. When I try to debug the page, it does not show me any error but the images on the master page are not visible. The content page works fine if it is in the directory itself without any folders. Can anyone let me know if I am missing something here.</p>
| asp.net | [9] |
4,435,669 | 4,435,670 | I don't know which is better, php or .net? | <p>I love Internet,I want to learn something cool,
who can tell me which is better, php or .net?
Even JAVA</p>
| php | [2] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.