Delphi : Borland Database Engine (BDE) Freeware

If you are looking for a software that will bridge your delphi application and your interbase application that is freeware, look no further. I found this program while researching since i cannot install delphi during deployment because it needs a serial key. Now, you don’t need to.

Here are the links. Please try only one. They all link to the same file. But just in case one of the links fail, at least you have other options to reach them.

http://www.indishare.me/9eoytymglcyf

http://downloadity.net/file/36L9864

https://uploadocean.com/be2vntyuw74j

https://dailyuploads.net/ywnlecobuaeq

https://www.megaupload.us/1NlF/20180218_Borland_Database_Engine_BDE.7z

http://agileurbia.com/CQH

 

Delphi : Parse or Explode a string based on a parameter field

this is a small code that i put together to convert the date time format of “2017-11-18 08:25” to the date time format that i am using right now which is “11/18/2017 8:25:00 AM”.  For now i will make due with this one and so far it works.

enjoy,

coffee cup

 

 

var
vDATE : TDateTime;
vPOS : Integer;
vList : TStrings;
begin
//convert from 2017-11-18 08:25
//convert to 11/18/2017 8:25:00 AM

vPOS := POS(‘ ‘, edtDATE_ORIG.Text);

edtDATE_CHOP.Text := Trim(Copy(edtDATE_ORIG.Text,1, vPOS));
edtTIME_CHOP.Text := Trim(Copy(edtDATE_ORIG.Text,vPOS + 1, 100));

vList := TStringList.Create;
try
ExtractStrings([‘-‘], [], PChar(edtDATE_CHOP.Text), vList);

edtYEAR.Text := vList.Strings[0];
edtMONTH.Text := vList.Strings[1];
edtDAY.Text := vList.Strings[2];

//year, month, day
edtDATE_CURR.Text := edtMONTH.Text + ‘/’ + edtDAY.Text + ‘/’ + edtYEAR.Text;
vDATE := StrToDateTime(edtDATE_CURR.Text + ‘ ‘ + edtTIME_CHOP.Text);
edtDATETIME.Text := DateTimeToStr(vDATE);

finally
vList.Free;
end;

Windows 10, 8, 7 : alt+printscreen does not work. Solved

after i experienced this, windows 10 just updated again (after I disabled it) i had doubts if windows managed to disable this one. i tried to look at a lot of blogs and forums but so far, a lot of them suggested changing the keyboard. funny for me, i am using a laptop.

then it just hit me. i just downloaded software for screen capture and it downed on me that the software might be catching the keystrokes such as the alt+printscreen. when i closed the app, the alt+printscreen now works.

i just solved my own dilemma. hope somebody learns from this.

enjoy

coffee cup

Interbase : How to get the weekday , month, year and day from timestamp

its amazing that a lot of the functions needed in our daily lives get embedded to a lot of software’s out there.

This is a case that i needed to generate employees who went in on Monday. I was able to dig out these great finds.

Enjoy

Coffee Cup

 

The data type of EXTRACT() expressions depends on the specific part being extracted:

Extract Resulting
data type
Representing
YEAR SMALLINT Year, range 0-5400
MONTH SMALLINT Month, range 1-12
DAY SMALLINT Day, range 1-31
HOUR SMALLINT Hour, range 1-23
MINUTE SMALLINT Minute, range 1-59
SECOND DECIMAL(6,4) Second, range 0-59.9999
WEEKDAY SMALLINT Day of the week, range 0-6
(0 = Sunday, 1 = Monday, and so on)
YEARDAY SMALLINT Day of the year, range 1-366
SELECT EXTRACT (YEAR FROM timestamp_fld) FROM table_name;
=======
1999
SELECT EXTRACT (YEAR FROM timestamp_fld) FROM table_name;
=======
1999
SELECT EXTRACT (MONTH FROM timestamp_fld) FROM table_name;
=======
6
SELECT EXTRACT (DAY FROM timestamp_fld) FROM table_name;
=======
25
SELECT EXTRACT (MINUTE FROM timestamp_fld) FROM table_name;
=======
24
SELECT EXTRACT (SECOND FROM timestamp_fld) FROM table_name;
============
35.0000
SELECT EXTRACT (WEEKDAY FROM timestamp_fld) FROM table_name;
=======
5
SELECT EXTRACT (YEARDAY FROM timestamp_fld) FROM table_name;
=======
175
SELECT EXTRACT (MONTH FROM timestamp_fld) ||
'-' || EXTRACT (DAY FROM timestamp_fld) ||
'-' || EXTRACT (YEAR FROM timestamp_fld) FROM table_name;
====================
6-25-1999

Source : http://docwiki.embarcadero.com/InterBase/XE7/en/Extracting_Date_and_Time_Information

 

 

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.