Browsed by
Category: Problem solutions

Sprite Dicing

Sprite Dicing

Handy technique for saving texture space! There are various tools to do this, but the basic scheme is to split up a large texture into much smaller chunks, individually trimming these chunks, and seamlessly reconstructing the sprite in the viewport.

Source image
Compresses down to this!
Backdoor Roth IRA

Backdoor Roth IRA

Getting your backdoor Roth IRA right is very tricky. If done incorrectly, you can find yourself owing a ton of money and more than negating the value of contributions.

Here’s the best/most correct covering of the topic:

Here is a higher-level discussion:
https://www.dadsdollarsdebts.com/2016/11/22/roth-401k/

Also look here for much more in-depth information:

https://www.kitces.com/blog/how-to-do-a-backdoor-roth-ira-contribution-while-avoiding-the-ira-aggregation-rule-and-the-step-transaction-doctrine/

Attaching 5.25″ floppies via USB

Attaching 5.25″ floppies via USB

Floppy disks are a relic of the past these days. You might still see the odd 3.5″ floppy – and there are even still companies making 3.5″ USB drives you can plug into your system today. But 5.25″ floppy drives (360k and 1.2 meg variety) are much more scarce. So scarce, in fact, that you’re likely not to find any outside of old vintage computers. Most modern PC’s since the Pentiums don’t even have connectors or interfaces that support them and I know of no vendors that make USB 5.25″ drives.

So what is one to do if they have old 5.25″ floppies they need to read? Turns out others have had the same problem – so you’re not alone. You have the following options:

  1. Find a service that will convert them – Usually for a fee around $5-$10 per disk.
  2. Buy an old vintage pre-Intel Core based computer from eBay that has a working 5.25″ drive.
  3. Use a 5.25″ to USB converter.
    1. Kryoflux – https://www.kryoflux.com/ -the Holy Grail of floppy readers. Is able to read all formats. Save as raw stream, or export to common sector formats supporting: Acorn Electron, Apple, Amstrad CPC, Archimedes, Atari 8-bit, Atari ST, BBC, Commodore 64, Commodore Amiga, MSX, IBM PC, PC-8801, Sam Coupe, Spectrum, E-MU Emulator & Emulator II, DEC RX01 & RX02 and many, many others https://www.kryoflux.com/
    2. Device Side Data’s FC5025 –http://www.deviceside.com/fc5025.html – USB 5.25″ floppy controller plugs into any computer’s USB port and enables you to attach a 5.25″ floppy drive. Even if your computer has no built-in floppy controller, the FC5025 lets you read those old disks. And it’s not just for IBM PC disks – it also understands formats used by Apple, Atari, Commodore and TI, among others.
    3. Supercard Pro. – Here’s a review and this page which contains a lot of useful information.

Replacement fans on 2016 Razer Blade 14″ laptop

Replacement fans on 2016 Razer Blade 14″ laptop

I recently bought a used 2016 14″ Razer Blade M970 (RX09-01652E22) gaming laptop for about 20% the price of a new one (seems the only things that lose value faster than a Porsche driving off the lot are gaming laptops with last gen technology). I needed this one since it had a high-end GPU that allowed me to do modern DX12/Vulkan work, while being in a nice transportable 14″ slim form factor (it had a M970 graphics card).

While a screaming deal, there was one other noise problem: the fans. Gaming laptops are kind of notorious for needing powerful fans to cool their graphics cards. Both the fans in this laptop were starting to make bearing noises. The temps were fine and the fans worked ok – they were just a little noisier than they should have been. I took them out and cleaned them, but same result.

The originals are Cooler Master FB07006M05SPA312’s. DC 5v 0.5A, 4 pin connector.

Unfortunately, finding these guys turned up next to zero hits. Best options I could find were:

  1. Live with it – but know the fans might be dying/making more noise soon.
  2. Send it in to Razer and they’re replace them out of warranty. They charged a flat $100 rate + parts (they quoted me about $20) + shipping. About $150. Ouch.
  3. Buy used fan/heat-sink assembly off eBay. They were still charging around $40, and the fans were definitely all used. They could have the same noise issues as I was having – or have them soon.
  4. Dig deeper.

Found:

I opted for #4 and found a company on AliBaba that hit the spot. I found this vendor selling off-brand versions that looked and speced out right. I took the gamble since the price was $32 for 2 fans – a SCREAMING deal:
https://www.aliexpress.com/item/2PCS-CPU-fan-for-GIGABYTE-Razer-Blade-14-RZ09-01161E31-RZ09-01161E31-R3U1-laptop-cpu-cooling/32841110492.html

They arrived about 2+ weeks later as I opted for the free shipping. I popped out the old ones and can confirm these look and fit identically to the originals – sans the CoolerMaster stickers. They appeared to be brand new. Temps all appeared fine after gaming for well over an hour. They revved up to full power and then back down to idle perfectly. Best of all – they were nice and quiet. Success!

Alternative:

If you are looking for originals, I found these at $65/each, but that’s pretty steep to me:
https://www.aliexpress.com/item/Emacro-for-Cooler-Master-FB07006M05SPA312-Server-Round-Fan-DC-5V-0-5A-4-wire/32887795069.html

 

 

1.7 days – on average

1.7 days – on average

Glad to know our doctors and academics are still producing lots of great papers. While some things like magnets are seriously dangerous if swallowed, the goal of this one was to get over-protective parents to calm down about the risk of many other commonly swallowed household items.

Six pediatric health‐care professionals were recruited to swallow the head of a Lego figurine. The professionals then examined their stool samples for the next few days to determine:

  1. If Lego pieces passed through their system or got stuck
  2. The time it took to pass the Lego piece.

Full paper here:
https://onlinelibrary.wiley.com/doi/full/10.1111/jpc.14309

SMB1 is unsafe

SMB1 is unsafe

If you use samba and connect to it via Windows, you might get a message that says:

You can’t connect to the file share because it’s not secure. This share requires the obsolete SMB1 protocol, which is unsafe and could expose your system to attack.

The right solution is to update the Linux Samba share software/service. Unfortunately, that’s not always possible – especially if the server is not yours. The only recourse is to find another solution, contact the server owner to update it, or accept the risk.  Installing support for SMB1 opens you to the risk of various attacks – including a brutal man-in-the-middle that exposes everything. It’s a good idea to do whatever you need, then disable the protocol, because a compromised server/man-in-the-middle might block safer SMB2.x/3.x protocols which might make your system fall back to the unsafe v1.x without you knowing it.

At any rate, sometimes you have to accept the risk. Here’s how to install/enable smb1 on Windows if all else fails:

  1. Run Powershell command processor in elevated mode (run as admin)
  2. Type the following command:
    get-windowsoptionalfeature -online –featurename smb1protocol
  3. Once SMB has been installed please type the following command to activate it:
  4. enable-windowsoptionalfeature -online –featurename smb1protocol
  5. Once done, press Y and hit enter to restart your computer.
Setting up your own git server with individual user accounts

Setting up your own git server with individual user accounts

This is sort of covered in other spots, but not as clearly and from scratch. Here’s a complete guide that shows how to set up your own git server and git clients. I found this setup handy when trying out some more complex git merging commands and experimenting with remotes while learning git.

I tested this on Ubuntu 16.04 by creating an Ubuntu virtual machine and then cloning it. 1 VM for the server, and 2 for clients. I used bridged networking so each would get their own IP address, but that’s not required as long as the VM’s can communicate with each other over TCP/IP.

There are two ways to set the git accounts up. The first way shown has all client users accessing the repository through the same server user account. While each user’s submissions will be labeled correctly in the git log, having everyone use the same system account isn’t safe computing practices for groups. Instead, if you follow the instructions in the optional part you can use individual user accounts and keep things more safe.

Client/Server Setup

First, on the server:

  1. Make sure ssh is installed on the server:
    server$ sudo apt-get install openssh-server
  2. Make sure sshd is running/listed when you do a ps. If not, reboot or restart it.
    server$ ps -A | grep sshd
  3. Make sure git is installed:
    server$ sudo apt-get install git-core
  4. Add a user to the server that will hold the git repositories
    server$ sudo adduser git
    server$ sudo passwd git
    server$ su - git
    server$ mkdir -p .ssh

 

Next, on your client:

  1. Make sure git is installed
    client$ sudo apt-get install git-core
  2. Create an ssh key. While not strictly required, it’s a good idea to add a passcode to the key when prompted during key creation.
    client$ ssh-keygen -t rsa

    This should create a file called id_rsa.pub in your ~/.ssh directory. See documentation on ssh-keygen for full details.

  3. Copy the ssh key to the server’s git directory:
    client$ scp ~/.ssh/id_rsa.pub git@server.com:/home/git/client_id_rsa.pub

 

Back on server:

  1. Add the client user’s key to the ssh list in the /home/git/.ssh directory
    server$ mkdir ~/.ssh
  2. Append the client user key to the list of authorized keys
    server$ cat ~/client_id_rsa.pub >> ~/.ssh/authorized_keys
  3. Create a new group called ‘gituser’ we’ll use for users to access our repository in /home/git/
    sudo groupadd gituser
    sudo usermod -a -G gituser git
  4. Log out completely and back in. You MUST do this for group assignment to take effect orsubsequent chgrp/chmod commands won’t work.
  5. Make the git repository and tell it to share based on the group the user belongs to.
    server$ cd ~git
    server$ mkdir -p mydepot
    server$ cd mydepot
    server$ git init --bare --shared=group
    Initialized empty Git repository in /home/git/mydepot/
  6. Set the permissions on the repository directory so that anyone in the new ‘gituser’ group can access it.
    chgrp -R gituser /home/git/mydepot
    chmod -R g+rw /home/git/mydepot
    chmod g+s `find /home/git/mydepot -type d`

 

Back on client (if it is a clean client without files for the repo):

  1. Test your ssh connection by trying to ssh into the server (using the git user)
  2. Create the local project:
    client$ mkdir -p depot/project1
    client$ cd depot/project1
    client$ git config --global user.email "you@client.com"
    client$ git config --global user.name "clientUsername"
  3. Clone the remote to your local system
    client$ git clone ssh://git@serverurl_or_ip:/home/git/mydepot/ .

Enter your username password and you’re done. The clone and the remote should be connected. Push/Fetch as normal. See the optional part below if you don’t want to use a global git user account on the server.

 

Or – Back on client that HAS existing files you want to get to the server:

Lets say you have a client that already has a bunch of files or even a git repository and you want to start using a remote repository. Here’s how you can add those local files into the remote server repository you just created.

  1. Initialize the repository where your client files are
    client$ git init
      Initialized empty Git repository in <blah>
    client$ git add .
    client$ git commit
      <Write something about this being a commit from the client>
  2. If you are going to using the git user account for all users, connect the project to your server this way:
    client$ git remote add origin ssh://git@serverurl_or_ip:/home/git/mydepot/

    If you don’t want to use the git account, then you must first create a user account on the server that matches the client userid (making sure to set the group/user properties on the server account), then use this:

    client$ git remote add origin ssh://serverurl_or_ip:/home/git/mydepot/

    Enter the password for your username or the ‘git’ server user depending on which one you used.

  3. Set up git configuration to avoid warnings and push:
    client$ git config –global push.default simple
    client$ git push –set-upstream origin masterYou will be prompted for the passkey you used when you created your RSA key in the above push step. Enter that passkey (not your git/user account password).

Optional – Using user accounts instead of a global ‘git’ account on the server.

The previous instructions had everyone use the same ‘git’ server user account when checking in – which means everyone must have the ‘git’ server account password. The log will show the right names, but security-wise this isn’t always best to use one global account on servers.

If you have more than one user but want everyone to log in separately, simply create a user account on the server like this:

On client for each client user:

  1. Create a ssh key on your client as before.
  2. Copy that key .pub to the server and append it to the authorized_keys file as above.
    client$ scp .ssh/myclient_id_rsa.pub git@serverurl_or_ip:/home/git

On server:

  1. Append the client’s public key to the authorized keys
    server$ cat ~/myclient_id_rsa.pub >> ~/.ssh/authorized_keys
  2. Create a user account that matches the userid on the client
    server$ sudo useradd client_username
    server$ sudo passwd client_username
  3. Make sure the new user account has access to the /home/git/ project directories by setting their group membership:
    server$ sudo usermod -a -G client_username

From now on, you don’t need to specify the git user account. Do not put the git@ part into the git clone url and use the username’s password when asked to log in:

client$ git clone ssh://serverurl_or_ip:/home/git/mydepot .

This method works great, but does require that you keep the client and server userid account passwords synced.

Setting up a Windows client:

Once the server is set up, you’re almost there. Microsoft has written a good guide. You’ll need OpenSSH or Windows 10 installed the generate an ssh key (if you don’t have one already).
https://docs.microsoft.com/en-us/vsts/git/use-ssh-keys-to-authenticate?view=vsts

 

Resource links:

Backdoor IRA’s with Turbotax 2017

Backdoor IRA’s with Turbotax 2017

Ok – Turbotax 2017 has a problem with its entry ordering when handling backdoor Roth IRA’s. If you just follow the normal wizards, you’ll end up with the incorrect information for your IRA contributions either: pay too much tax or be informed you have to pay a penalty for having gone over the IRA contribution limits.

The solution comes in several parts to get the wizard to figure out the right data. Here’s 3 major pitfalls I hit:

  1. If you do automated imports of statements from your financial institute, or you simply enter your IRA contributions/transfers to Roth IRA on page 1/’Wages & Income’ section of your federal taxes BEFORE you enter the ‘Traditional and Roth IRA Contributions’ section on the ‘Deductions & Credits’ page 2, then it often calculates your backdoor Roth IRA incorrectly.
  2. Double-entry and confusion around the word ‘contributed’. You only ‘contributed’ to a traditional IRA. You didn’t contribute to your Roth IRA, you transferred money to it. This can lead to overpayment.
  3. Confusion about conversions and recharacterizations. They seem interchangeable, but are very different tax terms that result in massively different calculations and even severe penalties if done wrong.

 

Solutions and information:

There are number of write-ups on this topic, but here’s the ones that helped:

 

Checking your 8606 form

Once you’ve done the steps above, you should verify the generated 8606 form is correct. Have Turbotax generate a PDF with the worksheets and find the 8606 form. Here’s a site that has a great, and complete, description of backdoor Roth IRA handling shows you what your 1040 and generated 8606 forms should look like.