Ipod Shuffle and Keeping up with the Podcasts

Posted by sergio_101 on Feb 22nd, 2008
2008
Feb 22

ipod shuffle smart folder

i got an ipod shuffle yesterday. at first, i was taken aback by the simplicity of the interface. not just that it has no display, but the amount of fiddling that you can do with the playlist is very sparse. you really can just attach to it, fill it up, and move on.

i was talking to my brother, and we both wished it had a facility to let you grab the newest three podcasts from each of your subbed podcasts. that would be a really cool way to go. unfortunately, there is no such thing..

this morning, in the shower, i remembered that the itunes library is just an xml file that is well defined, and super simple to whip through. my first instinct was to just write some ruby code that jumps into the xml file, and makes this kind of playlist.

then, reality set in.

as far as i know, itunes uses this file to mess with its playlists and listings. i don’t THINK it’s generated from another source, but i am not keen on running the risk of messing it up. thinking further, i don’t want to let some source code out that might possible mess up someone else’s itunes library..

i will think about this a little more, and maybe take a whack at it..

but for now, here is a smart playlist that will do something similar. it gives you a list of 25 of the newest podcasts that are less than 4 weeks old. i will mess with this a bit, and see if it works for me.

if i find that the itunes library xml file is not read, but only generated by itunes, i will think about messing with that, too..

let me know if you find this useful..

loading huge sql files into godaddy

Posted by sergio_101 on Feb 1st, 2008
2008
Feb 1

the problem

for the past year or so, we have been suggesting that all of our clients use godaddy for web hosting. for as long as we have been suggesting them, we have not had any problems with them.

the one beef i have always had with them is that it is a huge pain to load up a mysql database from a sql file. for pretty much all of our sites, we use typo3 as our content managment system. this system produces a fairly large sql file. one of the tables in that file (a caching table) is way over 2mb. this means that we can’t split it up to upload it to phpmyadmin. the other problem is that while the control panel says that it supports zip, i can’t, for the life of me, get it to work.

the almost solution

in the past, what i have done is upload the sql file to a remote directory, then get on the phone with godaddy tech support and BEG them to load up the file. this is a really big pain for everyone involved, as there is alot of naming schemes and questions that everyone has to agree on before anything can happen. they are extremely cautious when doing this (as well they should be), so this can take an incredible amount of time to plow through.

after about a day or so, i finally end up with something workable, and we can move on.

the final solution

after going through this many times, i remembered a command in php: “system();“.

this command allows you to feed a string into the command line, and have it evaluated. you are then returned whatever the response to the command is..

so, all you have to do is make a php file with something like this in it:

[sourcecode language=’php’]

'; //in this line, the DBNAME is the name of the database you are populating //the databse.sql is the file you uploaded .. change those names to something //that makes sense $command = "mysql DBNAME < datbase.sql" $last_line = system($command, $retval); // Printing additional info echo '
Last line of the output: ‘ . $last_line . ‘
Return value: ‘ . $retval; ?>

[/sourcecode]

so, here’s how you do it:

  • upload your sql file to a unique directory. make it a temp directory, so you can just delete the whole thing when you’re done.
  • upload the file with the php code above to the same directory.
  • using your web navigator, go to the php page you created. this will automatically run your code.
  • take note of anything weird that shows up in the output, but chances are, everything will go just fine.
  • delete the entire directory, to make sure no one accidentally overwrites anything.

some notes

in most cases, when running mysql from the command line, you have to add “-u username -p password” to authenticate you as a user. with godaddy’s hosting, simply running “mysql” logs you in with the correct credentials. if you try to specify credentials manually, it will flop.

hope that was helpful to someone out there!

back to mail.app after a month of gmail

Posted by sergio_101 on Aug 16th, 2007
2007
Aug 16

at first, it seemed like a great idea. moving all my email handling online.. into one easy to use system. i gave it a good solid try, for a month, but as of yesterday, i am using mail.app again, rather than gmail. there are a few solid reasons:

  • there are times when i need to see an email right away. when someone is sending me something mission critical, or i am waiting for some sort of confirmation. gmail checks your pop account every now and then, but you have to jump through some hoops to get it to check it right away.

  • managing multiple signatures is a pain. yes, there a greasmonkey script that lets you do this, but it’s not quick and natural.

other than that, i really liked gmail. my favorite parts were:

  • check your email from anywhere… even from your phone!

  • tagging - google has tagging hooked up. tag and archive.. and your mail is there, and easily indexed.

  • indexing - gmail mail searching is VERY fast. searches give results in a blink. mail.app takes awhile to check through mail. this very well could be because i have had mail.app running for years, and there is alot more to index, but i am not sure.

so, here i am.. back on mail.app.. and we’ll see how it goes…

tried ubuntu for a week - back to mac

Posted by sergio_101 on Aug 15th, 2007
2007
Aug 15

okay, i am officially back on mac.

for those of you following along, you will know that i have spent the last few days once again trying to make a go using linux on a laptop. there are a few reasons why i have decided to ditch this idea. sure, i did my time and figured each of these out, but there were some HUGE annoyances that i didn’t want to spend any more time dealing with.

they are as follows:

  • printing - we use a ricoh networked printer here at work. my mac saw it, and just started using it without any problems. ubuntu couldn’t find the right drivers, and after awhile, just flat out gave up. i am sure i could deal with this if i threw more time at it.. but well.. time IS money.. and screw that..

  • sound - thanks to a few great websites, i recompiled alsa, and got my sound working correctly, but there were still a few things that were major annoyances. when you put headphones in, it was a crap shoot that the laptop speakers were gonna turn off when i wanted them to. fiddling with the volume was a HUGE pain.

  • no quicksilver - okay, this is something that is kinda wussy, but i have grown to rely on quicksilver. i cannot do without it. period. i refuse. i know this is not a real OS thing, but this is a tool that helps me get stuff done quickly, without thinking much about it… and breaking my train of thought.

  • no textmate - i absolutely love emacs. for lots of things. but there are things that textmate just does WAY better. rails development, blogging, and quick edits here and there. there is just no match for textmate when you need to get shiz done quickly and easily.

  • display - at work, i run a big display. when i get to work with my powerbook, i just plug it into the big display, and whatever i was doing snaps right back to life on the new machine. no problem. with ubuntu, i had to reconfigure X a few different times to get the correct resolutions to work. not that it was horrible, but there is no possible way that a newbie could do this without sharting himself. when i got it running, the screens ran in mirror mode. getting them to switch was a nightmare. i also had to restart X every time i needed to attach the new screen. it was easier to just reboot.

  • ipod - i was TOTALLY shocked out how great the ipod support was. it could play all the files, but i couldn’t get it to give me a random playlist while excluding podcasts. that was kind of a deal breaker in that i listen to TONS of podcasts and TONS of random playlists.

  • other display issue - this is no slight on ubuntu at all, but my display on my powerbook rocks. the display on my lenovo sucks. i can’t stand looking at it any longer. it does look okayish in ubuntu, but when you plug in a real screen, you can really tell how lacking it is.

  • The automator - yeah, all of us real programmers know that the automator is gay. it’s not programming. but for programmers, we get paid to get stuff done, not just to write code. the automator has saved me HOURS millions of times. enough to make it worthwhile.

  • Simplify Media - for those of you who run itunes and like to share playlists, this allows you to share them across the internet. i just discovered this a few weeks ago, and was having major withdrawals.

  • Hibernate - no matter what i did, it was a crap shoot as to what was gonna happen when i shut the book. with the powerbook, it just quietly goes to sleep, and when i open it up, it wakes up. with ubuntu, it would either wake up correctly, or the battery would be dead. i messed with it for awhile, and it seemed to work, but i was never SURE that it would open up where i left off. the whole week i used ubuntu, my powerbook was shut off in my purse. this morning, when i officially came back, i hooked up the power (battery was dead) and it sprung back right where i left off.

All that being said, there are a some things that i LOVE about ubuntu. i will keep it on this laptop (and probably upgrade to ubuntu studio via some scripts a guy posted). i have not used linux as my sole OS for a year or so (i do this alot) but i was impressed at all the new stuff:

  • wireless networking - laptops are tricky, but there was a ton of info on how to get my wifi working. it took about ten minutes, and it worked great.

  • sound - sound was always a big pain. not anymore. even running a laptop, i had no problems. i had to recompile alsa, but that wasn’t horrible.

  • music programs - there are a ton of great players now, even native last.fm players that ran without a hitch.

  • browser issues - this was always the deal killer for me. i could never get two things i always use to run consistently: rhapsody and sirius. rhapsody ran fine (although i had to google a bit to get it to work), but sirius was still a no go. there is a program called sipie that lets you play sirius through a neat little interface, but i think the source may be based on an older version of the sirius website, and it’s broken.

  • emacs - since emacs is so embedded into linux so deeply, i ended up using it really heavily and learning a bunch more about it.

  • Support - at this point, any problem you run into has been solved a hundred times and is one or two gooles away.

  • multimedia - plays dvds, sound files, and runs like a full on jukebox with no glitches, hiccups, or delays like the old days.

anyway, i am keeping ubuntu on this machine, but i am not going to be using it as my main work machine. it will be a music production (hobby, not pro) machine.

SimplifyMedia and iTunes sharing, part dos…

Posted by sergio_101 on Jul 23rd, 2007
2007
Jul 23

okay, so i have been running simplify media’s itunes sharing system for a few days, and i have only had one friend on there who was never online. i have no idea who this person is, as the system doesn’t allow messaging.

today, i got another buddy request from someone named ’spleenrock.’ whoever this person is, they have the coolest taste in music.

although i am TOTALLY open to taking anyone on as a buddy, i would really like it if they dropped me an email, and comment on my blog, or an IM.. just so i know who you are…

so, spleenrock.. if you are out there, drop me a line..

and for all others, feel free to drop me ’sergio101′ a line and be a buddy.

Simplify Media - Sharing ITunes over the net

Posted by sergio_101 on Jul 18th, 2007
2007
Jul 18

Interesting find - Simplify Media

One of our biggest pastimes throughout the day is listening to each others’ itunes lists. Unfortunately, this only works for people on your network.

In the past, I have set up my machine at home to be able to access our net, and have access to my home itunes, but the problem has always been that this is a pain to set up. The other pain is that the folks with the wherewithal to set up such a server usually don’t have very interesting playlists (100 hours of nine inch nails is only tolerable for a fraction of that… okay.. a small fraction)..

Simplify Media makes it easy for less tech oriented people to allow others access to their media. Now this is something I can dig. It would be interesting to see how this aligns with the ITunes TOS. I am half afraid to check.

I now have it set up and running, and I need some buddies!

If you are running this, drop me a line, and we can hook up.

My username is: sergio101

for a little more info on this, check out boing boing’s take.

ADDENDUM!

for those of you looking to find some share buddies, you can add the following to get a good start:

sergio101

spleenrock

citykitty

if you would like to have your name added to this list to get more buddies, drop me a comment, and i will put you on here..

PHP and the PayPal API - from 10,000 feet..

Posted by on Jan 27th, 2006
2006
Jan 27

i spent a good deal of time plodding through the documentation to get this thing set up, only to find that the documentation is spread all over the site, and you really have to pull pieces from everywhere.. and alot of them are not 100% correct.. and alot of them don’t fit together..

the biggest problem that the doco has is that there is no view from 10,000 feet. the views are all from the ground.. here are some hints to save you some aggravation..

this is not a comprehensive “how-to” doc.. but rather a gotcha doc.

  • the first thing you do is create accounts in what is called a “sandbox.” you need a developer’s account to do this, but in essence, you are just creating a buyer and a seller account. that’s it. there is no juju here.
  • while you are doing this, you also need to generate fake certs.. write down the passphrase you use. you will follow the codebases and doco to hell and back. by the time you have assembled a workable codebase, you will have forgotten the passphrase you use. i did. on a good note, it’s easy to generate a new one. when you generate a new one, the old one is IMMEDIATELY taken out of service. if you are working on a live cert, there is a risk of disaster on a high volume site..
  • next, you need to install the pear files. for those of you who are not familiar with pear, it is alot like CPAN in the perl world. my guess is that if you are struggling with this, you are probably using this on a shared system. there are special rules for setting this up on a shared system. mostly, this involves setting up paths to the pear libraries. make SURE you install the libraries above your web root so that no one can abuse them..
  • now that you have all that setup, there is a web console that you can use to test your api calls. although this looks interesting and fun, i spent a good amount of hours getting all the path dependencies worked out. after a good afternoon chasing these down, i nixed the whole idea. it would be easier to code bareback here.
  • you will most luck at this point if you just TOTALLY dump the whole set of examples that paypal gives you and go here. there is a good codebase there, BUT keep in mind, there are some problems with it.. when you start running it, and it goes haywire, look for an xpm tag. remove it AND its mate. also, there is a whacked out form tag in there somewhere. move form and its twin OUTSIDE the whole form (they are embedded kinda weird. dreamweaver will bitch like mad about this). fix that first before you go insane.
  • ditch ALL of the POST variable initializations. trust me on this one. there are a TON that don’t really do anything but make you go back and forth about a million times trying to figure out what gets used and what doesn’t. this is all stuff that should be done in javascript OR left completely out of a tutorial on the API.
  • create session variables for your info. the data is passed twice. this is a typo minefield. i found a neat way to do this (after my eyes glazed over for the millionth time tracking down POST variables.) you can see how i did it (and will do it from now on) . let me know if anyone has any comments on this. on my way out he door today, i started wondering if mabye i had a switch on in PHP that allowed you to just call $_SESSION and $_POST variables at will. i remember hearing that you could do this under some configurations. this seems almost as dangerous as putting your weiner in a meat grinder.
  • finally, run some fake transactions. go back to that link on pear. there is a bogus credit card number on there that you will have erased when you set your forms up. you need that because you will have forgotten the fake credit card number of your sandbox account. i spent about ten minutes trying to figure out how to get that back, but i gave up. that other credit card will do. by now, you will have made a bogus express transfer anyway, so you know your sandbox account works.

well, that’s about it. in retrospect, it wasn’t THAT bad.. but it was sort of like those little chinese finger cuffs. once you figure out how to get them off, it all makes sense.. but when you are jammed all up in there, it’s maddening.. let me know if this helps..

2006
Jan 26

here’s a problem i consistently run into..

i am implementing a paypal service that takes the form of three files..

a file to gather the payment data…

a file to process the data, and make sure it is correct..

a file to provide api calls to paypal to process the payment..

the api samples do this the way most every other php script does..

via POST, they send the data to the next form..

in the receiving form, there are some agonizingly LONG strings of the following:

$firstName=$_POST['firstName']; $lastName=$_POST['lastName']; …and so on for ALL variables…

keep in mind that if you proceed this way, ANY time you update your inintial form, you will have to update ANY references to the $_POST call. this sucks..

i dug around for a bit.. and found this..

the first thing i did was take my $POST variables, and map them to $_SESSION variables. i thought for SURE this was alot tougher than i thought. it’s way easier.

session_start(); $_SESSION=$_POST;

will copy the array, and initialize the session variables..

since i used javascript to gussy the data up, there was really nothing to do on this end but to display the data and let the user go back and fix it if necessary..

here’s where it gets cool…

once we get to the api calls, we would, in all other cases, be required to initialize our variables again.. one by one.. based on the $_POST variable.. this SUCKS..

here’s a neat way to skate by this …

there is a command called session_encode() that will serialze your session variables..

once you serialze them, you can just unserialze them using unserialize() and you will in effect initialize all your $_SESSION variables as normal variables…

here’s how i did it:

$vars=session_encode(); print $vars; // do this once, just to see it work.. unserialize($vars);

at this point, you will see that you now have all your variables initialized..

keep in mind that if you change them, it has nothing to do with $_SESSION.. but in my case.. that wasn’t the gist of the thing.. all i needed was to make API calls with them without having to reference them via $_SESSSION..

in other words..

i can use:

$IPAddress

rather than

$_SESSION['IPAddress']

i thought that was pretty neat…

WirelessTroubleshootingGuide - Ubuntu Wiki

Posted by on Jan 17th, 2006
2006
Jan 17

for those of you who are being KILLED trying to set up a wireless adapter in linux, here’s what worked for me..

i am using the D-Link DWL-G520 on some random amd64 box. when i tried connecting to the net on an open system, i had no problems. as soon as i tried connecting using WEP, there were problems galore.. i couldn’t get dhcp to give me an address or anything..

the link about gives a ton of great advice, but the part that fixed the whole problem for me was fixing the auth mode.. i had a feeling that this was the problem as the network utility did not give me any oprions for auth mode.

if you are using WEP-64, you can do this:

iwpriv ath0 authmode 2

then do a:

dhclient ath0

and you should get an address..

if this DOES work, make sure to add it to your /etc/network/interfaces file so it will happen on boot.

pre-up iwpriv ath0 authmode 2

worked for me..

be sure you use the correct interface for your system.. my wireless happens to be ath0… yours might be different..

2006
Jan 15

ALOT of times i find myself on another system and needing desperately to retrieve a log file to send to someone for further inspection. in the old days (before this afternoon) i would usually end up tar-ing the file scp-ing it to my machine, then emailing it to whoever needed it…

i came across a cleaner solution this morning..

at the link above, they go over some really cool command line uses for mail. read the above link if you are interested in doing something like this on a regular basis..

i ended up using the mime section… and my command line when something like:

mutt -s "serverlog file" -a serverlog.txt.gz address@email.com

the only caveat is that mutt will open, and want some input for a body, it opens it in vi, but that’s not that big of a deal.

i thought about making a dummy text file, if i have to do this very often, but i doubt it, as you would have to keep this text file in the same place all the time.

hopefully, i won’t have to be sending this text file too many places..

Next »