Friday, January 12, 2018

Install Virtualbox Guest Additions to Kali Linux

Start the Kali Linux VM.

Edit your official repos list:

  • nano /etc/apt/sources.list 
and ensure that the following 2 lines are there

Save and exit nano.

Open a terminal window and type
  • apt update 
  • apt -y dist-upgrade
  • reboot

Check your version to ensure it is the latest.
  • uname -a

Install the X11 guest utilities package, which provide closer integration and improve the virtual machine's interactive performance.
  • apt -y install virtualbox-guest-x11
  • reboot
Now mount the VirtualBox Guest Additions image, using the "Devices/Install Guest Additions CD image" menu option on the running VM window.

When that is done, open a terminal window and type the following commands (assuming you are logged in as 'root')

  • cd /root/Desktop
  • cp /media/cdrom/VBoxLinuxAdditions.run /root/Desktop/
  • chmod 755 VBoxLinuxAdditions.run
  • ./VBoxLinuxAdditions.run

ps: Comments and/or links to this article are most welcome!

Wednesday, November 29, 2017

How to move files into different folders while keeping git (TortoiseGit) happy


  • Create the folder you want to move the files into.
  • Select all the files and right-drag them (i.e. drag while pressing the right mouse button) into the relevant folder.
  • When you release the right-button, a menu will popup offering various copy/move options.
    One of them is "Git move versioned item(s) here". 
  • Select that option and your files will be moved into the selected folder.
    Git will also be aware that the files did not disappear but were moved.



ps: Comments and/or links to this article are most welcome!

Wednesday, May 17, 2017

Selecting a worksheet from within a userform in Excel VBA

I came across this problem recently.

I had a 'Goto to sheet' button in the main sheet of an Excel workbook that contained a large number of sheets.

Pressing that button caused a userform to popup, showing a list of all the relevant sheets. This is the code behind that button

    With UserForm1
        .StartUpPosition = 0
        .Show vbModeless
    End With


The user would select a sheet from the listbox and press Ok, which would activate the selected sheet, using this code.

    Dim s As String
    s = ListBox1.Value

    Worksheets(s).Activate
    Worksheets(s).Range("B1").Activate
    Unload Me


All appeared to be working well, however, it seems that Excel showed the correct page but, internally, it was pointing to the main sheet.

(The main sheet had named A14 as 'emailAddr'. 
Clicking on A14 in the main sheet would show 'emailAddr' at the address cell, which is the cell above A1 - the one that shows the cell names...)

When VBA switched to the selected sheet, if I clicked in A14, it would show 'emailAddr' in the address cell instead of A14.

If I then manually went the previous sheet and then back to the one I wanted, it'd all be ok.


When I changed the 
    .Show 
to 
    .Show vbModeless

everything worked as it should!



ps: Comments and/or links to this article are most welcome!

Saturday, December 10, 2016

Very useful interactive CSS reference

I came across this very handy, interactive, visual CSS reference guide.

It describes all CSS properties and shows how they would appear on a page.

And, while studying the above, you may want to enjoy some cool music.


ps: Comments and/or links to this article are most welcome!

Saturday, October 8, 2016

Visual Studio 2015 installation issues ('package did not load ...')

[updated 9oct2016]

I am using VS2015 Community edition and recently decided to apply some updates that VS suggested, as well as add a few more addins.

Once the installation finished, I tried to open the solution I had just been working on, only to receive an error from VS about 'Roaming package did not load'.

I rerun the VS2015 installer and, after a length wait, was told that all was well.
I run VS and received the same error.

I then uninstalled VS (which took quite some time) and then re-installed it, only to have the same error appear.

I tried tricks from the web, like deleting the 
C:\Users\%user%\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache directory, to no effect.

Nothing I tried worked.

I even tried an uninstall with the '-uninstall -force' option, which ended up coming back with an error about 'bad blocks' (can't recall exact message).

All in all, nothing worked.

I then resorted to using the 'Total Uninstaller' tool from MS which removes all previous versions on VS.

After a reboot, I proceeded with a complete re-install of VS2015.

It took its good time to do the blasted install and, not surprisingly, it came up with an error at the end, regarding a problem with VC++ runtimes.

However, It did not say that the install failed, rather that it could not install those runtimes.

It turns out that something that I installed, installed VC++ redistributable v14.0.24215, whereas VS2015 wants v14.0.24210 (32 and 64-bit)

For me in any case, removing my (newer!) version of those runtimes, fixed the problem

I hope this works for you too.


[update:
Important note: Running TotalUninstaller actually made the re-install work better! It became clear that, prior to running this, there were leftovers from previous VS installations that caused this installation to make incorrect assumptions!]

The steps were:
- Unistall VS2015 via vs_community /uninstall
- run TotalUninstaller (Setup.ForcedUninstall.exe)
- reboot (it is windows after all...)
- run VS2015 installer. It now looks like it should! It does a proper, clear installation.



ps: Comments and/or links to this article are most welcome!

Sunday, June 26, 2016

open source software I use, part 2

[update 26-jun-2016
Thanks to Audrina W., I have now corrected the link to Smarty

Note that a lot of what is shown here was relevant in 2010 or so but is now out of date.]


Continuing on from part 1 of this series, here are some more open-source apps I use:


- jQuery. I have found this javascript library to be indispensable! It is a simple, non-imposing, yet deceptively powerful library. I will not write why or how it is so good here; there are lots and lots of articles on the web doing just that. I'd strongly suggest you have a look at it, if you do any kind of javascript work. It is not the only library out there nor the most all-encompassing but, to me, it is one of the most useful and fun to work with!


Web development:
I will bundle all the tools I use in one and see how it goes! Most of them do not need any explanation (but feel free to tell me otherwise!)


PHP: Server-side scripting language.
Reasonably
popular. I believe there are a couple of apps written in it.
(cough cough! A couple of million apps maybe! I read somewhere that there are approx 50 million web-sites running on PHP!!!)


btw, if you are a strongly-typed language developer (say, C, C++, C#, C+1, D-1 whatever, Pascal etc), do remember that this is a scripting language!
It allows you to write apps, large and small, very quickly, with nothing more needed than a text editor.
However, it also allows you to create apps that suck and are full of bugs.
Since it has no type-checking nor any compile-time smarts, you are always running the risk of bugs in your source.
A small mis-type of a variable name could bring down a large app, long after you've moved onto greener pastures.


That said, see my point above about 50 million web sites. (Not that more is better!)


Smarty: Template engine for PHP. Allows separation of presentation logic from PHP code
(makes using MVC just that much easier)


XDebug: Debugger for PHP. Works well with Eclipse. Must-have


EclipsePDT: The mother of all IDEs. Initially written by IBM, later offer to the OSS community. Thank you Big Blue!
(The PDT version is tailored to PHP development)




SAJAX: This library will help you write ajax-enabled apps; it provides all that is needed to make calls from javascript to PHP and back, passing arguments to and fro.
I have found it very useful, however I am now using the jQuery ajax support for most of this work. It is not the same but achieves the same result.
(NOTE: Jul 2010: jQuery provides all that is needed to do AJAX easily, so there is no need for this)


Mantis: Bug-tracker, written in PHP.


XAMPP: If you need a LAMPP stack (Linux Apache MySQL PHP Perl) or a WAMPP (Windoze....) then your best shot at a simple, no-hassles installation is via the XAMPP installer.
Download and run it and, presto, your machine has all the essentials for web development.
[update 2015]I now prefer WAMP. One of the great things about it is that it allows you to easily switch between different versions of PHP, Mysql and Apache, all via a menu entry.


PHPMyAdmin: MySQL database administration tool. Simply extract into a web dir onto your LAMPP server, point your browser at it and there you are! You now have a web-based, browser-driven MySql administrator!


JasperReports: OSS's answer to Crystal Reports.
This is just the reporting engine and runs off XML report-definition files. Do not panic, there is a GUI designer Eclipse plugin for it that makes report design a breeze (screenshot). There is also a stand-alone GUI for it, called iReport.


Note: Eclipse also has a reporting tool, called BIRT. I haven't used it a lot, however you should have a look at it too.




And now, for some non-development-related OSS tools:
- KeePass: Password vault. There is also a PocketPC version of it. It has a smart 'find out what form I am in and paste out the correct credentials' way of doing things.


I use it to store all my passwords. Before I leave work, I export the password to KeePass's native format, upload it to gmail, go home and download from gmail. I then get KeePass to import it and update existing keys and add new ones. I then export the merged results, upload to gmail, go to work, download from gmail and repeat all over again.


Webmin: A web-based, browser-driven Linux management tool. Allows you to manage almost everything on your Linux box from just a browser. You can start/stop jobs, administer users, administer server apps (such as Apache, MySql, ProFTPD, Samba etc etc).
It pretty much does everything. All you need to do is extract the webmin source (PHP) files onto your web server, point your browser to https://myserver:10000 and you are in control!


If you do end up using any of the above, let their authors know; they'd appreciate acknowledgement.
more later...


ps: Comments and/or links to this article are most welcome!

Wednesday, May 11, 2016

Uninstall remnants of Visual Studio 13 and above

Microsoft has created a utility that is run from the command line (administrator level needed), which cleans up any leftover files or registry keys that may be left over after a failed un-install.

This can come handy when a VS uninstall fails. If you try to install VS again, you may find that it detects the partial, previous installation and misbehaves.
In my case, it kept insisting that the installation dir was on the D: drive and would not let me change it.


You can find it here.


ps: Comments and/or links to this article are most welcome!

Tuesday, February 2, 2016

I've published my first music album

All work and no play... 

Well, I decided to have a little fun (while still working) and published an album of my music! 
Finally! 

They are all composed and played by me (I play electric guitar; all the rest are via MIDI) 
There are many more tunes in the pipeline; alas, it takes quite a while to finalise a tune. 
Hopefully, more will be out in the next 6 months. 

Check it out on Google Play​, SoundCloud​ ​and BandCamp

Enjoy!


ps: Comments and/or links to this article are most welcome!

Thursday, December 17, 2015

Make Logitech keyboard media keys work with AIMP and Google Play Music

If your Logitech keyboard media keys are not working, it is probably because Logitech's Setpoint software does not support your media player.

I have an MK300 MK520R keyboard and when I press the volume up/down, mute and pause keys, all is well.

However, when I press the prev/next keys, nothing happens.

Here is a solution that works with my keyboard and Setpoint

- Find the file players.ini 
(in my case, it is in:  C:\Program Files\Logitech\SetPointP)

- Open it with an editor and add the 2 lines I've highlighted
(please note that due to line-wrap, things look a little messy.
I have used <CRLF> in places where the line needs to break.
Any line breaks anywhere else are actually just word-wraps)


#List of supported players<CRLF>
#{btn|key|msg|emg|cmd|wac},exeName, wndClass,wndCaption,xxx,play_delayplay,pause,stop,prev,next,remove_flags,ShowOSD,menu_item<CRLF>
#special char --> ^ ctrl;+ shift+ctrl; $ ctrl (no translation); * alt (no translation); @ ctrl+alt (no tanslation); & (no translation) <CRLF>
<CRLF>
[Players]<CRLF>
AIMP3=cmd,AIMP3.exe,Winamp v1.x,xxx,xxx,40045,40046,40047,40044,40048,0,1,WinAmp 5<CRLF>
AIMP2=cmd,AIMP2.exe,Winamp v1.x,xxx,xxx,40045,40046,40047,40044,40048,0,1,WinAmp 5<CRLF>
MusicMatch7=wac,MMJB.EXE,MMJB:MAINWND,xxx,xxx,xxx,xxx,xxx,xxx,xxx,0,1,MusicMatch<CRLF>



[EDIT 3 may 2017]
Modified to suit Google Play Music
In the players.ini file, add the following to the corresponding sections

[Players] GooglePlayMusic=key,chrome.exe,Chrome_WidgetWin_1,xxx,xxx,&0xB3,&0xB3,&0xB2,&0xB1,&0xB0,0,1,Google Play Music 

[Players.Run] GooglePlayMusic=path,%USERPROFILE%\AppData\Local\Google\Chrome\User Data\Default\Web Applications\_crx_icppfcnhkcmnfdhfhphakoifcfokfdhg\Google Play Music.ico 

Players.Display] 
GooglePlayMusic=Google Play Music
You then need to kill the SetPoint process and re-start it, for the changes to take effect.


[EDIT 5 feb 2019]

[Players]

AIMP3=cmd,AIMP3.exe,Winamp v1.x,xxx,xxx,40045,40046,40047,40044,40048,0,1,WinAmp 5 AIMP2=cmd,AIMP2.exe,Winamp v1.x,xxx,xxx,40045,40046,40047,40044,40048,0,1,WinAmp 5 
AIMP4=cmd,AIMP.exe,Winamp v1.x,xxx,xxx,40045,40046,40047,40044,40048,0,1,WinAmp 5 


[Players.Display]
AIMP=AIMP
AIMP2=AIMP2
AIMP3=AIMP3


[Players.Seek]
AIMP=cmd,40060,xxx,1,1
AIMP2=cmd,40060,xxx,1,1
AIMP3=cmd,40060,xxx,1,1

[Players.Rewind]
AIMP=cmd,40061,xxx,1,1
AIMP2=cmd,40061,xxx,1,1
AIMP3=cmd,40061,xxx,1,1


Remember to restart Setpoint after you made your changes to the INI file.

Friday, January 16, 2015

Playing my music from my NAS to a Raspberry Pi player ... and beyond

[work in progress]

Due to audio issues with Win7 and 8, I had to move my music playback off the PC and onto a Raspberry Pi.

Here is a brief description of what I have:
Raspberry Pi 
I use a Model B+ (Model B also works perfectly) with MPD.
MPD is configured to output sound to the HDMI output, as well as stream it over HTTP. That way, I can also listen to my music from any of the connected devices (such as tablets, phones etc)


USB sound card
The Pi has 2 music outputs:
a) 3.5mm analog audio jack. This works ok but the sound is not of high quality.

b) HDMI. Digital output. This is a much better option

c) USB. Digital output. This requires an additional USB sound card that plugs into one of the Pi's USB ports. The quality is very good. (Audiophiles with a golden ear will probably disagree.)

I use option C, with one of these USB 2.0 Virtual 7.1 Channel Audio Sound Card Adapters.


NAS 
All my music is stored on a NAS, so it can be accessed from anywhere by anyone of my players (currently, just the one)

Cantana
This is the software that I use on the PC to play music. The software runs on the PC; the sound comes out of the USB sound card (connected to the Pi) and is fed to my amplifier/speakers.


MPDroid
I use this MPD client on my phone, so I can also choose what to hear, without needing to fire up the PC.
Additionally, if MPDroid detects an incoming or outgoing phone call, it pauses the music and resumes it once the call is finished. Very nice!

If you need more info on how this is all set up, leave me a comment.


ps: Comments and/or links to this article are most welcome!

I can't update Android apps installed on the sd card anymore

Connect your device to your PC (you may need to have the USB drivers that came with your phone installed)I've recently started having a problem with updating my Android apps.

If they were located on the SD card then the update would fail after it was downloaded.

After searching around for quite a bit, the following did the trick:

  • Connect your phone to your PC
  • When the connection is detected by the phone, it may ask you if you wish to switch to USB storage. Say yes.
  • From your PC, go to the phone's drive (that should have just appeared in Explorer) and navigate to /sdcard/.android_secure/
  • Find the file called smdl2tmp1.asec and delete it
  • Disconnect the phone
  • Done!!

[UPDATE 1dec2014]
A number of people have commented that they can no longer find the file smdl2tmp1.asec.
I have been told by others (but have not tested myself, as I don't have the problem) that another option is to connect the phone to a PC and use Windows Explorer to look at the SD card and try to find that file.

I am afraid I don't have any other suggestions :-(




[Blatant plug! See my article about my album on Google Play.]


 ps: Comments and/or links to this article are most welcome!

Tuesday, August 12, 2014

Saffire Pro 26, Firewire, Windows DPC latency

For the last 6 or so months, I've had a big problem with crackles and pops when playing or recording music, due to DPC latency issues.

When I ran DPC Latency checker v1.3, it would show sudden red spikes every time there was heavy network traffic. Sometimes, just refreshing Chrome would do it.

This was not only happening within Reaper, while recording but also when playing back MP3 files via AIMP.

Extensive searches through the web failed to find anything that would work for me. The best I could do, was reboot the PC and the start recording.
Once the PC had been up for a while (especially if it had been put in 'Sleep' mode and then woken up), the crackles would come back.



At the time, I was running Win7-64 and used USB3 for all external devices.

So, in order to overcome this I decided to move the sound generation to external hardware and I bought a Focusrite Saffire Pro 26 for recording my music.

This provides me with A/D conversion from my guitar --> PC, as well as D/A when playing back music from the PC.

In addition to that, I get to use some of the best pre-amps around.

Alas, it would seem that USB3 does not provide sustained  high throughput, so most audio equipment manufacturers (including Focusrite) use Firewire.

Given that I was going to move to Win8 at some point, I wanted to make sure the card I bought worked well with Win8.
(It appears that MicroSchmuck saw it fit to stop supporting Firewire in Win8 and only a few chipsets actually work with it).

I ended up taking a chance and buying a generic Firewire card from CPL in Notting Hill, Victoria.




Against all odds, it worked perfectly well in Win7-64.
A few days later, I moved to Win8.1 and that card still works fine!

Additionally, the DPC latency seems to now hover around 1-3 ms, no matter what I do with the network!
I was copying 220GB over the network without any problem.

I hope this helps others struggling with DPC issues while recording/playing back music.

[UPDATE 16aug2014]
Hmmm, it would seem that VirtualBox can sometimes mess with DPC latency...
It is quite amazing running an i7 CPU and yet still struggle with performance at this level.
Something tells me Billy-Boy's creation is at fault.
If only Reaper and the VSTs I use were available under Linux!

[UPDATE 13oct2014]
So, even though I now run an i7-4790 CPU @3.6GHz, I still (sometimes) get atrocious clicks and buzzes when generating music from the PC itself.


See my article on how I moved my music playing off the PC and onto a Raspberry Pi.




ps: Comments and/or links to this article are most welcome!

Saturday, July 19, 2014

Laravel, Composer, WAMP/PHP 'missing open_ssl' fix

If you are trying to install Laravel and are encountering the 'The openssl extension is missing' error with the Composer installer, here is a fix:

WAMP maintains a different php.ini for the Apache dir and the PHP dir.
The WAMP control panel maintains the PHP.INI in the apache dir 
(for example   C:\wamp2.4\bin\apache\Apache2.4.4\php.ini)

There is also another PHP.INI, using by the command-line PHP, in the PHP directory 
(for example   C:\wamp2.4\bin\php\php5.4.16\php.ini)


Edit the PHP.INI file in the PHP dir and uncomment the following line

extension=php_openssl.dll


Done!


ps: Comments and/or links to this article are most welcome!

Tuesday, October 15, 2013

Compile LESS CSS files and compress/minify CSS and JS files using node.js

Here is what you need to do, in order to

- compile your LESS files into CSS whenever they are changed and also compress those CSS files into .min.css (*1)

- compress your JS files into .min.js whenever they are changed


The 2 scripts described here will automatically perform the above actions upon invocation and will then also set up a file-watcher on the specified directory.



But first:
- Download and install node.js from here.

- Download and install uglifyjs from here, using
npm install uglify-js --global
- Download and install LESS compiler from here, using
npm install less --global

Download this RAR file, which contains all the script files that I have modified, so all you need to do is adjust the contained sample batch file and off you go.


These scripts allow you to specify a source and a target directory.
For LESS/CSS, the LESS file is compiled into CSS in the same directory.
The CSS is then compressed into the target directory.

For JS, the js file is compressed into the target directory.

When you run the batch file, it will scan and process all matching files and then it will stay in the background, monitoring the source directory.


Many thanks to the guys that have created all of the above tools.
The original idea for this was from Jonathan Cheung's code here.



[Blatant plug! See my article about my album on Google Play.]

ps: Comments and/or links to this article are most welcome!

Sunday, September 1, 2013

Freepascal/Lazarus decimal rounding vs Excel rounding


I found this thread quite useful, regarding decimal rounding in freepascal/Lazarus.

This article also describes a unit somebody has written that handles decimal values more accurately (and also more like .net does (much as it hurts me to say this!))


ps: Comments and/or links to this article are most welcome!

Sunday, August 11, 2013

How to achieve shift-click (contiguous) select on a Lazarus TDBGrid


Please follow this link to my post in the Lazarus forum

ps: Comments and/or links to this article are most welcome!

Thursday, July 18, 2013

FortesReports: Misc info

This post will accumulate info on FortesReports, the reporting tool used in Lazarus/FreePascal.

Once enough info has been collected and cleaned up, it will be passed on to the Lazarus group.
------------------------

- Grouping and ORDER BY
Groups in a report do not force a sort by that field.
If you have a SELECT f1, f2 FROM dooda ORDER BY f2
and create a report which groups by f1, you will end with multiple breaks, as f1 changes values while moving through the recordset.
To avoid that, you will need to SELECT f1, f2 FROM dooda ORDER BY f1, f2



ps: Comments and/or links to this article are most welcome!

Saturday, May 25, 2013

FreePascal/Lazarus: How to use lookup combo in DBGrid

I recently worked on a project where I used FreePascal in order to create an app that consisted of a single EXE and which did not need to be installed (portable app).

I had some difficulty in getting a lookup column in the grid and, after lots of searches pointing to convoluted solutions, I came across the following 2 pages, which gave me the info I needed to solve the problem.

Defining a Lookup List Column

Defining a lookup field

In a nutshell, you need to create a lookup field in the TSqlQuery (or whatever query type you use).
You then add a new field in the grid control and link it to the lookup field you created in the query.

Using this method means that you must specify the UPDATE and INSERT SQL (just in case you used to rely on what FreePascal/Delphi generated).


For example, in this case, the CrewMembers table contains a CrewID but not the CrewName.

A lookup field is created in the CrewMembers query, as show below



I want to show the CrewName from the Crew table when I am editing the CrewMembers table.
The CrewMembers table contains only the CrewID, not the name.


LookupDataSet= A Dataset that loads data from the Crew table
LookupKeyField= The name of the key field in the Crew table that I will link to via my CrewID
keyFields=The name of the key field in my table/grid (in this case, CrewID)

This is a just a quick overview. Leave a comment if you'd like more info.

[Blatant plug! See my article about my album on Google Play.]


ps: Comments and/or links to this article are most welcome!

Thursday, March 21, 2013

Extensive comparison of rss/news readers

I recently found this page, containing a large number of rss/news readers and a features table comparison.

Now that Google Reader has been shot in the head, this page may just help you find a replacement.


ps: Comments and/or links to this article are most welcome!

Sunday, January 20, 2013

Win7 window-title double click does not maximise...

Somehow, I found myself double-clicking on the top border of a window in Win7 and...nothing happened.
I had rather hoped that the window would maximise vertically, as it had countless times before.

I blamed it on the extreme heat we've been having here in Melbourne (no, not the one in the US, I mean the real one), so I put up with it for a week or two.


Eventually my nerves couldn't take it any more, so I found this fix:
(This fix should also work in Vista. The best fix though is to ditch Vista, kick yourself for ever installing it on your computer and stay with Win7-64.
Also, there is no need to pay more money to Microsnuff. 
No, you don't need Win8!)

- Open Control Panel.
- Click on 'Ease of Access'
- Click on 'Make the Mouse easier to use'
(be warned, the computer will start talking to you. Don't worry, its just subliminal messages from Steve Balmer trying to make you:
   - Buy Win8
   - Switch from Google to Bing (Bing what???I hear you say)
   - repeat above 2 steps forever)

- Make sure the 'Prevent windows from being automatically arranged...' checkbox is *not* checked
- Done!



ps: Comments and/or links to this article are most welcome!