Tech Sharing

Tech Sharing


Posts Tagged ‘ Programming ’



Microsoft today launched PowerApps, a new service that allows business users to easily create a basic mobile or Web-based app without requiring codes.

Available in preview from today, the idea behind it is to take more business apps to mobile, instead of being tied to the PC as they have been traditionally.

Users can access data from cloud services like Office 365, Salesforce, Dropbox or other on-premises systems through PowerApps and use that information to create their app.

For example, if you export a file from Salesforce tracking employees performance, you could create an app to follow that, instead of exporting and analyzing a file every week.

PowerApps also comes with sample apps and templates, so users don’t have to come up with an a design or layout from scratch.

The apps are designed on a PC and can then be accessed on-the-fly through the PowerApps app for iOS, Android and Windows Phone. Apps can be shared with other people through a URL link and they can collaborate on the project as well.

Microsoft’s Corporate Vice President of app platform Bill Staples said in a statement today that the aim of PowerApps is to bridge the innovation gap in the business apps sector.

And while Microsoft may not be the first to come up with this idea, it’s already at an advantage as one of the most recognizable business brands in the world and as first choice for many in-office software around the globe.

The company has not released pricing information while the service is still in preview.

1. You become the computer repair guy.

Can you fix my computer
Truth: Most of the time you just Google the problem.

2. You suddenly forget how to code because… Stack Overflow is down.

3. When you change one line of code.

When you change one line of code

4. When you try to solve a bug.

Fixed a bug but more bugs come out

5. End user have no idea how to use your software.

end user

6. Critical issue… cannot reproduce.

Can't reproduct bug

7. JavaScript.

8. When your manager thought more developer means faster development.

When manager thought more developer means faster

9. More tasks on Friday afternoon.

More tasks on Friday afternoon

10. Hey can you please add a button before it goes live?

When client wants to change requirements at last minute

11. CSS in a nutshell.


12. This code looks like crap, let me refactor it.

Code refactoring

13. When you try to fix something else’s code.

When you try to fix something elses code

Congratulations, it’s now your problem!

14. Everyone thought you are a hacker.

Everyone thought you are a hacker

15. When you read other people’s code.

Reading other people's code

16. When you are given 2 days instead of 3. Because you don’t have leadership skills.

When you have 2 days instead of 3.

17. This sums up programming.

Sums up programming

Using web service is one of the good solution when you try to consume 3th party or integrate your system with other system without knowing how their internal logic.

When you try to call the web service for the first time, CF actually will chace the web service by using the web service description (WSDL) that response from the target server to create a java proxy/stub based on that, than it will be reused for the following call from CF to the same web service again.

CF doing that is actually try to improve the performance for the web service calling, but it come with some disadvantage when the target web service being changed by adding a new require parameter or return an extra parameter, your script will trigger an error message, this is because your CF have no knowledge about the new changing make on the target site. It will continue to use the older cached proxy/stub.

To resolved this problem, you may need to manually refresh the cache that created by the CF in the early call to inform CF to refresh it’s cache of that proxy stub.

There are more than 1 way that you can doing that, the following are the sample 4 difference way to achieve the same result:

I. ColdFusion Administrator



II. Programatically:

In ColdFusion 8, you have two options:

i. Cfinvoke’s refreshWSDL attribute:

<cfinvoke webservice="#wsdl#" method="method" returnvariable="rv"<br />refreshWSDL="yes"><br />	<cfinvokeargument name="arg" value="1"/><br /></cfinvoke>


ii. Cfobject’s arguments structure

<br /><cfscript><br />    wsargs = structnew();<br />    wsargs.refreshwsdl="yes";<br />    somevar = createobject("webservice","http://[server]/webserviceurl]",wsargs);<br />    ...<br /></cfscript><br />

In ColdFusion 7, however, you can use the following solution:

<cfset wsAddress = "http://your.web/service/url.cfc?wsdl"><br /><!--- CF7 ---><br /><cfset createObject("java", "coldfusion.server.ServiceFactory").<br />XmlRpcService.refreshWebService(wsAddress) />



Merging Two Structs in ColdFusion

By on November 26, 2012

The following script showing how to merge 2 ColdFusion structure into one. The following sample showing 2 difference structure which each has two keys

<!--- Struct1 have 2 key: FirstName and Last time --->
<cfset struct1={firstname="Adam" ,lastname="Presley" }>

<!--- Struct 2 have 2 key: FirstName and age --->
<cfset struct2={ firstname="Michael" ,age="33" }>

<!--- Using a nifty ColdFusion method we can mash the two together in a single line of code. --->

<cfset structAppend(struct1, struct2) /> <!--- <cfset struct1.putAll(struct2) /> --->

<cfdump var="#struct1#">
Notice the commented out version. That is the underlying method to do the same thing as StructAppend.

The structure result after merge

There are always more than single methods to accomplish the same job in programming language. To loop through the letters from A to Z in ColdFusion there are also more than one way, but I personally found out the following 2 methods are simpler and strain forward.


Hardcode the A to Z into a list and just loop over it






<cfdump var=”#strLetter#”>





The other way to loop through the letters is using the ASCII value from A to Z. We first convert the A and Z to ASCII, than just use the number to loop through the rest and convert it back to char to get back our result.




from=”#Asc( ‘A’ )#”

to=”#Asc( ‘Z’ )#”



<!— Get character of the given ascii value. —>

<cfset strLetter = Chr( intLetter ) />


<cfdump var=”#strLetter#”>




Please feel free to share the way you usually use or you may found out any other better way to do the job.

Useful Coldfusion Resources

By on November 24, 2011

This list is intended for developers new to ColdFusion, or to developers already using CF but looking for additional resources or information.

Adobe ColdFusion Resources


ColdFusion Documentation


Essential Resources


ColdFusion IDEs


Open Source CFML Engines


MVC Frameworks


ORM and Dependency Injection Frameworks

This TEDTalk was given by Thomas Suarez at TEDxManhattanBeach. Thomas is in the 6th grade at a middle school in the South Bay, and he’s made several apps for the App Store and established his own company,CarrotCorp.


Besides his fantastic presentation skills, Thomas is an amazing testament to how the younger generation is shaping the world of technology. What a smart kid. Steve Jobs would be very proud.


And we’re downloading his app, Bustin Jieber, as we speak. It looks fun.

Pausing scheduled tasks in CF8

By on January 14, 2011

This is a pretty good function for CF8 administrator where you can pause your schedule task whenever you like to. Not like the previous version of Coldfusion where the administrator only can only edit or delete the scheduled task.

With this function exists, you can pause it wihtout editing anything like what you did last time by changing the url to something else or change to date to expire the scheduled task.

Currently on running schedule task display

Currently pause scheduled task display

CFMX 6.1 scheduled task display without the pause and resume button

Last whole week working with a project which involve the integration with 3th party API through the HTTPS secure channel using coldfusion CFHTTP. I come across with the following error message:

I/O Exception: peer not authenticated

Try to Google it for some time and find out that I need to import the 3th party certificate into my Coldfusion server by using some keytool certificate import tools. Trying few times but still can’t get it work until I found a blog which showing a very effective way and free tools for import the certificate.

These instructions are for Windows based machines but the concepts and tools should work on Mac or Unix based platforms.

1. Install tools

Download and install Portecle JVM certificate manager

( You do not need the source (src) version

The easiest way to install Portecle is to unzip the contents of the zip file to a directory such as C:Program Filesportecle-1.5 Then find the file “Portecle.jar”, right click it and send it to your desktop as a shortcut. You can then use this shortcut to launch Portecle. (optionally you can also change the name of the shortcut and change the icon to use the portecle.ico file for the icon)

2. Extract the certificate

The easy way to get the certificate is ask from the issuer, but if you unable to do so, you may have another alternative solution which you open the https page in your browser and double click on the lock logo at bottom left of the browser (the lock appear just beside the url addrss for Google Chrome)

Double click on the lock –> click the certificate information button –> go to details –> click the copy to file button –> Follow the wizard and select the base-64 encoded X.509 (.cer) format –> save the file

3. Install Certificate to Java Virtual Machine and/or ColdFusion server

Start Portecele.

On the [File] menu, select [Open Keystore File] navigate to and locate the keystore you are interested in.

For many java installations this will be located in your “jrelibsecurity” directory and might be named “cacerts”

For the ColdFusion 8 default developer install the path will be “c:coldfusion8runtimejrelibsecuritycacerts”

You will have to enter the password for the keystore. The default password is “changeit”

Now you are ready to import the key.

From the [Tools] menu select [Import Trusted Certificate]

Navigate to and locate the certificate you saved and click [Import]

You will need to reenter the keystore password.

You can change the alias if you desire but I would recommend leaving it as the default

Note: You may also be prompted to “trust” the certificate.

Click on the save button at the top of the portecle

4.       Restart you Java Virtual Machine/coldfusion application server.

For ColdFusion not installed on top of JRun you just need to restart the ColdFusion service. If you are running on top of JRun you also need to restart JRun.

Up to now, you already successfully import your partner certificate to your coldfusion/java server.

Please feel free to leave your suggestion if any. Click here for more information regarding Protecle

Google for long time regarding how to hide the HTTP header for IIS in order to mask the server identity and finally found out this tools call URLScan.
Basically URLScan is an ISAPI filter that allows Web site administrators to restrict the kind of HTTP requests that the server will process. By blocking specific HTTP requests, the URLScan filter prevents potentially harmful requests from reaching the server and causing damage.
Actually most of the features that provided by URLScan are included in IIS but not the Remove Server Header features as microsfot find out that this is not an important issue that that’s no real security benefit of include in IIS. But that’s some marketing purposes why microsoft not encourage web master to hide the identity.

How to hide the IIS identity:

  1. download the URL scan
  2. Install the URL scan in your server.
  3. go to the URLScan config file at C:WINDOWSsystem32inetsrvurlscanUrlScan.ini
  4. Change RemoveServerHeader=1 (by default is 0)
  5. Save the file
  6. Restart your IIS
  7. Check on your header (
For more detail on the URLScan and the features, you may easily get a lot of information by Google on URLScan