Sunday, December 8, 2013

Vine vs. Instagram?

What’s better and where?




While Vine was the first video platform to boom, Instagram launched their own video capabilities just a few months after Vine came to market. Not only did Instagram’s launch of video functionality place them as a direct competitor to Vine, but they one-upped Vine by introducing 15 second video, compared to Vine’s measly 6 seconds.
One of the big questions in the social media world since Instagram video came out is, which better; Vine or Instagram? The answer to this question lies within the personal of the user. There are pros and cons to each platform and each of these pros and cons lead to the ultimate decision that the user will make. If this is a question that still bounces around in your mind, here’s a list of pros and cons to ease your mind a bit:
Why Vine?
§  A six second time limit forces a Vine user to think outside the box and be as  innovative as possible
§  Vine constantly loops the video, so if you miss something you can watch it again.
§  Twitter and Vine are linked together, so when you post something on Vine it automatically goes to your Twitter page, too.
Why Instagram?
§  Instagram has a longer recording time (15 seconds) which allows more time to film a typical TV spot.
§  The app also offers more creativity  offers more creativity with filters and editing features that enhance the display of the video.
§  Instagram also allows to share on not just Facebook and Twitter, but also Tumblr, Flickr and Foursquare.
Not So Good About Vine:
§  Vine lacks editing tools and style filters.
§  You can’t pull prerecorded videos from camera roll.
§  Vine’s user numbers have decreased 2.9 million to 1.35 million, a 50 percent decrease.
Troubles With Instagram:
§  Instagram doesn’t have the looping option for videos.
§  Just like Vine, Instagram doesn’t support pulling prerecorded videos from camera roll.
§  Because of the 15 second time limit, there are complaints of the video taking too long to load.
With these pros and cons in mind, a user now has a better chance of making a decision that is in line with their personal preference. Whatever the choice, with practice and proper use, you’ll become a video pro in no time!
Description in more detail:
Description in more detail
Here’s a look at some of the biggest ways the apps diverge:
Length: The biggest distinguishing factor between these two services is the amount of time they allow for clips. Instagram offers users 15 seconds to Vine’s six — two-and-a-half times the video fun. The longer time-limit is supposed to make it easier for more people to shoot videos, since you don’t have to ration your time quite as jealously as you do with Vine.
More time is not always a good thing. If you have something really fun to film, then it gives you a lot of room to run. But if the video’s boring, fifteen seconds can seem like a lifetime. (At least a waste of time.)
But asking people to take more time to watch your content means there could actually be a higher bar for what makes a good video on Instagram — or at least a lower tolerance threshold for subpar work.
Looping: Vine’s looping is one of its most unique features, tapping into the .gif-sharing culture and providing a good platform for animation. You wouldn’t want videos much longer than six seconds to play on repeat, so it makes sense that Instagram didn’t follow suit with a similar format.
Still, there’s something charming about the loop. The best Vines actually improve on their second or third rewatch, and there’s certainly a thoughtful crowd out there that takes pride in making clips that flow well from beginning to end.
Instagram videos, on the other hand, require users to be thoughtful in a more traditional way — basically, making sure that what they’re posting is worth the time to watch it.
 Shooting: Shooting on the two apps is similar, but not identical. On Vine, you can hold your finger down anywhere on the screen to start recording. With Instagram, you have to hit a dedicated button on the screen. It’s big and red, but it’s still not quite as easy to use when shooting.
The trade-off, however, is that Instagram lets you tap-to-focus in the midst of your shooting, opening up the intriguing possibility of switching the action from background to foreground and vice-versa.
Instagram also includes a nifty feature that lets you stabilize your video after you shoot it — again, a feature that makes sense when dealing with longer clips.
Editing: Instagram brings two new additions to the editing table that Vine doesn’t have — the ability to delete and the option to add one of its signature filters to your videos.
Being able to delete is a good touch, particularly if Instagram is looking for a more thoughtful phone video crowd. And filters can cover up a multitude of lighting and shooting sins, even if they can’t make your video any more entertaining.
Not to be outdone, Vine may be looking to deal with bloopers in the future as well. Ahead of Facebook’s announcement, Vine released a short video of a phone running a version of Vine that apparently can save drafts — a hint of what may be coming in the future.
Convenience: Instagram’s video comes as a mode within the existing app, while Vine stands alone. It’s a smart move for Instagram, given that it means they already have a video app with 130 million monthly users.
That could be the result of the lesson Facebook learned from its self-destructing Poke video app, a separate app that has failed to pick up many users. On the other hand, having a stand-alone app means that you’re fewer taps away from making a quick video in the moment.
Although Instagram and Vine are comparable in many ways (how to shoot video, the ability to add a text description using hashtags, and the ability to upload and share videos across multiple social media platforms), there are a number of differences between the two platforms:
                                                



Friday, December 6, 2013

Network latency & packet-loss simulation and-bandwidth on MAC

Sometimes while testing you may want to be able to simulate network latency, or packet loss, or low bandwidth. I have done this with Linux and tc/netem as well as with Shunra on Windows.

It turns out that Mac OSX includes ‘dummynet’ from FreeBSD which has the capability to do this WAN simulation.

Here is a quick example:
  • Inject 250ms latency and 10% packet loss on connections between my workstation and my development web server (10.0.0.1)
  • Simulate maximum bandwidth of 1Mbps
# Create 2 pipes and assigned traffic to and from our webserver to each:
$ sudo  ipfw add pipe 1 ip from any to 10.0.0.1
$ sudo  ipfw add pipe 2 ip from 10.0.0.1 to any


# Configure the pipes we just created:
$ sudo ipfw pipe 1 config delay 250ms bw 1Mbit/s plr 0.1
$ sudo ipfw pipe 2 config delay 250ms bw 1Mbit/s plr 0.1

A quick test:
$ ping 10.0.0.1
PING 10.0.0.1 (10.0.0.1): 56 data bytes
64 bytes from 10.0.0.1: icmp_seq=0 ttl=63 time=515.939 ms
64 bytes from 10.0.0.1: icmp_seq=1 ttl=63 time=519.864 ms
64 bytes from 10.0.0.1: icmp_seq=2 ttl=63 time=521.785 ms
Request timeout for icmp_seq 3
64 bytes from 10.0.0.1: icmp_seq=4 ttl=63 time=524.461 ms
Disable:
$sudo ipfw list |grep pipe
  01900 pipe 1 ip from any to 10.13.1.133 out
  02000 pipe 2 ip from 10.13.1.133 to any in
$ sudo ipfw delete 01900
$ sudo ipfw delete 02000


# or, flush all ipfw rules, not just our pipes
$ sudo ipfw -q flush
Notice that the round-trip on the ping is ~500ms. That is because we applied a 250ms latency to both pipes, incoming and outgoing traffic. Our example was very simple, but you can get quite complex since “pipes” are applied to traffic using standard ipfw firewall rules. For example, you could specify different latency based on port, host, network, etc. Packet loss is configured with the “plr” command. Valid values are 0 - 1. In our example above we used 0.1 which equals 10% packetloss. This is a very handy way for developers on Mac’s to test their applications in a variety of network environments.

Tuesday, November 26, 2013

Why Software Defined Networking (SDN)??


Software-defined networking (SDN) is an approach to networking in which control is decoupled from hardware and given to a software application called a controller. When a packet arrives at a switch in a conventional network, rules built into the switch's proprietary firmware tell the switch where to forward the packet. The switch sends every packet going to the same destination along the same path -- and treats all the packets the exact same way. In the enterprise, smart switches designed with application-specific integrated circuits (ASICs) are sophisticated enough to recognize different types of packets and treat them differently, but such switches can be quite expensive. The goal of SDN is to allow network engineers and administrators respond quickly to changing business requirements. In a software-defined network, a network administrator can shape traffic from a centralized control console without having to touch individual switches. The administrator can change any network switch's rules when necessary -- prioritizing, de-prioritizing or even blocking specific types of packets with a very granular level of control. This is especially helpful in a cloud computing multi-tenant architecture because it allows the administrator to manage traffic loads in a flexible and more efficient manner. Essentially, this allows the administrator to use less expensive, commodity switches and have more control over network traffic flow than ever before.

The Benefits of SDN
With a centralized, programmable network that can automatically and dynamically address changing requirements, SDN can:
1. Reduce CapEx: reducing the need to purchase purpose-built, ASIC-based networking hardware and supporting pay-as-you-grow models to eliminate wasteful overprovisioning.
2. Reduce OpEX: enabling algorithm control of the network, through network elements that are increasingly programmable, that makes it easier to design, deploy, manage and scale networks. The ability to automate provisioning and orchestration not only reduces overall management time, but also the chance for human error to optimize service availability and reliability.
3. Deliver Agility and Flexibility: helping organizations rapidly deploy new applications, services and infrastructure to quickly meet their changing business goals and objectives.
4. Enable Innovation: enabling organizations to create new types of applications, services and business models that can create new revenue streams and more value from the network

5 reasons why software defined networking makes a difference

1. SDN Creates New Revenue Streams
SDN reduces both capital and operating expense by simplifying and automating management, avoiding over-provisioning, and reducing human error, (which is the most common cause of network configuration failures).  Further, it allows you to offer new features and functions that would be very difficult or prohibitively expensive on your current data center network.  A good example was given at the Open Ethernet Forum, when Verizon described how they plan to use SDN for better quality downloads of streaming video.  Since SDN controllers potentially have access to resources outside the network, such as the type of encoding used on a video file, they can adjust the network provisioning to accommodate a 3D high definition video vs a home movie of your cat, dynamically giving each one the appropriate amount of network resources. The result is a better viewing experience than you’d get over someone else’s network.

2) SDN Guarantees Better Quality of Service
This is a consequence of centralized, programmable management; SDN can view the entire network topology, not just the next hop as in conventional networks.  Also, today’s network treats switches and routers as if they were a “one size fits all” appliance.  It’s up to a highly skilled network administrator to translate application requirements into terms the network operating system can implement. Often these translations are approximations at best, resulting in poor utilization of network resources.  By creating the equivalent of a single operating system for the entire network, SDN changes the game, allowing us to program network configurations.  And if we can program something, we can automate it and eventually optimize it.  We can dynamically create service chains, or virtual paths through the network which interconnect firewalls, load balancers, and other functions. That’s what we mean by an application aware network.   For example, SDN adopters such as Tervela (who does global financial trading and risk analysis) and Selerity (who provides ultra low latency transaction processing) require high availability disjoint paths through their network and consistently low latency. SDN allows them to program alternate end-to-end paths in advance; if a network link fails, the recovery time is over ten times faster than conventional Ethernet.

3) SDN Provides Faster Time to Value
This is a result of SDN making updates in software, rather than hardware.  You wouldn’t virtualize your servers or storage if it meant sending a technician with a screwdriver to reconfigure circuit boards every day.  And yet, during a presentation at the 2013 OFC/NFOEC conference, a Cisco Senior VP said that it currently takes 5 days to fully bring a multi-tier workload online, including configuring network appliances, storage, and more.  SDN allows you to create, modify, and remove virtual network configurations in minutes, not days; with overlays like DOVE, you never have to touch the underlying IP switches. We can better integrate networking with servers and storage to create rapidly deployable, turnkey solutions (like IBM PureSystems).  The same holds true for interconnecting multiple data centers.  Reprovisioning the WAN currently takes days or weeks, but it’s possible to orchestrate the networks within and between data centers from a common controller, reducing this time to minutes (some of IBM’s work in this area will be published this summer, in collaboration with the New York State Center for Cloud Computing & Analytics).




4) SDN Provides Better Security
This is a bit more subtle, but makes sense when you think about it.  SDN protocols such as OpenFlow can be used as policy-based packet filters, diverting traffic from know “black lists” of suspect data sources.  SDN overlays like DOVE (an IETF industry standard, now available as part of the IBM Software Defined Network for Virtual Environments) allow you to create huge amounts of VLANs, and scale them to large networks with a network connectivity service.  Combined with virtual hypervisor switches like the IBM 5000v you can drive isolated multi-tenancy all the way back into the server hypervisor.  Further, a centralized SDN controller cluster is easier to defend than a network with thousands of switches running their own independent operating system.  SDN should make it easier to pass security compliance audits, since the entire  network policy is contained in one place.  Virtual security appliances can quickly be provisioned as waypoints on a DOVE overlay network.

5) SDN Provides an Open, Standards-Based Environment
There are many benefits from using open source Linux server operating systems.  Through the Linux Foundation, SDN is building the equivalent of Linux for the data network, with the same expected benefits.  The recently announced OpenDaylight project, the largest open source effort in history, provides an open source community to accelerate SDN adoption.  IBM is a long standing supporter of open standards, from our early efforts with Linux on the mainframe to the Open Data Center Interoperable Network (ODIN), and we’ve published extensive interop testing with other vendor’s networking products.  As a founding member of OpenDaylight, we’re pleased to bring this same approach to data center networking.  This ecosystem creates a wider variety of new features for your network faster than ever before (analogous to the app store for your smart phone).

SDN industry momentum




Programming flow architecture






*some data is taken from web


Wednesday, October 9, 2013

Why we should care for C++11

Bjarne Stroustrup, the creator of C++, said recently that C++11 “feels like a new language — the pieces just fit together better.” Indeed, core C++11 has changed significantly. It now supports lambda expressions, automatic type deduction of objects, uniform initialization syntax, delegating constructors, deleted and defaulted function declarations, nullptr, and most importantly, rvalue references — a feature that augurs a paradigm shift in how one conceives and handles objects. And that’s just a sample.
The C++11 Standard Library was also revamped with new algorithms, new container classes, atomic operations, type traits, regular expressions, new smart pointers, async() facility, and of course a multithreading library.
biggest changes in the language, and why they are such a big deal. As you’ll see, threading libraries are not the only change. The new standard builds on the decades of expertise and makes C++ even more relevant. As Rogers Cadenhead points out, “That’s pretty amazing for something as old as disco, Pet Rocks, and Olympic swimmers with chest hair.”
First, let’s look at some of the prominent C++11 core-language features.

Lambda Expressions
A lambda expression lets you define functions locally, at the place of the call, thereby eliminating much of the tedium and security risks that function objects incur. A lambda expression has the form:
[capture](parameters)->return-type {body}
The [] construct inside a function call’s argument list indicates the beginning of a lambda expression. Let’s see a lambda example.
Suppose you want to count how many uppercase letters a string contains. Using for_each() to traverses a char array, the following lambda expression determines whether each letter is in uppercase. For every uppercase letter it finds, the lambda expression increments Uppercase, a variable defined outside the lambda expression:
int main()
{
   char s[]="Hello World!";
   int Uppercase = 0; //modified by the lambda
   for_each(s, s+sizeof(s), [&Uppercase] (char c) {
    if (isupper(c))
     Uppercase++;
    });
 cout<< Uppercase<<" uppercase letters in: "<< s<<endl;
}
It’s as if you defined a function whose body is placed inside another function call. The ampersand in [&Uppercase] means that the lambda body gets a reference to Uppercase so it can modify it. Without the ampersand, Uppercase would be passed by value. C++11 lambdas include constructs for member functions as well.

Automatic Type Deduction and decltype
In C++03, you must specify the type of an object when you declare it. Yet in many cases, an object’s declaration includes an initializer. C++11 takes advantage of this, letting you declare objects without specifying their types:
auto x=0; //x has type int because 0 is int
auto c='a'; //char
auto d=0.5; //double
auto national_debt=14400000000000LL;//long long
Automatic type deduction is chiefly useful when the type of the object is verbose or when it’s automatically generated (in templates). Consider:
void func(const vector<int> &vi)
{
vector<int>::const_iterator ci=vi.begin();
}
Instead, you can declare the iterator like this:
auto ci=vi.begin();
The keyword auto isn’t new; it actually dates back the pre-ANSI C era. However, C++11 has changed its meaning; auto no longer designates an object with automatic storage type. Rather, it declares an object whose type is deducible from its initializer. The old meaning of auto was removed from C++11 to avoid confusion.
C++11 offers a similar mechanism for capturing the type of an object or an expression. The new operator decltype takes an expression and “returns” its type:
const vector<int> vi;
typedef decltype (vi.begin()) CIT;
CIT another_const_iterator;


Deleted and Defaulted Functions
A function in the form:
struct A
{
 A()=default; //C++11
 virtual ~A()=default; //C++11
};
is called a defaulted function. The =default; part instructs the compiler to generate the default implementation for the function. Defaulted functions have two advantages: They are more efficient than manual implementations, and they rid the programmer from the chore of defining those functions manually.
The opposite of a defaulted function is a deleted function:
int func()=delete;
Deleted functions are useful for preventing object copying, among the rest. Recall that C++ automatically declares a copy constructor and an assignment operator for classes. To disable copying, declare these two special member functions =delete:
struct NoCopy
{
 NoCopy & operator =( const NoCopy & ) = delete;
 NoCopy ( const NoCopy & ) = delete;
};
NoCopy a;
NoCopy b(a); //compilation error, copy ctor is deleted

nullptr

At last, C++ has a keyword that designates a null pointer constant. nullptr replaces the bug-prone NULL macro and the literal 0 that have been used as null pointer substitutes for many years. nullptr is strongly-typed:

void f(int); //#1
void f(char *);//#2
//C++03
f(0); //which f is called?
//C++11
f(nullptr) //unambiguous, calls #2
nullptr is applicable to all pointer categories, including function pointers and pointers to members:
const char *pc=str.c_str(); //data pointers
if (pc!=nullptr)
  cout<<pc<<endl;
int (A::*pmf)()=nullptr; //pointer to member function
void (*pmf)()=nullptr; //pointer to function

Delegating Constructors
In C++11 a constructor may call another constructor of the same class:
class M //C++11 delegating constructors
{
 int x, y;
 char *p;
public:
 M(int v) : x(v), y(0), p(new char [MAX]) {} //#1 target
 M(): M(0) {cout<<"delegating ctor"<<endl;} //#2 delegating
};

Rvalue References
Reference types in C++03 can only bind to lvalues. C++11 introduces a new category of reference types called rvalue references. Rvalue references can bind to rvalues, e.g. temporary objects and literals.
The primary reason for adding rvalue references is move semantics. Unlike traditional copying, moving means that a target object pilfers the resources of the source object, leaving the source in an “empty” state. In certain cases where making a copy of an object is both expensive and unnecessary, a move operation can be used instead. To appreciate the performance gains of move semantics, consider string swapping. A naive implementation would look like this:
void naiveswap(string &a, string & b)
{
 string temp = a;
 a=b;
 b=temp;
}
This is expensive. Copying a string entails the allocation of raw memory and copying the characters from the source to the target. In contrast, moving strings merely swaps two data members, without allocating memory, copying char arrays and deleting memory:
void moveswapstr(string& empty, string & filled)
{
//pseudo code, but you get the idea
 size_t sz=empty.size();
 const char *p= empty.data();
//move filled's resources to empty
 empty.setsize(filled.size());
 empty.setdata(filled.data());
//filled becomes empty
 filled.setsize(sz);
 filled.setdata(p);
}
If you’re implementing a class that supports moving, you can declare a move constructor and a move assignment operator like this:
class Movable
{
Movable (Movable&&); //move constructor
Movable&& operator=(Movable&&); //move assignment operator
};
The C++11 Standard Library uses move semantics extensively. Many algorithms and containers are now move-optimized.
C++11 Standard Library
C++ underwent a major facelift in 2003 in the form of the Library Technical Report 1 (TR1). TR1 included new container classes (unordered_set, unordered_map, unordered_multiset, and unordered_multimap) and several new libraries for regular expressions, tuples, function object wrapper and more. With the approval of C++11, TR1 is officially incorporated into standard C++ standard, along with new libraries that have been added since TR1. Here are some of the C++11 Standard Library features: