Posts Tagged ‘PHP’

Problem 6 - What is the difference between the sum of the squares and the square of the sums?

// July 6th, 2009 // No Comments » // Project Euler

The sum of the squares of the first ten natural numbers is,

1^(2) + 2^(2) + … + 10^(2) = 385

The square of the sum of the first ten natural numbers is,

(1 + 2 + … + 10)^(2) = 55^(2) = 3025

Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 - 385 = 2640.

Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.

Sharing Your iTunes Library Online With PulpTunes

// July 1st, 2009 // 4 Comments » // Apple, iTunes

Pulp Tunes

So you want to share your iTunes library over the Internet. Many will say it can’t be done, and to those people I say, eat monkey balls!! Not only can you do it, not only is it super easy, it’s also FREE!! How you ask? I will tell you. All you need is this handy little program called PulpTunes. What PulpTunes does is install as a web service with a slick interface and let you access your library through your computer’s IP address.

What are some of the other features of PulpTunes?

  • Works on PC, MAC and Linux
  • Allows your to download the music files
  • Supports MP3 and AAC(MP4) files
  • Displays album art work
  • Command line mode for a server environment
  • FREE!!

Now lets walk through the basic set up, and then a more advanced set up in case you are on a dynamic IP.

The basic set up

What you’ll need:

  1. Latest version of PulpTunes
  2. Computer with iTunes installed
  3. Knowledge of how to open ports in your router

What you need to do:

  1. Download PulpTunes and install it…easy
  2. Log into your router and forward/open  port 15000, depending on what model you have it’ll be different. PulpTunes will provide you with a link to  a website where you can get detailed instructions for nearly every model out there.
  3. Open your web browser and navigate to http://your-ip-address:150000 Once again, PulpTunes will tell you what your IP address is.
  4. If you can’t access your library this way then you did something wrong, time to hit the PulpTunes forum, FAQ or leave a comment below and I’ll try to help you. If you can see your library, then you’re pretty much set. Blast the speakers and Enjoy!!

Dealing with those pesky Dynamic IP Addresses

Once you have PulpTunes set up and you’re happily jamming you’re pretty much set, that is, until your IP changes. This can happen at various times depending on your ISP and your locations. Sometimes it also happens if you turn off your computer, or unplug your router for a long time. In any case, it sucks, and can make you look bad if you’re trying to show off to your friends.

The solution: Use a service like www.dyndns.com/ which lets you assign a domain name to a dynamic IP address. Then when your IP address changes, dymdns.com will automagically update the domain to reflect the new IP address. The only drawback is that your domain will look something like itunes.dyndns.biz, where “itunes” is what I typed in myself, but that is still better than an IP address with a port number at the end.

(more…)

Problem 5 - What is the smallest number divisible by each of the numbers 1 to 20?

// June 29th, 2009 // No Comments » // Project Euler

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest number that is evenly divisible by all of the numbers from 1 to 20?

Problem 4 - Find the largest palindrome made from the product of two 3-digit numbers

// June 22nd, 2009 // No Comments » // Project Euler

A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.

Find the largest palindrome made from the product of two 3-digit numbers.

Problem 3 - Find the largest prime factor of a composite number

// June 15th, 2009 // 2 Comments » // Project Euler

The prime factors of 13195 are 5, 7, 13 and 29.

What is the largest prime factor of the number 600851475143 ?

Problem 2 - Find the sum of all the even-valued terms in the Fibonacci sequence which do not exceed four million

// June 9th, 2009 // 2 Comments » // Project Euler

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:

1, 2, 3, 5, 8, 13, 21, 34, 55, 89, …

Find the sum of all the even-valued terms in the sequence which do not exceed four million.

Problem 1 - Add all the natural numbers below one thousand that are multiples of 3 or 5

// May 26th, 2009 // 2 Comments » // Project Euler

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.

About Project Euler

// May 22nd, 2009 // No Comments » // Project Euler

I found these challenges very useful to the development and assessment of my programming abilities. From now I I will post a question from the Project Euler website as a challenge to all readers who have an interest in programming. Ideally the solutions will be submitted in PHP, but other languages will be accepted. I will post a challenge every Monday to give you the week to work on it and from the order of the submitted solutions we will know who came up with the answer first.

What is Project Euler?

Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems.

The motivation for starting Project Euler, and its continuation, is to provide a platform for the inquiring mind to delve into unfamiliar areas and learn new concepts in a fun and recreational context.

$100 off Zend Studio for your time

// May 19th, 2009 // 1 Comment » // Zend Framework

email-survey-100off-siderailI’ve been using the Zend Framework for several months now, it started with about 4 hours of hair pulling, 3 hours of cursing and who knows how many hours of puring myself over the documentation, which in my opinion leaves a lot to be desired (hint, hint, Zend). Thankfully now I have a good grasp of it and I’ve developed a full online ordering portal for the company I work for, and I am in the middle of rewriting the current company’s main website.

Through the entire process for these 2 projects I switched over from Dreamweaver to using the Zend Studio IDE, and I love it. And now Zend is giving you at least $100 off Zend Studio if you take a survey, that in their words will:

…collect information about your PHP development and production environments, your PHP IDE usage and the importance of some IDE features. It should about 5 minutes of your time to answer the questions.  Your coupon code for use on the Zend online store as well as the current aggregate survey results will be available to you at the end of the survey.

Sounds pretty good to me, so get to it everyone.