Blog Stats
  • Posts - 25
  • Articles - 1
  • Comments - 160
  • Trackbacks - 0

 

Thursday, June 26, 2014

Useful git instructions / commands


Concept of git 


In a git project, there will be two branches for each branch that you have :
one is local branch and other is remote branch
you always commit to your local branch and 
when you push the changes will get updated in the remote branch.
(if we dont do a push, the other person working in same project/branch will not get the changes at all)
if the other person in same project/branch needs to get the changes, then he/she has to do a git pull or git pull --rebase from the remote branch.

git commands that will be used in order 

 

git clone "git url" - creates new repo
git fetch origin - bring all remote branches
git checkout <branchname> - checks out the branch that you need
git branch - checks which branch ur in
git status -s : lists what are the pending changes
git pull orign <branchname> - first time
git add "filename"
git commit -m "Message"
git pull --rebase origin <branchname> - make sure that ur branch is up to date - updated from the remote

This is for getting all changes in master 


git pull --rebase origin master -- this is to bring all changes from your master branch
git pull --rebase origin <branchname> -- this is to bring all changes from your master branch

if conflict exists, see whats the conflict and resolve them 


git status -s : it will list all changes
look for "UU" - this means, the files with UU status has conflicts
open those files 
look for "<<<<" or ">>>>" or "===="
make necessary changes in the file and save it
git add "filename"
git status -s : check if the UU has changed to "M" or some other meaningful status
git rebase --continue - this will continue the rebase operation
If you get some message like "Nothing to continue"
git add -A -this will add all the files that are modified/added
git rebase --continue - this will continue the rebase operation
if you still get the above error
git rebase --skip
finally after going thru this rebase and conflict fix loop
if you do
git rebase --continue
you will see the message "No rebase in progress?"
it means you dont have any pending rebase
git branch - this will show you ur current branch. if the rebase did not succeed, you will see *(nobranch)
in case you want to abort your rebase operation:
git rebase --abort

git push origin <branchname> - this pushes your changes to ur remote branch

 

To merge to master 


git checkout master
git pull --rebase origin master
git merge <branchname>
if conflict exists, resolve them (same procedure as above)
git push origin master

 

for creating a new branch off ur current branch 

git checkout -b <newbranchname> 

Monday, June 23, 2014

How to cut paste in Mac OS X


The cut and paste works little differently in mac when compared to windows.

Usually we try to give the command Ctrl + X for cut instead of Ctrl + C while (copying or trying to cut from the source directory / folder)

But in Mac, this command is specified at the time we paste to the target, meaning : while doing copy or cut from source, its always copy : Command + C

But while pasting, it differs, it should be : 

(If the intension is cut) : Command + Alt (Option) + V (It means after pasting to destination, it will remove from source path)
(If the intension is copy) : Command + V


Sunday, August 18, 2013

How to write to NTFS on Mac OS (free)


How to write to NTFS on Mac OS

This is fully free and you dont need any purchased software to do this :)

Download this file and unzip it :- 
( I have downloaded all these softwares and kept together as a zip for easy downloading)



Install the following in order :- (Installation instructions for Mac OS X Mountain Lion 10.8.4)

1.MacFuse-Tuxera-2.2.dmg
2.ntfs-3g-2010.10.2-macosx.dmg
3.fuse_wait-1.1.pkg - Expand and install
4.osxfuse-2.6.1 - Enable compatibility layer while installing.dmg 

(As the 4th file name says, during the installation choose the option "Enable Compatibility Layer")

Restart if required

This will help you in solving the following ntfs 3g error :-

dyld:library not loaded: / use/local/lib/libfuse2.bylib
referenced from : / use/local/bin/ntfs-3g
reason:image not found


Go to Disk Utility :- (Spotlight search on top right of your Mac -> Type "Disk Utility")

If you have BootCamp enabled :-
You can see Bootcamp on the left
Right click and say mount

Same way for other USB or hard drive that you have connected, it will show in disabled state.
Right click and say mount

and you are done.

Now you will be able to write to NTFS on Mac :)

Sunday, April 7, 2013

Nodejs vs php



PHP vs NodeJS


Where to use Nodejs and PHP


Here are some quick examples of different programming situations and which language you should probably go with.

  • Are you building some sort of daemon? Use Node.
  • Are you making a content website? Use PHP.
  • Do you want to share data between visitors? Use Node.
  • Are you a beginner looking to make a quick website? Use PHP.
  • Are you going to run a bunch of code in parallel? Use Node.
  • Are you writing software for clients to run on shared hosts? Use PHP.
  • Do you want push events from the server to the client using websockets? Use Node.
  • Does your team already know PHP? Use PHP.
  • Does your team already know frontend JavaScript? Node would be easier to learn.
  • Are you building a command line script? Both work.
Courtesy :- http://thomashunter.name/blog/php-vs-nodejs/

Thursday, November 8, 2012

This virtual machine appears to be in use .vmdk - how to resolve?


Issue :-
This virtual machine appears to be in use.  If this virtual machine is already in use, press the "Cancel" button to avoid damaging it. If this virtual machine is not in use, press the "Take Ownership" button to obtain ownership of it.

Solution :-
you will have .lck folders in the directory where you will have the .vmdk file. Delete them and try again. It will work

Sunday, August 26, 2012

Auto increment in postgres


While creating the table you can see a data type called Serial or BigSerial (Note that these two options will not be available when you modify a column thats already created. You can see these options only when you create a column in pgAdmin III)

In create table script you need to give the SQL command like this :-
"ID" serial NOT NULL

Friday, May 25, 2012

How to Overcome or fix MIXED_DML_OPERATION error in Salesforce APEX without future method ?


How to Overcome or fix MIXED_DML_OPERATION error in Salesforce APEX without future method ?

MIXED_DML_OPERATION :-
one of the worst issues we have ever faced :)

While trying to perform DML operation on a setup object and non-setup object in a single action you will face this error.

Following are the solutions I tried and the final one worked out :-
1. perform the 1st objects DML on normal apex method. Then Call the 2nd objects DML through a future method.
    Drawback :- You cant get a response from the future method as its context is different and because its executing asynchronously and that its static.

2. Tried the following option but it didnt work :-
    1. perform the dml operation on the normal apex method.
    2. tried calling the 2nd dml from trigger thinking that it would be in a different context. But it didnt work.
    
3. Some suggestions were given in some blogs that we could try System.runas()
   Unfortunately that works only for test class.
   
4. Finally achieved it with response synchronously through the following solution :-
    a. Created 2 apex:commandbuttons :-
        1. <apex:commandButton value="Save and Send Activation Email" action="{!CreateContact}"  rerender="junkpanel" oncomplete="callSimulateUserSave()">
            Note :- Oncomplete will not work if you dont have a rerender attribute. So just try refreshing a junk panel.
        2. <apex:commandButton value="SimulateUserSave" id="SimulateUserSave" action="{!SaveUser}"  style="display:none;margin-left:5px;"/>
        Have a junk panel as well just for rerendering  :-
        <apex:outputPanel id="junkpanel"></apex:outputPanel>
    b. Created this javascript function which is called from first button's oncomplete and clicks the second button :-
                function callSimulateUserSave()
                {
                    // Specify the id of the button that needs to be clicked. This id is based on the Apex Component Hierarchy.
                    // You will not get this value if you dont have the id attribute in the button which needs to be clicked from javascript
                    // If you have any doubt in getting this value. Just hover over the button using Chrome developer tools to get the id.
                    // But it will show like theForm:SimulateUserSave but you need to replace the colon with a dot here.
                    // Note :- I have given display:none in the style of the second button to make sure that, it is not visible for the user.
                    var mybtn=document.getElementById('{!$Component.theForm.SimulateUserSave}');                
                    mybtn.click();
                }
    c. Apex Methods CreateContact and SaveUser are the pagereference methods which contains the code to create contact and user respectively.
       After inserting the user inside the second apex method you can just set some public Properties in the page,
       for ex:- created userid to get the user details and display in the page to show the acknowledgement to the users that the User is created.

Wednesday, August 17, 2011

The protocol 'net.msmq' is not supported


The protocol 'net.msmq' is not supported

If you get this error you need to do the following steps :-

You can just do the following if everything is right in place for you :-

1. Open IIS -> Your Website -> Advanced Settings -> Enabled Protocols

       This will have only http. You need to add net.MSMQ separating it by a comma like this : http,net.MSMQ

2. If it still doesnt work you need to do the following for activating MSMQ in your machine :-

  • Open visual studio command prompt as administrator
  • Paste the below line as a single command and press enter

%windir%\system32\inetsrv\appcmd.exe set site "Default Web Site" -+bindings.[protocol='net.msmq',bindingInformation='localhost']

(Remember: If you have deployed it in a different Site in IIS you need to change the site name in the above command) 

 

If you are still having problems you can follow the steps given in the below URL :-

http://msdn.microsoft.com/en-us/library/ms752246.aspx

Saturday, April 16, 2011

How to Enable USB Port through Regedit in Windows if it is blocked


1. Click Start, and then click Run. 2. In the Open box, type regedit, and then click OK. 3. Locate, and then click the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsbStor 4. In the right pane, double-click "Start". 5. In the Value data box, type "3" (without quotes), click Hexadecimal (if it is not already selected), and then click OK. Note :- if 3 is entered it will open the port and if 4 is entered it will close the port. 6. Quit Registry Editor.

Thursday, December 2, 2010

An Annoying bug in salesforce winter 11 release and how to delete apex classes and triggers in production


There is an annoying bug in salesforce winter 11 release

MyProfilePageController.cls

System.QueryException: List has no rows for assignment to SObject

Class.MyProfilePageController.testSave: line 78, column 35 External entry point

 

This is also the method for deleting Apex Classes and Triggers from Salesforce Production

 

(Note : You cannot delete an apex class or Trigger from Salesforce Production through changesets. Only way is to use Force.com IDE)

 

1. Install and Open Force.com IDE (don't install if you have already done)

2. Create a new Force.com Project connecting to Sandbox (providing the credentials for sandbox including the security token)

3. Delete the MyProfilePage page and the MyProfilePage meta xml under Pages and also delete the MyProfilePageController class and the MyProfilePageController meta xml under classes. (Right click delete). It will ask you whether you need to delete from the sandbox server too. Say No. Click Ok.

4. Right click on Src or the root folder of your project -> Force.com -> Deploy to server

5. Provide production server credentials

6. from the list shown Deselect all

7. Sort by type

8. Navigate to Pages and Check the checkboxes next to MyProfilePage page and the MyProfilePage meta xml (these will be shown in red as you have deleted  it locally )

9. Navigate to classes and Check the checkboxes next to MyProfilePageController class and the MyProfilePageController meta xml (these will be shown in red as you have deleted  it locally )

10. Click Validate and check whether it gives success. (It will.. if u dont have any problems in any other class )

11. Then Click Next. It will delete the salesforce class and page which has the bug and you can proceed with your further deployments. ( In case if it dint succeed, try deleting the above mentioned 4 files (in point no. 3) from the folder where you have mapped the sandbox project and run through all the steps from the point no. 4).

 Here are the supporting links :-

http://sites.force.com/ideaexchange/apex/ideaview?id=08730000000K1QLAA0

http://boards.developerforce.com/t5/Force-com-Sites/Bug-in-SFDC-provided-test-method-for-MyProfilePageController-cls/td-p/209169

 Salesforce is still working on it to fix it from their end during the next release.

 

 

 

Copyright © sathya