Posts

How an AI agent works

Image
Suppose you have a folder of notes from a side project. Somewhere in those notes is the reason you chose SQLite over Postgres. You remember discussing it, but you cannot remember which file contains the decision. You could search the folder yourself, read a few files, and put the answer together. What would it take to let a language model do those steps? The model can write a request to search. That request is still just output from the model; it has not searched a single file. Our application must run the search and send the results into another model call. Following that handoff is a useful way to understand an agent. For this example, watch what changes after each tool result: the model has new information for choosing its next action. Give the model a way to look For this example, we will design two tools: search_notes(query) Returns matching file names and short excerpts. read_note(path) Returns the contents of one file in the notes folder. A tool is a capability ...

Understanding AWS CDK, one stack at a time

Image
In one sentence: With AWS Cloud Development Kit (CDK), we write a program that produces a CloudFormation template. CloudFormation reads that template and creates or updates the resources in AWS. Keep that split in mind: the CDK application describes the infrastructure; CloudFormation builds it. The CDK command-line tool connects the two. 1. The problem Say we need a network, a load balancer, a Postgres database and an application running in Amazon Elastic Container Service (ECS). We have three ways to describe the setup. Configure it in the AWS console. We can create the resources, but repeating the setup and reviewing changes means keeping track of the individual settings ourselves. Write a CloudFormation template by hand. The setup becomes a file we can review and reuse. As we add roles, security groups, logs and connections, that file grows. Write a program that produces the template. That is CDK. We get functions, loops and types, and the output is still a file CloudFor...

groovy scripts for Jenkins

At some point, if you are working on managing  Jenkins  for your team, you will find yourself looking for a set of useful groovy scripts to control jenkins configuration for a large no of builds/jobs. Following are some mostly frequently needed ones Get all jobs that belong to a view  hudson.model.Hudson.instance.getView('my-view')?.items.each() { println it.fullDisplayName } Clear the build queue   import hudson.model.* def queue = Hudson.instance.queue println "Queue contains ${queue.items.length} items" queue.clear() println "Queue cleared" Disable jobs in a view  hudson.model.Hudson.instance.getView('1.1.x-tests')?.items.each() { println("JOB : "+it.name) it.disabled=true it.save() } Get all jobs that that define a TimerTrigger with the trigger spec  import hudson.model.* import hudson.triggers.* for(item in Hudson.instance.items) { for(trigger in item.triggers.values()) { if(trig...

specs 2, Scala and maven with IntelliJ 12.1 and getting things right

Recently, to learn a test framework for Scala ( even for Java) I chose specs2 .  Its still difficult to move to SBT, largely due to the fact that I am yet to be comfortable using it. So, for the time being I will stick to maven. To configure the scala/java project edit the pom.xml to include <dependencies> <!-- specs2 version I used : 1.12.3--> <dependency> <groupid>org.specs2</groupid> <artifactid>specs2_${scala.version}</artifactid> <version>${specs2.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.scala-lang</groupId> <artifactId>scala-library</artifactId> <version>${scala.version}</version> </dependency> </dependencies> <build> <sourceDirectory>src/main/scala...

me, akka and scala

I've been learning Scala recently, including through a Coursera course. I'm gradually moving from writing Java-like Scala toward thinking in terms of transformations on data. What I like so far is being able to express operations on collections without spelling out every intermediate step. Shorter code helps when it makes the flow easier to follow, but it does not automatically make a program easier to maintain. Recently, I came across Akka. It lets us organize concurrent work as actors that communicate through messages. Each actor handles one message at a time and can keep its own state. This gives us a way to separate responsibilities without having several workers directly update the same state. We still need to design how those actors coordinate. I tried a word-count program using Akka and Scala. A mapper splits sentences into words, a reducer combines their counts, and an aggregator maintains the totals. The useful part of this exercise is seeing how work moves between ...

How to make most out of Jira?

It has been quite a while (still < 1 year), I am using Atlassian Jira for bug/issue tracking withing my team of roughly 15. Previously, we were using a version of Redmine, doped to suit company environment. I had read, heard a lot about Jira's abilities regarding how it can be useful to ease the project management and accurately measure the project's progress. But, recently under peer pressure of my group, where I was required to file some appropriate bugs/improvements/tasks, along with doing myriad of other things, I learned  importance of using Jira. How we can make most out it? Well, Jira is no magic, but just a tool; rather, it provides a platform for task management. So, all task management is left to you. Here's how I did and worked well for me create a high-level abstract issue of big task you will be working on and put in the initial estimates if you already know or leave it to the sub-tasks divide the task into concrete sub-tasks with concrete est...

getting android emulator to work normally on 64 bit linux

Recently I started working on a nfc android app but I was stuck with very basic thing of getting emulator to work normally on my home laptop running Linux Mint. I tried numerous ways to configure eclipse, java paths, AVDs (android virtual devices), checking adb logcat etc but nothing really helped. The emulator could start but always hanged on the boot screen. (believe me, I even waited a complete day for it to boot up). Thanks to StackOverflow again! As described in the comments here  and also here , the Android team still has some more work to do until they make the emulator ( and other stuff) work with 64-bit version of java. But, I could happily run my android project with emulator ( which works quite fast now :) ) by simply configuring eclipse's default jre to be a 32-bit version of java 7. While 64 bit jdk being default for other things.