Automatically generate random Simulink models

Differential testing is a well-known technique in compiler testing. In our recent research project, we use this approach to random-test (aka fuzz) Simulink, the popular model-based design tool by MathWorks. Check out the project homepage for an early prototype implementation of our testing scheme which randomly generates (valid) Simulink models and applies differential testing technique to find bugs in Simulink. The project is open source and we welcome new contributors!

VirtualBox create share folder in Ubuntu Server Guest

Guest: Ubuntu

Host: Ubuntu

1. Install Guest Additions

From the Devices toolbar, click shared folder settings. Once the guest addition is downloaded, insert the disc using Devices > Insert Guest Addition CD

2. Mount Guest Addition CD and Install

sudo mount /dev/cdrom /media/cdrom
cd /media/cdrom
sudo VBoxLinuxAdditions.run

3. Restart

4. Create Shared Folder and Mount It

Text below is shamelessly copied from Ubuntu’s official site:

Creating a shared folder

  • Create a folder on the Host computer (ubuntu) that you would like to share, for example ~/share

  • Boot the Guest operating system in VirtualBox.

  • Select Devices -> Shared Folders…

  • Choose the ‘Add’ button.
  • Select ~/share

  • Optionally select the ‘Make permanent’ option

Prepare the folder

After you run following command, the shared folder will be accessible at ~/host location.

sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) share ~/host

Python 3 Read from Standard Input (stdin) Like C or Java

I will be using Python3 to read from standard input (or console). I will present two ways of doing this.

First Example

Input (data.txt)

First line of input will contain an integer which tells how many of lines (of data) will follow up. In each of the following lines, there will be one integer and and one floating-point (decimal) number, separated by a space:

3
1 2.3
3 4
5 6.0

Code (iotest.py)

if __name__ == '__main__':
    # Reading the first line and converting it to an integer
    num_entries = int(input())

    # Running a for loop to read each of the following lines
    for i in range(num_entries):
        current_line = input()
        # Getting the two values separated by space in variables `a` and `b`
        a, b = current_line.split()
        a, b = int(a), float(b)
        print(a, b)

Run the program

python3 iotest.py < data.txt

Second Example

Input (data.txt)

In this example, data file exactly looks like the one from first example, except that the first line is missing. Which means, we do not know how many data to read. We would have to run a while loop to read lines till there is and EoF (End of File) which tells us there is nothing more to read.

1 2.3
3 4
5 6.0

Code (iotest2.py)

if __name__ == '__main__':
    try:
        # Running a while loop since we don't know how many lines to read.
        while True:
            current_line = input()
            # Getting the two values separated by space in variables `a` and `b`
            a, b = current_line.split()
            a, b = int(a), float(b)
            print(a, b)
    except EOFError:
        # There is nothing more to do when we reach End of File (EOF)
        pass

Run

python3 iotest2.py < data.txt

Concluding Notes

  • You can run the programs without saving input data in a file. Just type python3 iotest.py and then enter data.
  • Be sure to use Python 3 only as the code will not work in Python 2
  • We are using input() built-in method of Python 3 which reads a single line and returns it as a string. So we have to convert them to appropriate data type (int/float).

From MDN Work Weekend @ Paris

Mozilla Developer Network (MDN) has been my first priority of contribution for more than a year. Specially, since I started feeling the way that contribution for the developer documentations and keeping them up-to-date in my native language is of utmost importance. Thanks to Mozilla and specially Ali for inviting me to join the first MDN work weekend at Paris, from March 7 to 9.

For those who don’t know what the MDN is: it is the home of HTML, CSS, JavaScript, Web API and other open-web standards’ documentation! Get Involved!

As a part of preparation, I, with the help of MDN task force members here in Bangladesh, ran a survey to understand how well local developers know MDN, how they use it everyday, and how they contribute to it. I was not able to present the survey result at the work weekend due to insufficient response, but I hope to publish the results soon, as now the survey has got more attention from local audience.

Are you a Bangladeshi web developer or CS student? Help us improve MDN for Bangladeshi developers by taking part in this short survey!

But my journey to Paris was not smooth. First, I got visa valid from the wrong dates and I had to change my flight, so that I have valid visa when I enter Paris. Next, my flight was delayed for bad weather conditions and I missed my connecting flight from Dubai. I had to stay a whole day at Dubai and I received at Paris the next day, at 2 PM in the afternoon! I was so much frustrated that once I thought I would go back from Dubai instead of keep trying. But then, I decided that I have to make most of it, so as soon as I arrived at Paris I checked in to my hotel and walked directly to Mozilla space at Paris.

Experience at Paris Mozilla space was awesome. Though I had very little time, I quickly joined Jeremie’s web literacy map session – experience at the session was wonderful. We had to figure it out what complete new learners must have and would be nice to have in order to make a website! Now, there is this MDN glossary which was a fantastic idea for new learners.

The next day I arrived early at the office. I was trying my best to pick up works. I spent most of the time with Kensie, Kaustav and Priyanka figuring out next steps for Dev Derby contest. I also had some inputs for MDN events as I had run localization sprint in Bangladesh. At afternoon everyone presented their works, it was really amazing to see so many outcomes in just 3 days. At the same time, I also felt bad about my flight incidents for which I missed most of the work weekend.

We had these fantastic dinners at Paris. I met these amazing people whom I’ve always wanted to meet, and having time with them has been the most inspiring thing that have ever happened to me, and I’m thriving to build the local contributor base here in my country for MDN!

 

 

Mozilla Awareness Booth @ AUST, Dhaka

Returned happily from Mozilla Awareness Booth at Ahsanullah University of Science & Technology (AUST), Dhaka. I returned early, Mozilla Bangladesh community fellows are still there, talking to buzzing students, making them aware of Mozilla missions and awesome products, and helping them to connect to us back by our Facebook group & mailing lists.

I’ll congratulate Ratul as this was his first event after being a rep and also Noor vai, Shuvo, Rifaz and Fuad for always being busy in the booth, talking to the students and being so much motivated!

There was little to do for me other them talking to the students about the MDN activities we’re doing here and web-dev stuffs, so I took some photos at the booth. 🙂