Ajax Content Type Handling in jQuery

In order to do this, we’ll have to use the ajax method, because the success function sends back the XMLHttpRequest object that we’ll use to read the content type.

$.ajax({
  type: "POST",
  url: "/widgets", 
  data: widgetForm.serialize(), 
  success: function(response, status, xhr){ 
    var ct = xhr.getResponseHeader("content-type") || "";
    if (ct.indexOf('html') > -1) {
      widgetForm.replaceWith(response);
    }
    if (ct.indexOf('json') > -1) {
      // handle json here
    } 
  }
});

This is perfect for handling different mime types sent from the server! =)

Loading mentions Retweet
| Viewed 114 times
|
Favorited 0 times

The Humble Lungi

 

The Legendary Lungi

Just as the national bird of Kerala is Mosquito, her national dress is  'Lungi'. Pronounced as 'Lu' as in loo and 'ngi ' as in 'mongey', a  lungi can be identified by its floral or window-curtain pattern.  'Mundu' is the white variation of lungi and is worn on special  occasions like hartal or bandh days, weddings and Onam.
 
Lungi is simple and 'down to earth' like the mallu wearing it. Lungi  is the beginning and the end of evolution in its category. Wearing  something on the top half of your body is optional when you are  wearing a lungi. Lungi is a strategic dress. It's like a  one-size-fits-all bottoms for Keralites.
 
The technique of wearing a lungi/mundu is passed on from generation to  generation through word of mouth like the British Constitution. If you  think it is an easy task wearing it, just try it once! It requires  techniques like breath control and yoga that is a notch higher than  sudarshan kriya of AOL. A lungi/mundu when perfectly worn won't come  off even in a quake of 8 on the richter scale. A lungi is not attached  to the waist using duct tape, staple, rope or velcro. It's a bit of  mallu magic whose formula is a closely guarded secret like the Coca  Cola chemicals.
 
A lungi can be worn 'Full Mast' or 'Half Mast' like a national flag. A  'Full Mast' lungi is when you are showing respect to an elderly or the  dead. Wearing it at full mast has lots of disadvantages. A major  disadvantage is when a dog runs after you. When you are wearing a  lungi/mundu at full mast, the advantage is mainly for the female  onlookers who are spared the ordeal of swooning at the sight of hairy  legs.
 
Wearing a lungi 'Half Mast' is when you wear it exposing yourself like  those C grade movie starlets. A mallu can play cricket, football or  simbly run when the lungi is worn at half mast. A mallu can even climb  a coconut tree wearing lungi in half mast. "It's not good manners,  especially for ladies from decent families, to look up at a mallu  climbing a coconut tree"- Confucius (or is it Abdul Kalam?)
 
Most mallus do the traditional dance kudiyattam. Kudi means drinking  alcohol and yattam, spelled as aattam, means random movement of the  male body. Note that 'y' is silent. When you are drinking, you drink,  there is no 'y'. Any alcohol related "festival" can be enjoyed to the  maximum when you are topless with lungi and a towel tied around the  head. "Half mast lungi makes it easy to dance and shake legs" says  Candelaria Amaranto, a Salsa teacher from Spain after watching  'kudiyaattam' .
 
The 'Lungi Wearing Mallu Union' [LUWMU, pronounced LOVE MU], an NGO  which works towards the 'upliftment' of the lungi, strongly disapprove  of the GenNext tendency of wearing Bermudas under the lungi. Bermudas  under the lungi is a conspiracy by the CIA. It's a disgrace to see a  person wearing Bermuda with corporate logos under his lungi. What they  don't know is how much these corporates are limiting their freedom of  movement and expression.
 
A mallu wears lungi round the year, all weather, all season. A mallu  celebrates winter by wearing a colourful lungi with a floral pattern.  Lungi provides good ventilation and brings down the heat between legs.  A mallu is scared of global warming more than anyone else in the  world.
 
A lungi/mundu can be worn any time of the day/night. It doubles as  blanket at night. It also doubles up as a swing, swimwear, sleeping  bag, parachute, facemask while entering/exiting toddy shops, shopping  basket and water filter while fishing in ponds and rivers. It also has  recreational uses like in 'Lungi/mundu pulling', a pastime in  households having more than one male member. Lungi pulling  competitions are held outside toddy shops all over Kerala during Onam  and Vishu. When these lungis are decommissioned from service, they  become table cloths. Thus the humble lungi is a cradle to grave  appendage.

Loading mentions Retweet
| Viewed 213 times
|
Favorited 0 times

a^2 + b^2 = c^2

Loading mentions Retweet
| Viewed 162 times
|
Favorited 0 times

Finding files with (classic) Mac line endings on a Mac

find . -name '*.txt' -exec grep -Pl '\r' {} \;

Editors are often unsuitable for converting larger files. For larger files (on Windows NT/2000/XP) the following command is often used:

TYPE unix_file | FIND "" /V > dos_file

On many Unix systems, the dos2unix (sometimes named fromdos or d2u) and unix2dos (sometimes named todos or u2d) utilities are used to translate between ASCII CR+LF (DOS/Windows) and LF (Unix) newlines. Different versions of these commands vary slightly in their syntax. However, the tr command is available on virtually every Unix-like system and is used to perform arbitrary replacement operations on single characters. A DOS/Windows text file can be converted to Unix format by simply removing all ASCII CR characters with

tr -d '\r' < inputfile > outputfile

or, if the text has only CRs, by converting CRs to LFs with

tr '\r' '\n' < inputfile > outputfile

The same tasks are sometimes performed with sed, or in Perl if the platform has a Perl interpreter:

sed -e 's/$/\r/' inputfile > outputfile                # UNIX to DOS  (adding CRs)
sed -e 's/\r$//' inputfile > outputfile                # DOS  to UNIX (removing CRs)
perl -pe 's/\r\n|\n|\r/\r\n/g' inputfile > outputfile  # Convert to DOS
perl -pe 's/\r\n|\n|\r/\n/g'   inputfile > outputfile  # Convert to UNIX
perl -pe 's/\r\n|\n|\r/\r/g'   inputfile > outputfile  # Convert to old Mac


To identify what type of line breaks a text file contains, the file command can be used. Moreover, the editor vim can be convenient to make a file compatible with the Windows notepad text editor. For example:

[prompt] > file myfile.txt
myfile.txt: ASCII English text
[prompt] > vim myfile.txt
  within vim :set fileformat=dos
             :wq
[prompt] > file myfile.txt
myfile.txt: ASCII English text, with CRLF line terminators

The following grep commands echo the filename (in this case myfile.txt) to the command line if the file is of the specified style:

grep -PL $'\r\n' myfile.txt # show UNIX style file (LF terminated)
grep -Pl $'\r\n' myfile.txt # show DOS style file (CRLF terminated)

For Debian-based systems, these commands are used:

egrep -L $'\r\n' myfile.txt # show UNIX style file (LF terminated)
egrep -l $'\r\n' myfile.txt # show DOS style file (CRLF terminated)

The above grep commands work under Unix systems or in Cygwin under Windows. Note that these commands make some assumptions about the kinds of files that exist on the system (specifically it's assuming only UNIX and DOS-style files—no Mac OS 9-style files). Check the -P, -L, and -l options to understand how it works.

This technique is often combined with find to list files recursively. For instance, the following command checks all "regular files" (e.g. it will exclude directories, symbolic links, etc.) to find all UNIX-style files in a directory tree, starting from the current directory (.), and saves the results in file unix_files.txt, overwriting it if the file already exists:

find . -type f -exec grep -PL '\r\n' {} \; > unix_files.txt

This example will find C files and convert them to LF style line endings:

find -name '*.[ch]' -exec fromdos {} \;

The file command also detects the type of EOL used:

file myfile.txt
> myfile.txt: ASCII text, with CRLF line terminators

Other tools permit the user to visualise the EOL characters:

od -a myfile.txt
cat -e myfile.txt
hexdump -c myfile.txt

dos2unix, unix2dos, mac2unix, unix2mac, mac2dos, dos2mac can perform conversions. The flip [10] command is often used.

Loading mentions Retweet
| Viewed 190 times
|
Favorited 0 times

Sample Valid Credit Card Numbers


Credit Card  Sample Number 
Visa  4111 1111 1111 1111 
MasterCard  5500 0000 0000 0004 
American Express  3400 0000 0000 009 
Diner's Club  3000 0000 0000 04 
Carte Blanche  3000 0000 0000 04 
Discover  6011 0000 0000 0004 
en Route  2014 0000 0000 009 
JCB  3088 0000 0000 0009 

Loading mentions Retweet
| Viewed 185 times
|
Favorited 0 times

8 Canonicalization Best Practices In Plain English

You can avoid the heartbreak of bad canonicalization, or at least minimize it, by doing a few simple things:

  1. Use 301 redirection to ensure that your home page is only found at one URL. If you don’t know how, read Stephan Spencer’s column about rewrites and redirects.
  2. Link consistently to your home page from within your own site. Use a single URL for your home page. Don’t mix in instances of ‘www.iansnerdvana.com/index.html’ with ‘www.iansnerdvana.com’. If you aren’t doing this properly right now, a quick change may have a big impact on SEO.
  3. Don’t use tracking IDs in internal site navigation. A lot of sites add stuff like ‘?source=blog’ in their navigation. That lets them use their analytics reports to track user movement within, to and from their site. Instead, learn to use your web analytics referrer and navigation path reports. If you must use tracking IDs, change your software to use a hash mark (a ‘#’ sign) instead of a question mark. Search engines ignore everything after the hash, so you’ll avoid confusion.
  4. Don’t use tracking IDs in organic links from other sites. If you get a link on another site, and want it to help with your SEO, don’t put a tracking ID in that, either.
  5. Be careful with pagination. Many sites have pagination, where visitors can click a 1, 2, 3 etc. to jump to later pages in search results, product lists or articles. That’s fine, but make sure that the each page has a single URL. For example, if page 1 of the article is ‘www.iansnerdvana.com/article.html’ when I click the article link from the home page, make sure that the number ‘1′ in the pagination takes me there, too, instead of to ‘www.iansnerdvana.com/article.html?page=1′.
  6. Set up preventative redirects. Make sure that ‘iansnerdvana.com’ 301 redirects to ‘www.iansnerdvana.com’.
  7. Exclude ‘e-mail a friend’ pages. Most content management systems that have ‘e-mail a friend’ options direct the user to a unique page that has the same form and content. But every instance of that page has a unique URL like ‘ID=123′, to tell the server which product or article to forward. It’s canonical higgeldy-piggeldy. Use robots.txt and the meta robots tag to exclude these from search engine crawls.
  8. Use common sense when building your site. Think, man/woman! If you need to change the header, footer or other page element based on where on your site the visitor came from, do it with cookies, or by sniffing out the referring URL. Design to do this ahead of time.

Loading mentions Retweet
| Viewed 182 times
|
Favorited 0 times

Cameron Herold: Let's raise kids to be entrepreneurs

Brilliant talk - I need to watch this every few years!

Loading mentions Retweet
| Viewed 197 times
|
Favorited 1 times
Filed under  //   education   entrepreneur   entrepreneurship   kids  

How To Become a Millionaire In Three Years | Jason L. Baptiste

I move forward the only direction
Cant be scared to fail in Search of perfection

-Jay-Z, On To The Next One

I’m going to go and replace 3 years with a “short time frame”. Some things to focus on:

Market opportunity- A million dollars is not a lot in the grand scheme of things, but it certainly is a lot if the market opportunity is not large enough. Even if you put Bill Gates and Steve Jobs as founders in a new venture with a total market size of 10 million, there is no way they could become too wealthy without completely changing the business (ie- failing).

Inequality of information- Find a place where you know something that many undervalue. Having this inequality of information can give you, your first piece of leverage.

Leverage skills you know- You can go into new fields such as say Finance, but make sure you’re leveraging something you already know such as technology and/or product. Someone wanted to start a documentary with me. I said that would be fun, but it would be my first documentary regardless of what happened. There was a glass ceiling due to that. If I do something leveraging a skill I know, I’m already ahead of the game.

Look in obscure places- We’re often fascinated with the shiny things in the internet industry. Many overlook the obscure and unsexy. Don’t make that mistake. If your goal has primarily monetary motivations, look at the unsexy.  One example would be email newsletters, which I’ve profiled before.

Surround yourself with smart people- Smart people whom are successful usually got there by doing the same and have an innate desire to help those do the same. It’s the ecosystem that’s currently happening with the paypal mafia and can be traced all the way back to fairchild semiconductor.

Charge for something- Building a consumer property dependent upon advertising has easily made many millionaires, but it isn’t the surest path. It takes a lot of time and scale, which due to cashflow issues will require large outside investment probably before you are a millionaire. Build something that you can charge for.  That’s how business has worked for thousands of years prior to the 1990s.  Make something, charge for it, repeat it.  DHH explains this really well at Startup School 08.

Information Products Are Valuable- E-Books, screencasts, And anything that can teach others to be good at something is a very lucrative business.  Look at guys like peepcode… they’re killing it.  There are also things like Parrot Secrets, which make 400k a year.  Bonus points if the information helps a person make money (directly or indirectly) or improves their self image.  Fyi, this doesn’t mean sell snake oil ebooks.  That may get you a somewhere in the 5 figures, but word will spread that your shit smells.

Your primary metric shouldn’t be dollars- If you’re going after a big enough market and charging a reasonable amount, you can hit a million dollars. Focus on growth, customer acquisition costs, lifetime value of the customer, and churn.

Get as many distribution channels as possible- There is some weird sense that if you build something they will just come. That a few “like”+retweet buttons and emails to editor@techcrunch.com will make your traffic explode + grow consistently. It fucking won’t. Get as many distribution channels as possible. Each one by itself may not be large, but if you have many it starts to add up. It also diversifies your risk. If you’re a 100% SEO play, you’re playing a dangerous dangerous game. You’re fully dependent upon someone else’s rules. If Google bans you, you will be done. You could easily replace the SEO example with: App store, facebook, etc.

Go with your gut and do not care about fameballing- Go with what your gut says, regardless of how it might look to the rest of the world. Too often we (I) get lost in caring about what people think. It usually leads to a wrong decision. Don’t worry about becoming internet famous or appearing on teh maj0r blogz. Fame is fleeting in the traditional sense. Become famous with your customers. They’re the ones that truly matter. What they think matters and they will ultimately put their money where their mouth is.

Be an unrelenting machine- Brick walls are there to show you how bad you want something. Commit to your goals and do not waver from them a one bit regardless of what else is there. I took this approach to losing weight and fitness.  I have not missed a single 5k run in over a year. (Here’s how I lost 50 pounds btw). It did not matter if I had not slept for two days, traveling across the country, or whatever else. If your goal is to become a millionaire, you need to be an unrelenting machine that does not let emotions make you give up / stop. You either get it done with 100% commitment or you don’t. Be a machine.

If it’s a mass market “trend” that’s all over the news, it’s too late- This means the barriers to entry are usually too high at this point to have the greatest possible chance of success. Sure you could still make a lot of money in something like the app store or the facebook platform, but the chances are significantly less than they were in the summer of 08 or spring of 2007. You can always revisit past trends though.  Peter Cooper and I clarified some of the semantics about what is a trend over here.

If you do focus on a dollar amount, focus on the first $10,000- This usually means you’ve found some repeatable process / minimal traction. ie- if you’re selling a $100 product, you’ve already encountered 100 people who have paid you. From here you can scale up. It’s also a lot easier to take in when you’re looking at numbers. Making 1 million seems hard, but making $10,000 doesn’t seem so hard, right?

Be a master of information- Many think it might be wasteful that I spent so much time on newsyc or read so many tech information sites. It’s not, it’s what gives me an edge. I feel engulfed.

Get out and be social- Even if you’re an introvert, being around people will give you energy. I’m at my worst when I’m isolated from people and at my best when I’ve at least spent some time with close friends (usually who I don’t know from business.)

Make waves, don’t ride them- There was a famous talk Jawed Karim gave from youtube. He described the factors that made youtube take off in terms of secondary/enabling technologies. I think they included (1- broadband in the home 2- emergence of flash, so no codecs required 3- proliferation of digital cameras 4- cheap hosting 5- one click upload 6- ability to share embed). Find those small pieces and put them together to make the wave. That’s what youtube did imho. The other guys really just rode the wave they created (which is okay).

Say no way more than you say yes- I bet almost every web entrepreneur has encountered this: You demo your product / explain what you’re doing and someone suggests that you do “X feature/idea”. X is a really good idea and maybe even fits in with what you’re doing, but it would take you SO FAR off the path you’re on. If you implemented X it would take a ton of time and morph what you’re doing. It’s also really really hard to say no when it comes from someone well respected like a VC or famous entrepreneur. I mean how the fuck could they be wrong? Hell, they might even write me a check if I do what they say!!!!! Don’t fall for that trap. Instead write the feedback down somewhere as one single data point to consider amongst others. If that same piece of feedback keeps coming up AND it fits within the guidelines of your vision, then you should consider it more seriously. Weight suggestions from paying customers a bit more, since their vote is weighted by dollars.

Be so good they can’t ignore you- I first heard this quote from Marc Andreessen, but he stole it from Steve Martin. Just be so good with what you do that you can’t be ignored. You can surely get away with a boring product with no soul, but being so good you can’t ignore is much more powerful.

Always keep your door/inbox open- You never know who is going to walk through your door + contact you. Serendipity is a beautiful thing. At one point Bill Gates was just a random college kid calling an Albuquerque computer company.

Give yourself every opportunity you can- I use this as a reason why starting a company in silicon valley when it comes to tech is a good idea. You can succeed anywhere in the world, but you certainly have a better chance in the valley. You should give yourself every opportunity possible, especially as an entrepreneur where every advantage counts.

Give yourself credit- This is the thing I do the least of and I’m trying to work on it. What may seem simple+not that revolutionary to anyone ahead of the curve can usually be pure wizardry to the general public, whom is often your customer. Give yourself more credit.

Look for the accessory ecosystem- iPod/iPhone/iPad case manufacturers are making a fortune. Armormount is also making a killing by making flat panel wall mounts. Woothemes makes millions of dollars a year (and growing) selling Wordpress themes. There are tons of other areas here, but these are the ones that come to mind first. If there’s a huge new product/shift, there’s usually money to be made in the accessory ecosystem.

Stick with it- Don’t give up too fast. Being broke and not making any money sucks + can often make you think nothing will ever work. Don’t quit when you’re down. If this was easy then everyone would be a millionaire and being a millionaire wouldn’t be anything special. Certainly learn from your mistakes + pivot, but don’t quit just because it didn’t work right away.

Make the illiquid, liquid- I realized this after talking to a friend who helps trade illiquid real estate securities. A bank may have hundreds of millions of assets, but they’re actually worth substantially less if they cannot be moved. If you can help people make something that is illiquid, liquid they will pay you a great deal of money. Giving you a 20-30% cut is worth it, when the opposite is making no money at all.

Productize a service- If you can make what might normally be considered a service into a scaleable, repeatable, and efficient process that makes it seem like a product you can make a good amount of money. In some ways, I feel this is what Michael Dell did with DELL in the early days. Putting together a computer is essentially a service, but he put together a streamlined method of doing things that it really turned it into a product. On a much smaller scale, PSD2XHTML services did this. It’s a service, but the end result + what you pay for really feels like a product.

Look For Something That Is Required Or Subsidized By Law-  Motorists are required to have insurance, public companies have to go through sarbox laws, doctors get tens of thousands of dollars for EHR systems, etc.  Look for something that is required by law and capitalize on that.  Usually things that are required and/or subsidized by law are mind numbing with complexities.  Find a way to simplify that process.

Make Sure You’re Robbing A Bank- When Willie Sutton was asked why he robbed banks, he said because that’s where the money is (Thanks to edw519 for this phrase).  Make sure whatever you’re going after is where the money actually is ie- a customer that will pay you.  Consumer markets are tough, especially with web based products.  People expect everything to be free.  Businesses are usually your best bet.

Don’t Be Emotional- Emotions can let you make stupid decisions.  It can make you not walk away because you’re attached to something.  Most importantly it will lead to indecision and a loss of confidence.  Put your emotions into your product or save them for your lover, family, friends,etc.

Don’t Leave Things Up to Chance- People feel that things will just work out due to carpe diem.  They usually don’t  People can be unreliable, deals can fall through, and shit will always happen.  Prepare for multiple scenarios and contingencies.  You can mitigate this by working with smart AND reliable people.

Raise Revenue, Not Funding- Everyone is always so damn fixated on getting funded because it’s the cool thing to do.  Focus on getting people to pay you at first and then scale things outwards with funding IF and WHEN you need it.  If your goal is to make a million dollars in three years, funding probably isn’t the way to go.  VCs won’t let you take a salary of ~300k per year.  Selling a company in < 3 years is a crapshoot.  The lifespan of an investment is usually about 7 years from what I’ve read.

Don’t Get Comfortable- You will probably get comfortable somewhere around 200k, maybe less or more, but it will certainly be before 1 million dollars.  If you get comfortable you start getting off balance and having the hunger to move forward.  Reward yourself a little bit, but live as frugally as possible.  I have friends who have made some okay money, but blow it all away on stupid shit because they got comfortable.

Look For Those Who Are Comfortable-  Who is comfortable in a certain industry?  Go in and knock them off their hammock so they spill their mojitos on themselves.  This can also be considered stagnation.  Industries often mature and people get comfortable keeping the status quo.  Stagnation is the mid-life crisis for a former trend. This is usually a good point to come in with something.

Don’t Skimp on the Important Things- When it comes to things that need to be reliable such as infrastructure, delivery, or even your own personal tech equipment – don’t skimp out.  These are the tools that ensure reliability and your product being delivered.  You can skimp on the office space, the desks, coach airfare, budget motel in mountain view,etc.

Companies Spend Just as Much or More On Services as they do On Software-  Paying for the ERP, CRM, or custom built system is just the first step.  There’s the maintenance, training, and service contracts.

Keep The Momentum Going-  I’ve had projects where things were moving a million miles an hour, then BOOM, they just lost a lot of momentum.  That is the worst possible thing you can have happen.  Keep moving the ball everyday.

Listen (or read the transcriptions of) to Every Mixergy Interview You Can- Most of my audience will probably know about Mixergy, but I can’t let a single reader leave without making sure they know it exists.  It is by far the most practical resource on the Internet if your goal is to do well.  Andrew has interviewed entrepreneurs from all walks of life with varying levels of success.  Most of them had real business models and bootstrapped.  Most importantly, he finds out what specifically led to their success. Link to Mixergy.

Last, but not least:  Learn How To Filter- I just wrote upwards of 2,200 words.  Some of the points are even contradictitory.  Start adding in other sources of information and you will feel like you’re being pulled in a five million directions.  You then become indecisive.  Take in information and then filter the good bits while synthesizing them to be a part of your overall plan.  What works for person A doesn’t always work for person B.

Loading mentions Retweet
| Viewed 222 times
|
Favorited 0 times

Church Sign

Loading mentions Retweet
| Viewed 206 times
|
Favorited 0 times

My View vs Street View

Loading mentions Retweet
| Viewed 203 times
|
Favorited 0 times