Wednesday, 6 November 2013

11 signs you have been hacked

In today's threatscape, antivirus software provides little piece of mind. In fact, antimalware scanners on the whole are horrifically inaccurate, especially with exploits less than 24 hours old. After all, malicious hackers and malware can change their tactics at will. Swap a few bytes around, and a previously recognized malware program becomes unrecognizable.
Sure sign of system compromise No. 1: Fake antivirus messages
In slight decline these days, fake antivirus warning messages are among the surest signs that your system has been compromised. What most people don't realize is that by the time they see the fake antivirus warning, the damage has been done. Clicking No or Cancel to stop the fake virus scan is too little, too late. The malicious software has already made use of unpatched software, often the Java Runtime Environment or an Adobe product, to completely exploit your system.
Sure sign of system compromise No. 2: Unwanted browser toolbars
This is probably the second most common sign of exploitation: Your browser has multiple new toolbars with names that seem to indicate the toolbar is supposed to help you. Unless you recognize the toolbar as coming from a very well-known vendor, it's time to dump the bogus toolbar.
Sure sign of system compromise No. 3: Redirected Internet searches
Many hackers make their living by redirecting your browser somewhere other than you want to go. The hacker gets paid by getting your clicks to appear on someone else's website, often those who don't know that the clicks to their site are from malicious redirection.
Sure sign of system compromise No. 4: Frequent random popups
This popular sign that you've been hacked is also one of the more annoying ones. When you're getting random browser pop-ups from websites that don't normally generate them, your system has been compromised. I'm constantly amazed about which websites, legitimate and otherwise, can bypass your browser's anti-pop-up mechanisms. It's like battling email spam, but worse.
Sure sign of system compromise No. 5: Your friends receive fake emails from your email account
This is the one scenario where you might be OK. It's fairly common for our email friends to receive malicious emails from us. A decade ago, when email attachment viruses were all the rage, it was very common for malware programs to survey your email address book and send malicious emails to everyone in it.
Sure sign of system compromise No. 6: Your online passwords suddenly change
If one or more of your online passwords suddenly change, you've more than likely been hacked -- or at least that online service has been hacked. In this particular scenario, usually what has happened is that the victim responded to an authentic-looking phish email that purportedly claimed to be from the service that ends up with the changed password. The bad guy collects the logon information, logs on, changes the password (and other information to complicate recovery), and uses the service to steal money from the victim or the victim's acquaintances (while pretending to be the victim).
Sure sign of system compromise No. 7: Unexpected software installs
Unwanted and unexpected software installs are a big sign that your computer system has likely been hacked.
Sure sign of system compromise No. 8: Your mouse moves between programs and makes correct selections
If your mouse pointer moves itself while making selections that work, you've definitely been hacked. Mouse pointers often move randomly, usually due to hardware problems. But if the movements involve making the correct choices to run particular programs, malicious humans are somewhere involved.
Sure sign of system compromise No. 9: Your antimalware software, Task Manager, or Registry Editor is disabled and can't be restarted
This is a huge sign of malicious compromise. If you notice that your antimalware software is disabled and you didn't do it, you're probably exploited -- especially if you try to start Task Manager or Registry Editor and they won't start, start and disappear, or start in a reduced state. This is very common for malware to do.
Sure sign of system compromise No. 10: Your bank account is missing money
I mean lots of money. Online bad guys don't usually steal a little money. They like to transfer everything or nearly everything, often to a foreign exchange or bank. Usually it begins by your computer being compromised or from you responding to a fake phish from your bank. In any case, the bad guys log on to your bank, change your contact information, and transfer large sums of money to themselves.
Sure sign of system compromise No. 11: You get calls from stores about nonpayment of shipped goods
In this case, hackers have compromised one of your accounts, made a purchase, and had it shipped to someplace other than your house. Oftentimes, the bad guys will order tons of merchandise at the same time, making each business entity think you have enough funds at the beginning, but as each transaction finally pushes through you end up with insufficient funds.
Source: www.infoworld.com/print/229782

Tuesday, 29 October 2013

The Type Hint Tight Couple

Anybody who does object oriented development quickly learns about type hinting - the process by which you can indicate to one object another object it should expect. Remember this example from the last post?

<?php
class MyClass() {
  public function __construct(MyObject $mobj) {
    $this->myObject = $mobj;
  }
}

But type hinting alone is not sufficient to loosely couple our objects. In fact, even though we are injecting our dependency in the initial example, we're type hinting on a concrete object, meaning that we are tied to that specific object for all future iterations. Sure, we can mock it for testing (which is an advantage), but we can't easily subclass it and use it elsewhere.

Fixing the Type Hint Tight Couple
It's easy to fix this particular tight coupling problem. To do so, we can draw back on our knowledge of SOLID principles, namely the Dependency Inversion Principle, which states:

Objects should rely upon abstractions, not concretions.

Fixing this tight couple requires only that we abstract the creation of the interface from the implementation of the object, and then type hint on it. For example:

<?php
interface MyObjectInterface {
  // some methods to define interface in here
}
class MyObject implements MyObjectInterface{
  // The implementation of the interface
}
class MyClass{
  public function __construct(MyObjectInterface $mobj){
    $this->myObject = $mobj;
  }
}

So, here instead of relying solely upon MyObject to type hint, we can now type hint on the interface, MyObjectInterface. This loosely couples our objects, because MyClass no longer cares about the implementation of MyObject; it only cares about knowing the right interface!

So, do all my objects need interfaces?
In short, no, they don't. The illustration I've provided is for objects that might have reuse potential later on, or are part of a library; when you're working with specific objects that are unlikely to change, there may not be a need for this level of decoupling.

Remember, the principles of object oriented design (like loose coupling) are about offering best case solutions, not final solutions or absolute hard-and-fast rules. It's up to you, the designer, to make good choices.

Monday, 28 October 2013

Tight coupling in OOP


What Is Tight Coupling?
It would help to define exactly what the problem is, in order to solve it.

Tight coupling, in object oriented application, is an abnormal dependency between two unrelated objects. This usually manifests itself in a few different ways; today we're going to talk about the first type: the object creation tight couple.

The Object Creation Tight Couple
Have you ever seen or written code like this?

<?php
class MyClass(){
  public function __construct(){
    $this->myObject = new MyObject();
  }
}

We've all probably observed this. Even if it's in another method besides the constructor, we've all seen code that creates other objects. The culprit here is the new keyword. This keyword creates an object, but the creation of an object tightly couples one object to another. It's impossible to easily swap one object for another.

Solving The Object Creation Tight Couple
There are a few easy ways to solve this particular type of problem. The first is with dependency injection. Dependency injection is the process of inserting an object at runtime, rather than creating it in an object, and looks like this:

<?php
class MyClass(){
  public function __construct(MyObject $mobj){
    $this->myObject = $mobj;
  }
}

With this approach, we are injecting the object, which makes it possible to swap the object out with a mock object for testing or another object to modify the application. But this isn't the only way we can solve this problem.

We can also use a factory to create the object we need at run time, but abstract the creation to another object or group of objects (like the Abstract Factory pattern). Using a factory looks like this:

<?php
class MyClass(){
  public function __construct(MyObjectFactory $mobj){
    $this->myObject = $mobj->getInstance();
  }
}

Now, the real power of this isn't shown in the constructor; it's shown when the getInstance() method is used in a method that requires it. But, you can easily see the power of the factory here to create an object on demand, yet still follow the best practices of dependency injection and testability.

5 Ecommerce Metrics You Should Be Tracking

When it comes to ecommerce analytics, business owners and marketing managers typically focus on metrics like conversion rates, number of transactions, and average order value.

These are valuable, and should be monitored. After all, measuring such outcomes is what directly impacts revenue and the bottom line.

Thanks to Google Analytics as well as Mixpanel, Flurry, Site Catalyst, and other analytics platforms, these ecommerce metrics are readily available to site owners.

While focusing on the outcomes is key, close attention to tracking user behavior and interaction with the site or mobile app will also yield significant incremental improvements. Here are five interactions you don’t see a lot of people measuring, when they really should be.

Product Categories
You can easily report on top products, what’s selling, and what’s not selling on your website. However, go beyond that and consider rolling up your reports to the product category level. Some categories can be driving more revenue than others..

Product Comparison
Many ecommerce sites allow shoppers to list products next to each other for ease of comparison — dimensions, features, pricing, and other features — and also for an opportunity to upsell the higher value products.

Live Chat Tracking
You have probably seen live chat features on sites more often than not. You come to a site to check out a service or a product and you’ll see an invitation — sometimes a pop-up — asking if you would like to chat with a customer support agent. I’ve seen ecommerce businesses where the average order value is 25 to 30 percent higher when a purchase included a live chat.

Shopping Cart Removes
While it’s common to measure “Add to Cart” clicks to track which products are added to the online shopping cart and track based on where that action occurred — whether they are on the product page, promo page, or a product modal — it’s also useful to also track cart removes, or the products that visitors added to cart and then later removed.

Know Your User Segments
Real gems are found in zooming in on a segment of users along with the purpose of their visits. If you are new to the concept of segmentation, write down the various types of customers that buy from you.

For example, you might be primarily a consumer product store, but also have a reseller or a distribution channel. These resellers are identified upon login and your system will present the pricing and discounts that are unique to them. When tracking transactions and revenue, it’s important to segment your reports by these user types. Otherwise a large order at a highly discounted price for one of your resellers will skew your revenue and conversion data.


Wednesday, 14 August 2013

Writing SOLID code

In computer programming, SOLID (Single responsibility, Open-closed, Liskov substitution, Interface segregation and Dependency inversion) is a mnemonic acronym introduced by Michael Feathers for the "first five principles" identified by Robert C. Martin in the early 2000s that stands for five basic principles of object-oriented programming and design. The principles when applied together intend to make it more likely that a programmer will create a system that is easy to maintain and extend over time. The principles of SOLID are guidelines that can be applied while working on software to remove code smells by causing the programmer to refactor the software's source code until it is both legible and extensible. It is typically used with test-driven development, and is part of an overall strategy of agile and adaptive programming.

S - SRP - Single Responsibility Principle - A Class should have only a single responsibility.
O - OCP - Open/Close Principle - Entities should be open for extension but closed for modification
L - LSP - Liskov Substitution Principle - objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program
I - ISP - Interface Segregation Principle - many client-specific interfaces are better than one general-purpose interface
D - DIP - Dependency Inversion Principle - one should “Depend upon Abstractions. Do not depend upon concretions.

Monday, 29 July 2013

5 Keys for Multichannel Holiday Success

For the 2013 holiday shopping season, consumers will increasingly rely on marketplaces and comparison-shopping channels.  Amazon, Newegg, Ebay, Google Shopping — all have huge numbers of motivated shoppers.  Ecommerce merchants large and small can sell on these channels. But not all of them will do it profitably.

 1. Products. Identifying winning products is the first step. Research last year's best sellers, evaluate new products, and consider niche offerings and up-sells. 

2. Sourcing and inventory management.  Ensuring product availability is crucial. The necessity of placing orders early and check for add-on items.

3. Product content and feeds. Compelling images, descriptions, and videos are all important for selling products on marketplaces and comparison-shopping channels. Optimize your product content and data feeds.

4. Pricing. Understanding your margins is vital for profitable multichannel selling. Understand dynamic pricing and strategies for mass-market pricing.

5. Fulfillment. Selling on multiple channels can produce dramatic peaks in holiday sales volume, which can cause back-office catastrophes. Make sure your company is prepared.  




Monday, 15 July 2013

Writing Objects doesnt' make it OOP

Lots of developers understand that object oriented code offers advantages over procedural programming. And so, they begin working on creating objects in their own projects, and eventually feel pretty good about what they've done. After all, if they're using objects, their code must be object oriented, right?

Well, not exactly. They quickly find out just how limited their code is when they try to implement the concepts of object oriented programming, like reuse and extensibility. And they quickly find that their code is really procedural code wrapped up in classes, not the grand object oriented application they thought it was.

But how can you know ahead of time what kind of code you have? Is there a set of tools you can use to determine if your code is truly object oriented, or is it just procedural code wrapped in classes? Let's take a look at the hallmarks of truly object oriented code and find out.

Object oriented code splits responsibilities between classes.

The biggest indicator of truly object oriented code is whether or not it correctly splits responsibilities up between classes - a principle known as the single responsibility principle.

In object-wrapped procedural code (OWPC), many responsibilities will exist within the same objects. You'll have database connections being made, queries being run, data being evaluated, and even possibly display functions being performed. But truly object oriented code will break these behaviors apart into their component parts, focusing on each one individually.

Object oriented code is polymorphic.

So, I just used a big word: polymorphism. But even though the word seems scary, it's not: polymorphism is just a principle which means "one behaviour, many forms." For example, all SQL databases perform similar behaviors, but they have individual implementation details for connecting and passing messages around. A polymorphic database layer will implement a common behaviour for all the databases, and obscure the specific implementation details for each unique database type.

What this leads to is easy reuse of objects throughout your code. For example, you can switch easily from MySQL to SQLite if you have a true object oriented application that has a truly polymorphic database layer.

Object oriented applications apply dependency injection.

A truly object oriented application will correctly apply dependency injection. Often in OWPC applications, objects are instantiated directly, either inside classes or inside procedural files. But an application designed to be object oriented will utilize dependency injection as a means of allowing for inversion of control.

This is done in PHP usually in one of two ways: first, there can be a layer responsible for instantiating objects (usually a controller). Or, there can be a dependency injection container that holds (or creates) the objects needed in the application. Both approaches are reasonable, and both are widely used.

Object oriented design is challenging, but worthwhile.

The truth is that designing applications to be object oriented is challenging, frustrating, and extremely worthwhile. Conquering the challenges results in reusable, segmented, small bits of code that are easy to maintain, simple to understand and incredibly powerful when used correctly.

Your Delivery Platform Is Tier-Zero Infrastructure

On 10 September, GitLab released critical patches for its Community and Enterprise editions. The most serious issue, CVE-2026-85706, was ass...