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 |
|---|---|---|---|---|---|
839,373 | 839,374 | What's the main difference between Java SE and Java EE? | <p>I'm new to Java, so any comment is welcome.</p>
| java | [1] |
5,364,442 | 5,364,443 | jQuery error: object doesn't support this property | <p>i am working on the following page:
<a href="http://www.skuuzi.com/products/skuuzi-4pack-brown" rel="nofollow">http://www.skuuzi.com/products/skuuzi-4pack-brown</a></p>
<p>On the above page there are options like 4brown, 4 grey. the options can be selected in firefox and IE8. But in IE7 and IE9 i get error the options cannot be selected.It is working fine in firefox.</p>
<p>Following is the js that i am using Radio-demo.js</p>
<pre><code>$(document).ready(function() {
$("#list li a").live('click', function(event) {
// First disable the normal link click
event.preventDefault();
// Remove all list and links active class.
$('#list .active').removeClass("active");
// Grab the link clicks ID
var id = this.id;
// The id will now be something like "link1"
// Now we need to replace link with option (this is the ID's of the checkbox)
var newselect = id.replace('link', 'option');
alert(newselect);
// Make newselect the option selected.
$('#' + newselect).attr('checked', true);
// Now add active state to the link and list item
$(this).addClass("active").parent().addClass("active");
return false;
});
// Toggle Form so you can see it working
$("a.toggleform").click(function(event) {
event.preventDefault();
$('#radioform').toggle("slow");
});
});
</code></pre>
<p>Please help me how can i remove the error and get it working in all browsers</p>
| jquery | [5] |
5,505,983 | 5,505,984 | Android Book Pages | <p>What's the best way to implement functionality in Android where I have a large amount of text (let's say a book), and I display one page at a time. However, instead of displaying it all at once, and having the user scroll through it, I would want to create it like iBooks where each page is separate, and the user "flips" through it [although, I don't need a fancy flip. A simple slide, like Kindle for iOS, would do].</p>
<p>So how should I go about this? Is creating a customview necessary, or is there some way to do it without that?</p>
| android | [4] |
3,797,866 | 3,797,867 | Java Synchronization inside Another Thread | <p>I have a quick question about Java synchronization.</p>
<p>Please assume the following code:</p>
<pre><code>public class Test {
private String address;
private int age;
public synchronized setAddress(String a) {
address = a;
}
public synchronized setAge(int a) {
age = a;
}
public synchronized void start() {
...
listener = new Thread(new Runnable(){
public void run() {
...
setAge(10);
...
synchronized(Test.this) {
address = null;
}
}
}
}
}
</code></pre>
<p>I am a little bit unsure about Java synchronization when synchronized method or synchronized block is called inside another thread.</p>
<p>Assume the thread running class Test as A, and
the listener thread B.</p>
<p>Then if I execute the code above, does it guarantee that synchronized method calls and synchronized block are synchronized with the A (the thread running Test class) ?</p>
<p>Thank you for reading.</p>
| java | [1] |
3,449,863 | 3,449,864 | how to read text file in android | <pre><code> try
{
InputStream instream = openFileInput("E:\\test\\src\\com\\test\\mani.txt");
if (instream != null)
{
InputStreamReader inputreader = new InputStreamReader(instream);
BufferedReader buffreader = new BufferedReader(inputreader);
String line,line1 = "";
try
{
while ((line = buffreader.readLine()) != null)
line1+=line;
}catch (Exception e)
{
e.printStackTrace();
}
}
}
catch (Exception e)
{
String error="";
error=e.getMessage();
}
</code></pre>
<p>I want to read the text from text file and in the code above occurs exception (that means it goes to catch block).i put text file in application folder. where to put this text file(mani.txt) to read correctly.</p>
| android | [4] |
3,480,052 | 3,480,053 | Is there something faster than -drawInRect:withFont:lineBreakMode:alignment:? | <p>Shark shows me that this method takes a HUGE performance hit. Like 80% in my table view. All I do is draw two labels per cell (about 8 in total per page). During scrolling. I drawInRect: with that.</p>
<p>Are there some better methods? Like drawing directly to some layer?</p>
| iphone | [8] |
5,000,083 | 5,000,084 | jQuery loading screen on form submit with file response | <p>I have an HTML form. When submitted it creates an Excel file and returns it.
On all other forms I have a loading screen shown in the <code>onSubmit</code> function and hidden in the <code>document.ready</code> function, but when a file is returned, there is no <code>document.ready</code> and so my loading screen doesnt hide.</p>
<p>I tried jQuery form plugin with callback function, but this way I was not able to normally show the response page on the other forms. The same is the case with <code>$.post()</code> function with a callback.</p>
<p>All I want is to call my <code>loadingScreenHide</code> function when the form submit is finished and leave the rest as normal.</p>
<p>Any ideas? </p>
<p>Thanks.</p>
<p>Code i tryed is like:
with form plugin callback function (return true; doesnt seem to work) :
$('form').ajaxForm(function () {activateDeactivateScreen('hidden'); return true; });</p>
<p>or with post instead:
$.post($('form').attr('action'), $('form').serialize(), function () {activateDeactivateScreen('hidden'); return true; });</p>
<p>the 2 main problems are when i use normal submit i dont have a callback and when i get a callback i dont have the normal submit/page load</p>
<p>i also had the idea of changing my java server pages to save the file temporary and redirecting to a download, but this way i would have to change about 20-30 java sources, so i would prefer a javascript solution</p>
| jquery | [5] |
3,229,419 | 3,229,420 | Error al conectar con localhost | <p>Could you help me with my problem?</p>
<p>I am trying to access localhost to obtain the data from a table but I get an error <strong>HttpHostConnectException</strong> when i run it </p>
<p>COMPLETE ERROR: org.apache.http.conn.HttpHostConnectException: Connection to <a href="http://localhost" rel="nofollow">http://localhost</a> refused</p>
<p>Code used:</p>
<pre><code>public class MysqlConnectActivity extends Activity {
private TextView tv;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tv = (TextView) findViewById(R.id.TextView01);
}
private class DownloadPoints extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... urls) {
String response = "";
try {
HttpClient client = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://localhost/leerDatosUsuarios.php");
HttpResponse execute = client.execute(httppost);
InputStream content = execute.getEntity().getContent();
BufferedReader buffer = new BufferedReader(new InputStreamReader(content));
String s = "";
while ((s = buffer.readLine()) != null) {
response += s;
}
}
catch (Exception e) {
Log.e("log_tag", "Error en la conexion HTTP: "+e.toString());
}
return response;
}
@Override
protected void onPostExecute(String result) {
tv.append("\nREAD FROM MYSQL:\n" + result);
}
}
public void readWebpage(View view) {
DownloadPoints task = new DownloadPoints();
task.execute( "http://localhost/leerDatosUsuarios.php");
}
</code></pre>
<p>Thank you for your attention
Alvaro</p>
| android | [4] |
19,637 | 19,638 | Using the datafilter parameter in an .ajax query using javascript | <p>I'm performing a search using the jQuery .ajax function but I need to filter the results to get rid of some code that's generated from the search. The CMS I'm using wraps all content in a body tag, etc. I need to grab just the contents of a specific div and load it into my target div. Here's what I have so far:</p>
<pre><code>$('#submitQuery').click(function(){
$.ajax({
url: '/Default.aspx?CCID=18511&FID=101997&ExcludeBoolFalse=True&PageID=10212140',
type: "POST",
data: "CAT_Custom_300770="+tags1,
success: function(data2) {
$('#results').append(data2);
},
dataFilter: function(data) {
return $(data).find('.queryResults')[0];
$('#results').append(data);
}
});
<div id="results"></div>
</code></pre>
<p>The code on the results page that I'm trying to load into the #results div is:</p>
<pre><code><div class="queryResults">(Results go here) </div>
</code></pre>
<p>The CMS adds a bunch of extra code like links to standard style sheets, body tags, etc.</p>
<p>What I'm trying to do is bring only the contents of the .queryResults div and load it into the #results div. </p>
<p>Any help is appreciated!</p>
| jquery | [5] |
3,993,592 | 3,993,593 | converting binary string into float | <p>I have an object that I am storing bits in. </p>
<pre><code>class Bitset:
def __init__(self, bitstring):
self.bitlist = []
for char in bitstring:
self.bitlist.append(int(char))
def flipBit(self, index):
val = self.bitlist[index]
val = (val + 1) % 2
self.bitlist[index] = val
self.newBitstring()
def bitstring(self):
newString = ''
for val in self.bitlist:
newString = newString + str(val)
return newString
def __len__(self):
return len(self.bitlist)
def __str__(self):
return self.bitstring()
def __repr__(self):
return self.bitstring()
</code></pre>
<p>Is there anyway I can convert the bits into a float? Thanks.</p>
| python | [7] |
3,526,689 | 3,526,690 | Need help parsing HTML with a regex in python | <pre><code>mystring = "<tr><td><span class='para'><b>Total Amount : </b>INR (Indian Rupees)
100.00</span></td></tr>"
</code></pre>
<p>My problem here is I have to search and get the total amount </p>
<pre><code>test = re.search("(Indian Rupees)(\d{2})(?:\D|$)", mystring)
</code></pre>
<p>but my test give me None.
How can I get the values and values can be 10.00, 100.00, 1000.00</p>
<p>Thanks</p>
| python | [7] |
287,749 | 287,750 | Convert .pdf to xml in php | <p>after googling a lot of time I still can not find a suitable answer how to convert .pdf to xml in php. Can some one help me to do this with some code or library?</p>
| php | [2] |
1,097,206 | 1,097,207 | sharing image for android | <p>Hi I want to share the image to mail, facebook, etc.. I can able to share the text to social media, but im unable to share the image. How shall i do share my image? my code is below: </p>
<pre><code>Intent sharingIntent = new Intent(Intent.ACTION_SEND);
Uri screenshotUri = Uri.parse("http://www.golfcourseranking.com/pics/1419630512.jpg");
sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);sharingIntent.setType("image/jpeg");
startActivity(Intent.createChooser(sharingIntent, "Share image using"));
</code></pre>
| android | [4] |
3,003,893 | 3,003,894 | dialogs and database | <p>When i click on a image button i want a dialog to appear which i need to populate with questions and answers from a database. I dunno were to start can anybody point me in the right direction?</p>
| android | [4] |
2,140,812 | 2,140,813 | Why my code not giving compile error? | <p>In the below code i am assigning data to final object .But not getting the compile error .</p>
<pre><code>class Name {
private String name;
public Name (String s) {
this.name = s;
}
public void setName(String s) {
this.name = s;
}
}
private void test (final Name n) {
n.setName("test");//here exception coming but not giving compile error
}
</code></pre>
| java | [1] |
2,331,119 | 2,331,120 | Declare array of Object, within the Object's constructor? | <p>If I have a class, MyClass, can I declare an array of MyClass on the heap, within the constructor of MyClass?</p>
<p>I can do this in C# but it doesnt seem to like it in C++?</p>
<p>I also get an error about no appropriate constructor for type MyClass??</p>
<pre><code>class MyClass
{
public:
MyClass(int);
private
MyClass* array;
};
MyClass::MyClass(int size){
array = new MyClass[size];
}
</code></pre>
| c++ | [6] |
3,600,754 | 3,600,755 | Get class object from object.toString in java | <p>I want to get the class object from the <code>object.toString</code> (without overriding the toString method in the class).</p>
<p>I know the reflection will give the object but it creates a new instance of the class which I don't want.</p>
| java | [1] |
4,181,178 | 4,181,179 | Trouble with implementing abstract super class Java | <p>I'm working on an assignment where I'm trying to implement a class that extends an abstract super class, but by using</p>
<pre><code> public class B extends A{}
</code></pre>
<p>However, that gives me the error that type B must implement the abstract method A.act, is there another way in which I can do this without using extends?</p>
<p>Using:</p>
<pre><code> public abstract class B extends A{}
</code></pre>
<p>Gives me a different error on another part of the assignment that should be correct.</p>
<p>What should I do? Thanks for the help.</p>
| java | [1] |
4,015,615 | 4,015,616 | onTouch return an InvalidCastException | <p>Im getting an InvalidCastException with this piece of code:</p>
<pre><code>public boolean onTouch(View view, MotionEvent event) {
if (!(view instanceof Card)) return false;
int eventaction = event.getAction();
Card card = (Card)view;
int X = (int)event.getRawX();
int Y = (int)event.getRawY();
switch (eventaction) {
case MotionEvent.ACTION_DOWN:
card.setAlpha(128);
card.bringToFront();
SoundManager.playSound(1, 1);
int rotation = (card.getRotation()-Card.ROTATION_HORIZONTAL) * -1;
card.setRotation(rotation);
break;
case MotionEvent.ACTION_MOVE:
card.setPosition(X - (card.getImage().getWidth()), Y - (card.getImage().getHeight()));
break;
case MotionEvent.ACTION_UP:
card.setAlpha(255);
SoundManager.playSound(2, 1);
break;
}
return true;
}
</code></pre>
<p>Class card extend ImageView, this code work perfect in RelativeLayout but not in a LinearLayout... there is any reason for that?</p>
| android | [4] |
4,687,270 | 4,687,271 | Using ASIHTTPRequest and json-framework on the iPhone | <p>I'm planning on using both these libraries (or wrappers?) in my upcoming iPhone app. I see one of the top reason applications get refused, is due to using private frameworks/API calls. Is ASIHTTPRequest and json-framework considered such, or can I safely use these? </p>
| iphone | [8] |
2,349,041 | 2,349,042 | HorizontalScrollView keep track of current selection | <p>I have a HorizontalScrollView that shows three dates at once and snaps to the date in the middle when you lift your finger. Currently the dates are saved in an LinkedList.</p>
<p>The list has to be dynamic, means that when I scroll to the right, it has to reload the next dates on the right and delete some of the dates on the left. The problem is, I don't know how to create a link between my LinkedList and the ScrollView.</p>
<p><a href="http://i.imgur.com/snrbk.png" rel="nofollow">Here is a link to how it looks</a></p>
<p>Its my first post, so please excuse me if I'm not specific enough.</p>
<p>EDIT: Okay, I found the answer: <a href="http://developer.android.com/reference/android/widget/Gallery.html" rel="nofollow">Gallery</a> offers exactly what I want.</p>
| android | [4] |
5,200,343 | 5,200,344 | C++ Object Class | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/6779645/use-of-this-keyword-in-c">Use of “this” keyword in C++</a> </p>
</blockquote>
<p>If I write these two C++ classes:</p>
<pre><code>class A
{
public:
const std::string getParam1()
{
return _param1;
}
void setParamA(std::string param1)
{
_param1=param1;
}
private:
std::string _param1;
std::string param2;
};
</code></pre>
<p>and </p>
<pre><code>class A
{
public:
const std::string getParam1()
{
return _param1;
}
void setParamA(std::string param1)
{
this->_param1=param1;
}
private:
std::string _param1;
std::string param2;
};
</code></pre>
<p>What is the difference between:</p>
<pre><code> void setParamA(std::string param1)
{
_param1=param1;
}
</code></pre>
<p>and </p>
<pre><code> void setParamA(std::string param1)
{
this->_param1=param1;
}
</code></pre>
<p>Thanks. </p>
| c++ | [6] |
4,339,819 | 4,339,820 | Automatically Restart PHP Script on Exit | <p>Is there a way I can automatically restart a PHP script whenever it exits, regardless of whether it has been exited properly, or has terminated due to an error, or maxed memory usage, etc.?</p>
| php | [2] |
3,171,255 | 3,171,256 | Converting video using php | <p>We can convert video file to .flv format by ffmpeg-php extension but how can we convert .flv to other format, i searched but no solution find...</p>
<pre><code>//ececute ffmpeg generate flv
exec('ffmpeg -i '.$uploadfile.' -f flv -s 320x240 '.$new_flv.'');
// But can we this, convert it to mpeg..
exec('ffmpeg -i '.$uploadfile.' -f mpg -s 320x240 '.$new_flv.'');
//execute ffmpeg and create thumb
exec('ffmpeg -i '.$uploadfile.' -f mjpeg -vframes 1 -s 150x150 -an '.$new_image_path.'');
</code></pre>
<p>Or, is there any php api like (ffmpeg) to do this....???</p>
| php | [2] |
2,597,995 | 2,597,996 | How do I use that "<<<HTML" thing in PHP? | <p>I know I shouldn't be outputting things directly in PHP, but using a template instead, but whatever.</p>
<p>I remember perl being able to do this, and as I reached for my perl book, I realized: I already packed it, as I'm moving. It's incredibly difficult to search for "<<<", as well. </p>
<p>So, I know I can go,</p>
<pre><code>echo <<<SOMESTUFF
blah
blah
blah
</code></pre>
<p>but other than that I'm at a loss... How do I end it? Where do I need semicolons?</p>
| php | [2] |
957,469 | 957,470 | adding a property to an EventArgs | <p>I have extended the standard FileSystemWatcher class by adding a string property (fileToTest), now i need to extend also the FileSystemEventArgs to add this property how can i do this ?</p>
<p>my extend FileSystemWatcher : </p>
<pre><code> class AleFileSystemWatcher : FileSystemWatcher
{
public string fileToTest { get; set; }
}
</code></pre>
<p>The FileSystemEventArgs fileToTest property should be the same of AleFileSystemWatcher fileToTest .</p>
<p>Can i do this ?</p>
| c# | [0] |
1,101,570 | 1,101,571 | Can functools.partial be used to bind arbitrary positional arguments? | <p>Suppose you want to define a <em>partial</em> setting the positional arguments in an arbitrary order, i.e. you want to apply <em>partial</em> to <em>str.split</em> fixing the 2nd and 3th arguments. The desired result is the same as:</p>
<pre><code>lambda s: str.rsplit(s, SEP, 1) # SEP given.
</code></pre>
<p>(I use <code>str.rsplit(s...</code> instead of <code>s.rsplit(...</code> to make the point more clear).</p>
<p>Some approximation using <em>functools.partial</em> is:</p>
<pre><code>partial(str.rsplit, sep=SEP, maxsplit=1) # SEP given
</code></pre>
<p>But <em>str.rsplit</em> doesn't use keyword arguments, only positional.</p>
<p>How to fix those arguments in partial?
Are the only choices lamda and wrappers?</p>
<p>wrappers are ugly if you want to define the function inline, like defining it for an argument wating for a function. <em>Lambda</em> is the <em>defacto</em> here, and <em>partial</em> is the other option, but it seems to lack in this case.</p>
| python | [7] |
19,787 | 19,788 | Python Random Number Generator Errors | <p>Hello I just started programming in Python and I was just trying to make a RNG but there are some errors that I don't understand.</p>
<p>Here's the code</p>
<pre><code>import random
import time
numbersGenerated = 0
print('Hello! How many numbers do you want?')
numbersNeeded = input()
print('What would you like the minimum for the numbers be?')
Min = input()
print('And the maximum?')
Max = input()
numbersNeeded = str(numbersNeeded)
numbersGenerated = str(numbersGenerated)
while numbersGenerated < numbersNeeded:
number = random.randint(Min, Max)
number = int(number)
numbersGenerated = numbersGenerated + 1
print(number)
print()
time.sleep(2)
print('All done. Hope to see you again!')
</code></pre>
<p>The Traceback Error says</p>
<pre><code>File "C:/Python32/Number_Generator.py", line 20, in <module>
number = random.randint(Min, Max)
File "C:\Python32\lib\random.py", line 215, in randint
return self.randrange(a, b+1)
TypeError: Can't convert 'int' object to str implicitly
</code></pre>
<p>I have changed lines thirteen and to int also but that didn't change the outcome.</p>
| python | [7] |
4,032,857 | 4,032,858 | java code to list mp3 files in the current directory matching with the letters typed then and there in a JTextField | <p>java code to list mp3 files in the current directory matching with the letters typed then and there in a JTextField....</p>
<pre><code> I am developing a small music player app in java...
For that i want code to list the files which are all matches with letters typed then and there in a textfield...
Example:If j is typed then files having start letter as j...
if je is typed then search result should be refined...
</code></pre>
| java | [1] |
485,924 | 485,925 | PrettyPrint python into a string, and not stdout | <p>I'd like to use prettyprint to print out a dictionary, but into a string and not to console.
This string is to be passed on to other functions.</p>
<p>I know I can use the "stream" parameter to specify a file instead of sys.out but I want a string.</p>
<p>How do I do that?</p>
| python | [7] |
5,269,544 | 5,269,545 | Title bar coming for some time in android | <p>When i use Alert Dialog along with this</p>
<pre><code>dialog.requestWindowFeature(Windows.FEATURE_NO_TITLE);
</code></pre>
<p>After using this ,the title bar comes for a few second and then vanishes.</p>
<p>How to handle this?</p>
| android | [4] |
2,145,773 | 2,145,774 | How to use strongly-typed like dictionary <string,Type> to associate a string to a class | <p>I want to create a dictionary to associate a string to a class for example:</p>
<pre><code>"dog" -> Dog class
"cat" -> Cat class
</code></pre>
<p>so I tried this</p>
<pre><code>public Dictionary<String, Type> dic = new Dictionary<String, Type>();
dic.Add("dog", Dog);
</code></pre>
<p>but Add doesn't accept <code>Dog</code>.</p>
<p>So what's the syntax ?</p>
| c# | [0] |
5,388,053 | 5,388,054 | Who calls the main function in java? | <pre><code>public static void main(String[] args)
{
boolean t=true;
System.out.println("Before return");
if(t) return;
System.out.println("not execute");
}
</code></pre>
<p>In the above code when the <code>return</code> is used then it should return to the function which calls the main function. Who exactly calls the <code>main</code> function?</p>
| java | [1] |
963,547 | 963,548 | Jquery onmouseover and onmouseout not appearing in IE and Chrome | <p>I'm trying to add a new div and input within JQuery, when i use the following code in Firefox it works</p>
<p>jQuery("bracket div closebracket", { "class": "wrapper", id: "product" + i, "onmouseover": "javascript:Highlight('product" + i + "');", "onmouseout": "javascript:Lowlight('product" + i + "');" })
.append(jQuery("", { type: "text", id: "name" + i }))
.append(jQuery("", { type: "text", id: "property" + i }))
.appendTo("#someContainer");</p>
<p>I can see the onmouseover and onmouseout within Firebug, when looking at IE and Chrome the mouse actions aren't there, does anyone know why they don't work and how i'll be able to get that working.</p>
<p>Thanks in advance</p>
| jquery | [5] |
2,518,918 | 2,518,919 | Retain form values after reloading the page by hyperlink click | <p>I'm trying to add paging functionality to a serch items page. so I have added a pager with <code>UL</code> as</p>
<pre><code>echo '<ul>';
for($i=1; $i<=$pageCount; $i++)
{
echo '<li><a href="' . $_SERVER['PHP_SELF'] . '?page=' . $i . '">' . $i . '</a>';
}
echo '</ul>';
</code></pre>
<p>When I click on a Page No in Pager, I can get the page number clicked on by</p>
<pre><code>if (isset($_GET['page']))
{
$pageNo = $_GET['page'];
}
</code></pre>
<p>but I can not retain the text enterd by the user to serach items. I tried <code>$_POST['txtSearchText']</code> but it does not retain the value after the page refreshed.</p>
<p>Is there a way to retain the from values (without using session) after self loading the page by hyperlink click?</p>
| php | [2] |
3,937,074 | 3,937,075 | how to set value for <select> tag | <p>Using Php I have wrote the drop down list box code.
for Edit employee details I have used the same code and I tried to set the value on list box but the value is not set. how to do this.</p>
<pre><code>Employee Name: <select name=emp_name *$value='$name'*>
<option> -- EMPLOYEE NAME -- </option>
<?
while ($q->fetchInto($row)){
print "<option>$row[0]</option>";
}
?>
</select>
</code></pre>
| php | [2] |
1,317,773 | 1,317,774 | Checking if $_POST variable is populated | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3496971/check-if-post-exists">Check if $_POST exists</a> </p>
</blockquote>
<p>I'm trying to run something if and only if a $_POST var is populated.</p>
<p>Can I do <code>if(empty($_POST[...])) { ... }</code>? Or should I go about this another way?</p>
| php | [2] |
2,296,823 | 2,296,824 | Mapping Entire Drive Into A Tree View | <p>I need help on how to map my drives into a tree view. I can get my drives to show but I can not get all the sub directories. I would like to get my entire drive mapped out into a tree view. Any help would be appreciated. This is what I got so far.</p>
<pre><code> string[] drives = Environment.GetLogicalDrives();
foreach (string dr in drives)
{
TreeNode node = new TreeNode(dr);
node.Tag = dr;
treeView1.Nodes.Add(node);
}
treeView1.CollapseAll();
</code></pre>
| c# | [0] |
3,889,629 | 3,889,630 | Undefined function | <p>Just a simple problem for most of you i'm sure.
I have a function addTeamFixtures and it calls on a function flip.</p>
<p>That function is defined later in the script.
But I don't think it is happy with that.</p>
<p>The code where it calls the function:</p>
<pre><code> $rounds[$round][0] = flip($rounds[$round][0]);
</code></pre>
<p>Any ideas?</p>
<p>More code.....</p>
<pre><code> //function to flip rounds over
function flip($match)
{
$components = split('v', $match);
return $components[1] . "v" . $components[0];
}
</code></pre>
<p>This is the function flip, and then I have a function which has the above code inside?
Am i missing something?</p>
| php | [2] |
2,515,330 | 2,515,331 | ASP.NET Encryption HEX Characters | <p>What can be done to this code to make the Encryption in HEX rather than ASCII?</p>
<p>Encryption:</p>
<pre><code>Public Function EncryptAES(ByVal sIn As String, ByVal sKey As String) As String
Dim AES As New RijndaelManaged
Dim ahashMD5 As New MD5CryptoServiceProvider()
AES.Key = ahashMD5.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(sKey))
AES.Mode = CipherMode.ECB
Dim AESEncrypt As ICryptoTransform = AES.CreateEncryptor()
Dim aBuffer As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(sIn)
Return Convert.ToBase64String(AESEncrypt.TransformFinalBlock(aBuffer, 0, aBuffer.Length))
End Function
</code></pre>
<p>Decryption:</p>
<pre><code>Public Function DecryptAES(ByVal sOut As String, ByVal sKey As String) As String
Dim dAES As New RijndaelManaged
Dim dahashMD5 As New MD5CryptoServiceProvider()
dAES.Key = dahashMD5.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(sKey))
dAES.Mode = CipherMode.ECB
Dim dAESDecrypt As ICryptoTransform = dAES.CreateDecryptor()
sOut = Replace(sOut, " ", "+", 1, -1, CompareMethod.Text)
Dim daBuffer As Byte() = Convert.FromBase64String(sOut)
Return System.Text.ASCIIEncoding.ASCII.GetString(dAESDecrypt.TransformFinalBlock(daBuffer, 0, daBuffer.Length))
End Function
</code></pre>
| asp.net | [9] |
474,630 | 474,631 | server sends file to clients java | <p>I have a server and multiple clients and i am trying to make the server-thread send a file to the all connected clients at the same time.The weird thing is,sometimes the files are written correctly and sometimes the laptop makes noise and the files are written in the console and no files are created.I don`t do any changes in the code between the trials.Could anyone help me about that? Thanks in advance.Here is the sending server-thread code</p>
<pre><code>try
{
out.println("AcceptFile,");
FileInputStream fis = new FileInputStream(fn);
byte[] buffer = new byte[fis.available()];
fis.read(buffer);
ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream()) ;
oos.writeObject(buffer);
oos.flush();
}
catch(Exception c)
{
System.err.println("exc" + c);
}
</code></pre>
<p>Here is the Client-thread receiving</p>
<pre><code>try
{
ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
byte[] buffer = (byte[])ois.readObject();
String pic="copy"+studId+".pdf";
System.out.println(pic);
FileOutputStream fos = new FileOutputStream(pic);
fos.write(buffer);
fos.flush();
fos.close();
}
catch(Exception e)
{
System.out.println("Exception writing");
}
</code></pre>
| java | [1] |
3,249,183 | 3,249,184 | customer strange exception from google play | <p>i have received that exception:</p>
<pre><code>java.lang.NullPointerException
at com.callsfreecalls.android.SmsSend$4.onClick(SmsSend.java:179)
at android.view.View.performClick(View.java:3538)
at android.view.View$PerformClick.run(View.java:14330)
at android.os.Handler.handleCallback(Handler.java:608)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:4987)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
</code></pre>
<p>for that peace of code:</p>
<pre><code>editSmsText = (EditText) findViewById(R.id.editSmsText);
editSmsText.setOnKeyListener(new OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
// If the event is a key-down event on the "enter" button
if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // <- this is line 179
// Perform action on key press
//adapter.add(new OneComment(false, editSmsText.getText().toString()));
//editSmsText.setText("");
return true;
}
return false;
}
});
private EditText editSmsText;
</code></pre>
<p>any suggestion? push editSmsText to static?</p>
| android | [4] |
4,731,197 | 4,731,198 | NSBundle pathForResource method | <pre><code>NSURL *modelURL1 = [[NSBundle mainBundle] URLForResource:@"MyTest" withExtension:@"momd"];
NSLog(@"%@", [modelURL1 absoluteURL]);
NSString *path = [[NSBundle mainBundle] pathForResource:@"MyTest" ofType:@"momd"];
NSURL *modelURL = [NSURL URLWithString:path];
NSLog(@"%@", [modelURL absoluteURL]);
</code></pre>
<p>The first line is generated by XCode when I use Core Data, but it does not work because the method doesn't work prior to iOS 4. So I need another method, I thought I could use the second one but it returns nil...Why does it not work?</p>
<p>Thanks</p>
| iphone | [8] |
2,788,363 | 2,788,364 | jquery-plugin datepicker does not work when cloned | <p>I have a following codes (markup and javascript) in which each block of 2 text boxes are cloned. Each block contains 2 text box; one with normal text box; the other is text box (id of "textboxDueDate") with datepicker plug in associating with. Only the first/original works with popup calendar when user clicks inside it. However, cloned "textboxDueDate" text boxes does not have popup calendar showed when they are clicked inside. What are wrong with my codes?</p>
<pre><code> <div>
<input type="button" id="buttonAddBookTrack" value="Add Another Book Track" />
</div>
<div id="divTemplate">
<fieldset>
<legend>Book</legend>
<div>
<label>Book ISBN: </label>
<input type="text" />
</div>
<div>
<label>Due Date: </label>
<input type="text" id="textboxDueDate" />
</div>
</fieldset>
</div>
<div id="divOtherBooks"></div>
<!-- java script ---->
<script type="text/javascript">
var _idCount = 1;
$(document).ready(function () {
$('input[id^=textboxDueDate]').datepicker();
$('#buttonAddBookTrack').click(function () {
var appendedDiv = $('<div>').appendTo('#divOtherBooks').data('divClonedTemplate', '_' + _idCount);
$('#divTemplate').children().clone().appendTo(appendedDiv);
$('input[id^=textboxDueDate]').not('.hasDatePicker').datepicker();
_idCount++;
});
});
</script>
</code></pre>
| jquery | [5] |
2,763,794 | 2,763,795 | Checking if you can log into an email account using php? | <p>I am writing a bit more at the top in an effort to get it to post. Skip this and read on: </p>
<p>I am writing a script that tests user's e-mail accouns. For example, the user might provide an e-mail address such as: johnny@bla.com. For the purpose of this exercise, I know that the domain name will be: mail.domain.com. So, in this case, mail.bla.com. The password is provided by the user, because they enter it to test the account.</p>
<p>I need to know:</p>
<ul>
<li>If the user entered an incorrect password</li>
<li>If they could reach the server</li>
</ul>
<p>It must just be able to check POP email accounts.</p>
| php | [2] |
1,151,197 | 1,151,198 | Change LayoutParams of LinearLayout that is inside of RelativeLayout | <p>I have LinearLayout inside of RelativeLayout. I would like to change height of LinearLayout programmatically. I have tried do this with LinearLayout.LayoutParams but I've got an exception. How to solve this problem? Thanks.</p>
| android | [4] |
1,958,511 | 1,958,512 | Keypress event on jquery datatables paginate buttons | <p>I am using jquery datatables in my application.I have pagination type as "full_numbers".Now i want to add kepress event on these buttons i.e when an user press 'enter key' upon focusing on the button , should open respective page.</p>
<pre><code>$('.paginate_button, .paginate_active').live('keydown', function(e) { if(e.which == 13) { $(that.el).dataTable().fnPageChange("next"); } });
</code></pre>
<p>Please guide on this.</p>
| jquery | [5] |
3,070,298 | 3,070,299 | how to check if all elements on subvalue of array is equal to a value | <pre><code>Array
(
[0] => Array
(
[id] => 10
[on] => 2
)
[1] => Array
(
[id] => 15
[on] => 2
)
[2] => Array
(
[id] => 20
[on] => 2
)
)
</code></pre>
<p>I would like the following:</p>
<ol>
<li><p>if <code>[on]=>2</code> on all the sub-array, return <strong>$result = 2</strong> </p></li>
<li><p>if one of the sub-array has <code>[on]=>1</code>, return <strong>$result = 1</strong></p></li>
</ol>
<p>Can anyone help me? Thanks!</p>
<p>Have tried this, but it doesn't correct for the 1st requirment</p>
<pre><code>foreach($arr as $key=>$val){
if(in_array(2, $val)){
$result = 2;
}else if(in_array(1, $val)){
$result = 1;
}
}
</code></pre>
| php | [2] |
1,696,924 | 1,696,925 | getting error like ur view controller and nib file | <p>i have observed 1 warning when i am opening my nib file ,but that doesnt effected my out put ..
i want to to know what causes this error
its showing ' View Controller' has both its 'View' and 'NIB Name' properties set. This configuration is not supported.</p>
| iphone | [8] |
1,365,782 | 1,365,783 | jquery array confusion | <p>Here's the code that I want to modify:</p>
<pre><code>a[href*="google"]
</code></pre>
<p>Now what I want to do is to add multiple keywords such as google, yahoo, etc.
I tried doing like this and this worked fine:</p>
<pre><code>a[href*="google"],[href*="yahoo"]
</code></pre>
<p>But now I'm trying to get data from array, e.g:</p>
<pre><code>var array = ["google",yahoo","etc"]
</code></pre>
<p>What should I write now? Confused with the code. :(</p>
<p>These aren't working:</p>
<pre><code>1. a[href*=array]
2. a[href*=[array]]
</code></pre>
| jquery | [5] |
2,710,272 | 2,710,273 | Cannot modify header information - headers already sent by in php code | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/8028957/warning-headers-already-sent-in-php">“Warning: Headers already sent” in PHP</a> </p>
</blockquote>
<p>i creat web service for iphone app so that i write some code that fetch data from database and give output in form of XML,but data comes from database with warning " Cannot modify header information - headers already sent by (output started at /home/content/s/o/u/soulcachaca/html/apc.php:1) in /home/content/s/o/u/soulcachaca/html/apc.php on line 3"</p>
<p>i also use <code>ob_start();</code> and <code>ob_end_flush()</code>.</p>
<p>why this error comes ?
somebody give me proper solution to remove this from my code?</p>
| php | [2] |
3,897,515 | 3,897,516 | Filling selection boxes from INI file | <p>The code:</p>
<pre><code>$INIFile = parse_ini_file('config.ini');
echo '<center><form method="POST" action=""><br /><table class="specialtable">';
echo '<tr><td><font face="Verdana" color="white">Status:&nbsp;</font></td><td><select name="Status">
<option value="0">Offline</option>
<option value="1">Online</option>
</select></td></tr>';
</code></pre>
<p>The .ini file:</p>
<pre><code>Status = 1
</code></pre>
<p>This is the code I have. How can I make it so the first option will be read from the the .ini file?</p>
<p>Thanks in advance.</p>
<p>This is an example of what needs to be done, except that it does not work. Serves as an example:</p>
<pre><code>echo '<center><form method="POST" action=""><br /><table class="specialtable">';
echo '<tr><td><font face="Verdana" color="white">Status:&nbsp;</font></td><td><select name="Status">
switch('.$INIFile["Status"].')
{
case 0: <option value="0">Off</option>; break;
case 1: <option value="1">On</option>; break;
}
<option value="0">Offline</option>
<option value="1">Online</option>
</select></td></tr>';
</code></pre>
| php | [2] |
2,341,199 | 2,341,200 | How do I tell the index of my subdomain to call the entire contents of the root directory in the index.php file of my sub-directory? | <p>I am fairly new to php but I have an index file in my root directory where I define some php variables and call the "header.php" file which contains my site content. </p>
<p>Here is the structure. </p>
<p>I have two domains</p>
<p><strong>mysite.com</strong> -> references the root folder, the index file (which contains my dynamic variables) calls header.php using php includes which loads images, css, and content</p>
<p><strong>domain1.mysite.com</strong> -> references a sub-directory titled "domain1". In domain1 I have an index file with seperately defined variables and I would like to call the SAME header and content that mysite is calling in the root directory. However, because I am calling it from a sub-directory, it does not load images or CSS.</p>
<p>I think this is a simple fix, but how do I tell the index of my subdomain to call the entire contents of the root directory in the index.php file of my sub-directory?</p>
| php | [2] |
4,096,291 | 4,096,292 | using AND/OR in if else PHP statement | <p>how do you use 'AND/OR' in an if else PHP statement? would it be:</p>
<p>1) AND</p>
<pre><code>if ($status = 'clear' AND $pRent == 0) {
mysql_query("UPDATE rent
SET dNo = '$id',
status = 'clear',
colour = '#3C0'
WHERE rent.id = $id");
}
</code></pre>
<p>2) OR</p>
<pre><code>if ($status = 'clear' OR $pRent == 0) {
mysql_query("UPDATE rent
SET dNo = '$id',
status = 'clear',
colour = '#3C0'
WHERE rent.id = $id");
}
</code></pre>
<p>many thanks in advance!</p>
| php | [2] |
4,920,665 | 4,920,666 | PHP Links/Resources | <p>I am building a PHP competency for the company I work for and I wanted to get everyone's opinion on the best resources for PHP (articles, tutorials, etc.).</p>
| php | [2] |
5,911,847 | 5,911,848 | How to add Payment functionality in Shopping Cart | <p>I have got E commerce web site in asp.net. I have added shopping cart using Datalist, shopping cart functionality running fine now I want to add payment functionality. </p>
| asp.net | [9] |
1,035,698 | 1,035,699 | Python check if list of keys exist in dictionary | <p>I have a dictionary that looks like that:</p>
<pre><code>grades = {
'alex' : 11,
'bob' : 10,
'john' : 14,
'peter': 7
}
</code></pre>
<p>and a list of names <code>students = ('alex', 'john')</code></p>
<p>I need to check that all the names in <code>students</code> exist as keys in <code>grades</code> dict.</p>
<p><code>grades</code> can have more names, but all the names in <code>students</code> should be in <code>grades</code></p>
<p>There must be a straightforward way to do it, but i'm still new to python and can't figure it out. tried <code>if students in grades</code>, didn't work.</p>
<p>In the actual cases, the lists will be much bigger.</p>
<p>thanks</p>
| python | [7] |
856,093 | 856,094 | Is there a virtual machine for javascript? | <p>Is there a virtual machine for javascript?</p>
| javascript | [3] |
4,045,821 | 4,045,822 | Jquery to test if $(this) does not have a specific class | <pre><code>if ($(this).hasClass('white')) {console.log('white');};
</code></pre>
<p>equates to true and prints to the console. How do I test if it does not have the class <code>white</code> on the $(this) selector? I have </p>
<pre><code>if ($('this:not(.white)')) {console.log('not white');};
and
if ($(this).not('.white')) {console.log('not white');};
and
several other combinations?
</code></pre>
<p>I know I likely should use the .not() method, and can't figure out how to use the :not selector in combination with the <code>$(this)</code> selector. </p>
<p>I would like that when the element is clicked, that I can see one true and one false statement. (it either does or doesn't have the class 'white') </p>
| jquery | [5] |
2,510,234 | 2,510,235 | Strings split in javascript? | <p>i am using my_colors.split(" ") method, but i want to split or divide string in fixed number of words e.g each split occurs after 10 words or so ...how to do this in javascript?</p>
| javascript | [3] |
1,087,524 | 1,087,525 | Php Textarea Can't Include textarea value, please help me :) | <p>please help, some days I searched and did not find ?</p>
<p>i have " test.php "</p>
<pre><code><html>
<body>
<form>
<input type="text" Name="">
<textarea name=""></textarea>
<input type="submit" value="help me">
</form>
</body>
<html>
</code></pre>
<p>and "index.php "</p>
<pre><code><html>
<body>
<?php
$test = "test.php";
?>
<textarea name=""><?php readfile($test ); ?></textare>
</body>
</html>
</code></pre>
<p>my problem,
why the submit button is outside the textarea ?
and not read it as a string or value?</p>
<p>Thanks :)</p>
| php | [2] |
3,526,017 | 3,526,018 | How to compare date and year? | <p>i am implementing one graph related app.</p>
<p>In that when application start i am getting present month,present year from calende and display on the screen with graph. like April 2012 and graph</p>
<p>ok that is fine.</p>
<p>In my screen i have two buttons like preview,next.</p>
<p>when user clicks preview ,i want to change April 2012 to March 2012,Fib 2012 ..........</p>
<p>And when user clicks next button,i want to change April 2012 to May 2012.....</p>
<p>How i will do these type of comparigens.</p>
<p>If any one know please help me.</p>
<p>Thanks in advance</p>
| android | [4] |
3,421,817 | 3,421,818 | store a transaction from apache php server into greentree system | <p>A client wants me to store user transactions in their greentree accounting package from a separate Apache server using PHP. Has anyone done this and can someone please point me in the right direction?</p>
| php | [2] |
2,250,310 | 2,250,311 | Android Linearlayout rotate? | <p>I need to rotate the linearlayout with it's child view's. Now I am using android 2.2 but in Android 3.0 has a rotate option.If we set the rotation degree we can get the rotated view. </p>
<blockquote>
<p>setRotation(float rotation)</p>
</blockquote>
<p>I need to rotate my view by using android 2.2. How to do this in android 2.2 .Can any one suggest me to do .... !!</p>
<p>Note: I need to rotate the view relevant to it's touch position</p>
| android | [4] |
5,399,284 | 5,399,285 | Find a Location on the map Via latitude and longitude in ASP.NET | <p>I have many latitude and longitude data in my database, I want to use these data to find locations on the map in street view in my website that has developed by ASP.NET. I want to find component for ASP.NET that when I extract these data from database, these component have ability to use them and show the locations. So I looking back from you to guide me.
Thanks All+</p>
| asp.net | [9] |
2,994,184 | 2,994,185 | What are the different ways of consuming A WEB SERVICE | <p>Can you please explain what are the different ways of consuming aws?
eg:we can consume a web service through http query
also using API 's.
is there any other ways to consume a web service other than this?</p>
| java | [1] |
1,964,044 | 1,964,045 | Access php function from different pages | <p>I wrote a php function earlier today, and the funtion is being used by several pages on my website. It would be pretty good if I only had to have the function in one place, so that i don´t have to edit the function on every page if i want to make an adjustment.</p>
<p>I tried puting the function on an own page, and then I used include() to access it, but it didn´t work. Is there any way to do what I want to do?</p>
| php | [2] |
1,362,238 | 1,362,239 | Efficient swap method for a derived class | <p>Here is a code fragment that speaks for itself. Thank you!</p>
<pre><code>class Foo : private std::vector<int>
{
public:
void swap(Foo& x)
{
std::swap(bar, x.bar);
// what goes here?
}
private:
int bar;
};
</code></pre>
| c++ | [6] |
3,284,431 | 3,284,432 | How to find the path of Database file in Android Emulator? | <p>I am executing some sqlite query in the Android emulator. I want to know which path that database files are storing. Pls give me some idea how to find it. If u can provide me some code snippet.</p>
<p>urs,
s.kumaran.</p>
| android | [4] |
3,943,787 | 3,943,788 | Output using innerHTML | <p>I need to output the contents of a Javascript variable which has html code in it:</p>
<pre><code>var jsVar = '<div>
<p> Sample text </p>
<img src="some image.jpg" alt="" />
<div>';
</code></pre>
<p>I want to add it to an object on the page using innerHTML. How do I do it ?</p>
| javascript | [3] |
4,307,186 | 4,307,187 | Can't get winsound.Beep to work | <p>I am trying to make some <code>Beep</code> noises with the <code>winsound.Beep</code> command. However when I am using <code>winsound.Beep(500, 500)</code> I do not hear anything. With <code>winsound.MessageBeep</code> and <code>winsound.PlaySound</code> however, I DO get to play sounds. Any ideas what I should do?</p>
<p>What I am trying to do: I want to write a little practicing program for training intervals: the computer sounds a first tone, then a second tone and you will have to guess what the tone interval is. For this I need pitched tones, tones for which I can set the frequency. I want to keep it as simple as possible, any pitched sound will do. I do not want to have to collect a set of .wav files or whatever. I want to make use of a tone generator which I think is available on most soundcards. winsound.Beep seems like something that can do this trick, but any other suggestions are welcome.</p>
| python | [7] |
1,152,897 | 1,152,898 | Javascript difference between functions within an object | <p>What is the difference between functions within an object. I have 2 examples which basically do the same thing.</p>
<pre><code>function a(param) {
function b(input) {
return input%10;
};
return 'The result is ' + b(param);
};
</code></pre>
<p>and</p>
<pre><code>function a(param) {
this.b=function(input) {
return input%10;
};
return 'The result is ' + this.b(param);
};
</code></pre>
<p>What is the advantage and the disadvatages in both cases? In the second i know that that function can be called from outside the main function.
Is there also a difference when running it? (like time and performance)</p>
| javascript | [3] |
4,675,587 | 4,675,588 | Python approach to dataset manipulation | <p>Folks, we have the following problem: we've got several objects containing table data that look something like this:</p>
<p><code>{'field1':'value1','field2':'value2', ...}</code></p>
<p>At some point during runtime we need to "select" data from these objects (tables) in the same way one were to query a DB (i.e. get records in this set that matches field1 == some_value and field2==some_other_value). We don't have access to the original RDBMS or db views. We fiddled with the idea of using an intermediary DB (like sqlite) and then query it for the data as needed. </p>
<p>But it felt "smelly" to add another moving part to the app just for dataset querying purposes. So, my question is: is there a pythonic way to approach this? Should we bite the bullet and push the data to a DB, query the DB, then delete? Thanks in advance for your opinion and input.</p>
<p>The data is a list of dictionaries.</p>
| python | [7] |
3,340,080 | 3,340,081 | Access to key/values pairs of HashMaps within an Object[] | <p>I have an Object[] which entails lots of Objects of the type HashMap. The HashMap looks like this:</p>
<pre><code>Object[]
{id=15, name=Hello}
{id=27, name=Hello}
{id=15, name=Hello}
</code></pre>
<p>I have tried to cast it to HashMap[], however no luck.</p>
<p>I would like to iterate and retrieve a list of names. Hope you can help me.</p>
| java | [1] |
689,196 | 689,197 | Is this code calling a constructor that doesn't exist? | <p>Perhaps this is a basic misunderstanding, but the following line is confusing to me: </p>
<pre><code>return *static_cast<MockBehavior*>(COMPOSITE::m_Children[index]);
</code></pre>
<p>What exactly is this line doing?</p>
| c++ | [6] |
66,420 | 66,421 | iphone dev getting video thumbnail (frame) from MPMoviePlayerController | <p>every one i am trying to get the video frame or thumbnail from a video url but not succeeding in it, here is my code</p>
<pre><code>- (void)viewDidLoad {
thumbnailimg = [[UIImageView alloc]init];
movie = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://www.youtube.com/watch?v=ec9KXrpYvzk"]];
//UIImage *singleFrameImage = [movie thumbnailImageAtTime:10
//timeOption:MPMovieTimeOptionExact];
//thumbnailimg.image = singleFrameImage;
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self selector:@selector(handleThumbnailImageRequestFinishNotification:)
name:MPMoviePlayerThumbnailImageRequestDidFinishNotification
object:movie];
NSNumber * time =[NSNumber numberWithInt:10];
NSArray *times = [NSArray arrayWithObjects:time,nil];
[movie requestThumbnailImagesAtTimes:times timeOption:MPMovieTimeOptionExact];
[super viewDidLoad];
}
-(void)handleThumbnailImageRequestFinishNotification:(NSNotification*)note
{
NSDictionary *userinfo = [note userInfo];
NSMutableDictionary *event = [NSMutableDictionary dictionary];
NSError* value = [userinfo objectForKey:MPMoviePlayerThumbnailErrorKey];
if (value!=nil)
{
[event setObject:[value description] forKey:@"error"];
}
else
{
UIImage *image = [userinfo valueForKey:MPMoviePlayerThumbnailImageKey];
thumbnailimg.image = image;
}
[event setObject:[userinfo valueForKey:MPMoviePlayerThumbnailTimeKey] forKey:@"time"];
}
</code></pre>
<p>even the handleThumbnailImageRequestFinishNotification is not firing, plz. tell me what i am doing wrong and how to correct it, thanx in advance, Regards Saad</p>
| iphone | [8] |
4,192,642 | 4,192,643 | when does getclassloader return null when using digest.getClassloader | <p>I am having a this problem while using commons digester.</p>
<p>I have the jar in classpath set in my eclise.</p>
<p>Here is the code snippet.</p>
<pre><code>Digester digester = new Digester();
System.out.println(digester.getClassLoader());
</code></pre>
<p>The above path returns me null in my machine whereas the same project with similar build path in another machine returns the classoader object.</p>
| java | [1] |
5,614,597 | 5,614,598 | How to make Quick news bar reading char by char | <p>Hey,
I see in almost news websites bar called quick news and its appear and reading character by character like this site <a href="http://www.filgoal.com/English/DefaultDynamic.aspx" rel="nofollow">http://www.filgoal.com/English/DefaultDynamic.aspx</a> in the latest news section under menus.
i hope if any one can help me to know how it works or give me a sample for that.
thanks,</p>
| javascript | [3] |
5,168,228 | 5,168,229 | Reusing a TableRow | <p>In order to save time when a TableLayout is populated (with repetitive data), I want to reuse TableRows. However when I try to reuse them, I get the following error:</p>
<pre><code>java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
</code></pre>
<p>I am storing the TableRows in an ArrayList. I then store the ArrayList in a Hashtable. This is how I am populating the ArrayList and Hashtable:</p>
<pre><code>ArrayList<TableRow> tableRowAl = AcmSinglton.rowHash.get(this.cfr);
// if ArrayList is null, populate the ArrayList with the TableRows
if (tableRowAl == null){
NodeList nodeList = (NodeList) xpath.evaluate(this.xpath, xmlSource, XPathConstants.NODESET);
for(int i=0; i<nodeList.getLength(); i++){
TableRow tr = new TableRow(this.activity);
tr.removeAllViews();
tr.setId(i);
TextView tv = new TextView(this.activity);
Element chapElement = (Element) nodeList.item(i);
tv.setText(chapElement.getAttribute(this.attribute));
tr.addView(tv);
rowsAl.add(tr);
}
// put the ArrayList<TableRow> into the hashtable for reuse
AcmSinglton.rowHash.put(this.cfr, rowsAl);
}else{
// Resuse the TableRows
this.rowsAl.addAll(tableRowAl);
}
</code></pre>
<p>When I try to add the TableRow to the tableLayout, I get the error:</p>
<pre><code>ArrayList<TableRow> al = new ArrayList<TableRow>();
// get the Arraylist
al = xmlloaded.getRowsAl();
for (int x=0; x < al.size(); x++){
TableRow tableRow = new TableRow(this);
tableRow = al.get(x);
View child = tableRow.getChildAt(0);
final TextView tx = (TextView)child;
// I get the error here when I try to add the TableRow
tableView.addView(tableRow);
}
</code></pre>
<p>Thanks for the help.</p>
| android | [4] |
5,356,029 | 5,356,030 | Store complete php object in mysql, mongo, or other database | <p>I need to be able to temporarily store a complete PHP object (containing some data and methods) somewhere... we use MySQL already but I'm open to other solutions if they work better.</p>
<p>Essentially, I can't use serialize because we lose the methods and I'd rather not save the data, and then create a new instance of the object every time I want to use it.</p>
<p>What's the best way for storing a complete php object for later use (needs to be saved to memory, using session not ok if user disconnects).</p>
| php | [2] |
5,716,151 | 5,716,152 | Problem in String camparisson ...! | <p>here is my code :</p>
<pre><code>NSUInteger f;
for (f = 0; f < [appDelegate.books count]; f++) {
check = [appDelegate.books objectAtIndex:f];
checkthis = check.LotteryNumber;
mystring = check.LotteryNumber;
NSLog(@"Dynamic Value: %@",mystring);
NSLog(@"Static Value: %@",checkthis);
if (checkthis == mystring) {
found = YES;
break;
}
printf("In LOOP");
}
if ( found ) {
// do found
NSLog(@"Found");
} else {
// do not found
NSLog(@"not Found");
}
//if (checkthis == mystring) {
</code></pre>
<p>in above line if i place checkthis on both side , its working , but when i am taking a dynamic value its not working..
i also tried like this </p>
<pre><code>if(checthis isEqualToString mystring)
</code></pre>
<p>same problem here ....</p>
<p>Thanks in advance</p>
| iphone | [8] |
1,121,382 | 1,121,383 | jquery: unbind mouseenter and leave won't work | <p>i have a tabbed view and when i hover above unselected tabs i give it the same style as a selected tab. the problem is that when i click it i can't seem to unbind the enter and leave events.</p>
<pre><code>function DocReady() {
$("." + TAB_OFF_CLASS).click(changeCategory);
$("." + TAB_OFF_CLASS).mouseenter(onCategoryOver);
$("." + TAB_OFF_CLASS).mouseleave(onCategoryOut);
}
function onCategoryOver() {
$(this).removeClass(TAB_OFF_CLASS).addClass(TAB_ON_CLASS);
}
function onCategoryOut() {
$(this).removeClass(TAB_ON_CLASS).addClass(TAB_OFF_CLASS);
}
function changeCategory() {
var catTab = $(this);
var catName = catTab.find('#catName').html();
var id = catTab.attr('categoryID');
catTab.unbind('click');
catTab.unbind('mouseenter', onCategoryOver);
catTab.unbind('mouseleave', onCategoryOut);
catTab.removeClass(TAB_OFF_CLASS).addClass(TAB_ON_CLASS);
...
</code></pre>
<p>}</p>
<p>as you can u see i also tried to bind it again to an empty function doesn't work either.
update: the unbind works only when i click the tab and stay over it until the code finishes. but if i click and pull out it doesn't. i guess it's because the mouseleave event fires in the middle of the click handler. anyone...?</p>
| jquery | [5] |
1,057,070 | 1,057,071 | Taking item from string array that *might* be there | <p>I have a string array, and it may contain an element with the text "mytext" within the string. eg:</p>
<pre><code>mystringarray
{
[0] => "hello world";
[1] => "some of mytext";
}
</code></pre>
<p>I also have an array that doesn't have the mytext text in it.</p>
<pre><code>mystringarray
{
[0] => "hello world";
[1] => "some of notmy";
}
</code></pre>
<p>My problem is when I use:</p>
<pre><code>string mytextdata = mystringarray.Single<string>(t => t.Contains("mytext")).ToString();
</code></pre>
<p>I get an exception for the second array as it can't find an element that matches the expression.</p>
<p>Is there a quick way I can edit this one line to not throw an exception if it finds nothing, and instead just ignore? I have a lot of these lines and I don't want to have to wrap each in an if statement.</p>
<p>Apologies if question isn't clear.</p>
| c# | [0] |
4,041,417 | 4,041,418 | Facing problem while importing project into the workspace | <p>I had the same issue before and tried many ways to slove it. Now it is working fine with importing project. Now am facing some related issue that is, there are some apiDemos in the plugin with my friend. I have copied it and tried to import it into the workspace but here is the same problem again showing that it has some or the other error in every line.</p>
<p>And this is the screen shot of how the error look in every line. Can anyone help in this case.</p>
<p><img src="http://i.stack.imgur.com/uJWD1.png" alt="Screenshot"></p>
| android | [4] |
1,314,616 | 1,314,617 | Remember form value when return back to submit due to some error | <p>After filling the form when submit, accidentally due to some filling error ,the form is not submit and return to back,in this condition the value of all text box is blank. i want to stable value of all fields in this condition . I'm using php with smarty framework. Please reply with solution as soon as possible.</p>
<p>Thanks.</p>
| php | [2] |
5,800,965 | 5,800,966 | check if primary key exist | <p>I have tried posting this earlier and had to delete it because the code editor did not post it correctly and incompletely. plus I had a member ask me about SQL injection. </p>
<p>Here's the story:</p>
<p>I have a page where the user can check his information before it is submitted to the database. All I want to do is look to see if that primary key is present before I submit it to avoid getting a server error. </p>
<p>In my page load event I have the following:</p>
<pre><code>SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString1"].ConnectionString);
SqlCommand oldcmd = new SqlCommand("SELECT * from dbo.registrar WHERE [MY ID] = '"+ID+"'", conn);
oldcmd.CommandType = CommandType.Text;
SqlDataAdapter da = new SqlDataAdapter(oldcmd);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count >= 1)
{
lblExists.Visible = true;
lblExists.ForeColor = System.Drawing.Color.Red;
lblExists.Text = "Oops! Our records show that you have already signed up for this service. Please check your information or contact your administrator for further assistance.";
}
</code></pre>
<p>The label fires even though there is no record in the database which tells me that I am doing it wrong.</p>
| c# | [0] |
1,352,349 | 1,352,350 | Gedit / External tools - IDLE | <p>I am trying to edit a file using GEDIT and have it open with IDLE. It works with these two lines in the external tools option -</p>
<pre><code>#!/bin/sh
idle -r $GEDIT_CURRENT_DOCUMENT_NAME
</code></pre>
<p>The problem is that a new instance of IDLE opens up every time I run it. Is there a way to just update the IDLE session? </p>
<p>Thanks in advance,</p>
| python | [7] |
653,099 | 653,100 | Beginner's Mistake | <p>I know this is probably a dumb question but I am a beginner and I just started learning today. I am using Dev C++ and I wrote my first code:</p>
<pre><code>#include <iostream>
using namespace std;
int main()
{
cout << "Hello World" ;
return 0;
}
</code></pre>
<p>I click to compile and run. Nothing comes up. Then I click just "run" and it said it is not compiled yet. </p>
<p>I think there might be errors and I would have gladly fixed them myself but I don't know where I can see the errors in Dev C++.</p>
<p>Could this be a compiler error or did I mess up something in my code?</p>
<p>Thanks!</p>
| c++ | [6] |
3,034,535 | 3,034,536 | Strange force close on acore when adding a home screen shortcut | <p>I want to add home screen shortcuts to individual chat rooms, in my app. Here's my code to do so:</p>
<pre><code>Intent roomIntent = roomIntent(room).putExtra("shortcut", true);
Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, roomIntent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, room.name);
Parcelable resource = Intent.ShortcutIconResource.fromContext(this, R.drawable.icon);
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, resource);
setResult(RESULT_OK, intent);
finish();
</code></pre>
<p>When I go to add the shortcut to my home screen, I get a Force Close, not on my own process, but on com.android.acore(!). I've run the debugger and verified that my code gets executed all the way to the call to finish().</p>
<p>If I do this instead for the EXTRA_SHORTCUT_ICON:</p>
<pre><code>intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, R.drawable.icon);
</code></pre>
<p>It works fine and places the shortcut, and the shortcut behaves correctly -- but of course the shortcut has the stock Android icon, not mine, since this isn't the proper way to specify the icon.</p>
<p>When I look at the source code of other apps that have done this, and at <a href="http://dev.android.com/guide/samples/ApiDemos/src/com/example/android/apis/app/LauncherShortcuts.html" rel="nofollow">the one example</a> of it in the official Android reference area, my code looks identical. My icon's a standard 48x48 png that I use for the app's main icon, without problems. I've verified this problem on an emulator running stock 1.6, haven't tested other versions.</p>
<p>I have no idea what I'm doing wrong. Any ideas?</p>
| android | [4] |
772,561 | 772,562 | ExpandableListView using SimpleCursorTreeAdapter | <p>I am creating ExpandableListView using SimpleCursorTreeAdapter. I am facing lot of problems. </p>
<p>Can anyone tell me how I can I do this?</p>
| android | [4] |
3,672,229 | 3,672,230 | label text not persisting on a published website | <p>I have a label on my master page with a default text</p>
<pre><code><dxe:ASPxLabel ID="m_Label" runat="server" Font-Bold="True"
ForeColor="White" RightToLeft="True" Text="LabelText">
</dxe:ASPxLabel>
</code></pre>
<p>And then I set the text on the Master page</p>
<pre><code>if (!Page.IsPostBack && !Page.IsCallback)
{
if(condition)
{
m_Label.Text="one"
}
else
{
m_Label.Text="two"
}
}
</code></pre>
<p>If I run my web page from the source code it displays the correct text i.e one or two.
But if I publish my web page and then open the page it always says "LabelText"</p>
<p>Am I missing anything?</p>
| asp.net | [9] |
4,051,719 | 4,051,720 | onbeforeunload support detection | <p>I'd like to check if the current browser supports the onbeforeunload event.
The common javascript way to do this does not seem to work:</p>
<pre><code>if (window.onbeforeunload) {
alert('yes');
}
else {
alert('no');
}
</code></pre>
<p>Actually, it only checks whether some handler has been attached to the event.
Is there a way to detect if onbeforeunload is supported without detecting the particular browser name?</p>
| javascript | [3] |
2,330,702 | 2,330,703 | Javascript: Out of scope? | <p>Re-Edited:
I went over to W3schools and played around in there javascript editor window to see what was going on. Here is a shorter script.</p>
<pre><code><html>
<body>
<script type="text/javascript">
var eType = document.getElementById("Type")
</script>
<select class="field select addr" id="Type">
<option value="Type:L" selected="selected">Location</option>
<option value="Type:C">Corporate</option>
<option value="Type:R">Remittama</option>
<option value="Type:M">Mailing</option>
</select>
<script type="text/javascript">
document.write(eType);
</script>
</body>
</html>
</code></pre>
<p>I did what ThiefMaster suggested on how to get the element by not using the .text or .value but as you can see if you run this code I still get a null at this step of the process. From what I can see and many suggestions I am doing this correctly. I know I must be missing something. Can anyone see it?</p>
| javascript | [3] |
3,015,533 | 3,015,534 | Update text with submitted data w/jQuery | <p>I have a form on a page. I have a link acting as submit button. The value is sent to a php page via ajax where the value is set into a session.</p>
<p>After submit I swap the form with text field where the text is displayed. How do I use the text from the submitted form to display withing <code><pre></pre></code> tags?</p>
<pre><code>$("#btnPreview").click(function() {
var custM = $("#inviteMsg").val();
$.ajax({
url: "ajax.php",
type: "POST",
data: "msg="+custM
});
});
<div id="customMsgPreview">
<div class="rollSec">
<pre>
// SUBMITTED TEXT NEEDS TO APPEAR HERE
'.$tstLnk.'
</pre>
</div>
</code></pre>
| jquery | [5] |
2,310,412 | 2,310,413 | is there any difference between 'a.b.a' and 'b.b.a' | <pre><code>class a(object):
class b:
a='aaa'
print a.b.a#print 'aaa'
b=a()
print b.b.a#print 'aaa'
</code></pre>
<p>thanks</p>
| python | [7] |
857,597 | 857,598 | How to use UIEdgeInsets property in Button in iphone | <p>I an new iphone application Developer and want to know how to use UIEdgeInsets property in button so please guide me.</p>
| iphone | [8] |
4,794,940 | 4,794,941 | Incorrecr height of div returned by JS fuctions. Why? | <p>I try to get size of main div on page, to make iframe change its height to content, but document.getElementById("divId").offsetHeight (also try innerHeight) return wrong value. It always returns 247, but in fact page looks like it cut on 75%. I have an idea that page didn`t load fully, so I put resize code in the footer of the page, but it still return 247.</p>
<pre><code>$(document).ready(function() {
console.log(document.getElementById("resizeDiv").offsetHeight);
}
);
</code></pre>
<p>Any suggestions?</p>
| javascript | [3] |
4,690,167 | 4,690,168 | Alternative to base64_encode | <p>Are there any other encoding functions other than base64_encode for encoding text in PHP? </p>
<p>Edit: The purpose of the encoding functions:</p>
<p>To generate a string that can be used in a URL that can be used as an identifier.</p>
<p>For example, instead of <a href="http://www.something.com/?id=4&category=books&type=20" rel="nofollow">http://www.something.com/?id=4&category=books&type=20</a></p>
<p>I would like to have:</p>
<p><a href="http://www.something.com/?q=a3444aAbt3daj492klsj" rel="nofollow">http://www.something.com/?q=a3444aAbt3daj492klsj</a> </p>
<p>So to get the variables one has to decode the only query string which is a hash.</p>
| php | [2] |
2,306,107 | 2,306,108 | python subbing variables into string | <pre><code>sample_string = """
<div>
<h1>
%s
<h1>
Image:
%s
<br>
<p>
text text text text text text
</p>
%s
<p>
text text text text text text text text text more text this is just more text
in a paragraph tag
</p>
</div>"""
>>> print sample_string
<div>
<h1>
var1
<h1>
Image:
var2
<br>
<p>
text text text text text text
</p>
var3
<p>
text text
</p>
</div>
</code></pre>
<p>I am attempting to sub in vars into a string. While I am having no issues subbing in variables, I am finding if I return the string, some of the text is getting cut off at the bottom. What is causing this </p>
| python | [7] |
806,287 | 806,288 | Refreshing listview automatically when a new process enters | <pre><code>public void processloader(object temp)
{
Process[] processes = null;
try
{
processes = Process.GetProcesses();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
Application.Exit();
return;
}
listView1.BeginUpdate();
listView1.Clear();
int threadscount = 0;
listView1.Items.Clear();
foreach (Process p in processes)
{
try
{
string[] prcdetails = new string[] { p.ProcessName, p.Id.ToString(), p.StartTime.ToShortTimeString(), p.PriorityClass.ToString(), (p.WorkingSet64 / 1048576).ToString() + "Mb", p.Threads.Count.ToString() };
ListViewItem proc = new ListViewItem(prcdetails);
listView1.Items.Add(proc);
threadscount += p.Threads.Count;
}
catch { Console.WriteLine(p); }
}
statusBar1.Panels[0].Text = "Processes : " + processes.Length.ToString();
statusBar1.Panels[1].Text = "Threads : " + (threadscount + 1).ToString();
listView1.EndUpdate();
listView1.Refresh();
}
</code></pre>
<p>here is the refreher block i call this function every second by using System.threading.timer(). i need a solution like original taskmanager refreshing functionality can anyone help for this? please provide some sample codes. thanks in advance!</p>
| c# | [0] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.