Hi there đź‘‹

Welcome to my blog

Streaming LLM responses in Ollama and Deno

When building AI-powered applications, one of the most frustrating user experiences is waiting for a complete response to load, especially for long-form content. Imagine requesting a 10,000-word story and having to wait 30+ seconds staring at a blank screen before any text appears. This is where streaming comes to the rescue. The Problem with Blocking Responses Traditional AI implementations follow a request-response pattern where the entire response must be generated before being sent to the client. For short queries, this works fine. But for longer content generation, users are left wondering if the system is still working or has crashed. ...

October 15, 2025 Â· 2 min Â· 273 words Â· Me

Web browser automation with browser-use and Gemini

I recently experimented with the browser-use library to create an AI agent that can browse the web autonomously. This post walks through a simple example that uses Google’s Gemini AI to find the top post on Hacker News’s “Show HN” section. You can find the complete project code on GitHub. The Setup The implementation is fairly straightforward. Here’s what we need: Python 3.11+ (specified in .python-version) The browser-use library for web automation Google’s Gemini API for the AI model A few standard libraries for async operations and environment management The Core Implementation The heart of the example is in main.py, which demonstrates the browser-use pattern in just a few lines: ...

October 10, 2025 Â· 2 min Â· 331 words Â· Me

Deno, LangChain, Ollama, and structured outputs

When working with LLMs programmatically, it’s important to receive a structured response from the model. This makes it easier to parse and use the output in your application. In this post, we’ll walk through how to define a schema using zod and query an Ollama model with the help of LangChain. For simplicity, we’ll use Deno, so make sure it’s installed on your system. You can find the full code here: https://github.com/hosainnet/ai-experiments/tree/main/deno-ollama-structured-response — let’s break it down. ...

September 25, 2025 Â· 2 min Â· 252 words Â· Me

Unit Testing React Native Components

tldr: github.com/hosainnet/RNUnitTests I’ve recently jumped ship to React/React Native (and JS in general) and one of the first hurdles for me was figuring out how to unit test RN component code. As many of us starting out, you’ll have probably come across the snowflake project for guidance and inspiration (which deserves credit for most of the content in this post). However since it’s a big project with a large set of dependencies and files, I wanted to go through the minimal setup needed to go from react-native init AwesomeProject to being able to run npm test and get some results back. ...

January 31, 2016 Â· 5 min Â· 934 words Â· Me

Dependency Injection With Dagger 2 and Android

Dependency Injection is one of the patterns we use in software development to achieve separation of concerns, making our code maintainable and testable. Consider the following Activity code: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); Retrofit retrofit = new Retrofit.Builder() .baseUrl("http://reddit.com") .addConverterFactory(GsonConverterFactory.create()) .build(); ApiService apiService = retrofit.create(ApiService.class); apiService.getUser("reddit") .enqueue(new Callback<User>() { @Override public void onResponse(Response<User> response, Retrofit retrofit) { displayUserDetails(response.body().getData()); } @Override public void onFailure(Throwable t) { } }); } The code above uses Retrofit to consume the Reddit API through an ApiService and display some basic information about a given user. ...

November 7, 2015 Â· 5 min Â· 985 words Â· Me

Getting Started With Android Development Using Groovy 2.4 and Android Studio

Groovy 2.4 was released last month with native support for Android development. In this post I’ll explain how to set up a new Android Studio project with Groovy support as I couldn’t find a decent tutorial to explain it for newcomers (like myself). Why Groovy? If you’re new to Groovy, you may ask why would I want to do this? In short: less code = (hopefully) less buggy and more readable code. Here are some of the benefits of using Groovy over Java: ...

February 7, 2015 Â· 4 min Â· 793 words Â· Me

Grails Upgrade Part 1: 2.1.3 to 2.2.5

We have recently upgraded a fairly large web application from 2.1.3 to 2.4.4. Since it’s a big jump, we split the task into multiple grails upgraded so this post will focus on 2.1.3 to 2.2.5. The best place to start is the official upgrade documentation page. Here are some of the things we’ve encountered during the upgrade: ###“delete() does not work in withNewSession”### Sessions are now always flushed after withNewSession closure is executed, unless flush mode is manual: https://jira.grails.org/browse/GRAILS-9739 ...

January 26, 2015 Â· 1 min Â· 180 words Â· Me

Hello World!

January 1, 2015 Â· 0 min Â· 0 words Â· Me