Dynamic formatting of phone number in cn1 - codenameone

Are there any classes in cn1 similar to Android's PhoneNumberFormattingTextWatcher ?
I have a textfield for a phone number input. While user types in the phone number, I want it dynamically modify to "(123)456-7890" format. In general, this code will work https://stackoverflow.com/a/5114914/8921111 . But I need a real-time modifying.
Thank you.

No. You can use a DataChangeListener and dynamically edit the input to force a specific mask but that isn't ideal...
A simpler solution would be to use separate text fields for each editable portion and move the input between those entries. You can automatically move the cursor between the fields when one is filled up. See the developer guide section that covers masking here: https://www.codenameone.com/developer-guide.html#_masking

Related

Firefox returns blank $viewValue when type="number" with space in field

I'm trying to setup a credit card entry field, and I need to be able to separate the digit-groups with a space. But on a mobile device, I want the number keyboard to appear, so I'm using input[type="number"] instead of just input[type="text"].
Currently, when I test on Chrome it's working. The $viewValue appearing in the directive for the credit card field shows the 16-digit number (Angular even auto-removes the spaces because of number type field).
But in Firefox, as soon as you type a space, $viewValue returns as "" (even though the field value is "5555 5555 5555 4444").
Is there any way to make this work as expected?
Wow Maybe this a serious Mozilla Bug, with no solution for now, then you may apply other ways to resolve this.
Use mask (lose number on mobile): Try Plugins, library like this http://digitalbush.com/projects/masked-input-plugin/ , the bad user loses the PAD NUMBER on mobile devices.
To keep input number (complex only for fun): Make a input type hidden, then when the user type on number field, fill the hidden input with the value.
Use text field (best way): yes number is the new era on HTML5, but users don't care that for now, yeah show only numbers with the pad (like most apps) is awesome, now ask is really necesary?
Dynamic Form JS: verify the browser version, if Wild Mozilla appears, change type number to type text ;)
Good luck !!
best regards from http://elporfirio.com

Excel: apply conditional formatting if cell contains one of x strings

What I'm trying to do should be quite simple but I am getting error messages saying that conditional formatting doesn't accept this method.
So I am looking for a fix or an alternative.
What I have is a list of search texts for phone faults
screen broken
wifi not working
bluetooth dead
the dooflip isnt working
etc.
I have also set up a number of common keywords
screen
wifi
bluetooth
By comparing these two we can see that the last one doesn't adhere to any of my common keywords, and so I want it highlighted/ copied somewhere etc. so I can view and take any action.
So far I have attempted to set up conditional formatting to search the terms for the keywords and if it doesn't contain any then highlight it.
=ISERROR(SEARCH({"wifi", "bluetooth", "screen"},$H$117))
When using this I get informed that conditional formatting does not support arrays (it works fine if I only specify one search term).
If i create a table with all the keywords in and use the following it works, however it will only find direct mataches, and wont search for the word in the cell string
=ISERROR(MATCH(<cell_to_change_colour_of>, <keyword_table>,0))
So is there another way of doing this?
my answer requires MOREFUNC addon*
=REGEX.COMP(A1,"wifi|bluetooth|screen",FALSE)
this will return true if any of the words appear anywhere in cell A1. FALSE in the formula stipulates that it is not case sensitive.
Unfortunately due to Excell's stupid rules it will not work directly in Conditional Formatting box. You will need to place it in a helper column, and point the conditional formatting rule to that column.
MOREFUNC ADDON
Morefunc Addon is a free library of 66 new worksheet functions.
HERE is some information (by original author)
here is the last working download link I found
here is a good installation walk-through video

Online Maps (google, nokia)

Is it possible to highlight a list of countries with a different colors?
I need to display some countries' statistics on the world map.
Now I use an image and fill a region with color (calculated for each country) by country's coordinates. It's a simple solution and it works well. But now I need to specify the countries' name too (and I think it's not the last customization).
There is a polygon solution, but it uses an array of coordinates. I don't think it's a suitable solution to highlight countries's territory.
I haven't found a solution yet. Any suggestions?
Thanks in advance.
Highlighting countries or regions to support statistics is known as Choropleth Mapping
, but unfortunately there usually isn't direct library support for Choropleth maps bundled into an online map API. This means you'll have to create your own framework, but fortunately it is possible to create one - I wrote an example using jQuery + HERE Maps to
answer the question here
Updated WKT solution now available
Access to KML shapes is no longer required, since the Geocoder API now offers an IncludeShapes attribute which returns the shape of a country in WKT format. A WKT parser can be found here.
A simple WKT choropleth example can be found here.
KML Base solution
For any framework you will need to have a file holding the boundaries of the countries or regions you need. The example uses a KML file, but you could also start with polygons if you had them. Country borders are a political minefield, which is the reason I guess most online mapping APIs steer clear of them. As a hint: try starting with something like http://geocommons.com/overlays/119819 and simplify it as much as possible to speed up the rendering- many small wiggles in the coast lines and small outlying islands are unnecessary.
Of course you could also try searching for "create choropleth map" from a search engine of your choice and use an tool to create a static image for your data (potentially at several zoom levels) and then use this as the basis of an map tile overlay. This requires a lot more work up front, but would push all the calculations server side and hence be faster to display.
Working example can be found on GitHub here
You could put the country's name into the image. It's not that difficult to place text into an image. The only tricky bit is if you are using tiles, you need to deal with names that cross tile boundaries by drawing the name once for each tile.

How do I add an "enviroment" to my scene in 3ds MAX?

I'm Currently working on a scene and i cant seem to find infomation as to how to make a setting for my scen. Its basically a street with buildings on either sides. about 500m long.
I want to put it into a city "enviroment" for animation. Also there will be camera movements so i dont think simply adding an image as a background will work. what i want to know is, Is there a a way to achieve what i want without actually building a small city?
any help or a pointer in the right direction would be great.
thanks in advance
A cubemap might work. http://wiki.polycount.com/CubeMap
There are applications which will generate a city for you, based on criteria you enter. You can enter the building types, sizes etc. I've used one called City Engine - I used the built in wizards to create this but you can create one from scratch even specifying the road layouts: Youtube Video
3ds max has predefined models within it's system,
For example a tree:
This tutorial is great:
http://www.youtube.com/watch?v=G-cfF2ep2DI
look into "AEC Extended"

WinForms name chooser

I have a set of names (first, last, salutation) and need a control to allow users to select a single name using WinForms. A ComboBox works fine if the there are ~20 names, but not so well when there are >100 names.
Can anyone recommend a name picker? Perhaps an address book control that I could customize? It's not too hard to write my own, but I have other wheels to invent.
I'm giving you an answer that seems more like a feature request... :-) It can be very easy to use if you implement a control which behaviour is similar to the auto-completion feature of Google: foreach char inserted by the user, a window appears with only the names that match with the string inserted.
I think that it isn't so hard to implement, but I'm sorry, I can't give you a recommendation, only an advice :-)
I agree with Maurizio. To add to his answer:
The most commonly used interface which does exactly this is in email clients, where they auto-complete names (and/or email addresses) as you type them. Thunderbird is a pretty good example. These usually either auto-complete if there is only one match, or show a drop-down list of possible autocompletions you can pick from. In addition, a button next to the field usually allows you to browse the address book as a list.
I'd also suggest filtering the autocompletions available in the most useful ways: e.g. As you type "wi", you could filter it down to names like "[WI]lson, John", "Amery, [WI]lliam", and "[I]ving, [W]alter", making it easy to find people by their initials as well as first and surnames.

Resources