Schwartz Engine

Schwartz Engine

About This

I develop Android Apps and games. I play board games and I am an experienced GM in warhammer Fantasy Role Play (1st and 2nd Ed). I am also painting and sculpting miniatures.
Yes that's right I am a freak - No mistake there, I even exercise Ju-Jitsu twice a week too. I am using this media to track my work and organise it a little.

I'm an old fart :-)

LifePosted by Carsten Schwartz Jul 15, 2019 13:46
Yep, that's right!

I have had some problems with my back the last couple of years and overstretched it during Ju Jitsu practice a couple of months ago. It made me wonder if I should stop practicing Martial Arts entirely.

But luckily one of the guys from the Ju Jitsu Club made me change my mind to change to the Tachi Ryu School of Ju Jitsu where you not throw people but fights standing using kicks, fists, pain points, strangulations and locks. My problem is that I can handle being thrown and also do some of the throws, but I have reached a level where the throws in that higher category are to taxing on my back. So luckily the club has a standing version of self defence I can attend instead.



In that connection I have gotten som training videos and by coincidence started drawing some of the poses the other night, It has been a while since I last did sketching but it was really fun. I find it highly relaxing to sketch stuff even though I have to figth a little drawing hands and feet and getting the proportions right, I guess more practice will make improve that. Highly recommended, it's an old habit of mine which I intende to do more of in the future :-)











  • Comments(0)//theengine.schwartzengine.com/#post34

Yesss! Now my Android Phone Lives Yet Some Years Again...

Apps an' MobilesPosted by Carsten Schwartz Mar 08, 2019 16:36
Yep that's right!

I just added some more life to my OnePlus One Android device.

As of late I have noticed that my phone's battery performance have dropped significantly. So what to do? I looked for a OnePlus 6 on Ebay and you can easily get one for some $550 since it is last years top model in this range.

But then I tried to see if it was feasible to buy a new battery and replace it myself, low and behold the guys at IFIXIT have a nice guide on how to do this, so I ordered a battery at around $60, included in this package was a kit to do the replacement with 9 free tools as an extra.


I received the package and one afternoon I did the moves to replace the battery. The guide from IFIXIT made it for me. It was easy enough to get the back panel of the phone with the included plastic tool and then loosen the screws.


Then it started to get a little difficult. The battery is glued on the back side so you have apply some controlled force as you loosen it. But of it went and I inserted the new battery, mounted the screws back in and put on the back panel. I turned on the phone to check out the battery status, the phone booted but into a recovery menu, and I had some anxious moments because the #$!??! phone kept returning to this menu. Luckily I noticed that the back panel not was put back on all the way and that this held the volume button down, and surely enough as I clicked the panel in place the phone booted as normal.

I have given my phone some more years spending $60 and some sweat and saved some $500 in the process. I still baffles me in this hysterical climate debate and save the earth alarmist age, that you are unable to buy a new battery and replace it without having to take your phone apart in a difficult way. I am lucky that this phone only requires loosening of the back panel and some screws, other phones you need to heat up to disassemble with a higher risk of ruining your device. Some years ago it was easy take of the back panel and slide the battery out and put in the new battery. A waste of resources, that this causes a lot of people to buy a new phone after 2-3 years, and not very friendly towards the environment, but we don't talk about that do we?

BTW: To read about the unscientific climate debate I recommend reading Climate of Extremes: Global Warming Science They Don't Want You to Know by Patrick J. Michaels and Robert Balling Jr. A book on how Climatologist was told to shut up about the truth about the climate because it not fits with the alarmist narrative :-)
















  • Comments(0)//theengine.schwartzengine.com/#post33

Updating how hard can it get...

LifePosted by Carsten Schwartz Oct 17, 2018 22:27
Yep that's right I just updated from Ubuntu 16.04 LTS to 18.04 LTS. A dialog has been popping up asking me to update for a while, I have chosen to 'Ask me later' for a while too, since I felt the risk of loosing my setup was to high. But the other day I gave it a go since I have backup of everything including my text recipe for installing the most used development tools and utilities I need...


What can I say everything works as it did before, even Wine that gave me troubles when I tried to install it on a previous test installation of 18.04 LTS I had made on another machine. So What's not to like. And the process was relatively fast also, yes I am still not looking back to use Windows again this is a keeper!

as an aside; I had some short moments of almost anxiety when the tilde character '~' showed up as '-' in the terminal window when I checked if Git still was running as expected. It turned out that thew font I had chosen used this to display the tilde character and that is still worked. I have now changed the font to something that displays the character properly. ;-)

  • Comments(0)//theengine.schwartzengine.com/#post32

Creating a Central GIT Repo from Scratch

Apps an' MobilesPosted by Carsten Schwartz Oct 03, 2018 22:06
Achtung-Achtung! Nerdy GIT article yet again - You have been warned


Alas I discovered that I had forgot to put my TypeScript Code under wraps in a repository, so away I went to make a new repo, so I after some attempts I made a new repo using this command:

git --bare init --shared TypeScriptCode.git

This created a ready bare repository I intended to use as my central repository.

Next step was to create a place where I could work with my code. So:

cd ~/Work
git clone file:///home/carsten/GitOrigins/TypeScriptCode
cd TypeScriptCode/

Then I copied the code from where I had the original directories from my typescript work on amongst other things the Asteroids Clone, and after that started to add stuff:

echo '*/built/*' > .gitignore
git add .gitignore
git add AsteroidsGame/*.js
git add AsteroidsGame/*.ts
git add AsteroidsGame/*.html
git add AsteroidsGame/*.json
git add AsteroidsGame/resources/
git add AsteroidsGame/sound
git add CommonLib/*.ts
git commit -m "Initial Checkin"
git push

And then I was started, I added the rest and after some testing, now I have a central repository for my typescript code...






  • Comments(0)//theengine.schwartzengine.com/#post31

Griswolds' Edge aka I'll Kick Some Monsters Ass!

Apps an' MobilesPosted by Carsten Schwartz Sep 07, 2018 14:42
The other day putting some trunks up into my ceiling space, I fell over some old PC game's from way back. I had just listened to an episode of one of my favourite podcasts The Retro Hour about the making of Diablo at Blizzard North, and there it was in and old almost not dusty box, the original Diablo I CD Game I bought back then with manual and all.


Since I am running Linux now I started up Windows 10 in Virtual Box but Diablo I was not designed for this version of windows, so I went ahead and made a Windows XP instance and installed it in there.


It ran like a charm and I have been playing a lot of this with a true nostalgia feeling. After a while it started to annoy me that I had to have the CD in the drive to play. But that is the great part of running in VirtualBox, I simply made an iso of the CD and added that as the CD to the XP instance.


No more screams from the spinning up and down of the drive, and a big performance boost since the Diablo data now is loaded from an iso file on my SSD drive. This makes these old CD based games fly compared to the old days when tou had to have the disc in the drive.

And further more, Windows XP also boots and runs extremely fast from an SSD based VirtualBox based image, much faster than back in the day ;-)

I am considering using this for my graphical editing, since Paint Shop Pro might execute faster even though this is a VM.

BTW! I look like a Knight Tank now!


























  • Comments(0)//theengine.schwartzengine.com/#post30

It's Insane I tell YA! - Aka The Git Based Buuugh Hunterrrrhh II!

Apps an' MobilesPosted by Carsten Schwartz Aug 11, 2018 09:18
Achtung-Achtung! You have been warned - A geeky article on Git and strange behaviour in the Java Swing API ahead!


First Step - Migration to new Git Repositories

Until recently I have used SVN for versioning of my game software, but the other day I talked to one of my colleagues about migrating my repository from SVN to Git. It seemed a natural choice, since Git its the versioning control system of this age and in my new job we work and code on a Linux platform using Git extensively on the command line.

I had some vague hints that I could use Git by calling git svn to clone my old SVN repository. Later that evening I had some time on my hands and started migrating. I don not use the cloud for backup I have several USB devices where I backup my stuff. My original repository is file based of the same reason and has this file based url:

file:///home/username/Android/AndroidRepository

So away to the terminal I went, created a GitOrigins folder for my new Git repositories. My Goal was to split my apps into individual Git repositories. I called git svn just to see what options I had before going ahead, but that didi not go well git: 'svn' is not a git command. See 'git --help' the terminal responded in its silent clinical way. No problem git-svn is part of the Git core system and can be installed on Ubuntu by calling:

sudo apt-get install git-core git-svn


Just to prepare I titled myself Sir GoogleALot for a period to find some recommendations on how to best procede after my web adventure I was ready to go. Starting with A Dungeon Horror Deed which was implemented with a trunk a folder called ADungeonHorrorDeedPilot/trunk in SVN I invoked my first magic Git conversion command in my GitOrigins folder:

git svn clone file:///home/usernam/Android/AndroidRepository/ADungeonHorrorDeedPilot/trunk

After a lot of conversion output in the terminal, I ended up getting a trunk folder. So now I needed to convince myself that it indeed was a valid Git repository so I installed some nifty Git tools for interactive meddling and started gitk which is a graphical viewer by calling these commands:

sudo apt-get install gitk
sudo apt-get install git-cola
sudo apt-get install git-gui
cd trunk
gitk

gitk is for browsing branches, commits and changes, git-gui as a helper for gitk and git-cola to work with commits and other git activities. Starting gitk showed med that I was in a valid Git repository.


But I wanted to extract the repository with the specific name ADHD, not trunk. I deleted the new trunk folder and invoked git-svn to extract to that specific name:

git svn clone file:///home/username/Android/AndroidRepository/ADungeonHorrorDeedPilot/trunk ADHD

And it went as expected, you can name the repository by adding the name you want at the end of the command as can be seen from the last calls. After this I went ahead and converted the rest of the repositories I had and checked all repositories with gitk for validity and they where ok. So far so good, at this stage I decided to make a zip of GitOrigins and saved it as a backup.

WTF! My origin must be bare!

After cloning all my projects to independent repositories, next i wanted to try out working with the code. As the first thing I made a Work folder and cloned the ADHD repository there by calling:

mkdir Work
cd Work
git clone file:///home/username/GitOrigins/ADHD
cd ADHD


Git has to know who the user is to do its operations this was done with these commands:

git config --global user.name “username”
git config --global user.email “username@gmail.com”
git config --global color.ui 'auto'


Now for the funny stuff, importing the ADHD project to Eclipse, building it and running it in a virtual Android device. It worked like a charm. However calling git status showed me that i had both a bin and a gen folder containing untracked files. These folders are generated but not needed to be put under version control, so in the best Git style i made a .gitignore file containing:

/bin/*
/gen/*

Now my git status command showed me that only the .gitignore was untracked so I tracked it and comitted it:

git add .gitignore
git commit -a -m "Initial version of ignore file"


No problem, so now to push this local change to the origin in the GitOrigins folder:

git push

But to my horror this failed to begin with. There are two types of Git repositories, bare and non-bare. Bare repositories are a working copies with out the actual files, but contains the Git version of the files in the form of structured changes and hashes, and these are the ones you per default can push your changes to.

To convert an existing working copy to a bare use these commands, for a working copy in a repository called myrepo:

cd myrepo
mv .git ../myrepo.git # renaming just for clarity
cd ..
rm -fr myrepo
cd myrepo.git
git config --bool core.bare true


I made a script containing these commands, that takes the name of the directory as the one argument to do this:

cd ${1}
mv .git ../${1}.git
cd ..
rm -fr ${1}
cd ${1}.git
git config --bool core.bare true


This was used to convert all the folders in my repository directory called
GitOrigins like this:

./make_bare.sh ACurrencyCalculator
./make_bare.sh ADHD
...


Then I could Push ;-)

The Sultan of Swing - Aka Weird Bug Solving

After this initial effort I also imported my ADHDEditor project. It all ran smoothly and I only had to ignore a bin directory since the editor is a Java Swing application. So i tried it out and to my horror discovered an undetected bug in my editor. As it turns out I have been a lazy bastard when I made the editor using JOptionPane to create most of my entity editing dialogs. Some of them uses JComboBox to select an entity icon and dynamically show it when a new selection is made in the JComboBox through a cunning listener implementation:


In the code that prepares the JOptionPane I did this to set the JComboBox:


But due to something weird in the Swing API for this listener implementation the icon is not updated when I try to edit a Quest where the first entry in the type ComboBox is selected. Strangely enough I also have a JOptionPane setup for editing monsters but that does not have the same problem. After messing around I ended replacing the setSelectedItem call with this fix:


I solves the problem but is not really a satisfactory fix since I can not can find the core reason for the bug imidiately, but it will have to do for now.

Final Elimination of the Franken Bug

As an aside it just occurred to me that the editor code for different entities can be put into separate classes, making the code even more maintainable. I have started this process with the QuestEditor class. I it will also give me a chance to dig deeper into the problem, because it is easier to test a single class like this.

And testing this way have also enabled me to find the problem. You can not invoke a change listener by selecting and item that already is selected. So I have made a method that updates the Icon that can be called in the listener and be called during the creation of the editing dialog and this solved the problem.

As a follow up here a small week after I wrote this post I can tell that the Editors has been moved to separate class removing some 500 lines from the main class file and at the same time giving a much better overview, making it much easier to maintain.

Leaving stuff better than when I entered always makes me happy ;-)

















































































  • Comments(0)//theengine.schwartzengine.com/#post29

I am not Looking Back II!

Apps an' MobilesPosted by Carsten Schwartz Jul 28, 2018 11:36
Recently I read on OMG!UBUNTU! that a tech contributor from online magazine Forbes.com had ditched Windows and tried using Ubuntu for two weeks, the guy did try another Linux distribution first but dropped it since the installation 'couldn't find a drive to install the OS to.'. He had the same issues as me with Windows even though he had used it for decades. After the experience he will continue using Ubuntu for his tech writing: ' this is absolutely my new daily driver for writing, working, communicating, browsing and media consumption'. Read the article by Following this link.


As a conclusion on my part, I still do not see that Windows is improving as It is the company OS at the business where I work. In fact it has gotten worse with updates and all. Linux however stays the same and is fast and pleasant to work with, I have never once had a nagging doubt after ditching Windows. The advantages you get by dropping the stagnating OS are many, amongst a lot of other things not mentioned here, you will get a system that:

- Always boots in 30 seconds or less
- Always shuts down in 5 seconds or less
- Not forces you to update, but allows you to select when
- Not degrades in performance over time
- Has a free office suite (Libre Office)
- Not has a slowly corrupting registry
- Runs significantly faster than Windows
- Not has an ugly tile based user Interface, who ever made that brain fart I do not know...

Note that this is not a commercial, I am not getting money from a sponsor to say this, I am simply recommending a good product.

I know Microsoft is trying with a valiant effort to make the company look like an open source advocate, but I am not convinced. And I am not getting money to not recommend them either.. :-)
























  • Comments(0)//theengine.schwartzengine.com/#post28

Holiday At last, refactoring as therapy...

Apps an' MobilesPosted by Carsten Schwartz Jul 08, 2018 12:26
After a period in and out of the job market I have finally landed a job at a company I hope is more credible/stable than the other jobs I have had in the last year. So now I am on official Vacation at last and gathering strength at home with the family.

So I just sat down to look at my Asteroids Clone and discovered some things that could be improved in the code. To many hard coded values and a slight little problem where the spaceship could be smashed up even before the game started.

Try the new improved Asteroid Clone!

It is satisfying to be able to clean up and make corrections to the code relatively fast event though I have not touched it for a while.



As I say, Good Code is defined by answering this question:

Would you give the guy who wrote this a beer after maintaining it?




  • Comments(0)//theengine.schwartzengine.com/#post27
Next »