J2ME: platformRequest Issue - java

I want to call a number in below format using platformRequest:
platformRequest("tel:*123*33584744#");
But it gives me error Invalid number on the phone.
But if i call this number manually by typing on phone then it works fine. Even below works fine:
platformRequest("tel:33584744");
So i suspect problem lies when i put * or # chars in the number. As i said when i type these chars in the number manually and press the call button on the mobile it works fine but not with platformrequest.
What is wrong I am doing?
Any alternative to platformrequest method?
How to call a number in below format:
*123*33584744#
Details: CLDC 1.0, MIDP 2.0
Thanks

I found the solution myself:
I simply changed the text box type to:
mTextBox = new TextBox("Magic Dialler", "", 25, TextField.ANY);
// The below line does the trick !!
// 1: Adds Import From Contacts option
// 2: Adds Call button for calling just about any number with any special chars !
mTextBox.setConstraints(3);
http://sarfraznawaz.wordpress.com/2010/03/27/magic-dialler-my-first-j2me-application/

according to my and some others knowledge, you cannot use platformRequest to do network service requests (tel:*123*...). besides, there is no way to access the service reply from JavaME.

ax is right you can't give numbers starting with special characters in the
request.
But if i am understanding your problem, i have a workaround
you can use DTMF post dial code for this.
like:
("tel:123/p333584744#");
where /p for DTMF and first 3 where voice operator ask for number and after that number ends with #.for more information see

Related

How to invoke method/constructor parameter hint in IntelliJ?

If I write code sequentially, then after I enter some method call and opening parenthesis, I get a hint after delay:
if I discard it or return to the place later, I see no any hint:
How to invoke it without retyping the code?
Ctrl+P will give you a pop-up with the method parameters. Usefully, the parameter corresponding to your cursor position will be highlighted and will change as you move back and forth through the parameters.
Intellij provides a lot of assistance. See here for a summary of what's available.
I faced the same condition in the earlier days.
No need to retype the complete code but just retype the comma(,) intellij is intelligent enough to guess the next variable value and suggest you better. I used this many times so far and made me to save my time in all instances.
Hope i was useful.
On Mac the shortcut is ⌘ (Command) + P.
It works fine.

JSF/Applet - How to call a function (auto increment a number) every time a page prints

Hello guys i'm creating a web based label (barcode) printing application in Java (JSF) that requires printing via web.
A certain scenario was given during our testing:
If the user wants to print 10 copies of the same label (barcode), a field in the label which called the serial number must increment itself. Let say for example the last number generated was 100, then each label must have a unique serial number - 101, 102 ... 110.
I'm thinking of a way to call a function each time a printer prints a label or if there are any other ways to achieve this functionality.
Your help will be much appreciated and I'd like to thank you in advance for your response.
From your browser : propose a print button, which fill update (javascript) the page before opening the print dialog (JS : window.print). You can also have a look at onAfterPrint (http://www.webmasterworld.com/javascript/3038993.htm, IE only) to intercept in javascript the print action.
Other possible design (better) is to handle this on the server. This is the only way if you want that the concurrent users will not use the same serial numbers.
--> propose a button that gets a PDF generated by your server with the proper serial number. The pdf is then easily printed cleint side.
Of course, you will never be sure the pdf is actually printed. But having the printers theselves reporting directly to the server seems very complex to organize.

How to make a Skype Out call using asterisks?

I've been working on an asterisk-java application and so far I've been able to figure out how to call from one phone to another phone and also one phone to another computer. Now I want it so that I can use my phone to dial a number and if a preceding number is some special character, that number will be dialed through the skype server and call that number using Skype. Of course I will pay for all fees that apply and such.
For example:
If I dial a number such as #1234567888, the # will mean I would want to do a skype out call so the dial string 1234567888 will be called using skype's server.
Is this possible? Any hints or tips would be much appreciated!
Thank you for any help in advance!!
I use "Skype for Asterisk" by Digium (commercial).
When I want to call some skype user I use his/her id with Skype/ prefix, so you can replace # into this prefix and dial such id.
On Asterisk wiki there is list of Asterisk gateways including free/opensource: Skype Gateways, but I haven't tried it.
Skype for Asterisk will no longer be available after July 26th
I've tried a lot, and finally had luck with freeswitch + skypopen (ex skypiax)
http://wiki.freeswitch.org/wiki/Mod_skypopen_Skype_Endpoint_and_Trunk#What_is_Skypopen
( not trivial to implement )

TextItem with Price Filter

Hai,
I am using SmartGwt Java. To format the price using keyPressFilter, Please suggest any regular expression. It will accept only 0-9 and single decimal only.
Now I am using KeyPress handler. In this if it is empty (default) set this value "0.00", using TextItem.setEmptyDisplayValue("0.00"). So First time it will accept single decimal eventhough there is another decimal present("0.00"). Give solution for this issue.
Thanks in advance.
Regards,
Sathya.
Many different solutions are possible.
Turning an empty field into a content of "0.00" after pressing any key is surprising, perhaps even disturbing to the user; I wouldn't do that. If you're going to assist him, you have to do so thoroughly, offering the equivalent of an input editor. Otherwise, let him do his work and just check the end result when he attempts to change focus out of the field.
Regular expressions are one way to check the input; but done alone, this is a lazy and ineffective solution. You have access to the whole input text at every keystroke. You could solve your problem by checking at keyUp time whether there is already a decimal in the input text, and if so not allow another. You could do something similar to prevent entering more than 2 digits after the decimal.

Selenium typeKeys strips out dot from the String being typed

The following instruction
Selenium.typeKeys("location", "gmail.com");
types the string gmailcom instead of gmail.com.
What's happening there?
From the comments:
I am trying to simulate autofill and the only way to do it currently on selenium is to combine type and typeKeys. eg:
selenium.type("assigned_to", split[0]+"#");
selenium.typeKeys("assigned_to", "gmail.com");
Now my question is why typeKeys doesn't type the 'dot' in between gmail.com?
Have you tried using the Native key functions and javascript char codes?
I couldn't get a 'period' character to work using them (char 190), but I got the decimal (char 110) to work just fine, and the text box shouldn't have a problem with either.
selenium.Focus("assigned_to");
selenium.Type("assigned_to", split[0]+"#");
selenium.TypeKeys("assigned_to", "gmail");
selenium.KeyPressNative("110");
selenium.TypeKeys("assigned_to", "com");
Use the type method.
From the javadoc for typekeys:
this command may or may not have any
visible effect, even in cases where
typing keys would normally have a
visible effect
...
In some cases, you may
need to use the simple "type" command
to set the value of the field and then
the "typeKeys" command to send the
keystroke events corresponding to what
you just typed.
We had similar problems using typekeys in selenium python.
One workaround we figured to resolve this issue is to use the combination of 'type' and 'type_keys'. As you might be aware, type does not have such issues.
We did this in our selenium python script and it works just fine.
For example:
If there's an email address to be entered in a text box: test.me#test.me.uk
Then do
type(locator,’test.me#test.me.’)
type_keys(locator,’uk’)
Maybe a very crude way to do, but it did the job.
Hope this helps someone else with a similar problem.
Also try to set focus on element before write on it.
selenium.focus(locator);
selenium.typeKeys(locator, value);
it did function in my case, handling a input type=password.
Suppose the string to be typed using typeKeys is "abc.xyz.efg". Then, we can use type and typeKeys commands to write the given string.
type(locator,"abc.xyz.")
typeKeys(locator,"efg")
The above two steps are useful whenever you want to select an element in drop down box, and the drop down pops down only if we use typeKeys command.
I'm also seeing this behaviour when using Selenium RC (C#), and with different characters ('y' for example which also seems to remove the character follow it from the typing action..)
For some situations it is entirely possible to get around the issue by typing out the keys with the TypeKeys or KeyPress functions, but I haven't managed to find a solution that works when you want to type text in a field, enter control characters ([Enter] or a newline for example), and then type more text.. (using the 'Type' function in this case simply overwrites the field contents...).
If anyone manages to find a reasonable solution to this issue, please add it to this question as it's starting to come up in google now and would probably help alot of people out.. (I'd start a bounty if I could..)
This is an open bug in Selenium (bug SEL-519).
After some fiddling around with it, I finally managed to enter '.' into a textarea by using JavaScript. Execute something like window.document.getElementById('assigned_to').value += '.' via storeEval or the like.
I got the same behaviour but fixed it by passing a variable to the Type command instead of a string.
string email = #"name#gmail.com";
selenium.Type(inputfield, email);
It works like a charm!

Categories

Resources