Wednesday, June 29, 2011

I have officially moved this blog to http://www.davemineer.com

No matter what blog software I use in the future this should be the URL pointing to that blog. Please update your aggregator. Does anybody even follow this lame blog?

Friday, May 27, 2011

How do I add a user on ubuntu 11.04?

Long time ago I got a dell mini 9 inch and the kids kind of like it but the keys are really small, so is the screen so there wasn't a lot of love.  Then we lost the power adapter and it sat idle for a long time.  Probably 6 months.  I found a replacement power cord on ebay for about $7 and now we can use it again.

it came with XP but that was running slow so I installed ubuntu on it to try and make it more interesting.  I think it worked.  I kind of have fun with it.  Just a toy so far and really it will probably be that way for ever cause it is so small.

Back to the point.  I want it to work right when I logon which means I want some stuff saved as part of my user profile, but I don't want the kids getting on to my stuff either.

We added one user from the command line. My son actually did that, good job buddy! I found an article that shows how to do it via the gui interface:

http://www.liberiangeek.net/2011/03/addremove-users-ubuntu-11-04-natty-narwhal/

To summarize: 
System Settings, System, Users and Groups

IIS Manager Error: The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)

 

I am trying to set up a local dev environment again.  Have tried apache, mysql and everything over the years, this time I am using IIS (Have also done that before) and MSSQL because our main DB is in MSSQL.  I am having trouble installing coldfusion so I reboot and when it comes back up I try and start my web server but I get the error above.  A netstat -ao tells me what is using what ports but the PID doesn't match anything in task manager, but from google search I see that skype defaults to port 80 if you let it.  Shut down skype (only for a second cause I use it all the time) and my websites start up now.

 

Skype has option under Tools/Options/Advanced/Connection "Use port 80 and 443 as alternatives for incoming connections.  Unchecked that and all should be well. Will see if I have any problems with skype.  Another option is to start your webserver before you start skype which is probably what would happen if you let your webserver start automatically.  I don't do that cause I don't always use it and don't want it hoggin resources on my dev machine.  I use a batch script to start up what I need for my dev environment and the webserver is part of that.

 

Skype Version (5.3.0.111)

Monday, May 23, 2011

Database Maintenance - Previous Thursday, Current Week, Last day of week.

We keep bumping into some bad field values from the old database.  These usually aren't an issue in our new database but since we use the old one for some stuff it is important to keep it clean throughout.  Each one of our records has 3 fields which correlate it to a specific publication of our newsletter.  The first day of our publishing week, the week, and the last day of our publishing week.  Some of our records were missing these values and I went in search of finding a way to bulk update.  The biggest challenge was getting the beginning day of the week. We work on a Thursday - Wednesday week.  The reasons for this are another blog post.  Anyway to find the previous thursday of any week I used the following:

update table
set beg =
    CASE
        WHEN DATEPART(dw,date) in (5,6,7) THEN dateadd(dd,5-DATEPART(dw,date),date)
        ELSE  dateadd(dd,1-(DATEPART(dw,date)+3),date)
    END
    WHERE beg is null
Basically, what happens is that it checks the day of the week and if it is 5,6, or 7, (that means Thursd, Fri, or Saturday) then it substracts 5 - that number.  So if thursday would be 5-5 = 0 and datadd 0 would stay thursday(5). otherwise take the day and subtract from 1.  This will always be a negative number which works with the datadd to get you back to the previous thursday.  So, if it is a tuesday, that would be a 3. So 3+3 =6 and 1-6 = -5, so Tuesday - 5 days = mon,sun,sat,fri,thurs TADA! back to the previous thursday.

If there be an easier way, let me know.


I mentioned that I also had to get the end date and the week.

For the end date I simply updated the end = dateadd(dd,6,beg) where end is null

Don't get tricked into thinking that is a 7, it is a 6. That's always been a problem for me since there are 7 days in the week. but you add by 6 to get to where you need to be, I promise.

The week was simply a datepart(ww,end)-1.  Why -1, just how it has always been for us.  Calendar week 1 is sometimes very short, I think even 1 day if it is a saturday or something.  Go learn about that, I just know for us we area always at sql(week) - 1 for our current week.

Friday, May 06, 2011

jQuery autoselect

Today I wanted to use the jQuery autoselect feature to add an autoselect to an input field on a web page.  I have heard alot about jQuery but until yesterday I really hadn't done anything with it. (how horrible is that)  Yesterday I used it for the simple task of updating a text field with the value of a select dropdown field. Simple, this is all it took:

$("#jid").change(function(){
   $("#city").val($("#jid option:selected").text());
});

Where jid is the select dropdown and city is the text input I wanted the text from the dropdown to be copied to.

The autocomplete was a little more complicated, but not much.  I use the following as the basis for this project and pretty much just copied it and adapted it to my site:

http://www.coldfusionjedi.com/index.cfm/2010/4/12/Playing-with-jQuery-UIs-Autocomplete-Control

jQuery does make things easy.  I use a cfc as in the 2nd to last example on above to return dynamic results. 

Wednesday, April 27, 2011

Find and Fix Scientific Notation values in a field

Many years ago during some importing or upgrading to a bigger better database one of my fields was converting longer numerical values to scientific notation.  This quit happening but I still had alot of those values in a text field in my database. Originally that field was numeric, but we converted it to text because there were often times when letters were added to the values we receive.

After not being able to find a isScientificNotation() function I found the values like this:

select myfield, LTRIM(str(cast(my field as real))), * from mytable

This worked great and made it easy to write an update statement like so:

update mytable
set myfield = LTRIM(str(cast(myfield as real)))
where myfield like '%e+%'

No more scientific notation in my field. Cool. Should have fixed this years ago, or not let it happen in the first place.

Dave

Friday, July 30, 2010

Railo on mac

I have had a great time at CFUNITED this year.  One of the things that has been a hot topic, which I haven't really caught wind of until today, is the battle between Adobe and the CFML open source alternatives, mainly Railo and Open BD.  I will save that topic for another post.  But that, along with the fact that I have been wanting to do it anyway, prompted me to give Railo a run.

I am mac challenged.  I spend 95% of my time on a PC.  The only time I seriously use my mac is when I travel, and at home in the evening, so maybe I only spend 80% of my time on a PC.  So I can't handle any advanced stuff on a mac.

Railo provides a version that you don't have to install.  That is good for me.  It is called "Railo Express (Jetty)".  It worked just as expected.  I dropped in my apps folder after unzipping the archive and double clicked on "Start" and there you go.  I pointed my browser to http://localhost:8888/ and up came a screen prompting me for a new password.  After selecting one I was presented with the admin interface for railo.

I snooped around the admin interface for a minute, but then I wanted to just see a regular page.  I opened up the index.cfm file in the railo directory (under applications for me, it had a weird name that represented the relase number and everything) under webroot and noticed there was a cflocation:

<cflocation url="railo-context/admin.cfm" addtoken="no">

I commented that out and then I was able to use that page like any other cfm page and add cfml to it however I want.

Pretty nice that railo makes it so easy to get started with CFML.  I have a hard time articulating my thoughts on stuff, like the adobe vs open source battle, but being able to start coding in CFML so easily seems like a good thing for our community.

Monday, May 10, 2010

Coldfusion 9 orm where in clause

I was trying to do a where in clause using coldfusion 9 orm and it just didn't work. I know pretty fast when something is over my head. A quick search revealed this thread: http://groups.google.com/group/cf-orm-dev/browse_thread/thread/19dc48732d58fca0/f47f3d4ef2e75aab?lnk=raot&fwc=1 in the cf9 orm mailing list. This thread discusses the exact issue I was wondering about. At the end, Barney Boisvert gives an example of how to do this (you have to click on "show Text" in the Bob Sivlerberg Post)

Since I can't figure out how to post code to this STUPID blog, you will have to visit the link.

I also had another issue, I wanted to still use offset and maxrows.  That was easy enough even though I tried to make it hard, and you can see that solution in my post to the same group: http://groups.google.com/group/cf-orm-dev/browse_thread/thread/ab1f8badf28dfbb5?hl=en

Wednesday, May 05, 2010

No Row with the Given Identifier Exists: [contact#0]

So I was setting up coldfusion 9 orm and dumping an object that had lots of related objects, an they had lots of related objects etc.. I kept getting the above error when outputting a one-to-many related object. After searching the database I noticed that that particular foreign key was being set to a 0, instead of a null value, but both those values where present in the linking table.

The solution was to use the missingrowignored="true" option in my orm definition. The record with id = 0 didn't exist and cf 9 orm tried pulling a record with that value (usually it expects a null value when nothing related exists). This caused it to error but I also got a positive from hasContact(). Anyway the missingrowignored="true" was the fix.

Tuesday, May 04, 2010

Specifying Security Credentials in Amazon Web Services AWS EC2

At cfobjective this year Chris Peterson gave a great presentation on running coldfusion in the cloud. In his demo he showed Amazon EC2 and showed how he used it for cloud computing. I was excited about this and I have been checking it out.

Right off the bat I got confused on how to enter my security credentials. I created a key pair and tried to enter that, but it didn't work. So after a couple weeks (I only was able to look at it for a few minutes a couple of different times) I found out what was going on. To get the necessary information, I had to go to the AWS EC2 website and after you login you click "Account" then you click "Security Credentials". Now, after this click, I always have to logon again. NO problem. Then, down below, you will see a section "Access Credentials" with 3 tabs, Choose the "Access Keys" tab, it is probably already selected since it is the first one. You see where it says "Your Access Keys" you can see the Access Key Id, and you simply click on show under the "Secret Access Key" column to see your Secret Key.

Then, using elsaticfox I click on credentials, or it prompts me for them. You can enter anything for the "Account Name" and the AWS Access Key and AWS Secret Access Key where those that we saw above.

Seems simple enough but one of those things that tripped me up.

Wednesday, April 28, 2010

How do I install the latest version of JAVA on Linux Ubuntu?

This is not easy. It's no wonder more people don't use Linux. I cannot see any normal person doing this. Until stuff like this is resolved and made easier Linux won't be coming to many desktops any time soon.

I found this article that walked me through it, but I had no idea what I was doing, just followed the instructions.

http://ubuntuforums.org/showthread.php?t=1437100

Monday, January 11, 2010

Error while executing the Hibernate query.

org.hibernate.hql.ast.QuerySyntaxException: state is not mapped [from state]

This is the error I got when trying to do a simple ORMExecute("from state"). This happened because the from statement is case sensitive. I did change the name of the .cfc but I still am forced to use a uppercase "s" in "State". The tablename is tblState, so I am still confused on this one, but changing the case to match the original cfc did fix it.

Sunday, January 03, 2010

ColdFusion Builder Beta 3 and subclipse (subversion)

The ColdFusion Beta Builder 2 expired on Jan 1, 2010 so I was forced to do something that I wanted to do anyway, install beta 3. I did that on my mac over the weekend. Once I installed it I had a problem getting subversion back on so I could update my repositories.

The first problem was when i selected the subversion components from their site http://subclipse.tigris.org/ It had required dependencies. After unchecking a few, I think mylyn and the graphing one It allowed me to go to the accept licenses screen. However the next and finish buttons stayed greyed out no matter what I chose. I chose the radio button to accept the license agreements and even made sure to scroll through all of them to the end and everything. Nothing worked. Google search gave me this: http://hippiex.instantspot.com/blog/2009/07/13/Easy-Subclipse-and-Coldfusion-Builder. I don't know how it made a difference because I didn't choose any of the components from that site, but just adding it as a site seemed to fix the licensing issue.

After that, I got subclipse to install but upon trying to update to head my repository I got the error "Thread attempted to read nesting count of a lock it did not own". After googling that I found some advice to add all the optional components, which I went back and did, one at a time. I can't remember what order I did them in but I ended up having to add them all except for collabnet merge client before it actuall worked without giving me that error.

Friday, November 13, 2009

How to call a controller in FW/1

Sean Corfiled wrote a simple MVC framework a few months ago called FW/1 (check it out here). I have been following the discussion list since the beginning. Last night I finally gave it a try. I was very impressed by it's simplicity. There isn't alot of documentation but there doesn't need to be a whole lot because it is so easy and Convention based. I had a view up and running based on the getting started doc in just a few minutes. Very nice. It is not only easy, understanding the conventions will surely help my development in model-glue and other frameworks, even when I don't use a framework this will help with my mental and code organization.

Then I moved to controllers. I just couldn't grasp how they were called. I reread the docs a few times and finally went to bed a defeated man. This morning I reread once more and it clicked, and the docs explain it perfectly, I was just a little thrown by the verbage, which I shouldn't have been. In model glue I call an event like so:

<event-handler name="maint.city">
<broadcasts>
<message name="needCity"/>
</broadcasts>
<results />
<views>
<include name="body" template="maint/city.cfm" />
</views>
</event-handler>

In FW/1 your url would be http://www.whatever.com/myapp/index.cfm?action=maint.city

FW/1 automatically calls the city() function in the controllers/maint.cfc controller. It seems almost silly that I couldn't figure this out, but It did escape me for a minute. I knew to create a controller and where to put it, but I wasn't sure how to call different functions etc.. In model-glue I would broadcast different messages. So I was thinking maybe I needed to call functions from my view or something, like city = rc.controller.getCityById().

Turns out, as mentioned that FW/1 calls the city() function automatically and i can call other stuff from inside that function.

Wednesday, November 11, 2009

Posting Code Snippets in blogger

I have always wanted a good way to post code snippets on this blog. My favorite is the way that Ben Nadel does it at his blog: http://www.bennadel.com/. I sent him a message asking him how he does this, but I have not heard back from him. I found a way to post code snippets but it ain't that pretty.

You use blockquote and the returned output from this parser: http://www.blogcrowds.com/resources/parse_html.php
ColdFusion Report Builder has Report Functions

I stumbled on a discussion at: http://www.justskins.com/forum/archive/index.php?t-5171.html that made me realize that Report Functions are available in ColdFusion Report Builder. I had been struggling with the expression builder using iif to conditional show fields. iif is a bear, you have to use DE(" ") and different things and it can be ugly.

As mentioned in the article, you cant use cfml syntax in the expression builder. But you can using report functions. This is a very nice feature. Since I get mad at adobe for that bad things better get happy for the good things. Nice one Adobe!
Coldfusion Report Builder Frustration

In my detail band I want to eliminate the blank lines when a field has no value. I my situation I return a lot # and subdivision and often times there isn't any listed so the line is blank. I don't want a blank line to show up. In Crystal Reports they let you add sections and you can choose to not print the whole section if it is blank anyway.

Coldfusion report builder has an option "Remove Line When Blank" but it flat out does not work for me. Nothing is removed. Whatever the secret combination of options is to make this work, I can't figure it out. C'mon Adobe, we really need this tool, please upgrade and fix it.

Thursday, October 29, 2009

Salesforce.com frustration

We are nearing our limit of 1GB storage space in salesforce.com. I emailed my sales rep about increasing storage and his reply was $1500 for an additional 1GB. After some frantic screaming (by me) he said he had made a mistake and new pricing was actually$750. Anyway it sent me on a tyraid because I feel such a sense of vendor lockin with salesforce and such a prisoner to their EXPENSIVE product line that I did some research on alternatives. My post to a blog that sums up my problems very well eplains my thoughts pretty good. We are currently at 95% usage. See image below for our actual usage right now.

Blog Post: http://forcemonkey.blogspot.com/2009/08/salesforcecom-data-storage-space.html

My Comments:

Great post. This is exactly the problem we have and our stats look exactly like yours. 61% used up in tasks, and our usage grows about 5-7 % per month. Problem is that 15 of our users are sales people who call, email and do stuff all day long. So 50 - 80 tasks is nothing when you consider, emails, calls etc..

It is pretty scary the strangle hold salesforce is applying to my company. The quoted price for more data was at first $1500 per year for 500 meg, but after screaming loud enough he told me he made a mistake and the new pricing was $750. We have 30 users and pay approx $36,000 per year for salesforce. In a world where google gives me 17 GB free, salesforce should be a little more liberal with their storage space. They aren't the only kid on the block any more either.

I could save 70% with sugarcrm and 88% with zoho. Admittedly, especially since we are so comfortable with it, salesforce is still top dog (in my opinion) and worth some extra bucks. But at some point you break the camels back. Then you give up a few features (increasingly fewer) to save $25 to $30 K per year.

Monday, October 26, 2009

Using IIF with ColdFusion Report Builder

I was trying to do some conditional logic in coldfusion report builder and having some problems. Evidently the problem was with my misunderstanding of IIF. I was trying the following:

IIF (len(myvar), myVar, myVar2)

The way IIF works is that it expects strings, indicating variables, which to me is counterintuitive. But the solution that worked was:

IIF (len(myvar), 'myVar', 'MyVar2')

This evaluated to the correct values of those variables and works great.
Inserting a Line Break in ColdFusion Report Builder

I had a field that I wanted to insert a line break. This field needed to be dynamic in it's sizing and it is very possible that it will have to wrap. So It was not an option to just place another field box or textbox below the current one, because if it wrapped and expanded, then the text would flow over the box below.

So I needed a way to force a line break inside the expression builder.

Turns out I just needed to insert a "Chr(10)". More detail: query.fieldname & Chr(10) & ' more text here if you want'

That worked great and now the size of the text in query.fieldname doesn't matter. If it wraps everything is just pushed down, as I wanted.