Monday, October 26, 2015

Delphi XE7 IDE crash due to CnPAck MSDN Help Integrated

After spending 2 full hours I managed to find the culprit for an IDE crash (access violation in VCL210). The cause was ...drum roll please... CnPack!

There was a palette in IDE's main tool bar called MSDN Help. However, when I right click to configure the toolbar, the palette was not listed there to show it/hide it. This probably cause the crash when I tried to remove it by dragging it out of the toolbar.

Saturday, October 17, 2015

Let DC++ autoconfigure the Internet connection

If you are behind a router that supports uPNP:


  • Make sure the uPNP feature is active in your router. Usually is disabled by default.
  • First you need to enable UPnP in Windows
  • Make sure of this by checking the "Universal Plug and Play Device Host" and "SSDP Discovery" services. Both of these services should be set to "Automatic" startup and "Started" status.
  • In DC++ activate the "Firewall with UPnP / Use UPnP to let DC++ configure my router" 
Check if your port is open at www.portforward.com

Enjoy.

Tuesday, September 15, 2015

svchost.exe high memory usage and 100% CPU - SOLVED

Every now and then I see high CPU utilization. So I decided to see which program is taking so much CPU.

First I looked into the task manger. At the first look it didn't show any program to take more than 1% CPU. But after checking the 'Show processes from all users' we got the guilty program: svchost.
But wait! svchost is not a program but a container for other programs (services). So we have to look inside svchost. For this, we click the 'Resource monitor' button (under Performance tab) in TaskManager.



In Resource monitor I looked under the CPU tab and I have seen that netsvcs is the process that takes all the CPU. I checked the checkbox in from of this process to filter out all other irrelevant processes. Now the 'Services' panel (located below Processes panel) shows that wuauserv is the actually guilty party. This is 'Windows updates'

If you have this problem, you could simply turn off this service as explained here:
http://www.techracket.com/solution-fix-svchost-exe-high-memory-usage-cpu-usage/


-----------------------

Related links:
http://www.cnet.com/forums/discussions/100-percent-cpu-usage-caused-by-svchost-process-need-help-339390/

Wednesday, June 17, 2015

More delphi weirdness - No mapping for the Unicode character exists in the target multi-byte code page

Today I tried to open an old project. While loading the main DFM form I got a "No mapping for the Unicode character exists in the target multi-byte code page" error.

After wasting some time I figured out what caused it: the form had a custom control that had a property like this: HeaderCellSpacing = 1.300000000000000000.
Meanwhile the control was updated and this property was renamed. This was the reason of the error. It was enough to open the DFM and manually delete that property. After that the form loaded nicely.

Delphi should have been able to see which properties does not exist anymore and automatically remove them. Another proof that Delphi XE7 is totally unworthy for day by day development.



Keywords: No mapping for the Unicode character exists in the target multi-byte code page

Wednesday, May 27, 2015

How to reduce Firefox (FF) memory usage?

How to reduce memory usage in Mozilla Firefox

 

Know your browser

Type about:memory in the Firefox address bar. This will show you current memory usage.

Browser history

  1. Type about:config in the Firefox address bar
  2. Do a search for browser.sessionhistory.max_entries
  3. Double click the default value (50), change it to something lower (3, 4, 5).

Addons
  1. Type about:addons in the Firefox address bar 
  2. Disable unused/unnecessary/unknown addons and plugins

AdBlock Plus

If you don't have AdBlock Plus, you don't know what you are missing: The Internet without ads!!! I am not kidding! However, it was reported that AdBlock Plus increased memory usage. So, if you have lots of open tabs, you may want to disable this plugin.
I did an experiment in May 2015, and it seems is not true, or at least, they fixed this issue, since then.


Enable hardware acceleration

  1. Type about:preferences#advanced in the Firefox address bar
  2. Check "Use hardware acceleration when available".
Please note that in my case this creates other (font-related) problems.



Restart Firefox often

In my case it helps a lot to restart Firefox every hour.


History

Press Ctrl+H to show the 'History'. Delete all entries older than 6 months.


Install it fresh

Installing a fresh copy of Firefox will help a lot. Somebody made and experiment about this here: https://support.mozilla.org/en-US/questions/1011071





In my case, the memory consumption decreased from 900MB to 500MB.

Thursday, April 2, 2015

Giving up on Delphi

Some months ago I upgraded from Delphi XE to Delphi XE7. Boy! What a mistake!
As EurekaLog people put it, Delphi XE7 is a "train wreck".
Now I am on the way of contacting Embarcadero and asking for a refund.
I will keep you updated to see how it goes.



You can find the word 'refund' only once in their huge EULA document. Not a good sign.

...Other than with respect to any indemnification hereunder, Licensor’s entire liability and Licensee’s exclusive remedy under this provision will be for Licensor to use commercially reasonable efforts to remedy defects covered by this warranty and condition within a reasonable period of time or, at Licensor’s option, either to replace the defective Product or to refund the amount paid by Licensee to license the use of the Product. Licensor does not warrant or condition that the operation of the Product will be uninterrupted or error free or that all software defects can be corrected. This warranty and condition shall not apply if... 
http://edn.embarcadero.com/article/43347

Here is related discussion about the disturbing changes Embarcadero make in their license and marketing approach: http://tech.turbu-rpg.com/429/if-this-is-true


Tuesday, March 17, 2015

How to set paths (library, debug, BPL, DCP, search) in Delphi XE7 (for multiplatform use)

So, Delphi's help doesn't tell us much about how to set up paths for DPK packages. It is ok. We got all used with Delphi's sloppy manual.

So, I will tell you how I do it so they work both on 32 and 64 Win platforms:



My packages


I have these major packages/folders:
  • Graphics32
  • Drag and Drop (Melander)
  • 3rd  Party (many small packages put together in a big package)
  • CommonPackages (these are my own packages)
I always build 'Graphics32', 'Drag and Drop' and '3rd  Party' packages only in Release mode. So, there is no DCUs and BPLs complied in Debug mode, therefore we don't set a path for $(Config).



Package setup 

Double click the DPK file to load it in Delphi. Go to project's settings and set xxxxxxxxxxxx.
This will ensure that the IDE and app that use this package don't have access to the package's PAS files. If the IDE has access to the PAS file it will recompile the files every time you complile the app.Even worst, if the IDE recompiles package's files, it will put the DCUs in app's folder!

Also unckeck 'Build as needed'. xxxxxxxxxxx




IDE setup 


IDE setup - Package output directory
  • For Win32 platform set it to: $(BDSCOMMONDIR)\Bpl
  • For Win64 platform set it to: $(BDSCOMMONDIR)\Bpl\$(Platform)
Do the same for 'DCP output directory'.


IDE setup - Library path settings

In Delphi options -> Library -> Library path, I set these paths for Win32 platform:
  • c:\MyProjects\Packages\DragDrop\$(Platform)
  • c:\MyProjects\Packages\Graphics32\$(Platform)
  • c:\MyProjects\Packages\Third party packages\$(Platform)
  • c:\MyProjects\Packages\CubicCommonControls\$(Platform)_$(Config)
Please note that Graphics32, Drag and Drop and 3rd  Partyonly have the $(Platform) set.

CommonPackages are multi-platform (Win32/64) and multi-config (debug, prerelease, release). Therefore, we use $(Config) in the path.
If the control uses *.res files you need to manually copy them in the $(Platform) folder (the folder where the DCU are written)

This is Delphi's help page for Browsing path: Specifies search paths where the compiler can find the required files for the package, such as .dcp and .bpi files.
This is the Delphi global library path. The compiler can find only those files that exist on the Library path. If you try to build your package with a file that is not on the Library path, you receive a compiler error.
Some resource files (such as controls.res) are only available in the Release folder (not the Debug folder), so you should ensure that your project Release directory either is specified in the Library path or will be resolved by at least one variable in the Library path.


Browse path

In Delphi options -> Library ->:
Enter the path to package's source code so the IDE will able to reach the code (for example to be able to open a file when you control+click a method in IDE):
  • c:\MyProjects\Packages\DragDrop\
  • c:\MyProjects\Packages\Graphics32\
  • c:\MyProjects\Packages\Third party packages\
  • c:\MyProjects\Packages\CubicCommonControls\
This is Delphi's help page for Browsing path: Specifies the directories where the Code Browsing feature of the Code Editor looks for unit files when it cannot find an identifier on the project search path or source path. The Code Editor searches for unit files used for code browsing in the following order:

  1. The project Search path for Delphi ( Project > Options > Delphi Compiler ) or the Include path for C++ ( Project > Options > Directories and Conditionals).
  2. The global browsing path (this option) for Win32 Delphi language projects; the directories specified with this option are appended to the debug source path for the project. Therefore, the debugger search order for unit files is determined by the following path settings:
    • The Browsing path (this option).
    • The project Source path (the directory in which the project was saved).


Search path

I am not sure you really need the thing below (I think you don't):

The project's 'Search Path' is set like this (for all platforms):
  • c:\MyProjects\Packages\DragDrop\$(Platform)
  • c:\MyProjects\Packages\Graphics32\$(Platform)
  • c:\MyProjects\Packages\Third party packages\$(Platform)
  • c:\MyProjects\Packages\CubicCommonControls\$(Platform)_$(Config)

You have to do the same for 32 and 64 bit platforms (in the 'Selected Platform' dropdown menu).


The applications

For applications (DPR) that are using the packages specified above I set the 'Unit output directory' like this (for 'All configurations/All platforms'):
  • .\$(Platform)_$(Config)


__________


Update: I had problems making a project to work when when I used a combination of $(Platform)_$(Config) and $(Platform) in the paths. It worked after I replaced $(Platform)_$(Config) with $(Platform).

Tuesday, March 3, 2015

Trying to do some multi-platform programming

So, I purchased Delphi XE7 for a pile of money (around 1000euros) hoping to do all the wonderful things they advertised.
After struggling with their grandiose (read as 'scarce' or 'almost nonexistent') user manual I managed compiling my 32 bit application for Windows 64.

Since Delphi is 32 bit and my Windows machine is also 32 bit you need to somehow deploy your app on Windows 64 and run/debug it there. This is what PAServer (debugger platform assistant) is supposed to do.
However, PAServer keeps crashing as soon you press the Run button in Delphi. Sometimes this error is shown:


Error setting debug exception hook.

[223ADB5B]{win32debugide210.bpl} Win32Debug.TNativeProcess.SetDelphiTracingLevel (Line 2324, "Win32Debug.pas" + 5) + $11
[223AD5ED]{win32debugide210.bpl} Win32Debug.TNativeProcess.InitExceptRanges (Line 2195, "Win32Debug.pas" + 3) + $4
[223ADFB8]{win32debugide210.bpl} Win32Debug.TNativeProcess.DoSetExceptOption (Line 2436, "Win32Debug.pas" + 2) + $6
[203620D0]{dbkdebugide210.bpl} Debug.TDebugger.SetProcess (Line 11394, "Debug.pas" + 31) + $10
[20363397]{dbkdebugide210.bpl} Debug.TProcess.SetExceptOption (Line 11709, "Debug.pas" + 1) + $4
[203574BF]{dbkdebugide210.bpl} Debug.TThread.ntfyThread (Line 6355, "Debug.pas" + 58) + $6
[1B76C593]{bordbk210.dll} Unknown function at @isDbkLoggingOn$qv + $626BB
[1B79C22A]{bordbk210.dll} Unknown function at @isDbkLoggingOn$qv + $92352
[1B79680A]{bordbk210.dll} Unknown function at @isDbkLoggingOn$qv + $8C932
[1B76B927]{bordbk210.dll} Unknown function at @isDbkLoggingOn$qv + $61A4F
[1B76C593]{bordbk210.dll} Unknown function at @isDbkLoggingOn$qv + $626BB
[1B793703]{bordbk210.dll} Unknown function at @isDbkLoggingOn$qv + $8982B
[1B79C4D7]{bordbk210.dll} Unknown function at @isDbkLoggingOn$qv + $925FF
[1B709D72]{bordbk210.dll} Unknown function at DllUnregisterServer + $17EF6
[1B76B8CC]{bordbk210.dll} Unknown function at @isDbkLoggingOn$qv + $619F4
[505C2850]{vcl210.bpl  } Vcl.Controls.TControl.Perform (Line 7010, "Vcl.Controls.pas" + 10) + $8
[1B76C7FC]{bordbk210.dll} Unknown function at @isDbkLoggingOn$qv + $62924
[1B714263]{bordbk210.dll} Unknown function at @isDbkLoggingOn$qv + $A38B
[505C76E2]{vcl210.bpl  } Vcl.Controls.TWinControl.WndProc (Line 10038, "Vcl.Controls.pas" + 153) + $6
[505C2850]{vcl210.bpl  } Vcl.Controls.TControl.Perform (Line 7010, "Vcl.Controls.pas" + 10) + $8
[505C5E7E]{vcl210.bpl  } Vcl.Controls.TWinControl.GetControl (Line 9130, "Vcl.Controls.pas" + 4) + $A
[505CA48F]{vcl210.bpl  } Vcl.Controls.TWinControl.CMInvalidate (Line 12012, "Vcl.Controls.pas" + 10) + $4
[505C2C15]{vcl210.bpl  } Vcl.Controls.TControl.WndProc (Line 7232, "Vcl.Controls.pas" + 91) + $6
(0003C651){CnWizards_DXE7.dll} [0DCCD651]
(0003C6B8){CnWizards_DXE7.dll} [0DCCD6B8]
(0003C769){CnWizards_DXE7.dll} [0DCCD769]
(00039EF6){CnWizards_DXE7.dll} [0DCCAEF6]
[500636D0]{rtl210.bpl  } System.@FinalizeArray (Line 31435, "System.pas" + 139) + $0
[500636C0]{rtl210.bpl  } System.@FinalizeArray (Line 31423, "System.pas" + 127) + $0
[50716363]{vcl210.bpl  } Vcl.Forms.TApplication.ProcessMessage (Line 10354, "Vcl.Forms.pas" + 25) + $1
[5071639E]{vcl210.bpl  } Vcl.Forms.TApplication.HandleMessage (Line 10382, "Vcl.Forms.pas" + 1) + $4
[507166D1]{vcl210.bpl  } Vcl.Forms.TApplication.Run (Line 10520, "Vcl.Forms.pas" + 26) + $3



Some people suggested that if you set your connection (the network connection between the 32 bit debugging machine and 64 bit debugged machine) without a password it may not work! I have tried that but with no success.


UPDATE

I tried to fix this and I spend too much time. In the end I gave up and installed Delphi in a second computer (yes, and did all the madness about installing all tools, libraries, etc) that has Win64 bits.


I also contacted Embarcadero support about this issue. They said that somebody will call me but I never heard from them. They know they can't fix the problem.

The conclusion is that Delphi is not even by far ready for multi-platform development. It has some multi-platform capabilities but I would say it doesn't go beyond the 'experimental' or 'beta' stage. Multi-platform (FMX included) is not ripe yet. Maybe in a couple of years. But then if it is too wait that long (and pay lots of money for upgrades) we should also consider Lazarus. 

Friday, February 27, 2015

Delphi bug: Exception EAccessViolation in module rtl210.bpl at 00016A9C [SOLVED]



I keep getting this error at Delphi shut down:

Application Error - Exception EAccessViolation in module rtl210.bpl at 00016A9C.
Access violation at address 50066A9C in module 'rtl210.bpl'. Read of address 06152AF8.

Solution 1:

The problem is fixed by restoring this registry key to its original state: [HKEY_CURRENT_USER\Software\Embarcadero\BDS\15.0\Known IDE Packages]

Here is the pristine value for this key:

[HKEY_CURRENT_USER\Software\Embarcadero\BDS\15.0\Known IDE Packages]
"$(BDS)\\bin\\htmide210.bpl"="(Untitled)"
"$(BDS)\\bin\\comptoolbar210.bpl"="Component Toolbar Package"
"$(BDS)\\bin\\mlcc210.bpl"="(Untitled)"
"$(BDS)\\Bin\\tgide210.bpl"="(Untitled)"
"$(BDS)\\Bin\\delphiosx32210.bpl"="Delphi OSX32 Platform"
"$(BDS)\\Bin\\macosxdebugide210.bpl"="MacOS"
"$(BDS)\\Bin\\delphiwin64210.bpl"="Delphi Win64 Platform"
"$(BDS)\\Bin\\win64debugide210.bpl"="(Untitled)"
"$(BDS)\\Bin\\GuidedTour210.bpl"="Embarcadero Guided Tour Package"
"$(BDS)\\Bin\\ModernTheme210.bpl"="(Untitled)"
"$(BDS)\\Bin\\asmview210.bpl"="Assembly Browser Package"
"$(BDS)\\Bin\\dbkdebugide210.bpl"="(Untitled)"
"$(BDS)\\Bin\\delphiwin32210.bpl"="Delphi Win32 Platform"
"$(BDS)\\Bin\\dotnetcoreide210.bpl"=".NET Core IDE Package"
"$(BDS)\\bin\\exceptiondiag210.bpl"="(Untitled)"
"$(BDS)\\bin\\fileexplorer210.bpl"="(Untitled)"
"$(BDS)\\bin\\historyide210.bpl"="(Untitled)"
"$(BDS)\\Bin\\htmlhelp2210.bpl"="HtmlHelp Viewer"
"$(BDS)\\bin\\idefilefilters210.bpl"="IDE File filters"
"$(BDS)\\bin\\plugview210.bpl"="Pluggable Tree View Package"
"$(BDS)\\Bin\\projpageide210.bpl"="Value Data: Project and template library package"
"$(BDS)\\Bin\\startpageide210.bpl"="Start Page IDE Package"
"$(BDS)\\Bin\\tlbview210.bpl"="TypeLibrary Browser Package"
"$(BDS)\\Bin\\codetemplates210.bpl"="(Untitled)"
"$(BDS)\\bin\\coreproide210.bpl"="Core IDE Pro Package"
"$(BDS)\\bin\\dbkdebugproide210.bpl"="(Untitled)"
"$(BDS)\\Bin\\profiledeployide210.bpl"="(Untitled)"
"$(BDS)\\Bin\\profilemgride210.bpl"="(Untitled)"
"$(BDS)\\Bin\\sdkmgride210.bpl"="Embarcadero SDK Manager"
"$(BDS)\\bin\\refactoride210.bpl"="Core Refactoring Package"
"$(BDS)\\bin\\todoide210.bpl"="ToDo"
"$(BDS)\\Bin\\comcore210.bpl"="HtmlHelp Viewer"
"$(BDS)\\Bin\\projecttargets210.bpl"="(Untitled)"
"$(BDS)\\Bin\\vclmenudesigner210.bpl"=".NET Core IDE Package"
"$(BDS)\\Bin\\DataExplorerIDE210.bpl"="(Untitled)"
"$(BDS)\\Bin\\unittestide210.bpl"="(Untitled)"
"$(BDS)\\Bin\\iteidew32210.bpl"="(Untitled)"
"$(BDS)\\Bin\\VisualizationServiceIDE210.bpl"="Visualization IDE Service Package"
"C:\\Users\\Public\\Documents\\Embarcadero\\Studio\\15.0\\Experts\\IDEFixPackStartup.bpl"="IDE Fix Pack Startup"


[UPDATE]
SOLUTION 2 (and cause):

After some work I discovered what caused this: The 'FMX controls' package was disabled (probably I disabled it since FMX is still infantile and I don't intend to use it right now). Re-enabling this package solved the problem.


Delphi: Access violation in module 'bindcomp210.bpl'


I keep getting an "Access violation at address 1204F872 in module 'bindcomp210.bpl'. Read of address 1423C764" message during Delphi startup.

After poking around I have found the solution: delete the
"Project" and/or "SaveFileDirectory" keys in [HKEY_CURRENT_USER\Software\Embarcadero\BDS\15.0\Session]


Wednesday, February 25, 2015

How difficult is to write a solid software protection (licensing) scheme?

Extracting unique identification numbers from hardware and using them for software protection scheme





I had customers that are purchasing a single software license but using it on multiple computers so I wanted to prevent them from doing so. The solution I have found was to generate a license key that is unique for each computer.

How? Using a DLL called Hardware ID Extractor, I can read the unique hardware ID of each computer. The DLL is easy to use. To get the CPU ID for example you simply call: GetCPUID.

The first thing you will ask yourself is: does the ID persist after the user formats the PC and reinstalls Windows. The answer is YES (hooray!). It works because this neat DLL reads the ID that is written (permanently) in hardware, not from Windows registry key.
And yes, it is compatible with all programming languages.

Link: Hardware ID Extractor library




Supported IDs:

Hard disk:

* Hard drive ID (unique hardware serial number written in drive's IDE electronic chip)
* Partition ID (volume serial number)

CPU:

* CPU ID (unique hardware ID)
* CPU vendor
* CPU current running speed
* CPU theoretic speed (CPU rated speed)

Physical memory:

* Memory Load ( Total memory used in percentage (%) )
*Total Physical ( Total physical memory in bytes )
*Avail Physical ( Physical memory left in bytes )
*Total PageFile ( Total page file in bytes )
*Available PageFile( Page file left in bytes )
*Total Virtual( Total virtual memory in bytes )
*Available Virtual ( Virtual memory left in bytes )

BIOS (NEW!):

Bios unique identification numberBiosDate
Bios unique identification numberBiosVersion
Bios unique identification numberBiosProductID
Bios unique identification numberBiosVideo

My old Fuji A610 is better than my new Fuji F550EXR

My old Fuji A610 is better than my new Fuji F550EXR. Take a look at these two photos takes at the same moment (a camera was in my right hand and the other camera in my left hand). Which one do you like better?



The first one is taken with my ancient FinePix A610, the second one with F550EXR.








____________________

Recommended download:

 

Why handling a possible ISP/server time-out is critical?

 Imagine that a possible client is downloading the application for the first time. During start up the application checks the internet to updates, news, resource files, etc. If the server fails to respond the application will hang. After 20 seconds (or way less) the customer will hit the Control+Alt+Del buttons, kill the application, uninstall it and download a similar one. Client lost. Bingo!

How to win a "who gets more traffic" contest (How to generate LOT of fake traffic on a web site)

Web Traffic Generator is a nice dirty tool that helps you to generate literary thousands of page views.

Lets say you participate in a contest "who's web page gets more visitors". All you have to do is to download this little devilish software, enter the URL of the page you want to send traffic to and press the 'Generate' button.
Now, minimize the program to system tray and go watch a movie or play a game. Few hours later check the visitor counter on that page. Your puny 35 visits suddenly rised to 35000+
 Ups... a bit too much? You should have stopped earlier.

Here is the link to that little proggy.

--------

What else is it good for?

(Extras from program's description:)


With Web Traffic Simulator you can generating fake traffic by reloading the specified web page(s) repeatedly in an integrated web browser. It has many purposes, such as:
  • increasing the counter of a web page in order to keep your web site/software in top of the others
  • increasing the visits on your YouTube pages
  • cheating on a "Top 10" popularity web site by increasing the number of votes
  • keeping you connected (preventing a web site like Yahoo Mail from logging you off after a period of inactivity)
  • reloading a page millions of times
  • downloading an URL (web page, ZIP, EXE...) millions of times
  • simulating clicks (for example on a link, banner, image, ad)
  • storming a web server by generating massive downloads
  • testing your web server under heavy load
  • use your imagination and you will find countless other possibilities…
 
 
And if you wonder if the program will work with Google Analytics, the answer is: it will! Google Analytics will see the fake traffic as real traffic.
 

Delphi developers are now charged for bug fixes [via Update Subscription]

Starting this year Embarcadero has a new plan to milk money from its customers. With the new 'Update Subscription' plan, Embarcadero wants to charge 30% from original purchase price, each year, each customer that wants access to product bug fixes (that were not supposed to be there anyway).
Eve more, there is no warranty that the customer will actually get the bug fixes. Embarcadero clearly states that: "All fixes, updates and hotfixes are purely at Embarcadero's discretion."
Actually it states that twice. So, don't miss to read it :)

Ongoing Maintenance and Hot-Fixes for Previous Versions*

In the middle of a development cycle on an older IDE version? The RAD Studio team will now continue to release critical updates and hotfixes for up to two (2) years and three (3) major versions, improving your investment and enabling you to upgrade to the latest version on your schedule. All maintenance updates and hotfixes will only be available to users on an active Subscription and cannot be downloaded or purchased separately. Versions currently under Ongoing maintenance include XE7, XE6, and XE5 versions. Active subscribers will also have immediate access to beta hotfixes, providing the most timely access to critical fixes. All fixes, updates and hotfixes are purely at Embarcadero's discretion.
Link


Some stores are already selling upgrade subscriptions for 2000 pounds + VAT.



There is another way to get updates?
No. The FAQ clearly states it:

Can I obtain updates and hotfixes without a subscription?
An active update subscription is the only way to obtain updates and hotfixes for current and prior (up to 2 years) releases.


















I see a big incoming wave of programming towards Lazarus.