Firebird News: Database .NET 8.2 released with many new features
The Wiert Corner - irregular stream of stuff: jpluimers
Last quarter, 11 issues of Micro Cornucopia appeared on BitSavers including the final May 1990 issue.
This month, another 7 issues appeared, most of which cover a form of Pascal in one or more of the articles and advertisements:
- Micro_Cornucopia_#33_Dec-Jan87.pdf
- Micro_Cornucopia_#34_Feb87.pdf
- Micro_Cornucopia_#35_Apr87.pdf
- Micro_Cornucopia_#36_Jun87.pdf
- Micro_Cornucopia_#37_Sep87.pdf
- Micro_Cornucopia_#38_Nov87.pdf
- Micro_Cornucopia_#39_Jan88.pdf
A fun thing to notice are the advertisements for Modula-2. Logitech Modula-2. Yes though the Logitech Wikipedia page does not mention it at all, Logitech didn’t only sell mice, keyboards and web-cams. They had more products. Being Swiss, they were big in Modula-2.
The only issues still to be scanned are #28 till #32.
–jeroen
Filed under: Assembly Language, C, C++, Delphi, Development, Pascal, Software Development, Turbo Assembler, Turbo Pascal, x86 Tagged: computer, media, research, science, technology
The Wiert Corner - irregular stream of stuff: jpluimers
A few interesting links for my archive:
- fcl-passrc – Free Pascal wiki.
(some classes for parsing Free Pascal, which is a lot like Delphi) - Syntax sample.
(Delphi 2009 grammar) - Looking for a Complete Delphi (object pascal) syntax – Stack Overflow.
- Identification of a Delphi 2009 level grammar to convert to GoldParser – Stack Overflow.
–jeroen
Filed under: Delphi, Development, FreePascal, Pascal, Software Development
DelphiTools.info: COM connector spring cleanup
DWScript COM Connector has just received a spring cleanup, as it had grown a bit mouldy over the last years. The COM Connector optionally gives scripts direct access to ActiveX and COM objects.
As part of the cleanup, it now support IEnumVARIANT and ComVariantArray can now be enumerated as well with “for in“.
In practice it means you can now use it to query WMI information f.i., as an illustration the following code will run a WQL query and print the name of the processor running the system:
const wbemFlagForwardOnly = $00000020; var locator := CreateOleObject('WbemScripting.SWbemLocator'); var service := locator.ConnectServer('localhost', 'root\CIMV2', '', ''); var objectSet := service.ExecQuery('Select Name from Win32_Processor', 'WQL', wbemFlagForwardOnly); forvar item in objectSet do PrintLn(item.Properties_.Item('Name').Value);
And speaking of WMI, Rodrigo RUZ maintains a lot of useful WMI queries on his The Road To Delphi blog.
twm’s blog: setfacl woes
Ever since I switched my Linux server to using ACLs (access control lists) for advanced access rights management I have struggled with rights being set too restrictive on new directories and files. Now it seems that I have solved the issue and this post is meant to remind me how to change the whole directory tree to the rights I want it to have:
sudo setfacl -Rm d:u::rwX,u::rwX,d:g::rwX,g::rwX,d:o:rX,o:rX directoryname
This recursively sets default and actual rights for directoryname and subdirectories as:
- users: rw for files and directoryies, x for directories only
- groups: the same
- others: r for files and directories, x for directories only
I really hope that this is the last time I have to troubleshoot access rights issues. I want to concentrate on developing software rather than administrating bloody servers.
DelphiTools.info: DWScript showcase: AquaSoft SlideShow
Answering the call for showcases, Steffen Binas prepared a very nice set of screenshots for AquaSoft‘s Slide Show impressive product, which went far beyond the minimal requirement, so I’m posting a full-blown article about it. Following is the presentation of their software and how DWScript is used inside it.
When you need a powerful showcase I’d bet AquaSoft SlideShow is the one: http://www.aquasoft.de/diashow.as (an english website for version 8 is coming soon).
Despite the simple name of the application it’s very powerful, just have look at the trailer video created completely with it.
The scripting system is intended to be used mainly by the developers and preset designers but we provide all the tools users too.
Our Interface based API can be found here (German only): http://wiki.aquasoft.de/wiki/index.php/Dokumentation_der_Scripting-API
How scripting is used:
- build intelligent presets which generate parts of the slideshow out of more complex templates.
- generate basic GUI for presets (e.g. Animated Path)
- allow execution of HLSL shaders, build their GUI and calculate their parameters
- generate context menu entries for SlideShowObjects
- manipulate bitmaps
Another product is AquaSoft WebShow 4 which is a tool to create web galleries out of photos and videos. DWScript is used here in its original manner using the HTML Filter to mix pascal code with html. Later we used more and more an HTMLBuilder class with fluent interface written completely in DWScript to avoid the html fragments mixed in the templates.
The templates are created object orientated and use inheritance. DWScript was a replacement for an own scripting language which was used in earlier versions. WebShow 4 is unfortunatelly not completely ready yet as it only has three templates included but is already public as the web wizard shipped together with AquaSoft SlideShow 8.
The road to Delphi: How distinguish when Windows was installed in Legacy BIOS or UEFI mode using Delphi?
As part of the TSMBIOS project, I needed a method to distinguish when Windows was installed in Legacy BIOS or UEFI mode. The solution was provided by the GetFirmwareEnvironmentVariable function.
The msdn documentation states
Firmware variables are not supported on a legacy BIOS-based system. The GetFirmwareEnvironmentVariable function will always fail on a legacy BIOS-based system, or if Windows was installed using legacy BIOS on a system that supports both legacy BIOS and UEFI. To identify these conditions, call the function with a dummy firmware environment name such as an empty string (“”) for the lpName parameter and a dummy GUID such as “{00000000-0000-0000-0000-000000000000}” for the lpGuid parameter. On a legacy BIOS-based system, or on a system that supports both legacy BIOS and UEFI where Windows was installed using legacy BIOS, the function will fail with ERROR_INVALID_FUNCTION. On a UEFI-based system, the function will fail with an error specific to the firmware, such as ERROR_NOACCESS, to indicate that the dummy GUID namespace does not exist.
.
So the Delphi code to detect such condition will be something like so
{$APPTYPE CONSOLE} uses Windows, SysUtils; function GetFirmwareEnvironmentVariableA(lpName, lpGuid: LPCSTR; pBuffer: Pointer; nSize: DWORD): DWORD; stdcall; external kernel32 name 'GetFirmwareEnvironmentVariableA'; begin try GetFirmwareEnvironmentVariableA('','{00000000-0000-0000-0000-000000000000}', nil,0); if (GetLastError = ERROR_INVALID_FUNCTION) then Writeln('Legacy BIOS') else Writeln('UEFI Boot Mode'); except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; Readln; end.
The road to Delphi: Added Linux support to the TSMBIOS Project
Great news for the Free Pascal developers, I just added Linux support to the TSMBIOS project.
Note : The TSMBIOS read the SMBIOS info using the /dev/mem device file which provides access to system physical memory, so the code must be executed using a user with the proper permissions.
The road to Delphi: Delphi XE3 Vcl Styles Additions
Alexey Sharagin from Embarcadero just wrote a blog article titled Tuning VCL Styles for Forms and Controls, which shows some features related to the VCL Styles introduced in Delphi XE3.
The road to Delphi: How customize the fonts of a TActionMainMenuBar and TPopupActionBar with the Vcl Styles Enabled
This week I received two emails from different Delphi developers asking about : How customize the fonts of a TActionMainMenuBar and TPopupActionBar with the Vcl Styles Enabled? Also a question about the same topic was asked in StackOverflow.
This post shows how this task can be done.
In order to change the font and size of a TActionMainMenuBar and a TPopupActionBar in a VCL application you must use the Screen.MenuFont property like so.
Screen.MenuFont.Name := 'Impact'; Screen.MenuFont.Size := 12;
But if the Vcl Styles are enabled these changes are not reflected (This is because the Vcl Styles uses the fonts defined in style file).
Now if you want change the font type or font size of the Vcl Styles elements related to the menus like MenuItemTextNormal, MenuItemTextHot and so on, you will use the Style Designer and set font values which you want.
But unfortunately this will not work either, I mean even if you edit the fonts of the Vcl Style file, the changes are not reflected in the Menus components (or others controls). The reason for this is that the Vcl Styles Engine ignores the fonts types and font size defined in the style file. and just use the font color value to draw the text of the controls.
Note : The font used by the Vcl Styles is Tahoma and the Size is 8.
So what is the solution for customize the font of a TActionMainMenuBar component? A possible workaround is create a new Action Bar Style and also create a new TCustomMenuItem and TCustomMenuButton to override the DrawTextmethod and draw your self the menu text using the Screen.MenuFont values, the good news are which since now, you can find a implementation of a new Action Bar Style in the Vcl.PlatformVclStylesActnCtrls unit (which is part of the Vcl Styles Utils project) which allows you to modify the font of the TActionMainMenuBar and TPopupActionBar components.
So to use this new Action Bar Style, just add the Vcl.PlatformVclStylesActnCtrls unit to your project and then assign the new style to your Action Manager like so :
ActionManager1.Style:=PlatformVclStylesStyle;
And now when you run your app the TActionMainMenuBar and TPopupActionBar will use the font defined in the Screen.MenuFont property.
The road to Delphi: Exploring Delphi XE3 – Accesing Windows Sensors from VCL (and Firemonkey)
Delphi XE3 includes support for sensors in OSX and Windows, the classes and types necessaries to access such devices are defined as abstract classes in the System.Sensors unit and implemented in the System.Mac.Sensors unit for OSX and System.Win.Sensors unit for Windows. This article will focus in the Windows side implementation.
Windows 7 introduces the Sensor and Location API, which unifies the access to hardware devices like GPS, Light Sensors, Biometric Sensors and so on. Avoiding the need of use a specific dlls or SDK to control the sensor devices. this API is condensed on these files which are part of the Windows 7 Software Development Kit (SDK).
File name | Description |
---|---|
Sensorsapi.h | The main header file for the Sensor API. This header file contains the interface definitions. |
Sensors.h | The header file that contains definitions of platform-defined constants. |
Initguid.h | The header file that contains definitions for controlling GUID initialization.{ |
FunctionDiscoveryKeys.h | The header file that defines device ID property keys that are required when you connect to logical sensors. |
Sensorsapi.lib | A static library that contains GUID definitions for the Sensor API. |
PortableDeviceGuids.lib | A static library that contains GUID definitions for Windows Portable Devices objects. |
All these headers was translated by Embarcadero and included as part of the RTL of the Delphi XE3, these are the units which contains such translations Winapi.Portabledevicetypes, Winapi.Sensors, Winapi.Sensorsapi, Winapi.Locationapi. Fortunately an additional set of classes was added to wrap the sensors API, these classes are defined and implemented in the System.Sensors and System.Win.Sensors units. So you don’t need access directly interfaces like ISensor or ISensorManager to gain access to the sensors.
Enumerating Sensors
In order to gain access to the sensors you must get an instance to the TSensorManager class and then call the Activate method, from here you can iterate over the Sensors property or use the GetSensorsByCategory method to get an array of TSensor objects filtered by an TSensorCategory.
var LManager : TSensorManager; LSensors : TSensorArray; LSensor : TCustomSensor; begin LManager := TSensorManager.Current; LManager.Activate; try LSensors := LManager.GetSensorsByCategory(TSensorCategory.Location); for LSensor in LSensors do begin //do something end; finally LManager.Deactivate; end; end;
All the sensors share a common set of properties like the Manufacturer, Model, Serial number and so on. So extending the above code you can access such properties on this way :
var LManager : TSensorManager; LSensors : TSensorArray; LSensor : TCustomSensor; begin LManager := TSensorManager.Current; LManager.Activate; try LSensors := LManager.GetSensorsByCategory(TSensorCategory.Location); for LSensor in LSensors do begin Writeln(Format('Description : %s', [LSensor.Description])); Writeln(Format('Manufacturer : %s', [LSensor.Manufacturer])); Writeln(Format('Model : %s', [LSensor.Model])); Writeln(Format('Serial No : %s', [LSensor.SerialNo])); Writeln(Format('State : %s', [GetEnumName(TypeInfo(TSensorState),integer(LSensor.State))])); Writeln(Format('TimeStamp : %s', [DatetoStr(LSensor.TimeStamp)])); Writeln(Format('Unique ID : %s', [LSensor.UniqueID])); end; finally LManager.Deactivate; end; end;
Now depending of the sensor category, you must cast the TCustomSensor to the proper specific class, in this case we will use the TCustomLocationSensor class.
var LManager : TSensorManager; LSensors : TSensorArray; LSensor : TCustomSensor; LLocationSensor : TCustomLocationSensor; begin LManager := TSensorManager.Current; LManager.Activate; try LSensors := LManager.GetSensorsByCategory(TSensorCategory.Location); for LSensor in LSensors do begin Writeln(Format('Description : %s', [LSensor.Description])); Writeln(Format('Manufacturer : %s', [LSensor.Manufacturer])); Writeln(Format('Model : %s', [LSensor.Model])); Writeln(Format('Serial No : %s', [LSensor.SerialNo])); Writeln(Format('State : %s', [GetEnumName(TypeInfo(TSensorState),integer(LSensor.State))])); Writeln(Format('TimeStamp : %s', [DatetoStr(LSensor.TimeStamp)])); Writeln(Format('Unique ID : %s', [LSensor.UniqueID])); LLocationSensor:=LSensor as TCustomLocationSensor; LLocationSensor.Start; try Writeln(Format('Sensor Type : %s', [GetEnumName(TypeInfo(TLocationSensorType),integer(LLocationSensor.SensorType))])); Writeln(Format('Authorized : %s', [GetEnumName(TypeInfo(TAuthorizationType),integer(LLocationSensor.Authorized))])); Writeln(Format('Accuracy : %n', [LLocationSensor.Accuracy])); Writeln(Format('Distance : %n', [LLocationSensor.Distance])); Writeln(Format('Power Consumption : %s', [GetEnumName(TypeInfo(TPowerConsumption),integer(LLocationSensor.PowerConsumption))])); Writeln(Format('Location Change : %s', [GetEnumName(TypeInfo(TLocationChangeType),integer(LLocationSensor.LocationChange))])); if TCustomLocationSensor.TProperty.Latitude in LLocationSensor.AvailableProperties then Writeln(Format('Latitude : %n', [LLocationSensor.Latitude])); if TCustomLocationSensor.TProperty.Longitude in LLocationSensor.AvailableProperties then Writeln(Format('Longitude : %n', [LLocationSensor.Longitude])); if TCustomLocationSensor.TProperty.ErrorRadius in LLocationSensor.AvailableProperties then Writeln(Format('Error Radius : %n', [LLocationSensor.ErrorRadius])); if TCustomLocationSensor.TProperty.Altitude in LLocationSensor.AvailableProperties then Writeln(Format('Altitude : %n', [LLocationSensor.Altitude])); if TCustomLocationSensor.TProperty.Speed in LLocationSensor.AvailableProperties then Writeln(Format('Speed : %n', [LLocationSensor.Speed])); if TCustomLocationSensor.TProperty.TrueHeading in LLocationSensor.AvailableProperties then Writeln(Format('True Heading : %n', [LLocationSensor.TrueHeading])); if TCustomLocationSensor.TProperty.MagneticHeading in LLocationSensor.AvailableProperties then Writeln(Format('Magnetic Heading : %n', [LLocationSensor.MagneticHeading])); if TCustomLocationSensor.TProperty.Address1 in LLocationSensor.AvailableProperties then Writeln(Format('Address1 : %s', [LLocationSensor.Address1])); if TCustomLocationSensor.TProperty.Address2 in LLocationSensor.AvailableProperties then Writeln(Format('Address2 : %s', [LLocationSensor.Address2])); if TCustomLocationSensor.TProperty.City in LLocationSensor.AvailableProperties then Writeln(Format('City : %s', [LLocationSensor.City])); if TCustomLocationSensor.TProperty.StateProvince in LLocationSensor.AvailableProperties then Writeln(Format('State/Province : %s', [LLocationSensor.StateProvince])); if TCustomLocationSensor.TProperty.PostalCode in LLocationSensor.AvailableProperties then Writeln(Format('Postal Code : %s', [LLocationSensor.PostalCode])); if TCustomLocationSensor.TProperty.CountryRegion in LLocationSensor.AvailableProperties then Writeln(Format('Country Region : %s', [LLocationSensor.CountryRegion])); finally LLocationSensor.Stop; end; Writeln; end; finally LManager.Deactivate; end; end;
Not all the properties exposed by the Windows sensors and Location API are mapped directly in the TCustomSensors class, so to access this additional data you can use the HasCustomData and CustomData indexed properties and use one of the values defined in the Winapi.Sensors unit which is the translation of the Sensors.h header file.
if LLocationSensor.HasCustomData[SENSOR_DATA_TYPE_SATELLITES_USED_COUNT] then Writeln(Format('Satellites used : %d', [ Integer(LLocationSensor.CustomData[SENSOR_DATA_TYPE_SATELLITES_USED_COUNT])]));
Sample Application
Check this sample console application which enumerates all the sensors and properties.
{$APPTYPE CONSOLE} uses System.TypInfo, System.Sensors, System.SysUtils; procedure EnumerateSensors; var LManager : TSensorManager; LCustomLocationSensor : TCustomLocationSensor; LCustomLightSensor : TCustomLightSensor; LCustomEnvironmentalSensor : TCustomEnvironmentalSensor; LCustomMotionSensor : TCustomMotionSensor; LCustomOrientationSensor : TCustomOrientationSensor; LCustomMechanicalSensor : TCustomMechanicalSensor; LCustomElectricalSensor : TCustomElectricalSensor; LCustomBiometricSensor : TCustomBiometricSensor; LCustomScannerSensor : TCustomScannerSensor; LSensor : TCustomSensor; i : Integer; begin LManager := TSensorManager.Current; LManager.Activate; //LSensors := LManager.GetSensorsByCategory(TSensorCategory.Location); if LManager.Count > 0 then for i := 0 to LManager.Count-1 do begin Writeln(Format('Sensor %d',[i+1])); Writeln('--------'); LSensor:= LManager.Sensors[i]; Writeln(Format('Category : %s', [GetEnumName(TypeInfo(TSensorCategory),integer(LSensor.Category))])); Writeln(Format('Description : %s', [LSensor.Description])); Writeln(Format('Manufacturer : %s', [LSensor.Manufacturer])); Writeln(Format('Model : %s', [LSensor.Model])); Writeln(Format('Serial No : %s', [LSensor.SerialNo])); Writeln(Format('State : %s', [GetEnumName(TypeInfo(TSensorState),integer(LSensor.State))])); Writeln(Format('TimeStamp : %s', [DatetoStr(LSensor.TimeStamp)])); Writeln(Format('Unique ID : %s', [LSensor.UniqueID])); case LSensor.Category of TSensorCategory.Location : begin LCustomLocationSensor:=LSensor as TCustomLocationSensor; LCustomLocationSensor.Start; Writeln(Format('Sensor Type : %s', [GetEnumName(TypeInfo(TLocationSensorType),integer(LCustomLocationSensor.SensorType))])); Writeln(Format('Authorized : %s', [GetEnumName(TypeInfo(TAuthorizationType),integer(LCustomLocationSensor.Authorized))])); Writeln(Format('Accuracy : %n', [LCustomLocationSensor.Accuracy])); Writeln(Format('Distance : %n', [LCustomLocationSensor.Distance])); Writeln(Format('Power Consumption : %s', [GetEnumName(TypeInfo(TPowerConsumption),integer(LCustomLocationSensor.PowerConsumption))])); Writeln(Format('Location Change : %s', [GetEnumName(TypeInfo(TLocationChangeType),integer(LCustomLocationSensor.LocationChange))])); Writeln(Format('Latitude : %n', [LCustomLocationSensor.Latitude])); Writeln(Format('Longitude : %n', [LCustomLocationSensor.Longitude])); Writeln(Format('Longitude : %n', [LCustomLocationSensor.Longitude])); Writeln(Format('Error Radius : %n', [LCustomLocationSensor.ErrorRadius])); Writeln(Format('Altitude : %n', [LCustomLocationSensor.Altitude])); Writeln(Format('Speed : %n', [LCustomLocationSensor.Speed])); Writeln(Format('True Heading : %n', [LCustomLocationSensor.TrueHeading])); Writeln(Format('Magnetic Heading : %n', [LCustomLocationSensor.MagneticHeading])); Writeln(Format('Address1 : %s', [LCustomLocationSensor.Address1])); Writeln(Format('Address2 : %s', [LCustomLocationSensor.Address2])); Writeln(Format('City : %s', [LCustomLocationSensor.City])); Writeln(Format('State/Province : %s', [LCustomLocationSensor.StateProvince])); Writeln(Format('Postal Code : %s', [LCustomLocationSensor.PostalCode])); Writeln(Format('Country Region : %s', [LCustomLocationSensor.CountryRegion])); LCustomLocationSensor.Stop; end; TSensorCategory.Light : begin LCustomLightSensor:=LSensor as TCustomLightSensor; Writeln(Format('Lux : %n', [LCustomLightSensor.Lux])); Writeln(Format('Temperature : %n', [LCustomLightSensor.Temperature])); Writeln(Format('Chromacity : %n', [LCustomLightSensor.Chromacity])); Writeln(Format('Sensor Type : %s', [GetEnumName(TypeInfo(TLightSensorType),integer(LCustomLightSensor.SensorType))])); end; TSensorCategory.Environmental : begin LCustomEnvironmentalSensor:= LSensor as TCustomEnvironmentalSensor; Writeln(Format('Sensor Type : %s', [GetEnumName(TypeInfo(TEnvironmentalSensorType),integer(LCustomEnvironmentalSensor.SensorType))])); Writeln(Format('Temperature : %n', [LCustomEnvironmentalSensor.Temperature])); Writeln(Format('Pressure : %n', [LCustomEnvironmentalSensor.Pressure])); Writeln(Format('Humidity : %n', [LCustomEnvironmentalSensor.Humidity])); Writeln(Format('Wind Direction : %n', [LCustomEnvironmentalSensor.WindDirection])); Writeln(Format('Wind Speed : %n', [LCustomEnvironmentalSensor.WindSpeed])); end; TSensorCategory.Motion : begin LCustomMotionSensor:= LSensor as TCustomMotionSensor; Writeln(Format('Sensor Type : %s', [GetEnumName(TypeInfo(TMotionSensorType),integer(LCustomMotionSensor.SensorType))])); Writeln(Format('Acceleration X : %n', [LCustomMotionSensor.AccelerationX])); Writeln(Format('Acceleration Y : %n', [LCustomMotionSensor.AccelerationY])); Writeln(Format('Acceleration Z : %n', [LCustomMotionSensor.AccelerationZ])); Writeln(Format('Angle Accel. X : %n', [LCustomMotionSensor.AngleAccelX])); Writeln(Format('Angle Accel. Y : %n', [LCustomMotionSensor.AngleAccelY])); Writeln(Format('Angle Accel. Z : %n', [LCustomMotionSensor.AngleAccelZ])); Writeln(Format('Motion : %n', [LCustomMotionSensor.Motion])); Writeln(Format('Speed : %n', [LCustomMotionSensor.Speed])); Writeln(Format('Update Interval: %n', [LCustomMotionSensor.UpdateInterval])); end; TSensorCategory.Orientation : begin LCustomOrientationSensor:= LSensor as TCustomOrientationSensor; Writeln(Format('Sensor Type : %s', [GetEnumName(TypeInfo(TOrientationSensorType),integer(LCustomOrientationSensor.SensorType))])); Writeln(Format('Tilt X : %n', [LCustomOrientationSensor.TiltX])); Writeln(Format('Tilt Y : %n', [LCustomOrientationSensor.TiltY])); Writeln(Format('Tilt Z : %n', [LCustomOrientationSensor.TiltZ])); Writeln(Format('Distance X : %n', [LCustomOrientationSensor.DistanceX])); Writeln(Format('Distance Y : %n', [LCustomOrientationSensor.DistanceY])); Writeln(Format('Distance Z : %n', [LCustomOrientationSensor.DistanceZ])); Writeln(Format('Heading X : %n', [LCustomOrientationSensor.HeadingX])); Writeln(Format('Heading Y : %n', [LCustomOrientationSensor.HeadingY])); Writeln(Format('Heading Z : %n', [LCustomOrientationSensor.HeadingZ])); Writeln(Format('Mag. Heading : %n', [LCustomOrientationSensor.MagHeading])); Writeln(Format('True Heading : %n', [LCustomOrientationSensor.TrueHeading])); Writeln(Format('Comp.Heading : %n', [LCustomOrientationSensor.CompMagHeading])); Writeln(Format('Comp True Head : %n', [LCustomOrientationSensor.CompTrueHeading])); end; TSensorCategory.Mechanical : begin LCustomMechanicalSensor:= LSensor as TCustomMechanicalSensor; Writeln(Format('Sensor Type : %s', [GetEnumName(TypeInfo(TMechanicalSensorType),integer(LCustomMechanicalSensor.SensorType))])); Writeln(Format('Switch State : %s', [BoolToStr(LCustomMechanicalSensor.SwitchState, True)])); Writeln(Format('Switch Array State : %d', [LCustomMechanicalSensor.SwitchArrayState])); Writeln(Format('Multi Value State : %n', [LCustomMechanicalSensor.MultiValueState])); Writeln(Format('Force : %n', [LCustomMechanicalSensor.Force])); Writeln(Format('Abs. Pressure : %n', [LCustomMechanicalSensor.AbsPressure])); Writeln(Format('Gauge Pressure : %n', [LCustomMechanicalSensor.GaugePressure])); Writeln(Format('Strain : %n', [LCustomMechanicalSensor.Strain])); Writeln(Format('Weight : %n', [LCustomMechanicalSensor.Weight])); end; TSensorCategory.Electrical : begin LCustomElectricalSensor:= LSensor as TCustomElectricalSensor; Writeln(Format('Sensor Type : %s', [GetEnumName(TypeInfo(TElectricalSensorType),integer(LCustomElectricalSensor.SensorType))])); Writeln(Format('Capacitance : %n', [LCustomElectricalSensor.Capacitance])); Writeln(Format('Resistance : %n', [LCustomElectricalSensor.Resistance])); Writeln(Format('Inductance : %n', [LCustomElectricalSensor.Inductance])); Writeln(Format('Current : %n', [LCustomElectricalSensor.Current])); Writeln(Format('Voltage : %n', [LCustomElectricalSensor.Voltage])); Writeln(Format('Power : %n', [LCustomElectricalSensor.Power])); end; TSensorCategory.Biometric : begin LCustomBiometricSensor:= LSensor as TCustomBiometricSensor; Writeln(Format('Sensor Type : %s', [GetEnumName(TypeInfo(TBiometricSensorType),integer(LCustomBiometricSensor.SensorType))])); Writeln(Format('Human Proximity: %n', [LCustomBiometricSensor.HumanProximity])); Writeln(Format('Human Presense : %s', [BoolToStr(LCustomBiometricSensor.HumanPresense, True)])); Writeln(Format('Touch : %s', [BoolToStr(LCustomBiometricSensor.Touch, True)])); end; TSensorCategory.Scanner : begin LCustomScannerSensor:= LSensor as TCustomScannerSensor; Writeln(Format('Sensor Type : %s', [GetEnumName(TypeInfo(TScannerSensorType),integer(LCustomScannerSensor.SensorType))])); Writeln(Format('Human Proximity: %d', [LCustomScannerSensor.RFIDTag])); Writeln(Format('Barcode Data : %s', [LCustomScannerSensor.BarcodeData])); end; end; Writeln; end else Writeln('Not sensors was found'); LManager.Deactivate; end; begin try EnumerateSensors; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; Readln; end.
Virtual Sensors
If you don’t have sensors in your machine you can play with these virtual sensors.
- GPSDirect NMEA Sensor Driver for Windows 7
- Geosense for Windows Sensor
- Microsoft Virtual Light Sensor included in the Windows SDK
The Wiert Corner - irregular stream of stuff: jpluimers
For my research queue:
I should look at the below ConnectionStrings to access dBase with ADO from Delphi, If I ever need to do that.
Thanks Cromulent for asking, Nelson for editing and Pieter for answering:
Microsoft dBase ODBC driver
Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;OLE DB Services = -1;Extended Properties=dBase IV;Dbq=c:\mypathdoing operations like ADOTable1.Open are very fast (good) but GetIndexNames returns nothing (bad).
Microsoft Jet OLEDB 4.0 driver
Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=dBASE IV;OLE DB Services=-1;Data Source=c:\mypathdoing operations like ADOTable1.Open are exceedingly slow (bad) while GetIndexNames does return index names the way it should (good).
How do I get both speed and the index info via ADO for the dBase tables?
Microsoft Paradox Driver 7.x
“We use the following connection string which works really well.”
Provider=MSDASQL.1;Persist Security Info=False;Extended Properties="Driver={Microsoft Visual FoxPro Driver};UID=;SourceDB=c:\mypath;SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;Deleted=Yes;"
–jeroen
via Delphi + ADO + dBase – Stack Overflow.
Filed under: Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 5, Delphi 6, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Development, Software Development
Firebird News: Firebird Python driver FDB release 1.1 is out
Firebird News: isql documentation update
The Wiert Corner - irregular stream of stuff: jpluimers
A small duh moment when I found this out myself the hard way: when repeatedly drawing anti-aliased text, it will alter the background on each draw.
So you cannot do that. Not in Delphi, not in .NET, not in Cocoa, nowhere (:
–jeroen
via: delphi – “Additive” text rendering on TCanvas? – Stack Overflow.
Filed under: .NET, Delphi, Development, FireMonkey, Software Development, User Experience, WinForms, WPF, XNA
Firebird News: PHP 5.5 beta3 is released and pdo_firebird.dll is re-added to builds and ready for testers
The road to Delphi: Added support to TSMBIOS for SMBIOS 2.8 spec.
A few weeks ago (3 Apr 2013) a new update to the System Management BIOS (SMBIOS) Reference Specification was introduced by the DMTF. So the TSMBIOS project was updated to support the SMBIOS 2.8.
The following changes was added to the 2.8 version:
- Processor Information (Type 4):
- SMBIOSCR00106: processor family name correction (48h)
- SMBIOSCR00107: new processor family types
- SMBIOSCR00108: new processor family type
- SMBIOSCR00110: correct typo in table 24 (processor upgrade)
- SMBIOSCR00118: new processor family types
- SMBIOSCR00121: new processor family type
- SMBIOSCR00122: new processor upgrade type
- SMBIOSCR00125: add new Intel socket type
- Memory Device (Type 17):
- SMBIOSCR00109: add minimum, maximum and configured voltages
- SMBIOSCR00114: add LRDIMM to memory device list
- Other:
- SMBIOSCR00116: correct/clarify structure length fields
- SMBIOSCR00120: add new supported processor architectures
- SMBIOSCR00123: update referenced specifications
- Wording updates for clarity and consistency
Delphi Code Monkey: Programming For Non-Programmers : No Silver Bullets, No Free Lunches.
- There Ain't No Such Thing As A Free Lunch (TANSTAAFL) -- Robert Heinlein
- There Are No Silver Bullets -- Fred Brooks
- The core product is free, and is supported by revenues from their tutorial videos (LiveCode Academy) as well as from their sales and support for their premium product.
- It's cross platform, on Windows, Linux, mobile, and Mac, in fact, it claims to support all the platforms that Delphi still has on the distant future roadmap.
- Let users pick items and combine them using menus and toolbars that will result in code templates being generated, for common tasks like variable declarations and assignment, looping, and conditional checks.
- Let users write in a simple declarative style without line-noise or overhead:
Field1 = "test" - When users type something that is not understood, provide some kind of interactive help that helps them navigate their way out of the mess or confusion they are in.
twm’s blog: Storing gnugettext translations as resources
I always wondered why the assemble tool in dxgettext appends the translation files directly to the executable rather than using the existing mechanism of resources. This is no longer necessary. I have updated the gnugettext code to optionally use RCDATA resources named after the files.
So you e.g. create a translations.rc file as
LOCALE_DE_DEFAULT RCDATA ..\locale\de\LC_MESSAGES\default.mo LOCALE_DE_DELPHI RCDATA ..\locale\de\LC_MESSAGES\delphi2007.mo LOCALE_DE_DZLIB RCDATA ..\locale\de\LC_MESSAGES\dzlib.mo LOCALE_EN_DEFAULT RCDATA ..\locale\en\LC_MESSAGES\default.mo LOCALE_EN_DELPHI RCDATA ..\locale\en\LC_MESSAGES\delphi2007.mo LOCALE_EN_DZLIB RCDATA ..\locale\en\LC_MESSAGES\dzlib.mo
Compile it using a resource compiler e.g. brcc32 to translations.res and add it to the executable.
The new code in gnugettext will automatically find and use these resources, all you have to do is add the conditional define dx_SupportsResources.
// if the conditional dx_SupportsResources is defined the .mo files // can also be added to the executable as Windows resources // Be warned: This has not been thoroughly tested. // Default is turned off. {.$define dx_SupportsResources}
You can find the updated gnugettext.pas in the dxgettext subversion repository on sourceforge.
Disclaimer: I have only cursorily tested this code. Use it at your own risk!