Latest Entries »


Note:

-----------------------------------------

1. Just a quick plugin development, to fix my work. You may extend it use it distribute it and what ever....................

Objective of the post

--------------------------------------

1. Basic Plugin development

2. implementing css3 round image style

-------------------------------------------------

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>

// plugin start from here

// this hooks a new function to jquery [ $.fn.circle_me = function ]

/*

plugin name : circle_me

author : Jumper

email : neerooze@gmail.com

*/
$.fn.circle_me = function(options) {
console.log('Init circle me');

// default styles

var _style = {
             border: '1px solid #DDD',
             borderRadius: '50%',
             display: 'inline-block',
             height:"200px",
             width:"200px"
};
// over ridding the default style with users style
_style = $.extend( _style, options);

/*
Here   "  return "  is so important if you want to add changeable function.

eg:         $(".circle_now").circle_me().hide();

if you do not add return, here hide function will not work but still plugin will work  fine. If you do not want to add chain function you may ignore return function.

*/
return $(this).each(function(){
              $(this).css(_style);
              var _bg = $(this).attr('src');
              $(this).css({"backgroundImage":_bg});
        });

}

// plugin ends here
$(document).ready(function(){

     // initializing plugin basic

     $('.circle').circle_me();

    // initializing plugin with custom options

     $('.circle').circle_me( {  height: "300px", width: "400px", borderRadius:" 70%"});
});
</script>

// html part

<img class="circle"  src="https://fbcdn-sphotos-a-a.akamaihd.net/hphotos-ak-ash3/67563_10151525052674927_2120163905_n.jpg" />

Cheers…..


function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();

reader.onload = function (e) {
$(‘#blah’).attr(‘src’, e.target.result);
}

reader.readAsDataURL(input.files[0]);
}
}

http://stackoverflow.com/questions/4459379/preview-an-image-before-it-is-uploaded


var storage= {
  setItem: function(key, val) {
   if (!val) { val  = null; return;}
 if (typeof val == "object") {
 val = JSON.stringify(val); // type casting object into string
 }
 localStorage.setItem(key, val);
 },
 getItem: function(key) {
 var val = localStorage.getItem(key);

 if (!val) {return;}

 // parsing stringified object back to object
 len = val.length;
 if (val[0] == "{" && val[len-1] == "}") {
 val = JSON.parse(val);
 }

 return val;
 }
}

// TESTING IN CONSOLE.

storage.setItem("ID",{name:"Jumper"});
var id = storage.getItem("ID");
console.log("name : "+id.name);



Overriding Page Templates per Content Type in Drupal 7

As we know drupal have few  template files: html.tpl.php, page.tpl.php and node.tpl.php. There are few more which controlling the display of more specific elements . For overrriding other templates you may search more now let me show you how to override the page tempates per content type.

We can implement it by adding additional tempalte suggestions to the “theme_hook_suggestions” array in template.php

  1. Open the template.php file in your theme for editing.
  2. Look for a function called yourthemename_preprocess_page (replace the yourthemename with your theme’s name).
  3. If this function already exists, you will need to add the if statement to the end of the function just before the closing bracket. Otherwise you’ll need to create a new function to look like this:

function yourthemename_preprocess_page(&$vars) {
  if (isset($vars['node']->type)) {
    $vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type;
  }
}

Now you can create a template file called page–content-type.tpl.php and all nodes with that type will use the new template file.

Filename Notes:

  • Use two dashes after the word ‘page’ in the filename.
  • If your content type is two or more words, replace the underscore ( _ ) with a short dash ( – ) in the content type machine name.

express-checkout-recurring-payments


installing drupal 7 in ubuntu 12.10


while installing drupal in my machine i faced some unexpected permission problem something like below:

OK
Web server Apache/2.4.3 (Unix) OpenSSL/1.0.1c PHP/5.4.7
OK
PHP 5.4.7
OK
PHP register globals Disabled
OK
PHP extensions Enabled
OK
Database support Enabled
OK
PHP memory limit 128M
Error
File system
The directory sites/default/files is not writable. An automated attempt to create this directory failed, possibly due to a permissions problem. To proceed with the installation, either create the directory and modify its permissions manually or ensure that the installer has the permissions to create it automatically. For more information, see INSTALL.txt or the online handbook.
OK
Unicode library PHP Mbstring Extension
OK
Settings file The ./sites/default/settings.php file exists.
Error
Settings file The settings file is not writable.
The Drupal installer requires write permissions to ./sites/default/settings.php during the installation process. If you are unsure how to grant file permissions, consult the online handbook.

Check the error messages and proceed with the installation.

so don’t worry, its just simple permission issue all we need to do is give sufficient permission to drupal
  1. create a folder named “files” in /opt/lampp/htdocs/drupal/sites/default/
  2. enter this command in the terminal sudo chmod 777 -R /opt/lampp/htdocs/drupal/sites/default/files
  3. rename the default.settings.php to settings.php inside /opt/lampp/htdocs/drupal/sites/default/default.settings.php
  4. sudo chmod 777 -R /opt/lampp/htdocs/drupal/sites/default/settings.php

you are now all ready to go now.

Cheers

</ niroze >

refernces:

 


reference : http://www.upubuntu.com/2012/12/install-mysql-workbench-5244-from-ppa.html

MySQL Workbench is a tool with GUI that allows developers to design, model, manage, and generate databases visually. It integrates under a single IDE SQL development, data modeling, server administration, database design/creation/maintenance, etc.


The latest version of MySQL Workbench is 5.2.44 which is available for many platforms. You can find the new changes and bug fixes for this latest release here. In this article, we will see how to install MySQL Workbench 5.2.44 from PPA using Olivier Berten’s PPA which is supported by the following distributions:

  • Ubuntu 12.10/12.04
  • Linux Mint 14/13

MySQL Workbench Installation

Open the terminal and issue these commands:

sudo add-apt-repository ppa:olivier-berten/misc

sudo apt-get update

sudo apt-get install  mysql-workbench

You can start the tool from the Unity dash or from the terminal with this command:

mysql-workbench &


reference :  http://www.upubuntu.com/2012/10/install-xampp-181-from-ppa-under-ubuntu.html

Fire up new terminal. enter following command.

  1. sudo add-apt-repository ppa:upubuntu-com/xampp
  2. sudo apt-get update
  3. sudo apt-get install xampp

You can now start XAMPP with this command:

  1. sudo /opt/lampp/lampp start

Or use Unity dash and search for XAMPP Control Panel and start the server:

You can now access the XAMPP web interface at this link (replace localhost with your server IP address if needed):

http://localhost/xampp/

Troubleshooting

If you get this error when accessing phpMyAdmin:

Access forbidden!
New XAMPP security concept:
Access to the requested directory is only available from the local network.This setting can be configured in the file “httpd-xampp.conf”.

You can fix it with the following instructions:

- Open the terminal and run this command:

sudo gedit /opt/lampp/etc/extra/httpd-xampp.conf

- Replace now these lines:

<Directory “/opt/lampp/phpmyadmin”>
  AllowOverride AuthConfig Limit
  Order allow,deny
  Allow from all
</Directory>

with these lines:

<Directory “/opt/lampp/phpmyadmin”>
  AllowOverride AuthConfig Limit
  Order allow,deny
  Allow from all
  Require all granted
</Directory>

- Save your file and exit, then restart XAMPP with this command:

 sudo /opt/lampp/lampp restart

//======================= setting permission on httpdocs =================================================

You are mistaking how chmod and the unix file permissions operate.

You need to configure the /opt/lampp/htdocs directory so that the user you are logged in as has permission to write. You also need to ensure that what you write in there can be read by whatever web server LAMPP uses (I’m not familiar with LAMP unfortunately.)

First you need to look at who is owning /opt/lampp/htdocs:

$ ls -ld /opt/lampp/htdocs

Should return something like:

drwxr-xr-x 4 lampp www 4096 2011-03-22 12:43 /opt/lampp/htdocs

The first bit (dwrxr-xr-x) is the file permissions. “lampp” is the owner of the directory, and “www” is the group-owner of the directory. You need to note this one.

First off let’s sort the group. If the group is anything except “root” then all is well and good and you can skip this section:

If it’s “root” it will need changing to something more sensible. Let’s make a new group for it to belong to:

$ sudo groupadd www

Then change the group on the directory:

$ sudo chgrp -R www /opt/lampp/htdocs

Now you need to make the web server run as the group www. If the web server is Apache then you should check the /etc/apache/httpd.conf file and edit the “Group” setting accordingly. I don’t know the setting for other web servers.

Now this is where you’d skip to if you didn’t need to switch the group from root to something else.

We now need to address the permissions on the directory. We want to be using some very special permissions, called the “setgid” bit.

$ sudo chmod 2775 /opt/lampp/htdocs
$ ls -ld /opt/lampp/htdocs
drwxrwsr-x 4 lampp www 4096 2011-03-22 12:43 /opt/lampp/htdocs

You see the permissions have now changed somewhat. Let’s explain these.

  • The first letter is the file type. In this case “d” is for Directory.
  • The next three, “rwx” are the permissions the owner (lampp) has on the directort. r = read, w=write and x=see the directory contents.
  • The next three, “rws” are for the group-owner (www), but you notice the x in this case is actually an s – we will come to that in a moment.
  • The last three, “r-x”, are for everybody else. That is read, and see the content of the directory. No writing.

The “s” in the group permissions is called the “setgid” bit. This is a special permission which causes any files created in the directory to inherit the group-owner from the directory itself. So if user “fred” in group “users” makes a file in there it would be owned by “fred” in group “www”. This is very useful for a shared area where multiple people all read and write the same files.

But as it stands you still don’t have the ability to write to that area. Why? Because you’re not in the “www” group. Let’s rectify that now:

$ sudo usermod -aG www <user_name>

Replace “www” with the group-owner of the /opt/lampp/htdocs directory you noted near the beginning.

You will need to log out and in again for this change to take effect – your group memberships are read at login time.

Once you have done that you should suddenly find you can now magically write files in /opt/lampp/htdocs.

If you have other users on the system that you want to allow to write to there, just add them to the www group with the usermod -aD www <username> command.

enjoy.

cheers


  1. sudo add-apt-repository ppa:skype-wrapper/ppa
  2. sudo apt-get update
  3. sudo apt-get install skype-wrapper

refrence : http://www.noobslab.com/2012/09/install-skype-wrapper-in-ubuntulinux.html

installing sh file in ubuntu 12.10


 

1)download your sh file  e.g. “file_name.sh” and save it in your Desktop

2)Open Terminal (ALT + ctrl + T)

3)Now type cd ~/Desktop

4)Then type sudo sh file_name.sh type your root password

5)now you are all ready to use ur new application

 

Follow

Get every new post delivered to your Inbox.