Data Center Hub

Internet Data Center and Hosting News and Views

How to handle more than 4GiB memory on Debian 6

Filed under: Uncategorized — Bill Laakkonen at 2:24 pm on Wednesday, August 15, 2012

The default Debian kernel does not address beyond 3406132K RAM. You may want to use lshw to list the hardware physically installed in the server- lshw -C memory. Use apt-get install lshw if not installed.

Install the bigmem kernel.

1. “uname -r” will give you the installed kernel e.g. 2.6.32-5-686

2. Run “dpkg –get-selections | grep bigmem” to show if the bigmem kernel is installed

3. If it is not installed then run “apt-get install linux-image-2.6-686-bigmem”

4. Run the dpkg command from step 2 again, it should now show the bigmem kernel, any alias name, and “install” in the output.

Reboot and make sure you are running the new kernel- uname should show bigmem appended to the end of the kernel name. Use top or free or cat /proc/meminfo | grep -i memtotal to see the new memory amounts.

How to Disable CTRL-ALT-DEL in Linux and FreeBSD

Filed under: Uncategorized — Bill Laakkonen at 2:18 pm on Wednesday, August 15, 2012

When running X-Windows the CTRL-ALT-DEL sequence is normally ignored. If you happen to be running a Windows Virtual Machine, along with Unix/Linux VMs- you might accidentally send the three finger salute to the wrong virtual machine. On VirtualBox it can be worse as the sequence is short cut to RIGHTCTRL-DEL and before you know it- the Linux or other Unix-like server is rebooted. Since there is no other way to avoid this in such an environment, here’s how to disable CTRL-ALT-DELETE on Linux and FreeBSD boxes.

1. Linux (e.g. Debian). Edit /etc/inittab and look for the line below “# What to do when CTRL-ALT-DEL is pressed”. Put a # at the front of the line which has the shutdown command, save and exit, then tell init to re-examine its’ files by issuing “init Q” and/or rebooting the machine.

2.FreeBSD – you should be able to run this: sysctl hw.syscons.kbd_reboot=0 to disable the three finger salute at the console. Add the hw.syscons.kbd_reboot=0 to /etc/sysctl.conf to have it disabled automatically on boot and reboot to be sure it takes.

Images in TinyMCE are not showing up in Modx manager after server change.

Filed under: Uncategorized — Bill Laakkonen at 1:46 pm on Friday, August 3, 2012

Images in TinyMCE are not showing up in Modx manager after server change.

Q We moved the site from a Windows host to a Unix host and now find the images are not showing in the management interface with the TinyMCE editor- the images are there still, and the folder has proper permissions. What could be the problem?

A. When you move from Windows to Unix you will find TinyMCE needs to have the final base path reset. In modx Evolution you’ll find it under Tools->configuration->Interface and Features->File Base Path. if you see a path starting with a letter and you are on a Unix server, you need to reset the path by clicking on the reset button and saving the settings. That should do it.

Notes for Validating and Troubleshooting Bad HTML

Filed under: Web Site Design — Bill Laakkonen at 8:23 am on Sunday, July 8, 2012

It is important for your HTML documents to validate properly. Even though most published HTML documents have a variety of errors, they usually do not prevent the document from displaying properly in most browsers. I like my sites to have a good chance of consistent presentation across all devices, so I do a few checks before publishing. Following are a couple tools I use to do this.

First Round: I use the developer toolbar for Firefox from Chris Pedrick. You can find it at: http://chrispederick.com/work/web-developer/ – It has a quick link to the W3 HTML validator – in the toolbar under Tools->Validate HTML. It should blat out any simple errors for you to quickly correct.

Second Round: I use the Lynx text based browser to check the design. http://lynx.isc.org/lynx2.8.6/index.html

I use Cygwin on my Windows boxes so that I have real tools at hand. You can get Cygwin and Lynx together at cygwin.org.

Once the site is opened in Lynx you should see your site as it really appears to search engines such as Google (not to mention sight impaired individuals).

Start lynx in your terminal by typing lynx http://www.yourdomain.com/page.html – In a few seconds your page text should show up on screen. If the page has bad HTML- you should see Bad HTML flash in the status line as the page loads. To troubleshoot, press Ctrl+T (trace mode on) and reload the page with Ctrl+R. Now press the ; to view the trace log file and look for your errors. If you are a vi user, the log viewer also uses / for search (press /Bad to find the word Bad) and is case sensitive as it should be. As you can see below, the input tag is not within a FORM tag — yet this document validates at the w3 validator page! Like all things, you need to check it twice.

Lynx Bad HTML

 

Adding Disqus to Modx Evolution

Filed under: Uncategorized,Web Site Design — Bill Laakkonen at 7:29 am on Saturday, July 7, 2012

Adding Disqus to Modx Evolution

1. Create a disqus account, verify your email and log in to the account- remember your short name for step two.

2. Grab the Universal Embed Code and create a new chunk named disqus-

http://yourusername.disqus.com/admin/universal/ – when you use your short name in the URL to the left (replacing “yourusername”) the user code should be correct for your unique site. I also concatenated the second bit of code called comment count which is supposed to be placed just before the </body> tag into the disqus chunk and it seems to work fine for me.

<div id=”disqus_thread”></div>

<script type=”text/javascript”>

var disqus_shortname = ‘yourusername’;

 

 

(function() {

var dsq = document.createElement(‘script’); dsq.type = ‘text/javascript’; dsq.async = true;

dsq.src = ‘http://’ + disqus_shortname + ‘.disqus.com/embed.js’;

(document.getElementsByTagName(‘head’)[0] || document.getElementsByTagName(‘body’)[0]).appendChild(dsq);

})();

</script>

<noscript>Please enable JavaScript to view the <a href=”http://disqus.com/?ref_noscript”>comments powered by Disqus.</a></noscript>

<a href=”http://disqus.com” class=”dsq-brlink”>comments powered by <span class=”logo-disqus”>Disqus</span></a>

<script type=”text/javascript”>

/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */

var disqus_shortname = ‘yourusername’; // required: replace example with your forum shortname

 

/* * * DON’T EDIT BELOW THIS LINE * * */

(function () {

var s = document.createElement(‘script’); s.async = true;

s.type = ‘text/javascript’;

s.src = ‘http://’ + disqus_shortname + ‘.disqus.com/count.js’;

(document.getElementsByTagName(‘HEAD’)[0] || document.getElementsByTagName(‘BODY’)[0]).appendChild(s);

}());

</script>

 

3. Create a unique URL Identifier for Disqus. If you use the Modx document id variable it should always be unique.

For Modx Evolution use the following code just before your head tag:

<script type=”text/javascript”>

var disqus_identifier = ‘[*id*]‘;

</script>

 

4. Add a call to the disqus chunk in the content area of the page template(s). Just before the end of the div containing the content call: [*#content*], add {{disqus}} . Now you should be able to clear your site cache and test it.

Missing Thumbnails in PHP on IIS 6

Filed under: Servers — Bill Laakkonen at 2:02 pm on Friday, December 4, 2009

I noticed the images in the Modx manager had no thumbnails after getting Modx working on IIS 6.0 and Windows Server 2003. While the installation script for Modx is excellent, I did not get a warning about the missing GD library. How would one know that the reason the thumbnails are missing is due to the GD library? I can only say I know because I know. If you have a PHP application with missing thumbnails, it is likely GD is not enabled.

How to check if you have GD. Simply make a PHP info page and look for a section named gd. If you do not see one in your info page, open your php.ini file (likely in your Program Files\PHP\ folder) and look for ;extension=php_gd2.dll. Remove the semicolon and save the file. Check your EXT folder to be sure you have the dll located there. Make sure you only have one copy of the dll and in only one location. The contents of your info page should tell you where the extension should live.

After saving the php.ini reload your php info page. Still don’t see it? Navigate to your IIS Manager and refresh your default application pool. Open IIS Manager->Server->Application Pools->DefaultAppPool – Right Click->Refresh. Now reload your info page and you should see gd included in the output.

Hosted VOIP PBX or In-house?

Filed under: Internet and Phone — Bill Laakkonen at 12:51 pm on Friday, November 27, 2009

When does it make sense to use a Hosted or managed VOIP PBX systems or build a system in house? If you are new to the concept of a VOIP PBX, here is a nice video which should help you in the process.


Installing Modx on IIS 6, Server 2003

Filed under: Servers — Bill Laakkonen at 3:30 pm on Wednesday, November 4, 2009

I just installed Modx 1.0.0 on IIS 6.0, windows Server 2003 and had a few glitches. I’ve done several 1.0.0 installs under UNIX and they went without a hitch. These are just my notes for reference, not a “how-to”.

Prior to starting the install make sure the assets/cache/ Folder for the site has IUSR_MACHINE permissions or you will get errors like “failed to open stream permission denied” for siteCache.idx.php and the install will fail.

Make sure you enable mbstring (extension=php_mbstring.dll) in your PHP.ini or you will get an error from Ajax Search of call to undefined function, e.g. “Fatal error: Call to undefined function mb_strlen() in C:/directory/assets/snippets/ajaxSearch/classes/ajaxSearch.class.inc.php on line 1090″. After you make the change, restart IIS and look for mbstring in the output of your PHP info page.

Following is another Ajax Search issue that I have not resolved yet. When you go to a page in the search results, you get:

« MODx Parse Error »MODx encountered the following error while attempting to parse the requested resource:

« PHP Parse Error »

PHP error debug

Error:     preg_replace() [function.preg-replace]: Compilation failed: lookbehind assertion is not fixed length at offset 11

Error type/ Nr.:     Warning – 2

File:     C:\location\manager\includes\document.parser.class.inc.php(746) : eval()’d code

Line:     120

This is repeatable on my CentOS box and now my windows box too. The issue on CentOS is PHP was compiled against a buggy version of PCRE- but- the version used in that web server is held hostage by Parallels and their poorly supported control panel Plesk, which is not upgradable and is not planned to be upgraded for some time yet. On the windows box, updating PHP is a little easier. My info.php shows PHP is compiled with PCRE Library Version 6.6 06-Feb-2006. So the issue is not with Modx or the Ajax Search- it is with the PCRE Library. This should be resolved on windows by upgrading PHP. On the Unix box, I did a workaround and simply turn off the ajax search results highlighting.

Add a “tweetthis” link to any page

Filed under: SEO — Bill Laakkonen at 11:37 am on Tuesday, November 3, 2009

Dave Child at AddedBytes.com created a really cool snippet for Modx 0.9.6.3 called “tweetthis” The tweetthis snippet will return a link to twitter for the user to tweet the current page. The URL is sent through TinyURL automagically and TinyURLs are cached indefinitely to assets/cache/tweetthis.txt. The Link is given the class “tweetthis” so you may apply some styling to it. Here is a link to download tweethis. It also works on Modx 1.0 (for me, at least).

Here’s how to add it to your Modx site:

  1. Login to your manager interface Go to Elements->Manage Elements->Snippets->New Snippet.
  2. Give your new snippet a name of “tweetthis” and copy and paste the text of the snippet file into the snippet code form- don’t forget to keep the PHP open and close tags, choose a category under “Properties” and tick off the “Lock snippet” box
  3. Save your snippet
  4. Open your desired template (e.g blog or default) and add a call to the snippet with your optional parameters.

    &name=`@Shopping_CartIt` Optionally use your Twitter ID by prefixing your ID with an @.

    &text=`Tweet This!` Optional label Text for the link. “Tweet This!” is the default text.

    &id=`5` Optional Document ID. If not specified it defaults to the current document.

  5. Example Snippet Call: [!tweetthis?&name=`Shopping_CartIt`!] Save your template.
  6. If desired, edit your CSS to style the link.
  7. Test your page, apply to additional templates.

Here is a site with the TweetThis snippet installed- try it out. If you’re not using ModX, check it out. I’ve built a dozen sites with it over the last few years and it is a powerful platform for SEO and content management.

Modx SEO fine tuning- adding global Meta tags for keywords and description

Filed under: SEO — Bill Laakkonen at 10:21 am on Wednesday, October 28, 2009

Modx 0.9.X and 1.X have a default keyword manager that you may manually apply to each page but it is rather clunky to use, requiring each keyword entered manually first to the list, then manually applied to each page.

An easier way to do this is to create a Template Variable for the keywords and add it to the default template for the site. You can apply a default list to all pages and then manually edit each page to fine tune your keywords and descriptions.

Keywords first:

As site admin on the Modx manager interface you should first create a Template Variable (TV) called keywords, caption of Meta Keywords, default text of “type your keywords for the page here”, input type “text“, Input Option Values blank, Default Value; enter a list of your site-wide default keywords separated by commas. E.G. “Web Servers, Web Hosting, Dedicated Servers” etc. Tick off “Lock the template variable” leave Widget and Sort Order blank, Tick off your templates to use the TV, choose a Category E.G. Modx Default Templates and save it.

Now go to your template and add the following

<meta name=”keywords” content=”[*keywords*]” />

Save the template, clear the site cache and view your page. All the pages using this template should have the default keywords now. If you pull up an individual page and edit in the manager interface, you should see the keyword list which you can customize for each page. If you already added keywords to your pages- don’t forget to deselect them and save the page for each page you have applied them to. You don’t want to have keywords added twice.

Now add the Description Meta data-

Adding Meta description is even easier- just add:

<meta name=”description” content=”[*description*]“/>

to your Modx template; if you entered a description into the description field when creating your document, you should see this in the HTML source for the pages of your web site.

BASE HREF tag

Don’t forget to add a BASE HREF tag to your site so that all links are built relative to your site root, regardless of how the site is called. This can be helpful if you have another domain as an alias for your site.

<base href=”http://www.domain.com/”></base>

Replace www.domain.com/ with your site root URL.

301 Redirect

You should use a 301 redirect for sites that might be viewed using the domain name (domain.com without www) rather than the host (www, etc) name. How to do this varies depending on your web server. Here is an article I wrote on both 301 redirects and BASE HREF.

Next Page »