zzapper’s Technical Tips

July 16th, 2008 No comments

Vim Tips and Tricks Famous Vim Tips
Vim Tips Blog Vim Tips in Detail
zsh tips An Alternative to bash
ZSH Daily Twitter Tip AZSH on Twitter
Cygwin tips Linux on your Windows PC
Best Productivity Programs Open Source
Categories: Uncategorized Tags:

How to Play the MP3 Files in Order on Your USB Car Radio

October 13th, 2013 No comments

It’s nothing to do with alphabetical order and little to do with copying them to the USB in sequence, sub-directories don’t help so what’s the secret?

Your car radio reads files from the USB in the physical order it finds them on the disk. This order gets more and more disorganised as you add & delete mp3 files. So here’s what you have to do:-

Copy any MP3 files you want to keep to your PC. Then REFORMAT your USB Stick, it’s best to do full reformatting rather than quick. Now copy your MP3 files back to the USB Stick in the correct order. It may be possible to do this with Windows Explorer but I don’t take the risk I write a little batch file to copy them one by one.

In future avoid deleting individual files on your USB stick delete the lot each time.

(It nearly drove me crazy before I found the solution)

Categories: Uncategorized Tags:

Brilliant locate & updatedb (linux/cygwin)

September 1st, 2013 No comments
The great thing about using Linux is discovering some utility that you didn’t know about and then wondering how you ever lived without it!

My latest find is locate which is a file finder it is super fast because it uses a database. You need to update this database every now and again with updatedb (on cygwin make sure you run as administrator).

The only hiccup is that you can’t specify exact filename match. I’ve adapted a small script to achieve this.

examples of locate
> locate php.ini
/etc/php.ini

and here’s a useful trick

> cp -p $(locate bridge) /tmp/

or
> cp -p $(locate “*suki*.jpg”) /tmp

note I have to quote wildcards and match the whole string

I also find this handy ( as php.ini is often in different locations on various boxes)

> vi $(locate php.ini)

Categories: Uncategorized Tags:

Windows 8 Nightmare : Worse Than You Think

May 10th, 2013 No comments

Hi
I’ve unfortunately been using W8 for months now this is my experience so far. (I am using it mouse & keyboard and not using touch-screen) I only bought it because it was much cheaper than Windows 7 and hadn’t done my research. It starts with the Metro GUI which is a horrid Smart Phone like interface, cool for teens they can single-click, Facebook, YouTube , Twitter and so on but the serious user asks where is the Start Button, where is the Control Panel, how do I add a Printer , how do I set a program to Start Up automatically (haven’t worked this out yet)? I am gradually learning how to convert the GUI back to Windows 7 but it is frustrating.

Sometimes you click an App and it goes Whole Screen and you don’t know how to get out, sometimes you open an App and see an Advert! Another dumb feature is that if you click an email link to FaceBook it goes to your Browser and not the FaceBook App. Yuk Yuk Yuk.

To add items to Start Up in Windows 8

Type shell:Startup into Windows Explorer (Brilliant)

Windows Vista Horror, Windows 7 Great, Windows 8 Disaster Windows 9 Super or Microsoft bust??

Tonight I had to Google “How to print a PDF file in Windows 8″ the solution? Control-P!

I don’t need another steep learning curve, imagine if you bought a new car and found you had to re-learn to drive! Hating Windows-8

Was feeling suicidal had enough trouble restoring my data from previous crashed computer without having to fight Windows 8. Downgrading to Windows 7 is expensive if you don’t have Windows 8 Pro so I decided heck I would just buy a new PC with Windows 7 and sell my new Windows 8 PC on eBay, my time is worth money so any money lost would be worth it. But then I installed Classic Shell

Classic Shell™ is a collection of usability enhancements for Windows. The main features are:
Highly customizable start menu with multiple styles and skins
Start button for Windows 7 and Windows 8
Toolbar and status bar for Windows Explorer
Caption and status bar for Internet Explorer

This restores the functionality I expect and is good enough so I will say for the while with Windows 8 though if I could press a button I would revert to Windows 7.

Categories: Uncategorized, windows Tips Tags:

Autohotkey Scripts for Automating Images with Irfanview

April 2nd, 2013 No comments
1
2
3
4
5
6
7
8
9
10
11
12
13
14
; set the save directory first to where you want to save
; turns the photo 90 degree Right and then saves it
^!b:: ; Control-Alt-B
irfanviewright:
 Send, r  ; right (MUST be LOWERCASE)
 Sleep, 1000
 Send, s ; Save
 Sleep, 1000
 Send , !S ; Alt_s Save button
 Sleep, 1000
 send , !Y ; Alt_y Confirm
 Sleep, 1000
 ;send , {space} ; next photo
return
Categories: Uncategorized Tags:

~+ Another Magical ZSH Tip

November 17th, 2012 No comments

I’ve been using zsh’s ability to cd to any of your recent directories for a long while

e.g.

> cd -<tab> which gives you a pick list of recent directories

I’ve just learnt however about the ~+ operator which allows

vi ~+<tab>
1 — /c/aaz
2 — /c/aaa
3 — /c/aax
4 — /usr/bin

I type 1-4 to pick the desired directory and then can continue completion.

remember you need the options in your .zshrc

setopt autopushd pushdignoredups # used by cd-
autoload compinit
compinit

also to remember to visit a few directories beforehand

Categories: zsh Tags:

Cygwin, zsh & rebaseall

November 7th, 2012 No comments

If you happen knowingly or unknowingly upgrade your zsh you may run into the dreaded “cannot create fork” “dll overlapping” problem not even ls will work. It happens rarely enough that when it occurs I panic thinking that my entire Cygwin environment is corrupt, but phew it just needs a rebaseall.

Now rebaseall must be run with Cygwin shutdown and here’s the kicker and Cygwin services such as sshd must be stopped in Windows services. The easiest way I know then to run the rebaseall command is directly from Windows Run box or from a Dos prompt

\cygwin\bin\dash -c ‘/usr/bin/rebaseall’

 

and hey presto your Cygwin will be fine.

Categories: Cygwin, zsh Tags:

Linux Job Control: Foreground, Background, Disown, Nohup and Wait

October 30th, 2012 No comments

Started a job but wish you’d put into background?
Control-Z (stop the job)
> bg (run stopped job in background)
> disown %1 (ensure job doesn’t die if console accidentally closed
but next time use nohup (no hangups)
> nohup php reallylongjob.php &
want to start a second job when this finishes?
> wait %1 && php finish.php

Categories: linux Tags:

Bash: Selectively Tar-ing files from a web root (back up your website)

June 15th, 2012 No comments

nice -n 19 find . -type f \( -iname “*.php” -o -iname “*.js” -o -iname “*.inc” \) -print0 | xargs -0 tar rvf dev$(date ‘+%d-%m-%Y’).tar

I had terrible trouble getting this to work the tar wasn’t capturing all the files I eventually found out that I required the print0 and the xargs -0. This would have been trivial with zsh but I didn’t have it this server.

Why the selective backup? because there are huge images and PDFs etc which would have slowed down the backup enormously.

Categories: shell tips Tags:

Solution: How to install Service Pack 1 on Windows 7

January 19th, 2012 No comments

Your Service Pack fails to install error given 80246007 or may be 80070003.

See here for official Microsoft solution (but see my additional information in red) :-

To change or restart the Background Intelligent Transfer Service (BITS)

You must be logged on as an administrator to perform these steps.

Open Administrative Tools by clicking the Start button , clicking Control Panel, clicking System and Maintenance, and then clicking Administrative Tools.

RIGHT MOUSE CLICK  Services and SELECT RUN AS ADMINISTRATOR.

If you are prompted for an administrator password or confirmation, type the password or provide confirmation.

Right-click the Background Intelligent Transfer Service (BITS) service, and then click Properties.

On the General tab, next to Startup type, make sure that Automatic (Delayed Start) is selected. If it is not, select it and then click Apply.

Next to Service status, check to see if the service is started. If it is not, click Start.

 

Service Pack 1 will now install.

Categories: windows Tips Tags:

WordPress have your menus dropped to the bottom?

November 5th, 2011 No comments

This has happened to me several times and I’ve always blamed a WordPress update or Theme update so I’ve de-installed and re-installed etc etc, but in the end it has always been the same simple mistake namely An Unclosed DIV Tag in a Post! This usually or always causes chaos to your page structure. So next time this happens to you whether on your WordPress Blog or in the CSS of your Website always think to check for unmatched DIV Pairs <DIV>…</DIV>

Categories: css, wordpress Tags: