This past weekend (March 25-27) I got a collective six hours of sleep. This comes from the fact that I was participating in a challenge at RIT called the RIT48 Challenge. Essentially, this challenge required participants to design, plan, and launch a web startup company in just 48 hours. Participants are judged on their business models, plans, product designs, etc.
I joined a team at the last minute when their web developer had a family emergency. The team already had their idea in place, we just had to wait until the start of the event to work on it (participants can only work on their ideas during the 48 hours). My team's idea was to create a new content distribution system for small publishers, web artists, videographers, photographers, etc. Essentially, we wanted to create a site that would allow larger companies to get in touch with smaller companies / content producers in regards to licensing their content.
After 48 hours of almost no sleep, our product and business model were in place. Although we didn't win the competition, I really learned a lot during that weekend. I learned a ton about team work, business models, how to launch a startup company, and a lot more. I also met a ton of interesting people in all areas.
RIT48 was an amazing challenge, and I'm already planning on competing next year.
Tuesday, March 29, 2011
Sunday, March 20, 2011
Convert a PHP Array to a JavaScript Array
Many times when working with advanced web applications it may be necessary to convert an array of PHP variables into an array of JavaScript variables. I stumbled upon this issue in some recent web development work and most of the solutions online seemed incredibly complicated for such a simple task.
JavaScript is different than PHP because JavaScript allows manipulation of the page data on the client side (meaning no page refreshes are necessary). PHP works by sending information to a server (server side) to manipulate and return. This means that page refreshes are necessary (typically). So let's say you have an array of strings in PHP; we'll call it "phpArray()". This array may be created in PHP with the following PHP code:
Now we have a
Now we're going to loop through the loop and add each element of the array to the string with quotes around it. (Note: this is for an array of strings. An array of ints should be handled as strings in PHP, but passed to JavaScript without the quotes.)
This code creates a PHP string that looks like:
Now, we need to do one final thing. This code loops through the array and adds a comma (,) and space( ) to the end of each array element. That means that the resulting code will appear as "Last Word", We don't want this because it will mess up our JavaScript. To cut off this last comma and space, we will do:
This code removes the last comma and allows us to place it into our JavaScript. In the JavaScript section of our page, we're now going to add:
We now have a JavaScript array called "jsString" which contains all of the elements of the PHP string array. It would be the same as writing:
That's all there is to it. If you have any questions, just leave a comment!
JavaScript is different than PHP because JavaScript allows manipulation of the page data on the client side (meaning no page refreshes are necessary). PHP works by sending information to a server (server side) to manipulate and return. This means that page refreshes are necessary (typically). So let's say you have an array of strings in PHP; we'll call it "phpArray()". This array may be created in PHP with the following PHP code:
$phpArray = array("Word One", "Word Two", "Word Three", "Word Four");Now we have a
$phpArray variable in PHP that contains the words as strings. To convert this array to a JavaScript array, we are going to first create a string from the PHP array by running through a PHP loop. First, we will declare a string variable in PHP to hold the loop's contents:$string = ""Now we're going to loop through the loop and add each element of the array to the string with quotes around it. (Note: this is for an array of strings. An array of ints should be handled as strings in PHP, but passed to JavaScript without the quotes.)
foreach ($phpArray as $a) {
$string .= "\"" . $a . "\", ";
}
This code creates a PHP string that looks like:
$string = "Word One", "Word Two", "Word Three", "Word Four", Now, we need to do one final thing. This code loops through the array and adds a comma (,) and space( ) to the end of each array element. That means that the resulting code will appear as "Last Word", We don't want this because it will mess up our JavaScript. To cut off this last comma and space, we will do:
$finalstring = substr($string, 0, (strlen($string) - 2));This code removes the last comma and allows us to place it into our JavaScript. In the JavaScript section of our page, we're now going to add:
<script language="javascript" type="text/javascript">
var jsString = new Array(<?php echo $finalstring; ?>);
</script>
We now have a JavaScript array called "jsString" which contains all of the elements of the PHP string array. It would be the same as writing:
var jsString = new Array("Word One", "Word Two", "Word Three", "Word Four");That's all there is to it. If you have any questions, just leave a comment!
Saturday, February 19, 2011
Watson and the Future of Humanity
You've probably seen it by now - the videos of the IBM-created supercomputer named "Watson" correctly answering question after question on Jeopardy as its human opponents stood by helplessly. After reading many of the comments on the news articles around the Internet, I have realized that most people truly don't understand the implications of the technology behind Watson. "Computer Overlord," "HAL," and "Rise of the Machines" jokes aside, Watson represents a unique turning point in the history of computing and information searching.
Watson is unique because it can truly learn from reading - just like humans. However, Watson stores its vast amount of information based on patterns. Everything that Watson does boils down to a series of patterns, word associations, and language recognition skills. Watson will never be able to "think" on its own in terms of the human definition of "thinking." However, with every passing day, its ability to compare billions and billions of words, create highly specialized series of rules based on associations, and deliver content that is unique grows.
So what can Watson be used for, besides putting Ken Jennings to shame? Imagine five or six years from now, you're experiencing pain in your stomach. You visit the hospital and you list your symptoms aloud for the doctor. But as you do, a machine is also processing your symptoms, sorting through millions of medical articles, patient databases, your family health history, and more to determine what it thinks you should be diagnosed with. Your doctor could never possibly process that much information. Together, the computer and the doctor correctly diagnose your problem. The point here is that neither the doctor nor the computer are working independently. Humans are amazing at understanding the complexities of speech. A computer could never understand "Well it hurts sometimes, but only when I am thinking about it." However, computers are excellent at processing information. Your doctor could never sort through five million medical articles for the one that relates to you; the doctor could never think of every possible side effect of every combination of medicine. But machines can. So working in tandem, the computer and doctor could achieve much more than either could alone.
Watson represents a giant step forward in the history of computing. It is amazing how machines are slowly being trained to comprehend our search queries in terms of the spoken language rather than a string of text we type into a search engine. Hopefully Watson's technology will help us achieve even more. But always remember: humans created Watson.
Watson is unique because it can truly learn from reading - just like humans. However, Watson stores its vast amount of information based on patterns. Everything that Watson does boils down to a series of patterns, word associations, and language recognition skills. Watson will never be able to "think" on its own in terms of the human definition of "thinking." However, with every passing day, its ability to compare billions and billions of words, create highly specialized series of rules based on associations, and deliver content that is unique grows.
So what can Watson be used for, besides putting Ken Jennings to shame? Imagine five or six years from now, you're experiencing pain in your stomach. You visit the hospital and you list your symptoms aloud for the doctor. But as you do, a machine is also processing your symptoms, sorting through millions of medical articles, patient databases, your family health history, and more to determine what it thinks you should be diagnosed with. Your doctor could never possibly process that much information. Together, the computer and the doctor correctly diagnose your problem. The point here is that neither the doctor nor the computer are working independently. Humans are amazing at understanding the complexities of speech. A computer could never understand "Well it hurts sometimes, but only when I am thinking about it." However, computers are excellent at processing information. Your doctor could never sort through five million medical articles for the one that relates to you; the doctor could never think of every possible side effect of every combination of medicine. But machines can. So working in tandem, the computer and doctor could achieve much more than either could alone.
Watson represents a giant step forward in the history of computing. It is amazing how machines are slowly being trained to comprehend our search queries in terms of the spoken language rather than a string of text we type into a search engine. Hopefully Watson's technology will help us achieve even more. But always remember: humans created Watson.
Sunday, January 9, 2011
What an iPhone on Verizon Means
As most of you have probably heard by now, rumors are flying about the iPhone coming to Verizon this Tuesday (January 11th). Although I feel that Verizon could use this moment to pull one of the largest pranks the entire mobile industry has ever seen and introduce another Android device, I think that most experts agree this is the day the iPhone will finally be announced. To be honest, I am not as excited about this as most. Allow me to explain.
Since the beginning, I have supported Android. I have owned iOS devices, but have felt that, as someone who loves to modify and customize my device, Android is the better platform. I do admire Apple for their products that "just work" and feel that they have become the leaders in the mobile industry because of this. They are catering to a market of people who don't care about the technology behind their devices, they just want to turn it on and use it (Obviously technology enthusiasts use iOS devices as well, they're just not the bulk of users). But in the end, Android has become a place where I can install whatever application I like, change my home screen, and make changes to how the entire operating system functions; it's just how open source works.
This is why I don't look forward to the 12 Million expected iPhone users, each consuming on average 200 MB of data per month, consuming valuable Verizon resources. Android users have enjoyed Verizon's fast, always-present network for about two years. Unless Verizon has invested millions of dollars in infrastructure to support the impending onslaught of iPhone users, you can bet that the network will stagger under the load. While I doubt that it will suffer as much as AT&T's has, I am certain that the slow-down and congestion will be noticeable.
In addition to speed issues, I fear for the future of Android. Android is an amazing product and has made huge leaps in terms of development and market share. A huge portion of Android's success (sadly) has been because it is typically referred to as the "Verizon iPhone." I have no doubt that Android's market share will take a huge dip when the iPhone is introduced. It will need to fight to stay alive, and without Verizon's ridiculous marketing, I honestly don't know about Android's future.
The iPhone coming to Verizon is something millions of customers have wanted for years. Now that it is finally here, I fear it will bring congestion to Verizon's networks and a decline in Android's market share and development. Google will need to invest millions in marketing, which I hope they do. Competition is good for the consumer and I hope that both products will benefit from this. I just hope that Google can do enough to convince new users that Android is just as good (and better, in some cases) than the iPhone.
Since the beginning, I have supported Android. I have owned iOS devices, but have felt that, as someone who loves to modify and customize my device, Android is the better platform. I do admire Apple for their products that "just work" and feel that they have become the leaders in the mobile industry because of this. They are catering to a market of people who don't care about the technology behind their devices, they just want to turn it on and use it (Obviously technology enthusiasts use iOS devices as well, they're just not the bulk of users). But in the end, Android has become a place where I can install whatever application I like, change my home screen, and make changes to how the entire operating system functions; it's just how open source works.
This is why I don't look forward to the 12 Million expected iPhone users, each consuming on average 200 MB of data per month, consuming valuable Verizon resources. Android users have enjoyed Verizon's fast, always-present network for about two years. Unless Verizon has invested millions of dollars in infrastructure to support the impending onslaught of iPhone users, you can bet that the network will stagger under the load. While I doubt that it will suffer as much as AT&T's has, I am certain that the slow-down and congestion will be noticeable.
In addition to speed issues, I fear for the future of Android. Android is an amazing product and has made huge leaps in terms of development and market share. A huge portion of Android's success (sadly) has been because it is typically referred to as the "Verizon iPhone." I have no doubt that Android's market share will take a huge dip when the iPhone is introduced. It will need to fight to stay alive, and without Verizon's ridiculous marketing, I honestly don't know about Android's future.
The iPhone coming to Verizon is something millions of customers have wanted for years. Now that it is finally here, I fear it will bring congestion to Verizon's networks and a decline in Android's market share and development. Google will need to invest millions in marketing, which I hope they do. Competition is good for the consumer and I hope that both products will benefit from this. I just hope that Google can do enough to convince new users that Android is just as good (and better, in some cases) than the iPhone.
Monday, November 22, 2010
Life Without My Smartphone
So it happened - the moment I had never really prepared for, but still dreaded nonetheless. I was happily swiping away at my first generation Motorola Droid when suddenly the touchscreen refused to respond. Thinking it was a glitch, I turned the phone off, then back on again to no avail. I removed the battery, waited a few minutes, then tried again. Nothing. Eventually, I went to desperate measures and performed a factory reset. Still nothing. Finally, I had to face the truth - my beloved Droid was dead; the very device I have used for everything, from sending email and editing documents to identifying songs on the radio was dead. Luckily, I had a replacement, LG enV3 so I was able to make phone calls and text (Google Voice saved me during the time I was without a phone.). But as many of you who have had a smartphone know - once you get one, you can't go back.
Undeniably, not having a smartphone made me question how I was ever able to manage my life before. I couldn't send email, I couldn't browse Facebook, I couldn't check my calendar, read the news, perform Google searches, or anything else but text and call. I couldn't read my voicemail using the Google Voice app, scan barcodes, get directions, navigate, identify music, listen to Pandora, listen to my music, or play Angry Birds.
This experience has also led me to question my need for a smartphone. Honestly, I can say that I am addicted to the device - when it was working, it never left my side. But I am addicted to it because it makes my life easier and it makes communication seamless. I don't need a smartphone because someone tagged me in a photo on Facebook; I need a smartphone because it allows me to access my contacts from anywhere, send a last-minute email, stay on time with my schedule, and navigate to a new place.
UPDATE: Thanks to Verizon, I now have activated my replacement Droid and everything seems to be working.
Undeniably, not having a smartphone made me question how I was ever able to manage my life before. I couldn't send email, I couldn't browse Facebook, I couldn't check my calendar, read the news, perform Google searches, or anything else but text and call. I couldn't read my voicemail using the Google Voice app, scan barcodes, get directions, navigate, identify music, listen to Pandora, listen to my music, or play Angry Birds.
This experience has also led me to question my need for a smartphone. Honestly, I can say that I am addicted to the device - when it was working, it never left my side. But I am addicted to it because it makes my life easier and it makes communication seamless. I don't need a smartphone because someone tagged me in a photo on Facebook; I need a smartphone because it allows me to access my contacts from anywhere, send a last-minute email, stay on time with my schedule, and navigate to a new place.
UPDATE: Thanks to Verizon, I now have activated my replacement Droid and everything seems to be working.
Saturday, November 13, 2010
Facebook and Email - What Could Be Announced Soon
If you follow any of the technology blogs, or even happened to glance at Yahoo! during the past few days, you may have noticed that Facebook is planning an "event" for this coming Monday. As usually happens with these events, almost everyone has been speculating as to what new feature the popular social network could roll out next. This time, it seems to be an overhaul of Facebook's email system, with all of its users possibly getting an @facebook.com email address.
This announcement is interesting, yet also confusing to me. Allow me to explain. Back in the beginning days of the Internet (and technically speaking, still today), we access websites through a series of numbers called IP addresses. So to go to one website, you would type, for example, 129.23.88.1 into the web browser and be taken to that homepage. But then, along came the domain name system, which allows a word to be translated into that address. So instead of remembering a very complex set of numbers for every one of their favorite sites, users can now simply remember facebook.com or google.com. You're probably wondering what this has to do with anything.
Well, in order to send someone an email, we have to remember a series of letters and numbers followed by an @ sign, followed by more letters, followed by a period, followed by more letters. This is ridiculous. I have saved all of my contacts, so sending them an email is not difficult because Gmail or whatever email program you use stores the names and associated emails. But suppose you want to send an email to your friend "John Smith?" You know his name, just not his email address. So what do you do? You either have to look his email up on Facebook, assuming it is publicly available, or you have to wait and ask him for it at some other time. This is a problem; it is a problem that Facebook can fix.
Email needs to be more social - a form of social which is not necessarily a bad thing. So what can Facebook do? Facebook, as you are aware, is currently the biggest social network in the world. It knows all of your connections; it knows that when you want to talk to "John Smith," it's not the same "John Smith" that someone else is likely wanting to talk to. This is where the confusion comes in, which I will do my best to explain.
Essentially, I am proposing that Facebook begin to change email all-together. Redo the inbox, make it a full-featured web-application, even allow IMAP and POP support. But it can be different than email in this way: Instead of having to remember my immature friend's email address of "fancypants340@facebook.com," I can instead formulate an email by typing, from any account, john.smith@facebook.com. Then, when Facebook's servers receive the email, they can compare the sender with the recipient and know which John Smith it was intended for. Have two John Smith's in your friends list? It could reply with an email that asks for clarification.
Internally, this would work similar to email, but in another way, entirely different. Instead of having to remember or store 2,000 contacts, all I have to do is remember their name. I think, if human social interaction demonstrates anything, that it is much easier to remember a name (think google.com) than a series of numbers of letters (think 173.194.33.104).
This announcement is interesting, yet also confusing to me. Allow me to explain. Back in the beginning days of the Internet (and technically speaking, still today), we access websites through a series of numbers called IP addresses. So to go to one website, you would type, for example, 129.23.88.1 into the web browser and be taken to that homepage. But then, along came the domain name system, which allows a word to be translated into that address. So instead of remembering a very complex set of numbers for every one of their favorite sites, users can now simply remember facebook.com or google.com. You're probably wondering what this has to do with anything.
Well, in order to send someone an email, we have to remember a series of letters and numbers followed by an @ sign, followed by more letters, followed by a period, followed by more letters. This is ridiculous. I have saved all of my contacts, so sending them an email is not difficult because Gmail or whatever email program you use stores the names and associated emails. But suppose you want to send an email to your friend "John Smith?" You know his name, just not his email address. So what do you do? You either have to look his email up on Facebook, assuming it is publicly available, or you have to wait and ask him for it at some other time. This is a problem; it is a problem that Facebook can fix.
Email needs to be more social - a form of social which is not necessarily a bad thing. So what can Facebook do? Facebook, as you are aware, is currently the biggest social network in the world. It knows all of your connections; it knows that when you want to talk to "John Smith," it's not the same "John Smith" that someone else is likely wanting to talk to. This is where the confusion comes in, which I will do my best to explain.
Essentially, I am proposing that Facebook begin to change email all-together. Redo the inbox, make it a full-featured web-application, even allow IMAP and POP support. But it can be different than email in this way: Instead of having to remember my immature friend's email address of "fancypants340@facebook.com," I can instead formulate an email by typing, from any account, john.smith@facebook.com. Then, when Facebook's servers receive the email, they can compare the sender with the recipient and know which John Smith it was intended for. Have two John Smith's in your friends list? It could reply with an email that asks for clarification.
Internally, this would work similar to email, but in another way, entirely different. Instead of having to remember or store 2,000 contacts, all I have to do is remember their name. I think, if human social interaction demonstrates anything, that it is much easier to remember a name (think google.com) than a series of numbers of letters (think 173.194.33.104).
Friday, November 12, 2010
Google Hacking
I recently completed a presentation for a security group at RIT called "Google Hacking." Essentially, Google hacking involves using certain logical search operators to find critical files that Google has indexed that shouldn't technically be indexed. This is usually the fault of the designers of the website because they did not specifically prevent Google from reading the content on their servers.
So what is the risk of having Google index your files? Well, let's think about the following search:
- intitle:“Index of..etc" passwd
Now, here lies the problem. Imagine if someone were to get a hold of the passwords stored in "passwd." These passwords, which are typically hashed, can actually be broken using simple tools such as John the Ripper. After completing many of these searches, I determined that a surprising number of results were returned when searching for these types of files.
The web designers (or hosts) who are creating these websites need to secure these files, either by hiding them from search engines or preferably encrypting the actual files. Here is my presentation:
So what is the risk of having Google index your files? Well, let's think about the following search:
- intitle:“Index of..etc" passwd
Now, here lies the problem. Imagine if someone were to get a hold of the passwords stored in "passwd." These passwords, which are typically hashed, can actually be broken using simple tools such as John the Ripper. After completing many of these searches, I determined that a surprising number of results were returned when searching for these types of files.
The web designers (or hosts) who are creating these websites need to secure these files, either by hiding them from search engines or preferably encrypting the actual files. Here is my presentation:
Subscribe to:
Posts (Atom)
