An Improvement in Photography

•October 29, 2012 • Leave a Comment

Over the past year, my photography has seen a dramatic improvement. I just went back to an old post of mine and realized that most of the links were broken because I had deleted them from my deviantART gallery because the pictures did not seem any good to me anymore.

I’m lazy at post processing, so I usually don’t upload a photo until a few months after it was taken; heck, there are still tons of unprocessed shots in my library that I think are worthy for uploading.

But for the finished ones, here are some I am proud of, though as /r/photocritique has shown me, they all have their flaws:

This slideshow requires JavaScript.


I usually only update my dA and Shadowness, but here they all are:
deviantART
500px
Shadowness
Flickr

New deviantART Photos

•October 11, 2011 • 6 Comments

Just wanted to show off some new pictures from my deviantART gallery.

 

 

 

 

 

 

Enjoy, and be sure to check our my deviantART profile!

NXC RNG: Mersenne Twister

•July 22, 2011 • 4 Comments

 

Here’s an example use of my implementation of the MT19937 Pseudo-Random Number Generator algorithm for NXC:

#include "MersenneTwister.h.nxc"
#include "random_ul.h.nxc"
#include "uniform_int.h.nxc"

#define MAX 10

task main()
{
    MT_srand();
    NumOut(0, 0, urand(MAX));
    Wait(2000);
}

The repository/sources can be found here.

 

NXC Syntax Highlighting in Notepad++

•July 13, 2011 • Leave a Comment

Once you’re done with Spiller’s post on compiling NXC code in Notepad++, you may wish to improve the look of things a bit.

NOTE: Due to Notepad++ limitations, we’re going to have to sacrifice the C language, and NXC shalt be born from its ashes. (Don’t worry: you can always use C++ as a substitute. :))

Let us begin.

Adding the .nxc File Extension

  1. Open up Settings->Style Configurator...
  2. Select C under Language :
  3. Under User ext. :, add nxc

This straightforward, humble action should bring life to your source code.

Adding Keywords

In the same Style Configurator dialog:

  1. Under Style :, select INSTRUCTION WORD
  2. Under User-defined keywords, copy and paste the following:
    __FLTRETVAL__ __RETURN__ __RETURNF__ __RETURNS__ __RETURNU__ __RETVAL__ __STRRETVAL__ __STRBUFFER__ __STRTMPBUFFER__ __TMPBYTE__ __TMPFLOAT__ __TMPLONG__ __TMPULONG__ __TMPWORD__ asm false mutex priority repeat start stop sub true until
  3. Under Style :, select TYPE WORD
  4. Under User-defined keywords, copy and paste the following:
    bool byte string inline safecall task

Adding Function Auto-Completion

  1. Open up Settings->Preferences...
  2. Click on the Backup/Auto-Completion tab
  3. Under Auto-Completion, check the Enable auto-completion on each input and Function parameters hint on input checkboxes
  4. Select Function completion
  5. You may also wish to change it to “From 3 th character”, or something like that.

Customizing Function Auto-Completion for NXC

UPDATE: I haven’t tried it yet, but bungeshea has made a new version that uses features introduced in Notepad++ 6.2.

This part is not for the faint-hearted. Venture on if you dare. (Actually, it’s not that complicated.)

  1. Download the NXC API to Notepad++ XML Converter binaries here. (Or compile them from source, if you wish.)
  2. Drag the %ProgramFiles%\BricxCC\Default\nxc_api.txt to NXC API to Notepad++ XML.exe.
  3. Rename the newly generated nxc.xml file to c.xml.
  4. Move c.xml to %ProgramFiles%\Notepad++\plugins\APIs\.

That’s it!

Plugins

NppAutoIndent

This gives you a “smart indentation” feature. I find it pretty useful.

  1. Download the NppAutoIndent plugin:
    1. Open up Plugins->Plugin Manager->Show Plugin Manager
    2. Under the Available tab, check the NppAutoIndent checkbox
    3. Click Install
  2. Enable Plugins->NppAutoIndent->Smart Indent

Creating and Editing RIC Files

•May 27, 2011 • 2 Comments

There are a few tools available to edit RIC files. This post will describe their strengths and weaknesses. (If you know any others, please leave a comment.)

 

nxtRICedit nxtRICedit

by Andreas Dreier

  • Free
  • Windows only
  • Easy to use
  • Supports NBC/NXC Enhanced Firmware exclusive features


nxtRICeditV2 nxtRICeditV2

by Andreas Dreier

  • Free
  • Windows only
  • For advanced users
  • Supports NBC/NXC Enhanced Firmware exclusive features
  • Bugs in GUI
    • Window not resizable
    • 1280×780 resolution required

 RICcreator

by Sebastian Wahl (Spiller)

  • Free and Open-source
  • Written in C++, Qt
  • Cross Platform (Windows, Mac, Linux)
  • For advanced users
  • Supports NBC/NXC Enhanced Firmware exclusive features
  • Easier creation of RIC fonts
  • Powerful ability to import Image Files (PNGs)
  • Good GUI


 RICScript

by John Hansen (More info)

  • Free and Open-source
  • Text based editor (Requires BricxCC or NBC Compiler)
  • File type before compilation: .rs
  • Cross Platform (Windows, Mac, Linux)
  • For very advanced users
  • Supports NBC/NXC Enhanced Firmware exclusive features

Recommendations

Here’s what I recommend.

Beginners: Use nxtRICedit.
Advanced users: Use nxtRICeditV2, as RICcreator is still under development. Once it’s stable, you should use RICcreator. UPDATE: Use RICcreator; it’s pretty awesome now.

nxtRICeditV3 may or may not come out soon. It is intended to address the bugs in nxtRICeditV2. When it comes out, you can get rid of nxtRICeditV2. (If you decide not to use the awesome RICcreator, that is!)

Basic types for NXC Memory Manager

•April 26, 2011 • Leave a Comment

Well, so far I’ve got a few of the basic types for Memory Manager tested and working. (BYTE, CHAR, INT, UINT.) A few more should be implemented soon. (LONG, ULONG, FLOAT.)

(You can download the latest revision here.)


After that, I’ll need [someone] to test MM_convert(); this will allow you to convert between different types:

MM_ID idf = MM_new(MM_ID_TYPE_FLOAT);
MM_ID idl = MM_convert(idf, MM_ID_TYPE_LONG, false);

(The last false parameter specifies that you don’t want idf‘s memory to be automatically deleted.)


Another thing I’m working on is MM_op(). It will allow you to execute operations:

// int a, b;
MM_ID a = MM_new(MM_ID_TYPE_INT);
MM_ID b = MM_new(MM_ID_TYPE_INT);

// a = 4; b = 2;
MM_set_INT(a, 4);
MM_set_INT(b, 2);

// answer = a + b;
MM_ID answer = MM_op2(a, MM_OP_ADD, b);

Sure, you can always MM_get() them, and manually execute the operations, but that’s no fun! :)


Actually, all of this should be hidden behind a “parser” (it’s more like an interpreter), so you won’t have to worry about it at all; you’ll simply call MM_parse() to do all the work for you. You’ll just need to input a string with the code into the function. This is what I’m going for:

MM_parse(" \
long a = 2; \
double pi = 3.14; \
double d = a * pi;");

float diameter = MM_parse_get_FLOAT("d");

NumOut(0, 0, diameter, 0);

As you can see, all the type conversions like long to double are handled “implicitly” (although I’ll add explicit functionality too, of course). All the memory allocation/operations/etc are handled for you, as if you were programming in NXC… inside NXC. You’ll be able to integrate your code into itself (does that make any sense?). I may also add support for a compiler directive (MM_PARSE_SYSTEM) which will allow you to execute “system commands” like NumOut() inside the parser.


If you’re worried about all that typing, you can always use #defines to make the function names shorter:

#define p(str) MM_parse(str)
#define pgfloat(str) MM_parse_get_float(str)

p(" \
long a = 2; \
double pi = 3.14; \
double d = a * pi;");

float diameter = pgfloat("d");

NumOut(0, 0, diameter, 0);

I could use some help in testing. (I don’t have access to a NXT most of the time.) I’ll post the files to test on this Mindboards thread.

Beginning Work on NXC Memory Manager

•March 18, 2011 • 3 Comments

If you haven’t heard already, I’ve begun work on a “Memory Manager”.

What it does

Using my library (libraries, actually), you’ll be able to:
[Please insert “pseudo-” in front of all the list items.]

  • Create variables (bools, [unsigned] chars, [unsigned] ints, [unsigned] longs, floats, doubles, strings, and arrays of those types, too)
  • Set their values (working on it; support for different ops is being added)
  • Pointers! (And pointers to pointers, or pointers to pointers to pointers, or pointers to pointers to pointers to pointers, or…)
  • Use “hash tables” (working on it)
  • Parsers of [obfuscated] expressions (… guess; yeah, you’re right: I need to finish the hash stuff first)
  • “Dynamic” memory management
  • Dynamic typing (if you’re insane enough to want this), and duck typing (I just wrote this down for kicks, actually; quack quack)
  • Function overloading
  • Possibly operator overloading
  • And definitely use super advanced kung-fu fighting robot functions

Example code

By “pseudo”, I mean you won’t be able to do this:

int lol = 42;
int *pi = lol;
NumOut(0, 0, *pi, 0);

But we will have something similar to this:

MM_ID lol = MM_new(MM_ID_TYPE_INT);
// prototype: MM_ID MM_new(MM_ID_TYPE type = MM_ID_TYPE_BYTE, unsigned long len = 1);

MM_mov_INT(lol, 42);
// or use MM_set_INT(lol, 42);

MM_ID pi = lol;

NumOut(0, 0, MM_get_INT(pi), 0);

It’d look a lot nicer if NXC itself supported function overloading. >_> :D Assuming it did, here’s the new version:

MM_ID lol = MM_new(MM_ID_TYPE_INT);
MM_mov(lol, 42);
MM_ID pi = lol;
NumOut(0, 0, MM_get(pi), 0);

No more _INTs!

Or, if you take my “parser” into account, something similar to this:

P_parse("int lol = 42;");
string pi = "lol";
NumOut(0, 0, P_get_INT(pi), 0);

How to contribute

If you’re willing to help, you can become a tester. I don’t have a NXT with me all the time, so I post things for people to test at the Memory Manager thread on the Mindboards Forums.

Also, I’ve set up a Mercurial repository, if you want to check out my progress.

 
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: