Web Programming

8 Microsoft Visual Studio Keyboard Shortcuts You Need to Know Today

150 150 rhecht

Here are eight of my favorite keyboard shortcuts in Visual Studio. There’s a good chance at least one of them will be new to you.

1. Move Code Alt+Up/Down

This keyboard shortcut is new in Visual Studio 2013. If you put the cursor on a line of code and use the Alt+Up Arrow keys, the line of code you’ve selected moves up. If you use the Alt+Down Arrow keys, the line of code selected moves down.

2. Create Collapsible Region Ctrl+M+H/Ctrl+M+U

Chances are you’ve noticed the “+” and “-” symbols in the margins that let you collapse and expand your classes and functions. Did you know you can create your own collapsible regions? If you select a section of code and then use the key sequence Ctrl+M+H, you turn that region into a collapsible/expandable region. The key sequence Ctrl+M+U will remove the collapsible region. It doesn’t delete the code, it just removes the icon that lets you expand and collapse.

3. Comment Code Block Ctrl+K+C/Ctrl+K+U

Whether it’s because you’re trying to track down a “but,” or experimenting with code change, from time to time you’ll want to comment and uncomment blocks of code. If you select a block of code and use the key sequence Ctrl+K+C, you’ll comment out the section of code. Ctrl+K+U will uncomment the code.

4. Peek Definition Alt+F12

When you’re going through your code and you want to examine the code in the method you’re calling, many programmers will use the F12 key or the pop-up menu option Go To Definition. Go To Definition will navigate to the called method; however, many times you don’t need to navigate to the code. Sometimes, you just want a quick look at the method. If you’ve installed Visual Studio 2013, there’s a new keyboard shortcut — Alt+F12 — that will give you a preview of the method being called inline. You can use the Esc key to close the preview.

5. Navigate Forward/Backward Ctrl+–/Ctrl+Shift+–

When you have multiple files open at the same time, you might want a way to quickly move back and forth between two or three different locations in your code. If you’ve moved from one location to another you can use the keyboard sequence <Ctrl>+– to move to the previous location and then you can return using Ctrl+Shift+–.

6. Ctrl-Shift-S

Saves all documents and projects. Very useful when you have many items open and are too lazy to go to the top left “File->Save All.”

7. F7

Switches from the design view to the code view in the editor.

8. Shift-F7

Switches from the code view to the design view in the editor.



HostSo.com Web Hosting Services Review – Negative

150 150 rhecht

hostso-logo_bgRecently I was advised by a friend of mine to try switching my web hosting to HostSo. The pitch was that they operated a server that had 12 GB of RAM, and if one paid only $8.56/month for their ULTRA plan, one had unlimited space. I decided to give it a shot, which lasted a total of three days.

Here’s how it went: I went to the website and purchased the hosting plan. That setup was straightforward. One thing that gave off a red flag was the inability for them to enable Shell access on my own account for “security purposes.” That bothered me was that my website files, zipped, were too large to be unzipped on their server.

I had asked server support via Live Chat to unzip the files for me if possible. They did – to an extent. When they unzipped my website files they forgot to include all subdirectories and pointers. That left behind a huge mess of files all in the same directory for me to delete, as there was not much more I could do with them. I realized then and there that I would need to upload all website files the old-fashioned way.

After doing that (many hours later), setting up the necessary MySQL databases for my WordPress sites and pointing everything correctly, I noticed that my websites were all running slowly despite the claim that the server ran on 12 GB of RAM. My guess was there were already too many websites being hosted already on their server which was causing the sites to already run slowly. I set up WP-SuperCache (or W3-Total Cache, I forget which – they’re both good) to cache and speed up the sites. That helped a little. Then the unspeakable (in terms of customer service) happened.

The following day after my sites were launched I noticed that none of my WordPress sites, built on a Multisite configuration, were showing. I found that the “Permissions” to the required website directory were set to “000.” I reset the permissions of that and all subdirectories, then asked server support what happened. Their response? “Oh, we decided to disable that directory as it was causing too much of a load on our server.” Well duh! Websites do tend to do that. They also instructed me to optimize my databases and it won’t happen again. When I did, I replied that I had done so, but that what bothered me was that they took my sites down without my asking, and that concerned me from a business perspective. They replied that it won’t happen again before they warn me, and that I need to continue optimizing my databases. I decided then and there to leave their hosting in a flash.

When I asked to leave their hosting, they asked me why and I explained that their hosting didn’t meet my business requirements. It took a lot of back-and-forth with setting up a formal ticket, among other things, to finally get some sort of Credit Cart refund. Since they were using 2Checkout to process their payments, they returned the exact amount I paid them, but I received something like $8 less than they paid me due to 2Checkout’s insane processing fees. Whatever, at that point I decided to cut my losses.

I later learned from doing some Google searches that others had real complaints about HostSo’s Services. Among them were:




In short, never again. I had a terrible experience with them and don’t want to see others fall into the same trap.

WordPress: Youtube Embeds Not Working in Posts After Import

150 150 rhecht

Let’s say you are importing a WordPress website from another website (e.g. posts, pages, etc.) and notice that Youtube embeds didn’t move over. What do you do?

Answer: WordPress automatically filters anything that looks “funny,” which includes inline frames. What you do is (from http://wordpress.org/support/topic/youtube-embeds-not-working-after-import):

You can find in /wp-includes called kses.php. In kses.php, you’ll want to scroll down to line 1309 and comment out the three lines under //Post filtering so that they look like this:

// Post filtering
#add_filter(‘content_save_pre’, ‘wp_filter_post_kses’);
#add_filter(‘excerpt_save_pre’, ‘wp_filter_post_kses’);
#add_filter(‘content_filtered_save_pre’, ‘wp_filter_post_kses’);

This will prevent the filter from removing all your youtube videos, slideshare embed, scribd documents, etc. Once you’ve altered the filter and saved it, you’re ready to create your new blogs, hit the Tools menu, and import your XML from your exports above. After the process completes, you should have a working blog with all of your previous content in place exactly as before.

What you’ll need to do (sorry) is restart from scratch – remove all tables in database, delete wp-config file and start over, with the modified kses file.

WHM – How to Log in as Root in SSH


wheel group usersSSH is a very powerful technology, though not very user friendly. Sometimes things need to be done at the “root” level. However, for security purposes a regular user cannot simply log in as root using “su -” if not granted access.

How do you add a user to this access? Simple: in WHM when you log in, go to Security Center, then Manage Wheel Group Users. Over there you can add users to this “Wheel Group” to get in as root.

Hope this helps!

Wither CodeIgniter? Hello Laravel, CakePHP, and Zend


codeigniter-logoI recently was looking at different website frameworks and decided to revisit an old friend – CodeIgniter. CodeIgniter is a fast and lightweight PHP framework that has gained quite a following, and is famously known to power ExpressionEngine, a CMS that costs $300 per license. A friend recommended that framework to me a few years back, and after learning the MVC framework from it via online tutorials and books, built my first project, a Toronto-based Traffic/Parking Tickets filing program. Sadly, like the project, the framework doesn’t look like it’s materializing any further.

What shocked me was when EllisLab, the current owner of CodeIgniter, wrote a blog post last June that essentially looked like they were raising the white flag on the framework. The excuse: they don’t have time, money or resources to focus on it and are looking for someone to focus on it more. In a fast-paced world where everyone is busy and where new frameworks are coming out of the woodwork, it doesn’t look like there’s much hope left for it.

Looking at an independent post, it looks like the next frameworks to focus on are CakePHP and Laravel. Zend also works as they have been around the longest and offer PHP certification.

Rest in Peace, CodeIgniter. I will look to learn Laravel here as it looks to be the future in PHP framework coding.

How to Disable Browser Cache in Chrome Using F12

150 150 rhecht

Like many, I love using Google Chrome (even though I know that through that, Google essentially steals my personal info 🙂 ). However, when launching a new website, or moving it over to another hosting, I notice that other browsers like Firefox and Internet Explorer will show the new hosting, while Chrome takes forever.

I tried clearing the browser cache, but found that it only works well to a degree. I needed a more immediate cache-clearing solution.

How to clear browser cache once a new site is moved over

Press f12 to open the developer console. Then, under the elements tab, click the gear in the lower right corner: chrome-wrench. On the left, there is an option to disable cache.



How to clear browser cache for Chrome – in general

You can clear the cache regularly.

Wrench icon > Options > Under the hood > Clear browsing Data


Wrench Icon > Tools > Clear browsing Data


From: http://superuser.com/questions/334793/how-to-disable-browser-cache-in-chrome

WooCommerce – Change Product Description Heading Title

150 150 rhecht

Change the heading title in the product description panel on the single product page in WooCommerce. This is for the ‘Product Description’ title inside the panel, NOT for the ‘Description’ tab. This code snippet goes in your functions.php, or other functions file. Change line 9 where it says, ‘YOUR CUSTOM TITLE’, to your own title.

 * Change on single product panel "Product Description"
 * since it already says "features" on tab.

function isa_product_description_heading() {


You may want to remove the heading title altogether since it’s sort of redundant; there’s already a tab on top with a title. So, to remove the title, do this code instead:

 * remove on single product panel, "Product Description"
 * since it already says "Description" on tab.

function isa_product_description_heading() {
	echo '';

Courtesy of: http://isabelcastillo.com/change-product-description-title-woocommerce

Youtube Video Inside iFrame – Not Hiding in Safari 5.1

150 150 rhecht

Try adding:


as the first GET variable in the url for the youtube video.

(eg: src=”http://www.youtube.com/embed/12345assdfdfdf?wmode=opaque&rel=0″)

Worked for me in a similar situation. This actually works!

Source: http://stackoverflow.com/questions/10700577/youtube-video-inside-iframe-not-hiding-in-safari-5-1

WebP – Google’s Image Extension for Web Internet Browsers – How to Properly Use

150 150 rhecht

webplogoRecently, when I launched a new design for a website, one of the biggest features was a photo gallery. This photo gallery was calling a number of high-res PNG files, which was a big part that caused the home page to load slowly. Seeing few options for the same quality images at a smaller file size. I then recalled a couple of years ago when Google announced a new image format specific for web browsers. That format is WebP, and for all intents and purposes it’s the same as a PNG file at 1/5th the size, allowing for faster loading.

I immediately jumped at the chance to convert my PNG files into WebP images, and was more than pleased at the results. However, imagine my chagrin when I realized that WebP can only be used by Google Chrome and no other browser! What to do?

The simple answer seems to be that for now, make image loading browser specific, at least until all other browsers (Internet Explorer, Firefox, Safari, Opera, etc.) get up to speed. It’s a shame as WebP loads lightening-fast, but that what cross-browser compatibility is all about. If the browser is Chrome, then unleash the WebP goodness it has to offer. Else, load the slow-loading PNG files. But how?

Looking at browser-specific CSS rules, I realized then and there that from a CSS perspective, you cannot isolate Chrome from Safari, Chrome from Opera, etc. The only two ways are server-side or JQuery.

Since too much Javascript is never a good thing, I did the responsible thing: I hard-coded a condition in PHP:

if (strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome') !== false)
    // User agent is Google Chrome
    // Output WebP background CSS file
    //Output slow-loading PNG background CSS file

And voila! It worked!

Oh, before I finish, here’s a way to slightly reduce the size of your PNG files. It’s called PNGCrush and should reduce the image size by up to a quarter of what it was before. Enjoy!

Note: Being lazy, I’ve been using TinyPNG, a user-friendly PNG resizer that doesn’t compromise the size or quality of your PNG images.


How to Add a User to a WordPress Multisite Via Database as an Administrator

150 150 rhecht

WP_MultiSiteA while back we were given permission to host and edit a clients’ website, built on WordPress with Multisite functionality. However, for various reasons we were unable to get in touch with the previous developer who had Admin access to the sites. Since we were hosting their website and database, we at least had that. The solution then was to add a new user (us) through the back-end. The question that remained was, how?

Here is what we did:

1. Access the database

Once the database was created and uploaded, we needed to access it. Our personal favourite desktop tool for the job is HeidiSQL.

2. Add a new user

To do this, go to the wp_users table. From there, you can add your username, user_nicename, email, etc.

The password though is a bit tricky. Assuming that the encryption is a standard MD5 Hash and not with SALT, you can insert a password (say it’s 123456) as follows:

"Update [table_prefix - usually wp_]users set user_pass=md5('123456') where ID=[id # of user you are trying to update];"

1 - add user info without password

3. Add User to sites

Now that the basic user information is added, now we need to associate it with a site. To do so you would add the following fields:

  • wp_capabilities -> a:1:{s:13:”administrator”;s:1:”1″;}
  • wp_user-settings -> editor=tinymce&mfold=o&align=center&libraryContent=browse&urlbutton=custom&imgsize=full
  • wp_user_level -> 10

Do this for all sites, wp_, wp_1_. wp_2_, wp_3, etc.

2 - usermeta convention

4. Add Site Admins in wp_sitemeta

Okay, great. Now you have added yourself as an admin for each sites. However, you still aren’t yet set to change Network Settings. For this, you need to go to [table_prefix – usually wp_]sitemeta. From there search for a meta_key called “site_admins.” The syntax is in the screenshot below. Let’s analyze the syntax.


  • “a:3″ -> for network Admins, there will be 3. The succeeding text will now list them.
  • “i:0″, “i:1″, ”i:2″ -> This is the user order: Admin1, Admin2, Admin3, etc.
  • “s:5″, “s:9″, “s:10” -> This represents the number of characters of the declared username! This apparently was added as a security feature of sorts. If the number of characters are off than this will not work!
  • “admin,” “irisemedia,” etc. -> This is the declared username that will be associated with the Network Admins

3 - sitemeta convention

Now, try logging in and see if it works.

Post originally published here: http://www.irisemedia.com/blog/2013/04/30/how-to-add-a-user-to-a-wordpress-multisite-via-database-as-an-administrator.html