Web Colors Previewer v2.0
Well, the old tool didn't have many features, the new one displays rows of colors with different characteristics from the original. click on the image and enjoy!
KPL Variables
KPL variables resemble PHP variables in the sense that they are loosely typed and don't have to be declared. For those new to programming, this means that you don't have to declare that the variable is an integer or a text string.
Naming
Variable names must start with an alphabetic character followed by any alpha-numeric combination, underscores are allowed but any other non alpha-numeric character is forbidden. These are some Examples of correct variable names:
- myVar
- MyVar
- myVar123
- myVar_123
Making WPF CheckBox and RadioButton display correctly in Windows classic theme
When developing a wpf app for work I ran into a display problem for the CheckBox and RadioButton. Most of our office computers still use windows XP with the classic theme and even the new Windows 7 computers are set to use the classic theme as well.
Originally, I wrote my RadioButton and CheckBox like so
Name="radioButton1" GroupName="someGroup" Content="Option 1" />
<RadioButton Style="{StaticResource myRadio}"
As you can see the "Content" part is what determined my label for the defined RadioButton, and here is where the problem is. I am not sure why but the Classic theme in windows can't render this properly causing the entire control to be inaccessible.
To fix this problem we need to remove "content" and link a label to the control. This is quite simple to do as you can see as follows:
<RadioButton Style="{StaticResource myRadio}" GroupName="someGroup" Name="radioButton1">
<Label>Option 1</Label>
</RadioButton>
I would like to know more why this is a problem on the classic theme but right now this workaround works great across all OS's and themes
cmds files in DP2 – creating a simple order
If you want to get your feet wet with KPL, cmds files are the easiest way to get started. Cmds stands for commands, there are many uses for these files but the most important in my opinion is the import of photo orders from other applications. To be able to use cmds files we first we need to enable a hot folder in DP2, the steps are as follows:
- On the User Tasks Menu Click on categories under you see the menu option Import
- Click Import and look for Commands
- Click Commands
- A new window opens, select a directory (preferably one that is easy accessible for your application)
- click Start
What is KPL and how it relates to DP2?
KPL (Kodak Professional Language) is the underlying language that drives the DP2 Photo Lab production software. It is based on the C programming language family and it allows developers access to a lot of C methods and windows API's. The language has been greatly expanded from it's C roots to include features that are tailored to the photo production world.
The best way to understand this is to imagine DP2 as being a Runtime Environment in which KPL is Executed. The entire DP2 User interface and Underpinnings are implemented using KPL. Since KPL is an interpreted language, changes to DP2 do not require recompiling and can be done pretty much live. Even thought documentation is limited, the fact that you can see all the code that is used to do everything in DP2, makes it easy to learn what does what. DP2 has a very powerful Programmer's Assistant tool and Debugger. There is also integration with Notepad++ for syntax highlighting also integration with the plugging snippets plus adds snippets and auto completion.
DP2 is a database driven application so naturally KPL has amazing tools for reading and writing data to the database. For what I have seen KPL is an Object Oriented Language, there is a long list of classes but most of the scripting that a user will be doing is based on the use of functions.
There is a great number of built-in functions for managing orders, images, packages and other production related work. Also, since Version 14 there is a very powerful Hooks system to alter the interface without having to change core DP2 files, this is a great way to avoid having your code being wiped out when a new version is installed.
There is a lot more to be said about KPL and DP2, you can create UIs using Html, JS and CSS, there is a built in Web server for receiving commands and there is also way to insert KPL scripts from other applications through the use of a hotfolder. There is robust printer integration, great queue management and print job organization. I will be talking more about this things on future articles as I work and discover more on the matter.
It is also important to note that the programming team at Kodak is filled with great, helpful people that will answer most of your questions almost immediately over email. And most of the changes in DP2 are driven by customer feedback.
Why I chose Silverlight over Flash for my FTP client
UPDATE: I have been having issues with silverlight sockets so this project hasn't been finished. If anyone had any luck with something like this please share your experience. Thanks
I made this File uploader that connects to an FTP server to upload customer files. My first instinct was to use flash and action script. The project went smoothly and development was rather easy, I was impressed by the simplicity of the Actionscript sockets. It turns out all that simplicity came at a price, just a few hours after deployment some users could not upload files, the app would hang and crash some browsers.
After a few minutes of researching I discovered that the files that caused this problem were large files. The size of the file that caused the problem was dependent on the system, older systems with small memory would crash with files that were 200MB while others could handle 1GB files.
as it turns out my problem was that Flash could not load a file partially. you pretty much have to load the entire file to memory to send it with a socket. then there is the problem that flash doesn't support any sort of bytesSent property of progress event handler.
While .net sockets don't support progress event handlers they do provide with the bytesSent property. also FileStream allows for the partial loading of a file. All this translates to two thing:
- I can read a file piece by peace, so now i can send 1GB files from any system.
- Since i can read a partial file I can now resume an interrupted upload.
Silverlight Sockets are harder to implement thought, since all receives and sends are asynchronous any method that updates the interface needs to be implemented as a delegate. You also need to keep track of the order in which messages arrive. A simple way is to block the application and make it wait for an eventComplete from the socket using and Autoevent.
So in conclusion I ended up using Silverlight for my FTP Client because of the flexibility that FileStream provided and even thought Sockets in Silverlight are more difficult to implement, now I have a more robust application for my customers.
P.S one bit of advise is that if you must receive and send messages at the same time in the same socket, use two socketEventArgs, one for sending and one for receiving
Using Public Keys With Putty to Connect to WHM running on Linux
So the other day I wanted to set up SSH with public keys through putty so I could connect to WHM. While i did find the instructions on how to do it they were lacking a lot of information after a lot of google I was able to figure it out. So I figured The findings should be shared with everyone. Here is a step by step guide that should make someone's life a little easier:
Part A - Setting up your Public Keys
Sorting characters and numbers in mySQL
So I have a table with a column in this form
| someColumn |
|---|
| 1 |
| A |
| 2 |
| C |
| 3 |
| 10 |
When you ORDER BY someColumn you get result in this order 1,10,2,3,A,C
as you can see the number sequence is all messed up, 10 doesn't go after 1
to fix that you can do ORDER BY (someColum + 0) to convert the sequence to integers
but that leaves the characters out of order now. The characters get sorted by creation date
this is a very inconvenient problem.
To keep this short this is the solution
SELECT someColum as sort, someColumn, otherColums... WHERE someOther = 'somevalue' ORDER BY sort ASC, (someColumn +0)ASC
by Adding a sort column using 'someColum' we can now perform two sorting operations on the same Column first by chars then by converting 'someColum' to integerss. This will return an output like this 1,2,3,10,A,C. If you swap the ' ORDER BY sort ASC, (someColumn +0) ASC' to' ORDER BY (someColumn +0) ASC ,sort ASC', now you get the Characters first A,C,1,2,3,10. You can also change the order to Descending by using DESC.
Adding the Authorize.net PHP SDK to CodeIgniter 2.0
This is a follow up post to my initial Adding the Authorize.net PHP SDK to CodeIgniter 1.7. Now that CI 2.0 is out the plugins are long gone.
So after a couple of minuted fiddling with this, I managed to get the Authorize.net API working as a library in CI
Here is what you need to do :
- Step 1 – You need to download the PHP SDK from Authorize.net, you can get it here
- Step 2 – Copy the AuthorizeNet.php file and the lib folder into your copy of CI’s application/libraries folder
- Step 3 – Rename the file AuthorizeNet.php to Authorizenet.php
- Step 4- Add this to code to Authorizenet.php
ddlab.net Website launch
Just finished and published this website at work I think it looks pretty good ddlab.net 
