The best place to *find* answers to programming/development questions, imo, however it's the *worst* place to *ask* questions (if your first question/comment doesn't get any up-rating/response, then u can't ask anymore questions--ridiculously unrealistic), but again, a great reference for *finding* answers.

My Music (Nickleus)

20110530

how to import/overwrite mysql database to a remote server using the command line

i installed tikiwiki on a domain i have hosted on domeneshop.no and they recommended not to use phpmyadmin, but mysql workbench instead. i wanted to import an old tikiwiki i had started 2 years ago. i used like an hour trying to setup mysql-workbench and kept getting the error:
ERROR 1046 (3D000) at line 22: No database selected
when all i really needed to do was open a terminal and run this:
mysql --host=myhost.example.com --user=myUser5 -p --default-character-set=utf8 myDbSchemaName < "/home/nick/sqlFileToImport.sql"

20110523

how to install printer and scanner drivers on ubuntu 64-bit for brother DCP-9270CDN

(updated for ubuntu linux 12.04)


INSTALL PRINTER DRIVERS

download drivers from Brother website (drivers are i386 even for amd64/64-bit):
LPR driver     deb     1.1.1-5     756 KB     2011.Jan.28
cupswrapper driver     deb     1.1.1-5     12 KB     2011.Jan.28

navigate to the location where you downloaded the deb files, e.g. ~/Downloads:
cd
cd Downloads
sudo dpkg -i --force-all dcp9270cdnlpr-1.1.1-5.i386.deb
returns:
Selecting previously unselected package dcp9270cdnlpr:i386.
(Reading database ... 178504 files and directories currently installed.)
Unpacking dcp9270cdnlpr:i386 (from dcp9270cdnlpr-1.1.1-5.i386.deb) ...
Setting up dcp9270cdnlpr:i386 (1.1.1-5) ...
mkdir: cannot create directory `/var/spool/lpd/dcp9270cdn': No such file or directory
chown: cannot access `/var/spool/lpd/dcp9270cdn': No such file or directory
chgrp: cannot access `/var/spool/lpd/dcp9270cdn': No such file or directory
chmod: cannot access `/var/spool/lpd/dcp9270cdn': No such file or directory


(you can disregard the warnings)

sudo dpkg -i --force-all dcp9270cdncupswrapper-1.1.1-5.i386.deb
returns:
Selecting previously unselected package dcp9270cdncupswrapper:i386.
(Reading database ... 178536 files and directories currently installed.)
Unpacking dcp9270cdncupswrapper:i386 (from dcp9270cdncupswrapper-1.1.1-5.i386.deb) ...
Setting up dcp9270cdncupswrapper:i386 (1.1.1-5) ...
cups stop/waiting
cups start/running, process 28182


dpkg -l|grep Brother

returns:
ii  dcp9270cdncupswrapper:i386 1.1.1-5 Brother CUPS Laser Printer Definitions
ii  dcp9270cdnlpr:i386 1.1.1-5 Brother lpr Laser Printer Definitions
ii  printer-driver-ptouch 1.3-3ubuntu0.1 printer driver Brother P-touch label printers




CONFIGURE THE PRINTER

go here: http://localhost:631/printers
click the link: DCP9270CDN
dropdown box: Administration > Printers > Manage Printers
click DCP9270CDN > in the second dropdown list to the right at the top ("Administration" is selected by default), choose Modify Printer

a popup box will ask you for your username and password--this is your normal ubuntu username and password

##OLD##
choose radio button: LPD/LPR Host or Printerclick continue
set lpd to: lpd://XXX.XXX.XXX.XXX/binary_p1
(replace the XXX's with the ip address for your network printer)
####

to find the printer's IP address and active services and enabled protocols, go to the printer and select the following:
menu > print report > network configuration

now, back in your browser ( http://localhost:631/printers ) choose the radio button for Other Network Printers > AppSocket/HP JetDirect.
(
why AppSocket?
"The AppSocket protocol ... is the simplest, fastest, and generally the most reliable network protocol used for printers."
http://localhost:631/help/network.html#SOCKET
)



click continue
connection:
socket://192.168.1.242
click continue
click continue

upload the PPD file. to find where it is, run this in a terminal: 
locate ppd|grep Brother








i got the following output:
/usr/local/Brother/Printer/dcp9270cdn/cupswrapper/dcp9270cdn.ppd

click Browse to select the PPD file
click Modify Printer



INSTALL SCANNER DRIVERS (OPTIONAL)
Scanner Driver download page
find the section for DCP-9270CDN (search for it on the page) and download the following:

brscan4 64bit     deb     0.4.1-1     72 KB     2012.Jun.05
scan-key-tool 64bit     deb     0.2.3-0     51 KB     2012.Mar.22


(install drivers for scanning from Brother website)

navigate to the location where you downloaded the deb files, e.g. ~/Downloads:
cd
cd Downloads
sudo apt-get install sane-utils
sudo dpkg -i --force-all brscan4-0.4.1-1.amd64.deb

returns:
Selecting previously unselected package brscan4.
(Reading database ... 178540 files and directories currently installed.)
Unpacking brscan4 (from brscan4-0.4.1-1.amd64.deb) ...
Setting up brscan4 (0.4.1-1) ...
This software is based in part on the work of the Independent JPEG Group.


dpkg -l|grep Brother

returns:
ii  brscan4 0.4.1-1 Brother Scanner Driver
ii  dcp9270cdncupswrapper:i386 1.1.1-5 Brother CUPS Laser Printer Definitions
ii  dcp9270cdnlpr:i386 1.1.1-5 Brother lpr Laser Printer Definitions
ii  printer-driver-ptouch 1.3-3ubuntu0.1 printer driver Brother P-touch label printers


brsaneconfig4 -a name=SCANNER model=DCP-9270CDN ip=XXX.XXX.XXX.XXX
(the ip flag is apart of the brsaneconfig4 line. replace XXX... with your printer's IP address)

brsaneconfig4 -q|grep SCANNER
returns:
0 SCANNER             "DCP-9270CDN"       I:XXX.XXX.XXX.XXX

sudo dpkg -i --force-all brscan-skey-0.2.3-0.amd64.deb
returns:
Selecting previously unselected package brscan-skey.
(Reading database ... 178568 files and directories currently installed.)
Unpacking brscan-skey (from brscan-skey-0.2.3-0.amd64.deb) ...
Setting up brscan-skey (0.2.3-0) ...


dpkg -l|grep Brother

returns:
ii  brscan-skey 0.2.3-0 Brother Linux scanner S-KEY tool
ii  brscan4 0.4.1-1 Brother Scanner Driver
ii  dcp9270cdncupswrapper:i386 1.1.1-5 Brother CUPS Laser Printer Definitions
ii  dcp9270cdnlpr:i386 1.1.1-5 Brother lpr Laser Printer Definitions
ii  printer-driver-ptouch 1.3-3ubuntu0.1 printer driver Brother P-touch label printers


start the scanner tool:
brscan-skey

check to see if the scanner is "Active":
brscan-skey -l
returns:
SCANNER           : brother4:net1;dev0  : XXX.XXX.XXX.XXX        Active

to scan, put the document on the scanner, press Scan button on the scanner > Scan to PC > Image > choose your user (e.g. "nick"), press "Start".

gimp will open automatically on your computer with the scanned image open as an image. i found that i had to close gimp completely after each successive scan otherwise i would get an error.

20110505

ocr - tesseract vs oscroscript (ocropus) - how to convert image to text

both tesseract and ocropus are developed by google, but for some reason ocropus misses the first line of the paragraph. see for yourself:

tesseract output:
The book is the synthesis of, on one hand, the no-nonsense
mathematical trader (sdf-styled “practmcnct of uncettaintfl who
spent his life trying to resist being fooled by randomness and mult the
emotions associated with uncertainty and, on the other, the aesthetically
obsessed, litcr:itun:·l0ving human being willing to be fooled by any form
of noruense that is polished, refined, original, and tasteful. I um not
capable of avoiding being the fool of randomness; what l can do is
confine it to where it brings some aesthetic gratification.
ocropus output:
mathematical trader (sdf-styled “practmcnct of uncettaintfl who spent his life trying to resist being fooled by randomness and mult the emotions associated with uncertainty and, on the other, the aesthetically obsessed, litcr:itun:·l0ving human being willing to be fooled by any form of noruense that is polished, refined, original, and tasteful. I um not capable of avoiding being the fool of randomness; what l can do is confine it to where it brings some aesthetic gratification.
compare the original (orig) image with the monochrome image. i had to convert it to monochrome to get a decent output.

this is how i did it in gimp:
1. first i enlarged the image so i could see more clearly the individual letters
2. colors > levels > edit settings as curves
i dragged the diagonal line down to the right just a little bit to make the letters a little more full looking (decrease the cloudy anti-aliasing effect)
3. image > mode > indexed > use black and white (1 bit) palette
turns it monochrome

now you have a png you can use to get a decent result with using ocroscript:
ocroscript recognize surface02.png > surface02.html

tesseract needs a tif file so you have 1 more step to get the better result with tesseract (the first line, which ocroscript doesnt manage to get):

4. layer > transparency > remove alpha channel
now save as *.tif and run this:
tesseract surface02.tif surface0.txt


moving my vbulletin forum here

the vbulletin version i'm using on The Royal Nick Humphrey Global World IT Forum, Home Edition is getting old now and i dont want to pay for a new one/upgrade.

last week my post table got corrupted, "coincidentally" right after i put a link in my signature to my website with lesser-known information, in norwegian, about the mormon church, that they dont want you or their members to know about. my website is called mormonerne. i suspect that someone from the church has tried to shut my site down, but i cant prove it. the exmormon site has had a lot of attacks so it's not unlikely, but it got me to thinking about security in general--it might be good to move my forum to a place like blogger, owned by google, where it would be harder for a hacker to do damage. so EAT THAT mormon hacker trash (if it was a mormon) lol =)

so all my new posts and IT tutorials will be posted here from now on.