mardi 2 août 2016

Compiling assemblies for Unity3D using Xamarin 6.x on OSX

8th June 2016, Xamarin releases Xamarin Studio 6.0.0 on OSX, replacing it by Visual Studio 2015 on Windows systems. This version comes with Mono 4.4.x by default, which doesn't support dotNET Framework 3.5. Problem, it's the only way to create compatible assemblies for Unity3D on OSX.

vendredi 7 août 2015

Unity3D: Returning a value from a coroutine

In Unity3D, a simple mecanism helps you to make an asynchronous call in a procedural way, and wait for it to finish: coroutines. This mecanism is not magic. It uses enumerators, that make a code block return a list of values, one by one. However, you can't get any returning value from a coroutine.
But there's a way to do it anyway.

Unity3D - Coroutines et retour de valeurs

Sur Unity3D, un mécanisme simple permet à du code procédural de lancer des traitements asynchrones et d'attendre la fin de son exécution: les coroutines.
Ce mécanisme n'a rien de magique. Il se repose sur les énumérateurs, qui permettent à du code de renvoyer une liste de valeurs, une par une. Cependant, les coroutines ne permettent pas de retourner de valeurs que l'on puisse exploiter.
Il existe toutefois une manière simple de le faire.

vendredi 30 août 2013

Edit Python files with IDLE from WinSCP

Pour une version française de l'article, cliquez sur ce lien : http://antoine-agthe.blogspot.com/2013/08/editer-des-fichiers-python-avec-idle.html


What is WinSCP?


WinSCP for Windows is a simple and powerful tool that lets you work with your server throught SSH while taking benefits of your favorite edition tools, on your favorite Operating System (I stay neutral, never said that my case, or not)


What is Python (briefly)?


Python is a programming language, quite effective, and that simple, for heavy development as for shell script.
It is a good way for whom wants to get started with the wonderful world of programming.


Context


As I was on a project that needed a Facebook connection server-side for statistic processing called once a week (CRON), I chose to use Python.

The server was an Amazon EC2 instance configured with Ubuntu LTS, and my working environment was a PC with Windows 7. I needed a simple solution to edit script files from my server directly on my computer.

I use WinSCP for years now because it makes it easy, by downloading a copy of the edited file into a local temporary file, then listening its updates, in order to upload it automatically when it's modified.

However, the default text editor of WinSCP is not enough convenient for source code editing. And so for Python files. Even if Notepad++ is my favorite editor for many file formats, it does not satisfy me as much as the default Python file editor, IDLE, provided by the Python installer.


Problem


Make IDLE be the default editor of Python files on WinSCP is not as easy as with Notepad++, because IDLE is not an executable, properly speaking.
IDLE is a Python script, interpreted by Python itself, that provides a GUI for python file editing.
So that's not a simple "path to EXE" that you have to set up in WinSCP, but a command line.


Solution


I found a way to do it thanks to the Windows registry.
Don't panic, we won't make anything in that registry, but get a string value.

On Windows, when you wanna edit a Python file, you open the context menu of the file (right click), then select Edit with IDLE.
If you don't know, you'll learn that these contextual functions are defined in the Windows registry.

To find the proper command line, I just called regedit.exe (Windows key + R, then type regedit), then searched (Ctrl+F, or Edit->Search) the following expression : Edit with IDLE.

I got a registry entry HKEY_CLASSES_ROOT\Python.File\shell\Edit with IDLE, that contained a key called command, with the following value:

"C:\Python27\pythonw.exe" "C:\Python27\Lib\idlelib\idle.pyw" -e "%1"

So in order to use IDLE with WinSCP for Python files, you just need to open the Preferences window then click "Editors", and add a new configuration for files with .py extension, select External editor, then type :

C:\Python27\pythonw.exe C:\Python27\Lib\idlelib\idle.pyw -e "!.!"


Editer des fichiers Python avec IDLE depuis WinSCP

For an english version of this article, follow this link : http://antoine-agthe.blogspot.com/2013/08/edit-python-files-with-idle-from-winscp.html

Qu'est-ce que WinSCP ?

WinSCP pour Windows est un outil simple et puissant pour qui désire travailler sur son serveur via SSH tout en bénéficiant de ses outils d'édition favoris, sur son OS favoris (je reste neutre, j'ai jamais dit que c'était mon cas … Je n'ai pas dit le contraire non plus)

Qu'est-ce que Python (vite fait) ?

Python, quant à lui, offre un rapport simplicité/performance plus que correct, que ce soit pour des développements lourds ou dans un usage type script shell.
C'est par ailleurs un très bon langage pour qui voudrait découvrir le monde merveilleux de la programmation.


Contexte

Dans le cadre d'un projet nécessitant une connexion Facebook depuis un serveur pour des traitements périodiques via CRON, j'ai privilégié l'usage d'un script en Python.

Le serveur étant une instance Amazon EC2 sous Ubuntu LTS, et mon environnement de dev étant sous Windows 7, j'avais besoin d'un moyen simple de rapatrier directement le script depuis le serveur, de pouvoir le modifier en local, et de synchroniser ces modifications sur le serveur rapidement.

J'utilise WinSCP depuis assez longtemps maintenant, car il offre cette capacité de synchronisation d'un fichier "remote" modifié en local via un fichier temporaire dont il observe les modifications.

Cependant, l'éditeur par défaut de WinSCP est loin d'être pratique quand il s'agit de modifier des fichiers Python. Si Notepad++ est mon éditeur pour de nombreux formats de fichier, il ne me satisfait pas autant que l'éditeur par défaut de Python, IDLE, fourni avec l'installeur.


Problème

Faire de IDLE l'éditeur par défaut des fichiers Python sur WinSCP n'est pas aussi simple qu'avec Notepad++, car IDLE n'est pas un exécutable à proprement parler.
IDLE est en réalité un script Python qui, s'exécutant, produit un GUI.
Ce n'est donc pas un lien vers une application que vous devez entrer dans la configuration de WinSCP, mais une ligne de commande.


Solution

La solution se trouve dans la base de registre.
Rassurez-vous, nul besoin ici de modifier cette base. Elle m'a juste été nécessaire pour connaître la ligne de commande à utiliser.

Sous Windows, quand on souhaite éditer un fichier Python, on ouvre le menu contexte du fichier (clic droit), puis on sélectionne Edit with IDLE.
Si vous ne le savez pas encore, vous apprendrez donc que ces fonctions contextuelles sont rassemblées dans la base de registre.

Pour trouver cette fonction, j'ai tout simplement exécuté regedit.exe ( touche Windows + R, saisissez regedit), puis j'ai recherché (Ctrl+F, ou menu Edition->Rechercher) l'expression Edit with IDLE.

Je suis donc tombé sur l'entrée HKEY_CLASSES_ROOT\Python.File\shell\Edit With IDLE qui contient une clé command dont la valeur est justement une ligne de commande permettant d'ouvrir un fichier python avec IDLE :

"C:\Python27\pythonw.exe" "C:\Python27\Lib\idlelib\idle.pyw" -e "%1"

Il suffit donc, pour profiter d'IDLE via WinSCP, d'ouvrir la fenêtre des Préférences de WinSCP sur l'onglet "Editeurs", et d'ajouter une nouvelle préférence pour les fichiers d'extension .py et d'utiliser un éditeur externe, en spécifiant :

C:\Python27\pythonw.exe C:\Python27\Lib\idlelib\idle.pyw -e "!.!"




vendredi 8 février 2013

Naming convention for software version

To identify a source code version is a good way to save time during development, test, and deployment phases.
Without it, it is difficult to communicate with all the collaborators, developers, software testers, and final users.

Choosing a naming convention for source code version makes project status easier to control.


Convention de nommage des versions de logiciel

Savoir identifier la version d'un logiciel permet de gagner énormément de temps lors des phases de développement, de test et des différentes phases de mise en production.
Sans cette identification, il est difficile de communiquer avec les différents acteurs d'un projet : les développeurs, les testeurs, jusqu'aux utilisateurs finaux.

En conventionnant le nommage, on assure une compréhension plus rapide de l'état d'un projet.