rTraction

Viewing posts by: David Millar

Crystal Reports Images not showing up

September 24, 2009

Written by | 9 Comments



When deploying a .NET web application with Crystal Reports you will need to install the appropriate crystal reports library on the server to use any reports you’ve built.

I recently ran into an issue where Crystal Reports Images (images in a report) would not show up on a new Windows 2003 Server.  After extensive web research with no solution in sight I decided to try to solve the problem on my own.

Note:  If you’re having problems with the images in the header bar (BusinessObjects toolbar) then please see this site below:
- http://www.gutgames.com/post/Crystal-Reports2c-issues2c-and-fixes.aspx
- or simply google “toolbar images for crystal reports not showing up”

To resolve my error I went into the Web Server(IIS) manager and performed the following steps:

Image showing the configuration variables entered into new Handler1) Clicked on ‘My Website’ where I was using crystal reports
2) Clicked on ‘Handler Mappings’
3) On the right side under ‘Actions’ I selected ‘Add Managed Handler’
4) Request Path: CrystalImageHandler.aspx
5) Type: CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions…….
6) Crystal Reports Image Handler
7) Press OK
Success!


I was able to track down this issue by looking at the URL for non-working images.  All pointed to the following:
http://www.MySite/CrystalImageHandler.aspx?*****useless info******

As you can see, the system is trying to access a handler to read out images specified in the report.

I hope this solution can save you hours of potentially wasted time and frustration.


Millar GolfingDavid Millar, Lead Developer
Millar, as he is known around the office, is a rock-solid, workhorse coder. If anyone really understands what a chunk of code is doing it’s him. Family, friends, sports, and his wife are the most important things in life to him. He plays sports weekly and golf in the summer when he’s not busy hanging out with friends and family. Recently he got married to his wife Kate in a beautiful ceremony surrounded by friends and family on a perfect summer day. A humanitarian at heart, his positive demeanour is rattled most when “society makes decisions without considering more relevant information from the present”, and people “make self indulgent decisions that hurt society and everyone else”.

WSS 403 Forbidden & DCOM Errors in Eventlog

June 24, 2009

Written by | No Comments



One thing that can be frustrating for any developer is when you run into a problem and despite millions of search results when searching for a resolution nothing seems to solve the issue.  I thought I would share some simple solutions to two very frustrating WSS issues we’ve run into this past year.

The first issue is intermittent 403 Forbidden errors on a WSS (Windows Sharepoint Services) site.  We were seeing  anonymous users in our test environment who couldn’t use the website at all until an admin logged in.  After someone had logged in then anyone could use the website with or without a login.  What ended up being the problem was a permissions issue on the bin folder for the website.  To fix this problem please follow the simple steps below.

  1. Ensure all sub folders that are virtual directories on the site are using the same application pool as the root site.  (This didn’t help me as everything was set properly, however I read countless posts of this causing problems for others)
  2. Add read access on the bin folder for the account IUSR.  (You don’t need to add read access to the files, which is somewhat confusing but none the less that protects the files from being downloaded)
  3. Success!

If you have any other problems please post your questions/solutions below.

Continuing on, I also ran into a strange DCOM error popping up in Eventlog on most of our servers with WSS sites running.  The error looks like this…

The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID {61738644-F196-11D0-9953-00C04FD919C1} to the user <serverName>\networkservice SID (S-1-5-21-<serviceSID>). This security permission can be modified using the Component Services administrative tool.

Needless to say, getting this error several hundred times a day in Eventlog is not ideal.  The resolution is rather simple but not overly easy to explain.  Please carefully follow the steps below.

  1. Copy the GUID (In my case it was {61738644-F196-11D0-9953-00C04FD919C1})
  2. Open the registry editor by running regedit
  3. Click on ‘My Computer’ at the top then select Edit -> Find and Paste the Guid (remove the {})
  4. You should see an application name in the right pane when the Guid is found – in my case this was “IIS WAMREG admin service”
  5. Close the registry editor and open Component Services from Control Panel -> Administrative Tools
  6. Expand Component Services, My Computer, DCOM Config and find the application name discovered above in step #4.
  7. Right click on the the application name and select “Properties” then select the Security tab
  8. The first block should be set to Customize – select edit on the right side.
  9. Now add the service account (in my case this was network service) and add the appropriate access which in my case was “Local Activiation” (which you can see in the error above)
  10. Success!

Please share this information as both of these errors can be both frustrating and a waste of time.

Good luck and happy coding!

Howto Setup PHP (Apache, Mysql) on Windows

May 26, 2009

Written by | 3 Comments



First Grab the latest copies of the following:

Apache (MSI with OpenSSL): http://httpd.apache.org/download.cgi
PHP Windows Binary (Zip Package): http://www.php.net/downloads.php
MySql Community Engine (MSI): http://dev.mysql.com/downloads/mysql/5.1.html#win32
MySql Tools (MSI): http://dev.mysql.com/downloads/gui-tools/5.0.html

Once you’ve downloaded the latest files follow these steps below:

  1. Install Apache
    1. Network Domain: it doesn’t matter
    2. Server Name: it doesn’t matter
  2. Unzip PHP into c:\php
  3. Install MySql
  4. Install MySql Tools
  5. Create a folder c:\websites (or call it what you want)
  6. Go to My Computer -> Right Click Properties -> Advanced -> Environment Variables
    1. Select Path -> Click Edit
    2. Add a ;c:\php on the end
  7. Restart your computer!
  8. Browse to the Apache Folder (Should be in Program Files\Apache Software Foundation\Apache
    1. Go into conf and open httpd.conf
    2. Change the following and Save
      1. ServerRoot (Should be set to your Apache folder – nothing should be changed here)
      2. Listen (In the event you want your Apache WebServer to not run at localhost:80 – you can specify a specific ip/port here
      3. In the LoadModule section you might want to enable rewriter_module (not necessary!)
      4. DocumentRoot "C:\websites"
      5. <Directory "C:\websites"> <– This is about ~15lines below the document root (REQUIRED CHANGE)
      6. Under the DirectoryIndex save yourself some time and add index.php after index.html with a space separating them
  9. All Done making configuration changes to Apache
  10. Copy the index.html file in htdocs to c:\websites
  11. Click on the Apache Server Monitor in your TaskBar and restart Apache (if you have any problems check the logs folder in the Apache directory)
  12. Open your Web Browser and Browse to http://localhost – You should see ‘It Works’
    1. If this failed to work – check the settings you’ve changed (typo’s will break things) also check the error logs in the apache\logs folder (Post any problems you can’t resolve in the comments)
  13. Now that you have Apache working – lets get PHP working so you can start coding with php/mysql
  14. Rename php.ini-distribution to php.ini
  15. Open php.ini
  16. Change the following and Save
    1. max_execution_time (Suggested for development to increase to 60)
    2. max_input_time (Suggested for development to increase to 120)
    3. memory_limit (Suggested for development to increase to 256M – great for any type of video conversion)
    4. error_reporting = E_ALL & ~E_NOTICE (Un-comment this and ensure other error_reporting lines are commented
    5. display_errors = On
    6. log_errors = On
    7. session.save_path = "c:\tmp"
    8. post_max_size = 16M (Suggested for development)
    9. doc_root = (You can leave this blank)
    10. extension_dir = "c:\php\ext" (Required)
    11. upload_max_filesize = 16M (Suggested for development)
    12. Un-comment the following extensions:
      1. extension=php_curl.dll
      2. extension=php_gd2.dll
      3. extension=php_mbstring.dll
      4. extension=php_mcrypt.dll
      5. extension=php_mssql.dll
      6. extension=php_mysql.dll
      7. extension=php_openssl.dll
    13. If you have access to an SMTP server configure SMTP
  17. Re-open the httpd.conf for apache and add the following lines after the end of the LoadModule section
    1. LoadModule php5_module "C:/php/php5apache2_2.dll"
    2. AddType application/x-httpd-php .php
    3. PHPIniDir "C:/php"
  18. Restart Apache
  19. Create a file in c:\websites called test.php
  20. Put <?php phpinfo(); ?> in the file and save
  21. Access http://localhost/test.php
  22. You should see a dump of all the information – All the extensions you’ve loaded above should have a section within the information displayed (If you can’t find mysql on the page for example then the .dll did not load properly – Verify your Environment Path variable (restart if you change it) and try again)
  23. Don’t forget to look at your log files if you’re having problems – and if php says it can’t load a module that exists in a specific path then it’s likely an Environment Path issue.
  24. Happy Coding!

Gumblar.cn – Virus in the wild

May 18, 2009

Written by | No Comments



We’ve been noticing a lot of traffic related to a new virus that has been attacking users/websites recently.

The virus works to exploit your system is several distinct ways.

  1. An infected PC transmits FTP information to Gumblar.cn
  2. Gumblar.cn connects to FTP’s submitted from infected pc’s and injects code into any php/html pages it finds
  3. Any user visiting a site will have JavaScript run in their browser that does the following:
    1. Loads obfuscated JavaScript to connects to gumblar.cn if your running windows and not infected
    2. This in turn loads a nice piece of JavaScript that will load an SWF file
    3. This SWF file is the virus payload – it contains a byteArray that will inject a virus onto the computer (I believe it’s another SWF file being loaded as the byteArray)
  4. If this computer is running windows and has flash it will become infected
  5. See Step #1

The JavaScript code you’re looking for will look something like this:

One thing to note in the above code is the words gumblar in plain text.

When it comes to cleaning your webhost up you should take the following steps.

  1. Take your website down (turn the web server off – stop infecting your users)
  2. Remove the FTP information from your PC
  3. Change the FTP username/password on your webhost
  4. Look for new files created (image.php, etc…) that shouldn’t be there
  5. Now that you’ve removed the backdoor & changed the password you need to perform cleanup
  6. Find any PHP or HTML pages injected with the virus code and remove it

Once you’ve done this – everything should start getting back to normal.

There have been some useful scripts posted in the comments about this virus at blog.unmaskparasites.com.

If you’ve had any success or troubles with this virus please post your comments below.

If anyone knows of an easy way to convert a byteArray that’s being passed to an ActionScript Loader back into readable text please leave me a comment below.

Good Luck!

Konami Code – Cheat Code – Easter Egg

May 15, 2009

Written by | 1 Comment



Have you ever thought about adding a Easter Egg to your website?

Using a Cheat Code such as the Konami Code you can now easily add one to your website using jQuery and the plugin that Trevor Morris developed.  Get the plugin here.

The code is simple and easy to follow.  Here’s a snippet to demonstrate how simple it is to perform a basic javascript action.

	$(document).ready(function() {
		$(document).cheatCode({
			code : '38,38,40,40,37,39,37,39,66,65',
			activated : function(){
				alert('Hidden');
			}
		});
	});

Don’t forget you’ll need to grab a copy of jQuery if you don’t already have it loaded up!

Please let us know if you like our Easter Egg.