Friday, November 2, 2018

A sample C++ code (working draft)

#include
#include
#include

using namespace std;

class set
{
    int n;
    vector arr;
    public: set(int n1, vector arr1)
    {
        n = n1;
        arr = arr1;
    }
    public:
        int find_median()
        {
            cout << endl;
            for (auto i=0; i < n; i++)
                cout << " " << arr[i] << "|";
            cout << random();
            cout << endl;
            return 0;
        }
};


int main()
{
   cout << "Hello World" << endl;
   vector l;
   for (auto i=1; i<=10; i++)
      l.push_back(i);
    for (auto i=l.begin(); i!=l.end();i++)
      cout<<*i;
   class set a(10, l);
   cout << endl << "Median is" << a.find_median();
   return 0;
}

Sunday, May 8, 2011

Cloud providers information

* Google App Engine - http://code.google.com/appengine/
* Amazon EC2 – http://aws.amazon.com/ec2/
* GoGrid - http://www.gogrid.com/
* RackspaceCloud/Mosso – http://www.rackspacecloud.com/
* Right Scale – http://www.rightscale.com/
* 3Tera - http://www.3tera.com/
* Elastic Hosts – http://www.elastichosts.com/
* Etelos - http://www3.etelos.com/
* Hostway FlexCloud – http://www.hostway.com/flexcloud/
* Joyent - http://www.joyent.com/
* Jungle Disk – http://www.jungledisk.com/
* TerreMark - http://www.theenterprisecloud.com/
* cloud.bg – http://www.cloud.bg/en/ – High availability system (Cloud) which allows site owners to use automated cPanel/WHM enabled cloud hosting service in a load-balanced environment( European hosting )
* Commensus – http://www.commensus.com – Provides cloud hosting, virtual server hosting and PaaS services.
* Rackspace Windows Cloud (Beta) – http://www.rackspacecloud.com/windows – Cloud Servers will be fully supported by Microsoft
* CariNet – http://www.cari.net/ – Get secure cloud servers, Dedicated servers, cloud hosting and private cloud hosting.
* Chillyz – http://www.chillyz.com/ – Cloud Computing, Cloud Hosting Service – Delhi, India

Heroku
Kaavo
Rightscale
Appirio
Zuora
Eucalyptus
GoodData
Skytap
CloudSwitch
Okta
Cloud.com


Free server vrtualization software
In no particular order, here are some of my favorite top free virtualization tools:

* VMware vSphere ESXi Free Edition and VMware Go
* VMware vMA, vCLI (or command-line interface), PowerCLI, and scripts from the vGhetto script repository such as vSphereHealthCheck
* Veeam Monitor (free edition), FastSCP, and Business View
* Vizioncore Wastefinder, vConvert SC and Virtualization EcoShell
* SolarWinds' VM Monitor
* Trilead VM Explorer
* TripWire ConfigCheck
* ConfigureSoft/EMC Compliance Checker
* ESX Manager 2.3 from ESXGuide (ESX 3i and 4i are not supported)
* vKernel SearchMyVM, SnapshotMyVM, and Modeler
* Hyper9 GuessMyOS Plugin, Search Bar Plugin, and Virtualization Mobile Manager
* XtraVirt vAlarm and vLogView


TABLE OF CONTENTS
General cloud resources
Open source cloud projects
Cloud standards initiatives
Cloud computing and social media
News and blogs from the cloud providers


General cloud resources

National Institute of Standards and Technology on cloud computing
The National Institute of Standards and Technology (NIST) has published a broad functional definition of cloud computing based on the expected behavior of a cloud computing resource. This is the accepted base line for cloud computing models and architectures; although providers sometimes do not meet all of the requirements listed in the definition, there is general agreement that a cloud computing solution must adhere closely to the NIST definition.

Other cloud computing explanations are available at WhatIs.com and Wikipedia.

CloudClimate
This cloud monitoring website, courtesy of network tracking software vendor Paessler, keeps track of live performance data on several large cloud computing providers, including Amazon, GoGrid and NewServers.

Cloud Provider Scorecard
Another monitoring service from Apparent Networks, the Cloud Provider Scorecard issues alerts when cloud services suffer degradation and tracks outages in real time.

Top 10 cloud computing providers
This is a list of the top 10 cloud computing providers, from NewServers to Amazon and many in between. Customer traction, innovation and track record are key factors in its rankings. The provider space is changing very fast, and many telecoms, hosting companies and others are launching cloud services. This list is a point-in-time snapshot of the market as we see it and not a comprehensive list of vendors.

Cloud computing players on MindMeister
Maintained by Quebecois technologist Jean-Lou Dupont, an interactive and comprehensive list of cloud computing vendors and organizations. Always worth a read to gauge the weather in the cloud computing world.

Amazon Web Services product directory
This ever-expanding list of products available for use in Amazon's cloud covers options from CA, IBM, Oracle and Red Hat among others. Let us know if we are missing any important ones.

Cloud computing development for beginners
Any newcomers looking to develop applications in the cloud will find this guide extremely useful, especially the tips on developing in Microsoft Azure and running a Web service on Google App Engine.

Cloud Developer Tips: Practical tips for developers of cloud computing applications
Shlomo Swidler's blog provides insight and ideas on developing projects and applications for the cloud, along with cloud computing news and notes in general.
Additional cloud resources:
Virtualization and the cloud are not panaceas

How to move to the cloud

Can cloud computing survive an economic upturn?


Jack of all Clouds
Cloud entrepreneur Guy Rosen offers, amongst other things, a monthly State of the Cloud address with in-depth stats on the top cloud computing providers.

Cloud management tools for beginners
Get an overview of the big names in cloud computing management tools, including RightScale, Kaavo and Scalr, in this special report designed to educate on the core features of cloud management vendors and products.

A special report on Oracle grid and cloud computing
Take a look at the definition of grid computing and cloud computing, how they compare to other technologies such as clustered computing, how grid and cloud computing are used in Oracle and the future of their adoption.

Rational Survivability: Cloud and virtualization security blog
An entertaining take on virtualization and cloud computing security from information security expert Christofer Hoff. Hoff is now director of cloud computing with Cisco and maintains the blog irregularly.

Lori MacVittie's cloud blog for F5 networks
All-around geek extraordinaire Lori MacVittie writes regularly on cloud theory and application. Come here to get your app/dev and network jargon properly applied to cloud computing.

Open source cloud projects

Eucalyptus
This Amazon-compatible open source software, started in the fall of 2007 at the Computer Science Department at the University of California, Santa Barbara and is designed to implement cloud computing on compute clusters. Eucalyptus is a for-profit open source firm that maintains the project. It also comes bundled as a standard part of Ubuntu .

Abiquo
A Web-friendly and versatile infrastructure platform. Originally a project started in Spain, now a for-profit open source company just like Eucalyptus but with a different approach to cloud.

Nimbus
If you're looking to turn your cluster into an Infrastructure as a Service (IaaS) cloud, the Nimbus open source toolkit provides an implementation based on the Xen hypervisor.

Hadoop
The Apache Hadoop project is a collection of open source software designed to work with distributed computing.

OpenECP
Following the commercialization of the Enomaly Elastic Computing Platform, this free, open source Web-based management platform offshoot, called OpenECP, was released.

Ganglia
The Millennium Project at the University of California, Berkeley gave birth to Ganglia, an open source distributed monitoring system designed for high-performance computing systems.
And if you're looking for open source cloud management projects, libcloud, jclouds and Dasein are open source "translation" projects that developers can use to interact with many different cloud providers through a single interface.

Cloud standards initiatives

Cloud Standards Coordination
This wiki documents all standards development organizations involved in the cloud market and their respective efforts to produce workable cloud computing security standards.

CloudAudit
CloudAudit, also known as Automated Audit, Assertion, Assessment, and Assurance API (A6), is an organization attempting to automate several aspects of cloud computing infrastructure, platform and application environments.

Cloud Security Alliance
The Cloud Security Alliance, which includes members like CA, Google, Microsoft, Rackspace and Terremark, is a nonprofit organization formed to promote best practices for cloud computing security.

Open Cloud Consortium
The Open Cloud Consortium (OCC) supports the development of frameworks for interoperating between clouds, along with operating a testbed called the Open Cloud Testbed.

Open Standards Cloud Incubator
The Distributed Management Task Force's Open Standards Cloud Incubator focuses on developing cloud computing management protocols in order to standardize interactions between cloud environments.

Open Cloud Computing Interface
The goal of the Open Grid Forum Open Cloud Computing Interface (OCCI) working group is to provide cloud Infrastructure as a Service (IaaS) users with API specifications for remote management.

The Open Group Cloud Work Group
The Open Group Cloud Work Group looks to work with other cloud standards organizations in an attempt to show enterprises how to best incorporate cloud computing into their organizations.

Cloud Storage Initiative
The Storage Networking Industry Association's Cloud Storage Initiative, which includes members from NetApp, Oracle and EMC, works to promote the adoption of cloud storage as a new delivery model.

Cloud computing and social media

If you're on the hunt for great places to interact and swap ideas on cloud, look no further. Twitter is abuzz day after day with tweets from the Clouderati, a group that includes the best and brightest in cloud computing. Industry leaders can often be found debating topics like cloud security and pricing.

And if you're looking for cloud conversation in more than 140-character bursts, you can chat about cloud computing on both Facebook and Google Groups. Both sites are packed with aficionados looking to discuss the future of the cloud.

News and blogs from the cloud providers

Amazon Web Services Blog
Everything you could ever need to know about Amazon Web Services, including product releases, tools, updates and development information.

The Cloud Blog from Rackspace
Looking for information on Rackspace? This oft-updated blog covers all official Rackspace Cloud news direct from the company.

Force.com Blog
The Platform as a Service (PaaS) offering from Salesforce.com presents its own blog, with information on the company and its development platform.

Sunday, March 20, 2011

Code visualisation

A good links to code visualization and its related tools are

CodeCrawler
CodeCity

How to create a daemon process in linux using C

A good tutorial about this topic can be found here.

After creating it, compile it using gcc and run(eg:./a.out). U can see this daemon running as a child of init(see using pstree command). U can see the pid of this process using ps -e command.

Another one can be found here
Code:
#include "sys/types.h"
#include "sys/stat.h"
#include "stdio.h"
#include "stdlib.h"
#include "fcntl.h"
#include "errno.h"
#include "unistd.h"
#include "syslog.h"
#include "string.h"

int main(void) {

/* Our process ID and Session ID */
pid_t pid, sid;

/* Fork off the parent process */
pid = fork();
if (pid < 0) {
exit(EXIT_FAILURE);
}
/* If we got a good PID, then
we can exit the parent process. */
if (pid > 0) {
exit(EXIT_SUCCESS);
}

/* Change the file mode mask */
umask(0);

/* Open any logs here */

/* Create a new SID for the child process */
sid = setsid();
if (sid < 0) {
/* Log the failure */
exit(EXIT_FAILURE);
}



/* Change the current working directory */
if ((chdir("/")) < 0) {
/* Log the failure */
exit(EXIT_FAILURE);
}

/* Close out the standard file descriptors */
close(STDIN_FILENO);
close(STDOUT_FILENO);
close(STDERR_FILENO);

/* Daemon-specific initialization goes here */

/* The Big Loop */
while (1) {
/* Do some task here ... */

sleep(30); /* wait 30 seconds */
}
exit(EXIT_SUCCESS);
}

Wednesday, March 16, 2011

Switch Statement in C

Today when I am listening to a podcast about MISRA C, I came to know about some interesting fact about switch statement in C. The explanation with example about it can be found here.

Imagine a calculation depending on certain numbers being prime or not. If the routine gets a prime parameter it executes one routine, if the parameter is not prime, another. Like this:
if (is_prime(a))
··process_prime(a);
else
··process_nonprime(a);
The if-statement is just that, a statement, a composite statement.
A switch-statement is composed of a switch keyword, the value on which to operate, and a, possibly composite, statement. It could be our if-statement, if we so choose. However, without any case/default-labels, the switch-statement would just jump over the statement so specified, effectively doing nothing. To remedy that, we put the default-label before the if-statement:
switch (a)
··default:
····if (is_prime(a))
······process_prime(a);
····else
······process_nonprime(a);
This code already looks strange, but it is functionally equivalent to the if-statement by itself.
If we now imagine the function is_prime(a) to be very expensive, it would make sense to take a shortcut around that function wherever possible. And if 99% of the values the variable a can have lie between 2 and 10 inclusive, it definitely would make sense to circumvent the is_prime() function, since we know the primeness of those values without calculation:
switch (a)
··default:
····if (is_prime(a))
··case 2: case 3: case 5: case 7:
······process_prime(a);
····else
··case 4: case 6: case 8: case 9: case 10:
······process_nonprime(a);
To understand why this is correct C, we need to realize that case-labels belonging to a switch-statement can be positioned anywhere within the boundaries of the composite statement belonging to the switch. In our case, this means until the semicolon after the process_nonprime(a) statement.
It works as follows:

If a is 3 upon execution of the switch, the label case 3: is where execution continues after determining the value of a to be three, jumping into the middle of the if-statement and calling the function process_prime with a parameter 3. After execution of that function, the if-statement is terminated, terminating the enclosing switch-statement at the same time.
If a is 8 upon execution of the switch, the label case 8: is where execution continues after determining the value of a to be eight, jumping into the middle of the if-statement and calling the function process_nonprime with a parameter 8. After execution of that function, the if-statement is terminated, terminating the enclosing switch-statement at the same time.
If a is 29 upon execution of the switch, the label default: is where execution continues after determining that no known value is to be processed, executing the if-statement from its beginning. Depending on the value of a (29 in this case) the if-condition determines which of the two alternative functions to call, just like a normal if-statement.

Tuesday, March 8, 2011

Rename a pendrive in Ubuntu

You can use the following command to achieve this purpose...

sudo mlabel -i /dev/sdb1 :: Name_of_penDrive

Thursday, February 17, 2011

Ubuntu

1. To know about the hardware you are using in your computer. The lshw-gui adds a nice gui to the lshw command.

$sudo lshw.

2. To know about the CPU specifically,
$lscpu

3. To know whether your video card is supported by X11,
$lspci
This utility gives a list of all the devices plugged in to your PCI bus.

4. To see what USB devices are on your system,
$lsusb

5. To know about disk subsystem, use blkid utility
It prints out all the available filesystems. With this utility, you can learn what devices are available and what filesystems are being used on them. The associated UUIDs also are available if you want to use them in the entries in /etc/fstab.

6. To see whether your kernel actually is using the available hardware,
$lsmod

Sysinfo gives a GUI view of system info as well.
Another great utility is dmidecode. This will give you a ton of information about your machine


To know about Cpu and others info and their usage:

To obtain CPU information:
head /proc/cpuinfo

To obtain memory (RAM) information
head /proc/meminfo

To obtain partition of your swap space:
# head /proc/swap

To obtain partition sizes:
# head /proc/partitions

for mem info
free -m

$uptime
Shows the information about the system uptime and load averages in last 1,5 and 15 minutes.
if the load averages were 20.68, 5.01, 1.03, I would conclude that the high load had likely started in the last 5 minutes and was getting worse.

$top and $iostat

$lsof - lists information about files opened by processes.
An open file may be a regular file, a directory, a block special file, a character special file, an executing text reference, a library, a stream or a network file (Internet socket, NFS file or UNIX domain socket.) A specific file or all the files in a file system may be selected by path.

Instead of a formatted display, lsof will produce output that can be parsed by other programs. Use -F option and OUTPUT FOR OTHER PROGRAMS section.
In addition to producing a single output list, lsof will run in repeat mode. In repeat mode it will produce output, delay, then repeat the output operation until stopped with an interrupt or quit signal.

$powertop -p

To know about the list of softwares installed in your computer, use
dpkg -l (OR)
dpkg --get-selections > installed.txt (O/P will be in installed.txt file)

To open word documents in command line use catdoc package like cat for normal text files.



8 Great open source desktop productivity tools:
------------------------------------------------
Abiword 2.8.6 - simple word processing application. Allows you connect to another AbiWord user across a network and work on the same document in real time.

Scribus 1.3.8 - desktop publishing program has a macro language GIMP with a number of prepackaged macros (Eg: a calendar generator), can produce professional-quality CMYK PDFs, and even includes a "preflight check" function.

SeaMonkey 2.0.6 - Mozilla's "suite" product, which bundles Web browsing, email, IRC chat, and an HTML editor in one application, hasn't received nearly as much attention as Firefox or Thunderbird, both of which are now incorporated as part of the SeaMonkey bundle.

GIMP 2.6 - GNU Image Manipulation Program, a staple recommendation as an alternative to Photoshop.

Paint.NET 3.5.5 - spectacular program comes closer than any other to replacing Photoshop for the casual user. support for just about every major image format make this program well worth having.

Inkscape 0.48 - Free software's answer to Adobe Illustrator. Its native file format is conventional XML, and it can import and export from a whole bevy of existing vector and raster formats, as well as PDFs.

Dia 0.97 - A flowchart and diagram drawing tool that is much like an AbiWord for illustration, in that it gives you only what you need to create a certain class of design and doesn't burden you beyond that.

FreeMind - a drawing tool specifically for creating "mind maps," or diagrams that illustrate conceptual frameworks.


Ubuntu Useful softwares:
------------------------

(1)pdfedit, Kword, Scribus, flpsed - for editing the PDF documents

Install:
$ sudo apt-get install pdfedit

To start PDFEdit, type:
$ pdfedit /path/to/pdf.file &
$ pdfedit &


$ sudo apt-get install scribus

To use scribus to edit PDF files:
Start scribus > New File > Insert > Image > Double click > Select PDF file

To edit file, enter:
$ flpsed /path/to/pdf-file.pdf &

PDFEdit is the best free open source software for for Linux / Unix-like operating systems. However, it does not support editing protected or encrypted PDF files.

(2)Xfig - for drawing the images in linux(MS Visio is a great tool in windows for drawing images)

Install:
sudo apt-get install xfig

Use: $ xfig

(3)jing - Video capturing tool in linux

(4)Storybook, Writer's Cafe - Tools for writing stories or novels in a structured manner.
Both are cross platform(Run in both Linux and Windows).