Showing posts with label Tegans Tech Talk. Show all posts
Showing posts with label Tegans Tech Talk. Show all posts

Sunday, November 18, 2012

LG Optimus S from Ting - Rooting Instructions

Most of this post is going to be fairly technical with links to some technical pages, so most of my readers aren't going to be interested. In fact, this information will be out of date soon, so I'm not even entirely sure why I'm writing it, except that I hope to get Eric the same phone which means I'll be going through this process once more.

So, if you want to read about me rooting a phone, read on. Otherwise, you might want to skip this one.

Wednesday, March 02, 2011

Kindle and Calibre - Creating EBooks

Something Calibre does very well is convert ebooks from one format to another. And because of that, I've been able to do something that I simply couldn't have imagined doing just one year ago. I've created a couple of ebooks. From scratch.

I'm not going to be sharing these books, sorry, but I can share how and why I made them.

Torvald and Erin Gray
The why is pretty simple, really. I'm going to be headed to Emerald City Comicon this weekend. I've been to all of them so far, and I'm happy to be going to this one thanks to the generosity of my evil twin Lisa (we're not really twins, but people kept asking if we were, so we ran with it). Anyway, to make a short story long, I do two main activities at comic book conventions. I ask nicely for free sketches, and have gotten a few, and I troll people. Both activities result in physical proof, one in the form of a sketch and the other in the form of a photograph. But until this year I've never been able to bring all the proof along with me. Two of my sketchbooks are completely filled and one of them is utterly priceless to me because of the sketches in it. I leave it in my firesafe unless I want to look at it. Bringing it to every convention so I can show off the awesome sketches in it isn't an option. I have scans of all the sketches but I haven't got permission to share them all online, so most people will never see some of the artwork in my sketchbook. As for the Torvald pictures, most of them are available online but I don't have easy access to the internet while at shows. My highest tech portable object is my Kindle. So again, until now, I had to be content with directing people to the website.

A few days ago, though, I suddenly realized that with my Kindle and Calibre, I could create ebooks for both the sketches and the troll, and be able to show them off freely, if in plain B&W, to anyone who wanted to see a particular item. It might be a little tricky to make sure I could navigate to the particular picture I wanted, but I have already played around with the ePub format a little, so I thought I'd see if I could do it.

The ePub format, fast becoming a standard for ebooks, is a very simple one. It's basically a set of html files zipped up. That's it. Now, I've been making webpages for over 15 years, so I have a pretty good grasp of basic HTML. Even better, the Torvald site was already set up in such a way that I figured it would be a piece of cake to convert it to an ePub. So I started with that. I removed all the extra formatting from the page, and simplified the layout a little. Then I zipped up the site and imported the zip file into Calibre. Once there, I converted the zip to ePub and took a look at the result.

It was a shambles. The links didn't work, and the layout was completely different. Oops.

I took the ePub that Calibre had created and examined it by saving it to my disk (right click, save to disk) and then changing the extension to zip from epub. It had a handful of extra files in it, and it had removed all my extra picture folders and put everything in the main folder. I went to another epub I'd already dissected and looked at it to see what I was doing differently. It took a little sleuthing, but I discovered that my internal links were using a different convention than the ones used by the working epub. I'd been taught to make a link to a specific place inside a page by making an "a name" tag and putting it around that place. The working epub's HTML files instead used an "id" tag within another tag. So I changed all of Torvald's internal links to id tags instead of name tags, removed a bit more garbage HTML code, and tried again.

This time it worked. I had an epub book with a table of contents that I could click on a name, and be taken to the picture of that person with Torvald. It was awesome. I converted it to mobi format and uploaded it to my Kindle, and it still worked. It's a HUGE file, 25 megs, but it's there on my Kindle so if anyone at Emerald City wants to see some particular person with Torvald, I can click a couple of times and bring up that image.

Aquaman by Todd Nauck
The sketches were harder. The website isn't one that can simply be converted, and as I mentioned earlier, all the sketches aren't on the website anyway. Plus, with these, I wanted them to be as big as possible. So I figured out what the maximum size of an image within a book is on the Kindle (520x640), found my raw images, and did a big of cropping, editing to make the contrast better, and some batch resizing and converting. With the images, all 278 of them, ready, I had to create an HTML frame to hang them on.

I divided the collection into eight sketchbooks (three Aquaman ones, an autograph one, one for images not in sketchbooks, a Doctor Who sketchbook, my husband's sketchbook, and my evil twin's sketchbook). Each sketchbook got its own page, and I made the HTML as simple as possible. Just a embedded pictures with id tags so the index could find them. I opened each page in Firefox as I finished to make sure the page were displaying properly.

Then I made two indexes. The first one pointed to each of the sketchbook pages and also to an A to Z index of the artists, which was the second index. I set that one up alphabetically, linking each artist name to the picture by the id tag. It was a bit time-consuming work, but it was to pay off.

Once I was done, I zipped it up and imported the zip file into Calibre, then converted it to ePub. The Table of Contents was a mess. It tried to include part of the A to Z index instead of just the main index.

So I dissected the ePub and copied some of its files over to my original work. There's a toc.ncx file. I edited that one down to just the items I wanted to show in the index. There's a content.opf file. That one just lists all the files in the epub, so I mostly left it alone. I also copied over a META-INF directory and it's sole file as it was, and a mimetype file as it was. Calibre also created a titlepage.xhtml file, and I copied that one over as well, because it's the file that creates the book cover. With the edited toc.ncx file, I zipped up the contents again. This time I renamed the zip file to epub, and imported it into Calibre as an epub file. It worked. Perfectly.

Next job, convert to mobi and upload to my Kindle. And it all worked. I can find an artist name in the A to Z and jump quickly to it.

So I created a couple of books for my Kindle. One from a website, and one from scratch. I'm feeling pretty good about it at the moment, though I'm far from knowing everything. I admit, I can hardly wait to get to Seattle and see my friends and family, and enjoy the convention.

If you happen to be going and want to see my efforts in person, just look for the gal in the Aquaman t-shirt carrying Torvald the Troll in a belt-pack.

Friday, February 25, 2011

Kindle and Calibre - DRM and Plugins

This is very much the elephant in the room of ebooks. I make no secret of the fact that I despise Digital Rights Management (DRM). It's an attempt to use technology to solve a social problem. As a result it is always quickly broken and instead of stopping the copyright infringers it makes it hard for honest people to use files they have already purchased. I've already posted about a situation where I attempted to remove DRM for someone, but failed and ended up pirating it (to my personal dismay). There has been at least one study that shows people will turn to piracy to get what they need out of ebooks that have DRM. The online comic XKCD has a persuasive argument why DRM makes criminals out of us all. So I'm not fond of DRM*.

In short, DRM only stops honest people from being able to use a file the way they expect to be able to. It does nothing at all to stop the "pirates". The people who want to make a file widely available will always be able to break the technology used to create DRM, and as a result the pirated copy of a book will always be more useful than the one laden with crippling DRM. As a publisher, you NEVER want a pirate to offer a better product than your own. That's stupidity in marketing.

As an aside, I have repeatedly argued for a different kind of DRM scheme that embeds a user's information in a file in multiple ways without restricting the file's use (watermarking). I have absolutely no issue with a file I download having information that will allow a company to see if I have put that file on a file-sharing site. I don't share my files anyway. Such a scheme would not cripple the file, meaning that normal non-techie people can use it fine. Yes, it's still technology and therefore people could still remove the ID from the file and pirate it, but it would be less likely to happen, in my opinion. People would rather be honest than dishonest.
Getting back to the discussion at hand, while some publishers offer DRM-free books (such as Baen Books), most cripple their books, making them impossible to read on multiple devices unless you register every device and download them specifically to those devices. For many bookstores, you can't register a competing device, so if you have a Sony and want to read a book you bought for Kindle on it, you're out of luck.

Let me state this right now: Calibre will NOT help you break DRM. Calibre is a management program, not a piracy program.

However, Calibre is an open source program that allows plugins, and there have been multiple plugins created for Calibre that will remove almost any type of DRM from any file you import into Calibre. I want to stress: this is not legal everywhere, and any justification you make for it is an excuse. If you decide to hunt down anti-DRM plugins for Calibre, do so fully aware that what you are doing is probably illegal and possibly immoral as well. You may disagree with me, but I won't lie to myself. What I did to help Tim and Jane was wrong, even if it was moral in some sense. And if I were to, say, remove all DRM from every book I purchase it would also be technically illegal, even though I do NOT share my book files.

If you really want to be a bad consumer and strip DRM from your ebooks you will have to use an internet search to find the files you need, because I cannot and will not link to them or host them here. First, Amazon has an understandable desire to sue people who help others to break DRM. Second, DRM tech is constantly advancing as the DRM peddlers continue their futile attempts to stay ahead of the techies who enjoy removing stupid things like DRM. So a link to a DRM removal tool would soon become obsolete anyway.
Side Thought: DRM peddlers are like drug dealers. "Sure, c'mon, we can get rid of your nasty hallucipirates, just give us a lot of money and we'll give you our latest and greatest." And the DRM might work for a bit, but they will soon have to return for another hit.
If you are determined to strip DRM from your Kindle ebooks, here's some hints. First, you may want to install Kindle for PC or Kindle for Mac. And you might want to download any ebooks you want to strip of DRM to those programs. When you do an internet search, you maybe should look up something about Calibre, plugins and DRM. You should not have to sign up for any forum or pay any money for the plugins. I can't tell you what exact searches will work, or if you'll be able to find what you are looking for. But hey, if you are determined, good luck.
One last note: If I learn that you've used this information to pirate ebooks and share them with everybody, I'll consider you lower than pond scum and scorn you for the rest of your life. If you want to remove DRM, remove it for private use, not copyright infringement.
Let's move on to a less dangerous subject. How about, oh, Calibre plugins!

Adding a plugin to Calibre is very easy. First, you find the plugin you want to add. There's a good list of plugins here, and they include some really neat stuff. For Kindle 3 users, check out the collections management plugin.

Each plugin comes in the form of a zip file (don't extract it, it needs to stay a zip file). Simply download it to your computer somewhere you can find it again.

Next, you need to tell Calibre to load up the plugin.
  • Click on the Preferences button.
  • Then, down in the lower left should be a "Plugins" button. Click that.
  • At the bottom of the window that opens is an "Add a new plugin" button. Click it, and you'll get a search window.
  • Find your downloaded zip file, click "Open", and let it install. You might get a warning about the danger of a plugin. As long as you downloaded the plugin from a trusted source, you should be ok and can click through.
  • Now your plugin will show up in the list of plugins. At this point, if it needs to be customized, you can select the plugin and click the "Customize plugin" button. What you get will depend on what features the plugin has, if any. Many plugins don't require any customization.
  • Once you'll installed and customized, if needed, then you need to restart Calibre. You can do that quickly by typing Ctrl+R.
  • It is safe to delete the original zip file you downloaded once the plugin has been installed.
  • If the plugin needs to have a menu item or toolbar button added, go to Preferences and then "Customize the Toolbar". Use the dropdown to find what menu or toolbar it needs to be added to, then find the action in the "Available actions" box, select it, and add it to the other box. Use the arrows to move it to where you want it to show up.
Once you've installed a plugin and restarted Calibre, the plugin should be working immediately. A handful of plugins, like the collections one, require a couple more steps to make them work best. Read the instructions that come with the plugin to make sure. Quite a few plugins don't require any effort on your part at all, they just work.

If you are a developer yourself and familiar with Python, there is good information about how to create a Calibre plugin in the Calibre User Manual.

That it for these topics. If I ever get a Kindle 3, maybe I'll write up how to actually use the collections plugin to your best advantage. But my poor little K1 doesn't have collections on it, so I'm clueless about it at the moment.


* There is one single exception to my distaste of DRM, and that's library books. I may go into detail later, as I intend to discuss library books and the Kindle, but at the moment it's enough to say that I don't mind DRM on library books.

Saturday, February 12, 2011

Kindle and Calibre

I installed Calibre back when it was recommended by Wil Wheaton on his blog, and I found I didn't use it at all. The file structure was strange, and I only had a few ebooks to put into it. I didn't realize it had a viewer, and in short the usefulness of it seemed extremely limited.

But now I have a Kindle, and I suddenly understand why Calibre is so well-loved by the literati of the ebook crowd. Yes, the file structure is odd, but that's because the program is looking at the files as books, not as files. And it can be hard to get it to work if you aren't technically competent, as the manual isn't written for the average user. That's due to it being written by a computer engineer for computer techies. But more people are going to be using it in the future, so I thought I'd start to work on writing up some of the tricks of using Calibre so I can remember what I did, and other people might be able to benefit from my experiences as well.

Today's first trick: downloading and installing Calibre.

Ok, not much of a trick. If you've done any installation at all, you know already what to do. The Calibre downloads are available for lots of different operating systems, and I've installed it on both Windows XP and Ubuntu myself. At the moment, I'm mostly using my Windows install, so my tricks will be written with that in mind.

Now, when you install it, Calibre will create a library, and THAT is a very key point. I have several libraries for my books. I have a main library that is actually located in my Dropbox and holds only the stuff I'm currently working with. On my external drive I've put several libraries that have my archives, my backups, and some other stuff. I'll get into those more in the future. But the location of the library is important, if only because later in my tricks I'm planning on explaining how I made a bunch of different libraries and why.

In any case, once you've installed Calibre, you'll want to know what to do with it. Well, the best thing is to watch the video tutorials, as those will give you a good start on figuring out the program, and introduce you to Kovid, who is the guy who built this fantastic system and is giving it away for free (though donations are accepted). The tutorials use an older version of Calibre, but still manage to give a good idea of how it works.

I'm tempted to leave it at that, because if you watch the tutorials you will probably be able to figure out the rest without difficulty, but I know that most people won't bother with the tutorials. So here's some of the basics: Use the "Add books" button to add books to Calibre. It copies the books from whatever location you get them from into it's own file structure. The original is left alone. Once in Calibre, you can edit just about everything that has to do with the file by clicking the "Edit metadata" button, or right-clicking on a book title and selecting "Edit metadata".

The metadata is actually where the magic of Calibre sorting comes in, as you can sort on just about every field in the metadata, and you can add your own custom fields and sort on those as well. For instance, I like knowing where I got an ebook from, so I added a field called "Source" in which I put where I bought it, or if I got it from Gutenberg or another free site. Adding a custom field is simple, you go to "Preferences", then "Add your own columns". The lookup name must be one word and lowercase, otherwise you can play with the settings and come up with what you want. Other fields I added include a boolean (yes/no) column for whether or not I've read the book, whether or not I've reviewed it, and in my Dropbox library I have a column to indicate if I've backed it up to my external drive.

Well, I'm going to write more on this topic, but at the moment I think that's enough to get someone started on the program. If you have any favorite Calibre tricks you'd like to share with me, feel free to post about them in the comments. I'll be covering Calibre news and blog recipes, how to get a series title to show up as part of the title when you upload to Kindle, and using multiple libraries while still having a nightly news download in future installments.

Saturday, March 20, 2010

Blogging About Blogger is a Sin

And I'm a sinner. Still working on downgrading this blog to the layouts format, and finding, slowly, answers to most of my questions. I'm going to go technical to record some of the problems so when I get to Elayne's page I can remember what I did...

0) I set up a dummy blog and imported my classic template into it in order to have a safe sandbox to play in. Google has made it impossible to test edit any other way.

1) Start with the shape of your page. The widgets or gadgets or whatever they are calling them this week are immaterial until you have the layout of page itself fixed up. To do this, you can find a similar layout and switch to it, then strip away everything that doesn't fit. This is the most difficult step, but not the most annoying.

2) Gadgets store the information you really need in a database on Google. This means that you have no access to the code you insert into a gadget unless you go through the rigamarole of opening each gadget individually. This is the most annoying part of downgrading. You cannot simply edit the code within the HTML, it's not stored there.

3) Some prepackaged gadgets don't allow you to format the information in them. This sucks. It makes it very hard to duplicate the look I have on my sidebars. Apparently it's the cool thing to hardcode formats now. I spit on developers who do that with stuff they intend to share. Gadgets would be "cool" if they were more customizable. As it is, many of them are simply unusable.

4) If you want a custom header, you have to delete the default header. You cannot edit it. It will revert back to whatever you edited it from. This is not just annoying, this is maddening. It would have been nice to have a warning on it, or even in the documentation, that it isn't possible to edit it.

4a) You can only delete the worthless default header by deleting it in the HTML editing area. You cannot delete it from the drag 'n' drop window.

5) Download the HTML repeatedly while editing. If you hit a step that destroys your work, you can upload a working copy. Trust me, you will hit a step that destroys your work.

6) If your previous template worked on IE and everything, don't assume it will still work. Test on IE, Opera, and Firefox. If it works on Opera and Firefox, it's a non-compliance bug in IE. Curse Microsoft for their non-compliant browser, and then try to fix it. There are numerous hacks to work around Microsoft's unwillingness to be compliant with browser standards. They are ugly, but having your page display oddly in IE is a poor choice.

7) The good old "conditional tags" from the classic templates have been replaced by poorly documented If/Else statements within widgets. This is annoying, but not impossible. The format for these statements is simply enough. It must be right after the b:includable tag, and be in the format b:if cond='statement' where "statement" is the condition. To make a widget show up only on the main page, the statement is data:blog.pageType == "index". To make it show up on everything except the main page, you change "==" to "!=" like so: data:blog.pageType != "index". The other pageTypes are "archive" and "item".

8) There must be a good tutorial on XML templates somewhere, but I haven't found one that doesn't assume knowledge I don't have. Annoying. Frustrating. Maddening.

Oh well, back to work. I hope this helps when I start to dissect Elayne's template.

Update: Ah, I remember the problem I had before. Because each bit of code is saved in a database, you can't just create a dummy blog and transfer everything over. ARGH!!!!

Monday, January 05, 2009

Webcam Madness

Ok, I'm determined to get a webcam for monitoring the house and outside weather while I'm away. Problem is, I can't find exactly what I need from simple Google searches. So I'm hoping somebody who reads this either knows something or knows where I can start to find out...

I want a very simple webcam that takes pictures every 5 minutes or so. I don't need heavy-duty live security... I just want to know that the house is still standing. So I plan on aiming the camera out a window at the garage and driveway, which will show me the weather. And if the house is still standing, the camera will still be taking pictures, right? So I need a reliable camera.

The problem is that I don't have an extra computer to hook the webcam up to, so it needs to be able to send images directly through the router to a website on my domain.

I've found plenty of wireless cameras that fit the bill, but most of them are WAY more than I want. They include audio and full video. I only need still pics, audio is ridiculous and streaming video is overkill. I don't need a full-blown petcam, just a good ol' webcam.

Does anyone know if something like this is even made? And if so, where can I get some reviews or information about it?

Help?

Tuesday, March 04, 2008

Wikify Me

Wow. I've started to work on creating a website using MediaWiki software. If all goes well, substantial portions of my Aquaman website will be replaced with this new wikified version (you can probably even guess the address of the wiki). I'm pretty excited about it because it means I'll be able to invite people in to help keep the content up-to-date and to maintain the website. While I love Aquaman, I'm just not too good at keeping websites up-to-date. And other fans have been asking me for years if they can help. Now I can say, "YES!"

Anyway, I've been dipping my feet in the wiki pool, and have discovered a LOT in the last few days. The biggest discovery so far, though, has to be templates. I knew that Wikipedia uses templates to make life easier for their editors. I didn't realize that it wasn't simply a natural function of the software! I got all excited when I went to Dreamhost's Wiki and saw this stylesheet for infoboxes on websites. I assumed, very wrongly, that I'd just need a little markup and I'd be good. Ha.

Because I want to use the infoboxes on my wiki, I grabbed what I thought was the code from Wikipedia for the Superhero infobox, planning on adjusting it to my needs. It didn't look like it would work... and it didn't. I then discovered what Templates are (I originally wrote a bit about namespaces and the structure of wikis, but decided that's too techie even for me). I found the template for my infobox, but I couldn't make heads or tails of it. I then found this helpful page that explains the details. Progress is being made!

So I created the template on my aquawiki, and... it didn't quite work. It was all messed up with extra characters. I couldn't figure out why, because everything I was reading seemed to indicate it should work fine.

Eventually I found a mailing list that had the answer. I needed to install an extension onto MediaWiki to PARSE the code correctly. The templates, the way I was using them, don't automagically work with the main code... they need a ParserFunction Extension. Funny how none of the pages on templates seem to mention that clearly. I found the installation instructions and followed them, and then checked my test page... perfection!

The reason I'm posting this is because someday I may help Eric to set up his Wizard of Oz wiki, and I want to remember how to create templates properly. And also, there's a tiny chance that someone else out there has a wiki that they want to put infoboxes on, but can't figure out the details. Now I've hopefully given enough clues for them to put it all together (Custom CSS => Template code from Wikipedia (both infobox and the ! templates) => ParserFunctions Extension).

Wednesday, July 25, 2007

Tegan's Tech Talk - GIMP Scripting Part Three

This is the continuation of me learning how to batch script in GIMP. In the first part, I explained my quest. In the second part, I explained my script-fu. In this part, I explain how to run and batch my script-fu.

The quick way to test the script is to run it from the GIMP console (Xtns->Script-Fu->Script-Fu Console). To run it, I simply type script-fu-mylevels "TestIn.bmp" "TestOut.bmp" and hit the enter key and VIOLA! Ok, well, not quite... First I have to put the TestIn.bmp in the correct directory on my machine. In my case, I just put them in the same place as GIMP was running from, since that was easiest. I could put them elsewhere, put I need to put the whole path into the variable. For example: "C:\Documents and Settings\All Users\Documents\TestIn.bmp".

In the end, because it meant less typing, I decided to just stick it in the same directory that GIMP is running from (C:\Program Files\GIMP-2.0\bin). This is also how I ended up setting up my batch file, so I have to put files in that directory to run the batch on them. My excuse is that it was just easier. I'm sure I could figure out how to make it run in the folders I want it to run in, but I don't feel like taking the extra time to figure it out. Batch scripts are supposed to SAVE time.

Anyway, back on track, I use the GIMP console to test my script. If it works, I'm good. If it doesn't, I alter it. I actually ended up using this step quite a bit with the levels script, as I found numerous little problems with it, including that the channels was set to all red in the first version. Most of the other problems were typos on my part.

Once I knew the script would do what I wanted it to do, I had to batch it so I can run it on a lot of files all at once. In Windows, it is easy to create a DOS .bat file, so that's what I ended up doing. I learned DOS batching in college (not in classes, but from hanging out with comp-sci majors) and so I had a good grip on what I was doing in this section of the effort.

A DOS batch file is just a text file of DOS commands saved with the .bat extension. To run my script-fu, I used this:

for %%G in (*.bmp) do gimp-2.2 -i -f -d -b "(script-fu-mylevels \"%%G\" \"F%%G\")" "(gimp-quit 0)"
What this script does is take every file (%%G) that has an extension of .bmp and opens GIMP, runs my script on the file, saves the result with a prefix, then closes GIMP.

I ran the batch with a test group of 50 images, and it worked like a charm. At that point, I was satisfied. I managed, with a lot of help, to create a script and batch it in GIMP. If I need this again, maybe this write up will help me remember how it happened so I can duplicate the success.

Tuesday, July 24, 2007

Tegan's Tech Talk - GIMP Scripting Part Two

This is the continuation of me learning how to batch script in GIMP. Most of my readers aren't going to have any interest in this, it's mostly for my own edification, and possibly to help someone else who is looking for information via a search engine and stumbles on this. In the first part, I explained my quest. In this part, I explain my script-fu.

The easiest way for me to look at my script is to present the script as it finally ended up, then dissect it. So here's my final script:

(define (script-fu-mylevels infile outfile)
(let* ((img (car (gimp-file-load 1 infile infile)))
(drawable (car (gimp-image-get-active-drawable img))))

(gimp-levels drawable 0 25 225 1.0 0 255)

(gimp-file-save 1 img drawable outfile outfile)))

(script-fu-register "script-fu-mylevels"
"/Xtns/Script-Fu/Tools/My Levels"
"My Levels"
"tomcat"
"tomcat"
"2007-05-17"
""
SF-FILENAME "Infile" "infile.bmp"
SF-FILENAME "Outfile" "outfile.bmp")
There are really only two main parts to this. The first starts at "define", and the other starts at "script-fu-register".

You can read about the "script-fu-register" bit on this page. It is a necessary step, but it's just basic script-fu stuff. In short, this section tells GIMP what the script is. It doesn't need much editing in my non-interactive script. By the way, "tomcat" is the guy who helped me figure this whole thing out, thanks Tomcat!

So let's get into the meat of the script, the part that starts with "define". It's easiest to take this apart a section at a time.

This bit:
(script-fu-mylevels infile outfile)
just says "I'm naming this this thing 'script-fu-mylevels' and it accepts two variables, 'infile' and 'outfile'" This is important, infile and outfile are my two main variables. When I run this script, I have to include BOTH for the script to run correctly.

The next two lines load the file and get it ready to edit. Not much I can really say about them, since I don't entirely understand what each bit does. I do know that the "1" in there tells the script to run non-interactive... so it doesn't need any input after it starts running.

The really important bit for me is the next line:
(gimp-levels drawable 0 25 225 1.0 0 255)
There's a menu in GIMP called the Procedure Browser (Xtns->Procedure Browser). Using this tool you can find the script version of every single command available in GIMP.

In my case I wanted to use the levels command, so I did a search in the Procedure Browser for "levels" and found an item called gimp-levels. When you have an item selected in the Procedure Browser, over in the right pane you see the parameters that the item needs. In the case of gimp-levels I was sure it was the right one because the various parameters matched the inputs available on the menu item.

Going through the rest of the line in my script-fu, "drawable" is an internal variable set earlier and refers to the image that's been loaded. The "0" is the channel, if I use "1" it would only affect the red levels, "2" would affect green levels and so on. "25" is the lowest input. When you start the levels item in GIMP it starts at 0, in my script I'm upping it to 25 to increase the dark level in my image. The "225" is similar, it starts as 255, so I'm lowering it to increase the light level in my image. If you know how the levels menu item works, you'll understand this. If you don't... well, just know that those are the only two settings I've changed from default. The next three numbers are just set at the defaults, "1.0", "0" and "255".

Pulling it all together, this line says, "Take the image we loaded, run gimp-levels on it with the following parameters". In reality, very simple. Not so easy to understand for a beginner. This line in the script would change completely depending on what item you use from the Procedure Browser, and what variables need to be set for it.

The last line of my script-fu
(gimp-file-save 1 img drawable outfile outfile)
just tells the computer to save the file, using the variable outfile as the name.

The next step is to take that script-fu and save it as a text file with a .scm extension (mylevels.scm), and put into the scripts directory (in my case C:\Documents and Settings\User\.gimp-2.2\scripts). The next time I load GIMP, this script will be added to the list of scripts I can use.

Whew! So that's the script-fu side of it. Next step is to run this sucker!

Monday, July 23, 2007

Tegan's Tech Talk - GIMP Scripting Part One

Remember awhile ago when I started moaning about being unable to do batch scripting in GIMP? Well, I eventually got help and figured out what I was doing, and decided to write it up so I would remember it if/when I had to go back and do it again. Unfortunately, it's just not that easy to write up. So it's taken me quite some time to get around to it, and I'm not even positive I'm completely correct.

To make things even more interesting, I just got a real, legal copy of Photoshop, which I haven't even installed on my computer yet. I'm stunned to have it, and eager to start learning it (and incredibly grateful to the person who acquired it for me). But it makes me wonder if the effort of learning scripting in GIMP is worth documenting. However, I feel like if I took the effort to learn it, maybe I should try to hang onto that knowledge. So here goes...

This is REALLY esoteric, so most of you will want to stop reading about now.

To the rest of you, I'm not dumbing this down for you, I'm dumbing this down for me. I want to be able to understand this if/when I come back to it months from now. I really hope that this whole blog entry will be made obsolete by someone adding proper macro recorders and batching to GIMP. I'll point out that a start has been made by David's Batch Processor, which has some GIMP functions, but not all. The functions I needed weren't in DBP.

GIMP batch scripting is made up of two parts at the moment. Because this is open source software, the reality on the ground can and will change at a moment's notice, as some new developer adds something wonderful. This reflects reality as of Spring of 2007, when I first made a stab at GIMP scripting. Right, so to get back on track: GIMP batch scripting is made up of two parts.

The first part is writing a script in script-fu that will accept variables. The second is writing a batch file/shell script to run that script-fu. There's a tutorial here, but it doesn't help much if you simply don't know anything about it, which is where I started out. The same goes for this tutorial, which is missing the dead-simple stuff that newbies like me need. The guy who wrote the first tutorial came to my rescue, and now I understand most of the script.

Script-fu is the built in scripting tool in GIMP. It was designed by developers for developers, so it lacks the grace of a simple GUI for end users. However, it is actually very elegant and complete. What it offers is a way to access every function of GIMP via script. So if you want to rotate an image, you find the corresponding rotate piece in the script-fu and use that as your command. Yeah, it's a little more complicated than that, but basically anything you can do in GIMP using the GUI can also be done with a script, if you can figure out which script to call and feed it the right variables.

And that's what I'll do in part two... make myself a script-fu!

Sunday, February 25, 2007

Tegan's Tech Talk - Various Stuff

The Oscars must have started, as the TiVo has started recording something, and I'm pretty sure the only thing we set up for tonight was Oscars. I've spent much of the day helping hubby-Eric learn how to use our new domain names and server. It's been an interesting day.

First up: Google Reader.

Yes, I like it a lot more than Bloglines. The interface is much better, I prefer the method of "starring" entries that I want to go back to, and having them all in the same place to look at. The sharing function has so much possibilities, as you can subscribe to other people's shares as feeds and suddenly get a whole new world's worth of blog reading. Lots of potential there.

But the problems! Ay!

  • I really need the ability to blogroll from my reader. It is so much easier to keep a blogroll updated if it's wrapped up in the way I read my feeds. The lack of a blogroll function is one big strike against it.
  • There is currently no way to tell if an entry has been updated. This is a VERY annoying problem, and may be the biggest strike against Google Reader.
  • Related to the updated problem, there is currently no way to tell when an entry was first posted. The dates in Google Reader seem to be when the app reads the feed. Not good. No "first posted" date, and no "last updated" date makes a cranky Laura.
  • Lastly, more speed, a way to see how many users are subscribed to a feed, and a way to mark entries as read from the list view. Minor problems, but still problems.
If anyone from Google is reading this, pass this along to the Reader team. So, sooo close to being a perfect app for me. But those first two strikes mean I have to still use Bloglines, and I hate having to use two apps when one should do.

Next Item: Dreamhost.

As you all know, hubby-Eric and I sprung for a domain name and new server space. We got space at Dreamhost in part because of recommendations from various folks, and in part because it's a big operation and I hoped that would mean better service/uptime/etc. So far, with some minor flubs, it's been more than worth the price we paid for it. But hubby-Eric has been so busy, it took until today for me to get him up-and-running on all the fiddly bits and such. So I've been immersed in Dreamhost today... and today Dreamhost has had one of the worst outages they've had in a long time. Ah, the excellent timing I have! Now, that's not to say we weren't able to make progress. In fact, the worst effect it's had on us is that we haven't been able to send out e-mail like we want from our domain. But it still strikes me as funny that the one time I get to sit down with hubby-Eric and really spend some time helping him learn the new system, it flakes out on us.

Last Item: Mac Computers.

They are weird. Installing programs is either incredibly easy compared to a PC, or outrageously odd. For instance, we attempted to install Thunderbird, but somehow managed to run it from the file that we downloaded. I really have no idea how that worked. Eventually we figured out how to put the program into the right folder/directory/whatever and get rid of the downloaded file, but it seemed like it defaulted to the wrong way. I thought Macs were supposed to be easier! I guess if I understood Macs like I understand PCs it would be simpler, but man, jumping into OSX from an XP machine is strange going. Hubby-Eric says, "They're quirky. But I like quirky."

Well, back to the fun. Dinner to make... then I suppose we'll start watching the Oscars with lots of fast-forwarding. And lots more to do on our websites. Probably no Ripples Through Time tonight, as I'm too teched up at the moment. Who knows, maybe I'll recover.

Wednesday, February 21, 2007

Tegan's Tech Talk

I should've seen this one coming. Time for RSS 101, Tegan-style.

Ok, an RSS Feed is simply a file that takes all the entries in a blog and puts them into a standard format. When you publish your blog, an RSS feed is published. A group of programs called "readers" note the change in your RSS feed, and update with your new entry. Anyone using a reader to read your blog then sees your new entry. Nifty!

Aside: RSS stands for "Really Simple Syndication"... when you publish a feed, you are syndicating your blog entries: sharing them with other sites in a standard format.
There are a lot of advantages to using a reader to read blogs. For one thing, I have 300 or so blogs I want to read. Going to each and every blog to see if they've updated every single day would be a pain. With a reader, I see only new entries since the last time I checked the reader. That makes it really easy to read 300 plus blogs in a fairly short amount of time as I can quickly see which have been updated. In addition, most RSS Feeds show full entries, so I can usually read the whole entry in the reader instead of needing to visit the blog itself.

Yes, I still visit blog pages themselves. Usually to comment, or to view images that don't show up in the reader (some methods of preventing hot-linking prevent feeds from showing images). But most of the time, when I read blogs, I use my reader and get through them quickly.
Aside: Using a shared service (like Bloglines or Google Reader) to read feeds is good netiquette, because the service only has to visit each feed once to retrieve the feed for thousands of users, thus saving bandwidth for the publisher of the feed.
I prefer reading blogs this way. It's faster. I don't mind people reading my blogs through RSS feeds. Some people do mind. They want people to visit their site, so they get the hit on their site or so you'll see the advertising they put on their page. But it's rapidly getting to the point that I won't read a blog if there is no feed for it, because I read so many blogs I wouldn't be able to keep up without feeds.

So, suppose I've convinced you to give a reader a try. From my e-mail, I'd say I got at least one person interested. Here's what you need to do. Go to one of the readers I've mentioned, Bloglines or Google Reader, and look for a bit that says "Add" or "Add subscription". Click on that. It'll ask for a URL. Put in this: http://realtegan.blogspot.com/atom.xml. That's the feed address for this blog. It will give you something to start with.
On Google Reader you could also start with a pre-defined "Bundle" that they've set up (next to "Add subscription", click on "Browse" and then pick a bundle).
Almost every website that updates an a regular basis now has a feed. You can often spot them by looking for "RSS", "Atom", "XML", or an orange graphic. Even better, some sites have feed for particular subjects on their sites. For instance, if you only wanted to read my Ripples Through Time posts on a feed, you could use this link. Many browsers have the ability to search for feeds on a site, and will allow you to subscribe in the reader of your choice with a click. In short, you should not have difficulty finding feeds you would be interested in.

Once you have a feed or two, play with the program. Check the entries, see how they are displayed. Decide if you want to read blogs that way. Every entry should have a link back to the blog site itself, so try using the links to visit the original blog. Explore. I don't really know what else to tell you at this point, because at this point I've usually gotten so interested in the new program that you'd need a crowbar to remove me from my computer. I know most people aren't like me, but if you haven't got the hang of it yet, I'm unlikely to be able to give you useful tips.

I will mention that when I started using Bloglines, I only had a handful of blogs in there, all the others I still checked by hand. Eventually most of my blog reading migrated over to Bloglines because it was just so much easier to keep up.
And that's it for this boring edition of Tegan's Tech Talk. Regarding yesterday's entry that spawned this followup, Google Reader is DEFINITELY winning. Except for blogrolls, it has everything I need, and except for subscriber counts, it has everything I want.
To finish off the post, how about some of my favorite feeds? In no particular order, and leaving tons of great feeds out: The Aquaman Website, The Aquaman Shrine, AiT/Planet Lar, Brian Wood's Livejournal, Bully, Mike Sterling's Progressive Ruin, Girl Genius (main storyline), The Modulator, Paul Cornell, Rashy's Livejournal, Journalista, Bad Astronomy, Snopes New Urban Legends, CNN Top Stories, Pen-Elayne, The Johnny Barcardi Show, Jeff Parker, Boing Boing, MetaFilter, and Slashdot. These are just a handful of the sites I check every day thanks to my RSS Readers.

Tuesday, February 20, 2007

Tegan's Tech Talk

I've been using Bloglines to quickly read my blogs ever since my Blogmama Elayne introduced me to it years ago. But several sites I read (in Bloglines, no less) have directed me to Google Reader as a viable second option. I've been having minor problems with Bloglines for a long time... not enough to make me dump them (since I'd found nothing better) but definitely enough to make me willing to look at something else.

Here's my thoughts, as I go through the new Google Reader... First off, before I even open the thing, I'm thinking how Google is slowly taking over my life. Their e-mail system is better than many others (I love being able to put emails in multiple "folders" with the labels function, and the spam filter is better than just about anyone else), I use their search engine almost exclusively, and they've bought Blogger. Despite their mantra "Don't Be Evil", they've made some very depressing choices regarding politics and internet freedom. Hmmm... do I really want to turn over my blog reading to them as well?

Ah well, here goes. I poked around the site a bit, constantly being told that there was nothing to see because I wasn't subscribed to any feeds. I finally figure out to click on "Manage subscriptions" in the hopes I can import my feeds from Bloglines. Under this page, there's an "Import/Export" tab. Lovely. *click* Hmmm, must export from Bloglines first. Hey, it says I can "Learn more about exporting your subscriptions from another feed reader." Ok, *click*. Bloglines export instructions. I follow the instructions. Go back to the "Import/Export" tab. Import the file I just exported from Bloglines. WHUMPF! I've got a bunch of feeds. Back to the main page!

Ok, it appears to be an unsorted mess. Of course, the first time you go into a new program, it always looks like an unsorted mess. I'll give this system a chance. First thing to do is mark everything read. I've already read them all in Bloglines, don't want to read them all again. Lucky, there's a "Mark all as read" option. So I start with that. Ok, the sidebar has my subscriptions, good... and they are listed under the "folders" I had in Bloglines. I minimize the folders. Looks better. Ok, new items are appearing, so I can see what happens.

Top of the left sidebar, "Home" item. If I click on that when there are new entries, it gives me a summary of some of the new entries. Not bad! "All Items" shows me the entries, apparently organized by whatever is newest. If I click on a folder, I get just the entries in that folder organized by whatever is newest. So far so good. Bloglines let me sort by feed, but this is good too.

Oh, hey... at the top right there is "Expanded View" and "List View"... I think I prefer the "List View". It shows me the title/first lines of entries, what feed it's from, and time of update. The "Expanded View" shows the whole entry. I can see more entries with "List View", and when I click on a title it expands to the whole entry AND marks the entry as read.

In Bloglines, if I want to save an entry to link to later, I click on the "Keep New" option. There's a "Clip" option, but it requires moving to another tab, and I haven't used it. I prefer everything right in front of me. As usual, Google keeps users in mind and has a "Star" option. Mark an item with a star, and you can use the third option on the top of the left sidebar, "Starred Items", to quickly view everything you have saved.

Not sure what "Shared Items" is for yet, must play around some more.

Ok, entries are sorted by when they come in. This is very different than Bloglines, but all things considered I think I prefer it. And it looks like I can put a single feed into multiple folders, because the folders are just labels, like in Gmail. That could come in VERY handy.

No way to edit subscriptions to only look for new entries and not updated entries. Hmmm. I wonder if that has anything to do with the way this system stores old entries? It sure looks like it keeps EVERYTHING, which is really nice if you tend to read a feed item and then 20 minutes later think, maybe I should blog that, only to be unable to find it on Bloglines, because Bloglines makes everything vanish once you've read it. Ah, there is an option to show only new entries in Google Reader, good. I can have it both ways.

Another advantage to seeing everything... I can see when some of these blogs I have sitting in my feeds were last updated. Some of them haven't been updated in months. I'm going to have to have a good cleaning here soon. I can't do THAT in Bloglines, and I've requested it from them before.

Hrm... site is a little slow. Massive amounts of code, or massive amounts of people hitting it?

I use Bloglines as a blogroll for one of my pages, and I wouldn't mind doing that on other pages. Can I do that with this system? Doesn't really look like it... at least not the same way. It appears that in order to make something shared, I have to mark the item shared, then either direct people to my sharing page, or create a "clip box" javascript app that shows the latest items I enjoyed. Which would be fine if I only wanted to link to items, but doesn't do much if I want to link and comment on them, which is much more my style. Still, a page of links I find cool could be useful. I'll have to ponder this one.

How many people are subscribed to my feed? I can't see a number on any feeds, like in Bloglines. That's another annoyance.

Ok, summary time:

  • Bloglines: has blogrolling capability, shows how many subscribers are on a feed, allows you to view and edit feeds (including ability to not see items that have been updated).
  • Google Reader: has multiple viewing modes, doesn't remove items (just marks them read), has easy way to highlight items for later view, sorts subs in a folder by last updated, allows you to put feeds into multiple folders.
Hmmm. I'm going to give the edge, by a fraction, to Google Reader. I'll probably use both for awhile, then switch to whichever suits me best in a few days.