Monday, December 13, 2010

Flash Debug Player In Google Chrome

After reading other blogs and pages online about this, I decided better instructions were needed.

Problem:
Getting Google Chrome to use the debug Flash Player wasn't working.

More Info:
Google Chrome began auto-updating the Flash plugin automatically since each update is generally a security patch of some sort.

Solution:
To get Flash Debug Player to work, do the following:

Download and install the Flash Debug Player for Netscape based browser (like FireFox and Chrome): http://www.adobe.com/support/flashplayer/downloads.html

Navigate to your chrome plugins page by entering the following url: about:plugins

Click the Details link in the top right corner. This will give you more information about each plugin.

Now you need to search for the Plugins related to Flash Player and disable the one located in the Chrome folder. (If your on Windows XP, it may have a path like this: C:\Documents and Settings\user_name\Local Settings\Application Data\Google\Chrome\Application\8.0.552.224\gcswf32.dll

Once you have disabled this, the other plugin (the debug player) should now be handling all your Flash Files.

Best of Luck

Wednesday, October 6, 2010

UnoException during conversion: URP_Bridge : disposed

Problem:

While trying to run unoconv, the process would be aborted and the following error would print out.

UnoException during conversion: URP_Bridge : disposed

Solution:
In my particular case, the server was running out of memory and therefore could not finish the process.

Hope this will help someone out who had the same problem.

Monday, August 30, 2010

Passing Shipping Info to Paypal Pro with API call doDirectPayment on OpenCart

Problem:
A client of mine wanted to use OpenCart for a shopping cart website and was using PayPal pro to handle the e-commerce. The problem was that the only information OpenCart passed to PayPal was the information needed to process the credit card. This makes sense if you are handling all your shipping things in OpenCart, however in my clients situation, they needed someone else on PayPal to be able to see the shipping information for fulfilling the orders.

Solution:
The PHP file handling the connection to PalPay was only passing some of the data, not all of it. If you look at the file: root/catalog/controller/payment/pp_pro.php, you will see a PHP associative array handling all the data that will be passed to PayPal. (Note: an associative array is where you can hold a lot of data in one container and by using what are called key/value pairs. For instance a key might be something like shoe_size and the value may be something like 12 written in PHP with key => value). I looked into the object holding on the user data and found that just like payment_*** you can use shipping_***. So my setup ended up looking similar to this:

$payment_data = array(
            'METHOD'         => 'DoDirectPayment',
            'VERSION'        => '51.0',
            'USER'           => html_entity_decode($this->config->get('pp_pro_username'), ENT_QUOTES, 'UTF-8'),
            'PWD'            => html_entity_decode($this->config->get('pp_pro_password'), ENT_QUOTES, 'UTF-8'),
            'SIGNATURE'      => html_entity_decode($this->config->get('pp_pro_signature'), ENT_QUOTES, 'UTF-8'),
            'CUSTREF'        => $order_info['order_id'],
            'PAYMENTACTION'  => $payment_type,
            'AMT'            => $this->currency->format($order_info['total'], $order_info['currency'], $order_info['value'], FALSE),
            'CREDITCARDTYPE' => $this->request->post['cc_type'],
            'ACCT'           => str_replace(' ', '', $this->request->post['cc_number']),
            'CARDSTART'      => $this->request->post['cc_start_date_month'] . $this->request->post['cc_start_date_year'],
            'EXPDATE'        => $this->request->post['cc_expire_date_month'] . $this->request->post['cc_expire_date_year'],
            'CVV2'           => $this->request->post['cc_cvv2'],
            'CARDISSUE'      => $this->request->post['cc_issue'],
            'FIRSTNAME'      => $order_info['payment_firstname'],
            'LASTNAME'       => $order_info['payment_lastname'],
            'EMAIL'          => $order_info['email'],
            'PHONENUM'       => $order_info['telephone'],
            'IPADDRESS'      => $this->request->server['REMOTE_ADDR'],
            'STREET'         => $order_info['payment_address_1'],
            'CITY'           => $order_info['payment_city'],
            'STATE'          => ($order_info['payment_iso_code_2'] != 'US') ? $order_info['payment_zone'] : $order_info['payment_zone_code'],
            'ZIP'            => $order_info['payment_postcode'],
            'COUNTRYCODE'    => $order_info['payment_iso_code_2'],
            'CURRENCYCODE'   => $order_info['currency'],
            'DESC'            => 'items being ordered - 127 char limit',
            'SHIPTONAME'     => $order_info['shipping_firstname'] . $order_info['shipping_lastname'],
            'SHIPTOSTREET'     => $order_info['shipping_address_1'],
            'SHIPTOCITY'     => $order_info['shipping_city'],
            'SHIPTOSTATE'     => ($order_info['shipping_iso_code_2'] != 'US') ? $order_info['shipping_zone'] : $order_info['shipping_zone_code'],
            'SHIPTOZIP'         => $order_info['shipping_postcode'],
            'SHIPTOCOUNTRY'     => $order_info['shipping_iso_code_2'],
            'SHIPTOPHONENUM' => $order_info['telephone']
);
Hopefully this will help out some who have had issues with this.

Wednesday, August 25, 2010

Symfony 1.4 - crashing when loading large fixture files

Problem:
I have been trying to load a large fixture file in Symfony but everytime I went to load the fixture using doctrine:load-data, Symfony would crash. I looked at the mySQL tables and found that Symfony had in fact finished loading the fixture, but for some reason had become non-responsive.

Solution:
To allow symfony to load the fixture (whether it crashes due to system resources like PHP memory or an issue with PHP itself), I found that I can control the loading of the fixture by following these simple steps.

  1. Split the fixture into several files (While keeping your table reference in each one)
  2. Load each fixture file 1 at a time (this can be accomplished using doctrine:data-load --append rel/path/to/fixture)
  3. check your tables to ensure data is still being loaded, if you find it has stalled more a good amount of time and nothing has been loaded, you will probably want to look into killing the PHP process (something I wont explain here) and doing some more fixture break downs.
Hopefully this will help some of you who have had the same issue I have been having.

Tuesday, August 24, 2010

Control Loading Order / Sequence of Fixtures in Symfony 1.4

Problem:

I want to split my fixtures into separate files in the fixtures directory but when I try to load the data, I get constraint errors.

Solution:
Symfony has a solution for determining the sequence it should use to load fixtures, that is by placing a number in from of the original file name. I use 1_filename.yml.

Good luck programming.

Friday, August 20, 2010

Apply Smoothing to Video in Spark VideoPlayer or VideoDisplay Component

Problem:
I want to allow smoothing on the video that is being played by a Spark VideoPlayer or VideoDisplay component but those components don't have a property for this.

Solution:
To smooth a video being played by one of these components, you have to access the video object once it is loaded. These components do not provide a smoothing option directly. To determine when a video has loaded, we will detect a state change on the component itself by adding a MediaPlayerStateChangeEvent listener.

MXML:
<s:VideoDisplay id="vid_player" top="0" left="0" right="0" bottom="0" source="video.flv"  mediaPlayerStateChange="checkState(event)" />

AS3 (MXML Alternative) - attach the listener with AS3:
vid_player.addEventListener(MediaPlayerStateChangeEvent.MEDIA_PLAYER_STATE_CHANGE, checkState)

The checkState method will do more to check is the video has successfully loaded.

AS3 - checkState Method:
import org.osmf.events.MediaPlayerStateChangeEvent;
private function checkState(e:MediaPlayerStateChangeEvent):void{
    if(e.state == "playing") 
        vid_player.videoObject.smoothing = true;
}

 If you try to access the videoObject before the "playing" state, you will get a null reference.

Please let me know if you come across any questions with this code.

Tuesday, July 27, 2010

The name of this class conflicts with the name of another class that was loaded.

Generally I try to avoid dead dreadful programming languages and if you've ever programmed in ActionScript 2.0, you can see why. Among all the problems that come with programming in AS2.0, there is one that seems to cause quite a stir among developers. The 'conflicts with the name of another class' error popups up out of no where and ruins your day. If your on a time critical project, this error alone may be enough to inspire you to quit your job. However, don't submit your 2 weeks notice yet. There may be a couple more things you can try.

Problem:
When trying to compile ActionScript 2.0 code, the error The name of this class, 'ClassName', conflicts with the name of another class that was loaded, 'ClassName'. popups up out of nowhere.

More Information:
Flash likes to make it's job easier when compiling AS2.0 code and chooses to cache compiled byte code for classes you have written. If these classes appear not to change between compiles, then you may just find yourself getting the error mentioned above. The way that Flash determines if something has been changed in your class is by looking at the time stamp on the file. If you have classes on a server with an incorrect time, then your server might be assisting in this problem.

Solution:
To fix this problem we need to look at several things. First we need to make sure the time stamp of the classes being loaded in now later (in the future) than the current time noted on your local machine's clock. If you have had problems with the conflicts error, you will most likely need to clear the ASO files before your next compile. The Flash IDE provides a quick way to delete ASO files and test your movie (listed under the Control menu).

Hopefully this helps others to not have to suffer (as much as can be helped with programming AS2.0) as we have. Good luck.

Friday, July 2, 2010

Mysterious Lines Around Images in Word 2007

Problem:  My wife was creating signs for work in Microsoft Word 2007 and each time she added a logo, there would be a mysterious gray line on the left and top of the image. We looked for cropping errors and tried changing the logo.  Nothing seemed to work to get rid of the lines until we decided to change the image size.

Solution:  The original logo was 406 x 344 and we reduced size to190 x 170.  This reduction seemed to fix the problem and there were no more mysterious lines.

Tuesday, June 29, 2010

Copying text to Clipboard using JavaScript

While developing a while back I needed a way to use programming to copy text to a user's clipboard without using Flash (recent versions of Flash restrict this anyway). The solution was pretty easy and handled by JavaScript.

Problem: Needed to copy text to clipboard in Chrome without using Flash and when a user clicked a link. Chrome (and most likely other browsers) restrict this copying to prevent malicious activity. While this is helpful to user's it can also be unhelpful to programmers.

Solution: To accomplish this I started out testing what could be copied and found that only text inside a form input control could be copied using execCommand. This helped me to understand that my first objective was to create a form input and copy the text inside it. Once I was able to do this, I decided to create the input field with JavaScript, then set the value of it with JavaScript, then run my execCommand function. This worked. The last thing I needed to do was to hide the form input control so that the user didn't see it popup every time they copied something. Using CSS I was able to make the form input mostly unnoticeable. CSS is not required for the solution to work, but helped to make things less noticeable.

When all was said and done, my script works fine in Chrome. I will test it in other browsers and see how it performs.

Note: Making a form input hidden with CSS will prevent JavaScript from selecting it to add it to the clipboard. As you will notice in my solution, I always kept the input visible. My code is shown using jQuery but can be easily done without it.

Code: 
$("<input />") // Create the element
      .attr('id','custom_input') // this may be unnecessarily -- the CSS below helps to hide the input
      .css({width:'1px', height:'1px', border:'none', backgroundColor:'#FFF', 'position':'absolute'})
      .prependTo($(t).parent()) // in my case this is document root -- this may
      .val($('#element_id').html())
      .focus()
      .select();

document.execCommand("copy", false, null);

If you have questions regarding implementing this code or non-jQuery versions, do let me know.

Best of luck.

Wednesday, June 16, 2010

Symfony 1.4 uploads FLV as EXE or BIN files

When transferring a project from our development server to our production server at work, I realized that uploading FLV files resulted in the end result being a .BIN (or binary file). Oddly this didn't happen on the development server, only the production server. After verifying everything I could think of between the two servers, I finally decided on a solution.

Problem: 
Symfony uploading FLV files as BIN files (or sometimes EXE on Windows).

More Information:
Symfony has a big associated array of mime-types and file extensions, one that specifies 'application/octet-stream' as being associated with the file type BIN.

Solution:
I tried manually changing the sfValidatedFile.class.php file in lib/vendor/symfony/lib/validator/ but it didn't help. To solve this problem, I ended up manually checking the file's extension before and after upload and then correcting it if it was wrong. If I come up with a better solution, I will definitely post my findings.

Good luck.

Friday, April 23, 2010

ll equivalent in Debian Linux

Problem:
Want to see files with sizes and permissions on debian linux like you can with RH (Red Hat) linux distros.

More Info:
ll is an alias for the file structure listing command ls.

Solution:
View files, file sizes, and permissions on debian ls -hal.

Sunday, April 18, 2010

Fixing the CW Player

Problem:
My wife and I enjoy watching shows on the CW TV but have recently found that we began being greeted with the player showing a screen saying it was updating the player.

Tech Talk: The player they use is called the Move Media Player. It is a program that you have to have specifically installed on your computer to play video content from CW site as well as many other websites. It does have some tracking software that helps them track you across several websites, but doesn't expose your personal information or data.

 Solution:
After trying many different scenerios with several browsers and uninstalling reinstalling the Move Media Player found in the installed programs list on Window Vista or XP. I was finally able to diagnose some of the problem and figure out a solution. Uninstall the Move Media Player from your computer (Start -> Control Panel->Uninstall a program [on Windows Vista/ similar on Windows XP]). Once you have removed the Move Media Player, use Internet Explorer and navigate to your shows web page. When the place where video normally shows gives you the option to download and install the Move Media Player, do so. Complete the installation. You shouldn't have to do anything at that point other than wait.

More Information: Google Chrome is not said to be supported at this time, so it most likely wont help you resolve this problem. I originally tried to use Firefox to reinstall the Move Media Player, but continued to trace an error. Firefox did work however when I retried it later. If you have specific questions about this issue, feel free to leave a comment and I will help you the best I can.

Happy television watching.

Friday, March 26, 2010

Flash Builder 4 / Flex 4 - Where did the icon property go?

Problem:

In previous versions of Flex (when using Halo), it was simple to add an icon to a button. But now with the Spark theming, there is no such convenience. I went in search of a solution online and after much digging where others had written custom components and so on, I found a solution posted by Adobe and its incredibly simple.

Solution:
Just create a new theme extending the Spark button skin, and then make two line replacements. Instead of me reexplaining it, just read it on Adobe's website.

http://help.adobe.com/en_US/Flex/4.0/UsingSDK/WS2db454920e96a9e51e63e3d11c0bf69084-7d9f.html

Good luck.

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.