Yesterday I needed to do a little report for the boss but the data that I needed to group together wasn’t exactly the same. I hit up the “Goog” for ways to use regular expressions in a count query, but that is kinda tricky to find so this is what I was able to come up with….
So let’s say you had a table where you were attaching the landing url a site visiting is entering your website on, and you wanted to track that landing url the whole way to the end of some web based procedure. Of course certain urls will be different but some could be common for the purpose of counting them together on a report. In a practical example, lets say you are doing pay-per-click traffic with Google and Yahoo. Both of these providers use unique ids in the url to help distinguish between multiple clicks from the same person (so you end up with many urls that are different but mean the same thing). And of course you were a good little developer when you decided to send Google traffic to /google/ and Yahoo to /yahoo/!
With that premise and the following fields in a database table called “signup”, you can group the unique Google and Yahoo landing pages together with a simple regular experssion.
signup table
+----------------------+
| Field
+----------------------+
| id
| signup_date
| landing_page
| etc....
+----------------------+
SELECT
DATE_FORMAT(signup_date,’%m-%d-%Y’) as signup_date,
count(landing_page) as signup_count,
IF(landing_page REGEXP ‘^/(google|yahoo).*’,SUBSTRING(landing_page,1,7),landing_page) as lp
FROM signup
WHERE
1=1
AND signup_date >= ‘” . $istartdate . “‘
AND signup_date <= ‘” . $ienddate . “‘
GROUP BY DATE_FORMAT(signup_date,’%m-%d-%Y’), IF(landing_page REGEXP ‘^/(google|yahoo).*’,SUBSTRING(landing_page,1,7),landing_page)
If that makes no sense whatsoever…. awesome!
When I make a report based on grouping data by day, I select the date for each row, then the count of the column I am looking at, and in this example the field that I am grouping to look at. (This query is sitting behind a web form so the php variables for start and end date are passed in.) In the GROUP BY clause, if you specify the first grouping as the formatted date, you can base the format on the way you are outputting the information on the report. In this example I am doing the report by day. If you wanted to grab the values by month, you would just change the date format pattern from this: ‘%m-%d-%Y’ to ‘%m-%Y’. The tricky part in this query was I need to have one grouping condition that would pull together all the like landing page urls as each value. I chose to use an if statement IF(Condition,true,false) where the condition was a regular expression pattern. Using the condition = landing_page REGEXP ‘^/(google|yahoo).* ‘ tells MySQL that IF the landing_page starts with ‘/google’ or ‘/yahoo’ return the true value, otherwise return the false value. I was not able to return the entire value, so using SUBSTRING will chop off the characters that you want and ignore the rest. If the pattern fails to match it will return the normal value for landing_page. And that is all there is to it.
Let me know if that was helpful to anyone!
This content was syndicated from: Alex Barger. If you are looking for help for your charitable organization's internet presence, or general I.T. related consulting... I may be available for virtual volunteer services.
Counting items with mysql and regex in the group by statement
No related posts.
So it has been quite some time since I posted on here. It has been rough lately. Not sure what kind of funk I’ve been in… but actively trying to get out of it. Hoping getting back in tune with the tubes will help. (Twitter is probably the biggest reason not to post on here…damn you Twitter)
While I have been gone I have been doing some work with CakePHP, FAI - fully automatic linux installations, VirtualBox & VMware, Magento, etc. So I have been keeping pretty busy.
I also found a nice little hardware project that has just come into my radar. http://www.brewtroller.com/ This is something that I have been wanting to work on in my *cough* free time. However my vision would be to use a host computer for all the logic and user control, and the controller board used for simple I/O. Anyone interested in this, drop a comment and let me know.
This content was syndicated from: Alex Barger. If you are looking for help for your charitable organization's internet presence, or general I.T. related consulting... I may be available for virtual volunteer services.
Related posts:
The company I work for has decided to do a charity benefit of $10,000 in services to the organization that answers the question on their site or blog: “How can internet marketing benefit your organization?” For further details visit the post charity internet marketing
This content was syndicated from: Alex Barger. If you are looking for help for your charitable organization's internet presence, or general I.T. related consulting... I may be available for virtual volunteer services.
Happy Holidays from ProspectMX
Related posts:
Here is a short ten minute video tutorial and howto directions. This is how to setup Yubikey authentication on Red Hat Fedora with PAM authentication. You can configure SSH to restrict access to your Linux box so that only Yubikeys you authorize can gain access. Therefore restricting access to anyone who does not.
# build libyubikey
wget http://yubico-c.googlecode.com/files/libyubikey-1.1.tar.gz
tar -zxf libyubikey-1.1.tar.gz
cd libyubikey-1.1
./configure
make
make install
cd ../
# build pam yubikey
wget http://yubico-pam.googlecode.com/files/pam_yubico-1.8.tar.gz
tar -zxf pam_yubico-1.8.tar.gz
cd pam_yubico-1.8
./configure
make
make install
cp libs/pam_yubico.so /lib/security/
# Setup keyfile
mkdir /root/.yubico/
vi /root/.yubico/authorized_yubikeys
root:{12char key}
# SSHD Config
PasswordAuthentication yes
ChallengeResponseAuthentication yes
UsePAM yes
# Pam module
vi /etc/pam.d/sshd
auth sufficient pam_yubico.so id=16 debug
This content was syndicated from: Alex Barger. If you are looking for help for your charitable organization's internet presence, or general I.T. related consulting... I may be available for virtual volunteer services.
How To Setup Yubikey SSH On Fedora
Related posts:
Greetings! Finally got the first impromptu video up on the inter-webs. This is just a rough video of me opening my package from Yubico. I talk a little bit about what the device is and then plug it into my computer for the first time.
Also, I attempt to gain access to Yubico’s restricted user forum. Enjoy!
This content was syndicated from: Alex Barger. If you are looking for help for your charitable organization's internet presence, or general I.T. related consulting... I may be available for virtual volunteer services.
Related posts:
Just a quick note out that I just received my Yubico Yubikeys! I normally tear into packages like presents on Christmas morning, but I am trying to restrain myself. I have decided to do a video blog-casting series, detailing the entire life-cycle of my experiences with the YubiKey. So hopefully video shooting goes well. It is already 10pm, so we’ll seen how quickly I can wrap this up.
This content was syndicated from: Alex Barger. If you are looking for help for your charitable organization's internet presence, or general I.T. related consulting... I may be available for virtual volunteer services.
Related posts:
One of the great things I learned about at CPOSC this past Sunday was the Yubico YubiKey. I had not heard of this little device, granted I had heard of the RSA SecurID. (If you are wondering what a SecurID is, it is a portable device that allows you to add an extra layer of authentication and security to a computer system or interface.) It was interesting that I had just had a conversation with a colleague about the want to find an alternative to the RSA commercial solution. So I was at the conference and the one speaker mentions the Yubikey, and invites interested parties in joining him for a demo of the little devices over lunch. I was so amazed that I just ordered two devices. I will blog more as I learn more about them and what I do with them.
Have you had any experience with any secure token based authentication systems? Please drop a comment and let us know.
This content was syndicated from: Alex Barger. If you are looking for help for your charitable organization's internet presence, or general I.T. related consulting... I may be available for virtual volunteer services.
Related posts:
Hey tweeple!
I am now a twitter fanatic. I avoided systems like this in the past, but recently have found great uses for it. So now I too, am a twitter-holic. So shout out to the tweeple!
This content was syndicated from: Alex Barger. If you are looking for help for your charitable organization's internet presence, or general I.T. related consulting... I may be available for virtual volunteer services.
I hooked up my blog to twitter
Related posts:
Here are a few schematics that I have collected. Thought I would share these out there on the net. They all have pros and cons. You can read more about my specific experience with each one over here on the robot kits page.
Willem Pic Programmer Schematics
Tait Pic Programmer Schematics
Classic Pic Programmer Schematics
This content was syndicated from: Alex Barger. If you are looking for help for your charitable organization's internet presence, or general I.T. related consulting... I may be available for virtual volunteer services.
Related posts:
Attention LUGers and LUGer-wannabes: I am helping reintroduce the Lancaster Linux User Group. With the rising cost of fuel, driving to the CPLUG meetings doesn’t fit everyone’s budget or busy schedule. So anyone who is interested, please visit the blog and post a comment stating your level of interest. I have spoken to several people already and feel that we could begin to form a great group in no time. BTW, we will plan on scheduling our meetings on a different day that the CPLUG does so that we do not create a conflict with their meetings.
This content was syndicated from: Alex Barger. If you are looking for help for your charitable organization's internet presence, or general I.T. related consulting... I may be available for virtual volunteer services.
Related posts:
So I added the glassy looking Web 2.0 icons to my sidebar the other day and was actually surprised of the result. Yesterday I ended up with a few extra twitter followers, a new facebook friend and I even had some decent stumbler action. Not bad for a few minutes of work. Of course I linked the icons to my profiles on those respective sites. This is the place I got the icons from if you are interested [iconarchive.com].
I am not real big on all the social sites, and stay far far away from mysapce. Can you recommend any other sites worthy of holding a spot in my sidebar?
This content was syndicated from: Alex Barger. If you are looking for help for your charitable organization's internet presence, or general I.T. related consulting... I may be available for virtual volunteer services.
Related posts:
First off, let me say I have no affiliation with BlogExplosion and just a blogger who signed up on BlogExplosion.
Basically what I have been doing is surfing for traffic every couple of days so that I can spend 15 - 20 credits each day on traffic to my blog.
(Earn Blog Traffic -> Surf Member Blogs) I use Firefox and just pop this in a separate tab, and do other things while “surfing”. Also while surfing, I keep an eye out for interesting blogs and topics that are related to mine. When I find blogs like that, I post a comment. Sometimes they will let you do your site url when posting. This engages the other blogger. I also try to find a way to relate their post back to a post at my blog and refer them to what I have posted. So this creates extra traffic sources, unrelated to BlogExplosion itself.
Unless you have a blog with wide appeal and topic nature, it would seem like paying for a billboard ad in an unrelated space. Granted, the people who are all using this site all have blogs so some people will actually do what I do while surfing. Many of the visits I receive are people that just bounce from one blog to another. So the key here is to have content and “bait” if you will, as close to the top as possible on your blog so that when the people look to the surf bar, they see something to become engaged with. You are not going to capture everyone… but obviously the goal is as many as possible. Take a look at the top of my site [ http://www.cruzinthegalaxie.com ], and notice how I have my top area setup in such a way to be unique and personal. I wanted my site to be remembered and stand out from the crowd.
The other thing that I do is BlogRocket. Sometimes twice a day. For one credit you can get 4 - 10 visits rather then one. Also you can visit a site on the blog rocket page, to be entered into a credit contest. So if you do that once a day, you will have the best odds at winning that pool.
If you sign up with BlogExplosion, your site will eventually get approved, so you could start doing these things now and build up some credits. I don’t do auto-assign of credits. I go in and manually assign about 20 per day. That keeps a nice steady stream of visits to my site. It felt like it took a long time before my blog was approved in their system. The first time they gave me a message about non-english or non-us site, so I deleted it and reentered it. But eventually it was approved.
I am also building referrals. So far that is not working out for me. The referrals that you get would theoretically help you build your credits. The problem is getting the referrals to surf for traffic.
How do you use BlogExplosion?
This content was syndicated from: Alex Barger. If you are looking for help for your charitable organization's internet presence, or general I.T. related consulting... I may be available for virtual volunteer services.
Related posts:
Prize Unique Referred Traffic: www.endureonline.com
Prize Quantity of Links: tidbitsandtreasures.blogspot.com
Prize Highest Google PR: Tie Between endureonline.com and tidbitsandtreasures.blogspot.com, so the winner is determined by the most unique referred traffic so the winner is endureonline.com
Congradulations to C.McComsey of www.endureonline.com, B.Sanders of tidbitsandtreasures.blogspot.com, and to all others who participated. Way to get off your duff and help a dude out. Thanks again!!
If you would like to see more detailed information I have provided the data that the winners were determined by. This pdf is a snapshot of the google analytics report of referring traffic for the contest period. Here is a csv file that contains all of the links as far as yahoo has indexed. The highest PR link, I had to manually go through all the registered links.
This content was syndicated from: Alex Barger. If you are looking for help for your charitable organization's internet presence, or general I.T. related consulting... I may be available for virtual volunteer services.
Related posts:
We got back last night from our trip to Ocean City, NJ. The little guy is at that age where he wants to do everything, touch everything, and always have his way so that made for a challenge. We hit the beach a few days, hit the boardwalk others. I think I gained about 10 pounds with all that good food! I uploaded some of the pictures to my Flickr account.
The drama of the story was the B&B that we stayed in was having some issues with the next door neighbor. We were in the middle of a feud. The neighbor was making noise and causing disturbances by cranking the radio, honking horns, and banging on things. It was kinda comical in one aspect, but did make it hard for Luke to take a nap. She apologized to us the next day, and hooked us up with a stack of tickets to the amusement rides. Whoo-hoo free rides!
Friday everyone was cleared from the water, as medical syringes washed up on the beach. Luckily for us, we already had packed up to head home. I feel bad for all the others on their way to the beach this weekend. COME ON PEOPLE!!! Stop ruining this earth. Keep your sh*t out of the water.
This content was syndicated from: Alex Barger. If you are looking for help for your charitable organization's internet presence, or general I.T. related consulting... I may be available for virtual volunteer services.
Drama at the Beach and New Pics from Vaction
Related posts:
Dear friends, I am writing to inform you that I will be continuing work from my new office. It is a bit noisy here at times, but it can be drowned out by the calming sounds of an ocean waves mp3 I have on my phone. When the tide is out, I’ll get some work done.
Now where did my laptop get to ???
Cheers!
This content was syndicated from: Alex Barger. If you are looking for help for your charitable organization's internet presence, or general I.T. related consulting... I may be available for virtual volunteer services.
Related posts:
I added some more information on the programming the Microchip PIC resource guide that I have been working on. I have added links to the pic programming software I have used. Also, I now have a list of compilers that will take a program in traditional C or Basic, and compile it for the Microchip PIC line of chips. If you have any special request for sample projects, let me know. The next section will be building an actual circuit and programming a chip.
This content was syndicated from: Alex Barger. If you are looking for help for your charitable organization's internet presence, or general I.T. related consulting... I may be available for virtual volunteer services.
Update 2 - Microchip PIC Programming
Related posts:
If you are looking for an experienced Linux consultant in Lancaster, PA. Don’t fret, I am here for you. I understand that the number of Linux implementations continue to grow nationwide, but little old Lancaster PA sometimes is forgotten about. Growing up in this area and working for many companies, most I have seen utilize Microsoft based computer systems. In my seven plus years in the industry, I have started to see more and more Linux use right here in our backyard. If you have a business and wondering what the heck it is, or if it is a good fit for your business model now local schools are priming students with Linux as well as Windows administration. Be on the lookout for a penguin powered system near you!
PS - Let me know if you spot one. I’d love to hear.
This content was syndicated from: Alex Barger. If you are looking for help for your charitable organization's internet presence, or general I.T. related consulting... I may be available for virtual volunteer services.
Related posts:
So we were out to the photo studio the other day. Got a handful of new pictures of the little dude. We wanted to get some summer photos before the summer was over.
This content was syndicated from: Alex Barger. If you are looking for help for your charitable organization's internet presence, or general I.T. related consulting... I may be available for virtual volunteer services.
Related posts:
I have been using BlogExplsion to get free traffic to my site for over a month now and hit over 1000 visitors. I have the BlogRush widget on this site and be lucky to have seen 25 visitors from that tool. If you run a blog, and are looking to increase your average visitors to your site, then check it out. One way you can get people to come, is by surfing through other blogs by members of their site. They call it “surf member blogs” and as you go to each site you earn credits that you can use to participate in the surf or other activities. I think I’ll be giving blogrush the boot, and putting a BlogExplosion widget in it’s place.
This content was syndicated from: Alex Barger. If you are looking for help for your charitable organization's internet presence, or general I.T. related consulting... I may be available for virtual volunteer services.
Free Blog Traffic - BlogExplosion
Related posts:
If you are in need of a Linux consultant - I’m your man. I have over seven years experience with various Linux distributions (aka “flavors”). Redhat, CentOS and similar versions are my strongest operating systems, however I am also familiar with Debian, Ubuntu and FreeBSD along with their directives. Experience with LAMP stack installation, configuration, and development. Familiar with the most common hosting and enterprise software.
Feel free to post your Linux related questions, and I’ll answer them in a follow-up blog post. If you would like a private answer, that can be arranged as well.
Post your linux questions here.
This content was syndicated from: Alex Barger. If you are looking for help for your charitable organization's internet presence, or general I.T. related consulting... I may be available for virtual volunteer services.
Related posts:
