Thursday, September 3, 2015

Adobe Reader: "Cannot find or create [font-name]"

The  "Cannot find or create [font-name]" problem comes up nearly every time I build a new Windows box then install Adobe Acrobat Reader or Pro.  This time it was on a Windows 10 x64 box.

The fix that worked for me was to delete Adobe's local cached files with:

rmdir "%userprofile%\AppData\Local\Adobe\Acrobat\" /s /q



Saturday, January 31, 2015

CentOS 7 PostgreSQL 9.2 install

Here's what I did to install PostgreSQL on a CentOS 7 box.  As root:

yum -y install postgresql postresql-server postgresql-contrib postgresql-libs

Optionally, install pgAdmin III with:
yum -y install pgadmin3

Configure initial database structure:
postgresql-setup initdb

Configure PostgreSQL to listen on all IPs by editing /var/lib/pgsql/data/postgresql.conf.  Change listen_addresses = '*'

Start the server:
systemctl start postgresql

Check that the service is listening:
netstat -antup | grep 5432

Modify /var/lib/pgsql/data/pg_hba.conf to allow md5

## IPv4 local connections:
host    all             all             127.0.0.1/32            md5 
# IPv6 local connections:
host    all             all             ::1/128                 md5 

As the user postgres reload configuration:
su - postgres
pg_ctl reload

As postgres, create a test database and an administrative user:
createdb test
psql test
CREATE USER root WITH SUPERUSER LOGIN PASSWORD 'password';
\q

As root, configure PostgreSQL to start with the system:
systemctl enable postgresql


.ssh permissions on a *nix box

Mostly to remind myself...set .ssh permissions on a *nix box.  From ~:

chmod 700 .ssh
chmod 644 .ssh/id_rsa.pub
chmod 600 .ssh/id_rsa

End result is:

  • .ssh directory is (drwx------)
  • public key (.pub file) is (-rw-r--r--)
  • private key (id_rsa) is (-rw-------)

That's better.


Friday, January 2, 2015

Build libsdl2-dev deb package for Raspbian on Raspberry Pi

Some projects I want to experiment with require Simple DirectMedia Layer (SDL) version 2 for Raspbian on a Raspberry Pi.  Unfortunately, the debian package for libsdl2-dev is not currently included in Raspian Repository.  Jan Zumwalt described how to build libsdl in his post titled "How To Install & Use SDL2 on Raspbian PI".  I prefer to install software via package managers when possible so I decided to make a .deb for libsdl2-dev.

Install devscripts
sudo apt-get install devscripts

Download libsdl 2.0.  I used SDL2-2.0.3.tar.gz.  Then follow the IntroDebianPackaging guide.

rename the SDL2-2.0.3.tar.gz to SDL2_2.0.3.tar.gz
extract the tar.gz
All the necessary files for building a .deb are already in the debian folder

Run debuild
debuild -uc -us

Install missing build dependencies
sudo apt-get dh-autoreconf libpulse-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libxss-dev libxt-dev libxxf86vm-dev

Run debuild again
debuild -uc -us

Install packages
sudo dpkg -i libsdl2_2.0.3_armhf.deb
sudo dpkg -i libsdl2-dev_2.0.3_armhf.deb


Sunday, December 21, 2014

PowerShell Text-to-Speech (TTS).

Here is a PowerShell one liner for Text-to-Speech (TTS) using Microsoft's desktop oriented Speech API (SAPI).

(New-Object -ComObject Sapi.SpVoice).Speak("Hello There!")

It uses New-Object to create a Component Object Model (COM) instance of SAPI spVoice.

Actually, if you plan to use speech in script it will make more sense to keep the object around for reuse.

$synth = New-Object -ComObject Sapi.SpVoice
$synth.Speak("Hello Again!")

In the Windows jungle there is no escape from King-COM!


Oh...wait..You can also access SAPI via .NET instead of directly using COM.  You can make the SAPI  System.speech assembly accessible by using Add-Type.

Add-Type -AssemblyName System.speech
$synth = New-Object System.Speech.Synthesis.SpeechSynthesizer
$synth.Speak("Hello from dot net")

SAPI is fun to play with but it comes with a limited set of voices and speech recognizers.  If you want to experiment with other voices you'll need to purchase them or switch speech systems.  One option is the Microsoft Speech Platform which supports several additional voices.

Unfortunately, voices and speech recognizers are not compatible between the two Microsoft speech systems. They have slightly different designs reflecting their different use cases.  SAPI is designed for desktop platforms and single users.  The SAPI speech recognizers are tuneable to a specific user and they support recognition of arbitrary words with a diction engine.  A single  running instance of the SAPI speech system can be shared among many applications (i.e. the SAPI provider runs out-of-process).  The Speech Platform is server oriented.  It is in-process (AKA InProc) so each process that requires speech capabilities will have it's own instance of the Speech Platform speech system.  You could run multiple speech capable processes on a single server (e.g. concurrent voice recognition processes on several users voice mailboxes).

I'm assuming that you have already downloaded and installed the Microsoft Speech Platform SDK, runtime, language packs (speech recognizers and text-to-speech voices) you want to use.  Once again, use Add-Type to add the Speech Platform assembly and create Microsoft.Speech objects in a PowerShell environment.  The Speech Platform requires you to set the audio output destination so you can hear what is said.

Add-Type -Path "C:\Program Files\Microsoft SDKs\Speech\v11.0\Assembly\Microsoft.Speech.dll"
$ms_speak = New-Object Microsoft.Speech.Synthesis.SpeechSynthesizer
$ms_speak.setOutputToDefaultAudioDevice()
$ms_speak.Speak("Hello, again, and again!")

After creating the SpeechSynthesizer object You can record the speech to a file with:

$ms_speak.setOutputToWaveFile("hello.wav")
$ms_speak.Speak("Greetings")
$ms_speak.Dispose()

You must Dispose of the object to commit the speech audio data to the named file.

I recommend  reviewing the MSDN documentation for both speech systems. Also, check out the Out-Voice function and this blog post (both by Boe Prox) he describes how you can spelunk the two systems from PowerShell with Get-Member.  Finally, Language Packs provide SAPI text-to-speech voices and speech recognizers for a few non-English languages.
--
P.S. Technically you can use SAPI InProc or shared (out-of-process).
P.P.S. There really is no getting away from COM.  It's still one of the architectural pillars of Microsoft server and desktop products.



Sunday, November 16, 2014

PowerShell one liner to download a file from a URL

PowerShell 3 and 4 include the Invoke-WebRequest (wget) to download a file from a URL.

A PowerShell 4 one liner to download a file from a URL is:

Invoke-WebRequest url -OutFile filename

Replace url with a string that has the full URL for the file and replace filename with a string containing the local file name.  For example, to download get-pip.py I could do the following:

Invoke-WebRequest "https://raw.github.com/pypa/pip/master/contrib/get-pip.py" -OutFile "get-pip.py"

 In PowerShell 2 you can use the following one liner to achieve the same.

(New-Object System.Net.WebClient).DownloadFile(url,filename)

For example, to download get-pip.py I could do the following:

(New-Object System.Net.WebClient).DownloadFile("https://raw.github.com/pypa/pip/master/contrib/get-pip.py","get-pip.py")

Optionally, if you are running Windows 7 you could switch  to PowerShell 4 by installing Windows Management Framework 4.0.


Sunday, August 31, 2014

Install Kinect for Windows SDK v1.8

Here are the steps I completed to install the Kinect for Windows SDK version 1.8 on a Windows 8.1 x64 box with Visual Studio 2010 already installed.  These steps were adapted from the Kinect for Windows SDK 1.8 System Requirements page at MSDN.

1. Uninstall Microsoft Visual C++ 2010 x86 & x64 Redistributable.  KB2728613 provides the following:
MsiExec.exe /passive /X{F0C3E5D1-1ADE-321E-8167-68EF0DE699A5}

MsiExec.exe /passive /X{1D8E6291-B0D5-35EC-8441-6616F567A0F7}
2. Install the DirectX Software Development Kit. At the moment this seems to be the June 2010 version.

3. Update Microsoft Visual C++ 2010 x86 & x64 Redistributable.  I used Windows Update.


5. Install Games for Windows Marketplace Client.  See Stack Overflow "How to install the XNA Game Studio 4.0 in Windows 8?" for the reason why. Install Microsoft XNA Game Studio 4.0.  (It might be worth checking one of the versions at XNA Game Studio project on Codeplex.

6. Finally, Install KinectSDK v1.8 and Kinect for Windows Developer Toolkit v1.8.

Saturday, August 30, 2014

Silent Uninstall of All Java on a Windows Box



Finally figured out a command line method to do a silent uninstall of all Java on a Windows box.  Open a command window as Administrator, then run the following wmic:

wmic product where "name like 'Java %% %%'" call uninstall /nointeractive
That is so much easier than manually uninstalling.

Tuesday, July 1, 2014

Fix Windows 8.1 mouse pointer stutter in Ace of Spades

I started having mouse problems after upgrading to Windows 8.1 when playing Ace of Spades.  I was almost convinced that it was a hardware problem.

Turns out that Microsoft changed the mouse polling for 8.1.  Microsoft has a patch for this at KB2908279.  I downloaded and ran the "Microsoft Fix it" on Ace of Spaces.  After running, I had to reboot.  After rebooting I ran the game with no change...still lots of mouse stutter.

The KB2908279 fix it recommended checking KB2907018 and KB2907016. KB2907016 is the "Disable display scaling on high DPI settings" and it did the trick for my hardware/software setup.

Thursday, February 13, 2014

Windows Search iFilter for PDF files.

I'm working on some papers for an online class and found out that Windows search doesn't have a built in iFilter for PDF files.  Since I'm using a 64-bit Windows 7 box I downloaded the Adobe PDF iFilter 64 11.0.01; installed; and Windows is now indexing.

Saturday, January 4, 2014

Empire Earth 2 window mode

I picked up Empire Earth 2 from gog.com but was having some issues with multiple-monitors.  After a bit of googling I came across a solution from someone going by galatei at neoseeker.  Add the following lines to the config.cfg (or config_EE2X.cfg for EE2:TAS):

g_bFullscreen = 0 
g_allowWindowedMode = 1 
g_ConstrainCursor = 0 
s_windowXOffset = 10 
s_windowYOffset = 10 
s_adapterIndex = 0

Worked for me in single player mode.





Monday, December 30, 2013

Hack is the new Magic

It's pretty likely that you will be a subject of scorn and ridicule if you explain things you don't understand as "magical", "mystical", or acts of God. So in the technology realm it seems that popular media uses "hack" in place of "magic". I've started using the following word replacements when reading online "news':

  • hack = magic
  • nerd = witch
  • geek = wizard
  • cyber = medieval
  • code = incantation
  • jailbreak = dark magic
  • DRM = white magic
  • enhance = magnify
It really makes reading the online "news" more magical!


Wednesday, October 9, 2013

Quick PuTTY registry backup from the command line

Here is some strung together windows commands to backup PuTTY registry keys:

@echo off
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b) For /f "tokens=1-2 delims=/:" %%a in ("%TIME%") do (set mytime=%%a%%b)

echo Backing up PuTTY registry to .\PuTTY-sessions-%mydate%_%mytime%.reg regedit /e .\PuTTY-sessions-%mydate%_%mytime%.reg HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions

Hope that works for you.

Wednesday, May 16, 2012

Manually add libdvdcss.dll to Handbrake on 64-bit Windows 7

I was looking for a process that would allow someone to manually add  libdvdcss.dll to a 32-bit Handbrake version 0.9.6 install on 64-bit Windows 7.  After a bit of web searching the process that seems to work for many is:
1. Download GStreamer WinBuilds v0.10.6 GPL (x86) (GStreamer-WinBuilds-GPL-x86.msi ) from OSSBuild Downloads.
2. Install GStreamer.
3. Navigate to C:\Program Files (x86)\OSSBuild\GStreamer\v0.10.6\bin
4. Copy libdvdcss-2.dll to C:\Program Files (x86)\Handbrake
5. Rename libdvdcss-2.dll to libdvdcss.dll

---------------
Check Handbrake Windows 7 64-Bit DVD Ripping for a 64-bit oriented guide.

Saturday, May 12, 2012

Digital Curation / Digital Asset Management TTPs for digital forensics artifacts

Started looking into Digital Curation / Digital Asset Management techniques, tactics and procedures.  I’m mostly interested in curating and preserving digital forensics artifacts -- hard drive images, memory images, network trace captures, event log files, etc.—to support team oriented forensics analysis and annotation of large scale digital corpora.  I prefer to use open source technologies. Fortunately for me, professional digital archivists are already working the issues!

The Council on Library and Information Resources provides an overview of the challenges in their December 2010 report  titled “Digital Forensics and Born-Digital Content in Cultural Heritage Collections”.  A bit on the lighter side…the “Preserving Virtual Worlds Final Report” from IDEALS investigates preservation of video games and interactive fiction.

Sunday, May 6, 2012

Netzob–Reversing protocols

Just saw Netzob on free(code) today.  It looks like it combines protocol format recovery (vocabulary) and control flow recovery as automaton.  They use grammar inference (specifically Angluin L*)  to generate a modified Mealy machine.  Very cool!  I previously did some work inferring protocol control flow as FSM  using a few GI algorithms.  I’m off to the netzob code repository to have a look…

Storage Virtualization for home use

I have several odd size SATA drives that I might be able to put back to work…so I’m looking for a storage virtualization system.  At the moment it looks like Windows 8 Storage Spaces or the Linux based Greyhole might be the best fit for my home use scenario.  Greyhole is the storage pooling system used in Amahi.

IQEmu–Launch Windows apps in a VirtualBox sandbox on Linux host.

IQEmu launches  Windows applications in a virtualized sandbox on Linux hosts.  Currently works best with VirtualBox for the virtualization backend.  Source is available via github.

Alternatives to Objective-C that target iOS

While some have fun with Objective-C and despite neat features like automatic reference counting I have no deep love for the language.   So I started looking for some alternatives to target iOS devices.  So far my list is very short:
  • RubyMotion – based on MacRuby is a Ruby implementation built in Objective-C.  The backend is a LLVM derived compiler that emits iOS native code.
  • MonoTouch – from Xamarin, the developers of Mono, it’s a version of C# that targets iOS.  They also have developed Mono for Android so there is the possibility of sharing some code between platforms.
  • RoboVM - translates Java bytecode into native ARM or x86.  One advantage RoboVM has over RubyMotion and MonoTouch is that source is available at GitHub robovm/robovm.
WikiPedia has a longer list of platform development environments in a  Mobile application development article.  Also, Simone D’Amico summarizes several cross-platform mobile development SDKs.  Finally, there are some mutterings around about developing with other languages, besides MacRuby,  then emitting iOS binaries via the LLVM middle-end optimizers and LLVM back-end code generators.