6 votes

What programming/technical projects have you been working on?

This is a recurring post to discuss programming or other technical projects that we've been working on. Tell us about one of your recent projects, either at work or personal projects. What's interesting about it? Are you having trouble with anything?

3 comments

  1. xk3
    (edited )
    Link
    I added support for other eBay marketplaces in my disk prices program: Austria, Australia, Belgium, Canada, Switzerland, Germany, Spain, France, Great Britain, Hong Kong, Ireland, Italy,...

    I added support for other eBay marketplaces in my disk prices program: Austria, Australia, Belgium, Canada, Switzerland, Germany, Spain, France, Great Britain, Hong Kong, Ireland, Italy, Netherlands, Poland, Singapore, United States. Typing out this message made me realize there was a bug in my link extracting function that I use everywhere so I fixed that (unrelated to the website).

    I've added a lot of small features and bugfixes to the site over the past week. One of the most interesting parts is probably the way that I represent currencies in the different region pages. At first I was customizing everything with a special DataTable render function which required me to pass in data about the way that each currency should be formatted--not just the currency symbol but also the different way that Belgium writes the before the amount and France writes it after--though both use , instead of .. And the Swiss use ' to separate groups of thousands instead of , but . for cents.

    $.fn.dataTable.render.number(',', '.', 2, '$')
    

    All of that information starts to become a bit tedious... but I was making good progress and almost done when I realized that the browser really does a better job at this:

    Enter Intl.NumberFormat!

    I basically replaced all of that complicated code with this:

    const _fmt_currency = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format
    
    function fmt_currency(data, type, row) {
        if (type === 'display') {
            return _fmt_currency(data);
        }
        return data;
    }
    

    By replacing the currency code for the different pages, it all works inside the browser. A lot easier and more accurate.

    Another thing that I realized that I could do to make things more localized is that instead of doing this (for the number of seller reviews, which is often in the thousands):

    $.fn.dataTable.render.number(',') 
    

    With DataTables.js I can just leave the preset blank and it uses the browser's locale:

    $.fn.dataTable.render.number()
    

    To test this I opened a browser like this:

    LANGUAGE=fr chromium-browser
    

    Neat!

    5 votes
  2. creesch
    (edited )
    Link
    Over the past few months I have been having a lot of fun on the Tildes minecraft server. But, often enough I just want to hang out here for the social aspect and chat with people online. So, two...

    Over the past few months I have been having a lot of fun on the Tildes minecraft server. But, often enough I just want to hang out here for the social aspect and chat with people online. So, two weeks ago, I went for the obvious solution of creating a minecraft mod which exposes a web chat so I can chat with people online in the browser.

    Effectively it consists of two parts:

    • A java back-end (the mod) keeping track of chat and acting as a server (using javalin) to serve static files and a websocket connection.
    • A web front-end using simple HTML and mostly vanilla Javascript (with @ts-check annotation for a bit of type safety).

    Developing it so far has been an interesting experience and a lot of basic functionality has been implemented:

    • Basic chat including minecraft message parsing to html. (Basically minecraft uses a complex JSON structure for chat text formatting and actions tied to specific types of chat messages)
    • Favicon updates to indicate new messages in chat if the tab is not in focus.
    • History is kept per server so on joining web chat you can scroll back up.

    Some other stuff is still in development:

    • Ping/mention functionality. Shoutout to @teaearlgraycold who is developing this and who also has been contributing in various other areas.
    • A user list so you can see who is online.

    With other things I still want to implement:

    • Tab completion
    • Overall better structure of the repo

    Minecraft mod development can be a convoluted experience as there is a lot of fragmentation, outdated information (the game is well over a decade old now), bad/missing documentation, etc. But overall it has been fun figuring it all out and getting things to work with still plenty of things to further implement.

    It also reaffirmed that I really prefer Maven over Gradle because of the more structured approach. The reason for choosing Gradle simply comes down to the minecraft modding ecosystem. Effectively modern day minecraft mods are built on top of mod loader libraries/frameworks acting as intermediary between game and mods. Providing APIs, keeping mods compatible, etc, etc. Fabric, the mod loader I created this mod on heavily leans on Gradle and all documentation is effectively geared towards Gradle use. To be fair though, once it is configured it works fine though.

    3 votes
  3. Turtle42
    Link
    Ooo I've been waiting for this thread to show up. I started making this little library catalog to catalog my own home books because I didn't see a self hosted one I liked. It was initially going...

    Ooo I've been waiting for this thread to show up.

    I started making this little library catalog to catalog my own home books because I didn't see a self hosted one I liked. It was initially going to be just CLI tools or something since I didn't have much HTML and CSS experience but it quickly snowballed and now I have a presentable working webapp that I'm actively improving with the hope that some day it might be good enough to deploy as an open source self hosted application if I can ever get it to that point.

    Here's the GitHub page if anyone wants to tell me what I'm doing wrong :) The interface has already had more updates that I haven't posted yet. It's been very addicting.

    3 votes