Posted on

Goodbye JavaScript

Hello Google Dart

Can’t we just embed a lite JVM into the browser, so I can write groovy.

Whats with all the parentheses.

main(){
var callbacks=[];
for(var i =0; i callbacks.add(() => print(i));
}
callbacks.forEach((c) => c());
}

Sorry, I think groovy is more elegant, with a step in the right direction to remove awkwardly typed characters like the ( and )

Posted on

From Bill Maher’s Blog

The Endth Degree

By Bill Maher

Is going to college still even worth it? College grads are coming out with degrees, yes – and herpes – but also with student loan debt totaling $60,000, $80,000, $100,00. These kids haven’t even gotten started in their careers and they’re already saddled with what’s tantamount to a full mortgage. In this sucky economy, graduates find themselves back in their old bedrooms at their parents’ homes, taking jobs in the service industry that they could have gotten without a college degree.

Wouldn’t a bright, industrious kid be better off in this economy to just jump into the job market and try to excel through merit?

[full article]

Posted on

Grails Service to do file system, sftp, and ftp file operations

So I’ve been preparing this module to do sftp / ftp / and file system manipulations in groovy.

I’ve got it running as a service in grails, with a page setup for testing.

Its really important that if your testing this class out in windows, you turn off your firewall.

I wasted like 2 hours trying to figure out why I kept getting errors.

Now I would like to turn this functionality into a .jar for standalone execution and injection into other projects.

You will need the ant-jsch.jar and jsch-0.1.33.jar, google guave, and apache commons net.

I some how automagically installed the ant-jsch and jsch jars in a way that doesn’t require import statements.

Credit due to
https://gist.github.com/1135043 for FTP code.
http://groovy-almanac.org/scp-with-groovy-and-antbuilder/ for SCP with ANT trick.
and an article I don’t recall the URL to on google guava for file system manipulation

import groovy.util.AntBuilder
import com.google.common.io.*
import org.apache.commons.net.ftp.FTPClient

class FileService {
def boolean fileSystemMove(String from, String to){

try{
	
	Files.move( new File(from), new File(to) )
	
}catch(Throwable t){

	println 'filesystem error' + t;
	return false
	
}

return true;
		
}


def boolean fileSystemCopy(String from, String to){

try{
	Files.copy( new File(from), new File(to) )
}catch(Throwable t){
	return false
}

return true;

		
}



def boolean sftpCopyTo( String host, String user, String passwd, String destination, String fileurl ){		

def ant = new AntBuilder();

ant.scp(				
	file: fileurl,
	todir:"${user}@${host}:${destination}",
	trust:true,
	verbose:true,						
	password:passwd)
}



def boolean sftpCopyFrom( String host, String user, String passwd, String destination, String fileurl ){
def ant = new AntBuilder();

ant.scp(				
	file: "${user}@${host}:${fileurl}" ,
	todir: destination,
	verbose:true,
	trust:true,
	password:passwd)
}

	
def boolean ftpCopyFrom( String host, String user, String passwd, String destination, String fileurl  ){
try{
	def String fileName = fileurl.split('/')[-1];
	new FTPClient().with {
		connect host
		//enterLocalPassiveMode()
		type(BINARY_FILE_TYPE)
		login user, passwd
		changeWorkingDirectory destination
		def incomingFile = new File(fileurl)
		incomingFile.withOutputStream { ostream -> retrieveFile fileName, ostream }
		disconnect()
	}
	true
}catch (Throwable t) {
	false
}
}

def boolean ftpCopyTo( String host, String user, String passwd, String destination, String fileurl  ){

try{	
	def String fileName = fileurl.split('/')[-1];
	def FTPClient ftp = new FTPClient();
	ftp.connect host
	ftp.type(ftp.BINARY_FILE_TYPE)
	ftp.login user, passwd
	ftp.changeWorkingDirectory destination				
	def InputStream input = new FileInputStream(fileurl);
	ftp.storeFile(fileName , input)
	
	ftp.disconnect()
	true
} catch ( Throwable t ) {
	false
}


}

		
			
	
}
Posted on

creating jar files with groovy

So I saw recently that its quite simple to compile down a groovy script into a .jar file.
http://groovy.codehaus.org/WrappingGroovyScript

I guess that hello world .class file looked something like this in groovy

class HelloWorld {
   static main( args ){
      println "Hello World!"
   }
}

So does that mean I can write code as groovy, and then import the jar as a dependency into a Java project?

I am assuming the answer is yes, because groovy compiles down to the same byte code as Java.

Now the question is, is it better to deliver a stand alone .jar file to my co-worker to execute on the command line, or import into his project as a dependency and call methods on it?

I see finally Java has copied a feature of .NET. All .NET languages compile down to the same byte code.

Posted on

Convincing my wife to move to Cupertino!

I really, really, really need to get my honey bunny to be cool, man.
She is just so attached to Glendale, and the Armenian community there-in.

It has made it impossible for me to get her to agree to move up to Silicon Valley.

Just last year, I took her to San Francisco to check out the area, and see if she would like to live there.
Well, today I received yet another job offer from the area, and the magnetic pull to join the other Engineer’s and inovators there is becoming to strong to resist.

Wish me luck, Interwebs, as I try yet again, to convince my honey bunny to be cool.

Posted on

mnogosearch

Finally got mnogosearch indexing and installed the php front end.
The PHP front end is very ugly. And not even functional! Not sure what I am supposed to do to get it working right.

The worst part is, the search engine server is loud. So I have a noisy machine, mostly useless, sitting in my office, until I get this up and running.

Posted on

Falling in love with Groovy

This is great!
Finally the JVM has been leveraged for over 200 other languages. Scala is one of the more popular ones. Lots of startups talking about it.
But I gotta say, now that I know Grails, and even got paid to learn it, I might just keep on using it.

Yes, sure, there are a lot of things wrong with it, and I can still make a project in PHP faster, but I finally passed that inflection point, where it would be worth while using.

Posted on

Grails is great, But Boring

Why in the heck would anyone choose the java platform to build on, idfk.
The compilation process, and project build times, take all the fun out of being a web developer.
Grails goes a long way to breach that gap, from code monkey, to creative genius, but f*me bro, its still boring as heck.
Cleaning, and re-running the application every time I make a change to a domain class, which is quite often on this Agile team that I am on, is super tedious.
Yeah, Yeah, Yeah, it’s nothing like a 6 to 9 minute build that I was experiencing at NBCU, getting eonline.com to work on my system.
But its still irritating, when the sun is shining outside, on a Friday, during summer, and I have to sit in an agile dungeon, and wait for Grails to compile.

PHP, I miss you!

Posted on Leave a comment

Grails DataSources plugin

Hi Guys, I have been trying to integrate multiple datasources with grails.

I get a strange error:

nested exception is org.hibernate.cache.NoCachingEnabledException: Second-level cache is not enabled for usage [hibernate.cache.use_second_level_cache | hibernate.cache.use_query_cache] ->> 334 | innerRun in java.util.concurrent.FutureTask$Sync

Anyone out there know the answer? Comment please.