Menu

JILRuntime/JewelScript / News: Recent posts

JewelScript needs your input!

With version 1.3 out of the door, there's literally nothing left on my planned features list. In fact, it already has more features than I ever planned to implement.

However, that doesn't mean I'm going to stop now. There are still some open issues that need resolving and some TODOs for existing features that need "polishing".

At this point I very much would like some input from anyone out there who may be using JewelScript, or is planning to do so.... read more

Posted by SourceForge Robot 2015-01-13

JILRun runtime environment 0.7.2.0 released

A new version of the command line application has been released.

The new version is built against version 1.3.4.0 of the JILRuntime library. Thus, it now supports single- and multiple inheritance, and closures.

For more information, see the JILRun runtime environment page.
link

Posted by SourceForge Robot 2015-01-11

JILRuntime 1.3.4.0 update released

JewelScript 1.3.4.0 has been released.

Version 1.3 adds major features to the language, for example single-inheritance, virtual method calls, multi-inheritance / mix-in classes and closures.

Download:
Download the source code from SourceForge.
You may also check out the SVN repository anonymously from Google Code.... read more

Posted by SourceForge Robot 2015-01-11

jewel.ORG

Rapid GUI application prototyping with a lightweight runtime environment.

Today I thought I'd demonstrate jewel.ORG, a project I have been tinkering with on and off when not working on JewelScript or something else. I've started this project two years ago, but never spent much time on it until recently. Now I finally made some progress and the application has reached a state where I can demonstrate it.... read more

Posted by SourceForge Robot 2015-01-08

Let’s talk ‘private’

About making class members private, why I didn't want to support it, and why I finally added it.

Yesterday I committed the first bunch of changes to support declaring a member variable or member function private. It already works, but there still may be some cases where the compiler doesn't notice that you have no access to a variable or function. This will improve over time.

Only a scripting language... read more

Posted by SourceForge Robot 2015-01-04

JewelScript 1.3: Inheritance, virtual methods, mix-in classes, closures

A brief overview for the upcoming release of the library.

The next release will add some major new features. If you have been following this blog or it's RSS feed lately, you may have noticed that I have been quite busy over the holidays. There were some things on my wish list for the language that I always wanted to add -- and finally I found the time and motivation to do it.

Posted by SourceForge Robot 2015-01-02

Testing mix-in classes

Testing mix-in classes.

Unlike extends, which allows single inheritance of a base class, inherits allows to inherit multiple base classes. Technically these are two very different mechanisms however.

While 'extends' makes the new class compatible to all super classes, 'inherits' will not make the new class compatible to any of it's bases. Instead, all members of the base class are relocated into the new class, they are literally mixed in. The new class is independent from it's bases and doesn't share any code or data with them.... read more

Posted by SourceForge Robot 2015-01-01

I’m so excited…

…and I just can't hide it!

Here's a sneak peek at what I'm up to right now, fresh from the forge. The code already runs. :)

class C1
{
    method C1(string s)
    {
        name = s;
        age = 45;
    }
    virtual method M1()
    {
        println(name + " " + age);
    }
    method M2()
    {
        M1();
    }
    string name;
    int age;
}

class C2 extends C1
{
    method C2(string n)
        extends C1(n)
    {
        job = "Developer";
    }
    method M2()
    {
        println(name + " " + age + " " + job);
        base.M2();
    }
    method M1()
    {
        println("Overridden!");
    }
    string job;
}

link

Posted by SourceForge Robot 2014-12-31

JILRun runtime environment 0.6.1.52 released

A new version of the command line application has been released.

The new version fixes a few bugs, one of them a serious but rare memory corruption bug caused by the byte-code optimizer.

Next to bug fixes, new functions have been added. For example the table::count() method, and several new functions for the Windows::Console::CharArea class. See the included HTML documentation for details.

For more information, see the JILRun runtime environment page.
link

Posted by SourceForge Robot 2014-12-30

JewelScript 1.2.3.88 — The X-mas update

"Proof that I have no life and nothing better to do on holidays."

I have just committed an important update to the JewelScript project. It contains a few bug fixes, one of them being a serious but rare memory corruption bug.

It's astonishing to realize that some bugs can lay dormant in the code for almost 10 years, and then suddenly, when you would never expect a certain part of the library to have such a bug, it resurfaces.... read more

Posted by SourceForge Robot 2014-12-30

I get weak in the presence of weak-references

Despite the humorous title, this post's topic is weak references - and it will be rather technical. JewelScript users who want a better understanding of the inner workings of the runtime can learn here, what weak references are, why they can be dangerous, why we need them, and how they should be used.

1. Reference counting is not scary

Many developers shy away from reference counted virtual machines, because they are afraid that it'll make their lives hard and coding "ugly". They worry they need to properly add-ref and release every single little object, and that ending up with a huge memory leak is inevitable.... read more

Posted by SourceForge Robot 2014-12-22

JILRun runtime environment 0.6.1.50 released

A new version of the command line application has been released.

Changes this time cover improved crash handling of the runtime. The application will now produce a detailed crash log if either a virtual machine exception, or a native exception is raised. The crash log will list current instruction, call stack, register contents, data stack contents and the code of the current function.

Native exceptions include access violations and stack overflows. They are caught even when they occur in C parts of the program. Due to certain optimizations, and the VM being in an inconsistent state during the exception, the crash log may not be entirely accurate when catching native exceptions. But it can still give developers a better clue on what went wrong.... read more

Posted by SourceForge Robot 2014-12-22

Remote-controlling VLC via TCP socket

This simple script opens VLC without GUI and initializes the media player's built-in remote-control interface. Command input entered by the user is sent via TCP socket to VLC. This script could be the basis of your own VLC remote program. Run it with the JILRun runtime environment.

/*

 * vlc-remote.jc
 *
 * Start VLC with remote control interface and offer simple command prompt.
 */

import stdlib;
import System::Network::Socket;
import System::Text::WideString;
import System::Time::Delay;
import Windows::API;

using stdlib;
using System::Network::Socket;
using System::Text::WideString;
using System::Time::Delay;

const string VLC = /"C:\Program Files (x86)\VideoLAN\vlc\vlc.exe "/;
const string Command = "--rc-host localhost:8080 --extraintf oldrc --intf dummy";

//------------------------------------------------------------------------------
// function main
//------------------------------------------------------------------------------

function string main(const string[] args)
{
    Windows::API::Execute(VLC + Command, 0);
    DoClient(8080, "localhost");
    return null;
}

//------------------------------------------------------------------------------
// function DoClient
//------------------------------------------------------------------------------

function DoClient(int port, const string addr)
{
    clause(int e)
    {
        Delay delay;
        Socket socket;
        println("Trying to connect to " + addr + ":" + port);
        // connect to specified host and port
        if (e = socket.Connect(addr, port))
            goto Error(e);
        println("Connection established, enter query. Type 'help' for commands.");
        while( socket.Connected )
        {
            // check if there is a message from the server
            while (socket.InputPending )
            {
                WideString resp = socket.Receiveln();
                println(resp.toString(850));
            }
            // have user enter something
            print("VLC> ");
            string query = getString();
            // send it to server
            socket.Sendln(query);
            // process input
            if (query == "logout" || query == "quit")
                break;
            // wait for response
            delay.Start(1000, false);
            while (socket.InputPending == 0)
            {
                Windows::API::Sleep(20);
                if (delay.Elapsed())
                    break;
            }
        }
        socket.Close();
    }
    clause Error
    {
        printf("ERROR %d\n", e);
    }
}

link

Posted by SourceForge Robot 2014-12-21

Removing duplicates from a string array

Removing duplicate values from an array of strings is not a common necessity, therefore there's no built-in function for this in JewelScript's string or array class. However, there are cases where this kind of functionality is required. Here's a tip on how to do it efficiently.

Our first approach

The simple approach to filtering a list of strings would be to use nested loops. We'll start with this simple, but not very efficient example and work our way to a smarter implementation:

import stdlib;

function string main(const string[] args)
{
    string[] names = {"Judy", "Rick", "Helen", "James", "Sandra", "Rick", "Elisabeth", "Judy"};
    string[] res = RemoveDuplicates(names);
    for (int i = 0; i < res.length; i++)
        stdlib::println(res[i]);
    return "";
}

function string[] RemoveDuplicates(string[] values)
{
    string[] result;
    // iterate over each value in 'values'
    for (int i = 0; i < values.length; i++)
    {
        string v = values[i];
        // check if 'v' is already in 'result'
        int j;
        for (; j < result.length; j++)
        {
            if (v == result[j])
                break;
        }
        // add 'v' to 'result' if not found
        if (j == result.length)
            result += v;
    }
    return result;
}
... [read more](/p/jilruntime/news/2014/12/removing-duplicates-from-a-string-array/)
Posted by SourceForge Robot 2014-12-13

JILRun runtime environment 0.6.1.49 released

Unfortunately I messed up the last released of the package. It contained an older version of the executable.

The JILRun Runtime Environment is a console application that embeds the JewelScript language to allow users to program automated tasks in JewelScript. It contains a number of useful native classes statically linked to the executable.

Changes mainly focus on the network code this time. The Download class has been revised with bug fixes and stability / reliability improvements.... read more

Posted by SourceForge Robot 2014-12-02

Can you hack in JewelScript?

JewelScript looks like a nice language -- but it's all so serious and tidy with semicolons and stuff. So can you really 'hack' in JewelScript?

Yes you can! Here is a code example of Tim William's Email-Obfuscator. I ported it from JavaScript to JewelScript and reformatted it so that all code is on a single text line. You can run it using the JILRun command-line application.... read more

Posted by SourceForge Robot 2014-11-21

JILRun runtime environment 0.6.1.48 released

This is a small update that fixes a few bugs and enhances the reliability of the Download class.

The JILRun Runtime Environment is a console application that embeds the JewelScript language to allow users to program automated tasks in JewelScript. It contains a number of useful native classes statically linked to the executable.

Changes mainly focus on the network code this time. The Download class has been revised with bug fixes and stability / reliability improvements.... read more

Posted by SourceForge Robot 2014-11-20

Top Log-in Spammers for August 2014

This blog continues to be spammed with automated log-in attempts from bots. Luckily 99% of the bots are so unsophisticated, they just try to log in as "admin" with a random password.

If you're a WordPress user yourself, I urge you to delete the default admin user and create a new one under a different name. My blog uses 128-bit hash keys as user names, the names shown in blog posts are just aliases. And aliases aren't recognized as log-in names. If you want to make your WordPress blog safer, I recommend you do the same.... read more

Posted by SourceForge Robot 2014-08-07

Render Island Effect (Heightmap)

Renders a heightmap for an island that can be imported in tools like WorldPainter to create a MineCraft map. (IrfanView Sandbox 1.2)

import Random;
import Math;
import RasterizerSSE;

using Math;

class RenderIsland : Effect
{
    Slider XSeed, XFreq, YSeed, YFreq, SPers, SOcts, SInt1, SInt2, SInt3;
    Label Rand;

    PerlinNoise Perl;
    float SeedX, SeedY;
    float Freq1, Freq2;
    float Int1, Int2;
    float MaxX, MaxY;
    float SteepM, SteepC;

    method RenderIsland()
    {
        Perl = null;
        SeedX = 0;
        SeedY = 0;
        Freq1 = 0;
        Freq2 = 0;
        Int1 = 0;
        Int2 = 0;
        MaxX = 0;
        MaxY = 0;
        SteepM = 0;
        SteepC = 0;

        Rand   = new Label("Perlin Properties");
        XSeed  = new Slider("X Seed (Start Position)",   "", 0,   0, 255,    0);
        YSeed  = new Slider("Y Seed (Start Position)",   "", 0,   0, 255,   70);
        XFreq  = new Slider("Frequency 1 (Zoom Factor)", "", 1,   1,  10,    4);
        YFreq  = new Slider("Frequency 2 (Zoom Factor)", "", 1,   1,  10,   10);
        SPers  = new Slider("Persistence (Smoothing)",   "", 2,   0,   1,  0.6);
        SOcts  = new Slider("Octaves (Level of Detail)", "", 0,   1,   5,    5);
        SInt1  = new Slider("Intensity 1",               "", 2,   0,   1,  0.5);
        SInt2  = new Slider("Intensity 2",               "", 2,   0, 0.3,  0.2);
        SInt3  = new Slider("Flatness / Steepness",      "", 2,   0,   1,  0.5);
    }

    method Parameter[] GetParameters()
    {
        return {Rand, XSeed, YSeed, XFreq, YFreq, SPers, SOcts, SInt1, SInt2, SInt3};
    }

    method EffectInfo GetEffectInfo()
    {
        return new EffectInfo(
            "Render Island",
            "by Jewe",
            "Renders the height map of an island."
        );
    }

    method DoEffect(Image img)
    {
        // create rasterizer for the image
        RasterizerSSE land = new RasterizerSSE(img);
        // set up Perlin noise
        Perl = new PerlinNoise(SOcts.Value, SPers.Value);
        SeedX = XSeed.Value;
        SeedY = YSeed.Value;
        Freq1 = 0.002 * XFreq.Value;
        Freq2 = 0.022 * YFreq.Value;
        Int1 = SInt1.Value;
        Int2 = SInt2.Value * 0.03;
        SteepM = SInt3.Value * 0.5;
        SteepC = 0.5 - SteepM;
        MaxX = Math::PI / img.Rectangle.Width;
        MaxY = Math::PI / img.Rectangle.Height;
        // render map
        land.ProcessPixels(RenderHeightMap);
        // finalize
        land.Finalize();
    }

    method RenderHeightMap(const int x, const int y, ColorRGB c)
    {
        float s = Sin(x * MaxX) * Sin(y * MaxY) * SteepM + SteepC;
        float r = Pow(Perl.Random(SeedX + x * Freq1, SeedY + y * Freq1) * Int1, 3.0)

                + Perl.Random(SeedX + x * Freq2, SeedY + y * Freq2) * Int2;
        c.Set(r + s);
    }
}

link

Posted by SourceForge Robot 2014-07-01

IrfanView 4.38 / IrfanView Sandbox 1.2 released

IrfanView 4.38 has been released and along with it, IrfanView Sandbox 1.2 as part of the IrfanView 4.38 plug-ins bundle.

You can download the new version from the IrfanView main site, or directly via these links:

- IrfanView 4.38
- IrfanView 4.38 plug-ins
link

Posted by SourceForge Robot 2014-06-24

JewelScript 1.2.3.80 released

This update fixes a number of bugs and adds several new language features and improvements to the built-in types.

For detailed information what has changed since the last public release (1.1.3.32), see this post:
http://blog.jewe.org/?p=1416

Posted by Jewe 2014-06-19

JILRuntime 1.2.3.80 update released

This update fixes a number of bugs and adds several new features.

JILRuntime library 1.2.3.80

This update fixes a number of bugs and adds several new language features and improvements to the built-in types.

You can grab it from the sourceforge site (see link above) or download it right off this site using this link.

For detailed information what has changed since the last public release (1.1.3.32), see this post.... read more

Posted by SourceForge Robot 2014-06-19

JILRuntime 1.2.3.80 released

This update fixes a number of bugs and adds several new features.

JILRuntime library 1.2.3.80

This update fixes a number of bugs and adds several new language features and improvements to the built-in types.

You can grab it from the sourceforge site (see link above) or download it right off this site using this link.

For detailed information what has changed since the last public release (1.1.3.32), see this post.... read more

Posted by SourceForge Robot 2014-06-19

namespace and using

namespace std
{
    class Outer
    {
        class Inner
        {
            const string Hello = "Hello World!";
            string msg;
            method Inner() { msg = ""; }
            function Print(Inner i) { }
        }

        method Outer() // access member class
        {
            inner = new Inner();
            inner.msg = Inner::Hello;
            Inner::Print(inner);
        }
        Inner inner;
    }

    class No_Using
    {
        method No_Using() // access member class without 'using'
        {
            inner = new Outer::Inner();
            inner.msg = Outer::Inner::Hello;
            Outer::Inner::Print(inner);
        }
        Outer::Inner inner;
    }

    class Using
    {
        using std::Outer::Inner; // declare namespace usage
        method Using() // access member class with 'using'
        {
            inner = new Inner();
            inner.msg = Hello;
            Print(inner);
        }
        Inner inner;
    }
}

link

Posted by SourceForge Robot 2014-06-04

Lambda expressions

// define a condition delegate type
delegate bool Condition(const string);

class DataSet
{
    string[] Data;

    method DataSet(const string[] data)
    {
        Data = data;
    }

    // returns elements that match the given condition
    method string[] Select(Condition c)
    {
        string[] result;
        for (int i = 0; i < Data.length; i++)
        {
            if( c(Data[i]) )
                result += Data[i];
        }
        return result;
    }
}

function string main(const string[] args)
{
    // create an array of strings
    DataSet names = new DataSet({
        "Judy", "Christopher", "Helen", "James", "Sandra", "Rick", "Elisabeth" });

    // Select all names that start with "J"
    string[] namesWithJ = names.Select( (i) => i.startsWith("J") );

    return null;
}

link

Posted by SourceForge Robot 2014-06-04
MongoDB Logo MongoDB