Ramblings on technology with a dash of social commentary
RSS icon Email icon Home icon
  • how to track multiple svn branches in git

    Posted on March 3rd, 2014 phpguru No comments

    [Note: This mirrored blog post was originally online at http://www.jukie.net/~bart/blog/svn-branches-in-git If you know Bart, link him here so I can update this citation.]

    I must say that I am no fan of SVN, but SVN and I get a long a lot better since I started using git-svn. Long ago a good friend of mine, Dave O’Neill, taught me how to handle multiple branches using git-svn. I had used that technique until Dave taught me how to do it better.

    Recently I saw this blog post which referenced Dave’s article talking about the first method. I guess Dave never got around to updating his blog with the better way. So I am going to do that here:

    A few of my clients use SVN. Some I am guilty of introducing to SVN. But for this post I need to give you an example that you can follow along with. So let’s use shell-fm — my favorite last.fm client — with an SVN repo located at svn://nex.scrapping.cc/shell-fm.

    NOTE: You should use a modern git release. If git --version is older then 1.5.3, you need to upgrade.

    Let’s start by cloning this repository using git-svn:

        $ git svn clone svn://nex.scrapping.cc/shell-fm -T trunk -b branches -t tags

    NOTE: if you have commit access you may want to modify your svn:// url appropriately.

    UPDATE: --stdlayout is a short form for -T trunk -b branches -t tags, and new versions of git-svn support it.

    This process will take longer then an svn checkout would… a lot longer. There are two reasons for this. (1) you are getting all the history of the project, and (2) SVN has a very slow protocol for this purpose.

    Anyway, once it’s done (it took me about 5 minutes) you will have a directory called shell-fm with the contents of trunk checked out in it. If not for the fact that the .svndirectory is replaced with a .git directory you would have thought that you were using a slower SVN.

    Enter into your new repository and you will see that you have a master branch that is, by default, following trunk.

        $ git branch
        * master

    This is not a git tutorial or a git svn tutorial; but I should at least show how to update your tree, and commit to upstream.

    I would like to insert here an advanced topic of packing your repository. I don’t want to explain it here, see the [man page], but trust me it will make your git experience much more enjoyable if you run the following once in a while:

        $ git gc

    Now, to update your working tree to the latest of the branch you are currently tracking, you would run:

        $ git svn rebase

    This is similar to svn update. There are likely no updates available now, so this will do nothing.

    Next, if you want to share something with the upstream svn server you would run:

        $ vim source/main.c
        $ git commit -m"this is a test" source/main.c
        $ git svn dcommit

    This is similar to svn commit.

    Now, let’s look at these branches I was promising:

        $ git branch -r

    Each of the above is tracking a remote branch in SVN, except for trunk which is tracking trunk. When you run git svn fetch all branches will be updated, and new branches on the remote will be added. git svn fetch fetches the updates with out modifying the local working files (which git svn rebase would). git svn fetch mimics standard git fetch behaviour with an upstream git server.

    Working off remote branches is usually done on local topic branches — that is to say, not on master — but you can use whatever you want as git-svn doesn’t care.

    Let’s thus create a new branch for fixing a mythical bug on the 1.2 branch.

        $ git checkout -b fixing-bad-1.2-bug 1.2

    Almost immediately, and without server interaction, we get a checkout of branch 1.2 contents. You can see where you are with:

        $ git branch
        * fixing-bad-1.2-bug

    If you carefully inspect output of git log you can see that git-svn reveals the branch name and upstream SVN commit ID on the last line of each commit:

        $ git log -1
        commit 308244b0d275db460e3b4527afd51258cece4d33
        Author: strogg <strogg@7df44517-d413-0410-91cf-82ca28b36b55>
        Date:   Thu Sep 13 19:39:51 2007 +0000
            This is a patch from Wisq to make shell-fm accept 302 redirects as well as 301.
            git-svn-id: svn://nex.scrapping.cc/shell-fm/branches/1.2@252 7df44517-d413-0410-91cf-82ca28b36b55

    We are on branches/1.2 commit id 252. If you prefer it, you can even get the svn style log output with git svn log… but why?

    Working on this branch is as easy as working off trunk. You edit, commit, and git svn dcommit to upstream.

    Switching between your local branches is easy…

        $ git checkout -f master
        $ hack hack hack
        $ git commit
        $ git checkout -f fixing-bad-1.2-bug
        # and we're back on 1.2 bug fixing

    Note that you don’t have to push your commits back to upstream immediately, or ever for that matter, to make use of the git repository to store your local changes. But if you do decide to you just need to run git svn dcommit.

    If you’re interesting in migrating CVS to git, have a look at the CVS to git Transition Guide.


  • What? Google Search Isn’t Awesome? Top 10 Reasons Why

    Posted on August 28th, 2012 phpguru No comments

    You know you love Google’s #1 product… their impressive Google web search. If you’re like me, you use it hundreds, if not thousands of times a day.

    In addition to the Google’s basic web search, Google offers Google Advanced Search, as well as a Google Image Search,

    It’s now almost impossible to find the link to Google Advanced Image Search, but it’s still there, and it’s the best way to perform an advanced search for images online.

    You can use Google Search Operators, also called Google Search Modifiers, and they even offer users a whole page of Google Search Tips., including tricks like searching for recipes, using the calculator functions, and lots more.

    But as good as Google’s search box is, there’s always room for improvement. Here’s a list of new and improved Google Web Search features I’d like to see. If you agree with these great feature additions I’ve suggested below, or if I forgot any, leave me a comment! I know I’d use them for sure!

    Top 10 Ways Google Can Improve Search

    10. Starting with something boring and annoying, how about a Tax Forms search? The one at irs.gov is alright, but let’s face it, the government could use Google’s help. The Google search 1040 site:irs.gov year:2011 type:pdf should bring up the obvious result I am after. It doesn’t. Google could help me spend even less time on the IRS website than I do already, which would be a very good thing.

    9. Music Search. There’s no way to search music available in iTunes, without launching iTunes. I love music, but the search capability of iTunes and other music programs is terrible. Let me flag a song or album for later, like a wish list, and remind that I liked it. Integrate with all the streaming services like Pandora, Slacker and such. Give me Search Operators like artist:justin+bieber or label:interscope or genre:thrash+metal. (That’s three different search examples.)

    8. Melodic Search. Create a musical instrument interface with which to perform song searches. As a play-by-ear pianist, I can never remember the lyrics or the names of songs, but I can play the notes! Let me play notes on an on-screen keyboard, or with my attached Midi keyboard, and find music matching the musical notes I am playing. For example, if I play C . . G C . . G C G C E G –> Google should pull up Mozart Eine Kleine Nachtmusik. This is easily implemented with widely available MIDI data.

    7.  Advanced Video Search. To perform an Advanced Video Search on Youtube now is an exercise in aggravation. An advanced YouTube search that worked would be really cool. Give me all the fields as operators, too, like views:1M or maru type:video views:2M..5M by:views ord:desc. This should show me maru clips between 2M and 5M views ordered by views descending. This search actually returns an incredibly random assortment of useless junk.

    6. Expert Search right from the Google.com home page. Upgrade the advanced search operators, giving power users like me the utmost flexibility. For any input field on the advanced search or advanced image search, create an Advanced Search Operator for it. For example, why can’t I find cat exact:lolz type:gif w:128 h:128? I clearly am after an exact search of funny cat gif icons. I should be able to easily guess the “colon operator” for any advanced search field, and why not show me what it is when I hover over it on the advanced image search form so I don’t have to go find an obscure help doc on a different website on performing an advanced Google search.

    5. Create Search Templates — Let me save and share advanced search filters and advanced images search filters and use them for later. For example, it can take a few minutes to set up a good advanced images search. Why not let me store the following for easy retrieval… for example (site:a.com OR site:b.com OR site:c.com)  (type:jpeg OR type:png) (size:2mp..4mp). Clearly I am looking for jpg or png images betwen 2mp and 4mp on 3 specific websites. As a designer, if I could save those search parameters and re-use them, I could easily load it up, add a keyword, and save hours every year.

    4. How about a Movie Search? Just buy IMDB.com , Blockbuster.com and RottenTomatoes.com and combine them. You know you want to.  Your current Movie Showtimes Search is very embryonic. Is it too much to expect that type:movie (actor:judd+nelson AND actor:molly+ringwold) could find The Breakfast Club and 16 Candles? Results: ho-hum.

    3. You can’t have a movie search without a Celebrity Search. It amazes me that I cannot set up an RSS feed for daily updates of Zoë Saldana jpegs that are at least 1280 x 1024. I clearly want wallpaper. Why not let me do celeb:zoë+saldana type:jpg size:2mp..

    2. You’re obviously working on a Travel Search, otherwise you wouldn’t have bought ITA Software and Frommer’s. Are you ever going to improve Google Flight Search? I bet some readers don’t even know that exists. I hate every minute of making travel plans online, and since the internet killed the travel agent, I’m forced to do this on my own now, forevermore. Hurry up and fix it already!

    1. Social Search. This is a no-brainer. I can’t search anything on Twitter, Facebook, LinkedIn, or even Google+. The state of social search is so incredibly dismal, it’s going to require an entire blog post all on it’s own. In short, if I’m logged into all of my social networks, I should be able to search them all with ease. They all provide APIs, don’t they? Don’t you have, like, fifty zillion programmers? Surely with all the work that went into Google+ you had to think about how to make all of that content searchable. It seems like the moment I link to something or share it, the sooner I can never find it again!

    Now I hinted at this in #7 above, but how cool would it be to search the web with SQL? Or at least, using some SQL-like operands? By now millions of people use SQL on a daily basis, and certainly your search algorithms could be easily adapted to understand things like by:relevance ord:desc. (ORDER BY relevance DESC) or BETWEEN 2011-12-31 AND 2012-06-30? This reminds me that you could make it a lot easier to combine mulitple boolean operators. Only one or two work at a time. Why not let me use AND, OR and Parentheses? ( this OR that ) AND (brick OR brack). So I guess you could call this a bonus eleventh way Google could improve it’s search features. Call it Nerd Search.

    Okay, there now, Googlebot, fans of Google, and other casual readers. What do you think?

  • Face Facebook Sharing Security Head On

    Posted on August 31st, 2011 phpguru No comments

    Sharing Policies on Facebook just got an upgrade. I thought you might like to see the new enhancements.

    1. Say who your with. Right off the bat, you can select the friends you want to be involved with a particular stream or conversation.

    2. Add Location to your posts. You can now define places where your conversation has relevance.

    3. Control privacy when you post – or after. If you realize a conversation might be better kept between certain people, you can now change the way your wall posts are published during or after the conversation starts.

    Visit this page on the Facebook.com Help pages For a more in-depth look at how to use Facebook’s newer, more secure sharing features.

  • How to Add Products to your Home Page in Magento

    Posted on August 28th, 2011 phpguru No comments

    In just 10 easy steps!

    Here are the steps:
    1. Download Magento and get it set up and running on your local box or web hosting account. I wrote about that before.
    2. Login to the backend in one browser tab, and load up your frontend in a new window.
    3. Turn off caching on the System -> Configuration screen.
    4. Configure your default store, or copy the default theme (or better yet, follow this tutorial to create a new Magento theme as your_interface/your_theme)
    5. Go to  System -> Manage Stores -> Website, Store, Store Layout and create one, point it to your_interface/your_theme
    6. Configure at least one Category and activate it.
    7. Configure at least one Product, assign it to the active category, and set it to enabled. Add Inventory of more than zero, and change Out of Stock to In Stock on the product editor.
    8. Assign the product to a website by checking the product on the Manage Products list and choosing Update Attributes in the upper right-hand corner. On the Manage Product -> Update Attributes screen is a right-hand tab that says “Website”. Choose that and check the store(s) you created in step 2 to assign the product to the website.
    9. Edit your Home Page content to have the following code, where 2 is Category ID shown on the Manage Categories -> Edit Category page.
    10. Go back to the Home Page browser tab and hit refresh (option refresh to force reload, in some browsers, or to be sure, clear your browser cache first).

    If this isn’t very clear, please watch this great screencast by Scott W on Vimeo.  In less than 10 minutes it will all be clear.


  • Laser Projection Keyboard for iPad, Mobile Devices a Cruel Hoax?

    Posted on May 10th, 2011 phpguru 2 comments

    If you’re looking for a projection keyboard that uses a laser to project an image of a keyboard onto any flat surface, I was too, so I did some digging. Below are my (disappointing) findings.

    Here’s a YouTube video from CES.

    One of the comments on the YouTube page for this video says, in part,

    This is yet an unproven technology. It has no corrective Artificial Intelligence to correct your mistakes as you type. Try the Cellulon keyboard and you will find it frustrating to type, unusable and seriously flawed. You will end up writting garble after garble. They seriously need to work on a fix. Don’t buy this overpriced fail of keyboard.

    Dang it! What a cool concept. Maybe it was too good to be true. These devices appear to be mysteriously unavailable. In fact, most of the information is from 2008-2010. Why is it that nobody appears to be selling the coolest thing ever? Maybe it’s a bunch of hype or they went back to the drawing board to get the concept working better.

    Think Geek says

    Out of stock ( no ETA available )

    This random site looks too cheesy to buy from.

    The Celluon Laserkey CL800BT on Amazon says

    Currently unavailable.
    We don’t know when or if this item will be back in stock.

    Google has a few stores listed, but at $2,500+? Hmm, now this is just strange.

    Does anyone have one of these devices?

    Are these cruel hoaxes from some April 1 news release or are newer, better models coming out soon to an Android, iPhone, iPad or your favorite 4G Tablet coming out any time soon?

    I think someone needs to get to the bottom of this.

  • Infinite Starlight: A Thought Experiment

    Posted on May 5th, 2011 phpguru 2 comments

    Albert Einstein, a patent clerk in Bern, performed what are now called “Thought Experiments”. He was born in 1879 and received the Nobel Price in Physics in 1922. So, he was just 42. What makes Einstein’s story so unique is that he wasn’t classically trained in physics.

    Like Einstein, I’m also not an astrophysicist, but the topic of stars, space and astronomy has always intrigued me. I’ve always thought it would be interesting to come up with my own thought experiment, and I think I finally have one.

    When I look around at the world around me, I find the level of detail in the cosmos utterly mind boggling. The farther you zoom in, the more and more detail you see. It’s almost infinite.

    Most of us with even a basic science or astronomy class know what a star is: a gigantic ball of burning hydrogen in the void of space. Carl Sagan described the universe most simply and profoundly: 100 billion galaxies each with 100 billion stars. That’s an incredibly large number of stars to be sure, but it’s not infinite, I think we could all agree on that.

    My theory is that the amount of energy a star has is infinite, and it gives off an infinite amount of energy at all times. I know that sounds crazy. Impossible. There must be a limit, although very large. But nothing is truly infinite, right? So this brings about a paradox then, and I would love to understand it fully.

    For this thought experiment, though, let’s talk about just one star, any star. Look up in the night sky and pick a star, and gaze at it. Which star you pick is irrelevant.

    How about Betelgeuse, a red supergiant, Orian’s shoulder in the constellation of Orion. You see that bright star, one of the brightest in the heavens? Good. Walk around your back yard (be careful in the dark) and pause and look up again. Still see the Orion’s shoulder? Yep. Go down the street a ways. Yep, you can still see Betelgeuse. No matter where you walk, and look up, you can still see that star. Go to the other side of the world (stick to the same hemisphere, consult a star map, etc.) — somewhere and sometime that Orion is visible. Arizona in the spring, for example.

    The point is, no matter where you look, there’s Orion and Betelgeuse. No matter where you go, light from that star is hitting your retina. If the moon ever goes in front of Orion, the light that would’ve hit your retina is instead going to hit the dark side of the moon. Technically, Betelgeuse casts a shadow on earth when the moon passes in front of it (when the moon casts a shadow on earth from our own star, it’s an eclipse.) Still, had the moon not been in the way, you could’ve seen the light that was destined for your retina.

    Theoretically, you could travel to another star in a different constellation, and assuming you could keep track of where you are in relation to Betelgeuse, you could land on an earth-like planet orbiting around a different star, and look up, and see Betelgeuse from that vantage point, too.

    The point of all of this is to visualize more clearly the way that light expands outward from a star.

    Time divides infitely. How many moments are in between the start of the big bang and now? How many nanoseconds are inside of a second? We use the term nanosecond today because that’s the thinnest sliver of time we can measure with modern technology. But any mathematical scholar will tell you that you can always take half of something, or a quarter, or an eighth or sixteenth – we can increase the denominator all the way to ∞. So how many 1/∞ths of a second are in a minute? ∞. How many 1/∞ths of a nanosecond are in a billion years? ∞ of them.

    Angles divide infinitely, too. How many angles are in between 0° and 90°? For example, an arcsecond is 1/3600th of a degree. But how many photons fit into an arcsecond? The farther away you go from the origin of the angle, the easier that is to measure, right, because the angle is getting wider. But how can it work that way? If you think about it for a moment, you’ll have to realize that there are ∞ angles which are each 1/∞th of one degree in size, in between any two other vectors that converge at a point.

    We can describe this expansion of light from a star as an ever-enlarging spherical volume. You can think of a sun as a huge beachball factory releasing an ∞ number of beachballs every 1/∞th of a moment. The edge of each beachball is a photon ready to hit any eyeball that might be gazing upward to see it.

    We proffered before that angles are infinitely divisible. To think about this some more, lets say you had a Sharpie marker and a beach ball, and you started drawing black dots on the beach ball and counting up how many dots it took to color the beach ball 100% black, at some point way in the future, the ball would be totally black and you would have a number of dots recorded which represented how many sharpie marker dots fit on the surface of the sphere. Now switch to a razor fine-point pen. Obviously it would take a lot more fine-point dots to cover the ball than the larger dots made by the sharpie marker, but it should still be possible to turn the ball black and record the number of fine-point razor dots it took to color the ball completely black.

    How does that apply to starlight? Well, we described before the way light expands out from the source star as being an expanding sphere. If we imagine the light expansion edge-horizon as a huge beachball, then we can imagine that for every photon-width point on the edge of the light-sphere, as as well as for every place inside the volume of the light sphere, at any moment in time there has to be at least one photon there, had our eye been in that exact spot to observe it. In other words, if you could have ∞ eyeballs from ∞ imaginary people all forming a circle (sphere) around Betelgeuse, then every single one of the ∞ eyeballs would get hit by a photon.

    That brings us to the width of a photon. If a photon has a width, which I’m fairly sure it does, then there should be a finite number of photons required to draw the light sphere. Or, if the width and height of a photon is 0, then it would take ∞ photons to cover the edge of an arbitrary light sphere some time/distance from the star. So let’s call the width of a photon, ƒ. I’m not sure what the equation would be, but I think we would all agree that if ƒ is > 0 then some finite quantity of photons would be required to ensure that any eyeball pointed towards the source would receive a photon.

    The farther away you go from the star, the wider the ∞ angles become. In other words, if you go 1 billion light years away from the source, then you’re on the edge of a light sphere whose radius is 1 billion light years. We can focus on two arbitrary photons next together at this distance. If a photon has a width, ƒ, and we choose two photons π and ∂ which are next together, their combined width is 2ƒ.

    What happens if we go another 1 billion light years farther away to 2 billion light years away from the source, parallel to π’s original trajectory. At twice the distance, isn’t the number of ƒ-width photons needed to cover the light-sphere equal to twice the number of photons required to cover the light sphere at 1 billion light years? If photons have a width ƒ > 0 then would it be correct or incorrect to assume that only a finite number of photos could fit around the edge of the star, during every 1/∞th moment in time since the star started burning?

    So, either stars have an infinite amount of energy, or something special about the speed of light (faster than light communication?) enables photons to be a wave (no energy required?) until they are observed (photon created at moment of observation). Since I think any sane person would argue that there is no possible way for a star to possess infinite energy, then there are clearly some things I am missing.




  • LVS-TUN How To on RackSpace Cloud

    Posted on October 6th, 2010 phpguru No comments

    I have to hand it to the sales/techs over at RackSpaceCoud.com.

    After just a few minutes with their Online Chat Sales, I was intrigued enough to create an account. Heck, it was free, and would give me a chance to experiment with server configuration via one of the hot topics today – virtualization.

    One of the first things I mentioned to Zack (I think that was his name) was that I was interested in making a more fault-tolerant web server setup. My client at the time had a dedicated server, but was planning on a few different television appearances, and didn’t want his site to go down with the surge of traffic.

    Load Balancer How-To using Apache Mod_Proxy (Easy)

    The RackSpaceCloud tech linked me to this article by Brandon Woodward on how to set up a simple load balancer using Apache. I followed that article to the letter, using one CentOS VM for the load balancer, and two CentOS VMs for web heads.

    Well, I have to admit, it was not as difficult as I thought it would be. Now granted, it’s not super robust, but for a simple round-robin load balanced setup, it only took an hour or two to setup and configure, and it is still in place on the client’s domain. Not bad, considering it’s the equivalent of 3 servers for less than $50/mo.

    Load Balancer How-To using LVS-TUN (Intermediate-Advanced)

    Having found the RackSpaceCloud article on setting up a load balancer with Apache just a few months prior, I was interested in learning more when I saw this new article by the same author on installing and configuring LVS-TUN.

    I was intrigued, because even though I believe having a mod_proxy-based load balancer solution on 3 servers in the cloud is preferrable in many ways to a single server with no load balancer at all, I could still see some areas for improvement and wondered what else was out there.

    Woodward explains it like this:

    LVS-TUN is a tunneling load balancer solution that will take all incoming requests through the load balancer and forward the packet to the web nodes. The web nodes will then respond directly to the client without having to proxy through the Load Balancer. This type of solution can allow for geo-load balancing, but will more importantly allow a customer use the bandwidth pool available from all web nodes, instead of relying on the limited through put of the load balancer.

    In other words, whereas the mod_proxy-based load balancer is quick and easy to set up and manage, the load balancer itself is a single point of failure, since it is acting as a proxy for the two web heads behind it. LVS-TUN on the other hand, enables the load balancer itself to be distributed, and also takes advantage of the web heads serving content directly back to the client.

    Whether you’re looking at a load balanced setup for scalability or just your own hardware architecture experimentation, without a doubt, the cloud is the best playground.

  • New Apple Device – Kevin Nealon LOL

    Posted on September 9th, 2010 phpguru No comments
    New Apple Device? I don't think so. Funny Kevin Nealon joke on Twitter

    New Apple Device? I don’t think so. Funny Kevin Nealon joke on Twitter

  • A Search Engine Better Than Google? Maybe. WolframAlpha

    Posted on July 21st, 2010 phpguru No comments

    So My MacBook Pro recently failed to wake up from sleep. I held the power on button for about 15 seconds, then let go. Nothing happened. I pressed the on button again and it booted right up again.

    Next I see this:

    screen-shot-2010-07-21-at-72206-pmInterested, I click Report to see what anonymous statistics it collected.

    In addition to a ton of other stuff, it says:

    System Uptime: 53599109180380 nanoseconds

    Hmmm, I wonder… How long is that?

    This is a perfect example of what Wolfram Alpha is perfect for.

    Sure, you enter the search term like…

    53599109180380 nanoseconds in hours

    …into Google, to take advantage of a hidden feature called Google Calculator.

    As exciting as it may seem to use Google for a calculator, wait until you check out Wolfram Alpha, a knowledge engine that uses natural language search to give you a wealth of information about your search term.

    Here’s what you get when you search for 53599109180380 nanoseconds on WolframAlpha.com.

    What is WolframAlpha.com? A Computational Knowledge Engine

    …plus a whole lot more interesting things, too, like the distance light can travel during that time.

    If that doesn’t get you going, check out this Wolfram Alpha overview screencast.

    Thanks to Alan for sharing this great link!

  • Funny T-Shirt of the Day – American Infidel

    Posted on July 20th, 2010 phpguru No comments
    Just like an American Idol T-Shirt, only much, much, better.

    Just like an American Idol T-Shirt, only much, much, better.