NoneType Error, Python
I'm getting
TypeError: 'NoneType' object is not iterable
on this line:
temp, function = findNext(function)
and have no idea why this is failing. I am using function in while loops:
while 0 < len(function):
…
but am not iterating through it. All of the returns in findNext(function)
are pretty much
return 'somestring',function[1:]
and cannot understand why it thinks I'm iterating on one of those objects.
Tuesday, 10 September 2013
Eclipse RCP - usage of help subsystem
Eclipse RCP - usage of help subsystem
I am developing an RCP application following the e4 development model. My
application is made of
the plugin project itself containing: the plugin.xml, application.e4xmi
and required resources
the product project with the .product descriptor
My need is to access the PlatformUI.getWorkbench().getHelpSystem() in
order to provide Help features to users. When trying to create the
Workbench itself with
PlatformUI.createAndRunWorkbench(...)
I get very low level errors like:
org.eclipse.e4.ui.model.application.descriptor.basic.impl.PartDescriptorImpl
cannot be cast to
org.eclipse.e4.ui.model.application.ui.MUIElement
Searching the web I have found little results on this same matter. I am
under the impression that an application-based product cannot access
Workbench services like the Help system, unless it is re-designed to be a
Workbench based application.
Can anyone please shed some light on how to access the workbench from a
stripped-down RCP application?
Thanks in advance
I am developing an RCP application following the e4 development model. My
application is made of
the plugin project itself containing: the plugin.xml, application.e4xmi
and required resources
the product project with the .product descriptor
My need is to access the PlatformUI.getWorkbench().getHelpSystem() in
order to provide Help features to users. When trying to create the
Workbench itself with
PlatformUI.createAndRunWorkbench(...)
I get very low level errors like:
org.eclipse.e4.ui.model.application.descriptor.basic.impl.PartDescriptorImpl
cannot be cast to
org.eclipse.e4.ui.model.application.ui.MUIElement
Searching the web I have found little results on this same matter. I am
under the impression that an application-based product cannot access
Workbench services like the Help system, unless it is re-designed to be a
Workbench based application.
Can anyone please shed some light on how to access the workbench from a
stripped-down RCP application?
Thanks in advance
Codenameone Q: How can i add row of components to a GUI when a button has been pressed?
Codenameone Q: How can i add row of components to a GUI when a button has
been pressed?
I'm putting together an app where a user can record information about like
a sale of an unknown number of items in a business. My question is based
on recording the quantity, name, individual price and total price of each
item sold in a sale. I've already coded a java computer program where i
have a table available on the GUI, the user records the information of one
item in a table and if they need more rows there is a button which can be
pressed each time a new row is needed. I'm wandering: A) is there a table
component i can use in Codenameone on the GUI and B) can i have the same
concept of pressing a button in order to add a new row to the table?
If this isn't possible because i've had no luck while researching this
topic, does anyone have any suggestions of how i can record an unknown
number of items in a
been pressed?
I'm putting together an app where a user can record information about like
a sale of an unknown number of items in a business. My question is based
on recording the quantity, name, individual price and total price of each
item sold in a sale. I've already coded a java computer program where i
have a table available on the GUI, the user records the information of one
item in a table and if they need more rows there is a button which can be
pressed each time a new row is needed. I'm wandering: A) is there a table
component i can use in Codenameone on the GUI and B) can i have the same
concept of pressing a button in order to add a new row to the table?
If this isn't possible because i've had no luck while researching this
topic, does anyone have any suggestions of how i can record an unknown
number of items in a
Android mediaplayer with surfaceholder change
Android mediaplayer with surfaceholder change
i couldn't find any clue as to how to fix this problems so i hope you can
assist.
I have a service with a mediaplayer on it, the mediaplayer is loaded with
a url to stream a video from and prepares it. I have an activity that
binds to the above service, sets display for the surface view using the
surfaceholder and then starts the mediaplayer.
All is working great the first time, the problem occurs when i quit the
activity and start it again - the previous surface is destroyed and a new
one is created on the current creation of the activity. the mediaplayer
dosen't change the surfaceholder to the new one. at least its what i think
is happening since i see in watch that the mSurfaceHolder of the
mediaPlayer has in fact changed yet the screen is black and the
mediaplayer is playing (seen in logcat).
i have also tried setDisplay(null) on surfacedestroy, yet again this dont
seem to work. any ideas or suggestions? i really dont want to reset the
mediaplayer because then i will have to buffer the video again when it is
already fully loaded
Thanks!
i couldn't find any clue as to how to fix this problems so i hope you can
assist.
I have a service with a mediaplayer on it, the mediaplayer is loaded with
a url to stream a video from and prepares it. I have an activity that
binds to the above service, sets display for the surface view using the
surfaceholder and then starts the mediaplayer.
All is working great the first time, the problem occurs when i quit the
activity and start it again - the previous surface is destroyed and a new
one is created on the current creation of the activity. the mediaplayer
dosen't change the surfaceholder to the new one. at least its what i think
is happening since i see in watch that the mSurfaceHolder of the
mediaPlayer has in fact changed yet the screen is black and the
mediaplayer is playing (seen in logcat).
i have also tried setDisplay(null) on surfacedestroy, yet again this dont
seem to work. any ideas or suggestions? i really dont want to reset the
mediaplayer because then i will have to buffer the video again when it is
already fully loaded
Thanks!
Add multiple text views progammatically in android
Add multiple text views progammatically in android
Here I have to add text view pro-grammatically based on array list size.
Text views should be appear in row like continues pattern... eg. tv1, tv2,
tv3 and so on till the size of array list.
But here I am getting text views which are appearing on each other. I
can't read the text on them. Here is my code...
ArrayList<String> languageNames = new ArrayList<String>();
RelativeLayout rl = (RelativeLayout)findViewById(R.id.rl);
if(languageNames.size()>0)
{
int size = languageNames.size();
TextView[] tv = new TextView[size];
RelativeLayout.LayoutParams p = new
RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
p.addRule(RelativeLayout.BELOW, tvLocation.getId());
for(int i=0; i<size; i++)
{
tv[i] = new TextView(getBaseContext());
tv[i].setText(languageNames.get(i).toString());
tv[i].setLayoutParams(p);
tv[i].setPadding(50, 50, 0, 0);
tv[i].setTextColor(Color.parseColor("#000000"));
rl.addView(tv[i]);
}
}
else
{
}
what needs to be done so that I can get text views in appropriate manner?
Here I have to add text view pro-grammatically based on array list size.
Text views should be appear in row like continues pattern... eg. tv1, tv2,
tv3 and so on till the size of array list.
But here I am getting text views which are appearing on each other. I
can't read the text on them. Here is my code...
ArrayList<String> languageNames = new ArrayList<String>();
RelativeLayout rl = (RelativeLayout)findViewById(R.id.rl);
if(languageNames.size()>0)
{
int size = languageNames.size();
TextView[] tv = new TextView[size];
RelativeLayout.LayoutParams p = new
RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
p.addRule(RelativeLayout.BELOW, tvLocation.getId());
for(int i=0; i<size; i++)
{
tv[i] = new TextView(getBaseContext());
tv[i].setText(languageNames.get(i).toString());
tv[i].setLayoutParams(p);
tv[i].setPadding(50, 50, 0, 0);
tv[i].setTextColor(Color.parseColor("#000000"));
rl.addView(tv[i]);
}
}
else
{
}
what needs to be done so that I can get text views in appropriate manner?
Monday, 9 September 2013
How to get DBGrid to draw Yes/No rather than True/False
How to get DBGrid to draw Yes/No rather than True/False
I'm trying to replace True/False with Yes/No in a DBGrid. The code below
almost works:
procedure TDatamodule1.DBGridDrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn; State:
TGridDrawState);
var
sText : String;
begin
if (UpperCase(Column.Field.FieldName) = UpperCase('Approved')) or
(UpperCase(Column.Field.FieldName) = UpperCase('Obsolete')) then
begin
if Column.Field.Value = True then
sText := 'Yes'
Else
If Column.Field.Value = False Then
sText := 'No'
Else
sText := '';
(Sender as TDBGrid).Canvas.FillRect(Rect);
(Sender as TDBGrid).Canvas.TextRect(Rect, Rect.Left+3, Rect.Top+2,
sText);
end;
end;
This appeared to work until I started using the keyboard cursor keys to
move around the grid. The cell that has the focus always has both True and
Yes or False and No drawn on top of each other. How do I prevent the
default True/False label from being drawn on the cell that has focus? All
other cells of the grid are perfect.
Thanks in advance.
I'm trying to replace True/False with Yes/No in a DBGrid. The code below
almost works:
procedure TDatamodule1.DBGridDrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn; State:
TGridDrawState);
var
sText : String;
begin
if (UpperCase(Column.Field.FieldName) = UpperCase('Approved')) or
(UpperCase(Column.Field.FieldName) = UpperCase('Obsolete')) then
begin
if Column.Field.Value = True then
sText := 'Yes'
Else
If Column.Field.Value = False Then
sText := 'No'
Else
sText := '';
(Sender as TDBGrid).Canvas.FillRect(Rect);
(Sender as TDBGrid).Canvas.TextRect(Rect, Rect.Left+3, Rect.Top+2,
sText);
end;
end;
This appeared to work until I started using the keyboard cursor keys to
move around the grid. The cell that has the focus always has both True and
Yes or False and No drawn on top of each other. How do I prevent the
default True/False label from being drawn on the cell that has focus? All
other cells of the grid are perfect.
Thanks in advance.
Use dinamically R strings in Android
Use dinamically R strings in Android
I'm having a problem while using the strings stored in my strings.xml, I
have a wide list of strings stored there, they are very useful for me
because I'm using them to translate my program. However, now I want to
choose between those strings dynamically and I don't know how to do it.
Uhm, maybe it will be easy to understand with an example. Let's assume
that I have the following strings:
<string name="red">Red</string>
<string name="blue">Blue</string>
<string name="green">Green</string>
<string name="yellow">Yellow</string>
And now let's assume that I have a function that passes me a string with a
color, for example "yellow". Now I only have a solution for this, to make
a very huge switch (very very huge, because I have lots of strings), I
think that there must be an option to transform the output of my function
into the right parameter. I mean, if I have a function that returns me
"yellow", and i want to use R.strings.yellow, there must be a link
between. I don't know if maybe it could be used any kind of reflection to
achieve this.
Anyone can help me?
1,000 thanks!
I'm having a problem while using the strings stored in my strings.xml, I
have a wide list of strings stored there, they are very useful for me
because I'm using them to translate my program. However, now I want to
choose between those strings dynamically and I don't know how to do it.
Uhm, maybe it will be easy to understand with an example. Let's assume
that I have the following strings:
<string name="red">Red</string>
<string name="blue">Blue</string>
<string name="green">Green</string>
<string name="yellow">Yellow</string>
And now let's assume that I have a function that passes me a string with a
color, for example "yellow". Now I only have a solution for this, to make
a very huge switch (very very huge, because I have lots of strings), I
think that there must be an option to transform the output of my function
into the right parameter. I mean, if I have a function that returns me
"yellow", and i want to use R.strings.yellow, there must be a link
between. I don't know if maybe it could be used any kind of reflection to
achieve this.
Anyone can help me?
1,000 thanks!
Subscribe to:
Posts (Atom)