FeedAgg.com Logo
Your Account | Sign In | Sign Up

Add Feed | Search | Home | Help | Contact | Blog

Feed: markojakic.net - cool web.dev & scripting blog - AggScore: 45.8



Summary: markojakic.net - cool web.dev & scripting blog


Cool web development, programming, designing and scripting blog

Configure & Run XAMPP on Ubuntu Linux


I like to keep posts as simple as possible, so don’t mind me writing things fast — there is comments section below where you can feel free to ask anything related ;)

You probably installed XAMPP already and then came here for help, but let’s cover that part too. Go to our beloved Google.com and search “install xampp on linux”. First result that appears, click on it and follow steps on ApacheFriends’ website. Download from first link in the table (at time of this post it was “XAMPP Linux 1.7.7″, size 77MB).

Follow step 2.

Now, if you get stuck at > /opt/lampp/lampp start, do this:

sudo service apache2 stop (if you are logged as SU, omit “sudo” part)

Also, you can stop mysql service, same as above but instead apache2, type “mysql”.

This is because Ubuntu Linux (or any) has it’s own Mysql and Apache servers installed. Kill them to use XAMPP’s ones.

Now type in console:

sudo /opt/lampp/lampp start

…and type in browser http://localhost and you’ll see XAMPP live and running. But here we have problems which you need to solve by yourselves. Go to //localhost/phpmyadmin and you will get “Existing configuration file (./config.inc.php) is not readable.”. This is because you need to set permissions for your username. Go to Phpmyadmin folder (> cd /opt/lampp/phpmyadmin).My username is markzero, and command to run was:

sudo chown markzero:markzero config.inc.php (so obviously instead “markzero” put your username)

Now we also need to set some ownerships, and permissions to htdocs folder inside XAMPP, otherwise we won’t be able to FTP files into it, and/or to copy. Go to /opt/lampp folder (> cd /opt/lampp). Write this piece:

sudo chown -R your-username:your-username htdocs

…and…chmod it to 755:

sudo chmod -R 0755 /opt/lampp/htdocs

And nope, it is not yet done. We need to change /opt/lampp/etc/httpd.conf file to reflect our ownership change. While in /opt/lampp folder, type:

sudo gedit /etc/httpd.conf

Find this:

– User nobody

– Group nogroup

Note: it might not write “nobody” or “nogroup” but find that module, there aren’t two of them. Change “nobody” to your username, in my case it is “markzero”. Restart your mysql and apache2 services as explained above in beginning, and it should all work!

Now create some folder inside /lampp/htdocs and copy some files through FTP to it. Success! All is working: FTP, write permissions and ownerships.

Start (approximately) from scratch before this tutorial to be sure you followed exactly as I wrote. Let me know if you run into issues! ;)

Date Published: Apr 02, 2012 - 6:38 am



How to programmatically embed YouTube video using iFrame


Date Published: Dec 12, 2011 - 3:28 am



Insert table column to another table column in SQL


If you have an empty new table, and wanted to transfer IDs from another table you could do this:

 
INSERT INTO new_table (user_id) SELECT existing_table.ID FROM existing_table;

If you would like to preserve order you can just order by any column from existing table:

 
INSERT INTO new_table (user_id) SELECT existing_table.ID FROM existing_table ORDER BY existing_table.any_column;

;)

Date Published: Nov 20, 2011 - 6:29 am


Match all elements except first using CSS, using plus “+” sign


It is not so familiar rule between designers, the exception of first element within group of elements which share the same parent. Most cases I’ve seen use some kind of server-side or Javascript scripting, to declare special class, e.g. “first” to the first element. Let’s take a look at a list:

 
li {background:red;}

This will produce that all LI elements have red background. What about if we do this?

 
li + li {background:red;}

The rule here tells us to declare style to elements which come directly after firstly declared, sharing same parent. This will make first LI HTML element excluded from style specification, because it has no elements before.

 
<</span>ul>
<</span>li>List 1</</span>li>
<</span>li>List 2</</span>li>
<</span>li>List 3</</span>li>
</</span>ul>

Using last style, only lists ‘List 2′ and ‘List 3′ will have background red colored.

Date Published: Oct 24, 2011 - 12:22 pm


Find products with no images attached in Magento, using SQL


It really sucks when you have 2k products and randomly some (300+) of them doesn’t have images attached. You can use this SQL just to see which product doesn’t have images:

 
SELECT * FROM `magcatalog_product_entity_media_gallery` RIGHT OUTER JOIN magcatalog_product_entity ON magcatalog_product_entity.entity_id = magcatalog_product_entity_media_gallery.entity_id WHERE magcatalog_product_entity_media_gallery.value is NULL
Date Published: Oct 10, 2011 - 6:03 am


How to dump objects in Magento


This is my first post about Magento, as I started developing in it. So, one of the first things I had to remember was this:

 

print_r(dollarsignrvar->debug());
?>

It is funny how long it took me to figure this one out. Not all objects override debug method though.

Date Published: Oct 07, 2011 - 5:16 am


Reload page after successful Ajax on click


If you’re failing with callback functions after JQuery click’s function, try this tut. Try putting your callback function on complete AJAX function. If you call on success it may happen that caller (in this case window refresh) gets called immediately on click of a button, that is, page would refresh right on click instead of waiting for your function to finish execution.

Let’s say there is an HTML element with the ID ‘obj’. On-click would look like this:

 
dollarsignr('#obj').click(function() {
   call_function(
      parameters,
      function() {
         window.location.reload();
   });
});

This will call call_function function. Now just set your caller on complete of an AJAX:

 
function call_function(parameters,callback) {
dollarsignr.ajax({
   type : 'POST',
   url : someurlhere,
   data : datahere + '&param=' + datahere,
   dataType : 'json',
   success : function(serverData) {
      /* your code here */
   },
   complete : function(jqXHR, textStatus) {
      if ( typeof(callback) == "function") {
       callback();
      }
   }
});

All data here is given just for example purposes. Change them to your likings…

Date Published: Sep 30, 2011 - 4:16 am


JQuery checkboxes inverse selection


This tut shows you how to easily invert selected/unselected HTML checkboxes. Let’s say we have such HTML structure:

 
<</span>p><</span>input type="checkbox" name="cb[1]" class="my_cb" /> Check 1</</span>p>
<</span>p><</span>input type="checkbox" name="cb[2]" class="my_cb" /> Check 2</</span>p>
<</span>p><</span>input type="checkbox" name="cb[3]" class="my_cb" /> Check 3</</span>p>
<</span>p><</span>input type="checkbox" name="cb[4]" class="my_cb" /> Check 4</</span>p>
<</span>p><</span>input type="checkbox" name="cb[5]" class="my_cb" /> Check 5</</span>p>
<</span>p><</span>a href="javascript:;" id="cb-inverse">Inverse</</span>a></</span>p>

Now all there is to do is to set some JQuery functionality to the link’s click function:

 
$('a#cb-inverse').click(function() {
 $('input.my_cb').each(function() {
   $(this).is(':checked') ? $(this).removeAttr('checked') : $(this).attr('checked','checked');
 });
});

Demo:

Check 1

Check 2

Check 3

Check 4

Check 5

Inverse

Date Published: Sep 25, 2011 - 3:47 am


Change Titles of Meta Boxes


First thing to do when customizing admin area is to name all boxes to users’ likings. For example “EXCERPT” you can call “SHORT DESCRIPTION”, and such. For example, “POST TAGS” is inside DIV element tagsdiv-post_tag. Let’s say you want to name it just “TAGS”. You would do it this way:

 

add_action( 'add_meta_boxes', 'change_tag_meta_box', 0 );
function change_tag_meta_box() {
    global $wp_meta_boxes;
    unset( $wp_meta_boxes['post']['side']['core']['tagsdiv-post_tag'] );
    add_meta_box('tagsdiv-post_tag',
        __('Tags'),
        'post_tags_meta_box',
        'post',
        'side', 
        'low');
}
?>

To determine core (built by WP team) caller function (in this case post_tags_meta_box) find it inside /wp-admin/edit-form-advanced.php by searching for ID tag (or part of it like “tagsdiv” because post_tag tells us about tag taxonomy) of desired meta box.

ID of a meta box you can inspect using FireBug: inspectmetaboxID

If a meta box is made by some plugin, you need to search within that plugin’s directory. Parameters of the add_meta_box function see here.

Date Published: Sep 15, 2011 - 2:27 am


Get all Users except Subscribers in WordPress


This, small and short as usual, tutorial will show you how to put WordPress User objects into array. For my needs, it wasn’t necessary to put Subscribers, but Administrators, Editors and Authors. You can easily exclude any, like Contributors too.

Just put this snippet into your code and you will have users as WP objects inside allowed_users array:

 

dollarsignrall_users = get_users();
dollarsignrallowed_users = array();
foreach ( dollarsignrall_users as dollarsignruser ):
    dollarsignrwp_user = new WP_User(dollarsignruser->ID);
    if ( !in_array( 'subscriber', dollarsignrwp_user->roles ) ):
        array_push(dollarsignrallowed_users, dollarsignruser);
    endif;
endforeach;
?>

;)

Date Published: Sep 03, 2011 - 7:23 am


 
Visitor Rating: 5 (1) (Rate)

Story Clicks: 0

Feed Views: 44

Lenses (Add|?)

Comments (Log in to add)

Feed Details
Date Added: 01/17/2011
Date Approved: 01/17/2011
By: Anonymous
Search FeedAgg.com




3600 sp5016 serv 4.0277 seconds to generate.