Tuesday, November 22, 2011

Useful Curl

1. FTP
curl -u adobenet\\bjsstqe:Bvt_1109  --ftp-pasv ftp://sjstore.corp.adobe.com/builds01/adobedrive/3.0.1/Patcher/win32/mul/20111121.3.0.1.98/AdobeDrive-3.0.1-mul-AdobeUpdate.zip -# > AdobeDrive-3.0.1-mul-AdobeUpdate.zip


2. Http

curl -u admin:admin http://adtest-pc:4502/var/dam/testcom -F jcr:primaryType=nt:folder

curl -u admin:admin -T 5M.JPG http://adtest-pc:4502/var/dam/test/t/

Wednesday, October 19, 2011

How to connect HSql DB

How to connect HSql DB:
1), java -cp hsqldb.jar org.hsqldb.util.SqlTool --rcFile r.rc adrive
2), java -cp hsqldb.jar org.hsqldb.util.DatabaseManagerSwing

// in the file r.rc ,
urlid adrive
url jdbc:hsqldb:file:C:\Program Files\Common Files\Adobe\CS5ServiceManager\plugins\org.hsqldb_1.8.0.8\update\database\adrive-db;
username sa
password

Wednesday, September 28, 2011

CPPUNIT- TestFixture


TestFixture Class Reference
[Writing test fixture]

Wraps a test case with setUp and tearDown methods. #include <TestFixture.h>

Inheritance diagram for TestFixture:




Public Member Functions

virtual ~TestFixture ()
virtual void setUp ()
Set up context before running a test. 
virtual void tearDown ()
Clean up after the test run. 


Detailed Description

Wraps a test case with setUp and tearDown methods.A TestFixture is used to provide a common environment for a set of test cases.
To define a test fixture, do the following:
  • implement a subclass of TestCase
  • the fixture is defined by instance variables
  • initialize the fixture state by overriding setUp (i.e. construct the instance variables of the fixture)
  • clean-up after a test by overriding tearDown.
Each test runs in its own fixture so there can be no side effects among test runs. Here is an example:

class MathTest : public CppUnit::TestFixture { protected: int m_value1, m_value2; public: MathTest() {} void setUp () { m_value1 = 2; m_value2 = 3; } }
For each test implement a method which interacts with the fixture. Verify the expected results with assertions specified by calling CPPUNIT_ASSERT on the expression you want to test:

public: void testAdd () { int result = m_value1 + m_value2; CPPUNIT_ASSERT( result == 5 ); }
Once the methods are defined you can run them. To do this, use a TestCaller.

CppUnit::Test *test = new CppUnit::TestCaller<MathTest>( "testAdd", &MathTest::testAdd ); test->run();
The tests to be run can be collected into a TestSuite.

public: static CppUnit::TestSuite *MathTest::suite () { CppUnit::TestSuite *suiteOfTests = new CppUnit::TestSuite; suiteOfTests->addTest(new CppUnit::TestCaller<MathTest>( "testAdd", &MathTest::testAdd)); suiteOfTests->addTest(new CppUnit::TestCaller<MathTest>( "testDivideByZero", &MathTest::testDivideByZero)); return suiteOfTests; }
A set of macros have been created for convenience. They are located in HelperMacros.h.

See also:
TestResultTestSuiteTestCaller,CPPUNIT_TEST_SUB_SUITECPPUNIT_TESTCPPUNIT_TEST_SUITE_END, CPPUNIT_TEST_SUITE_REGISTRATIONCPPUNIT_TEST_EXCEPTIONCPPUNIT_TEST_FAIL.


Constructor & Destructor Documentation


virtual TestFixture::~TestFixture ) [inline, virtual]


Member Function Documentation


virtual void TestFixture::setUp ) [inline, virtual]
Set up context before running a test.

Reimplemented in TestCaseDecorator, and TestCaller< Fixture >.


virtual void TestFixture::tearDown ) [inline, virtual]
Clean up after the test run.

Reimplemented in TestCaseDecorator, and TestCaller< Fixture >.


The documentation for this class was generated from the following file:

Function


Syntax

LPTSTR WINAPI GetCommandLine(void);

Parameters

This function has no parameters.

Return value

The return value is a pointer to the command-line string for the current process.

_putenv_s, _wputenv_s 

Visual Studio 2005

Create, modify, or remove environment variables. These are versions of _putenv, _wputenv with security enhancements as described in Security Enhancements in the CRT.
The _putenv_s function adds new environment variables or modifies the values of existing environment variables. Environment variables define the environment in which a process executes (for example, the default search path for libraries to be linked with a program). _wputenv_s is a wide-character version of _putenv_s; the envstring argument to _wputenv_s is a wide-character string.

About hpp


What's the Difference Between .H and .HPP

  1. .hpp, .h, etc. is a loose convention for C++ header files, .hpp is a loose convention for C++ template implementation, and .h is pretty strong convention for c files.

  2. You can use .hh and .cc on UNIX and Linux programmers, different from .cpp and .h. files .hh files can helps emacs distinguish between C and C++ syntax highlighting. .cc extension looks good together with .hh, and it's shorter than .cpp.

  3. .hpp .h to differentiate between the two languages when building mixed-language products. For example, a class definition might go in an .hpp (implementation in .cpp), whereas a .h file would define only functions supported by C. To do this separation it is important to know the difference between the languages - to this end I pass *.c through gcc and *.cpp through g++.

Monday, September 26, 2011

One Useful Command on OSX

DITTO(1)                  BSD General Commands Manual                 DITTO(1)

NAME
     ditto -- copy directory hierarchies, create and extract archives

SYNOPSIS
     ditto [-v] [-V] [-X] [<options>] src ... dst_directory
     ditto [-v] [-V] [<options>] src_file dst_file
     ditto -c [-z | -j | -k] [-v] [-V] [-X] [<options>] src dst_archive
     ditto -x [-z | -j | -k] [-v] [-V] [<options>] src_archive ...
           dst_directory
     ditto -h | --help

DESCRIPTION
     In its first form, ditto copies one or more source files or directories
     to a destination directory.  If the destination directory does not exist
     it will be created before the first source is copied.  If the destination
     directory already exists then the source directories are merged with the
     previous contents of the destination.

     In its second form, ditto copies a file to the supplied dst_file path-
     name.

1.this command can create folder if target folder don't exist
2.this command can replace file if target file exist.

Monday, September 5, 2011

External Interface


External Interface

ExternalInterface is a class in the flash.external package that enables communication between ActionScript and the Flash Player container (e.g. an HTML page with JavaScript).
ExternalInterface is especially useful for two-way Flex application and browser JavaScript integration. In fact, Adobe recommends using ExternalInterface for all ActionScript-JavaScript communication.
ExternalInterface exposes two key pieces of functionality:

addCallback( functionName:String, closure:Function ) - expose a Flex function to the container

  • calling a container function (calling JavaScript from ActionScript)
  • exposing a Flex function to be callable by the container (calling ActionScript from JavaScript)
  • Example:
  • ExternalInterface.addCallback("sendToActionScript", receivedFromJavaScript);
  • "sendToActionScript" is defined in JS, receivedFromJavaScript is defined in AS.
ExternalInterface defines two especially important static functions:
  • call( functionName:String, ... arguments ) - call a container function


ExternalInterface.call("sendToJavaScript", input.text);

Flex and JavaScript Integration

Use the ExternalInterface class for ActionScript-JavaScript communication.
ExternalInterface defines two especially important static functions:
  • call( functionName:String, ... arguments ) - call a container function
  • addCallback( functionName:String, closure:Function ) - expose a Flex function to the container

Examples

Call Browser/JavaScript from ActionScript

Calling JavaScript from ActionScript is easy with ExternalInterface . Simply call the static call()function passing the function name and, optionally, any arguments.
// call a JavaScript function defined in the container page
   var result:String = 
      ExternalInterface.call( "doSomethingInJavaScript", arg1, arg2 );
The above ActionScript code could call the below JavaScript code in the container HTML page:
// a JavaScript function in the container HTML page
   function doSomethingInJavaScript( arg1, arg2 )
   {
      // do something
      return "results for " + arg1 + " and " + arg2;
   }

Call ActionScript from JavaScript/Browser

Calling ActionScript from JavaScript again requires use of the ExternalInterface class. First we must use the addCallback() function to expose the ActionScript function we want to call to the container.
public function init():void
   {
      // expose an ActionScript function to the container
      ExternalInterface.addCallback( "doSomethingInActionScript", doSomethingInActionScript );
   }
   
   // function now callable from JavaScript
   public function doSomethingInActionScript( arg1:String, arg2:Number ):String
   {
      return "result";
   }
The below JavaScript code can be used to call the exposed ActionScript function:
// get the Flex application (Flash object)
   var isIE = navigator.appName.indexOf("Microsoft") != -1;
   var flashName = "flashObjectName";
   var flashObject = (isIE) ? parent.Main.window[flashName] : document[flashName];
   
   if( flashObject )
   {
      // call the Flex application (Flash object)
      flashObject.doSomethingInActionScript( "arg1", 2 );
   }
Make sure the Flex application has been initialized and the function callback has been registered beforethe JavaScript call.