![]() |
|
SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here. |
![]() |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
||||
|
||||
Unknown Method in SOME STVs?
Gents,
I've run into a problem that I just can't figure out. I'm using one of pluckyhd's methods that is in his flux.jar file. (flux_api_HasPropertyElement()) When I use the method from one STV it works just fine. When I use it in another STV I get an unknown method error. I checked spelling numerous times, I deleted the action widget and rekeyed it, and I even copied the action widget from the working STV to the non-working STV. Nothing helped. Why, on the same server, would I get an unknown widget error from one STV but not another? I just don't know what else to try at this point. Thanks, Tom
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#2
|
|||
|
|||
Are you passing the same parameter types in both cases? If for example a method is setup as method(String) and you call it with method(int), you will get a method not found.
Thanks, Jeff |
#3
|
||||
|
||||
Jeff,
I looked at the parameters and they are the same ![]() Tom
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#4
|
||||
|
||||
Jeff,
I looked at this again and you are correct. The method was expecting a string and I passed it an int. I thought the int would be converted but it was not. How do I convert an int to a string? java_lang_String_toString() does not seem to be the answer. Tom
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#5
|
||||
|
||||
Try
Int + "" This will convert the Int to a string. Aloha, Mike
__________________
"Everything doesn't exist. I'm thirsty." ...later... "No, it's real!!! I'm full." - Nikolaus (4yrs old) |
#6
|
||||
|
||||
Quote:
![]()
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#7
|
||||
|
||||
Less typing is not the point. Good programming strives for clarity, not minimal keystrokes. A line of code gets typed just once, but read many times. So it's worth a little extra effort to make sure the meaning will be clear to the reader. The + "" shortcut does not (in my opinion) serve this goal, since you have to know how the trick works to understand what's going on.
The clearest and most direct way to convert an int to a String is with java_lang_Integer_toString(). It's pretty hard to mistake the meaning of that.
__________________
-- Greg |
#8
|
||||
|
||||
Well I never said I was a good programmer.
![]()
__________________
"Everything doesn't exist. I'm thirsty." ...later... "No, it's real!!! I'm full." - Nikolaus (4yrs old) |
#9
|
||||
|
||||
Thanks to all for helping
![]()
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#10
|
|||
|
|||
You should be able to use the Integer object type as well:
java_lang_Integer.toString(int) Conversions, widening, etc usually wont happen for numeric types to strings: http://java.sun.com/docs/books/jls/s...sions.doc.html Autoboxing (1.5+): http://java.sun.com/j2se/1.5.0/docs/...utoboxing.html
__________________
[SageTVServer] AthlonII X4 920|ATI 3450/Passive 256MB|4GB PC2-1066|Gigabyte MA770-UD3v2|Seagate 320GB/DB35.3 750GB (DVR HD)|Win7/Ult/x86 [SageTVClient1] AthlonX2 5400|ATI 4550/Passive 512MB|4GB PC2-800|Gigabyte MA770-UD3v1|Creative X-Fi|Seagate 320GB|Win7/Ult/x86|42" LCD [SageTVClient2] AthlonX2 5400|ATI 4550/Passive 512MB|4GB PC2-800|Gigabyte MA770-UD3v1|Realtek HDA|Seagate 320GB|Win7/Ult/x86|32" LCD SageTV 6.6.2|SageMC 6.3.9b_24 (clients)|3x HD-PVR (FiOS) - Firewire Tuning|1x HDHomeRun Last edited by koan00; 12-12-2009 at 06:20 PM. |
#11
|
||||
|
||||
Quote:
__________________
-- Greg |
#12
|
|||
|
|||
sEnse it I my coding I will comment. Gregs method is the way I would do it.
That being said do you need integers stored? If so I can add some overrides in java to accept your integer and return an integer so you don't have to convert it back and fourth in your stv. Just let's me know sorry I was late to respond was away today. |
#13
|
||||
|
||||
I used the java_lang_Integer_toString and that worked just fine.
Plucky, I'm not sure what you mean. I'm using your flux_api_Has/Set/RemovePropertyElement methods to store a list of MediaFile IDs. I need to store data that allows me to uniquely identify specific MediaFiles and this seemed like the best way to do that. If you have a better way to store data that identifies unique MediaFiles I'm open to suggestions. Tom
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. Last edited by tmiranda; 12-13-2009 at 11:04 AM. |
#14
|
|||
|
|||
Quote:
|
#15
|
||||
|
||||
Yes I am using those methods (GetMediaFileID and GetMediaFileForID) and I am using your api to store the ID values. The problem I ran into was your api's did not work when I tried to store the ID's directly (because the IDs are integers). Converting the IDs to strings and then storing them with your api's worked.
I am now looking into what happens when I read the values back in using your api's. I'm not sure if they will get converted automatically back to integers or if they will be strings and I need to use java_lang_Integer_decode() to turn them back into integers. I hope that makes sense. In any case, your api's are easy to work with and do a great job. I just need to understand more about java. (I never would have guessed that passing a wrong parameter to a method would generate an "Unknown Method" error. That makes no sense at all to me.) Tom
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#16
|
|||
|
|||
Quote:
![]() "Unkown Method" simply is because integers and strings are completely different and currently the java coding only accepts strings not integers. |
#17
|
||||
|
||||
Java allows method overloading. You can have m(String) and m(int) and those are two different methods. It decides which one to invoke based on the argument type. So if all you have is m(String) and you try to pass in an int, it will tell you "unknown method" because it couldn't find a method called m that takes an int. It's not that you called m(String) with the wrong argument type; by definition that's not possible. What happened was you tried to call a method m(int) that doesn't exist.
__________________
-- Greg |
#18
|
||||
|
||||
Greg, Thanks for the explanation. That makes sense now. Is there anything special I need to do to use java_lang_Integer_decode() to convert a string to an int or is the method as straight forward as it seems?
Plucky, It would be great if you could make the calls accept integers or strings. (Or a new method for integers, whatever is easier.) Thanks, Tom
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#19
|
||||
|
||||
Tom, it gets even more confusing.... using java_lang_integer_decode() will decode an integer into an Integer object, which is not an "int". Depending on your java version you could still end up with a method not found.
In phoenix, I will sometimes create the method signatures that accept an Object, then I determine the type inside the method. This is not ideal programming behaviour, but it saves me from creating a bunch of overloaded methods for each type, int, long, float, string, etc. This viloates greg's "Good programming strives for clarity" approach, but it makes the code more "user friendly" to non developers that don't want to deal with auto-unboxing and type conversions. And if you can read method paramters and/or javadoc, then you still get 'clarity'. ie, a method that requires an int, might accept look something like this... Code:
public String GetElementAt(Object index, String[] data) { int idx = TotInt(index); // assume you have a ToInt() utility method that return an int return data[idx]; }
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#20
|
|||
|
|||
Quote:
Sean, Thanks for that idea never thought of doing it that way vs an overload. Have always used overloads...I agree it may not be ideal but would be loads easier to understand and like you said saves allot of coding. Tom, Sean is correct you don't want to integer_decode but rather java_lang_Integer_parseInt(String) to get it back to an integer. I would also recommend a basics on java book or reading some of the great material sun has posted. It has helped me loads. Like Sean told me when I was starting out you got to at least know the basics and knowing that will extend your stvi's so much further, plus coding in a IDE like netbeans is loads easier than in studio for everything IMHO ![]() Also I would load up the old flux api (has been merged with ortus) and add a integer method for you and send you the jar. |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Recording Errors - Unknown Cause | jillsy | SageTV Software | 0 | 03-06-2009 12:44 AM |
HDPVR showing up as unknown device after replugging in. | personalt | Hardware Support | 9 | 11-02-2008 09:35 AM |
Error:Unknown Internal Screen on MC Main Menu | McBainWRX | SageMC Custom Interface | 2 | 08-01-2008 05:39 AM |
Fix for unknown wma "bug" | perry59 | SageTV Software | 1 | 10-31-2007 10:29 AM |
HD channel tuning and guide data for an 'unknown' channel | snoopy | SageTV EPG Service | 5 | 05-04-2007 11:24 AM |