Curse you, SquirrelSQL! I KNOW that my connection string is Correct!!!!

No Comments »

Found a little gotcha.

If you go to your friend Mr Google to get JDBC connection string information to establich a connection in SquirrelSQL client, and after pasting the helpful information into the SquirrelSQL Aliases dialog, you receive the message “XYZ property is invalid” when you know it’s perfectly fine….

… re-type the entire connection string manually (no copy-paste).

Sometimes, the paste brings in characters in Unicode format in such a way that the application or the driver do not like.

It only took me ten minutes to figure that one out, thank goodness.  It was maddening.

Bonus tip: The JTDS driver’s JDBC connection string to use Windows Authentication in an environment with Active Directory Services is jdbc:jtds:sqlserver://SERVER:PORT/DATABASE_NAME;useNTLMv2=tru‌​e;domain=MYDOMAIN


Downgrade an Eclipse WTP Dynamic Web Project

No Comments »

So in part of my work I have to deal with a super-slow CVS server, and a module that takes 1.5 hours (or more) to checkout, update, sync, etc.

I had to check out the project into Eclipse WTP as a new Dynamic Web Project. I figured out *after* I completed the checkout, that I’d defined the project as a Servlet-Spec 3.0 project rather than 2.5. Oops.

(The symptoms: There were Java compiler problems saying that HttpServletRequest could not be found. It’s a clue that the Target Runtime was not set. When I I tried to set it an Apache Tomcat 6 server I’d set up, it was not presented as an option. I switched to Server and went to Add/Remove modules… and selected my project, and I saw a message saying that the Tomcat 6 could not handle the project version. Thus the inspection of the facets to see which Servlet Spec I’d selected.)

But that shouldn’t be a problem. Just bring up the Project’s properties, go to Project Facets, select Dyanimic Web Project, and change the version to 2.4, right? Nope. I get a helpful message saying “Cannot change the version of project facet Dynamic Web Project to 2.5.”

Oh bother. I sure don’t want to create a new project, because then I’d have to deal with the doc of a CVS system. Let’s try a hack…

Shut down eclipse. Open a command-line window. Go to the project’s folder. Then go into the .settings/ folder, and edit the file org.eclipse.wst.common.project.facet.core.xml

It’s contents:


<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
    <fixed facet="wst.jsdt.web"/>
    <fixed facet="java"/>
    <fixed facet="jst.web"/>
    <installed facet="java" version="1.6"/>
    <installed facet="jst.web" version="3.0"/>
    <installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>

From there, just change the jst.web version to 2.5 from 3.0. Save the file. Start Eclipse back up…. wait as it rebuilds the workspace…. go to the Project Facets properties… And now i have a full list of available facets, all unselected. Change Dynamic Web Project to 2.5 and select it. Change Java to 1.6 and select it. Select JavaScript (version 1.0). For each of these, right-click, and choose “Lock.”

I also clicked the Runtime tab and selected my desired server. Clicked Apply and closed the properties dialog. Check the settings file (from above)


$ cat org.eclipse.wst.common.project.facet.core.xml

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
   <runtime name="PWS2"/>
   <fixed facet="java"/>
   <fixed facet="wst.jsdt.web"/>
   <fixed facet="jst.web"/>
   <installed facet="java" version="1.6"/>
   <installed facet="jst.web" version="2.5"/>
   <installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>

The compile errors are gone.


Cisco VPN PCF Location

No Comments »

It’s often easier to set up a new Cisco VPN connection by importing the client profile from somebody else who is already up and running. This is especially true when setting up a connection in Max OSX 10.5 and earlier VPNC frond-ends, or equivalent tools in Linux. It stores the server, group name and password, and possibly more info.

Where is the file stored? On Windows sytems it is C:\Program Files\Cisco SYstems\VPN Client\Profiles.


Strict Quote Escaping in Tomcat 6

No Comments »

Mayble I’ll rename the blog to Stupid Things that I Forget. I always wind up having to spend quality time with Mr Google whenever tryingt o figure out this bunk. I have to work with an application that has nested (unescpaped) quotes in its JSP’s. So, I need to turn off Strict Quote Escaping for Tomcat 6.

From http://blogs.sourceallies.com/2009/10/strict-quote-escaping-in-tomcat/

“However in this case we just needed to get the app up & running quickly so I found a quick, temporary workaround instead of fixing all of the improperly formatted quotes. Setting org.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false in $TOMCAT_HOME/conf/catalina.properties allows the double-quotes within double-quotes, and no more exceptions!”

I use Eclipse WTP for my day-to-day work. Each server that you have set up has a corresponding SERVERNAME-config folder in the Servers project. Inside each of those folders is a catalina.properties file for that server. Update that and you should be good to go.


SQL Server Date Math without Time

No Comments »

Okay. Put this in your “I’m sure there’s a better way to do this, but it works” bucket. Maybe even toss it in the “Shouldn’t this be easier?” one as well.

I have a seemingly simple task – in a daily job, scrub some data on records with a date field value 60 days prior to the current date.

The date field does include time, so we can’t just subtract 60 days from sysdate(). If the job runs a 9:01am, then only records from 60 days prior at 9:01am would be scrubbed.

So we need to strip the time from the date(s). This isn’t rocket science by any stretch of the imagination. But the syntax in removing time from consideration with SQL server isn’t exactly intuitive.

So here’s the SQL I used to allow me to do that. The query returns the the value of datetime2 field my_date, the value without time, and 60 days prior to that without time. (To be more acurrate, the time is set to 0:00:00.000.)

select
top 1
my_date,
dateadd(dd, datediff(dd,0,my_date), 0) ,
dateadd(dd, datediff(dd,0,my_date), 0) - 60
from
my_table
;

The result (with each field on a separate line for clarity):

2002-04-21 18:30:00.000
2002-04-21 00:00:00.000
2002-02-20 00:00:00.000

It’d be nice if SQL server included a fucntions to just return the day… i.e. date(datetimefield) = ’14.jul.2010′.


Removing Double Home Link in WordPress

No Comments »

I know this post isn’t eloquent—please forgive that. It’s a copy-paste from some notes to myself.

Added a static Home page, and an Updates page. Went to Settings, Reading, and specified Home as the static page to display at the root of the site, and Updates as the place for postings. View the site. There are two Home links in the navigation menu.

WordPress 3 supports custom menus. If you create a custom menu, most new themes will display that. And if you don’t have a custom menu, most new themes will display a list of pages again. (In other words, wp_nav_menu() will invoke wp_page_menu().)

One option to remove the double link is to create a custom menu, explicitly listing the pages you want in the nav bar.

We may go that route eventually. But we’d rather the site just list the pages.

Updated header.php to comment out the invocation of the standard nav_menu function and use wp_page_menu instead, and told it to exclude the Home page from the menu.

To find the ID of the page to exclude, go to the pages listing, and hover over the link of the Home page, and look for its ID in the URL that appears in the status bar.

‘primary’ ) ); */ ?>
’5′ ) ); ?>

And that was it…


Attaching CMedia USB to VMWare Win7 Guest Locks Ubuntu 10.04

7 Comments »

Zoiks. It appears that having multiple VMWare images running (one of them Windows 7, the other Windows XP), plugging in a CMedia USB headset adapter into your system, and connecting the Win7 instance to that will lock up your entire system.

I had this happen before. My earlier response to was to specify that each guest should be manually connected to USB devices under the assumption that two VM’s trying to auto-connect was to blame. Guess not :-) So, the next theory is that there may be an issue with Audio Devices. With that in mind, I’ve disabled “connect at power on” for the WindowsXP instance. I don’t need audio from it. We’ll see how it goes… but for today I think I’ll just run one at a time. :sigh:

Update: (12-29-2011) It seems there has been an issue since at least 2010. I will try the workaround out after business hours :-)   http://communities.vmware.com/thread/257460


Using Oracle SQL Developer to Reset Your Password

No Comments »

If you need to reset your own password in Oracle (assuming you have the permissions to do so), the process is nominally easy with Oracle SQL Developer. Right-click on a Connection, and choose Reset Password… from the context menu.

HOWEVER, the menu item may be greyed out, and that was the case for me recently. So here are some notes on how I dealt with that.

It seems to me that there has to be a less heavy-handed way to accomplish this. But, it worked for me :-)

Enjoy….

—-

I had Oracle SQL Developer 1.5.5. The “Reset Password” context menu item was disabled. Research indicated that the menu item requires the OCI/thick driver. That driver is not included by default with SQL Developer if you get that as a standalone app.

I couldn’t find the means to obtain the OCI driver only, so I wound up downloading and installing the Oracle11g database and then started the included instance of SQL Developer.

To enable the OCI driver, select Tools/Preferences from the menu bar. In the preferences dialog, go to Database / Advanced Parameters, and select “Use OCI/Thick driver”.

This was on a WinXP (32bit) system, for what it’s worth.

From there, you can set up a connection to the database. If you have the password saved in the connection properties, and you successfully connect to the database at least once, then the Reset Password context menu item should be enabled.

* As a side note, before installing the database product, I’d also tried updating the password using the “password” command in a worksheet, and the alter user replace sql command. Neither were successful. The former only resulted in a error message indicating that the operation failed, but did not give a reason. The latter always stated that the new password did not meet password requirements, no matter what was entered.


Non-breaking Space in MS Word 2010

No Comments »

Type Ctrl+Shift+Space to get a hard space in a Word 2010 doc. (They keyboard shortcut is the same as it always was. :)


Creating Groups in OSX Leopard (10.5)

No Comments »

So Eeyore was a little upset when he learned that Apple killed Unix user and group schemes, removing addgroup (or groupadd) in the process. In its place, was some centralized binary and proprietary database.

“Well isn’t that nice?” he said, “Might as well switch to that other OS and live with regedit.”

“N-n-n-n-n-now you don’t have to be like that,” protested Piglet-me. “L-l-l-l-look at this!” He pointed excitedly at http://hints.macworld.com/article.php?story=20090219133314985.

Eeyore read the article, and his ears lifted up a little. “Well… how about that? You CAN create groups in OS-X still. Just not the Unix way.”

To create groups:

  1. Go to System Preferences -> Accounts…
  2. Click “+” as you would to add a user….
  3. In the next dialog, there is a dropdown for the field “New Account:”….
  4. From that dropdown, select “Group”
  5. enter a name, and click Create Group.
  6. From there you will be directed to a checklist where you can specify group members.

You can now chown away, assigning folders to the new group.

Note: I didn’t try out the extended chmod command listed in the article. I’ve only gone so far as creating the group and assigning folders to it.