Posts

Coins - Pay to Win

Image
Coins, the purest Pay to Win game. Buy coins to rank highest. To win in this game, you need to buy more coins than anyone else! Can you afford it? https://coinspaytowin-50d3a.firebaseapp.com/ https://play.google.com/store/apps/details?id=com.paulfrischknecht.coinspaytowin (Microsoft Store Link Pending)

White

A white screen is arguably one of the simplest and least arbitrary things a screen-driving information system can present, together with Black (to be released soon). Here are some implementations: https://white.paulfrischknecht.com/  (a PWA) https://play.google.com/store/apps/details?id=com.paulfrischknecht.white  (a native Android app, listed in the Google Play App Store) https://www.shadertoy.com/view/msfGDM  (a glsl shader, listed in Shadertoy) https://www.youtube.com/watch?v=QggJzZdIYPI  (a YouTube video, not mine)

Unofficial Powershell Strict Mode

Use Powershell Strict Mode (Unless You Love Debugging) Set-StrictMode  -Version  2 $ErrorActionPreference  =  "Stop" # ^^^ Inspired by  http://redsymbol.net/articles/unofficial-bash-strict-mode/

Length in bytes of Virtual Boy games

I'm exercising automation of data extraction. Here I have a bunch of files in different .7z files whose length I want to extract. 3D Tetris (U) [!] 1048576 Galactic Pinball (JU) [!] 1048576 Golf (U) [!] 2097152 T&E Virtual Golf (J) [!] 2097152 T&E Virtual Golf (J) [b1] 2097152 Insane Mouse Mansion (J) [!] 1048576 Jack Bros (J) [!] 1048576 Jack Bros (U) [!] 1048576 Jack Bros (U) [b1] 1048576 Mario Clash (JU) [!] 1048576 Mario Clash (JU) [b1] 1048576 Mario's Tennis (JU) [!] 524288 Mario's Tennis (JU) [a1] 524288 Nester's Funky Bowling (U) 2097152 Nester's Funky Bowling (U) [a1] 2097152 Nester's Funky Bowling (U) [b1] 2097154 Nester's Funky Bowling (U) [b2] 2097124 Panic Bomber (J) [!] 524288 Panic Bomber (U) [!] 524288 Panic Bomber (U) [b1] 524288 Panic Bomber (U) [h1] 524288 Panic Bomber (U) [h2] 524288 Blox V1.0 by KR155E (PD) 1048576 Blox V1.1 by KR155E (PD) 1048576 Croach, The (PD) 65536 Etch-A-Sketch by Pat Daderko (PD) ...

Dead Simple Todo Tool - Open Source, Javascript, Web-Based

Image
Download https://github.com/Masterxilo/DeadSimpleTodo/ Screenshot This is a python webserver + browser based very simple todo list tool which augments a pen and paper based list with - recording the dates of changes and - infinite nesting plus reordering of items. All the data and required media is stored locally. How to To run this, get Python 2 (e.g. Python 2.7.9), run the script todo5Server.py (`python todo5Server.py`) and open http://localhost:8001/todo.html in your browser. The data is preserved over refreshes of the page and restarts of the server. License Do what you want with this (subject to the licenses of the tools used which I did not read). Shortcuts - Delete an entry   Shift delete while it is in focus or backspace when the text is empty. - Insert new entry below selected   Hit enter. - Insert new entry as child of current   Hit shift+enter - Insert new entry above selected   ctrl+enter - Write '.' as the text in an...

What's wrong with JavaServerFaces

Image
When we click on the “homepage” link of the JSF entry in Maven Repository we are forwarded (from http://java.sun.com/javaee/javaserverfaces/ - I thought that company died long ago, but Oracle doesn’t bother fixing links) to http://www.oracle.com/technetwork/java/index.html which currently showcases a picutre of a young man in front of the computer and we are told he is probabaly working with JSF & PrimeFaces (PrimeFaces is “a popular JavaServer Faces (JSF) UI framework” that is also used in my project, I hope I’ll get to cover that too). Now, to me, he doesn’t look like he is happily working on something interesting but rather trying hard to finally get-that-bloody-thing to work (already in the exhaustion/resigning phase – “damn, why doesn’t it work!? :(“). This is comes close to how I feel about the series of tools I am writing about here (1). So let’s get started tinkering about this web framework. The website ( Get Started subpage) uses a two nice gray color sh...

What's wrong with Maven

In the project I have to work on mentioned in the last post, there are of course other technologies and tools used besides Hibernate that I have to learn (I do not come from a Java programming background so most of these are (though not conceptually) relatively new to me). One of them is the buildtool Maven. Let’s see what flaws we can find with Maven: It’s ironic how their philosophy is “don’t repeat yourself” yet they use xml for the configuration where up to half of the filesize comes from repeating words for the closing tags (yes I know that’s not what they mean ). They make users to define custom “properties” with custom tags. Within a pom.xml file you can write: <properties> <myfaces.version>2.1.12</myfaces.version> <mojarra.version>2.1.23</mojarra.version> <myweirdpropertythatiwillnotuse>42</myweirdpropertythatiwillnotuse> </properties> where myfaces.version etc. is the name of the property I want to define. ...

Why Hibernate is a disaster

I am forced to work with this Java Object Relational Mapping “solution” (a collection of functions, annotations and configuration hell to try to fit the round peg of object oriented programming into the square hole of relational databases) for the next 4 months (2 already done - luckily). And I really have not much to say in its favor. Read http://empire-db.apache.org/empiredb/hibernate.htm : The use of annotations and strings to provide information is a bad choice. The former because it cannot be modified or easily read at runtime (only through awkward interfaces), the latter because it is only checked at runtime, which means never for the 90% of the code that are run 10% of the time (don’t comment with “well you need unit tests”). The developers of Hibernate have never heard of the Law of Demeter. session.buildLockRequest().setLockMode(LockMode.PESSIMISTIC_WRITE).setTimeOut(1000 * 60).lock(entity); They used method chaining (the “builder pattern”) extensively. http://stackov...

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

This was driving me nuts today -- trying to get Oracle SQL Developer 4 and/or a simple java code (in the style of http://stackoverflow.com/a/16626825/524504 ) to "connect" to a local Microsoft Access Database .mdb file. But I kept getting the not-very-helpful message [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified luckily, I have been able to sort out this problem with the help of http://www.selikoff.net/2011/07/26/connecting-to-ms-access-file-via-jdbc-in-64-bit-java/ http://www.microsoft.com/en-us/download/details.aspx?id=13255 and http://stackoverflow.com/questions/7116019/hand-install-of-64-bit-ms-access-odbc-drivers-when-32-bit-office-is-present I have 32 bit office installed, so I didn't have the 64 bit Access Database odbc driver. I love it when the biggest troubles in programming something are things like that. I will change this.

Saving files is outdated

Some time ago, when disks where really slow or files where even stored on external, even slower devices (cassettes, floppy disks) it may have made sense to specify when exactly to save a file because you had to wait a considerable amount of time. However with modern harddrives and usb sticks and whatnot, this concern is out of the way. I hate it when I have to save files manually in any program, especially in text editors. First thing I do is look for an autosave plugin. However, programs should allow as many levels of undo as possible and keep the history even after restarting a session. vim can do this http://stackoverflow.com/questions/6426956/can-i-get-a-versioned-recovery-from-a-vim-swap-file

C/C++ Function to convert Unicode Japanese Katakana to Hiragana

I wrote a little tool which allows to add new words to the dictionary of the Chrome Extension Rikaikun (inspired by rikaichan for Firefox) and then recompile the index file. The index file stores all spellings in hiragana, so this was needed. Fortunately, the rikaikun source code already had this code ready, albeit in JavaScript. The function writes the result to r and returns the end of the converted string. // modified from Chrome extension rikaikun, file data.ja wchar_t * katakana_to_hiragana ( wchar_t * word , wchar_t * r ) { // katakana -> hiragana conversion tables wchar_t ch [ ] = { 0x3092 , 0x3041 , 0x3043 , 0x3045 , 0x3047 , 0x3049 , 0x3083 , 0x3085 , 0x3087 , 0x3063 , 0x30FC , 0x3042 , 0x3044 , 0x3046 , 0x3048 , 0x304A , 0x304B , 0x304D , 0x304F , 0x3051 , 0x3053 , 0x3055 , 0x3057 , 0x3059 , 0x305B , 0x305D , 0x305F , 0x3061 , 0x3064 , 0x3066 , 0x3068 , 0x306A , 0x306B , 0x306C , 0x306D , 0x306E , 0x306F...

How to prepare midi files for synthesia (split hands)

I decided to use this blog to take some notes that might become useful to others, so here I go. If you found some midi of a nice piano song you want to practice with synthesia but unfortunately all the notes are in one track so you can't learn each hand separately, use http://midieditor.sourceforge.net/index.php?page=downloads to move the notes for one of the hands to a new track. Simply create another track, select the notes, Edit -> Move to track...

sftype (super fast type) - type speed training/test game

Image
Quickly put this together: This program I quickly put together in Game Maker 8.1 helps you measure and improve your typing speed. My best so far is like 73 WPM... Download: http://goo.gl/3sm7i The source code is included. For improving your typing speed also check out: http://play.typeracer.com/

How to monitor a directory for changes with ReadDirectoryChangesW

Here's how to use  ReadDirectoryChangesW  without knowing all of this and without using this overkill C++ class library (remove the &o parameter in the call to make it blocking instead of async. Note: This only returns one change, you have to step trough a buffer of FILE_NOTIFY_INFORMATIONs if you need to get more): HANDLE hDirectory ; OVERLAPPED o = { 0 }; union { FILE_NOTIFY_INFORMATION i ; char d [ sizeof ( FILE_NOTIFY_INFORMATION )+ MAX_PATH ]; } fni ; int checkAutoCompile () { DWORD b ; if (! hDirectory ) { hDirectory = CreateFile ( "." , FILE_LIST_DIRECTORY | GENERIC_READ , FILE_SHARE_READ | FILE_SHARE_WRITE , 0 , OPEN_EXISTING , FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED , 0 ); o . hEvent = CreateEvent ( 0 , 0 , 0 , 0 ); } ReadDirectoryChangesW ( hDirectory , & fni , sizeof ( fni ), TR...

Extended Terrain XYZ now free and open source

Image
This is a 3D Terrain Editor I created back in 2007 with Dark BASIC Pro (free now, anybody should be able to compile this). Along with standard heightmap terrain editor features, it also allows shifting the vertices to create simple overhangs and caves. Videos Download Extended Terrain XYZ - Open Source - fix-dlls.zip (7.8 MB) - compiled executable and instructions for compiling included (ReadMe.txt) ExtendedTerrainXYZDemoMaps.zip (26.5 MB) ExtendedTerrainXYZRequiredPlugins.zip (2.1 MB) - you need these if you want to build from source Old Information:  link

Simple Multitouch on Windows

Image
Quickliy coded a dll ( packaged as a Game Maker extension here , but can be used with any HWND) that gives a simple interface to multi touch handling on Windows. All source files included.

NVIDIA GPU-accelerated Path / SVG Vector Graphics Rendering

Image
This definitely needs attention: (video with link without slides: http://www.youtube.com/watch?v=bCrohG6PJQE ) Try viewing for example this svg image in your browser - it'll definately kill it. This particular image renders at 35 FPS on my GPU (GTX 260) in NVIDIAs svg viewer which uses their quite new (June 2011) GL_NV_path_rendering OpenGL extension. Remarkable. The GPU implementation doesn't implement the filters - blurring in this example - (neither does IE). I'll try to add these, I don't think they'll slow it down too much. Read more at http://developer.nvidia.com/nv-path-rendering Note: Many browsers claim to have GPU accelerated rendering, but this mostly only applies to the final composition of different elements (though some do have GPU text rendering). Edit: After looking at the specification and some samples , I see that this is actually pretty complex: You can define various intermediate targets and in and outputs for filters. The easiest w...

Some Java Bit Functions and easy syntax hightlighting of various languages in html

Use  http://tohtml.com/  and  http://bedaux.net/cpp2html/  for easy syntax highlighting in your blogger posts. (I tried this  with that  but it doesn't seem to work). Now the Java stuff (easily portable to C, C++ and many other languages): // Returs bit a to b (> a). lsb is bit 0, msb is 63, is returned as String in normal order (msb first) public static String getBits(long n, int a, int b) { String bs = "" ; for ( int i = a ; i < = b ; i + + ) bs = ( 1 & ( n > > i ) ) + bs ; return bs ; } // Calculates floored log2 by finding position of highest set bit. // Ignores very highest bit of long (63rd). public static int log2(long n) { long m = 1 L < < 62 ; int i = 62 ; while ( ( n & m ) = = 0 & & i > 0 ) { m = m > > 1 ; i - - ; } return i ; } /**    ...

Fastest way to zero out memory - stream past cache with movntdq/_mm_stream_si128

As a rule of thumb, this technique is only beneficial if the buffer is larger than half the largest level cache. #include <time.h> #include <stdio.h> #include <stdlib.h> #include <stdlib.h> #include <emmintrin.h> #include <intrin.h> typedef unsigned long long ull ; ull tsc ; int clk ; // Stream 64 Bytes to DRAM, bypass caches. _p must be 16-byte aligned. template < typename T > inline void memstream ( T * _p , const __m128i & i ) { char * p = ( char *) _p ; _mm_stream_si128 (( __m128i *)& p [ 0 ], i ); _mm_stream_si128 (( __m128i *)& p [ 16 ], i ); _mm_stream_si128 (( __m128i *)& p [ 32 ], i ); _mm_stream_si128 (( __m128i *)& p [ 48 ], i ); } inline void serialize () { int a [ 4 ]; __cpuid ( a , 0 );} inline void starttimer () { clk = clock (); serialize (); tsc = __rdtsc ();} inline void stoptimer ( char * n ) { serialize (); ull tsc2 = __rdtsc...

No installers

When publishing software, make it installerless and portable (meaning it shouldn't write it's settings to the registry but to a user specifiable folder (a subfolder of itself by default)). Also, when zipping things up don' t put the files directly in the root folder, forcing people to use the "extract to folder..." option instead of "extract here". This stops people from downloading your software to a temporary folder and opening it in a zip viewing program, then dragging and dropping it somewhere else, because the'y first have to create a folder whereever they want to put it. Instead, create a single folder in the zip and put the files there. Download some of my software to see what I mean.