• Home
  • About
  • Job Profile
  • Portfolio
  • Training
Blue Orange Green Pink Purple

RESTful API – The HTTPish …

Many newer application programmers are realizing the need to open their core functionality to a greater audience. Providing easy, unfettered access to your core API can help get your platform accepted, and allows for mashups and easy integration with other systems. → REST is the underlying architectural principle of the web and depends on HTTP […]

Read More 0 Comments   |   Posted by lazyboy
Aug 30

SUSE – another user-friendly desktop Linux distributions

SUSE is another user-friendly linux distributions which is also widely used in developer communities.

  • SUSE Linux is an opearating system, built on top of the open source linux kernel.
  • SUSE Linux is of German origin, basically an acronym of “Software und System-Entwicklung” (software and systems development)
  • Started in 1994, making SUSE one of the oldest existing commercial distributions.
  • It has consecutive acquiring history, Firstly bought by Novell in 2003, then in 2011, Novell and SUSE acquired by The Attachmate Group. Later, in October 2014, the entire Attachmate Group, including SUSE, was acquired by the British firm Micro Focus International.
  • Current SUSE Linux Enterprise release is 12.1 and openSUSE distributions version is 42.1
  • One of its useful feature is: YaST – the best tool any OS ever had.

openSUSE distribution is more popular among developers, check here : why you should use openSUSE

Use and love linux, stay safe at your work!

Read More 0 Comments   |   Posted by lazyboy
Aug 19

SEO meta techniques for a wordpress blog

SEO became the important part of websites. WordPress comes with the great concept of blog, CMS and with nice SEO support. Although I’m sharing here the some techniques for basic meta for different pages in wordpress to be handled in a common header section upon your page type, content. Here goes my thoughts…

Basically 3 most common part/page used in a wordpress blog/site, where we goes for visit are

single.php for single post
category.php for any type category/term
index.php for blog home/default template for other types

At first we have common meta tags which will be used if not a single post or category page requested. For category page, we taken category title as a meta keyword and titles of posts under the category as a meta description. For single post page, post title as as meta description and post tags are as meta keywords. Finally a common meta key/description for index/home or other requested page. Here goes the code snippet:

<?php
if(is_category()){
    $cat = get_query_var('cat');
    $cmeta_desc = '';
    $cposts = get_posts(array('numberposts' => -1, 'post_type' => 'post', 'category' => $cat));
    if($cposts){
        foreach ($cposts as $ck => $cp) {
            $cmeta_desc .= $cp->post_title.",";
        }
    }
    $cmeta_desc = rtrim($cmeta_desc, ",");
    ?>
    <meta name="description" content="<?php echo $cmeta_desc;?>">
    <meta name="keywords" content="<?php single_cat_title();?>">
<?php
} else if(is_single()) {
    $tags = '';
    $tag_list = wp_get_post_tags($post->ID);
    foreach ($tag_list as $tk => $tag) {
        $tags .= $tag->name.",";
    }
    $tags = rtrim($tags, ",");
?>
    <meta name="description" content="<?php echo $post->post_title;?>">
    <meta name="keywords" content="<?php echo $tags;?>">    
<?php
} else {
?>
    <meta name="description" content="PHP developer, tech savvy, tech blogger, freelancer">
    <meta name="keywords" content="php, mysql, wordpress, codeigniter, web developer, freelancer, web consultant">  
<?php
}
?>

Hope this will give you guys some idea as well as some help in wordpress.

Happy blogging!

Read More 0 Comments   |   Posted by lazyboy
Aug 19

Set favicon in cross browser and more…

We have seen most of the site has favicon which describe the additional information about the site , Addition in the scene it could be logo,company Profile, company production,web site application, and so many .

now how can u do this ? its very simple to do , just u need to add some line’s of code and be ready with small icon image, u can also add animated image in fevicon

add this part in between Section. Please try to use relative icon type like type=”image/ico” for .ico image.

<link rel="shortcut icon" type="image/ico"  href="images/favicon.ico">

now some time this code will not work on most of the Browser like IE old version in this case u can add this line

<link rel="shortcut icon" href="images/favicon.ico" type="image/vnd.microsoft.icon" *gt;

we can use this also for IE:

<!--[if IE]>
<link href="images/favicon.ico" type="image/x-icon" rel="shortcut icon" />
<![endif]-->

Finally ConvertICO can help to convert png image to ico image.

Standard size of favicon: 16×16 is the better size for favicon to show in major browsers. Here is a better read about creating a favicon and more : http://www.netmagazine.com/features/create-perfect-favicon

Hope this will help the beginners who just started their journey in web development.

Happy’s coding :)

Read More 0 Comments   |   Posted by lazyboy
Aug 19

WordPress custom URL rewrites and tips

WordPress has its own URL rewrite support for custom development. Before starting code, it would be good to visit its codex page here. Though there are many things to know and will take time to understand the whole process, i’m describing here a common scenario for rewriting a URL.

htaccess can be used to rewrite URL’s and good technical knowledge required for that to do that on server, at this point we can use wp rewrite to fullfill our need without editing site’s htaccess file.

Here goes the things: suppose we have a page for news listing like http://example.com/news, and we added a custom field in back-end to choose a news reporter. Now we want a page where news will be listed by reporter. we also need SEO friendly URL like this: http://example.com/news/reporter. In this case if we can take reporter slug from URL like \index.php?pagename=catalog&reporter=john’,we can the get reporter slug and can use for further query.

Normally all rewrite rules map to a file handler (almost always index.php), not another URL.

            add_filter('rewrite_rules_array','wp_insertMyRewriteRules');
            add_filter('query_vars','wp_insertMyRewriteQueryVars');

            // Adding a new rule
            function wp_insertMyRewriteRules($rules)
            {
                $newrules = array();
                $newrules['news/(.*)/?'] = 'index.php?pagename=news&reporter=$matches[1]';
                return $newrules + $rules;
            }

            // Adding the 'reporter' var so that WP recognizes it
            function wp_insertMyRewriteQueryVars($vars)
            {
                array_push($vars, 'reporter');
                return $vars;
            }

This would map news/whatever to the WordPress page ‘news’, and pass along the query var ‘reporter’. You could create a page template for ‘news’, then pick up the value of ‘reporter’ using getqueryvar(‘reporter’).

In above example, first we wrote the rules and added the function, then added function to get it by query var.

Tips:

1. Avoid using query vars like id - use something more unique (like 'reporter') to avoid clashes with WordPress.
2. Don't flush rules on every init! It's bad practice, and will write to .htaccess and call database updates on every page load!
3. WordPress will always flush permalinks whenever you update a post or your permalink structure (simply update your permalinks when you make changes to your code).

Will be back soon with another WP issue :)

Read More 0 Comments   |   Posted by lazyboy
Aug 19

Running videos with Flexsilder and issues to be pointed with iframe

Flexslider become one of the most popular jquery based slider for its lots of options, content based support and also for responsive. I’m gonna here to discuss some key points about running videos with Flexslider which needs to be pointed to avoid JS errors and for smoothness.

For vimeo video, we use froogaloop js file, there is a updated file for this, try to use updated one and always add this JS file at the end of the html file.

For youtube video in firefox browser, sometimes nav arrows don’t show and other css issues, try to use ‘wmode=transparent’ at the end of the iframe src.

Iframe should not be hidden at first by ‘display:none’, this can be in a case that we want a play button to be clicked on this and to play the video, and the iframe is hidden at first. so hidden iframe can cause error like ‘value not an object’ or so on.

Use ‘enablejsapi=1&verson=3′ to use it with youtube player API.

For youtube player API, always try to read first its document(https://developers.google.com/youtube/js_api_reference) and get idea as well as other issues.

To play a youtube video, the easiest and also the dirty! way is to add ‘autoplay=1′ at the end of the iframe src like below:

    $('videiID')[0].src += "&autoplay=1";

We can also use a simple function ‘callplayer()’ to control youtube iframe as shown here(http://jsfiddle.net/g6P5H/) or discussed here(http://stackoverflow.com/questions/7443578/youtube-iframe-api-how-do-i-control-a-iframe-player-thats-already-in-the-html) .

Some useful links about youtube and vimeo API with Flexslider : https://github.com/woothemes/FlexSlider/issues/346#issuecomment-13826530, http://daigo.org/2012/11/learning-flexslider-api

So, above points can reduce your hassle for JS erros or others.

Happy coding!

Read More 0 Comments   |   Posted by lazyboy
Jul 08

Javascript function parameter issue : Uncaught SyntaxError: Unexpected token = in Google Chrome

In Javascript, we often use functions for common tasks. Recently I have fallen in a problem where i have written a function to get ajax call which is common for some actions. That function has a parameter to get the URL which needed for ajax call. It was ok in Firefox, but in chrome, all other JS work stopped, due to the parameter error, that is ‘parameter default value’. Solution is, you can’t assign a default value to the function parameter. More explanation here: Function default parameter.

So we need to use below way for browser compatibility:

function get_ajax_fields(parameter){
        flds_request = jQuery.ajax({
            url: baseURL+"dataimport/"+parameter,
            dataType: "json"
        });
        return flds_request;
}

We can't use like this: parameter=''

Hope the issue can save your time! Enjoy!!
Read More 0 Comments   |   Posted by lazyboy
Apr 22

Agile Methodology, an analysis to its title

Agile Methodology:

  • an approach to project management
  • it works at iterative, incremental way
  • its also known as ‘inspect-and-adapt’ approach with ‘analysis-paralysis’ way.

Agile Software Development is a group of software development method including most used popular SCRUM with the tool ScrumWorks Pro.

The main concept behind it:

Agile methods break tasks into small increments with minimal planning and do not directly involve long-term planning. Iterations are short time frames (timeboxes) that typically last from one to four weeks. Each iteration involves a cross functional team working in all functions: planning, requirements analysis, design, coding, unit testing, and acceptance testing. At the end of the iteration a working product is demonstrated to stakeholders. This minimizes overall risk and allows the project to adapt to changes quickly. An iteration might not add enough functionality to warrant a market release, but the goal is to have an available release (with minimal bugs) at the end of each iteration. Multiple iterations might be required to release a product or new features.

Team size is typically small (5-9 people) to simplify team communication and team collaboration.No matter what development disciplines are required, each agile team will contain a customer representative. This person is appointed by stakeholders to act on their behalf

And the meeting for these teams, sometimes referred as daily stand-ups or daily scrum meetings, are held in at the same place and same time every day and should last no more than 15 minutes. Standing up usually enforces that rule.”

There is a common debate between old Waterfall and Agile method. Now the question is why agile and why not waterfall?

Waterfall method tell us for a sequential workflow. like making requirements, design, coding, testing and so on, that is one by one.
But the problem here is : at the end of a project, a team might have built the software it was asked to build, but, in the time it took to create, business realities have changed so dramatically that the product is irrelevant. In that scenario, a company has spent time and money to create software that no one wants. Couldn’t it have been possible to ensure the end product would still be relevant before it was actually finished?

Yes, it can be done by agile way, an iterative, incremental system where a group of teams finish their assigned work by their team meeting, collaborating with client within a short time frame and finally done with a successful software which make sense.

Well-known agile software development methods include:

  • Agile Modeling
  • Agile Unified Process (AUP)
  • Crystal Clear
  • Extreme Programming (XP)
  • Kanban (development)
  • Scrum

Today, up to this, happy agiling, be right back with SCRUM soon :)

Read More 0 Comments   |   Posted by lazyboy
Jun 12

Usefull function for custom post type in wordpress and more

I’m gonna share someuseful function here which is really handy for custom post type. Some guys really don’t know about those functions, as i got those useful after digging some solutions for real life problem.

1. is_post_type_archive(‘POST-TYPE-NAME’), this is needed when you are checking something for post type archive/listing page like in common header/footer. we frequently use for add some js/css or some class in common places.

2. get_query_var(‘var_name’), we frequently use this to get category name, its retrieve corresponding value of given variable name. I have got this most useful when i need the slug/post_name of a post of any post type. For the last couple of month, i used below code to get last/second segment of URL of a post :

$subpath = $_SERVER['REQUEST_URI'];
$tokens = explode('/', $subpath);
$scn_seg = $tokens[sizeof($tokens)-3];

But that was the extra effort to get URL segment for a post, we can do it by get_query_var(), we need to pass post type name as a parameter to this function like for ‘news’ post type we will use get_query_var(‘news’).

$news_post_slug = get_query_var('news');

So for the URL : http://example.com/news/lorem-ipsum-dolor/, we can get the post slug(post_name used in DB) by get_query_var(‘news’).

3. wp_deregister_script() sometimes we use plugins for some extra facilities like custom post type/twitter feed, plugins use wp_head() to inject its necessary js/css or others function to hook, same as for wp_footer(). wp_deregister_script() is needed when we use our own js like jquery library. So there will be 2 jquery file when using own with wp’s native 1. and sometimes for new bee, its hard to find out why js error occurred and js functions are not working …. wp_head() renders some others links also. to avoid this type of situation, we need to remove that, we can use just wp_deregister_script('jquery'); in theme’s functions.php file.

This is useful to give a condition for admin section like below, otherwise admin panel’s may create problem:

if( !is_admin()){
   wp_deregister_script('jquery');
}

Its also better to add your own library just after de-register wp’s native jquery like below :

if( !is_admin()){
	wp_deregister_script('jquery');
	wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"), false, '1.3.2');
	wp_enqueue_script('jquery');
}

Finally its handy to remove the jQuery from your wordPress font-end/theme files, add wp_deregister_script(‘jquery’) just before wp_head() on your theme’s header.php file like below.

wp_deregister_script('jquery');
wp_head();

Will add some other WP function soon which we need frequently in development.

 

Read More 0 Comments   |   Posted by lazyboy
Apr 23

On page SEO tips – must follow list!

You own a online shop or have a business, you want more customer, more interaction, so SEO takes part here to be more reachable you to your audience. Now a days, without SEO, we can’t think a website. I have listed here some vital points about SEO, which you can digg more and try to apply.

Here goes the basic tips of SEO:

  • king content, be sure to have unique, well written, useful content with the relevant keywords
  • build quality back-links with your keywords/phrases
  • need fresh, new, updated content always
  • be sure to link texts with the relavant name like ‘html tags’ with the text ‘html tags’, not just ‘click here’
  • keyword/text with location name like our main branch can be ‘our main branch in Dhaka’
  • Always use appropriate keyword/phrase in text/links/image ‘alt’ tag
  • ‘Spiders can crawl text, not Flash or images’, so whenever you design website think about SEO issues also.
  • Links from .edu domains are given nice weight by the search engines. search for possible non-profit .edu sites that are looking for sponsors
  • Use RSS feed with proper title and description.
  • Use the words “image” or “picture” in your photo ALT descriptions and captions. lot of searches are for a keyword plus one of those words.
  • Check server headers. Search for “check server header” to find free online tools for this. You want to be sure your URLs report a “200 OK” status or “301 Moved Permanently ” for redirects. If the status shows anything else, check to be sure your URLs are set up properly and used consistently throughout your site.

More list is coming soon………

Read More 1 Comment   |   Posted by lazyboy
Apr 23

Show user login form in sidebar/template in wordpress

Recently, i was looking for a solution to show a simple user login form in site sidebar, googled but it referred for using plugin like sidebar-login. Suddenly i got wordpress have already its native function to use for login form.

wp_login_form() allows to add the form in any place you wish. some parameters exist there to control the form attributes. i can just put your attention to the following :

  • ‘redirect‘ — where to redirect after login
  • ‘remember‘ — whether to remember the values.

Let us see an example:

if (is_user_logged_in()) {
   echo 'Hello, ', $user_login, '. <a href="', wp_logout_url(), '" title="Logout">Logout</a>';
} else {
   wp_login_form();
}

here, we just checked for logged in user to show different message.
If you want you can customize the look of the form by defining extra css putting it within a div as following screen.
login
So instead of using a plugin with extra feature,using native function is as easy as better!

Read More 1 Comment   |   Posted by lazyboy
Previous Page 1 of 3

Saif The Green

  • View Saif's profile on LinkedIn
  • Recent Posts
    • RESTful API – The HTTPish …
    • SUSE – another user-friendly desktop Linux distributions
    • SEO meta techniques for a wordpress blog
    • Set favicon in cross browser and more…
    • WordPress custom URL rewrites and tips
  • Archives
    • October 2016
    • August 2016
    • August 2014
    • July 2014
    • April 2014
    • June 2013
    • April 2013
    • March 2013
  • Categories
    • CodeIgniter
    • Javascript
    • Linux
    • MySQL
    • opencart
    • php
    • SEO
    • Software Development
    • Web Development
    • Web Services
    • Wordpress
  • Meta
    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
  • Archives
    • October 2016
    • August 2016
    • August 2014
    • July 2014
    • April 2014
    • June 2013
    • April 2013
    • March 2013
  • Search







Saif The Green is proudly powered by WordPress
Entries (RSS) and Comments (RSS).