AppScout has a good article on the new Amazon’s payment service:
Amazon on Tuesday unveiled two new payment options that allow Web site owners to shift payment transactions to the online retailer.
With Checkout by Amazon, webmasters will get help from Amazon in managing shipping charges, sales tax, promotions, and post-sale activities including shipments, refunds, cancellations, and charge backs.
Amazon Simple Pay, meanwhile, is a less complicated option for those who don't need Amazon's end-to-end checkout pipeline and order management capabilities.
To enable Checkout by Amazon, webmasters must add Amazon 1-Click to their Amazon.com account and insert a few lines of code into their Web site template. When customers go to check out of the site, they click the "Checkout with Amazon" button, a widget pops up asking for a shipping address, and customers buy via Amazon's 1-Click. Amazon sends them a confirmation e-mail, and users remain on your site.
Click here to read more
CAPTCHAs are everywhere now. When you want to open an account, anywhere, you will encounter one of those. But there are times when the programmers probably needed a spec describing exactly what the expression “proving that you are a human” means…
Corey Smith found some of the worst CAPTCHAs on the Web. Here is my personal favourite:
A common thing you may want to do when dealing with transactions involving various documents and files is insert them into you SQL Server database. The following code snippet let you load a file from the disk and insert it into your database.
INSERT INTO myTable (documentData)
SELECT * FROM
OPENROWSET(BULK N'c:\myDocument.doc', SINGLE_BLOB) as dt
Note that you need to name the select statement (here, I named it “dt”) or you will get this error message:
Server: Msg 491, Level 16, State 1, Line 3
A correlation name must be specified for the bulk rowset in the from clause.
Using SQL Server 2005 new function ROW_NUMBER() makes this really easy.
All you have to do is to add the function ROW_NUMBER, with the OVER() clause as such :
OVER (ORDER BY EmployeeName) AS Row,
EmployeeId, EmployeeName, Salary
The OVER clause needs an “order by” parameter to know how to sort the rows for proper numbering.
There is a very simple script to accomplish this and this can be really helpful for generating stats on a week-by-week basis:SELECT DATEADD
(wk, 0, GetDate
Replace GetDate with a datetime column and you could generate, for example, a sales report, week-by-week.
This isn’t necessary a critical part of a DBA’s job but, at times, it can be useful to have an idea of how many rows are in your databases.
The simplest way to get it is with this query:
select sum(rowcnt) from sysobjects, sysindexes
where sysindexes.id = sysobjects.id and sysindexes.indid in (0, 1) and sysobjects.xtype = 'u'
This will get you the sum of rows in the entire database, for users objects only. If you want the table-by-table breakdown, you can simply add the name of the object in the query:
select sysobjects.name, sysindexes.rowcnt from sysobjects, sysindexes
where sysindexes.id = sysobjects.id and sysindexes.indid in (0, 1) and sysobjects.xtype = 'u'
order by sysobjects.name
From The Wall Street Journal:
Brand reputation, or what your customers think about your business, is crucial for any small company that wants to attract new clients and grow a business.
What one customer says in a blog or product review can directly influence another customer’s decision to choose you over your competitors.
Here are four ways you can monitor your brand online:
1. Google Alerts: Set up a once-a-day alert for the names of your company, key products and top executives so you can check every time they’re mentioned on a Web site or news story. You can also set up alerts to track the same information about your competitors.
2. Social-media buzz: At Serph.com, you can search social-media sites that Google Alerts may not catch. For example, Serph pulls results from social-bookmarking site del.icio.us and social news site digg.com, among others.
3. Customer reviews: Monitor and respond to what customers are saying about your business on review Web sites like Yelp.com and Citysearch.com. These sites allow businesses to register with the site so they can customize their listings with contact information and better interact with customers.
4. Yahoo Pipes: This service allows you to set up a “pipeline” that aggregates information from search engines, miniblogging tool twitter, photo-sharing site flickr and other Web portals that could be mentioning your business.
The quality of your sleep is a determining factor in your daily productivity. Hacking your sleep schedule requires some time and effort but can be really rewarding in the end. You will have more time to do whatever you like to do (work, be with your family, blog, etc.) and you will have more energy to do it.
- Do not eat before going to bed (at least 2 hours before sleep time).
- Sleep in dark, quiet room.
- Sleep with fresh air (open windows or get air refresher).
- Exercise during the day. If you don’t exercise, go for a 15 minutes walk before the sleep time.
- Do not watch TV in the bed before going to sleep. Read a book, take a bath, do something relaxing.
- Don’t drink coffee or other stimulants within 6 hours of bed time.
- Don’t take long naps (more than 30 minutes) during the day.
Follow these simple tips and within one or two weeks you will notice how your sleep starts improving.
A trick that works marvels for me is:
First, condition yourself to wake up exactly at the same time every morning, weekdays, weekends and holidays included. Your body needs stability at some point in the sleeping process. For working people like me, the easiest variable to standardize is the wake-up time. Then, go to sleep only when you feel tired. Don’t give yourself a specific bed time but let your body decide when you need sleep. By having the same wake-up time, your body will automatically feel tired at exactly the right time to have the perfect sleeping time, every time. Doing so will save you countless hours of sleepless bedtime. I went from 8–9 hours of sleep per normal night to 6–7 and I have the same amount of energy than before.
Another tip that I can give you is to stop the caffeine and replace it with exercise. A good rule of thumb is 15 minutes of exercise for each cup of coffee taken in a normal day. For example, if you take 3 coffees in your normal day, exercise 45 minutes per day. After 2–3 weeks, you will find that you need less and less coffee to stay awake and alert. Within 2–3 months, you will have replaced your coffee addiction altogether, you will be more healthy, more rich (coffee is expensive in the long run), you will sleep better and you will need less sleep than before.
Since everyone is different, something that works for me may not work for you. These are just examples of what you can do to sleep better but you need to find what works best for you.
The LTRIM function in T-SQL only removes whitespaces. But, in some instances, you need to do more complex trimming. The trick is to use the PATINDEX function in conjunction with the STUFF function. PATINDEX will return the index of the first occurence of a specified pattern. In my example below, PATINDEX will return the index of the first non-zero character. STUFF takes 4 parameters:
– the affected column
– the the starting point of the deletion
– the length of the deletion
– a string to insert at the deletion point
So the code below will delete all characters, starting at the first, and finishing before the first non-zero character. Why not use SUBSTRING instead? Because STUFF is a little more robust than SUBSTING and will not raise an error on you if the PATINDEX returns -1.
SELECT STUFF(myColumn, 1, PATINDEX('%[^0]%', myColumn) - 1, SPACE(0)) FROM mytable
Also, if you happen to have a column of type float and you want to get the values without the leading zeros (for example, 0.75 would become .75), you simply need to cast your column as varchar and you’re set.
I have many ideas during the course of a normal day. A lot of which I can’t realise or I just don’t have the time to execute. So for your viewing pleasure, here are some of them. Feel free to use any or all of them at no cost at all.
If you are a cellphone or mobile device developer, you might be interested in:
- 911–SMS: When you’re at home and a burglar enters, it may occur to you that your need to inform the cops that you are in danger. What the system seems to be lacking as of today is a proper text-message based emergency call. Have you wondered how awkward it would be to phone the cops and let the bad guy know where you are hidden in the same time. What every cellphone need is some preset emergency text messages with your address already written down that would be redirected to your local police station (as any 911 call would do). That way, it would be a lot easier to let the cops know that you are in danger without revealing your position to an intruder.
- Cell-Reminder: I don’t know if this has been done but it would a very useful feature in my opinion. This should be a feature directly integrated in the cellphone itself. You select the “Remind-me” feature and you say a date and time and a message. Something like “tomorrow, 5pm, pick up some milk”. With some basic voice recognition software and a little hard drive, you save the message and the cellphone automatically rings at the requested date and time and play the message you previously recorded.
That’s it for today folks. Happy coding!