MySQL Group_Concat through a Join

June 21st, 2012

So today I came across a problem where I want to pull all available projects in the system and also get a list of the users associated with that project. The way we had done it before was to grab a list of the projects and do an additional call for each to find the users. That turns out to be kind of a pain, especially on processing time. Today I taught myself how to use the GROUP_CONCAT feature and turn about 10 seconds of compute time down to about 0.0468 seconds. Gnarly! Here’s the sql:

SELECT CONCAT_WS( ' ', u.firstName, u.lastName ) ,
(
SELECT GROUP_CONCAT( DISTINCT userId ) AS user_ids
FROM projectsharing ps
WHERE ps.projectId = project.id
GROUP BY ps.projectId
) AS combinedusers, project.name, project.description, project.estimatedHours, project.actualHours, project.ownerId, project.parentId, project.id
FROM project
LEFT OUTER JOIN user u ON ( u.id = project.ownerId )

This outputs our project data with a list of concatenated user ids.

Auto-Upgrade WordPress on Ubuntu

May 28th, 2012

Just a quick fyi: to allow automatic upgrades on an Ubuntu install, make sure the documentroot has group write for www-data:

 

sudo chown -R www-data.myusername /var/www/websiteRoot

sudo chmod -R g+w /var/www/websiteRoot

 

 

vmware host IP

June 16th, 2011

Just wanted to throw this up before I forget it. If you’re using vmware on an OS X machine with a Windows Client and need to connect to the host (OS X) computer you can find the IP by:

Open up the command line tool in Windows.

Type ‘ipconfig’ to see the network info.

In there you’ll see the ‘gateway’ IP address. That’s the address you use to connect to whatever on your OS X host =)

Not that I need to post all these details for myself, but it might be useful for someone else. I couldn’t find it anywhere in my Google searches.

=w=

My new ADD solution: GTD

February 18th, 2010

I’ve kinda had a breakthrough over the past few weeks I thought was worthy writing about. With my new brain(my droid) its been possible for me to use Internet tools almost anywhere I have service. I’ve never been able to successfully use an online task service before due to the fact I’m never by my computer when I remember I have to do something. For me the ‘always connected’ mantra is the only way to go, and pen/paper was the only way to acomplish it.

Enter GTD and RTM. Alone they are mighty BUT TOGETHER THEY ARE SUPER AWESOME!

GTD (getting things done) is a task management system developed by David Allen. The purpose of this is getting all the tasks (which he calls open loops) out of your head. This really helps you forget about them so you can focus on only what you have to get done now.

RTM (remember the milk) is a very feature-full online task management app. They’ve got great syncing tools for mobile(droid/iphone apps), daily emails, location awareness, and so much other awesome shtuff. Overall its very easy to implement GTD with it, and it has seriosly changed my life. Check it out:

http://blog.rememberthemilk.com/2008/05/guest-post-advanced-gtd-with-remember-the-milk/

a simple way to decentralize twitter, and why we need it

October 16th, 2009

Once of my biggest problems with twitter is the fact that twitter is centralized. This means that content I give to twitter, and content I receive from twitter both go to/come from the same place. This sucks.

Once twitter goes down the service is completely unusable. This is totes mccraps. My solution: let the twitter api change the data source from twitter to a 3rd Party source. It would look like this:
request for tweets from twitter -> if twitter not hosting then forward request to 3rd party site -> 3rd party site publishes tweets
This way I can run my own twitter server for my friends and myself. All my friends need to do is log onto twitter through my site and my site automatically changes their data source from twitter to my server. They then can trust their data to me instead of twitter. It is much less likely that I will go down since I know my load will never peak, unlike twitter which doesn’t know their load and will keep breaking like it does.
Twitter can still own the data if they want(based on their terms of service they can still grab it and keep it). But they don’t have to be responsible for it, which they shouldn’t be. It’s your data, you should be able to decide who’s responsible for it. I can make the same claim to facebook, but they have too closed of a philosophy to ever change.
This could also help innovate your social graph. Following friends could be expanded to following the people on your server. It also would make creating social apps over twitter much easier for developers by giving them unlimited access since they would be able to run their own servers.
Twitter’s servers would still be the main key, and they wouldn’t lose any power doing it this way. They would be able to offload their processing to other people’s servers, saving them money. Makes sense, to me at least.

why google is winning

October 16th, 2009

In the past year or so I’ve noticed something simple about google’s strategy that is going to push them even further from M$ in the coming years. It’s all about planning for the future, and not deviating from that plan.

The main examples I’m going to use are search, and android. There’s a concept of once you’re the king, it’s extremely hard to be overtaken. M$ has done this with the OS and Google with search. Unless you can do a massive leap frog over the king, there’s almost no point in throwing a crap load of money trying.
M$ has been trying to do this with search, but they will never win. I’m sorry, but M$ has not showed in the past that they are smart or clever enough to push any massive feature list that will get the masses to switch from google. They had the wrong mindset/business plan and in the end bing will fail.
Google, on the other hand, has the right mindset. Their mindset is on the future, and the future for the web is mobile. This, I believe, is the number 1 reason behind Android. Google creates this great mobile operating system, that hardware venders can use for free, and boom, Google owns search on any mobile device that uses Android (along with all the other mobile OSs that use goog for search).
Google now has the last laugh as they become the king of mobile search, while M$ is trying to play catchup with something Google perfected over 5 years ago.

Google Adds Alternate Routes to Map Driving Directions

June 12th, 2009

My love for online mapping grows as someone finally adds alternate routes to driving directions.
The major benefit of this is avoiding traffic. In cities like Chicago this can be huge. It would have been awesome to have had this when I was driving to work, instead of taking the train like I do now.

It gives you the estimated times driving times for all routes, including estimated times with traffic. It also gives the transit info, including alternate transit routes and times for those.

I’ve been pretty pumped about this type of feature since I heard about it in the Dash GPS devices, and now it’s finally something I can use.

check it out:
http://maps.google.com/maps?f=d&source=s_d&saddr=S+Wabash+Ave&daddr=N+Arlington+Heights+Rd&hl=en&geocode=FWoCfwIdrO7G-g%3BFcozggIdXobB-g&mra=dme&mrcr=0&mrsp=1&sz=12&sll=42.050057,-87.874832&sspn=0.134352,0.311737&ie=UTF8&z=12

synergy – awesome kvm

June 11th, 2009

I finally had it this week having to use 3 keyboards/mice for my computers around my personal office. My friend, a while ago, told me about an open-source solution called synergy.

I installed it last night on two ubuntu machines and it was so easy and fast to install.

sudo apt-get install synergy quicksynergy

Then create a synergy.conf . Here’s mine:

sudo vi /etc/synergy.conf:
section: screens
kelly:
mary:
end

section: aliases
mary:
192.168.8.102
end

section: links
mary:
right = kelly
kelly:
left = mary
end

section: options
screenSaverSync = false
# My KVM uses Scroll Lock to switch screens, so set the
# hotkey to lock the cursor to the screen to something else
keystroke(f12) = lockCursorToScreen(toggle)
end

Then start:
synergys -f –config /etc/synergy.conf

And that’s it. It works awesome! Check it out if you have multi-monitors with different boxes.

bye bye rss…time to switch to twitter

May 6th, 2009

So since I use it more often, and 90+% of my blogs are on twitter…I’m going to start leaving rss for twitter. It forces my blogs to make my life more efficient with the 140 char limit. Twitter also has a better program base then google reader does making it much easier to use.

Sorry rss…twitter wins.

looking for nerds in Chicago… anyone there?

February 5th, 2009

I’ve recently found out I work way too much. I’m also training for another marathon in April which takes up time, and sometimes I like to sleep. I recently tried bar trivia for the first time and realized my need to have a few more like-minds around me.

It’s a little hard for me to find friends I like. I get bored way to easy with my ADD and too many people are more interested in things that just don’t have any depth at all. You know what I’m talking about.

So it’s time for me to make some friends that have smarts, are unique and a bit nerdy I guess. Any ideas?