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,798,398 | 1,798,399 |
writing to file object, python
|
<p>I have the following code</p>
<pre><code>for i in np.arange(10):
f = open("file_"+str(i)+".dat",'w')
for j in np.arange(100):
f.write(str(func(i,j)))
f.write("\n")
print func(i,j)
f.close()
</code></pre>
<p>Now, I can see the output on the terminal because of the <code>print</code> command but the files that it is creating are empty. It isn't able to write the output to the file. How can I do it?</p>
|
python
|
[7]
|
3,750,952 | 3,750,953 |
How to convert an H:MM:SS time string to seconds in Python?
|
<p>Basically I have the inverse of this problem: <a href="http://stackoverflow.com/questions/775049/python-time-seconds-to-hms">Python Time Seconds to h:m:s</a></p>
<p>I have a string in the format H:MM:SS (always 2 digits for minutes and seconds), and I need the integer number of seconds that it represents. How can I do this in python?</p>
<p>For example:</p>
<ul>
<li>"1:23:45" would produce an output of 5025</li>
<li>"0:04:15" would produce an output of 255</li>
<li>"0:00:25" would produce an output of 25</li>
</ul>
<p>etc</p>
|
python
|
[7]
|
3,622,443 | 3,622,444 |
Why don't you need a powerful ide for writing Python?
|
<p>I have heard before that many Python developers don't use an IDE like Eclipse because it is unnecessary with a language like Python. </p>
<p>What are the reasons people use to justify this claim?</p>
|
python
|
[7]
|
1,341,792 | 1,341,793 |
Jquery function works only one time
|
<p>here is a problem:</p>
<p>I need jquery to execute some php script and then return some results. There is a pagination at the page (generated by php). So there can be two cases. User gets to the page from external link => pagination starts from beginning. Or user selects a page => jquery runs php again and gets new pagination and results.
Here is a script:</p>
<pre><code>var page = '';
$.getJSON("test.php", {resid: "[[*id]]"}, function(output) {
$('#testdiv').html(output.content).show();
$('#pagination').html(output.pagination).show();
$('a.pagenav').click(function() {
page = $(this).attr('href');
$.getJSON("test.php", {resid: "[[*id]]", spp: page}, function(output) {
$('#testdiv').html(output.content).show();
$('#pagination').html(output.pagination).show();
});
return false;
});
});
</code></pre>
<p>The script works at inilial load (pagination gets generated) and then one time I select a page. But the next time I select a page, it just follows it's url.
Need help )
thx</p>
|
jquery
|
[5]
|
1,224,793 | 1,224,794 |
get text from pressed button
|
<p>How can I get the text from a pressed button? (Android)</p>
<p>I can get the text from a button:</p>
<pre><code>String buttonText = button.getText();
</code></pre>
<p>I can get the id from a pressed button:</p>
<pre><code>int buttinID = view.getId();
</code></pre>
<p>What I can't find out at this moment is how to get the text on the pressed button.</p>
<pre><code>public void onClick(View view) {
// Get the text on the pressed button
}
</code></pre>
|
android
|
[4]
|
5,494,186 | 5,494,187 |
Have you Guys Heard of C++ Server Pages?
|
<p>I have been looking for a ways to maximize speed in my web application. Came across an interesting application called CSP. Have you guys ever heard of them? They claim that you can program web application in c++. Is it worth it?</p>
<p><a href="http://www.micronovae.com/CSP.html" rel="nofollow">http://www.micronovae.com/CSP.html</a></p>
|
c++
|
[6]
|
2,924,419 | 2,924,420 |
Call reference of an object as a parameter in another method
|
<p>For example:</p>
<pre><code>A a = new A(b);
B b = new B(a);
</code></pre>
<p>How can I use <code>b</code> as a parameter in <code>A</code> constructor when it's not existed, how can the compiler will know that <code>b</code> will be created later? </p>
<p>Thank you.</p>
|
c#
|
[0]
|
2,395,313 | 2,395,314 |
javascript to check when the browser window is close
|
<p>Does anyone know any way that I can use javascript to check when the browser window is close and pop-up a confirmation dailog to ask whether the user is confirm to exit the browser or change his mind to stay? </p>
|
javascript
|
[3]
|
3,093,188 | 3,093,189 |
Replace console output in python
|
<p>I'm wondering how I could create one of those nifty console counters in Python as in certain C/C++-programs.</p>
<p>I've got a loop doing things and the current output is along the lines of:</p>
<pre><code>Doing thing 0
Doing thing 1
Doing thing 2
...
</code></pre>
<p>what would be neater would be to just have the last line update;</p>
<pre><code>X things done.
</code></pre>
<p>I've seen this in a number of console programs and am wondering if/how I'd do this in Python.</p>
|
python
|
[7]
|
2,858,774 | 2,858,775 |
jQuery animations - when is asynchronous and when it's not?
|
<p>I have two divs which I want to animate:</p>
<pre><code><div id="character">
<div id="sprite">
</div>
</div>
$("#sprite").animate({"width" : "1", }, 400 );
$("#character").animate({"width" : "1", }, 400 );
$("#character").animate({"margin-left" : "0", }, 400 );
</code></pre>
<p>However it seems that the first two animations execute simultaneusly while the third only starts when the others have finished.</p>
<p>Why is asynchronous in the first two but not with the third? How can I make the three of them run at the same time?</p>
|
jquery
|
[5]
|
1,330,963 | 1,330,964 |
regarding downloading the image file using php code
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/8028957/headers-already-sent-by-php">Headers already sent by PHP</a> </p>
</blockquote>
<blockquote>
<p>Warning: Cannot modify header information - headers already sent by
(output started at C:\xampp\htdocs\phppractice\file
download\download.php:3) in C:\xampp\htdocs\phppractice\file
download\download.php on line 4</p>
<p>Warning: Cannot modify header information - headers already sent by
(output started at C:\xampp\htdocs\phppractice\file
download\download.php:3) in C:\xampp\htdocs\phppractice\file
download\download.php on line 5</p>
</blockquote>
<p>I'm facing this error while dowloading a file using PHP. I have 2 files, <code>index.php</code> and <code>download.php</code>. Why am I getting this error?</p>
|
php
|
[2]
|
5,820,805 | 5,820,806 |
Current Location of user on Map In android
|
<p>I am trying to display current location of user on Map,
But it not success till now, Can anyone help me to do that?</p>
|
android
|
[4]
|
180,641 | 180,642 |
Replacing the image within an image src tag
|
<p>I have the following situation, I have an html file with image tags about 10 or more, but it varies. Now what I want to achieve is to replace the image src with a PHP function as example below</p>
<p>I want to replace something like this </p>
<pre><code><img src="image1.png" ....
<img src="image2.png" ....
</code></pre>
<p>with this</p>
<pre><code><img src="<?=imageResize('image1.png',20,15)?>" ...
<img src="<?=imageResize('image2.png',20,15)?>" ..`.
</code></pre>
<p>Is this possible?</p>
|
php
|
[2]
|
4,932,678 | 4,932,679 |
Adding multiples views freeze ProgressDialog
|
<p>I want to show a ProgressDialog while programatically it's adding multiples views to a layout.
I have declared a ProgressDialog at the main Activity and then an AsyncTask is started that add the multiples views. On the onPostExecute of the AsyncTask the ProgressDialog is dismissed. The application works, but the problem is that the start up is slow and the ProgressDialog briefly freeze.
This is the main cycle of the AsyncTask. Column extend a LinearLayout.</p>
<pre><code>for(int i=0;i<7;i++){
((LinearLayout) Global.a.findViewById(R.id.scrollLayout)).addView(new Column(Global.a,i));
}
</code></pre>
|
android
|
[4]
|
4,484,778 | 4,484,779 |
Arrays of Pointers with overloaded operators
|
<p>When I run this code I get a bad_alloc error, Am I accessing the subscript operator wrong or something ? To me it makes sense that I go to the appropriate object, it gets returned and then the subscript operator should kick in ? By the way I want to use arrays and not vectors :)</p>
<pre><code>class A{
public:
A(int size)
{
array = new int[size];
}
int& operator[](const int &i)
{
return array[i]
}
private:
int * array;
};
int main() {
A ** a = new A*[10];
for(int i = 0; i < 10; i++) {
a[i] = new A(10);
for(int l = 0; l < 10; l++) {
cout << a[i][l] << endl;
}
}
}
</code></pre>
<p>Thanks in advance</p>
|
c++
|
[6]
|
2,712,323 | 2,712,324 |
If condition break
|
<pre><code>if(Condition) {
}
if(condition) {
}
if(condition) {
} else {
}
</code></pre>
<p>If the first condition fails, it should break instead of executing the last <code>if/else</code> conditon</p>
|
javascript
|
[3]
|
4,030,427 | 4,030,428 |
why HttpWebRequest runs the target page twice?
|
<p>I use following code for posting data to <code>default2.aspx</code> page. but when I trace the <code>default2.aspx</code> page it runs twice and I encounter error.
What's wrong with my code?</p>
<pre><code>string url = "http://localhost:3629/WebSite6/Default2.aspx";
StringBuilder postData = new StringBuilder();
postData.Append("first_name=" + HttpUtility.UrlEncode("Raymond") + "&");
postData.Append("last_name=" + HttpUtility.UrlEncode("Sanaz"));
StreamWriter writer = null;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = postData.ToString().Length;
try
{
writer = new StreamWriter(request.GetRequestStream());
writer.Write(postData.ToString());
}
finally
{
if (writer != null)
writer.Close();
}
Response.Redirect("http://localhost:3629/WebSite6/Default2.aspx");
</code></pre>
<p>Default2.aspx:</p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
s= Request.Form["first_name"].ToString();
}
</code></pre>
|
asp.net
|
[9]
|
4,812,873 | 4,812,874 |
PHP - How can I assign a name to my array key instead of an int with array_push
|
<p>Hey everyone, I have a database result that returns from a method. I need to push 4 more values onto the stack but I need to name the keys. array_push() automatically assigns an int. How can I overcome this behavior?</p>
<pre><code>Array
(
[these] => df
[are] => df
[the] => sdf
[keys] => sd
[ineed] => daf
[0] => something
[1] => something
[2] => something
[3] => something
)
</code></pre>
<p>The keys that are int values need to be changed. How can I do this using array_push?</p>
|
php
|
[2]
|
3,957,192 | 3,957,193 |
Android slow query
|
<p>In my main activity A, I have a button, when click, it will go to another activity B. when b on create, it queries from a table which is about 200 records and appends each record as textview into a ViewFlipper.</p>
<p>I have few problems. First, when the button in main activity is clicked, it takes about 3-5 seconds before go to activity B everytime.</p>
<p>Any suggestions?</p>
|
android
|
[4]
|
564,043 | 564,044 |
Always return proper URL no matter what the user enters?
|
<p>I have the following python code
<pre><code>from urlparse import urlparse</p>
<p>def clean_url(url):
new_url = urlparse(url)
if new_url.netloc == '':
return new_url.path.strip().decode()
else:
return new_url.netloc.strip().decode()</p>
<p>print clean_url("http://www.facebook.com/john.doe")
print clean_url("http://facebook.com/john.doe")
print clean_url("facebook.com/john.doe")
print clean_url("www.facebook.com/john.doe")
print clean_url("john.doe")
</pre></code>
In each example I take in a string and return it. This is not what I want. I am trying to take each example and always return "http://www.facebook.com/john.doe" even if they just type www.* or just john.doe.</p>
<p>I am fairly new to programming so please be gentle.</p>
|
python
|
[7]
|
1,242,832 | 1,242,833 |
How can I create a string in C# programmatically?
|
<p>I have a string, and I want to add a number of spaces to the beginning of that string based on an int variable.<br>
I want to do something like this:</p>
<pre><code>int NumberOfTabs = 2;
string line = "my line";
string line = String.Format("{0}{1}", " " * NumberOfTabs, line);
</code></pre>
<p>...and now line would have 8 spaces </p>
<p>What is the easiest way to do this?</p>
|
c#
|
[0]
|
5,393,619 | 5,393,620 |
Access a function in js
|
<p>I have a function in my separate js file called hello().</p>
<p>On my page I have this js:</p>
<pre><code><script type='text/javascript'>//do hello fnc</script>
</code></pre>
<p>How can I get the on page script to call the function in my main js file?</p>
|
javascript
|
[3]
|
4,708,570 | 4,708,571 |
How to set different colors for different options in a select with jQuery
|
<p>I'm trying to generate a 'select' with a different color for each 'option' with jQuery.</p>
<p>I did that:</p>
<pre><code><html>
<head>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
</head>
<body>
<select id="taxonomy" name="taxonomy"></select>
<script type="text/javascript">
$(document).ready(function() {
$('#taxonomy').append($('<option></option>').val('-ANY-').html('-- ANY --'));
$('#taxonomy').append($('<option></option>').val('Critical').html('Critical'));
$('#taxonomy').append($('<option></option>').val('Warning').html('Warning'));
$('#taxonomy option[value="Critical"]').css('color', 'red');
$('#taxonomy option[value="Warning"]').css('color', 'orange');
});
</script>
</body>
</html>
</code></pre>
<p>Unfortunately, it's only working on Firefox. There is no color in Chrome or Safari...</p>
<p>Do you have better solution working on any browser ?</p>
<p>Thanks.</p>
|
jquery
|
[5]
|
3,730,054 | 3,730,055 |
C# Cisco IP phone calling
|
<p>What I have is a cisco 7965 IP phone.</p>
<p>I'm simply trying to reference a SQL database, select the phone number from a column and send it to my phone.</p>
<p>I don't really need help with the SQL part, i need help sending the phone number to the phone. If anybody has an example or a good place to start, let me know!</p>
<p>Thanks!</p>
|
c#
|
[0]
|
4,559,619 | 4,559,620 |
iPhone-SDK:Tab bar item images are not visible
|
<p>I created a Tab Bar Controller which has 5 tab bar items. I am trying to add images for all the items through interface builder. I am also able to choose images and set for the particular tab bar items. But whenever i set an image, it does show blank white screen instead of the complete image. P.S: My image is not corrupted, it is a good image. My image size is 24*24. I am not creating tab bar controller items programmatically.</p>
<p>Any suggestions please?</p>
|
iphone
|
[8]
|
1,724,696 | 1,724,697 |
comparing double values in C++
|
<p>I have following code for double comparision. Why I am getting not equal when I execute?</p>
<pre><code>#include <iostream>
#include <cmath>
#include <limits>
bool AreDoubleSame(double dFirstVal, double dSecondVal)
{
return std::fabs(dFirstVal - dSecondVal) < std::numeric_limits<double>::epsilon();
}
int main()
{
double dFirstDouble = 11.304;
double dSecondDouble = 11.3043;
if(AreDoubleSame(dFirstDouble , dSecondDouble ) )
{
std::cout << "equal" << std::endl;
}
else
{
std::cout << "not equal" << std::endl;
}
}
</code></pre>
|
c++
|
[6]
|
3,412,883 | 3,412,884 |
What's wrong with javascript (toFixed) method?
|
<p>What's wrong with this code?</p>
<pre><code>var result = 985.toFixed(2);
</code></pre>
<p>And the fix is:</p>
<pre><code>var result = (985).toFixed(2);
</code></pre>
<p>I still want to know the reason. :)</p>
|
javascript
|
[3]
|
3,096,694 | 3,096,695 |
Get the position after click on button in a list view
|
<p>I've that in my Adapter :</p>
<pre><code>public View getView(int position, View convertView, ViewGroup parent)
{
ViewHolder holder;
if(convertView==null)
{
convertView = myInflater.inflate(R.layout.list, null);
holder = new ViewHolder();
holder.text01 = (TextView) convertView.findViewById(R.id.Text01);
((Button)convertView.findViewById(R.id.ListButonPlus)).setOnClickListener(this);
convertView.setTag(holder);
}else
{
holder = (ViewHolder) convertView.getTag();
}
return convertView;
}
</code></pre>
<p>And that :</p>
<pre><code>public void onClick(View v)
{
Toast.makeText(v.getContext(), "pouette",1000).show();
}
</code></pre>
<p>And I try t get the position of the item who contains my button.</p>
<p>How Can I pass the position variable present in the getView method to my onClick Method?
I will have several button In my View (Item view) </p>
<p>Thank you</p>
|
android
|
[4]
|
6,019,814 | 6,019,815 |
Iterate a vector in C++
|
<p>I have a vector:</p>
<pre><code>std::vector<std::pair<int, long> > v;
v.push_back(std::make_pair(1, 2L));
etc...
</code></pre>
<p>How can I iterate through it and get out the int and the long elements from it?</p>
|
c++
|
[6]
|
5,836,875 | 5,836,876 |
How to check in UIButton2 method if UIButton1 Sender is selected
|
<p>I want to write code in UIButton2 method to check if UIButton1 sender is selected</p>
<pre><code> else if (UIButton1sender.selected == YES) {
[UIButton2sender setImage:[UIImage imageNamed:@"52.png"] forState:UIControlStateNormal];
[audioPlayer play];
[self resumeTimer];
[self resumeLayer:self.view.layer];
</code></pre>
<p>So how do i write this UIButton1sender.selected.</p>
<p>Thanks for help. </p>
|
iphone
|
[8]
|
5,277,059 | 5,277,060 |
while loop login
|
<p>I've completed my login page. My problem now is I can only log in using the first account created. I found out that I have not complete my login page. The missing item is the while..loop code so that the application will check the other existing user instead of only looking for a match for the first user.</p>
<pre><code>if(username.equals(c.getString(1)))
{
if(password.equals(c.getString(2)))
{
Context context = getApplicationContext();
int duration = Toast.LENGTH_LONG;
Toast toast = Toast.makeText(context, "LOGIN SUCCESS", duration);
toast.show();
Intent intent=new Intent(Login.this,Test.class);
startActivity(intent);
}
</code></pre>
<p>I do know that the code is something like <code>while (c.moveToNext())</code> but I do not know how to apply it on my if..else statement.</p>
<p>I hope you can help me out on this simple task. Thank you!</p>
|
android
|
[4]
|
3,954,924 | 3,954,925 |
How to use Service to receive sms and read sms from inbox and send sms message from inbox to another activity in Android?
|
<p>I am working an Android project. In this project I am sending some data from android app to webserver.Now I am able to send data from Android client to WebServer using PHP- MySQL perfectly..Now my question is how to make an android app so that I can receive sms and after receiving sms, how to read sms from inbox and then how to send read(retrived) sms message to that app which is sending data(message) to webserver. I want to receive , read and send to an activity completely in a background.</p>
|
android
|
[4]
|
3,723,982 | 3,723,983 |
.change on form with jquery
|
<p>I'm trying to change a form with jquery but I can't do what I want...</p>
<p>I have a form with a list of product. Each product has an <code>input type="number"</code> for quantity and a second input for percentage.</p>
<p>When the user change the input, the price of each product is caculate in jquery with : <code>$('#products input').on('change', function(){ ... });</code></p>
<p>It's working well.</p>
<p>But at the bottom of my form, I have two other <code>input type="number"</code> with quantity and percentage and when a user change this input, all inputs for product quantity (or percentage) is changed. But the <code>.on('change')</code> on my form isn't actived so the price isn't actualised.</p>
<p>I'm lost... I looking for trigger but its doesn't run.</p>
<p>If someone see a solution...</p>
<p>Thank you.</p>
|
jquery
|
[5]
|
3,108,820 | 3,108,821 |
How to make styles for Rounted Rectangle button in android
|
<p>I need xml styles for tab on or off state,whenever i click the button,display rounded rectangle on button.How can i make new style for given image.please give some tips for me
how to create styles for rounded rectangle like this image</p>
<p><img src="http://i.stack.imgur.com/Qlhjd.jpg" alt="enter image description here"></p>
|
android
|
[4]
|
5,988,089 | 5,988,090 |
Take all input in Python (like UAC)
|
<p>Is there any way I can create a UAC-like environment in Python? I want to basically lock the workstation without actually using the Windows lock screen. The user should not be able to do anything except, say, type a password to unlock the workstation.</p>
|
python
|
[7]
|
3,072,552 | 3,072,553 |
Count of number of data elements
|
<p>How to count the number of data elements that are stored using <code>.data()</code> function in jQuery.</p>
|
jquery
|
[5]
|
4,888,013 | 4,888,014 |
Data-structure to store "last 10" data sets?
|
<p>I'm currently working with an object Literal to store temporary information to send to clients, it's like a history container for the last 10 sets of data.</p>
<p>So the issue that I', having is figuring out the most efficient way to splice on object as well as push an object in at the start, so basically i have an object, this object has 0 data inside of it.</p>
<p>I then insert values, but what I need to do is when the object reaches 10 keys, I need to pop the last element of the end of object literal, push all keys up and then insert one value at the start.</p>
<p>Take this example object</p>
<pre><code>var initializeData = {
a : {},
b : {},
c : {},
d : {},
e : {},
f : {},
g : {},
h : {},
i : {},
j : {}
}
</code></pre>
<p>When I insert an element I need <strong>j</strong> to be removed, <strong>i</strong> to become the last element, and <strong>a</strong> to become <strong>b</strong>.</p>
<p>So that the new element becomes <strong>a</strong>.</p>
<p>Can anyone help me solve this issue, I am using node.js but native JavaScript is fine obviously.</p>
<hr>
<p>Working with arrays after advice from replies, this is basically what I am thinking your telling me would be the best solution:</p>
<pre><code>function HangoutStack(n)
{
this._array = new Array(n);
this.max = n;
}
HangoutStack.prototype.push = function(hangout)
{
if(this._array.unshift(hangout) > this.max)
{
this._array.pop();
}
}
HangoutStack.prototype.getAllItems = function()
{
return this._array;
}
</code></pre>
|
javascript
|
[3]
|
3,397,077 | 3,397,078 |
send xml to server
|
<p>I am recording a video from iPhone and I want to show the video <strong>live</strong> on a diffrent server. </p>
<p>I am using a logic to take the snapshots of images that I am recording then convert imagedata <strong>(20 images of recording at one time )</strong> into string and send the string as xml to the server.
I can parse the data on the server and save it as image. </p>
<p>How can I <strong>send an xml</strong> of 20 images at one time to the server.</p>
|
iphone
|
[8]
|
3,320,473 | 3,320,474 |
C++ Hangman program check if work function
|
<p>This is the program i have so far it compiles but outputs are wrong. I'm trying to fix this function that compares two arrays and returns true if they are equal and false if not. </p>
<pre><code>bool CheckWon ( char selectedWord[], char gameBoard[] )
{
bool checkWon = false;
int length = strlen(selectedWord);
for (int i = 0; i < length; i++)
if ( strcmp( gameBoard[i], selectedWord[i] ) == 0)
checkWon = true;
return checkWon;
}
</code></pre>
|
c++
|
[6]
|
796,314 | 796,315 |
Calendar event Reece Calendar
|
<p>I have downloaded a script Reece Calendar from internet,I finally connected it with database but I have some errors in it!</p>
<p>Can you please help me?</p>
<p>The first errore is:</p>
<p>Undefined index: timeout in C:\wamp\www\ReeceCalendar_0.9\cal\gatekeeper.php on line 180</p>
<p>and the code in this line is:</p>
<p>if($d['timeout']!="") $cal_options['timeout'] = $d['timeout'];</p>
|
php
|
[2]
|
2,773,020 | 2,773,021 |
php parallel curl request with for
|
<p>This is code I wrote for fetching multiple URLs in parallel...</p>
<pre><code>$nodes = array($url1, $url2, $url3);
$node_count = count($nodes);
$curl_arr = array();
$master = curl_multi_init();
for($i = 0; $i < $node_count; $i++)
{
$url =$nodes[$i];
$curl_arr[$i] = curl_init($url);
curl_setopt($curl_arr[$i], CURLOPT_RETURNTRANSFER, true);
curl_multi_add_handle($master, $curl_arr[$i]);
}
do {
curl_multi_exec($master,$running);
} while($running > 0);
for($i = 0; $i < $node_count; $i++)
{
$results[] = curl_multi_getcontent ( $curl_arr[$i] );
}
print_r($results);
</code></pre>
<p>Is this part really parallel?</p>
<pre><code>for($i = 0; $i < $node_count; $i++)
{
$results[] = curl_multi_getcontent ( $curl_arr[$i] );
}
</code></pre>
<p>Can any one tell me?</p>
|
php
|
[2]
|
4,569,659 | 4,569,660 |
How to pass the data from Browser to another activity?
|
<p>Is it possible to pass the data from Browser to Explicit Activity?</p>
<p>Ex: I have gmail open in the Browser. One of the emails contains <code>href(http://xxx/Test.pdf)</code> document. I want to pass directly the href(URL) info to my Activity.</p>
|
android
|
[4]
|
4,622,495 | 4,622,496 |
Export HTML page to PDF
|
<p>My project need a function to <strong>export HTML page to PDF</strong> when clicking 'Export To PDF' button. I would like to do it by the client side. </p>
<p>Any suggestions are highly welcomed. Thanks in advance!</p>
|
javascript
|
[3]
|
3,676,780 | 3,676,781 |
PHP: Reversing the order in which links are echoed out ( apparently very difficult )
|
<pre><code>$archiveNumber = 0;
$archiveDirectory = 'blogtext/';
$archiveHandle = opendir( $archiveDirectory );
$entryAfter;
$entry;
if( $archiveHandle = opendir( 'blogtext/' ) )
{
while( false !== ( $entry = readdir( $archiveHandle ) ) )
{
if( $entry != '.' && $entry != '..' && !is_dir( $entry ) && strpos( $entry, '-subject' ) )
{
$entryAfter = str_replace( '-'.$number.'-', '', $entry );
$entryAfter = str_replace( '-subject', '', $entryAfter );
$entryAfter = str_replace( '.txt', '', $entryAfter );
echo '<a href="blog/'.strtolower( $entryAfter ).'.php"> ';
include( 'blogtext/'.$entry );
echo '</a><br>';
$number++;
}
}
closedir( $archiveHandle );
}
</code></pre>
<p>Is there any way to reverse the order in which the links are echoed out in this function?</p>
<p>At the moment, the links are printed out in reverse order ( starting with -biggestnumber-name.php, and ending with -smallestnumber-name.php ). And I'd like to reverse it.</p>
<p>( I know that the way that I'm doing this is probably pants-on-head-retarded. You don't need to mention that. )</p>
|
php
|
[2]
|
1,420,543 | 1,420,544 |
Couldn't install Ad-Hoc in iPhone 3.0 OS?
|
<p>I've created an Ad-Hoc of my iphone app, but i couldnt install it on my iPhone (upgraded to iPhone OS 3.0). And also i created new provisioning file and plist file but it still shows error:</p>
<p><strong>The application was not installed on th iPhone "Unknown" because an unknown error occured (0xE8008017)</strong></p>
<p>Please send me a solution..........</p>
|
iphone
|
[8]
|
4,625,151 | 4,625,152 |
Multiple returns from function
|
<p>Is it possible to have a function with 2 returns like this:</p>
<pre><code>function test($testvar)
{
// do something
return $var1;
return $var2;
}
</code></pre>
<p>If so, how would I be able to get each return separately?</p>
|
php
|
[2]
|
4,671,563 | 4,671,564 |
Shortening function name with variable
|
<p>I would like to call some functions by shorter alias in order to minimize code size.</p>
<pre><code>(function(){
var t = document.getElementById;
t('element-id');
})();
</code></pre>
<p>This piece of code gives <code>Error: Could not convert JavaScript argument</code>. Why?</p>
|
javascript
|
[3]
|
4,997,541 | 4,997,542 |
How to add a QLabel as the child of QTreeWidgetItem?
|
<p>I want to add a QLabel as the child of QTreeWidgetItem(not QTreeWidget) but i didn't find any method of QTreeWidgetItem that allow me to add a child in it such as by using setItemWidget(item,column,widget) of QTreeWidget we can add a label in QTreeWidget.</p>
<p>please respond ASAP your responce will be so helpful for me.</p>
|
javascript
|
[3]
|
2,687,913 | 2,687,914 |
response stream and ask for saving pdf file
|
<p>in asp.net, after creating a reportDocument, I would like to save it as a pdf report without showing it. In other words, I would like to show a response that the user chooses to save it:</p>
<pre><code>ReportDocument reportdoc = new ReportDocument();
reportdoc.Load(Server.MapPath("CrystalReporttest.rpt"));
reportdoc.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, false, "test123.pdf");
</code></pre>
<p>So far, I have tried it like this and it shows the pdf report rather than ask for "save it".</p>
<p>It is a directly way to do so in asp.net?</p>
<p>Thanks in advance.</p>
|
asp.net
|
[9]
|
5,984,912 | 5,984,913 |
is there a Q&A formatted introduction to python similar to "the little schemer"
|
<p>EDIT: This should not have been closed, what I'm asking for (a Q&A formatted beginners intro to python) is more specific than still open questions such as "Online resources for Introduction to computer and computer sciences for absolute beginner", "What did you use to teach yourself python?" or "Python tutorial for total beginners?". The "debate" in the comments is not argumentative at all, just more background info.</p>
<p>I just looked at the first chapter of "The Little Schemer" and I love the idea of a Q&A format in an introduction to a programming language, is there anything like it in python? There's a sample chapter available at the amazon page if you're curious about what exactly the format looks like: <a href="http://rads.stackoverflow.com/amzn/click/0262560992" rel="nofollow">http://www.amazon.com/exec/obidos/ASIN/0262560992/ref=pd_sim_books/103-5471398-9229403</a>. (The reason I'm so excited about the Q&A format is that it's very convenient to put it into anki, a digital flashcard program.)</p>
|
python
|
[7]
|
1,580,505 | 1,580,506 |
Implementing queue in c#
|
<p>I am developing a c# application, in which the server gets requests from many clients at a time. Each client also gets their data from different databases. In this situation sometimes data leakage is happening, means clients get data from an incorrect database. Say for example client1 should get data from db1 and client2 gets data from db2. Instead they get data from opposite databases; client1 gets from db2 and client2 gets from db1.
I am adding the code below where it collects the data.</p>
<pre><code>public string List()
{
Response.ContentType = ContentType.Xml;
try
{
ThingzFilter filter = null;
Dictionary<string, string> parameters = new Dictionary<string, string>();
if (Id!="")
{
// get parameters from http request
foreach (HttpInputItem param in Request.Param)
parameters.Add(param.Name, param.Value);
setServerURLs();
//Request.Clear();
if (Request.QueryString["lang"].Value != null)
{
ThingzDB.TzThing.get_language = Request.QueryString["lang"].Value.ToString();
}
else
{
ThingzDB.TzThing.get_language = SessionDatabase.DefaultLanguage;
}
}
ThingzDatabase db = SessionDatabase;
langStr = db.Language;
// this is run if there was no ID supplied
// which means we want all items of all types
if (Id == "")
{
if (Request.AcceptTypes == null)
{
//TypeController.session_id = Request.QueryString["sessionid"].Value;
jobs.Add(Request.QueryString["sessionid"].Value);
if (nextJobPos > jobs.Count - 1)
return "";
else
{
TypeController.session_id = jobs[nextJobPos];
nextJobPos++;
langStr = SessionDatabase.Language;
}
filter = new AllThingzFilter(SessionDatabase, parameters, langStr);
TypeController.session_id = "";
filter.Execute();
}
</code></pre>
<p>In this server is console application and clients are windows where the site names , means the databse names are mentioned.
Please give me a solution to overcome this issue.</p>
|
c#
|
[0]
|
2,743,104 | 2,743,105 |
LinkedList Part
|
<p>I think I might have done something right, headByRating and headByName both refer to the same address.</p>
<p>I have been drawing diagras working all day trying new things etc, and i havent really made any progress.</p>
<p>I have two list pointers, headByRating and headByName.
and two node pointers nextByName and nextByRating.</p>
<p>Somehow I need to be able to sort this stuff by its name and rating.
I've been thinking that I do that by each of the ptrs' address'.</p>
<p>2 statements as an example that I have been trying to sort:</p>
<pre>
//main.cpp
list *wineries = new list();
wineries->insert(winery("Lopez Island Vinyard", "San Juan Islands", 7, 95));
wineries->insert(winery("Gallo", "Napa Valley", 200, 25));
</pre>
<p>the winery ctor is fine everything is allocated and into the object at this point:</p>
<pre>
//list.cpp
void list::insert( const winery& winery )
{
list *listPtr = new list(); // havent really used the list obj. yet.
node *current = new node( winery ); // winery is now a node.
node *temp = current; // temp knows about the nodes address.
while ( temp->nextByName != NULL )
{
// check for null and reassign
temp = temp->nextByName;
}
node *new_node = new node( winery ); // creating a new node.
new_node->item = winery;
new_node->nextByName = new_node;
new_node->nextByRating = new_node;
}
</pre>
<pre>
// list.h
struct node
{
winery item;
node * nextByName;
node * nextByRating;
};
class list
{
...
private:
node * headByName;
node * headByRating;
};
</pre>
<p>What is a good approach to this? I dont think im doing this right. </p>
|
c++
|
[6]
|
5,134,412 | 5,134,413 |
PHP : session variable aren't usable when site is redirected
|
<p>I've to admin a small website for my alumni group which is hosted by my ISV. The url is something like www.myIsv.com/myWebSite/ which is quite ugly and very forgetable. The main admin of the webserver has registered a domain name www.mysmallwebsite.com and put a index.html with this content:</p>
<pre><code><html>
<head>
<title>www.mysmallwebsite.com</title>
</head>
<frameset>
<frame src="http://www.myIsv.com/myWebSite/" name="redir">
<noframes>
<p>Original location:
<a href="www.myIsv.com/myWebSite/">http://www.myIsv.com/myWebSite/</a>
</p>
</noframes>
</frameset>
</html>
</code></pre>
<p>It works fine, but some features like PHP Session variables doesn't work anymore! Anyone has a suggestion for correcting that?</p>
<p>Edit:
This doesn't work both on IE and on Firefox (no plugins)</p>
<p>Thanks</p>
|
php
|
[2]
|
4,607,203 | 4,607,204 |
why is $(this) selector pointing to what it does in this function?
|
<p>What I am confused about is why $(this) is pointing to '#navigation a' objects and not '#navigation_blob' object? To be clear I know what $(this) does. I am just confused about the scoping in this example.</p>
<p>Thanks!</p>
<p><i>Taken from "Jquery novice to ninja":</i></p>
<pre><code>$('#navigation a').hover(function() {
// Mouse over function
$('#navigation_blob').animate(
{width: $(this).width() + 10, left: $(this).position().left},
{duration: 'slow', easing: 'easeOutElastic', queue: false}
);
}, function() {
// Mouse out function
var leftPosition = $('#navigation li:first a').position().left;
$('#navigation_blob').animate(
{width:'hide'},
{duration:'slow', easing: 'easeOutCirc', queue:false}
).animate({left: leftPosition}, 'slow');
});
</code></pre>
|
jquery
|
[5]
|
5,612,908 | 5,612,909 |
Android: INSTALL_FAILED_DEXOPT while install app on android 1.5
|
<p>I am developing app which bust run on both Android 1.5 and Andoroid 2.x platforms.
When I install it on Android 2.2 all is OK, but on emulator with Android 1.5 I get an error:</p>
<pre><code>Failure [INSTALL_FAILED_DEXOPT]
</code></pre>
<p>What is the problem may be?</p>
<p><strong>UPD</strong> That is Logcat output:</p>
<pre><code>09-26 07:12:22.484: INFO/PackageManager(579): /data/app/vmdl23706.tmp changed; unpacking
09-26 07:12:22.494: DEBUG/installd(557): DexInv: --- BEGIN '/data/app/vmdl23706.tmp' ---
09-26 07:12:36.114: ERROR/dalvikvm(1362): LinearAlloc exceeded capacity, last=336
09-26 07:12:36.114: ERROR/dalvikvm(1362): VM aborting
09-26 07:12:36.265: INFO/DEBUG(551): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
09-26 07:12:36.265: INFO/DEBUG(551): Build fingerprint: 'generic/sdk/generic/:1.5/CUPCAKE/150240:eng/test-keys'
09-26 07:12:36.265: INFO/DEBUG(551): pid: 1362, tid: 1362 >>> /system/bin/dexopt <<<
09-26 07:12:36.265: INFO/DEBUG(551): signal 11 (SIGSEGV), fault addr deadd00d
</code></pre>
<p>It seems that memory was not enough... If anybody knows how to fight with such problem? I would be very grateful for any help.</p>
|
android
|
[4]
|
1,472,981 | 1,472,982 |
Puzzle on Inner Classes and Class Hiding
|
<p>I have a very interesting Example to solve which is based on inner classes:</p>
<pre><code>package inner;
class A{
void m(){
System.out.println("Outer");
}
}
public class TestInner {
public static void main(String[] args) {
new TestInner().go();
}
private void go() {
new A().m();
class A{
void m(){
System.out.println("Inner");
}
}
new A().m();
}
class A{
void m(){
System.out.println("Middle");
}
}
}
</code></pre>
<hr>
<p>The OUTPUT it gives is:
Middle
Inner</p>
<p>but my question is **how can i print the output as:
Outer
Inner</p>
<p><em>Condition is I dont want to use the package name to create an object....</em></p>
<p>A good response is expected...</p>
<p>Thanks.enter code here</p>
|
java
|
[1]
|
5,278,802 | 5,278,803 |
Searching for Python http lib
|
<p>Something like httparty for Ruby</p>
|
python
|
[7]
|
3,236,157 | 3,236,158 |
Creating dynamic labels not holding individual text
|
<p>I'm trying to create multiple instances of a user control on the page. I'm using labels to assign values to each control.
So from code behind I'm creating dynamic labels as:</p>
<pre><code>Label lblName = new Label();
lblName.ID = "lblName_" + entity.Id; // lblName_1, lblName_2, lblName_3, ...etc
lblName.Text = entity.Name;
this.Page.Controls.Add(lblName);
lblName.Style.Add(HtmlTextWriterStyle.Display, "none");
</code></pre>
<p>This is applied in the loop. But all the controls gets values of last instance of label; instead of individual.</p>
|
asp.net
|
[9]
|
2,957,726 | 2,957,727 |
Add a row to UITableView for adding new item?
|
<p>In order to provide UI for user to add new items to my table view, I would like to add a new row in my table at a specified location (last row for example) when the view is in edit mode (I have a edit button on the view's navigation bar right side). This new row will have a add button indicator on the left side and disclosure accessory arrow on the right. When the view is not in edit mode, this add row should not be displayed.</p>
<p>I am not sure if I should overwrite:</p>
<pre><code>- (void)setEditing:(BOOL)editing animated:(BOOL)animated{...}
</code></pre>
<p>where I call the UITableView's method:</p>
<pre><code>insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:
(UITableViewRowAnimation)animation
</code></pre>
<p>to insert a new row?</p>
<p>My understanding is that this call may add a new row into the table view. The table view's data source is from CoreData storage. Not sure this may cause inconsistent numbers of data in the data store and table view? If it is OK and I have to manage rows in the table view, how can I add left add indicator and left disclosure arrow to the new row?</p>
<p>Another question is that if I can do it to insert a new row as Add row, should I remove it when the table view not in edit mode?</p>
<p>Just want to know if I am on the right track.</p>
|
iphone
|
[8]
|
3,079,375 | 3,079,376 |
How to record live streaming audio | iPhone
|
<p>I am working on a radio app. I am recording that live audio stream through AVAudioQueue but problem is it records outer noise as well. I want a way to remove that outer noise. I just want to record that stream only.
Please help me. I am stuck on it.</p>
|
iphone
|
[8]
|
1,541,876 | 1,541,877 |
How do you show a JS alert only once?
|
<p>I want a message to pop up to alert users of LT IE8 that they should really upgrade their browser or they won't have the best possible web experience. However I only want this to pop up on their first visit to my site, not on every page refresh.</p>
<p>Is there a way to do this?</p>
<p>Thanks in advance.</p>
|
javascript
|
[3]
|
1,257,729 | 1,257,730 |
arrow key navigation in table using jquery
|
<p>i have application in which i navigate among table cell using arrow key. i have an issue here</p>
<p>1) if focus is in first cell of first row pressing left key will make focus invisible
2) if focus is in last cell of last row pressing right key makes focus invisible. </p>
<p>how do i make focus stay in same cell if the cell is first cell of first row(when left key is pressed) and same with last cell of last row (right key is pressed)</p>
<p>here is code:</p>
<pre><code>switch(e.keyCode)
{
case 37:
// Left
button = cell.prev('td').find('button');
if (button.length == 0)
{
// Nothing further left, go to end of
// previous row
button = cell.parent('tr').prev('tr').find('td:last button');
}
break;
case 38:
// Up
row = cell.parent('tr');
index = row.children('td').index(cell);
button = row.prev('tr').find('td:eq(' + index + ') button').length === 0 ? row.find('td:eq(' + index + ') button') : row.prev('tr').find('td:eq(' + index + ') button');
break;
case 39:
// Right
button = cell.next('td').find('button');
if (button.length == 0)
{
// Nothing further right, go to beginning of
// next row
button = cell.parent('tr').next('tr').find('td:first button');
}
break;
case 40:
// Down
row = cell.parent('tr');
index = row.children('td').index(cell);
button = row.next('tr').find('td:eq(' + index + ') button').length === 0 ? row.find('td:eq(' + index + ') button') : row.next('tr').find('td:eq(' + index + ') button');;
break;
}
</code></pre>
|
jquery
|
[5]
|
1,928,851 | 1,928,852 |
URL in ajax post
|
<p>I want to post this variables via ajax:</p>
<pre><code> <div class="vIn" id="star">
<div id="inner">
<span id="1" class="disabled"></span>
<span id="2" class="disabled"></span>
<span id="3" class="disabled"></span>
<span id="4" class="disabled"></span>
<span id="5" class="disabled"></span>
<input type="hidden" id="<?php echo $_GET['cID']?>" />
</div>
</div>
</code></pre>
<p>I have used this script:</p>
<pre><code>$(document).ready(function(){
$('#inner span').click(function(){
$(this).prevAll().andSelf().addClass('enabled');
var a = $(this).attr("id");
var cID = $("#inner input").attr("id");
$.ajax({
type: "POST",
url: "ajax/rating.php",
data: "value=+a+&cID=+cID+",
success: function(msg){
alert(data);
}
});
});});
</code></pre>
<p>With click event, there is no any alert. Am I use right data in $.ajax?
Thanks in advance.</p>
|
jquery
|
[5]
|
5,983,754 | 5,983,755 |
Android change font - getAssets() error
|
<p>I have a problem with my custom fonts. I change it like this:</p>
<pre><code>@Override
protected void onFinishInflate() {
super.onFinishInflate();
mTimeDisplay = (TextView) findViewById(R.id.timeDisplay);
Typeface typeface = Typeface.createFromAsset(getAssets(),
"Fonts/Roboto-Light.ttf");
mTimeDisplay.setTypeface(typeface);
mAmPm = new AmPm(this);
mCalendar = Calendar.getInstance();
setDateFormat();
}
</code></pre>
<p>But i have error : <code>The method getAssets() is undefined for the type DigitalClock</code></p>
|
android
|
[4]
|
3,717,855 | 3,717,856 |
window.open function load CSS
|
<p>Is there any way to load CSS during pop up a window? </p>
<pre><code> function kmt_ShowBoxPopup(targetDivID, aTag)
{
var orgin_div_content=document.getElementById(targetDivID).innerHTML;
//alert(targetDivID);
showBoxPopupWin =window.open("",targetDivID,'height=400,width=710,screenX=250,screenY=80, scrollbars=yes');
showBoxPopupWin.document.write ('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">'+
'<html><head><title>'+targetDivID+'</title></head><body>'+orgin_div_content+'</body</html>');
if (window.focus) {showBoxPopupWin.focus()}
}
<a class="cs_popuplink" onclick="kmt_ShowBoxPopup('BOX02_01',this); return false; ">show me how..</a>
<div id = "BOX02_01" STYLE=display:none>
p
p
p
</div>
</code></pre>
<p>Here is my code. I would like to load a CSS in showBoxPopupwin.document.write function. Is it possible? </p>
<p>cheers,
Qing </p>
|
javascript
|
[3]
|
2,519,819 | 2,519,820 |
Change width of element with mouseover jquery
|
<p>I am trying to create a thin line under a nav bar to follow the mouse but am having trouble getting e.page:X to set the width of the element.</p>
<p>Here is what I have:</p>
<pre><code>$('#test').mousemove(function(){
var linewidth = e.pageX;
$("#line").width($linewidth);
})
})
</code></pre>
<p>Can anyone tell me why this is not setting the width of #line</p>
|
jquery
|
[5]
|
5,947,264 | 5,947,265 |
How can I assign a call back function after I query something in javascript?
|
<p>I typically, call this to query back the result:</p>
<pre><code>db.transaction(function(tx) {
tx.executeSql('SELECT * FROM MyDB WHERE key = ?', [aKey], MyDB.renderResults);
});
</code></pre>
<p>and the renderResults function is like that:</p>
<pre><code>renderResults: function(tx, rs){
// for(i = 0; i < rs.rows.length; i++){
// document.getElementById("textfield").value = "";
// document.getElementById("textarea").value += rs.rows.item(i).chiChar;
// }
}
</code></pre>
<p>But I would like to make it more flexible, I would like to assign a function as a param to renderResults, in order to make my renderResult can execute a call back function. In other words,I would like to put the commented code into a function, which the renderResults only execute the function I put .....How can I do so ?? Thank you. </p>
|
javascript
|
[3]
|
2,893,752 | 2,893,753 |
How to clone object in java
|
<p>I want to create a list/array of object with the same parent class which then I will use it for reference. but i dont know how to clone those object to make a new object.</p>
<p>here is the example</p>
<pre><code>BigFoo a;
SmallFoo b;
ChickenFoo c;
List<Foo> foos;
foos.add(a);
foos.add(b);
foos.add(c);
Foo foo = foos.get(1).clone();
</code></pre>
<p>but in Java i found no clone function in the default function. I wonder how this is accomplished?</p>
|
java
|
[1]
|
429,976 | 429,977 |
Run program when cpu resources below percentage
|
<p>I want a program that I'm writing to execute on certain dates set by the user and also when CPU resources fall below a certain %. Right now, I am using Task Scheduler Managed Wrapper
(http://taskscheduler.codeplex.com/documentation) to set up a Windows Scheduled task with the date and time a user specifies. </p>
<p>However, I haven't been able to figure out how to do the CPU % part. Is it even possible to set up a Windows Scheduled Task to do this? If not, how would I do it? Windows service? </p>
|
c#
|
[0]
|
3,017,664 | 3,017,665 |
can we Reload UIView?
|
<p>HI all,</p>
<p>is there any way round,in which we can reload UIView,like we do in table view, reloadtable?</p>
<p>is it possible?</p>
<p>regards
shishir</p>
|
iphone
|
[8]
|
66,281 | 66,282 |
Formatting UITextField or UiTextView
|
<p>using iphone sdk 3.0 can someone say how to format a UITextField or UITextView
so that when the user enters a phone number it will be formatted the way
the contacts application formats the number ie +1 (888) 465-375
How to do this?</p>
<p>Thanks</p>
|
iphone
|
[8]
|
3,979,399 | 3,979,400 |
How to reference the conents of a variable instead of a variable in Java
|
<p>Ok, I'm trying to make a quick double validator for any JTextField in a program. I would like to pass this to a function which then checks the contents of a field, makes sure it's a double, then return it as a double to the function. </p>
<p>Here is what I have so far but theTF.getValue() should get the value of the string, not the string itself. </p>
<pre><code> public double valDouble(String theTF)
{
double theDouble;
try
{
theDouble = theTF.getValue();
return theDouble;
}
}
</code></pre>
<p>How can I run the getValue() on the contents of the string?</p>
<p>Edit:
Ok, I somewhat screwed up my meaning. I understand the parseDouble, but I left it out on accident here is what I have now:</p>
<pre><code> public static double valDouble(String theTF)
{
double theDouble;
try
{
theDouble = Double.parseDouble(theTF);
}
catch(NumberFormatException e3)
{
theDouble = 0;
}
return theDouble;
}
</code></pre>
<p>My Real issue is theTF represents the name of a TextField. I need the value OF the text field not the value in theTF. I'd like to have this here to, perhaps, highlight the field red etc. </p>
<p><strong>Answer</strong>(Thanks Hunter):
The best way was to pass the Object, not sure why I was trying to parse out the value of a string reference. </p>
<pre><code> public static double vDbl(JTextField theTF)
{
double theDouble;
try
{
theDouble = Double.parseDouble(theTF.getText());
}
catch(NumberFormatException e3)
{
theTF.setText("Invalid");
return 0;
}
return theDouble;
}
</code></pre>
|
java
|
[1]
|
4,568,887 | 4,568,888 |
I can't change background of the list item when it is clicked
|
<p>I want to change the background of a list item when it is clicked, but it isn't working.</p>
<p>This is my MusicAdapter inner class :</p>
<pre><code>class MusicAdapter extends ArrayAdapter<String>{
Fill fill=null;
public MusicAdapter(){
super(GetMusics.this,android.R.layout.simple_list_item_1,song_list);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
row = convertView;
if(row==null){
LayoutInflater inflater = getLayoutInflater();
row = inflater.inflate(R.layout.row, null);
fill=new Fill(row);
row.setTag(fill);
}else{
fill=(Fill)row.getTag();
}
row.setBackgroundResource(R.drawable.list_selector);
fill.setRow(song_list.get(position));
return row;
}
}
</code></pre>
<p>I also tried this, but again it didn't work:</p>
<pre><code>private AdapterView.OnItemClickListener onItemClick = new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View v, int arg2,
long arg3) {
// TODO Auto-generated method stub
lv.getChildAt(arg2).setBackgroundResource(R.drawable.list_selector);
}
};
</code></pre>
<p>Here is my list_selector.xml:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_focused="true"
android:drawable="@color/Peru"/>
<item android:state_pressed="true"
android:drawable="@color/Tan"/>
<item
android:drawable="@color/Peru"/>
</selector>
</code></pre>
<p>Do you have any suggestions? </p>
|
android
|
[4]
|
2,829,276 | 2,829,277 |
Orientation change issue in Android
|
<p>I'm starting a thread from activity which is downloading a file. But in between, if it changes the orientation, then it starts the new activity. This is not the right way to behave, rather it should continue to download from the state where it was before the orientation change.</p>
|
android
|
[4]
|
1,204,554 | 1,204,555 |
is there a masters degree in Mobile development like android?
|
<p>it's not a programming question, but programmers related.</p>
<p>if yes, please guide me to some colleges that have that program.
thanks.</p>
|
android
|
[4]
|
2,402,114 | 2,402,115 |
$_GET not working for querystring parameters in php
|
<p>I am having a problem with <code>$_GET</code> in one of my php script.</p>
<p>I am using an php script as a body for mail and I am uploading that script using a url. Everything was working fine when I was using only one parameter in query string.
When I used an array an converted it to query string using </p>
<pre><code>http_build_query($var1);
</code></pre>
<p><a href="http://dev.thedoghouseps.com/mail_update_pet_info.php?id=1429&pet_id=1460&name=new&type=cat&breed=doberman2&dob=2009-02-16&sex=F&color=blue&vet_name=test&vet_phone=34%7C111%7C1111" rel="nofollow">url is</a>: </p>
<pre><code>http://dev.thedoghouseps.com/mail_update_pet_info.php? _
id=1429&pet_id=1460&name=new&type=cat&breed=doberman2& _
dob=2009-02-16&sex=F&color=blue&vet_name=test&vet_phone=34%7C111%7C1111
</code></pre>
<p>Now problem is that I can not access the all the parameter except <code>id</code> and <code>pet_id</code>.
i.e. <code>$_GET['name']</code> is not giving me any value. But when I put this url directly on the navigation of browser then I am getting all the parameters except <code>pet_id</code>.</p>
<p>I have no idea now.</p>
|
php
|
[2]
|
5,729,391 | 5,729,392 |
Downloading big files and writing it locally
|
<p>which is the best way to download from php large files without consuming all server's memory?</p>
<p>I could do this (bad code):</p>
<pre><code>$url='http://server/bigfile';
$cont = file_get_contents($url);
file_put_contents('./localfile',$cont);
</code></pre>
<p>This example loads entry remote file in <code>$cont</code> and this could exceed memory limit.</p>
<p>Is there a safe function (maybe built-in) to do this (maybe stream_*)?</p>
<p>Thanks</p>
|
php
|
[2]
|
1,647,086 | 1,647,087 |
python private attribute
|
<pre><code>class A():
def __init__(self):
self.__var = 5
def get_var(self):
return self.__var
def set_var(self, value):
self.__var = value
var = property(get_var, set_var)
a = A()
a.var = 10
print a.var == a._A__var
</code></pre>
<p>Can anyone explain why result is <code>False</code>?</p>
|
python
|
[7]
|
2,261,776 | 2,261,777 |
Compare 2 images using C#
|
<p>Can we compare 2 images of different resolutions and colour.</p>
|
c#
|
[0]
|
4,635,072 | 4,635,073 |
Is this an array or an object in Javascript?
|
<p>Could someone explain this block of code to me and what the type of 'arr' is.
I know that an array is an object but</p>
<ol>
<li>Why does the <strong>[[Class]]</strong> show up as Array if it behaves like an Object</li>
<li><p>arr.length returns 3. How?</p>
<pre><code>var arr = [0, 1, 3];
arr.name = "asdf";
console.log(arr[1] + " " + arr.name + " " + arr.length);
// Returns-> 1 asdf 3
Object.prototype.toString.call(arr);
// Returns-> "[object Array]"
</code></pre></li>
</ol>
<p>Whats the deal here?</p>
<hr>
<p>This has already been answered in good detail in this SO post </p>
<p><a href="http://stackoverflow.com/questions/5048371/are-javascript-arrays-primitives-strings-objects">Are Javascript arrays primitives? Strings? Objects?</a></p>
|
javascript
|
[3]
|
2,917,208 | 2,917,209 |
write output of print_r in a txt file. PHP
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2628798/print-array-to-a-file">Print array to a file</a> </p>
</blockquote>
<p>How can I write the ouput (for example when I use an array), in a file?, I was trying with this:</p>
<pre><code> ...
print_r($this->show_status_redis_server());
$status_redis = ob_get_contents();
fwrite($file, $status_redis);
...
</code></pre>
|
php
|
[2]
|
1,629,719 | 1,629,720 |
validating user session in php
|
<p>I am creating few pages (including login page) which should only be accessible by a sysadmin. </p>
<p>In login.php after the user's credentials have been verified. I set a session variable like so:</p>
<pre><code>mysql_connect("localhost", $values['uname'], $values['password']) or
die(mysql_error());
echo "Connected to MySQL<br />";
mysql_select_db("somedb") or die (mysql_error());
session_start();
$_SESSION['level'] = 'admin';
header('Location: /admin/index.php');
</code></pre>
<p>And then in the index.php page I am doing the following:</p>
<pre><code><?php
if($_SESSION['level'] !== 'admin'){
header("location:../admin/login.php");
}
?>
</code></pre>
<p>But it does not seem to work. Everytime I am being redirected to login.php (even after successfully logging in via login.php).<br />
Is there something wrong with this approach and how I am going about this?</p>
<p>Basically on page other than login.php I need a way to make sure user is logged in...</p>
|
php
|
[2]
|
5,740,900 | 5,740,901 |
different themes in portrait and landscape for a ListView
|
<p>I have a ListView which should have the "Theme" theme in portrait and the "Theme.Light" theme in landscape mode. How do I do that? The theme seems to be tied to the activity, and for the ListView I can only change the style, but I dont find a style which works.</p>
<p>Or, is there a way to change the activity's theme based on orientation? By code or prefereable by xml?</p>
<p>To be more precise and explain the reason: I try to start experimenting with the fragment compatibility library. The starting activity shows in portrait mode a list which looks best with black background. When I touch a list item, a second Activity starts and shows a ListView which better looks on white, so this second Activity has the Theme.Light. Works so far.</p>
<p>When I switch to landscape, I try to show both ListViews aside. The second one on the right <em>has</em> to have a white background. The first one on the left could stay on white also (so the whole activity could change the theme), but I'd like to see one on black and one on white, if possible. (I put both ListViews in Fragments, this is done and works. Only the colors are wrong.)</p>
<p>Any ideas?</p>
<p>Greetings, Joerg</p>
|
android
|
[4]
|
5,322,576 | 5,322,577 |
Overriding MS Office Hotkeys
|
<p>How might I go about programatically overriding hotkeys in MS Office?</p>
<p>I have a global hotkey (<strong>CTRL+SHIFT+1</strong>) for my app that works in other applications but seems to get lost when I try it in any MS Office application. When I shutdown my app the hotkeys work in MS Office again as they are supposed to.</p>
|
c#
|
[0]
|
479,150 | 479,151 |
Java Returning method which returns arraylist?
|
<p>I have one class with a method like this:</p>
<pre><code>public ArrayList<Integer> myNumbers() {
ArrayList<Integer> numbers = new ArrayList<Integer>();
numbers.add(5);
numbers.add(11);
numbers.add(3);
return(numbers);
}
</code></pre>
<p>how can i call this method inside another class?</p>
|
java
|
[1]
|
2,238,780 | 2,238,781 |
Issue with a php form
|
<p>I've created a very basic php form for a website and the form mostly works - only problem is that when the form is emailed to the gmail account, only one line (the "college" line) shows up in the email, with the rest blank. The sender's name ($field_name) appears in the subject line of the message (along with the xxx.Org TShirt Order part of the message), but the only line that appears in the body of the message is the "college part".</p>
<p>Here's the code (I'm aware that it's not sterilized... I'm really new to php and I don't feel like I've got a handle on the language yet, so I'm starting really basic):
<pre><code>$mail_to = 'xxx@gmail.com';
$subject = 'xxx.Org TShirt Order - '.$field_name;
$body_message = 'From: ' . $field_name . "\n";
$body_message .= 'E-mail Address: '.$field_email."\n";
$body_message .= 'Quantity of Shirts: '.$field_quantity."\n";
$body_message = 'Shirt Style(s): '.$field_which."\n";
$body_message .= 'Size(s): '.$field_size."\n";
$body_message .= 'School: '.$field_school."\n";
$body_message = 'College: '.$field_college."\n";
$headers = 'From: '.$field_email."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";
$mail_status = mail($mail_to, $subject, $body_message, $headers);
if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
alert('Thank you for placing an order with xxx.Org. We will contact you shortly.');
window.location = 'contact_page.html';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Message failed. Please send an email to xxx@gmail.com');
window.location = 'contact_page.html';
</script>
<?php
}
?>
</code></pre>
|
php
|
[2]
|
3,115,256 | 3,115,257 |
Go back to Previous Application (not Activity) in Android
|
<p>There are two Android applications calling each other: App1, App2.</p>
<p>steps: </p>
<ol>
<li><p>start App1 from Android desk. --> </p></li>
<li><p>start startActivity(intent) or startActivityForResult(intent,0) to App2 from App1. --></p></li>
<li><p>start startActivity(intent) or startActivityForResult(intent,0) again to App1 from App2. --></p></li>
<li><p>start ( ? ) to go back to app1(activity) or App2. </p></li>
</ol>
<p>I woud like make a dialog to let user to choice back to App1 or App2 in step 4. Is it possible to complete it ? </p>
<p>I have had tried the <a href="http://stackoverflow.com/questions/4038479/android-go-back-to-previous-activity">article here</a> and it just back to the activity on App1 only.</p>
<p>Thanks for any suggestion !</p>
|
android
|
[4]
|
2,156,345 | 2,156,346 |
How create serial key like encrypted string
|
<p>below snippet which encrypt the string but encrypted string looks like random alphanumeric. but i want encrypted string like </p>
<blockquote>
<p>5214-6548-4584-4568-abcd or ABCD-TEST-1F2D-FSDF</p>
</blockquote>
<p>My snippet </p>
<pre><code>$encrypted = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key))));
var_dump($encrypted); // "ey7zu5zBqJB0rGtIn5UB1xG03efyCp+KSNR4/GAv14w="
</code></pre>
<p>the below snippet i took from <a href="http://stackoverflow.com/questions/6833448/how-should-i-encrypt-my-data-in-a-php-application">source encryption</a></p>
<p>How to create serial number using client MAC+HOST+os</p>
|
php
|
[2]
|
5,980,578 | 5,980,579 |
Registering MouseDown and MouseMove on Form
|
<p>How and where can I register a mouse event on a form. When I doubleclick on the form it'll generate the Form_Load event for me and I can add code into there. However when I add something like</p>
<pre><code>private void Form1_MouseDown(object sender, MouseEventArgs e{
Console.WriteLine("mouse down")
}
</code></pre>
<p>However when I do a mousedown event on the form I don't get anything on the console. I know something is missing where I register the event to the form or something of the sort. Any ideas?</p>
<p>Thanks,</p>
|
c#
|
[0]
|
677,050 | 677,051 |
Need to have some method to access data in my class
|
<p>I have the following class:</p>
<pre><code>public static class ReferenceData
{
public static IEnumerable<SelectListItem> GetDatastore()
{
return new[]
{
new SelectListItem { Value = "DEV", Text = "Development" },
new SelectListItem { Value = "DC1", Text = "Production" },
};
}
}
</code></pre>
<p>When I want to find the name of the datastore given the value I have been using:</p>
<pre><code>DatastoreText = ReferenceData.GetDatastore().Single(s => s.Value == datastoreValue).Text
</code></pre>
<p>This works good but is there a better way? Can I code the above into my reference class and so reuse it in different places?</p>
<p>Thanks</p>
|
c#
|
[0]
|
5,445,572 | 5,445,573 |
How to get event in another control event?
|
<p>In my application, i am trying to get button_click event in another button click event, but it is not working. </p>
<p>My code is,</p>
<pre><code>protected void btn1_Click(object sender, EventArgs e)
{
Response.Write("hi.....");
}
protected void btn2_Click(object sender, EventArgs e)
{
btn1.Click += new EventHandler(this.btn1_Click);
}
</code></pre>
<p>What is wrong with this?</p>
|
asp.net
|
[9]
|
1,472,466 | 1,472,467 |
sorting objects in NSMutableArray
|
<p>My NSMutableArray contain the list of GroupUser objects :</p>
<pre><code>@interface GroupUser : NSObject {
NSString *groupUser_name;//user name
NSString *groupUser_customMsg;
NSString *groupUser_emailId;
NSString *groupUser_groupName;
NSString *groupUser_aliasName;
int groupUser_imageId;
int groupUser_state;//whether user is online( value 0) offline(value 1) or busy(value 2)
int groupUser_type;
}
</code></pre>
<p>now i want to sort the list :
1. On the bases of groupUser_state
2. On the bases of groupUser_name</p>
<p>eg:: 1. Sam Offline(value 1)
2. Ravi Online(value 0)
3. Amit Online(value 0)
4. Ganga Online(value 0)
5. Durga Offline(value 1)</p>
<p>Output after sorting should be::
1. Amit Online
2. Ganga Online
3. Ravi Online
4. Durga Offline
5. Sam Offline</p>
<p>Help me by providing code for the same.. Thanx in advance</p>
|
iphone
|
[8]
|
2,246,754 | 2,246,755 |
Delay script loading
|
<p>So if I have the following:</p>
<pre><code><script type="text/javascript" src="offsite file I am referencing"></script>
</code></pre>
<p>and I simply want to delay the execution of calling that file using settimeout, how would I go about that?</p>
<p>Very strange in that I would have no problem using settimeout on a simple function, but I am kind of stumped in this seemingly more simple situation.</p>
<p>My thought would be I could just make a function that calls that file after x amount of time, but calling the file in the function seems to be escaping me.</p>
|
javascript
|
[3]
|
3,514,833 | 3,514,834 |
How To detect the UItable Section
|
<p>I have a small problem:</p>
<p>I have a table with two sections. Both sections contains UIButtons on each of their corresponding cells. Clicking on these buttons plays the song. While song plays animation goes on. My problem is when I tab on button of any of the section then animation starts in both the section. Now I want to know how can I detect on which section button is pressed so that animation can work only in the section in which button is clicked .</p>
<p>I can track the indexPath by using :</p>
<pre><code> myVar = [sender tag];
</code></pre>
<p>How can I track section? Please help.
Thanks in advance.</p>
<p>This method will be called when I tap the UIButton:</p>
<pre><code> [playPreviewButton addTarget:self action:@selector(**playPreviewButtonClicked**:) forControlEvents:UIControlEventTouchUpInside];
</code></pre>
<p>"playPreviewButtonClicked" method get called from each section when I tab the UIButton</p>
<pre><code> if(previewTapped==[indexPath row])
{
//display the animation wala stuff
[secondImageView removeFromSuperview];
[testView addSubview:firstImageView];
[cell.contentView addSubview:testView];
//Following statements will control the animation on scrolling.
NSMutableArray *tempArray = [[NSMutableArray alloc] init];
for(loopCounter = (songPreview.currentTime/animationCounter)+1; loopCounter<[animationImagesArray count]; loopCounter++)
{
[tempArray addObject:[animationImagesArray objectAtIndex:loopCounter]];
}
firstImageView.animationImages = tempArray;
[firstImageView setAnimationRepeatCount: 1];
firstImageView.animationDuration = (songPreview.duration)-(songPreview.currentTime);
[firstImageView startAnimating];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
[UIView commitAnimations];
}
</code></pre>
<p>**</p>
<p>where previewTapped = [sender tag]</p>
<p>My problem is when I tab button in any section then animation starts in both the sections.
above "if" statement executed whenever cell created on scrolling the table. </p>
|
iphone
|
[8]
|
3,830,314 | 3,830,315 |
Android mail without intents using Android Mail API
|
<p>I am using an function to attach image to an email.</p>
<pre><code> public void addAttachment(String filename) throws Exception {
BodyPart messageBodyPart = new MimeBodyPart();
DataSource source = new FileDataSource(filename);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(filename);
_multipart.addBodyPart(messageBodyPart);
}
</code></pre>
<p>I call this function when attaching images to email.
When I try to remove the attachment it is not possible.</p>
<pre><code> public void removeAttachment(String filename) throws Exception {
BodyPart messageBodyPart = new MimeBodyPart();
DataSource source = new FileDataSource(filename);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(filename);
_multipart.removeBodyPart(messageBodyPart);
}
</code></pre>
<p>Tried with this function but not working.</p>
<pre><code> public void AddAndRemoveAttachment(String filename, Boolean yesorno)throws Exception{
BodyPart messageBodyPart = new MimeBodyPart();
DataSource source = new FileDataSource(filename);
if(yesorno == true ){
source = new FileDataSource(filename);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(filename);
_multipart.addBodyPart(messageBodyPart);
}
else{
_multipart.removeBodyPart(messageBodyPart);
}
}
</code></pre>
<p>But the removeBodyPart is not removing the attached image.
Looking forward to your reply.
thanks.</p>
|
android
|
[4]
|
3,184,111 | 3,184,112 |
Why does one of my values change?
|
<p>So I have this;</p>
<pre><code>var emailA = ConstructEmailA();
SnedEmailA(emailA.Append("</body>").ToString());
var emailB = ConstructEmailB(emailA);
SendEmailB(emailB.ToString());
</code></pre>
<p>Which works fine. Essentially, ConstructEmailB takes emailA and adds to it. However, I originally had this:</p>
<pre><code>var emailA = ConstructEmailA();
var emailB = ConstructEmailB(emailA);
SnedEmailA(emailA.Append("</body>").ToString());
SendEmailB(emailB.ToString());
</code></pre>
<p>Which did not work as expected. Instead of emailA and emailB being different, emailA contained the same info as emailB. How come?</p>
<p>Here is my ConstructEmailB method:</p>
<pre><code>private StringBuilder ConstructEmailB(StringBuilder email)
{
email.Append("Append stuff");
return email;
}
</code></pre>
|
c#
|
[0]
|
4,366,258 | 4,366,259 |
Locally served javascript shows inheritance chain in console, remotely served does not?
|
<p>Recently noticed the below. Locally served page is on top, remotely served is on bottom. Curious as to what would cause this. My settings for chrome dev tools is identical. My guess would be local is showing the full inheritance chain and remote does not, but some other developers in my office don't see the same for their local setups. Any ideas? <img src="http://i.stack.imgur.com/DMgFm.png" alt="enter image description here"> </p>
|
javascript
|
[3]
|
114,740 | 114,741 |
Ajax dropdown not working in mobile device
|
<p>In my Java spring application I have a form with Region drop down. On selection of particular region city list is populated using ajax. This functionality working fine in web browsers.
But does not work from an iPhone or Android phone. The second dropdown is not populate.
Is any solution for such problem ? Please help.</p>
|
java
|
[1]
|
297,390 | 297,391 |
accessing hidden value in parent of iframe src
|
<p>is it possible to access a hidden variable that resides in the parent of an iframe src?</p>
<pre><code><html>
<body>
<input type="hidden" id="target">Find me</input>
<iframe src="FrameMain.aspx"/>
</body>
</html>
</code></pre>
<p>So in FrameMain.aspx code-behind, can I get the target value. Now, I know I can pass value as encrypted URL parms but just wondering if there was another way?</p>
|
asp.net
|
[9]
|
2,067,673 | 2,067,674 |
IWin32Window in C#?
|
<p>How do i use this to create a tooltip?</p>
<p>Ive tried looking through all articles in MSDN website but i just cannot get my head round it.</p>
<p>Thanks,</p>
<p>Ash</p>
|
c#
|
[0]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.