Monday, January 6, 2014

Computer Scientists are pretty much worthless when it comes to conserving anything.

Bits are equal to power. Let's say that I want a simple tool to get a file, in this case "wget". One would think that it would be simple to compile it, or get it; however, here's the build dependency list:
gnutls libtasn1 nettle p11-kit desktop-file-utils glib2 libffi perl5 perl5.12 gdbm popt libxslt libxml2 xz libgcrypt libgpg-error pcre
Perl? I don't want Perl. I can see how libgcrypt and a few others are in there. I get to eat up flash write cycles, power, time just because someone decided to include perl.

Program packages should be as small as possible. This is important in an energy constrained environment or just as a function of time.

Tuesday, December 24, 2013

removing the password from PDF files.

PDF files with passwords really do not make much sense. You can remove the PDF password easily, and for free. You just need ghostscript installed.
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=PDFnopass.pdf -c .setpdfwrite -f PDFwithPASSWORD.pdf

Sunday, October 27, 2013

Cross platform Makefile

I needed to change my Makefile to output different target information based on the Operating System. This turned out more difficult than I thought since Windows doesn't have uname. I asked some friends, and the gave me some code snippets. To start with find the OSCLASS and OSNAME.
ifeq ($(OS),Windows_NT)
    OSCLASS = windows
    OSNAME=windows
else
    OSCLASS = unix
    UNAME_S := $(shell uname -s)
    ifeq ($(UNAME_S),Linux)
     OSNAME = linux
    endif
    ifeq ($(UNAME_S),Darwin)
        OSNAME = osx
    endif
endif
You can then do switches based upon the compiling OS. The biggest one was that I needed to output to a file. The problem with files that would write to both windows and unix is that the shell commands are different, so I need to address the differences in commands.
ifeq ($(OSCLASS),unix)
    FIXDIR = $1
    COMMANDCAT = cat
else
    FIXDIR = $(subst /,\,$1)
    COMMANDCAT = type
endif
Windows uses "type", whereas unix uses "cat". I then also fix the \ issue to go from the the unix / to the windows \ with the FIXDIR command. When I type "make test", the following will output the contents of info/chunk2.txt and append it to installer/test.inf.
test:
  $(COMMANDCAT) $(call FIXDIR,info/chunk2.txt >> installer/test.inf)
In unix, you will get: cat info/chunk2.txt >> installer/test.inf
In Windows, you get: type info\chunk2.txt >> installer\test.inf

Tuesday, October 15, 2013

Referencing datasheets in BIBTEX.

The CD4007 inverter pair is referenced as far back as papers from the early 1970's.  It's a great IC for teaching, but I really had to think of how to reference it using bibtex. I decided to go with the MISC tag.

@misc{CD4007,
    author={Texas Instruments},
    title={CD4007UB},
    url={http://www.ti.com/lit/ds/symlink/cd4007ub.pdf},
    note={original document from Harris Semiconductor},
    publisher={Texas Instruments},
    year={2012}
}

UPDATE:
Of course, once I decide on a method, I come up with a better method. Include:
\usepackage{url}
in your TEX document, and then you can have a prettier entry.
@misc{CD4007,
  author={Texas Instruments},
  title={CD4007UB},
  howpublished = "\url{http://www.ti.com/lit/ds/symlink/cd4007ub.pdf}",
  note={original document from Harris Semiconductor},
  publisher={Texas Instruments},
  year={2012}
}

Saturday, September 21, 2013

I lost my router...

I lost my router in the digital ether, so I pinged until I found my router. I used nmap to ping all addresses on my subnet.
nmap -v -sP 192.168.1.*

Sunday, July 21, 2013