Add a variable to store a user’s first name using console.readLine - store

I am new to Java, and I would like to know the answer for this question.
Why isn't the first line enough to store that value? Thanks.
printscreen: http://i.stack.imgur.com/0CjkI.png

Related

Kentico 11 System Generated GUID

Using Kentico 11 (Portal engine)
I would like to add a GUID field to one of my pagetypes. I would like the system to generate the guid (I assume this is done via a macro?). Any idea what macro might do the trick? Any help is appreciated.
I do not believe there is a macro which will generate a new GUID for you. You'd have to create a custom macro method to do that for you. The macro you're using won't work because the document isn't created at the time the macro is accessed. AND it wouldn't be unique either.
I had the same issue... I just ended up fixing it directly in SQL by adding default value:
ALTER TABLE [SomeTableName] ADD CONSTRAINT [ContraintName] DEFAULT NEWID() FOR [ColumName];
This is your custom column so you can set the value to whatever your want. I dont see any other use for GUID macro although it is not complicated thing to do.
For others that stumble upon this question in need of an auto-populating unique identifier field, I chose to use existing macro functions to piece together a unique string. This was a more appealing solution than going down the build-your-own macro path.
Here is the macro I used in the Default value field:
{% String.FormatString("{0:yyyyMMddhhmmssfffff}", CurrentDateTime) + Math.GetRandomInt(10000, 99999) #%}
Here's an example value:
201912200958109206631318
No, it's not technically a GUID. It does the job, though.

create integer associated to a string in java

i've been programming for about three weeks on a game in Java.
The last days I was searching for a way to "connect" an integer value to an string and being abled to create new objects which are abled to hold this values aswell.
This would be needed to create item-objects holding an item-ID and the path for the item-image.
I got some inspiration from other people in my company aswell, who told me to use XML-Files or CSV-files to save the item-ID to the correct item-path, but before i learn to create an XML or use a CSV i wanted to know if there might be a better or easier way to create items without wasting more time in try and error to assign an Integer to an String...
Thanks for your Attention

ObjectID with conventions

I need to generate ids with a convention, for example:
Instead of getting: "538cd180e381f20d1c1cd2a2"
I would like to have an ID like this one: "p38cd180e381f20d1c1cd2a2"
So what I want is that my IDs start with a consonant letter.
Does anyone know how to accomplish that within the driver, I mean, getting that behaviour on "new mongo.ObjectId()"?
Thanks in advance.
You can use the following, to get the id starting with a consonant
db.collection.insert({"_id":"p"+new ObjectId()})
you can use any other string in place of "p" and the string will append to the start of the id generated by mongodb.
Short answer: Sorry, no standard way available to achieve this as of now.
Detailed answer and workaround: MongoDB or driver generated ids are a combination of Creation Time (as timestamp), Increment value for next id, Machine on which the id is generated and the process id of the process which generated this document id. All this info is available in the generated id and can be extracted back. For now, this is what you have been given and there is no support for generating your own custom id from the driver's algorithm.
If you want to customize your id generation and be able to make use of these properties, then you can embed all this info that MongoDB uses for id generation and add this information to your document itself. By doing that you will be able to reproduce the information that MongoDB generates from the id. And while inserting the document to MongoDB, you can give your docs a customized id which agrees with your requirements.
So if you later on want to make comparisons based on creation time or maybe the machine, you can do that from the information that was added to the docs themselves.
Use the code: db.collection.insert({"customId":"p"+new ObjectId()}). And let your code use this customId.

Storing index values in FAST-ESP without modifications

first of all I'm totally new to FAST but I already have a couple of issues I need to solve, so I'm sorry if my questions are very basic =)
Well, the problem is that I have a field in the FAST index which in the source document is something like "ABC 12345" (please note the intentional whitespaces) but when stored in the index is in the form "ABC 123456" (please note that now there is a single space).
If I retrieve all the document values then this specific value is OK (with all the whitespaces), my only problem is with the way the value is stored in the index since I need to retrieve and display it to my user just like it appears in the original document, and I don't want to go to the full document just for this value, I want the value that I already have in the index. I think I need to update one of the FAST XML configuration files but I don't have enough documentation at hand in order to decide where to perform the change, index_profile.xml? in the XMLMapper file?
I've found the answer by myself. I'm using a XMLMapper for my collection, all I had to do was to add the ignore-whitespace attribute to the Mapping element and then set this attribute value to "false". This solved the problem and the raw data now when retrieved from the index contains the expected inner whitespaces.
Thanks.

Why the OnWorkflowItemChanged is different between List and document library?

I am doing a workflow for a document library. I put a OnWorkflowItemChanged, and I want to get the value of the column which is changed. I use the workflowProperties.Item["name"] and use the afterProperties. But when I use the workflowProperties.Item["column name"], I still got the original value. When I use the afterProperties, it's NULL.
Then I make another workflow that is the same as above for a list. I can use the workflowProperties.Item["column name"] to get the new value in OnWorkflowItemChanged.
Has anyone come across this problem before? Can you give me some help?
The question seems to mix up Item with ExtendedProperties. As to why a difference is seen on a List/Document Lib, it might have something to do with versionining or perhaps the internal serialization is different. Anyway, some of my experience is outline below. I hope it may be of use:
Use the GUID (as a Guid object, not a string) to access the Before / After ExtendedProperties field. Using the Display Name in the ExtendedProperties will not work. The documentation on it is wrong. You can use SPList.Fields to go from Display Name to Column ID (Guid).
I bind all "Before" to MyWhatever_PreviousProperties and all "After" to MyWhatever_Properties, only accessing MyWhatever_[Previous]Properties after the appropriate event(s)).

Resources