Posting so I can find this easily next time, maybe even I'll remember typing this up.
With Railo (4.2+) and MySQL, I used a generated password that contained a percent sign (%) in the value. For example:
thisIsA%Password%Sample
The problem is that Railo attempts to use "URL decoding" on it, like converting %20 to a space, as you've likely seen before.
After a search online, I ran across this StackOverflow article. To sum it up, you need to pre-escape the % sign for yourself, if you're unable to change the password for some reason.
The above password becomes this now:
thisIsA%25Password%25Sample
Pretty simple, but a tricky item to encounter.
- Will Belden
June 10, 2014
I tend to focus on development topics of late. Specifically ColdFusion/Railo, Coldbox Framework, SQL Server and Eclipse.
Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts
Tuesday, June 10, 2014
Wednesday, April 16, 2014
IIS 7, Railo and Rewrite Rules (SES)
I recently added the "suggested" SES rewrite rules for my Coldbox app. I use IIS7 along with Railo Tomcat. After the rewrite rules were added to my web.config file and uploaded, my Railo admin became (keywords coming:) ugly, unusuable, missing CSS, no style, missing images...just horrible!
You're a developer. You've been searching for a while. (Because you didn't find this post sooner.) You are struggling with getting the Railo Admininistrator screen to look like it ought to. Everyone says "Oh...sorry, we don't use IIS." Or those that do say "Oh...sorry, we use Helicon Rewrite engine." Or even better: "Windows? Sorry, man..."
I stumbled on a post finally after getting some community attempts at helping, but no real answer. I don't have the link to the post handy, but at the end of the discussion, the fella said "Okay, well, I'll go back to using Path_Info." For me, this was for Coldbox and Railo on IIS. Perhaps you're using CFWheels or another framework where the SES requires rewrite rules.
The rule I had found initially used SCRIPT_NAME. Not sure if that's an IIS vs. Railo vs. Tomcat problem, but I gave it shot. It worked! No more ugly Railo admin screens. I could actually see what I was doing in there! (When it doesn't work, and tries to rewrite the Railo links, you might be butchering your error logs for your app, as well as confusing your IIS log files, I'm sure.)
Here's my current rule from my web.config. (Or you can adapt it for the visual interface in the IIS admin, if you need to.)
<rule name="Application Administration" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll">
<add input="{PATH_INFO}" pattern="^/(.*(CFIDE|cfide|CFFormGateway|jrunscripts|railo-context|fckeditor|ckeditor)).*$" ignoreCase="true" />
</conditions>
<action type="None" />
</rule>
- Will Belden
April 16, 2014
You're a developer. You've been searching for a while. (Because you didn't find this post sooner.) You are struggling with getting the Railo Admininistrator screen to look like it ought to. Everyone says "Oh...sorry, we don't use IIS." Or those that do say "Oh...sorry, we use Helicon Rewrite engine." Or even better: "Windows? Sorry, man..."
I stumbled on a post finally after getting some community attempts at helping, but no real answer. I don't have the link to the post handy, but at the end of the discussion, the fella said "Okay, well, I'll go back to using Path_Info." For me, this was for Coldbox and Railo on IIS. Perhaps you're using CFWheels or another framework where the SES requires rewrite rules.
The rule I had found initially used SCRIPT_NAME. Not sure if that's an IIS vs. Railo vs. Tomcat problem, but I gave it shot. It worked! No more ugly Railo admin screens. I could actually see what I was doing in there! (When it doesn't work, and tries to rewrite the Railo links, you might be butchering your error logs for your app, as well as confusing your IIS log files, I'm sure.)
Here's my current rule from my web.config. (Or you can adapt it for the visual interface in the IIS admin, if you need to.)
<rule name="Application Administration" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll">
<add input="{PATH_INFO}" pattern="^/(.*(CFIDE|cfide|CFFormGateway|jrunscripts|railo-context|fckeditor|ckeditor)).*$" ignoreCase="true" />
</conditions>
<action type="None" />
</rule>
Rules you may have found previously may use SCRIPT_NAME. Try swapping it out. Hope you found this and it solved your problem in 5 minutes instead of the week I've been needing an answer.
- Will Belden
April 16, 2014
Monday, April 14, 2014
Coldfusion 8 and Decrypt function
Found an interesting item today in Coldfusion.
Apparently decrypt() in Coldfusion (8, at least) can apparently figure out when you intentionally change an encrypted value and still decrypt it.
Apparently decrypt() in Coldfusion (8, at least) can apparently figure out when you intentionally change an encrypted value and still decrypt it.
Sublime - Key Binding for Toggle Word Wrap
Tired of choosing the View menu, then Word Wrap? Are you a keyboard person, not a mouse person?
This will save you a little bit of time. Add this key binding line to your "Key Bindings - User" to eliminate the new for mouse work.
{ "keys": ["ctrl+shift+w"], "command": "toggle_setting", "args": {"setting": "word_wrap"}}
You can certainly change the key combination to your liking.
For me, this is actually replacing the "close window" default binding. I can hit ALT+F to bring up the file menu and then "x" to Exit the application just fine. (Been doing that for years.) Or even ALT+F4. Or CTRL+W repeatedly (closes files, then the the application when there are no more open documents.) I simply don't need yet another "exit the application" keyboard shortcut.
- Will Belden
April 14, 2014
This will save you a little bit of time. Add this key binding line to your "Key Bindings - User" to eliminate the new for mouse work.
{ "keys": ["ctrl+shift+w"], "command": "toggle_setting", "args": {"setting": "word_wrap"}}
You can certainly change the key combination to your liking.
For me, this is actually replacing the "close window" default binding. I can hit ALT+F to bring up the file menu and then "x" to Exit the application just fine. (Been doing that for years.) Or even ALT+F4. Or CTRL+W repeatedly (closes files, then the the application when there are no more open documents.) I simply don't need yet another "exit the application" keyboard shortcut.
- Will Belden
April 14, 2014
Friday, March 28, 2014
Sublime - Correcting your common misspellings automatically
In the past 8 months or so that I've been using Sublime (version 2, as of this writing v3 is still in Beta), I have found it to be the best coding editor I have ever used. I was a die-hard UltraEdit fan, but after trying Sublime, I haven't gone back to UltraEdit at all.
Enough with the fanboy raving, now to the meat of this post...
In our coding we use the "local" scope quite a bit. I have a horrible habit I can't break myself of: I type "lcoal", not "local", constantly. Sometimes I catch it, most often the compiler does instead! So I set out to solve it.
In Sublime, keyboard shortcuts aren't just ctrl+shift+x, they can be series of key combinations, like ctrl+k, ctrl+b to toggle the visibility of the file navigator on the left of the screen. Sublime also supports macros, which are pre-recorded actions, such as typing. Here's what you can do.
- First, record a macro of what you WANT to type. To start recording a macro, choose "Record a macro" from the Tools menu or hit ctrl+q.
- Next, type the correct word you want to appear. In my case, I typed out the letters l-o-c-a-l-(period). (I only wanted this to kick in when I typed "lcoal.", with the dot.)
- Now, stop recording the macro with Tools...Stop Recording Macro or shift+ctrl+k.
- The next step is to save the macro, also available from the Tools menu. In my case, I saved it as "type-local.sublime-macro" in the folder Sublime suggests, the Packages/User folder.
- Now, open your Key Bindings. From the Preferences menu, choose "Keybindings - User".
- Now, add an entry like so:
, { "keys": ["l","c","o","a","l","."], "command": "run_macro_file", "args": {"file": "Packages/User/type-local.sublime-macro"} }
You'll notice that the keys value is a JSON array of keys, in order, that I always type incorrectly. This is the incorrect order. I want this misspelling to trigger the macro that types it correctly. - If you don't get the JSON format right (watch your commas and closing brackets and braces), Sublime will tell you and not let you save the file until you correct it.
It's important to note that the keys in the key combination array above are replaced with whatever actually happens. It took me three times to wonder why my recorded macro of hitting backspace 6 times turned "" into "". I was actually backspacing over the "cfset" portion of my text. The key combination is just a trigger and after recognition by Sublime is no longer considered as text you've added to the file.
Enjoy, hope this works out for you!
Acknowledgement: After much Googling for the right information, this post kind of got me on track, though it doesn't discuss macros specifically. I needed it to be transparent and not slow down my work. The use of key bindings combined with macros accomplished it perfectly.
Tuesday, March 25, 2008
Eclipse and getting .htm and .html files to open in CFEclipse...
I've been working lately with a lot of HTML files that primary templates, read in by ColdFusion and Java for processing. I love CFEclipse, with it's great color coding making my files easier to read and scan.
However, with my current "company-provided" Eclipse setup, .htm* files opened in the regular text editor. I finally figured out how to change it, instead of right clicking on each file in the navigator and selecting "Open With...CFML Editor".
Select the Window menu, then choose Preferences. Under General, Editors select File Associations. Then, scroll down in the list to .htm and .html. Click on the first, ".htm". In the bottom section, called "Associated Editors", depending on your configuration, you might see multiple options. These, apparently, are the choices you have when you right click the specific file. But highlight "CFML Editor", then click the "Default" button to the right. Do this again for .html in the top list, and you'll be set!
- Will Belden
Tuesday, April 25, 2008
However, with my current "company-provided" Eclipse setup, .htm* files opened in the regular text editor. I finally figured out how to change it, instead of right clicking on each file in the navigator and selecting "Open With...CFML Editor".
Select the Window menu, then choose Preferences. Under General, Editors select File Associations. Then, scroll down in the list to .htm and .html. Click on the first, ".htm". In the bottom section, called "Associated Editors", depending on your configuration, you might see multiple options. These, apparently, are the choices you have when you right click the specific file. But highlight "CFML Editor", then click the "Default" button to the right. Do this again for .html in the top list, and you'll be set!
- Will Belden
Tuesday, April 25, 2008
Friday, December 28, 2007
SQL, WHERE clause vs. JOIN clause conditions...
Today I found that there's a difference between the a condition in the WHERE clause and in the JOIN clause in a SQL Statement. Now, I realize there really isn't a difference, but in this case...it made all the difference.
Here's an approximation of the original SQL:
SELECT A.id_a, B.id_B
FROM apple A
LEFT JOIN banana B ON B.id_a = A.id_a
WHERE GetDate() BETWEEN B.start_date AND B.end_date
The idea here is to obviously only get the records where the current date falls in the range provided by the Banana table record. This worked great in all my scenarios where I had a Banana record. When I went to try it on a set of Apple records that did not have corresponding Banana record, I got no results at all.
So I took the WHERE clause (or the line containing the date check) and placed it on the LEFT JOIN clause, like so:
SELECT A.id_a, B.id_B
FROM apple A
LEFT JOIN banana B ON B.id_a = A.id_a AND GetDate() BETWEEN B.start_date AND B.end_date
Now it only applies to excluding out of range records in the JOIN only, rather than applying to the result set as a whole. In the initial flavor of the SQL statement, the date comparison would be made against two NULL values for the date fields. The Banana record requires those date values if it exists, but I want Apple records even if there is no corresponding Banana record, and do no date comparison at all. Only exclude the Banana record if the dates are out of range.
Just a gotcha to keep an eye out for!
- Will Belden
Friday, December 28, 2007
Here's an approximation of the original SQL:
SELECT A.id_a, B.id_B
FROM apple A
LEFT JOIN banana B ON B.id_a = A.id_a
WHERE GetDate() BETWEEN B.start_date AND B.end_date
The idea here is to obviously only get the records where the current date falls in the range provided by the Banana table record. This worked great in all my scenarios where I had a Banana record. When I went to try it on a set of Apple records that did not have corresponding Banana record, I got no results at all.
So I took the WHERE clause (or the line containing the date check) and placed it on the LEFT JOIN clause, like so:
SELECT A.id_a, B.id_B
FROM apple A
LEFT JOIN banana B ON B.id_a = A.id_a AND GetDate() BETWEEN B.start_date AND B.end_date
Now it only applies to excluding out of range records in the JOIN only, rather than applying to the result set as a whole. In the initial flavor of the SQL statement, the date comparison would be made against two NULL values for the date fields. The Banana record requires those date values if it exists, but I want Apple records even if there is no corresponding Banana record, and do no date comparison at all. Only exclude the Banana record if the dates are out of range.
Just a gotcha to keep an eye out for!
- Will Belden
Friday, December 28, 2007
Subscribe to:
Posts (Atom)