working on it ...

Filters

Explore Public Snippets

Sort by

Found 33k snippets matching: .class

    public by cghersi modified Jan 29, 2016  9943797  2399  13  9

    Java: read from USB using RXTX library

    This is a well-tested class to read from USB device using RXTX library. First of all place rxtxSerial.so (or rxtxSerial.dll) in the classpath. The received bytes are stored in a queue called "receivedBytes". This queue is filled by the serialEvent() callback called by RXTX framework. Users of this class should retrieve the ready data from "receiv
    import gnu.io.*;
    import java.io.*;
    
    import java.util.Enumeration;
    import java.io.IOException;
    
    /**
     * This class provides the utilities to read the data exchanged via USB port.
     */
    public class USBComm implements SerialPortEventListener {
    
    	/**
    	 * Stream for the storage of incoming data
    	 */
    	private InputStream inputStream;
    	/**
    	 * Stream for the dispatching of data
    	 */
    	private OutputStream outputStream;
    	/**
    	 * Timeout of the USB port
    	 */
    	private final int PORT_TIMEOUT = 2000;
    	/**
    	 * Representation of the serial port used for the communication
    	 */
    	private SerialPort serialPort;
    	/**
    	 * Buffer that stores the received bytes from the media
    	 */
    	protected LinkedBlockingQueue<Byte> receivedBytes;
    
    	/**
    	 * Builds a new manager for the communication via USB port.
    	 * @exception IOException if an error occurred during the opening of the USB port
    	 */
    	public USBComm() throws IOException {
    	  receivedBytes = new LinkedBlockingQueue<Byte>(100000);
    		String port = "COM1"; //place the right COM port here, OS dependent
    	
    		//Check that the USB port exists and is recognized:
    		Enumeration<?> portList = CommPortIdentifier.getPortIdentifiers();
    		boolean portFound = false;
    		CommPortIdentifier portId = null;
    		while (portList.hasMoreElements()) {
    			portId = (CommPortIdentifier) portList.nextElement();
    		    if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
    		    	System.out.println.info(portId.getName());
    				if (portId.getName().equals(port)) {
    					System.out.println("Found port: " + port);
    				    portFound = true;
    				    break;
    				} 
    		    } 
    		} 
    	
    		if (!portFound) 
    		    throw new IOException("port " + port + " not found.");
    	
    		try {
    			System.out.println("USB port opening...");
    		    serialPort = (SerialPort) portId.open("USBCommunicator", PORT_TIMEOUT);
    		    System.out.println("USB port opened");
    		    inputStream = serialPort.getInputStream();
    		    outputStream = serialPort.getOutputStream();
    		    serialPort.addEventListener(this);
    			    	serialPort.notifyOnDataAvailable(true);
    			//#==================================================================#
    			// WARNING! - DO NOT SET THE FOLLOWING PROPERTY WITH RXTX LIBRARY, IT
    			// 			  CAUSES A PROGRAM LOCK:
    			// 	serialPort.notifyOnOutputEmpty(true);
    			//#==================================================================#
    			    	
    		    //wait for a while to leave the time to javax.comm to
    		    //correctly configure the port:
    		    Thread.sleep(1000);
    		    
    			int baudRate = 115200; //set propertly
    	    	serialPort.setSerialPortParams(baudRate, 
    	    		SerialPort.DATABITS_8, 
    	    		SerialPort.STOPBITS_1, 
    				SerialPort.PARITY_NONE);
    		    
    	    	serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
    	    		
    		    System.out.println("setted SerialPortParams");
    		} catch (Exception e) {
    			System.err.println(e.getMessage());
    			throw new IOException(e.getMessage());
    		}
    	}
    
    	
    	public void closeUSB(){
    		//close the streams for serial port:
    		try {
    			inputStream.close();
    			outputStream.close();
    		} catch (IOException e) {
    			System.err.println("Cannot close streams:" + e.getMessage(), e);
    		}
    	}
    
    	/**
    	 * Listener for USB events
    	 * 
    	 * @param event new event occurred on the USB port
    	 */
    	public void serialEvent(SerialPortEvent event){
    		switch (event.getEventType()) {
    	
    			case SerialPortEvent.BI:
    			case SerialPortEvent.OE:
    			case SerialPortEvent.FE:
    			case SerialPortEvent.PE:
    			case SerialPortEvent.CD:
    			case SerialPortEvent.CTS:
    			case SerialPortEvent.DSR:
    			case SerialPortEvent.RI:
    			case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
    				//nothing to do...
    			    break;
    	
    			case SerialPortEvent.DATA_AVAILABLE:
    				byte received = -1;
    				do {
    					try {
    						received = (byte)inputStream.read();
    					} catch (IOException e) {
    						System.err.println("Error reading USB:" + e.getMessage());
    					}
    				
    					synchronized (receivedBytes) {
    						try {
    							receivedBytes.add(received);
    						} catch (IllegalStateException ew) {
    							System.err.println(ew.getMessage());
    							receivedBytes.poll();
    							receivedBytes.add(received);
    						}
    					}
    				} while(received != -1);
    
    			    break;
    		}
    	}
    
    	protected void write(byte[] buffer){
    	    try {
    	    	outputStream.write(buffer);
    	    	outputStream.flush();
    	    } catch (IOException e) {
    	    	System.err.println("Cannot write:" + e.getMessage());
    	    }
    	}
    }            

    public by micurs modified Mar 4, 2014  6854604  323  10  17

    Typescript: passing a class member function as parameter to another function

    Typescript introduces the class construct and the concept of member functions. However if you try to pass a instance member function as parameter to another function the binding with the instance is lost. To solve this problem you can use the capability of javascript (and Typescript) to support closures on anonymous function (or lambda expressio
    ///<reference path='../types/node.d.ts'/>
    ///<reference path='../types/underscore.d.ts'/>
    
    import _ = require("underscore");
    
    class SomePeople {
      values : string[] = [ 'John', 'Mary', 'Peter'];
    
      out() {
        _.each( this.values, (v) => process.stdout.write( v + '\n') );
      }
    }
    // This function accept a function it will execute internally
    function outSomething( outFunc : () => any ) {
      outFunc();
    }
    
    var crowd = new SomePeople();
    
    // This won't work since the actual crowd instance binding will be lost
    outSomething( crowd.out );
    
    // This will work: the closure within the lambda expression retain the
    // crowd instance and its data
    outSomething( () => crowd.out() );
        

    public by cghersi modified Jan 31, 2014  1414876  143  9  3

    C#: String Tokenizer

    This class provides a fast way to tokenize the given string and can be fully customizable in terms of splitting symbols, strange characters managed as letters, etc.
    using System;
    using System.IO;
    using System.Text;
    using System.Collections;
    using System.Collections.Generic;
    
    public class StringTokenizer
    {
        const char EOF = (char)0;
    
        int line;
        int column;
        int pos;	// position within data
    
        string data;
    
        List<Token> tokens;
    
        bool ignoreWhiteSpace;
        bool ignoreEqualChar;
        bool ignoreDigits;
        bool tokenSeparatedBySpace;
        char[] symbolChars;
        char[] symbolAsLetter;  //array of symbols treated as common letters inside words
    
        int saveLine;
        int saveCol;
        int savePos;
    
        bool tokenListCreated = false;
    
        public StringTokenizer(TextReader reader)
        {
            if (reader == null)
                throw new ArgumentNullException("reader");
    
            data = reader.ReadToEnd();
    
            Reset();
        }
    
        public StringTokenizer(string data)
        {
            if (data == null)
                throw new ArgumentNullException("data");
    
            this.data = data;
    
            Reset();
        }
    
    
        /// <summary>
        /// gets the list of tokens representing the input
        /// </summary>
        public List<Token> Tokens
        {
            get
            {
                if (!tokenListCreated)
                    this.CreateArrayList();
                return this.tokens;
            }
        }
    
    
        /// <summary>
        /// gets or sets which characters are part of TokenKind.Symbol
        /// </summary>
        public char[] SymbolChars
        {
            get { return this.symbolChars; }
            set { this.symbolChars = value; }
        }
    
    
        /// <summary>
        /// gets or sets which special characters (symbols) are treated as common letters inside words.
        /// Default is empty list.
        /// </summary>
        public char[] SymbolAsLetter
        {
            get { return this.symbolAsLetter; }
            set { this.symbolAsLetter = value; }
        }
    
    
        /// <summary>
        /// if set to true, white space characters will be ignored,
        /// but EOL and whitespace inside of string will still be tokenized.
        /// Default is false.
        /// </summary>
        public bool IgnoreWhiteSpace
        {
            get { return this.ignoreWhiteSpace; }
            set { this.ignoreWhiteSpace = value; }
        }
    
        /// <summary>
        /// if set to true, '=' character will be ignored,
        /// but EOL and whitespace inside of string will still be tokenized.
        /// Default is false.
        /// </summary>
        public bool IgnoreEqualChar
        {
            get { return this.ignoreEqualChar; }
            set { this.ignoreEqualChar = value; }
        }
    
        /// <summary>
        /// if set to true, digits are treated as normal characters, like literals.
        /// Default is false.
        /// </summary>
        public bool IgnoreDigits
        {
            get { return this.ignoreDigits; }
            set { this.ignoreDigits = value; }
        }
    
        /// <summary>
        /// if set to true, tokens must be separated by separators (spaces, tabs, etc).
        /// Default is false.
        /// </summary>
        public bool TokenSeparatedBySpace
        {
            get { return this.tokenSeparatedBySpace; }
            set { this.tokenSeparatedBySpace = value; }
        }
    
        private void Reset()
        {
            this.ignoreWhiteSpace = false;
            this.ignoreEqualChar = false;
            this.ignoreDigits = false;
            this.tokenSeparatedBySpace = false;
            this.symbolChars = new char[]{  '+', '-', '/', '*', '~', '@', '#', '%', '^',
                                            '=', '<', '>', '!',
                                            ',', '.', ':', ';', '_',
                                            '$', '€', '£', '&', '?', '|', '\\', '\'', '§', '°', 
                                            'ç', 'ì', 'è', 'é', 'ò', 'à', 'ù',    
                                            '(', ')', '{', '}', '[', ']'};
            this.symbolAsLetter = new char[] { };
    
            this.tokens = new List<Token>();
    
            line = 1;
            column = 1;
            pos = 0;
            tokenListCreated = false;
        }
    
        protected char LA(int count)
        {
            if (pos + count >= data.Length)
                return EOF;
            else
                return data[pos + count];
        }
    
        protected char Consume()
        {
            char ret = data[pos];
            pos++;
            column++;
    
            return ret;
        }
    
        protected Token CreateToken(TokenKind kind, string value)
        {
            Token tmp = new Token(kind, value, line, column);
            tokens.Add(tmp);
            return tmp;
        }
    
        protected Token CreateToken(TokenKind kind)
        {
            string tokenData = data.Substring(savePos, pos - savePos);
            Token tmp = new Token(kind, tokenData, saveLine, saveCol);
            tokens.Add(tmp);
            return tmp;
        }
    
        /* populate the arraylist. */
        protected void CreateArrayList()
        {
            //initialization of the positions for the scrolling of the input string:
            line = 1;
            column = 1;
            pos = 0;
            tokens.Clear();
    
            //sliding input in order to fill the arraylist:
            Token tmp = Next();
            while ((tmp.Kind != TokenKind.EOF) && (tmp.Kind != TokenKind.EOL))
                tmp = Next();
    
            tokenListCreated = true;
        }
    
        public Token Next()
        {
        ReadToken:
    
            char ch = LA(0);
            switch (ch)
            {
                case EOF:
                    return CreateToken(TokenKind.EOF, string.Empty);
    
                case ' ':
                case '\t':
                    {
                        if (this.ignoreWhiteSpace)
                        {
                            Consume();
                            goto ReadToken;
                        }
                        else
                            return ReadWhitespace();
                    }
    
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                    if (ignoreDigits)
                        return ReadWord();
                    else
                        return ReadNumber();
    
                case '\r':
                    {
                        StartRead();
                        Consume();
                        if (LA(0) == '\n')
                            Consume();	// on DOS/Windows we have \r\n for new line
    
                        line++;
                        column = 1;
    
                        return CreateToken(TokenKind.EOL);
                    }
                case '\n':
                    {
                        StartRead();
                        Consume();
                        line++;
                        column = 1;
    
                        return CreateToken(TokenKind.EOL);
                    }
    
                case '"':
                    {
                        return ReadString();
                    }
    
                default:
                    {
                        if (Char.IsLetter(ch) || (ignoreDigits && Char.IsDigit(ch)) ||
                            (ch == '_') || IsSymbolAsLetter(ch))
                            return ReadWord();
                        else if (IsSymbol(ch))
                        {
                            string symbol = new string(ch, 1);
                            char firstChar = ch;
    
                            StartRead();
                            Consume();
                            ch = LA(0);
    
                            //case of symbols composed by more than 1 char:
                            //symbols: "<>" or "!=" or ">=" or "<=":
                            switch (firstChar)
                            {
                                case '<':
                                    if ((ch == '>') || (ch == '='))
                                    {
                                        StartRead();
                                        Consume();
                                        symbol = string.Format("{0}{1}", symbol, ch);
                                    }
                                    break;
    
                                case '>':
                                    if ((ch == '<') || (ch == '='))
                                    {
                                        StartRead();
                                        Consume();
                                        symbol = string.Format("{0}{1}", symbol, ch);
                                    }
                                    break;
    
                                case '!':
                                    if (ch == '=')
                                    {
                                        StartRead();
                                        Consume();
                                        symbol = string.Format("{0}{1}", symbol, ch);
                                    }
                                    break;
    
                                default: break;
                            }
    
                            //if user wants tokens separated only by separators (spaces, tabs, etc.), check if 
                            //symbol is alone or within a word:
                            if (tokenSeparatedBySpace && (ch != EOF) && (ch != ' ') && (ch != '\t') &&
                                (ch != '\n') && (ch != '\r'))
                            {
                                return ReadWord(string.Format("{0}{1}", firstChar, ch));
                            }
    
                            return CreateToken(TokenKind.Symbol, symbol);
                        }
                        else
                        {
                            StartRead();
                            Consume();
                            return CreateToken(TokenKind.Unknown);
                        }
                    }
    
            }
        }
    
        /// <summary>
        /// save read point positions so that CreateToken can use those
        /// </summary>
        private void StartRead()
        {
            saveLine = line;
            saveCol = column;
            savePos = pos;
        }
    
        /// <summary>
        /// reads all whitespace characters (does not include newline)
        /// </summary>
        /// <returns></returns>
        protected Token ReadWhitespace()
        {
            StartRead();
    
            Consume(); // consume the looked-ahead whitespace char
    
            while (true)
            {
                char ch = LA(0);
                if (ch == '\t' || ch == ' ')
                    Consume();
                else
                    break;
            }
    
            return CreateToken(TokenKind.WhiteSpace);
    
        }
    
        /// <summary>
        /// reads number. Number is: DIGIT+ ("." DIGIT*)?
        /// </summary>
        /// <returns></returns>
        protected Token ReadNumber()
        {
            StartRead();
    
            bool hadDot = false;
    
            Consume(); // read first digit
    
            while (true)
            {
                char ch = LA(0);
                if (Char.IsDigit(ch))
                    Consume();
                else if (ch == '.' && !hadDot)
                {
                    hadDot = true;
                    Consume();
                }
                else
                    break;
            }
    
            return CreateToken(TokenKind.Number);
        }
    
        /// <summary>
        /// reads word. Word contains any alpha character or _
        /// </summary>
        protected Token ReadWord()
        {
            StartRead();
    
            Consume(); // consume first character of the word
    
            while (true)
            {
                char ch = LA(0);
                if (Char.IsLetter(ch) || (ignoreDigits && Char.IsDigit(ch)) || ch == '_' ||
                    (ignoreEqualChar && (ch == '=')) || IsSymbolAsLetter(ch) ||
                    (tokenSeparatedBySpace && IsSymbol(ch)))
                    Consume();
                else
                    break;
            }
    
            return CreateToken(TokenKind.Word);
        }
    
        /// <summary>
        /// reads word. Word contains any alpha character or _ and is appended to input string
        /// </summary>
        /// <param name="prefix">string which word is appended to</param>
        protected Token ReadWord(string prefix)
        {
            StartRead();
    
            //bring forward the position cursor of the nmber of chars in prefix:
            savePos = savePos - prefix.Length + 1;
    
            while (true)
            {
                char ch = LA(0);
                if (Char.IsLetter(ch) || (ignoreDigits && Char.IsDigit(ch)) || ch == '_' ||
                    (ignoreEqualChar && (ch == '=')) || IsSymbolAsLetter(ch) ||
                    (tokenSeparatedBySpace && IsSymbol(ch)))
                    Consume();
                else
                    break;
            }
    
            return CreateToken(TokenKind.Word);
        }
    
        /// <summary>
        /// reads all characters until next " is found.
        /// If "" (2 quotes) are found, then they are consumed as
        /// part of the string
        /// </summary>
        /// <returns></returns>
        protected Token ReadString()
        {
            StartRead();
    
            Consume(); // read "
    
            while (true)
            {
                char ch = LA(0);
                if (ch == EOF)
                    break;
                else if (ch == '\r')	// handle CR in strings
                {
                    Consume();
                    if (LA(0) == '\n')	// for DOS & windows
                        Consume();
    
                    line++;
                    column = 1;
                }
                else if (ch == '\n')	// new line in quoted string
                {
                    Consume();
    
                    line++;
                    column = 1;
                }
                else if (ch == '"')
                {
                    Consume();
                    if (LA(0) != '"')
                        break;	// done reading, and this quotes does not have escape character
                    else
                        Consume(); // consume second ", because first was just an escape
                }
                else
                    Consume();
            }
    
            return CreateToken(TokenKind.QuotedString);
        }
    
        /// <summary>
        /// checks whether c is a symbol character.
        /// </summary>
        protected bool IsSymbol(char c)
        {
            for (int i = 0; i < symbolChars.Length; i++)
                if (symbolChars[i] == c)
                    return true;
    
            return false;
        }
    
        /// <summary>
        /// checks whether c is a symbol character treated as common letter inside words.
        /// </summary>
        protected bool IsSymbolAsLetter(char c)
        {
            for (int i = 0; i < symbolAsLetter.Length; i++)
                if (symbolAsLetter[i] == c)
                    return true;
    
            return false;
        }
    }
    
    public enum TokenKind
    {
        Unknown,
        Word,
        Number,
        QuotedString,
        WhiteSpace,
        Symbol,
        EOL,
        EOF,
        BinaryOp,
        UnaryOp,
        MetaValueOp,
        OpenBrace,
        ClosedBrace
    }
    
    
    /// <summary>
    /// Token is the single element in which is broken a string
    /// </summary>
    public class Token
    {
        int line;
        int column;
        string value;
        TokenKind kind;
    
        public Token(TokenKind kind, string value, int line, int column)
        {
            this.kind = kind;
    
            //if the token is a QuotedString, remove quotes from the value:
            if (kind == TokenKind.QuotedString)
            {
                if (value[0] == '"' && (value.Length >= 2))
                {
                    int len = value.Length - 2;
                    //particular case when the quoted string doesn't end with '"' (e.g. "san francisco)
                    if (value[value.Length - 1] != '"')
                        len++;
                    this.value = value.Substring(1, len);
                }
                else
                    this.value = value;
            }
            else
                this.value = value;
    
            this.line = line;
            this.column = column;
        }
    
        public Token(TokenKind kind, string value) : this (kind, value, 0, 0)
        {
        }
    
        public int Column
        {
            get { return this.column; }
        }
    
        public TokenKind Kind
        {
            get { return this.kind; }
            set { kind = value; }
        }
    
        public int Line
        {
            get { return this.line; }
        }
    
        public string Value
        {
            get { return this.value; }
            set { this.value = value; }
        }
    
        public override string ToString()
        {
            string val = value;
            if (kind == TokenKind.QuotedString)
                val = string.Format("\"{0}\"", val);
    
            return string.Format("value:{0} ;kind:{1}", val, kind);
        }
    }

    public by cghersi modified Jan 31, 2014  963118  283  8  0

    How to encrypt and decrypt strings in C#

    This class can be used to encrypt and decrypt the given string. In the current implementation the passwrod is directly saved inside the code; depending on the infrastructure and architecture of the code sometimes it can be passed as parameter
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Security.Cryptography;
    
    public static class Encryptor
    {
        static private string _key = "myVeryStrongPsw";
    
        /// <summary>
        /// Encrypt the given string using the default key.
        /// </summary>
        /// <param name="strToEncrypt">The string to be encrypted.</param>
        /// <returns>The encrypted string.</returns>
        public static string Encrypt(string strToEncrypt)
        {
            try
            {
                return Encrypt(strToEncrypt, _key);
            }
    
            catch (Exception ex)
            {
                return "Wrong Input. " + ex.Message;
            }
        }
    
        /// <summary>
        /// Decrypt the given string using the default key.
        /// </summary>
        /// <param name="strEncrypted">The string to be decrypted.</param>
        /// <returns>The decrypted string.</returns>
        public static string Decrypt(string strEncrypted)
        {
            try
            {
                return Decrypt(strEncrypted, _key);
            }
            catch (Exception ex)
            {
                return "Wrong Input. " + ex.Message;
            }
        }
    
        /// <summary>
        /// Encrypt the given string using the specified key.
        /// </summary>
        /// <param name="strToEncrypt">The string to be encrypted.</param>
        /// <param name="strKey">The encryption key.</param>
        /// <returns>The encrypted string.</returns>
        public static string Encrypt(string strToEncrypt, string strKey)
        {
            try
            {
                TripleDESCryptoServiceProvider objDESCrypto =
                    new TripleDESCryptoServiceProvider();
                MD5CryptoServiceProvider objHashMD5 = new MD5CryptoServiceProvider();
                byte[] byteHash, byteBuff;
                string strTempKey = strKey;
                byteHash = objHashMD5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(strTempKey));
                objHashMD5 = null;
                objDESCrypto.Key = byteHash;
                objDESCrypto.Mode = CipherMode.ECB; //CBC, CFB
                byteBuff = ASCIIEncoding.ASCII.GetBytes(strToEncrypt);
                return Convert.ToBase64String(objDESCrypto.CreateEncryptor().
                    TransformFinalBlock(byteBuff, 0, byteBuff.Length));
            }
            catch (Exception ex)
            {
                return "Wrong Input. " + ex.Message;
            }
        }
    
        /// <summary>
        /// Decrypt the given string using the specified key.
        /// </summary>
        /// <param name="strEncrypted">The string to be decrypted.</param>
        /// <param name="strKey">The decryption key.</param>
        /// <returns>The decrypted string.</returns>
        public static string Decrypt(string strEncrypted, string strKey)
        {
            try
            {
                TripleDESCryptoServiceProvider objDESCrypto =
                    new TripleDESCryptoServiceProvider();
                MD5CryptoServiceProvider objHashMD5 = new MD5CryptoServiceProvider();
                byte[] byteHash, byteBuff;
                string strTempKey = strKey;
                byteHash = objHashMD5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(strTempKey));
                objHashMD5 = null;
                objDESCrypto.Key = byteHash;
                objDESCrypto.Mode = CipherMode.ECB; //CBC, CFB
                byteBuff = Convert.FromBase64String(strEncrypted);
                string strDecrypted = ASCIIEncoding.ASCII.GetString
                (objDESCrypto.CreateDecryptor().TransformFinalBlock
                (byteBuff, 0, byteBuff.Length));
                objDESCrypto = null;
                return strDecrypted;
            }
            catch (Exception ex)
            {
                return "Wrong Input. " + ex.Message;
            }
        }
    }
    

    public by angelangel04 modified Sep 22, 2014  773819  80  7  -1

    CSR Classics Hack Cheats Android iOS 2015

    Download CSR Classics Hack Cheats Android iOS 2015 From Below Link
    
    DOWNLOAD -> http://bit.ly/XNqBTB
    
    
    DOWNLOAD -> http://bit.ly/XNqBTB
    
    
    DOWNLOAD -> http://bit.ly/XNqBTB
    
    
    
    
    CSR Classics hack for Android is our latest game application that can generate unlimited gold and cash to your account! This time the driver takes on classic cars and we race through the streets of American cities! A key task in the game is smooth operating transmission. Moreover, in the same race are involved as mothers valued cars, which can unlock our CSR Classics hack tool download, such as. Audi, BMW, Chevrolet, Shelby, Mercedes and many more!
    How does the race in CSR Classics cheat Android game? At the start, we need to keep gas in terms of the optimal rotation. This signals the green light on the tachometer, and what technique you choose for this is already our own thing – you can try rhythmic tremors, but you can also hold the gas until the proper moment. Then accelerate, changing the way racing, CSR Classics hack gold generatr preferably also when the green light, but not always indications are correct – you still need to pay attention to the traction. If we have installed in the car nitro, press the button and use the extra power.
    During the change to another car you will need to adjust habits, like the rest of each improvement. In someCSR Classics hack tool unlock cars can be purchased for real money (virtual currency), and it costs quite a bit. For frugal we also have good news – the game can go without virtual money. NaturalMotionGames Ltd. introduced the function of a virtual mechanic. You can play in changing the engine, gearbox and exhaust as well as extras such as car color and stickers.
    
    csr-classics-hack-unlimited-coins
    
    CSR Classics hack Android game is definitely very good, professionally created game on Android. High quality graphics looks great on our smart fonach. The game is sure to attract the attention of all fans of street racing and vintage cars.
    
    
    hack android generator
    
    - Unlimited  Gold
    - Unlimited Cash
    - Unlock All Cars
    - Unlock Gold Truck
    - Unlock Solary
    - Vip Valut
    
    
    
    1. Download the CSR Classics Hack bellow.
    2. Connect your Android or iOS device.
    3. Select your features and enter their values.
    4. Last one – click the Start button, it will automatically hack the game.
    5. Enjoy your hack!
    
    
    
    
    
    Tags:
    csr classics hack
    csr classics hack tool
    csr classics hack iphone
    csr classics hack no survey
    csr classics hack ifunbox
    csr classics hack cydia
    csr classics hack android
    csr classics hack apk
    csr classics hack for mac
    csr classics hack no download
    csr classics hack cydia
    csr classics hack tool
    csr classics hack iphone
    csr classics hack no survey
    csr classics hack ifunbox
    csr classics hack android
    csr classics hack apk
    csr classics hack for mac
    csr classics hack no download
    csr classics hack download
    csr classics hack android
    csr classics hack apk
    csr classics hack android no survey
    csr classics hack android apk
    csr classics hack apk download
    csr classics hack android no root
    csr classics hack money and unlock best cars
    csr racing classic hack apk
    csr classics hack money and unlock best cars
    csr classics hack cydia
    csr classics coin hack
    csr classics hack no computer
    csr racing classic cydia hack
    csr classics hack money and unlock best cars
    csr classics hack download
    csr classics hack download no survey
    csr classics hack download without survey
    csr classics hack dmg
    csr classics hack tool download
    csr classics hack free download
    csr classics hack tool download no survey
    csr classics hack no download
    csr classics hack file download
    csr classics iphone hack download
    csr classics hack exe
    csr classics hack tool v3 1.exe
    hack csr classics español
    csr classics hack for mac
    csr classics hack free download
    csr classics hack for iphone
    csr classics hack for android
    csr classics hack file download
    csr classics hack file
    csr classics hack free
    csr classics hack for ios
    csr classics hack tool free download
    csr classics hack tool free
    csr classics hack gold
    csr classics gas hack
    csr classics game hack
    csr classics gold hack no survey
    csr classics free gold hack
    csr classics hack gratis
    csr classics hack gratuit
    csr classic hack german
    csr classics hack iphone
    csr classics hack ifunbox
    csr classics hack ifile
    csr classics hack iphone no survey
    csr classics hack ipad
    csr classics hack ifunbox mac
    csr classics hack iphone 5
    csr classics hack ios 7
    csr classics hack ios no jailbreak
    csr classics hack jailbreak
    csr classics hack no jailbreak
    csr classics hack without jailbreak
    csr classics hack no jailbreak no survey
    csr classics hack non jailbreak
    csr classics hack ios no jailbreak
    csr classic hack iphone no jailbreak
    csr classics money hack no jailbreak
    csr classics hack no jb
    csr classics hack ohne jailbreak
    lucky hack csr classics
    csr classics hack mac
    csr classics hack money and unlock best cars
    csr classics hack money
    csr classics money hack ifunbox
    csr classics money hack no jailbreak
    csr classics hack ifunbox mac
    csr classics ios money hack
    mot de passe csr classics hack
    csr classics hack no survey
    csr classics hack no download
    csr classics hack no jailbreak
    csr classics hack no root
    csr classics hack no computer
    csr classics hack no survey android
    csr classics hack no jailbreak no survey
    csr classics hack non jailbreak
    csr classics hack no jb
    csr classics hack tool no survey
    csr classics hack on ipad
    csr classics hack ohne jailbreak
    csr classics hack password
    csr classics profile hack
    mot de passe csr classics hack
    hack para csr classics
    csr classics hack.rar
    csr classics racing hack
    csr classics hack tool.rar
    csr classics hack tool v1 78.rar
    csr classics hack save
    csr classics hack sinful
    csr classics hack without survey
    csr classics hack tool no survey
    csr classics hack download without survey
    csr classics hack download no survey
    csr classics hack iphone no survey
    csr classics hack tool download no survey
    csr classics hack no jailbreak no survey
    csr classics gold hack no survey
    csr classics hack tool
    csr classics hack tool download
    csr classics hack tool.rar
    csr classics hack that works
    csr classics hack tool download no survey
    csr classics hack tool free download
    csr classics hack tool no survey
    csr classics hack tool android
    csr classics hack tool mac
    csr classics hack tool password
    csr classics hack unlimited money and gold
    csr classics hack using ifunbox
    csr classics ultimate hack tool v.3.3
    csr classics ultimate hack tool
    csr classics ultimate hack tool download
    csr classics hack money and unlock best cars
    how to hack csr classics using ifile
    csr classics hack v6.8
    csr classics hack v1.2
    csr classics v1.0.4 hack
    csr classics v1.0.3 hack
    csr classics hack tool v1.2
    csr classics hack tool v1.6 download
    csr classics hack tool v3 1.exe
    csr classics hack tool v1.6
    csr classics ultimate hack tool v.3.3
    csr classics hack tool v1.78
    csr classics hack with ifile
    csr classics hack without survey
    csr classics hack without jailbreak
    csr classics hack with ifunbox
    csr classics hack download without survey
    csr classics hack zip
    csr classics hack tool 2013 .zip
    csr classics cheats
    csr classics cheats android no survey
    csr classics cheats android
    csr classics cheats iphone
    csr classics cheats ipad
    csr classics cheats iphone 4
    csr classics cheats download
    csr classics cheats money
    csr classics cheats no download
    csr classics cheats and tips
    csr classics cheats android no survey
    csr classics cheats android
    csr classics cheats iphone
    csr classics cheats ipad
    csr classics cheats iphone 4
    csr classics cheats download
    csr classics cheats money
    csr classics cheats no download
    csr classics cheats and tips
    csr classics cheats free download
    csr classics cheats android no survey
    csr classics cheats android
    csr classics cheats and tips
    csr classics cheats android no root
    csr classics cheats android free
    csr classics cheats apk
    csr classics cheat app
    csr classics android cheat codes
    csr racing classics cheats android
    csr classics money cheat android
    csr classics cheats tool box.rar
    csr classics cheats tool box download
    csr classics cheats tool box
    csr classics cheats cydia
    csr classics cheats cash
    csr classics cheat codes
    csr classics cheat codes android
    csr classics cars cheats
    csr classics coin cheat
    csr classics cheats without computer
    csr racing classic cheat codes
    hack creator csr classics cheats
    csr classics cheat chomikuj
    csr classics cheats download
    csr classics cheats no download
    csr classics cheats free download
    csr classics cheats deutsch
    csr classics cheats deutsch android
    csr classics cheats android download
    descargar csr classics cheats
    csr classics cheats tool box download
    csr classics cheat engine
    csr classics cheat engine tool
    csr classics cheats 2014.exe
    csr classics cheats 2013.exe
    csr classics hack cheat engine
    csr classics cheat tool.exe
    csr classics cheats for android
    csr classics cheats free download
    csr classics cheats for ipad
    csr classics cheats for iphone
    csr classics cheats free gold
    csr classics cheats for ios
    csr classics fuel cheat
    csr racing classic cheats for android
    cheats for csr classics
    cheats for csr classics app
    csr classics cheats gold
    csr classics game cheats
    csr classics gas cheats
    csr classics gold cheat android
    csr classics cheats free gold
    csr racing classic gold cheat
    csr classics geld cheat
    csr classics cheats hack tool
    csr classics cheats hack 2014
    csr classics cheat hack
    csr classics hack cheat engine
    csr classics cheats no hack
    hack creator csr classics cheats
    csr classics cheats iphone
    csr classics cheats ipad
    csr classics cheats iphone 4
    csr classics cheats ifunbox
    csr classics cheats ipad no survey
    csr racing classics cheats iphone
    csr classics in game cheats
    cheats in csr classics
    csr classics cheats jailbreak
    csr classics cheats no jailbreak
    csr classics time lapse cheat
    csr classics cheats money
    csr classics cheats mac
    csr classics money cheat android
    csr racing classic money cheat
    csr classics cheats no survey
    csr classics cheats no download
    csr classics cheats no jailbreak
    csr classics cheats no hack
    csr classics cheats ipad no survey
    csr classics cheats on iphone
    csr classics cheats on ipad
    csr classic cheats on android
    cheats on csr classics
    csr classics cheats tablet
    csr classics cheats tips
    csr classics cheat tool
    csr classics time cheat
    csr classics cheats hack tool
    csr classics cheat engine tool
    cheats to csr classics
    csr classics cheats tool box.rar
    csr classics cheats tool box download
    csr classics cheats tool box
    
    

    public by lbottaro modified Oct 24, 2013  644673  11  7  2

    Using Pickle to Save Objects in Python - String Serialization

    You can use the pickle module to save data in a serialized format, typically in a txt string, performing what is better known as data serialization, marshalling, or flattening. Pickle allows you to save an object to a file for later retrieval. Pickling some data will write the python object (dictionary, list, tuple, class) as one long strea
    import pickle 
    
    # The data to save
    myDict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}
    # The object to pickle
    object_pi = myDict 
    # The file where to write the serialized string
    file_pi = open('filename_pi.obj', 'w')
    # Dump the data as string to file 
    pickle.dump(object_pi, file_pi)
    file_pi.close()

    public by marksimon232 modified Jun 23, 2014  518669  2  5  3

    Base64 Decoding in iOS 7+

    Do you have Encoded text(NSString) using NSData Class new API which is Added in iOS7?
    Objective-C
    
    NSString *plainString = @"foo";
    Encoding
    
    NSData *plainData = [plainString dataUsingEncoding:NSUTF8StringEncoding];
    NSString *base64String = [plainData base64EncodedStringWithOptions:0];
    NSLog(@"%@", base64String); // Zm9v
    Decoding
    
    NSData *decodedData = [[NSData alloc] initWithBase64EncodedString:base64String options:0];
    NSString *decodedString = [[NSString alloc] initWithData:decodedData encoding:NSUTF8StringEncoding];
    NSLog(@"%@", decodedString); // foo 
    Swift
    
    let plainString = "foo";
    Encoding
    
    let plainData = (plainString as NSString).dataUsingEncoding(NSUTF8StringEncoding)
    let base64String = plainData.base64EncodedStringWithOptions(NSDataBase64EncodingOptions.fromRaw(0)!)
    println(base64String) // Zm9v
    Decoding
    
    let decodedData = NSData(base64EncodedString: base64String, options: NSDataBase64DecodingOptions.fromRaw(0)!)
    let decodedString = NSString(data: decodedData, encoding: NSUTF8StringEncoding)    
    println(decodedString); // foo 

    public by lbottaro modified Mar 31, 2014  494593  1  8  4

    How to marshal and unmarshal java class to xml file using JAX-B

    This java code shows how to marshal and unmarshal class data to xml using JAX-B library, contained in javax.xml.bind.JAXB package. MyNetwork object contains two lists, one for Vendor objects and one for Equipment objects. Each Equipment has a list of Cards and each card refers to a specific Vendor. Marshalling and unmarshalling operation is dele
    package com.test.jaxb;
    
    import java.io.File;
    import javax.xml.bind.JAXB;
    
    public class MarshallingExamples {
    
        public MarshallingExamples() {
            MyNetwork network = new MyNetwork();
            Vendor v1 = new Vendor("123", "NameVVV");
            Vendor v2 = new Vendor("567", "NameZZZ");
            Vendor v3 = new Vendor("345", "NameXXX");
            Equipment eqp1 = new Equipment("112233", "TYPE_ABC", "00-14-22-01-23-45");
            eqp1.addCard(new Card(CardType.DWDM, "AABBCC", 2, v1));
            network.addEquipments(eqp1);
            Equipment eqp2 = new Equipment("222333", "TYPE_ZZZ", "00-C4-22-C1-23-C5");
            eqp2.addCard(new Card(CardType.SDH, "AA1234", 1, v2));
            eqp2.addCard(new Card(CardType.ETH, "AACCDD", 4, v1));
            network.addEquipments(eqp2);
            Equipment eqp3 = new Equipment("445566", "TYPE_CDE", "01-C3-2A-C1-AA-C5");
            eqp3.addCard(new Card(CardType.DWDM, "AAFF44", 1, v3));
            eqp3.addCard(new Card(CardType.DWDM, "AABF33", 1, v3));
            eqp3.addCard(new Card(CardType.ETH, "AA33DD", 2, v2));
            network.addEquipments(eqp3);
            network.addVendor(v1);
            network.addVendor(v2);
            network.addVendor(v3);
            JAXB.marshal(network, new File("out.xml"));        
            network = JAXB.unmarshal(new File("out.xml"), MyNetwork.class);
            for(Equipment eqp : network.getEquipments()) {
                System.out.println(eqp);
            }
            for(Vendor vend : network.getVendors()) {
                System.out.println(vend);
            }
        }
    
        public static void main(String[] args) {
            new MarshallingExamples();
        }
    }
    

    public by lbottaro modified Jun 22, 2014  413085  2  7  5

    Functions as first class objects in Python

    Python allows the coder to treat functions as objects, also known as first class objects. Usually a first class object is an entity that can be dynamically created, destroyed, passed to a function, returned as a value, and have all the rights as other variables in the programming language have. In this case the functional programming paradigm al
    #!/usr/local/bin/python2.7
        
    def add(a, b):
      return a + b
    
    def subtract(a, b):
      return a - b
    
    def multiply(a, b):
      return a * b
    
    def divide(a, b):
      if b:
        return a /b
      else:
        return "Error, divide by zero!"
        
    def power(a, b):
      return a ** b
      
    def modulus(a, b):
      return a % b
    
    functions = [add, subtract, multiply, divide, power, modulus]
    
    for function in functions:
    
      name = function.__name__
      result = function(4.0,5.0)
      print(name + ": " + str(result))

    public by johansonkatherine modified Apr 16, 2014  442991  0  5  3

    Java code for Changing Color Space of PDF Document

    This code shows how java developers can change color space of PDF document from RGB color to CMYK and vice versa by using Aspose.PDF for Java Library. The following methods have been implemented in the Operator class for changing colors. Use it to change some specific RGB/CMYK colors to CMYK/RGB color space, keeping the remaining PDF document as it
    Document doc = new Document(myDir + "input_color.pdf");
    OperatorCollection contents = doc.getPages().get_Item(1).getContents();
    System.out.println("Values of RGB color operators in the pdf document");
    for (int j = 1; j <= contents.size(); j++)
        {
    	Operator oper = contents.get_Item(j);
    	if (oper instanceof Operator.SetRGBColor || oper instanceof Operator.SetRGBColorStroke)
    	try {
    	    //Converting RGB to CMYK color
    	    System.out.println(oper.toString());
    
    	    double[] rgbFloatArray = new double[]
    	        {
    		    	Double.valueOf(oper.getParameters().get(0).toString()),
    		    	Double.valueOf(oper.getParameters().get(1).toString()),
    		    	Double.valueOf(oper.getParameters().get(2).toString()),
    	        };
    	    double[] cmyk = new double[4];
    	    if (oper instanceof Operator.SetRGBColor)
    	    {
    		((Operator.SetRGBColor)oper).getCMYKColor(rgbFloatArray, cmyk);
    		contents.set_Item(j, new Operator.SetCMYKColor(cmyk[0], cmyk[1], cmyk[2], cmyk[3]));
    		}
    		else if (oper instanceof Operator.SetRGBColorStroke)
    		{
    		    ((Operator.SetRGBColorStroke)oper).getCMYKColor(rgbFloatArray, cmyk);
    		   contents.set_Item(j, new Operator.SetCMYKColorStroke(cmyk[0], cmyk[1], cmyk[2], cmyk[3]));
    		}
    		    else
    throw new java.lang.Throwable("Unsupported command");
    
    	} catch (Throwable e) {
    	    e.printStackTrace();
    	}
    		        }
    doc.save(myDir + "input_colorout.pdf");
    
    //Testing the result
    System.out.println("Values of converted CMYK color operators in the result pdf document");
    doc = new Document(myDir + "input_colorout.pdf");
    contents = doc.getPages().get_Item(1).getContents();
    for (int j = 1; j <= contents.size(); j++)
        {
    	Operator oper = contents.get_Item(j);
    	if (oper instanceof Operator.SetCMYKColor || oper instanceof Operator.SetCMYKColorStroke)
    	{
    	   System.out.println(oper.toString());
    	}
       }
    
    • Public Snippets
    • Channels Snippets