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,988,988
2,988,989
What is CreateNewAttribute in C#?
<p>I want to know what is CreateNewAttribute and how it works?</p>
c#
[0]
1,076,792
1,076,793
strtotime function for hours more than 24
<p>Hello I am trying to compare a time during with Hours:Minutes:Seconds format using strtotime function but there is a probleme if Hours is more than 24</p> <p>PHP Code:</p> <pre><code>$time_duration_1 = '102:44:18'; $time_duration_2 = '87:42:19'; if(strtotime($time_duration_1) &gt; strtotime($time_duration_2)) { return true; }else{ return false; } </code></pre> <p>Is there any handy function for that kind of situation? or shall I do the checking manually hard coded?</p> <p>Thanks in advance</p>
php
[2]
226,912
226,913
Temperature array, potentially 2D?
<p>The assignment at hand is below:</p> <p>Write a program that uses an array to store the temperature for five day objects.<br> Each object must encapsulate it’s day name (ex: Monday, Tuesday...etc) and temperature The controlling program will display the average temperature for that week.</p> <p>Now I understand the basic principle of array's and how they are used, but the I am confused about two things:</p> <pre><code>public class TemperatureAndDay { public static void main(String[] args) { double [] temperature = new double [4]; temperature[0] = 45.24; temperature[1] = 67.30; temperature[2] = 55.23; temperature[3] = 49.20; temperature[4] = 50.22; } } </code></pre> <p>Could anyone give me some tips/hints/examples of code that would give me a better understanding of what my professor wants me to do? Thank you.</p>
java
[1]
2,332,655
2,332,656
How to create outlook task request in java
<p>I would like to know how to create outlook "Task Request" in java.</p>
java
[1]
3,733,714
3,733,715
dynamically adding label at the end another label
<p>hi i have a scroll view and in that scrollview i have label and and i have a dynamic text for that label .....</p> <p>and i am adding another label to the scroll view at the end of the first lable.....</p> <p>and the code is as follows....</p> <pre><code>UILabel *lblGenericName = [self createDynamicLabel:responseDrugInfo.GenName contentFrame:CGRectMake(120, 24, 150, 20) color:[UIColor customisedlightgreysColor] font:[UIFont regular14]]; [scrollview addSubview:lblGenericName]; [lblGenericName release]; </code></pre> <p>lblGenericName.numberOfLines = 0;</p> <p>[lblGenericName sizeToFit];</p> <p>now i want to add dynamically another label at the end of that label ...</p> <p>can any one please help me how to do that........</p>
iphone
[8]
2,666,325
2,666,326
for loop for simple linked list c++
<p>I'm trying to do a loop for this part:</p> <pre><code> insert_front(&amp;list,name[0]); insert_front(&amp;list,name[1]); insert_front(&amp;list,name[2]); </code></pre> <p>but, i can't figure out which should be used as a limiter, which should stop the loop for going and how it will change the name[] perimeters. </p> <p>Here's the whole code:</p> <pre><code>#include "list.h" #include "string" using namespace std; int main(){ cout&lt;&lt;"What is your name \n"; string name; getline(cin,name); Node *list; list = new_list(); insert_front(&amp;list,name[0]); insert_front(&amp;list,name[1]); insert_front(&amp;list,name[2]); } print_list(list); delete_list(&amp;list); print_list(list); return 0; } </code></pre>
c++
[6]
1,916,451
1,916,452
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')'',' or ';'?
<pre><code> echo "&lt;tr&gt;"; echo "&lt;td&gt; " . $row["accntid"] . "&lt;/td&gt;"; echo "&lt;td&gt; " . $row["accountholder"]. "&lt;/td&gt;"; echo "&lt;td&gt; " . $row["tid"]. "&lt;/td&gt;"; echo "&lt;td&gt; " . $row["storeno"] . "&lt;/td&gt;"; echo "&lt;td&gt; " . $row["branchname"] . "&lt;/td&gt;"; echo "&lt;td&gt; " '&lt;a href=home.php?id=' . $row["branchid"]. '&gt;' . "&lt;/a&gt;\n""&lt;/td&gt;"; echo '&lt;a href=home.php?id=' . $row['branchid'] . '&gt;' . $row['storeno'] . "&lt;/a&gt;\n"; echo "&lt;/tr&gt;"; </code></pre> <p>Causing a problem</p> <pre><code> echo "&lt;td&gt; " '&lt;a href=home.php?id=' . $row["branchid"]. '&gt;' . "&lt;/a&gt;\n""&lt;/td&gt;"; </code></pre> <p>And getting this error.</p> <pre><code> Parse error: syntax error, unexpected ''&lt;a href=home.php?id='' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ';' in C:\xampp\htdocs\ODBC\loginsession\searchstore.php on line 164 </code></pre> <p>Thanks for the help</p>
php
[2]
774,889
774,890
Jquery error method not displaying desired result
<pre><code>&lt;img src="one.jpg" height="200" width="200"&gt; &lt;img src="three.jpg" height="200" width="200"&gt;&lt;br&gt; &lt;a href="mylink.html"&gt;&lt;u&gt; Click Here &lt;/u&gt;&lt;/a&gt;&lt;br&gt; &lt;script src="displayAlert.js"&gt;&lt;/script&gt; &lt;style type="text/css" src="externCSS.css"&gt; &lt;/style&gt; $(document).ready(function(){ $("[src]").error(function(){ alert ("error"); }); }); </code></pre> <p>Expected Output - The code should display the alert when the files are not present at the specified path.</p> <p>The jquery is displaying the alert only when the image files are not present at the specified path. It is not displaying anything for css or script files if they are not present. Where am I going wrong? </p>
jquery
[5]
4,060,661
4,060,662
Higher-level socket functions
<p>I have a typical network protocol consisting of typical message stream (32-bit length field + variable-length body) and I want to read messages asynchronously from a TCP socket.</p> <p>However C# seems to provide a rather low-level API: I still have to allocate buffers, track the written offset and data length by hand, and maintain state between separate calls to read length and body like in the bad old days of C.</p> <p>Are there any higher-level functions that I can try out before diving into writing tedious asynchronous stateful code? (no third-party libraries).</p>
c#
[0]
4,013,220
4,013,221
GCM - Does the android phone needs to be connected on the internet to received this notification?
<p>I'm just wondering how GCM works,</p> <p>Does the android phone needs to be connected on the internet to received this notification?</p> <p>Thank you.</p>
android
[4]
2,667,624
2,667,625
C++/ Restricting the instance of class, which other classes are inherit from it
<p>I want to make a class in C++, which other classes inherit from it. But I want to make sure that no one will be able to make an instance from this class.</p> <p>Meaning:</p> <pre><code>class Animal{ public: virtual ~Animal() {} }; class Fish: public Animal{ }; </code></pre> <p>I want to make sure that:</p> <pre><code>Fish* fish = new Fish(); </code></pre> <p>would be possible, but </p> <pre><code>Animal* ana = new Animal(); </code></pre> <p>would not.</p> <p>How can I do it?</p>
c++
[6]
3,390,868
3,390,869
Whats the difference between theese two java code snippets?
<p>I have this code i am doing for university. The first code works as expected, the second one provides different results.</p> <p>I can not see what they are doing differently??</p> <p>first:</p> <pre><code>public Mat3 getNormalMatrix() { return new Mat3(this.getInverseMatrix()).transpose(); } </code></pre> <p>second:</p> <pre><code>public Mat3 getNormalMatrix() { Mat4 mat = this.getInverseMatrix(); Mat3 bla = new Mat3(mat); bla.transpose(); return bla; } </code></pre>
java
[1]
2,463,089
2,463,090
Incorrect cell selection with rowspan (jQuery)
<p>Markup:</p> <pre><code>&lt;tr&gt; &lt;td colspan="3" rowspan="4"&gt;1&lt;/td&gt; &lt;td&gt;2&lt;/td&gt; &lt;td&gt;3&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>jQuery:</p> <pre><code>$("table tr td:first").addClass("first-col-cell"); $("table tr td:last-child").addClass("last-col-cell"); </code></pre> <p>...according to jQuery documentation :first selector should only select the first td (1) but it also selects other 2.</p> <p>Thanks</p>
jquery
[5]
4,567,533
4,567,534
Use jQuery to change row color unless checkbox is clicked
<p>I have some table rows with checkboxes.</p> <pre><code>&lt;table cellpadding="0" class="action_table"&gt; &lt;tbody class="action_table_body"&gt; &lt;tr class="action_table_row"&gt; &lt;td class="action_table_checkbox"&gt;&lt;input type="checkbox" id="chkbx_1"&gt;&lt;/td&gt; &lt;td class="action_table_checkbox"&gt;&lt;input type="checkbox" id="chkbx_2"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>I'm toggling the color of the rows on mouseover events.</p> <pre><code>$(".action_table_row").mouseenter(function() { $(this).css({background:'#FCF6CF'}); }).mouseleave(function() { $(this).css({background:'#F3F3F3'}); }); </code></pre> <p>I also want to highlight rows that are checked:</p> <pre><code>$('input:checkbox').click(function() { if ($(this).attr('checked')) { $(this).parent().parent().css({background:'#ff0000'}); } else { $(this).parent().parent().css({background:'#F3F3F3'}); }); }); </code></pre> <p>The problem is when these two interact. I want to maintain the highlighting if a row is checked, thus overriding the mouseenter/mouseleave.</p> <p>I tried this, but it seems to operate across all rows/checkboxes instead of the specific row with the checked checkbox.</p> <pre><code>$(".action_table_row").mouseenter(function() { if ($(this + ':checkbox').attr('checked') == false) { $(this).css({background:'#FCF6CF'}); } }).mouseleave(function() { if ($(this + ':checkbox').attr('checked') == false) { $(this).css({background:'#F3F3F3'}); } }); </code></pre> <p>How do I keep the css from changing if a row's checkbox is clicked?</p>
jquery
[5]
5,459,572
5,459,573
How to write javaScript function for this?
<p>I have a textbox and i write javascript function that if it is blank then it will generate alertbox . but i press space in that textbox then it doesnot generate alertbox.</p> <p>so i want that if i give space then it also generate alertbox, for this what to do?</p> <p>I used this function:</p> <pre><code>function Trim(objValue) { var lRegExp = /^\s+/; var rRegExp = /\s+$/; objValue = objValue.replace(lRegExp, ''); //Perform LTRim objValue = objValue.replace(rRegExp, ''); //perform RTrim return objValue; } function ValidateTextBoxIncome() { var txtEnterItems = document.getElementById("txtEnterItems"); if (Trim(txtEnterItems) == '') { alert("Cannot be blank"); return false; } } </code></pre> <p>where is the error? please suggest me.</p>
javascript
[3]
3,177,993
3,177,994
Using bitmap font for displaying and editing texts
<p>One of the problems i'm facing now, is displaying complex text (English + Persian/Arabic). The texts that have both English and Persian/Arabic letters, not display in correct order. For solving this issue, I created a Bitmap Font library that draws these complex texts correctly. Now i want to convert all the texts in all of my program's widgets to their bitmap equivalent. For example, if i have a TextView in my program, i want to get it's text, convert it to bitmap with my bitmap font and finally replace it in TextView. The problem is finding a general solution that can be apply to any widget that can display text, like ListView, EditText, Menus, ...</p> <p><img src="http://i.stack.imgur.com/VvBvl.png" alt="enter image description here"></p>
android
[4]
4,887,877
4,887,878
Adding a Row to a DataTable question
<p>Greetings everyone-</p> <p>In my code below I'm trying to add a Row from an existing DataTable (dtResult) into a new DataTable (dtCopyResult) if email address does not match. So I guess my knowledge of ADO.NET is not up to par because whenever I try to run my below code, I get an "This Row already belongs to another table". Please let me know how I can fix this..</p> <p>Many Thanks</p> <pre><code> if (checkBox1.Checked) { for (int i = dtResult.Rows.Count - 1; i &gt;= 0; i--) //dtResult is a DataTable { foreach (object email in emails) //emails is an ArrayList of email addresses { if (email.ToString().ToUpper() != dtResult.Rows[i][3].ToString().ToUpper()) { dtCopyResult.Rows.Add(dtResult.Rows[i]); //dtCopyResult is a new blank DataTable that I'm trying to add rows to } } } } </code></pre>
c#
[0]
1,639,827
1,639,828
TypeError: 'bool' object is not callable
<p>I am brand new to python. I got a error</p> <pre><code>while not cls.isFilled(row,col,myMap): TypeError: 'bool' object is not callable </code></pre> <p>Would you please instruct how to solve this issue? The first "if" check is fine, but "while not" has this error.</p> <pre><code>def main(cls, args): ... if cls.isFilled(row,col,myMap): numCycles = 0 while not cls.isFilled(row,col,myMap): numCycles += 1 def isFilled(cls,row,col,myMap): cls.isFilled = True ## for-while i = 0 while i &lt; row: ## for-while j = 0 while j &lt; col: if not myMap[i][j].getIsActive(): cls.isFilled = False j += 1 i += 1 return cls.isFilled </code></pre>
python
[7]
3,067,116
3,067,117
Java EE how to start? Am I doing it right?
<p>Ok so lately I've been reading a bit bout Java EE and I'm really hyped up because of it and I'm even thinking about doing it professionally (I'm in my 4th year of university, out of 5, so I need to decide what I want to do I guess). So I was wondering what's the best way to get round to learning it?</p> <p>I'm getting a Head First JSP/Servlets book next week (huge Head First fan here) and I plan on reading the Sun tutorial simultaneously, as a start. But then what? Should I go with EJB (obviously Head First EJB) or JPA/Hibernate (I was recommended Manning: Java Persistence with Hibernate)?</p> <p>I know it will depend on the company, but what is the bare minimum an employer would expect from a candidate for a Java EE post?</p>
java
[1]
1,217,548
1,217,549
jquery fill input form with url data
<p>how i need fill out a input of my form with jquery.</p> <p>I have my url: <a href="http://example.com/page.html?name=YourName=Mark" rel="nofollow">http://example.com/page.html?name=YourName=Mark</a></p>
jquery
[5]
5,188,663
5,188,664
no suitable constructor exists to convert from "uint8_t *" to "std::vector<uint8_t, std::allocator<uint8_t>>"
<pre><code>no suitable constructor exists to convert from "uint8_t *" to "std::vector&lt;uint8_t, std::allocator&lt;uint8_t&gt;&gt;" </code></pre> <p>and the cast not working </p> <p>Edit:</p> <pre><code>const std::vector&lt;uint8_t&gt; Test (const std::vector&lt;uint8_t&gt; buffer) const; uint8_t* buffer="..."; //so i can use Test() function Test(buffer); Error no suitable constructor exists to convert from "uint8_t *" to "std::vector&lt;uint8_t, std::allocator&lt;uint8_t&gt;&gt;" </code></pre>
c++
[6]
4,019,246
4,019,247
JavaScript Array Looping
<p>So I've got this piece of code below:</p> <pre><code>var divs = ["A", "B", "C"]; for (var i = 0, div; div = divs[i]; i++) { print(div); } </code></pre> <p>As I understand it, the for loop iterates through every element of the divs array and prints them. I however fail to understand how the loop terminates. Could somebody explain that to me?</p>
javascript
[3]
2,930,901
2,930,902
How to programmatically find the default installation directory for the given OS and user, thru Java?
<p>I need to find the directory that will be used by default by the given OS and user combination for installing a new application. For example, on Windows, for any user, that directory could be <code>C:\Program Files</code>; for Linux + root, it could be <code>/usr/local</code>; for Linux + non-root user, it could be <code>/home/username</code> etc.</p>
java
[1]
2,864,198
2,864,199
C# get and set properties for a List Collection
<p>How are properties for a Collection set?</p> <p>I've created a class with a Collection properties. I want to add to the List anytime I set a new value. Using _name.Add(value) within the set method doesn't work.</p> <pre><code>Section newSec = new Section(); newSec.subHead.Add("test string"); newSec.subHead.Add("another test string"); public class Section { public String head { get; set; } private List&lt;string&gt; _subHead = new List&lt;string&gt;(); private List&lt;string&gt; _content = new List&lt;string&gt;(); public List&lt;string&gt; subHead { get { return _subHead; } set { _subHead.Add(value); } } public List&lt;string&gt; content { get { return _content; } set { _content.Add(value); } } } </code></pre> <p>Update with my solution:</p> <pre><code>public class Section { private List&lt;string&gt; _head = new List&lt;string&gt;(); private List&lt;string&gt; _subHead = new List&lt;string&gt;(); private List&lt;string&gt; _content = new List&lt;string&gt;(); public List&lt;string&gt; Head { get { return _head; } } public List&lt;string&gt; SubHead { get { return _subHead; } } public List&lt;string&gt; Content { get { return _content; } } public void AddHeading(string line) { Head.Add(line); } public void AddSubHeading(string line) { SubHead.Add(line); } public void AddContent(string line) { Content.Add(line); } } </code></pre>
c#
[0]
3,384,668
3,384,669
C# Get "has stopped working" error when i use Application.Exit();
<p>in my application i launch several process, and when i use the command <code>Aplication.Exit();</code> Windows give me the "has stopped working" error. i don't understand why, also the <code>Enviroment.Exit(0);</code> give me this error. UPDATE: i use the awesomium webcontrol, and before launch Application.Exit(); i call </p> <pre><code>WebCore.Shutdown(); </code></pre> <p>and then</p> <pre><code>Process.Start("cmd.exe", "/c " + @"rmdir /s/q " + dir); // erase all temporary files Application.Exit(); </code></pre>
c#
[0]
1,785,474
1,785,475
question regarding GUI in java
<p>HOW TO pass the string input in GUI using JTextfield to other class in java. </p>
java
[1]
231,331
231,332
What is the difference between .map, .every, and .forEach?
<p>I've always wondered what the difference between them were. They all seem to do the same thing...</p>
javascript
[3]
1,890,375
1,890,376
Tree Building Logic Trouble
<p>I am writing a simple app that incorporates a tree that represents the English language. I have done something similar in C++, but this is my first venture at building a tree in Python.</p> <pre><code>englishWords = [] englishFile = open("english.txt") for line in englishFile: englishWords.append(line.rstrip()) class Node: def __init__(self, value): self.Value = value self.checked = False self.Pointers = [] self.numPointers = 0 def addNode(self, value): x = Node(value) self.Pointers.append(x) return x headString = "HEAD" Head = Node(headString) def buildPointers(parent, info, nodeList): x = 0 y = len(nodeList) while x &lt; y : if parent.numPointers == 0: newNode = parent.addNode(info) parent.numPointers = parent.numPointers + 1 buildPointers(newNode, nodeList[x+1], nodeList) break else: for i in parent.Pointers: if info == i.Value: buildPointers(i, nodeList[x+1], nodeList) continue else: newNode = parent.addNode(info) parent.numPointers = parent.numPointers + 1 buildPointers(newNode, nodeList[x+1], nodeList) continue def treeBuild(lyst): for i in lyst: iList = list(i) buildPointers(Head, iList[0], iList) treeBuild(englishWords) </code></pre> <p>As soon as I run the code Windows says "python.exe has stopped running" it's probably something simple that I have overlooked, so feel free to rip into me or the way I wrote this. I would love any criticism that will help make me a better programmer. </p>
python
[7]
1,994,338
1,994,339
How to get players scores for the current week
<p>I've been left some code to try and figure out, which is..</p> <pre><code> public function scoreboard($ttime, $numb = 10) { if ($ttime == "day") { $timesearch = $this-&gt;myTime - 86400; } if ($ttime == "week") { $timesearch = $this-&gt;myTime - 604800; } if ($ttime == "month") { $timesearch = $this-&gt;myTime - 18144000; } if ($ttime == "hiscore") { $timesearch = $this-&gt;myTime - 1000000000; } //get top 10 ------------------ return @mysql_query("SELECT uid, name, score, FROM table WHERE scoredate&gt;$timesearch ORDER BY score DESC LIMIT $numb"); } </code></pre> <p>What I need is to get the players score for the current week, I.e the actual week in which the score was created (based on server date), but I think that code doesn't do that? it seems to take the current date and just go back 7 days?</p>
php
[2]
1,252,399
1,252,400
How can I show the "Open with" file dialog?
<p>Is there any simple way to open the "Open with" file dialog?</p>
c#
[0]
1,984,087
1,984,088
Read from a file when a new line 's been written to it by another process
<p>What is the fastest method in C++, to read a new line from a file which is written by another process. Or how my program can be notified that there is a new line in file so read it? (in linux)</p>
c++
[6]
5,944,005
5,944,006
Android How to Exit our application when Exit button click
<p>When User click "Exit" button, Its go to device home screen.Then again click/select my application its go to last opened activity.I houldn't go there.It need to go initial screen.How we can implement this.I have done using :</p> <pre><code>public void onExitAction(View botton){ SharedPreferences myPrefs = this.getSharedPreferences("myLogedPrefs",MODE_WORLD_READABLE); myPrefs.edit().remove("myLogedPrefs"); myPrefs.edit().clear(); myPrefs.edit().commit(); Intent startMain = new Intent(Intent.ACTION_MAIN); startMain.addCategory(Intent.CATEGORY_HOME); startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(startMain); finish(); } </code></pre> <p>Please help me..</p> <p>Thanks in advance</p>
android
[4]
2,104,981
2,104,982
Android: File browsing
<p>I want to browse(view as a list view) the res directory while running the application. I tried some codes, but they didn't work. Some one please help me</p>
android
[4]
5,607,994
5,607,995
using templates with multiple object types
<p>I need to write a container template class <code>&lt;T, R&gt;</code> where T is an object and R can be either <code>vector&lt;T*&gt;</code> or <code>list&lt;T*&gt;</code>. i need to support common operations like insert(T) size() etc...</p> <p>I am holding a class member called <code>T data</code> to be the list or the vector. the problem is, how do i write the code so at runtime i know which operation to invoke from <code>std::list</code> or <code>std::vector</code> ? </p> <p>for example, to get the fist element in the container i would have to invoke <code>data[0]</code> in the vector case and <code>data.front()</code> in lists case. should i just use <code>typeid</code> operator ?</p> <pre><code>if (typeid(R) == typeid(vector&lt;T*&gt;)) then ... else if (typeid(R) == typeid(list&lt;T*&gt;)) then ... </code></pre> <p>Or is there a better way ? </p>
c++
[6]
2,737,442
2,737,443
How to take picture from front camera in android2.2
<p>can anybody tell How to take picture from front camera in android2.2 can anybody provide sample code</p> <p>Thanks</p>
android
[4]
5,538,823
5,538,824
How do I get the x coords to show up after mouse click? - Python
<p>I'm trying to figure out how to get the x coords to show up when the user clicks a point in the graphics window. Any ideas? Thanks!</p> <p>Here's my code:</p> <p><strong>Set graphics window</strong> </p> <pre><code>win = GraphWin("Uncle Scrooges Money Bin", 640,480) win.setCoords(0,0,80,60) win.setBackground("white") </code></pre> <p><strong>Get coordinate of mouse click 1</strong></p> <pre><code>point1 = win.getMouse() #***************************** </code></pre> <p><strong>Display coordinates of point 1</strong> </p> <pre><code>print("Point 1 coordinates: ", point1) </code></pre>
python
[7]
3,648,928
3,648,929
How can I extract a password protected .zip file from within my PHP application?
<p>How can I extract a password protected <code>.zip</code> file from within my PHP application?</p>
php
[2]
1,390,733
1,390,734
show data in table view in android
<p>I want to get data from <code>database</code> in my android <code>table view</code>.</p> <p>Should I use loop? Is static good for this?</p>
android
[4]
5,901,615
5,901,616
Python: How to extract required information from a string?
<p>I am new to Python. Is there a StringTokenizer in Python? Can I do character by character scanning and copying.</p> <p>I have the following input string</p> <pre><code>data = '123:Palo Alto, CA -&gt; 456:Seattle, WA 789' </code></pre> <p>I need to extract the two (city, state) fields from this string. Here is the code I wrote</p> <pre><code>name_list = [] while i &lt; len(data)): if line[i] == ':': name = '' j = 0 i = i + 1 while line[i] != '-' and line[i].isnumeric() == False: name[j] = line[i] # This line gives error i = i + 1 j = j + 1 name_list.append(name) i = i + 1 </code></pre> <p>What should I do?</p>
python
[7]
4,705,186
4,705,187
image preloading problem (using $("img").load())
<p>I use the load function to preload Images before applying a hover effect.</p> <pre><code>$("img").load(function(){ //image preloading //some function &amp; variable setting $listingItems.hover( function(){ //effect }, function(){ //effect back } ) }) // load </code></pre> <p>the problem i have i that the effects only works if i reload the page. When i first come to the page, the images are loaded but there is no hover effect.</p> <p>You can take a look at the source here: <a href="http://meodai.ch/rundum/shop.html" rel="nofollow">http://meodai.ch/rundum/shop.html</a></p> <p>What have i done wrong? Can anyone help? Is there an other simple way to preload images before executing a function?</p>
jquery
[5]
3,487,298
3,487,299
orika Exception in thread "main" java.lang.NoClassDefFoundError: javassist/CannotCompileException
<p>I'm doing the following and get as reward :</p> <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: javassist/CannotCompileException </code></pre> <p>Does anyone know why ? </p> <pre><code>package javaapplication1; import ma.glasnost.orika.MapperFactory; import ma.glasnost.orika.impl.DefaultMapperFactory; public class JavaApplication1 { public static void main(String[] args) { MapperFactory factory = new DefaultMapperFactory(); } } </code></pre>
java
[1]
909,256
909,257
dropdownlist binding
<p>I was trying to bring all the database names in a dropdownlist.. Here is my code ..</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { populateddl(); } } private void populateddl() { using (SqlDataAdapter sda = new SqlDataAdapter("exec sp_databases", conn)) { using(DataSet ds = new DataSet()) { sda.Fill(ds); DropDownList8.DataSource = ds; DropDownList8.DataBind(); } } } </code></pre> <p>em not able to get the names in the dropdownlist, pls help me in this scenario.. when run the application what em getting is.. system.data.datarowview as items of dropdownlist instead of this i should get names of databases Looking forward for ur replys</p> <p>Thanks &amp; Regards,</p>
asp.net
[9]
5,165,433
5,165,434
why are java RandomAccessFile so much slower than FileOutputStream?
<p>As long as I can understand java api, opening a RandomAccessFile using "rw" does not write ervery single byte synchronously on the underlying storage device. Unlike with "rws" or "rwd".<br> Why is it almost the same "speed" like the unbuffered FileOutputStream with "rw" and more than 10 times slower with "rws"/"rwd"?</p> <p>the following simple code shows this, and I cannot get any reasonnable explanation to this. Any clue?</p> <pre><code>import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; import java.io.RandomAccessFile; public class StreamTest { public static void main(String[] args) throws Exception { OutputStream os; RandomAccessFile raf; int size = 10000; File file = new File("test.log"); long a=System.currentTimeMillis(); os = new FileOutputStream(file); for(int i=0;i&lt;size;i++){ os.write(("1").getBytes()); } os.close(); long b=System.currentTimeMillis(); System.out.println("writing direct "+(b-a)); raf = new RandomAccessFile(file,"rws"); for(int i=0;i&lt;size;i++){ raf.write(("1").getBytes()); } raf.close(); long c=System.currentTimeMillis(); System.out.println("random access write "+(c-b)); raf = new RandomAccessFile(file,"rw"); for(int i=0;i&lt;size;i++){ raf.write(("1").getBytes()); } raf.close(); long d=System.currentTimeMillis(); System.out.println("random access optimized write "+(d-c)); } } </code></pre>
java
[1]
364,678
364,679
Compare 2 images using C#
<p>Can we compare 2 images of different resolutions and colour.</p>
c#
[0]
1,998,289
1,998,290
is '__all__' only for 'from some import *'
<p>a.py</p> <pre><code>__all__=['b','c'] a='aaa' b='bbb' def c(): print 'ccc' def d(): print 'dddd' </code></pre> <p>b.py</p> <pre><code>from a import a print a from a import * print a print d#error </code></pre> <p>Are there any other uses.</p> <p>thanks</p>
python
[7]
4,138,336
4,138,337
What are the units and axes directions for View.getLocationOnScreen ()?
<p>View.getLocationOnScreen() returns the X and Y coordinates of a View.</p> <ul> <li>Are the units pixels, or DIPs?</li> <li>Where is the origin? Top left?</li> <li>Which corner of the View does the location refer to?</li> <li>Which way do the axes go? e.g. what are the coordinates of the four corners of a 320x480 screen?</li> </ul>
android
[4]
2,869,106
2,869,107
Android Ros tutorial map_view
<p>I am working with the android tutorial map_view. I have the app running perfectly in my tablet. I have run a map_server node in my terminal after running roscore, of course. Do I need something more running to see the map in my tablet?. I can see anything about the map. It shows an orange triangle that should be the robot, but there is nothing in the background as a map should be.</p> <p>Does anybody have achieved to run the android example correctly? I would be so grateful if somebody could tell me the steps to obtain it running OK.</p> <p>Thanks!</p>
android
[4]
121,221
121,222
hashtable values reordered
<p>I have a hashtable, which contains strings for example, when I use put method as below </p> <pre><code> hashtable.put("1","A"); hashtable.put("1","B"); hashtable.put("1","C"); hashtable.put("1","D"); hashtable.put("1","E"); </code></pre> <p>Then when I try to print it back it doesn't print in same order, Any one knows why would something like this happen?</p> <pre><code> Collection c = ht.values(); Iterator itr = c.iterator(); while(itr.hasNext()) System.out.println(itr.next()); </code></pre> <p>Thanks Max</p>
java
[1]
5,657,029
5,657,030
url decode exception - c#
<p>I have some URL encoded data in a db (sql server 2005) which I decode to parse it. I use:</p> <pre><code>Uri.UnescapeDataString </code></pre> <p>sometimes I get:</p> <p>{"Invalid URI: There is an invalid sequence in the string."}</p> <p>what invalid sequences do I have to look out for you reckon?</p> <p>Thanks.</p> <p>Christian</p>
c#
[0]
2,689,052
2,689,053
should Assembly.GetExecutingAssembly().CreateInstance throw an exception here?
<p>I'm pretty new, so this may be a "stupid question," or may not be appropriate here, please advise as appropriate. </p> <p>I'm exploring some of C#'s features, this week I'm messing about with reflection. I'm confused when I read <a href="http://msdn.microsoft.com/en-us/library/145sfyea.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/145sfyea.aspx</a>, from what I can tell I'm not getting MissingMethodException (No matching constructor was found.) when I think I should.</p> <p>Question: should this code throw an exception at the noted point? </p> <pre><code>using System; using System.Collections.Generic; using System.IO; using System.Reflection; namespace Test { abstract class Vehicle { public string type { get; set; } } class Van : Vehicle { public Van() { System.Console.WriteLine("van!"); this.type = "van"; // ... } } class Program { static void Main(string[] args) { List&lt;String&gt; things = new List&lt;String&gt;(); things.Add("Van"); things.Add("Car"); List&lt;Vehicle&gt; inventory = new List&lt;Vehicle&gt;(); foreach (String s in things) { Vehicle vehicle = Assembly.GetExecutingAssembly().CreateInstance("Test" + "." + s, true) as Vehicle; if (vehicle != null) { inventory.Add(vehicle); } else { System.Console.WriteLine("Should an attempt to create an instance of"+ "Test" + "." + s+ " have thrown an exception? " ); }; } Console.Read(); Console.Read(); } } } </code></pre>
c#
[0]
1,935,599
1,935,600
How find Internet connection is available or not on Android 4G?
<p>I have used Following Code For Wheather Intenet conection is available or not, its works fine upto 3G systems. but Its not working for 4G technology. Anybody have idea about How find Internet connection is Avlable or not on 4g? if any body have democode for it, please provide it</p> <p>Code: </p> <pre><code>public static boolean checkConnection(Context c) { ConnectivityManager mConnectivityManager = (ConnectivityManager) c.getSystemService(Context.CONNECTIVITY_SERVICE); TelephonyManager telephonyManager = (TelephonyManager) c.getSystemService(Context.TELEPHONY_SERVICE); if(mConnectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnected() || telephonyManager.getDataState() == TelephonyManager.DATA_CONNECTED) return true; else return false; } </code></pre> <p>Thanks in Advance Nirav modh</p>
android
[4]
4,179,576
4,179,577
JQuery object vs HTMLElementxxx Object
<p>This works:</p> <pre><code>$('h1').click(function(){console.log("clicked");}; </code></pre> <p>this does not:</p> <pre><code>var h1 = $('h1'); h1[0].click(function(){console.log("clicked");} </code></pre> <p>this works again:</p> <pre><code>var h1=$('h1'); var h2 = $(h1[0]).click(function() {console.log("clicked");} </code></pre> <p>Would anybody explain why?</p> <p>Thanks a lot!</p> <p>Cheers Long</p>
jquery
[5]
5,656,066
5,656,067
Access API methods in NON IE browsers
<p>i have a device in aspx page inside a table td tag as below</p> <pre><code>&lt;td style="text-align: left;" colspan="2"&gt; &lt;object id="Myobject" style="left: 0px; top: 0px" height="0" width="0" classid="CLSID:6283f7ea-608c-11dc" name="Myobject" &gt; &lt;/object&gt; &lt;/td&gt; </code></pre> <p>The object has many many methods that are accessible in ie 6,7 and 9. It throws an error "Object method not supported" or "Object method not found in Google Chrome/Mozilla</p> <p>how do i access these methods?</p> <p>Thanx</p>
javascript
[3]
5,671,794
5,671,795
Testing if PHP Variable contains a Nowdoc String
<p>Is there a way to tell if a PHP variable contains a nowdoc string?</p> <p>I recently posted <a href="http://stackoverflow.com/questions/10918924/escaped-backslash-characters-in-php-single-quoted-strings">this</a> question.</p> <p>My goal is to output PHP strings exactly as they are and I discovered that using nowdoc strings is the closest thing to verbatim strings in PHP. </p>
php
[2]
6,026,383
6,026,384
which api's are available to find movie shows information?
<p>I want to find shows of movie,show booking,price of shows, I am searching for api for that can any one tell me which api's are there for that.</p>
iphone
[8]
3,798,020
3,798,021
Find items in multi-dimensional array
<p>I have an array that has the following:</p> <pre><code>$items = array( 'desk' = array('pen', 'pencil', 'ruler'), 'wardrobe' = array('suit', 'shirt', 'tie') ); </code></pre> <p>What would be the easiest way to find the items in the <code>wardrobe</code> array?</p> <p>i.e i need to return an array with 'suit, shirt and tie'</p> <p>Thanks</p>
php
[2]
2,854,893
2,854,894
Fade in one after the other
<p>How to make li fade in one after the other? Here is the link where my lis are fading in while scrolling down at the same time, is s there a way to make them fade in one after the other? Here is my code:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready( function() { tiles = $('.ajax_block_product').fadeTo(0,0); $(window).scroll(function(d,h) { tiles.each(function(i) { a = $(this).offset().top + $(this).height(); b = $(window).scrollTop() + $(window).height() + 200; if (a &lt; b) $(this).fadeTo(2500,1); }); }); function inWindow(s){ var scrollTop = $(window).scrollTop(); var windowHeight = $(window).height(); var currentEls = $(s); var result = []; currentEls.each(function(){ var el = $(this); var offset = el.offset(); if(scrollTop &lt;= offset.top &amp;&amp; (el.height() + offset.top) &lt; (scrollTop + windowHeight + 200)) result.push(this); }); return $(result); } inWindow('.ajax_block_product').fadeTo(0,1); }); &lt;/script&gt; </code></pre> <p>The line which is responsible for fade in is - if (a &lt; b) $(this).fadeTo(2500,1); And here is the link if it will be helpfull - <a href="http://layot.prestatrend.com" rel="nofollow">http://layot.prestatrend.com</a> Thanks for any reply, folks!</p>
jquery
[5]
2,458,558
2,458,559
PHP upload image and file to a specified folder
<p>Hi all i need to create a form to upload two files to a specified folder that is created by the selection of a select and an input on the same page.<br> <br>So the form must have:<br> input type="text"<br> select<br> upload image on the folder "select_value/input_value/random_name_image.jpg"<br> upload file on the folder "select_value/input_value/random_name_file.txt"<br></p> <p>someone can help me to create this form? thanks a lot</p>
php
[2]
2,362,983
2,362,984
Error 1400 Invalid window handle
<p>I have code:</p> <pre><code>...... g_hWnd = CreateWindow( L"Urok6WindowClass", L"TitleWindow", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, rc.right - rc.left, rc.bottom - rc.top, NULL, NULL, hInstance, NULL ); if( !g_hWnd ) return E_FAIL; ShowWindow(g_hWnd, nCmdShow ); </code></pre> <p>All works fine. But if I add:</p> <pre><code> LPTSTR tilte_old= L"Old title"; int gettus = GetWindowText(g_hWnd, tilte_old, 100); DWORD error = GetLastError(); WCHAR szTest[10]; swprintf_s(szTest, 10, L"%d", error); MessageBox(NULL, szTest, L"TEST2", MB_OK); </code></pre> <p>MessageBox >> 1400 </p> <p>gettus >> ''</p> <p>Why is this happening? Why windows handle is invalid?</p>
c++
[6]
5,869,731
5,869,732
Use of Javascript with Dojo/Dijit on a WordPress page
<p>I just created a web page that uses a lot of JavaScript to build a fancy form that helps build an build the object/html behind an mp3 player for a user. I got it working and tested in a plain-html page outside of WordPress. </p> <p>I then copied into a WordPress "page", took out the &lt;head&gt; tag, changed &lt;body&gt; to a &lt;div&gt;, but no luck. </p> <p>Can it even be done? </p> <p>I also want to use a small javascript to open up a video-player in a new small browser-window. </p> <p>Working on raw html page: <a href="http://learnhowtoputaudioonyoursite.com/TestMP3Player.html" rel="nofollow">http://learnhowtoputaudioonyoursite.com/TestMP3Player.html</a></p> <p>Not working in WP page: <a href="http://learnhowtoputaudioonyoursite.com/build-player" rel="nofollow">http://learnhowtoputaudioonyoursite.com/build-player</a></p>
javascript
[3]
2,241,060
2,241,061
Check for Null in a gridview
<p>I am storing a image datatype in my DB. But while checking it </p> <pre><code> &lt;asp:LinkButton ID="lbEvidence" runat="server" Text='&lt;%# CheckNull (Eval("Evidence")) %&gt;' </code></pre> <p>aspx.cs</p> <pre><code>protected string CheckNull(object objGrid) { // checks whether there is evidence file or not if (object.ReferenceEquals(objGrid, DBNull.Value)) { return ""; } else { return "Record Found"; } } </code></pre> <p>Even when the image in the DB is NULL, here objgrid takes a value System.Byte[4] and returns Record Found. Works fine when the image is not null</p> <p>Any hints Sun</p>
asp.net
[9]
2,770,478
2,770,479
Get clicked element in ButtonSet
<p>I would like to know which element is clicked so I can change its CSS class. Here is the code:</p> <pre><code>&lt;script type="text/javascript"&gt; $(function() { $("#radio").buttonset(); }); &lt;/script&gt; </code></pre> <hr> <pre><code>&lt;div id="radio"&gt; &lt;input type="radio" id="radio1" name="radio" /&gt;&lt;label for="radio1"&gt;Choice 1&lt;/label&gt; &lt;input type="radio" id="radio2" name="radio" checked="checked" /&gt;&lt;label for="radio2"&gt;Choice 2&lt;/label&gt; &lt;input type="radio" id="radio3" name="radio" /&gt;&lt;label for="radio3"&gt;Choice 3&lt;/label&gt; &lt;/div&gt; </code></pre>
jquery
[5]
101,277
101,278
Android simple ImageView code causing emulator to crash, but works on the device?
<p>I did a lot of online search on this problem and I couldn't find anyone having this problem here. I have run into a strange problem where adding <code>ImageView:src</code> in the xml file is leading my emulator to crash. </p> <p>I just couldn't understand why this is happening. I have done this before and it worked just fine, but now after five days chasing this problem, I just couldn't understand it.</p> <p>I have made sure that I have the picture in all the drawable folders (drawable, hdpi, mdpi, ldpi). I also tried jpg, bmps, pngs. It works fine on my physical device, but crashes on the emulator.</p> <p>main.XML File</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:layout_gravity="center"&gt; &lt;ImageView android:id="@+id/image1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/stars1" /&gt; &lt;TextView android:id="@+id/text1" android:text="Sample Text" android:layout_height="wrap_content" android:gravity="center" android:layout_width="wrap_content" android:textSize="30dp" android:layout_marginLeft="100dp" android:layout_marginTop="150dp" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>Oncreate() method:</p> <pre><code>package com.project.testwrappro; import android.app.Activity; import android.os.Bundle; public class TestWrapProActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } } </code></pre>
android
[4]
1,743,265
1,743,266
TCP Socket with custom service type
<p>I'm a new C# developer (I'm from obj-c), and I was using objective-c to create a TCP socket with a type (<code>initWithDomain:@"local." type:@"_nameOfServer._tcp." name:@"nameOfServer" port:1234</code>) and I want to create a TCP socket (with C#) that uses the "type" value (I want it because I develop an iPhone application that searches TCP servers with the type value). </p> <p>Any idea (class, code, etc.)?</p>
c#
[0]
2,190,555
2,190,556
Inserting data line by line from datagridview
<p>I am stuck at one point.</p> <p>I am able to read data from csv file and display it on data gird view. Now, I want to insert those data (which is display in datagridview) into database.Also, at time of insert data with same primary key should get update. </p> <p>I tried different way like stored procedure, loop but its not working. </p> <p>I couldn't able to understand how should I read data line by line from datagridview and insert into database. </p>
c#
[0]
4,662,421
4,662,422
How do we upload a file to mysql database using php
<p>I need to upload a file of ethereal capture into the MySQL database. The problem is , it is not done manually through a html form . Hence I can't use enctype="multipart/form-data" and $_FILES to upload a file. </p> <p>Is there a way to upload a file just using PHP in to the MySQL database.</p> <p>Regards, Mithun</p>
php
[2]
272,480
272,481
Retaining the state of Mediaplayer -android
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/11438878/handling-screen-orientation-android">Handling Screen Orientation - Android</a> </p> </blockquote> <p>In my application i am having a listview with list of songs and a button with play/pause option. how to handle screen orientation while playing a song. help me with samples...........</p>
android
[4]
4,819,670
4,819,671
UIWebView or Custom UIView
<p>I have a dilemma and was wondering if anyone else had this issue. I have a Navigation based app that when you drill down to the last level, that last view has lots and lots of information and details. I am wondering if I should just use a UIWebView to display the details of information or if I should create a custom UIView with all the labels and outlets set in that UIView. Which way is recommended or the preferred way of doing something like this?</p>
iphone
[8]
1,835,948
1,835,949
How to do Unit test for asp.net web application?
<p>i have a asp.net web application. I want to do Unit test for that using visual stdio 2010.I added one test project to that web solution and add one test method present in APP_Code it was throw error like please refer APP_Code dll but my web project does not contain .dll files</p>
asp.net
[9]
2,460,725
2,460,726
Returning an abstract class from multiple inherited classes
<p>I'm trying to do the following:</p> <pre><code>abstract class G { protected var = 0; } class G1 extends G { var = 1; } class G2 extends G { var = 2; } // This is where I'm having a problem public G method() { switch(someVar) { case x: return new G1(); case y: return new G2(); } } </code></pre> <p>Java is complaining that method must return a type of G. How should I go about returning G1 OR G2 (which both extend G)? It very well may be that I'm approaching this entirely wrong...</p> <p>Thank you.</p>
java
[1]
1,459,136
1,459,137
Dynamically add TableRow to TableLayout
<p>When a button is clicked, the following method is run:</p> <pre><code>public void createTableRow(View v) { TableLayout tl = (TableLayout) findViewById(R.id.spreadsheet); TableRow tr = new TableRow(this); LayoutParams lp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); tr.setLayoutParams(lp); TextView tvLeft = new TextView(this); tvLeft.setLayoutParams(lp); tvLeft.setBackgroundColor(Color.WHITE); tvLeft.setText("OMG"); TextView tvCenter = new TextView(this); tvCenter.setLayoutParams(lp); tvCenter.setBackgroundColor(Color.WHITE); tvCenter.setText("It"); TextView tvRight = new TextView(this); tvRight.setLayoutParams(lp); tvRight.setBackgroundColor(Color.WHITE); tvRight.setText("WORKED!!!"); tr.addView(tvLeft); tr.addView(tvCenter); tr.addView(tvRight); tl.addView(tr, new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); } </code></pre> <p><code>R.id.spreadsheet</code> is an xml TableLayout. I can see from debugging that the method is being accessed, but nothing is drawn to the screen. What gives? Do I need to reset the Content View somehow?</p>
android
[4]
1,092,655
1,092,656
How do I get this attribute using jQuery?
<p>I know should be really simple, but I just don't get it.</p> <p>I'm using clone to copy a <code>&lt;li&gt;</code> element:</p> <pre><code>var li = $('.selected_list .template').clone(); </code></pre> <p>The list has the following items:</p> <pre><code>&lt;li&gt; &lt;input type="hidden" value="" class="item_id" name="item_id[]"&gt; &lt;div class="col_rating"&gt; &lt;input type="textbox" value="" maxlength="3" class="item_rating" name=""&gt; &lt;/div&gt; &lt;/li&gt; </code></pre> <p>I can use the following to change the content of the <code>item_id</code> input:</p> <pre><code> $(li).find('.item_id').prop({ 'value': $(item).attr('id'), 'name': 'item_id[]' }); $(li).find('.col_rating').find('input.col_rating').prop('name','item_rating[]'); $(li).find('.col_name').text($(item).find(('.assoc_name')).text()); $(li).find('.col_cost &gt; input.item_cost').val($('.info_container .unit_cost').val()); </code></pre> <p>But how can I change the value of the <code>input</code> that is wrapped inside the <code>div</code>?</p> <p>I tried using <code>&gt;</code> to access children, but that didn't work.</p> <p>You help is much appreciated :)</p> <p><strong>Update</strong><br> I am able to change the value of the <code>item_id</code>. The question is, how do I update the <code>name</code> attribute of the <code>col_rating</code> input?</p>
jquery
[5]
353,273
353,274
Is it possible to create anonymous objects in Python?
<p>I'm debugging some Python that takes, as input, a list of objects, each with some attributes.</p> <p>I'd like to hard-code some test values -- let's say, a list of four objects whose "foo" attribute is set to some number.</p> <p>Is there a more concise way than this?</p> <pre><code>x1.foo = 1 x2.foo = 2 x3.foo = 3 x4.foo = 4 myfunc([x1, x2, x3, x4]) </code></pre> <p>Ideally, I'd just like to be able to say something like:</p> <pre><code>myfunc([&lt;foo=1&gt;, &lt;foo=2&gt;, &lt;foo=3&gt;, &lt;foo=4&gt;]) </code></pre> <p>(Obviously, that is made-up syntax. But is there something similar that really works?)</p> <p>Note: This will never be checked in. It's just some throwaway debug code. So don't worry about readability or maintainability.</p>
python
[7]
2,298,238
2,298,239
C# Array Builder?
<p>What's the best way to build an array?</p> <p>I'm writing a method that adds a bunch of stuff to an array (of strings) and then returns it. Right now, I've just used a <code>List&lt;string&gt;</code> and then <code>.Add</code> stuff to it, and then return <code>list.ToArray()</code>. I don't know the length of the array beforehand (unless of course I use a 2-pass algorithm, once just to compute the size). Is that a good way to do it, or is there a more efficient way?</p> <p>PS: I don't want to yield an enumerable.</p>
c#
[0]
3,328,061
3,328,062
Python: How to change hex string int integer?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/209513/convert-hex-string-to-int-in-python">Convert hex string to int in Python</a> </p> </blockquote> <p>Hello, I want to use some string like "0xFF123456" as a 32-bit unsigned integer. Please give me some advice. Thanks.</p>
python
[7]
1,930,958
1,930,959
How I can close a 1st form without closing the full application?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4759334/how-can-i-close-a-login-form-and-show-the-main-form-without-my-application-closi">How can I close a login form and show the main form without my application closing?</a> </p> </blockquote> <p>How i can close a 1st form with out closing full the application?<br> C#. as a example if my 1st form is logging form after enter username and password if they are correct that form should be close and other form need to be open.</p> <p>I tried <code>this.close()</code> but my full application is exiting :(. After that I tried <code>this.Hide()</code> it works but my form is still running just hidden from UI. </p> <p>ty</p>
c#
[0]
5,502,887
5,502,888
insert text to textarea
<p>case: if i <code>click red image</code> <strong>></strong> <code>add new div</code>, then if i <code>click green image</code> <strong>></strong> <code>insert text to textarea</code></p> <p>how can i make this work?<br> <a href="http://jsfiddle.net/AMZMA/tNt7t/11/" rel="nofollow">http://jsfiddle.net/AMZMA/tNt7t/11/</a></p> <p>i know if i make it to this<br> <a href="http://jsfiddle.net/AMZMA/tNt7t/9/" rel="nofollow">http://jsfiddle.net/AMZMA/tNt7t/9/</a><br> it works</p> <p>but it will load image in background cause i'm using <code>display:none</code><br> i only want load image when i click the <code>red image</code></p> <p>sorry for my bad english :D</p>
jquery
[5]
3,945,494
3,945,495
How to capture global key presses in java
<p>I made a simple Media player in Java but I <strong>want to record global key presses like Ctrl + P</strong> to pause/resume the current music being played <strong>without the JFrame having focus</strong> but it seems that its not possible due to JVM security issues.</p> <p>I came across <a href="http://code.google.com/p/jnativehook/" rel="nofollow">JNativeHook</a> but I want to implement my own method only for Windows. Please Suggest how to do it and where to begin ?</p>
java
[1]
699,243
699,244
javascript alert message russian text
<p>how do i give a alert message in russian text?</p> <p>these chars means name = &amp; #1048;&amp; #1084;&amp; #1103; if you put them in normal html , it shows Имя</p> <p>Thanks in advance for any help</p>
javascript
[3]
1,726,121
1,726,122
Displaying animated GIFs in Android
<p>I am getting my GIF image as a byte array from the server. Now since android cannot display animated GIFs in the ImageView, I have to decode it and show it as a movie. </p> <p>The problem that I am facing here is that the GIF that I am getting from the server has its dimensions set for an iPhone. So the GIF comes out really small on Android devices with larger screen/resolution. </p> <p>To fix this I have two alternatives: 1) I could either extract each Bitmap from the GIF and scale them according to my screen size. But for that I will have to mess up the aspect ratio and the image will come out stretched. </p> <p>2) Or I could ask the server guys to add support for Android devices, so that they could send me the GIF according to my screen size.</p> <p>Please recommend as to what the best solution would be. Do tell if you have any suggestions of your own.</p>
android
[4]
2,198,701
2,198,702
What is the best approach to scale complex layout
<p>What is the best approach to scale complex layout so it will shrink on small screens (buttons, text images) and stretch on big proportionally? For example i have an calendar layout with month title, grid full of day numbers, navigation buttons etc. I want it to be fullscreen on 320x480 and on 1280x720 with all elements stay on screen just scaled if needed.</p>
android
[4]
1,975,180
1,975,181
read in array into another array C++
<p>after reading inputs to an array:</p> <pre><code>int * inputs; </code></pre> <p>the "<code>inputs</code>" is 1 dimensional array: <code>inputs[6]</code>, then reading this array out, the values are:</p> <pre><code>inputs[0]=1 inputs[1]=2 inputs[2]=3 inputs[3]=4 inputs[4]=5 inputs[5]=6 </code></pre> <p>I would like to read this array into another one dimensional array:</p> <pre><code>int counter=0; int * allElements = new int[6]; for(int i=0; i&lt;6; i++) { allElements[counter++] = inputs[i]; } </code></pre> <p>That is a traditional way of reading all of the elements into one dimensional array and I believe if I read the elements of "<code>allElements</code>" this way:</p> <pre><code>for(int i=0; i&lt;6; i++) printf("%d ", allElements[i]); </code></pre> <p>and it should be: <code>1 2 3 4 5 6</code></p> <p>However, I would like to read all elements of that array into the 1 dimensional array such that when I do it like this:</p> <pre><code>for(int i=0; i&lt;6; i++) printf("%d ", allElements[i]); </code></pre> <p>It should be: <code>1 3 5 2 4 6</code></p> <p>How can I achieve this way?</p>
c++
[6]
172,627
172,628
com.android.ddmlib.SyncException: No space left on device?
<p>I know, This question has been asked many times in here, but all of them were for emulator.</p> <p>I'm trying to install APK with size of around 45MB size, and I have mentioned in manifest file to prefer external to install APK. I'm trying to install this on htc desire. well I could actually install on the emulator, but for device installation I get following console error Failed to install xxx.apk on device 'HTXXXXX': No space left on device [2012-05-01 09:55:18 - xxx] com.android.ddmlib.SyncException: No space left on device [2012-05-01 09:55:18 - xxx] Launch canceled!</p> <p>More Info: - Logcat has no clue about this - I have 7GB space left in sdcard - I could install the app using APK installer.</p>
android
[4]
1,981,311
1,981,312
Dynamic Dialog using jQuery
<p>I have an image next to each radio button on a form. The number and content of radio buttons are fetched from a database. I'm trying to create a click event on those images, which provides a quick intro about the respective option. </p> <pre><code>$('#icon').click(function() { $('#dynamicid').dialog(); return false; }); </code></pre> <p>I know how to create a dialog on click, but not how to create it from div whose id and content are fetched from DB using php. How can I do that?</p> <p>P.S: I'm new to jQuery.</p>
jquery
[5]
3,868,595
3,868,596
Need to improve the performance of code for unzipping files
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4504291/how-to-speed-up-unzipping-time-in-android">How to speed up unzipping time in Android?</a> </p> </blockquote> <p>I wrote this code to unzip files but it takes too much time to unzip even a small file of 20Kb. Any suggestions?</p> <pre><code>package recycle.pack.age; import android.util.Log; import java.io.File; import java.io.*; import java.util.zip.*; public class Decompress { private String _zipFile; private String _location; public Decompress(String zipFile, String location) { _zipFile = zipFile; _location = location; _dirChecker(""); } public void unzip() { try { FileInputStream fin = new FileInputStream(_zipFile); ZipInputStream zin = new ZipInputStream(fin); ZipEntry ze = null; while ((ze = zin.getNextEntry()) != null) { Log.v("Decompress", "Unzipping" + ze.getName()); if(ze.isDirectory()) { _dirChecker(ze.getName()); } else { FileOutputStream fout = new FileOutputStream(_location + ze.getName()); for (int c = zin.read(); c != -1; c = zin.read()) { fout.write(c); } zin.closeEntry(); fout.close(); } } zin.close(); } catch(Exception e) { Log.e("Decompress", "unzip", e); } } private void _dirChecker(String dir) { File f = new File(_location + dir); if(!f.isDirectory()) { f.mkdirs(); } } } </code></pre>
java
[1]
1,745,608
1,745,609
how to get the value in jquery from unknown type element
<p>in my page i want to get the value of a div or textbox.</p> <p>in two different different condition he can be div and textbox it is sure</p> <p>how i can get the value of div or textbox when i am sure that it was only div or textbox but not sure that it was div or textbox.</p> <p>any method can help me to get the value even he was div or textbox. </p>
jquery
[5]
3,437,888
3,437,889
Can header() redirects be counted on to end the program flow?
<p>In a PHP program can header() redirects be counted on to end the program flow, or is there value in, for example, following them with a die() to be safe? Is it possible for the user to exploit the script by somehow forgoing the redirects? This question is crucial in a case where the user is redirected for not having sufficient access permissions and the code following is intended only for those who were not redirected.</p>
php
[2]
4,840,318
4,840,319
Learning jQuery, where/how to start
<p>I just started using javascript about 2 months ago. I'm still really noob at it, but.. Anyway, I've been hearing a lot about jQuery and have had people suggest I start looking into it. So, I think now is the time, but I have no idea how to use it, or even where to start learning.<br/> Does anyone have any good ideas of ways I can start getting my feet wet with jQuery? Perhaps a simple learning project? Maybe some good tutorials, reference manuals, books on jQuery? Anything to help me start learning in the right direction, thx!</p>
jquery
[5]
2,247,437
2,247,438
when I use global scope variable without 'var', its showing me Error. why?
<p>See my example code below</p> <pre><code>&lt;script&gt; alert(a); // undefined alert(b); // It is Error, b is not defined. var a=1; b=10; &lt;/script&gt; </code></pre> <p>When both variable a and b are in global scope, why I am getting error message for b. But there is no error message for variable a ? what is the reason ?</p> <p>can anyone please explain me ?</p>
javascript
[3]
5,590,222
5,590,223
Developing Iphone game - adding images at random
<p>I am currently writing an iPhone game for my coursework - space ship flying through space, if asteroid is hit ship slows down, if star collected, ship speeds up - I currently have the ship travelling through space and one instance of a star and one instance of an asteroid each added using:</p> <pre><code>asteroid = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Asteroid.png"]]; [self addSubview:asteroid]; </code></pre> <p>and </p> <pre><code>star = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"StarImage.png"]]; [self addSubview:star]; </code></pre> <p>I would like to add multiple instances of these objects to the game in a random fashion, However I am unsure of the best way to do do this. Does anybody have any suggestions??</p> <p>Cheers x</p>
iphone
[8]
4,880,229
4,880,230
How to use FileObserver for System files [Android]
<p>I wan to monitor changes in android system file<br> <code>"/sys/class/net/eth0/operstate"</code> for monitoring ethernet state.</p> <p>I have written an File Observer class but i am not getting any events in <code>public void onEvent(int event, String path)</code> call back function. </p> <p>Do we need any special type of permissions for observing android system files?<br> Do i need to run my APK as root.</p> <p>Thanks.</p>
android
[4]
2,878,118
2,878,119
box wont maximize further
<p>Hello i have this app written in C# and it wont maximize further even though the code forcefully specifies the size, the window doesn't follow it. Other windows app follows the size that i specified but this one doesn't (been figuring what might go wrong but it seems a bug). Thanks stackoverflow</p> <p><img src="http://i.stack.imgur.com/oRV1G.png" alt="enter image description here"></p> <p>As you can see, the running window is not following explicitly what the code tells. The dislayed window should be way larger than the current size.</p>
c#
[0]
3,117,755
3,117,756
How do i colour a BufferedImage/ Image in java?
<p>Sorry, if I asked a question that doesn't make sense, basically i just need a code snippet and possibly an explanation on how to colour in Images in java. (The images are greyscale)</p>
java
[1]
730,661
730,662
How to filter the feeds from a postano api
<p>I am working on postano api. using the following link i will get all the feeds regardless of facebook or twitter or instagram</p> <pre><code>http://www.postano.com/api/posts.php?ak=XXXXX&amp;ts=$newtimestamp&amp;sig=$newhash&amp;postano=1234&amp;start=0&amp;count=10 </code></pre> <p>But if i want to filter the feeds i need to pass something like feed_type="facebook" or "twitter" so that only respective feeds will be retrieved. !!</p> <p>I tried in some ways but failed.</p> <p>Can any one suggest me the correct path ?</p>
php
[2]
5,102,383
5,102,384
Set a variable based on the #of a url -- window.location.hash
<p>so lets say i have a url www.hello.com#one</p> <p>i know i can grab the has value</p> <pre><code>var hash = window.location.hash; alert (hash); </code></pre> <p>but rather then write (i know the below is not propper code):</p> <p>if var hash = one then set var hashValue to 1</p> <p>else</p> <p>if var hash = two then set var hashValue to 2</p> <p>else etc etc</p> <p>is there a better way to write this.</p> <p>Cheers</p>
jquery
[5]
4,248,097
4,248,098
Is there an item similar to Excel spreadsheet in C#?
<p>Is it possible to add an item in C# project that is similar to Excel spreadsheet? I need to add a report for my tests that would have TestName, TestStatus, Time, etc in each column.</p>
c#
[0]
4,949,533
4,949,534
NavigateURl leads to HTTP Error 400 - Bad Request
<p>Ok I have a gallery with thumbnail images that is sorrounded with a tags like this</p> <pre><code>&lt;asp:Repeater ID="Repeater" runat="server"&gt; &lt;ItemTemplate&gt; &lt;asp:HyperLink NavigateUrl= '&lt;% String.Format("?name = {0}", Container.DataItem) %&gt;' runat="server"&gt; &lt;asp:Image CssClass="images" ImageUrl= '&lt;%# String.Format("~/pictures/thumbs/{0}", Container.DataItem) %&gt;' runat="server"&gt; &lt;/asp:Image&gt; &lt;/asp:HyperLink&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&gt; </code></pre> <p>But when I click an image I just get the HTTP Error 400 - Bad Request error.</p> <p>Can anyone help me?</p>
asp.net
[9]
814,883
814,884
URLConnect - writing data to 3 text fields on website
<p>My program should connect to a website's login form, where I get my data from a database(username &amp; password) and it should input that into the text fields within the login form.</p> <p>This is the code i have so far, but doesnt seem to work.</p> <pre><code>try { URL url = new URL( "http://www.clubvip.co.za/Login.aspx" ); HttpURLConnection hConnection = (HttpURLConnection)url.openConnection(); hConnection.setDoOutput( true ); hConnection.setRequestMethod("POST"); PrintStream ps = new PrintStream( hConnection.getOutputStream() ); ps.print("ctl00_ContentPlaceHolder1_CellNumberRadText_text=username&amp;amp;ctl00_ContentPlaceHolder1_PasswordRadText_text=password&amp;amp; ps.close(); hConnection.connect(); if( HttpURLConnection.HTTP_OK == hConnection.getResponseCode() ) { InputStream is = hConnection.getInputStream(); OutputStream os = new FileOutputStream("output.html"); int data; while((data=is.read()) != -1) { os.write(data); } is.close(); System.out.println("is close"); os.close(); hConnection.disconnect(); } } catch(Exception ex) { ex.printStackTrace(); } </code></pre>
java
[1]
204,091
204,092
call the methods from one activite to other( java.lang.IllegalStateException: System services not available to Activities before onCreate())
<p>I'm struck with some problem will calling the method from one activity to other......</p> <p>I have a activity called Transaction2 in this activity,I have a method like getProposal().I need to call this method in to the other activity called PaymentDetails. I called the method like this : I import the activity(import com.Transaction2;) in to the paymentDetails and i create an object as </p> <pre><code>Transaction2 ts2 = new Transaction2(); </code></pre> <p>and i call the method as <code>ts2.getProposal();</code></p> <p>when i called like this I am getting the exception like </p> <pre><code>java.lang.IllegalStateException: System services not available to Activities before onCreate() </code></pre> <p>Can anyone help me ?</p>
android
[4]
596,964
596,965
unique attribute values with jquery
<p>is there a way to get all the unique values for a certain attribute.</p> <p>e.g</p> <pre><code>&lt;div class="bob" data-xyz="fish"&gt;&lt;/div&gt; &lt;div class="bob" data-xyz="dog"&gt;&lt;/div&gt; &lt;div class="bob" data-xyz="fish"&gt;&lt;/div&gt; &lt;div class="bob" data-xyz="cat"&gt;&lt;/div&gt; &lt;div class="bob" data-xyz="fish"&gt;&lt;/div&gt; </code></pre> <p>I need to get all the distinct values for data-xyz attribute on div.bob,</p> <p>so it should return fish, dog and cat.</p>
jquery
[5]