I am using this code to get cell id from my sony erricson p990 cellphone but it set cellID value to "no property".
Blockquote
String cellID = System.getProperty("com.sonyericsson.net.cellid");
if(cellID == null)
cellID = System.getProperty("CellID");
if(cellID == null)
cellID = "no property";
Blockquote
How can I solve this problem? Is signing the program solve the problem?
the above code is working, by the way you should try http://www.easywms.com/easywms/?q=en/node/3589
Related
I'm trying to write an "If" statement that checks to see if a the Key that corresponds to a Player object in a (Scripting.)Dictionary called Players has a String value that contains the letter "P."
I must be missing some VBA syntactical sugar, but I can't seem to find the answer to what I'm doing wrong anywhere.
My statement right now is:
For Each Key In Players.Keys()
If Not (Players(Key).Position Like "*P*") Then 'something'
End If
Next Key
However, it selects the first dictionary entry it loops through even though the Position property has a P in it.
In this case Player(Key).Position = "RP," which I would like to then skip over the "Then" statement. It currently does not work.
Any help would be appreciated.
Edit
The Player class is:
'Class Module: Player
Public Name As String
Public Position As String
Public WAR As Double
This doesn't solve your problem, but... it may help. I was not able to reproduce this behavior:
Player Class Module:
'Class Module: Player
Public Name As String
Public Position As String
Public WAR As Double
Subroutine:
Sub test()
Dim players As Scripting.Dictionary
Set players = New Scripting.Dictionary
Dim pers As Player
Set pers = New Player
pers.Position = "RP"
players.Add "1", pers
Set pers = New Player
pers.Position = "What"
players.Add "2", pers
Set pers = Nothing
For Each pkey In players.Keys
If Not (players(pkey).Position Like "*P*") Then
Debug.Print players(pkey).Position, "Not a P Player"
Else
Debug.Print players(pkey).Position, "Its a P Player"
End If
Next
End Sub
Results in Immediate Pane:
RP Its a P Player
What Not a P Player
Like I said in the comments, I don't know why this isn't working for you, but hopefully seeing this in simplified code may point out some problem with your class implementation, or your dictionary iterations, or your like condition... or something that isn't obvious in the bit of code you have shared.
Hi i am trying to retrieve data from Ms Access database in VC++. As i am a new to VC++, please help me.
Here is the code i have written so far.
System::Data::DataSet^ ds=gcnew System::Data::DataSet();
OleDbConnection ^ con=gcnew OleDbConnection("Provider= Microsoft.ACE.OLEDB.12.0;Data source=dbmc.accdb; Persist Security Info=True");
OleDbCommand^ com =gcnew OleDbCommand();
OleDbDataReader^ myReader;
com->CommandText ="SELECT name FROM Table1";
com->Connection = con;
con->Open();
try
{
myReader=com->ExecuteReader();
while(myReader->Read())
{
String^ vName = myReader->GetString('name');
comboBox1->Items->Add(vName);
myReader->Close();
}
}
catch(Exception^ex)
{
MessageBox::Show(ex->Message);
}
When I run this program i get an error "Index Out of Bound".
The GetString() method takes an integer of the column number as a parameter, not the column name (see here for full documentation).
Change the line
String^ vName = myReader->GetString('name');
to
String^ vName = myReader->GetString(0);
I have a spinner I'm populating from the database. I want to choose which item from the list is selected by default. I need to find out what item in the list (CursorAdapter) has the value "Default Away" and set that to the selected value.
Spinner away_team_spinner = (Spinner)findViewById(R.id.away_team_spinner);
DatabaseHelper db = new DatabaseHelper(this);
Cursor team_list = db.getTeams(p_game_level);
startManagingCursor(team_list);
String[] team_name = new String[]{colTeamName};
int[] to = new int[]{android.R.id.text1};
SimpleCursorAdapter adapter =
new SimpleCursorAdapter(this, android.R.layout.simple_spinner_item, team_list, team_name, to );
adapter.setDropDownViewResource( android.R.layout.simple_spinner_dropdown_item );
away_team_spinner.setAdapter(adapter);
//// HERE IS WHERE MY ERRORS START ////
Log.i("NEW_GAME","Before set arrayadapter");
CursorAdapter adapter_choose = (CursorAdapter)away_team_spinner.getAdapter();
Log.i("NEW_GAME","Before set setSelection");
away_team_spinner.setSelection(adapter_choose.getPosition("Default Away"));
This is the "solution" I found by searching on this web site. However, I cannot use "getPosition" with CursorAdapter object. I tried ArrayAdapter, but then the line after "Before set arrayadapter" comment errors with "android.widget.SimpleCursorAdapter cannot be cast to android.widget.ArrayAdapter". What am I doing wrong? Thanks.
have you thought about running a for loop until you find the position then set the adapter position that way? ill draft up some code then test it, i'm doing something similar
and well this just did the trick, enjoy!
int cpos = 0;
for(int i = 0; i < simpleCursorAdapter.getCount(); i++){
cursor.moveToPosition(i);
String temp = cursor.getString((your column index, an int));
if ( temp.contentEquals(yourString)){
Log.d("TAG", "Found match");
cpos = i;
break;
}
}
spinner.setSelection(cpos);
I am getting Exception for substringWithRange:range in below method.
I am having textview with editing disabled.
i am using textfield only for text selection.
when i am selecting text for firs time no exception but when i press for second time it throughs.
Exception:
'NSRangeException', reason: '* -[NSCFString substringWithRange:]: Range or index out of bounds'.
- (void)textViewDidChangeSelection:(UITextView *)textView {
NSRange range = [tv selectedRange];
str = [tv.text substringWithRange:range];
}
I've checked your example. Sometimes you retrieve an undefined range like (2147483647, 0). So, check it to avoid crashes:
- (void)textViewDidChangeSelection:(UITextView *)textView {
NSRange range = [textView selectedRange];
if(range.length == 0 || range.location > textView.text.length)
return;
NSString *str = [textView.text substringWithRange:range];
}
Dim xbg As Rm
xbg.LobId = cmb_lob.SelectedValue
xbg.Mobile = mobno.Text
xbg.BusinessFax = faxno.Text
xbg.BusinessPhone = phno.Text
xbg.Save()
I have a combo box, which is not mandatory while input in the module. therefore user can select blank value in combo cox for which i want to save null in Oracle Database for that record. I had trid with following condition but fails to get result. you are requested to please help
if cmb_lob.selectedindex=-1 then
xbg.lob=dbnull
else
xbg.LobId = cmb_lob.SelectedValue
Actual Problem arises when first user save record with selection in Combo box then user edit that record and select blank from Combo box. now i have to replace value of combox box with null at database.
Set it to null or whatever VB considers null - it will be set in the DB that way.
try:
if cmb_lob.selectedindex <> -1 then
xbg.LobId = cmb_lob.SelectedValue
else
xbg.LobId = Nothing 'suggested by John Shean (see comments)
So that if the value is selected only then assign it to field else leave it as it is (null)
Try xbg.LobId = Nothing instead –
By John Sheehan