Friday, September 21, 2012

The first thing I do. (part 2 - Windows)

Every time I setup a new windows VM or system I do the following:

1:  Go grab Microsoft Security Essentials.  It just works and I like that.

2:  Head over to Ninite.com ( http://ninite.com/ ) and add the following:
  • Putty -- to get real work done
  • CutePDF or FoxIt reader -- to look at pdf's
  • Notepad++ -- handy notepad replacement.
  • WinMerge -- great for comparing source files
  • FileZilla -- in case I'm too lazy for the command line
  • 7-zip -- to uncompress stuff
  • WinRar -- ditto
  • WinDirStat -- shows where all the disk space went
  • Launchy --  can't live without keyboard shortcuts.
3:  Install cygwin from (http://www.cygwin.com/ ) to get some real power in the windows environment.

NOTE:  to get telnet you need to include inetutils.

4:  Grab Firefox from firefox.com.


That gets me to where the new box is somewhat useful.
     

Thursday, September 20, 2012

VIM hints

I need a page for keeping vim hints.  This is that page.

The stuff I use every day,  j/k  h/l  etc are easy to remember but the following stuff I just don't do often enough to have it bound to my fingertips.

Indent a block:

tag and use the > key.

:.,''a >

note: works in both directions.  (as in < )

You can indent x lines by doing x<< or x>>

Joining lines:

It's easy to join a line with the shift-J key, however that inserts a space (after trimming any additional spaces in the joined line.

Using the command:   gJ will join and not insert spaces.  ( g  then J ).



The first thing I do. (part 1 - unix)

When I get on a new machine where I will have to spend some time I do the following tasks to make the environment somewhat sane

Unix/Linux/Solaris/etc

1: set the default shell to bash.

2:  create/update the .bash_profile with:
      a:  PS1 =  <machine name>   --  this is so I can have a bunch of putty
      b:  alias vi to vim

3:  install vim if it's not already installed (this takes care of 2-b above)

4:  install 'screen' if it's not installed.

5:  start screen and created a bunch of windows to do the actual work from.

Screen is really nice in that a disconnection from system will not cause all of my work to be lost.

If I'm trying to build a minimal Linux distro I also grab BleachBit which helps get rid of a lot of the gunk left around on a build.

link:  http://bleachbit-project.appspot.com/



Basic is back!

Out of college the first work language I coded in as Wang Basic on one of these.  Back in the days when memory was talked about in bytes and storage was in 'k'.  (compared to today where we talk about memory in meg and gig and storage in gig and tera).

From Wang Basic I moved on to doing some work on an Atari 400 using Atari Basic and later assembly.

So I was curious when a company called Byte Works release an app called techBasic for iOS devices.

Let me say up front that entering code using an iPhone is lesson in patience but for goofing around with the iPhone techBasic is pretty interesting.

I've purchased it and am using the bluetooth 4 (BLE) hooks to try to talk to some bluetooth devices.  The amount of code (compared to trying this in ObjC) is pretty small and I can debug on the fly.

This simple program:

! initialize the bluetooth handler
BLE.startBLE

! we need to start a scan, this needs a string to pass around
dim uuid(0) as string
BLE.startScan(uuid)

!
! the BLE layer uses a callback/event mechanism for handling
! bluetooth activity.   This function will get called each time 
! a bluetooth device is seen.
!
sub BLEDiscoveredPeripheral( time as Double,
        peripheral as BLEPeripheral,
        services() as string,
        adverts(,) as string,
        rssi as single )
   print "Found a bluetooth device, name: ", peripheral.bleName,
      "  rssi value = ", rssi
   BLE.stopScan
end sub

Now if you have a ble device in discovery or advertising mode you should get a nice printout of the device name and rssi or signal strength.

more as I drill down.

 

Thursday, September 6, 2012

AirDrop over Ethernet

I don't really use wireless on my mac mini or iMac and so I was bummed when I found out that AirDrop doesn't work over ethernet.  

Luckily I stumbled upon an article on Lifehacker

here:  http://lifehacker.com/5939804/enable-airdrop-over-ethernet-even-on-unsupported-macs-and-hackintoshes

To the point,  run the following in a Terminal session:

 defaults write com.apple.NetworkBrowser BrowseAllInterfaces 1 

Then restart Finder with 'killAll Finder'
 
Note that I needed to enable AirDrop in the sidebar under Finder preferences.

Wednesday, September 5, 2012

OS X: My screen isn't going to sleep.

Strange problem,  for some reason my iMac (running Lion) display was not going to sleep after the preset time.   I tried playing around with both the screen saver and power settings and I couldn't get it to go into sleep.

a hint from here: http://apple.stackexchange.com/questions/16306/why-is-the-screen-saver-not-kicking-in solved the issue.

Summary:

from the terminal run 'pmset -g',  the output looks like:

$ pmset -g
Active Profiles:
AC Power        -1*
Currently in use:
 autorestart    0
 powerbutton    1
 halfdim    1
 panicrestart    157680000
 hibernatefile    /var/vm/sleepimage
 networkoversleep    0
 disksleep    10
 sleep        0
 hibernatemode    0
 ttyskeepawake    1
 displaysleep    15 (imposed by 2319)
 womp        0




The process '2319' on the displaysleep line is the problem.



A quick 'ps' and we can find out what the process is:


$ ps -fea | grep 2319
    root  2319     1  0   Sep 02 ?        0:04 /System/Library/CoreServices/RemoteManagement/screensharingd.bundle/Contents/Ma


hmm,  no idea what the process is but what the heck,  kill it with:

$ sudo kill -9 2319

And the problem is solved.

What I think happened is that I had an aborted remote desktop from my macbook and it left this process 'stuck'.   There was very little cpu usage and everything is working find now.