Archive for Programming

Sudo lets me edit all kinds of nutty things!

Still learning how to do as many things as possible from the command line here, am writing this down for future reference for myself. If I try to edit a file, and I’m all like “vi filename” and I do my edits and am all like “:w”, and it’s all like “no, you need to use a !” to save! And so then I’m all like “:w!” and it’s all like “E212: Can’t open file for editing.” That’s when I need to edit that sucker as root. Which means I shoulda typed in “sudo vi filename” and then my password, and then I can edit that file like no one’s business!

Using the jQuery clone() method with a lightbox

So I’m using Flexslider, which is a jQuery slideshow with some great touch capabilities. However, it only displays one slide at a time, so I hacked at it until I got it to display 3. Of course, only later did I realize that someone already forked it on Github like 2 months ago and did this before me, oops. Anyhow, Flexslider uses the clone() method to pad out slides at the end of the slideshow, and, with the modified script, these cloned slides get displayed.

So I’m using Lightbox (the Lightbox2 module for Drupal 6, to be specific) and it’s not liking those cloned slides. Nope, not at all. Doesn’t work. Have no clue why, and couldn’t really find anyone else with that problem on the internets. What I did figure out, though, is when you call clone, if you call it with the parameter of true: clone(true). And that seems to work, as my cloned slides now open in lightboxes. So, yay!

Distraction is the name of the game, kids

Nanowrimo is in full swing, and I totally hit 35,000 today. It’s so much easier to write (for me, at least) choose your own adventure books than regular books. No more deciding which direction to take, I can just go in every direction! The story’s pretty meandering so far – I like trying to tie in details from each path with other paths, so that characters can still get pretty fleshed out. And, so, a decision you make will influence decisions other characters make as well. But, I’m afraid that’s for later. I’m kinda short on endings so far – my main character (named “Mary Sue”, haha) has been killed once, hospitalized once, and had a few romantic encounters, but that’s about it. When I first started this endeavor, I had all sorts of lofty ideas about doing literary tie-ins with non-main characters (mostly because Snow Crash is the Best Book Ever and so I wanna gonna slip in Hiro and YT somewhere, and then branch off in other fun ways) but so much for loftiness. I started off with characters that reminded me of pop culture references (an Anthony Michael Hall a la John Hughes kid, along with a Rickie from My So Called Life character). But then everything sort of started devolving when I started naming new love interests after Colorado Rapids team members. And somehow added in Jersey Shore people as well. Hah! It’ll get cleaned up later, I’m just trying to pump out the content. Writing is rather like making pottery. The first draft is really just piling a giant lump of clay on the wheel, the real work is in the editing.

Am headed to LA for Turkey week, that should be fun. I will be paying a big chunk of Stupid tax to the local Apple store during that time, where my Mac shall sit for that duration having it’s keyboard repaired. Though it means NaNoing on my teeny netbook, I’m looking forward to not having a laptop for awhile, as it will make it near impossible to do work for my job. Considering I haven’t had a sick day where I didn’t have to still work, and I was crouched in the corner at the HP theme park in FL last spring, supposedly on vacation, doing work, it’ll be nice to have absolutely no way to do work. I am struggling with some serious burnout issues, and am really hoping that this break (along with my upcoming week in Richmond) will help.

Speaking of that week in Richmond, I’m not going to insanely plan it like I have other trips. This is because I want to be lazy, and it’s not like I have a car to use (not really looking to rent a car for the week, and the trips mostly to see my parents, who I haven’t seen since last September, anyhow).

Not too much else going on. Now that I’m writing more, I find that I’m reading more. Which is a good thing. Am kinda cracked out on sleep, which sucks. I look at this laptop and my phone too close to bed, which messes me up. So I’m trying to shut them off earlier, and read before bed. But now I’m waking up an hour before I need to, and then dozing off again 10 minutes before my alarm. I just want a decent night of sleep, but that’s been proving challenging. It’s even more frustrating when my body doesn’t cooperate on the weekends as well, as I super depend on weekends to try catching up. Oh well.

I need more time. I want to learn Ruby, and then rails. Possibly Python as well. Every day I am reminded of how many things I don’t know, and it drives me maaaaaaad. I mean, I guess it’s good, if I knew everything what would be the point of getting up. I just feel like unless I’m actively learning new things and producing new things, I fall behind, which is super stressful.

I need to go skiing or snowboarding. I got pants to do so, and have yet to experience either. If needed, I’ll look for a Meetup group that’s doing the beginner’s version of one or the other, with hopefully a carpool involved. I’ve been rear-ended once up in those mountains, and my little car is mountain-shy still!

On a final note, I ate all of the chocolates and now have none. Dang!

Joomla on Windows Server 2008 running IIS 7.5: “could not instantiate mail function”

I hate it when I do a google search and can’t find what I need, so I’m mostly posting this so the next time I get this error, I can do a google search and find the post I made about this error in order to fix it. Yay internet.

Should the error “could not instantiate mail function” pop up when using Joomla and doing something that requires using php mail(), and you happen to be using a Windows server (2008, running IIS 7.5 in my particular case), there’s a good chance you (or I, as the case may be) restarted IIS at some point and your SMTP server never bothered to restart itself. If you’re like me, you had to set up SMTP in IIS 6 for some bizarre reason, so open up the IIS 6 Manager, check if your SMTP Virtual Server is running, and if not, start it!

To test if it’s running without filling out a form or whatever, either put together a sweet little php file that spits out “yay” if email sends or “nay” if not, or just try “Forgot Password” in Joomla and see if you get an email.

Yay!

Joomla: How to get a user’s K2 group

Joomla’s been driving me crazy lately, I’m sticking this code here for future reference so I can find it again, and in case someone else needs it for whatever reason. Use this to grab the K2 user group that a user is in with a Joomla install (works for 1.5, not sure about older/newer versions).

Enjoy!

$user =& JFactory::getUser();
//name of K2 user table
$k2usertable = 'nua_k2_users';
$userId = $user->get('id');
// get user Group
$db =& JFactory::getDBO();
$query = "
  SELECT ".$db->nameQuote('group')."
    FROM ".$db->nameQuote($k2usertable)."
    WHERE ".$db->nameQuote('userID')." = ".$db->quote($userId).";
  ";
$db->setQuery($query);
$userGroup = $db->loadResult();

//the user group's id
echo $userGroup;

Jurors, Food, Work, Life, Etc..

I feel pretty awful for the jurors of the Casey Anthony case, and am looking forward to this whole thing dropping out of the spotlight sometime soon. For those that don’t know, I was on the jury for a murder trial a few years back. It was a fairly short trial, 3 1/2 days including deliberation. Both educational and difficult, and I hope I’m never on a murder trial ever again. My wooziness to blood/wounds made it very difficult to not get lightheaded and pass out during the part where photographic evidence was being detailed to us. Anyhow, we were pretty sure the accused was guilty. However, the defense was relying way too much on forensics and completely ignoring other things, and in the end we could not say beyond a reasonable doubt that he was guilty. So we went with the verdict of “not guilty.” And, it was so awful to leave that courtroom while seeing and hearing the victim’s family’s reaction to our verdict. But, it would have been so much worse if the accused actually was innocent, and we’d decided he was guilty. Being on a jury is tough, and I’m sure so much more so for a high profile case, so people really need to cut those jurors some slack.

So. I’m living in a motel right now. Some who read this know, some don’t. Drew and I broke up over a month ago. I’m moving into an apartment in Capitol Hill in about a week and a half, incidentally on the same day that Carolyn will be flying out to visit for the weekend. Things have been…weird. Sad. Strange. Am still dealing with it, and likely will be for awhile. People have been very supportive though, and I really appreciate that.

I miss having a kitchen. I got to use Jonathan and Jill’s kitchen a week back and have a sushi party with them, which was fun. Got some really good salmon, here’s a shot of some of the salmon rolls:

sushi

Work’s going OK, though I’ve been staying up late a few more nights than I’d like dealing with the persnicketiness of HTML emails. HTML emails are definitely one of the lesser appealing things that I do. One thing that I’ve been doing lately that I hope to do more of is developing for mobile websites. There’s a great Drupal module called Mobile Tools that will switch your theme based on mobile device detection, and with that plus playing with the JQuery Mobile theme, I’ve been working on the mobile version of my work’s website. There are of mobile design is so new, I think there’s lots of opportunities to do cool stuff. I’ve also been dying to actually contribute a Drupal module to the Drupal community, and am hoping I can find something good to contribute involving mobile.

Am hoping to do some packing today, I’m trying to get rid of stuff I just don’t use – I hate having lots of stuff, and moving it is a big pain, so I’m trying to better justify the things I own. Super fun times.

Incompetency. Or, WYSIWYGs are the Devil.

I don’t like WYSIWYGs. This is because the “I” stands for “isn’t”. The specific ones that cause me angst these days are the ones designed for CMSs and email builders, which supposedly allow non-coders to build fabulous looking pages and emails with no knowledge of code whatsoever. And this wouldn’t necessarily be a problem, if WYSIWYGs were nice and paired down to the basic necessities of “add a link” and “add a picture” and “stick an ordered list here” and other really simple choices to help fill out the content of an already nicely designed site. Or, if in the case of the disgusting behemoth WYSIWYGs like TinyMCE(AKA the in-browser Second Coming of Frontpage), the content editor simply ignored all the superfluous buttons and stuck to what is safe.

But no, they have stacks and stacks of mostly unnecessary formatting, all sitting there just itching to make whatever you’re trying to build just a little bit uglier. And the problem is that those who do not know the evil of a WYSIWYG think it gives them power to create mighty, complex, and beautiful layouts. Then, when their beautiful layout turns to gobbledygook, they hand it off to someone else to fix. Incidentally, content editors who either know some html or are willing to learn are awesome. They’re more likely to know better then to dump table into table and format text over and over until there’s approximately 123127836 nested span tags, then try to “fix” the formatting mess by copying and pasting some stuff from MS Word. What really bugs me, though, are those who treat the idea of using HTML like an upper manager treats the idea of using a copy machine. Faked incompetency is crap.

If a text editor is really necessary, stick a simple one in there that inserts the HTML tags for you, like the “html” tab on this here WordPress text editor. What I’m really hoping is that this is just a temporary technological gap, and it’s just a matter of waiting until either someone makes a WYSIWYG that actually works properly (hah!) or writing basic HTML becomes as common as cursive used to be.

Hoo Boy do I suck at updating this thing!

I am so tired, like giant sponge tired. See, we went to this club this past Friday. I’m all like “Goth night at a gay club, I’m there!” I start sneezing uncontrollably after one too many inhales of the ole fog machine. The next day, it’s still going, except I have a headache. While I have my doubts as to if one can catch colds from fog machines, I’m pretty sure one can catch colds by being in the vicinity of drunk and sweaty people. The nose has calmed down a bit, but I’m stuck with this headache and some of the worst kind of fatigue.

How convenient, I suppose, that my temp job has slowed to nothing? I’m due to come back in at *some* point to fix something, and then there’s still hope of future projects, but it’s pretty sporadic, which is unfortunate for those of us who like paychecks. I’m trying to take advantage of my time off, at least. Last week that mostly involved too many cookies and a serious time investment into the long-forgotten Civ III. There were progress nuggets buried in there somewhere, though, mostly consisting of continued work on the Pak’ma’ra painting, plus some planning for the (hopefully) visionary new Salami Day site. We’ll see.

A chunk of Drew’s relatives came to visit last weekend, and left in their wake a vast array of uneaten Indian food. My new favorite thing is Korma. At this point, I’ve only had Lamb Korma, but I’m sure all of the other varieties are just as delightful. My Other New Favorite Thing is Bhakti chai, which I desperately need to write a tastyniblets post about at some point. It is everything chai should be and more. I apparently need to seek out a Natural Grocers where they sell Bhakti chai ice cream, it sounds incredibly magical.

So I really hate WYSIWYG editors. I need to find one that works for Drupal, though, as for some bizarre reason people who don’t know html really like them. I’m all like “learn html!” and they’re all like “no way!”. Sigh. I’ve crushed through the rather-generic one titled WYSIWYG, it looked messy and did little for me. Then I switched to WIZZYWIG, which I had high hopes for. Unfortunately, the admin panel was limiting, with poorly written textfields where the max size was far shorter than one needs. I poked the js to get around this, which was fine up until the point I realised I needed the ability to upload PDFs. On to CKeditor! Testing that out now, I’m hoping it’s the editor that will make all of my fantasies come true.

Social Icons Font Set

So there’s all these websites that have little square icons allowing you to RSS the site, link the site to another site, etc.. I’d been reading about CSS’s ability to include a font in your stylesheet using @font-face, expanding the number of fonts you can see on a web page beyond just the standard set. I was thinking it would be neat to have an RSS symbol that was a font character rather then an image, so I downloaded FontForge. At some point in all of this I decided to convert a bunch of the most often used social networking icons into font characters, 26 in all. Useful for embedding into websites, or just for dumping into Photoshop to make your own icon images. Check them out!

I used CSS3 to spice them up. These are not meant to be a font set in and of itself, but more of my playing with CSS to explore the possibilities. Also, if you are viewing this in IE or an older browser, the icons may look a bit bland.

There is a lot that you can do with “box-shadow” involving layering shadows of different offsets, radius widths, and colors. I was particularly happy with how the LastFM icon came out.

I really wish there was a means of using CSS to apply shading directly on top of text. As I know of no way to do this, I had to figure out other means for icons that require multiple colors. The Picasa logo uses 5 different colors in the logo on a white background, so I instead made a 5-colored background using box-shadow and placed a white logo on top of that. This has it’s limitations, though, as I couldn’t quite get the green background segments of the Newsvine icon to look as they should.

There’s no way to outline text using CSS, but you can create an outline using by layering multiple “text-shadow” elements together, offsetting them in all directions around your text character. I used this on the AIM, Yelp, and Netvibes icon. This isn’t a perfect method, as you can tell by the jagged edges on the AIM icon. It works quite well on 90 degree angles, though, as you can see from the Netvibes icon.

The biggest pains were the Flickr and Delicious icons. Delicious is simple in that it just uses two squares, but it’s two differently colored squares. So I made one solid and the other comprised of lines, and hoped for the best. It’s still a little odd looking as it currently is. The Flickr icon is the same situation, but with circles instead. Most of the icons exist as just link html, but this one is a link within a span tag. I set the font character to be a blue, and then the link’s left margin to be a negative value, meaning you only see one of the dots. I used “text-shadow” to create the pink circle on it’s right. Incidentally, this is the only one I couldn’t figure out an IE CSS hack for, so it’s not quite usable in IE if you want the Flickr icon in it’s multi-colored glory. StumbleUpon was also a pain, and one I still don’t have looking quite right.

These icons are not all that ideal right now, and here’s why: First off, IE does not support CSS3 tags like text-shadow and box-shadow. Meaning that, though these are for the most part functional in IE, they’re not all that pretty. Also, not every browser supports @font-face right now. If this entire post is confusing to you, as all you see in the icons above is the alphabet, you’re probably using one of those browsers. I look forward to all of these things being adopted by the browsers that currently don’t support them, which will hopefully be sooner then later.

View a page with just these icons on them, or download a zipped file of the HTML, CSS, and fonts for these icons. Or, you can download just the font from the Open Font Library.

I’ve also got the icons posted here on varoper.com, essentially showing everything already displayed in this post, but with far fewer words and minus the fabulous yet jarring fish background.

On Writing, Designing, Games, and Beer

So I had this dream last night where I was a character in some Bleach episode, and I was trying to build PDFs out of CNC router parts. This sums up my last couple of weeks pretty well.

The website is launched, though there are still things that need to be done to it before it is finished. Still, I now have the time to get back to working on my other projects. I’m about halfway done with the font I’m working on. I now have piecemeal Drupal modules that I would like to clean up and stick on their site. I also again had the revelation that my professional website looks bad and needs a makeover. I get that revelation on a regular basis. This is good in that I’m constantly a.) learning more about design and programming and b.) upgrading the website to reflect that knowledge, but is a pain because this is a chunk of work to have to do on a regular basis. Am also thinking of shifting it into Drupal, to give me another Drupal site and to give me more Drupal experience. The site is just straight PHP right now, before that it was built with the ever popular duo of M4 + shell scripts. Which made me feel pretty cool to have a site built in them, but was not all that applicable to the job direction I was trying to go in. Oh yeah, I also have my super-cool new site idea that I wanna build and launch at some point. And there’s still converting the rest of the php into classes at Writaur.com. And making a version of Storypath that uses gamebook/rpg character elements.

Apparently none of this was as important to get done as beating Peggle Nights yesterday. It’s a free download if you create an account at PopCap games and say “yes” to getting a newsletter. Not nearly as exciting as Oasis, but it’s still pretty fun, and is apparently effective at distracting me from the pile of things I have to do. I’ve still got most of the “Challenge” levels to beat, so it will pose as a potential distraction for awhile to come, I suspect.

I made it to the second round in the Amazon Breakthrough Novel Contest! The first round was where they read your 300 word pitch for your novel. 1000 people get to go on to the second round, and as they accept only 5000 entries, and the Young Adult category was a new one for this year, there’s a good chance I was accepted for my lack of typos and misspellings. Still, I was in the top 20%, so that’s good. The 2nd round is where they read the first 3000-5000 pages of my story. I really hope the style of the novel won’t be a hindrance – as it’s a “Choose your own adventure” style book, and the contest requirements said it had to be the first 3000-5000 words, so they will be reading a rather disjointed story indeed.

And on a final note, tonight will involve beer. Apparently the Coors factory is about 15 minutes away from where we live, and a coworker of Drew’s invited us to go take the tour. Seems that they’re very generous with their free samples, and the end of the tour involves being able to try up to three of their products. We still need to determine the “Who’s driving?” strategy of all of this, hopefully the factory is near enough to downtown Golden, CO, that we can stroll around and sober up a bit. The best part about Colorado is that, were we ambitious, there is a path about a 10 minute’s walk away from where we live that we could bike on to this factory. It’s a 9 mile ride, which I don’t think is bad at all, but Drew might have difficulty with. Still, we’ve got a stationary bike that he’s been using, so maybe come Springtime we can try the ride and see how it goes.