Monday, March 15, 2010

Strange "Connection closed by 127.0.0.1" in log files every minute

Recently I had been installing different types of software to help me track my server. Some days after doing this however, my server started reporting a strange message in the log files.

Problem: 
The following would show up in my logs with a different GUID and  timestamp of course on one minute intervals.
Mar 15 13:03:27 server 1 sshd[16979]: Connection closed by 127.0.0.1

Solution:
To solve this mystery I began trying to think of the possibilities of what it could be. What had I just installed that would be doing this? My memory sucks and I couldn't remember, so I began looking through the web to see if anyone had any solutions. A coworker of mine suggested using a netstat command ("netstat -lep --tcp") to see what services were running and which ones were newly installed on my server. I went through and turned off the services one at a time until I found the culprit. Monit had been installed some days earlier but the configuration file had errored out producing the message above in my log. Stopping the service ("/sbin/service monit stop"), the error no longer appeared in the log file. With some fixing, I am sure the wrongs in the Monit config file could be made right, but for now I am just going to keep it off.

Hope this helps someone else with the same issue. Good luck.

Friday, March 5, 2010

Problems starting Dimdim 4.5 Open Source

When trying to install Dimdim 4.5 CentOS RPM on my CentOS 5.4 server, I had to modify several files to get things to work in addition to the standard installation instructions.

Problem:
Starting dimdim displayed several errors when starting up. It would work just fine except for sharing documents. This always produced the error: 'The document conversion failed with error: document id generation failed.'. Looking closer to the start up errors and doing some google searching I finally figured out how to get documents to upload and display.
Traceback (most recent call last):
File "/usr/local/dimdim/Mediaserver/mods/interface.py", line 7, in
from document_manager.slidedeck import CSlidedeck
File "/usr/local/dimdim-4.5/Mediaserver/mods/document_manager/slidedeck.py", line 22, in
from engine import exportEngine
File "/usr/local/dimdim-4.5/Mediaserver/mods/document_manager/engine.py", line 34, in
import uno
File "/opt/meeting/lib/python2.5/uno.py", line 33, in
import pyuno
SystemError: dynamic module not initialized properly
Solution:
Revert my openoffice 3.1 back to openoffice 3.0. Significant changes between the version of open office cause issues with calling required modules. You can use yum to remove the current openoffice rpm (will be several rpms).

You can find the rpm for open office 3.0 here.

You will need to gunzip and tar the file to unpack it. Once you have done that you can follow the directions here to install them.

Restart dimdim.

Friday, February 26, 2010

Google Docs Viewer extension for Chrome

Chrome Browser: If you are a tech-savvy person, you probably have noticed that Google integrated with much of the internet market with free software and services. The Google Chrome browser is optimized to load web pages faster and interpret JavaScript quicker than most other web browser available. In the past month or two I have started using and liking Chrome. It is still considered "beta" and does have some bugs, but overall it's worth the download.

Google Docs Viewer: Since Google integrated extensions in the Chrome browser, developers have quickly begun to develop free extensions to make common tasks more efficient. One issue all browsers have in my opinion is the Adobe PDF plug-in. This plug-in is slow and can crash your browser if things aren't exactly right or if the PDF has file corruption.Google has released a simple tool to allows users to view PDF files without the Adobe plug-in by using a web based service. The extension, Ultimate Google Docs Viewer, automatically reassigns links to PDFs, powerpoints (*.ppt, *.pptx), tiffs, and Microsoft Word files (*.doc, *.docx) to automatically open in the Google Docs Viewer. It also provides quick access to download the file.

More Extensions: I will be reviewing other extensions and promoting those I think are beneficial.In the meantime, I would recommend looking into the Google Chrome browser.

Monday, January 25, 2010

Uploading a File in Symfony 1.4

Being new with Symfony, I decided to learn on their most recent stable version (1.4). For my work, I needed to be able to upload a file from the user when they submitted a form. While reviewing the Jobeet tutorial they have posted to help users learn Symfony, I found this:
sfValidatorFile is quite interesting as it does a number of things:
  • Validates that the uploaded file is an image in a web format (mime_types)
  • Renames the file to something unique
  • Stores the file in the given path
  • Updates the logo column with the generated name
 My implementation was in fact using sfValidatorFile to validate the file's mime type, etc. Trusting this to be as the documentation said it is, I looked for every other possible reason why my files wouldn't upload.

Problem:
Files wouldn't upload properly in Symfony 1.4 even with using the sfValidatorFile.

Solution:
Manually loop over and move files to the upload directory.

The code I used in my actions file was like this:

if ($this->form->isValid())
        {
            foreach ($request->getFiles($this->form->getName()) as $uploadedFile)
              {
                $uploadDir = sfConfig::get('sf_upload_dir') . '/assets';
                move_uploaded_file($uploadedFile["tmp_name"], $uploadDir . "/" . $uploadedFile["name"] );
            }
            $this->redirect('media/thumbnailSelector?'.http_build_query($this->form->getValues()));
        }
I hope this helps someone figure out their code issues.

Happy coding.

Wednesday, January 13, 2010

Symfony XAMPP windows white screen or blank page issue

Recently while installing Symfony on my localhost using the xampp package, I realized I was having issues once I was trying to get the screen to load. When I typed in the url using localhost:8080, I was greeted by a white page with no source at all. Luckily the solution was very simple.

Problem:
While following the steps for setting up Symfony, finally testing it I was greeted with a blank page.

Solution:
When I checked the frontend_dev.php page, it told me I had an error with my doctrine plugin setup. So I went back to the page where the manual discussed that configuration and repeated those steps verifying in Windows Explorer that thing were happening for each command. This solved my problem and the page showed up just fine.

If you are not sure why your page isn't loading, first check the frontend_dev.php page, that will most likely explain the error. Raw exceptions are obstructed from appearing on production as a security feature in Symfony.

Best of luck programming.

Sunday, November 8, 2009

Flash caching PHP response

Recently I ran into an issue where I would call a PHP file that would generate a unique id and return that to Flash (I am sure I could do the same thing from within flash but decided to just use PHP's uniqid to solve this for now) The id that comes back is used for files the user is uploading. The problem I noticed is that Flash would make the call to the PHP file and then get back the same UUID everytime. I thought that perhaps Flash was caching the page and then just loading it instead of re-requesting it from the web server. In summary this was somewhat true. The page was being cached somewhere and needed some PHP header references to prevent from caching properly.


Problem:
Flash kept loading the same values from a PHP script that should have been generating different values on every call.

Solution:
I included these header functions and parameters at the top of my PHP file.
header( "Pragma: no-cache" );

header( "Cache-Control: no-cache" );

header( "Expires: Sat, 01 Jan 2000 00:00:00 GMT" );

 Happy programming.

Getting file extension with ActionScript

It has been some time since I have posted, but I figured this one quick function for extracting a file extension was worth a quick post.

Problem:
You are dealing with files and want a quick way to extract the files extension.

Solution:
A simple function that will return back you to the extension of any file with or without a full path reference preceding it is this:
function getFileExtention(str:String):String{
    return str.substring(str.lastIndexOf(".") + 1, str.length);
}
NOTE: This will not account for URLs that have GET parameters on the end of them. To do this, Google search getting file extension using regexp or regular expressions.

 I hope this helps someone who is looking for a quick solution online. Good luck.