Friday, May 23, 2014

angular module ui.router error

When you have an error as below in the console for Module ui.router is not available

Error: [$injector:modulerr] Failed to instantiate module ui.router due to: Error: [$injector:nomod] Module 'ui.router' is not available! You either misspelled th......1)

1) Add the following ui module dependencies in bower.json
"dependencies": { "angular": "1.2.15", "angular-ui-router": "~0.2.10", "angular-ui-bootstrap-bower": "~0.11.0",

and then,

2) C:\Users\dsunders\testShare>bower install

Thursday, February 13, 2014

How to git commit --amend


If you have multiple commits, you can either squash your commit or amend your commit. Below are the steps to amend your commit

myname@myname-WS /c/Users/myname/mynames-alfresco-dev (ta1747)
$ git add .

myname@myname-WS /c/Users/myname/mynames-alfresco-dev (ta1747)
$ git commit --amend

This will open the vi editor, change the commit message and then exit [wq]

[ta1747 cb03152] ta1747 - Change the upload URL
 2 files changed, 5 insertions(+), 3 deletions(-)

myname@myname-WS /c/Users/myname/mynames-alfresco-dev (ta1747)
$ git log
commit cb0315286b26e69f8d58b4262e35394101e18150
Author: David Sundersingh
Date:   Thu Feb 13 11:53:06 2014 -0800

    ta1747 - Change the upload URL


myname@myname-WS /c/Users/myname/mynames-alfresco-dev (ta1747)
$ git diff rewrite
myname@myname-WS /c/Users/myname/mynames-alfresco-dev (ta1747)
$ git push origin +ta1747

Counting objects: 41, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (20/20), done.
Writing objects: 100% (21/21), 1.64 KiB | 0 bytes/s, done.
Total 21 (delta 14), reused 0 (delta 0)
To git@gitserver:myname/alfresco-dev.git
 + 16ff671...cb03152 ta1747 -> ta1747 (forced update)

How to resolve git merge conflicts: How to git rebase --skip if git rebase --continue does not work

myname@myname-WS /c/Users/myname/mynames-alfresco-dev (ta1747)
$ git rebase rewrite
First, rewinding head to replay your work on top of it...
Applying: Change upload URL
Using index info to reconstruct a base tree...
M       src/webapps/alfresco/WEB-INF/classes/alfresco/extension/templates/webscripts/com/mycompany/se/rewrite/src/models/attachment.js
:11: trailing whitespace.
        // change the URL to avoid login authentication
warning: 1 line adds whitespace errors.
Falling back to patching base and 3-way merge...
Auto-merging src/webapps/alfresco/WEB-INF/classes/alfresco/extension/templates/webscripts/com/mycompany/se/rewrite/src/models/attachment.js
CONFLICT (content): Merge conflict in src/webapps/alfresco/WEB-INF/classes/alfresco/extension/templates/webscripts/com/mycompany/se/rewrite/src/models/attachment.js
Failed to merge in the changes.
Patch failed at 0001 Change upload URL to /share/proxy/alfresco
The copy of the patch that failed is found in:
   c:/Users/myname/mynames-alfresco-dev/.git/rebase-apply/patch

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".


myname@myname-WS /c/Users/myname/mynames-alfresco-dev ((f8bf9f1...)|REBASE 1/1)
$ git status
# HEAD detached at f8bf9f1
# You are currently rebasing branch 'ta1747' on 'f8bf9f1'.
#   (fix conflicts and then run "git rebase --continue")
#   (use "git rebase --skip" to skip this patch)
#   (use "git rebase --abort" to check out the original branch)
#
# Changes to be committed:
#   (use "git reset HEAD ..." to unstage)
#
#       modified:   src/webapps/alfresco/WEB-INF/classes/alfresco/extension/templates/webscripts/com/mycompany/se/rewrite/src/views/browse-files/browse-files-template.ftl
#
# Unmerged paths:
#   (use "git reset HEAD ..." to unstage)
#   (use "git add ..." to mark resolution)
#
#       both modified:      src/webapps/alfresco/WEB-INF/classes/alfresco/extension/templates/webscripts/com/mycompany/se/rewrite/src/models/attachment.js
#

myname@myname-WS /c/Users/myname/mynames-alfresco-dev ((f8bf9f1...)|REBASE 1/1)
$ git add .

myname@myname-WS /c/Users/myname/mynames-alfresco-dev ((f8bf9f1...)|REBASE 1/1)
$ git commit -m "Resolve conflicts while rebasing file upload URL changes"
[detached HEAD 16ff671] Resolve conflicts while rebasing file upload URL changes
 2 files changed, 6 insertions(+), 4 deletions(-)

myname@myname-WS /c/Users/myname/mynames-alfresco-dev ((16ff671...)|REBASE 1/1)
$ git rebase --continue
Applying: Change upload URL to /share/proxy/alfresco
No changes - did you forget to use 'git add'?
If there is nothing left to stage, chances are that something else
already introduced the same changes; you might want to skip this patch.

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".


At this stage git rebase continue did not work, so instead use git rebase --skip

myname@myname-WS /c/Users/myname/mynames-alfresco-dev ((16ff671...)|REBASE 1/1)
$ git rebase --skip

myname@myname-WS /c/Users/myname/mynames-alfresco-dev (ta1747)
$ git diff rewrite

Since I already had a open merge request, this push will update the existing merge request

myname@myname-WS /c/Users/myname/mynames-alfresco-dev (ta1747)

$ git push origin +ta1747 (This forces the update similar to git push -f)

Thursday, June 10, 2010

Flash Security Error #2170: Security sandbox violation

In one of my recent Flex projects with Cisco, the flex app has to connect to salesforce to utilize Force.com Web service APIs. From the Development Environment, that is, from the Flex Builder there is no problem in connecting to Salesforce either over http or https. However, once the Flex app is published to one of the Cisco's IIS or Tomcat Server, the Flex app could not connect to Salesforce complaining Security sandbox violation (not the Salesforce sandbox, but the Flash player sandbox).

Whenever there is a security violation, the first thing that comes to mind is the crossdomain.xml that should be properly configured and set-up at the salesforce end.
Salesforce had the crossdomain.xml in both their http and https servers.
http://test.salesforce.com/services/Soap/u/crossdomain.xml
http://test.salesforce.com/services/Soap/crossdomain.xml
https://test.salesforce.com/services/Soap/u/crossdomain.xml
https://test.salesforce.com/services/Soap/crossdomain.xml

This is the content of the crossdomain.xml file in salesforce.com
- < cross-domain- policy>
< allow-access- from domain="*" secure="true" />
< allow-http- request-headers- from domain="*" headers="*" secure="true" />
< /cross-domain- policy>

I tried my swf accessed from both http and https. I still get the same error. Error #2170: Security sandbox violation

I gave permission for the swf file to allow access to Salesforce URL in swf settings > Global security settings panel. I still get the same error. Error #2170: Security sandbox violation

Thanks to one of the coders in the flex forum, he alerted me of the new security feature that got introduced in Flash Player 10. The above solution would have worked great in Flash player 9, bcos in version 9, the flash player would automatically look at the root crossdomain.xml in salesforce.com. If it is not there, it would look at the next crossdomain.xml in /root/at this folder1/crossdomain.xml

But in Flash player 10, we have to load crossdomain file explicitly in the Flex code. Read here for more info:
http://www.adobe.com/devnet/flashplayer/articles/fplayer9_ security_03.html

I have added the following code in my flex app.

private function setupSecurity():void {
Security.loadPolicyFile("https://test.salesforce.com/services/Soap/u/crossdomain.xml");
}

Did it work? No! Why? I have deployed the Flex app on the Cisco's IIS server which is a http server. So the Flex app failed to connect saying the same error because I was trying to connect to http IIS server to the https Salesforce server. Conflict of Interest! Either http to http connection is possible. Or https over https is possible. So before installing the https server in Cisco's IIS server, I tried http over http (beware: this would send the password in clear text. You could see the password in firbug in clear text). This is just a test to find out if it would work. Yes! it worked. Now Cisco has to buy a SSL certificate. I did a research to find it costs $1500 for a year!

Please check this URL to buy the certificate :
https://ssl-certificate-center.verisign.com/process/retail/product_selector;jsessionid=4DF6BC5DE74707E0E5B69747B6131232?uid=e1494c681c05e7c3229fd5030d7f1fc0&product=GHA002

Before making this purchase, I need to prove if the https to https works as well. Microsoft is handy for this. They have a free self sign certificate to be installed in the IIS server. Check this URL : http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/993a8a36-5761-448f-889e-9ae58d072c09.mspx?mfr=true

I had to install this self signed SSL on my laptop first. I had IIS Server running on my laptop. After I installed this, https flex app over https salesforce worked!!

When I installed the same solution in Cisco's IIS server, it worked great!!

Here's a screen shot of this flex app which connected to salesforce and retrieved the data to show the relationship in Yworks.