Windows 7 : How to access the advanced boot options on your laptop

If you are a windows pc user for quite some time, accessing the Windows 7 to see the Advanced Boot Options can be a challenge if you are using different laptop brands. Here are the list of shortcut key combinations

Enjoy

Coffee Cup

 

Acer – Alt + F10

Asus – F9

Dell/Alienware – F8

HP – F11

Lenovo – F11

MSI – F3

Samsung – F4

Sony – F10

Toshiba – 0 (not numpad) while turning on, release key when Toshiba logo appears

 

Delphi : How to change the date format on both inside the app and globally

I have encountered an issue the other week of a friend that want the default date be changed to another format inside the app. After digging a few days later i came out with a complete list of local settings you can change while inside the delphi environment. Will be posting the codes here for anyone who has encountered the same issues as i have. Hope this helps somebody out there.

Enjoy

Coffee Cup

CurrencyString, CurrencyFormat, NegCurrFormat, ThousandSeparator,
DecimalSeparator, CurrencyDecimals, DateSeparator, ShortDateFormat,
LongDateFormat, TimeSeparator, TimeAMString, TimePMString,
ShortTimeFormat, LongTimeFormat

//Change COMPUTER date and time
SetLocaleInfo(GetThreadLocale, LOCALE_SSHORTDATE, ‘MM/dd/yyyy’);
SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0,
SMTO_ABORTIFHUNG, 1000, PDWord(Nil)^);

//Change formatting from within the APPLICATION
DateSeparator := ‘/’;
ShortDateFormat := ‘MM/dd/yyyy’;

Delphi : Retrieving various locale information

I got this info from a website that showcases all of the identifiers for each pc. Thought of posting it here also in my blog for future references

Question: How can I determine various locale information using delphi?

Answer:
Delphi has a function called GetLocaleInfo which you can use to retrieve information such as the system language, currency symbol, number of decimal digits and so forth.

Here is a function that will return locale information based on the parameter “flag” :

……..
function TForm1.GetLocaleInformation(Flag: Integer): String;
var
pcLCA: Array[0..20] of Char;
begin
if( GetLocaleInfo(LOCALE_SYSTEM_DEFAULT,Flag,pcLCA,19) pcLCA[0] := #0;
end;
Result := pcLCA;
end;
……..

Example of using the function:

……..
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage(GetLocaleInformation(LOCALE_SENGLANGUAGE));
end;
……..

“Flag” can take the following values (as seen in Windows.pas):

LOCALE_NOUSEROVERRIDE { do not use user overrides }
LOCALE_USE_CP_ACP { use the system ACP }
LOCALE_ILANGUAGE { language id }
LOCALE_SLANGUAGE { localized name of language }
LOCALE_SENGLANGUAGE { English name of language
LOCALE_SABBREVLANGNAME { abbreviated language name }
LOCALE_SNATIVELANGNAME { native name of language }
LOCALE_ICOUNTRY { country code }
LOCALE_SCOUNTRY { localized name of country }
LOCALE_SENGCOUNTRY { English name of country }
LOCALE_SABBREVCTRYNAME { abbreviated country name }
LOCALE_SNATIVECTRYNAME { native name of country }
LOCALE_IDEFAULTLANGUAGE { default language id }
LOCALE_IDEFAULTCOUNTRY { default country code }
LOCALE_IDEFAULTCODEPAGE { default oem code page }
LOCALE_IDEFAULTANSICODEPAGE { default ansi code page }
LOCALE_IDEFAULTMACCODEPAGE { default mac code page }
LOCALE_SLIST { list item separator }
LOCALE_IMEASURE { 0 = metric, 1 = US }
LOCALE_SDECIMAL { decimal separator }
LOCALE_STHOUSAND { thousand separator }
LOCALE_SGROUPING { digit grouping }
LOCALE_IDIGITS { number of fractional digits }
LOCALE_ILZERO { leading zeros for decimal }
LOCALE_INEGNUMBER { negative number mode }
LOCALE_SNATIVEDIGITS { native ascii 0-9 }
LOCALE_SCURRENCY { local monetary symbol }
LOCALE_SINTLSYMBOL { intl monetary symbol }
LOCALE_SMONDECIMALSEP { monetary decimal separator }
LOCALE_SMONTHOUSANDSEP { monetary thousand separator }
LOCALE_SMONGROUPING { monetary grouping }
LOCALE_ICURRDIGITS { # local monetary digits }
LOCALE_IINTLCURRDIGITS { # intl monetary digits }
LOCALE_ICURRENCY { positive currency mode }
LOCALE_INEGCURR { negative currency mode }
LOCALE_SDATE { date separator }
LOCALE_STIME { time separator }
LOCALE_SSHORTDATE { short date format string }
LOCALE_SLONGDATE { long date format string }
LOCALE_STIMEFORMAT { time format string }
LOCALE_IDATE { short date format ordering }
LOCALE_ILDATE { long date format ordering }
LOCALE_ITIME { time format specifier }
LOCALE_ITIMEMARKPOSN { time marker position }
LOCALE_ICENTURY { century format specifier (short date) }
LOCALE_ITLZERO { leading zeros in time field }
LOCALE_IDAYLZERO { leading zeros in day field (short date) }
LOCALE_IMONLZERO { leading zeros in month field (short date) }
LOCALE_S1159 { AM designator }
LOCALE_S2359 { PM designator }
LOCALE_ICALENDARTYPE { type of calendar specifier }
LOCALE_IOPTIONALCALENDAR { additional calendar types specifier }
LOCALE_IFIRSTDAYOFWEEK { first day of week specifier }
LOCALE_IFIRSTWEEKOFYEAR { first week of year specifier }
LOCALE_SDAYNAME1 { long name for Monday }
LOCALE_SDAYNAME2 { long name for Tuesday }
LOCALE_SDAYNAME3 { long name for Wednesday }
LOCALE_SDAYNAME4 { long name for Thursday }
LOCALE_SDAYNAME5 { long name for Friday }
LOCALE_SDAYNAME6 { long name for Saturday }
LOCALE_SDAYNAME7 { long name for Sunday }
LOCALE_SABBREVDAYNAME1 { abbreviated name for Monday }
LOCALE_SABBREVDAYNAME2 { abbreviated name for Tuesday }
LOCALE_SABBREVDAYNAME3 { abbreviated name for Wednesday }
LOCALE_SABBREVDAYNAME4 { abbreviated name for Thursday }
LOCALE_SABBREVDAYNAME5 { abbreviated name for Friday }
LOCALE_SABBREVDAYNAME6 { abbreviated name for Saturday }
LOCALE_SABBREVDAYNAME7 { abbreviated name for Sunday }
LOCALE_SMONTHNAME1 { long name for January }
LOCALE_SMONTHNAME2 { long name for February }
LOCALE_SMONTHNAME3 { long name for March }
LOCALE_SMONTHNAME4 { long name for April }
LOCALE_SMONTHNAME5 { long name for May }
LOCALE_SMONTHNAME6 { long name for June }
LOCALE_SMONTHNAME7 { long name for July }
LOCALE_SMONTHNAME8 { long name for August }
LOCALE_SMONTHNAME9 { long name for September }
LOCALE_SMONTHNAME10 { long name for October }
LOCALE_SMONTHNAME11 { long name for November }
LOCALE_SMONTHNAME12 { long name for December }
LOCALE_SMONTHNAME13 { long name for 13th month (if exists) }
LOCALE_SABBREVMONTHNAME1 { abbreviated name for January }
LOCALE_SABBREVMONTHNAME2 { abbreviated name for February }
LOCALE_SABBREVMONTHNAME3 { abbreviated name for March }
LOCALE_SABBREVMONTHNAME4 { abbreviated name for April }
LOCALE_SABBREVMONTHNAME5 { abbreviated name for May }
LOCALE_SABBREVMONTHNAME6 { abbreviated name for June }
LOCALE_SABBREVMONTHNAME7 { abbreviated name for July }
LOCALE_SABBREVMONTHNAME8 { abbreviated name for August }
LOCALE_SABBREVMONTHNAME9 { abbreviated name for September }
LOCALE_SABBREVMONTHNAME10 { abbreviated name for October }
LOCALE_SABBREVMONTHNAME11 { abbreviated name for November }
LOCALE_SABBREVMONTHNAME12 { abbreviated name for December }
LOCALE_SABBREVMONTHNAME13 { abbreviated name for 13th month (if exists) }
LOCALE_SPOSITIVESIGN { positive sign }
LOCALE_SNEGATIVESIGN { negative sign }
LOCALE_IPOSSIGNPOSN { positive sign position }
LOCALE_INEGSIGNPOSN { negative sign position }
LOCALE_IPOSSYMPRECEDES { mon sym precedes pos amt }
LOCALE_IPOSSEPBYSPACE { mon sym sep by space from pos amt }
LOCALE_INEGSYMPRECEDES { mon sym precedes neg amt }
LOCALE_INEGSEPBYSPACE { mon sym sep by space from neg amt }
LOCALE_FONTSIGNATURE { font signature }
LOCALE_SISO639LANGNAME { ISO abbreviated language name }
LOCALE_SISO3166CTRYNAME { ISO abbreviated country name }

URL:
http://delphi.cjcsoft.net//viewthread.php?tid=45725

Delphi : Set system locale information

So far this is what i had dig up on the topic. It made sense to post this one here since i am pretty sure somebody’s also looking for this info. Hehehe

Enjoy

Coffee Cup

procedure SetLocaleInfoSample;
var number, ds, lz;
begin
number := 0.7;

// Remember default number settings
ds := GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL);
lz := GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ILZERO);

// Log a number using default settings
Log.Message( FloatToStr(number) );

// Log a number using a different decimal separator
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, ‘,’);
Log.Message( FloatToStr(number) );

// Log a number without the leading zero
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ILZERO, ‘0’);
Log.Message( FloatToStr(number) );

// Restore original settings
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, ds);
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ILZERO, lz);
end;

{
The function produces the following output for US English locale:

0.7
0,7
,7
}

procedure ChangeShortDate;
var strOldShortDate;
begin
// Get current short date format
strOldShortDate := GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE);

if not SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE, ‘yyyy/MM/dd’) then
Log.Error(‘Could not change short date format.’);

// Restore original short date format
if not SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE, strOldShortDate) then
Log.Error(‘Could not restore original short date format.’);
end;

Windows : How to restart or shutdown your computer in command line or DOS mode

I know what you’re thinking, how come you need to know this thing if there is a shutdown or restart button.  Well, extra wisdom is better than nothing. I had a case where the shutdown and restart button is missing. My first guess is that the pc has been infected with a virus.

But just in case you encounter this scenario and you have the run command, you can type the following line

To shut down your computer, type: shutdown /s

To restart your compute,r type: shutdown /r

To log off your computer, type: shutdown /l

For a complete list of options, type: shutdown /?

After typing your chosen option, press Enter. The computer will execute your desired task.

How to add or remove password in MS Excel 2007

Had to chance up on encountering this problem again. Fortunately, you need to follow these steps in order to add or remove passwords in MS Excel 2007.

I have made a youtube video to show both the short version and the long version on how to achieve this.

For the short version here are the steps

Open Microsoft Excel 2017 workbook
Open the file to add or remove the password
Click the ORB logo on the top left
Click the ‘Save As’ button
Click the ‘Tools’ button and then click ‘General Options‘ tab
In the ‘Password to open’ box, add or delete the existing password then click ‘OK’.
Click the ‘Save’ button. If prompted, click ‘Yes’ to replace the existing workbook

Enjoy

Coffee Cup

Windows Server 2012 R2 Socket Network Error

Today is a new day. Mark and I installed a new windows server 2012 r2 and have also installed the drivers and software. We started using the Server Guide downloaded from the Lenovo Website and then the Operating System.

After installing, i loaded my app and hoped that it would run smoothly as always. But no, it did not push through as expected. I assigned the server with an ip address of #15. I use the DOS prompt ping and the ipaddress replied. I tried to look at the My Computer and typing the server name, and you can see the shared folders.

This is the whole message…
“EXCEPTION EBDE ENGINE ERROR IN MODULE XXX.EXE AT 00096F36. UNKNOWN DATABASE. UNABLE TO COMPLETE NETWORK REQUEST TO HOST ERVER_NAME? FAILED TO ESTABLISH A CONNECTION. A SOCKET OPERATION WAS ATTEMPTED TO A GENERAL SQL ERROR. UNREACHEABLE NETWORK ALIAS”

The error kept mentioning socket connection that was not successfuly. So what i did changed the ip address again. Lo and behold, i was able to run my app. Usually in normal windows pc the system should let you know if you have an ip address conflict. In this case, the server did not show that little dialog box.

It has been a very educational experience with conflicting ip address that in the windows server does not show you. Please note that the ip address belonged to a belkin device and not a PC or laptop. Maybe that could be the cause.

I tried to replicate the scenario in my Windows 7 pc and my pc reacted with a small message dialog of IP CONFLICT.

I have created a youtube video to show my adventure

Happy watching

Coffee Cup