Abzetdin Adamov's IT Blog

IT is about doing more with less!

Archive for the ‘Programming and Development’ Category

Big Data Day Baku 2015 – or Big Day on Big Data

Posted by Abzetdin Adamov on April 21, 2015

Big Data Day Baku 2015 - CeDAWI - Center for Data Analytics and Web Insights  - Abzetdin Adamov

Big Data Day Baku 2015 – CeDAWI – Center for Data Analytics and Web Insights

The extremely fast grow of Internet Services, Web and Mobile Applications and advance of the related Pervasive, Ubiquity and Cloud Computing concepts have stumulated production of tremendous amounts of data partially available online (call metadata, texts, emails, social media updates, photos, videos, location, etc.). Even with the power of today’s modern computers it still big challenge for business and government organizations to manage, search, analyze, and visualize this vast amount of data as information. Data-Intensive computing which is intended to address this problems become quite intense during the last few years yielding strong results. Data intensive computing framework is a complex system which includes hardware, software, communications, and Distributed File System (DFS) architecture.

Just small part of this huge amount is structured (Databases, XML, logs) or semistructured (web pages, email), over 90% of this information is unstructured, what means data does not have predefined structure and model. Generally, unstructured data is useless unless applying data mining and analysis techniques. At the same time, just in case if you can process and understand your data, this data worth anything, otherwise it becomes useless.

Big Data Day Baku 2015 is the first Data-Centric event is planned to be held in Azerbaijan.
The events main goal is increase public awareness of new opportunities and challenges brought by Big Data, share experience with industry and government on the development of state-of-the-art Data Analysis technologies, attract youth to make career and do outstanding research in Data Science.

SOME OF TOPICS TO BE COVERED:

  • Big Data Era – How Big is Big Data?
  • Big Opportunities and Challenges brought by Big Data – Big Data Use Cases
  • Open Data for Public Sector Transformation and Innovation
  • Big Data Infrastructure
  • Open Source Platforms and Technologies for Big Data Analytics
  • Natural Language Processing and Computational Linguistic
  • Large-Scale Data Management Life Cycle

QUESTIONS TO BE ANSWERED:

  • – What is Big Data Value?
  • – How it will affect us all?
  • – Big Data Era, but are we ready for challenges?

EVENT TARGET AUDIENCE:
Marketing specialists, Business owners, IT Professionals, Students (Participation of the students is highly encouraged), Scientists and Researchers, Government representatives

EVENT WEBSITE: http://cedawi.org/big-data-day

Advertisements

Posted in Big Data Management and Analysis, CeDAWI - Center for Data Analytics and Web Insights, Meetings with Colleagues, Programming and Development, Web Programming and Design | Leave a Comment »

How to prevent robots (spambots) from automatically spamming up your WEB Form?

Posted by Abzetdin Adamov on January 12, 2012

randomized field names to prevent spambots to automatically submitting your form

Randomized field names to prevent spambots to automatically submitting your form

The Internet boom reinforces the security problems and unfortunately increases the number of unfair users that are using technology in improper way. At the same time the interactive nature of Web increases the number such opportunities. Actually, the main purpose of using spambots is to spread unsolicited information mainly for advertisement purposes.

So, how to prevent spambots from automatically submitting your WEB Form? It’s quite old problem and have several solutions:

1. Most common and effective way is the use of Captcha. Many people give up because they don’t want to type additional field or it’s too difficult to recognize symbols on Captcha.  Captcha is not always very good at keeping spam away because computer software already can recognize letters as well as humans do. Sometimes developers trying to make Captcha more complex for spambots, in fact make it harder to read just for humans (Example: low text-to-background contrast or bad color combination does nothing to stop computer, since in this sense computers have plenty of advantages over human).

2. Text-based logical Captcha is another methods, however its just slightly different approach to the same common image-based Captcha. The idea is that, web forms shows some instructions and human is expected to enter to input some data according to those instruction. For example, “If tomorrow is Monday, what day is today?”, or “Enter the third word of this sentence.”, etc.

3. Another way is to add to form additional input(s) and hide them through CSS (<input type=”text” name=”login” style=”display:none”>). After this application on server side should check if additional field has been filled out or not and accept form datas if field is empty and reject if not. The point here is that for spambot this field is just one of thers and will fill it in, on the other hand humans don’t see it at all so its going to be empty. Its obvious that this method is not effective against targeted attacks or if the form was examined by human to determine fields those have to be left unchanged.

4. And finally, proposed method of spambot prevention the idea of which is that, actually any spambot must know the names of inputs of the web form in order to spam repeatedly, in other words input names have to be constant. So, why don’t we specify input names randomly. In this way all input names will change randomly after each submission. Since, spambot can’t predict the filed names, the continues spamming will be complicated.

However, even this approach can’t prevent spamming totally. For example, in the case when spambot does not store field names and each time request web form content newly, this method will not help… Because, in this case spambot does not care about field names and just takes what is there…

PHP code to enable randomized field names and prevent some kind of spambots to automatically submit your form:


<html>
<head>
</head>
<body>
<?php
   session_start();

   if (isset($_SESSION['fld_name'])) {   // Check if appropriate form field has session declared for it...
      if (isset($_GET[$_SESSION['fld_name']])) {
         echo "<br>".$_GET[$_SESSION['fld_name']];
         echo "<br>".$_GET[$_SESSION['fld_sname']];
         echo "<br>".$_GET[$_SESSION['fld_email']];
      }
   }
   $_SESSION['fld_name'] = randName(5);   // Creates sessions for each field-input with random value (for example, string with length 5)
   $_SESSION['fld_sname'] = randName(5);
   $_SESSION['fld_email'] = randName(5);
?>

<!-- HTML Code of Web Form -->
<form>
<input type="text" name="<? echo $_SESSION['fld_name'];?>"><br>   // The name parameter of each input is assigned randomly
<input type="text" name="<? echo $_SESSION['fld_sname'];?>"><br>
<input type="text" name="<? echo $_SESSION['fld_email'];?>"><br>

<input type="submit" value="Submit">
</form>

<!-- Function to generate random string -->
<?php
   function randName($len) {
      $rnd = array_merge(range('a', 'z'));
      $out ='';
      for($i = 0; $i < $len; $i++) {
         $out .= $rnd[mt_rand(0, count($rnd)-1)];
      }
      return $out;
   }
?>

</body>
</html>

Posted in Programming and Development | 2 Comments »

Fully Customized Search Engine by Google Search Ajax API

Posted by Abzetdin Adamov on March 13, 2011

The information is most valuable wealth of humanity today. According to IDC Report we all are getting to be richer rapidly in this meaning. So that, according to this report (The Digital Universe Decade – Are You Rady? ) the amount of digital data worldwide (Digital Universe) will grow this year to 1.2 million petabytes or 1.2 zettabytes. Annual growth makes up more than 60%. By 2020 our Digital Universe will be 44 times as big as it was in 2009.
So, the ability to find appropriate piece of information within this tremendous amount structured and unstructured data getting to be more and more important. It’s why we all love Google so much! But Google is not self-centred (selfish), but rather Google makes his own technology opened for others to develop customized Search Engines, in particular (to be рonest this opennes is restricted, unfortunately).

I’m going to share with you my Fully Customized Search Engine developed by using Google Search Ajax API. If you have an idea how to improve it or you may want to share your mind, feel free to drop a comment.

HTML Code of Customized Search String Input within Container. Don’t forget to get your own Google Ajax API Key at http://code.google.com/apis/loader/signup.html
Download all in one: GSearchEngine.zip

Primary JavaScript Code based on Google Search Ajax API

//////////////////////////////////////////////////////////
// Abzetdin Adamov
// Fully Customized Search Engine by Google Search Ajax API
// JavaScript Code based on Google AJAX API
// Last modified 03/13/2011
//////////////////////////////////////////////////////////

var searchControl;
window.onload = onLoad;

function onLoad() {
searchControl = new GSearchControl();
//SMALL_RESULTSET, LARGE_RESULTSET
searchControl.setResultSetSize(google.search.Search.LARGE_RESULTSET);

//EXPAND_MODE_PARTIAL, EXPAND_MODE_OPEN, EXPAND_MODE_CLOSED
searchOptions = new google.search.SearcherOptions();
searchOptions.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN);

var webSrearch = new GwebSearch();
webSrearch.setUserDefinedLabel("myWeb");
searchControl.addSearcher(webSrearch, searchOptions);

var siteSearch = new GwebSearch();
siteSearch.setUserDefinedLabel("Adamov.net.ru");
siteSearch.setSiteRestriction("adamov.net.ru");
searchControl.addSearcher(siteSearch);

var blogsSrearch = new GblogSearch();
blogsSrearch.setUserDefinedLabel("myBlogs");
searchControl.addSearcher(blogsSrearch);

var imgSrearch = new GimageSearch();
imgSrearch.setUserDefinedLabel("myImages");
searchControl.addSearcher(imgSrearch);

var drawOptions = new GdrawOptions();
// DRAW_MODE_TABBED, DRAW_MODE_LINEAR
drawOptions.setDrawMode(GSearchControl.DRAW_MODE_TABBED);
drawOptions.setInput(document.getElementById('queryInput'));
searchControl.draw(document.getElementById("searchcontrol"), drawOptions);

inputBlur();
}
var query = null;
document.onkeydown = function(event) { kd(event); };

document.getElementById('queryInput').onfocus = function(event) { inputFocus(event); };
document.getElementById('queryInput').onblur = function(event) { inputBlur(event); };

var searched = false;
function kd(e) {
if (!e) e = event;
if (query == null)
query = document.getElementById('queryInput');
if (e.keyCode == 27) {
query.value = '';
searchControl.clearAllResults();
}
query.focus();
}

function inputFocus() {
var queryInput = document.getElementById('queryInput');
queryInput.style.color = "#555";
if (queryInput.value &amp;&amp; queryInput.value == "Введите строку для поиска в Adamov.net.ru") {
queryInput.value = "";
}
}

function inputBlur() {
var queryInput = document.getElementById('queryInput');
queryInput.style.color = "#bbb";
if (!queryInput.value) {
queryInput.value = "Введите строку для поиска в Adamov.net.ru";
}
}

Fully Customized Search Engine: DEMO
Download all in one: GSearchEngine.zip

Posted in Programming and Development, Web Programming and Design | Tagged: , , | Leave a Comment »

Simple and Small Captcha to Diminish the Vulnarability of your Website

Posted by Abzetdin Adamov on February 9, 2011

Simple and Small Captcha to Diminish the Vulnarability of your Website

Simplest and Smallest Captcha

The interactivity is most recent trend in Web Application Development. To attract more visitors to any Web project owner should offer more interactive services like subscription, voting/polls, forums, comments, … One cannot deny that such a interactivity where visitor can enter a data, increases the vulnerability of the web project. Your website may fall a victim of brute-force attack, automated data injection through your forms, SQL injection, … Easiest solution to avoid such problems is to use Captcha. Captcha helps to make sure that only humans perform certain actions with your website, protecting it from spam bots (software). It prevents abuser from injection of vast number records and spamming your system.
You can use one of Google solutions Recaptcha at http://www.google.com/recaptcha. But sometimes you can’t use this solution for some reasons:

  1. You may not want your server connect to any resources in Internet (as in my case)
  2. You may not want to use software of other party
  3. Google Recaptcha don’t offer the level of customization you need

Because of the similar reasons I’ve decided to develop my own captcha. As a result you can see following code of very simple and small, but at the same time enough robust and flexible Captcha. You can define any length for Captcha string as well as the type of string: numbers, chars or combination of numbers and chars. It can be easily used just by following to the short instructions.

Include this code just before proceeding the data you get from form. It verify the captcha image with value entered to cahtcha input (reg_captch).


<?php
session_start();
$captcha = $_POST["reg_captch"]; 
if (isset($captcha) && isset($_SESSION["captch"])){
	if ($captcha == $_SESSION["captch"]){
		// call appropriate function here or do nothing to continue to run the rest script
	} else {
		exit("Captcha error...");
	}
} else {
	exit("Captcha error...");
}
?>

Add the following HTML code into your Form (before Submit button may be the right place)

<input class=in_text type=text name=reg_captch id=reg_captch>
<img id="captch" src="captcha.php?rnd=&lt;?=rand();?&gt;" width="100" height=">
<!-- I'm using random values here to prevent image caching in browser, it's important for Firefox, Chrome, ... -->
<img style="cursor:pointer" src="images/refresh.png" alt="Refresh" onClick="javascript:document.getElementById('captch').src='captcha.php?' + Math.random();">

Here you can get main code of captcha (captcha.php), as well as zip file with captcha background image (security_background.gif) and text font to display captcha value (feel free to use your own …)

Main Code – captcha.php
Resource Files – resources

Posted in Programming and Development, Uncategorized, Web Programming and Design | Tagged: , , | Leave a Comment »

GTK2HS Installation under Windows and Haskell/GUI Programming with GTK2HS.

Posted by Abzetdin Adamov on December 11, 2010

Haskell WinGHCI Interface

Haskell WinGHCI Interface

Recently I tried to make necessary settings to do GUI programming in Haskell under Windows. It turned out, that it’s not so easy as may seem. There are a lot of contradictory tutorials on the Web. Even, official download address of GTK2HS (www.haskell.org/gtk2hs/download) annonced by many tutorials is not existing now. So the official instructions for building gtk2hs on Windows have out of date information and leave out some important issues, so here’s how I got it all working on Windows XP, I believe steps are same for Windows 7. Now step by step we will go though installation process:

  1. Haskell Platform
    Install latest release from http://hackage.haskell.org/platform/ (I installed version 2010.2.0.0 ) 

  2. GTK+
    Download the GTK+ all-in-one bundle 2.16 version (2.22 has some problems) all-in-one bundle from here http://www.gtk.org/download-windows.html
    Extract to folder you would like (for example d:\gtk)
    Add \bin (d:\gtk\bin) to PATH (environmental) variable.
    Run CMD and check command

    > pkg-config –cflags gtk+-2.0
    If you will get some paths instead of failure message, things are going well

  3. MinGW
    You don’t need to install MinGW separately, it already exists within your Haskell Platform. Only you should do – add MinGW \bin to to PATH (environmental) variable (I’ve installed Haskell Platform to D:\Haskell Platform\2010.2.0.0, so my path is D:\Haskell Platform\2010.2.0.0\mingw\bin).

  4. GTK2HS
    Now you should have everything you need to install gtk2hs from Hackage:

    cabal update
    cabal install gtk2hs-buildtools
    cabal install gtk

Depend on you Internet download speed, computer perfomance and releases of packages we talked above, each step will take some time. Whole process may vary from 20 to 40 minutes.

Congratulation! Now you can make sure that GTK2HS wors properly by running the following advanced “Hello World” code:

import Graphics.UI.Gtk

main :: IO ()
main =
    do initGUI
       win <- windowNew
       windowSetTitle win "Adamov's Example"
       win `onDestroy` mainQuit

       ent <- entryNew
       btn <- buttonNew

       col <- vBoxNew False 5
       containerAdd col ent
       containerAdd col btn

       buttonSetLabel btn "Click to Print"
       entrySetText ent "Hello World"

       btn `onClicked` do s <- entryGetText ent
                          print s

       containerAdd win col
       widgetShowAll win
       mainGUI
Haskell/GUI Programming with GTK2HS. Advanced "Hello World"

Haskell/GUI Programming with GTK2HS. Advanced "Hello World"

Posted in Programming and Development | Tagged: | 2 Comments »