Today I wrote a script that allows you to input a single string of text separated by commas and outputs that text with line breaks where the comma was. It works whether or not there is a space between the comma and the next item.
I was inspired to write this because I had a long string of data separated by commas that I wanted to insert into individual rows in a spreadsheet rather than individual columns.
There are two parts to the code – the first HTML page that takes the input and then the second php file which contains the script that does the magic.
Example input: one,two,three (or: one, two, three)
Example output:
one
two
three
Here is the code:
<?php
$text=$_POST['text'];
$i = 0;
$match = ',';
$index=0;
for ($i = 0; $i < strlen($text); $i++ ) {
if (($text[$i])==$match) { //finds the next comma
echo substr($text, $index, $i-$index);
echo "<br>";
if ($i+1==' ') { //checks to see if there are spaces after commas
$index = $i+2; //stores new index to use as starting point for substring
}
else {
$index = $i+1;
}
}
}
// In case the last item doesn't have a comma following it
echo substr($text,$index,strlen($text)-$index);
?>
Remember the RAZR? The phone that sold 100 million units, dominated the mobile market, and was the choice of socialites everywhere? Do you remember who made that phone? Maybe not, because after the RAZR, Motorola found itself unable to produce another product that was able to even remotely resemble the success of the 2004 hit. Motorola was producing phones that garnered no attention, and more importantly, no customers. Its plummeting stock and a faltering economy spelled bad news for the American based communications giant.
Enter new co-CEO, Sanjay Jha. Since 2008, he has overhauled the culture at Motorola, and has been doing everything in his power to overhaul the image of the Motorola brand. The emergence of the Droid family of handsets finally has consumers talking about Motorola again. But is it enough?
The landscape of the mobile phone market is completely different than it was in 2004. The Razr was successful because it did one thing, and it did it better than any other phone available. Nothing else that sleek and stylish could make phone calls. These days, phones are doing more than making phone calls, and the competition is fierce. Sanjay Jha made a calculated move to invest Motorola’s resources in developing for the Android platform. Aligning yourself with Google is normally a good move.
Currently, Android is the only true competitor to Apple’s iOS, and the flagship Android devices are coming out of Motorola’s camp. It’s market share in the smart-phone market rose from 3.3% to 4.7% in the past year (SOURCE), with more highly anticipated devices on the way.
Motorola might be playing from behind, but with Sanjay at the helm don’t count them out.
Before I head to Germany in July, I definitely needed to find myself a quality snap-and-shoot digital camera. While I wasn’t looking for a professional SLR, I did want to be able to take high quality pictures and learn a little bit about photography. I’ve long wanted to try my hand at photography, but unfortunately it is an expensive hobby.
After some shopping around I was led to the Panasonic DMC-FH20, and I haven’t been disappointed. This camera comes with several nice features, including the intelligent auto (iA) feature and the ability to record HD video.
Form Factor
It’s not the slimmest camera on the market, so if you’re looking for something that is going to fit in your skinny jeans you might want to look elsewhere. The button layout strikes a great balance between having an overwhelming amount of buttons and so few that navigation becomes cumbersome.
Features
I’ve had a great experience becoming familiar with this camera. The user interface is very intuitive, and provides a variety of options. The iA feature provides good shots, as do the 25 different scene settings, and boasts an 8x optical zoom. You also have the option to shoot with three different aspect ratios: 4:3, 3:2, and 16:9.
The HD video was one of the reasons I decided on this particular camera. It records in 720p, or if you’re looking to conserve some space you can use the VGA and wide screen VGA modes. Note that you cannot adjust the zoom while taking a video. Check out the video to get a better idea of the video quality.
Other Notes
The video mode restricts the maximum length of any video you record. I have an 8 gig SDHC card (it supportds SD and SDXC as well), and while recording in HD I can only record about 8 1/2 minutes consecutively. Video also creates extremely large file sizes, a 5 minute video is going to run around 800 megabytes.
Video Demonstration
Final Thoughts
So far I’m very happy with the camera, and highly recommend it. I’ll make sure to post updates with some pictures from my trip. Meanwhile, check out some photos below and my Flickr Stream.
For the longest time the only way to try out Google’s new product Google Voice was to be invited, but I never took the time to seek out an elusive invite. Yesterday Google Voice was finally made available to the public, and being a willing participant of the Google takeover, I set up my account.
Setup
Setup was super easy, if you have a Google Account (which you should), there is nothing more to signing up than typing in your password and choosing a phone number. You can choose your phone number by typing in your area code, or typing in a phrase that you want, and it lists all available numbers. For example, I first tried searching for “austin”, but there were no corresponding numbers available. This isn’t too surprising considering Austin is a six letter word, and you’re searching for a seven digit number. I then tried “hutch” and found several pages of options to choose from.
Features
Initially I wasn’t exactly sure how I was going to use Google Voice, and what benefits it would provide. Seeing that it is free, I decided to grab my number and start playing around. I’m sure Google Voice does a lot of little things, but I’ll highlight the stuff that makes it valuable to me personally.
Voice mail
Any call that is placed to your Google number can either be accepted or sent to voice mail (duh), but trust me it gets a lot more interesting. Voice mails are tied to your account, and you can access them from anywhere you can connect to the internet. They are saved and transcribed automatically. No more going through an annoying menu in a hopeless attempt to find a voice mail that actually was deleted three days ago.
Texting
All texts that are sent to your Google number are archived on your account, making it the easiest way to back up your texts available. You literally don’t have to do anything, other than make sure that people are texting your Google number and not your original number.
Connecting Phones
When someone calls your Google number, you can easily set it up to ring multiple phones. For example, the service can ring both your cell phone and home phone (what’s a home phone?) if someone calls your Google number.
Layout
The layout similar to a Gmail account, with a voice mail inbox, a text inbox, and a contact list. Your contacts can be imported from multiple types of contact organizing software such as Outlook.
Overall
I can say I’m excited to see how I use Google Voice in the near future. Google has really hit the mark with this service, and I can see this being a useful tool for both personal and professional use.