Interesting: Starting with Xcode 7, Apple made it possible to sideload apps on the iPhone, iPad, and Apple TV using a free Apple ID. Although a paid developer account is still required to deploy apps to the App…: How-To: Create a free Apple developer account for sideloading apps | 9to5Mac
Archive for the ‘Development’ Category
How-To: Create a free Apple developer account for sideloading apps | 9to5Mac
Posted by jpluimers on 2017/02/16
Posted in Apple TV, Development, iOS, iOS Development, iPad, iPhone, iPod touch, Mobile Development, Power User, Software Development, xCode/Mac/iPad/iPhone/iOS/cocoa | Leave a Comment »
HashLib4Pascal is a Delphi/FPC compatible library that provides an easy to use interface for computing hashes and checksums of strings (with a specified encoding), files, streams, byte arrays and untyped data to mention but a few.
Posted by jpluimers on 2017/02/15
One day I will need lots of hashing in Delphi: Xor-el/HashLib4Pascal: HashLib4Pascal is a Delphi/FPC compatible library that provides an easy to use interface for computing hashes and checksums of strings (with a specified encoding), files, streams, byte arrays and untyped data to mention but a few. [WayBack]
via: Hello all,I made a port of “HashLib” (http://hashlib.codeplex.com/) “with some fixes, additions and modifications” for Delphi (2010 ( I hope ) and above)… – Ugochukwu Mmaduekwe – Google+ [WayBack]
It’s a port of the C# HashLib – Home [WayBack]
Another fork is at https://github.com/bonesoul/HashLib
–jeroen
Posted in .NET, C#, Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Encoding, FreePascal, Pascal, Software Development | Leave a Comment »
Firebird – adjusting Delphi stored TDateTime (or OLE Automation date) fields that contain Dates, Times or DateTimes
Posted by jpluimers on 2017/02/15
Delphi programmers often store TDateTime (be it date, time or date+time values) as floating points in the database. They take the easy way out basically because TDateTime is nothing but a typed alias for the Delphi Double type (which is equivalent to the IEEE 754 double-precision binary floating-point format: binary64 type) .
Actually, TDateTime is equivalent to the OLE Automation date (which is described in the remarks of DateTime.ToOADate Method (System)) which has an epoch of midnight at 1899-12-30 (to be compatible with Lotus-123 including its leap-year-bug, background on that is at Why are the Microsoft Office file formats so complicated? (And some workarounds) – Joel on Software).
Anyway: the definition is this:
An OLE Automation date is implemented as a floating-point number whose integral component is the number of days before or after midnight, 30 December 1899, and whose fractional component represents the time on that day divided by 24. For example, midnight, 31 December 1899 is represented by 1.0; 6 A.M., 1 January 1900 is represented by 2.25; midnight, 29 December 1899 is represented by -1.0; and 6 A.M., 29 December 1899 is represented by -1.25.
The base OLE Automation Date is midnight, 30 December 1899. The minimum OLE Automation date is midnight, 1 January 0100. The maximum OLE Automation Date is the same as DateTime.MaxValue, the last moment of 31 December 9999.
The sample values are remarkably the same as the ones for TDateTime:
Value Description 0 December 30, 1899; 12:00 A.M. 2.75 January 1, 1900; 6:00 P.M. -1.25 December 29, 1899; 6:00 A.M. 35065 January 1, 1996; 12:00 A.M.
The below SQL example uses the Firebird date/time/timestamp casting shortcuts:
select date '1899-12-30' + 42452.670590278 as Date20160323,
timestamp '1899-12-30 00:00:00.000' + 42452.670590278 as DateTime20160323160539,
time '00:00:00' + 60*60*24 * 0.5 as Noon,
timestamp '1899-12-30 00:00:00.000' + 0 as DateTime18991230Midnight,
timestamp '1899-12-30 00:00:00.000' + 2.75 as DateTime190001011800,
timestamp '1899-12-30 00:00:00.000' + -1.25 as DateTime189912290600,
timestamp '1899-12-30 00:00:00.000' + 35065 as DateTime19960101Midnight
from rdb$database
Which – using DMY date format and 24 hour clock format settings – results in:
DATE20160323 DATETIME20160323160539 NOON DATETIME18991230MIDNIGHT DATETIME190001011800 DATETIME189912290600 DATETIME19960101MIDNIGHT CONSTANT --------------------------------------------------------------------------------------------------------------------------------------------------- 24-3-2016 23-3-2016 16:05:39 12:00:00 30-12-1899 1-1-1900 18:00:00 28-12-1899 18:00:00 1-1-1996
Which basically taught me a new thing about firebird: Times are calculated in seconds, so date fractions need to be multiplied by 60 * 60 * 24.
You can see this in the following query and results:
select (cast('Now' as time) - cast('00:00:00.000' as time)) / (24 * 60 * 60) as DelphiTime, cast('Now' as time) - cast('00:00:00.000' as time) as SecondsSinceMidnight, cast('Now' as date) - cast('1899-12-30' as date) as DelphiDate, cast('Now' as timestamp) - cast('1899-12-30 00:00:00.000' as timestamp) as DelphiDateTime, 24 * 60 * 60 as SecondsPerDay, cast('Now' as date) as "Date", cast('Now' as time) as "Time", cast('Now' as timestamp) as "TimeStamp" from rdb$databaseDELPHITIME SECONDSSINCEMIDNIGHT DELPHIDATE DELPHIDATETIME SECONDSPERDAY Date Time TimeStamp ------------------------------------------------------------------------------------------------------------------------------------------------ 0,4366 37722,284 42835 42835,436600509 86400 10-4-2017 10:28:42 10-4-2017 10:28:42
Note this post is complementary to Date format converter from Text or Unix/Mac/Filetime/Microsoft to virtually any readable form (which mentions the wrong Microsoft epoch as it should be 1899-12-30 midnight): the above shows how to do the conversion to readable dates in Firebird (might work in InterBase as well, but I’ve not used that for a long time).
–jeroen
PS: for Microsoft SQL Server: passing dates to the sql server: pass it as float – 2. -2 is the difference between delphi tdatetime start date and mssql start date.
Posted in Algorithms, Database Development, Development, Firebird, Floating point handling, Software Development | 2 Comments »
MahdiSafsafi/delphi-detours-library: Delphi Detours Library
Posted by jpluimers on 2017/02/14
I didn’t know about the MahdiSafsafi/delphi-detours-library: Delphi Detours Library [WayBack] until this question turned up:
Does anybody have a version of Delphi Detours (https://github.com/MahdiSafsafi/delphi-detours-library) that works with Delphi 2007? – Primož Gabrijelčič – Google+ [WayBack]
No need for it yet, but it will be useful one day.
–jeroen
Posted in Delphi, Development, Software Development | Leave a Comment »
How to speed up Count(*) in InterBase/Firebird – Stack Overflow
Posted by jpluimers on 2017/02/14
The drawback of how the multigenerational architecture is implemented:
Even when an index is available on the column or columns included in the COUNT, all records must be visited in order to see if they are visible under the current transaction isolation.
The benefits of the MGA (multi-generational architecture) having far less locking than other architectures means you need to be careful using the COUNT operator on large result-sets.
In many systems the exact result of a COUNT isn’t very important, so you can use the workaround referred from How to speed up Count(*) in Interbase/Firebird – Stack Overflow
See also:
- [WayBack]Select count(*) is slow
- [WayBack] [#CORE-3666] Count command too slow – Firebird RDBMS Issue Tracker
- [WayBack] Robert Haas: Fast Counting (as PostgreSQL uses a similar architecture)
–jeroen
Posted in Database Development, Development, Firebird, InterBase | Leave a Comment »
Gitkraken – free and commercial edition to raise funds for diabetes
Posted by jpluimers on 2017/02/10
I didn’t know about this. When SourceTree doesn’t improve, I might try it one day.
–jeroen
Posted in Development, DVCS - Distributed Version Control, git, GitKraven, Mercurial/Hg, Source Code Management, SourceTree | 1 Comment »
RDP Clipboard Fix – via Remko Weijnen’s Blog (Remko’s Blog)
Posted by jpluimers on 2017/02/09
RDP Clipboard Fix is the client-side fix for loosing your RDP clipboard (server side fix is killing the RDPClip process). Since his site is not archived but some of the links have 404’s, here is the full article with fixed WayBack links:
Did you ever loose Clipboard functionality (copy/paste) while working with several Terminal Server sessions? I think everyone that works a lot with Terminal Server has experienced this from time to time.
It’s caused by badly behaving applications. Dimitry Vostokov wrote a tool to fix this issue for Citrix (RepairCBDChain.exe), he explains the issue very well on his blog:
Windows has a mechanism to notify applications about clipboard changes. An application interested in such notifications has to register itself in the so called clipboard chain. Windows inserts it on top of that chain and that application is responsible to propagate changes down the chain:
If 3rd-party application forgets to forward notifications down then we have a broken clipboard chain and clipboard changes are not sent via ICA protocol:
Read more at Dimitry’s Blog: http://web.archive.org/web/20071019060125/http://citrite.org/blogs/dmitryv/2006/12/09/clipboard-issues-explained/
So how can we fix this for Terminal Server then?
MSTSC creates a hidden window with Window Class RdpClipRdrWindowClass, you can observe this with a Window Spy tool such as X-Spy
If we look at the Window Style we can see the Window is hidden (doesn’t contain WS_VISIBLE):
So we just need to find all windows with this Windows Class and subscribe them to Clipboard Notifications.
The code is simple:
function EnumWindowsProc(hHwnd: HWND; Param:Integer): boolean; stdcall; var ClassName: String; begin SetLength(ClassName, 255); SetLength(ClassName, GetClassName(hHWnd, PChar(ClassName), 255)); if ClassName = 'RdpClipRdrWindowClass' then begin // This is uses to restore the clipboard functionality SetClipboardViewer(hHWND); end; Result := True; end;Using EnumWindows instead of FindWindow (as RepairCBDChain seems to do) has the advantage that it finds multiple windows (when you have multiple sessions) and not just the first.
You can download the compiled version below. If you like it why not leave a comment?
RDP Clipboard Fix (12076) – RDPFixClip.zip
See here for more Terminal Server related articles:http://remkoweijnen.nl/blog/topics/terminalserver/
There’s an explanation of this issue at the Microsoft Terminal Services team blog too:
http://blogs.msdn.com/ts/archive/2006/11/16/why-does-my-shared-clipboard-not-work-part-1.aspx
http://blogs.msdn.com/ts/archive/2006/11/20/why-does-my-shared-clipboard-not-work-part-2.aspx
–jeroen
Source: RDP Clipboard Fix | Remko Weijnen’s Blog (Remko’s Blog)
Posted in Clipboard, Development, Power User, Software Development | 1 Comment »
Date format converter from Text or Unix/Mac/Filetime/Microsoft to virtually any readable form
Posted by jpluimers on 2017/02/09
Brilliant Date format converter from dates in Text (almost any format) or timestamp numbers in Unix, Mac, Filetime or Microsoft (which is the same as Delphi TDateTime) format to any of these formats:
Text Date:
Date in human-readable textWednesday, March 23, 2016 4:05:39pm RFC 822:
RFC 822 formatted dateWed, 23 Mar 2016 16:05:39 +0000 ISO 8601:
ISO 8601 formatted date2016-03-23T16:05:39+00:00 UNIX Timestamp:
seconds since Jan 1 19701458749139 Mac Timestamp:
seconds since Jan 1 19043541593939 Microsoft Timestamp:
days since Dec 31 189942452.670590278 FILETIME:
100-nanoseconds since Jan 1 1601131032227390000000
01D1851D:D7B58B80
Source: Date format converter
–jeroen
Posted in *nix, .NET, Apple, Delphi, Development, Mac, Mac OS X / OS X / MacOS, Power User, Software Development | 1 Comment »
Trying to recover from enhancement software that generates fake input incorrectly – The Old New Thing
Posted by jpluimers on 2017/02/08
Be sure to read the details in Trying to recover from enhancement software that generates fake input incorrectly – The Old New Thing [WayBack] (much more Old New Think stuff below):
The most insightful part for me was this diagram listing where various methods enter the message pipeline (I added the GetMessage/PeekMessage entry):
Posted in Conference Topics, Conferences, Delphi-Tage.de, Development, Event, Software Development, The Old New Thing, Windows Development | Leave a Comment »
Determining the current shell in *n*x variants including ESXi
Posted by jpluimers on 2017/02/08
On most systems, I use bash as shell, but not all systems have it, for instance the shell.xs4all.nl server uses tcsh and ESXi 4+ uses a very limited ash shell from busybox (ESX 4 had bash though).
There is this huge script that covers many shell and operating system versions (even DOS, Windows) and interpreters (python, ruby, php, etc) what shell is this which I got through Stéphane Chazelas‘s answer in linux – determine shell in script during runtime – Unix & Linux Stack Exchange
I wanted a shorter thing that works in current Linux, BSD, OS X and ESXi versions.
Some very short scripts are less reliable, for instance echo $SHELL looks nice, but isn’t always set.
Similar for echo $0 which will fail for instance if it shows as sh but in fact is a different shell in disguise.
This works for bash, tcsh and busybox sh, is a bit more precise than getting $0. It’s based on HOWTO: Detect bash from shell script – Stack Overflow:
lsof -p $$ | awk '(NR==2) {print $1}'
But on ESXi it shows this because lsof doesn’t take any parameter there and just dumps all information:
----------+---------------------+---------------------+--------+------------------
It’s because lsof on ESXi always shows this header where Cartel and World aren’t exactly well documented:
Cartel | World name | Type | fd | Description
----------+---------------------+---------------------+--------+------------------
Empirically for non VM related processes, it looks like the Cartel is the PID and World name the command.
On Linux and BSD based systems, the header looks like this, so command and PID are reversed in ESXi:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
This command then works on both ESXi, OS X, Linux and BSD assuming you can word search for the PID and noting that PID/command will be reversed on ESXi as compared to OSX/Linux/BSD:
lsof -p $$ | grep -w $$ | awk '(NR==2) {print $1,$2}'
–jeroen
Posted in Apple, bash, BSD, Development, iMac, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, OS X 10.10 Yosemite, OS X 10.11 El Capitan, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User, Scripting, Software Development | Leave a Comment »








