Sunday, January 31, 2010

logo - gimp

There's a great site for a tutorial, but the steps are a little vague. Here's how I did it.

1) Made some garbage logo and saved it as a png
2) Duplicated the layer
   Layer > Duplicate Layer
3) Opened the stack viewer so I could move layers up and down
   Windows > Dockable Dialogs > Layers
4) Highlighted the duplicate in the stack, ran a Gaussian blur about "5"
   Filters > Blur > Gaussian
5) Made a new layer, colored white
   Layer > New Layer > (check white)
6) Put a vertical gradient on the new layer (white to blue looks cool)
7) In the stack viewer, moved the blue layer to top, above the blurred Gaussian.
8) Bumpmapped the blurred layer into the blue layer
   Filters > Map > Bump map
9) With these three layers, slide them around and change their opacity until desired dropshadow appears in the picture, then merge down and flatten.

Monday, January 18, 2010

MySQL - GUI's - Workbench

links
MySQL Gui's   Common MySQL commands   MySQL Workbench issues   MySQL field types

Website maintenance can be considered in two main halves, the administration of files portion and administration of databases (if any) portion. For file administration, adding and deleting files, I use a secure ftp program and an ssh tunnel to my provider. But what about database administration? If I am given MySQL databases, and if that provider has phpMyAdmin installed, then I use a mix of command line and phpMyAdmin database commands. As a side note, I like PostgreSQL more than MySQL, but most webspace providers only install MySQL.

command line
Making a command-line connection to the database is a good place to start, even if we will use a GUI later. Through the command line, we can easily verify connection is possible, and we can also run MySQL installation scripts, etc.

Let's imagine we had a database at Google that was web-facing w/remote access permissions. This would never happen, but this is the way ISP's often provide database access to you and me. We could connect to our imaginary Google database in the following way:
$ mysql -h google.com -u pietro -D mystuff -pwiggetystop

(note: no space between the "-p" command and the password itself "wiggetystop") So, if I've done this correctly, I'll be logged into my Google database and have a cheery "mysql >" prompt waiting for mysql commands.

phpMyAdmin
By default, many distros that have package management programs install phpMyAdmin into the Apache area. It's understood that Apache is used to parse the php files in phpMyAdmin, but Apache is another annoying level of overhead which also brings on security concerns if used outside of localhost. I only use phpMyAdmin when it's provided on an ISP's server. What is the solution for accessing a database remotely from one's local machine using a GUI? We don't want to pay for Navicat, now do we?

mysql workbench
It turns-out MySQL makes a GUI developer suite called "Workbench", which includes administration, navigation, and design tools. After checking dependencies, I downloaded, compiled, and installed the program, actions which appeared to have proceeded successfully. The start-up command is $ mysql-workbench, and it might have a few options for that command.


The reason this screenshot has no administration is because Workbench couldn't load the administration and nav modules, which left only the design module (pictured). There is a documented bug when compiling in Linux, even with all the Python libraries I could think of installed. The Python program pexpect, was considered helpful in the bug report, so I installed that as well. No improvement. Currently, I only have the design interface, as shown in the image above.

After digging around, filing a bug report (incidentally, they don't even want to answer within the bug forum where they will be useful to all, they direct one instead to their IRC channel where only the current people in the room will see the solution - ridiculous), all of the usual stuff, I dug in deeper with strace. It appears that it's the usual problem: Java, the most ridiculous run-time library since Visual Basic. This garbage occurs from each object MySQL Workbench attempts to retrieve:

**Message: WARNING: MetaClass db.maxdb.Catalog is registered but was not loaded from a XML


This seems to be the Java getDocument call. And there is no way to fix this I know of except to once again spend hours checking every exported path and poorly designed JRE directory search requirement. I've seen this kind of thing in other Java based programs. It's not Java itself that sucks so badly, it's their (apparently) lazily designed afterthought of a Run-Time Enivironment. And Java's inability to tolerate errors slewing off its own runtime environment, certainly doesn't help. This particular thwart experience is probably related to their "MetaClass" requirments.

navicat
I don't want an application with Wine built-in. It conflicts with the Wine I already have installed and is an incredibly boggy duplication of effort.

Saturday, January 16, 2010

linux - cheapo usb camera/webcam

links
Video: use and settings (not good for compile instructions)
Blog: making it work with Flash


getting started (FAIL)

# udevmonitor

the program '/bin/bash' called 'udevmonitor', it should use 'udevadm monitor ', this will stop working in a future release monitor will print the received events for:
UDEV the event which udev sends out after rule processing
UEVENT the kernel uevent
UEVENT[1263672227.910603] add /class/usb_device/usbdev1.2 (usb_device)
UEVENT[1263672227.910786] add /class/usb_endpoint/usbdev1.2_ep00 (usb_endpoint)


# lsusb

Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 093a:010e Pixart Imaging, Inc. Digital camera, CD302N/Elta Medi@ digi-cam/HE-501A
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub


So the kernel sees the camera. We have a $2 Pixart CD302N/HE-501A (ID 093a:010e) camera. How do we capture from this piece of junk?

Software
A simple command line interface for the camera will be spcagui ,once the camera is initialized, if the camera uses the gspca module to drive the camera. How do I determine the right module for my CD302N/HE-501A (ID 093a:010e) camera?

Navigated to Linux Kernel driver database and found that the 093a:010e camera uses gspca module. Checking the kernel to see if it's activated:
# modprobe gspca
FATAL: Module gspca not found.

So, it's not installed. Would the Kernel allow it, if we had it?
# cd /etc
# grep -rn "CONFIG_USB" *
udev/rules.d/30-scanners.rules:25:# For Linux >= 2.6.22 without CONFIG_USB_DEVICE_CLASS=y

So, it appears I won't have to modify the kernel, but I will have to build a module (in Windowspeak, a "driver") to load into the kernel. If I'd had to change the kernel from "n" to "y", I would go here and accomplish all this. But I don't have to change the kernel.

The documentation above noted the GSPCA module relies on libv4l, so it must also be checked:
# netpkg libv4l
[I][l] Found installed libv4l-0.5.8-i486-60.1.tgz on the repository
what should I do ?
1) reinstall
2) download
3) skip
There and installed. So only the source and patch for the GSPCA module needs to be found somewhere.
  • At this site appears gspcav1-20071224.tar.gz is the most recent version.

  • At this site appears gspcapatch.gz is a 2009 version.

Unzip them both into the same folder, then patch
$ patch<.gspcapatch
Following the patch, root-up and run their excellent compilation script
# ./gspca_build
The module will be created. Then just modprobe it and check to see if it loaded
# modprobe gspca
# lsmod
gspca          601572  0
videodev       23680   1   gspca
v4l1_compat   9732   1   videodev

So, all are loaded. I plugged-in the camera, and checked in /dev, and found that there was no /dev/video0, and so there was no way to find the camera. This is a well known bug, but the standard fixes, such as reloading the module, haven't worked.

A HA!
# modinfo gspca
filename: /lib/modules/2.6.28.7/kernel/drivers/usb/media/gspca.ko
license: GPL
description: GSPCA/SPCA5XX USB Camera Driver
author: Michel Xhaard
--HUGE OUTPUT--

# modinfo gspca |grep 93A
alias: usb:v093Ap2463d*dc*dsc*dp*ic*isc*ip*
alias: usb:v093Ap2472d*dc*dsc*dp*ic*isc*ip*
alias: usb:v093Ap260Fd*dc*dsc*dp*ic*isc*ip*
alias: usb:v093Ap260Ed*dc*dsc*dp*ic*isc*ip*
alias: usb:v093Ap2608d*dc*dsc*dp*ic*isc*ip*
alias: usb:v093Ap2603d*dc*dsc*dp*ic*isc*ip*
alias: usb:v093Ap2601d*dc*dsc*dp*ic*isc*ip*
alias: usb:v093Ap2600d*dc*dsc*dp*ic*isc*ip*
alias: usb:v093Ap2470d*dc*dsc*dp*ic*isc*ip*
alias: usb:v093Ap2460d*dc*dsc*dp*ic*isc*ip*
alias: usb:v093Ap2471d*dc*dsc*dp*ic*isc*ip*
alias: usb:v093Ap2468d*dc*dsc*dp*ic*isc*ip*
alias: usb:v093Ap050Fd*dc*dsc*dp*ic*isc*ip*
Notice that there is no 093a:010e in the list of these Pixart cameras. So, we are definitely going to need to add another module or patch the current one further. The OS needs to create the node/dev/video0 or else software that shows images can't interact with the camera.

mr97310a.c
Mr97310a.c, may be the patch. It's described at the Linux Database. Scrolling down, the site seems to indicate that the 093a:010e Pixart Imaging, Inc. Digital camera, CD302N/Elta Medi@ digi-cam/HE-501A requires this "C" module to be patched into the gspca module when compiling it, however this patch cannot be downloaded or copied and pasted. Alternatively, perhaps it will be a module named gspca_mr97310a. I can't figure out how to build this from the documentation.

Since I don't want, or don't have the information, to go to that trouble, I'm going to handcode what the module source will need to find the hardware, and then recompile the module:

In gspa.mod.c, added:
MODULE_ALIAS("usb:v093Ap010Ed*dc*dsc*dp*ic*isc*ip*");

In gspa_core.c, added line 413:
{PAC7310},
added Line 613:
{PAC7310, "Pixart Kaibo 7310"},
added Line 628:
{USB_DEVICE(0x093a, 0x010e)}, /* Pixart Kaibo 7310 */
added Lines @ 4120:
case 0x010e:
spca50x->desc = PAC7310;
spca50x->bridge = BRIDGE_PAC7311;
spca50x->sensor = SENSOR_PAC7311;
break;

Then, took out the old module and recompiled and installed:
# modprobe -r gspca videodev v4l1_compat
# rm /lib/modules/2.6.28.7/kernel/drivers/usb/media/gspca.ko
# cd /home/foo/Download/gspcav1-20071224
# ./gspca_build

So, after these steps, and a # modprobe gspca and plugging in the camera, we get:
[dev]# find . -name "video*"
./video0
./v4l/video0
./.udev/names/video0

Great! The system is seeing the camera, and creating the /dev/video0 and associated nodes. Let's see if we can get a picture. No. It may be that the 7311 bridge is not going to work properly with a 7310 camera:
$ spcagui
SpcaGui version: 0.3.5 date: 18 September 2005
video device /dev/video0
ERROR opening V4L interface
: Input/output error

Reinstalling the driver, with modprobe yields the same result. It appears I'm very close, but that the bridge for the 7311 is not going to work with the 7310. Not sure what to do without that 7310 bridge, but at least the process is confirmed for compiling the driver and recognizing the camera. More to come.

linux analog video tape -> digital format

There are two parts. First there are many different types of video format to consider, what do we need as an outcome? DivX, Quicktime, swf? Start by considering that, or whether it might have to go out into multiple formats or be edited. Next is taking the old RCA video outputs from a VCR and getting the analog audio and video into the Linux box for capture and potential editing before burning to DVD, sending to YouTube, whatever. Finally, there is a layer that's software for editing, but that will likely be a separate post, so I'm not considering that one here.

Friday, January 1, 2010

Math - Grammar - Law

Geometry tends to bore people, for example, me. It might be interesting in one way though. There's a connection we feel between Math, Grammar, and Law (within this essay, "MGL") that emerges when we do Geometric proofs. I don't think there's any other subject where there's a convergence like this. What allows them to work together appears to be the rule structures underlying each concept.

Familiarity, intuitive use
Most of us who are not professionals in MGL fields still operate with them enough to have a feel for them. In Math most of us recall that different theories seem to apply to different types of problems, for example, commutativity and additive inverses. Without knowing the names of the rules, we understand that 3 - 2 is not the same as 2 - 3, but that 2 + 3 and 3 + 2 are equal. In Grammar, we know that adverbs describe actions, but even if we've forgotten the name of that rule, it feels wrong if we mistakenly use an adverb to describe a noun. Eg, "An unused heavy weight makes a good doorstop." looks correct, as compared to "An unused heavily weight makes a good doorstop". In Law, most of us understand that, if contracts are broken, there might be a lawsuit, whether or not we happen to know the applicable law. So in each of these areas, most of us operate out of habit without needing to consult the specific MGL rule that applies. In Geometry, when we make proofs, we have to be explicit about only the Math portion, but there are other laws at work.

Grammmar
Grammar is determined by usage and social convention. In the case of US English, media status and academia tend to promote one form of usage into Standard English and Received Pronunciation. These then normatively reinforce that usage over others. Outside of this politicking however, grammar "rules" are descriptive, not normative. they are descriptions of what we observe across languages. One of the potential hiccups is agreeing on the linguistic terms. Linguistic terms are themselves words -- defined partly by usage -- so that they risk a circularity of using themselves to define themselves. We break the circle fairly effectively by first having a conversation about what our linguistic terms refer to, a meta-conversation, attempting to solidify what our discussion will point out in a language before we start examining languages. Outside of Linguistics study, in the world. language operates without bounds. Inside Linguistics, that is, while studying worldly language effects, we want own words to point to agreed-upon concepts.

As an example, let's suppose we're Linguists who agree about the meaning of the word "case", insofar as language is concerned. Using this definition, we're able to observe the number or nature of cases across languages in way we both understand. In German, we could agree there are likely at least 4 cases; the nominative, accusative, genitive, and dative cases. Observing English, we might agree that typical English usage does not split these apart so neatly. The language rules society follows come through usage, the rules we use to describe them must come through academic agreement. In one sense, Grammar is a posteriori, but the study of Grammar requires a priori definitions.

Math
With Math, we believe we establish rules based on logic first, and experience second. So, the trajectory is deductive, we start with principles and build logically from that point to conclusions within that logic, or must expand it. The basis is a priori, but the expansion of axioms to encompass new information is a posteriori. Of course, Kant considered Mathematics "synthetic" for this blend. But what about our meta-conversation in Math, like the one we had in Linguistics? Isn't it true that we must first have a conversation about what Math words mean and agree upon what they point to, before we subsequently do that Math? For the part of Math that is arithmetic, that uses symbols, such as 2+2=4, it's relatively easy to agree because there are quantities these point to, not just concepts. We can place two items in front of anyone in any language and, once it's clear we are discussing a quantity, need only agree on the symbol. So for quantitative Math, there can be agreement about the language. But Math is not all quantities, it's also performing operations on quantities and applying theorems to those quantities, and these operations and concepts may need clearly agreed terms to discuss.

Law
With Law, the statuatory scenario is a priori; the law is true by its definition as declared, not through observation (inductively). In this way it is like the first discussion we had about Linguistics, we had to first agree what we meant by the words we were going to use with the However, with precedents, the law also allows for interpretation which can affect its implementation in an a posteriori sense.

Geometry connection
One thing that seems to combine all three of these is Geometry. Geometric proofs utilize deductive logic, the obviousness of quantities and graphical constructs, and clear definitions. Perhaps Geometry is not so boring after all.