<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rosdyana Kusuma on Medium]]></title>
        <description><![CDATA[Stories by Rosdyana Kusuma on Medium]]></description>
        <link>https://medium.com/@rosdyanakusuma?source=rss-bcb73929917c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*tV8fQzHFNLppIeyehIXuaA.png</url>
            <title>Stories by Rosdyana Kusuma on Medium</title>
            <link>https://medium.com/@rosdyanakusuma?source=rss-bcb73929917c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 02:52:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rosdyanakusuma/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Podman: Your Go-To Open-Source Alternative to Docker Desktop for the Enterprise Crew]]></title>
            <link>https://rosdyanakusuma.medium.com/podman-your-go-to-open-source-alternative-to-docker-desktop-for-the-enterprise-crew-ee583a9893e1?source=rss-bcb73929917c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee583a9893e1</guid>
            <category><![CDATA[containerization]]></category>
            <category><![CDATA[podman]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Rosdyana Kusuma]]></dc:creator>
            <pubDate>Mon, 07 Jul 2025 08:17:02 GMT</pubDate>
            <atom:updated>2025-07-07T08:17:47.402Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/884/0*lIqCu0wa2OJ4TX82.png" /><figcaption>Visit <a href="https://podman.io/">podman.io</a></figcaption></figure><p>Alright, let’s be real. Docker Desktop has been the king of local container dev for ages. Everyone uses it, it’s practically synonymous with containers, right? But for us folks in the enterprise world, with all our security rules and the ever-changing licensing drama, it’s time to look at some other players. And that’s where <strong>Podman</strong> steps in, making some serious waves as a fantastic, open-source alternative.</p><p>This article’s all about showing you why Podman isn’t just “another option,” but a seriously compelling choice for DevOps and Software Engineers. We’ll dive into how it tackles those annoying enterprise headaches, from boosting security to playing nice with Kubernetes.</p><h3><strong>Podman’s Daemonless Magic: A Huge Win for Enterprises</strong></h3><p>One of the coolest things about Podman and a massive plus for enterprise environments is its <strong>daemonless architecture</strong>. Unlike Docker, which needs a persistent, root-privileged background process (that Docker engine we all know), Podman just… doesn’t.</p><h4><strong>What Does “Daemonless” Even Mean?</strong></h4><p>Think of it this way: when you type a podman command, it talks directly to the container runtime (like runC) and your operating system&#39;s kernel. There&#39;s no middleman daemon hanging around, no single point of failure that could crash or get exploited. This fundamental design choice is a game-changer, especially for how we handle security and resources in big companies.</p><h4>Security Boost: Less Surface for Attacks</h4><p>No root-privileged daemon means a <strong>smaller attack surface</strong>. With Docker, if that daemon gets compromised, an attacker could potentially get root access to your host system. With Podman, commands run as <em>your</em> user, and containers can even run as <strong>rootless containers</strong> by default.</p><p>Rootless containers are a big deal for enterprise security. Here’s why:</p><ul><li><strong>No root needed:</strong> You can build and run containers without needing admin privileges on your machine.</li><li><strong>Better isolation:</strong> Even if something goes wrong inside a container, the damage is way more contained. It’s running as a regular user, not as root, so it can’t mess with the whole system.</li><li><strong>Plays nice with strict rules:</strong> If your company has tough security policies, Podman’s rootless approach and daemonless design fit right in. It’s just inherently more secure and easier to audit.</li></ul><h4>Resource Friendly &amp; Stable</h4><p>Since there’s no daemon hogging resources in the background, Podman is <strong>more efficient</strong>. When you’re not running containers, it’s not chewing up your CPU or RAM. This means:</p><ul><li><strong>Faster startups:</strong> No daemon to fire up means your commands run quicker.</li><li><strong>More stable systems:</strong> Take away that single point of failure (the daemon), and your container environment just becomes more solid and less likely to randomly act up.</li></ul><h3>Podman Desktop: Closing the GUI Gap for Devs</h3><p>Let’s be honest, a big reason folks stick with Docker Desktop is that slick GUI. The Podman community heard us loud and clear and rolled out <strong>Podman Desktop</strong>. It’s a seriously solid, feature-packed app that gives you that familiar, visual way to handle your containers, images, volumes, and even pods.</p><p>Podman Desktop offers everything you’d expect:</p><ul><li><strong>Container management:</strong> Start, stop, restart, and delete all the usual suspects.</li><li><strong>Image handling:</strong> Pull, build, tag, push.</li><li><strong>Volume setup:</strong> Keep your data persistent.</li><li><strong>Pod view:</strong> Visually group and manage your containers just like in Kubernetes.</li><li><strong>Troubleshooting:</strong> Check logs, inspect details, run commands inside containers.</li></ul><p>The best part? It’s <strong>cross-platform, </strong>Windows, macOS, Linux, you name it. So all your developers, no matter their OS, get a consistent experience. It really does bridge that GUI gap, giving you all the visual comfort without sacrificing Podman’s under-the-hood awesomeness.</p><h3>Where Podman Shines in the Enterprise &amp; How to Switch</h3><p>Podman absolutely rocks in situations where security, efficiency, and open-source principles are top priorities:</p><ul><li><strong>CI/CD Pipelines:</strong> It’s daemonless and rootless, which makes it perfect for CI/CD. Build agents can run containers without needing admin access, seriously beefing up your pipeline’s security.</li><li><strong>Shared Dev Environments:</strong> In places where multiple developers share a dev box, Podman’s rootless capabilities ensure better isolation. One person’s container won’t mess with someone else’s or the host.</li><li><strong>Super Strict Security:</strong> If you’re in a highly regulated industry, Podman’s design naturally fits those “least privilege” and “small attack surface” rules.</li><li><strong>Developer Laptops:</strong> With Podman Desktop, developers get a powerful, secure, and familiar setup that still plays by the company’s security rules.</li></ul><h4>Switching Over is Easy Peasy</h4><p>Moving from Docker commands to Podman is surprisingly simple. The <strong>Podman CLI is basically a mirror of Docker’s</strong>. Most of your everyday Docker commands (like docker run, docker build, docker images, docker ps) have direct podman equivalents. So, the learning curve is practically flat.</p><p>Plus, Podman works perfectly with your existing Docker images. No need to rebuild anything. It’ll pull and run them from any OCI-compliant registry. And if you’re a docker-compose fan, podman-compose is there to help you keep using your existing compose files.</p><h3>Wrapping It Up</h3><p>For enterprise teams navigating the wild world of modern software, Podman is a mature, solid, and genuinely <em>better</em> open-source option than Docker Desktop. Its <strong>daemonless design</strong> means way better security with rootless containers and less risk, all while being more efficient and stable.</p><p><strong>Podman Desktop</strong> takes care of the GUI crowd, giving you that slick visual experience without compromising on the good stuff underneath. And arguably most importantly, Podman’s <strong>native Kubernetes pod support</strong> creates a seamless flow from your local machine right to production, making your whole workflow smoother.</p><p>By bringing Podman into your enterprise, you’re not just picking an alternative; you’re upgrading to a container development experience that’s more secure, more efficient, and perfectly aligned with your Kubernetes future.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee583a9893e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Talk to Your Data: Building an AI SQL Chatbot with WebSockets, LLMs, and MCP]]></title>
            <link>https://rosdyanakusuma.medium.com/talk-to-your-data-building-an-ai-sql-chatbot-with-websockets-llms-and-mcp-ab639288f364?source=rss-bcb73929917c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab639288f364</guid>
            <category><![CDATA[model-context-protocol]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[websocket]]></category>
            <dc:creator><![CDATA[Rosdyana Kusuma]]></dc:creator>
            <pubDate>Sun, 06 Jul 2025 11:00:29 GMT</pubDate>
            <atom:updated>2025-07-06T11:04:03.544Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OFFuxXMN6zHg_Lpr" /><figcaption>Generated by ChatGPT.</figcaption></figure><p>Hold on to your keyboards, fellow data wranglers and AI enthusiasts! Ever wished you could just <em>talk</em> to your database instead of wrestling with SQL queries? Like, “Hey database, show me the top 5 most expensive gadgets,” and boom, answers appear. Well, today, we’re gonna build just that: an <strong>AI-powered SQL chatbot</strong> that’s as slick as a greased lightning bolt and talks to your data in real-time.</p><h3>Why This Is Cooler Than a Polar Bear’s Toenails</h3><p>Interacting with databases usually means you gotta know SQL like the back of your hand. But what if you could just ask a question in plain broken English and get your answers directly from the database? That’s the dream, right? This tutorial is gonna be your map to building an AI-powered chatbot that takes your natural language questions, turns ’em into SQL, runs ’em, and spits out the results, all in real-time thanks to <strong>WebSockets</strong>. No more hitting refresh like it’s 1999!</p><p>We’re gonna mix and match some seriously cool tech here:</p><ul><li><strong>Model Context Protocol (MCP)</strong>: This is our secret sauce, letting Large Language Models (LLMs) play nice with external tools, especially our databases. Think of it as the LLM’s personal assistant for database chores.</li><li><strong>Azure OpenAI</strong>: Our brain for this operation, handling the natural language stuff and, yes, even writing SQL for us. Pretty neat, huh?</li><li><strong>Socket.IO</strong>: For that real-time, two-way chat goodness between your browser and our backend. Instant gratification, baby!</li><li><strong>Node.js &amp; React</strong>: Our dynamic duo for the backend heavy lifting and the snazzy frontend interface.</li></ul><p>By the time we’re done, you’ll have a fully functional SQL chatbot that can poke around multiple databases just by you asking nicely.</p><h3>The Master Plan: Our Project Architecture, sql-chat</h3><p>Our whole setup, lovingly named sql-chat, breaks down into three main buddies:</p><ol><li><strong>mcp-server</strong>: This guy&#39;s the database whisperer. It exposes all our database query powers as &quot;tools&quot; using the Model Context Protocol (MCP). It&#39;s like a bouncer for your MySQL databases, making sure only cool, standardized requests get through.</li><li><strong>server</strong>: This is the brains of the operation. It juggles all those WebSocket connections from your browser, chats with the LLM (Azure OpenAI), and uses an MCP client to talk to the mcp-server for all the database action.</li><li><strong>client</strong>: Your friendly React frontend. It&#39;s just a simple chat window, sending your questions via WebSockets and showing you the answers in real-time.</li></ol><p>Here’s a quick peek at how they all dance together:</p><pre>+-----------------+       +-----------------+       +-----------------+<br>|     Client      |       |      Server     |       |    MCP Server   |<br>|   (React App)   |       |   (Node.js)     |       |   (Node.js)     |<br>+-----------------+       +-----------------+       +-----------------+<br>| - Chat UI       |       | - Socket.IO     |       | - MCP Tools     |<br>| - Socket.IO     |&lt;-----&gt;|   (WebSocket)   |       |   (DB Queries)  |<br>|   Client        |       | - Azure OpenAI  |&lt;-----&gt;| - MySQL         |<br>|                 |       |   Integration   |       |   Connection    |<br>|                 |       | - MCP Client    |&lt;-----&gt;| - StdioServer   |<br>|                 |       |   (StdioClient) |       |   Transport     |<br>+-----------------+       +-----------------+       +-----------------+</pre><h3>MCP: The LLM’s Rosetta Stone for Tools</h3><p>Alright, let’s get a bit nerdy about <strong>Model Context Protocol (MCP)</strong>. This isn’t just some fancy acronym; it’s a rulebook that lets LLMs talk to external tools and data sources in a super organized and safe way. Imagine giving an LLM a phonebook of functions it can call in the real world. That’s MCP.</p><p><strong>Why MCP, you ask?</strong> LLMs are word wizards, but they don’t natively know how to, say, fetch data from a database, send an email, check the weather, or even spy on your ex. MCP fills that gap. Developers define these “tools” with clear descriptions and what kind of inputs and outputs they expect. Then, the LLM, based on your question, decides which tool to “call.” MCP handles the actual execution and sends the results back to the LLM to finish its thought.</p><p>For our SQL chatbot, MCP is like the MVP because it lets our LLM:</p><ul><li><strong>Understand Database Superpowers</strong>: We tell it things like “Hey, you can query_product_database&quot; or &quot;You can get_database_schema.&quot;</li><li><strong>Cook Up Valid SQL</strong>: With the tool’s input schema (which includes the database schema — fancy!), the LLM can whip up the correct SQL queries. No more guessing games!</li><li><strong>Run Queries Safely</strong>: The mcp-server acts as a bouncer, only allowing SELECT queries and handling all the database connection fuss securely. Safety first, folks!</li></ul><h3>The Star Player: The MCP Server (mcp-server)</h3><p>Our mcp-server is a standalone Node.js app that&#39;s all about dishing out our database functionalities as MCP tools. It uses the super helpful @modelcontextprotocol/sdk to get this done.</p><p><strong>What’s inside?</strong></p><ul><li><strong>UnifiedMySQLMCPServer</strong>: This class is the conductor of our database orchestra, managing connections (like for our product and faq databases) and registering all those cool MCP tools.</li><li><strong>setupDatabases()</strong>: Kicks off all our mysql2 connection pools, pulling database info from environment variables.</li><li><strong>setupHandlers()</strong>: This is where the magic happens! We define and register our MCP tools here:</li><li>query_product_database: Let the LLM run SELECT queries on the product database. It&#39;s got built-in bouncers to ensure only SELECT statements get through.</li><li>query_faq_database: Same deal, but for your FAQ database.</li><li>get_database_schema: This is a game-changer! It lets the LLM dynamically snag the schema (tables, columns, types, keys) of any database. This is <em>critical</em> for the LLM to build accurate SQL.</li><li><strong>StdioServerTransport</strong>: This clever bit lets the mcp-server chat with its client (our main server app) over standard input/output. Makes running it as a child process super easy.</li></ul><p>Here’s a simplified peek at the code:</p><pre>class UnifiedMySQLMCPServer {<br>  private server: McpServer;<br>  private databases = new Map&lt;string, Database&gt;();<br>  constructor() {<br>    this.server = new McpServer({ name: &#39;unified-mysql-mcp-server&#39;, version: &#39;1.0.0&#39;, capabilities: { tools: {} } });<br>    this.setupDatabases();<br>    this.setupHandlers();<br>  }<br>  private setupDatabases() {<br>    // Example: Setup Product Database connection pool<br>    if (process.env.PRODUCT_DB_HOST) {<br>      const productPool = mysql.createPool({ /* ... config ... */ });<br>      this.databases.set(&#39;product&#39;, { name: &#39;ProductDB&#39;, pool: productPool, config: { /* ... */ } });<br>    }<br>    // ... similar for FAQ Database ...<br>  }<br>  private setupHandlers() {<br>    for (const [key, db] of this.databases) {<br>      const toolName = `query_${key}_database`;<br>      this.server.registerTool(toolName, {<br>        description: `Query the ${db.name} database to retrieve information`,<br>        inputSchema: { query: z.string() },<br>      }, async (args: { query: string }) =&gt; {<br>        // ... query validation (only SELECT) and execution ...<br>        const [rows] = await db.pool.execute(args.query);<br>        return { content: [{ type: &#39;text&#39;, text: JSON.stringify({ success: true, data: rows }) }] };<br>      });<br>    }<br>    this.server.registerTool(&#39;get_database_schema&#39;, {<br>      description: &#39;Retrieve the schema (tables and columns) for a specified database.&#39;,<br>      inputSchema: { dbKey: z.string() },<br>    }, async (args: { dbKey: string }) =&gt; {<br>      // ... logic to fetch schema from information_schema ...<br>      return { content: [{ type: &#39;text&#39;, text: JSON.stringify({ success: true, schema: /* ... */ }) }] };<br>    });<br>  }<br>  async start() {<br>    const transport = new StdioServerTransport();<br>    await this.server.connect(transport);<br>  }<br>  // ... stop method ...<br>}</pre><h3>The Bridge Builder: The MCP Client (server/src/unified-mcp-client.ts)</h3><p>Nestled in our main server application, unified-mcp-client.ts is the liaison to our mcp-server. It&#39;s job? To get the mcp-server running as a child process and make sure they can chat happily.</p><p><strong>What’s it got?</strong></p><ul><li><strong>UnifiedMCPClientManager</strong>: This class is like the project manager for all things MCP client.</li><li><strong>initialize()</strong>: This method kicks off the mcp-server process using StdioClientTransport. It also sniffs out all the tools the mcp-server offers and, get this, fetches the database schemas using the get_database_schema tool. This schema info is <em>gold</em> for the LLM; it needs to know what tables and columns exist to write correct SQL!</li><li><strong>executeTool(toolName, args)</strong>: When the main server needs to run an MCP tool (like query_product_database), this method takes the reins.</li><li><strong>fetchDatabaseSchema(dbKey)</strong>: A handy helper that specifically calls the get_database_schema tool on the mcp-server to grab that crucial database metadata.</li></ul><p>A sneak peek at this file:</p><pre>// ... imports and logging setup ...<br>class UnifiedMCPClientManager {<br>  private client: Client | null = null;<br>  private availableTools: Tool[] = [];<br>  async initialize(): Promise&lt;string[]&gt; {<br>    // Start the MCP server as a child process<br>    const transport = new StdioClientTransport({<br>      command: &#39;npm&#39;,<br>      args: [&#39;start&#39;],<br>      cwd: path.resolve(__dirname, &#39;../../mcp-server&#39;)<br>    });<br>    this.client = new Client({ name: &#39;sql-chat-unified-client&#39;, version: &#39;1.0.0&#39; }, { capabilities: {} });<br>    await this.client.connect(transport);<br>    // Discover tools and fetch schemas<br>    const result = await this.client.listTools();<br>    this.availableTools = result.tools as Tool[] || [];<br>    // ... fetch schemas using get_database_schema tool ...<br>    return this.availableTools.map(t =&gt; t.name);<br>  }<br>  async executeTool(toolName: string, args: any): Promise&lt;McpResult&gt; {<br>    if (!this.client) throw new Error(&#39;MCP client not initialized&#39;);<br>    return await this.client.callTool({ name: toolName, arguments: args }) as McpResult;<br>  }<br>  async fetchDatabaseSchema(dbKey: string): Promise&lt;any&gt; {<br>    if (!this.client) throw new Error(&#39;MCP client not initialized&#39;);<br>    const result = await this.client.callTool({ name: &#39;get_database_schema&#39;, arguments: { dbKey } }) as McpResult;<br>    const parsedContent = JSON.parse(result.content?.[0]?.text || &#39;{}&#39;);<br>    return parsedContent.schema;<br>  }<br>  // ... shutdown method ...<br>}</pre><h3>The Grand Central Station: The Main Server (server) - LLM &amp; WebSocket Integration</h3><p>This is the central system of our app. It’s where the rubber meets the road, handling your chat messages, talking to the LLM, running MCP tools, and sending answers back to your browser in a flash.</p><h3>LLM Integration (Azure OpenAI):</h3><p>We’re using the openai SDK to hook into Azure OpenAI. The core idea is to use the LLM&#39;s &quot;tool calling&quot; superpowers.</p><ul><li><strong>Tool Definitions</strong>: We tell the LLM about our MCP tools (query_product_database, query_faq_database). The cool part? We cram the <em>dynamically fetched database schemas</em> right into the description of these tools. This gives the LLM all the context it needs to craft perfect SQL.</li><li><strong>LLM Call</strong>: You send a message, and the server ships it off to the LLM along with the tool definitions.</li><li><strong>Tool Call Detection</strong>: If the LLM figures out it needs to call a tool to answer your question (e.g., “Show me products less than fifty bucks”), it’ll send back a tool_calls object. This tells us which tool to call and what arguments (like the generated SQL query) to use.</li><li><strong>Tool Execution</strong>: Our server intercepts these tool calls, grabs the arguments, and then tells the UnifiedMCPClientManager to executeTool on the mcp-server.</li><li><strong>Follow-up LLM Call</strong>: The results from the tool (e.g., the data from your database query) get sent <em>back</em> to the LLM as a “tool” message. The LLM then takes this info and whips up a human-friendly answer.</li><li><strong>Retry Mechanism</strong>: Things can go wrong, right? What if the LLM generates some janky SQL? We’ve got a retry loop. If a tool fails, the error message gets sent back to the LLM, giving it a chance to fix its query on the next try. Smart, eh?</li></ul><h3>WebSocket Implementation (Socket.IO):</h3><p>Forget traditional REST APIs for this; we’re using socket.io for that sweet, sweet real-time chat.</p><ul><li><strong>HTTP Server</strong>: Just a bare-bones Node.js http server for a /health check and to hook up our socket.io server.</li><li><strong>Socket.IO Server</strong>: This is where the magic happens. It’s attached to our HTTP server.</li><li><strong>connection Event</strong>: When a new client connects, a socket object pops up, representing that client&#39;s unique connection.</li><li><strong>chatMessage Event</strong>: The server is all ears for chatMessage events from your browser. The handleChatMessage function jumps into action.</li><li><strong>Real-time Feedback</strong>: As all this processing happens, the server is constantly chatting back to your browser:</li></ul><p>Here’s the simplified blueprint for our main server:</p><pre>// ... imports and logging setup ...<br>const openai = new AzureOpenAI({ /* ... config ... */ });<br>const mcpManager = new UnifiedMCPClientManager();<br>const server = http.createServer((req, res) =&gt; { /* ... health check ... */ });<br>const io = new Server(server, { cors: { origin: &quot;*&quot;, methods: [&quot;GET&quot;, &quot;POST&quot;] } });<br>io.on(&#39;connection&#39;, (socket: Socket) =&gt; {<br>  socket.on(&#39;chatMessage&#39;, (message: string) =&gt; handleChatMessage(socket, message));<br>  socket.on(&#39;disconnect&#39;, () =&gt; console.log(&#39;Client disconnected&#39;));<br>});<br>async function handleChatMessage(socket: Socket, message: string) {<br>  const requestId = generateRequestId();<br>  const messages: ChatCompletionMessageParam[] = [{ role: &#39;user&#39;, content: message }];<br>  // Fetch schemas and define tools for LLM<br>  const productSchema = databaseSchemas.product ? formatSchemaForLLM(&#39;product&#39;, databaseSchemas.product) : &#39;&#39;;<br>  const faqSchema = databaseSchemas.faq ? formatSchemaForLLM(&#39;FAQ&#39;, databaseSchemas.faq) : &#39;&#39;;<br>  const tools: ChatCompletionTool[] = [<br>    { type: &#39;function&#39;, function: { name: &#39;query_product_database&#39;, description: &#39;...&#39; + productSchema, parameters: { /* ... */ } } },<br>    { type: &#39;function&#39;, function: { name: &#39;query_faq_database&#39;, description: &#39;...&#39; + faqSchema, parameters: { /* ... */ } } },<br>  ];<br>  let retries = 0;<br>  let finalContent: string | null = null;<br>  while (retries &lt;= MAX_RETRIES) {<br>    const response = await openai.chat.completions.create({ model: process.env.AZURE_OPENAI_API_DEPLOYMENT!, messages, tools, tool_choice: &#39;auto&#39; });<br>    const responseMessage = response.choices[0].message;<br>    messages.push(responseMessage);<br>    if (responseMessage.tool_calls) {<br>      // Execute tool calls<br>      const { toolMessages, executionFailed } = await executeToolCalls(requestId, socket, responseMessage.tool_calls);<br>      messages.push(...toolMessages);<br>      if (executionFailed &amp;&amp; retries &lt; MAX_RETRIES) {<br>        retries++;<br>        continue; // Retry LLM call with error feedback<br>      } else if (executionFailed) {<br>        finalContent = &quot;I was unable to execute the required tools...&quot;;<br>        break;<br>      }<br>      // Follow-up LLM call for natural language response<br>      const finalResponse = await openai.chat.completions.create({ model: process.env.AZURE_OPENAI_API_DEPLOYMENT!, messages });<br>      finalContent = finalResponse.choices[0].message.content;<br>      break;<br>    } else {<br>      finalContent = responseMessage.content;<br>      break; // No tools, direct response<br>    n}<br>  }<br>  if (finalContent) {<br>    socket.emit(&#39;finalResponse&#39;, { content: finalContent });<br>  } else {<br>    socket.emit(&#39;error&#39;, { message: &#39;Empty response from LLM.&#39; });<br>  }<br>}<br>async function executeToolCalls(requestId: string, socket: Socket, toolCalls: readonly ChatCompletionMessageToolCall[]) {<br>  let executionFailed = false;<br>  const toolMessages: ChatCompletionMessageParam[] = [];<br>  for (const toolCall of toolCalls) {<br>    socket.emit(&#39;toolCall&#39;, { id: toolCall.id, name: toolCall.function.name, args: JSON.parse(toolCall.function.arguments || &#39;{}&#39;) });<br>    let functionResult: McpResult;<br>    try {<br>      functionResult = await mcpManager.executeTool(toolCall.function.name, JSON.parse(toolCall.function.arguments));<br>      const parsedContent = JSON.parse(functionResult.content?.[0]?.text || &#39;{}&#39;);<br>      if (parsedContent.success === false) executionFailed = true;<br>    } catch (error: any) {<br>      functionResult = { content: [{ type: &#39;text&#39;, text: JSON.stringify({ success: false, error: error.message }) }] };<br>      executionFailed = true;<br>    }<br>    socket.emit(&#39;toolResult&#39;, { id: toolCall.id, result: functionResult.content?.[0]?.text || &#39;&#39; });<br>    toolMessages.push({ tool_call_id: toolCall.id, role: &#39;tool&#39;, content: functionResult.content?.[0]?.text || &#39;&#39; });<br>  }<br>  return { toolMessages, executionFailed };<br>}<br>// ... server listen and MCP initialization ...</pre><h3>The Pretty Face: The Client (client) - React Frontend</h3><p>Your simple, elegant chat interface is powered by React. It uses socket.io-client to hook up to our backend WebSocket server and show you messages as they happen.</p><p><strong>What’s it made of?</strong></p><ul><li><strong>socket.io-client</strong>: The little library that lets your browser talk WebSockets.</li><li><strong>useEffect Hook</strong>: This manages your WebSocket connection, setting it up when the chat component loads and tearing it down when it&#39;s not needed.</li><li><strong>useState Hooks</strong>: For keeping track of your chat messages, what you&#39;re typing, and if you&#39;re connected or not.</li><li><strong>sendMessage() Function</strong>: Takes your typed message and fires it off to the server using socket.emit(&#39;chatMessage&#39;, input).</li><li><strong>Event Listeners</strong>: The client is all ears for messages from the server:</li><li>connect, disconnect, error: For connection status and oopsies.</li><li>status: To show you what the server is busy doing.</li><li>toolCall, toolResult: To show you when tools are being called and what they spat out.</li><li>finalResponse: The final, polished answer from the LLM.</li><li><strong>Dynamic UI</strong>: Messages are rendered on the fly, with different styles for you, the AI, and those helpful system/tool messages.</li></ul><p>Here’s a simplified view of the client’s code:</p><pre>import React, { useState, useEffect, useRef } from &#39;react&#39;;<br>import { io } from &#39;socket.io-client&#39;;<br>const SERVER_URL = &#39;http://localhost:3001&#39;; // Match your server&#39;s port<br>function App() {<br>  const [messages, setMessages] = useState([]);<br>  const [input, setInput] = useState(&#39;&#39;);<br>  const [status, setStatus] = useState(&#39;Connecting...&#39;);<br>  const socketRef = useRef(null);<br>  const messagesEndRef = useRef(null);<br>  useEffect(() =&gt; {<br>    const socket = io(SERVER_URL);<br>    socketRef.current = socket;<br>    socket.on(&#39;connect&#39;, () =&gt; setStatus(&#39;Connected to server.&#39;));<br>    socket.on(&#39;disconnect&#39;, () =&gt; setStatus(&#39;Disconnected from server.&#39;));<br>    socket.on(&#39;error&#39;, (err) =&gt; {<br>      setStatus(`Error: ${err.message || err}`);<br>      setMessages((prev) =&gt; [...prev, { role: &#39;system&#39;, content: `Error: ${err.message}`, type: &#39;error&#39; }]);<br>    });<br>    socket.on(&#39;status&#39;, (data) =&gt; setStatus(data.message));<br>    socket.on(&#39;toolCall&#39;, (data) =&gt; {<br>      setMessages((prev) =&gt; [...prev, { role: &#39;system&#39;, content: `Calling tool: ${data.name} with args: ${JSON.stringify(data.args)}`, type: &#39;toolCall&#39; }]);<br>    });<br>    socket.on(&#39;toolResult&#39;, (data) =&gt; {<br>      setMessages((prev) =&gt; [...prev, { role: &#39;system&#39;, content: `Tool result: ${data.result}`, type: &#39;toolResult&#39; }]);<br>    });<br>    socket.on(&#39;finalResponse&#39;, (data) =&gt; {<br>      setMessages((prev) =&gt; [...prev, { role: &#39;ai&#39;, content: data.content, type: &#39;finalResponse&#39; }]);<br>      setStatus(&#39;Ready.&#39;);<br>    });<br>    return () =&gt; {<br>      if (socketRef.current) socketRef.current.disconnect();<br>    };<br>  }, []);<br>  useEffect(() =&gt; {<br>    messagesEndRef.current?.scrollIntoView({ behavior: &quot;smooth&quot; });<br>  }, [messages]);<br>  const sendMessage = () =&gt; {<br>    if (input.trim() === &#39;&#39;) return;<br>    setMessages((prev) =&gt; [...prev, { role: &#39;user&#39;, content: input, type: &#39;user&#39; }]);<br>    setInput(&#39;&#39;);<br>    if (socketRef.current &amp;&amp; socketRef.current.connected) {<br>      socketRef.current.emit(&#39;chatMessage&#39;, input);<br>      setStatus(&#39;Sending message...&#39;);<br>    } else {<br>      setStatus(&#39;Not connected to server.&#39;);<br>    }<br>  };<br>  // ... JSX for rendering chat interface ...<br>}<br>export default App</pre><h3>Getting This Baby Up and Running!</h3><p>Ready to get your hands dirty? Here’s how to fire up this whole operation on your machine:</p><h3>Stuff You Need First (Prerequisites)</h3><ul><li><strong>Node.js and npm</strong>: Get the LTS version of Node.js and its buddy npm installed.</li><li><strong>MySQL Database</strong>: You’ll need at least one, but two are better for this. One for your “products,” another for “FAQs.” Docker’s your friend here if you don’t have a local install.</li><li><strong>Azure OpenAI Account</strong>: You’ll need an endpoint, API key, API version, and a deployment name from your Azure OpenAI setup.</li></ul><h3>Environmental Goodies (.env)</h3><p>Create a .env file right at the root of your sql-chat project (or in server and mcp-server if you&#39;re feeling extra organized). Fill it with these:</p><p>Code snippet</p><pre># Azure OpenAI Configuration<br>AZURE_OPENAI_ENDPOINT=&quot;YOUR_AZURE_OPENAI_ENDPOINT&quot;<br>AZURE_OPENAI_KEY=&quot;YOUR_AZURE_OPENAI_KEY&quot;<br>AZURE_OPENAI_API_VERSION=&quot;2024-02-15-preview&quot; # Or your specific version<br>AZURE_OPENAI_DEPLOYMENT=&quot;YOUR_DEPLOYMENT_NAME&quot; # e.g., gpt-4o<br><br># MySQL Database Configuration (for mcp-server)<br># Product Database<br>PRODUCT_DB_HOST=&quot;localhost&quot;<br>PRODUCT_DB_USER=&quot;your_product_db_user&quot;<br>PRODUCT_DB_PASSWORD=&quot;your_product_db_password&quot;<br>PRODUCT_DB_DATABASE=&quot;your_product_db_name&quot;<br># FAQ Database (Optional, but recommended for full functionality)<br>FAQ_DB_HOST=&quot;localhost&quot;<br>FAQ_DB_USER=&quot;your_faq_db_user&quot;<br>FAQ_DB_PASSWORD=&quot;your_faq_db_password&quot;<br>FAQ_DB_DATABASE=&quot;your_faq_db_name&quot;<br># Server Port (for the main server)<br>PORT=3001<br># Debugging (set to &#39;true&#39; for verbose logging)<br>DEBUG=true</pre><h3>Install and Launch!</h3><p>Open up <strong>three separate terminal windows/tabs</strong>. This is important!</p><h4>1. Main Server (server)</h4><p>Now, head to the server folder:</p><pre>cd server<br>npm install<br>npm run build<br>npm start</pre><p>This will get your main Node.js server humming, initiating the MCP client, connecting to Azure OpenAI, and opening up port 3001 for WebSocket connections. Logs will confirm MCP client initialization and available tools.</p><h4>2. Client (client)</h4><p>Finally, jump into the client folder:</p><pre>cd client<br>npm install<br>npm start</pre><p>This will fire up the React dev server. Your browser should magically open to <a href="http://localhost:3000.">http://localhost:3000.</a></p><h3>Let’s Chat with Your Database!</h3><p>With all three running, open http://localhost:3000 in your browser. You&#39;ll see the chat interface. Now, try asking some questions:</p><ul><li>“What are the top 5 most expensive products?”</li><li>“How many products are in the ‘Electronics’ category?”</li><li>“What is the answer to ‘How do I reset my password?’” (if your FAQ database has that info!)</li><li>“Show me all products.”</li></ul><p>Watch in awe as your chatbot processes your natural language, asks the LLM to write some SQL, executes it through the MCP server, and gives you back the results in a nicely readable format. It’s like magic, but with code!</p><h3>Wrapping It Up (But Not Really)</h3><p>You just built a seriously cool, AI-powered SQL chatbot! You harnessed the power of LLMs with external tools via the Model Context Protocol and made it all real-time with WebSockets. This isn’t just a toy; it’s a robust, scalable, and secure way to let anyone talk to complex data sources in natural language. How awesome is that?</p><p><strong>Wanna make it even cooler?</strong></p><ul><li><strong>SQL Smarts</strong>: Teach it to do even fancier SQL, like complex joins or subqueries.</li><li><strong>Better Errors</strong>: Make the error messages super friendly and give hints if things go wrong.</li><li><strong>Security, Security, Security</strong>: Add authentication and authorization for your WebSocket connections and database access.</li><li><strong>Stream It</strong>: Get LLM responses streaming in, so it feels even more interactive.</li><li><strong>Auto-Updates</strong>: What if your database schema changes? Make the LLM’s tools update automatically!</li><li><strong>More Databases</strong>: Expand the mcp-server to talk to PostgreSQL, SQL Server, you name it!</li></ul><p>Repository: <a href="https://github.com/rosdyana/sql-chat">https://github.com/rosdyana/sql-chat</a></p><p>Go on, mess around with the code, add your own twists, and make it your own! The database world is now your oyster!</p><p>What’s the first question you’re gonna ask your new AI SQL chatbot? Let me know in the comments!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab639288f364" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Faced Teamwork Imbalance as a Software Engineer and How to Solve It]]></title>
            <link>https://rosdyanakusuma.medium.com/how-i-faced-teamwork-imbalance-as-a-software-engineer-and-how-to-solve-it-08e2906e2a73?source=rss-bcb73929917c------2</link>
            <guid isPermaLink="false">https://medium.com/p/08e2906e2a73</guid>
            <category><![CDATA[teamwork]]></category>
            <category><![CDATA[mental-health]]></category>
            <category><![CDATA[software-engineer-life]]></category>
            <dc:creator><![CDATA[Rosdyana Kusuma]]></dc:creator>
            <pubDate>Wed, 09 Apr 2025 13:29:59 GMT</pubDate>
            <atom:updated>2025-04-09T13:29:59.411Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gHVcJRm4JrbKtuVF" /><figcaption>Just a “backend” engineer stuck with a lazy teammate.</figcaption></figure><p>Working as a software engineer is exciting, challenging, and rewarding. But sometimes, teamwork can become unexpectedly frustrating. Recently, I faced such a situation.</p><p>I work as a full-stack developer and acting team lead in a multinational company in Taiwan. My small team consists of three members: me, Mr. J (front-end engineer), and Mr. M (project manager). Over the last two years, I’ve noticed a growing imbalance in our workloads. Mr. J, despite his nine-year tenure, has become increasingly disengaged. Tasks that should be completed quickly ended up dragging on for days without a clear reason.</p><p>In our agile sprint planning meeting, when a task that normally can be completed in three days to complete was estimated by Mr. J as needing six days, I began feeling frustrated. During discussions, he remained passive, giving safe and brief answers, rarely contributing actively to problem-solving. Additionally, he frequently appeared distracted, checking his phone or taking personal calls.</p><p>This phenomenon is sometimes called “<strong>Social Loafing”</strong>, where an employee becomes minimally engaged, contributing only enough to retain their position without motivation, enthusiasm, or commitment.</p><h3>Why did Social Loafing happen?</h3><p>A few conditions can cause this situation to happen.</p><ol><li>Feel safe because thinking someone else will cover their tasks.</li><li>No clear performance evaluation.</li><li>Feel like their contribution is unnoticed or not valued enough.</li></ol><h3>The impact on me and the team</h3><p>As a team lead and colleague, I felt stressed and overwhelmed by this situation. I found myself taking on additional responsibilities to compensate, leading to mental fatigue and frustration.</p><h3>What I tried</h3><p>I started by introducing clear tracking tools (we used Jira) and frequent stand-up meetings. Unfortunately, this wasn’t enough. I then decided to talk to Mr. J directly in a private meeting. I asked if there were personal or professional issues causing his performance issues. This method created a safe space for him to communicate.</p><p>Next, I increased transparency and accountability within our team. Every sprint estimation was openly discussed, with clear justification expected. If there were unrealistic estimates, Mr. J had to provide specific technical explanations in front of the team.</p><p>I also communicated clearly with my project manager about this issue, ensuring the management was aware of the performance imbalance and its impact.</p><h3>Results and reflections</h3><p>Slowly, this approach started to create improvement. Clear accountability made it harder to hide disengagement. Open communication showed care and genuine interest in resolving underlying issues. Although the change didn’t immediately affect, these steps significantly reduced my stress and improved the overall productivity and mood of our team.</p><p>If you’re facing similar teamwork issues, don’t stay silent. Address them clearly, transparently, and empathetically. Healthy communication and clear expectations can transform challenging situations into opportunities for growth and improvement.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=08e2906e2a73" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Install memcached in Django project]]></title>
            <link>https://rosdyanakusuma.medium.com/install-memcached-in-django-project-a3fd723bacd?source=rss-bcb73929917c------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3fd723bacd</guid>
            <category><![CDATA[django]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[memchaced]]></category>
            <dc:creator><![CDATA[Rosdyana Kusuma]]></dc:creator>
            <pubDate>Thu, 13 Jan 2022 13:33:00 GMT</pubDate>
            <atom:updated>2022-01-13T13:41:49.645Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*4YjLi13xxCDYfkln" /><figcaption><a href="https://unsplash.com/photos/8BFWBUkSqQo">https://unsplash.com/photos/8BFWBUkSqQo</a></figcaption></figure><p><strong>What is Memcached?</strong></p><p>Free &amp; open-source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.</p><p>Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.</p><p>Memcached is simple yet powerful. Its simple design promotes quick deployment, ease of development, and solves many problems facing large data caches. Its API is available for most popular languages.</p><p>I can say that this is one of basic optimization when we develop an API or in situations where we need to consume API but with a limit. Even though we can try to optimize the Django ORM first, I barely suggest implementing this Memcached for “first impression”.</p><p>Basically, Django support several Memcached, the most famous are <a href="https://docs.djangoproject.com/en/2.2/topics/cache/#memcached">MemcachedCache and PyLibMCCache</a>. I prefer the second one ( PyLibMCCache) because it’s written in C.</p><p>Preparation</p><p>Install the dependencies</p><pre>sudo apt-get install memcached</pre><p>or if you’re using docker, you can pull this image</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7f96ea51149eb08c6ecbf515bc1bc9de/href">https://medium.com/media/7f96ea51149eb08c6ecbf515bc1bc9de/href</a></iframe><p>install the python library,</p><pre>pip install python-memcached</pre><p>if you want to use ‘django.core.cache.backends.memcached.MemcachedCache’ in your Django, or</p><pre>pip install pylibmc</pre><p>for ‘django.core.cache.backends.memcached.MemcachedCache’</p><p>the next step is to add cache configuration on your Django project settings</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/16857d8ac5c6a952c06052df1740de30/href">https://medium.com/media/16857d8ac5c6a952c06052df1740de30/href</a></iframe><p>in this example, I am using PyLibMCCache as my cache’s backend, and also docker, that’s why my cache location is in port 11211, if you’re not running on docker, just change it with localhost or 127.0.0.1 .</p><p>Since we deal with API, this is an example of how to use cache on view’s class.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ba4ae1258716949de82bd766fe9e15fb/href">https://medium.com/media/ba4ae1258716949de82bd766fe9e15fb/href</a></iframe><p>happy coding!</p><p><em>Originally published at </em><a href="https://www.rosdyanakusuma.com/tutorials/install-memcached-in-django-project/"><em>https://www.rosdyanakusuma.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3fd723bacd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Install NVIDIA Driver in Ubuntu 18.04.]]></title>
            <link>https://rosdyanakusuma.medium.com/how-to-install-nvidia-driver-in-ubuntu-18-04-307c25f73259?source=rss-bcb73929917c------2</link>
            <guid isPermaLink="false">https://medium.com/p/307c25f73259</guid>
            <category><![CDATA[installation]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[driver]]></category>
            <category><![CDATA[nvidia]]></category>
            <dc:creator><![CDATA[Rosdyana Kusuma]]></dc:creator>
            <pubDate>Thu, 28 Mar 2019 15:24:06 GMT</pubDate>
            <atom:updated>2019-03-28T15:24:06.542Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*inCc4FCwq2US5_ncE7cg-A.jpeg" /><figcaption>Yamingshan national park, one of my favorite spot in the weekend .Source: Expedia.</figcaption></figure><p>In this article, I will share my experience to install NVIDIA driver on Linux OS (Ubuntu 18.04). I have been through some problem when try install or upgrade the NVIDIA driver. Before we start, there’s some notes.</p><ul><li>Never mixed up install from apt and installer file. If you willing to install from installer file to get latest driver version, always remove all previous NVIDIA installation.</li><li>Always reboot/restart your Linux OS after installation</li><li>In order to use the NVIDIA GPU, please follow instruction to disable secure boot (when install the driver, they will provide instruction how to do it, please read carefully their instruction).</li></ul><p>There will be 2 ways to install the NVIDIA driver, first using apt-get, second way is using installer (runfile).</p><h4>Install NVIDIA Driver via apt-get</h4><p>Basically, this driver provided in ubuntu official repository. We can check it using this command</p><pre>$ sudo ubuntu-drivers devices</pre><p>and we will get the list of NVIDIA driver. To install the driver, we just need to run this simple command</p><pre>$ sudo apt-get install nvidia-driver-418 nvidia-modprobe</pre><p>in those command example, I pick version 418, you can choose what version is suitable for you. We also install nvidia-modprobe, it’s a utility to load NVIDIA kernel modules and crate NVIDIA character device files automatically every time your machine booting up.</p><h4>Install NVIDIA Driver via Installer (Runfile)</h4><p>This part is recommended for advanced user. When install via apt-get is quite simple, otherwise, install with installer(runfile) need more steps and need be more carefully.</p><p>Remove Previous Installations</p><p>In case you installed NVIDIA driver before, it’s very recommended, must remove previous installation.</p><pre>$ sudo apt-get purge nvidia*</pre><p>Download the NVIDIA Driver</p><p>Latest NVIDIA drivers can be download from their official website ( <a href="https://www.nvidia.com/object/unix.html">https://www.nvidia.com/object/unix.html</a> )</p><p>Install the Dependencies</p><p>Other library as dependencies is required if we want to install NVIDIA driver via runfile. We need to install this dependencies first.</p><ul><li>build-essential</li><li>gcc-multilib</li><li>dkms</li></ul><pre>$ sudo apt-get install build-essential gcc-multilib dkms</pre><p>Blacklist the Nouveau Driver</p><pre>$ sudo nano /etc/modprobe.d/blacklist-nouveau.conf</pre><pre>with this content:</pre><pre>blacklist nouveau<br>options nouveau modeset=0</pre><pre>and then run this command</pre><pre>$ sudo update-initramfs -u<br>$ sudo reboot</pre><p>Stop gdm Service</p><p>After reboot/restart, open console from login page (ctrl+alt+f2). and stop the gdm service (Ubuntu 18.04 by default using gdm as dekstop manager) using this command</p><pre>$ sudo systemctl stop gdm</pre><p>Run the Installer</p><p>Enter the directory where you saved the downloaded NVIDIA driver installer, and run this command.</p><pre>$ chmod +x NVIDIA-Linux-x86_64-418.56.run</pre><pre>the file name should follow your installer file. then we can run this installer with this command.</pre><pre>$ sudo ./NVIDIA-Linux-x86_64-418.56.run --dkms -s</pre><p>Where, -s is for silent installation, and — dkms is used for register dkms module into the kernel. Before finish the installation, usually the installer will ask you to set a password to turn off the secure boot. Just follow their instruction and reboot the machine.</p><p>Check the Installation</p><p>you just need to run this command to check if your NVIDIA driver is successfully installed.</p><pre>$ nvidia-smi</pre><p>Thank you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=307c25f73259" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Django + Celery — Send email to admin when error occurs]]></title>
            <link>https://rosdyanakusuma.medium.com/django-celery-send-email-to-admin-when-error-occurs-e1e53643549d?source=rss-bcb73929917c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e1e53643549d</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[celery]]></category>
            <category><![CDATA[django]]></category>
            <dc:creator><![CDATA[Rosdyana Kusuma]]></dc:creator>
            <pubDate>Thu, 28 Mar 2019 15:19:29 GMT</pubDate>
            <atom:updated>2019-03-28T15:19:29.610Z</atom:updated>
            <content:encoded><![CDATA[<h3>Django + Celery — Send Email to Admin When Error Occurs.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HSdbbPD40ljcC8DdUnGJgQ.jpeg" /><figcaption>A view from elephant mountain, a 101 tower, Taiwan. FYI, I living in Taipei.</figcaption></figure><p>In this case, I have a Django project which using celery to handle asynchronous task queue/job queue. Since we must not set DEBUG on production side, to notice admin whenever error occurs is send an email with traceback info.</p><p>There are some steps to set up email admin notification due to error occurs. First, we need to setup mail configuration in our settings.</p><pre># settings.py<br>import os<br>import configparser</pre><pre>PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))</pre><pre>CONFIG = configparser.ConfigParser()</pre><pre>CONFIG.read(&quot;%s/development.cfg&quot; % (PROJECT_DIR))</pre><pre># mail admin conf.<br>ADMINS = (<br>    # (&quot;name&quot;, &quot;email&quot;),<br>    # (&quot;name&quot;, &quot;email&quot;),<br>)</pre><pre>EMAIL_HOST = CONFIG[&quot;email&quot;][&quot;EMAIL_HOST&quot;]</pre><pre>EMAIL_HOST_USER = CONFIG[&quot;email&quot;][&quot;EMAIL_HOST_USER&quot;]</pre><pre>DEFAULT_FROM_EMAIL = CONFIG[&quot;email&quot;][&quot;EMAIL_HOST_USER&quot;]</pre><pre>EMAIL_HOST_PASSWORD = CONFIG[&quot;email&quot;][&quot;EMAIL_HOST_PASSWORD&quot;]</pre><pre>EMAIL_PORT = CONFIG.getint(&quot;email&quot;, &quot;EMAIL_PORT&quot;)</pre><pre>EMAIL_USE_TLS = CONFIG.getboolean(&quot;email&quot;, &quot;EMAIL_USE_TLS&quot;)</pre><pre># A sample logging configuration. The only tangible logging<br># performed by this configuration is to send an email to<br># the site admins on every HTTP 500 error when DEBUG=False.<br># See http://docs.djangoproject.com/en/dev/topics/logging for<br># more details on how to customize your logging configuration.<br>LOGGING = {<br>    &quot;version&quot;: 1,<br>    &quot;disable_existing_loggers&quot;: False,<br>    &quot;filters&quot;: {<br>        &quot;require_debug_false&quot;: {&quot;()&quot;: &quot;django.utils.log.RequireDebugFalse&quot;},<br>        &quot;require_debug_true&quot;: {&quot;()&quot;: &quot;django.utils.log.RequireDebugTrue&quot;},<br>    },<br>    &quot;handlers&quot;: {<br>        &quot;console&quot;: {<br>            &quot;level&quot;: &quot;DEBUG&quot;,<br>            &quot;class&quot;: &quot;logging.StreamHandler&quot;,<br>            &quot;filters&quot;: [&quot;require_debug_true&quot;],<br>        },<br>        &quot;mail_admins&quot;: {<br>            &quot;level&quot;: &quot;ERROR&quot;,<br>            &quot;filters&quot;: [&quot;require_debug_false&quot;],<br>            &quot;class&quot;: &quot;django.utils.log.AdminEmailHandler&quot;,<br>            &quot;include_html&quot;: True,<br>        },<br>    },<br>    &quot;loggers&quot;: {<br>        &quot;django.request&quot;: {<br>            &quot;handlers&quot;: [&quot;mail_admins&quot;],<br>            &quot;level&quot;: &quot;ERROR&quot;,<br>            &quot;propagate&quot;: True,<br>        },<br>        &quot;debugmsg&quot;: {&quot;handlers&quot;: [&quot;console&quot;], &quot;level&quot;: &quot;DEBUG&quot;, &quot;propagate&quot;: False},<br>    },<br>}</pre><p>I also created development.cfg to store my configuration.</p><pre>[email]<br>EMAIL_HOST_USER: yourmail@gmail.com<br>EMAIL_HOST: smtp.gmail.com<br>EMAIL_HOST_PASSWORD: password<br>EMAIL_PORT: 587<br>EMAIL_USE_TLS: True</pre><p>in this case, I am using google smtp, you can set up with your own.</p><p>and then in your task.py, you can use celery signal ( <a href="http://docs.celeryproject.org/en/latest/userguide/signals.html#task-failure">http://docs.celeryproject.org/en/latest/userguide/signals.html#task-failure</a> ) and send email</p><pre># task.py<br>from celery.signals import task_failure</pre><pre>@task_failure.connect()<br>def celery_task_failure_email(**kwargs):<br>    from django.core.mail import mail_admins<br>    import socket</pre><pre>    &quot;&quot;&quot; celery 4.0 onward has no method to send emails on failed tasks<br>    so this event handler is intended to replace it<br>    &quot;&quot;&quot;</pre><pre>    subject = &quot;[Django][{queue_name}@{host}] Error: Task {sender.name} ({task_id}): {exception}&quot;.format(<br>        queue_name=&quot;celery&quot;,  # `sender.queue` doesn&#39;t exist in 4.1?<br>        host=socket.gethostname(),<br>        **kwargs<br>    )</pre><pre>    message = &quot;&quot;&quot;Task {sender.name} with id {task_id} raised exception:<br>{exception!r}</pre><pre>Task was called with args: {args} kwargs: {kwargs}.</pre><pre>The contents of the full traceback was:</pre><pre>{einfo}<br>    &quot;&quot;&quot;.format(<br>        **kwargs<br>    )</pre><pre>    mail_admins(subject, message)</pre><p>Thanks!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e1e53643549d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Belajar Machine Learning Sederhana dengan WEKA]]></title>
            <link>https://rosdyanakusuma.medium.com/belajar-machine-learning-sederhana-dengan-weka-a07032db8e12?source=rss-bcb73929917c------2</link>
            <guid isPermaLink="false">https://medium.com/p/a07032db8e12</guid>
            <category><![CDATA[weka]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Rosdyana Kusuma]]></dc:creator>
            <pubDate>Wed, 03 Jan 2018 17:06:44 GMT</pubDate>
            <atom:updated>2018-01-03T17:06:44.341Z</atom:updated>
            <content:encoded><![CDATA[<p>Sebelum kita memulai dengan sebuah <em>simple problem machine learning</em> dengan <em>WEKA</em>, ada baiknya kita mengetahui terlebih dahulu secara singkat apa itu <em>Machine Learning</em> dan apa itu <em>WEKA</em>.</p><p><em>Machine Learning</em> merupakan salah satu cabang dari disiplin ilmu Kecerdasan Buatan (<em>Artificial Intellegence</em>) yang membahas mengenai pembangunan sistem yang berdasarkan pada data. Saya tidak akan menjelaskan secara detail karena topic utama disana adalah cara menggunakan <em>WEKA </em>untuk memecahkan simple problem di <em>machine learning</em>. Artikel menarik dari <em>dailysocial.id</em> ini cukup bagus untuk mengerti lebih lanjut tentang <em>machine learning</em> ( <a href="https://dailysocial.id/post/machine-learning/">https://dailysocial.id/post/machine-learning/</a> )</p><p>Sedangkan WEKA adalah sebuah <em>machine learning tool</em> yang ditulis dengan bahasa pemrograman <em>Java</em>. <em>WEKA </em>ini memuat banyak <em>machine learning</em> algoritma di dalam nya. Dengan <em>WEKA </em>kita bisa melakukan <em>pre-processing data</em>, <em>classification</em>, <em>regression</em>, <em>clustering</em>, <em>association rules</em>, dan juga <em>visualization</em>. WEKA merupakan singkatan dari <em>Waikato Environment for Knowledge Analysis</em>, yang dikembangkan oleh Waikato University di New Zealand. WEKA juga merupakan sebuah nama dari burung yang cuma berhabitat di New Zealand.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/359/1*tP6kRT52bV73hNvAbn-DJQ.jpeg" /><figcaption>WEKA tool, dengan icon burung Weka yang hanya ada di New Zealand.</figcaption></figure><p>Mari kita mulai untuk mencoba sebuah <em>simple machine learning problem </em>dengan menggunakan WEKA. Sebelumnya, anda dapat mengunduh WEKA di tautan berikut, <a href="http://www.cs.waikato.ac.nz/ml/weka/downloading.html">http://www.cs.waikato.ac.nz/ml/weka/downloading.html</a> .</p><p>Kita akan memakai dataset yang sudah saya persiapkan, atau bisa dengan dataset yang lain, karena inti dari artikel ini adalah penggunaan WEKA. Dataset dapat di unduh di tautan berikut, <a href="https://rosdyanakusuma.com/files/datasets.zip">unduh dataset</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a07032db8e12" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Forecast Stock Market using Deep Neural Network.]]></title>
            <link>https://rosdyanakusuma.medium.com/forecast-stock-market-using-deep-neural-network-8e492a849958?source=rss-bcb73929917c------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e492a849958</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[stock-market]]></category>
            <category><![CDATA[predictions]]></category>
            <dc:creator><![CDATA[Rosdyana Kusuma]]></dc:creator>
            <pubDate>Wed, 03 Jan 2018 17:00:44 GMT</pubDate>
            <atom:updated>2018-01-03T17:00:44.824Z</atom:updated>
            <content:encoded><![CDATA[<p>Deep neural network or we can call it Deep Learning is become popular now. Before deep neural network, we understand the existence of Machine Learning. And before that, both Deep Learning and Machine Learning is lead to Artificial Intelligence. The history told us that Artificial Intelligence research field was born at the early 1950s, around twenty years later about 1980s the Machine learning research field was introduced by the researcher, then later around 2010s the Deep Learning starts spreading around the world research field and industry. Many research field can be implementing this phenomenon topic. In my humble opinion, almost every research field can relate to Artificial Intelligence technology. Economic, Biology, Medic, Vision, Agriculture and many more field can be implementing a package of Artificial Intelligence inside. We can take an example, for the simple thing like forecasting the weather, create an artificial robot that can learn by itself, the prediction about cancer in human cell, recognize the fashion, or forecast the value of the stock market.</p><p>On this part, we will discuss more Artificial Intelligence and Stock Market. As we know that we can do something than predicting or forecasting, we also can build a system that learning by itself and this system also have decision system to take action. If you remember one of British artificial intelligence company which is acquired by Google in 2014 called DeepMind has successful steal researcher attention with their research publication. The AlphaGo who defeated the world GO game championship, then they also have AlphaZero which focused on chess game and success to defeat previous dominating robot. And the other publication is about WaveNet, the artificial that can learn and create own speech. From those examples many researchers also try to implement the same idea to another topic, in this case we talked about stock market. Many ideas about using AlphaGo method to create an artificial robot that can do trading in stock market with main goal to get high returns with perform some technical analysis such as investment timing, trading strategies, and investment portfolio in some technical indices like moving average, random walk indices and moving average convergence divergence. The other idea is using the DeepMind WaveNet, some of researcher think that the moving trends of stock market can take some similarity with audio wavelength, using WaveNet they tried to learn the motive behind of stock movement in wavelength format then try forecast the next t-n value. Of course, not only using one method from DeepMind’s idea, some researcher also combines it with another algorithm.</p><p>Recently, Residual Network or we can called it ResNet also take some attention in research field with their shortcut method, they believe that the deeper neural network with shortcut block will help to reach high accuracy in forecasting. In meantime I try to implement this idea to forecasting stock market movement using residual network. The dataset source from top ETF in Taiwan fetching use Yahoo finance API. Using sequential data, split into training data and testing data. Training data using range time from 2000 until 2016 and testing data is during 2017. With sliding windows method to generate dataset and using up and down indicator for stock market movement. 1 for up and 0 for down movement. For comparing with situational case, I am using 5, 10, 20 trading days, which is can be representative as a week and a month. We can’t directly feed into keras residual network, because this algorithm designed for two dimension data, and our stock market data is one dimension. In order to create a one dimension resnet we need to re-write again. For this case, I generated ResNet 212 to get deeper layer. Except OHLCV (open, high, low, close volume) value, I also add more features from technical analysis to get more pattern in our dataset. Moving average and Random Walk Indices are added in our features. Running the experiment using Tensorflow backend with GPU support in 100 epochs can be finished in below 20 minutes ( it will depend on your GPU CUDA Core). Forecasting in binary classification has some beneficial. Some previous experiments lead to more classes will be harder to get high accuracy. The result is quite surprised because can reach accuracy above 60%, which is some researcher said that forecasting in time series is not easy to surpass 60% with validated result. It means we can’t not 99% believe the result, we also need to validate it on real situation.</p><p>A short story for Seminar report in Yuan Ze University.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e492a849958" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DOTA 2 di R programming dengan ROpenDota]]></title>
            <link>https://rosdyanakusuma.medium.com/dota-2-di-r-programming-dengan-ropendota-94c28d79397c?source=rss-bcb73929917c------2</link>
            <guid isPermaLink="false">https://medium.com/p/94c28d79397c</guid>
            <category><![CDATA[r]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[opendota]]></category>
            <category><![CDATA[dota-2]]></category>
            <category><![CDATA[dataset]]></category>
            <dc:creator><![CDATA[Rosdyana Kusuma]]></dc:creator>
            <pubDate>Mon, 10 Jul 2017 07:56:35 GMT</pubDate>
            <atom:updated>2017-07-10T08:00:02.321Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*MldLzsTYj8qdh0HhLE_Q7g.png" /><figcaption>Tampilan perintah di R console yang menampilkan beberapa fungsi dari ROpenDota</figcaption></figure><p>ROpenDota adalah sebuah <em>package </em>di dalam bahasa pemrograman R. Konsep dari package ini sangat sederhana, yaitu menggunakan API dari OpenDota dan memanggilnya di dalam sebuah R package sehingga kita dapat mengambil data dari hasil pertandingan DOTA 2.</p><p>ROpenDota dapat di install dengan mudah di R karena sudah terdaftar di CRAN ( <a href="https://cran.r-project.org/web/packages/ROpenDota/index.html">https://cran.r-project.org/web/packages/ROpenDota/index.html</a> ). Dengan menggunakan perintah berikut, <em>install.packages(“ROpenDota”). </em>Atau bisa menggunakan sumber dari github, dengan perintah berikut <em>devtools::install_github(‘rosdyana/ROpenDota’)</em> .</p><p>Latar belakang dari pembuatan <em>R package</em> sederhana ini adalah untuk membantu membuat <em>datasets </em>di salah satu project saya. Project ini berhubungan dengan mata kuliah saya tentang <em>Big Data Analytic</em> dan <em>Artificial Intelligent</em>. Project tersebut bernama “<em>Big Data Analytic on DOTA 2 to Analyzing Player Roles</em>” ( jika ada waktu insyaallah akan saya tulis di medium/blog saya ).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*4579LvTDuIpSlGJGYKyG-Q.png" /><figcaption>Contoh datasets dari ROpenDota</figcaption></figure><p>Saya dengan senang hati mempersilahkan jika ada yang tertarik untuk mengembangkan ROpenDota.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94c28d79397c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>