Sunday, November 3, 2013

Count-Min Sketch Data Structure

Data structure is the core of any software program. Without an appropriate data structure, any algorithm might suffer in accessing stored data and optimizing the running time. For example, the following tasks that need to build for a best timing in a data set:
  • To estimates frequencies of particular elements
  • To finds top-K most frequent elements
  • To performs a range of queries
  • To make a percentiles estimation. 
As we can see, they are all related to a frequency or a range of queries in a data set. So, one of the structures sets up to get the best optimization for the tasks above is Count-Min Sketch, a method estimates frequency-related properties of a data set.

What is Count-Min Sketch Data Structure?
Count-Min Sketch is one of members in the family of memory efficient data structures to optimize the counting of the rate of an element in its lifetime.

Problem statement:
We have a set of duplicated values, and the issues is to estimate the frequency for each value. The estimation for relatively rare values can be imprecise, however, frequent values and their absolute frequencies should be determined accurately.

The basic idea of Count-Min Sketch:
As similar to Linear Counting, Count-Min sketch is designed as:
  • A 2-D array (d x w) of integer counters.
  • When a value is set, it is mapped to one position at each of d rows using d difference and an independent hash code.
  • Counters on each position will increase for the next arriving values.
  • Algorithm estimates the frequency of given value as a minimum of the corresponding counters in each row.



Below is an animation for Count-Min sketch data structure:


Below is a practical implementation of Count-Min sketch:
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
class CountMinSketch {
    long estimators[][] = new long[d][w]   // d and w are design parameters
    long a[] = new long[d]
    long b[] = new long[d]
    long p      // hashing parameter, a prime number. For example 2^31-1

    void initialize() {
        for(i = 0; i < d; i++) {
            a[i] = random(p)    // random in range 1..p
            b[i] = random(p)
        }
    }

    void add(value) {
        for(i = 0; i < d; i++)
            estimators[i][ hash(value, i) ]++
    }

    long estimate(value) {
        long minimum = MAX_VALUE
        for(i = 0; i < d; i++)
            minimum = min(
                minimum,
                estimators[i][ hash(value, i) ]
            )
        return minimum
    }

    hash(value, i) {
        return ((a[i] * value + b[i]) mod p) mod w
    }
}

Accuracy

Accuracy of the Count-Min sketch depends on the ratio between the sketch size and the total number inserting values (not duplicated values). This means that Count-Min technique provides significant memory gains only for skew values, for example, the values have very different probabilities.


It is clear that Count-Min sketch can't track frequencies of 5900 elements using only 152 counters, in the case of low skewed values with high frequencies, so the histogram will be very inaccurate.

In general, the applicability of Count-Min sketches is not a straightforward question that can be recommended in the real life of experimental evaluation, but it can be use for some particular cases. However, the theory of Count-Min sketch is a base for accuracy on skewed data and measurements on a real data set.


References:
1. Count-Min Sketch
http://en.wikipedia.org/wiki/Count–min_sketch

2. Streaming Algorithms and Sketches
http://blog.aggregateknowledge.com/tag/count-min-sketch/

3. Count-min sketch & its applications
https://sites.google.com/site/countminsketch/


Sunday, October 27, 2013

Google Hacking

Google is a very important tool for all people nowadays. For business, it helps to improve profit for business owner by paying Google an amount of money in order to get in the top results of a search query. For school, there is no argument that Google will be the best tool for studying, researching, gathering information and so on. However, Google is also a very powerful tool for hackers to seek vulnerabilities of a system.

In this article, I would like to discuss about Google Hacking.

WHAT IS GOOGLE HACKING?
Google Hacking is the term used when a hacker tries to seek vulnerabilities of a system and its sensitive data by using Google search engines. In Google search engine, the queries that help to filter the results (sensitive data) from a search line store in Google Hacking Database. Although Google blocks some of their famous hacking queries, hacker is still able to attack a website by launching the Google Hacking Database queries.

Google Hacking Database is able to identify these below information:
  • Advisories and server vulnerabilities
  • Error messages that contain too much information
  • Files that contain unencrypted passwords
  • Sensitive directories which should never show to outsider
  • Pages that contain login portals

WHAT ARE COMMON KEYWORDS IN A GOOGLE SEARCH QUERY?

allintext - occurrences of all the keywords given
intext - occurrences of keywords all at once or one at a time



inurl - a URL matching one of the keywords
allinurl - a URL matching all the keywords in the queryi
intitle - occurrences of keywords in URL
allintitle - occurrences of keywords all at a time
site - a particular site and lists all the results for that site
filetype - a particular filetype in the query
link - external links to pages
numrange - specific numbers in your searches
daterange - a particular date range



Some Sample Simple Google Search Queries: 

intext:@gmail.com filetype:xls

Spammer can use Google to troll email addresses across the Internet.  A huge list of emails is that they need in succeeding their goals.



inurl:group_concat(username, filetype:php intext:admin


As above, hackers are able to hack some of the SQL injection results that other users made on the sites. Unfortunately, username and password combinations are still in a search result.

After that the md5 hash might be easily cracked by using any simple tool. The combination is bcheramy : 130270


HOW TO PREVENT GOOGLE HACKING ATTACKS?
First, we should verify the pages that identified by Google hacking queries. If pages provide information that could not be found on the website, we should remove such pages from the site. However, if site requires these pages, we should re-arrange them and their wording so that they are not indexed and detected by Google hacking queries.


References:

1. Google Hacking:
http://www.acunetix.com/websitesecurity/google-hacking/

2. Google Hacking Database (GHDB)
http://www.hackersforcharity.org/ghdb/


Wednesday, October 9, 2013

Open-Source Software Is Our Future

Nowadays, open-source software and code are everywhere, especially in an open project that we can find easily in the Internet like SourceForge or Google Code. The term “new frontiers” of programming does not apply for today anymore. Most of the best algorithms that need for coding have already been written. Spending time to rewrite a code or algorithm that it has been done is a waste of time since they are given free as open-source. In addition, some programmers have generously donated their code for free to help improve on a specific project.

So, open-source seems to be a good point we should do. In my opinion, however, before you use an open-source software, I want to discuss about how open-source will be our future.


1. Stability - Is open-source software stable?

Stability is really important for any software program, and there should be no argument about that. The community is a base of any open-source software. A good open-source community should have hard-working developers, and users support infrastructure. Most communities offer such things like: 


Open source middleware
Closed circle of open-source industry
  • releases that are recent enough to be useful
  • up to date and helpful documentation 
  • a helpful and active mailing list 
  • automated tests 
  • well maintained change notes 
  • well managed issue tracker 
  • well managed version control system  

As a result, the community is the stability of any open-source software. Unlike commercial software, the open-source one gets updated quickly when a bug or a security hole is found. Yet the size of an open-source community will be reflex its stability.




2. Support -  Can I get the help I need?

Some people say that they couldn’t reach any support when they need because there are no free toll numbers and support teams. It seems to be right since open-source software doesn’t have direct support. Again, open-source is all about its community. In fact, it can be a lot easier to get the help you need through the vast community of open-source users. I suggest that you should register to any supported forum, then ask questions, and get the help you need almost right away.

3. Cost - What's it going to cost me?


Unlike any commercial software with the same features and functionality, the open-source software is usually free. In some complex open-source software system, users will need supported for implementation with a fee such as RedHat Linux, CMS system. However, it is way cheaper when comparing to the commercial one.
Low cost open source
Low cost open-source vs. commercial software

4. Flexibility - Can I move it, change it, or tweak it?

The beauty of the open-source program is its ability to become exactly what you want it to be. For example, we can easily see what difference between android and iOS. People are changing to android more and more because iOS doesn’t give to its users the ability to customize the system. People like android because of its flexibility and customization. As a result, open-source software frees users from the grip of being out dated.

5.
Security - Will my stored data be safe?


First, I will say that the “open” term in open-source is to only refer to the source code itself, not the data stored in the system. Because of the constant update, open-source seems to be safer. If an open-source system is well implemented and followed correctly security procedures, your data in the system will be just fine. There is no difference between an open-source and commercial program from being attacked by hackers. The rate is same for both.

Open source is wildly used
Open Source Wildly Used


Because of all advantages above, I will say “YES” to open-source because it benefits for the community in many ways. In short, open-source will be the best choice for small business or a start-up company with short budget. However, users must stay in the community to get the support when they need.


  
References:

1. Good or Bad? The Verdict on Open Source CMS
http://www.cmscritic.com/good-or-bad-the-verdict-on-open-source-cms/

2. Balancing stability and innovation in open source
http://blog.startifact.com/posts/older/balancing-stability-and-innovation-in-open-source.html


Sunday, October 6, 2013

Agile and 3 most important portions of the agile process

While agile is a general philosophy regarding software production, scrum is an implementation of that philosophy pertaining specifically to project management. So agile scrum defines a set of recommendations that the whole team should follow. There are 3 main portions in the agile process that we need to concentrate on when applying agile into project management in real life.

1. The scrum master is no. 1 role in an agile process.

Besides the product owner who is responsible for defining the users' stories, and maintaining the whole product backlog, scrum master is the most important roles in the agile process. This person has to be a bridge of communication between the product owner and the rest of the implementation team.

Scrum master
Scrum Master is most important in an Agile process

Because of the important role, scrum master should be a person who possesses a strong technical knowledge with good communication skills, and proactively participates in all development processes. In short, it is a hard role that requires many skills. In addition, any modification about users' stories and product backlog from the product owner must be completed through the scrum master.









2. Planning board is the backbone of an agile process.

Currently, the planning board now accommodates the Lean Development Process that we use in agile today. The benefit of the planning board is to help adapting any changes throughout the process.

There are four main columns must be present in the board:

The Planning Table
  • Release backlog – it shows all the current release after each sprint or all what we have archived.
  • Sprint backlog – in each sprint, it shows what product owner wants to be done. Any undone from previous sprint will keep showing in the sprint backlog, and yet moving to the release backlog when they are done.
  • Working on – work divided mostly is listed here for teamwork control. The whole team will know what they and other members are working on.
  • Done – all completed stories will be here. However, all bugs and changes from the sprint backlog also need to list here.

3. Continuous Improvement Model helps push up performance.

After a few sprints, the scrum master needs to gather the whole team to discuss any good and bad things has happened in the team. This is very important to improve the team performance. At first, it might not be comfortable to talk about what really go wrong in the team, yet it will give big awareness for the whole process. In retrospectives meeting, all team members need to give their open opinions about what are happening in the team.

Improving Circle

  • Bad things – like fighting between team members, not collaborating in pair work, or spending too much time on minor things. Solutions to these problems should be given immediately to help avoiding  them in the future.
  • Good things – like finishing on time, giving the best suggestions and ideas. It is also important to list all the good things because it encourages the team to do it more and more.







The adaption of the agile process may be different for each time and each team. However, we can embrace the whole process by concentrating on 3 important portions of the process above. We should never follow blindly the rules because adaption to the changes is more important.


References:
1. SCRUM: The Story of an Agile Team
http://net.tutsplus.com/articles/editorials/scrum-the-story-of-an-agile-team/

2. Agile Development
http://www.versionone.com/agile101/agile_development.asp


Friday, September 20, 2013

LinkedIn and Branding: Build Your Personal Brand 101


It is no doubt that personal brand is very important to job seekers. One of the most effective ways to sell YOU to potential employees is to build an impressive online personal brand on a social network. However, each social media tool has different targets; for example, Facebook may be great for graduate students, and Twitter is good for media recruitment. In contrast, LinkedIn generally is the best choice for anyone who is searching for a job. Currently, most recruiters and HR departments are searching their candidates through 225 million LinkedIn accounts.


LinkedIn Logo 
“LinkedIn is not just a virtual resume that should be tucked away for a rainy day. Instead, it acts as a resume, cover letter, references document, database of your contacts throughout your life and a place where you can learn, share and interact in a professional manner.”




Following are 2 very first steps to build an impressive brand on LinkedIn.

1. BRAND YOUR PROFILE

Let think that LinkedIn is an incredible asset to your entire career, so we have to make it perfectly errors free. The more you keep your LinkedIn profile professional, the more you can sell YOU to all people in the network. A professional profile is likely to attract all potential employees.

Below are some important things to brand a profile:
  • Custom URL: A "http://linkedin.com/in/yourfullname” is an easy way to find you in the network.
  • Picture: Your picture should be professional to reflect your brand. In fact, you get 30% more clicks if your file has a picture.
  • Headline: It should display your desired job or the last job.
  • Summary: A brief summary, which is about your work experiences, unique abilities, awards and career aspirations is most important in the profile
  • Keywords: It is good to add as much as you can to get found easily.
  • Applications: You put your blog here because it is good if people know more about you.
  • Recommendations: Significant recommendations that are from people in your trusted the network is a plus for the profile.

2. DEVELOP YOUR NETWORK

Your career opportunities depend on how big your professional trusted network. Because LinkedIn is a network of people, any contact you add will help you link to their contacts. So, you should add all your friends as contacts in order to link to their contacts.

Below are things you should do to develop your network:
  • Be open and available: It helps on accepting the contact requests.
  • Leave an email address: It is the only way to communicate with other friends.
  • Promote your URL: You should let people know your works, experiences, or even your thoughts, feelings and emotions.

As long as you keep your LinkedIn profile updated, you will have a great chance to get hired.


References:

1. How To Build Your Personal Brand on LinkedIn [21 Useful Tips] 
http://theundercoverrecruiter.com/how-build-your-personal-brand-linkedin-21-useful-tips/

2. HOW TO: Build Your Personal Brand on LinkedIn 
http://mashable.com/2009/07/27/linkedin-personal-brand/


Friday, September 13, 2013

QR Codes and 2 Common Issues of Security Risks


Generally, all we know about QR codes are encoded messages that contain information such as URL, phone number, text, or even a Wi-Fi access password. This information can be used to market a business or to provide further information about the company’s products and services. A tool such as QR codes scanner, or a smartphone QR codes scanner application can easily decode it. However, scammers might use these QR codes to redirect users to websites, which may contain viruses or malwares, via malicious links. From here, incautious users may become cyber-attack victims when scanning untrusted QR codes.

In this post, I will discuss about 2 common issues of security risks and solutions to avoid when using QR codes.
1. Shortened URL in QR code is really dangerous:
SHORTENED URLS COULD BE MALICIOUS LINKS. Currently, most URLs in QR codes are decoded as shortened URL version because it is easier to save a short, simple URL than a long, complex one. For instance, tinyrul.com, bit.ly and goo.gl are some URL shortening services to help convert any long, complex URL to a shortened version.
For example:

Quang Pham blog's QR code

This is my full blog address: http://quangpham-cs100w.blogspot.com,
and its shortened URL is http://goo.gl/1JtEKN  




Scammers site's QR code



 

A website's link that may contain viruses or malwares: http://scammers.com,
and its shortened URL is
http://goo.gl/qEKd6Y





Are you able to see if the two shortened URLs above lead us to trusted websites? When we click to those shortened URLs to get access to webpages, we cannot know if the sites are viruses or malwares free or not. Are there any solutions for this problem?

YES! WE SHOULD PREVIEW THE SHORTENED URLS BEFORE USING THEM. Several website tools help us to get a full URL address from the shortened URL. In addition, some URL shortening services, such as goo.gl, give us an option to preview the shortened URL first by add a “+” at the end of the URL. 
As I type in “http://goo.gl/qEKd6Y+”, the preview page will show full address “http://scammers.com” in order to let us know if it is a trusted destination.


2. Scanning randomly malicious QR codes is an easy way to get attacked from scammers:
STAY AWAY FROM MALICIOUS QR CODES! Scanning QR codes in the form of stickers placed randomly on the street's walls is most dangerous. It is a very common way that scammers use to get people scan the code just because of curiosity. Reports say, “46% just said they were curious what this odd little jumbled cube could do.” So, we should not scan any QR codes that are not from trusted sources. 
Malicious QR Codes everywhere on the street.
A malicious QR code on the street.

LOOK CLOSELY TO A QR CODE BEFORE DO ANYTHING ELSE! Another way to avoid getting hacked is to know if QR codes are legit codes or under a form of adhered stickers over other ones. Most trusted companies will market their products and services by publishing their posters in public areas. Usually, all QR codes are printed directly on these posters. However, scammers may produce malicious QR codes as stickers and adhere them onto legitimate ones.

QR Codes Sticker can be use to adhere on original one
QR Codes Sticker can be use to adhere on original one

There is no double that QR codes are on the upswing. In a near future, we may start to see more intuitive ways of deceiving people via QR codes. However, the two essential issues above are most common ways to attack users when incautiously scanning QR codes. So, everyone should be careful with those little black-and-white squares.

References:  


Friday, September 6, 2013

Social networking and the lack of when promoting a company brand


Currently, in the Web 2.0, most of the social networking sites increase their services to attract people to stop by every day. For example, Facebook, Goolge Plus, Twitter, YouTube and Linkedln are the top social networking sites that help connecting people to people, finding jobs or even promoting a start-up business. Users can benefit from these powerful online tools a lot if they know how to use them correctly for their specific purposes. However, safety is always a first concern to everyone when using social media tools to expose themselves to the public.

Top media social networking site
Top famous sites of social media networking

Nowadays, most of the organizations use social media to promote their brands, create a positive image of the companies, advertise their new products, and connect directly to their consumer.  In comparing to traditional ways, it is cheap and more effective just by maintaining their presence on most famous social media sites. In this post, I will discuss the lack of when promoting a brand in social media.

1. Maintaining a good company reputation is most important in social networking.

Most companies build their social media site as a customer base to communicate with consumers, to provide feedback to improve their products. However, potential risk is lacked of communication policy. For example, most of the big companies have a Facebook page with a long list “friended” of their employees in the account. Assuming one of these employees' comments on the site that is inaccurate and unrepresentative information could damage the company image. The inappropriate activities of employees at the company social media sites are bad to company reputation. As a best solution to this problem is a proper training to all employees who may say or represent as company’s voice in the social media website.

A whopping 74% of your employees agree that their social media antics could damage your company’s reputation
A whopping 74% of your employees agree that their social media antics 
could damage your company’s reputation



2. Social engineering training must be good enough to avoid security threads.

For hackers, the best way to attack a company is to through its employees. For instance, any follower of a company Facebook's site can post a giveaway product, which is under a survey link to the site. The post may attract the site’s viewer, including company’s employees. When these employees click to the survey link, they may be asked for employee ID, username and password to join the reward program. From here, these input data could provide information to hack the company network. Although this kind of Internet scam is not effective like before, there is still a lot success cases in this type of hacking. So, managing best social engineering is the must for all companies nowadays.

New Apple ID Phishing Effort

Over 300 sites compromised by New Apple ID Phishing Effort by using host fake login pages, which are linked to in emails sent out in an attempt to trick unsuspecting Apple users.

 
3. Carefulness in protecting intellectual property and confidentiality is important.

When building a company social media page like Facebook and LinkedIn, the communication to competitive companies within the community cannot be avoided. The exposed data such as marketing strategies, rate of sales, new products could be a big thread for company future. To protect the confidential data from other competitors, the policy of data protection should be given clearly to employees who may recklessly share to the outside world.

The New Apple ID Phishing Effort
The NetWitness/Ponemon survey reveals that 44% of corporate intrusions
result in the loss of “confidential or sensitive information,” while 45% of
attacks lead to “theft of intellectual property.”

 
The growth of brand marketing in social media networking is non-stop nowadays. Thus, many organizations are reluctant to adopt this kind of marketing without proper protection. The most important goals are to detect the weaknesses of social engineering, policy in protection of intellectual property and confidentiality. At the end, the company's reputation is the most valuable property to a company.

For more information, you can look at some valuable link about this topic: