The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,862 other subscribers

Archive for 2014

Some more notes on ASUS RT-N66U, firmwares, temperatures and versions

Posted by jpluimers on 2014/08/20

In the the irregular series of ASUS RT-N66U and TomatoUSB posts:

Execute this script from the Tomato USB interface, or a ssh/telnet shell:

cat /dev/mtd0ro | grep bl_version
nvram get os_version
nvram get clkfreq
wl -i eth1 phy_tempsense | awk '{print $1/2+20;}'
wl -i eth2 phy_tempsense | awk '{print $1/2+20;}'
  • Line 1 gets the CFE bootloader version
    (1.0.2 and lower boot with 32K of NVRAM, 1.0.3 and up with 64K of RAM; some Firmwares work around the 32k limitation)
  • Line 2 gets the Firmware model and version
  • Line 3 gets the CPU speed
  • Line 4 and 5 get the temperature for eth1 (2.4 Ghz) and eth2 (5 Ghz) in Celsius
    It is based on the RMerlinDev (firmware developer) information on temperatures: These are for each radio. Take the returned value, divide by 2, then add 20. Results are in Celcius.
    Next to that knowledge, it uses a few tricks on awk calculation, and first parameter in awk (the second parameter would be the hex value of the temperature code in parenthesis) which is easier than shell calculations.

Based on those, I found a few very useful scripts:

–jeroen

Posted in ASUS RT-N66U, Awk, bash, Development, Internet, Network-and-equipment, Power User, Scripting, Software Development, TomatoUSB | Leave a Comment »

GitHub System Status

Posted by jpluimers on 2014/08/19

Any site should have a stat system like this: GitHub System Status.

Posted in Development, DVCS - Distributed Version Control, git, Power User, Software Development, Source Code Management, Subversion/SVN | Leave a Comment »

Tom Lehrer – New Math Animated – YouTube

Posted by jpluimers on 2014/08/19

via: Tom Lehrer – New Math Animated – YouTube.

Base 8 is like base 10 when you miss two fingers…

Posted in Comics | Leave a Comment »

Delphi and C++ Builder VCL Library Buffer Overflow

Posted by jpluimers on 2014/08/19

Since this did not make it to DelphiFeeds yet: I’ve seen the function PaletteFromDIBColorTable in Graphics.pas go back as far at least until Delphi 2006, and references on the web as far back as Delphi 4.

So: this bug is old, but as it is a security one, make sure you patch soon.

For Delphi XE6, download 29913 BMP Buffer Overflow hotfix – Delphi, C++Builder, RAD Studio XE6.

For older Delphi versions, read this piece that was adapted from the EDN article Delphi and C++ Builder VCL Library Buffer Overflow:

For users of prior versions of Delphi and C++Builder: these steps should be followed to modify the VCL source code and add it to your application.

For each application:

  1. Add the modified Edit Vcl.Graphics.pas or Graphics.pas or Borland.Vcl.Graphics.pas to your project
  2. For C++Builder: Under Project | Options | Packages | Runtime Packages, set “Link with runtime packages” to false
  3. Rebuild your application

Once for the native VCL and .NET VCL:

  • Note: Variable names and scoping might be slightly different depending on your product version.
  1. Edit Vcl.Graphics.pas or Graphics.pas or Borland.Vcl.Graphics.pas
  2. Locate the function PaletteFromDIBColorTable.
  3. Add the following code just before the line assigning a value to Pal.palNumEntries when the DIBHandle = 0
    if ColorCount > 256 then 
      InvalidGraphic{$IFNDEF CLR}@{$ENDIF}SInvalidBitmap;;

–jeroen

via Delphi and C++ Builder VCL Library Buffer Overflow.

Posted in Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi 8, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Development, Software Development | Tagged: , , , | 5 Comments »

Delphi: (ab?)using managed types to help guarantee initialisation of stack record (via: Stack Overflow)

Posted by jpluimers on 2014/08/19

I mentioned Delphi managed types is in Delphi “Variant Records”, a few notes indicating they are special.

Managed by the RTL, you can use them to your advantage when you have record types that – when on the stack – are only partially initialized by the RTL: only the managed types are initialized.

Given there is still no support to support “Initialize” and “Finalize” operators (vote for it on [WayBack] QualityCentral) the best you can do was mentioned by LU RD (an alias a very smart Swedish guy Leif Unéus):

Add a dummy string member into your record. Since a string is a managed type it will be initialized to an empty string when the record comes in scope.

So when calling your Clear method, test if the dummy string is empty first. Set the string to a value when appropriate to the use logic to mark the record as initialized.

It reminded me of a managed types idea that former Delphi compiler engineer Barry Kelly once posed to me when I was struggling with the initialization state of nullable records: I wanted the default to be NULL, so I added an extra field managed field “IsInitialized” and the “IsNull” property would negate that field.

Use the Delphi compiler to your advantage (:

–jeroen

via: delphi – Guarantee initialisation of stack record – Stack Overflow.

Posted in Delphi, Delphi XE2, Delphi XE3, Delphi XE4, Development, QC, Software Development | Leave a Comment »

Windows: Where is my DropBox configuration?

Posted by jpluimers on 2014/08/18

Running DropBox on a roaming profile is a pain, especially when DropBox auto-starts.

Limitation: you can now use it on only 1 PC in the roaming profile domain at a time (I’ve not yet tried Open Source Software and Windows 32-bit: Multiple Dropbox (Do It Yourself).)

The reason is that depending on the logoff/logon order of machines, DropBox will overwrite parts of its configuration, and then think it needs to start with a fresh configuration.

Solution: Read the rest of this entry »

Posted in Power User, Windows, Windows 7, Windows 8, Windows Vista, Windows XP | Leave a Comment »

Adobe Reader installer download speed differences: FTP much slower than HTTP

Posted by jpluimers on 2014/08/17

The FTP download is much much slower than the http one:

4.2 MB/s – 73.4 MB of 73.4 MB: http://ardownload.adobe.com/pub/adobe/reader/win/11.x/11.0.08/en_US/AdbeRdr11008_en_US.exe

119 KB/s – 24.6 MB of 73.4 MB: ftp://ftp.adobe.com/pub/adobe/reader/win/11.x/11.0.08/en_US/AdbeRdr11008_en_US.exe

This over the same 50 megabit fiber connection.

So basically you have to:

  1. Browse the ftp://ftp.adobe.com/pub/adobe/reader/win/11.x  for a version in your language (en-US for intance has the youngest full install at ftp://ftp.adobe.com/pub/adobe/reader/win/11.x/11.0.10/en_US/ as younger versions only contain update MSP files, for instance in ftp://ftp.adobe.com/pub/adobe/reader/win/11.x/11.0.16/misc/)
  2. Copy the download URL
  3. Replace the ftp://ftp.adobe.com/pub/adobe/reader/win with http://ardownload.adobe.com/pub/adobe/reader/win (you cannot browse the latter as it genrates “Not Found; The requested URL /pub/adobe/reader/win/ was not found on this server.”)
  4. Download the URL that you just assembled

–jeroen

Posted in Adobe, Adobe Reader, Power User | 2 Comments »

Designer’s guide to DPI

Posted by jpluimers on 2014/08/15

Designer’s guide to DPI.

On retina, Hi-DPI, Android, iOS, scaling, DP, SP, etc.

–jeroen

Posted in Android, Development, iOS Development, Mobile Development, Software Development, User Experience (ux), Windows Phone Development | Leave a Comment »

Interesting way to become relaxed: calm.com.

Posted by jpluimers on 2014/08/15

Interesting way to become relaxed: calm.com.

Posted in LifeHacker, Power User | Leave a Comment »

Tim Anderson on Developing an app on Microsoft Azure: a few quick reflections…

Posted by jpluimers on 2014/08/14

Very nice summary: Developing an app on Microsoft Azure: a few quick reflections….

–jeroen

Posted in .NET, .NET 4.5, C#, C# 4.0, C# 5.0, C# 6 (Roslyn), Cloud Development, Development, Software Development, Visual Studio 2013, Visual Studio 2014, Visual Studio and tools, Windows Azure | Leave a Comment »