j2me password field with numeric entry - java-me

I have used
this.passwordTextField = new TextField( "", "", 30, TextField.PASSWORD | TextField.DECIMAL);
to get the numeric value password field. but it still takes "#" as an entry and show "." for that at output. but I only need numbers. I also used
UiAccess.setInputMode( this.passwordTextField, UiAccess.MODE_NUMBERS);
how should i do that?

It also can solved by using
new TextField( "", "", 30, TextField.PASSWORD | TextField.MODE_NUMBERS );

Try this :
this.passwordTextField = new TextField( "", "", 30, TextField.PASSWORD |
TextField.NUMERIC);
The textfield constraint with TextField.DECIMAL will allow the user to enter characters - and ., check this.
You can even be smatter by trying the constraint TextField.PASSWORD | TextField.NUMERIC | TextField.SENSITIVE

Related

Escape characters in .csv for Azure Synapse seems to dissapear?

I have .csv file that looks like this:
"ID", "Name", "Extra Info"
"1", "John", "{\"Event\": \"Click\", \"Button Name\": \"Accept\"}
"2", "Adam", "{\"Event\": \"Click\", \"Button Name\": \"Accept\"}
I'm trying to load this file using this code in Synapse:
SELECT
TOP 2 *
FROM
OPENROWSET(
BULK 'https://[MY STORAGE ACCOUNT].dfs.core.windows.net/[FILE PATH]/[...]/*.csv',
FORMAT = 'CSV',
        PARSER_VERSION = '2.0'
)
AS [result]
Expecting this result:
ID
Name
Extra Info
1
John
{"Event": "Click", "Button Name": "Accept"}
2
Adam
{"Event": "Click", "Button Name": "Accept"}
But I keep getting this error:
Error handling external file: 'Unexpected token 'Event\' at [byte: XXX].
Expecting tokens ',', ' ', or '"'. '.
File/External table name: 'https://[MY STORAGE ACCOUNT].dfs.core.windows.net/[FILE PATH]/[...]/[SPECIFIC FILE NAME].csv'.
It looks like it's ignoring the first quote (") and Escape character in the Extra Info column? Leading to it think that \Event\ is some special token?
I just don't understand why or what I can do to fix this?
I think I found the answer based on this post and some of the Azure documentation:
How Field Quote works: Is my understanding of how FIELDQUOTE works correct?
Escaping Quotes in the Azure Documentation: https://learn.microsoft.com/en-us/azure/synapse-analytics/sql/query-single-csv-file#escape-quoting-characters
It seems that the only valid way to escape Quotes is by using double quotes.
This means my .csv should be formatted like this:
"ID", "Name", "Extra Info"
"1", "John", "{""Event"": ""Click"", ""Button Name"": ""Accept""}
"2", "Adam", "{""Event"": ""Click"", ""Button Name"": ""Accept""}
Instead of the original (which uses ):
"ID", "Name", "Extra Info"
"1", "John", "{\"Event\": \"Click\", \"Button Name\": \"Accept\"}
"2", "Adam", "{\"Event\": \"Click\", \"Button Name\": \"Accept\"}
Unfortunately I don't see a way around this other than BULK editing all my .csv files...

SQLite creating table name using a variable

I was wondering if it was possible to use the datetime module in python to create day-specific tables so that the table's name is the date itself.
date_object = datetime.date.today()
sqlite_create_transfer_table = '''CREATE TABLE IF NOT EXISTS date_object (
sender TEXT NOT NULL,
recipient TEXT NOT NULL,
ID text NOT NULL,
Size NOT NULL,
Colour NOT NULL,
Quantity INTEGER NOT NULL);'''
However this just makes the table titled 'date_object' rather than using the variable. Any help would be greatly appreciated, thanks! <3
datetime.date.today() will return a datetime.date object which you must convert to a string, but even then a string like 2022-03-05 is not a valid name for SQLite.
You must enclose it between square brackets or backticks or double quotes.
Try this:
date_object = datetime.date.today()
sqlite_create_transfer_table = f"""CREATE TABLE IF NOT EXISTS [%s](
sender TEXT NOT NULL,
recipient TEXT NOT NULL,
ID text NOT NULL,
Size NOT NULL,
Colour NOT NULL,
Quantity INTEGER NOT NULL);""" % date_object
You need to concatenate the query something like this:
sqlite_create_transfer_table = '''CREATE TABLE IF NOT EXISTS '+date_object+' (
sender TEXT NOT NULL,
recipient TEXT NOT NULL,
ID text NOT NULL,
Size NOT NULL,
Colour NOT NULL,
Quantity INTEGER NOT NULL);'''

How can I search all fields include query text partially?

I am using $text and $search to search fields including query text partially.
For example, fields is following.
{ first_name: "Frist Name", last_name: "Last Name", email:"name#email.com"}
If I type "na" in search field, I want to get all fields including "na".
How can I get fields on node.js.
To do that you want to use a regex, be aware though that this does NOT use the text index you've built.
it would look like this:
{email: new RegExp(".*na.*")}

How do I compare attribute to a lower case value in dynamodb table -> Item -> attribute in query runtime

I want to search text string in attribute like we do in mysql LOWER(fieldName) = LIKE% strtolower(search_text)% . I did some r n d but not found any solution.
{
"TableName": "DEV_postTbl",
"ProjectionExpression": "postId, postType, postStatus",
"ScanIndexForward": false,
"Limit": 6,
"KeyConditionExpression": "postStatus =:postStatusPublished",
"IndexName": "postStatus-createdOn-index",
"FilterExpression": " ( contains( postTitle, :searchText) OR contains(postDescription, :searchText) OR contains(postLocation.addressLine, :searchText) ) ",
"ExpressionAttributeValues": {
":searchText": "hello",
":postStatusPublished": "published"
}
}
This is my code.. but this search only "hello" instead of "Hello", "heLLO" like this
DynamoDB is case sensitive. If your data is case insensitive, one solution is to lower case or upper case the data before storing it in DynamoDB. Then you can get around this by querying for all lower case or all upper case.
Example :
Store postTitle with lowerCase items.
When You search just lowerCase the :searchTex (str.toLowerCase()) and then query.

report builder export numeric to excel

In my report I have the field set to numeric, but when I export it to Excel, if the field is 0, it changes to a text field and fills it with 0.0000000000000000000000. If it's not 0, it comes across as numeric. I've tried checking for NULL, but it truly has 0 in it. I've also tried FORMATNUMBER with no luck. This is one of the combinations I've tried. If it's in US dollars, they want a dollar sign:
=IIF(Fields!Unit.Value = "USD", FORMATCURRENCY(Fields!JanActive.Value,2),FORMATNUMBER(Fields!JanActive.Value,2))
This was making me crazy until I realized that I needed the Value expression to work with the Format expression. Here's what fixed it:
Value expression
=IIF(Fields!JanActive.Value = 0, 0.0, Fields!JanActive.value)
Format expression
=IIF(Fields!Unit.Value = "USD", "'$'#,0.00;('$'#,0.00)", "#0.##")
Not sure what would happen if the value is NULL, but I think that could be addressed in the value expression.

Resources