## Sunday, December 14, 2014

### Regular Expression - replace group

I have a html
<a href="cc.ccs"/><a href="bb.ccs"/><a href="#"/>

I want to replace the non # href so that it become
<a href="my_cc.ccs"/><a href="my_bb.ccs"/><a href="#"/>

print re.sub(
r"href=\"([^#].*)\"",
r"href=\"my_\g<1>",
r"<a href=\"my_cc.ccs\"/><a href=\"my_bb.ccs\"/><a href=\"#\"/>")

## Saturday, December 6, 2014

### Open second winedt

http://tex.stackexchange.com/questions/11374/running-multiple-winedt-processes-on-windows-7-x64

## Monday, December 1, 2014

### Installation of Apache ODE on Windows 7

1. Use latest JRuby
2. Use latest JDK
3. Use Tomcat 6.0

Guideline of installation is here
http://ode.apache.org/developerguide/building-ode.html

---Some meta information for myself, not sure whether it is useful---
For rewriting (just rewriting it)

Installing Source of Apache ODE
My current version jdk 1.7 Update 51

Using latest junit
Set the java_home to jdk
Install buildr
Run buildr

macos with JDK 1.5 and JDK 1.6) is
buildr 1.4.4, jruby 1.5.1 (ruby 1.8.7 patchlevel 174).

jruby -S gem install buildr -v 1.4.4
jruby -S gem install buildr --verbose

cd c:\
buildr package test=no

buildr test

buildr eclipse

### Setup Java Web service Service

1. Create Dynamic Web Project
1. Configuration -> Axis2
1. Create src file
2. Create Web Service
1. Choose Operator Class
2. Choose Apache Axis2
3. After all start server

1. Right Click Project, Right On Server, Copy the URL
Details can be found here:

### Setup Java Web service Client

1. Dynamic Project
2. Configuration -> Axis2
3. New => Web Service Client
4. Pass the WSDL, check server

Details step can be found here

## Tuesday, November 25, 2014

### SoapUI Tutorial - Setup and Execute Public Web Service in 1 minute (HD)

Here is a tutorial on setup and executing a public web service using SOAPUI (in just one minute).

### How to create a Java Web Service using Tomcat and Apache ODE

This is a very short and concise guide (in just 3 minutes) for creating Java Web Service using Tomcat and Apache ODE.

## Wednesday, November 19, 2014

### Export Data from Quickvoice (Iphone, IPad) to computer

Quickvoice is an app for IPhone and IPad. If you are having problem of exporting data from quickvoice (Iphone, IPad) to computer, visit the following two links:

## Tuesday, September 16, 2014

Default Template and Make the rule distance larger

Default Template
\documentclass[chapterprefix=false]{scrreprt}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage[textheight=1.618\textwidth,
lmargin=37mm, rmargin=22mm, driver=pdftex,
footskip=11mm, vmarginratio=1:1]{geometry}

\fancypagestyle{plain}{%
\fancyhf{}
\fancyfoot[L]{\small Project Name}
\fancyfoot[C]{-- \thepage\ --}
\fancyfoot[R]{\small Submission Date}
\renewcommand{\footrulewidth}{0.4pt}}
\pagestyle{plain}
\begin{document}
\lipsum
\end{document}

First page and second page different
http://latex-community.org/forum/viewtopic.php?f=47&t=9191

## Monday, July 14, 2014

### Software development experience

The more related information u see the earlier, the better.
The more flexibility and less assumption you have, the better.
Try to make the workflow clear on the upfront, don't unnecessary hiding some workflow in inner function.

Effective coding
Use the method first, then define it.

1. Sequential Coding - Do not worry about the syntax error. Type it at the end. Write the method then use it.
2. No Design Time - Code during planning, planned during coding. Code whatever you can first, add information when necessary
3. Use first- Use first, then declare
4. Use keyboard - faster
5. Use Logic - not trial and error
6. Copy and paste -whenever code can be duplicated
7. Standardize naming convention - be discipline and do not need to decide

## Monday, July 7, 2014

### false positive > false negative for malware classifier

1. While this suggests that some malicious contexts are not being classified correctly, for most purposes, having
high overall accuracy and low false positive rate are the most important attributes of a malware classifier.

Reference: ZOZZLE : Fast and Precise In-Browser JavaScript Malware Detection
2. A "false positive" is when antivirus software identifies a non-malicious file as a virus. When this happens, it can cause serious problems. For example, if an antivirus program is configured to immediately delete or quarantine infected files, as is common on Microsoft Windows antivirus applications, a false positive in an essential file can render the Windowsoperating system or some applications unusable.[32] Recovering from such damage to critical software infrastructure incurs technical support costs and businesses can be forced to close whilst remedial action is undertaken.[33][34] For example, in May 2007 a faulty virus signature issued by Symantec mistakenly removed essential operating system files, leaving thousands of PCs unable to boot.[35]
Also in May 2007, the executable file required by Pegasus Mail on Windows was falsely detected by Norton AntiVirus as being a Trojan and it was automatically removed, preventing Pegasus Mail from running. Norton AntiVirus had falsely identified three releases of Pegasus Mail as malware, and would delete the Pegasus Mail installer file when that happened.[36] In response to this Pegasus Mail stated:
 “ On the basis that Norton/Symantec has done this for every one of the last three releases of Pegasus Mail, we can only condemn this product as too flawed to use, and recommend in the strongest terms that our users cease using it in favour of alternative, less buggy anti-virus packages.[36] ”
In April 2010, McAfee VirusScan detected svchost.exe, a normal Windows binary, as a virus on machines running Windows XP with Service Pack 3, causing a reboot loop and loss of all network access.[37][38]
In December 2010, a faulty update on the AVG anti-virus suite damaged 64-bit versions of Windows 7, rendering it unable to boot, due to an endless boot loop created.[39]
In October 2011, Microsoft Security Essentials (MSE) removed the Google Chrome web browser, rival to Microsoft's own Internet Explorer. MSE flagged Chrome as a Zbot banking trojan.[40]
In September 2012, Sophos' anti-virus suite identified various update-mechanisms, including its own, as malware. If it was configured to automatically delete detected files, Sophos Antivirus could render itself unable to update, required manual intervention to fix the problem.

Reference: http://en.wikipedia.org/wiki/Antivirus_software

3. A further complication of in vivo filtering is the asymmetry in error costs. Judging a legitimate email to be spam (a false positive error) is usually far worse than judging a spam email to be legitimate (a false negative error). A false negative simply causes slight irritation, i.e., the user sees an undesirable message. A false positive can be critical. If spam is deleted permanently from a mail server, a false positive can be very expensive since it means a (possibly important) message has been discarded without a trace. If spam is moved to a low-priority mail folder for later human scanning, or if the address is only used to receive low priority email, false positives may be much more tolerable. In an essay on developing a bayesian spam fi lter, Paul Graham [16] describes the different errors in an insightful comment: False positives seem to me a different kind of error from false negatives. Filtering rate is a measure of performance. False positives I consider more like bugs. I approach improving the filtering rate as optimization, and decreasing false positives as debugging.

Reference: "In vivo" spam filtering: a challenge problem for KDD

4.  Reference： A False Positive Prevention Framework for Non-Heuristic Anti-Virus Signatures

## Tuesday, June 24, 2014

### "Network Connections" is empty on Windows Operating System

If you have installed acronis, use this:
https://kb.acronis.com/content/2980 (maybe you need this http://blog.ronnypot.nl/?p=843 if security property is greyed out)

Otherwise, use this:

### VMWare Internet Connection Problem

Problem:
I cannot connect to internet with VMWare
OS: Windows 7
VM: Ubuntu
Connection Type: NAT

How I fix it:
Start>Type in "Network and Sharing Center">Change Adapter Setting

Right Click "VMware Network Adapter VMnet1", Click Diagnose, and fix whatever problems (by clicking the fixing button), do the same for "VMware Network Adapter VMnet8".

## Tuesday, May 13, 2014

### Synchronize Class View in Visual Studio 2010

1. Tools->Options->Environment->Keyboard and
2. bound Ctrl+Shift+C to View.SynchronizeClassView in Text Editor view.

http://stackoverflow.com/questions/546113/visual-studio-automatically-refresh-class-view-when-changing-class

## Monday, May 12, 2014

### Todo in Visual Studio 2010

1. Resharper>Tools>To-do Items list all todo items
2. Reshaper>Options set what to show in todo items

for me I create //MyTodo:...

3. To view only MyTodo: Using (1), in the filter choose MyTodo

## Wednesday, May 7, 2014

### Running 32 bit DLL on 64 bit Machine on Visual Studio

Solution:
1. Right click the Solution>Configuration Manager

2. In the Active solution platform, Choose <New>, under Copy Settings from, choose x86, click ok.
(ALL projects need to be compile under X86)

3. Make sure Build for all projects are checked.

P/S: If you have the problem on Visual Studio 2010 during compilation: Could not load file or assembly … or one of its dependencies. An attempt was made to load a program with an incorrect format (.resx file), use the following method to solve it.

1. Close all instances of Visual Studio.

2. From the Visual Studio Tools subfolder, open an elevated “Visual Studio Command Prompt (2010)” (using “Run as administrator” option). Change directory to "<system_drive>:\Program Files (x86)\Microsoft SDKs\Windows\v<x.xx>\bin\”.

3. Issue the command :

corflags /32bit+ ResGen.exe /force

5. Add the following property <ResGenToolArchitecture>Managed32Bit</ResGenToolArchitecture> under the PropertyGroup section. Save and close the csproj file.

From: http://support.microsoft.com/kb/2028833

## Friday, May 2, 2014

### How to refer to labels in other documents?

How to refer to labels in other documents?

\usepackage{xr}
\externaldocument{supplement}
...
\ref{ext:supplement}
http://tex.stackexchange.com/questions/160140/how-to-refer-to-labels-in-other-documents

## Tuesday, April 29, 2014

### Remove white and black backgrounds in photoshop

Today I have a fairly quick Photoshop tip on how to remove white or black backgrounds from images in Photoshop to create areas of transparency. There are several ways to do this, you could use the magic eraser, or just make a selection of the white or black background and then delete it, but I want to show you how to use a blending slider to do it. As well as the blending modes available in the Layers palette, you can play around with blending sliders in the Layer Style dialog box. Let’s get started.
1. Open an image in Photoshop with a predominantly white or black background.
2. Open the Layer Style dialog box by doing one of the following:
• Click the little fx button at the bottom of the Layers panel and choose Blending Options.
• Double-click its layer thumbnail in the Layers panel.
• Choose Layer > Layer Style > Blending Options.
Note: The Blending sliders won’t work on a locked Background layer; you have to double-click the layer first to make it editable.

At the bottom of the resulting dialog box, you’ll see two pairs of sliders-one set for the This Layer bar and another for the Underlying Layer bar. Each of these sliders lets you make parts of your image transparent based on the brightness value of the pixels. The left slider represents the shadows (blacks) in your image and the right one represents the highlights (whites). If you want to change the background of the currently active layer, then tweak the This Layer slider.
3. If you want to hide a white background, drag the highlight slider (the one on the right) toward the middle until the white part is transparent.
As you drag, you’ll see the white areas of the image disappear and the checkerboard pattern (or underlying layer) will appear. Note that any white area will disappear so you need to be careful how far you drag.
Likewise, if the background of your currently active layer is black and the subject (or object in the foreground) is much brighter, you can hide the black part by dragging the shadow slider (the one on the left) toward the middle until the black part is transparent. Very easy and quick.
If you’re keen to learn more about Photoshop, you may find this recent article on getting started with Photoshop of great interest.

## Monday, April 28, 2014

### Export Microsoft Powerpoint Speaker Note to Word

Export the notes text of a presentation
http://www.pptfaq.com/FAQ00481.htm
then
How do I use VBA code in PowerPoint
http://www.pptfaq.com/FAQ00033.htm

## Sunday, April 27, 2014

### What is the difference between functional and Non-functional requirements

For a software system, there are two kinds of requirements, i.e., Functional and Non-functional Requirements.
Functional Requirements: specify the functionality of the system.
Non-functional Requirements: specify the quality of the system,  is mostly related to the satisfiability of the user.
We use a simplistic Travel Agency Service (TAS) as an example to illustrate the concept. The workflow of the TBS is described as follows. When the request from the user is received, it invokes the other two services based on the request of the user. If the user prefers to Travel by Road, then the Car Booking Service (CBS) is invoked, otherwise if the user prefers to travel by flight, the Flight Booking Service (FBS) is invoked. Subsequently, Hotel Booking Service (HBS) is invoked for booking a hotel for the user, and then the result of the bookings are replied to the user.
In such scenario, the functional requirements of TAS could be:
1) When Travel By Road is chosen, then the CBS will always be invoked.
2) When Travel By Air is chosen, then the FBS will always be invoked.
3) HBS will only be invoked after either CBS or FBS is invoked.
4) HBS and FBS – exactly one of them would be invoked for each request.
etc.
The non-functional requirement of TAS would be
1) TAS responds to users within 3 seconds.
2) The availability of TAS is 99.999%.
etc.
As you can see non-functional is mostly related to the satisfiability of the user; therefore it is often an important clause in service-level agreements (SLAs), which is the contractual basis between service consumers and service providers on the expected Quality of Service (QoS) level.  For example, the SLAs of Amazon.com can be found here.
There are many other non-functional requirement attributes (e.g., Throughput, Latency Time), a more complete list could be found here: http://en.wikipedia.org/wiki/Non-functional_requirement.

## Wednesday, April 23, 2014

### wordpress - crayon syntax highlighter

<pre class="lang:java" title="something">
</pre>

## Monday, April 21, 2014

### Installation Guide for Internet Explorer VPC image on Virtual PC

Different versions of Internet Explorer (IE) have presented challenges for testing the Web application. In order to test on multiple browsers concurrently, Microsoft has kindly provided free downloadable disk images for IE 7, 8, 9, which could be run under their Virtual PC software, so that you could test all browsers under the virtual machine.

This post is a step-by-step guide on how to set up the VPC images for IE 7, 8, 9. In particular, the following versions of IE are available in Windows virtual machines.
• IE7 in Windows Vista – The install files for IE8 and IE9 are also available for install in this virtual machine.
• IE8 in Windows 7 with install files for IE9 – The install files for IE9 are also available for install in this virtual machine.
• IE9 in Windows 7

Step by Step Installation Guide:

Prerequisite:

Steps:

A confirmation dialog box displays. Click Yes to install the update.

Read through the license terms and click I Accept to continue with the installation.

The progress of the installation displays.

When the installation of the update is finished, the following dialog box displays. To restart your PC immediately, click Restart Now. If you want to make sure everything is closed before restarting, click Close. However, be sure to restart your PC before using Virtual PC.

To expand an IE virtual machine, double-click on the .exe file, which is the first part of the compressed files. For this example, we are going to extract the IE8 Windows 7 virtual machine and import it into Virtual PC.

If the Open File – Security Warning dialog box displays, click Run to continue with the installation.

Read through the License Agreement and click Accept to continue extracting the virtual machine files.

The WinRAR self-extracting archive dialog box displays. Either accept the default location for the Destination folder, which should be the current location of the compressed files, or click Browse to select a different location for the resulting virtual machine files. We accepted the default location. Click Install.

The installation progress displays.

When the files have been extracted, you will see a .vhd file, which is the virtual machine hard drive, and a .vmc file which contains the settings for the virtual machine.

To open Virtual PC, select Windows Virtual PC from the Windows Virtual PC folder on the Start menu.

A Windows Explorer window opens to the location of the Virtual Machines, if any existed. Click the Create virtual machine button on the toolbar. If you can’t see the button, click the double right-pointing arrow button and select Create virtual machine from the drop-down menu.

The Create a virtual machine wizard displays. Enter a name for the virtual machine in the Name edit box. Accept the default Location for the virtual machine file. It will be placed in the Virtual Machines folder that opened in the Windows Explorer window when you started Virtual PC. Click Next.

The Specify memory and networking options screen displays. Enter the amount of RAM, in megabytes, you want the virtual machine to use in the edit box. To connect the virtual machine to your network, select the Use computer network connections check box. You will most likely need to turn on this option so your virtual machine can access the internet through your network.

On the Add a virtual hard disk screen, select the Use an existing virtual hard disk radio button, and click Browse.

On the Select virtual hard disk dialog box, navigate to the folder where you extracted the .vhd and .vmc virtual machine files. Select the .vhd file and click Open.

Select the Enable Undo Disks check box.

NOTE: The Enable Undo Disks option allows you to return to the initial settings that exist when you first set up the virtual machine in Virtual PC. This is helpful because the versions of Windows in these virtual machines are not activated. They are essentially in trial mode. From the Microsoft site:

“You may be required to activate the OS as the product key has been deactivated. This is the expected behavior. The VHDs will not pass genuine validation. Immediately after you start the Windows 7 or Windows Vista images they will request to be activated. You can cancel the request and it will login to the desktop. You can activate up to two “rearms” (type slmgr –rearm at the command prompt) which will extend the trial for another 30 days each time OR simply shutdown the VPC image and discard the changes you’ve made from undo disks to reset the image back to its initial state. By doing either of these methods, you can technically have a base image which never expires although you will never be able to permanently save any changes on these images for longer than 90 days.”

We will explain later in this article how to undo changes and reset the virtual machine to the initial settings.

Click Create.

You should see a .vmcx file in the Virtual Machines folder in the Explorer window that opened when you started Virtual PC.

To open the virtual machine, select the .vmcx file and then click the arrow button next to the Open button that becomes available. Select Windows Virtual PC from the drop-down menu.

Two users display on the virtual machine screen during boot up. Each virtual machine has two users, but only one seems to work. Choose the following usernames for each of the virtual machines:

IE8 in Windows 7: IEUser

The Windows Activation dialog box displays saying that the activation period has expired. Click Cancel in the lower, right corner of the dialog box.

The Microsoft Security Essentials dialog box may display. Click Close.

Once Windows has started in the virtual machine, click the Internet Explorer icon on the Taskbar to open IE.

IE opens. You can set your default home page and view any web pages you need to test in this version of IE.

You can check the version by selecting About Internet Explorer from the Help menu.

To close the virtual machine, select Close from the Action menu.

In the Windows Virtual PC dialog box, select Shut down from the drop-down list. If you want Shut down to be the default option, select the Make it the default and don’t show this message again check box. Click OK.

You can change the settings for a virtual machine once it is shut down. To do so, select the .vmcx file for the virtual machine you want to change. Click Settings on the toolbar in Explorer.

If you are getting to end of your 30-day trial period in your Windows virtual machine, you can reset the virtual machine to the initial settings, therefore resetting the trial period. To do so, select Undo Disks in the list on the left of the Windows Virtual PC Settings dialog box. Make sure the Enable Undo Disks check box is selected and then click Discard changes.

A warning dialog box displays. To continue resetting the virtual machine settings, click Continue. Remember that any changes you made to the Windows system in your virtual machine will be lost.

You are returned to the Settings dialog box. Click OK to close it.

You can install IE8 or IE9 in the IE7 virtual machine. There are icons on the desktop to easily install either version. Remember, however, that installing IE8 or IE9 replaces IE7.

In the IE8 virtual machine, you’ll find the file to install IE9 in the C:\Internet Explorer Versions directory.

Once you have opened the virtual machine once, the login process is a little different. The following dialog box displays the next time you open the virtual machine.

Click IEUser and enter “Password1” in the edit box. Click OK.

A dialog box displays while the integration features of the virtual machine are enabled.

The virtual machine opens and you can run IE.

Side Note:

2. If you install a later version of IE in one of the virtual machines, it replaces the earlier version. If you need to run all three versions, create a virtual machine for each version.

## Saturday, April 19, 2014

### Crowdpruning for evolutionary algorithm

Make use of crowd pruning to increase diversity

Nsga-ii use crowd pruning for pruning the excessive items (more than n), it prefers things at less crowded areas. (crowd pruning)

IBEA (indicator-based)

Tixati

### Record slides to pdf from camera

1. Batch Rotate - Right click the images and select "Rotate Clockwise" or  "Rotate counterclockwise"
2. Batch crop -
File > Preferences > Special, Uncheck Update PPI on Crop (If not it will appear to small after the pdf merge)
Edit  > Synchronize Crops, to get the selection apply to all slides.
3. PDF Merge - Select the images and right click and choose "Combine files in Acrobat"

4. Reduce Image Size (for Adobe XI) - Choose Save as Others > Reduced Size PDF.

## Wednesday, April 2, 2014

### Magento

Install with IIS

Successful e-commerce involves a long list of to-do's, from
payment methods, shipping methods, products, content, e-mail templates, forms,

and much more.

Networks
Exchanges
Supply side platforms (SSP)
Demand Side platforms (DMP)
Data management platforms (DMP)

Real Time Bidding

IPOnline

DSP->DMP
<100ms

Jscamp.asia
NUSHACKERS

text-to-speech synthesizers

### Yii

how to change cwidget->how to create a theme
how to validate
user roles
how to change the site login

site/index.php and so on is the default
'components' => array(
'user' => array(
(
)
),

110 (drop down list)
remember to set this
<?php
$yii='/wwwroot/framework/yii.php';$config=dirname( FILE ).'/protected/config/main.php';

With this con guration, we can access the DB connection object using Yii::app()->db
at any place in our code. Note that Yii::app() returns the application instance that we
create in the entry script.

$duration=$this->rememberMe ? 3600*24*30 : 0; // 30 days
Yii::app()->user->login($this->_identity,$duration);

validation rules set in models rules method

<?php echo CHtml::activeDropDownList($post,'status',Lookup::items('PostStatus')); ?> Tag::model()->updateFrequency($this-> oldTags, $this->tags); access controller$dataProvider=new CActiveDataProvider('Post', array(
'pagination'=>array(
'pageSize'=>Yii::app()->params['postsPerPage'],
),
'criteria'=>$criteria, )); <?php$this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider, 'itemView'=>' view', 'template'=>"fitemsgnnfpagerg", )); ?> cgridview <?php$this->widget('CAutoComplete', array(
'model'=>$model, 'attribute'=>'tags', 'url'=>array('suggestTags'), 'multiple'=>true, 'htmlOptions'=>array('size'=>50), )); ?>$this->redirect(array('index'));

smartgit
open project
stage
commit
push to

C:\wamp\www\emplify\api\protected\views\layouts\main.php

Yii::app()->params['basetitle']