Technology and Open Source Update

Latest information about new technology and open source.

PHP – Taking Strings Apart

Posted by megahacker136 on October 14, 2008

Problem

You need to break a string into pieces. For example, you want to access each line that a user
enters in a <textarea> form field.

Solution

Use explode( ) if what separates the pieces is a constant string:
$words = explode(‘ ‘,‘My sentence is not very complicated’);

Use split( ) or preg_split( ) if you need a POSIX or Perl regular expression to describethe separator:
$words = split(‘ +’,‘This sentence has some extra whitespace in it.’);

$words = preg_split(/\d\. /,‘my day: 1. get up 2. get dressed 3. eat
toast’
);
$lines = preg_split(‘/[\n\r]+/’,$_REQUEST[‘textarea’]);


Use split( ) or the /i flag to preg_split( ) for case-insensitive separator matching:
$words = split(‘ x ‘,’31 inches x 22 inches X 9 inches’);
$words = preg_split(‘/ x /i’,’31 inches x 22 inches X 9 inches’);

Discussion

The simplest solution of the bunch is explode( ). Pass it your separator string, the string to
be separated, and an optional limit on how many elements should be returned:
$dwarves = ‘dopey,sleepy,happy,grumpy,sneezy,bashful,doc’;
$dwarf_array = explode(‘,’,$dwarves);
Now $dwarf_array is a seven element array:
print_r($dwarf_array);
Array
(
[0] => dopey
[1] => sleepy
[2] => happy
[3] => grumpy
[4] => sneezy
[5] => bashful
[6] => doc
)

If the specified limit is less than the number of possible chunks, the last chunk contains the
remainder:
$dwarf_array = explode(‘,’,$dwarves,5);
print_r($dwarf_array);
Array
(
[0] => dopey
[1] => sleepy
[2] => happy
[3] => grumpy
[4] => sneezy,bashful,doc
)

The separator is treated literally by explode( ). If you specify a comma and a space as a
separator, it breaks the string only on a comma followed by a space — not on a comma or a
space.
With split( ), you have more flexibility. Instead of a string literal as a separator, it uses a
POSIX regular expression:
$more_dwarves = ‘cheeky,fatso, wonder boy, chunky,growly, groggy, winky’;
$more_dwarf_array = split(‘, ?’,$more_dwarves);

This regular expression splits on a comma followed by an optional space, which treats all the
new dwarves properly. Those with a space in their name aren’t broken up, but everyone is
broken apart whether they are separated by “,” or “, “:
print_r($more_dwarf_array);
Array
(
[0] => cheeky
[1] => fatso
[2] => wonder boy
[3] => chunky
[4] => growly
[5] => groggy
[6] => winky
)

Similar to split( ) is preg_split( ), which uses a Perl-compatible regular-expression
engine instead of a POSIX regular-expression engine. With preg_split( ), you can take
advantage of various Perlish regular-expression extensions, as well as tricks such as including
the separator text in the returned array of strings:
$math = “3 + 2 / 7 – 9”;
$stack = preg_split(‘/ *([+\-\/*]) */’,$math,-1,PREG_SPLIT_DELIM_CAPTURE);
print_r($stack);
Array
(
[0] => 3
[1] => +
[2] => 2
[3] => /
[4] => 7
[5] => –
[6] => 9
)
The separator regular expression looks for the four mathematical operators (+, -, /, *),
surrounded by optional leading or trailing spaces. The PREG_SPLIT_DELIM_CAPTURE flag
tells preg_split( ) to include the matches as part of the separator regular expression in
parentheses in the returned array of strings. Only the mathematical operator character class is
in parentheses, so the returned array doesn’t have any spaces in it.

How to get filename from address or url?

Solution

$arrStr = explode(“\”, “D:\ruby program\cuba.rb”);
$arrStr = array_reverse($arrStr);

echo(“Filename is “ . $arrStr[0]);

or

$arrStr = split(“\”, “D:\ruby program\cuba.rb”);
$arrStr = array_reverse($arrStr);

echo(“Filename is “ . $arrStr[0]);

See the documentation to know details:

http://www.php.net/explode

http://www.php.net/split

http://www.php.net/preg-split

Posted in Open Source, Programing | Tagged: , , | Leave a Comment »

Google – Project 10 to the 100th

Posted by megahacker136 on October 10, 2008

Google wants to know if you have an idea that can improve the lives of as many people as possible. And it wants to know before Oct 20.

“These ideas can be big or small, technology-driven or brilliantly simple — but they need to have impact,” the king of search on the Internet said.

Google has US$10mil (RM33mil) to turn five of the best ideas it receives into reality.

It will first identify 100 best ideas and then ask Google users to vote on which ones should be funded. Their votes will result in a shortlist of 20, which a panel of judges will further distil to five.

The call is part of Google’s 10th birthday celebrations and known as Project 10^ 100 (pronounced Project 10 to the 100th).

“We have learned over the last 10 years at Google that great ideas can come from anywhere,” it said in a statement to the press.

“We want to extend to the world the idea that great ideas come from all angles.”

Google said it knows that there are countless brilliant ideas that need funding and support to come to fruition. It cited some examples of cool ideas.

There’s a team of two implementing a solution to help the millions of people who laboriously carry on their heads five-gallon buckets of water over long distances, it said.

The team has designed The Hippo Water Roller — a relatively inexpensive 24-gallon container that can be easily wheeled on the ground.

Another cool idea, said Google, is to have communities tacking on WiFi devices to public buses so they can detect and send stored e-mail messages as the buses travel through unconnected areas.

Visit http://www.project10tothe100.com/ for more details.

How to participate?

1. Send your idea by October 20th.

Simply fill out the submission form. <——click here to fill up the form

2. Voting on ideas begins on January 27th.

3. Google will help bring these ideas to life.

Project 10 to the 100th consist of 8 categories:

Category Descriptions

Here are the categories in which we’ll be considering ideas.

  • Community: How can we help connect people, build communities and protect unique cultures?
  • Opportunity: How can we help people better provide for themselves and their families?
  • Energy: How can we help move the world toward safe, clean, inexpensive energy?
  • Environment: How can we help promote a cleaner and more sustainable global ecosystem?
  • Health: How can we help individuals lead longer, healthier lives?
  • Education: How can we help more people get more access to better education?
  • Shelter: How can we help ensure that everyone has a safe place to live?
  • Everything else: Sometimes the best ideas don’t fit into any category at all.

Posted in internet, Tech Event, Tech Industry | Tagged: , , , | Leave a Comment »

Blogger vs. WordPress

Posted by megahacker136 on October 9, 2008

Pros of Blogger (Blogspot)-

  • It’s run by Google so you know it’s not going anywhere. They have billions of dollars to invest in technology! They won’t be going out of business anytime soon – so you know your blog/journal will be safe with them.
  • Blogger allows you to integrate with other Google Account tools such as Google Adsense. This allows you to make money with your blog without having to know anything about the online advertising business.
  • Tons of widgets – Blogger offers widgets that you can add to your blog. There are hundreds of widgets that various people have developed and they are all free of charge to use and easy to plug into your blogger blog.
  • It’s so easy! These guys know a thing or two about what people want out of a blog. They know that the average user has no idea about html code, php, or database programming experience. So they give you a one click option after login to begin typing. All you have to do is type in the title – then type in the body. The labels/tags are optional, but it’s helpful for people who want to find similar posts on your blog.
  • You can have many blogger blogs and it’s free! There is no limit to the number of blogs you have on the blogspot domain. This is a nice feature in contrast to some other free blogging services. Some people we know have 50+ blogs.
  • Google love their own services so it spiders well in the search engines and they also like the URL of blogspot. So if you do nothing else besides post on your blog you could get Google search traffic because it could rank well if you have well written posts with great content.
  • You can add a domain to your blog – through the CNAME records of your domain name – you can point blog.domainname.com to your Blogger blog. This is really easy to do. We’ll discuss the con to this later in the post.

Pros of WordPress-

  • First we have to differentiate the WordPress blogs – One is a free hosted service while the other is the software download. The hosted service is located on WordPress.com while the software dowload is run off WordPress.org. We’ll be talking about the WordPress.com software.
  • We love that it’s easy to use, but extremely robust – much like the downloaded software.
  • You can have multiple blogs on WordPress as well – just like Blogger.
  • If you write good posts and follow the guidelines – you can get good traffic from WordPress.com tag searches. When you post an entry – they allow your post to be found by the tags on a global tagging system. This enables anyone to click on a tag and view all recent posts. This is also good for links because the links are in the RSS feed of that tag.  – Be Careful though – this is not to be abused. It’s just so others can find your blog. If you get too spammy – they will kick you out of the tag searches and for good reason!
  • Cheap upgrade to add a domain to your blog. $15/year adds a domain name to your blog and removes ads.
  • They are “almost” ad free. They only display ads to certain users – they use google adsense and they are non-intrusive. They don’t show up to everyone and if you own the account – it will most likely not show up for you either. They almost always show up if the referring site is a search engine.

Posted in internet | Tagged: , , | Leave a Comment »

Red Hat vs Microsoft

Posted by megahacker136 on October 9, 2008

Red Hat has released a Linux software stack for compute-intensive IT environments that it said costs less than Microsoft’s price for its comparable Windows offering.

Red Hat charges a subscription of $249 per node, or server, per year for Red Hat HPC Solution, a new offering that combines Red Hat Enterprise Linux with Platform Open Cluster Stack 5, clustering software it has licensed from Platform Computing.

Red Hat HPC Solution also includes device drivers, a cluster installer, cluster-management tools, a resource and application monitor, interconnect support, and a job scheduler. The yearly subscription also includes ongoing technical support, bug fixes, and any future software updates, said product marketing manager Gerry Riveros.

Comparably, Microsoft’s Windows HPC Server 2008, which also combines the OS with components needed for clustering and managing the HPC environment, costs a one-time fee of $475 per node, which on the surface seems less expensive than Red Hat’s offering.

However, to get maintenance and software updates, Microsoft requires that enterprise customers purchase an Enterprise Assurance (EA) maintenance agreement for three years. Though Microsoft will not disclose publicly what those agreements cost, those familiar with them said they typically cost about 25 to 29 percent of the price of the product.

Factoring in the cost of the EA, the cost of one Windows HPC 2008 Server over three years would be more than $800, while a comparable HPC offering from Red Hat is about $750.

Through its public relations firm, Microsoft on Thursday(2/9/2008) declined to provide estimates about how much Windows HPC Server 2008 will cost over three years for customers beyond the per-node pricing, saying that information will be available on its Web site on Nov. 1.

Customers who require HPC environments perform tasks such as data modeling or complex, computer-generated simulation that require complex computational power.

Before Thursday, Red Hat offered only a version of Red Hat Enterprise Linux for HPC environments; customers have to assemble other components of the software needed to build a full-scale HPC environment themselves, Riveros said.

He acknowledged that pressure from Microsoft in the HPC market inspired the company to sell an all-in-one offering for a competitive price. Customers, too, asked Red Hat to combine the components with the OS to make for easier deployment and management, he said.

“We wanted to remove the chief roadblocks, the whole hassle of trying to put it together themselves,” Riveros said.

Linux is the OS most used for HPC environments and has been dominant in the market for some time. However, over the past several years, Microsoft — a relative newcomer to the space — has stepped up its efforts because the company wants people to use Windows in that market.

Last month, Microsoft released to manufacturing Windows HPC Server 2008 as a complete bundle for deploying and managing high-performance clusters at what it claims is a competitive price. Microsoft and Cray also last month unveiled a $25,000 personal supercomputer, the Cray CX1, that they said will give people an HPC environment at their desktop.

Source from InfoWorld.com

Posted in Uncategorized | 1 Comment »

Cisco Systems on Windows Server 2008

Posted by megahacker136 on October 8, 2008

Enterprises can now buy a networking appliance from Cisco Systems that runs basic Windows Server 2008 functions, a product designed for use in branch offices, Cisco and Microsoft announced Wednesday.

he companies said in February that they were working on a way for enterprises to run Windows Server 2008 services locally at a branch office on Cisco’s Wide Area Application Services (WAAS) networking appliance. The alternative for many companies is either to use a full Windows Server at every branch, which could be overkill, or run all functionality centrally, which could result in slow performance for branch workers.

With the new product, called Windows Server on WAAS, branch offices can host services locally including Active Directory, Microsoft Print Services, Microsoft Domain Name System Server and Microsoft Dynamic Host Configuration Protocol Server. That can improve performance for branch workers and reduce costs related to wide area network connectivity and branch systems management. An IT administrator can remotely manage the Windows Server functions using Microsoft System Center.

Cisco used embedded virtualization technology in its appliance to enable Windows Server 2008 to run on it.

Some companies that had early access to the product describe their experiences on a Web site set up by Microsoft and Cisco. Farm Credit Services of Mid-America had 180 Windows Servers companywide, including one in nearly every branch, said Jim Curtis, director of infrastructure. His goal with Windows Server on WAAS is to move most of the branch servers to the company’s data center to make better use of a small infrastructure support staff.

He currently runs Active Directory centrally, but once the appliance setup is complete he could move Active Directory to the branches as a read-only function, improving log-in times for workers and mitigating potential security issues, he said.

The product is one example of Cisco and Microsoft working together while they also compete in other markets, such as unified communications.

Pricing for Windows Server on WAAS starts at $10,000, including the hardware and the software license. Other configurations with more storage are also available.

Posted in PC, Software, Tech Event, Windows | Tagged: , , | Leave a Comment »

Cyber-Threats’ Reality

Posted by megahacker136 on October 8, 2008

WAR, crime and terrorism are traditional concepts that occur in the physical domain. The only difference between those concepts and ­cyberwar, cybercrime and cyber-terrorism is the “cyber” prefix.

Cyberwar refers to warfare in cyberspace and includes ­cyber-attacks against a nation state and critical communication network. Cyber-terrorism refers to the use of cyberspace to commit terrorism. It is generally understood to mean unlawful attacks and threats of attack against computers, networks and the information stored therein when done to intimidate or coerce a government or its people to further political or social objectives.

Cybercrime or crime in cyberspace has been much experienced by many parties where the motive is more of computer-related crimes and monetary gain is the focus.

What is a threat?

From the information security perspective, a threat is defined as the potential to cause an unwanted incident in which an asset, system or organisation may be harmed.

There are three sources of threats: Intentional, accidental and environmental. Some examples of intentional threats are those that use malicious software or illegal software. Accidental threats can be seen as service failure, human design error or hardware failure.

Meanwhile, examples of ­environmental threats are ­earthquakes, thunderstorms or lightning. All these threats cannot be totally eliminated, but can be reduced through the establishment of effective measures to curb such threats within each organisation.

Threats however, if not properly controlled, can create an unwanted impact on security, socio-economy and human lives.

Cheap method

The dimension of warfare can be categorised as conventional, space and cyber-warfare. Conventional warfare and space warfare are expensive whereas cyber-warfare is cheap. It is also accessible to many groups and individuals.

Cyber-warfare enables asymmetric warfare, where individuals have the abilities and capabilities to cause damage to a nation state.

Access to a personal computer with an Internet connection can create as much damage as traditio­nal weapons. It is attractive to many because it is cheap in relation to the cost of developing, maintaining and using advanced military capabilities.

The sophistication of an attacker’s tools and techniques is becoming more powerful and requires less technical knowledge nowadays.

Furthermore, all of these tools are available on the Internet, which is more user-friendly, at a very ­minimal cost and in many instances, are free of charge.

There are known threats which have limited capabilities and marginal opportunities with high risks of being detected. There are also emerging threats which have many capabilities and broad ­opportunities and provide low risks of detection. These are the ­dilemmas that we face today.

Case studies

Below are several case studies of cyberthreats reported outside Malaysia:

· Cyberattacks experienced by the Japanese government.

It was reported that the Japanese government’s computers were under attack on August 4, 2004. Eight Japanese government ­agencies’ computer networks were disrupted almost simultaneously, similar to what is known as barrage jamming in telecommunication terms.

Those networks experienced denial-of-service attacks whereby the affected networks were not accessible for a few hours.

· Hackers clogging up the US customs’ computers for hours.

This case was reported in August 2005 where viruses attacked the US Customs and Border Protection system for several hours. Several thousands of people were affected.

The viruses left a grave impact on the computers at airports in Miami, New York, San Francisco, Los Angeles, Houston and Dallas.

· Cyberattacks on Estonia

In May 2007, Estonia was under cyberattack for three weeks. The attacks paralysed Internet ­communications targeting the government, banking, media and police websites.

Huge economic losses were incurred as online transactions were disrupted. · Cyber-warfare between Russia and Georgia

Russia’s invasion of Georgia in August had moved into cyberspace as the Russians managed to siege and gain direct routing intended for Georgia.

It was reported that the Russians intercepted the network traffic to Georgia and redirected the route to their servers. Many of Georgia’s Internet servers were under their command and control.

Local attack

In 2001, Malaysia’s Internet ­infrastructure was attacked by the Code Red worm. This was a classic example of infrastructure attack in which the worm spread very fast and brought our national ­communication network to a ­standstill.

It was reported that the relevant agencies took three months to ­eradicate this worm and the ­estimated minimum losses was RM22mil, not inclusive of the losses to the business fraternity and other sectors as well.

Other incidents of cyberattacks were caused by the Blaster and Naachi worms in 2003. The incident started with the propagation of the Blaster worm through the scanning of vulnerable machines via the network, followed by Naachi worms.

These worms exploited the vulnerability found in the Windows NT, 2000 and XP software. The ­estimated cost to eradicate this worm was about RM31mil, not including lost productivity and the cost of lost opportunity.

Modern warfare

Today, cyberspace is the new war frontier whenever there are conflicts between countries.

The popular method of a ­cyberattack is the defacement of websites. Web defacement is a malicious activity whereby a website is “vandalised.”

Often the hacker replaces the site’s content with a specific ­political or social message. The hacker may even erase all the contents from the site by relying on known security ­vulnerabilities to access the site’s content.

The US-China conflict in May 2001, which resulted from an ­incident where a Chinese fighter was lost at sea after colliding with a US naval reconnaissance plane, is a good example to illustrate this scenario.

End word

In conclusion, cyber-threats are the problems of today and the future. They need to be addressed in a comprehensive manner. In dealing with cyber-threats, a country cannot stand alone. There is a need to have strategic alliances to deal with threats and vulnerabilities in the cyberworld.

Co-ordination and collaboration from all parties is important in order to enhance the security of Malaysia’s cyberspace.

Posted in PC | Tagged: , , | Leave a Comment »

Solaris is Drowning?

Posted by megahacker136 on October 7, 2008

Linux is enjoying growth, with a contingent of devotees too large to be called a cult following at this point. Solaris, meanwhile, has thrived as a longstanding, primary Unix platform geared to enterprises. But with Linux the object of all the buzz in the industry, can Sun’s rival Solaris Unix OS hang on, or is it destined to be displaced by Linux altogether?

Solaris, he said, has almost no new deployments and is a legacy operating environment offered by a company with financial difficulties. Original equipment manufacturers also do not see a bright future for Solaris, he claims.

By contrast, Linux is the overwhelming choice for new deployments on x86 systems, Zemlin says.  Sun has had its strength in applications such as ERP systems with a seven- to 20-year life cycle, he adds. “What’s starting to happen is those life cycles are starting to be completed,” and those customers are moving to Linux.

That move to Linux is accelerated by Linux’s strength in Web applications, where developers today are focused, Zemlin adds. “You can’t really talk to any Web-based application company these days that’s not using Linux,” he says.

Linux also is less costly to run, Zemlin claims. Sun, he declared, should just move over to Linux. Zemlin also held out little hope for other IBM’s AIX and Hewlett-Packard’s HP-UX Unix platforms. “It’s certainly true that Unix is on the decline,” he says.

“Customers are pretty aware that Unix is a more expensive legacy architecture. They continue to support it because they don’t want to change their legacy apps over to a new platform because of the costs,” Zemlin said. “But they know now they eventually need to do it because Unix just doesn’t have the combined might of all the different organizations and individuals that are developing [for] Linux.”

Thanks to its strong support of the x86 hardware architecture, “in terms of overall volume, Linux is just a much higher volume product than Solaris ever was,” says Al Gillen, an IDC analyst. IDC data show that worldwide Linux shipments in 2006 were about 2.4 million in 2006 and nearly 2.7 million in 2007. By contrast, Solaris shipments totaled 376,000 in 2006 and 371,000 last year.

Solaris, Zemlin says, is losing market share because it does not have a good price performance or value proposition.

Zemlin also disputes Sun’s notion that Solaris technology gives it an edge over Linux. “The only people I hear talk about DTrace [Solaris’s technology for assessing program and OS behaviours] and ZFS [the Zettabyte File System] as competitive features [are] Sun Microsystems sales representatives. It’s not something I believe is impacting the market in any way,” he says.

That Solaris has some superior features is not really in question; Sun’s OS has received numerous accolades, including InfoWorld’s Technology of the Year award. But with capabilities such as ZFS and DTrace, Sun is trying to compete based on minor features, Zemlin says. “That’s literally like noticing the view from a third-story building as it burns to the ground.” And the Linux community is working on rival technology, Zemlin adds.

Given Sun’s own Linux support on its Sparc and x86 servers, Zemlin suggests that it should make ZFS and DTrace available under a Linux-compatible license. Sun instead uses its Common Development and Distribution License (CDDL), which is not compatible with the Linux GNU General Public License. (Sun says CDDL provides licensing support for a greater universe of systems than GPL does.)

One company that is moving from Solaris  to Linux is Sesame Workshop, famous for TV shows such as Sesame Street. A key reason is that more people are available to support Linux than Solaris, says Noah Broadwater, vice president of information services at Sesame Workshop. “I honestly have one person who is certified on Solaris. I have four people who are certified on Linux,” Broadwater said.

The other key issue with Solaris boils down to one word: cost. Sesame is saving about $20,000 a year in support costs by moving to Linux, Broadwater says.

One fear that Broadwater had in moving to Linux was degradation in performance, but he has been pleasantly surprised such degradation has not occurred. For example, the company’s IBM Cognos BI application runs faster on x86 Linux boxes than it did on Sparc Solaris, he says.

The case for Solaris’s existence
Sun stands behind Solaris. “For customers who’d chosen Linux in the past, we’re seeing some of those same customers come back to Solaris,” says Charlie Boyle, director of Solaris product marketing at Sun.

Solaris boasts features such as ZFS for simplified storage management and Solaris containers for virtualization, Boyle says. He cites a recent partnership in which Dell will make Solaris available on its computers; Dell would not do this if there was not customer demand. Sun is seeing brand new customers for Solaris; “I think we’ve got a great future,” Boyle says.

“I think Solaris is absolutely a great OS,” says Neil Wilson, a former Sun employee who later left the OpenDS project. Solaris is “absolutely far superior to Linux for the cases where the hardware support is there,” he adds.

Gracenote, which provides a media recognition and metadata service for MP3 users (the CDDB database familiar to iTunes users), agrees. “We found the threading model in Linux was problematic. You get to a certain number of concurrent threads and the OS just slows way down,” says Matthew Leeds, vice president of operations at Gracenote.  Solaris “just works for us.”

The debate over Solaris’s open source future
As part of its plans to give Solaris a longer life, Sun has developed an open source effort based on Solaris, called OpenSolaris, featuring a binary release of Solaris through Project Indiana.

The Linux Foundation’s Zemlin, though, dismisses Sun’s open-source Solaris as “too little, too late.” His foundation has also charged that there is no real open source community around OpenSolaris, arguing that Sun still controls development. To back up its point, the foundation points to blogs detailing disputes over control of OpenSolaris and the Sun-driven OpenDS directory projects, from February 2008 and November 2007. Sun declined to comment on the specifics of these issues and noted they both happened several months ago. Zemlin claims Open Solaris is no more than an attempt to expand the Solaris user base to drive customers to commercial Sun technology.

Sun’s Boyle acknowledges that Sun employees participate in OpenSolaris development, but says they do so along with individual and corporate contributors such as Intel. Community registrations in the OpenSolaris community exceed 160,000, far in excess of Sun’s total employee account of 34,000 people, he notes.

“I’d say we’ve got a great community around OpenSolaris.” Boyle said. “People are free to come and go as they want, and the community’s been growing every month,” he says. “To say that Sun is controlling all this, I don’t think is a fair and accurate statement.”

Source from InfoWorld.com

Posted in Open Source, Unix | Tagged: , , | Leave a Comment »