Saturday, January 21, 2017

Xcode 8.2 Simulator Crash When Save Screen Shot - Alternate way to take Screenshot of iPhone simulator

I don't know what went wrong with my Xcode. Recently I was publishing an app in iTunes connect and for that I needed iPhone 7 screen shot. I opened simulator and run and app and tried to capture screenshot with Command + S and it crashed the simulator with following error and screen shot file was empty.



It shows some error related to some library of SwiftFoundation. I was not sure about this error. So first thing what I did is report it to apple and then tried few things like. Restarting simulator couple of times and restarting Xcode couple of times. But it didn't work. So may be it's related to SDK update. I updated the latest SDK but still it was not working. So at last I give it to Apple to solve the problem but I needed that screen shot. So here is alternate way to take Screenshot of iPhone simulator.

With simulator running. Select Go to Edit menu and Select Copy Screen.



This will copy current screen of simulator. Now open the preview and go to File and Select New From Clipboard.



And it will give you new image with copied screen of your simulator, now save it and use it with Preview. Hope this helps you.

Thursday, January 19, 2017

Magento 1.9 Ajax Login with Social Connectors

We are using Magento 1.9 right now for one the project as Magento 2.0 has certain performance issue and some of the extensions are not yet available for Magento 2.0. In this project we have a requirement to add Ajax Login with Social connector options which includes, login with Facebook and Login with Google. Problem we faced is, there is no free extension available in market which allows both ajax login and give you social connector options. So what I did is I installed two different extensions for Ajax Login and Social Connectors and then merged code from social connector plugin to Ajax Login plugin.

In this blog I am going to explain how you can do this.

First of you have to install following two plugins in Magento.

GoMage Social Connector
Ajax Login

With the first login you will get social login options in admin where you can configure your social networks like Facebook and Google and add necessary information like App id and redirect URL etc.

Once it's configured in admin, you will get Social Connectors option in login page like this.



But we need this options in Ajax Login Popup.




So to do this we will copy code for GoMage Extension to this. To do this go to.

app/design/frontend/base/default/template/digitalpianism/ajaxlogin

And open index.phtml file.

Add following code before buttons code.

<!-- Social Login -->
<a href="#" onclick="gomageSocialFBLogin();return false;" title="<?php echo $this->getText('facebook') ?>">
Login with Facebook
</a>

<a href="<?php echo $this->getUrl('gomage_social/google/login', array('_secure' => true, 'gs_url' => Mage::helper('core')->urlEncode(Mage::helper('core/url')->getCurrentUrl())));  ?>" title="<?php echo $this->getText('google') ?>">
Login with Google
</a>

That's it and now you will have social connector options in Ajax login.




I have just added basic designs, you can change it as per your requirements.

Wednesday, January 18, 2017

5 Things Programmers Don't Do or Hate to Do

I am a computer programmer and have been working in the IT industry since last 9 years. During this time I have realized many times that a programmer is mis interpreted by many who don't know exactly about programming and IT industry. There are certain myths in mind of non programmer persons that needs to be changed. This blog will explain 5 things that I have heard many times and I really hated to listen that. If you are a non IT person and reading this blog, just make sure next time you don't speak following things in front of computer programmer. If you are an IT person and reading this blog, just enjoy and and add a comment if you want to add something to this list.

Can you Fix my PC? Can you Fix my Windows?



This is the biggest mis understanding in mind of non IT people. They just believe that a computer programmer can repair any computer and can fix Windows. They can repair any part of computer including RAM and Hard disk and even Processor. Now this is a limit. How one programmer will know about hardwares? And hardwares like hard disk and processor is highly configured hardwares and need special environments and tools and skills to do that. It's not like open the CPU, take out hard disk, smashed hammers on it and done, it's repaired. Yes we can do small things like open CPU and adjust RAM and check for any loose connection and if that fixes the PC and then it's well and good. But beyond that we can not do anything. WE CAN NOT CREATE A COMPUTER

Same goes of operating system, if windows is corrupted or not working properly due to virus, a programmer can not fix it just like that. Operating system like windows are too much complex system and if its broken, it need to be repaired by expert who knows about it. Off course some programmers do know much about it and can fix the things but not all programmers can do it. So please spare us with this. 

WE ARE THE PROGRAMMERS AND WE DO NOT REPAIR PC AND WE DO NOT FIX WINDOWS

Do You Develop Websites?






No all the programmers do not just make websites , there are so many fields and functions in IT industry like mobile app, desktop app, cloud development, server admin etc. And all the programmers will have their own specializations. Some of the programmers create mobile app, some are experts in creating desktop applications. And anyways, internet is not just about websites, there is much more and for each field and functions, there are programmers who are expert in it.

Type Without Looking At Keyboard and Type it Faster




Programming is not just about writing stories, where we just have to type characters and alphabets and just numbers. Every computer language has strict syntax to follow when writing code and creating programs. 

For example, there should be semi colon ( ; ) at end of each statement when you are using PHP language. When we are writing a code we uses lots of characters like

: colon
; semi colon
( ) [ ] { } all type of brackets
, comma etc.

So we have to look down and see if we are using correct character. And we can not type faster while writing a code as when we are writing a code, we also have to think if it's correct or not and make sure there is no error or syntax error. So 

WE CAN NOT TYPE FASTER AND WE HAVE TO LOOK AT KEYBOARD.

Are You Writing Code All Nights?





Yes it's a fact that computer programmer works till late night or would like to work till late night but this is not usual scenario and we do not write code all nights. We are normal people and would like to rest like normal people do. We like to work till late night but not at a cost of our health and besides we are not machine that will work 24 hours a day with out any rest.


Do You Also Hack Computers?





A Big No, programmers are not hackers not even ethical hacking. Hacking needs good knowledge of computer hardwares and networks and not all programmers know about it. It needs some special skills and training to be a qualified ethical hackers. Yes some programmers do it for fun and out of curiosity but this is not something we do it regularly on day to day business. It's not our bread butter and besides hacking is illegal and none of the programmer would like to go on that way.