<commit_before># Using RhoSimulator

RhoSimulator allows to [run](#run-application-in-rhosimulator) Rhodes applications without lengthy build process and to [debug](#debugging-with-rhostudio) them in [RhoStudio](../rhostudio.tutorial). Currently RhoSimulator works on <b>Windows</b> only.

## Install RhoSimulator

If you have [Rhodes gem](install#rhodes-gem-for-linux-and-non-rhostudio), then RhoSimulator is installed already.
(Note: If you're going to use RhoSimulator from rhodes-3.1.0 gem on Mac, you need to put missing Qt libraries
(QtDBus.framework and QtXml.framework) from [RhoSimulator31Mac_fix.zip](http://rhosimulator.s3.amazonaws.com/RhoSimulator31Mac_fix.zip)
to 'platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks' folder within rhodes SDK home directory,
e.g. '/Library/Ruby/Gems/1.8/gems/rhodes-3.1.0/')

If you would like to run RhoSimulator without Rhodes gem, download [Windows](http://rhosimulator.s3.amazonaws.com/RhoSimulator.zip) or
[Mac OS X](http://rhosimulator.s3.amazonaws.com/RhoSimulatorMac.zip) version, unzip and specify path to `rhosimulator.exe` or `RhoSimulator.app` respectively at `rhodes/rhobuild.yml`:

        env: 
           paths:    
              rhosimulator: <RhoSimulator folder>

Alternatively you may [build](#build-rhosimulator) your own customized version of RhoSimulator as described [below](#build-rhosimulator).

## Run application in RhoSimulator

To run application in RhoSimulator just run in rhodes or application folder:

    #run RhoSimulator to simulate specific platform:
    rake run:android:rhosimulator 
    rake run:iphone:rhosimulator
    
    #bbver from build.yml will be used as System.get_property('os_version')
    rake run:bb:rhosimulator
    
    rake run:wm:rhosimulator
    rake run:wp:rhosimulator

    #run RhoSimulator to simulate 'UNKNOWN' platform:
    rake run:win32:rhosimulator

If you modified Rhodes application sources, just press 'Refresh' in RhoSimulator to reload application, i.e. generally no RhoSimulator restart is required.
The restart of RhoSimulator is required only if a model was added/modified or some code was added to the AppApplication class.

## Debugging with RhoStudio

### Prerequisites

* Install [RhoStudio](../rhostudio.tutorial)
* Install [RhoSimulator](#install-rhosimulator)
* Ensure your application is configured properly and successfully [runs in RhoSimulator](#run-application-in-rhosimulator) (from command line as described above)

### Starting debug session in RhoStudio

* Select Run » Debug Configurations... from top menu
* Find 'Rhodes Application' section on the left and add new (or modify existing) configuration
* On 'Common setting' tab select a project by clicking 'Browse...' button next to 'Project name:'
* Select 'Rho simulator' as the platform
* Click 'Apply' and then 'Debug'

### Debug capabilities

In present version of RhoStudio you may:

* Set breakpoints in Ruby code (.rb files)
* Watch variable values (global, local, class and instance) - currently auto-watch list is displayed in Expressions window
* View application log in Console window

## Build RhoSimulator

If you use custom native extensions, then running and debugging your applications in RhoSimulator requires a custom build.
Follow these instructions to build your own customized version of RhoSimulator.

### Preliminary steps for Windows

* Currently only <b>Visual Studio 2008</b> is supported
* Follow [Build for Windows - Prerequisites](build#build-for-windows), but do not install the Rhodes gem since you're going to use Rhodes SDK source.
* Get the `rhodes` source (if haven't done it already) as described [here](build#setup-rhodes-source-code). Don't forget to add the `bin` folder to your path, run `rhodes-setup` and update Rhodes SDK path in `build.yml` at your application root folder.
* First build the Qt libraries for VS 2008:
    * Download the Qt source:
        * Go to [http://qt.nokia.com/downloads](http://qt.nokia.com/downloads)
        * Jump to `Qt libraries`
        * Download the [source code as a zip](http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.8.1.zip) (260 MB)
        * Extract the downloaded archive, e.g. into `C:\Qt\4.8.1`
    * Prepare to build the OpenSSL library:
        * Download [v1.0 source code](http://www.openssl.org/source/openssl-1.0.1.tar.gz) from [www.openssl.org](http://www.openssl.org/) and extract the downloaded archive, e.g. into `C:\Qt\openssl-1.0.1`
        * Install Perl interpreter (if it's not installed yet), e.g. [ActiveState Perl](http://www.activestate.com/activeperl)
        * Install [Netwide Assembler (NASM)](http://www.nasm.us/pub/nasm/releasebuilds/2.10/win32/nasm-2.10-installer.exe) from [www.nasm.us](http://www.nasm.us/) (if it's not installed yet)
    * Open Control Panel » System » Advanced system settings » Environment Variables and then:
        * Create new system variable `QTDIR` = `C:\Qt\4.8.1` (this will be the installation folder of the compiled Qt libraries)
        * Add to the `PATH` variable: `C:\Qt\4.8.1\bin;C:\Qt\openssl-1.0.1\bin` (it doesn't matter that `C:\Qt\openssl-1.0.1\bin` folder does not exist yet)
        * Add to the `PATH` variable the path to `nasm.exe` (usually `C:\Program Files\nasm`)
        * Either close all command prompts and Visual Studio instances, or reboot the computer so the new settings take effect.
    * Open Visual Studio 2008 Command Prompt. This is accomplished using Start » All Programs » Microsoft Visual Studio 2008 » Visual Studio Tools » Visual Studio 2008 Command Prompt. Run in Visual Studio 2008 Command Prompt:

			> vcvarsall.bat x86
			> C:

    * To build OpenSSL library run in the same command prompt:

			> cd \Qt\openssl-1.0.1
			> perl Configure VC-WIN32 enable-static-engine --prefix=C:/Qt/openssl-1.0.1
			> ms\do_nasm
			> nmake -f ms\ntdll.mak
			> nmake -f ms\ntdll.mak install
			> nmake -f ms\ntdll.mak clean

    * To build Qt library run in the same command prompt:

			> cd \Qt\4.8.1
			> configure -opensource -platform win32-msvc2008
			  -nomake examples -nomake demos -nomake docs
			  -qt-libpng -qt-libjpeg -qt-libtiff -qt-libmng
			  -openssl-linked -I C:/Qt/openssl-1.0.1/include
			  -L C:/Qt/openssl-1.0.1/lib
			> nmake
			> nmake clean

      Be aware that it will take a while to build the Qt libraries from sources (maybe few hours or so). Particularly the `configure` command may run for a few minutes, and the `nmake` command may run for a few hours.
    * After the build process is completed exit Visual Studio 2008 Command Prompt

### Preliminary steps for Mac OS X

* Follow [Building a Rhodes Application for iPhone/iPad - Prerequisites](build#building-a-rhodes-application-for-iphoneipad), but do not install the Rhodes gem since you're going to use Rhodes SDK source.
* Get the `rhodes` source (if haven't done it already) as described [here](build#setup-rhodes-source-code). Don't forget to add the `bin` folder to your path, run `rhodes-setup` and update Rhodes SDK path in `build.yml` at your application root folder.
* First build the Qt libraries for Mac from sources to enable HTTPS protocol support in RhoSimulator:
    * Download the Qt source:
        * Go to [http://qt.nokia.com/downloads](http://qt.nokia.com/downloads)
        * Jump to `Qt libraries`
        * Download the [source code as a gzipped tar](http://download.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.8.1.tar.gz) (229 MB)
        * Extract the downloaded archive, e.g. into `~/qt-4.8.1`
    * Make sure that your `PATH` environment variable does not contain the path to any previously installed Qt binaries
    * Add to your `~/.profile` the new environment variable `QTDIR` by adding the line (or by changing the existing `QTDIR` variable):
<commit_msg>rhosimulator/win32: rolled back to Qt 4.7.4<commit_after># Using RhoSimulator

RhoSimulator allows to [run](#run-application-in-rhosimulator) Rhodes applications without lengthy build process and to [debug](#debugging-with-rhostudio) them in [RhoStudio](../rhostudio.tutorial). Currently RhoSimulator works on <b>Windows</b> only.

## Install RhoSimulator

If you have [Rhodes gem](install#rhodes-gem-for-linux-and-non-rhostudio), then RhoSimulator is installed already.
(Note: If you're going to use RhoSimulator from rhodes-3.1.0 gem on Mac, you need to put missing Qt libraries
(QtDBus.framework and QtXml.framework) from [RhoSimulator31Mac_fix.zip](http://rhosimulator.s3.amazonaws.com/RhoSimulator31Mac_fix.zip)
to 'platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks' folder within rhodes SDK home directory,
e.g. '/Library/Ruby/Gems/1.8/gems/rhodes-3.1.0/')

If you would like to run RhoSimulator without Rhodes gem, download [Windows](http://rhosimulator.s3.amazonaws.com/RhoSimulator.zip) or
[Mac OS X](http://rhosimulator.s3.amazonaws.com/RhoSimulatorMac.zip) version, unzip and specify path to `rhosimulator.exe` or `RhoSimulator.app` respectively at `rhodes/rhobuild.yml`:

        env: 
           paths:    
              rhosimulator: <RhoSimulator folder>

Alternatively you may [build](#build-rhosimulator) your own customized version of RhoSimulator as described [below](#build-rhosimulator).

## Run application in RhoSimulator

To run application in RhoSimulator just run in rhodes or application folder:

    #run RhoSimulator to simulate specific platform:
    rake run:android:rhosimulator 
    rake run:iphone:rhosimulator
    
    #bbver from build.yml will be used as System.get_property('os_version')
    rake run:bb:rhosimulator
    
    rake run:wm:rhosimulator
    rake run:wp:rhosimulator

    #run RhoSimulator to simulate 'UNKNOWN' platform:
    rake run:win32:rhosimulator

If you modified Rhodes application sources, just press 'Refresh' in RhoSimulator to reload application, i.e. generally no RhoSimulator restart is required.
The restart of RhoSimulator is required only if a model was added/modified or some code was added to the AppApplication class.

## Debugging with RhoStudio

### Prerequisites

* Install [RhoStudio](../rhostudio.tutorial)
* Install [RhoSimulator](#install-rhosimulator)
* Ensure your application is configured properly and successfully [runs in RhoSimulator](#run-application-in-rhosimulator) (from command line as described above)

### Starting debug session in RhoStudio

* Select Run » Debug Configurations... from top menu
* Find 'Rhodes Application' section on the left and add new (or modify existing) configuration
* On 'Common setting' tab select a project by clicking 'Browse...' button next to 'Project name:'
* Select 'Rho simulator' as the platform
* Click 'Apply' and then 'Debug'

### Debug capabilities

In present version of RhoStudio you may:

* Set breakpoints in Ruby code (.rb files)
* Watch variable values (global, local, class and instance) - currently auto-watch list is displayed in Expressions window
* View application log in Console window

## Build RhoSimulator

If you use custom native extensions, then running and debugging your applications in RhoSimulator requires a custom build.
Follow these instructions to build your own customized version of RhoSimulator.

### Preliminary steps for Windows

* Currently only <b>Visual Studio 2008</b> is supported
* Follow [Build for Windows - Prerequisites](build#build-for-windows), but do not install the Rhodes gem since you're going to use Rhodes SDK source.
* Get the `rhodes` source (if haven't done it already) as described [here](build#setup-rhodes-source-code). Don't forget to add the `bin` folder to your path, run `rhodes-setup` and update Rhodes SDK path in `build.yml` at your application root folder.
* First build the Qt libraries for VS 2008:
    * Download the Qt source:
        * Go to [http://qt.nokia.com/downloads](http://qt.nokia.com/downloads)
        * Jump to `Qt libraries`
        * Download the [source code as a zip](http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.4.zip) (237 MB)
        * Extract the downloaded archive, e.g. into `C:\Qt\4.7.4`
    * Prepare to build the OpenSSL library:
        * Download [v1.0 source code](http://www.openssl.org/source/openssl-1.0.1.tar.gz) from [www.openssl.org](http://www.openssl.org/) and extract the downloaded archive, e.g. into `C:\Qt\openssl-1.0.1`
        * Install Perl interpreter (if it's not installed yet), e.g. [ActiveState Perl](http://www.activestate.com/activeperl)
        * Install [Netwide Assembler (NASM)](http://www.nasm.us/pub/nasm/releasebuilds/2.10/win32/nasm-2.10-installer.exe) from [www.nasm.us](http://www.nasm.us/) (if it's not installed yet)
    * Open Control Panel » System » Advanced system settings » Environment Variables and then:
        * Create new system variable `QTDIR` = `C:\Qt\4.7.4`
        * Add to the `PATH` variable: `C:\Qt\4.7.4\bin;C:\Qt\openssl-1.0.1\bin` (it doesn't matter that `C:\Qt\openssl-1.0.1\bin` folder does not exist yet)
        * Add to the `PATH` variable the path to `nasm.exe` (usually `C:\Program Files\nasm`)
        * Either close all command prompts and Visual Studio instances, or reboot the computer so the new settings take effect.
    * Open Visual Studio 2008 Command Prompt. This is accomplished using Start » All Programs » Microsoft Visual Studio 2008 » Visual Studio Tools » Visual Studio 2008 Command Prompt. Run in Visual Studio 2008 Command Prompt:

			> vcvarsall.bat x86
			> C:

    * To build OpenSSL library run in the same command prompt:

			> cd \Qt\openssl-1.0.1
			> perl Configure VC-WIN32 enable-static-engine --prefix=C:/Qt/openssl-1.0.1
			> ms\do_nasm
			> nmake -f ms\ntdll.mak
			> nmake -f ms\ntdll.mak install
			> nmake -f ms\ntdll.mak clean

    * To build Qt library run in the same command prompt:

			> cd \Qt\4.7.4
			> configure -opensource -platform win32-msvc2008
			  -nomake examples -nomake demos -nomake docs
			  -qt-libpng -qt-libjpeg -qt-libtiff -qt-libmng -qt-gif
			  -openssl-linked -I C:/Qt/openssl-1.0.1/include
			  -L C:/Qt/openssl-1.0.1/lib
			> nmake
			> nmake clean

      Be aware that it will take a while to build the Qt libraries from sources (maybe few hours or so). Particularly the `configure` command may run for a few minutes, and the `nmake` command may run for a few hours.
    * After the build process is completed exit Visual Studio 2008 Command Prompt

### Preliminary steps for Mac OS X

* Follow [Building a Rhodes Application for iPhone/iPad - Prerequisites](build#building-a-rhodes-application-for-iphoneipad), but do not install the Rhodes gem since you're going to use Rhodes SDK source.
* Get the `rhodes` source (if haven't done it already) as described [here](build#setup-rhodes-source-code). Don't forget to add the `bin` folder to your path, run `rhodes-setup` and update Rhodes SDK path in `build.yml` at your application root folder.
* First build the Qt libraries for Mac from sources to enable HTTPS protocol support in RhoSimulator:
    * Download the Qt source:
        * Go to [http://qt.nokia.com/downloads](http://qt.nokia.com/downloads)
        * Jump to `Qt libraries`
        * Download the [source code as a gzipped tar](http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.8.1.tar.gz) (229 MB)
        * Extract the downloaded archive, e.g. into `~/qt-4.8.1`
    * Make sure that your `PATH` environment variable does not contain the path to any previously installed Qt binaries
    * Add to your `~/.profile` the new environment variable `QTDIR` by adding the line (or by changing the existing `QTDIR` variable):

{'fraction_non_alphanumeric': 0.09873042469549527, 'fraction_numerical': 0.015273570922214345, 'mean_word_length': 3.7939450108124806, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 14, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 27, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3662163', 'n_tokens_mistral': 5046, 'n_tokens_neox': 4579, 'n_words': 1749}