We now describe the basics of developing applications with Eclipse. We begin with a short C++ example that you can build and run in your development machine; then we will port the example to run on the Android device, first using Java, then using Java + native code (C/C++), and finally using only native code.
After you complete this topic you should be able to:
We will now create our first C++ example program using Eclipse. The goal of this lesson is to get you familiarized with the Eclipse environment, so we will focus on a simple program that you will run on your desktop computer.
To develop C/C++ projects, you must first open the C/C++ perspective. The Open Perspective toolbar icon is located on the top-right corner of your Eclipse IDE. Each perspective in Eclipse provides a different set of docking arrangements for viewing the content and semantics of your files and projects. The default is the Java perspective; there is also a Debug perspective, and a C++ perspective. Click on the Open Perspective icon, select Other and pick C/C++.
Once on the C++ perspective, we will create the Fibonacci project. Select File > New > C++ project . Enter the project name, Fibonacci, and select Empty Project.
The toolchain option allows you to select which compiler you will use for this project. This will be platform specific: on Linux select Linux GCC; on Windows either MinGW GCC or Cygwin GCC; on Mac select MacOSX GCC. Finally, click on Finish.
Next, select the newly created Fibonacci project, and right-click to select New > Header File. Enter Fibonacci.h under Header File: and hit Finish.
Add the declaration for our Fibonacci function, as shown below. Enter the text and save the file.
#ifndef FIBONACCI_H_
#define FIBONACCI_H_
unsigned int Fibonacci( unsigned int n );
#endif /* FIBONACCI_H_ */
It is time to create our main function. Right-click on the project name and select New > Source File . Enter main.cpp in the Source File: entry.
Our program entry point will call the Fibonacci function and print the result out to the console.
#include <iostream>
#include "Fibonacci.h"
int main( int argc, char * argv[] )
{
std::cout << "Fibonacci(10) = " << Fibonacci( 10 ) << std::endl;
}
Now we will write the Fibonacci function. Create a new source file, name it Fibonacci.cpp and enter the text shown below.
#include "Fibonacci.h"
unsigned int Fibonacci( unsigned int n )
{
if( n == 1 ) { return 1; }
if( n == 0 ) { return 0; }
return Fibonacci( n - 1 ) + Fibonacci( n - 2 );
}
The program is done, let’s build the executable. Right-click the project and select Build Project. In the Console tab you should see the build progressing and succeeding.
Run the project. On the toolbar you will find two buttons, one for debugging and one for running the program.
Hit the run button (with the white triangle) and watch the Console tab in Eclipse, which will show the results of the compilation and then the output of the execution of the program.
Note
If you get an error message saying the binary couldn’t be found, go back to the previous step and make sure the project is built correctly.
After the program prints out the result of the Fibonacci call, it will exit.
We will now debug the program to trace its execution.
Note
Debugging requires gdb to be in your PATH. On Windows, you will be either using Cygwin gdb or MinGW gdb. If you are using Cygwin as installed by TADP, gdb will be missing. Run setup.exe under NVPACK/cygwin, select “install from Internet” and install the gdb package (under Devel section).
Open main.cpp and insert a breakpoint by double-clicking on the left margin as shown below. (Alternatively, right-click and select Toggle Breakpoint.) The blue dot is an indication that the breakpoint has been set.
Now hit the debug button on the toolbar. When the program starts you may be asked if you want to open the Debug Perspective, select Yes.
Once in the Debug perspective the program execution should stop at the breakpoint you have inserted.
The Debug toolbar allows you to select what to do next — continue running the program, step into, or step over the function.
We will step into the Fibonacci function to see it working. Select Step into or equivalently press F5. The execution will move into the Fibonacci function. The Debug Perspective shows a great deal of information: the calling stack, the current local variables, and the source code. In addition you can add watches, inspect memory, and even disassemble the code.
Instead of computing Fibonacci of 10, let’s compute Fibonacci of 15. In the local variables view, find the variable n and change its value from 10 to 15. After you are done, hit the Resume (F8) button.
You can even make breakpoints conditional: add a breakpoint to the Fibonacci function, right-click it and select Breakpoint Properties... > Common, set Condition: to n==5, and resume debugger (F8); now the debugger should stop when the function has been called with n equals 5.
In the previous steps, we left many details uncovered. Eclipse has an internal Makefile builder that creates the Makefile based on the sources that you add to the project. That is why we were able to build the program succesfully. In addition, Eclipse has different build configurations for a project. In this example, both Debug and Release configurations were created. The Debug configuration builds the program for debugging, while the Release turns on compiler optimizations for the final program. If you want to change the build properties, right-click on the project and press Alt + Enter (Linux) or Cmd + I (Mac) to bring up the properties sheet. Under C/C++ Build you will find the build options.
We will now create a similar Android project to run on our device.
Open the Java perspective. An Android project is always a Java project with the possible addition of native code. (Later we show projects that seem to be native-only, but in reality even they use Android Java runtime services.)
Select File > New > Android Application Project. In Application Name: type Fibonacci. In Project Name, type AndroidFibonacci. This is the name of the project in Eclipse. We already have a Fibonacci project so we must choose a different name. Set the remaining properties as shown and click Next.
Note
Don’t use spaces in the project name, otherwise native debugging will fail to find the symbols.
An Activity is Android’s basic unit of user interaction. We will manually create an Activity, so uncheck the Create Activity box and click Finish.
You now have a basic Android project skeleton.
We will now create a new Java class. Right-click on src and select New > Class. Fill out the class properties as shown — we want to create a class that inherits from android.app.Activity within the package com.nvidia.example.fibonacci.
Open the FibonacciActivity.java and add a Fibonacci function to the class skeleton. Java doesn’t have unsigned types, so we will use integers instead and handle negative numbers correctly.
package com.nvidia.example.fibonacci;
import android.app.Activity;
public class FibonacciActivity extends Activity {
int Fibonacci( int n ) {
if( n == 1 ) { return 1; }
if( n <= 0 ) { return 0; }
return Fibonacci( n - 1 ) + Fibonacci ( n - 2 );
}
We now have to create a simple UI to display our output. For this, we create a TextView widget inside the onCreate method. Add following code for the ‘’onCreate’’ method to the ‘’FibonacciActivity’’ class:
@Override
public void onCreate( Bundle savedInstance ) {
super.onCreate(savedInstance);
// Create the TextView
TextView tv = new TextView( this );
tv.setText( "Fibonacci(10) = " + Fibonacci( 10 ) );
setContentView( tv );
}
Note
After you copy and paste the code shown above, Eclipse will underline Bundle and TextView and note them as undefined classes. These are Android framework classes that require an import declaration. To add the imports for these, hover the cursor over the underlined text, and select the import option from the possible fixes or press the shortcut combination Ctrl-Shift-M (Linux, Windows) or CMD-SHFT-M (on Mac). You can of course just type the imports in, too.
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
All our code has been written. Now we need to specify in the manifest which activity to launch for this application. There can be more than one activity within an application, and one of those can be marked as the main entry point. We have created a single activity so far, this will be our MAIN and LAUNCHER activity.
Open AndroidManifest.xml. Eclipse will open the manifest editor. Select the AndroidManifest.xml tab to view the xml file.
Then replace the activity tag with the code shown below:
<application android:label="@string/app_name"
android:icon="@drawable/ic_launcher"
android:theme="@style/AppTheme">
<activity
android:name=".FibonacciActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
An Intent describes an operation to be performed. Activities with certain intent filters can perform the operations described by the intents.
Now we can run the application on the device! Make sure the device is connected an powered on. Right-click on the project name and select Run As > Android Application. Alternatively, you can click the run button on the toolbar. The code will be built and packaged into an .apk file that is pushed to the device and launched. The first time you ran the application you will be shown the “Auto Monitor Logcat” dialog. Choose Yes.
Once the application is run you should see:
This concludes our simple Java application tutorial.
See also
Now that we have completed our first app, we will launch the debugger and trace execution of the Fibonacci function.
To avoid debugging the String construction, modify the code slightly as shown below and set a breakpoint on the line that calls Fibonacci (double-click on the left of the line):
@Override
public void onCreate( Bundle savedInstance ) {
super.onCreate( savedInstance );
// Create the TextView
TextView tv = new TextView( this );
int fibo = Fibonacci( 10 );
tv.setText( "Fibonacci(10) = " + fibo );
setContentView( tv );
}
Click on the Debug button, and if prompted about the Debug Configuration, select Android Application. The application package will be recompiled and copied to the device. You might see a message saying the application is waiting for the debugger to connect, this is normal. You will be taken to the Debug Perspective and will see the application hit a breakpoint. Press F5 to trace into the function call. (Note that you can click the images in this document to see them in full size.)
Try changing the the value of n and hit F8 to continue running and see the displayed result.
Android provides a system log mechanism for developers to use from their applcations. The log has different levels of information:
- V — verbose
- D — debug
- I — info
- W — warning
- E — error
- F — fatal
All messages in the log include the process id that generated it. We will now add logging to our Fibonacci application.
Open FibonacciActivity.java and add the highlighted lines:
import android.util.Log;
public class FibonacciActivity extends Activity {
private static final String TAG = "Fibonacci";
@Override
public void onCreate( Bundle savedInstance ) {
Log.d( TAG, "onCreate called" );
super.onCreate( savedInstance );
// Create the TextView
TextView tv = new TextView( this );
int fibo = Fibonacci( 10 );
tv.setText( "Fibonacci(10) = " + fibo );
setContentView( tv );
}
Each LOG message has a TAG that comes very handy for filtering messages out. A good TAG is a name that relates to your activity.
Run the application and open the LogCat view in Eclipse to see the message. Go to Window > Show View > LogCat. If you don’t see the LogCat option, go to Window > Show View > Other... and search for LogCat. The LogCat viewer can filter the messages by process or information level, and you can also search the log as it is being dumped.
Alternatively, you can display the logcat in a console window by running adb, which can be found under the androd-sdk-[linux|windows|mac]/platform-tools directory:
adb logcat -s Fibonacci:*
The -s makes the default filter silent and the Fibonacci:* tells logcat to enable the Fibonacci tagged messages.
If you would like to write debug messages to a file, you need to be aware that Android has every application running under a different user id and has a limited set of paths that are writable by the application and visible to the user. If you are using the Tegra 3 Prototype, you can create directory under data to store your log files. But on commercial devices, this location is usually protected and you will need to find a suitable user-accessible path. Android provides the means to do so. To keep it simple, let’s add logging to a file we create in external storage. Don’t get mislead by the word external here, the external storage may not be the SD card. Files you write to external storage are not deleted when the application is uninstalled.
In FibonacciActivity.java, we will add code to write to a log file. We will create a logWriter class instance variable that we will use to write text messages to a file we will create.
private FileWriter logWriter;
@Override
public void onCreate( Bundle savedInstance ) {
Log.d( TAG, "onCreate called" );
super.onCreate( savedInstance );
try {
File path = Environment.getExternalStorageDirectory();
File logfile = new File( path, "fibo_log.txt" );
logWriter = new FileWriter( logfile );
Log.i( TAG, "Writing log to " + logfile );
}
catch( IOException e ) {
Log.e( TAG, "Couldn't open log file - reason " + e.getMessage() );
}
logMessage( "FibonacciActivity.onCreate\n" );
// Create the TextView
TextView tv = new TextView( this );
int fibo = Fibonacci( 10 );
tv.setText( "Fibonacci(10) = " + fibo );
setContentView( tv );
}
Now, let’s create the auxiliary function logMessage:
private void logMessage( String msg ) {
if ( logWriter != null ) {
try {
logWriter.write( msg );
}
catch( IOException e )
{
Log.e( TAG, "Couldn't write message to log file - reason " + e.getMessage() );
}
}
}
Finally, we need to flush the file and close the writer when the Activity is paused.
@Override
public void onPause() {
logMessage( "FibonacciActivity.onPause\n" );
try {
logWriter.close();
}
catch( IOException e )
{
Log.e( TAG, "Failed to close log file - reason: " + e.getMessage() );
}
super.onPause();
}
Modify the AndroidManifest.xml and indicate that the application requests permission to write to external storage.
<!-- Before the application tag, add the requested permissions -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application android:label="@string/app_name"
Run the application. Because each Android device might have a different path to the external storage, we print the location of the file to the system log.
To view the file, transfer it to the host computer from the command line using the command below (check the path from the log message). Note that in this implementation you have to pause the application so the file is closed so you can read the file.
adb pull /mnt/sdcard/fibo_log.txt
See also
An explanation on Android storage.
Using our FibonacciActivity as a starting point, we will add a native library that computes the Fibonacci function.
We first tell the project to build both C++ and Java code. Right-click on the project name and select Android Tools > Add Native Support ... Set the library name to libfibonacci.so, and click on Finish.
You will notice that Eclipse has now changed to the C++ Perspective. In addition, there is a new folder in the project tree called jni that contains fibonacci.cpp and Android.mk
Android.mk is a make file with the instructions on how to build our native sources.
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := fibonacci
LOCAL_SRC_FILES := fibonacci.cpp
include $(BUILD_SHARED_LIBRARY)
The LOCAL_MODULE gives the module name which in turn is used for the output filename. LOCAL_SRC_FILES contains the list of files to build, and finally, the include command is used to include the rules for building a shared library. The output of the build will be libfibonacci.so. This library needs to be explicitly loaded by the Java VM, as we show next.
Create a new file under the jni folder named Application.mk. Right-click on jni and select New > File.
While the Android.mk files defines module settings, the Application.mk file is used to define per-application settings that apply to all modules. Set the contents of the new file as shown below:
APP_ABI := armeabi-v7a
APP_PLATFORM := android-8
The APP_ABI line defines the target machine code instruction set to generate. The default is armeabi, which corresponds to an ARM ISA with no hardware floating point support. To support hardware FPU instructions of more recent ARM processors use armeabi-v7a. We also set the APP_PLATFORM to android-ver, where ver is the value of the ‘’android::minSdkVersion’’ in the ‘’AndroidManifest.xml’‘. A version above 9 is required to support ‘’NativeActivity’‘.
Let’s now modify the FibonacciActivity class and mark the Fibonacci function as native. We will also add a static method that loads the native library.
public class FibonacciActivity extends Activity {
@Override
public void onCreate( Bundle savedInstance ) {
super.onCreate( savedInstance );
// Create the TextView
TextView tv = new TextView( this );
int fibo = Fibonacci( 10 );
tv.setText( "Fibonacci(10) = " + fibo );
setContentView( tv );
}
// Our native Fibonacci function
native int Fibonacci ( int n );
static {
System.loadLibrary( "fibonacci" );
}
In our modified class the Fibonacci function doesn’t have an implementation, it is only marked as native.
To link the Java native method with its actual implementation the Java VM machine relies on name mangling. You can use the javah utility to generate the function headers for you and avoid remembering the mangling rules. For this, you will first need to compile your project. Right-click on the project name and select Build Project.
You will notice that even though the fibonacci.cpp is empty, the C++ builder is invoked successfully. There is no error telling us that the native method has not been implemented. This kind of error will be a Java Exception raised by the virtual machine. You can see it for yourselft, try to run the application, it will crash. You can look at the error by browsing the logcat:
If the LogCat window is too small, select the window and hit CTRL+M to expand the window, another CTRL+M brings back the other windows. Double-clicking the tab also does the same thing.
To generate the proper function header, open a console, go to your project directory (where the AndroidManifest.xml file is located) and run javah:
javah -classpath ./bin/classes -d jni com.nvidia.example.fibonacci.FibonacciActivity
The output will be the file jni/com_nvidia_example_fibonacci_FibonacciActivity.h
If it doesn’t work...
We found on some installations that javah from a previous, non-Android Java installation was on the path before the one from Android toolkit. Type which javah to find which version is used if you get problem, it should return a path within NVPACK. On cygwin, we fixed this by editing /home/<user>/.bash_profile by adding a line
PATH="/cygdrive/c/NVPACK/jdk1.6.0_24/bin:${PATH}"
Open the file fibonacci.cpp to continue working on our implementation. Create the Fibonacci function as shown and add an include for the new header.
#include <jni.h>
int Fibonacci( int n )
{
if ( n == 1 ) { return 1; }
if ( n <= 0 ) { return 0; }
return Fibonacci( n - 1 ) + Fibonacci( n - 2 );
}
Copy and paste the function declaration from jni/com_nvidia_example_fibonacci_FibonacciActivity.h into fibonacci.cpp. If you can’t see the file in the jni folder, click the folder and press F5 to refresh. Our jni function will simply be a wrapper around the Fibonacci function.
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: com_nvidia_example_fibonacci_FibonacciActivity
* Method: Fibonacci
* Signature: (I)I
*/
JNIEXPORT jint JNICALL Java_com_nvidia_example_fibonacci_FibonacciActivity_Fibonacci
( JNIEnv *env, jobject obj, jint n )
{
return Fibonacci( n );
}
#ifdef __cplusplus
}
#endif
That’s it! Build the project and click the run button to see it running on the device.
See also
Now that we have built and deployed our mixed Java and native code Activity we will show how to debug it. There are two Debug configurations that we can use. To debug Java code, we will debug as we did previously, by selecting Debug As > Android Application. This configuration launches a debugger that attaches to the Java VM. For native code, we will instead use Debug As > Android Native Application. This configuration now launches a gdbserver instance on the device that attaches to the application process.
To generate a binary library that is debugging-friendly we need to modify the build command. Right-click on the AndroidFibonacci project, and select Properties > C/C++ Build. Uncheck the Use default build command option and add the NDK_DEBUG=1 option to the build command.
More on configurations
To make switching between Release and Debug mode faster, you can use Build Configurations. Right now you only have a configuration called Default which is basically a Release build configuration created for you by Eclipse. Right-click on the project name in the Project Explorer pane, then Build Configurations, and you should see it:
Let’s create our Debug configuration. In the menu shown above, choose Manage... instead of Set Active. In the new window click New. In the field Name of the window that just opened type “Debug” and hit OK. If you go to the project’s properties now, in the C/C++ Build you should be able to pull down the Configuration menu and see your Debug configuration:
Select it and set the NDK_DEBUG=1 option as shown above. Hit OK. You can now switch between configurations by right-clicking the project’s name and then Build Configuration > Set Active:
The debugger attaches to the application process asynchronously, which means that the application will start and run until the point when gdbserver attaches to the process. As a consequence, if you are trying to put a breakpoint in code that runs early in your application, the program flow might have already gone by that point when the debugger is finally attached. To debug our Fibonacci function that is called when the application starts, we will modify fibonacci.cpp:
#ifdef __cplusplus
extern "C" {
#endif
#define WAIT_FOR_DEBUGGER
jint JNI_OnLoad( JavaVM *vm, void *reserved )
{
#if defined(WAIT_FOR_DEBUGGER)
volatile int _dbg = 1;
while ( _dbg )
{
}
#endif
return JNI_VERSION_1_2;
}
#ifdef __cplusplus
}
#endif
We have added a new function JNI_OnLoad with an infinite loop in it. JNI_OnLoad is called when the Java VM loads the library. The infinite loop will stall execution until the debugger is attached and we manually change the value of _dbg. It is marked volatile to make sure the compiler does not optimize the variable away so we can clear it from the debugger.
Launch the application for Native debugging by right-clicking on the project and selecting Debug As > Android Native Application. You will see the application starts but there is no output on the screen. At the same time Eclipse will change to the Debug Perspective.
When the Debug perspective is open, hit the Suspend button (two yellow vertical bars). In the Variables tab change the value of _dbg from 1 to 0; also set a breakpoint on the call to Fibonacci. Finally, let the program continue running by pressing F8; you should immediately hit the breakpoint you have just set.
You can now trace into the function by pressing F5 or step over it by pressing F6. Change the value of n and press F8 to continue with the execution.
We are done! You have now seen the basics on how to do Java and native code debugging of Android applications running on the device from Eclipse.
We can print debugging messages to the Android log from native code using the __android_log_print function.
Open fibonacci.cpp and add the following code at the top of the file.
#if !defined(LOG_TAG)
#define LOG_TAG "Fibonacci"
#endif
#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__)
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG , LOG_TAG, __VA_ARGS__)
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO , LOG_TAG, __VA_ARGS__)
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN , LOG_TAG, __VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR , LOG_TAG, __VA_ARGS__)
#include <android/log.h>
These are convenient macros that write to the log at the different information levels.
Add the following line to print the result of the Fibonacci function to the log.
JNIEXPORT jint JNICALL Java_com_nvidia_example_fibonacci_FibonacciActivity_Fibonacci
( JNIEnv *env, jobject obj, jint n )
{
LOGV( "Fibonaci(%d) = %d\n", n, Fibonacci( n ) );
return Fibonacci( n );
}
Finally, we need to modify the Android.mk to link the log library into the project.
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := fibonacci
LOCAL_SRC_FILES := fibonacci.cpp
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
The LOCAL_LDLIBS directive specifies a list of system libraries provided by the NDK that we can link into our project. In the above example, the log library defines __android_log_print.
Comment out the definition of WAIT_FOR_DEBUGGER of the previous section (so you don’t stay in the infinite loop), run the project, and verify that you can see the log message.
When logging to a file from native code we are still bound by the same restrictions we mentioned regarding user-accessible paths. Additionally, there is no native version of Environment.getExternalStorageDirectory() in the NDK, so we will have to pass the directory information from Java.
In FibonacciActivity.java, add a new native method that will enable native code logging into the specified file.
// Enable native logging to the given filename
native void enableNativeLogging( String filename );
In onCreate we will call enableNativeLogging :
@Override
public void onCreate( Bundle savedInstance )
{
super.onCreate( savedInstance );
[...]
enableNativeLogging( Environment.getExternalStorageDirectory() + "/fibo_native_log.txt" );
}
Now, let’s implement the native side of enableNativeLogging. First, in the file fibonacci.cpp we create an ofstream with the scope of the entire source file to hold a handle to the log file (and include fstream):
#include <fstream>
static std::ofstream gLogFile;
Second, we implement enableNativeLogging; this function calls into JNI to convert the Java string into a C-style string, opens the file, and then releases the allocated C-style string:
/*
* Class: com_nvidia_example_fibonacci_FibonacciActivity
* Method: enableNativeLogging
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_com_nvidia_example_fibonacci_FibonacciActivity_enableNativeLogging
( JNIEnv *env, jobject obj, jstring jfilename )
{
if( gLogFile.is_open() )
{
gLogFile.close();
}
// Call JNI to convert the jstring into UTF 8 bit characters
const char* filename = env->GetStringUTFChars( jfilename, NULL );
// If filename is non-empty, open the file.
if( filename[0] != 0 )
{
// Open the file
gLogFile.open( filename );
}
// Release the string allocated by JNI.
env->ReleaseStringUTFChars( jfilename, filename );
}
If you call the function a second time with an empty string, the file will be closed. In addition, because we are using ofstream, when the program exits the gLogFile object will go out of scope and the file will be closed. Alternatively, you could add enableNativeLogging( "" ); in the onPause() method in the Java side.
Note that we repeated the step described above to generate the proper function header: in a console, go to your project directory and run javah:
javah -classpath ./bin/classes -d jni com.nvidia.example.fibonacci.FibonacciActivity
We will extend our Fibonacci example further by showing how to call Java methods from the native code. We will add the ability to log messages into the TextView to mimic the behavior of a console application.
Open the file FibonacciActivity.java. Copy the new code for the FibonacciActivity class. We have moved the TextView to class member scope and we have added a function called printToConsole that we can call to append text to this TextView. In addition, we have a new native function called FibonacciSequence.
public class FibonacciActivity extends Activity {
private TextView mConsoleText;
@Override
public void onCreate( Bundle savedInstance ) {
super.onCreate( savedInstance );
// Create the TextView.
mConsoleText = new TextView( this );
setContentView( mConsoleText );
// Generate the Fibonacci sequence up to 10.
FibonacciSequence( 10 );
}
// Append new text to the consoleText TextView.
private void printToConsole( String text ) {
mConsoleText.setText( mConsoleText.getText() + text );
}
// Native Fibonacci function - returns the nth Fibonacci number.
native int Fibonacci ( int n );
// Computes the Fibonacci sequence up to n and prints
// it through the print function.
native void FibonacciSequence( int n );
static {
System.loadLibrary( "fibonacci" );
}
}
Since we have added a new native method we need to recreate the jni headers. First, build the project (this is necessary to compile the new Java code). Then, as we did in our previous tutorial, run javah:
javah -classpath ./bin/classes -d jni com.nvidia.example.fibonacci.FibonacciActivity
File jni/com_nvidia-example_fibonacci_FibonacciActivity.h will be regenerated.
Now we need to add the new method to our native library. Open fibonacci.cpp and copy and paste the newly added function header from com_nvidia-example_fibonacci_FibonacciActivity.h. Our implementation of FibonacciSequence will compute the Fibonacci numbers and print them to the TextView by calling the Java printToConsole method. The function code looks like this:
#include <sstream>
[...]
/*
* Class: com_nvidia_example_fibonacci_FibonacciActivity
* Method: FibonacciSequence
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_com_nvidia_example_fibonacci_FibonacciActivity_FibonacciSequence
( JNIEnv *env, jobject obj, jint n )
{
const char *methodName = "printToConsole";
const char *methodSignature = "(Ljava/lang/String;)V";
jclass objClass = ( jclass ) env->GetObjectClass( obj );
jmethodID methodId = env->GetMethodID( objClass, methodName, methodSignature );
for( int i = 0; i <= n; i++ )
{
// Our string buffer for the output message.
std::stringstream msg;
// Compute the current Fibonacci number.
int fibo = Fibonacci( i );
// Create the msg to print.
msg << "Fibonacci(" << i << ") = " << fibo << std::endl;
// Create a jstring to send the message to the Java VM.
jstring jtext = env->NewStringUTF( msg.str().c_str() );
// Call the Java class printToConsole method.
env->CallVoidMethod( obj, methodId, jtext );
// Delete the local reference created by NewStringUTF
// to allow the Java VM to garbage collect the jstring object.
env->DeleteLocalRef( jtext );
}
}
In order to call the printToConsole method on the passed Java object, we need to obtain its method ID from the Java VM. First we ask for the jclass of the passed object by calling GetObjectClass. Then we obtain the jmethodID by calling GetMethodID and passing the corresponding jclass identifier, the method name, and the method signature. The method name is printToConsole and the signature “(Ljava/lang/String;)V, which stands for a method returning void that takes an argument of type java.Lang.String.
When we call the retrieved method we can’t pass a pointer to char as an argument, we need to pass it a String object. The JNI environment has a helper function to do this. The newStringUTF function takes a char * and returns a jstring instance. We can then call the Java function using the CallVoidMethod and passing the obj, the method ID and the string.
The Android NDK provides different C++ STL implementations. To default system STL is very limited. To enable the GNU STL implementation, and use the ofstream object we need to modify the Application.mk file. By adding the following line to the Application.mk the NDK build system will set the include path for the headers and add the static library.
# APP_STL
# By default, the NDK build system provides C++ headers for the minimal
# C++ runtime library (/system/lib/libstdc++.so) provided by the Android
# system.
#
# However, the NDK comes with alternative C++ implementations that you can
# use or link to in your own applications. Define APP_STL to select one of
# them. Examples are:
#
# APP_STL := stlport_static --> static STLport library
# APP_STL := stlport_shared --> shared STLport library
# APP_STL := system --> default C++ runtime library
APP_STL := gnustl_static
Comment out the #define WAIT_FOR DEBUGGER; we will not be attaching the debugger for this run.
Build the program and run it. You will see the following output:
Android provides a NativeActivity framework that can be used to run applications that are written entirely in native code. A NativeActivity can have event loops to receive user input, but will have no UI building blocks; it was developed for game developers and it is expected that the UI is built using OpenGL ES rendering.
As an introduction to NativeActivity, we will write our Fibonacci example using this framework. Since there is no Java code, let’s start with a new project. The following steps assume you have already performed all the previous tutorials.
From the Java perspective, create a new Android Application project as we did before. Set the Application, Project, and package names, and the minimum Android SDK version to 9.
Add Android Native Support. Set the Library Name to libfibonacci.so.
Create the jni/Application.mk file and set the APP_ABI to armeabi-v7a and the android platform to 14 (this is the first platform to support the NativeActivity). Also, set APP_STL to gnustl_static.
APP_ABI := armeabi-v7a
APP_PLATFORM := android-9
APP_STL := gnustl_static
Now we have to setup the AndroidManifest.xml, which has a few extra settings for the NativeActivity. In the application section we specify the app doesn’t have any Java code.
<!-- We do not have Java code. Therefore android:hasCode is set to false. -->
<application android:label="@string/app_name"
android:hasCode="false">
In the activity block (within the application block) we also need to add a few new items. First, the activity name needs to be set to android.app.NativeActivity. This is an actual Java class that exists in the Android SDK and that provides the glue for the native code. Then we configure the application to be fullscreen. And finally, we add a meta-data tag to indicate the name of the library containing the native code.
<!-- Our activity is the built-in NativeActivity framework class.
This will take care of integrating with our NDK code. -->
<activity android:name="android.app.NativeActivity"
android:label="@string/app_name"
android:configChanges="orientation|keyboard|keyboardHidden"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<!-- Tell NativeActivity the name of or .so -->
<meta-data android:name="android.app.lib_name"
android:value="fibonacci" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Open the Android.mk. Our library needs to statically link with the android_native_app_glue library, which is provided as a separate module, and against the shared system log and android libraries.
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := fibonacci
LOCAL_SRC_FILES := fibonacci.cpp
LOCAL_LDLIBS := -llog -landroid
LOCAL_STATIC_LIBRARIES := android_native_app_glue
include $(BUILD_SHARED_LIBRARY)
$(call import-module,android/native_app_glue)
Now open fibonacci.cpp and add the following code:
#if !defined(LOG_TAG)
#define LOG_TAG "Fibonacci"
#endif
#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__)
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG , LOG_TAG, __VA_ARGS__)
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO , LOG_TAG, __VA_ARGS__)
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN , LOG_TAG, __VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR , LOG_TAG, __VA_ARGS__)
#include <android/log.h>
#include <android_native_app_glue.h>
int Fibonacci( int n )
{
if ( n == 1 ) { return 1; }
if ( n <= 0 ) { return 0; }
return Fibonacci( n - 1 ) + Fibonacci( n - 2 );
}
/**
* This is the main entry point of a native application that is using
* android_native_app_glue. It runs in its own thread, with its own
* event loop for receiving input events and doing other things.
*/
void android_main( struct android_app *state )
{
// Make sure glue isn't stripped.
app_dummy();
LOGV( "Fibonacci(10) = %d\n", Fibonacci( 10 ) );
// Event loop manager.
// This is an empty event loop manager that waits for the user
// to destroy the activity.
while( 1 )
{
// Read all pending events.
int ident;
int events;
struct android_poll_source *source;
// Wait indefinitely for an event to occur.
while( ( ident = ALooper_pollAll( -1, NULL, &events,
( void ** )&source ) ) >= 0 )
{
// Process this event.
if( source != NULL )
{
source->process( state, source );
}
// Check if we are exiting.
if( state->destroyRequested != 0 )
{
return;
}
}
}
}
The new code includes android_native_app_glue.h which provides the callbacks for notification of Activity life cycle events. In addition, the native application glue also requires an android_main function to be defined as the entry point for the application.
To keep our sample short, we haven’t created any UI, so we simply print to the Android log the result of Fibonacci(10). In addition, we do have to process application events for the Activity to remain responsive. This is done inside the event manager loop, where we process all events until the user requests the app to exit.
Note
As the comment says, app_dummy() is needed to make sure that the glue module is not stripped. Without it, none of the methods the module would be called directly in the code, as the glue module is basically a bunch of callbacks, and the linker would strip the module, thus causing a RuntimeExeption.
Try running the application. The screen will remain blank. Check the log message for the output. A handy way to find it quickly is to type in the LogCat search line tag:fib.
In an earlier example we showed how we could log into a file from native code, with the full path filename being provided by the Java application. When running a NativeActivity, we will find the path available to the application using the externalDataPath member of the ANativeActivity struct.
Open fibonacci.cpp and add the following includes and static declarations.
#include <fstream>
#include <sstream>
#include <sys/stat.h>
#include <errno.h>
static std::ofstream gLogFile;
Then add the following code to the android_main function to create and open the file. As opposed to what we have seen in the Java framework, the path might not exist, so we will need to create it. For this, we have developed an auxiliary function makepath that we will present shortly.
void android_main( struct android_app *state )
{
// Make sure glue isn't stripped.
app_dummy();
LOGV( "Fibonacci(10) = %d\n", Fibonacci( 10 ) );
std::stringstream filename;
filename << state->activity->externalDataPath << "/" << "fibo_native_log.txt";
MakePath( state->activity->externalDataPath, 0770 );
// Open the log file for output
gLogFile.open( filename.str().c_str() );
if( gLogFile.is_open() )
{
LOGI( "Opened log file %s\n", filename.str().c_str() );
gLogFile << "FibonacciActivity Native log file " << filename << std::endl;
}
else
{
LOGE( "Couldn't open the log file %s\n", filename.str().c_str() );
}
Add the MakePath and MakeDir functions before android_main:
static int MakeDir( std::string const &path, mode_t mode )
{
struct stat st;
if( stat( path.c_str(), &st ) != 0 )
{
if( mkdir( path.c_str(), mode ) != 0 && errno != EEXIST )
{
return false;
}
}
else if( !S_ISDIR( st.st_mode ) )
{
errno = ENOTDIR;
return false;
}
return true;
}
static bool MakePath( std::string const &path, mode_t mode )
{
std::string cstr( path );
int cpos = 0;
int ppos = 0;
bool success = true;
while( success && ( cpos = cstr.find_first_of( "/", ppos ) ) != std::string::npos )
{
if( cpos != ppos )
{
/* Neither root nor double slash in path */
cstr[cpos] = '\0';
success = MakeDir( cstr, mode );
cstr[cpos] = '/';
}
ppos = cpos + 1;
}
if( success )
{
success = MakeDir( path, mode );
}
return success;
}
Modify the manifest to give the app the rights to write to external storage.
Try it out.
See also


Initial Teacher Training Statistics Publications
Email<EMAIL_ADDRESS>Adam Leach 0114 274 2527
Beta This is a test version of the layout of this page. Take the survey to help us improve it
Official Statistics
Provisional recruitment to initial teacher training programmes in England in the academic year 2016 to 2017.
This statistical first release includes information on recruitment to initial teacher training ( ITT ) programmes.
There is a forecast of the number of trainees expected to start training later in the academic year.
We use the information to:
Email<EMAIL_ADDRESS>Adam Leach 0114 274 2527


" Arlington Road " * * 1/2
Despite its plethora of unanswered questions, and a loud, grating performance by Jeff Bridges, ARLINGTON ROAD still turns out to be an effective thriller. Sort of. I was reminded of the film SEVEN (the only movie that has ever left me shaking), with its claustrophobic atmosphere, moody score (courtesy the great Angelo Badalamenti), and sense of impending doom. SEVEN is a far superior motion picture, but I cannot discount any film that manages to leave me unnerved.
You know right away that Michael Faraday (an unmercifully one-note Bridges), who teaches a course on terrorism, and Oliver Lang (Tim Robbins), the seemingly normal guy next door, are going to have problems. After rescuing the his neighborıs young boy and, Iım not sure what this scene has anything to with the rest of the film Tom quickly suspects wrongdoing. He is obsessed over the death of his wife, and rants about the evil that are extremist groups all of which seems to feed some basic paranoia he harbors. And, thus begins a film-long quest to find out just why somebody would lie about where they attended college.
I mentioned loose ends: this movie has em. For instance, what does the opening sequence have to do with anything else that comes after? I mean, except to introduce the two men. And why (SPOILER alert), considering the overall scheme of things, did Michaelıs girlfriend have to die? What was the deal with the blueprint, or whatever it was, hidden behind the picture frame? Those computers the villains were driving around with?? And, then ARLINGTON ROAD commits the ultimate cinematic no-no of assuming that climactic events are going to unfold in just the right way, for the film to pay off like it wants to, when any number of things could go wrong to avert that ending. Not that I have problem with this ending, which comes completely out of left field, but in a good way. Iım only saying donıt cheat the audience. Had ARLINGTON ROAD played fair, the whole way, it wouldıve been a terrific entertainment. Lose Jeff Bridges, or at least tone him down a few trillion notches, and it wouldıve been one of the yearıs best.
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


nips nips2006 nips2006-86 nips2006-86-reference knowledge-graph by maker-knowledge-mining
Source: pdf
Author: Jonathan Harel, Christof Koch, Pietro Perona
Abstract: A new bottom-up visual saliency model, Graph-Based Visual Saliency (GBVS), is proposed. It consists of two steps: rst forming activation maps on certain feature channels, and then normalizing them in a way which highlights conspicuity and admits combination with other maps. The model is simple, and biologically plausible insofar as it is naturally parallelized. This model powerfully predicts human xations on 749 variations of 108 natural images, achieving 98% of the ROC area of a human-based control, whereas the classical algorithms of Itti & Koch ([2], [3], [4]) achieve only 84%. 1
[1] W. Einhäuser, W. Kruse, K.P. Hoffmann, & P. König
[2] L. Itti, C. Koch, & E. Niebur
[3] L. Itti & C. Koch
[4] L. Itti, & P. Baldi
[5] N. Bruce & J. Tsotsos
[6] L.F. Costa
[7] G. Boccignone, & M. Ferraro
[8] D. Brockmann, T. Geisel
[9] D. Parkhurst, K. Law, & E. Niebur
[10] D.K. Lee, L. Itti, C. Koch, & J. Braun
[11] L. Itti, J. Braun, D.K. Lee, & C. Koch
[12] W. Einhäuser & P. König,
[13] U. Rutishauser, D. Walther, C. Koch, & P. Perona
[14] B.W. Tatler, R.J. Baddeley, & I.D. Gilchrist
[15] J. Malik & P. Perona


Model Weight Tool is Skining BVH & Three.js Model this tool can create model for Pose Editor the format is same as SkinnedMesh but it not work perfectlly yet. Japanese Info


--- layout: default auth: optional title: Sign In styles: - signin.css scripts: - signin.js: afterbody: true ---
The page you are trying to access requires you to sign in.


House agrees to short halt in fight for Trump records
by MARK SHERMAN, Associated PressWASHINGTON (AP) - The House of Representatives is telling the Supreme Court it will agree to a 10-day halt in its fight for President Donald Trump's financial records.
The House's top lawyer has responded to Trump's emergency filing on Friday asking the justices to block the enforcement of a subpoena issued by a House committee to Trump's accountants.
Lawyer Douglas Letter tells the high court that the House opposes any lengthy delay in obtaining the records. But Letter says 10 days is enough for the orderly filing of legal briefs so that the justices can decide whether they will jump into the dispute between Congress and the president.
The high court has a separate pending request from Trump to block a subpoena from a New York prosecutor for Trump's tax returns.


Version 1.0.5 by AlterStep
Updated DNSCrypt proxy to version 1.4.3
Updated libsodium to 1.0.1-minimal
Updated DNSCrypt proxy to version 1.4.3
Updated libsodium to 1.0.1-minimal
Updated DNSCrypt proxy to version 1.4.1
Updated libsodium to 0.7.0-minimal
Runs on OSX 10.8 (Mountain Lion), 10.9 (Mavericks) and 10.10 (Yosemite)
New set of icons, contributed by Aaron VonderHaar
Improved installation scripts
LDNS has been downgraded in order to work on systems without Homebrew.
Include the release version of dnscrypt-proxy 1.4, with a new OpenNIC resolver.
Wait after dnscrypt-proxy has been turned on before sending a query. This actually makes state changes faster.
Debug log, turned off by default and deleted after every
reboot. In order to enable it, create an empty file named
debug.enabled
in
/Library/Application Support/DNSCrypt/control
and the debug log file itself is
/var/log/dnscrypt-osxclient-debug.log
Thanks a lot for your feedback on the first version!
This is my first release, based on the source code of the beta version written by OpenDNS.
It has only been tested on OSX 10.9.
It includes dnscrypt-proxy 1.4.0, libsodium 0.4.5, libldns 1.6.17.
Contact me on Github: https://github.com/alterstep/dnscrypt-osx-client


Title: Searching Facility
Primary Actor: User
Stakeholders and Interests: User - wants to be able to search for a topic or user.
Precondition: User with logged in already.
Trigger: User selects search button.
Main success scenario:
- User selects search button.
- SuD displays posts/people related to search.
Extensions:
- 2a. No matches on the keyword entered:
- 2a1. SuD notifies user on unsuccessful search.
- 2a2. User initiates Searching Facility use case


Requires
- module:express
- module:body-parser
- module:/models/users
- module:/models/exercises
- module:/util/valid
Methods
(inner) get/exercises(path, middleware)
Route serving exercises (GET), sending back all existing exercises for a given user in json format.
Accepts conditions such as from-to timespan and limiting the number of exercises returned
Parameters:
| Name | Type | Description |
|---|---|---|
path |
string | Express path |
middleware |
callback | Express middleware |
(inner) get/users(path, middleware)
Route serving users (GET), sending back all existing users in json format
Parameters:
| Name | Type | Description |
|---|---|---|
path |
string | Express path |
middleware |
callback | Express middleware |
(inner) post/exercises(path, middleware, middleware)
Route serving exercises (POST), creating a new exercise for a given user and sending back in json format an object comprising of the user's username and id, and the created exercise's description, duration and date.
Parameters:
| Name | Type | Description |
|---|---|---|
path |
string | Express path |
middleware |
function | json parser to retrieve user's username |
middleware |
callback | Express middleware. |
(inner) post/users(path, middleware, middleware)
Route serving users (POST), creating a new user and sending back in json format an object comprising of its username and id
Parameters:
| Name | Type | Description |
|---|---|---|
path |
string | Express path |
middleware |
function | json parser to retrieve user's username |
middleware |
callback | Express middleware. |


See: Description
| Interface | Description |
|---|---|
| MessageRouter |
Routers implementing this interface have a default output channel.
|
| RecipientListRouterManagement |
Exposes adding/removing individual recipients operations for
RecipientListRouter.
|
| Class | Description |
|---|---|
| AbstractMappingMessageRouter |
Base class for all Message Routers that support mapping from arbitrary String values
to Message Channel names.
|
| AbstractMessageRouter |
Base class for all Message Routers.
|
| ErrorMessageExceptionTypeRouter |
A Message Router that resolves the target
MessageChannel for
messages whose payload is a Throwable . |
| ExpressionEvaluatingRouter |
A Message Router implementation that evaluates the specified SpEL
expression.
|
| HeaderValueRouter |
A Message Router that resolves the MessageChannel from a header value.
|
| MethodInvokingRouter |
A Message Router that invokes the specified method on the given object.
|
| PayloadTypeRouter |
A Message Router that resolves the
MessageChannel
based on the
Message's payload type. |
| RecipientListRouter |
|
| RecipientListRouter.Recipient |


UTC +2. Summer time UTC +3 from early April until the end of September.
Voltage: 230 V
Frequency: 50 Hz
Leu (plural lei) divided into 100 bani
The import/export of lei is prohibited. Foreign currency must be declared on arrival and exchange receipts kept to show customs on departure.
ATMs are called "Bankomats"
Cash is widely used due to the risk of credit card fraud. Euros is the best foreign currency to use.
International dialing Code for Romania is +40.
Mobile Phones - Notify your cell phone provider that you will be traveling to Romania, and ask to be upgraded to international roaming, or Rent a cell phone or SIM card to use with your personal cell phone.
All emergencies - Dial 112
Ambulance - Dial 961
Fire Department - Dial 981
Police - Dial 955
IMRAY AND ADLARD COLES PILOT BOOKS are available at a discounted price for Noonsite.com users via World Cruising Club
The Black Sea
By David Read Barker and Lisa Borre
Publisher: Imray/RCC Pilotage Foundation
ISBN:<PHONE_NUMBER>125
Available from http://www.rccpf.org.uk/
Published 2012, with updates 2014. The latest and very comprehensive guide to all the countries bordering the Black Sea.
Mediterranean Almanac 2015/16
By Lucinda Heikell with Rod Heikell
Published by Imray (December 2014)
2016 supplement available from Imray
ISBN –<PHONE_NUMBER>986
Price - £29.50
See this Noonsite review.
Cruising Bulgaria and Romania
By Nicky Allardice
Published by Imray (1 Aug 2006)
ISBN:<PHONE_NUMBER>107
It is full of useful information about the towns and ports along the Danube River and the Black Sea Coast as well as excellent navigation information. Low stock.
The Danube Delta
By Guido Cattaneo
Published by Imray (2010)
ISBN:<PHONE_NUMBER>546
Covers the Danube Delta and its channels in Romania and the Ukraine.
The best charts for the Black Sea are Turkish and can be bought in Istanbul.
Romanian Tourism Promotion Office
SY Gyatso Log Book - Around the Black Sea
http://www.gyatso.net/the-black-sea/
In 2010, SY Gyatso circumnavigated the Black Sea, visiting five of the six countries beginning in Turkey and continuing in a counterclockwise direction to Georgia, Ukraine, Romania and Bulgaria before returning to Turkey again.
Danube Delta Biosphere Reserve Authority (DDBRA)
Management of the Danube Delta - website is in English
Noonsite welcomes information and updates especially regarding clearance, customs and immigration procedures from cruisers visiting this country.
Please E-mail noonsite with any new information, updates or corrections. Even just a short email confirming that the current data is accurate would be most helpful.


Utility¶
[github] https://github.com/Tomoki-YAMASHITA/CrySPY/tree/master/utility
Contents
cryspy_analyzer_RS.ipynb¶
[github] https://github.com/Tomoki-YAMASHITA/CrySPY/blob/master/utility/cryspy_analyzer_RS.ipynb
Jupyter Notebook to visualize results for Random Search.
cryspy_analyzer_BO.ipynb¶
[github] https://github.com/Tomoki-YAMASHITA/CrySPY/blob/master/utility/cryspy_analyzer_BO.ipynb
Jupyter Notebook to visualize results for Bayesian Optimization
cryspy_analyzer_LAQA.ipynb¶
[github] https://github.com/Tomoki-YAMASHITA/CrySPY/blob/master/utility/cryspy_analyzer_LAQA.ipynb
Jupyter Notebook to visualize results for LAQA.
cryspy_analyzer_EA.ipynb¶
[github] https://github.com/Tomoki-YAMASHITA/CrySPY/blob/master/utility/cryspy_analyzer_EA.ipynb
Jupyter Notebook to visualize results for Evolutionary algorithm
pkl_data.ipynb¶
[github] https://github.com/Tomoki-YAMASHITA/CrySPY/blob/master/utility/pkl_data.ipynb
Jupyter Notebook to analyze pickled data in CrySPY.
only_structure_generation¶
only_structure_generation
directory includes:
structure_generation.ipynb
sample_data_Si16_for_EA
directory
structure_generation.ipynb¶
Jupyter Notebook for tutorial to generate structures using CrySPY. You can generate crystal structures with RS and EA partly using CrySPY (Here no CSP, only structure generation)
sample_data_Si16_for_EA¶
Sample data used in structure_generation.ipynb
for parents in EA.
kpt_check.py¶
kpt_check.py
can check a k-point mesh with a given kppvol
. In this script, POSCAR
, CONTCAR
, and init_struc_data.pkl
are readable.
For example, check a k-point mesh with kppvol = 100 for a POSCAR file.
$ python kpt_check.py POSCAR 100
a = 10.689217
b = 10.689217
c = 10.730846
Lattice vector
10.689217 0.000000 0.000000
0.000000 10.689217 0.000000
0.000000 0.000000 10.730846
kppvol: 100
k-points: [2, 2, 2]
You can write a KPOINTS
file with -w
or --write
option for VASP.
$ python kpt_check.py -w POSCAR 100
$ cat KPOINTS
pymatgen 4.7.6+ generated KPOINTS with grid density = 607 / atom
0
Monkhorst
2 2 2
In checking k-point meshes for init_struc_data.pkl, first five structures in init_struc_data.pkl are automatically checked in the default setting. You can change the number of structures using -n
or --nstruc
option.
$ python kpt_check.py -n 3 init_struc_data.pkl 100
# ---------- 0th structure
a = 8.0343076893
b = 8.03430768936
c = 9.1723323373
Lattice vector
8.034308 0.000000 0.000000
-4.017154 6.957915 0.000000
0.000000 0.000000 9.172332
kppvol: 100
k-points: [3, 3, 3]
# ---------- 1th structure
a = 9.8451944096
b = 9.84519440959
c = 6.8764313585
Lattice vector
9.845194 0.000000 0.000000
-4.922597 8.526188 0.000000
0.000000 0.000000 6.876431
kppvol: 100
k-points: [3, 3, 4]
# ---------- 2th structure
a = 7.5760383679
b = 7.57603836797
c = 6.6507478296
Lattice vector
7.576038 0.000000 0.000000
-3.788019 6.561042 0.000000
0.000000 0.000000 6.650748
kppvol: 100
k-points: [4, 4, 4]
spg_check.py¶
spg_check.py
can check space group information of a specified file. Structure.from_file() in pymatgen is used in this code. Supported formats include CIF, POSCAR/CONTCAR, … etc. XXX.vasp file (POSCAR format) is also supported in this code.
See also
$ python spg_check.py Al2O3.vasp
(u'R-3c', 167)
You can change a tolerance value for checking the space group with -t
or --tolerance
option (default value is 0.1).
$ python spg_check.py -t 0.001 Al2O3.vasp
(u'R-3c', 167)
struc2cif.py¶
struc2cif.py
can convert a structure file to a cif file using pymatgen. Structure.from_file() in pymatgen is used in this code. Supported formats include CIF, POSCAR/CONTCAR, … etc. XXX.vasp file (POSCAR format) is also supported in this code. (input file name + ‘.cif’) file is generated.
See also
$ python struc2cif.py POSCAR
You can change a tolerance value for checking the space group with -t
or --tolerance
option (default value is 0.1).
$ python struc2cif.py -t 0.001 POSCAR
qe2vasp_cif.py¶
qe2vasp_cif.py
can generate structure data in VASP and cif formats from an input and output of QE.
You can obtain input structure data (in_struc.vasp
and in_struc.cif
) from an input of QE (pwscf.in)
$ python qe2vasp_cif.py pwscf.in
You can obtain optimized structure data (out_struc.vasp
and out_struc.cif
) from an output of QE (pwscf.out). The input of QE (pwscf.in) is also required as a first argument.
$ python qe2vasp_cif.py pwscf.in pwscf.out


WITNESS LIST Finance Committee July 7, 2005 - 2:30P HB 3 AGAINST BILL/AGAINST COMMITTEE SUBSTITUTE: Lavine, Dick Senior Fiscal Analyst (Center for Public Policy Priorities), Austin, TX ON BILL/ON COMMITTEE SUBSTITUTE: Allaway, Bill Texas Taxpayers and Research Association (TTARA), Austin, TX Colbert, Paul Consultant (Self), Houston, TX Greenfield, Stuart Boffin (Self), Austin, TX Hall, Carolyn Attorney (Texas Legislative Council), Austin, TX Hamner, William Assistant Director of Texas Administration (Texas Comptroller), Austin, TX Hebert, Bryan Attorney (Texas Legislative Council), Austin, TX Hedge, Glenna Partner and Director of Governmental Affairs (Linedarger Geggan Blair and Sampson, LLP), Austin, TX Kramer, David (Texas Legislative Council), Austin, TX Lindquist, Judith General Counsel (HEB), San Antonio, TX Miller, Robert Attorney (Hospital Corporation of America), Austin, TX Reed, Cyrus Director (Texas Center for Policy Studies), Austin, TX Registering, but not testifying: For Bill/For Committee Substitute: Moore, Edward Lawyer (Research Group of Texas, Inc), Austin, TX SB 6 ON BILL/ON COMMITTEE SUBSTITUTE: Newton, John (LBB), Austin, TX Parks, Ursula (LBB), Austin, TX


To control the robot you have to give it programming instructions. The available instructions are:
robot.moveRight(int steps);
robot.moveLeft(int steps);
robot.moveUp(int steps);
robot.moveDown(int steps);
robot.pushButton();
robot.openChest();
robot.hasRedKey();
robot.hasGreenKey();
robot.hasBlueKey();
if (robot.has<Color>Key()) {
robot.<SomeMethod>();
}
robot.openDoor();
All move-functions take one parameter, called steps
.
The type of this parameter is int
, which just means
that it should be a whole number, written using digits. If the
parameter is omitted it is assumed that just one step in the given
direction should be taken.
For example, the following program would make the robot walk two steps to the right, and then one step up.
robot.moveRight(2);
robot.moveUp(1);
When the robot stands on a button it can push it using the
pushButton
function. This function takes no
parameters.
When the robot stands on a chest it can open it using the
openChest
function. Whatever is in the chest will be
collected by the robot. This function takes no parameters.
To open red, green and blue doors a key is needed. To check if the
robot has the required key the hasRedKey
,
hasGreenKey
and hasBlueKey
methods should be
used.
The has<Color>Key
methods described above will
most likely be used together with the if
statement.
The if
statement takes a method call that returns
true
or false
as a parameter, and if
the call returns true the single instruction inside the
if
statement is executed.
When the robot stands on a door it can open it using the
openDoor
method. If the door is red, green or blue a key
with the same color as the door is needed.


an esoteric programming language based on the idea of train tracks and switches.
A general purpose DAW made in the Godot Game Engine.
A stealth based platformer with unique interface based mechanics.
A completely DOM-based game creation framework. Now maintained separately.


GenePattern 1.4 Release Notes
New in release 1.4
Graphical Client
- File Navigation Aids
- Send To. You no longer need to click and drag files to
input boxes. After selecting a module to run, right-click any file and
choose Send To to send that file to the analysis.
- Extended sorting. Sort files and results by name,
type, or creation time.
- Default application hooks. You can open a file with
its default application.
- Improved local saving Save job results directly to a
project directory or local drive.
- Navigate to file location. Go directly to a file's
location in Explorer/Finder.
- Module suggestion. Right-click on any file and choose
Modules to see all modules that can accept that type of file.
- History List. Selecting the History menu will show you
all analyses and visualizers you have run. Select any choice in this
list to re-run that analysis/visualizer.
- Job handling
- Clear all jobs. Clear all jobs in the results window
by selecting Results->Delete All Jobs.
- Terminate a running job by right-clicking on the
analysis name in the Results window and choosing Terminate Job.
- Complete job results. The job results you see will be
those you have created in any environment (Web, programming, etc.),
not only the Graphical Environment.
- Parameter Descriptions. Users can either show or hide
parameter descriptions.
- View Code. For Java, MATLAB, or R programmers:
right-click the name of an analysis in the Results window and choose
View Code to view the code that will execute that analysis. You can cut
and paste this into your development environment.
- Server Operations
- Switch servers without restart. Users can change which
server their client is connected to without having to restart.
- Delete jobs. Delete a job completely from the server.
- Delete output files. Delete output files from the
server.
Web Client
- Recent results links. Links to results of recent
analyses are available on the run module/pipeline pages.
- Firewall configuration. GenePattern can be configured
to install modules through an authenticating proxy.
- User access control. Users can specify which other
computers can connect to their GenePattern server and can set the
server to run in single-user mode, prohibiting other users from
connecting to a local GenePattern server.
- Execution and Results History
- Last executed modules are displayed at top of module lists.
- Most recent results links are available on run module/pipeline
pages.
- Miscellaneous
- The "Prompt when run" parameter works for pipelines.
- The Web Client is compatible with Safari, Mozilla, Firefox on
Macintosh.
- User can run pipelines and modules directly from the view
pages.
Known Issues
- Java Programming Language. Package structure has
changed to org.genepattern.


The Power of Microsites
FY2 MYP Design - MCHK
Welcome to Skills Challenges 1.2
This section invites you to complete some challenges. For all challenges, you should use Brackets (or an equivalent text-based editor) to create any HTML and CSS files.
All files should be placed in your Google Folder that starts with "WWW_FY2..."
Skills Challenge 3
Usually our first page in a website has the file name of “index.html”. In this challenge you will create a new file called “index.html” and create a simple list with links to the two pages you have already created (sc1.html and sc2.html). There should be a 3rd link in the list that takes users to a new Google search (www.google.com).
This file should be saved as index.html and saved in your "WWW_FY2..." Google folder.
Specifications
- The page must be saved as “index.html”.
- The page must have a title (<title> tag in the  section).
- The page must have a body and in the body there must be a list (eg. ul or ol tag and li tags)
- The list must contain links that take users to your sc1.html and sc2.html pages (use the ... tag)
- The list must contain a link to a Google search.
- The page must have an appropriate header (such as “Welcome” as
)
- The page might have an image.
Video walkthrough of skills task 1, 2 and 3
Skills Challenge 4
CSS (Cascading Style Sheets) are a way to format the elements in a website. It is a powerful way for web designers to set the style (such as the font, colour, size, appearance) of ALL
 tags or ALL paragraphs, or lists. CSS is often saved in another file, usually called “stylesheet.css”.
In this challenge you will copy a set sc4.html file, then create a new file called “stylesheet.css” and use that to change the formatting in the other files on your website. Your challenge is to make your sc4.html file look like the following sample page:
Follow the Instructions and Specifications below to complete the task.
All files should be saved in your "WWW_FY2..." Google folder.
You will need to know a little about CSS in order to complete this challenge, including how to select a HTML tag, how to select a class and how to select an ID.
Khan Academy "Intro to CSS" will help you learn CSS.
Instructions and Specifications
- Make a copy of this code and paste it into a new file called “sc4.html” in your "WWW_FY2..." Google folder.
- Now, in Brackets, make a new file and save it as "stylesheet.css" in the same folder as your sc4.html file.
-
Now let's change our H1 headers.
All H1 headers should:
- have a font-size of 18px,
- have a serif font-family,
- have a grey colour font.
In your stylesheet.css file, make those changes.
Hint: try
h1 {
font-size: ...
}
to start -
Now let's change our paragraphs.
All p tags should:
- have a font-size of 15px,
- have a san-serif font-family,
- have a line-height of 22px,
- have a #666 colour font.
In your stylesheet.css file, make those changes.
Hint: try
p {
font-size: ...
}
to start -
Next, let's make our main post heading image larger.
The "post-head-image" ID should:
- have a padding-top of 140px,
- and a padding-bottom of 140px.
This should give a 140px gap above and below any text in that div (box). This makes the div with id "post-head-image" much taller, displaying the background image.
Hint: try
#post-head-image {
padding-top: ...
} -
Let's make the main headline (which has a class of "pageTitle") white, larger and right-aligned.
The "pageTitle class should:
- have a font-size of 4rem (4 times the font size relative to the browser),
- have a shadow,
- be transformed to uppercase (
text-transform
) - and be white.
Hint: try
.pageTitle {
text-shadow: ...
} -
Extension (bonus):
Fix up the footer.
The footer should:
- have a background color of #1a4b35 ,
- have the navigation links displayed horizontally (Hint: see W3Schools page on navigation),
- have the footer navigation text change colour (darken) when you hover over them (see the footer in this example)


What is Rails?
8/29/15
Rails is a framework what functions as a software library. The Rails framework is a platform that allows Ruby, HTML, CSS, and JavaScript to interact with eachother conveniently. Ruby on Rails developers claim that rails enables its user to create web applications in less time by writing less code when compared to other languages/frameworks. Rails is "opinionated software" which means it makes assumptions about the best way to approach a problem. These assumptions will assist the user by creating things in less time.
This is an example of what working with Rails might look like. Your library of files are on the left side of the screen which helps organize your application.


Partner Institutions
- Some of the labs requires the users to install the Pre-requisites. Click here to view Pre-requisites
- In order to derive maximum learning experience, the users are advised to first read the instructions for conducting the labs. There are' step-by-step' instructions available in each lab to assist the users.
- Related NPTEL lectures are also available on the link given below.
- *Sign in required
*Signals and Systems Laboratory
Demonstration of different signals and their properties, demonstration of Salient properties systems, Analysis of Fourier properties of Signals.
This lab helps in studying the generation of magnetic field in a single coil system due to DC and AC current and behaviour of rotating magnetic field in a two coil system due to AC current.
*Virtual English and Communication Lab
This lab priovides experiments in Business Communication etc, where it is any communication that encourages a product, a type of service or organization in order to enhance sale prospects.
This lab helps students to calculate the natural frequency and damping ratio of a spring-mass system, experimentally; and compare the results with theoretical values.
This lab provides experiments which would help students to determine the dryness fraction of steam by separating and throttling calorimeter, determination of boiling range characteristics of petroleum product by using ASTM distillation etc.
*Electronic Instrumentation Lab
This lab includes experiments about Determination of Dynamic Performance Characteristics of First Order System as well as the response of standard test signal dynamics
*Mechanical Laboratory Experience in Fluid and Thermal Sciences
This lab provides experiments which would help students to determine the energy losses in pipe flow, measure the volumetric flow rate of fluids and analysis of flow through a Nozzle and a Diffuser etc.
This lab inlcudes experiments on reconstruction of a handaxe, identification of shape of flakes and identification of finger patterns of different individuals.
* Digital VLSI Design Virtual lab
To plot the (i) output characteristics & (ii) transfer characteristics of an n-channel and p-channel MOSFET, to design and plot the static (VTC) and dynamic characteristics of a digital CMOS inverter etc.


live-nation-entertainment
Businessmodel of Live Nation Entertainment
Customer Segments
Live Nation serves a range of customers, principally individuals and businesses associated with the events business. The Company’s four operating segments target different markets, with customers including:
- Event promoters, sports teams, talent agents, venues – including stadiums, arena, clubs, theatres, museums and festival sites, to which it provides event ticketing, promotion and venue operation services;
- Consumers, to whom it sells tickets for events and festivals, concessions, and merchandise – which is also sold to retailers;
- Artists, to whom it provides management and promotion services; and
- Advertising agencies, brand marketers, and commercial businesses, to which it offers a range of sponsorship opportunities and advertising solutions. Live Nation is currently promoting artists such as Coldplay, Beyonce, Black Sabbath, Guns n’ Roses, and Drake, and operates the Palavela, Bassrush, and Loud Park festivals, among many others.
Live Nation operates in more than 40 countries worldwide, with activities principally across the Americas, Europe, Asia Pacific. The US, Europe and Australia appear to be the Company’s most significant markets.
Value Propositions
Live Nation provides value to its customers in the following ways:
- Its broad range of events, with the Company promoting and operating a varied spectrum of events across all musical genres – including festivals and concerts, as well as promoting and selling tickets to sporting and other events;
- Its ticketing software and services, with the Company operating an efficient and reliable online ticketing service, making its events easily accessible, making Live Nation one of the world’s largest e-commerce businesses;
- The scope of its advertising and sponsorship programs, with the Company providing a range of effective advertising and brand marketing opportunities to companies and agencies; and
- Its global footprint, with the Company providing ticketing and event operations services on a global scale, with operations across the Americas, Europe, Asia Pacific. ### Channels
Live Nation operates a website at www.livenationentertainmnet.com, through which it provides information on its various services and activities. The Company sells tickets, provides resale ticket services, and marketing services through its flagship ticketing portals at www.livenation.com and www.ticketmaster.com, as well as through a network of associated ticketing websites. The Company also utilises mobile channels to sell tickets, through its Live Nation and Ticketmaster apps, and sells tickets through retail outlets and call centres.
Live Nation provides its artist services, advertising and sponsorship, and event operation services through direct interaction with members of the relevant sales or management teams. The Company operates a network of offices across 32 countries, through which it is able to serve clients locally.
Customer Relationships
Live Nation serves consumers wishing to purchase tickets on a largely self-service basis, operating online and mobile sales channels through which customers can access ticketing services for all of Live Nation’s upcoming events, which are searchable by
Live Nation cultivates closer relationships with its non-consumer clients, consulting directly with them so as to more completely fulfil their needs. This includes ongoing relationships with artists, and multi-year relationships with venues, event promoters, with the Company typically entering into written agreements with individual clients to provide primary ticketing services for specified periods, ranging from three to five years.
Customers are able to contact Live Nation with queries and enquiries both directly over the phone or via an online contact form. The Company also operates an online help centre, where it provides customers with a range of resources, including FAQs, tips and guides. Live Nation and Ticketmaster both have accurate social media presences, with customers able to interact with the Company through Facebook, Twitter, Instagram, YouTube and Pinterest
Key Activities
Live Nation provides live entertainment services. The Company operates through four business segments: Concerts, concerning the promotion and operation of live music events across its own and third-party venues; Ticketing, comprising ticketing agency services for its clients, with sales being routed through its own online sales channels and third-party outlets; Artist Nation, which provides management services to music artists in exchange for a commission on the earnings of the artists; and Sponsorship and Advertising, which sells a range of sponsorships and advertising solutions to businesses, enabling them to reach customers through the Company’s concert, venue, artist relationship and ticketing assets. The Company’s other activities are organised under the Other and Corporate segment.
Key Partners
Live Nation collaborates with a number of partners throughout the course of its business.
- Sponsorship and Advertising Partners, comprising companies with which the Company collaborates on event and concert sponsorship programs;
- Technology Partners, comprising technology companies that help to enhance the live event experience and provide innovations for the Company’s online services; and
- Alliance and Strategic Partners, comprising a range of companies and organisation with which the Company collaborates on joint projects and shares tools and resources. Live Nation has had successful sponsorships partnerships with Absolut Vodka, Bud Light, FirstMerit Bank, HTC, Yahoo, and O2. The Company has also launched a recent partnership with Snapchat to cover music festivals around the UK and Europe with its ‘Live Stories’ feature; has collaborated with Hulu and NextVR to pursue opportunities in virtual reality concerts; and has partnered with Philips in promote its home lighting systems.
Key Resources
Live Nation’s key resources are its online ticketing system and software, its IT infrastructure, its network of venues, its portfolio of managed artists, its network of partners and sponsors, and its personnel.
Live Nation owns and distribute intellectual property worldwide, which is protected under trademarks, brands, copyrights, and patents. Its trademarks include, among others, the marks “Live Nation”, “Ticketmaster”, “House of Blues”, and “The Fillmore”, which the Company deems to be significant to its brand-building efforts and the marketing of its services.
Searches of records published by the US Patent and Trademark Office identified a number of patent application filed in Live Nation’s name, including applications entitled ‘Centralized and device-aware ticket-transfer system and methods’, Dynamic filtering and precision alteration of query responses responsive to request load’ and ‘Live concert/event video system and method’.
Cost Structure
Live Nation incurs costs in relation to its operation of events and concerts – including artist fees and production costs, the development and maintenance of its online ticketing system, the maintenance of its IT infrastructure, the implementation of advertising and marketing campaigns, the management of its venue and artists, the management of its partnerships, and the retention of its personnel.
As of 31st December 2015, Live Nation employed around 7,700 full-time employees, accruing costs in the form of salaries and benefits. It also accrues utility and rental costs in relation to its international network of offices.
Revenue Streams
Live Nation generates revenue through the provision of ticketing, event operation, and artist management services, as well as through its advertising and sponsorship solutions. The Company charges a fee on all tickets for events on behalf of clients, and retains a larger portion of ticket prices on its own events. As a venue operator, the Company also generates revenue from the sale of concessions, parking, premium seating, and rental income.
In 2015 Live Nation generated $7.25 billion in annual revenue, up on the $6.87 billion recorded in revenue for the previous year. The Company attributed this 6% increase to a general increase in business across all segments. Live Nation’s Concert segment is its largest revenue generator, recording approximately $5.0 billion in annual revenue, representing around 68.5% the Company’s total for the year.


Scalable Web Framework aimed at Speed and Simplicity
Ready
$ [sudo] gem install e
Set
require 'e' class App < E map '/' def index # ... end end
Go!
App.run
Actions | Controllers | Slices | MVC? | Models?
Base URL | Canonicals | Actions | Action Mapping | Action Aliases | Parametrization | Format | RESTful Actions | Rewriter
Global Setup | Setup by Name | Setup by Format | Remote Setup
Route | Params | Passing Control | Fetching Body | Halt | Redirect | Reload | Error Handlers | Hooks | Authorization | Sessions | Flash | Cookies | Content Type | Charset | Cache Control | Expires | Last Modified | Accepted Content Type | Cache Manager | Send File | Send Files | Attachment | Headers
Engine | Extension | Templates Path | Layouts Path | Layout
Rendering Templates | Rendering Layouts | Ad hoc Rendering | Path Resolver | Templates Compilation
Server-Sent Events | WebSockets | Chunked Responses
Intro | Resource | Excluded Params | Root | Response | Error Handler | Access Restriction
Controllers | Slices | Roots | Run | config.ru
CIBox service are entirely built on Espresso Framework.
In terms of performance, the only really important thing for any framework it is to add as low overhead as possible.
The overhead are the time consumed by framework to accept the request then prepare and send response.
The tests that follows will allow to disclose the overhead added by various frameworks.
The overhead are calculated by dividing 1000 milliseconds to framework’s standard speed.
The framework’s standard speed are the speed of a "HelloWorld" app running on top of given framework.
The framework’s standard speed means nothing by itself. It is only used to calculate the framework’s overhead.
Tested apps will run on Thin
web server and will return a trivial "Hello World!" response.
Hardware used:
Processor Name: Intel Core i5
Processor Speed: 3.31 GHz
Number of Processors: 1
Total Number of Cores: 4
Memory: 8 GB
To run tests on your hardware, clone Espresso Framework repository and execute rake overhead
inside it.
Test results:
---
Speed Overhead 1ms-app 5ms-app 10ms-app 20ms-app 50ms-app 100ms-app
espresso 5518 0.18ms 847 193 98 49 19 9
sinatra 3629 0.28ms 783 189 97 49 19 9
rails 792 1.26ms 442 159 88 47 19 9
---
1ms-app shows your app speed when your actions takes 1ms to run.
10ms-app shows your app speed when your actions takes 10ms to run.
etc.
The app speed are calculated as follow:
1000 / (time taken by action + time taken by framework)
So, if your actions takes about 1ms and you use a framework with overhead of 0.18ms, the app speed will be:
1000 / ( 1 + 0.18 ) = 847 requests per second
However, if framework's overhead is of 1ms or more, the app speed will decrease dramatically:
1000 / ( 1 + 1.26 ) = 442 requests per second
Conclusions?
The framework speed matter only if your code matter.
If you develop a site aimed to serve a serious amount of requests, you should write actions that takes insignificant amount of time.
Only after that it make sense to think about framework speed.
Worth to Note - Espresso has built-in cache manager as well as views compiler.
These tools may help you to dramatically reduce the time consumed by your actions.
I never understood why should i create actions in some file,
then open another file and directing requests to created action.
Even worse! To use params inside action, i have to remember how i named them in another file.
And when i want to change a param name i have to change it in both files?
What about consistency?
A good tradeoff would be to use some DSL.
get '/book/:id' do params[:id] end
Looks much better.
But! Strings/Regexps as action names? No, thanks.
What if i need to remount a bunch of actions to a new root? Say from /news to /headlines? Refactoring? Using vars/constants in names? No, Thanks.
How do i setup multiple actions?
How do i find out the currently running action?
What if i do a request like "/book/100/?id=200"? What? Should i use unique param names? No, thanks.
etc. etc.
And why should i remember so many non-natural stuff?
Is not Ruby powerful enough? I guess it is:
def book id end
That's a regular Ruby method and it's regular Espresso action.
That's also an Espresso route. Yes, the app will respond to "/book/100"
And of course action params are used naturally, through method arguments(id
rather than params[:id]
).
All this offered by Ruby for free! Why to reinvent the wheel?
Usually you do not want to instruct each action about how it should behave.
It would take eras to define inside each action what content type should it return or what layout should it render.
Instead, you will use few lines of code at class level to write instructions that will be followed by all actions.
Example: Instruct all actions under App
controller to return JSON Content-Type
class App < E content_type '.json' # ... end
But what if you need to setup only specific actions?
Simple! Put your setup, well, inside setup
block and pass action names as parameters.
Example: Instruct only rss
and feed
actions to return XML Content-Type
class App < E setup :rss, :feed do content_type :xml end # ... end
Well, what if i need to setup for some 10 actions and another setup for another 20 actions?
Should i pass 30 arguments to setup
? I do not want to buy a new keyboard every month...
That's simple too. Use regular expressions.
Ex: setup only news related actions:
class App < E setup /news/ do # some setup end # ... end
Portability and DRY done right and easy.
With Espresso, any controller can be mounted under any app.
Even more, any set of controllers - a.k.a. slices - can be mounted under any app.
To create a slice simply put your controllers under some module.
Then you can mount that module under any Espresso app.
Even more, when mounting you can easily setup all controllers(or some) at once.
And of course when mounting, you can give a mount point.
require 'e' require 'e-ext' # needed for `Cms.run` and `Cms.mount` to work module Cms class Articles < E # ... end class News < E # ... end class Pages < E # ... end end app = Cms.mount do # some setup that will run inside each controller end # or app = Cms.mount do |ctrl| # some setup that will run inside controllers that match `ctrl` param end app.run
By default, verbless actions will respond to any request type.
To make some action to respond only to some request type, simply prepend the corresponding verb to the action name.
# will respond to any request type def book # ... end # GET def get_book # ... end # POST def post_book # ... end # PUT def put_book # ... end # etc.
With Espresso built-in rewriter you can redirect any requests to new URL.
However, beside trivial redirects, rewriter can also pass the control to an arbitrary controller#action or simply halt the request and send the response.
For most web sites, most time are spent at templates rendering.
When rendering templates, most time are spent at reading and compiling.
Espresso allow to easily skip these expensive operations by keeping compiled templates in memory and just render them on consequent requests.
If you have some expensive operations that basically return static data,
simply put them inside cache
block.
The result will be cached and returned on consequent requests.
To clear cache, simply call clear_cache!


Planet Sick-Boy: http://www.sick-boy.com "We Put the SIN in Cinema"
© Copyright 2001 Planet Sick-Boy. All Rights Reserved.
Sébastien Lifshitz's Come Undone is a real challenge to watch - not because of its content (although there are lots of penis shots), but because of its structure. It could take viewers a good 30 to 40 minutes to finally settle into Lifshitz's story, which almost haphazardly flops around using flashbacks and flashforwards like they're going out of style. But if you can claw your way through it all, Undone becomes increasingly interesting as it approaches its finale.
Lifshitz's story (co-written by Stéphane Bouquet) focuses on the first love of college-bound 18-year-old Matthieu (Jérémie Elkaïm), who is vacationing with his family near Nantes. Well, most of his family, anyway. Matthieu's father is back in Paris because he has too much work, and his mother (Dominique Reymond), a clinically depressed pill-popper, is only there in form. His sister Sarah (Laetitia Legrix) is sarcastic and full of spite, while Annick (Marie Matheron), a friend of the family, seems to be the glue that holds the whole dysfunctional bunch together.
One day while at the beach with Sarah, Matthieu locks eyes with a hunky local lad named Cédric (Stéphane Rideau), a more experienced boy (and ex-hustler, to boot) who works at a local waffle vendor. Sparks fly and a physical relationship quickly follows, despite the fact Matthieu has apparently had no previous sexual experience, gay or otherwise. Passionate trysts turn to ugly spats, and Matthieu becomes somewhat unhinged, leading up to Undone's gut-wrenching finale...which you kind of see at the beginning because of the film's screwy construction.
The high point here is the acting, which never once seems like acting. But the story is essentially about a shy, quiet boy falling for a rough partner from the other side of the tracks. It's nothing new, but worth a viewing if only for the performances of Elkaïm and Rideau.
========== X-RAMR-ID: 29676 X-Language: en X-RT-ReviewID: 252510 X-RT-TitleID: 10000716 X-RT-SourceID: 595 X-RT-AuthorID: 1146
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


| Home | Trees | Indices | Help |
|
|---|
|
|
Generic labeling support for graphs
| Instance Methods | |||
| boolean |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
| list |
|
||
| string |
|
||
| number |
|
||
|
|||
| list |
|
||
|
|||
|
|||
|
|||
|
Inherited from |
| Class Variables | |
WEIGHT_ATTRIBUTE_NAME =
|
|
DEFAULT_WEIGHT = 1
|
|
LABEL_ATTRIBUTE_NAME =
|
|
DEFAULT_LABEL =
|
| Properties | |
|
Inherited from |
| Method Details |
Return whether this graph is equal to another one.
|
x.__init__(...) initializes x; see help(type(x)) for signature
|
Add attribute to the given edge.
|
Append a sequence of attributes to the given edge
|
Add attribute to the given node.
|
Return the attributes of the given edge.
|
Get the label of an edge.
|
Get the weight of an edge.
|
Return the attributes of the given node.
|
Set the label of an edge.
|
Set the weight of an edge.
|
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Sat Aug 25 09:56:12 2012 | http://epydoc.sourceforge.net |


| All: |
{{redmine_issues.all_issues_len}} |
| Open: |
{{redmine_issues.open_issues_len}} |
| Closed: |
{{redmine_issues.closed_issues_len}} |
| Rejected: |
{{redmine_issues.rejected_issues_len}} |
UPDATED {{ redmine_issues.issues_today.updated_issues_len }}
CREATED {{ redmine_issues.issues_today.open_issues_len }}
RESOLVED {{ redmine_issues.issues_today.closed_issues_len }}
KILL RATE {{ redmine_issues.issues_today.kill_rate }}%
{% if redmine_issues.issues_today.user_assigned_dict|length > 0 %}
| USER |
CLOSED |
{% for user in redmine_issues.issues_today.user_assigned_dict %}
| {{ user.0 }} |
{{ user.1 }} |
{% endfor %}
{% endif %}
{% if redmine_issues.issues_week %}
UPDATED {{ redmine_issues.issues_week.updated_issues_len }}
CREATED {{ redmine_issues.issues_week.open_issues_len }}
RESOLVED {{ redmine_issues.issues_week.closed_issues_len }}
KILL RATE {{ redmine_issues.issues_week.kill_rate }}%
{% if redmine_issues.issues_week.user_assigned_dict|length > 0 %}
| USER |
CLOSED |
{% for user in redmine_issues.issues_week.user_assigned_dict %}
| {{ user.0 }} |
{{ user.1 }} |
{% endfor %}
{% endif %}
{% endif %}
UPDATED {{ redmine_issues.issues_month.updated_issues_len }}
CREATED {{ redmine_issues.issues_month.open_issues_len }}
RESOLVED {{ redmine_issues.issues_month.closed_issues_len }}
KILL RATE {{ redmine_issues.issues_month.kill_rate }}%
{% if redmine_issues.issues_month.user_assigned_dict|length > 0 %}
| USER |
CLOSED |
{% for user in redmine_issues.issues_month.user_assigned_dict %}
| {{ user.0 }} |
{{ user.1 }} |
{% endfor %}
{% endif %}
{{ redmine_issues.month_comparison_created|json_script:"month_comparison_created" }}
{{ redmine_issues.month_comparison_resolved|json_script:"month_comparison" }}
{{ redmine_issues.historical_data|json_script:"historical_data_redmine" }}
{% endblock %}