.. on Linux

Posts by dan

Further libssh2 wrapper updates

Posted by on Nov 13, 2012 in Apple, Linux, Xcode | 0 comments

I’ve written a small shell script that takes the archive downloaded from http://www.libssh2.org, extracts it, compiles it, extracts the headers and archive library and then tidies up after itself. The results just need adding to Xcode and you have a working libssh2 implementation.

Updated source code:

https://github.com/thebsdbox/DFSSHWrapper

Read More

Update to the sshwrapper

Posted by on Sep 13, 2012 in Apple, Computers, Linux | 0 comments

Had quite a few emails recently about using the ssh wrapping class I wrote aaaages ago. I’ve traded a couple of emails back and forth.. and decided that it would be easier for everyone if I just updated these old classes.

So the changes:

  • Added DFSSHConnectionType, this class is used to define how ssh will attempt to connect (password/key/keyboard)
  • Moved everything to a namespace (DF)
  • ARC
  • Tidied up the code, and sorted an issue with CStrings making a mess when converting to an NSString
  • Other things I did ages ago.. (no idea)

It’s uploaded to github.. let me know if there is any problems..

https://github.com/thebsdbox/DFSSHWrapper

 

[UPDATE]: Added the ability to place a timeout on a command sent over ssh…

Read More

Objective-C graphing and plotting with little-plot

Posted by on Apr 24, 2012 in Apple, Computers, Xcode | 2 comments

As development has continued on a personal project it became obvious that I would need to implement UI elements that simply weren’t part of the Cocoa UI-kit. Essentially the main goal is presenting the user with a graph interface allowing them to quickly see a data set without having to read through line after line of figures. I looked at Core Plot (http://code.google.com/p/core-plot/), which whilst providing some great functionality looks like a HUGE amount of overkill when wanting a simple UI element.

So after a few days of tinkering I’ve created a couple of NSView subclasses allowing either manually created Views that can be presented arrays and will display the data accordingly.
I present Little-plot :

The above screenshot consists of three NSViews (LineView, PieView and LabelView), which each display a line graph, a pie chart and graph labels (or legends).

The project is available on GitHub here.

Updates will appear soon, along with some real documentation.

Read More

Face Detection in OSX

Posted by on Apr 4, 2012 in Computers, Xcode | 2 comments

After reading this (http://maniacdev.com/2011/11/tutorial-easy-face-detection-with-core-image-in-ios-5/) tutorial for iOS 5 face detection I decided to try it for plain olde osX, I do find it somewhat annoying that the objective-C community is only focused on development using the iOS SDKs. The main changes involved turning the UI classes into NS classes and find ways around missing methods. I’ve uploaded my Source Code, which you can download and play with.

 

Read More

LVM2 device names and device paths

Posted by on Jan 10, 2012 in Computers, Linux | 0 comments

If you use LVM (Linux volume manager) you’ll be no doubt aware that the ability to place your volumes in groups and name the volumes accordingly makes administration much easier. Having a volume group called oracle and then a binaries and data volume means a tiny glance at a system identifies what is doing what (or so I was under the impression). When it comes to doing any sort of low level administration or system metrics, you may notice that device paths change. Using fdisk or looking at /proc metrics and you’ll suddenly come across dm-0 etc..  devices, which clearly are the lvm devices under another name. Scanning quickly through a ton of web pages and the lvm2 documentation turned up nothing.

Then I realised that the first two columns in /proc/diskstats where the major/minor device numbers, which when compared with the entries in /dev/mapper allowed me to match up the devices. This can also be achieved by looking at the major/minor numbers from lvdisplay and dmsetup ls. However the latter two tools require root privileges so clearly were not going to work with my current project.

Turned out that the simplest method is to look through the sysfs file hierarchy as the block devices can identify other names that they have. The following command will iterate all of the block devices with alternative names and print them in a format that can be piped into anything else, or in my case be read easily into an NSArray.

grep -H "." /sys/devices/virtual/block/*/dm/name \
| sed 's/\/sys\/devices\/virtual\/block\///g' \
| sed 's/\/dm\/name:/ /g'

		Read More