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 |
|---|---|---|---|---|---|
2,287,059
| 2,287,060
|
Potential leak when calling addSubview [iPhone]
|
<p>I'm making an app that changes between many XIBs. Although Leaks tool doesn't call it out, whenever I load a new view, the program's memory footprint gets larger and larger.</p>
<p>If I comment out:</p>
<pre><code>[self.view addSubview:currentView.view];
</code></pre>
<p>the program's memory use doesn't change.</p>
<p>Relevant code:</p>
<pre><code>- (void)setPage{
[currentView release]; //retained
switch (pageNumber) {
case 0:
currentView = [[TheViewController alloc]
initWithNibName:@"PageX"
bundle:nil];
break;
///Page 1, Page2, etc.
}
for (clearingView in [self.view subviews]) {
[clearingView removeFromSuperview];
//[clearingView release]; = crash
}
[self.view addSubview:currentView.view]; //Leaky
}
</code></pre>
<p>I'm using one view controller.</p>
|
iphone
|
[8]
|
460,216
| 460,217
|
Removing object from IEnumerable
|
<p>I am returning a list of IEnumerable from one method. How do i remove an element from it?</p>
<p>i want to do something like :-</p>
<p>objIEnumerable.remove(objCustomer)</p>
<p>Thanks in advance :)</p>
|
c#
|
[0]
|
2,593,786
| 2,593,787
|
bulk insert class object
|
<p>I have a situation where I have to insert a lot of records into the table. I have wrapped the insert stuff in a member function(of an object). But it takes a lot of time. To optimize this, I am keeping all these records in a buffer(as a list) as a data member of the class. When the no. of records reaches to 100, I am doing a bulk insert.</p>
<p>Here is the code.</p>
<pre><code>class TabDailyQuotes:
def __init__(self, metadata):
self.metadata = metadata
self.indexes = Table('DailyQuotes', metadata, autoload=True)
self.ins_buf = []
self.ins = self.indexes.insert()
def insert(self, dict_data):
if isinstance(dict_data, types.DictType):
for key, val in dict_data.items():
self.ins_buf.append(val)
else:
self.ins_buf.append(dict_data)
if len (self.ins_buf) == 100:
self.ins.execute(self.ins_buf)
self.ins_buf = []
def __del__(self):
if len (self.ins_buf) > 0:
self.ins.execute(self.ins_buf)
self.ins_buf = []
</code></pre>
<p>Here the problem is that when I call the function for the insert of only one record (and subsequent call to insert subsequent records), I have to use <code>__del__()</code> magic function to insert all left over records at the end of life of the object.</p>
<p>Can anybody tell me a better way to deal with this ?</p>
|
python
|
[7]
|
5,840,527
| 5,840,528
|
Adding class to a sibling once sibling is found
|
<p>If I am using the following statement...</p>
<pre><code>if ($('divA').siblings().text() == "1") {
the code here needs to add a class to that specific sibling where text = 1
}
</code></pre>
<p>How would I select that sibling div to add class?</p>
|
jquery
|
[5]
|
1,061,607
| 1,061,608
|
jquery make enter button submit form
|
<p>I have a simple form that looks like this:</p>
<pre><code><form action="#" name="submit" method="post">
<input name="zip" id="zip" type="text" value="" class="zip-start" />
<div class="form-submit"><a href="" id="zipformSubmit" rel="zipformSubmit" class="zipformSubmit">Submit</a></div>
</form>
</code></pre>
<p>I have JS that looks like this:</p>
<pre><code><script>
$(document).ready(function() {
$("a[rel=zipformSubmit]").click(function(e) {
e.preventDefault();
var zip = $('#zip').val();
if (zip.length < 5) { alert("Please enter a valid zip code"); return false;};
$.colorbox({href: "/ppc/form.htm?zip=" + zip, iframe:true, innerWidth:800, innerHeight:600});
});
});
</script>
</code></pre>
<p>The problem is that the user can only submit this form by clicking on the submit button. Any ideas on how i can adjust the js so that the enter button also submits the form?</p>
<p>thanks in advance</p>
|
jquery
|
[5]
|
3,397,524
| 3,397,525
|
Giving a two dates (or two months) detect in what season we are in PHP
|
<p>I would like to know if there is some easy way to identify seasons: spring, summer, autumn or winter. I'm have to generate a 'resume' and I'd like that if a period of working roughly fits a season (not exactly but with a +/-10 days error for example) it returns spring, summer, autumn or winter.</p>
<p>Like:</p>
<ul>
<li>input: 25/06/2010, 30/09/2010</li>
<li>output: Summer 2010</li>
</ul>
<p>(In Spain summer is between 21 July and 20 September)</p>
<ul>
<li>input: 02/02/2009, 30/04/2010</li>
<li>output: 2009-2010</li>
</ul>
<p>Any idea how to do this?</p>
|
php
|
[2]
|
2,235,899
| 2,235,900
|
Error trying to use static var inside an array in another class var
|
<p>Besides of talk a lot of not useful things, there goes my code:</p>
<pre><code>1 public static $_INT = 'INTEGER';
2 protected $_name = 'projetos';
3 protected $_primary = 'id';
4 protected $_fields = Array (
Array ('id', self::$_INT)
);
</code></pre>
<p>I'm having an error on line 4.</p>
|
php
|
[2]
|
5,187,829
| 5,187,830
|
best way to write this on iphone
|
<p>this is the output i want
<strong>"SELECT * FROM wateat_tbl where name like '%love%' or desc like '%love%'";</strong> </p>
<p>where *<em>love is a text enterted by use</em>*r
now i want to write this in effective way
right now i am doing this lame code</p>
<pre><code> myStringPrt1=@"SELECT * FROM wateat_tbl where name like '%"
NSString *trimmedString1 = [myStringPrt1 stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceAndNewlineCharacterSet]];
myStringPrt2=UserText;// user input LOVE
NSString *myStringPrt3=@"%' or desc like '%";
NSString *myStringPrt4=@"%'";
trimmedString1=[trimmedString1 stringByAppendingString:myStringPrt2];
trimmedString1=[ trimmedString1 stringByAppendingString:myStringPrt3];
trimmedString1=[ trimmedString1 stringByAppendingString:myStringPrt2];
trimmedString1=[ trimmedString1 stringByAppendingString:myStringPrt4];
NSLog(@"My string is now = %@", trimmedString1);
</code></pre>
|
iphone
|
[8]
|
2,595,334
| 2,595,335
|
Destroying a Layer with its Child in Wiengine
|
<p>I am new to android gaming, the engine for the development that I am using is Wiengine.
I want to know how can I destroy a Layer with its child</p>
|
android
|
[4]
|
2,756,995
| 2,756,996
|
What does the returned value of the strcmp mean?
|
<p>I know that strcmp returns...</p>
<blockquote>
<p>A value greater than zero indicates that the first character that does
not match has a greater value in str1 than in str2; And a value less
than zero indicates the opposite.</p>
</blockquote>
<p>But what do those positive or negative numbers mean? for example what does 2 mean?</p>
|
c++
|
[6]
|
1,013,874
| 1,013,875
|
How to run maven project from eclipse?
|
<p>I am trying to run simple java project. I had created project using 'Maven Project' type. I have one main class called 'TestMain'. When I tried to run the project using right click -> run , there was no menu to run the application as 'Run As Java Application'. I am wondering where that option has gone.</p>
<p>Can anyone please help me in runnin java application?</p>
|
java
|
[1]
|
938,571
| 938,572
|
is there anything in java like header files in C/C++
|
<p>In C, there is this concept of header files that lets you include the header files required for most of the program in one go and so you can only import that one header file in each of your program. I find this pretty neat. Now, I have been working in JAVA for a while and afaik I cannot group together a set of imports that I require for almost every file and put them in one. Am I wrong? And is this better than putting all the required bunch in one java file.</p>
|
java
|
[1]
|
2,178,718
| 2,178,719
|
How to run a program forever in Java? Is System.in.read() the only way?
|
<p>I took <a href="http://jersey.java.net/nonav/documentation/latest/getting-started.html#d4e54" rel="nofollow">this code</a>:</p>
<pre><code> 28 public static void main(String[] args) throws IOException {
29 HttpServer httpServer = startServer();
30 System.out.println(String.format("Jersey app started with WADL available at "
31 + "%sapplication.wadl\nTry out %shelloworld\nHit enter to stop it...",
32 BASE_URI, BASE_URI));
33 System.in.read();
34 httpServer.stop();
35 }
</code></pre>
<p>Does line 33 "System.in.read()" means that it will block until there is input? Will this also work when starting the Java application using UNIX rc script - not manually started from a command line?</p>
<p>I'd like to write a Java application to listen for HTTP connections. The application will be started automatically when the system boots (using UNIX rc scripts). It means that the application will run continuously - theoretically forever, until purposefully stopped. What is the best way to implement this in the Java main() method?</p>
|
java
|
[1]
|
5,608,366
| 5,608,367
|
How do I install a platform into my android device?
|
<p>I downloaded the emulator and followed the steps on the android website on how to install the SDK. i made an AVD and everything showed up on my computer screen perfectly, but now the problem was installing it to my phone. i can't find the instructions the android website on how to install it on my device.</p>
|
android
|
[4]
|
4,438,103
| 4,438,104
|
Image to memory stream, based on location
|
<p>I have an image column in bytes in DB & location (which stores the path of the image),
if the path is empty i used image column, if the path is not empty, i load the image to a byte array and return the image as Memory stream either from file path or direct byte image column.</p>
<pre><code>//query
select image,filepath from tablename;
byte[] Image = { };
if(file path is not empty)
{
System.Net.WebClient Client = new System.Net.WebClient();
Image = Client.DownloadData("Path of the image-http://....gif");
}
else
{
Image= datareader.GetOrdinal("image");
}
</code></pre>
<p>How do i assign a byte image to memory stream???</p>
|
c#
|
[0]
|
5,731,986
| 5,731,987
|
Print an integer to the screen from the Activity
|
<p>I'm trying to connect to a FTP-server. And I want a confirmation that I am connected.</p>
<p>This is my code:</p>
<pre><code>package no.ftptesting.oversikt;
import java.io.IOException;
import java.net.SocketException;
import android.app.Activity;
import android.os.Bundle;
import org.apache.commons.net.ftp.FTPClient;
public class ftptestingActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
FTPClient ftp;
ftp = new FTPClient();
try {
int reply;
ftp.connect("server",21);
System.out.println("Connected.");
reply = ftp.getReplyCode();
} catch (SocketException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
</code></pre>
<p>I want to print out a confirmation and the reply-integer on the screen. How can I do this?</p>
|
android
|
[4]
|
4,944,858
| 4,944,859
|
android applications
|
<p>in my application i want to create a shortcut (a button), to another application but i want the user to be able to select which application he wants...
So how do i access a list of all the installed applications and how do i create an intent to start any one of those applications ?</p>
|
android
|
[4]
|
3,575,383
| 3,575,384
|
c# create a rolling graph and print its area?
|
<p>I'm working on a c# project. I want to read data from a file and show data in a chart. Specifically, it is a very long chart which the user waits for the chart to animate ahead on x-axis and draw itself and when all the data(about 500 Mega-Byte) is drawn there's a scroll bar on x-axis which the user can use to roll the chart. After all the user maybe wants to print the whole(not only the visible area which is supported by almost all of the chart controls) area of char with a rolling thermal printer(the ones which you can see in restaurants).
Does anybody know which control should I use?
I've worked with zgraph which I couldn't print the whole chart area.
Also, I've worked with the DynamicDataDisplay and WPFToolkit controls but I couldn't just print the whole chart!
I'm really confused!!!!</p>
|
c#
|
[0]
|
4,036,763
| 4,036,764
|
Problem using imagecreatefromjpeg and imagejpeg
|
<p>As per an assignment given to me, I am trying to see the effects of the following two function of php on a image file
1. imagecreatefromjpeg
2. imagejpeg</p>
<p>I upload the file using a html and then my php code looks like this:</p>
<pre><code> <?php
try{
if(!$image=imagecreatefromjpeg('zee1.jpg')){
throw new Exception('Error loading image');
}
// create text color for jpg image
if(!$textColor=imagecolorallocate($image,0,255,0)){
throw new Exception('Error creating text color');
}
// include text string into jpg image
if(!$text=imagestring($image,5,10,90,'This is a sample text
string.',$textColor)){
throw new Exception('Error creating image text');
}
header("Content-type:image/jpeg");
// display image
imagejpeg($image, 'zee1After.jpg');
// free up memory
imagedestroy($image);
}
catch(Exception $e){
echo $e->getMessage();
exit();
}
?>
</code></pre>
<p>But when i do this, i get the following output:</p>
<p>Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 10368 bytes) in C:\Users\zee\Documents\Flex Builder 3\CLOUD\bin-debug\upload_file.php on line 3</p>
<p>The size of original image is : 5,136 KB give the above error after running the php. </p>
<p>But if i try for other image with size : 2,752 KB It Works .. </p>
<p>Can someone please help me with this.
Zeeshan</p>
|
php
|
[2]
|
3,659,738
| 3,659,739
|
Is there an XML literal add-in for C# which can convert an XML literal to a C# object?
|
<p>Is there an XML literal add-in for C# which can convert an XML literal to a C# object?</p>
|
c#
|
[0]
|
3,326,163
| 3,326,164
|
Android link in dialog
|
<p>How can I add a link to a dialog message?</p>
<p>i tried this but the link doesn't do anything on onclick:</p>
<pre><code>builder.setMessage(Html.fromHtml(
"Click on the " +
"<a href=\"http:\\www.google.com\">link</a> " +
"to download."));
</code></pre>
<p>or <code>//www.google.com</code></p>
|
android
|
[4]
|
794,117
| 794,118
|
'order' of unordered Python sets
|
<p>Question from a noob (me):</p>
<p>I understand that sets in Python are unordered, but I'm curious about the 'order' they're displayed in, as it seems to be consistent. They seem to be out-of-order in the same way every time:</p>
<pre><code>>>> set_1 = set([5, 2, 7, 2, 1, 88])
>>> set_2 = set([5, 2, 7, 2, 1, 88])
>>> set_1
set([88, 1, 2, 5, 7])
>>> set_2
set([88, 1, 2, 5, 7])
</code></pre>
<p>...and another example:</p>
<pre><code>>>> set_3 = set('abracadabra')
>>> set_4 = set('abracadabra')
>>> set_3
set(['a', 'r', 'b', 'c', 'd'])
>>>> set_4
set(['a', 'r', 'b', 'c', 'd'])
</code></pre>
<p>I'm just curious why this would be. Any help?</p>
|
python
|
[7]
|
5,689,636
| 5,689,637
|
getting a registry key and value in C#
|
<p>Sorry if this is simple, I haven't coded since college. I'm trying to write a program to view registry entries in Windows 7. I want to check to see if the registry value exists first, then check to see what the value is. If it doesn't exist, I want one message, if it does exist, I want one message reflecting a value of 1, and another reflecting a value of 0. I got the code to work if the registry key doesn't exist, but if I add the key and value it crashes. Not sure what I'm doing wrong here. Any suggestions would be appreciated. Here is my code.</p>
<pre><code>using (RegistryKey Key = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\services\LanmanServer\Parameters"))
if (Key != null)
{
string val = (string)Key.GetValue("EnableOplocks");
if (val == null)
{
oplockTextBox.Text = "Not Present In Registry";
oplockTextBox.BackColor = Color.Yellow;
}
else if (val == "1")
{
opslockTextBox.Text = "NO";
opslockTextBox.BackColor = Color.Red;
}
else
{
oplockTextBox.Text = "YES";
oplockTextBox.BackColor = Color.Green;
}
}
else
{
MessageBox.Show("");
}
</code></pre>
|
c#
|
[0]
|
677,572
| 677,573
|
how to get the count of number of true values in Arraylist java
|
<p>hi I am new here and new in Java programming as well actually my problem is that I have a Array List of type Book in which I am storing Book name and title and set the OnLoan value explicitly by true or false but I am able to store true or false value for the Book arrayList but I want to count number of true value in my arrayList say if 3 books having borrowed status true I want the count as 3 I dont know how to get that count out from ArrayList in java please help me out here is my sample code I am getting the true value by calling the getOnLoanStatus() from book class which holds true and false values</p>
<pre><code>int borrowCount=0;
Book loanStatus = new Book();
boolean l = loanStatus.getOnLoanStatus();
//boolean to String conversion
System.out.println("value of l is" + l);
if(this.booksHeld.isEmpty())
{
return null;
}
for(int i=0;i<this.booksHeld.size();i++)
{
if(booksHeld.contains(l)) // compare the isbn string with getIsbn Method
{
borrowCount++;
}
}
if(borrowCount==0)
{
return "Libray: " + numberOfBooks() + "books " + " 0 book on Loan";
}
else
{
return "Libray: " + numberOfBooks() + "books " + borrowCount + "on Loan";
}
</code></pre>
|
java
|
[1]
|
1,510,647
| 1,510,648
|
Is there a way to not break code if columns in a database change?
|
<p>Assume I have a declared a datatable and to this datatable I have assigned a result that gets returned from calling a stored procedure, so now, my datatable contains something like the following when accessing a row from it:</p>
<pre><code>string name = dr["firstname"];
int age = (int)dr["age"];
</code></pre>
<p>if firstname is changed to first_name and age is removed, the code will obviously break because now the schema is broken, so is there a way to always keep the schema in sync with the code automatically without manually doing it? Is there some sort of meta description file that describes the columns in the database table and updates them accordingly? Is this a case where LINQ can be helpful because of its strongly typed nature?</p>
|
c#
|
[0]
|
5,349,982
| 5,349,983
|
How can I use jQuery to determine if an object is a select?
|
<p>I have been using this to determine if an object is a "text" or not so I can get the .val or the checked state:</p>
<pre><code>var val = object.is(":text") ? object.val() : object.is(":checked")
</code></pre>
<p>This works BUT now the object might also be:</p>
<ol>
<li>From a select</li>
<li>From an input field</li>
<li>From a checkbox</li>
</ol>
<p>Is there another way I could code this so it would also work for a select?</p>
|
jquery
|
[5]
|
3,446,962
| 3,446,963
|
Android how can play song for 30 seconds only in mediaPlayer
|
<pre><code>I am working in android , i am creating a player for audio songs. I want to play a song only for 30 seconds. after that player must be closed.It should be start again if i press START button again.
this is the code for creating a media player:-
MediaPlayer mediaPlayer = new MediaPlayer();
public void songPreview(String songURL){
try{
mediaPlayer=new MediaPlayer();
mediaPlayer.setDataSource(songURL);
mediaPlayer.prepare();
mediaPlayer.start();
} catch(Exception ex){
ex.printStackTrace();
}
}
Please suggest me what code should i use to play my song only for 30 seconds after that it will stop. and if i want to play again then i have to press start button.
Note:- please provide me logic to stop media player after 30 second.
Thank you in advance.
</code></pre>
|
android
|
[4]
|
3,995,283
| 3,995,284
|
std::string as C++ byte array
|
<p>Google's Protocol buffer uses the C++ standard string class <code>std::string</code> as variable size byte array (<a href="http://code.google.com/apis/protocolbuffers/docs/proto.html#scalar" rel="nofollow">see here</a>) similar to Python where the string class is also used as byte array (at least until Python 3.0).</p>
<p>This approach seems to be good:</p>
<ul>
<li>It allows fast assignment via <a href="http://www.cplusplus.com/reference/string/string/assign/" rel="nofollow"><code>assign</code></a> and fast direct access via <a href="http://www.cplusplus.com/reference/string/string/data/" rel="nofollow"><code>data</code></a> that is not allowed with <code>vector<byte></code></li>
<li>It allows easier memory management and const references, unlike using <code>byte*</code>.</li>
</ul>
<p>But I am curious: Is that the preferred way for a byte arrays in C++? What are the drawbacks of this approach (more than a few <code>static_cast</code>s) </p>
|
c++
|
[6]
|
4,684,268
| 4,684,269
|
Is there a performance difference in using a tuple over a frozenset as a key for a dictionary?
|
<p>I have a script that makes many calls to a dictionary using a key consisting of two variables. I know that my program will encounter the two variables again in the reverse order which makes storing the key as a tuple feasible. (Creating a matrix with the same labels for rows and columns)</p>
<p>Therefore, I was wondering if there was a performance difference in using a tuple over a frozenset for a dictionary key.</p>
|
python
|
[7]
|
1,871,247
| 1,871,248
|
Checkbox js toggling incorrectly
|
<p>I have a check box in my registration form like this:</p>
<pre><code><form name="reg" id="reg" method="post">
<input type="checkbox" onclick="return validate('tos')" name="tos"/>
</form>
</code></pre>
<p>And I am using JS to check if its ticked, and if so, display a green tick in the form. However, its not actually ticking the check box when its clicked but it is loading the green tick. </p>
<p>Additionally, clicking it a second time doesn't remove the green tick which it should, because the user effectively unticked the check box.</p>
<p>So my JS is this:</p>
<pre><code>function validate (type){
output = [];
var x = document.getElementById("reg");
if (type == 'tos'){
div = 'result_tos';
input = x.elements[4].checked;
if (input){
output.push('<img src="correct.png"/>');
} else {
output.push('You must agree to our terms of service in order to join !');
}
document.getElementById(div).innerHTML = (output.join('')); //display result
}
}
</code></pre>
|
javascript
|
[3]
|
3,460,815
| 3,460,816
|
matching multiple line in python regular expression
|
<p>I want to extract the data between <code><tr></code> tags from an html page. I used the following code.But i didn't get any result. The html between the <code><tr></code> tags is in multiple lines</p>
<pre><code>category =re.findall('<tr>(.*?)</tr>',data);
</code></pre>
<p>Please suggest a fix for this problem.</p>
|
python
|
[7]
|
5,396,164
| 5,396,165
|
how to find a string in a text file and print the lines right before and after
|
<p>I am trying to convert my shell scripts into python code, but I am stuck while trying this operation.</p>
<p>I have a process that outputs a text file, the file has sections like this:</p>
<pre><code>Running Operation kdasdakdnaskdaksdma
(error if present) error: kdmakmdasmdaksom
</code></pre>
<p>This file could have multiple lines for the operation and the error (if present, otherwise the next line will just have another operation); there is always a crlf after each block.</p>
<p>I am trying to scan the file to find the line that contains "error:", and then read the operation that caused the error and the details of the error, so i can extrapolate it from the text file and save it in an error log file.</p>
<p>So far i can find the line(s) that has "error:" in it, with this simple code, but I am not able to find any example about how do you actually print the lines that are not necessarily the ones that contain the error message, but the ones that came before and after the line where "error:" is located.</p>
<p>using awk or grep would be straightforward, but with Python I am not really sure about how to do so; this is what i have so far, that is able to print the line that has the error but it prints just that, while i would like to have control to the lines printed before and after.</p>
<pre><code>import re
fh = open('~/logs_output.txt')
for line in fh:
if "error:" in line:
print line
</code></pre>
<p>Tried to look at RE module in python, and also to the string modules, but so far I haven't found anything that would allow me to do what you would do with awk for example, where you can look for an occurrence of a specific string and turn on print, and then turn it off, once that you are done</p>
<p>Can anyone point me to the right direction to tackle this issue? Thanks!</p>
|
python
|
[7]
|
3,373,358
| 3,373,359
|
set value of input
|
<p>Sometimes code says more then words, so the following lines work:</p>
<pre><code> $("#text11").append($(xml).find("address").find("street"));
$("#<%= tbWoonplaats.ClientID %>").val('testing?');
</code></pre>
<p>but these do not:</p>
<pre><code>var street = $(xml).find("address").find("street");
$("#<%= tbAdres.ClientID %>").val(street);
</code></pre>
<p>it displays [object object] in the input
now i've tried to replace <code>.val(street);</code>
with <code>.val(new string(street));</code> but that doesn't work either</p>
<p>appending to a span works but setting with <code>.val()</code> to input doesn't...</p>
<pre><code><span id="text11"></span>
</code></pre>
<p><strong>EDIT</strong>
the output of </p>
<pre><code>var street = $(xml).find("address").find("street");
window.alert(street);
</code></pre>
<p>is:
[object Object]</p>
|
jquery
|
[5]
|
4,859,774
| 4,859,775
|
Update UI from service
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2621395/more-efficient-way-of-updating-ui-from-service-than-intents">More efficient way of updating UI from Service than intents?</a> </p>
</blockquote>
<p>I have a RSS Feed reader application. I am handling the feed reading in a service, but I don't know how to update the UI. What would be the best way to handle this?</p>
<p>Thanks a lot</p>
<p>Gratzi</p>
|
android
|
[4]
|
3,802,951
| 3,802,952
|
issues in dragging item in list view
|
<p>I have created an ListView which contain list of item. Each item in a list view had an different image. What i want is to drag and drop each of the image in the list view means i can move the position of an items in the list view. </p>
<p>The thing i want to do is.</p>
<ol>
<li><p>I can drag and drop each of the image in the list for from one position to another.</p></li>
<li><p>on click of each image on the list view i want to open a dialog.</p></li>
</ol>
<p>So how that can be done. Please help me with suitable example.</p>
|
android
|
[4]
|
3,621,154
| 3,621,155
|
Parsing of file with Key value in C/C++
|
<p>Need some help in parsing the file </p>
<pre><code>Device# Device Name Serial No. Active Policy Disk# P.B.T.L ALB
Paths
--------------------------------------------------------------------------------------- -------------------------------------
1 AB OPEN-V-CM 50 0BC1F1621 1 SQST Disk 2 3.1.4.0 N/A
2 AB OPEN-V-CM 50 0BC1F1605 1 SQST Disk 3 3.1.4.1 N/A
3 AB OPEN-V*2 50 0BC1F11D4 1 SQST Disk 4 3.1.4.2 N/A
4 AB OPEN-V-CM 50 0BC1F005A 1 SQST Disk 5 3.1.4.3 N/A
</code></pre>
<p>The above information is in devices.txt file and and i want to extract the device number corresponding to the disk no i input.
The disk number i input is just an integer (and not "Disk 2" as shown in the file).</p>
|
c++
|
[6]
|
2,035,421
| 2,035,422
|
text transform in datatable
|
<p>In CSS, we can use text-transform: capitalize; to make every first letter capital.
I have a data table and i want to make every first letter in each column capitalize. how can i perform text-transformation : capitalize to sql datatables? (am using c# as code behind)
Here is my code..</p>
<pre><code>public void myfunction(DataSet ds)
{
DataTable myTable = ds.Tables[0];
// and now have to transform each first letter capital for
// all the columns in this table..
}
</code></pre>
<p>Thanks in advance! </p>
|
c#
|
[0]
|
1,299,170
| 1,299,171
|
get Image Name in ImageView Android
|
<p>I am dynamically loading images in image view by setting </p>
<p><code>view.setBackgroundResource(cards[i])</code></p>
<p>// cards is the image array </p>
<pre><code>cards[] = {R.drawable.image1,R.drawable.image2....}
</code></pre>
<p>is there any way I can know the image name or image id associated with image view in android?</p>
|
android
|
[4]
|
2,659,400
| 2,659,401
|
How to read a string containing xml elements without using the XML properties
|
<p>Im doing an xml reading process in my project. Where i have to read the contents of an Xml file. I have achieved it.</p>
<p>Just out of curiosity i also tried using the same by keeping the xml content inside the a string and then read only the values inside the elemet tag. Even this i have achieved. The below is my code.</p>
<pre><code>string xml = <Login-Form>
<User-Authentication>
<username> Vikneshwar </username>
<password> xxx </password>
</User-Authentication>
<User-Info>
<firstname> Vikneshwar </firstname>
<lastname> S </lastname>
<email> xxx@xxx.com </email>
</User-Info>
</Login-Form>";
XDocument document = XDocument.Parse(xml);
var block = from file in document.Descendants("client-authentication")
select new
{
Username = file.Element("username").Value,
passWord = file.Element("password").Value,
};
foreach (var file in block)
{
Console.WriteLine(file.Username);
Console.WriteLine(file.passWord);
}
</code></pre>
<p>similarly i obtained my other set of elements(firstname,lastname,email).</p>
<p>Now my curiosity draws me again. Now im thinking of the doing the same using the string functions?</p>
<p>The same string used in the above code is to be taken.</p>
<p>Im trying not to use any XMl related classes ie xdocument,xmlreader etc.</p>
<p>The same output should be achieved using only string functions. Im not able to do that. Is it possible.</p>
<p>Any guidance will be apprecaited.</p>
<p>Thanks and regards.</p>
<p>S. Vikneshwar.</p>
|
c#
|
[0]
|
280,447
| 280,448
|
date field in php is returning wrong value
|
<p>Am trying to get the date selected from a FORM to my sql database using php.</p>
<p>Code for JS:</p>
<pre><code><script type="text/javascript" src="mootools-core-1.4.5-full-compat.js"></script>
<script type="text/javascript" src="datepicker.js"></script>
<script type="text/javascript">
new DatePicker('.picker', {
pickerClass: 'datepicker ',
allowEmpty: true
});
</script>
</code></pre>
<p>Code for Date field in the FORM - HTML</p>
<pre><code> <td><input name='DateOfJourney' type='text' value='' class='date picker' ></td>
</code></pre>
<p>Code for PHP which i am echoing:
<code>echo $_POST['DateOfJourney'];</code></p>
<p>Also the DateOfJourney field in the sql table is VARCHAR type.</p>
<p>There are codes for CSS, if needed i'll copy them. The date field in the form is a date picker format.</p>
<p>When selecting the date as <code>16-02-2013</code>, the output its throwing is : <code>1361079469</code> which is a junk it seems.</p>
<p>Can you let me know how to get the exact value which i put in input in the FORM to reflect the same in the output database?</p>
|
php
|
[2]
|
775,105
| 775,106
|
Namespace with same name as a class name
|
<p>I thought the following makes sense to do, but it's not possible and an error will be thrown: <code>The namespace 'foo' already contains a definition for 'bar'</code>.</p>
<pre><code>namespace foo
{
public class bar { ... }
}
namespace foo.bar
{
public class baz : EventArgs { ... }
}
</code></pre>
<p>What would be the appropriate way of namespace naming for a case like this?</p>
|
c#
|
[0]
|
2,829,911
| 2,829,912
|
Compare Validator in asp.net?
|
<p>In web application, i am try to validate the date by using compare validator. but it is throwing error, This is my code </p>
<pre><code><asp:CompareValidator
ID="CompareValidator1"
runat="server"
Text="*"
Display="None"
ValidationGroup ="a"
ControlToValidate="txtValidate"
ValueToCompare='<%# DateTime.Today.ToShortDateString() %>'
Operator="GreaterThan"
Type ="Date"
ErrorMessage="Date Should Greater Than Todate">
</asp:CompareValidator>
</code></pre>
<p>The error is :</p>
<blockquote>
<p>The value '' of the ValueToCompare property of 'CompareValidator1'
cannot be converted to type 'Date'.</p>
</blockquote>
|
asp.net
|
[9]
|
3,071,098
| 3,071,099
|
How can i create cookies or sessions in android platform?
|
<p>How can i create cookies or sessions in android platform?</p>
<p>i am using one application like preferences settings. when ever i change the theme of android application need to store somwhere(?) the last updated theme name.</p>
<p>is there any way to store values cookies in android platform?</p>
<p>Thanks,
Jeyavel N</p>
|
android
|
[4]
|
5,075,380
| 5,075,381
|
How to use $.unique() function
|
<p>Please, help me to understand, how to use <code>$.unique()</code> function.</p>
<p>From the docs: </p>
<blockquote>
<p>Sorts an array of DOM elements, in place, with the duplicates removed.</p>
</blockquote>
<p>I'm trying this code:</p>
<pre><code><h1 class="foo">Headline</h1>
<h1 class="foo">Headline</h1>
<h1 class="foo">Headline</h1>
alert( $.unique($('.foo')).length );
</code></pre>
<p>It returns 3, but I supposed 1. What am I missing? And it would be great to see some practice example of using this function. Thanks.</p>
<p>P.S.</p>
<p>I've also tried to sort a few numbers, but got a very curious result.
The following code returns different values in different browsers!</p>
<p><code>$.unique([ 1, 2, 2, 3, 3, 1 ])</code></p>
<ul>
<li>Safari - 1, 2, 3, 1</li>
<li>Opera - 2, 1, 3</li>
<li>FF - 3, 2, 1, 3</li>
<li>Chrome - 3, 2, 1</li>
<li>IE - 2, 1, 3</li>
</ul>
|
jquery
|
[5]
|
163,589
| 163,590
|
Android Live Wallpaper
|
<p>I'm making a live wallpaper app and I was just wondering if I can create a background in photoshop and then place animations on top of that. I'm new to this and all the examples I've seen online don't really mention anything about this. Any help would be much appreciated! </p>
|
android
|
[4]
|
2,830,696
| 2,830,697
|
Display an image in a div with javascript?
|
<p>my js is not good, but I'm thinking I'm going to need to use the getElementbyId some think like:</p>
<pre><code>if (a == ‘tick’)
document.getElementById(‘imageDiv’) = tick.gif
else
document.getElementById(‘imageDiv’) = cross.gif
<div id="imageDiv"></div>
</code></pre>
<p>but is does not work.</p>
|
javascript
|
[3]
|
3,349,009
| 3,349,010
|
is it possible to get the class of the interface <Set>
|
<p>Am having some arguments say (String a, Treeset b, Set c)
and i try to get the class by arguments[i].getClass(); of the above arguments..
is it possible to get the class of the interface .</p>
<p>For example:</p>
<pre><code>Class[] argumentTypes = new Class [arguments.length];
for (int i = 0 ; i < arguments.length ; i++)
{
argumentTypes[i] = arguments[i].getClass();
}
</code></pre>
|
java
|
[1]
|
1,745,684
| 1,745,685
|
Android background image for multiple screens
|
<p>I read a topic about <a href="http://developer.android.com/guide/practices/screens_support.html" rel="nofollow">multiple screen support</a>, but I don't understand why I need a different picture for every screen size if I can stretch image by setting</p>
<pre><code> android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bk"
</code></pre>
<p>for every screen.</p>
|
android
|
[4]
|
5,224,538
| 5,224,539
|
ASP.NET Server.HtmlEncode Limitations
|
<p>I'm using Server.HTMLEncode to encode my HTML.</p>
<p>I notice it dosn't escape single quotes, which is a limitation if your using single quotes in your html e.g.
<code><input type='text' .... /></code> </p>
<p>(I've checked this is valid XHTML).</p>
<p>Are there any other limitations or things to note about Server.HTMLEncode, in particular any characters that are not valid XHTMl that this method dosn't deal with?</p>
|
asp.net
|
[9]
|
4,478,662
| 4,478,663
|
Keyboard polling
|
<p>I'm looking for a nice solution for non-blocking poll of the keyboard for Unix systems. If any keystroke happens, I want to capture it.</p>
<p>Some solution are presented in <a href="http://stackoverflow.com/questions/292095/polling-the-keyboard-in-python">Polling the keyboard in python</a>, but are there any other alternatives that utilize only the python standard library? I know curses is one alternative, but there are some issues with the Python distro I'm using that prevents me from using it.</p>
<p>It would be great if there's something as simple as <code>keyboard.read()</code> as in the question I linked.</p>
|
python
|
[7]
|
2,053,423
| 2,053,424
|
variable size text in android
|
<p>Friends,I am trying to set a text of variable size in my app, but I am not getting the desired result.</p>
<pre><code>msgInside=(TextView)findViewById(R.id.textView2);
msgInside.setTextSize(30);
msgInside.setText("BIG MESSAGE");
msgInside.setTextSize(20);
msgInside.setText("SMALL MESSAGE");
</code></pre>
<p>I can only see the <code>SMALL MESSAGE</code>, I need to see both the messages</p>
|
android
|
[4]
|
2,399,541
| 2,399,542
|
Read Sections of the File in PHP for Creating Labels
|
<p>I have a file which extract data from MYSQL database to create labels. I have add a string "BREAK" where labels end. My data file looks like this.</p>
<pre>
--------- Start File -------
BREAK
Order: 10000
NAME: XYZ
Phone: XXX-XXX-XXX
6 x ABC
6 x Main ST
6 x CITY
6 x STATE
6 x COUNTRY
BREAK
Order: 10001
NAME: XYZ1
Phone: XXX-XXX-XXX
BMC
MJ ST
CITY
STATE
COUNTRY
BREAK
Order: 10002
NAME: XYZ2
Phone: XXX-XXX-XXX
BMC
MJ ST
CITY
STATE
COUNTRY
......more orders..
--------- End File -------
</pre>
<p>In addition to reading 3 or more blocks and printing them separate, for the first block which is "6 x", I would like to remove "6 x" from the block and instead store 6 as a value in a variable to be used with lpr/print command on unix for printing 6 copies. This is not a major issue, I can probably figure it out later but reading these blocks in php and creating 3 or more files from them is my requirement.</p>
|
php
|
[2]
|
119,377
| 119,378
|
Get all program in C++ like start menu
|
<p>Can i get all program installed in my computer with C++?
Like start menu it's contains program installed.</p>
|
c++
|
[6]
|
3,830,717
| 3,830,718
|
Displaying the search data in database MySQL
|
<p>How can I display the data that I search in the MySQL?</p>
<p>I tried this code but it always give me an error of :</p>
<blockquote>
<p>"Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\FindFriend\resultFindFriend.php on line 12"</p>
</blockquote>
<pre><code><?php
if(!isset($_POST['dataFriend'])){
echo("no result");
}else {
$find = $_POST['dataFriend'];
$con = mysqli_connect('127.0.0.1','root','','test');
$queryFindFriend = "SELECT fullname FROM members WHERE fullname LIKE '%".$find."%'";
$friendResult = mysqli_query($con, $queryFindFriend);
$rows = mysqli_fetch_assoc($friendResult);
foreach($rows as $row)
{
?>
<div class="outputfindfriend">
<?php echo $row;?>
</div>
<?php
}
}
?>
</code></pre>
|
php
|
[2]
|
5,436,124
| 5,436,125
|
How to get wamp server response to the physical device in android?
|
<p>Hai i am tring to get response from the wamp server to the physical device. the application compiles and runs fine but i am not getting the response from the wampserver(my physical device and pc both are connected for wifi).thanks in advance.</p>
|
android
|
[4]
|
4,455,329
| 4,455,330
|
Inserting html string into a jquery object?
|
<p>I have the following structure:</p>
<pre><code>var $html = $("<div id='a'><div id='b'><div id='c'></div></div></div>");
</code></pre>
<p>I want to insert the following into the $html structure under div <code>#c</code>:</p>
<pre><code>var html = "<div id='d'><div id='e'><div id='f'></div></div></div>";
</code></pre>
<p>I tried the following:</p>
<pre><code>var $newHtml = $($html).find("#c").append(html);
</code></pre>
<p>I thought now the variable <code>$newHtml</code> would point to div <code>#a</code> and all its descending elements including the newly appended ones.</p>
<p>However, <code>$newHtml</code> only contains the <code>#c</code> div and decendants.</p>
<p>How do I get the <code>#a</code> object and its descendents?</p>
<p><strong>Update:</strong></p>
<p>To clarify:</p>
<p>I have the jquery object <code>$html</code> and a string <code>html</code>.</p>
<p>I want to insert the html string into one the innermost element of the <code>$html</code> structure.</p>
<p><code>both append & html works for it. The problem is, $newHtml only holds the elements of #c. $html contains all, including inserted elements.</code></p>
|
jquery
|
[5]
|
5,124,468
| 5,124,469
|
font in iphone sdk?
|
<p>is it possible to bring another language font in iphone sdk and to insert that font value (for example,chinese) in UILabel value? any help please?</p>
|
iphone
|
[8]
|
3,188,633
| 3,188,634
|
Submit a job, wait for its completion and after submit another job
|
<p>I need to run multiple times the same abaqus .inp file (slightly changed within runs) and after each run ends I need to submit a abaqus python script that will read the results.</p>
<p>I've done the following:</p>
<pre><code>#run the programme
os.system('abaqus job=file_name cpus=2')
#get results and write them to myresults.txt
os.system('abaqus viewer noGUI=python_name.py')
</code></pre>
<p>However, the main program executes the second line before the program started in the first line ends. As a result I get an error. How can I solve this?</p>
|
python
|
[7]
|
1,204,258
| 1,204,259
|
How can I enumerate all paths down a tree?
|
<p>I have a list</p>
<pre><code>list=[{"id":1},{"id":2,"children":[{"id":3},{"id":4},{"id":5,"children":[{"id":6}, {"id":7},{"id":8}]},{"id":9},{"id":10}]},{"id":11},{"id":12}]
</code></pre>
<p>Now how can i convert this list in below list format:</p>
<pre><code>[ [1], [2,3], [2,4], [2,5,6], [2,5,7], [2,5,8], [2,9], [2,10], [11], [12] ]
</code></pre>
|
python
|
[7]
|
2,426,904
| 2,426,905
|
how do i use the .one jquery function on this?
|
<p>not sure what i'm doing wrong but it's not stopping after one click. </p>
<pre><code><script type="text/javascript">
$(document).ready(function(){
$(".header").one('click', function(){
$("#fourlocs").effect("scale", { percent: 152, direction: 'horizontal' }, 700);
});
});
</script>
</code></pre>
|
jquery
|
[5]
|
490,856
| 490,857
|
How to know the size of the image to be uploaded with javascript?
|
<p>There is a webpage on my website where user can upload pictures. I want to set the limit of the pictures to be uploaded upto 2mb. Currently it uploads image of all sizes. If the picture is less than 2mb it will go along the normal path and get uploaded and if it is greater than 2mb a pop up should show error message. Can anybody help me in how to do this with javascript alone? Any help would be appreciated.
Thanks!</p>
|
javascript
|
[3]
|
5,004,580
| 5,004,581
|
jQuery problem on click event triggering hidden content
|
<p>I'm trying to load inline hidden content by fading it inside another div. The thing is that I can't prevent the content from being duplicated when there's more than one div with hidden content that have the same classes.</p>
<p>Here is a jsfiddle for better understanding: <a href="http://jsfiddle.net/EjU7M" rel="nofollow">http://jsfiddle.net/EjU7M</a></p>
<p>Any help would be appreciated, thanks in advance!</p>
|
jquery
|
[5]
|
5,524,644
| 5,524,645
|
Can I write `sin(whatever)`?
|
<p>Can i write <code>sin(whatever)</code> in Java and have it work?</p>
<pre><code>public static void main(String[] args) {
try {
double check = Double.parseDouble(args[0]);
} catch (NumberFormatException e) {
System.exit(0);
}
sin(args[0]);
}
</code></pre>
|
java
|
[1]
|
890,927
| 890,928
|
I need to make Stratus text cloud links be able to "Scroll to" using Jquery
|
<p>Currently i have a stratus text cloud withen a document that already had #jquery "Scroll to" for a horizontal scrolling website. I have figured out how to link the text from the stratus cloud to actually link to the different boxes. But they jump to, and i need them to do a smooth scroll to. </p>
<p>Any thoughts???</p>
<p>THanx</p>
<p>Bx</p>
|
jquery
|
[5]
|
5,250,266
| 5,250,267
|
C++ linker error
|
<p>I have a file <code>A.cpp</code> which has the following lines:</p>
<pre><code>#include"B.h"
int main(int argc, char **argv)
{
...
char *input_file = *argv;
B *definition = new B(input_file);
...
}
</code></pre>
<p>In <code>B.h</code>, I have the following:</p>
<pre><code>class B
{
public:
// Constructors
B(void);
B(const char *filename);
...
}
</code></pre>
<p>When I compile, I get the following error: <code>undefined reference to 'B::B(char const*)'</code></p>
<p>Any suggestions on how to fix?</p>
<p>Thanks.</p>
|
c++
|
[6]
|
2,226,824
| 2,226,825
|
I want to change url in index
|
<p>I want to change my url without creating another file:
my index.php file is not in a folder... and the other pages are in folder "about -> index.php", and so on... My footer for index page is like this:</p>
<pre><code> <li><a href="about">About</a></li>
<li><a href="contact">Contact</a></li>
</code></pre>
<p>and the footer from a folder like "about" is like this:</p>
<pre><code> <li><a href="../about">About</a></li>
<li><a href="../contact">Contact</a></li>
</code></pre>
<p>I want just 1 footer file not 2, is much faster to change data...
Please help ! ( I prefer PHP )</p>
|
php
|
[2]
|
4,173,248
| 4,173,249
|
how to change the FormatCurrency()?
|
<p>I am using this line :</p>
<pre><code>FormatCurrency(DBReader("Price").ToString, 2, True)
</code></pre>
<p>to format my Currency
and I have two websites, the first one is English and the second is Arabic.</p>
<p>In the English website the price will be in $ Currency because the the localization setting is set as "en-US".</p>
<p>In the Arabic website the price will be in ل.ل Currency because the the localization setting is set as "ar-LB".</p>
<p>The question is how to format this code:</p>
<pre><code>FormatCurrency(DBReader("Price").ToString, 2, True)
</code></pre>
<p>to make the currency in the $ only in both websites?</p>
|
asp.net
|
[9]
|
1,952,341
| 1,952,342
|
PHP not stripping slashes when echoing
|
<p>I'm hoping someone can clear this up for me. I have been reading a book on best practices when it comes to form validation and that if the user enter a wrong value return the form back to them with the data they entered with warning/error messages. </p>
<p>What I want to do is say a user enters the below into a text box: </p>
<pre><code>hello " there
</code></pre>
<p>I want to return the above in the text box. Now when I use the below code it adds a slash. </p>
<pre><code><input name="name" id="name" type="text" class="formbox"
<?
php if ($missing || $errors) {
echo 'value="' . htmlentities($name) . '"';
}
?>
>
</code></pre>
<p>What I considered doing is this:</p>
<pre><code><input name="name" id="name" type="text" class="formbox"
<?
php if ($missing || $errors) {
$name = stripslashes($name);
echo 'value="' . htmlentities($name) . '"';
}
?>
>
</code></pre>
<p>While the above works it seems inefficient. If I use just 'stripslashes' then anything after the " is removed. Currently the form is just checking its self in the sense that when the user clicks submit the form reloads and an IF statement catches any posts which then checks to see if there are any missing fields.</p>
<p>I hope this all makes sense as I have been unable to find a best solution on SO and Google.</p>
<p>Many thanks for any help in advance :) </p>
|
php
|
[2]
|
4,351,968
| 4,351,969
|
How i send process in background in iPhone?
|
<p>I developing an application in which i calling web service and i store online data in NSMutableArray. That array contains some image URL and its title. When i loading that array in my UITableView custom cell the application freeze or did not do anything to me till all image not be loaded (image resolution sometimes bigger than 4300X400) from web server. So i think it take time fetching data from webserver. Now i want first display UITableView with all images titles after that i want to send all images loading or data fetching process in background in a queue. Whenever the image data will loaded it directly get response to corresponding table cell. And during loading data if i switch the viewController that queue process will automatically release.
How i do that in iphone? Also above method should applicable for both iPhone3G and iPhone4G.</p>
<p>Give me web link if any online tutorial.</p>
<p>Thanks</p>
|
iphone
|
[8]
|
2,721,781
| 2,721,782
|
How to create configuration file for android application?
|
<p>I want to develop one android frame work application for cites guide. I need one configuration file for all cites. That configuration file,I will change that configuration file for make various new cities guide. How to create configuration file for my application.</p>
<p>Anybody know "how to create xml configuration file for our android application". Please give some idea about that.</p>
|
android
|
[4]
|
1,114,149
| 1,114,150
|
How to set content length as long value in http header in java?
|
<p>I am writing a web server in java that is transferring file upto 2GB fine. When I searched for the reason, I found like java HttpServelet only allows us to set the content length as int. As the maximum size of integer is 2GB, its working fine upto 2gb when I am using response.setContentLength method. Now the problem is bydefault response.setContentLength has the parameter of integer. So it is not taking long value as parameter. I have already tried
response.setHeader("Content-Length", Long.toString(f.length()));
response.addHeader("Content-Length", Long.toString(f.length()));
but nothing is working. All time it is failing to add content length when it is a long value. So please give any working solution for HTTPServletResponse so that I can set the content length as long value.</p>
|
java
|
[1]
|
3,817,788
| 3,817,789
|
How can I share HTML markup between two different HTML files?
|
<p>I'm trying to build a simple extension for Opera 11 and I've hit a massive snag I'm sure most developers meet.</p>
<p>In case you don't know, an extension in Opera is just another .html file, with some Javascript if you choose.</p>
<p>What I'm having trouble with is getting the HTML source from the CALLING web page and passing it to the popup.html.</p>
<p>So for example, I'm on my Blog, I'd like to pass that markup and have that as the 'document' variable. Instead the 'document' variable is empty because it's using the popup.html's content - not the calling content.</p>
<p>How could I pass the HTML of the main browser to the popup.html?</p>
<p>Here is the code I have so you can see what I'm trying to do:</p>
<pre><code><script>
var imgs = document.getElementsByTagName('img')
var t = "";
for (var i=0, n=imgs.length;i<n;i++) t += '<br><a href="'+imgs[i].src+'"><img src="'+imgs[i].src+'" width="100"></a>';
document.write(t)
</script>
</code></pre>
|
javascript
|
[3]
|
1,899,239
| 1,899,240
|
how to load particular page from the pdf in uiwebview?
|
<p>I have implemented pdf reader application.I want to load particular page from the pdf how it possibele?</p>
|
iphone
|
[8]
|
2,188,067
| 2,188,068
|
Remove Text from .txt file using python 2.7
|
<p>I have a text file that I need to append to be able to import into my database. There are some 4800 odd lines in the text file. The data is under. Can someone help me with a python script that will:</p>
<ol>
<li>Read the file</li>
<li>Remove everything except lines with NDC,xxxxx-xxxx-xx</li>
<li>Write a new file with the data NDC,XXXXX-XXXX-XX</li>
</ol>
<p>Notice that the NDC is some time in XXXX-XXXX-XX format and sometimes XXXXX-XXXX-XX format.</p>
<p>Here is some data:</p>
<pre><code>NDC,0065-0795-50
5.25667
48320,2
NDC,0517-2650-25
0.0411
NDC,51079-190-20
0.1582
NDC,0603-5450-21
0.7924
</code></pre>
|
python
|
[7]
|
5,365,628
| 5,365,629
|
How to force the screen orientation to portrait before starting an App?
|
<p>I am using the following line of code for each of my activities in order to force the screen orientation to portrait mode:</p>
<pre><code>setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
</code></pre>
<p>It works ok unless I put the device in landscape mode <strong>before</strong> launching the app. In this case, the activity closes suddenly.</p>
<p>Any idea on how to manage this case?</p>
|
android
|
[4]
|
333,084
| 333,085
|
Issue with Javascript Auto Post Form
|
<p>I'm using Javascript to auto post a form,
but I seem to be getting a lot of people telling me it doesn't work for them.</p>
<p>This is very important because the form is linked with my payments :/</p>
<p>Prehaps I am using an outdated way of doing it, any help would be appreciated.</p>
<p>Here is my code:</p>
<pre><code><script type="text/javascript">
document.getElementById('paypal_form').submit();
</script>
</code></pre>
<p>And here is the form (simplified):</p>
<pre><code><form method="POST" id="paypal_form" name="paypal_form" action="https://www.paypal.com/cgi-bin/webscr" style="margin: 0; padding: 0; display: block; clear: both;">
<input type="submit" value="Click here if your browser does not automatically redirect you." style="margin: 0; margin-top: 12px; margin-bottom: 0px; font-size: 11px; padding=left: 4px; padding-right: 4px; padding-top: 2px; padding-bottom: 2px;">
</form>
</code></pre>
|
javascript
|
[3]
|
3,429,958
| 3,429,959
|
Membership bulk email software
|
<p>We have a Microsoft web stack web site, we have a members database.</p>
<p>We want to start doing mass-emails to our (opted in) membership.</p>
<p>I don't <em>particularly</em> want to re-invent the wheel with a system for having a web form submit and then mass send emails looping through thousands of records without timing out and overloading the server...</p>
<p>I guess I'm looking for something like Mailman, that can run on a windows (ASP/ASP.NET + SQL Server) backend and do the work for me, with suitable APIs to manage the subscriber list and send emails to that list.</p>
<p>Suggestions please?</p>
|
asp.net
|
[9]
|
1,482,964
| 1,482,965
|
what's polymorphic type in C++?
|
<p>I found in one article saying "static_cast is used for non-polymorphic type casting and dynamic_cast is used for polymorphic type casting". I understand that int and double are not polymorphic types. </p>
<p>However, I also found that static_cast can be used between base class and derived class. What does polymorphic type here mean? Some people says polymorphic type means the base class with virtual function. Is that right? Is this the only situation? What else? Can anybody could elaborate this for me more?</p>
|
c++
|
[6]
|
619,980
| 619,981
|
Digit only TextField with a unique decimal point in Javascript
|
<p>I could develop the following code in Javascript that allows only digits to a given HTML <code>TextField</code>.</p>
<pre><code>function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57))
{
return false;
}
return true;
}
<input type='text' id='textField' name='textField' onkeypress="return isNumberKey(event);">
</code></pre>
<p>but I need to allow <em>one and only one</em> decimal point (<strong>.</strong>) to be entered to the <code>TextField</code>. I tried some way but I didn't fabricate the code that could suite this requirement. How can I allow only digits along with a <strong>unique</strong> decimal point to a given <code>TextField</code>?</p>
|
javascript
|
[3]
|
5,510,604
| 5,510,605
|
Logic of triangle inequality as python conditionals?
|
<p><em>[community edit: original title was "python conditionals", OP is asking what is wrong with code below]</em></p>
<p>I made a function that's supposed to determine if three sides can theoretically form a triangle. It works fine in my opinion , but when i input the code in pyschools.com website, it tells that in some test cases it doesn't work (unfortunately it doesn't show me the cases it didn't work). Is something missing from my code, so in some special cases my logic breas down? Thank you very much for your help.
Here's the function:</p>
<pre><code>import math
def isTriangle(x, y, z):
if x > 0 and y > 0 and z > 0:
if x > y and x > z:
c = x
elif y > x and y > z:
c = y
else:
c = z
if c == math.sqrt(x**2 + y**2):
return True
else:
return False
else:
return False
</code></pre>
|
python
|
[7]
|
1,782,654
| 1,782,655
|
NoClassDefFoundError
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/34413/why-am-i-getting-a-noclassdeffounderror-in-java">Why am I getting a NoClassDefFoundError in Java?</a> </p>
</blockquote>
<p>my progamme is compling successfully. But while running the program Error occurred Java.Lang.NoClassDefFoundError. Please Reply</p>
|
java
|
[1]
|
1,315,471
| 1,315,472
|
disable system buttons in android
|
<p>I am developing an application which will run on tablets on one small exhibition. I would like to prevent visitors from turning off the application so I try to find out how to disable the system buttons on the tablets (like for example the home button).</p>
<p>Tablets are asus transformer prime with android ICS.</p>
|
android
|
[4]
|
493,609
| 493,610
|
Creating a vector of strings : C++
|
<p>I am trying to create a vector which should input <code>strings (white space included)</code> until user enters <code>'!'</code>.</p>
<p>Below is my code :</p>
<pre><code>#include <iostream>
#include <vector>
#include <string>
#include <iterator>
using namespace std;
int main()
{
char buffer[100];
string temp;
vector <string> vec;
while(1)//Shows Segmentation fault error while running,
//compiles succesfully
{
cout << "Enter String : ";
cin.get(buffer,100,'\n');//To ensure that whitespaces are also input
cout << "@@@@ " << buffer << endl ;//Shows correct input
cin.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
//Clearing cin stream for any residual characters
temp.assign(buffer);//Assigning string the input "phrase"
cout << "###" << temp << endl;//Shows correct output
if (temp == "!") //if input is '!' character do not push on the vector a
//come out of the loop
break;
vec.push_back(temp);//push on the vector
temp.assign(NULL); //flush temp string
}
vector <string>::iterator p = vec.begin();
//display thre vector
while( p != vec.end())
{
cout << *p << endl;
p++;
}
return 0;
}
</code></pre>
<p>It compiles successfully but at run-time throws <code>Segmentation fault</code> error.</p>
<p>Not able to figure out why ? Can any one point out?</p>
<p>Also smarter solution for this, is appreciated along side pointing out what is wrong with my code.</p>
<p>Thanks</p>
|
c++
|
[6]
|
817,174
| 817,175
|
Compilation error with external Jar
|
<p>I am trying to command line compile my code and I cannot get it to run properly. My project was in eclipse and i could specify the location of a jar file to include but the command line is another issue. All .java and the .jar file are in the same director. </p>
<p>I can compile with</p>
<pre><code>javac -classpath opencsv-2.3.jar *.java
</code></pre>
<p>I get the following exception if I try to run my code. </p>
<pre><code>java ClassificationGenerator
</code></pre>
<p>Exception in thread "main" java.lang.NoClassDefFoundError: au/com/bytecode/opencsv/CSVReader</p>
<p>I tried running the code with </p>
<pre><code>java -classpath opencsv-2.3.jar ClassificationGenerator
</code></pre>
<p>but then i get </p>
<p>Exception in thread "main" java.lang.NoClassDefFoundError: ClassificationGenerator
Caused by: java.lang.ClassNotFoundException: ClassificationGenerator
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)</p>
|
java
|
[1]
|
4,345,283
| 4,345,284
|
Accessing the same service more than twice in the nick of time
|
<p>I have an application that will access interface service A which is to run from windows startup. This service is used by program B and my application functions on B's presence after getting a pointer to A.
The scenario is translated as follows,</p>
<pre><code>public interface A{}
///my program
public class MyProgram
{
public MyProgram()
{
ProgramB.DoA();
}
public A GetA(){}
}
public class ProgramB
{
void DoA(){}
}
</code></pre>
<p>The translated source is not true, but that seems to be what I am looking for. In order to eliminate the overhead of allocating and realocating dynamic accesses to the same service used by other processes, would you please provide an actual solution to the problem ?(I am all out of any idea now)</p>
|
c#
|
[0]
|
3,599,909
| 3,599,910
|
Creating a transparent viewController in XIB
|
<p>In iPhone how to add a viewControllers view as a subview on top of another viewControllers view, such that the subview should be transparent and whatever components is added to the subview should be visible?</p>
|
iphone
|
[8]
|
1,137,280
| 1,137,281
|
PHP Check if part or the entire word is contained in the string
|
<p>I have these two strings:</p>
<pre><code>blablab/wp-forum.php?link
blablab/wp-forum.php
</code></pre>
<p>How can I check in PHP if the <strong>second</strong> one is contained in the <strong>first</strong> one or not?</p>
<p>I cannot find a working and easy way.</p>
<p>Thanks</p>
|
php
|
[2]
|
4,243,293
| 4,243,294
|
Why 'if(!getimagesize($_FILES['imagefile']['tmp_name']))' doesn't work?
|
<p>After the file is uploaded, why it always gives me the false even if it is image?<p></p>
<pre><code>if (!getimagesize($_FILES['imagefile']['tmp_name'])) { $boolean = false; }
</code></pre>
<p>By the way, it gives me this error:<br>
<code>Warning: getimagesize() [function.getimagesize]: Filename cannot be empty in...</code></p>
|
php
|
[2]
|
4,320,691
| 4,320,692
|
How do I access the element delegated to in jQuery?
|
<p>Suppose I have this jQuery code.</p>
<pre><code>$(document).delegate('a[title]', 'click', function(event) {
var txt = // href value of the link ;
alert("txt");
})
</code></pre>
<p>How do I obtain the value of the <code>href</code> attribute of the link? I cannot use <code>$(this)</code> because that would refer to <code>$(document)</code>.</p>
|
jquery
|
[5]
|
4,552,245
| 4,552,246
|
What is non overloaded pointer to member and overloaded pointer to member?
|
<p>I am reading C++ programming language by Bjarne Stroustrup. I came across the statement in templates section.</p>
<p>A template argument can be a constant expression (§C.5), the address of an object or function
with external linkage (§9.2), or a non overloaded pointer to member (§15.5).</p>
<p>What is non overloaded pointer to member? Can someone give example?</p>
|
c++
|
[6]
|
3,624,554
| 3,624,555
|
Unable to initialize class with my list
|
<p>I'm not able to get rid of this NullPointerException in the following class. My controller is extending this class and the problem goes away when I comment out the constructor below... what am I doing wrong?</p>
<pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contentController' defined in file [C:\Users\bkuhl\JavaProjects\cmt\cmt\target\cmt\WEB-INF\classes\com\site\cmt\web\ContentController.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.fettergroup.cmt.web.ContentController]: Constructor threw exception; nested exception is java.lang.NullPointerException
</code></pre>
<hr>
<pre><code>public class Controller {
private List<String> cssFiles;
private List<String> jsFiles;
public Controller () {
this.addCss("global.css");
this.addJs("global.js");
}
public ModelAndView render (ModelAndView model) {
//add Js & Css files
model.addObject("cssFiles", this.cssFiles);
model.addObject("jsFiles", this.jsFiles);
return model;
}
/*
* Add a css file to the page
*/
public final void addCss (String cssPath) {
cssFiles.add(this.cssFiles.size(), cssPath);
}
/*
* Add a javascript file to the page
*/
public final void addJs (String jsPath) {
jsFiles.add(this.jsFiles.size(), jsPath);
}
}
</code></pre>
|
java
|
[1]
|
4,645,210
| 4,645,211
|
Is Python2.6 stable enough for production use?
|
<p>Or should I just stick with Python2.5 for a bit longer?</p>
|
python
|
[7]
|
4,096,841
| 4,096,842
|
PHP "You have () new comments on your clip", how?
|
<p>I want to do a function to my users, so on index.php there is e.g: </p>
<p>You have 2 new comments on your clip</p>
<p>How should i do this? I mean i want ideas to do this the easiest way. Table for the videos is member_videos, and tables for the comment is member_videocomments, a comment inside the table is connected by their "videoID", which is the id of the column in member_videos.</p>
<p>Should i do the classic, making a field, which all is 0, until it has been seen by the user its 1 or what should i do.</p>
|
php
|
[2]
|
1,746,077
| 1,746,078
|
How to use timers for a Pong game?
|
<p>I'm remaking my Pong game in Java that I made in Allegro a while back, but I'm not familiar with Java timers, so I don't know how to proceed. I've setup the paddles and the ball, but the ball doesn't move because I have no timer telling it when to do so. I can move the paddles, but that's only because repaint() gets called when I press a key or release a key, and in my paintComponent() method, it updates the positions of the paddles and draws them.</p>
<p>But with the ball, it will need to constantly move, so how do I accomplish this? The most recent version of my project's code can be found on its GitHub project page here: <a href="http://www.github.com/packetpirate/Pong" rel="nofollow">http://www.github.com/packetpirate/Pong</a></p>
<p>Thanks for any help.</p>
|
java
|
[1]
|
1,479,499
| 1,479,500
|
best way to reference an element with jquery?
|
<p>I want to know how can I save a reference to an object (this) using jquery. what I mean is for example I want when my user clicked on any element in his page, I send the reference of object to my webserver, and next time user calls the server, I send back the saved refernce to browser, and do other stuff like fadeIn() ... so far I've tried using JSON.stringify(this) and JSON.stringify($(this)), but both dont seem to work. I also tried saving elemen't ID and class and type, so next time user calls them I could just use selectors, but since I wan to use the script on any website, things might not be the ideal to use selectors. is there any way to get the exact refernce to an element and send it to server ?</p>
|
jquery
|
[5]
|
973,894
| 973,895
|
Concatenate lists with LINQ
|
<p>Is it possible to concatenate a <code>List<List<T>></code> into a <code>List<T></code> with a single operation in a way which isn't horrible slow, i.e:</p>
<pre><code>List<List<int>> listOfLists = new List<List<int>>();
List<int> concatenatedList = listOfLists.Something...
</code></pre>
<p>?</p>
|
c#
|
[0]
|
937,408
| 937,409
|
TypeError: base.contacts is undefined - how can i define it?
|
<p>Receiving the above error in reference to the line <code>for ( var i = 0; i < base.contacts.length; i++) {</code> and can't figure out how to resolve. Below is the relevant code section</p>
<pre><code> synckolab.addressbookTools.createTBirdObject = function (base, cards) {
var card = null;
if (base.type === "contact") {
card = Components.classes["@mozilla.org/addressbook/cardproperty;1"].createInstance(Components.interfaces.nsIAbCard);
} else if (base.type === "maillist") {
card = Components.classes["@mozilla.org/addressbook/directoryproperty;1"].createInstance(Components.interfaces.nsIAbDirectory);
card.isMailList = true;
} else {
return null;
}
// for a mailing list add the entries
if (base.type === "maillist") {
card.dirName = this.getCardProperty(base, "DisplayName");
if (this.haveCardProperty(base, "NickName")) {
card.listNickName = this.getCardProperty(base, "NickName");
}
if (this.haveCardProperty(base, "Notes")) {
card.description = this.getCardProperty(base, "Notes");
}
// fill the list
for ( var i = 0; i < base.contacts.length; i++) {
var listCard = cards.get(this.getUID(base.contacts[i]));
card.addressLists.appendElement(listCard, false);
}
} else {
// go through all elements of base
for ( var field in base) {
// skip our own stuff TODO: handle mailing lists!
if (field !== "type" && field !== "synckolab" && field !== "ts" && field !== "contacts" && field !== "isMailList") {
// copy the property from base to card
this.setCardProperty(card, field, this.getCardProperty(base, field));
}
}
}
return card;
</code></pre>
<p>};</p>
|
javascript
|
[3]
|
3,055,982
| 3,055,983
|
Unable to get values in C# Structure from C++
|
<p>There is a structure which contains another structure in it. The C++ function takes a Structure pointer.I am calling this C++ function from C# code. I create a object of structure and pass it to the C++ code as an out parameter. This C++ function actually calls another function from a dll and I am able to get the value in C++ but when it comes to C# I am not able to get the value.
Can anyone help me in getting the structure values in C#?</p>
<p>Regards,
Balaji</p>
|
c#
|
[0]
|
1,878,592
| 1,878,593
|
Send SMS programatically on scheduled time
|
<p>Is there any way to send SMS programatically on scheduled time ? Without checking current time in every second...</p>
|
android
|
[4]
|
3,106,298
| 3,106,299
|
Python set difference not working
|
<p>In the following code;</p>
<pre><code>all_digits = set(range(10))
print all_digits
for i in range(102,167):
digits = set(k for k in (str(i)))
if len(digits) != 3:
continue
print "digits:", digits
remaining_digits = all_digits - digits
print "remaining:", remaining_digits
</code></pre>
<p>The digits set contains 3 elements. I want a set difference of them, however, <code>remaining_digits</code> always have all digits. What am I doing wrong here?
Here is a sample from output I am getting;</p>
<pre><code>set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
digits: set(['1', '0', '2'])
remaining: set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
digits: set(['1', '0', '3'])
remaining: set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
digits: set(['1', '0', '4'])
remaining: set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
digits: set(['1', '0', '5'])
remaining: set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
digits: set(['1', '0', '6'])
remaining: set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
digits: set(['1', '0', '7'])
remaining: set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
digits: set(['1', '0', '8'])
remaining: set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
</code></pre>
|
python
|
[7]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.