Pages

Monday, August 22, 2011

8 Powerful Awk Built-in Variables – FS, OFS, RS, ORS, NR, NF, FILENAME, FNR

8 Powerful Awk Built-in Variables – FS, OFS, RS, ORS, NR, NF, FILENAME, FNR

Friday, August 19, 2011

difference between different shells

sh   csh  ksh  bash tcsh zsh  rc   es
Job control                          N    Y    Y    Y    Y    Y    N    N
Aliases                              N    Y    Y    Y    Y    Y    N    N
Shell functions                      Y(1) N    Y    Y    N    Y    Y    Y
"Sensible" Input/Output redirection  Y    N    Y    Y    N    Y    Y    Y
Directory stack                      N    Y    Y    Y    Y    Y    F    F
Command history                      N    Y    Y    Y    Y    Y    L    L
Command line editing                 N    N    Y    Y    Y    Y    L    L
Vi Command line editing              N    N    Y    Y    Y(3) Y    L    L
Emacs Command line editing           N    N    Y    Y    Y    Y    L    L
Rebindable Command line editing      N    N    N    Y    Y    Y    L    L
User name look up                    N    Y    Y    Y    Y    Y    L    L
Login/Logout watching                N    N    N    N    Y    Y    F    F
Filename completion                  N    Y(1) Y    Y    Y    Y    L    L
Username completion                  N    Y(2) Y    Y    Y    Y    L    L
Hostname completion                  N    Y(2) Y    Y    Y    Y    L    L
History completion                   N    N    N    Y    Y    Y    L    L
Fully programmable Completion        N    N    N    N    Y    Y    N    N
Mh Mailbox completion                N    N    N    N(4) N(6) N(6) N    N
Co Processes                         N    N    Y    N    N    Y    N    N
Builtin artithmetic evaluation       N    Y    Y    Y    Y    Y    N    N
Can follow symbolic links invisibly  N    N    Y    Y    Y    Y    N    N
Periodic command execution           N    N    N    N    Y    Y    N    N
Custom Prompt (easily)               N    N    Y    Y    Y    Y    Y    Y
Sun Keyboard Hack                    N    N    N    N    N    Y    N    N
Spelling Correction                  N    N    N    N    Y    Y    N    N
Process Substitution                 N    N    N    Y(2) N    Y    Y    Y
Underlying Syntax                    sh   csh  sh   sh   csh  sh   rc   rc
Freely Available                     N    N    N(5) Y    Y    Y    Y    Y
Checks Mailbox                       N    Y    Y    Y    Y    Y    F    F
Tty Sanity Checking                  N    N    N    N    Y    Y    N    N
Can cope with large argument lists   Y    N    Y    Y    Y    Y    Y    Y
Has non-interactive startup file     N    Y    Y(7) Y(7) Y    Y    N    N
Has non-login startup file           N    Y    Y(7) Y    Y    Y    N    N
Can avoid user startup files         N    Y    N    Y    N    Y    Y    Y
Can specify startup file             N    N    Y    Y    N    N    N    N
Low level command redefinition       N    N    N    N    N    N    N    Y
Has anonymous functions              N    N    N    N    N    N    Y    Y
List Variables                       N    Y    Y    N    Y    Y    Y    Y
Full signal trap handling            Y    N    Y    Y    N    Y    Y    Y
File no clobber ability              N    Y    Y    Y    Y    Y    N    F
Local variables                      N    N    Y    Y    N    Y    Y    Y
Lexically scoped variables           N    N    N    N    N    N    N    Y
Exceptions                           N    N    N    N    N    N    N    Y

Key to the table above.

   Y      Feature can be done using this shell.
          
   N      Feature is not present in the shell.
          
   F      Feature can only be done by using the shells function
          mechanism.
          
   L      The readline library must be linked into the shell to enable
          this Feature.
          
Notes to the table above

    1. This feature was not in the orginal version, but has since become
       almost standard.
    2. This feature is fairly new and so is often not found on many
       versions of the shell, it is gradually making its way into
       standard distribution.
    3. The Vi emulation of this shell is thought by many to be
       incomplete.
    4. This feature is not standard but unoffical patches exist to
       perform this.
    5. A version called 'pdksh' is freely available, but does not have
       the full functionality of the AT&T version.
    6. This can be done via the shells programmable completion mechanism.
    7. Only by specifing a file via the ENV environment variable.
 
http://www.faqs.org/faqs/unix-faq/shell/shell-differences/ 

Tuesday, August 9, 2011

mysql auto increment Reset

in order to reset the auto_increment, in a situation where some of the most recently added rows were deleted, use:

ALTER TABLE theTableInQuestion AUTO_INCREMENT=1234

and future insertions will be numbered from 1234 again (unless you still had rows numbered greater than 1234, and then the future insertions will start from the greatest number + 1 ).

Tuesday, August 2, 2011

checking Ip address of amazon after reboot

every time you reboot or stop/start an instance, you are assigned new public and private IP addresses and hostnames
with this script you can get the new IP and hostname of instance, so that you can use it later

#!/bin/sh
META=http://169.254.169.254/latest/meta-data
HOSTNAME=`/usr/bin/curl -s $META/hostname | /bin/sed 's+\..*++g'`
hostname $HOSTNAME
echo $HOSTNAME > /etc/hostname
IPV4=`/usr/bin/curl -s $META/public-ipv4

http://169.254.169.254 is an internal Amazon EC2 server that will report information about your instance—very helpful if you haven’t installed the EC2 API tools

Downgrade php to PHP 5.2 from PHP 5.3 on Ubuntu 10.04 and higher

Monday, August 1, 2011

Cloud Myths

Myth #1: "I'm using virtualization/hypervisors in my data center -- I'm already running a cloud."

 

Virtualization, or more properly "operating system virtualization" (typically implemented by a hypervisor) is an important component of a cloud infrastructure, but by itself, does not implement cloud semantics. When a user requests a collection of virtual machines (VMs) from a cloud, the VMs must be isolated from other VMs on the system in terms of their CPU access, memory access, network access, and access to persistent storage. Furthermore all of these forms of isolated access must be associated with an authenticated user for security and charging purposes. Operating system virtualization and hypervisors provides unauthenticated isolation of CPUs and memories, but not a private inter-VM network and not per-allocation persistent storage. Thus a cloud needs virtualization for part of its function, but data center virtualization, by itself, does not implement a cloud.

 

Clouds also provide a way for a cloud administrator to define either Service Level Agreements (SLAs) or Quality-of-Service (QoS) specifications that categorize the quality of access (and the resulting charging rate) individual users will experience. Thus, in a cloud, an administrator defines a set of SLAs, groups users according to the SLAs to which they are entitled access, and determines a charging rate for each active SLA. Alternatively, in a virtualized data center, the system administrators can use virtualization to control allocation of VMs to resources, but the notion of QoS or SLA is not exported to the end user as a way of enabling self-service provisioning.

 

In short, data center virtualization, alone, does not constitute cloud computing.

 

Myth #2: "Cloud Computing is just Grid Computing by a different name."

 

There are several ways in which Cloud Computing and Grid computing are distinct from a conceptual point of view. First, Grids are architected so that a small number of users can gather and use most, if not all of the resources in the grid. While those resources are in use, other users must wait (typically in one or more priority queues) for resource access. Because the duration and frequency of individual user resource allocations is highly variable and hard to predict, queuing delays can be quite substantial, particularly in settings where machine utilization is high.

 

In contrast, clouds provide the illusion of "infinite scale" by supporting a large number of users, each of which is entitled to only a small fraction of the total cloud resource pool. By ensuring that the cloud is provisioned to support the total number of possible simultaneous users (each requesting his or her maximum possible allocation), the resource usage pattern of any single user cannot cause a resource shortage. Thus cloud resource allocations are "on-demand" (resources are returned to the user when they are requested without queuing delay) and atomic (an entire resource allocation request is typically satisfied without the possibility of partial allocation failure).

 

Another way in which clouds and grids are distinct is that grids support inter-grid federation below the API level. That is, a user of a grid expects that the grid infrastructure will enable him or her to access resources in other grids somewhat transparently and under the control of the grid. As a result, grids are typically implemented as federated middleware that requires extensive and often complex policy mediation support. This need for policy mediation to be managed by the grid middleware can lead to non-intuitive or non-deterministic behavior that users may interpret as grid instability.

 

Currently clouds implement federation at the API level. A user can make requests from multiple clouds simultaneously and if the cloud allocations allow routing to and from an external network, these allocations can be combined under user control. Thus policy mediation occurs at the application level on a per-user basis making inconsistencies locally scoped and easier to rectify.

 

Thus, from the perspective of both the end-user and the infrastructure administrators, grids and clouds are distinct.

 

Myth #3: "Clouds provide infinite scale."

 

Public clouds like those operated by Amazon or Google certainly comprise larger resource pools than most individual users or organizations could use effectively. Thus it is tempting to believe that from the perspective of a single user, the amount of resource available is effectively limitless.

 

This notion of infinite resource availability would be true, in practice, if each cloud were only to service a small user community and each user were not quota limited. In many application domains, however, individual users do have large resource needs. So large, in fact, that if many of them (or even several of them) were to make large requests simultaneously even the largest clouds would run short of resources to provide. For these users, the cloud does not appear infinite.

 

Indeed, public clouds limit the total resource footprint that a "standard" user can control to a small quota, for this reason. Special users (after careful vetting) can have their quota increased but no user will be allowed to consume a substantial fraction of the total resource pool for fear of causing a resource shortfall. For the vast majority of users who are using the public clouds to implement dynamically scaling web sites, the quota allowed is larger than these web sites typically require, thereby providing the illusion of infinite scale. As resource-intensive, highly scalable applications begin to use cloud computing as either a public or on-premise platform, however, they will begin to reach the scaling limits imposed by resource availability.

 

This difference also obscures the relationship between private and/or hybrid clouds and use of the public clouds. Data center operators occasionally cite the availability of "infinite resources" as a reason to use the public clouds instead of an on-premise cloud or a hybrid cloud. In practice, most good-sized data centers have resource requirements that will exceed both, particularly if they are striving for high utilization levels. Public clouds offer the ability to "spill out" or "burst" from a data center into a public cloud utility and vice versa if there is a resource shortfall. Better, more efficient, and user-controlled resource usage is possible through a combination of public and private clouds. Infinite scale, however, is an illusion provided to users with only small to modest maximum requirements.

 

Myth #4: "Clouds only provide 'pay-as-you-go' access."

 

One of the most attractive features of the public clouds is that they allow users to change their resource usage dynamically in response to customer demand or offered load, and to pay only for the resources being used from moment to moment. While this type of charging is an important feature, it is by no means the only method a cloud can and should support. In particular, if an allocation is to be shared among several users within a single organization, it may make more sense to offer a maximum resource quota on a subscription basis to keep conflicting resource needs from causing confusion. If multiple users are to share the VMs within a single allocation, enabling all of them to acquire and release resources dynamically (possible resources in use by other users of the allocation) can lead to chaos.


"Legal Disclaimer: This electronic message and all contents contain information from Cybage Software Private Limited which may be privileged, confidential, or otherwise protected from disclosure. The information is intended to be for the addressee(s) only. If you are not an addressee, any disclosure, copy, distribution, or use of the contents of this message is strictly prohibited. If you have received this electronic message in error please notify the sender by reply e-mail to and destroy the original message and all copies. Cybage has taken every reasonable precaution to minimize the risk of malicious content in the mail, but is not liable for any damage you may sustain as a result of any malicious content in this e-mail. You should carry out your own malicious content checks before opening the e-mail or attachment." www.cybage.com

Difference between Socket and Port

Imagine you computer as a House with many doors. The address of your house would be equal to the the IP address of a computer. Each door would be equal to a computer's port. A socket would sit at a door and listen and talk. A socket is an a a connection to another computer. It would sit at one of your doors and yell across the street to your neighbour's house. In order to do this, you need to know what door your neighbour is listening at otherwise he can't answer. You call up your neighbour and he tells you that he is listening on port 150. You pick a random door at your house with a number above 1024 and make sure it's empty. If it isn't, you find another one and repeat.(This is usually handled by the socket and you don't need to specify this.) Then you open this door and throw a rock to your neighbour's house across the street and hit the door nunmbered 150. Your neighbour opens his door(#150) and you now can talk to him and send him data.


http://www.coderanch.com/t/206360/sockets/java/port-vs-socket

Cloud computing : From CIO.com

 

Cloud computing: The very definition of cloud computing remains controversial. Consulting firm Accenture has crafted a useful, concise definition: the dynamic provisioning of IT capabilities (hardware, software, or services) from third parties over a network.

Cloud computing is computing model, not a technology. In this model of computing, all the servers, networks, applications and other elements related to data centers are made available to IT and end users via the Internet, in a way that allows IT to buy only the type and amount of computing services that they need. The cloud model differs from traditional outsourcers in that customers don't hand over their own IT resources to be managed. Instead they plug into the "cloud" for infrastructure services, platform (operating system) services, or software services (such as SaaS apps), treating the "cloud" much as they would an internal data center or computer providing the same functions.

What is cloud computing?

Despite snarky comments among industry insiders and imprecise metaphors meant to explain virtualization and cloud computing to the masses, it is patently untrue that the corporate computing world is returning to the mainframe model of computing.

Today's hardware, software and networks are cheaper, more flexible and more accepting of anything a user or data-center manager wants to do, for one thing. Rather than making users wait days or weeks for any changes or reports, typical data centers can easily add extra storage or computing power to accommodate an online-sales promotion, for example.

On the other hand, constrictive budgets, a bad economy, and computing hardware that has largely outstripped the demands business applications put on it have increased the pressure on CIOs to not only show they're using IT dollars efficiently, but also actually do it.

Virtualization — as well as the cloud computing model within which it often runs — answer much of that need, by giving CIOs the ability to cover a week-long spike in demand by turning up the spigot on the computing power a business unit gets. A layer of virtualization software allows a bank of servers to share the available workload, and lets the CIO give a business unit 10% more storage capacity or compute power, rather than having to go buy completely new servers that add 10 times the required capacity.

The mainframe-like miracle is abstraction — the ability to hide the complexities of a system from the end user while providing all the power and capabilities the user requires.

The World Wide Web is the largest abstraction layer in IT — hiding the complexity of a global network with hundreds of thousands of specialized servers and arcane data behind search engines and hotlinks.

In IT, "virtualization" most often means server virtualization — in which one physical server acts as host to several virtual servers, each of which runs on a layer of software called a hypervisor whose job it is to parcel out storage, memory and other computing resources while making each virtual server believe it is running by itself on a standalone computer.

Cloud computing takes that abstraction one further step. Rather than making one server appear to be several, it makes an entire data-center's worth of servers, networking devices, systems management, security, storage and other infrastructure, look like a single computer, or even a single screen.

The idea is to let companies buy exactly the amount of storage, computing power, security and other IT functions that they need from specialists in data-center computing — in the same way they used to pay AT&T to come install the number of phones they required.

What are the different types of cloud computing?

Web-based email services from Google and Yahoo, backup services from Carbonite or MozyHome, customer-resource management applications like Salesforce.com, instant messaging and voice-over-IP services from AOL, Google, Skype, Vonage and others are all cloud-computing services, hidden behind yet another layer of abstraction to make them seem even simpler to end users who want the kind of power sophisticated computing can give them, but don't want to know how it's done.

There are three basic types of cloud computing:

• Infrastructure as a Service — provides grids or clusters or virtualized servers, networks, storage and systems software designed to augment or replace the functions of an entire data center. The highest-profile example is Amazon's Elastic Compute Cloud [EC2] and Simple Storage Service, but IBM and other traditional IT vendors are also offering services, as is telecom-and-more provider Verizon Business.

• Platform as a Service — Provides virtualized servers on which users can run existing applications or develop new ones without having to worry about maintaining the operating systems, server hardware, load balancing or computing capacity. Highest-profile examples include Microsoft's Azure and Salesforce's Force.com.

• Software as a Service — The most widely known and widely used form of cloud computing, SaaS provides all the functions of a sophisticated traditional application, but through a Web browser, not a locally-installed application. SaaS eliminates worries about app servers, storage, application development and related, common concerns of IT. Highest-profile examples are Salesforce.com, Google's Gmail and Apps, instant messaging from AOL, Yahoo and Google, and VoIP from Vonage and Skype.

 

 

Pros of Cloud Computing Model

• Quick deployment – add capacity or applications almost at a moment's notice.
• Metered cost – pay-as-you-go approach for storage, processing and applications means more efficient use of IT spending.
• Little or no capital investment – costs don't stay on the books for years.
• Little or no maintenance cost – maintenance is all from a workstation or configuration screen. You never have to go touch a physical server.
• Lower costs – Many customers use the same infrastructure, so the vendor is able to buy in bulk and amortize costs over more customers, potentially lowering per-unit cost to each customer.

Cons of Cloud Computing Model

• Little or no capital investment – services don't depreciate over years as capital expenses do, so there could be a tax disadvantage over time.
• Monitoring and maintenance tools are not mature yet – visibility into the cloud is limited, despite recent announcements by BMC, CA, Novell and others that they're modifying their data-center management applications to provide better control over data in Amazon's EC2 and other cloud services.
• Immature standards – groups such as the Distributed Management Task Force, the Cloud Security Alliance and the Open Cloud Consortium are developing standards for interoperable management, data migration, security and other functions, but real standards at the quality levels corporate IT requires are still a couple of years away, most analysts agree.

Risks of Cloud Computing Model

Data mobility – Most SaaS or cloud vendors have some ability for customers to download and store data, but the cost of using someone else's application is often that you can't get all your data out of it in a way that's usable in a different vendor's software.
Privacy – Most cloud contracts include privacy language that promises a customer's data is secure and private. But with cloud-monitoring and management software still in its infancy, a customer's ability to know for sure who's looking at what data — especially who within their own organizations is using it — is limited.
Service levels – Cloud computing isn't entirely one-size-fits-all; there is some ability to customize the applications and services each customer gets. But the ability to tailor service-level requirements to the specific needs of a business is far less than with internal data centers where IT's whole purpose is to further the company's business goals.
Interoperability – The highly-customized internal applications that many companies rely on most heavily are often incompatible with generic IT infrastructures available within the cloud. That may be fine with many companies, which would prefer to use only relatively generic applications outside their own firewalls.

 

 


"Legal Disclaimer: This electronic message and all contents contain information from Cybage Software Private Limited which may be privileged, confidential, or otherwise protected from disclosure. The information is intended to be for the addressee(s) only. If you are not an addressee, any disclosure, copy, distribution, or use of the contents of this message is strictly prohibited. If you have received this electronic message in error please notify the sender by reply e-mail to and destroy the original message and all copies. Cybage has taken every reasonable precaution to minimize the risk of malicious content in the mail, but is not liable for any damage you may sustain as a result of any malicious content in this e-mail. You should carry out your own malicious content checks before opening the e-mail or attachment." www.cybage.com

Summing column values using AWK

if you have value like this

$cat juned.txt
juned_workers 0.03322
juned_workers 0
juned_workers 0.17053
juned_workers 0
juned_workers 0.41322
juned_workers 0
juned_workers 0.16864
juned_workers 0.05603
juned_workers 0
juned_workers 0.15836

and if you want the total of column 2 , awk will be handy

$cat juned.txt | awk '{print "Row"NR,$_} { s += $2 } END { print "Total : ", s} '
Row1 juned_workers 0.03322
Row2 juned_workers 0
Row3 juned_workers 0.17053
Row4 juned_workers 0
Row5 juned_workers 0.41322
Row6 juned_workers 0
Row7 juned_workers 0.16864
Row8 juned_workers 0.05603
Row9 juned_workers 0
Row10 juned_workers 0.15836
Total : 1

Scalr - open source cloud management tool

Scalr is fully redundant, self-curing and self-scaling environment utilizing multiple cloud platforms like Amazon EC2, Amazon RDS, Rackspace, Nimbula, Eucalyptus.

Highlights

• Developed by Intridea
• First developed on mediaplug.org
• Released as open source in April 2008
• Designed with flexibility in mind, users customize a generic base.

Advantages:
• Pre-made images: Popular software is made available to you so you don't have to prepare images yourself
• New abstraction layers for infrastructure management: Manage servers at the Farm or Function levels, not at the server level
Automation: Scalr automates failover and scaling, so your infrastructure runs on auto-pilot
• Freedom: Open Source


for further details please visit : http://www.scalr.net/

Hello World

Hello World ....

After successful years with wwwTipsNtrapS.com thought I should start a blog and here I am with my first hello world post.

hope in coming days , iJuned.blogpost will host lots of important information.

bye for now