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,504,246
| 2,504,247
|
Android location: Chaotic results from onNmeaReceived()
|
<p>I am bashing around with android localization and already figured out how to receive NMEA data. Unfortunately, the results seem to be very chaotic. I do only need the GPRMC sentence but get GPGGA, GPVTG etc. returned. Is there any way to control the onNmeaReceived() function?</p>
<pre><code>public class TrackingService extends Service {
private Intent broadcastIntent = new Intent("com.example.locationlogger.TestBroadcastReceiver");
private LocationManager lm;
private LocationListener ll = new LocationListener(){
//sample listener...
};
GpsStatus.NmeaListener nl = new GpsStatus.NmeaListener() {
@Override
public void onNmeaReceived(long timestamp, String nmea) {
/*
* Broadcast a message..
*/
broadcastIntent.putExtra("TESTVAR", "Received some nmea strings: " + nmea);
sendBroadcast(broadcastIntent);
}
};
@Override
public void onCreate() {
lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
}
@Override
public void onStart(Intent intent, int startId) {
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, interval * 1000, 0, ll);
lm.addNmeaListener(nl);
}
</code></pre>
<p>}</p>
|
android
|
[4]
|
536,114
| 536,115
|
Quick access to Android for a third person
|
<p>Recently I was asked if I could help someone to get quick-started to android programming.</p>
<p>What would you suggest to tell this person?
Would you explain everything by hand or just refer to external links?
Which ressources would you recommend?
This whole issue should not take too much time...assuming 2-3 hours</p>
<p>Once my access to this issue was "<a href="http://www.wrox.com/WileyCDA/WroxTitle/Professional-Android-Application-Development.productCd-0470344717.html" rel="nofollow">Professional android application development</a>".
Java basics are already preconditioned, so there's no need to explain ANYTHING.</p>
<p>For avoiding any misconceptions: This shall be just a quick start, no reference or something like this, so I just need some keywords and a hint how deeply go through it.</p>
|
android
|
[4]
|
2,541,661
| 2,541,662
|
Radio button Issue in Asp.Net
|
<p>I have some radio button pairs of same groupName. If I set one radio button to checked = True , as a result, the view is not displayed. I'm writing the code in aspx.cs but view is not updated. For other controls its get updated.</p>
<pre><code>chatSettingsNode = xDoc.SelectSingleNode("//ToolBarChatSettings/ChatSettings/AdminSettings/Emoticons");
valueChk = chatSettingsNode.InnerXml;
value = Convert.ToBoolean(valueChk);
if (value == true)
{
rbtnAdminEmoticonsYes.Checked = true;
}
else
{
rbtnAdminEmoticonsNo.Checked = false;
}
chatAdminSettingsNode = xDoc.SelectSingleNode("//ToolBarChatSettings/ChatSettings/AdminSettings/AllowGroupChats");
//If the value Equals true or false Assigned to radiobox
valueChk = chatAdminSettingsNode.InnerXml;
value = Convert.ToBoolean(valueChk);
if (value == true)
{
rbtnAllowGroupChatsYes.Checked = true;
}
else
{
rbtnAllowGroupChatsNo.Checked = false;
}
</code></pre>
<p>ASPX</p>
<p>
"/>
" GroupName="rbtngrpEmoticons" />
" GroupName="rbtngrpEmoticons" />
</p>
|
asp.net
|
[9]
|
504,282
| 504,283
|
loading pictures from folder
|
<p>hi
how I can load a picture from spaciefied folder
tnx in advanced</p>
|
c#
|
[0]
|
3,205,202
| 3,205,203
|
Getting document.getElementByName with a substring
|
<p>With the constraint that you can't use jquery, what's the best way to get all element names that start with a specific string? (These are checkboxes, and I want to clear all the others when one is checked. </p>
<p>My solution works, but it seems less than optimal; is there a better approach? </p>
<p>What I'm doing is putting the checkboxes within a div and getting all the children of the div, and then comparing their name to what I'm looking for. Here's the javascript: </p>
<pre><code><script language="javascript" type="text/javascript">
function clearCheckboxes(name, id, divtag) {
if (document.getElementById(id).checked == false) {
return;
}
var listbox = document.getElementById(divtag);
var list = listbox.childNodes;
for(var i = 0; i < list.length; i++) {
if (list[i].type != "checkbox") continue;
if (list[i].id == id) continue;
if (list[i].name.substr(0, name.length) == name)
{
list[i].checked = false;
}
}
}
</code></pre>
<p>and then the html looks like this: </p>
<pre><code><div id="tag_div_2">
<input type="checkbox" name="tags_Type_4" id="4" onclick="clearCheckboxes('tags_Type_',4,'tag_div_2');" />3 Stone Ring
<input type="checkbox" name="tags_Type_3" id="3" onclick="clearCheckboxes('tags_Type_',3,'tag_div_2');" />Engagement Ring
<input type="checkbox" name="tags_Type_2" id="2" onclick="clearCheckboxes('tags_Type_',2,'tag_div_2');" />Solitaire
<input type="checkbox" name="tags_Type_5" id="5" onclick="clearCheckboxes('tags_Type_',5,'tag_div_2');" />Wedding Set
</div>
</code></pre>
|
javascript
|
[3]
|
4,280,309
| 4,280,310
|
datagridview doesn't display data
|
<p>i want to show the data from the database onto my datagridview control i have used the following piece of code but it is not showing any data when the form loads it just shows and empty datagridview i don't get any errors what am I doing wrong</p>
<pre><code> private void Form1_Load(object sender, EventArgs e)
{
dataGridView1.AutoGenerateColumns = false;
FillData();
}
public void FillData()
{
using (SqlConnection myConnection = new SqlConnection("server=localhost;" +
"Trusted_Connection=yes;" +
"database=database; " +
"connection timeout=10"))
{
myConnection.Open();
using (SqlDataAdapter sqlDa = new SqlDataAdapter("select * from スコープ", myConnection))
{
DataTable dt = new DataTable();
sqlDa.Fill(dt);
dataGridView1.DataSource = dt;
}
}
}
</code></pre>
|
c#
|
[0]
|
96,442
| 96,443
|
Quick help working with timestamps in php
|
<p>I'm working on a calendar app and need to get the timestamps for the beginning of each day/month etc:</p>
<p>whats the best method?</p>
<pre><code>//get timestamps for start of (day, month, year)
$ts_now = time();
$ts_today =
$ts_this_month =
$ts_this_year =
</code></pre>
|
php
|
[2]
|
77,916
| 77,917
|
C# "as" keyword with objects of various types
|
<p>How to correctly rewrite this code to be <em>foolproof</em> versus various types of input parameter? Currently this code fails if, for instance, input parameter is a valid instance of <code>DateTime</code>. I've just figured that out - it was wrongly returning <code>false</code> for todays date. </p>
<pre><code> public override bool IsValid(object value)
{
string field = value as string;
if (String.IsNullOrEmpty(field))
return false;
return true;
}
</code></pre>
<p>Would be nice to know if this is possible without having multiple if statements (for every possible value
type and even for some reference types, like the string).</p>
<p>EDIT: oh, of course, the requirement is for the object to not be null or whitespace (therefore it has to be castable or parsable to string, I guess).</p>
|
c#
|
[0]
|
3,992,252
| 3,992,253
|
Takes the variable data from it's own class instead of it's child classes even when called from the child class
|
<p>Okay, it's been a while, but I'm thinking about getting back into programming.</p>
<p>Anyway, This code takes the variable data from it's own class instead of it's child classes even when called from the child class. How do i get it so it uses the child's variable data instead of it's own when called by the child?</p>
<pre><code> public class TestRPG1 {
static Player hero;
static Enemy dragon;
public static void main(String[] args) {
hero = new Player();
dragon = new Enemy();
while(dragon.hp > 0){
int choice = (int) (Math.random() * 2);
if(choice == 0)
hero.attack(dragon);
else
hero.magic(dragon);
}
System.exit(0);
}
}
public class Combatant {
int hp = 100;
int mp = 100;
int attack = 15;
int magic = 25;
int defence = 15;
int damage = 0;
String name = "null";
public void attack(Combatant target){
damage = (int) (Math.random() * attack);
System.out.println(name + " attacked the " + target.name + " for " + damage + " damage!");
target.hp -= damage;
System.out.println(target.name + " has " + target.hp + " HP left!");
}
public void magic(Combatant target){
damage = (int) (Math.random() * magic);
System.out.println(name + " shot a fireball at " + target.name + " for " + damage + " damage!");
target.hp -= damage;
System.out.println(target.name + " has " + target.hp + " HP left!");
}
}
public class Enemy extends Combatant{
String name = "Dragon";
}
public class Player extends Combatant{
String name = "Hero";
}
</code></pre>
|
java
|
[1]
|
5,959,957
| 5,959,958
|
jQuery double click, but don't select the content
|
<p>I'm using jquery's dbclick() function in order to toggle highlight of the table raw. The problem I'm facing is that whenever I double click the content of the cell is also selected. Is there an easy way to prevent content selection?</p>
<p>My code:</p>
<pre><code>if ($('.tbl_repeat').length > 0) {
$('.tbl_repeat tr').dblclick(function() {
$(this).toggleClass('tr_active');
});
}
</code></pre>
<p>Perhaps I didn't make myself clear - I don't want to disable selecting all together - only when the double click occurs - apart from this event everything else should be selectable as usual.</p>
|
jquery
|
[5]
|
3,512,005
| 3,512,006
|
getMonth getUTCMonth difference result
|
<p>I found and inconsistent result when using the JavaScript date.getMonth() and date.getUTCMonth(), but only with some dates. The following example demonstrates the problem:</p>
<pre><code><!DOCTYPE html>
<html>
<body onload="myFunction()">
<p id="demo">Click the button to display the month</p>
<script type="text/javascript">
function myFunction()
{
var d = new Date(2012, 8, 1);
var x = document.getElementById("demo");
x.innerHTML=d;
x.innerHTML+='<br/>result: ' + d.getMonth();
x.innerHTML+='<br/>result UTC: ' + d.getUTCMonth();
}
</script>
</body>
</html>
</code></pre>
<p>The output of this example is:</p>
<pre><code>Sat Sep 01 2012 00:00:00 GMT+0100 (Hora de Verão de GMT)
result: 8
result UTC: 7
</code></pre>
<p>If i change the date to (2012, 2, 1) the output is:</p>
<pre><code>Thu Mar 01 2012 00:00:00 GMT+0000 (Hora padrão de GMT)
result: 2
result UTC: 2
</code></pre>
<p>In the first example, getMonth returns 7 and getUTCMonth returns 8. In the second example, both returns the same value 2.</p>
<p>Does anyone already experiences this situation? I am from Portugal and i think that it has something to be with my GMT but i don't understand why this is happening, because the examples are running in same circumstances.</p>
<p>Thanks in advances</p>
|
javascript
|
[3]
|
4,781,091
| 4,781,092
|
JQuery How to set attribute of element using other attribute of the same element
|
<p>I want to set title text of a link calling a function which receives as parameter the id of the element and outputs the text.</p>
<p>something like</p>
<pre><code>$(a).attr('title', function() {return $(this).id + "foo"});
</code></pre>
<p>but a construct like this doesn't exist as far I know. What can I do?
Thanks.</p>
|
jquery
|
[5]
|
297,819
| 297,820
|
Removing multiple classes (jQuery)
|
<p>Is there any better way to rewrite this:</p>
<pre><code>$('element').removeClass('class1').removeClass('class2');
</code></pre>
<p>Can't use removeClass(); as it would remove ALL classes, which I don't want.</p>
<p>Thanks</p>
|
jquery
|
[5]
|
2,431,217
| 2,431,218
|
How to convert a path in python?
|
<p>How to convert a path:</p>
<pre><code>t = 'c:\temp\xx'
</code></pre>
<p>I want to get "something like" that:</p>
<pre><code>x = r't'
</code></pre>
<p>I usually uses
x = r'c:\temp\xx'
and receives
x = r'c:\\temp\\xx'</p>
<p>I don't know how to assign the 'r' to another object..</p>
|
python
|
[7]
|
3,216,109
| 3,216,110
|
How to stop is_callable from displaying includes
|
<p>I am trying to use <code>is_callable</code> to check for class and method existence, it goes very well but keeps displaying my include parameters.</p>
<p>Here is the code:</p>
<pre><code>if(!is_callable(array(self::$classy,self::$action))) {
self::$classy = 'index';
self::$action = 'index';
}
</code></pre>
<p>and here is the result:</p>
<pre><code>.;C:\php5\pear;./lib;./model;./helper;./controller;/model/;/helper/;/controller/;/lib.
</code></pre>
<p>This happens only if the return value is true which means the method is not callable or the class is not in the registered autoloadeds.</p>
<p>Any Ideas ???</p>
|
php
|
[2]
|
3,017,913
| 3,017,914
|
request headers
|
<p>איך אני יכול לדעת את כל ה – QueryStrings שנשלחו ל – Request?
יש איזה פרמטר כזה?</p>
<p>Trsnaltaion in English (as per OP):</p>
<p>How can i know the names of the Querystrings that posted to the request?</p>
|
asp.net
|
[9]
|
5,412,159
| 5,412,160
|
jQuery last Element with certain css property
|
<p>I have a list of the same divs which are hidden. Now there are few of the same div which are not hidden, how do i get the last of them?</p>
|
jquery
|
[5]
|
3,454,149
| 3,454,150
|
How to display text dynamically on pie chart in android?
|
<p>I have worked on <strong>pie chart</strong> in android. I found an <strong>excellent solution</strong> from <a href="http://tutorials-android.blogspot.in/2011/05/how-create-pie-chart-in-android.html" rel="nofollow">http://tutorials-android.blogspot.in/2011/05/how-create-pie-chart-in-android.html</a> and worked on that. I am able to display the pie chart with colors but in my application in addition to colors I need to display the text also dynamically on that pie chart. <strong>How can I display text dynamically on those pie chart slices?</strong> </p>
<p>Please help me regarding this...Will be thankful...</p>
|
android
|
[4]
|
336,625
| 336,626
|
JAVA RSA Encryption and C# MSCAPI RSA Decryption
|
<p>We have our RSA Private key stored in smartcard. The key cannot be exported out. The encryption of data is being done as described in below code snippet. </p>
<pre><code>public byte[] RsaEncrypt(PublicKey publicKey, byte[] data, byte[] pSource)
{
Cipher rsaCipher = Cipher.getInstance("RSA/ECB/OAEPWITHSHA-256ANDMGF1PADDING",
"BC");
PSource pSrc = (new PSource.PSpecified(pSource));
rsaCipher.init(Cipher.ENCRYPT_MODE, publicKey,
new OAEPParameterSpec("SHA-256", MGF1,
MGF1ParameterSpec.SHA256, pSrc));
return rsaCipher.doFinal(data);
}
</code></pre>
<p>How to decrypt the encrypted data in C#? We can use the smartcard private key using MSCAPI by below code snippet.</p>
<pre><code>public byte[] RsaDecrypt(byte[] encryptedData, bool fOAEP)
{
CspParameters cspParams = new CspParameters(0x01, "SafeSign Standard Cryptographic Service Provider");
SecureString keyPassword = new SecureString();
char[] ContainerPassword = "1234".ToCharArray();
for (int i = 0; i < ContainerPassword.Length; i++)
keyPassword.AppendChar(ContainerPassword[i]);
cspParams.KeyPassword = keyPassword;
RSACryptoServiceProvider RsaProvider = new RSACryptoServiceProvider(cspParams);
RsaProvider.Decrypt(data, fOAEP);
}
</code></pre>
<p>Both with fOAEP set true and false, we are not able decrypt the data.</p>
|
c#
|
[0]
|
4,593,367
| 4,593,368
|
Network(Socket) Programming in C#.NET
|
<p>I am a beginner to C# and want to try hands at network programming in C#.
Please tell me some best book or other resource to start with.</p>
|
c#
|
[0]
|
715,379
| 715,380
|
Databound controls data is lost while calling the asp.net handler page
|
<p>I have a button on aspx page called export on whose onclick event i am calling a ashx page which has the logic to export to excel. the button is in a 'updatepanel', also i have other databound controls in the aspx page. this works fine and the excel is generated. Now when i click on any of the databound controls in the aspx page like list box, drop down, the data populated in these controls is lost. How can i maintain the values in the databound controls in such situation?</p>
<p>Is this a expected behaviour?</p>
|
asp.net
|
[9]
|
6,010,004
| 6,010,005
|
why std::cin in step 3 is omitted?
|
<p>I don't understand, why <code>cin >> W;</code> in step 3 is omitted, if i input not a number (i.e. 's').</p>
<pre><code>#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
short W = -1;
cout << "step 1) W = " << W << endl;
cout << "give a number: ";
cin >> W;
if ( cin.fail() )
{
cout << "ERROR, bad number" << endl;
W = -1;
cout << endl << "step 2) W == " << W << endl;
cin.clear();
}
cout << endl << "step 3) W == " << W << endl;
cout << "give a number: ";
cin >> W;
cout << endl << "step 4) W == " << W << endl;
system("PAUSE");
return EXIT_SUCCESS;
}
</code></pre>
|
c++
|
[6]
|
236,068
| 236,069
|
How to find if an IP address falls in a range specified using a pattern? - ASP.NET
|
<p>If I have an IP address: 192.100.100.2 and need to ensure that it falls within a range specified using wildcard patterns. </p>
<p>The patterns can be either:</p>
<pre>
1. 192. *. *. *
2. *. *. *. *
3. 192.1**. *.2
</pre>
<p>So essentially, an asterisk or three asterisks specify the valid range. Is there something built in in ASP.NET I can use to validate the IP address or would this be more of a custom validation?</p>
|
asp.net
|
[9]
|
5,191,789
| 5,191,790
|
How to create documentation for a c++ project?
|
<p>I am using the Ubuntu OS to create a library written in c++.<br>
I've created an shared library and now I need to document my work.<br>
I would like to know what is the smartest and fastest way to do it?</p>
|
c++
|
[6]
|
923,807
| 923,808
|
Detaching, manipulating, appending
|
<p>I was reading <a href="http://jqfundamentals.com/book/index.html" rel="nofollow">jqFundamentals</a> this weekend, and Rebecca Murphey talks about:</p>
<blockquote>
<p>The $.fn.detach method is extremely
valuable if you are doing heavy
manipulation to an element. In that
case, it's beneficial to $.fn.detach
the element from the page, work on it
in your code, and then restore it to
the page when you're done.</p>
</blockquote>
<p>I have a table sort like this, which I got from "Learning jQuery", page 140:</p>
<pre><code>var rows = $table.find('tr:not(:has(th))').get();
rows.sort(function(rowA,rowB) {
...
});
$.each(rows, function(index,row) {
$table.children('tbody').append(row);
});
</code></pre>
<p>I wonder if I should detach the table and reattach it?</p>
|
jquery
|
[5]
|
838,980
| 838,981
|
jquery checkbox to set input type
|
<p>I have a html page which requires two passwords, if these do not match a div appears to say so. Within the div a checkbox is also shown when the user checks this it should change the password type to text and vice versa. I seem to be having problems detecting if the checkbox is detected or not.</p>
<pre><code>$("#password_error").html('Passwords do not match <br /> <span class="password_error"><input type="checkbox" id="password_text" /> Show Characters</span>');
$("#password_error").show("slow");
checkbox_status();
function checkbox_status()
{
if ($('#password_text').is(':checked'))
{
$('input:password[type="text"]');
}
}
</code></pre>
<p>The ID on the input box for password is "password".</p>
<p>Any advice? Thanks</p>
|
jquery
|
[5]
|
1,586,001
| 1,586,002
|
change size of MPMoviePlayerController view
|
<p>How to change size of MPMoviePlayerController views. Now it is covering full screen in landscape mode. Can we resize to half size or other size? I want display only half screen and other video related info display in remaining screen? Is it possible? </p>
|
iphone
|
[8]
|
5,661,928
| 5,661,929
|
Passing parameters to a javascript callback function
|
<p>I've been trying to work out how to pass additional parameters to a javascript callback function.</p>
<p>In similar posts users have succeeded using anonymous function (these are new to me so I may have been doing them wrong) but I just can't get them to fire.</p>
<p>The below is what I have now, I need to be able to pass the itemId to the function "ajaxCheck_Callback" as well as the response.</p>
<p>Hope this makes sense.</p>
<p>Thanks for the help.</p>
<pre><code>function delete(itemId)
{
selectpage.ajaxCheck(itemId, ajaxCheck_Callback);
}
Function ajaxCheck_Callback(response)
{
alert(response);
alert(itemId);
}
</code></pre>
<p>Thanks for the help guys. I now get undefined on my alert whereas previously this was alerting correctly.</p>
<pre><code>function delete(itemId)
{
selectpage.ajaxCheck(itemid, function () {ajaxCheck_Callback(itemid); });
}
function ajaxCheck_Callback(response)
{
alert(response);
alert(itemId);
}
</code></pre>
|
javascript
|
[3]
|
2,491,210
| 2,491,211
|
Android: is there a mechanism for one user to purchase an app for other users?
|
<p>Say a company would like to purchase my app for each of its employees. Each employee has their own Google account. But, in order for the company to pay for the app for their account, they need to log in with their account, and have access to the company's credit card information. Is there any convenient way for a company to purchase an app for its employees? </p>
|
android
|
[4]
|
3,608,670
| 3,608,671
|
How to get width from all elements in jQuery collection
|
<p>Why doesn't <code>$(".elm").width()</code> return the width of all elements combined? Is this by design, or some sort of bug?</p>
<p>Or is there some other way to get the width of all elements combined other than this:</p>
<pre><code>var width = 0;
$(".elm").each(function() {
width += $(this).width();
});
</code></pre>
|
jquery
|
[5]
|
3,058,422
| 3,058,423
|
Read Hex binary data from file in android java
|
<p>i want to convert the hex data which are in file like (53 48 DA C8 00 04) to byte array.
how could i do it.i used below code but i am getting wrong byte array data :(</p>
<pre><code>private byte[] readBinaryFile(String fileName) throws IOException {
File file = new File(fileName);
InputStream input = new BufferedInputStream(new FileInputStream(file));
ByteArrayOutputStream output = new ByteArrayOutputStream();
for (int read = input.read(); read >= 0; read = input.read())
output.write(read);
byte[] buffer = output.toByteArray();
input.close ();
output.close();
return buffer;
</code></pre>
<p>}</p>
|
java
|
[1]
|
5,129,630
| 5,129,631
|
How to implement the MediaMetadataRetriever class in android
|
<p>I have saved the java fine in the package android.media and I am allowed to create an instance of MediaMetadataRetriever class, but I am having problem with MediaMetadataRetriever.setDataSource() method. On using the path for this method, I get an error saying "Source Not Found." I am using eclipse IDE, can anyone please provide the solution?</p>
|
android
|
[4]
|
3,808,956
| 3,808,957
|
Perpetuation of boolean value while passed inside multiple function calls
|
<p>In the below code, will the cahnges made to the Boolean value modifyPerson within the function be maintained or will it change to its initial value each time a new function is called.</p>
<p>Also i would like to know what difference is there if i use primitive boolean modifyPerson instead of Boolean .</p>
<pre><code>public void validatePersonDTO(PersonDTO personDTO, TransactionLogDTO logDTO,ArrayList regionIdList,Boolean modifyPerson) {
try {
validateEffectiveIn(personDTO, logDTO,modifyPerson);
validateCdsId(personDTO, logDTO,regionIdList,modifyPerson);
validateEmpFirstName(personDTO, logDTO);
validateEmpLastName(personDTO, logDTO);
validateFinDept(personDTO, logDTO,modifyPerson);
validateEmployeeClass(personDTO, logDTO,modifyPerson);
validateWorkLoadandBudgetFTE(personDTO, logDTO,modifyPerson);
validateStatusandDescription(personDTO, logDTO,modifyPerson);
validateSalGrade(personDTO, logDTO);
validateCostRate(personDTO, logDTO);
validateJobCode(personDTO, logDTO,modifyPerson);
validateRateCardCharged(personDTO, logDTO);
validateSupervisorId(personDTO, logDTO);
}catch (Exception e) {
logDTO.setGyr("R");
logDTO.setMessage(logDTO.getMessage()+";"+"PersonDTO could not be validated");
//LOGGER.error("personDTO could not be validated: " + personDTO, e);
}
}
protected void validateEffectiveIn(PersonDTO personDTO, TransactionLogDTO logDTO,boolean modifyPerson) throws Exception{
todaysDate=convStringToDate(now(),Constants.DATE_PATTERN_LONG);
if(effIn.after(todaysDate)){
modifyPerson=true;
logDTO.setGyr("R");
logDTO.setMessage(logDTO.getMessage()+";"+"Error in Effective In date "+effIn.toString()+"cannot be greater than today’s date");
throw new Exception ("Error in Effective In date "+effIn.toString()+"cannot be greater than today’s date");
}
else{
modifyPerson=false;
}
}
</code></pre>
|
java
|
[1]
|
1,803,900
| 1,803,901
|
Javascript Uncaught TypeError : Object has no method
|
<p>in my javascript application I am getting the following error upon page load. </p>
<pre><code>Uncaught TypeError : Object #<Object> has no method 'showHideCleanupButton'
</code></pre>
<p>this appears (inside Chrome's debugger) to be blowing up inside the method 'getAllItemsForDisplay'where it calls 'this.showHideCleanupButton'</p>
<p>here is a link to it on jsFiddle:
<a href="http://jsfiddle.net/cpeele00/4fVys/" rel="nofollow">http://jsfiddle.net/cpeele00/4fVys/</a></p>
<p>Any help would be greatly appreciated :-)</p>
<p>Thanks,</p>
<p>Chris</p>
|
javascript
|
[3]
|
4,736,658
| 4,736,659
|
C/C++ switch case with string
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4165131/c-c-switch-for-non-integers">C/C++: switch for non-integers</a> </p>
</blockquote>
<p>Hi,
I need to use a string in switch case. My solution so far was to calculate the hash of the string with my hash function. Problem is I have to manually pre-calculate all my hash values for strings. Is there a better approach? </p>
<pre><code>h=_myhash (mystring);
switch (h)
{
case 66452:
.......
case 1342537:
........
}
</code></pre>
|
c++
|
[6]
|
1,561,019
| 1,561,020
|
Variable type is null in remote class
|
<p>Here is my main class</p>
<pre><code>class pMr {
const VERSION = '0.0.3';
public $_connection;
private $_sessionName = 'LoginSession';
public function __construct($function = null) {
...
$this->buildConnection('Predis');
...
}
private function buildConnection($type = 'Predis') {
...
if($type == 'Redis') {
...
} else if($type == 'Predis') {
try {
$this->_connection = new Predis\Client(array(
'host' => $_SESSION[$this->_sessionName]['hostname'],
'password' => $_SESSION[$this->_sessionName]['password'],
'database' => $_SESSION[$this->_sessionName]['database'],
));
} catch (ClientException $e) {
die($e->getMessage());
}
var_dump(gettype($this->_connection));
}
}
}
}
</code></pre>
<p>Now, when that code runs, I get <code>string(6) "object"</code>, which is expected. Now, here is another class, which is loaded inside the main class and then executed (a function is called).</p>
<pre><code>class Interface {
static $_execOnLoad = true;
public static function getRedisVersion() {
global $pMr;
var_dump(gettype($pMr->_connection));
}
}
</code></pre>
<p>Now, in that function (when its called), returns NULL. This is the same variable that returns as an object in the above code. Why is this, and what is the work around?</p>
|
php
|
[2]
|
3,089,911
| 3,089,912
|
Passing values from a class to a method of another class
|
<p>I am creating a website. The home page has a text box and drop down box in which the user enters the movie name and language to search. When the user clicks on the Search button the search result page is displayed and the results of search should be displayed in a data grid. I created session variables to pass the text of the text box and data grid to be used in the other page. The code to fetch data from the database is in a class how do i pass the values received from the database to a method of another page? This is the code i have written, it doesn't give any errors but the data grid does not get filled with results what am I doing wrong?</p>
<pre><code> //Code for search button in home page
protected void Btnsearch_Click(object sender, EventArgs e)
{
Response.Redirect("SearchResults.aspx");
Session["moviename"] = TextBox3.Text;
Session["language"] = DropDownList1.Text;
}
//Code to fetch data from database
public class movie
{
public SqlDataAdapter searchmovie(object moviename, object language)
{
connection.con.Open();
SqlDataAdapter adapter1 = new SqlDataAdapter("select
select movieName,language,director,price from movie
where moviename = '" + moviename + "' and
language = '" + language + "'",
return adapter1;
}
}
//Code in search page to fill data grid with search results
public partial class SearchResults : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
movie m = new movie();
SqlDataAdapter movieDetails = m.searchmovie(Session["moviename"],
Session["language"]);
DataSet data = new DataSet();
movieDetails.Fill(data, "movieD");
GridView1.DataSource = data.Tables["movieD"];
GridView1.DataBind();
}
}
</code></pre>
|
c#
|
[0]
|
3,934,771
| 3,934,772
|
Custom Theme resets after performing search
|
<p>I am setting a custom theme in a "Contacts" application the following way...</p>
<pre><code>public void onCreate(Bundle savedInstanceState) {
if ("Red".equalsIgnoreCase( getIntent().getStringExtra( "Theme" )))
{
super.setTheme(R.style.red);
}
else if ("Green".equalsIgnoreCase( getIntent().getStringExtra( "Theme" )))
{
super.setTheme(R.style.green);
}
else if ("Blue".equalsIgnoreCase( getIntent().getStringExtra( "Theme" )))
{
super.setTheme(R.style.blue);
}
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mainDBHelper = new DBHelper(this);
/*
* added for the search functionality
*/
Intent intent = getIntent();
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
name = intent.getStringExtra(SearchManager.QUERY);
}
</code></pre>
<p>This works great, but after using the search functionality the theme is changed back to the default. I have a separate activity where you can select your theme. That activity starts a new mainActivity intent with the String(putExtra): Red, Green, or Blue. Can someone tell me what changes I need to make to prevent this? </p>
|
android
|
[4]
|
1,093,667
| 1,093,668
|
initialize an array with dummy values
|
<pre><code> while ($row = mysql_fetch_object($result)) {
$data[] = $row;
echo "<div id='captionbox' style='width: 110px;float:left;color:#FFF;text-align:center;'>";
echo "<a href='#' class='thumb'><img class='thumb-img' value = ".$row->aid." onclick='getVote(".$row->aid.", \"".$row->atitle."\")' src='images/roadies/th".$row->aid.".jpg' /> </a>";
echo "<input type = hidden name = aid id = rd".$row->aid." value = ".$row->aid.">".$row->atitle."</input>";
echo "</div>";
}
$jsfriend = json_encode($data);
</code></pre>
<p>In the above PHP code, I am adding the mysql rows into an array $data. then i am making a JSON object from that array. before I come into the while loop I want to create the array $data and initialize the $data[0] pointer with dummy values as I do not want to use the [0] pointer values. can this be done?</p>
<p>I hope I am making sense. </p>
|
php
|
[2]
|
5,784,572
| 5,784,573
|
Show first four children with jQuery
|
<p>I have a <code><div></code> and in that div there are several <code><a></code> tags. With jQuery I want to show the first four <code><a></code> tags.</p>
<p>I have managed that with the following code:</p>
<pre><code>$('div.gallery-hor.read-more a:nth-of-type(-1n+4)').show();
</code></pre>
<p>There's one problem: IE* and later do not support the <code>:nth-of-type()</code> code.</p>
<p>Is there a workaround width jQuery to fix this problem cross-browser?</p>
|
jquery
|
[5]
|
1,377,008
| 1,377,009
|
How to replace backslashes to single backslash from the string?
|
<p>for example I have a string</p>
<pre><code>$str = "///a//b/c////d.html";
</code></pre>
<p>How to make it more compatible with valid url?</p>
|
php
|
[2]
|
4,507,625
| 4,507,626
|
buy virtual points using facebook credits as currency
|
<p>What my requirement is?
I want to implement the In-App purchase functionality in my facebook game app.
I will add some In-App purchase in app like below: Buy 100 Credits: $0.99
Buy 600 Credits: $4.99
Buy 3500 Credits: $19.99
So, suppose user buy the 100 Credits in $0.99.
And after some days suppose, after 10 days, user uses all these 100 credits. And he wants to buy more credits. Then he is purchased 600 credits in $4.99.
We can tract that user uses all his credits and we will ask to user to buy more credits.
But what type of In-App purchase will be better for that?</p>
<p>If anyone have any idea about this then please help me..</p>
<p>Its urgent.</p>
<p>Thanks</p>
|
php
|
[2]
|
3,874,966
| 3,874,967
|
State machine for a web framework?
|
<p>I have recently began learning about state machines, and i have one question: Can the workflow of a web framework be modelled using a finite state machine?</p>
<p>The reason i consider this to be a possibility is that between receiving the request and delivering the informations, there are definitively a set of states (initializing the request, routing the request, dispatching it and displaying the information - in a very simplified form).</p>
<p>Thanks.</p>
|
php
|
[2]
|
984,910
| 984,911
|
Cant find the next element using jQuery
|
<p>Ok my HTML markup is as follows:</p>
<pre><code><div class="refine_search_box">
<div class="heading">Refine Search</div>
<div class="section_heading"><a href="#">By Size</a></div>
<div class="section">
@Html.DropDownListFor(m => m.Size, new SelectList(Model.SizeList, "key", "value", Model.Size), "")
</div>
<div class="section_heading"><a href="#">By Sport</a></div>
<div class="section">
@Html.DropDownListFor(m => m.Sport, new SelectList(Model.SportList, "key", "value", Model.Sport), "")
</div>
</div>
</code></pre>
<p>My Jquery is as follows:</p>
<pre><code>$(document).ready(function () {
$("div.section").toggle();
$(".refine_search_box a").click(function (e) {
var $this = $(this);
var $div = $this.prev().nextAll(".section").first();
$this.toggleClass("selected");
$div.toggle();
e.preventDefault();
});
});
</code></pre>
<p>What I want to happen is when the link in the .section_heading is clicked I want the .section div to open thats directly after it. But my jQuery always returns nothing for $div, I thought this would be quite simple but I'm obviously missing something obvious. I'm very new to jQuery so apologise if its stupidly simple!</p>
<p>Cheers.</p>
|
jquery
|
[5]
|
2,676,873
| 2,676,874
|
Set content view in android
|
<pre><code>public class CheckitoutActivity extends Activity {
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
void change()
{
setContentView(R.layout.someview);
}
</code></pre>
<p>It does not set the view to someview in the function change. What am i doing wrong.</p>
|
android
|
[4]
|
3,686,410
| 3,686,411
|
I am getting org.apache.http.MalformedChunkCodingException: CRLF expected at end of chunk error in android internet app
|
<p>I am trying to access the internet from my application.</p>
<blockquote>
<p>We are using proxy in our company, so i entered the proxy settings for the simulator by using the -http-proxy XXXXX. </p>
<p>I added the android.permission.INTERNET in android manifest file as well.</p>
<p>When i am trying to access the internet i am getting this exception and my application is getting force closed. </p>
</blockquote>
<p>Note: When i am using the browser application in the Emulator, i am able to access the internet.</p>
<p>I just copy pasted this code
<a href="http://w3mentor.com/learn/java/android-development/android-http-services/example-of-http-get-request-using-httpclient-in-android/" rel="nofollow">http://w3mentor.com/learn/java/android-development/android-http-services/example-of-http-get-request-using-httpclient-in-android/</a></p>
<p>I am getting the error:
<strong>WARN/System.err(300): org.apache.http.MalformedChunkCodingException: CRLF expected at end of chunk</strong></p>
<p>Please help me in resolving the same.</p>
<p>Thanks & Regards,<br>
SSuman185</p>
|
android
|
[4]
|
2,174,082
| 2,174,083
|
Java library to get all kinds of internet text sources?
|
<p>is there a library to fetch all kinds of text sources. For example: </p>
<ul>
<li>fetch URL/HTML and extract text</li>
<li>fetch a list of the top 100 hits for a Google or Twitter search</li>
<li>fetch a list of trending Twitter topics</li>
<li>fetch a list of Tweets for a given #</li>
<li>fetch a list of News headlines (e.g. Google News)</li>
<li>fetch a list of News headlines for a given search word
...</li>
</ul>
<p>this are just a few examples. Think Facebook, Picasa, Delicious, etc. Is there a library that offers a unified interface to get to the data described with a single line of code?</p>
|
java
|
[1]
|
2,510,629
| 2,510,630
|
Does not read the entire input stream in android
|
<p>I am trying to read a response from a server and transform it from InputStream to String but something goes wrong and i cannot see right now why.</p>
<pre><code>InputStream is = entity.getContent();
FileOutputStream folder = new FileOutputStream(
Environment.getExternalStorageDirectory()
+ "/test.xml");
try {
byte[] buf = new byte[1048576];
int current = 0;
int newCurrent = 0;
while ((current = is.read(buf)) != -1) {
newCurrent = newCurrent + current;
folder.write(buf, 0, current);
}
System.out.println("returned folder" + folder);
folder.flush();
} catch (IOException e) {
System.out.println("error on reading input: " + e.getMessage());
}
</code></pre>
<p>This is the error:</p>
<pre><code> error on reading input: Socket closed
</code></pre>
<p>This is the error I get and another problem that i don't understand is why it does not read the entire content from InputStream(maybe because it's all in one line?).
Thanks.</p>
|
android
|
[4]
|
1,097,962
| 1,097,963
|
Multiple marker with
|
<p>I am working on an application which displays multiple marker. This marker gets refresh when location change event is encounter. can any one guide me how can i do this.
I know to place 1 marker in map view but i don't have any idea about multiple marker that also with a refreshing one</p>
|
android
|
[4]
|
5,455,975
| 5,455,976
|
Drag and Drop of items in a linearlayout
|
<p>I am trying to implement drag and drop of icons, i can implement the it but the problem is all the views in the linearlayout are being draged along with the one which i am draging..</p>
<p>im Using the viewgroup with the linearlayout..</p>
<p>Can anyone please suggest me the correct way to implement it on a single icon leaving the other unmoved?</p>
<p>manoj</p>
|
android
|
[4]
|
2,512,705
| 2,512,706
|
Selection Start Row in DatagridView
|
<p>I am using the windows DataGridView, in this grid i allowed the multiple rows selection.</p>
<p>When i am checking the <code>dataGridView1.SelectedRows[0].Index</code> it's giving last selected rows Index. Just i want from which row the selection started(Start Row).</p>
|
c#
|
[0]
|
5,230,573
| 5,230,574
|
How to access multiple textbox by getElementsByName
|
<p>I have written following code in html:</p>
<pre><code><input type="text" id="id_1" name="text_1">
<input type="text" id="id_2" name="text_2">
<input type="text" id="id_3" name="text_3">
</code></pre>
<p>Here I have to get all textBoxes in an array in javascript function whose id starts with "id". So, that I can get above two textBoxes in an array. </p>
<p>How to get all textBoxes whose id start with "id"? </p>
|
javascript
|
[3]
|
4,453,404
| 4,453,405
|
hash_hmac key definition
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/5579559/how-to-implement-hash-hmac-properly">How to implement hash_hmac properly?</a> </p>
</blockquote>
<p>I'm using the hash_hmac function to generate a keyed hash. In this function's argument I should specify a key. I'm wondering what should I use there. Like how should I come up with something and what is your advice for me. I'm afraid if I placed something general I'll be exposed to security breaches on the website I'm developing. Any advice?</p>
<p>the user has "countryOfOrigin" attribute stored for him/her, is it a good idea to use it as a key or maybe instead of the that I can use the username provided on the sign up process..</p>
|
php
|
[2]
|
3,169,493
| 3,169,494
|
How to check checkbox in jQuery
|
<p>Hi i'm using jQuery in my asp.net mvc application, in this i have created some checkboxes like</p>
<pre><code>$("#dvModules").append('<input type="checkbox" id=Module_' + jsModulesData[ctr].Code + ' name="' + jsModulesData[ctr].Name + '" value="' + jsModulesData[ctr].Code + '"> ' + jsModulesData[ctr].Name + '
');
</code></pre>
<p>i checked some of them and stored its values in database, when i enter it to this page again, i got the values from the database, but i could not check the corresponding checkboxes with their values my code is below:</p>
<pre><code>var arrModuleIDs = SelectedModuleIDs.split(',');
$(document).ready(function () {
SelectedModuleIDs = '@ViewBag.SelectedModuleIDs';
var arrModuleIDs = SelectedModuleIDs.split(',');
for (var i = 0; i < arrModuleIDs.length; i++) {
$("#Module_" + arrModuleIDs[i] + "").attr('checked', true);
//Here the arrmoduleIDs is the values from database.
}
</code></pre>
<p>here the loop is performing well but the checkbox is not checked,
can anyone help me to resolve this.</p>
|
jquery
|
[5]
|
443,141
| 443,142
|
object.style.height doesn't work
|
<p>I've googled this but didn't find an answer, this is strange. In Javascript in Firefox when I do object.style.height it doesn't return anything. Would anybody know why?</p>
<p>In CSS I've put</p>
<pre><code>#movable {
height: 100px;
....
</code></pre>
<p>In HTML I've put</p>
<pre><code><div id="movable">&nbsp;</div>
</code></pre>
<p>And in JS:</p>
<pre><code>alert(movable.style.height);
</code></pre>
|
javascript
|
[3]
|
5,977,943
| 5,977,944
|
Android MapView, finding center of map, determining end of animation from fling gesture
|
<p>The closest thing I could find related to this was the following:</p>
<p><a href="http://stackoverflow.com/questions/1773717/android-maps-how-to-determine-map-center-after-a-drag-has-been-completed">android maps: how to determine map center after a drag has been completed</a></p>
<p>I want to determine the final "resting place" of the center of the map after the user has "flung" it. I am intercepting the touch event, when the user is lifting their finger up, but this doesn't work when the map is flung with a swipe motion, as the map continues to move at that point. Is there a callback that can be implemented when the map animation is complete? I looked at the documentation for the MapView, Overlay, MapController etc classes and I haven't seen anything that seems to help.</p>
|
android
|
[4]
|
1,219,513
| 1,219,514
|
Android: Bitmaps and Performance
|
<p>I have been reading a lot of posts here on SO about image loaders, bitmaps and asynctaks to download and display images. When dealing with a small amount of bitmaps, my image loader is fine, it downloads the image and display it to the user, but it also save a WeakReference in a HashMap that I use as a cache and also save the image in the SD card in case the user needs that image to be displayed later without having to download it again. So far this is fine, my apps were working totally ok.</p>
<p>Now I started working on a new apps where the number of images to be displayed in the same screen is greater than 50 (for example), in this case the screen does not scroll smoothly, and I also find the FPS lower than the usual, delivering a bad user experience. I am running out of ideas on what to do next. Does anyone have an advice?</p>
<p>Using WeakReference instead of WeakReference improve the memory usage and also the user experience? </p>
<p>I am no scaling the bitmaps as I download them since they are already thumbnails, should I be scaling them? The images can occupy a maximum of 50% of the width of the screen.</p>
<p>Right now my main concern is not related to the download time, my concern is regarding the number of bitmaps being displayed and how smooth the scroll should be. I am not using gridview, I am using masonry component from <a href="http://code.google.com/p/android-masonry" rel="nofollow">http://code.google.com/p/android-masonry</a></p>
<p>What kind of suggestions do you guys have to me? Where should I start be looking at? </p>
<p>Thanks
Thiago</p>
|
android
|
[4]
|
3,951,972
| 3,951,973
|
simple webservice code?
|
<p>i write a simple webservice code in asp.net when i build the service and run the service it is working fine. when i try to access the webservice it is giving some problem , problem means i am not getting that method (webservice method). After completing writing the webserivce i take a asp.net page (.aspx) and in solution explorer i add a webservices and it is added successfully. but when i adding namespace it is not getting the service name ( i not able to add the namespace of websercice</p>
|
asp.net
|
[9]
|
3,297,664
| 3,297,665
|
Jquery difference between searching 'children' and 'find'
|
<p>When is one preferred over the other when searching for nested DIvs?</p>
|
jquery
|
[5]
|
3,073,805
| 3,073,806
|
Navigation bar with tabbar in Android
|
<p>I need to place a <strong>NavigationBar</strong> along with a <strong>TabBar</strong> .Kindly suggest me tutorials regarding the same. </p>
|
android
|
[4]
|
626,546
| 626,547
|
GET DIR URL of current script
|
<p>This is current script url : localhost/do/index.php -> I want a var or function that return localhost/do :) (something like $_SERVER['SERVER_NAME'].'/do');</p>
|
php
|
[2]
|
2,057,814
| 2,057,815
|
Is there a PHP class that helps to embed IPTC data into JPEG?
|
<p>Is there a PHP class that helps to embed IPTC data into JPEG?</p>
|
php
|
[2]
|
1,801,564
| 1,801,565
|
C# SetHelpKeyword problem
|
<p>I have this code in a form constructor</p>
<pre><code>help = new HelpProvider();
this.help.HelpNamespace = @"C:\temp\help.chm";
this.help.SetHelpNavigator(this.button1, HelpNavigator.KeywordIndex);
this.help.SetHelpKeyword(this.button1, "key1lic");
this.help.SetHelpNavigator(this.button2, HelpNavigator.KeywordIndex);
this.help.SetHelpKeyword(this.button2, "test index");
</code></pre>
<p>When I have the focus on button1 and press F1 help.chm opens at "key1lic" index (there is a page for this index). But when I set the focus on button2 and press F1 the help file opens at the same index, that is, "key1lic", instead of "test index".</p>
<p>Same happens when I try to use the HelpProvider control and I manually set the index for each button.</p>
<p>Can someone explain me what I'm doing wrong ?</p>
<p>Thank you,
Mosu'</p>
<p>Edit:
Ok, this is very hilarious! This is focus problem and not a HelpProvider problem.
I was never setting the focus on the other button. I was just putting the mouse on it but this does not change the focus :-))</p>
|
c#
|
[0]
|
539,466
| 539,467
|
jQuery - how can I find the element with a certain id?
|
<p>I have a table and each of its td has a unique id that corresponds to some time intervals (0800 til 0830... 0830 til 0900 and so on). And I have an input text where the user will type the time intervals the they want to block. And if they type an interval that doesn't exist in my table, in other words, if they type an interval that doesn't correspond to any of my td's id's, I want to show an alert saying something like "this interval is not available for blocking".</p>
<p>But, I'm having difficult in find this id.
I'm doing this:</p>
<pre><code>var horaInicial = $("#horaInicial").val().split(':')[0] + $("#horaInicial").val().split(':')[1]; // this is remover the ":" from a formatted hour
var verificaHorario = $("#tbIntervalos").find("td").attr("id", horaInicial);
</code></pre>
<p>But this "verificaHorario" is actually setting all my td's to this horaInicial id.</p>
<p>So, how can I find an id in my table and if it doesn't exist show some alert.</p>
<p>thanks!!</p>
|
jquery
|
[5]
|
1,871,125
| 1,871,126
|
Find function and line number where variable gets modified
|
<p>Let's say that at the beginning of a random function variable $variables['content'] is 1,000 characters long.</p>
<p>This random function is very long, with many nested functions within.</p>
<p>At the end of the function $variables['content'] is only 20 characters long. </p>
<p>How do you find which of nested functions modified this variable?</p>
|
php
|
[2]
|
782,496
| 782,497
|
What is the most future-proof way to perform Java bytecode instrumentation?
|
<p>I wish to perform Java bytecode instrumentation from JDK 1.5 onwards. Is there a way to do this that works across most JVMs and is supported in future versions of the JDK?</p>
|
java
|
[1]
|
2,968,253
| 2,968,254
|
How to run a project remotely in android?
|
<p>I have an android project and I want to run the project in an emulator in another computer using eclipse or some other way. Is it possible?</p>
|
android
|
[4]
|
5,900,210
| 5,900,211
|
What is the purpose of Finalization in java?
|
<p>Different websites are giving different opinions.</p>
<p>My understanding is this:</p>
<p>To clean up or reclaim the memory that an object occupies, the Garbage collector comes into action. (automatically is invoked???)</p>
<p>The garbage collector then dereferences the object. Sometimes, there is no way for the garbage collector to access the object. Then finalize is invoked to do a final clean up processing after which the garbage collector can be invoked.</p>
<p>is this right?</p>
|
java
|
[1]
|
4,750,312
| 4,750,313
|
typeof is an operator and a function
|
<p>In JavaScript <code>typeof</code> is an operator and a function. Is it better used as an operator or a function? Why?</p>
|
javascript
|
[3]
|
3,042,676
| 3,042,677
|
Java and SwingSet
|
<p>I have seen some libraries call swingset. But I am new to java and don't have any Idea what is it. Can anyone tell me what is it. I have heard about swing but no swingset</p>
<p>Thank you</p>
|
java
|
[1]
|
2,199,856
| 2,199,857
|
My intent putExtra into two different names with different value. But I get same value in another activity?
|
<p>I have two names which suppose to get two different string value. Why S0 and S1 all get "ABC"? </p>
<p>DF=""</p>
<p>DWF="ABC"</p>
<p>Alarm.putExtra(com.Md.AlarmReminder.D0, DF);
Alarm.putExtra(com.Md.AlarmReminder.D1, DWF);</p>
<p>In another activity:
Bundle extras = getIntent().getExtras();</p>
<p>s0 =extras.getString(com.Md.AlarmReminder.D0);
s1 =extras.getString(com.Md.AlarmReminder.D1);</p>
|
android
|
[4]
|
2,088,064
| 2,088,065
|
How to remove digit () using regex in php?
|
<p>I have a sample code:</p>
<pre><code>Acer phones (36)
Yezz phones (13)
Nokia phones (371)
Apple (1)
</code></pre>
<p>How to remove (digit) in this text
I am using <code>preg_replace("^\(d\)$", "", $name[$i]);</code> // With <code>$name[$i] is Acer phones (36), Yezz phones (13)...</code></p>
|
php
|
[2]
|
4,199,601
| 4,199,602
|
Java Variable type and instantiation
|
<p>This has been bugging me for a while and have yet to find an acceptable answer. Assuming a class which is either a subclass or implements an interface why would I use the Parent class or Interface as the Type i.e.</p>
<pre><code>List list = new ArrayList();
Vehicle car = new car();
</code></pre>
<p>In terms of the ArrayList this now only gives me access to the List methods. If I have a method that takes a List as a parameter then I can pass either a List or an ArrayList to it as the ArrayList IS A List. Obviously within the method I can only use the List methods but I can't see a reason to declare it's type as List. As far as I can see it just restricts me to the methods I'm allow to use elsewhere in the code.</p>
<p>A scenario where List list = new ArrayList() is better than ArrayList list = new ArrayList() would be much appreciated.</p>
|
java
|
[1]
|
3,962,766
| 3,962,767
|
Testing App Store "Distribution" version
|
<p>Is there a way to test the App Store Distribution bundle that's to be submitted to iTunes Connect, on a device, e.g. iPod Touch? </p>
<p>Also, for the distribution bundle is it important to remove the file "Entitlemenets.plist"?</p>
|
iphone
|
[8]
|
4,317,812
| 4,317,813
|
writing text on an image
|
<p>I want to write a discount amount which is coming from a Database onto an image. I have taken an image like:</p>
<pre><code><div style="height: 158px; width: 210px; float: left; position: relative;">
<a id="aproduct" runat="server">
<asp:image id="pimage" runat="server" width="210" height="158" border="0" />
</a>
<asp:Panel ID="Panel1" runat="server">
<asp:image id="discountTag" style="position: absolute; top: 0; right: 0;"
border="0" src="images/PriceTag.png" alt=""
height="35px" width="35px" />
</asp:Panel>
</div>
</code></pre>
<p>I want to show discountTag image as background to <code><td></code> and show discount amount in a label.</p>
<p>I try for this, but when I do this the big image on which I am showing my discountTag label are not getting aligned properly. I want the o/p like Big image on which discountTag image on which discount amount. Can anybody do this?</p>
|
asp.net
|
[9]
|
3,461,452
| 3,461,453
|
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 < row:
## for-while
j = 0
while j < col:
if not myMap[i][j].getIsActive():
cls.isFilled = False
j += 1
i += 1
return cls.isFilled
</code></pre>
|
python
|
[7]
|
1,310,779
| 1,310,780
|
android- How to Support Multiple screens
|
<p>I implemented the application which supports different normal screens. For this, i created the 3 folders(like layout-normal-ldpi,layout-normal-mdpi,layout-normal-hdpi) in the res folder. In this i placed the different xml files with same name.But i got android.content.res.Resources$NotFoundException. How to handle this? can anybody help me.</p>
<p>thanks.</p>
|
android
|
[4]
|
1,986,073
| 1,986,074
|
How to get datakeys value in a gridview
|
<p>I try to delete a record in Gridview and Database .I added a boundfield button and set the CommandName to <strong>Deleterecord</strong> in the RowCommand event I want to get the primary key of this record to delete that(primary key value does not show in the grid view. The following block of code shows this event(I try to show some data in a text box):</p>
<pre><code>protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Deleterecord")
{
TextBox1.Text = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString();
//bla bla
}
}
</code></pre>
<p>I also set </p>
<pre><code>DataKeyName="sourceName"
</code></pre>
<p>in the gridview but it is not my primary key</p>
<p>If I click this button an exception occured like this:
<strong>Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index</strong>
How can I solve this problem</p>
|
asp.net
|
[9]
|
2,659,493
| 2,659,494
|
Calculate the number of holidays between two dates in C#?
|
<p>I'm looking for an Optimized Function which will return the number of public holidays and weekends between two given dates in C#</p>
<hr>
<p>Actually the requirement is to combine holidays and weekends to create a good vacation plan for user. I dont need to worry about the country and religion because i have webservices to take care of getting holidays of a specific country and religion</p>
|
c#
|
[0]
|
2,671,086
| 2,671,087
|
Android Acitvity Intent on itself
|
<p>How can i make an intent on the same Activity?</p>
<p>I have a Activity Lektion which has forward and backwards buttons, and when i hit on the forward button i want to start the same Activity just with other parameters.
For that i also send a bundle with the Intent.</p>
<p>But the Activity isnt going to be created again as it seems...</p>
<pre><code>public class Lektion extends Activity {
private int rowCount = 0;
private ArrayList<LektionPage> lektionPages = new ArrayList<LektionPage>();
private int lektionPage = 0;
private Bundle bundle;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.lektion);
bundle = this.getIntent().getExtras();
String lektionNummer = bundle.getString("LektionNummer");
setTitle("Lektion "+lektionNummer);
try{
lektionPage = bundle.getInt("LektionPage");
} catch(Exception e){}
forwardImageButton.setOnTouchListener(new OnTouchListener(){
public boolean onTouch(View view, MotionEvent me) {
if(lektionPage == rowCount){
return false;
}
Log.i("ontouch", ""+lektionPage);
Intent intent = new Intent(Lektion.this, Lektion.class);
bundle.putInt("LektionPage", lektionPage++);
intent.putExtras(bundle);
return true;
}
});
}
</code></pre>
|
android
|
[4]
|
4,819,204
| 4,819,205
|
jQuery selecting text from a div with :not
|
<p>I have made a fiddle: <a href="http://jsfiddle.net/hAzJq/" rel="nofollow">http://jsfiddle.net/hAzJq/</a></p>
<p>How can i select the text inside the div but not inside the span?</p>
<pre><code>alert($("div").not('span').text());
</code></pre>
|
jquery
|
[5]
|
3,842,843
| 3,842,844
|
Is there a way to remove ShareIntent latency?
|
<p>I create a share intent in this way:</p>
<pre><code>Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
String shareBody = "the share content body";
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject Here");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody);
startActivity(Intent.createChooser(sharingIntent, "Share via"));
</code></pre>
<p>it works fine, however dialog takes about 1-2 seconds to show (I think because it has to search for every app which can handle that intent), is there a way to remove this delay?
I think there is because after the first, subsequent calls have no delay at all.</p>
<p>I tried to preload the sharing intent and have my app just call startActivity but delay is the same...I think the overhead is on the startActivity call :(</p>
|
android
|
[4]
|
4,356,787
| 4,356,788
|
How can I convert the integer output of an enum to a two character string?
|
<p>For the following Enum:</p>
<pre><code>public enum ContentKey {
Menu = 0,
Article = 1,
FavoritesList = 2
};
</code></pre>
<p>The enum ContentKey returns an integer 0,1,2. How can I convert or cast this so that it returns a two digit zero padded string "00", "01" .. "99" etc</p>
|
c#
|
[0]
|
3,409,485
| 3,409,486
|
Purpose of the Java Class loader
|
<p>My question is: when does JVM load all the classes in the project. Also, why do we need the notion of a class loader. </p>
<p>I'd be happy if you could give me a example of a situation where you use class loader and why you use class loader in that situation.</p>
|
java
|
[1]
|
4,125,422
| 4,125,423
|
Local host is different from server
|
<p>The project I'm working on functions differently on the localhost than the server. I'm even running the localhost on the remote desktop that has the server. Firebug in Firefox shows an error in the javascript when I'm debugging on the server but it was a simple syntax error that I already fixed and it works fine on the localhost. I already tried clearing the cache on the browser and rebuilding the project. I'm pretty sure it's the unchanged javascript that is causing the problem but I can't figure out how to update my fixes.</p>
|
javascript
|
[3]
|
3,579,653
| 3,579,654
|
android starting a service
|
<p>I have read what I can find on here but I am still not really clear.
I write a package that has a main activity with a layout that just says what it is.<br>
This calls startService().<br>
In the service oncreate() an alarm intent is setup.<br>
In the service onstart the intent is used in Alarm.setrepeating().
There is an AlarmReceiver, when the alarm is triggered it calls startService().</p>
<p>I install on Android phone and an icon is installed on the phone desktop.
Touch the icon and the layout appears and the service starts and establishes the alarm.</p>
<p>Now the bit that puzzles me.
How can I have the layout go away so that the desktop is usable while the service is running or waiting between alarms? As far as I can tell if I use the back button the service is cancelled.</p>
|
android
|
[4]
|
4,801,620
| 4,801,621
|
get the true type prototype vs constructor?
|
<p>I wanted to see the real type of <code>[]</code> .</p>
<p>I always thought that i can use the apply method or the constructor .</p>
<p>so i tried :</p>
<p><code>[].constructor</code> ->(showed me) <code>function Array() { [native code] }</code></p>
<p>and</p>
<p><code>[].constructor.constructor</code> ->(showed me) <code>function Function() { [native code] }</code></p>
<p>and</p>
<p><code>Object.prototype.toString.apply([])</code> ->(showed me) <code>"[object Array]"</code></p>
<hr>
<p>questions</p>
<p>1) Whom to believe ?</p>
<p>2)why line 2 is different ?</p>
|
javascript
|
[3]
|
2,515,100
| 2,515,101
|
Adding keyword on android apk file when uploading google play store
|
<p>I uploaded the apk file to google play store. But i cannot find my project from google play store when i search my package name. How can i do for searching on google play store to detect my application.?</p>
|
android
|
[4]
|
5,618,288
| 5,618,289
|
I build .apk file using phonegap and keystore as per procedure
|
<p>I build .apk file using phonegap and keystore as per procedure.
I downloaded .apk from Phonegap and installed it on emulator. It runs fine.
but when i tried to run it on device or android tablet, it shows a black screen.</p>
|
android
|
[4]
|
4,550,107
| 4,550,108
|
Extend descendent object in javascript
|
<p>I've been learning more about javascript's prototypal inheritance. I know there is a somewhat fierce debate on whether to extend native objects and I'd like to side step that whole debate entirely in this question.</p>
<p>Is it possible to extend only descendent object in javascript?</p>
<p>To extend all objects I can do this:</p>
<pre><code>Object.prototype.size = function(){
var length = 0;
for(var i in this){
if(this.hasOwnProperty(i)){
length++;
}
}
return this;
}
</code></pre>
<p>But the problem is that It extends all objects. What I'd like to do is have this:</p>
<pre><code>var MyNameSpace = function(){
};
MyNameSpace.Object.prototype.size = function(){
var length = 0;
for(var i in this){
if(this.hasOwnProperty(i)){
length++;
}
}
return this;
}
</code></pre>
<p>That way I would only be extending the native objects in the scope of my global object.</p>
<p>any suggestions would be great thanks</p>
<p>Update:<br>
In response to a few comments I'm adding more code to clarify what I'm trying to do.</p>
<p>I think i may have not phrased my question correctly, or maybe my thinking is incorrect, but what i'd like to be able to do is this:</p>
<pre>
<code>
var my = new MyNameSpace();
var my.name = {firstName : 'Hello', lastName : 'World'};
var nameCount = my.name.size(); // 2
</code>
</pre>
<p>the code you provided will allow me to get the size of each MyNameSpace object I create, but not the object literals that are properties of the MyNameSpace object</p>
|
javascript
|
[3]
|
5,463,162
| 5,463,163
|
Result of expression 'this.getURL'[undefined] is not a function
|
<p>When i call a method directly without a setInterval the function works correctly</p>
<pre><code>slider.prototype.onTouchEnd = function(e){
clearInterval(this.inter);
this.getURL(this.url + '/' + this.eid.id + '/' + this.currX);
e.preventDefault();
}
</code></pre>
<p>putting the same function in a setInterval give me following error:
Result of expression 'this.getURL'[undefined] is not a function</p>
<pre><code>slider.prototype.onTouchStart = function(e){
e.preventDefault();
this.inter = setInterval("this.getURL('www.google.com')",100);
}
</code></pre>
<p>the code of getURL is:</p>
<pre><code>slider.prototype.getURL = function(url){
console.log(url);
verzoek=new XMLHttpRequest();
verzoek.onreadystatechange=function(){
if(verzoek.readyState==4) {
if(verzoek.status==200) {
var data=verzoek.responseText;
}
}
}
verzoek.open("GET", url, true);
verzoek.send(null);
}
</code></pre>
<p>the this.inter is created in the constructor</p>
<pre><code>var slider = function(eid){
...
this.inter = null;
}
</code></pre>
<p>I tried so many things but it keeps failing.</p>
<p>Thx in advance</p>
|
javascript
|
[3]
|
4,125,544
| 4,125,545
|
How do I implement onSearchRequested in activity started by startActivityForResult
|
<p>I need to pick a contact number to populate a number field in my main activity. I start another activity displaying a list of contact numbers using,<br>
<code>Intent contactPickerIntent = new Intent(Intent.ACTION_PICK,ContactsContract.CommonDataKinds.Phone.CONTENT_URI); startActivityForResult(contactPickerIntent, PICK_CONTACT_REQUEST);</code></p>
<p>I have the <code>onActivityResult()</code> method to parse the results. The problem is implementing a search method to search the list of contact numbers. I tried to use <code>onSearchRequested()</code> but this works for the Main activity. </p>
<p>Any idea on how do I implement <code>onSearchRequested()</code> for the activity spawned by the<code>contactPickerIntent</code> Intent.</p>
|
android
|
[4]
|
2,067,227
| 2,067,228
|
Is it possible to build this type of program in PHP?
|
<p>I want to build a QA program that will crawl all the pages of a site (all files under a specified domain name), and it will return all external links on the site that doesn't open in a new window (does not have the target="_blank" attribute in the href).</p>
<p>I can make a php or javascript to open external links in new windows or to report all problem links that don't open in new windows of a single page (the same page the script is in) but what I want is for the QA tool to go and search all pages of a website and report back to me what it finds.</p>
<p>This "spidering" is what I have no idea how to do, and am not sure if it's even possible to do with a language like PHP. If it's possible how can I go about it?</p>
|
php
|
[2]
|
3,843,081
| 3,843,082
|
not increment in row in ie8 browser. var new_row = x.rows[1].cloneNode(true); var len = x.rows.length;
|
<pre><code><script type="text/javascript">
function deleteRow(row) {
var x = document.getElementById('bom_table');
document.getElementById('bom_table').deleteRow(i);
}
}
function insRow() {
var x = document.getElementById('bom_table');
var len = x.rows.length;
// deep clone the targeted row
var new_row = x.rows[len].cloneNode(true);
// get the total number of rows
// set the innerHTML of the first row
new_row.cells[0].innerHTML = len;
// grab the input from the first cell and update its ID and value
var inp1 = new_row.cells[1].getElementsByTagName('input')[0];
inp1.id += len;
inp1.value = '';
// grab the input from the first cell and update its ID and value
var inp2 = new_row.cells[2].getElementsByTagName('input')[0];
inp2.id += len;
inp2.value = '';
// grab the input from the first cell and update its ID and value
var inp3 = new_row.cells[3].getElementsByTagName('input')[0];
inp3.id += len;
inp3.value = '';
// grab the input from the first cell and update its ID and value
var inp4 = new_row.cells[4].getElementsByTagName('input')[0];
inp4.id += len;
inp4.value = '';
// grab the input from the first cell and update its ID and value
var inp5 = new_row.cells[5].getElementsByTagName('input')[0];
inp5.id += len;
inp5.value = '';
// append the new row to the table
x.appendChild(new_row);
}
});
</script>
</code></pre>
|
javascript
|
[3]
|
4,303,086
| 4,303,087
|
Python: functions returned by itemgetter() not working as expected in classes
|
<p>The <a href="http://docs.python.org/library/operator.html#operator.itemgetter" rel="nofollow">operator.itemgetter()</a> function works like this:</p>
<pre><code>>>> import operator
>>> getseconditem = operator.itemgetter(1)
>>> ls = ['a', 'b', 'c', 'd']
>>> getseconditem(ls)
'b'
</code></pre>
<p><strong>EDIT I've added this portion to highlight the inconsitency</strong></p>
<pre><code>>>> def myitemgetter(item):
... def g(obj):
... return obj[item]
... return g
>>> mygetseconditem = myitemgetter(1)
</code></pre>
<p>Now, I have this class</p>
<pre><code>>>> class Items(object):
... second = getseconditem
... mysecond = mygetseconditem
...
... def __init__(self, *items):
... self.items = items
...
... def __getitem__(self, i):
... return self.items[i]
</code></pre>
<p>Accessing the second item with its index works</p>
<pre><code>>>> obj = Items('a', 'b', 'c', 'd')
>>> obj[1]
>>> 'b'
</code></pre>
<p>And so does accessing it via the <code>mysecond</code> method</p>
<pre><code>>>> obj.mysecond()
'b'
</code></pre>
<p>But for some reason, using the <code>second()</code> method raises an exception </p>
<pre><code>>>> obj.second()
TypeError: itemgetter expected 1 arguments, got 0
</code></pre>
<p>What gives?</p>
|
python
|
[7]
|
655,960
| 655,961
|
Boolean and for loop JAVA
|
<pre><code>int a=25:
for (double i=1;i<=a;i++)
{
int b=5*i;
boolean value= b==a;
System.out.println(value);
}
</code></pre>
<p>This method is true when i=5 but false otherwise. So the value can be true at i=5 but my program will print for me : false-false-false-false-TRUE-false-false-false... how can I make this program to print just TRUE for me. PS: I know that false or false or TRUE or false = True.. but how can I use it in the for loop?</p>
|
java
|
[1]
|
5,314,493
| 5,314,494
|
c# datastructure to index value with DateTime
|
<p>I need to store data such that a <code>DateTime</code> value and a <code>float</code> value are stored together. A <code>Dictionary</code> is not useful because when retrieving data, I don't have the exact <code>DateTime</code> value. I just give the date(not the hour,min,second values) and have to get the <code>float</code> value/values corresponding to the date. What other datastructure can I use?</p>
|
c#
|
[0]
|
5,478,881
| 5,478,882
|
ERROR: No enclosing instance of type OOPTutorial is accessible
|
<p>I am new to Java and trying to do a simple program to help me further understand object-orientated programming.</p>
<p>I decided to do a phone program. However on line 5 of the following program where I'm trying to create an instance of a phone class I am getting the following error: </p>
<p>"No enclosing instance of type OOPTutorial is accessible. Must qualify the allocation with an enclosing instance of type OOPTutorial (e.g. <code>x.new A()</code> where <code>x</code> is an instance of <code>OOPTutorial</code>)."</p>
<p>Here is the program: </p>
<pre><code>public class OOPTutorial {
public static void main (String[] args){
phone myMobile = new phone(); // <-- here's the error
myMobile.powerOn();
myMobile.inputNumber(353851234);
myMobile.dial();
}
public class phone{
boolean poweredOn = false;
int currentDialingNumber;
void powerOn(){
poweredOn = true;
System.out.println("Hello");
}
void powerOff(){
poweredOn = false;
System.out.println("Goodbye");
}
void inputNumber(int num){
currentDialingNumber = num;
}
void dial(){
System.out.print("Dialing: " + currentDialingNumber);
}
}
}
</code></pre>
|
java
|
[1]
|
5,855,053
| 5,855,054
|
Where can I get Mix 09 slides from?
|
<p>I saw a site with all the slides (as ppt/pptx) of Mix09. Unfortunately I cannot remember the site address.</p>
<p>Does anyone know where to get these slides from? I've looked everywhere but no luck.</p>
<p>Thanks</p>
|
asp.net
|
[9]
|
867,364
| 867,365
|
running a .py by double-clicking is not working
|
<p>I'm using Windows XP.</p>
<p>When I double click the Launch_PyDemos.pyw from the book Programming Python, nothing happens. When I try to run Launch_PyDemos.pyw from command-line, I get the error message:</p>
<pre><code>Traceback (most recent call last):
File "PyDemos2.pyw", line 41, in <module>
from PP3E.Gui.Tools.windows import MainWindow # a Tk with icon, title, quit
ImportError: No module named PP3E.Gui.Tools.windows
</code></pre>
<p>When I set the PythonPath enviroment variable to the PP3E folder, nothing happens. When I append the PP3E folder to the Path enviroment variable, nothing happens. When I copy the PP3E directory tree to the site-packages folder in your Python source library, nothing happens.</p>
<p>What is going on?</p>
|
python
|
[7]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.