J2ME Get current time zone - java-me

I have a j2me application and it needs to get the name of the current timezone and send it off to the server.
However, the only format that I seem to be able to get the phone to give me is "GMT-5:00". What I want the application to do is return the timezone's name (EST, PST, etc.)
I iterated over the string[] returned by TimeZone.getAvailableIds() and it has a list of all the time zones in the format that I want them in. (EST, CST, 'Pheonix, USA', 'Europe/Samara', etc.)
Any ideas on how to get the timezone's name instead of as an offset from GMT+0? Thanks in advance.

TimeZone.getID() is what you're looking for; it should return one of the values returned by TimeZone.getAvailableIDs().

you can make an array in which you'll put all your time zone ids. then just add 12 to the returned time zone offset and you can use that as an index for calling time zone names from your array.

Related

DialogFlow Fulfilment - How to get both original and default value for a parameter

I am trying to get a time value from an intent as both $time and $time.original. I need the $time value to do some processing on it and I need the $time.original to show the output back to user.
For example, if user says, 'are you open tomorrow?', I want to respond 'Yes, we are open tomorrow?' but on the back end, I need the value of date 'tomorrow' to do the processing.
Any help would be appreciated.
First, you would need #sys.date entity if you want to catch value of entities like tomorrow instead of #sys.time
Now coming to the question, directly extracting the parameter value will only give us parsed date value, not the original value.
But if we set an output context, then from that context we can extract both parsed value and the original value as intended.
Here is a request that we get on webhook we can get date and date.original by parsing the output-context that we set in the intent:
{"responseId":"###","queryResult":{"queryText":"are you open
tomorrow","parameters":{"date":"2018-12-28T12:00:00+05:30"},"allRequiredParamsPresent":true,"fulfillmentText":"","fulfillmentMessages":[{"text":{"text":[""]}}],"outputContexts":[{"name":"projects/###/agent/sessions/###/contexts/time","lifespanCount":5,"parameters":{"date":"2018-12-28T12:00:00+05:30","date.original":"tomorrow"}}],"intent":{"name":"projects/###/agent/intents/###","displayName":"time-intent"},"intentDetectionConfidence":1,"languageCode":"en"}}
I have not also tried with it yet but I Guess you would be able to parse it with it system entity Dialogflow system Entities
as they're shown #sys.date and example matches with what you need. I guess it will be processing it into date

All MODX *publishedon dates showing same date despite different inputs

I am using:
[[*publishedon:strtotime:date=`%e %B %Y`]]
This shows a date (18 August 2015 for some reason) but it won't change. No matter what date I put into the Published On field this will not change.
I have tried reinstalling MODX to no affect.
Would anyone know how to fix this?
It should work that way, if you want to access the publishedon field of the current resource.
If you want to access the publishedon field of resources listed with a getResources template chunk, you have to use
[[+publishedon:strtotime:date=`%e %B %Y`]]
I could be wrong, but have always thought that you can't enter a date into the Published On field; it takes its value from the Publish checkbox. Have you looked at the database to see what date is actually stored for that resource? And if the value stored in the db does in fact change when you enter a new date in the field...?
Ya, you are right:
publishedOn is just the date when the resource was published or published again.
Use a dateTV for something else instead, or better, use publishedOn as a fall back when the dateTV is not set.

How to compare a value in the response with earlier values in soapUI?

I'm working with soapUI and groovy to do a test whether a particular value regenerates again?
I'll have a soapUI request with JSON which gives a id in the response, i should extract tat id and store it in a dynamic location so that the when i run the test case again, i should be able to compare the prev id. if it both matches then the test case should fail, if not then the new value should be added and the when the test case runs now, it should compare the prev two values.
This goes on for a min of 10000 runs. so 10000th id should compare with all the 9999th id to check for repetition. If it exists, it should fail else the test should pass.
Please help me.. Thanks in advance!
March, 2013...wow..sorry for the late answer and hopefully you were able to find an answer to this question.
I do not have access to soapUI right so i cannot offer code for this answer but off the top of my head i would say..instead of saving the value in the dynamic location store it in a test suite, test case or project level property and each time you want to compare..just read that value and compare.
I understand you are going to have to store 10000 times so instead of creating so many properties, store the values in a list or map and store that map in the properties. Every time you need to check the value, you access that property, find what you are looking for an compare.
I'll have access to soapUI tomorrow so i'll try to write some code for you.

Retrieve resource working hours from Project Server via PSI

I'm working with SharePoint and ProjectServer 2007 via PSI.
I need to retrieve the working hours of an employee in a project during a date range but I can't find a way to do it. The closest data I've gotten is the RES_ACT_WORK from Project.ReadProject(), but this is a total value.
Any ideas?
Finally I've found the way to retrieve it!!!
Statusing.ReadStatusTimephasedData
Edit:
This method return the statusing data for the currently logged user. If the user is the project owner, it will get the data for every assigned resource. Otherwise, only the user's data will be returned.
In order to retrieve the whole of the data (every project and every resource), the [PSI impersonation][2] must be used.
But that is not possible in my case, so I am developing a [PSI extension][3] to expose the information I need and [custom permission][4] to control access to it.
[2]: http://msdn.microsoft.com/en-us/library/aa974347(office.12).aspx
[3]: http://msdn.microsoft.com/en-us/library/bb428837(office.12).aspx
[4]: http://msdn.microsoft.com/en-us/library/aa974255(v=office.12).aspx
NB: I cannot post more than one link yet :P

How can I create human readable key for notes documents

For the documents stored in the database, I would like to create a human readable key to uniquely identify the document. e.g. PO20090110-001. How do I go about doing that?
When saving a document you can put together the first part of the number by using the date or any technique you like (ej. "PO" & format(date, "YYYYMMDD") & confDoc.getitemvalue("doccounter")).
As for the counter I like to store it in a configuration document and update it when each doc is saved. If there are lots of documents created during the day you can run into rep conflicts on you configuration document, if this is the case you can have an agent on the server do the actual assigning of the number, the drawback to this is that you don't get the number right away when saving.
Hope this helps.
One solution used in our help desk is to take the initials of the current user and add it to the a number in the last document in a view. Add one to the number and store that it the new document along with the ititals and the new number as the key.
It's not simply.
Create field for uniquely key and this key saving onSave (or other event), but you must protect this number to be unique.
You can create agent, which checking number on domino server and if agent find conflict then notify application administrator or other responsibility person to resolve this.
Or each replica generate own number and after replicate on domino, agent assign number in right format.
You can create a "nearly" unique key in Domino simply by using the #Unique function, with no arguments. This will generate a string key, based on the current user's first and last name and the current clock time. You will end up with a string something like: "ESCR-12345678".
I say "nearly" unique, because it is not really like an identity column in SQL - Domino does not guarantee it will only give out a particular string once. If you use #unique in a server-side agent which generates many id's at once - for example, and agent that loops and uses #unique within the loop, you can get into a situation where #unique will return a duplicate - because you create 2 docs within the same second and because your "username" is always the server's canonical name. But, outside of that scenario, #unique is generally safe to use.
If you then need to open or reference docs by this ID, just create a view sorted by that ID and you can a url in the form ../myView/id?readDocument.

Resources