Online Coupon Codes and Its Function for You

Online coupon codes might be one important thing for some people who need it. Well, having a coupon is something interesting for some people. Moreover, it would be more interesting when the online coupon can be use for several important needed.

A coupon usually gives you different choice of function of the coupon. Usually, the coupon is used to get the discount of some online shop or some stores that provides the costumers to get the discount from the online coupon. Sometimes, some brands also provides the online coupon for those customers who always have in faith with them.

The online coupon codes are needed so that the coupon can be used for the transaction. You can look for the codes or ask the codes, but sometimes it needs some requirement that would be different from one store with another store.

Besides that, the number or the percentage of each coupon will be also different, it can be started from 10% of discount up to 40% of discount. It depends on the promo that is going on in the store. So, you have to pray so that your favorite store will give you the coupon for the discount.

How you can use the coupon? If you ask about how you can use it, of course you have to get the codes first, so that you can get that online coupon. Besides that, you also can use the coupon for some needs if you think that you need the stuff.

The stuff that you can buy with the online coupon is also sometimes limited by the store, so not all stuff you can buy even though you got the online coupon, if the store does not allow for it. So, use your online coupon or online coupon codes as wise as you can.

Databases are a necessity for any modern application. You might choose to go the traditional relation route, or choose a more hip NoSQL option. As developers we are often taught to load/query based on primary keys because it is more performant. The downside to this approach is you might possibly be leaking sensitive information that you never intended. How is this possible?

SQL / Relational Example

Ids in relational databases are usually integers or some variation of that, this allows us to get really succinct and clear urls in our web apps. Let’s take the following url as an example.

/user/100/order/1000

That is a clean url, but let’s look at it from an outsiders perspective. What might we be able to guess from the url.

  • We are looking at User #100
  • We are looking at Order #1000

We might also be able to glean how much each order is based on site information. This site might be selling $20 trinkets. So let’s break it down.

100 users * 1000 orders * $20 = $2,000,000

I now know that this business has a likely income of $2,000,000 dollars. This is sensitive information that the business might not want getting out, but as developers we may have just spilled the beans.

Let’s take Tech.Pro for example. I know that they use SQL Server on the backend and each post is given a numeric id. This post’s id is 1538. It might be a safe guess to make that there are 1538 posts on Tech.Pro as of writing this post.

NoSQL (RavenDB) Example

The default behavior of RavenDB is to associate the domain model name with your Id.

customers/1000

if you are using sharding your id might look like this.

USA/customers/1000

If this Id is publicly visible, what can we tell about our application?

  • You have a Shard based on the geographic region of “USA”
  • You have a domain model of Customers
  • You potentially have 1000+ customers

the last point of 1000+ customers is iffy since RavenDB uses a hilo algorithm, but it might be close enough to get an understanding of the user base. Additionally, you know that the developer has a domain object of customers. Knowing how a developer is structuring an app might give you insight into how to break their app.

Solution

The solution is really simple, but complex in its implementation.

You need to generate your own public facing Ids.

Some ways to generate it might include the following data.

  • Date and Time
  • Guid (non-sequential)
  • Counts relative to that specific user (if user data)
  • Slugs based on public data

The above solution will work for both RDMBS and NoSQL databases, since your Id will likely be part of your primary or secondary indexes.

Conclusion

Next time you think about exposing a default Id from your database, think about the implications to your business and ask yourself: “Do I really want people knowing this information?”

P.S. Sorry for the terrible Adult diapers joke in the title 🙂

After a long time of programming, I’ve realized that nulls are just evil, but what is worse is the idea that a collection can be null. This might be a provocative thing to say, or you might be on my side. I’ll try to explain myself and see if you agree with me.

Introduction

Every programming language has concepts centered around Set theory. If you are a C# programmer then you might know these sets by other names: Array, List, Collection, and Queue. There are many more than that. If you are unsure what a set is, then please allow me to explain?

A set is a well defined collection of objects. The objects that make up a set (also known as the elements or members of a set) can be anything: numbers, people, letters of the alphabet, other sets, and so on. – Wikipedia

So a set is just a group of stuff, seems simple enough right?

The Problem

In languages that support null values, a variable defined as a set can also itself be null. This can lead to situations where you get in trouble for asking questions about a specific set that is null. The number one question being the length of the set. This also leads to a lot of null checking that seems, to me at least, unnecessary.

My Argument

In .NET everything derives from the object class. This includes our favorite collections: List, Array, etc. This means that technically collections can be null, since they derive from object. This is an oversight by the .Net creators, since collections should fundamentally be a description of a set of 0 or more things. This means a set of nothing is a valid set, while nothing (null) is not a set by definition since it is not a group.

We deal with sets all the time in code, and an empty set is very useful. You might see things like this in your code or other codebases:

// Hey Set, How are you?
if (users.Any()) 
    DoSomething();

var max = Values.Max();
var min = Values.Min();

var hits = Punches.Sum();

Notice those descriptive methods still give you valuable information about the set, even if you imagine those sets are empty. I always do null checking on my sets, but why doesn’t the language just not allow sets to be null anymore and save us all a lot of time?

Workaround

This workaround isn’t a silver bullet, but I found it helps me a lot. I have also noticed, by skimming other projects on GitHub, that this is a more common problem than you think.

public class User {

    public User() {
       // a new user gets a new set
       Phones = new List<string>();
    }

    public IList<string> Phones { get; set; }
} 

You just set the collection / set in the constructor and it should be safe to start off with. The only issue is that the set operator is still exposed. You could solve this by not exposing it; this can be accomplished by using the protected or private keywords.

Conclusion

Some might argue that nulls are valuable, and I do recognize their value in some circumstances, but when it comes to collections it does not make any sense to allow them to be null. This would be near the top of the wish list in any new language / framework. Microsoft, if you are reading this, then I beg you to consider making this fix in the next version of the .Net Framework, or at least tell me why I’m wrong.

Be Careful with Amazon EC2’s Micro Instance

For the last few years we’ve been using a dedicated server for all of our hosting needs, but recently we decided to choose something a little more flexible and extensible and Amazon’s EC2 seemed like a perfect fit. Amazon offers a free micro instance for a year, so off we went – building our latest project. It wasn’t until the server started getting a little use that we noticed something important – a micro instance could end up costing us a significant amount of money.

At first this doesn’t make any sense because the micro instance is by far the cheapest solution Amazon offers. The problem is how storage is handled on a micro versus other types of instances. The only available choice on micro instances is the Elastic Block Storage (EBS), which charges per 1 million I/O requests. You might think a million I/O requests is a lot, but when you have an operating system, database, and web server all reading and writing data, requests build up extremely fast.

We were charged about \$0.54 the first month and didn’t think anything of it. It wasn’t until half way through the second month when we finally sat down and did the math. If five people using the site a few times a day are able to rack up half a buck, what happens if the site begins getting similar traffic to this site – 500K per month. That’s potentially 100,000 times more I/O requests, or \$54,000. Of course we don’t expect that much traffic immediately, but even a fraction of that could be a shocking bill.

 

With this knowledge we have moved our site to a small instance, which includes 160GB of local storage. Local storage costs nothing to read or write to, and according to Amazon’s own documentation, is typically used for large websites. There’s definitely nothing wrong with EBS and I think it’s a great service – it’s just not the right solution for running a server that will being doing tons of I/O.

Our new project includes a lot of large images and when we run out of local storage, EBS will be used to dynamically expand our storage space. This solution makes sense, because if an image is requested a million times, it’ll only cost us 10 cents, and hopefully a million views earns us a bit more than that.

Hopefully this article doesn’t discourage anyone from using a micro instance – it was a fantastic (and free) way to build our new project. Just remember to choose the right solution for your product when the time comes to launch.