Tag Archives: 2014

Using bpy – changing colors .

This tutorial show you a simple example of python scripting into Blender 3D software.
You need to select the window for scripting and to test with python scripting shell.
First you need to add one object : cube.
The default script and most common python script, start with this :

You need to see the print python function because will use python ver. 3.
Also the cube object and cursor vars will take the all you need to use it.
Now , this myvar variable show you hou to deal with python 3.

The next two python script will make editable or not the object : your cube.

… now the next line will change it into Object Mode ( can also use TAB key).

The goal of the edit mode_toggle function can be when you will use vertices.
The changing color of the cube can be done with this functions:

Now the cube will show you with a new diffuse color.

Posted in All, Blender 3D, Programming, Python. Tagged with , , , , , .

Unity 3D – C# script – save and load file.

This is a simple C# script example for a C# class Player.
The class Player come with this content into Player.cs C# script:

To make this C# script for saving the Player into one file I used this C# script named SaveLoadManager.cs:

The script come with two parts for save and load files.
I used Serializable property to save binary file named player.sav.
This script used also the Application.persistentDataPath to take the path of application.
I used a Debug log output but if you want to used into real application then is no need to use.
You can deal with any player settings and make new like: player.magic or player.status.
Take a look at the comments in the script and that script highlights design issues.

Posted in 3D, All, C#, Game engine, Programming, Unity 3D. Tagged with , , , , , , .

pygame – using sound, mixer, volume, channels, fade-in and out effect .

PyGame module come with sound feature and this allow users to test some effects.
The next source code will make a window and also will play a song.
After you can test all effects with python version 3.4.1 .
Just see the keys from source code and test it. The song is a ogg file.
I used this sample from a recording of the album Through the Devil Softly by the artist Hope Sandoval and The Warm Inventions from here.
Let’s see the python script:

Posted in All, Python. Tagged with , , , .

Yara python module – part 001

YARA is a multi-platform program running on Windows, Linux and Mac OS X.
More about yara python module can be see it here
YARA used this keywords with rules under files.

The Yara documentation can be found in this link.
The yara python module use version 1.7.7 and this will need to use when make rules.
Instalation with pip :

Let’s see this in action.
First you need to make your user under your_user account.
I make one folder named yara to keep the my rules, see:

and I test this file named doc_data.txt, from here:

The file has this text :

and the rule file detectstring has this rule:

You can use python shell with this source code:

The above rule is telling YARA that the file containing the string must be reported.
The print will show the rule compiled and the result.

yara python

yara python

Posted in All, Programming, Python. Tagged with , , , .

JSON IP and GeoIP REST API from telize website.

According to telize website :
This service offers a REST API allowing to get a visitor IP address and to query location information from any IP address. It outputs JSON-encoded IP geolocation data, and supports both JSON and JSONP.
There is no rate limit of any sort at the moment, and the service is free for everyone to use.

Today I test it with a simple json script.
This is the html file I used to get all infos.

Posted in All, HTML 5, Programming, web. Tagged with , , , , , .