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,976,720
| 2,976,721
|
jquery marking values less than selected value as checked
|
<p>I have numerous checkboxes that are prices and what I've tried to do is the following</p>
<p>When someone selects a prices/checkbox, it will automatically check the values that are less than the selected value.</p>
<p><a href="http://jsfiddle.net/ppw5z/1/" rel="nofollow">JsFiddle</a></p>
<p><strong>HTML</strong></p>
<pre><code><div class="prices">
<input type="checkbox" value="59.99" />59.99
<input type="checkbox" value="69.99" />69.99
<input type="checkbox" value="79.99" />79.99
<input type="checkbox" value="89.99" />89.99
<input type="checkbox" value="99.99" />99.99
<input type="checkbox" value="124.99" />124.99
<input type="checkbox" value="149.99" />149.99
<input type="checkbox" value="199.99" />199.99
<input type="checkbox" value="200.00" />200.00
</div>
</code></pre>
<p><strong>JQUERY</strong></p>
<pre><code>$('.prices input[type=checkbox]').live('click', function (){
console.log(this);
$(this).attr('checked', true);
var chosenPrice = $(this).val();
console.log(chosenPrice);
$(".prices input").filter(function(){
return $(this).attr("value") <=chosenPrice}).attr('checked', true);
});
</code></pre>
<p>It selects some values but it doesn't seem to work as it should be. check out the fiddle</p>
|
jquery
|
[5]
|
361,422
| 361,423
|
How can i get a client computer identifier in asp.net?
|
<p>all</p>
<p>Who can tell me how/whether I can get a client computer identifier in my asp.net/or javascript ? (The client is in network not local Intranet)</p>
<p>(What is the client computer indentifier? I think such as: Client computer MAC Address, or any hardware GUID (like CPU, Network Card, etc. ) ?)</p>
<p>Or whether any simplitify method to do it in HTML5?</p>
<p>Or whether I can get the client computer indentifier through ActiveX? (And how can i do use ActiveX, anyone who can give me some references, if the activeX can use C# to build is nice. )</p>
<p>(This is a business system, and customer is approved us to get their client computer hardware identifier, so how can i do in asp.net? )</p>
|
asp.net
|
[9]
|
1,767,543
| 1,767,544
|
jQuery hide if mouse not over element onload
|
<p>If I've got a menu, which for accessability reasons, is visible when the page loads (so if the EU doesn't have JS enabled then they can still navigate around), but I want to hide it if they do have JS enabled, then it's easy enough, just hide it. However I want it to stay open if the mouse is over the element when the event fires. </p>
<p>The problem is (with FF anyway, I presume that this applies to other browser as well) that no events fire off from the mouse to identify that it's currently over the menu if the mouse doesn't move, if that makes sense?</p>
<pre><code>$(function(){
$("#myMenu").animate({"width": 'toggle'}, 350).hide();
});
</code></pre>
<p>I've tried putting it directly into the window load event as well, however this won't work because the event parameter object shows <code>window</code> to be the current target, not the element the mouse is currently over, also this isn't good because of all the problems with window load waiting for images etc etc.</p>
<pre><code>$(window).load(function(e){
console.log(e);
$("#myMenu").animate({"width": 'toggle'}, 350).hide();
});
</code></pre>
|
jquery
|
[5]
|
527,063
| 527,064
|
Proper check to ensure scrollbars
|
<p>Ok, so I've got a pop up window from Javascript. However, this window has dynamically generated content - a person could add dozens of entries, which would fill the box, but because the box is frequently generated with little content in it, it does not naturally have a scrollbar.</p>
<p>How would I add a test in Javascript to make sure that everytime this script runs, a test to see if a scrollbar should be implemented is run, and then how would I implement the scrollbar?</p>
|
javascript
|
[3]
|
1,357,177
| 1,357,178
|
Android check for empty int variable
|
<p>How can I make this work?</p>
<pre><code>int resId = getResources().getIdentifier("image" + passedVar, "drawable", "com.fnesse.beachguide");
if (resId == null) {
image.setBackgroundResource(resId);
} else {
image.setImageResource(R.drawable.defaultimage);
}
</code></pre>
<p>I’m getting the correct response back from getResources and I can display an image but if the image doesn’t exist I would like to display a default image instead of nothing?</p>
<p>Cheers,</p>
<p>Mike.</p>
|
android
|
[4]
|
3,465,716
| 3,465,717
|
Else clause with for and while loop
|
<p>You can use the <code>else</code> clause with <code>for</code> and <code>while</code> loops (<a href="http://docs.python.org/2/reference/compound_stmts.html#for" rel="nofollow">docs</a>).</p>
<pre><code>def has_odd(l):
for num in l:
if num % 2 != 0:
print "odd's in the list"
break
else:
print "no odd's in the list"
</code></pre>
<p>This construct helps to concolidate the code as opposed to the following equivalent:</p>
<pre><code>def has_odd(l):
is_odd = False
for num in l:
if num % 2 != 0:
is_odd = True
break
if is_odd:
print "odd's in the list"
else:
print "no odd's in the list"
</code></pre>
<p>Yet, you don't see it used very often. What are the other use cases for the construct? </p>
|
python
|
[7]
|
2,992,098
| 2,992,099
|
Use grep on file in Python
|
<p>I have searched the grep answers on here and cannot find an answer. They all seem to search for a string in a file, not a <strong>list of strings</strong> from a file. I already have a search function that works, but grep does it WAY faster. I have a list of strings in a file sn.txt (with one string on each line, no deliminators). I want to search another file (Merge_EXP.exp) for lines that have a match and write it out to a new file. The file I am searching in has a half millions lines, so searching for a few thousand in there takes hours without grep.</p>
<p>When I run it from command prompt in windows, it does it in minutes:</p>
<pre><code>grep --file=sn.txt Merge_EXP.exp > Merge_EXP_Out.exp
</code></pre>
<p>How can I call this same process from Python? I don't really want alternatives in Python because I already have one that works but takes a while. Unless you think you can significantly improve the performance of that:</p>
<pre><code>def match_SN(serialnumb, Exp_Merge, output_exp):
fout = open(output_exp,'a')
f = open(Exp_Merge,'r')
# skip first line
f.readline()
for record in f:
record = record.strip().rstrip('\n')
if serialnumb in record:
fout.write (record + '\n')
f.close()
fout.close()
def main(Output_CSV, Exp_Merge, updated_exp):
# create a blank output
fout = open(updated_exp,'w')
# copy header records
f = open(Exp_Merge,'r')
header1 = f.readline()
fout.write(header1)
header2 = f.readline()
fout.write(header2)
fout.close()
f.close()
f_csv = open(Output_CSV,'r')
f_csv.readline()
for rec in f_csv:
rec_list = rec.split(",")
sn = rec_list[2]
sn = sn.strip().rstrip('\n')
match_SN(sn,Exp_Merge,updated_exp)
</code></pre>
|
python
|
[7]
|
1,890,777
| 1,890,778
|
How to create a list of all built-in PHP functions a project makes use of?
|
<p>Background: PHP allows providers to disable functions (directive "disable_functions"). So in order to get to know if your project is running on a specific server you'll have to check:</p>
<ol>
<li>What built-in (=excluding user-defined) functions is your to-be-deployed project using?</li>
<li>Are the functions available on the specific host?</li>
</ol>
<p>(Question (2) is a trivial loop over the result (1) with <code>function_exists</code>.)</p>
<p>In order to get the harvesting working (=a mostly complete set of built-in functions used on the development servers) one could create a list of functions with <code>get_loaded_extensions()</code>, <code>get_extension_funcs()</code> and <code>get_defined_functions()</code> (and access it's 'internal' array for the built-in functions).</p>
<p>Now the question: How would you extract/grep the built-in PHP functions used in the project from your (possibly hundreds of) source files?</p>
<p>It could be a nice PERL job or somethig like that. How would you do it?</p>
|
php
|
[2]
|
3,532,320
| 3,532,321
|
Performance tips about list
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/6961356/list-clear-vs-list-new-arraylistint">list.clear() vs list = new ArrayList<int>();</a> </p>
</blockquote>
<p>I have a list:</p>
<pre><code>List<Integer> l1 = new ArrayList<Integer>();
</code></pre>
<p>and added some integer variables on that list. After some operation, I need to reuse that list, so I set it to <code>null</code>.</p>
<p>Which is better, setting to <code>null</code> or using <code>.clear()</code>? Or is there another way?</p>
|
java
|
[1]
|
5,418,010
| 5,418,011
|
Android custom keyboard
|
<p>I've read the article how to implement an input service method from android website.
I want to develop a custom android keyboard with bigger keys. I've followed the SoftKeyboard example, everything is working well but something important is missing: the candidates view does not give me any candidate.
Does anyone can help how to connect the custom candidates view to internal android suggestion list?</p>
<p>Thanks for help</p>
|
android
|
[4]
|
3,223,467
| 3,223,468
|
jQuery: change css color based on inline style width
|
<p>If I have this html, how would I change the color based on the width?</p>
<pre><code> <div id="progress_bar" class="meter-bg">
<div class="meter" style="width: 67%;">
</div>
</div>
</code></pre>
<p>For example, if the width is between 0 and 33%, green. If it's 33%-66% orange. If it's 66%-100% red.</p>
|
jquery
|
[5]
|
5,141,877
| 5,141,878
|
Java package - class not found, same directory
|
<p>I have two Java classes "giveMyOb" and "dataConn" declared in the same directory. Both are public classes. "giveMyOb" has a static method "getMine()". Inside dataConn, I called the static method as </p>
<pre><code>giveMyOb.getMine();
</code></pre>
<p>When I try to compile dataConn.java, the following error is returned.</p>
<p>"Cannot find symbol</p>
<p>symbol: variable giveMyOb<br>
location : class dataConn<br>
giveMyOb.getMine(); "</p>
<p>It used to work earlier. But is not working now. Why is that?</p>
<p>Additional Information: JDK 1.6. Windows 7. 64 bit.</p>
<p>Update(30 days after the question): When compiled from Eclipse, the classes are referenced and it works. But the same won't work when compiling from command line. I was unable to figure out the reason and nothing logical comes to my mind!</p>
|
java
|
[1]
|
4,467,919
| 4,467,920
|
Issue with sorting with collection in java
|
<p>I have a hashmap:</p>
<pre><code>HashMap<String,QuoteBean> map = new HashMap<String,QuoteBean>();
</code></pre>
<p>The <code>QuoteBean</code> is a normal bean:</p>
<pre><code>class QuoteBean{
String symbol;
BigDecimal price;
BigDecimal quoteprice;
//setter and getter methods
}
</code></pre>
<p>Then, I get the values of the map which a collection of <code>QuoteBean</code> objects</p>
<pre><code>Collection obs =map.values(); //getting all the quoteobjects
List list = new ArrayList(obs); //converted to list
</code></pre>
<p>Then to sort:</p>
<pre><code>Collection.sort(list, new SymbolComparator());
</code></pre>
<p><code>SymolComparator</code> is:</p>
<pre><code>public class SymbolComparator implements Comparator<QuoteBean>{
String symbol;
@Override
public int compare(QuoteBean o1, QuoteBean o2) {
String symbol1=o1.getProductId().getSymbol();
String symbol2=o2.getProductId().getSymbol();
return symbol1.compareTo(symbol2);
}
}
</code></pre>
<p>When I execute the code I get an exeception which says cannot convert <code>String</code> to <code>QuoteBean</code> and the exception throws on the first line.</p>
|
java
|
[1]
|
4,132,949
| 4,132,950
|
Words, pdf document class/lib/jars to present Word, pdf format file to develop Android application
|
<p>I would like to build a fuction to read the format of Words,PDF or other types of document files and present it in my Android application.</p>
<p>Is there a widget, lib, class build inside Android? Or some 3rd org, that provides this for free?</p>
<p>Thanks for the help !</p>
|
android
|
[4]
|
3,856,157
| 3,856,158
|
Android is this too old
|
<p>I have just started learning android, I downloaded a package called "android developer tools" which comes with eclipse.</p>
<p>I do exactly what he does. When I am using his code after editing the xml file and going to the main code, I get lots of red lines while he does not.</p>
<p><a href="https://www.youtube.com/watch?v=I6ObTqIiYfE" rel="nofollow">https://www.youtube.com/watch?v=I6ObTqIiYfE</a></p>
|
android
|
[4]
|
1,208,387
| 1,208,388
|
Android Menu Button on 4.0 Devices
|
<p>If my target SDK is set to 11 and I am using Theme.Holo.NoActionBar, is there any way to get my menu to appear? I am using Theme.Holo for larger screens such as tablets, but purely in the interest of saving screen space, I'd like to not show the Action Bar on smartphones.</p>
<p>However, I don't know if some sort of "soft" menu button appears in this case like it does for apps targeted at earlier versions. I'm not sure if the emulator shows a realistic device screen layout, and I don't have a 4.0 phone (i.e., a Nexus) to try it on (and I'll have to wait a while to get one unless AT&T eventually gets the Nexus).</p>
|
android
|
[4]
|
4,225,532
| 4,225,533
|
Getting rid of the dollar sign?
|
<p>Ok so i am importing a csv via a PHP script I am writing and the spreadsheet has values like $4090,00 and i need to insert these values in a mysql decimal field using PHP. Is there an easy way to get rid of the $ if its present in PHP</p>
|
php
|
[2]
|
3,203,951
| 3,203,952
|
What is the "context" meaning in Android?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3572463/what-is-context-in-android">What is Context in Android?</a> </p>
</blockquote>
<p>I think its a very interesting question:
What is the "context" meaning/concept in Android ?</p>
<p>Almost any things/object need context to working properly.
What is the "context" represented? An integer ? a block of memory ?? or .....</p>
|
android
|
[4]
|
295,514
| 295,515
|
how to remove unused javascript functions, variables, and elements
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/53249/are-there-any-good-javascript-code-coverage-tools">Are there any good Javascript code coverage tools?</a> </p>
</blockquote>
<p>is there a firefox addon or something that scans a web document and tells me what javascript thing is not being used? i am doing it manually and its taking forever.</p>
<p>thanks</p>
|
javascript
|
[3]
|
2,953,126
| 2,953,127
|
Is there a better way to specify named arguments when calling in Python
|
<p><code>template.render(current_user=current_user, thread=thread, messages=messages)</code></p>
<p>Is there a dont-repeat-yourself compliant way to do <code>whatever=whatever</code>? Like a magic symbol to prepend the variable name with or something like this <code>~whatever, ~something, ~etc</code>?</p>
|
python
|
[7]
|
1,364,737
| 1,364,738
|
How to compare two files based on datetime?
|
<p>I need to compare two files based on datetime..I need to check whether these two files were created or modified with same datetime..I have used this code to read the datetime of files...</p>
<pre><code> string fileName = txtfile1.Text;
var ftime = File.GetLastWriteTime(fileName).ToString();
string fileName2 = txtfile2.Text;
var ftime2 = File.GetLastWriteTime(fileName2).ToString();
</code></pre>
<p>Any Suggestion??</p>
|
c#
|
[0]
|
570,105
| 570,106
|
Issue reading String
|
<p>I have an issue with my basic addition program everything works such as typing the value and testing if its not wrong but an issue occurs when i open my program and leave the TextView blank and press button check , the program terminates.<br>
Ive tried convert String =""; to an integer but then my program does not start.<br>
I belive it only compares integers and not String but im unsure how to overcome it<br>
Any help would be appreciated.</p>
<pre><code>int one=1, two=2;
ans = one + two;
TextView = Value;
TextView = i;
Button one,check;
i = (TextView) findViewById(R.id.display);
Value = (TextView) findViewById(R.id.answer);
one= (Button) findViewById(R.id.one);
one.setOnClickListener(this);
check= (Button) findViewById(R.id.check);
check.setOnClickListener(this);
public void onClick(View v) {
switch(v.getId()){
case R.id.one:
ans.append("1");
break;
case R.id.check:
if (answer ==(Integer.parseInt(Value.getText().toString())))
{
display.setText(one+"+"+two);
ans.setText("");
}
else
{
i.setText("Invalid");
}
break;
}
}
</code></pre>
|
android
|
[4]
|
2,600,408
| 2,600,409
|
python enums with attributes
|
<p>Consider:</p>
<pre><code>class Item:
def __init__(self, a, b):
self.a = a
self.b = b
class Items:
GREEN = Item('a', 'b')
BLUE = Item('c', 'd')
</code></pre>
<p>Is there a way to adapt the ideas for simple enums to this case? (see <a href="http://stackoverflow.com/questions/36932/whats-the-best-way-to-implement-an-enum-in-python">this question</a>) Ideally, as in Java, I would like to cram it all into one class.</p>
<p>Java model:</p>
<pre><code>enum EnumWithAttrs {
GREEN("a", "b"),
BLUE("c", "d");
EnumWithAttrs(String a, String b) {
this.a = a;
this.b = b;
}
private String a;
private String b;
/* accessors and other java noise */
}
</code></pre>
|
python
|
[7]
|
475,022
| 475,023
|
Better Way To Append To A String
|
<p>When I use a <code>foreach</code> to add content to a string i always use <code>$x .= 'content'</code> but first I have the declare that variable <code>$x = ''</code> which seems like an extra line of code that isn't needed. Is there a better way to do this?</p>
<p>Here's a good example:</p>
<pre><code>$options = array('Link 1', 'Link 2', 'Link 3')
$output = '';
foreach($options as $value) $output .= '<a href="#">' . $value . '</a>';
echo $output;
</code></pre>
|
php
|
[2]
|
4,383,358
| 4,383,359
|
Getting lat, long from iphone UDID only ...?
|
<p>how can i get lat,long information from my device UDID only ???</p>
<p>not using CoreLocation fromework , using device UDID only...!!!</p>
|
iphone
|
[8]
|
880,425
| 880,426
|
Keychain in IOS
|
<p>please, can someone tell me in a few words whats is keychain ? what's based for ? or shrare e document where i can understand,</p>
<p>thanks</p>
|
iphone
|
[8]
|
4,005,346
| 4,005,347
|
C# dynamically growing line graph
|
<p>Does anybody have a good example of a dynamically growing line graph, what i have is a program tracking users input and this input will grow varying amounts day to day but i need to graph it. Any tips of suggestions would be awesome.</p>
|
c#
|
[0]
|
3,319,508
| 3,319,509
|
JAVA - find element in linked list
|
<p>I need to solve this problem:</p>
<p>Write a method <code>find()</code> that takes an instance of <code>Stack</code> and
a <code>String</code> <code>key</code> as arguments and returns <code>true</code> if some node in the list has <code>key</code> as
its <code>item</code> field, <code>false</code> otherwise. Test your function in a test client. This test
client may be the main function in the class <code>Stack</code>.</p>
<p>In Java, this is what I've got so far:</p>
<pre><code>public class Stack<Item>
{
private Node first;
private class Node
{
Item item;
Node next;
}
public boolean isEmpty()
{
return ( first == null );
}
public void push( Item item )
{
Node oldfirst = first;
first = new Node();
first.item = item;
first.next = oldfirst;
}
public Item pop()
{
Item item = first.item;
first = first.next;
return item;
}
public static void main( String[] args )
{
Stack<String> collection = new Stack<String>();
String key = "be";
collection.find( key );
while( !StdIn.isEmpty() )
{
String item = StdIn.readString();
if( !item.equals("-") )
collection.push( item );
else
StdOut.print( collection.pop() + " " );
}
}
public void find( String key )
{
for( Node x = first; x != null; x = x.next )
{
if( x.item == key )
StdOut.println( x.item );
}
}
}
</code></pre>
|
java
|
[1]
|
3,086,479
| 3,086,480
|
calling google places api
|
<pre><code>//here is my code
public void performSearch() throws Exception {
try {
System.out.println("Perform Search ....");
System.out.println("-------------------");
HttpRequestFactory httpRequestFactory = createRequestFactory(transport);
HttpRequest request = httpRequestFactory.buildGetRequest(new GenericUrl(PLACES_SEARCH_URL));
request.getUrl().put("key", API_KEY);
request.getUrl().put("location", latitude + "," + longitude);
request.getUrl().put("radius", 500);
request.getUrl().put("sensor", "false");
if (PRINT_AS_STRING) {
System.out.println(request.execute().parseAsString());
Log.d("--->",request.execute().parseAsString());
} else {
PlacesList places = request.execute().parseAs(PlacesList.class);
System.out.println("STATUS = " + places.status);
for (Place place : places.results) {
System.out.println(place);
Log.d("--->",place.toString());
}
}
} catch (HttpResponseException e) {
System.err.println(e.getResponse().parseAsString());
throw e;
}
}
public static HttpRequestFactory createRequestFactory(final HttpTransport transport) {
return transport.createRequestFactory(new HttpRequestInitializer() {
public void initialize(HttpRequest request) {
GoogleHeaders headers = new GoogleHeaders();
headers.setApplicationName("MyLocationHelper");
request.setHeaders(headers);
JsonHttpParser parser = null;
parser.getJsonFactory();
request.addParser(parser);
}
});
}
</code></pre>
<p>I want to develop an application to show my current location on map and than i want to search the near by places around me. at this stage i am able to draw my current location on map, but i am unable to get the response from google places api.</p>
<p>performSearch() methods makes a call to google places api. </p>
|
android
|
[4]
|
5,025,002
| 5,025,003
|
How to make my defer to work
|
<p>Need some helpt with my defer, tried to use .then and .done. But it doesnt work.
It write my console.log before my servercall is done.</p>
<pre><code>$.when(PersonAtlLawUpdate(personRef)).then(console.log('test'));
function PersonAtlLawUpdate(personRef, cbFunc) {
var selectionPanel = $('div#SelectionPanel'),
fromdate = selectionPanel.find('input#FromDateTextBox')[0].defaultValue,
timeSpan = selectionPanel.find('select#TimeSpanDropdownList').data('timespanvalue'),
url = "MonthOverview.aspx/OnePersonAtlLawUpdate";
$.ajax({
url: url,
data: JSON.stringify({ personRef: personRef, fromdate: fromdate, timespan: timeSpan }),
type: "POST",
contentType: "application/json",
dataType: "JSON",
context: document.body,
success: function (atlError) {
changePersonAtlStatusIcon(atlError, personRef);
if (cbFunc != null) {
cbFunc();
}
return atlError;
},
error: function (xhr, status, errorThrown) {
//alert(errorThrown + '\n' + status + '\n' + xhr.statusText);
}
});
}
</code></pre>
|
jquery
|
[5]
|
3,863,135
| 3,863,136
|
Not able to connect using imap_open ()
|
<p>I am trying to connect and fetch messages of my hosting's email address using imap_open(), but its throwing errors.</p>
<pre><code>$server = '{mail.booksnearby.in:143/imap/ssl/novalidate-cert}INBOX';
$imap_connection = imap_open($server, $login, $password);
$mailboxinfo = imap_mailboxmsginfo($imap_connection);
$messageCount = $mailboxinfo->Nmsgs;
</code></pre>
<p>The above throws this error: <code>Array ( [0] => Retrying PLAIN authentication after [AUTHENTICATIONFAILED] Authentication failed.</code></p>
<p>If I change $server to </p>
<pre><code>$server = '{mail.booksnearby.in:143}INBOX';
</code></pre>
<p>then it throws the following error </p>
<pre><code>Certificate failure for mail.booksnearby.in: self signed certificate:
</code></pre>
<p>If $server is </p>
<pre><code>$server = '{mail.booksnearby.in:143/imap/ssl/novalidate-cert}INBOX';
</code></pre>
<p>it throws </p>
<pre><code>Array ( [0] => TLS/SSL failure for mail.booksnearby.in: SSL negotiation failed )
</code></pre>
<p>I can connect to the email account using an email client, with the same username password.</p>
<p>I can't seem to telnet in as well. Its running apache , cpanel and dovecat. Imap with Ssl support is enabled on my hosting..</p>
|
php
|
[2]
|
1,340,419
| 1,340,420
|
get html and text of highlighted (selected) elements (spans) and store text in hidden textarea
|
<p>I want to know how to get the html and text of spans that are selected. Example html:</p>
<pre><code><span>a</span>
<span>b</span>
<span>c</span>
<span>d</span>
</code></pre>
<p>so if I highlighted with my cursor (a-b)...I would get </p>
<pre><code>var storedHtml = `<span>a</span> <span>b</span>`
var text = "ab"
</code></pre>
<p>and the text would be stored in a hidden textarea</p>
|
jquery
|
[5]
|
5,053,838
| 5,053,839
|
how to add and remove the selected checkbox id to and from arraylist in android?
|
<p>I am storing the selected checkbox value into arraylist when it is selected by the user and removing from the same arraylist when unchecked by the user. But I am having one problem with this. i.e for example I selected the checkboxes 0,1,4,6. Then I unchecked 0th checkbox. But from the arraylist 6 is removed. Next time I unchecked 1th position checkbox. But this time in from the arraylist nothing is deleted. Finally I unchecked 0 and 4 but still nothing is deleted from arraylist. The values 0,1,4 are still existing in the arraylist. How to overcome this issue?
I want to store the selected items and remove the unselected items. Please help me regarding this....</p>
<p>My Code:</p>
<pre><code>public static ArrayList<String> selchkboxlist = new ArrayList<String>();;
String chk;
cbs = new CheckBox[20];
for(k=0; k<List.size(); k++)
{
arr = List.get(k);
cbs[k] = new CheckBox(getContext());
Rl.addView(cbs[k]);
cbs[k].setText((CharSequence) arr.get(2));
cbs[k].setTextColor(Color.parseColor("#000000"));
cbs[k].setId(k);
cbs[k].setOnClickListener( new View.OnClickListener()
{
public void onClick(View v)
{
CheckBox cbs = (CheckBox) v ;
if (((CheckBox) v).isChecked()) {
chk = Integer.toString(v.getId());
selchkboxlist.add(chk);
Toast.makeText(Myclass.this, "Selected CheckBox ID" + v.getId(), Toast.LENGTH_SHORT).show();
System.out.println("selected checkboxes"+selchkboxlist);
}
else
{
selchkboxlist.remove(chk);
Toast.makeText(Myclass.this, "Not selected", Toast.LENGTH_SHORT).show();
System.out.println("un selected checkboxes"+selchkboxlist);
}
}
});
}
</code></pre>
<p>Will be thankful....</p>
|
android
|
[4]
|
2,924,854
| 2,924,855
|
Opening doc,docx,Excell files inline of Ie 7.0
|
<p>Problem :-
I am dealing with doc,.docx,xls,.xlsx, Pdf, files with in a ASP.NET application.,</p>
<p>While I am clicking a button of Gridview, I need to open that file with in IE 6.0/7.0 BROWSER window., Office files like .docx, .doc, .xls, .xlsx , asking for <strong>open and save</strong> .. or Opening out side of the BROWSER. Browser getting close automatically..</p>
<p>But for pdf its working fine..</p>
<p>Code: Response.Clear();
Response.ContentType = "application/pdf";
strFilePath=
Response.WriteFile(strFilePath);</p>
<p>SAME CODE USED - with the content type of "application/msword";</p>
<p>But instaed of opening with in browser, its opening out side and automatically, Browser getting closed.</p>
<p>Could you please help me on this.. </p>
<p>Thanks
Karthikeyan</p>
|
asp.net
|
[9]
|
3,536,918
| 3,536,919
|
Javacript not work on chrome while its enable in settings
|
<p>This script is working only on firefox and in chrome it gives me that error:</p>
<p><code>Uncaught TypeError: Cannot call method 'substring' of undefined</code></p>
<pre class="lang-html prettyprint-override"><code><script type="text/javascript">
function hidediv()
{
document.getElementById('divright').style.display = 'none';
document.getElementById('divleft').style.margin = "0 auto";
document.getElementById('divleft').style.cssFloat = "none";
}
function showdiv()
{
document.getElementById('divright').style.display = 'block';
document.getElementById('divleft').style.cssFloat = "left";
}
</script>
<div class="right_links">
<nav class="reader_nav"><!-- html5 nav tag -->
<span class="content" id="show4" onmouseover="tooltip.show('Content', 300);" onmouseout="tooltip.hide();" ></span>
<span id="show5" class="prefrance" onmouseover="tooltip.show('Settings', 250);" onmouseout="tooltip.hide();" ></span>
<span id="show" class="search" onmouseover="tooltip.show('Search', 210);" onmouseout="tooltip.hide();"></span>
<span id="show2" class="about" onmouseover="tooltip.show('About this book', 204);" onmouseout="tooltip.hide();"></span>
<span id="show3" class="help" onmouseover="tooltip.show('Help', 120);" onmouseout="tooltip.hide();" ></span>
</nav>
</div>
</code></pre>
|
javascript
|
[3]
|
5,154,905
| 5,154,906
|
Reading Unicode characters in Java
|
<p>I am using "FileInputStream" and "FileReader" to read a data from a file which contains unicode characters.</p>
<p>When i am setting the default encoding to "cp-1252" both are reading junk data, when i am setting default encoding to UTF-8 both are reading fine.</p>
<ol>
<li>Is it true that both these use System Default Encoding to read the data?</li>
<li>Then whats the benifit of using Character stream if it depends on System Encoding.</li>
<li><p>Is there any way apart from:</p>
<pre><code> BufferedReader fis = new BufferedReader(new InputStreamReader(new FileInputStream("some unicode file"),"UTF-8"));
</code></pre>
<p>to read the data correctly when the default encoding is other than UTF-8.</p></li>
</ol>
|
java
|
[1]
|
995,394
| 995,395
|
How to pack existing database in iphone DocumentDirectory instead of resourcePath
|
<p>I want to pack my big database with iphone app and I don't want to copy a database from resource path to document directory for readonly problem. It's have other way to pack database to document directory or remove database from resource path after copy.</p>
<p>Thanks.</p>
|
iphone
|
[8]
|
4,862,727
| 4,862,728
|
PHP, skip first and last line of a text file using fgets
|
<p>I'm trying to figure out how to skip the first and last line of a text file when I'm reading it while using <code>fgets()</code>. The first line could be solved with an <code>if(!$firstLine)</code>, but I'm not sure how to ignore the last line or if my solution for ignoring the first line is the best choice.</p>
|
php
|
[2]
|
1,570,588
| 1,570,589
|
PHP: what is the easiest way to dump class constants into array
|
<p>I'm having a class with a list of constants. I want something like <code>get_object_vars</code> to dump constants into array. What is the simpliest way to do that?</p>
<p>Thank you in advance!</p>
|
php
|
[2]
|
50,787
| 50,788
|
How do you refresh a window in Tkinter
|
<p>If I created Tkinter window with some text that filled the whole window and now wanted to replace the window with a new text, is there a way to refresh the window? </p>
<p>For Example:</p>
<pre><code> a= 100
win= Tk()
win.geometry("500x300")
while a > 0:
if a%2 == 0:
lbl = Label (win, bg = "purple")
lbl.pack()
else:
lbl = Label (win, bg = "blue")
lbl.pack()
a= x-1
</code></pre>
<p>The problem with this code is that the Tkinter window does not refresh and just provides the end result instead of showing the windows changing colors.
Thanks for the help! </p>
|
python
|
[7]
|
1,600,865
| 1,600,866
|
In Jquery, how do I apply a class to every third (or fourth) instance of an element with a particular class?
|
<p>This is what I'm trying to do: <a href="http://jsfiddle.net/ZfwPT/" rel="nofollow">http://jsfiddle.net/ZfwPT/</a></p>
<p>i.e. make every first, sixth, eleventh, etc element with class "Noted" green,
and make every second, seventh, twelfth, etc. element with class "Noted" blue,
and so on. </p>
<p>I've been trying to use eq() but I think I'm doing something wrong: </p>
<p><code>$('span.Noted').eq(n/5).addClass('Note'n)</code></p>
<p>which to me means, take the number the item has (whether it's #5 or #100 in the series) and divide it by five, and then use that number to assign it a class. Then in CSS I have Note1 {color:green} etc. </p>
<p>There must be an easier way of doing this, right? </p>
|
jquery
|
[5]
|
5,079,271
| 5,079,272
|
C# for each ITERATION
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/13283184/c-sharp-column-formatting">C# Column formatting</a> </p>
</blockquote>
<p>well im in this tricky part of my code and is stuck for the time being so im asking for some help. I'm developing this in C# also. Here's piece of my code that the deals with it:
The method display is what im having trouble on the others are right. The problem output is wrong and has something to do with the for each loop. PLease take a look at the links of what my output looks like now and what im trying to make it look like please </p>
<pre><code>thanks alot guys the question was answered
</code></pre>
|
c#
|
[0]
|
2,387,508
| 2,387,509
|
how to configure the php RAR Archive in php.ini in windows
|
<p>step1:</p>
<pre><code>; Windows: "\path1;\path2"
include_path = ".C:\Zend\ZendServer\etc\php\PEAR";
</code></pre>
<p>step:2</p>
<pre><code>extension_dir = "C:\Zend\ZendServer\etc\php.ini ";
; On windows:
extension_dir = "C:\Zend\ZendServer\etc\php.ini "
</code></pre>
<p>step3:</p>
<pre><code>extension=php_bz2.dll
extension=php_curl.dll
extension=php_dba.dll
;extension=php_phar.dll
extension=php_rar.dll
;
[PECL]
;extension=php_ming.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_oci8.dll
</code></pre>
<p>I edit this 3 steps in php.ini files but am not unable to see the rar archive</p>
|
php
|
[2]
|
2,447,869
| 2,447,870
|
Detect relatives?
|
<p>i'm working on a virtual village project that is like this. there are 50 men and 50 woman they age and randomly marry with someone, they have kids and when they reach 80 they start to die.
i have a abstract c# class called human:</p>
<pre><code>abstract class Human
{
enum GenderType { Male, Female };
int Age;
bool Alive;
string Name;
GenderType Gender;
Human Father;
Human Mother;
Human Partner;
Human[] Children;
public abstract bool Check(ref List<Human> People, int Index);
}
</code></pre>
<p>and two child from Human class called Man and Woman. My question is how can i override Check method in Man/Woman class to be able to detect female/male relatives that is illegal to marry with. for example Mother, sisters, aunts, sisters in law, mothers in law and so on.</p>
|
c#
|
[0]
|
3,173,011
| 3,173,012
|
array except other
|
<p>I have 2 arrays:</p>
<pre><code>arr1 = [a,b,c,d,e]
arr2 = [c,d,e]
</code></pre>
<p>I want to give array arr1 except arr2.</p>
|
python
|
[7]
|
1,011,782
| 1,011,783
|
Meaning of statement class a(b)
|
<p>I have one doubt in C++ progaramming.</p>
<p>what is the meaning of statement <code>class a(b)</code> in c++ and also how to implement this?
Can we declare a class like this?</p>
|
c++
|
[6]
|
139,175
| 139,176
|
How can I hide ‘code behind’ files in asp.net? i.e. files with .cs extension
|
<p>And creates dlls for all code behind files.</p>
|
asp.net
|
[9]
|
2,486,413
| 2,486,414
|
how to find out the vat from total amount and percetage value in javascript
|
<p>This following code for get back to vat value from percentage value and amount value using java script but its not accuracy.</p>
<pre><code>var vat=((25*100)/447);
vat=vat.toFixed(1);
</code></pre>
|
javascript
|
[3]
|
1,971,398
| 1,971,399
|
Help needed on contains()
|
<p>Here is the HTML code of a radio button </p>
<pre><code><input type="radio" class="grgrgrtgxxxxfeegrgbrg">
</code></pre>
<p>I am trying to check whether radio button's name is having xx.<br>
Here is my jquery code i have written </p>
<pre><code>if($(this).prop('class').contains('xxxx'))
{
alert("Yup");
}
</code></pre>
<p>Please tell me the Syntax mistake in it.</p>
|
jquery
|
[5]
|
2,582,678
| 2,582,679
|
Put a Firefox window in full screen mode
|
<p>I've projected an Intranet Ajax application and I want put it in
a full screen mode so it seems as a real stand alone application.</p>
<p>My problem is that with Firefox 3 the <code>window.open</code> with options to
put the window in full screen mode not work well. I have always
the tile bar the url bar and the status bar.</p>
<p>Is there a way to hide that bars?</p>
<p>I remember not well that there is a way to write a script in a
signed way that the user can accept that.......</p>
<p>Any idea?</p>
|
javascript
|
[3]
|
1,322,091
| 1,322,092
|
Create wav to swf using swfdotnet library
|
<p>I am developing a <code>wav</code> to <code>swf</code> converter using the <code>swfdotnet</code> library. Are there any available samples of using it to convert <code>wav</code> to <code>swf</code>?</p>
|
c#
|
[0]
|
5,761,591
| 5,761,592
|
ADO.net using VS2010
|
<p>I am learning C# and I have succeeded in creating my own Windows Forms applications.</p>
<p>I tried many websites to learn something about ADO.NET, but everything failed.</p>
<p>I couldn't connect/create a database to my form.</p>
<p>Suggest me some easy tutorials.</p>
<p>It would be better if any .NET professional help me with practical examples from the basics.</p>
|
c#
|
[0]
|
2,961,037
| 2,961,038
|
What faults are there to coding a character sheet as an enumeration?
|
<p>I am working on creating a character sheet for a RPG I'm tinkering with. I figure out all the data I need the character sheet to keep, but I am not sure if the way I am doing it is most economical in the sense of speed and resources. Right now I have an enumeration with three types: NPC, MONSTER, PLAYER. Inside the enumeration I have a class that will store and handle all getting/setting for the stats and derived attributes. Are there any disadvantages to writing it this way? Does anyone have any suggestions?</p>
<p>TFYT ~Aedon</p>
|
java
|
[1]
|
1,439,124
| 1,439,125
|
How to remove vibrate effect from the iphone device
|
<p>I am implementing chat application.I have implemented vibrate effect when user get bips.but i want to remove vibrate effect and implement sound effect.how it is possible?</p>
|
iphone
|
[8]
|
2,421,564
| 2,421,565
|
Starting One Android App from Another App
|
<p>What is the best way to start one android app from another app? Is it to send custom broadcast event and have broadcast receiver of other app catch this event and do a start activity on something? Thanks</p>
|
android
|
[4]
|
4,184,172
| 4,184,173
|
C# Void function return values to string
|
<p>I have this void function, and since a void function doesn't return values, how can I pass the strings to the below method when I click the search button?</p>
<p>I need to make the if else statement to return the correct value, but the return doenst work since it is void :(</p>
<pre><code>private void btnSearch_Click(object sender, EventArgs e)
{
string brand;
string model;
string type;
string club;
//brand
if (this.cbBrand.SelectedValue == null)
{
brand = "";
}
else
{
brand = this.cbBrand.SelectedValue.ToString();
}
return brand;
//model
if (this.cbModel.SelectedValue == null)
{
model = "";
}
else
{
model = this.cbModel.SelectedValue.ToString();
}
return model;
//type
if (this.cbType.SelectedValue == null)
{
type = "";
}
else
{
type = this.cbType.SelectedValue.ToString();
}
return type;
//club
if (this.cbClub.SelectedValue == null)
{
club = "";
}
else
{
club = this.cbClub.SelectedValue.ToString();
}
return club;
searchMain(brand, model, type, club);
}
</code></pre>
|
c#
|
[0]
|
414,825
| 414,826
|
changing the default voice in android tts?
|
<p>hi is there a way by which one can change the default voice (female) in the android tts? like if i want some other voice (male)?</p>
|
android
|
[4]
|
5,207,338
| 5,207,339
|
store user prefrences in jQuery
|
<p>I have the following code for my ad system: </p>
<pre><code> function showandhide()
{
if ($('.showandhide').html() == 'show ads')
{
$('.showandhide').html("show ads");
$('.ads').hide();
}
else
{
$('.showandhide').html("hide ads");
$('.ads').show();
}
}
</code></pre>
<p>The code is very simple. It hides and shows ads in my website. The problem is that it does not store the user preferences. How do I store them? Is there a fast way without using a database? I do not feel like creating a code to store information to my database just for hiding and showing ads. Is there any other fast solutions? maybe something in jQuery?</p>
|
jquery
|
[5]
|
3,495,281
| 3,495,282
|
Aspx Page Level windows authentication?
|
<p>I have a document approval workflow application. The workflow sends emails to appropriate users with links for Accept/Reject the document. </p>
<p>When the user clicks on Accept or reject link, an aspx page is shown, where he can type a comment and submit.</p>
<p>Now the question is I want Windows Authentication on this aspx page. If the user is authenticated I want its Userid to be checked against database if his role/profile has priveledge to view the page.</p>
<p>How should I achieve this? </p>
|
asp.net
|
[9]
|
1,403,771
| 1,403,772
|
WndProc assignment issue
|
<p>I am attempting to make a custom GLWindow class that includes all of my setting up of my OpenGL window. However, I also want to include the WndProc callback function for messages being sent to the window in my GLWindow class.</p>
<pre><code>GLWindow.h:
class GLWindow
{
private:
HWND hWnd;
HDC hDC;
HGLRC hRC;
public:
GLWindow();
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
bool Create();
~GLWindow();
}
GLWindow.cpp:
GLWindow::GLWindow()
{
}
bool GLWindow::Create(int width, int height, char * title, bool fullscreen)
{
WNDCLASSEX window;
HINSTANCE hInstance;
hInstance = GetModuleHandle(NULL);
window.cbSize = sizeof(WNDCLASSEX);
window.cbClsExtra = 0;
window.cbWndExtra = 0;
window.hbrBackground = NULL;
window.hIcon = LoadIcon(NULL, IDI_APPLICATION);
window.hIconSm = LoadIcon(NULL, IDI_WINLOGO);
window.hCursor = LoadCursor(NULL, IDC_ARROW);
window.hInstance = hInstance;
window.lpfnWndProc = GLWindow::WndProc; // ERROR
}
GLWindow::~GLWindow()
{
}
</code></pre>
<p>The Error is that a value of type "LRESULT (__stdcall GLWindow::*)(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)" cannot be assigned to an entity of type "WNDPROC."</p>
<p>I can't figure it out</p>
<p>I've gotten this to work when WndProc shares the same .cpp file as the WinMain function, but it seems as if the scope throws it off.</p>
|
c++
|
[6]
|
5,895,698
| 5,895,699
|
C# compiler can't find interface Extension Method?
|
<p>I have an interface:</p>
<pre><code>public interface: IA { ... }
</code></pre>
<p>and I try to extend it into </p>
<pre><code>class public A : IA {
private static void foo(this IA a) {
a.foo();
}
}
</code></pre>
<p>but compiler says, that it can't find foo(), with first parameter of type IA.
How can I fix it?</p>
|
c#
|
[0]
|
220,538
| 220,539
|
Create a new unique global variable each time a function is run in javascript
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/5117127/javascript-dynamic-variable-name">Javascript dynamic variable name</a> </p>
</blockquote>
<p>A very basic question. I want to create a new javascript global variable each time a function is called. The variable should contain the id of the element so that I can easily access it later. </p>
<pre><code>id = 2347
//this function would be called multiple times, hopefully generating a new global each time
function (id)
{
var + id = something
// I want a variable that would be named var2347 that equals something, but the above line doesn't get it.
}
</code></pre>
<p>In a later function, I want to access the variable like so:</p>
<pre><code>function two (id)
{
alert(var + id);
}
</code></pre>
<p>I'm sure I'm going to have a "doh!" moment when someone is kind enough to answer this.</p>
|
javascript
|
[3]
|
3,779,499
| 3,779,500
|
Button function not working correctly on dynamic content
|
<p>I am having a bit of trouble with an app i am building for an iPhone using phonegap and jQuery. i have found several threads that have told me to use <code>on</code> function for content created dynamically. However, i cannot get the buttons to work correctly. The follownig code creates the buttons from a loop statement;</p>
<p><code>$("#question").append('<button class="next">ClickMe</buttons>');</code></p>
<p>The following code is my click function</p>
<p><code>$(".next").on("click", function(){
alert("working");
});</code></p>
<p>So far, there are 3 buttons created, but they do not produce the alert and i get no error messages. Can anyone help explain what i have done wrong?</p>
|
jquery
|
[5]
|
6,010,813
| 6,010,814
|
Android get contact number using name
|
<p>I am trying to make an application on android that takes the contact name as a string input and returns his phone number if that contact exists in the phone book...</p>
<p>I tried searching around but there is no clear tutorial as to how to do exactly that</p>
<p>input:contact name
outputs:the phone number</p>
<p>please help </p>
<pre><code> Cursor cursor = context.getContentResolver().query(ContactsContract.Contacts.CONTENT_URI,null, null, null, null);
while (cursor.moveToNext()) {
String name = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
if(name.equalsIgnoreCase(token3)) {
try{ ContentResolver cr = context.getContentResolver();
Cursor pCur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ?", new String[] { ContactsContract.CommonDataKinds.Phone._ID}, null);
String lname = pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
Toast.makeText(context, "number is "+lname, Toast.LENGTH_LONG).show();
}catch (Exception e) {
// TODO: handle exception
}
}
}
</code></pre>
<p>it's what I have so far. the piece of code in the try catch block always crashes. </p>
|
android
|
[4]
|
467,779
| 467,780
|
How can I set a label form database
|
<p>I want to set a label with something out a database.<br>
This is my query:</p>
<pre><code> string strQuery = "Select * FROM Contacts Where User='" + strSelectedUser + "'";
SqlCommand command = new SqlCommand(strQuery, Global.myConn);
SqlDataAdapter da = new SqlDataAdapter(command);
da.Fill(Global.ds, "Tabel");
</code></pre>
<p>Now I want to set a label</p>
<pre><code>lblContact.Text=......[column database = name]....?
</code></pre>
<p>How do I do that?</p>
|
asp.net
|
[9]
|
1,632,288
| 1,632,289
|
Javascript string.indexOf('') causing webpage to hang
|
<p>This line of code seems to make my webpage become unresponsive and I'm not sure why and it does run the code. This is Javascript. I am using Firebug on firefox to debug.</p>
<pre><code>i = response.indexOf(',');
</code></pre>
|
javascript
|
[3]
|
1,780,436
| 1,780,437
|
jquery replace row in table with fadein/fadeout
|
<p>I have a table which I want to update a single row in after an ajax update has completed. The rows all have an id which is the line number of the order. I've tried a variety of things, but no joy.</p>
<p>This is the current command...</p>
<pre><code>wsHtml += '<tr id="idLine'+data[0].ORDS1_LINE+'">';
wsHtml += '<td class="RightNoWrap" >' + data[0].ORDS1_LINE + '</td>';
.....
wsHtml += '</tr>';
$('#idLine'+data[0].ORDS1_LINE).fadeOut(1000,function(){ $(this).html(wsHtml).fadeIn(1000); });
</code></pre>
<p>Thanks</p>
|
jquery
|
[5]
|
3,904,777
| 3,904,778
|
How do I validate ajax delete with PHP
|
<p>I use ajax to POST a post id and current user id to a URL to delete this post, but i think it's not safe because anyone can post those parameters. How to make sure the user who send this Ajax POST is the post owner?</p>
|
php
|
[2]
|
3,771,583
| 3,771,584
|
save and read a file on disk
|
<p>I have a matrix with double elements that is produced in my application, I want to save it on disk and in another application read it and access each elements in matrix. How Can I do this?</p>
|
java
|
[1]
|
5,741,286
| 5,741,287
|
UITapGestureRecognizer not working
|
<p>UITapGestureRecognizer is not working for me, I wonder if anyone can help.</p>
<p>Here is my view definition:</p>
<pre><code>@interface MainDisplayView : UIView <UIGestureRecognizerDelegate>
</code></pre>
<p>In the implementation, I have this in a method which is definitely being called:</p>
<pre><code>UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(goToPrevious:)];
[tapRecognizer setDelegate:self];
[tapRecognizer setNumberOfTapsRequired:1];
[tapRecognizer setNumberOfTouchesRequired:1];
[myView addGestureRecognizer:tapRecognizer];
</code></pre>
<p>as well as this method:</p>
<pre><code>- (void)goToPrevious:(UITapGestureRecognizer*)recognizer {
NSLog(@"GO TO PREVIOUS");
}
</code></pre>
<p>I am testing in the simulator, and clicking in "myView" - but nothing happens.
Thanks a lot!</p>
<p>Edited the code formatting.</p>
|
iphone
|
[8]
|
4,709,324
| 4,709,325
|
Char array to long to char array
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/6370894/converting-a-four-character-string-to-a-long">Converting a four character string to a long</a> </p>
</blockquote>
<p>I want to convert a char array to a long and back again but I'm a bit stuck.</p>
<p>This is a fragment of the code I've got so far:</p>
<pre><code>char mychararray[4] = {'a', 'b', 'c', 'd'};
unsigned long * mylong = (unsigned long *)&mychararray;
cout << *mylong << endl;
</code></pre>
<p>Which should take the char array, and represent the first 4 bytes (the length of a long) as a long (I think).</p>
<p>Is this correct? And how would I undo it to get the char array back?</p>
<p>Thanks for your help.</p>
<p>EDIT: The third line was a typo - *mychararray should have been *mylong</p>
|
c++
|
[6]
|
378,781
| 378,782
|
Access the phone internal storage to push in SQLite database file
|
<p>I am developing my android application using Netbeans and java. When I am using the emulator I can access the File explorer and insert an SQLite database in to device internal memory by accessing the following path, <code>data/data/com.example.helloandroid/database</code></p>
<p>But I can not access this location to push the SQLite File in to the phone's internal storage (location) when I am using the real device. </p>
<p>Can someone please help me how to add the file in to phones internal storage. Thanks</p>
|
android
|
[4]
|
1,331,702
| 1,331,703
|
Solved - Android - cannot use external library
|
<p>I was asked to make a project work in Android and I am a complete noob in this aspect and, well... things are not working...</p>
<p>I have created a little code in Java which uses libraries - this code works perfectly. I am now trying to make this code work on Android but I have problems...
It seems I cannot use any element from the libraries I imported to my Android project. The project loads on the phone perfectly fine when no instance of the library is created, but when I make use of the library the app crashed and I get errors.</p>
<p><a href="http://i.imgur.com/OILHQ.jpg" rel="nofollow">http://i.imgur.com/OILHQ.jpg</a></p>
<p>Here is what the project package looks like</p>
<p><a href="http://i.imgur.com/HQEX9.jpg" rel="nofollow">http://i.imgur.com/HQEX9.jpg</a></p>
<p>The part with the arrow is what I think makes the program crashed. When I remove this line, everything works fine.</p>
<p>I checked online about problems with Android and external libraries but I could not understand everything... Could you help me pinpoint exactly what is wrong and how to solve this?
Thanks!</p>
|
android
|
[4]
|
1,946,043
| 1,946,044
|
python data types are classes or data structures?
|
<p>All I am new to python programming.I referred different tutorials in python,few Authors says In python like Numbers(int,float,complex),list,set,tuple,dictionary,string are data types some of theme says data-structure few are says classes.i am confused which is correct. </p>
<p>I'm doing an essay on Python and found this statement on a random site, just wondering if anyone could clarify and Justify your answer.</p>
|
python
|
[7]
|
4,763,946
| 4,763,947
|
php writing to csv from an array
|
<p>Ive looked around and ive found similar examples and gave them a shot but I can't get mine to work...</p>
<p>Here is mine...It doesnt work..What am I doing wrong :S?
The type of POST is arrays so I guess I have to convert it to string to make it work..
The names and numbers look like this:
Array ( [0] => john Hartz [1] => Cindy Cinamon [2] => Fruit Cake ) Array ( [0] => 9058553699 [1] => 4167641345 [2] => 4167641543 ) </p>
<pre><code><?php
error_reporting(-1);
$list = array (
$_POST['names'],
$_POST['numbers']
);
$fp = fopen('numbers.csv', 'w');
foreach ($list as $fields) {
fputcsv($fp, $fields);
}
fclose($fp);
?>
</code></pre>
<p>The below works...
<pre><code>$list = array (
array('aaa', 'bbb', 'ccc', 'dddd'),
array('"aaa"', '"bbb"')
);
$fp = fopen('file.csv', 'w');
foreach ($list as $fields) {
fputcsv($fp, $fields);
}
fclose($fp);
?>
</code></pre>
<p>here is the more new version, somewhat working but not quite...</p>
<pre><code><?php
error_reporting(-1);
$name = implode(",", $_POST['names']);
$num= implode(",", $_POST['numbers']);
$list = array (
array($name, $num)
);
$fp = fopen('numbers.csv', 'w');
foreach ($list as $fields) {
fputcsv($fp, $fields);
}
fclose($fp);
?>
</code></pre>
<p>brady, the problem isnt formatting....You see where you have "|" between names or numbers.... that im guessing shows the border between 1 cell and the other....well what I am getting is an ENTIRE array into ONE cell...So something like this...</p>
<pre><code>|"john Hartz" "Cindy Cinamon" "Fruit Cake"|
---------------------------------------
| 905855369941676413454167641543 |
</code></pre>
|
php
|
[2]
|
2,851,122
| 2,851,123
|
Javascript window.scrollBy not working on particular page
|
<p>window.scrollBy is not working on the following page
<a href="http://www.resident.co.il/aspx/places.aspx?t=4&a=1" rel="nofollow">http://www.resident.co.il/aspx/places.aspx?t=4&a=1</a></p>
<p>Any idea what can be the problem ? </p>
|
javascript
|
[3]
|
769,931
| 769,932
|
Xml Deserilization
|
<p>I have a control on aspx form. I select a xml file and deserialize it on localhost. It works fine. But I upload project files to my IIS server, select file and click deserialize button from client side, it gives me an error as below.</p>
<p>There is an error in XML document (0, 0). Root element is missing.</p>
<p>Code Details.</p>
<p>In aspx file </p>
<pre><code><input type="file" id="fD" runat="server"/>
<asp:Button ID="btnXMLLoad" runat="server" Text="Load XML" onclick="btnXMLLoad_Click" />
</code></pre>
<p>In .cs file btnXMLLoad_Click event </p>
<pre><code>XmlSerializer serializer = new XmlSerializer(typeof(transfer));
FileStream fs = new FileStream(_fileName, FileMode.OpenOrCreate);
TextReader reader = new StreamReader(fs);
transfer input = new transfer();
input = (transfer)serializer.Deserialize(reader);
</code></pre>
<p>It works local machine but users can not load XML file on the internet.</p>
<p>Please advise me..</p>
|
asp.net
|
[9]
|
5,831,744
| 5,831,745
|
using IPC under Service
|
<p>Please can anyone tell me what is, and when would it be good to use "IPC" ?</p>
<p>thanks,</p>
<p>ray.</p>
|
android
|
[4]
|
2,884,763
| 2,884,764
|
TypeError when assigning a random value from a list to a variable?
|
<p>I have a list and I want to assign a random element from that list to a new variable five times in order to generate a hand of cards. I've searched, and I can't seem to understand why my random.choice is causing errors.</p>
<pre><code>import random
cards = { '2' '3' '4' '5' '6' '7' '8' '9' 'J' 'Q' 'K' 'A' }
for newCard in range(5):
newDraw = random.choice(cards)
playerdeck.append(newDraw)
if newDraw in playerdeck:
playermatches = playermatches + 1
newDraw = oldDraw
</code></pre>
<p>When I try to run it I get this error:</p>
<pre><code>Traceback (most recent call last):
File "C:\Users\Nathaniel\Desktop\Fcard.py", line 6, in <module>
newDraw = random.choice(cards)
File "C:\Python32\lib\random.py", line 253, in choice
return seq[i]
TypeError: 'set' object does not support indexing
</code></pre>
|
python
|
[7]
|
5,267,267
| 5,267,268
|
returning code of function instead of result
|
<p>I saved a function created in jQuery in clean.js file..</p>
<pre><code>jQuery.fn.singleDotHyphen = function(){
return this.each(function(){
var $this = $(this);
$this.val(function(){
return $this.val()
.replace(/\.{2,}/g, '.')
.replace(/-{2,}/g, '-');
});
});
};
</code></pre>
<p>My action file is..</p>
<pre><code><script type="text/javascript">
$(document).ready(function() {
$.noConflict();
$('#title').limitkeypress ({ rexp:/^[A-Za-z.\-\s`]*$/ });
$('#title').blur(function() {
$(this).singleDotHyphen();
});
});
</script>
</code></pre>
<p>Issue is onblur its returning me code of the function where as I want to return the string that reject continuous hyphen and dots...</p>
|
jquery
|
[5]
|
4,406,816
| 4,406,817
|
Cleanest way to combine two shorts to an int
|
<p>I have two 16-bit shorts (s1 and s2), and I'm trying to combine them into a single 32-bit integer (i1). According to the spec I'm dealing with, s1 is the most significant word, and s2 is the least significant word, and the combined word appears to be signed. (i.e. the top bit of s1 is the sign.)</p>
<p>What is the cleanest way to combine s1 and s2?</p>
<p>I figured something like</p>
<pre><code>const utils::int32 i1 = ((s1<<16) | (s2));
</code></pre>
<p>would do, and it seems to work, but I'm worried about left-shifting a short by 16.</p>
<p>Also, I'm interested in the idea of using a union to do the job, any thoughts on whether this is a good or bad idea?</p>
|
c++
|
[6]
|
5,004,840
| 5,004,841
|
Library types in Stanley Lipmann's "C++ Primer"
|
<p>Newbie to C++ but I am a Java programmer. Trying to learn C++ now. Reading the C++ Primer by Stanley Lipmann.</p>
<p>I don't understand this sentence in Chapter 3 about library types. He's talking about library type string and vector:</p>
<blockquote>
<p>These library types are abstractions of more primitive types - arrays and pointers - that are part of the language</p>
</blockquote>
<p>Could it be he meant:</p>
<blockquote>
<p>These library types are abstraction type rather than primitive types like arrays and pointers which are part of the language</p>
</blockquote>
<p>Is my interpretation correct?</p>
|
c++
|
[6]
|
1,575,083
| 1,575,084
|
change image transition timeout
|
<p>I'm trying to work out some of the variables of a JQuery-based scripts I got here: <a href="http://www.dreamcss.com/2009/04/create-beautiful-jquery-sliders.html" rel="nofollow">http://www.dreamcss.com/2009/04/create-beautiful-jquery-sliders.html</a></p>
<p>Specifically I'm trying to work out how to change the delay between slide transition, whether I can disable the auto-transitioning or not (and how), and how to change the sliding speed of the images. Which variables do they rely on? Thanks for the help.</p>
|
javascript
|
[3]
|
236,545
| 236,546
|
Instance fields don't initialize if overridden base method is called during class initialization
|
<p>There's a base class <code>ServerAdapter</code>:</p>
<pre><code>public abstract class ServerAdapter {
public ServerAdapter() {
initGUI();
}
protected abstract void initGUI();
}
</code></pre>
<p>And a child class that inherits <code>ServerAdapter</code>:</p>
<pre><code>public abstract class LinuxServerAdapter extends ServerAdapter {
protected CheckBox key = new CheckBox();
public LinuxServerAdapter() {
super();
}
@Override
public void initGUI() {
//NPE is thrown here, because key = null
key.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
//Something happens here
}
});
}
}
</code></pre>
<p>End class that inherits LinuxServerAdapter:</p>
<pre><code>public class MyLinuxServerAdapter extends LinuxServerAdapter {
public MyLinuxServerAdapter() {
super();
}
public static void main(String args[]) {
ServerAdapter server = new MyLinuxServerAdapter();
}
}
</code></pre>
<p>NPE is thrown when I try to add clickHandler on a key.</p>
<p>Why <code>key</code> isn't initialized? Is this a case where initialization order works in a specific way?</p>
|
java
|
[1]
|
2,631,410
| 2,631,411
|
Defining operators and testing for null
|
<p>I have a class in C# where I define the operator ==. The method I have currently throws an object is null exception when testing the following</p>
<pre><code>MyClass a = new MyClass(); if(a==null)....
</code></pre>
<p>This is frustrating because in the definition of the operator i can't ask if either parameter is null because it will just go into infinite recursion.</p>
<p>How do I test to see if either parameter is null when defining the == operator.</p>
|
c#
|
[0]
|
5,933,670
| 5,933,671
|
using textfield of second view in first view
|
<p>I'm making a client-server program for iphone and i want to use my serverIP which is a part of my second view in the first view serverIP is a uitextfield. i use to enter the value of ServerIP in second View but i want to use the value of serverIP IN Firstview. </p>
<p>""secondview.h"" interface file</p>
<pre><code>#import <UIKit/UIKit.h>
@interface secondview : UIViewController {
IBOutlet UIView *view;
IBOutlet UITextField *serverIP;
IBOutlet UITextField *noc;
IBOutlet UIButton *save;
IBOutlet UIButton *back;
IBOutlet UIButton *load;
IBOutlet UILabel *display1;
}
-(IBAction) back;
-(IBAction) save;
-(IBAction) load;
@property (nonatomic,retain) IBOutlet UITextField *serverIP;
@property (nonatomic,retain) IBOutlet UITextField *noc;
@property (nonatomic , retain) IBOutlet UILabel *display1;
@end
</code></pre>
<p>""secondview.m"" implementation file</p>
<pre><code>#import "secondview.h"
@implementation secondview
@synthesize serverIP,noc,display1;
-(IBAction) save{
[[NSUserDefaults standardUserDefaults] setInteger:serverIP forKey:@"save"];
NSUserDefaults *myname = [NSUserDefaults standardUserDefaults];
[serverIP resignFirstResponder];
}
-(IBAction) load {
serverIP = [[NSUserDefaults standardUserDefaults] integerForKey:@"load"];
NSUserDefaults *myname = [NSUserDefaults standardUserDefaults];
}
-(IBAction) back {
[self.parentViewController dismissModalViewControllerAnimated: YES];
}
- (void)dealloc {
[super dealloc];
}
@end
</code></pre>
|
iphone
|
[8]
|
641,555
| 641,556
|
android target api not visible
|
<p>i have installed android sdk.
i have also downloaded and installed the adt plugin in my eclipse ide.
now when i go to preferences to set the path for android sdk, when i set the path and then press apply-- automatically the target api should be listed below. But they are not being listed below for some reason.
what could be the problem?
thank you in advance</p>
|
android
|
[4]
|
6,000,465
| 6,000,466
|
about savedinstances
|
<p>Simple app with a variable (x) and 3 buttons (previous, next, random).</p>
<p>Everything ok but when I change oriented of mobile x goes to previous value and I don't understand why.</p>
<pre><code> @Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState != null) {
int x = savedInstanceState.getInt("x");
button4.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Random generator = new Random();
int random = generator.nextInt(b);
boolean flag = generator.nextBoolean();
x=random;
savePos();
textView1.setText(""+prog[x]);/
public void savePos(){
editor.putInt("x", x);
}
</code></pre>
<p>full code is huge, but should be ok for understand.</p>
|
android
|
[4]
|
229,645
| 229,646
|
Window.open with Parameters Options not working
|
<p>I am using window.open as shown below </p>
<pre><code>window.open("<%=forHyperLink%>",'name_' + Math.random(),'height=600,width=800,resizable=0');
</code></pre>
<p>But i dont want to have Title Window and URL address Bar not to visible and also the Borders not to be visible . </p>
<p>Please help me , as how to do this </p>
|
javascript
|
[3]
|
2,647,459
| 2,647,460
|
Repeated execution of a java file
|
<p>I have a java file which i want to execute repeatedly on a machine. The file should be executed automatically as soon as the previous instance of the file execution is over. How to achieve this?</p>
|
java
|
[1]
|
3,357,167
| 3,357,168
|
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\html\Login\checklogin.php on line 23
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2973202/mysql-fetch-array-expects-parameter-1-to-be-resource-boolean-given-in-select">mysql_fetch_array() expects parameter 1 to be resource, boolean given in select</a> </p>
</blockquote>
<p>Hello im trying to get my login system going and i keep getting this error here is my code:</p>
<pre><code><?php
$host="localhost";
$username="root";
$password="power1";
$db_name="members";
$tbl_name="users";
$link = mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$Email=$_POST['Email'];
$Password=$_POST['Password'];
$Email = stripslashes($Email);
$Password = stripslashes($Password);
$Email = mysql_real_escape_string($Email);
$Password = mysql_real_escape_string($Password);
$sql="SELECT * FROM $tbl_name WHERE Email='$Email' AND password ='$Password'";
$result=mysql_query($sql, $link) or die ('Unable to run query:'.mysql_error());
$count=mysql_num_rows($result);
if($count==1){
session_register("Email");
session_register("Password");
header("location:login_success.php");
}
else {
echo "Wrong Email or Password";
}
?>
</code></pre>
<p>Its working now</p>
|
php
|
[2]
|
5,243,824
| 5,243,825
|
Automatically Scroll down using php
|
<p>hi can anyone help me with this problem: i have a php page which has a lot of information in iy. i want to do something like in wikipedia. in wikipedia the table of contents are all links. so if the user decided not to scroll down just to read the topic, the user will just rely on the links on the table of contents and when the user clicks it, the page will automatically scroll itself and will stop on that topic. i wanna do something like that in my php page. can anyone help me? kindly show me a sample code. thanks</p>
|
php
|
[2]
|
3,403,445
| 3,403,446
|
Android Game development error :Too many open files
|
<p>I am developing an android game and i tried to set a background of the MenuView of my game, how ever when i run it, after 1 min it will be force closed.
error messages: 1.Could not create 966656-byte ashmem mark stack: Too many open files
2.dvmHeapBeginMarkStep failed; aborting
3.VM aborting
i've spent a whole night and nothing works....does anyone know how to fix that?</p>
<pre><code>//MenuView
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
boolean retry = true;
while (retry){
try {
thread.join();
retry = false;
}catch ( InterruptedException e){
//try again shutting down the thread
}
}
}
protected void onDraw(Canvas canvas) {
canvas.drawBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.background), 0,0,null);
}
//MenuViewThread
public MenuViewThread( SurfaceHolder surfaceHolder, MenuView menu){
super();
this.surfaceHolder = surfaceHolder;
this.menu = menu;
}
@Override
public void run() {
Canvas canvas;
while (running) {
canvas = null;
// try locking the canvas for exclusive pixel editing on the surface
try {
canvas = this.surfaceHolder.lockCanvas();
synchronized (surfaceHolder) {
// update game state
// draws the canvas on the panel
this.menu.onDraw(canvas);
}
} finally {
// in case of an exception the surface is not left in
// an inconsistent state
if (canvas != null) {
this.surfaceHolder.unlockCanvasAndPost(canvas);
}
} // end finally
}
}
</code></pre>
|
android
|
[4]
|
1,792,880
| 1,792,881
|
connecting PIC16f877A with Pyserial
|
<p>my project is a 3D application designed with blender 2.59(which uses python) and i need to connect it with an external hardware using PIC16f877a, and its my first experience with this kind of projects.
my Questions are:
For the Pic program, can i write it with C or i have to write it with Python ?
for the serial port interface using pyserial can you help me with writing the code by tutorials or links to read the data from the pic and display it on the application that i have ?
Thanks in advance :)</p>
|
python
|
[7]
|
1,665,227
| 1,665,228
|
How do you learn about new or less-known Java tools/libs?
|
<p>How do you learn about new or less-known Java tools/libs? For example where did you learned about Lombok or jDBI for the first time (if you use them at all)?</p>
<p>Some project like Guice, Guava, Mockito, Joda Time are very common to hear about but some are not.</p>
|
java
|
[1]
|
513,219
| 513,220
|
hover over the button in android
|
<p>Is there anyway to change the appearance of a button when the user clicks on it? for example change the color or make it dark? Like using CSS in ASP.net to hover over a word or a link.</p>
|
android
|
[4]
|
1,147,998
| 1,147,999
|
Creating a dynamic app in Android
|
<p>I am currently looking to create an application in Android where a user can answer a questionnaire and that information is saved. The questionnaire will be in a sqlite database and can have different set on answers, and their can be several questionnaires the user can choose to fill. how do i go about firstly having the ability to create a dynamic questionnaire view for the user?</p>
|
android
|
[4]
|
4,868,310
| 4,868,311
|
PHP - Problems calling a function with parameters
|
<p>I need to call a function, in PHP, that accepts 3 parameters, RGB Values. This function converts RGB color values to HSL values, so <code>(R,G,B)</code> is needed in the parenthesis.</p>
<p>This is my function:</p>
<pre><code>function RGBtoHSL($red, $green, $blue) {
// convert colors
}
</code></pre>
<p>Which, if I make a test call of the following, it works just fine:</p>
<pre><code>RGBtoHSL(255,0,0);
</code></pre>
<p>and also works like this:</p>
<pre><code>RGBtoHSL(255,000,000);
</code></pre>
<p>Now, further down my page I have a variable <code>$displayRGB</code> which holds the current pixels RGB values in this format <code>xxx,xxx,xxx</code>. I've echoed this variable to test the format matches my requirements and it does, but when I try and add this variable to my function caller, it fails with the error "Missing argument 2, Missing argument 3" and points to this line:</p>
<pre><code>RGBtoHSL($displayRGB);
</code></pre>
<p>I'm still teething in PHP (come from ASP), can somebody please help point me in the right direction and pass me my dummy?</p>
|
php
|
[2]
|
3,220,561
| 3,220,562
|
confusion with encryption
|
<p>I'm trying to write a program that generates a list with the numbers from 1 to 26 in random order, then 'encrypts' a given word using that list so that the n'th letter of the alphabet is mapped to the n'th number in the randomized list. Example:</p>
<p>the randomized list is:</p>
<pre><code>[8,2,25,17,6,9,12,19,21,20,18,3,15,1,11,0,23,14,4,7,24,5,10,13,16,22]
</code></pre>
<p>which means that the word <code>act</code> becomes <code>[8,25,7]</code> and the word <code>xyzzy</code> becomes <code>[13,16,22,22,16]</code>.</p>
<p>I have the following code, but I'm not sure how to proceed:</p>
<pre><code>#8a
def randomalpha():
a=[0]*26
count = 0
while count < 25:
r = randrange(0,26)
if r not in a:
a[count] = r
count += 1
return(a)
print(f())
#8b
ls=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
def encrypt(alphabet):
a=randomalpha()
count=0
b=input('enter a word')
for i in b: #not sure if i am ok up to here but this is when i got really confused
print(encrypt(ls))
</code></pre>
|
python
|
[7]
|
2,976,565
| 2,976,566
|
My Application gives n ot responding message
|
<p>Hi all
i have made an application which send us email everytime we cross our speed to 20kmph but after few minutes it gives me Activity Not responding Message</p>
<p>what should i do for that?</p>
<p>its like i have used JAVA MAIL APIs for sending email and used location services to track my GPS Spees.
please help</p>
|
android
|
[4]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.