Showing posts with label development. Show all posts
Showing posts with label development. Show all posts

Tuesday, November 3, 2020

FPS Mismatch Pain

I am dipping my toes into video production. I began with some collage-style music videos now I am starting a YouTube channel about wrist watch nerdery. One pain has become immediately apparent is the trouble of frame rate. I made the mistake of adding audio as the first component to my video, so the frame rate wasn't set to my video's FPS. To my surprise the audio was out of sync with the video. I had never encountered this, my collage videos all used an audio track and video only clips.

I tried going into VLC and saving each clip's audio as a separate file, then importing it into Blender but I wasn't aware of exactly what was going on. It was still out of sync.

I next tried manually getting the FPS to match my video but then it refused to render (I later found some other settings I could have tried that may have helped).

My projects were still set to 30FPS so I had to keep all my clips short so that the mismatch was unnoticeable. I then learned how to set my phone camera to 60FPS and figured while I'm struggling with this, I may as well get a higher frame rate.

Bad Idea.

The only camera on my phone that is capable of 60FPS is the back camera. The front camera is still 30FPS. So I ended up with some clips at 60FPS and some at 30FPS. So I went through every 60FPS clip and converted it to 30FPS using FFMPEG.

Tonight I'll be starting a new video. I'm hoping it goes smoothly. By dragging my clip into the timeline first thing I believe the project will automatically set the the FPS.

After working on the video tonight, it did indeed set a custom FPS, however there is still a little bit of drift. This will be a problem when I get better and can create longer takes but for now it works well enough.

Wednesday, July 1, 2020

Clipboard Project

I've been coding in Java (Late at night) for a few years now. Most of my projects are console applications or arcade-style video games. Being hobby efforts, they usually require very little intense research. If it makes my head hurt, I do something else. It is my free time after all.

As a consequence I haven't done much with Swing and GUI development. Nor have I done much with the clipboard. But now I have reason. I am unable to use my all-time favorite clipboard manager so I need to write one. I am amazed at how easy it has been so far. True, I've done an obscene amount of web searching, and there is some funk in Java I've uncovered.

The benefit is I get to add even more VIM nerdiness to my project than CopyQ has. Also I've coded it to store everything encrypted. I have it minimizing to the tray and clips can be edited or deleted.

Still to do...

- Add a global hot key to display the window.

- Add 'permanent' bookmarks that can be arranged into categories or similar.

- Debug why it randomly doesn't load the stored clips when launching the application.

- Maaybe pop the window up at the mouse.

- Add options to the application.

Thursday, June 11, 2020

Never Say Always

I am FAR from a guru... or anything resembling one. I am self taught so often I know things, but am unfamiliar with their terminology. I may be unfamiliar with commonly taught problems or patterns. So don't give my thoughts too much weight.

I just watched yet another "Why <Insert Name> programming is horrible" video. In this case it was OOP (Which I personally like). I've seen a few of these. It is always fun to hear the criticisms of various languages or programming patterns or editors etc. The arguments typically go:

1. <Insert Name> is terrible. You should never use it (Gotta get the clicks).

2. Here's some arguments why it sucks.

3. But... sometimes it's useful.

4. Use <Insert Name> but not all the time.


I say use whichever paradigm works - when it works. It's like Kung Fu. If you are sparring and you are a 'kickarian' when you opponent has moved in past your kicking range, into elbow range let's say. Forcing a kick to happen is ridiculous. You need to throw some 'bows. Forcing everything into an object is just as bad... so is forcing everything to be procedural, or 100% CSS, or whatever the extreme proposition is. If it works best in a situation, use it.

Thursday, April 16, 2020

I've Done It

Well I've done it! I've created a relative path method that can walk up into another folder and back down until it finds the file! So it can generate relative paths even if the song files are not within a directory within the playlist. The task was easier than I expected. I use two strings one for walking up the path and another for walking back down to the specified sibling directory. Then I add the file name.

I've begun moving over my mp3s and setting their tags and adding them to playlists in my playlist manager. So far everything is working well.

I do have to rename my application. It manages playlists, not mp3s. We'll see how tough a change that will be.

Monday, April 13, 2020

The MP3 Problem

I have years of collected MP3s. They are arranged in directories, some by band name, others by genre, and still others by 'playlist' (New Years, Birthday, etc). The trouble is I have numerous duplicates of many of my song files. I want to have one single source of MP3s added to various playlists. However I need those playlists copied to different directories so I can copy them to my phone. There are a few apps out there that do this but so far I have not found a tool to meet my needs.

I decided to build a simple playlist manager with my specific scenario in mind. Then I would cleanup file names and get all the ID3 tags set on ALL my song files and copy them into one directory. A massive 'nosql database' of songs. No duplicates. Any duplication would occur in the playlists, not in mp3 files themselves. I would then create playlists for whatever I want. These would be used to export their songs to whatever directory I want for copying to my phone etc.

I set to work. Creating a console app with super basic 'file browse' methods etc. It kept everything in a database and would copy files out to wherever. However it wasn't very friendly to use (Even for a console app lol), it was time consuming and I kept see weird bugs and odd behavior.

So I gave up.

Then I thought of a different tack to take. I would build it as a GUI app that essentially creates standard .pls files. However, even though it is basically a text editor, it is used more like a playlist manager. You create, or open a playlist and add songs to it. You can delete songs just by highlighting the text and deleting it. When you save the file it goes through and fixes the relative paths and rebuilds the entries for each file present in the text editor.

Then you can export the currently open playlist's files to another directory. This is all working so far! However I really need to update the relative path code to be able to walk up and into sibling directories etc. It currently can only handle child directories.

In the future I may update it to a more logical control like a grid or list, but the text field works fine for now.
I am currently cleaning up all my song file names and setting their ID3 tags. This is going to take a LONG time.

Saturday, March 21, 2020

Slick Help

I have added more features to the markdown parser I wrote the other day. I added tables, and the ability to set column widths. So it isn't really a standard Markdown. The tables feature ended up working better than I thought it was going to.

I added the ability to link to other topics within the help system. This task was actually pretty tricky. Every time a help system is compiled the topics get new GUIDs, so I couldn't rely on those - and even if I could, how would the author know what the GUIDs are? I decided to add an alias property to the topics in the DB. This property can be used to link to other topics - and - display a 'back' link if a second alias is in the markdown. It worked smoothly.

Next I tackled images. I created two types of image definitions, one that uses a relative path to an Images directory, and the other a full URL. It is limited, but the idea of Markdown is to quickly define a readable document, formatting syntax should be fairly unobtrusive. I may allow for centered or text wrapped images though. It would be good to at least allow that much formatting.

I'm surprised at how fun and powerful this help engine is, now that I added markdown ability to the authoring of topics!

Saturday, January 4, 2020

Data Data Data

I have muscled through building a MySQL web service and a website to consume it. The site is still pretty bleh-looking, but it functions acceptably. I need to update it to be responsive so it looks good on phones and similar devices. But even more importantly I need to build up the data in the database. The whole idea is to construct an extensive wrist watch library. I want it to allow people to find watches using criteria that typically isn't available.

I'm often looking for things like watches that are time-only (No date, etc), or watches with a specific crystal material, or case thickness. Most sites allow users to filter on a couple of these attributes, but very rarely by all of them. So to make the service - and site - useful, I really need a massive library of watches with ALL their details and attributes.

I haven't yet thought of an automated means of doing this, and so far each watch entry takes a bit of time. I have to do web searches to find out specifications not outlined on the various sites selling them, or even the watch brands' own sites.

I have, however, just moved my insert code into procedures. Now I can call these procedures and keep track of the watch id associated with the watch attributes I'm inserting. So now, at least I don't have to hardcode the watch ids. I increment the watch id variable after calling the watch insert. So as long as I call the attributes inserts right after the watch insert, the ids will be correct.

This solution is still slow, but far easier than what I was doing before - and I can break up my calls to the inserts into any number of sql files.

Sunday, December 22, 2019

Simple Service

I've been working in CodeIgniter for the past couple of weeks, building a wrist watch library site. It is a great MVC framework. It actually works out of the box and it's simple and straightforward. But...
I really hate web development. The client / server barrier is super annoying, and sadly the one thing I found lacking in CI was calling a controller within a view (Like a sub view), doesn't seem to receive the data in the sub view. It can access the parent view's data, but not its own. So you either have to do full page refreshes, or load everything into the parent which could get out of hand.
I didn't want to use POSTs to interact with the backend, I wanted to allow users to bookmark ANYTHING they were looking at. But this quickly became an absolute nightmare. Finally, it became too much. I was no longer having fun.

I decided to just focus on the database. I started fresh, and this time I'm not over engineering it. Watch attributes are pretty stable. People will be searching for specific case sizes, lug widths, crystal material, etc. So I created a fairly flattened table. This makes it much easier to add items without an admin interface. But MySQL query outputs are not fun when you have a ton of fields in a table. I tried setting the output format to JSON but it was having none of it so I settled for VERTICAL output. But that kept annoying me too. And I really didn't want to just have a DB. That's kind of useless.

I decided to create a web service. I've done a little work on services at work, mainly either C# services or tweaking YAML definitions. But this is all updates to existing solutions. This would be good, building a service from scratch. I would like to do NodeJS, but so far I'm not familiar with free Node hosting. I know PHP/MYSQL hosting is super easy to find and configure etc. I decided to use PHP. So far it is great! there were a few 'head-meet-desk' moments, but now I can search the data and see it in JSON. And when I'm done, other people can leverage my growing watch database.
And so can I!
I probably will at some point.

Tuesday, November 12, 2019

Granular Collection

Granular CollectionI am currently returning to my PHP MVC application project. It is a collection of objects. The idea is to build a super granular item database / search tool. My particular implementation of it is wrist watches. I can do a pretty good search for watches on sites like Chrono24 and the gray market site Jomashop. But these have definite limitations.
For example, I like watches that are categorized as dress watches. I also like watches that do not have a date complication. With this app users can search for watches with a specified case size, lug width, date or no date and many other attributes that other sites cannot search on.

I am very new to this particular framework, however, so it'll be interesting to see how I can pull it off. I am using categories and a linking table for them, as well as an attribute table and a linking table for them. The attributes will drive the search page so it can be expanded as needed. The idea is to build a framework for collections of any number of items, not just watches.

As I make progress on this I will post the project's URL.

Wednesday, November 6, 2019

Oh the Memories

The next month or so, at work, will be mostly one project and one language ...

VB6

It is so weird coding in the first desktop language I ever learned. I remember back when I was just learning HTML and a little bit of CSS. I knew just enough to put up pages of info and horrible GIFs. I wanted to build desktop applications so I installed Visual Studio and began laying out forms etc. At the time I had no idea how to actually make it do anything, but my neat looking forms would display when I ran my creations.

Now I have nearly two decades of coding in various languages, project types, and platforms under my belt. It's interesting dealing with VB6's quirks and 'features'.

Most notable, it seems that IF statements consider every check in them, even if the first check(s) fail. At least that is how it was behaving. I had to break up the IF I was working on, nesting the second check inside the other - then it behaved as I expected. I am still able to web search any questions I have and there are plenty of topics and articles still out there. That's a good thing.

I'm guessing I'll have plenty more to say in the coming weeks and months.

Wednesday, May 8, 2019

Clipboard Trouble

In my foray into c++ so far there's one piece that is still eluding me: copying to the clipboard.

I want to be able to copy field values directly to the clipboard. So far this is eluding me. I've seen qtclipboard snippets but I've yet to get that class successfully added to my includes - even after installing qt on my laptop. I think that part of my problem is I'm trying to maintain a single code base. I don't mind needing to build windows binaries all the time, I DO need to structure everything so I don't have a nix directory and a windows directory (AND yet not have messy directories). I want one copy of the code files, one copy of the help defs, that's it.

At this point, after trying a few different options, I've put it on the back-burner.

Monday, May 6, 2019

Simple Fixes

I'm not sure if I'm a lazy developer, but I like my code like I like my computer's desktop - minimalist. I can appreciate engineering a solution for flexibility and robustness but either my skills are way below the people who write such code or their code is really difficult to decipher and update - or simply implement. If I'm looking for reusable code snippets I can use, as soon as my eyes start to glaze over I move on and look for a simpler piece of code. I'm pretty sure that says more about my skills than the snippets authors.

A great example of my minimalist tendencies is a fix I made this morning. I don't code in Python but I currently support an image data extraction script written in it (So I'm doing a lot of hilariously noobie web searches). I need to run large batches through it via input file of DB record IDs. The trouble is it isn't 'resumable'. So if it works all day and crashes before the batch is done, it has to reprocess everything from the top.

I'm not sure what other developers would do, here's what I did:

If it doesn't exist, I create a file:
<input file name>.bmark.txt

Where the script reads the input file into a tuple, I set bookmarkid the first row of the bmark file.

For each row of the input file... If bookmarkid is not "", is the current input id the bookmarkid? If so, clear the bookmarkid.
So the next row in the input, we have a bookmarkid of "" so we add the input id.

Later as we run the ids through SQL, as each one completes, I replace the bmark file contents with the successful id.

When everything is done, I delete the bmark file, just to be tidy.

So that was my minimalist solution to the problem. I added a little file to persist the last successful id that was processed. And when the script is started, I grab any 'bookmarked' id and check for it (The code was already reading the rows into a tuple, I just skipped adding them to the tuple until the bookmarkid == ""), resuming at the next row.

Win Build on Nix

I have completed a functioning version of NMX (Note Matrix - a project I've been building and rebuilding in various languages and platforms for - probably almost 15 years). It is a console-based notes / bookmarks / todo list / contacts etc app. It uses SQLITE for its database and every time an entry is viewed it creates a txt file of that entry, so you can view your data in any text editor (This feature came about in the Java version, so if you have Java issues, or the DB becomes corrupt, or incompatible with future versions of NMX, you can still read your data).

Being a total c++ noob, compiling the Windows binary was a challenge. I setup a virtual Windows box and tried Mingw. I had a hard time getting the SQLITE .dll linked. After a few attempts I decided to go with an IDE to build it. I went with a free lightweight app: Code::Blocks. I got my c++ files loaded into a blank project and linked the SQLITE .dll and it built!

My only concern was that the Windows OS in my virtual box would expire in about a month or so and I would have to rebuild it. So my goal was to be able to rebuild the Windows binary from within Wine.

I downloaded and installed Code::Blocks and Mingw in Wine. I had to get the Ming Gcc/G++ installed then it worked! I had to find and add the .dll versions of the standard libraries. I put these in the same directory as my sources. I tried creating a .bat file to call the same commands that Code::Blocks does when it rebuilds, but this didn't seem to work, so I'm stuck with Code::Blocks, but at least I can run it in Wine instead of a virtual machine.

Wednesday, April 17, 2019

CPP Progress

I have made progress at last. My implementation of my note-taking app now parses input, doing wildcard matches on the users input, against pipe delimited possibilities. It now creates new Entries and has a method to show them. I need to create the view entry command and I need to format the output, but it's a solid start.

I'm slowly beginning to feel more comfortable with the language and how to accomplish what I need. Pointer types are still tough, but getting better. I finally resolved the re-declaration error from header files being included more than once.

I'll have to setup a Windows vbox so I can grab the SQLITE .dll and compile it for Windows.

More to come...

Monday, April 15, 2019

C++ No Class

I've always worked with OOP patterns, even when I didn't know what I was doing. Honestly it makes sense to me, naturally. It is easy for me to wrap my head around how large problems can be broken down into manageable objects. I feels organic and natural to me. As many OOP explanations point out, it mirrors reality. I have a much harder time understanding functional paradigms. it just feels like the dreaded 'spaghetti code' to me.

However, as a high level language developer digging into C++, my feelings are a bit reversed. When I attempt to define and consume classes etc, I keep running into all sorts of issues - redeclared variables due to includes. However if I remove the offending includes I get 'cannot find X'. I feel as though I'm in a catch 22.

So for my first C++ project I've decided to avoid the headache altogether and code everything within functions. Sort of a noobie functional paradigm. Instead of classes I'll have header files containing that element's functions which are called in main and in turn can call other functions if needed.

So far I have sqlite hooked up and some basic string parsing - which is frustratingly difficult so far. I'm amazed at how difficult simply doing a string split is in C++. More on that in future articles.

Tuesday, February 12, 2019

My Java Project Structure

I do all of my Java coding 'by hand'. I don't use an IDE and I don't use build/packaging/deployment tools. I like to get my hands dirty and I like to know everything that is in my project, I don't want any black boxes. Of course if a project were to become so complex, or powerful, or huge as to require additional tools I will use them. But I would be sad that I had to.

I use little shell scripts I wrote to do the compiling of code and packing of .jars. I use VIM to write all the Java code. I have a common structure that I use for all of my projects and I will share that with you here.

ROOT
Each project is a self contained unit. It lives within the project root directory. In this article I will use WorldWeaver (My IntFiction engine) as our example. All of the client code, classes, and output, and anything else for the project lives in:

~/worldweaver/

At this root level I have any shell scripts I use for compiling and running etc.

CODE
The code directory contains all of my source code (.java). I follow title case for all of my classes. - However, I'm bad, I use title case for my methods as well. And I use title case for my public variable methods, camel case for my private variables etc. I think this is a habit from my .NET days.

COMPILED
The compiled directory is where I have my .class files built. This directory also contains my manifest file.

RELEASE
The release directory is where my jar file is compiled. It contains any files that are to be distributed with the app, including data files, config files, and databases etc.

The full structure is:

ROOT
  |__ CODE
  |__ COMPILED
  |__ RELEASE

I use javac with parameters for all of my building, copying and calls to java -jar in my shell scripts for launching, although I could also chmod the jar as executable and double click it like in Windows or Mac OS.

Monday, February 11, 2019

Regex, TDD Style

I've not done a ton of Test Driven Development (TDD) but from my understanding of it I like the idea. It's like checking your work in math, only backward. It forces you to check your work. You can't say: I would have checked my work but I ran out of time. At least that is my layman's perspective.

But I think the benefits of TDD may actually stretch into the core problem solving of programming. We know you have to think differently when taking a TDD approach, but I think that it could actually make the problem solving easier, and actually make learning new languages or syntax easier too.

What am I talking about? I just watched a video that walks the viewer through building regex expressions and the host did so by taking a TDD approach. He started with a valid value, and wrote a simple regex that would pass anything. Then he began to harden up the expression until it properly found only the desired values. I went away from the video with a far greater understanding of regex than I had before (I typically hamfist my way through regex use, scouring regexlib and using their tester tool to make sure what I find will work for me. Now I actually understand the syntax and rules of basic regex expressions - AND I saw a great way to actually author my own instead of copying/pasting existing expressions.

All through the use of TDD style regex expression writing.

Monday, February 4, 2019

API


I'm looking to build an API-based application. It's been a while since I've done any serious web work.

As I look into beginner API development it is becoming obvious how little I know. Apparently I've been spending too much time in the back end. It's going to take me a bit to get up to speed. Postgres was frustrating, couldn't even get a DB created. So that will be the first thing I tackle.

Ultimately my goal is a complete system of just APIs that could be used to build whatever UI a developer wants. The 'social end result could be a console app or a complex, full blown website or mobile app. Features could be included / excluded as desired. In an age where software is constantly taking away our ability to tweak and customize it, I want to go the opposite direction.

Sunday, January 27, 2019

No Idea

I feel like I haven't actually coded in my free time in a long while. I've definitely been busy with projects but they don't involve coding. I am building the Atomic Cage IntFiction game, and working on modeling some cars for a game, and doing tweaks to my murdered out Jreepad. No real coding.

I want to code stuff, but I don't have any idea what. I love console apps, and nerdy tools like VIM and would love to build something along those lines. I'm limiting myself in my choice of languages - Java. I can mimic multi-line input but it's funky and basic. Also it is difficult to launch other applications.

I have my contacts / todo list maker / bookmark manager but I've been working on it so long there isn't much I can add to it.

As I work on the game and meshes I'll ponder project ideas but so far I don't have any.

Friday, January 11, 2019

The Tutorial Path

Tutorials are such a great tool. I find that I learn best using them. When I'm interested in a particular goal or project often I'll follow a tutorial or two. After doing so I typically have enough tricks or knowledge under my belt to begin to tweak the project to my liking. From there I become more and more independent of guidance.

Recently I've been going that route with abstract 3D art. I've done three tutorials and tonight I built a creation that is more my own making than a closely followed tutorial. It is probably still obvious which tutorials I learned from but the end result is definitely different from them. And I have some ideas for future pieces that I will most likely be able to pull off on my own.

I am a beginner for sure, but I now know a few tricks that will get me closer to being able create what I envision.

Introduction to WorldWeaver

A New Iteration  I've been working on the second manifestation of my Interactive Fiction engine - WorldWeaver - for about a year now. I ...