I am analyzing a VB system when I stumbled upon the following code snippet. This is my first time reading VB code and this may be a trivial question.
.
.
Format$(txt & "/02/20", "gee")
.
.
My question is, what does "gee" stand for? Is it a date format or something? I cannot find the string anywhere else in the code. If it is a format type, what could it possibly be its equivalent in Java? I found out that Format$ in VB functions similarly to Java String.format().
Here is what the VB documentation says about Format$():
Function Format$(Expression, [Format], [FirstDayOfWeek As VbDayOfWeek
= vbSunday], [FirstWeekOfYear As VbFirstWeekOfYear = vbFirstJan1]) As String
Member of VBA.Strings
Formats an expression
I solved it using Visual Basic's Immediate window. It seems that "gee" is used for conversion from the Western Date to Japanese Imperial years.
Using immediate window:
? Format$( "2012/02/20", "gee")
Output -> H24
Another example:
? Format$("123123123", "#,##0")
Output -> 123,123,123
NOTE:
It seems that the above example using "gee" does not work with PC's having different regional settings. My VB6 is in English but my OS is a Japanese Windows 7 Professional.
The code snippet will always evaluate to "gee". EDIT This turns out not to be the case, see nmenego's answer!
It sounds like someone was experimenting with the Format function, and forgot to delete the experiment from the code!
If you'd like to learn more about Format have a look at the full VB6 documentation on Format and the format specifiers for dates.
Related
i found this nice log-creating command line:
typeperf "\Processor(_Total)\% Processor Time"
so far it worked for me well on an English language version of Windows 7 (or similar).
when trying out the very same thing on a German language Windows 7 it simply did not work.
how can the same functionality be triggered with that tool on a German (or other language) Windows 7?
the best line so far for German windows is this:
Get-Counter '\Prozessor(_Total)\Prozessorzeit (%)'
It has multi-line outputs with the value in question typically printed with a comma as decimal separator (in contrast to the English dot). for 100% there is no dot given. parsing the results down to the value looks a bit difficult.
having a more generic solution would still be more nice. the web page linked below helped me a bit in understanding what the key problem is.
https://social.technet.microsoft.com/Forums/de-DE/25bc6907-cf2c-4dc8-8687-974b799ba754/powershell-ausgabesprache-umstellen?forum=powershell_de
that far i am not sure if it's possible to make it truly generic using such helpers e.g. the keyword listing - but i am not that deep in what PS offers, rather i am skilled in cmd.exe.
Maybe this helps somehow further: you can find out the corresponding counter name in your language by comparing these registry keys.
English:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\009\Counter
Current language:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\CurrentLanguage\Counter
Here you have the list of names and IDs as value, so you can match them and find out the right one.
In Visual Studio 2010, there is a little bit of explanation at the beginning of autoexp.dat on how to define rules. However, this explanation is quite limited and I haven't come across any other document. Appreciate your help in understanding a few tokens.
Here is a rule I copied from somewhere. It works for my needs.
MyString{
preview ([$e.data,su])
stringview ([$e.data,sub])
}
Q1. What is the difference between preview and stringview? Do I really need stringview.
Q2. Why does stringview use "sub" and not "su?"
Q3. What does a hash (#) do on an expression? What is the difference between the following two lines?
preview ([$e.data,su])
preview #([$e.data,su])
preview is that you see in Debuger's watch window, if you define stringview it will add a small icon (looking glass) witch calls a Text Visuzlisers. (read StringView)
Format Specifiers in C++
I think this is some syntax requirements like tokens #tree #list etc
I am trying to get datetimepicker to return the date in the following format: 08-SEP-2012.
The returned format will be part of a web address and therefore very specific.
It is set on custom formatting, and I can get the day and year right. only the 3 letter month give me a problem. Maybe there is a very simple solution but I can't find it..
I'm fairly new to Visual Basic (or any programming in general) so any assistance would be greatly appreciated.
To convert a date into a string in your required format, use:
Dim s = theDate.ToString("dd-MMM-yyyy").ToUpper()
I would like to create a new "International Text Input Source" along the lines of the built-in Japanese input source where you can type in roman letters and get a drop-down of choices to choose from. However, I have no idea where to start work on such a thing. Is it feasible, or would it be a complete hack?
All I've found so far is the Text Input Source Services which seems to be all about dealing with existing input sources.
Any pointers on where to begin would be highly appreciated, thanks.
Sounds like what you are really looking for is documentation the Input Method Kit (which was introduced with Leopard).
Here's Apple's release note and a reference guide.
The reason I thought of this answer was because I had worked with Apple's Number Input sample code a year or two ago.
I get the type not defined error for XlEnableCancelKey when trying to use ShellAndWait with MS Word VBA. The Xl part of XlEnableCancelKey looks like it maybe an MS Excel type.
Also asked on MSDN VBA Forum.
Yes
In the VBA project, add a reference to the Microsoft Excel 12.0 Object Library.
Use WdEnableCancelKey instead of XlEnableCancelKey.
The reason being, for word a different enum type is defined which is used for Application.EnableCancelKey.
EDIT: Having looked at the link, I saw this line.
Application.EnableCancelKey = xlErrorHandler
Effectively, the code is wanting to use an enum value for EnableCancelKey.
Hence, you can use WdEnableCancelKey in place of XlErrorHandler.