Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×
User Journal

Journal Journal: Phonomological Morass

Truncation of words out side of their phonological boundries leads to linguistic degradation and syllabic morass. Please stop it. You scare my chickens.
Software

Journal Journal: Groovy and the shell

One of the reasons I decided to go with Groovy and Grails was that I could run in J2EE environments and I could use Java API from the command line in my shell scripts. Take a look. First you've gotta get Groovy http://groovy.codehaus.org/ Then stick it in your path. Personally I put it in my home directory and put the bin folder for groovy in my path from my .profile. Now you can do this: hello.groovy

#!/usr/bin/env groovy
println "Hello World!"

Groovy is a neat language you can do curries and functional programming, typing is optional, and you can use it with Grails to generate up web apps really quick. The nifty thing is you can learn one set of API and carry them around with you. You don't have to relearn a bunch of new ways of doing things if you don't want to... or you can if you do want to. Groovy is neat stuff. Grails is getting good. Or you can just use Groovy as a way to dink around with Java API. For example if you have Java and Groovy that means you can play around with ldap from Groovy using the Java API like this:

#!/usr/bin/env groovy

import java.util.Hashtable
import javax.naming.*
import javax.naming.event.*
import javax.naming.directory.*

def ou = " System and Service Accounts"

// here, we're just reading in some parameters...
def stdin = new BufferedReader(
new InputStreamReader(System.in)
)
print "username: " // your username to access LDAP... not a real user
String username = stdin.readLine()
print "password: " // the password for that account...
String passwd = stdin.readLine()

// next we set up an environment for LDAP
Hashtable env = new Hashtable()
env.put(
Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory"
)
env.put(
Context.SECURITY_AUTHENTICATION,
"EXTERNAL"
)
/* // if only I had SSL working... *sigh* oh well...
env.put(
Context.SECURITY_PROTOCOL,
"ssl"
) //*/

// You'll want to put your server's name or IP here:
env.put(
Context.PROVIDER_URL,
"ldap://activedirectoryhost.mycompany.com:636/"
)

// Here, you'll want to set up your company's parameters for OU and DC...
env.put(
Context.SECURITY_PRINCIPAL,
"CN=" + username + ",OU=" + ou + ",DC=mycompany,DC=com"
) // username
env.put(
Context.SECURITY_CREDENTIALS,
passwd
) // and password

// Now we'll try and connect...
try {
def ctx = new InitialDirContext(env)
def attr = ctx.getAttributes("")
def srchInfo = new SearchControls()
// you'll want to use your own search base
def searchBase= "OU=company,DC=mycompany,DC=com"
// this is the magic search string sauce:
def searchFilter = "(&(objectClass=person))"
// we strong type the next var because it is
// used in a Java API that needs String[]
String[] objAttribs=[
"givenName",
"cn",
"sn",
"mail",
"mailNickname",
"userPrincipalName",
"displayName",
"manager",
"department",
"memberOf"
]
srchInfo.setSearchScope(SearchControls.SUBTREE_SCOPE)
srchInfo.setReturningAttributes(objAttribs)

// Now we get the results and loop through them...
NamingEnumeration dirObjects = ctx.search(searchBase,searchFilter,srchInfo)
def nodirObjects = 0
while (dirObjects != null && dirObjects.hasMoreElements()) {
def dirObject = dirObjects.next()
println("'" + dirObject.getName() + "':")
def attrs = dirObject.getAttributes()
for(name in objAttribs) {
println "\t * " + attrs.get(name)
}
nodirObjects++
}
ctx.close()
println("Number of entries identified: " + nodirObjects)
} catch (Exception e) {
println "Exception: " + e
}

User Journal

Journal Journal: I declare War on Stupid 3

I was driving to work today and the driver in front of me opened her window and tipped out a cereal bowl of milk. She had been eating cheerios and had finished and was spilling out on the road to splash and splatter my car the left over milk. I am utterly horrified... we were on the highway traveling at highway speeds!
Television

Journal Journal: Futurama Revelations: Fry is Farnsworth's grand-pa.

Fry is not Farnsworth's great to-the-eleventy-ith grand uncle... Fry is Farnsworth's great to-the-twelfth-ith grand father. That's because due to a time travel accident Fry is his own grand-pa. I'm in shock.
Anime

Journal Journal: Paprika 1

I've just watched Paprika and I have to say it may be one of the best Anime movies I've seen in years. Absolutely surreal and epic yet perfectly sane. The plot borrows from some older scifi and takes things a step further. I think this story would make a wonderful Hollywood live action provided they could find an actress that could pull off the lead role without making us think that Paprika is merely silly, crazy, or deranged. The truth is Paprika is the wisest character in her world but wears it lightly recognizing that she and everyone she meets are merely the figments of other people's imagination.
Software

Journal Journal: What are you programming in now? 4

TIOBE has published their yearly Programming Community Index and it got me thinking... What is the most commonly used programming language in the Slashdot community? What language did you learn in the last year?

Personally, I've just started working in Groovy this year which has entered the TIOBE list at number 35. The biggest mover on this list seems to be Lua and Lua's rank on this list is enough for me to decide to check it out.

Java

Journal Journal: Mind bending Groovy code

jwagon sent me these mind bending groovy class manipulations in a chat today:

#!/usr/bin/env groovy

class AA {
                def msg
                AA(something){ msg = something }
        }

def c = { a, b ->
  def x =a.newInstance(b)
  println x.msg
}

c(AA, "foo")

Or how about....

#!/usr/bin/env groovy
def m = java.lang.String
def n = m.newInstance("foo")
println n

The Almighty Buck

Journal Journal: An American in London... how? 1

I was remembering how much I loved working in Europe but how the exchange rates ruined my contract there making it impossible to stay. I was paid out of Texas in dollars but I was living physically in Germany. A bad combination.

I wonder how hard it would be to get a job in London, paid in British Pounds, living on the British economy... as an American citizen. Has anyone ever done this? Is it possible for a geek? Do they need Software Engineers or Informaticians over there bad enough to entertain the idea?

Java

Journal Journal: Groovy and Grails 2

Is anyone out there using Groovy and Grails? Thoughts? Ideas about Groovy?
User Journal

Journal Journal: Everyone is a programmer.... 2

I just had a conversation with a promising young help desk attendant. He wanted to get into programming and asked if I could teach him. I told him that I could teach anyone to program... but just like singing... only some of us will ever do it well.

When someone shows up on American Idol and sings their heart out and the totally and utterly suck. How do you tell them? How do you tell the young bright and highly motivated student that they don't "think like a programmer" or that no matter how hard they work they will never become a great programmer. How do you tell?

I am convinced that anyone can learn to program and I can see a day in the not too distant future where every child is taught to program just as they are taught to use a keyboard and mouse today. The day is out there on the horizon.

Every child is taught science but only some will learn to become world changing scientists.

Every child may take music and art but only some will become musicians and artists. Their talent will be spotted early. They will be mentored to become better in their area of interest. They may even get to specialize on a particular skill.

One day programming will follow this path too. Just as promising young mathematicians and engineers are singled out and nurtured due to their skill. So too will the young budding programmer.

Today a child with an interest in medicine can visit a hospital and spend a day with a real nurse. An aspiring lawyer can visit a court room. An aspiring accountant (yes I've met children that aspire to be accountants) can visit an accounting firm and learn more about it.

Aspiring young technologists can visit Red Hat summer camp.

But, how do you evaluate that young dreaming no-talent that thinks he can be the next American Idol but clearly doesn't have the chops? What do you say to the young no-talent that wants to be a programmer?

I told my young charge that I can teach anyone to program but only some people will be great at it. Just as anyone can be taught the mechanics of writing and can write a 300 page novel if only they have the determination and willingness to learn. However, only the innate talent and skill developed by the pupil can turn them from merely a trained student into something great.

The teacher can give you voice lessons. The pupil can study. But only that intangible gift called talent can make them great. Study under the best. Work your hardest. And, it could pay off... if you don't try at all there is no way you will succeed. But, at the end of the day there is this intangible thing called talent that no one can give you.

You can paint a picture but no one may want to look at it.

You can write a book but no one may want to read it.

You can sing a song but no one may enjoy it.

You can write software but it may not be something others want to use.

Still, how else should you proceed? So you pour everything you have into your skill and into your art. You sculpt yourself and hone your abilities.

"Do you see a man skilled in his work? He will serve before kings; he will not serve before obscure men." Proverbs 22:29

You have to believe that or else not try at all. You have to believe that all your effort and sacrifice will pay off. You have to believe you can serve before kings.

Software

Journal Journal: software engineer projected fastest growing occupations

According to this dated BLS article Software Engineer is going to be one of the fastest growing jobs through 2014. Are the salad days of IT back?

New growth areas will continue to arise from rapidly evolving technologies. The increasing uses of the Internet, the proliferation of Web sites, and mobile technology such as the wireless Internet have created a demand for a wide variety of new products. As individuals and businesses rely more on hand-held computers and wireless networks, it will be necessary to integrate current computer systems with this new, more mobile technology.

User Journal

Journal Journal: Why do you write in Slashdot Journal? 4

I started writing in the slashdot journal system because most of what I write about is "news for nerds" type stuff. If I put a blog out on blog spot I'm lost in the crowd. Here I'm with like minds.

That said, why do you write in Slashdot Journal?
Programming

Journal Journal: Java or Perl 5

Had to pick which language to start a new server side project in, only languages on the table are Java and Perl... which do you pick? Go!

Slashdot Top Deals

You knew the job was dangerous when you took it, Fred. -- Superchicken

Working...