Saturday, 24 March 2018

Extract .zip directly to external hard drive in MacOS

Easily extract .zip file directly to External HDD / USB / External Storage instead of default SSD or HDD.


If you are having two storage in your Mac machine in which the default is having small storage space and other one is with large space then you obviously want to store files, large projects on big volume and your working softwares and compilers on default volume.
Below is the example demonstrated (storage for example purpose only).

  1. SSD (120 GB) - 
     2. HDD (External 500 GB) -  Archive.zip    ( <--- it's the zip to be extracted, and we want it to be extracted on this location only where the zip is present)

But when you click it to extract then it extracts to the default SSD storage at the location ~/Downloads/ with extracted folder named as "Archive".  (This is the actual problem we are facing when extracting the .zip file whose actual size is 100GB and we are having small storage of default SSD)

At this point we want to extract the .zip file to the external storage only.

Open the Terminal app from Spotlight search or from Applications -> Utilities -> Terminal and navigate to your folder where the .zip file is stored with "cd ~/locationOf/Acrchive.zip" and press Enter.

And extract the ZIP file with the OSX command line tool 

unzip /ExtrenalHDD/Folder/Archive.zip -d /Volumes/ExtrenalHDD/FolderName

In the above command after typing /Volumes press double Tab and you can see the list of Volumes present such as SSD, HDD, USB etc. The the second path  /Volumes/ExtrenalHDD/FolderName is the location where you want to extract the zip.

Thanks You





Sunday, 11 March 2018

List Of Trending Software Development Blogs

In the today's passion for technology every school or college student or any software professional who wants to learn software coding, searches online for extremely good blogs for practice.
Here are the list of top blogs which could be better for all those who want to learn Software development briefly.


The top 20 Software development blogs are listed below


1. Dzone
One of the best software development blogs is Dzone. Web, where you will find all necessary information about agile software development. Tutorials, guidelines, tools and software insights for beginners and experts. Hundreds of publications, over 1M members. Top topics: Agile, Big data, Cloud, Data base, Devops, Integraton, IOT, Java, Mobile, Performance, Security and many more.


A computer science portal for geeks. It contains well written, well thought and well explained computer science and programming articles.


Place for in-depth development tutorials and new technology trends. Here you will find latest information about Back-end, Web front-end, Mobile, agile project management, etc.


This blog is about software development & software architecture. Here you will find useful information about: Agile, Backend, IOS, Android, DDD, TDD, CI, SOLID, Unit testing, microservices, docker, natural language processing, Reactive, Javascript, PHP, Scala, Nodejs, Angularjs and many many more.

This blog has tutorials for iOS and Android developers. Tips and best practices for swift and mac lovers. Unit testing, Unity, C#, Json and many more.

Awesome blog for Agile lovers. It has some practical tips and approaches for agile software development; testing, integration, etc. Here you may find announcements, journal entries, status reports, news, trends, tricks and tips and many more.

Best place to find examples of clean code. Also, you will see DevOps tools and best software development practices.

Scotch is a web development blog discussing all programming topics. Most popular ones are: Javascript, Angular 2, Node.JS, Docker, PHP, etc.

This blog you will love if you have a good sense of humor as it’s posts often include funny asides on the human aspects of coding. Also you will find articles discussing recent advances in the tech world.

As you could guess from the name, here you will find all useful information about Docker. Case studies, tutorials, examples, updates, news and many more. Everything you need to be convinced using docker, but using it right.

Here you may actually learn Java online. You will find Android development tutorials, Java tutorials for beginners, Java books, Scala, Kotlin, Groovy and JRuby news, code examples and many more.

Useful blog with articles about Java, .NET, PHP, Javascript, C++ and many more.

Here it is a bit easy to guess again. This blog is about JavaScript, about React. All necessary tips and advices you may get there to be sure your Javascript project is going in the right direction.

In this blog engineers of Twitter share their case studies, their tips, their findings and pitfalls. This blog is based on real examples, real projects. Here you may really learn from one of the best engineer teams in the world and know which tools they use and which methodology they follow.

This blog is about Scrum; best practices and tools. Here you will find success stories, tutorials, examples, statistics and other useful articles to improve team’s productivity and efficiency of the project.

Again quite easy to guess that this blog is about Scala. Scala updates, Scala best practices, Scala tips and examples.


17. Devhumor
Yes, this one is related to software humor. Memes, pictures, jokes, code and other stuff from real life that make you laugh.

Offers daily posts of user-submitted examples of bad code and software design. Good place to find examples and explanation of curious perversions in Information Technology. Basically, it is “how not to” guide for developing software. They recount tales of disastrous development, from project management gone spectacularly bad to inexplicable coding choices.

Blog with interesting articles about Java, Performance Solutions, agile, software architecture, continuous delivery, cloud and many more.

Engineering blog for Node.js and JavaScript lovers. TDD, callback hell, clean coding and other buzz and important topics are discussed here.

  • Also make profile on Stackoverflow.com and search daily for any type of stuff related to software development, Networking, Hardware related questions.



All the Best for the future.


Tuesday, 24 May 2016

Left aligned UICollectionView cells with dynamic cell width in Xamarin.ios

Since this is my first blog post, if you find any spelling mistake then please forgive me.
As a Mobile App developer, I faced many issues in designing. Since in App developement using Xamarin.ios in .Net environment, i found many problems regarding some design features of  UICollectionView, UITableView.
So I want to share a some simple code and tricks to design a good looking Left Aligned UICollectionView with Dynamic cell width. Here you can assign dynamic height also. But most of the Mobile App developer requires UICollectionView with dynamic cell width.
So here is the full code.
The whole code is written in C# and it will be more helpful for the Xamarin.ios developers.


1.First create a UICollectionView and add it in View where you want it to be displayed.

UICollectionView collectionView;


2.Then create a UICollectionViewFlowLayout with any name. This FlowLayout will assign a frame to each of the cell that are created in UICollectionView.

UICollectionViewFlowLayout CollectionFlowLayout;
CollectionFlowLayout = new LeftAlignedCollectionViewFlowLayout();

if you are confused then let me explain why i had instantiated the flowlayout with custom name, because i had my whole code  and method declaration in my custom flowlayout class named LeftAlignedCollectionViewFlowLayout.

3. Then instantiate a collectionView with some frame and pass it our custom flowLayout named CollectionFlowLayout 

4. Write the class declaration and whole overridden methods in the LeftAlignedCollectionViewFlowLayout. The code is below.

class LeftAlignedCollectionViewFlowLayout : UICollectionViewFlowLayout
        {
            nfloat maxCellSpacing = 10;

            public LeftAlignedCollectionViewFlowLayout()
            {
            }

            public override UICollectionViewLayoutAttributes[] LayoutAttributesForElementsInRect(CGRect rect)
            {

               var arr = base.LayoutAttributesForElementsInRect(rect);
                for (int i = 1; i < arr.Count(); ++i)
                {
                    UICollectionViewLayoutAttributes currentLayoutAttributes = arr[i];
                    UICollectionViewLayoutAttributes prevLayoutAttributes = arr[i - 1];
                    nint maximumSpacing = 10;
                    nfloat origin =  prevLayoutAttributes.Frame.GetMaxX();
                    if(origin + maximumSpacing+ currentLayoutAttributes.Frame.Size.Width<CollectionView.ContentSize.Width)
                    {
                        CGRect frame = currentLayoutAttributes.Frame;
                        frame.X = origin + maximumSpacing;
                        currentLayoutAttributes.Frame = frame;
                    }
                }
                return arr;
            }

            public override UICollectionViewLayoutAttributes LayoutAttributesForItem(NSIndexPath indexPath)
            {
                var currentItemAttributes = base.LayoutAttributesForItem(indexPath);


                var collectionViewFlowLayout = CollectionView.CollectionViewLayout as UICollectionViewFlowLayout;

                if (collectionViewFlowLayout != null)
                {
                    var sectionInset = collectionViewFlowLayout.SectionInset;
                    if (indexPath.Item == 0)
                    { // first item of section
                        var frame = currentItemAttributes.Frame;
                        frame.X = sectionInset.Left; // first item of the section should always be left aligned
                        currentItemAttributes.Frame = frame;
                        return currentItemAttributes;
                    }

                    var previousIndexPath = NSIndexPath.FromItemSection(indexPath.Item - 1, indexPath.Section);
                    var previousFrame = base.LayoutAttributesForItem(previousIndexPath).Frame;

                    previousFrame.X = base.LayoutAttributesForItem(previousIndexPath).Frame.Left;
                    if (previousFrame.X != base.LayoutAttributesForItem(previousIndexPath).Frame.Left)
                    {
                        var n = base.LayoutAttributesForItem(previousIndexPath).Frame.Left;
                        previousFrame.X = n;
                        maxCellSpacing = 0;
                    }
                    var previousFrameRightPoint = (previousFrame.X) + (previousFrame.Size.Width) + maxCellSpacing;

                    var currentFrame = currentItemAttributes.Frame;
                    var width = 0.0;

                    var collectionViewWidth = CollectionView == null ? 0 : CollectionView.Frame.Size.Width;
                    width = collectionViewWidth;
                    var strecthedCurrentFrame = new CGRect(0, currentFrame.Y, width, currentFrame.Size.Height);

                    if (CGRect.Intersect(previousFrame, strecthedCurrentFrame) == CGRect.Empty)
                    { // if current item is the first item on the line
                        // the approach here is to take the current frame, left align it to the edge of the view
                        // then stretch it the width of the collection view, if it intersects with the previous frame then that means it
                        // is on the same line, otherwise it is on it's own new line
                        var frame = currentItemAttributes.Frame;
                        frame.X = sectionInset.Left; // first item on the line should always be left aligned
                        currentItemAttributes.Frame = frame;
                        return currentItemAttributes;
                    }

                    var frame2 = currentItemAttributes.Frame;
                    frame2.X = previousFrameRightPoint;
                    currentItemAttributes.Frame = frame2;
                }
                return currentItemAttributes;
            }

        }

5.Create and assign a data source to the our previously insaniated collectionView.

UIcollectionDInterestSource collectionDataSource;
collectionView.Source = collectionDataSource = new UIcollectionDInterestSource(this, collectionView, lstString);

Here 'this' parameter in the datasource is the instance of the class that holds our UICollectionView.
2nd parameter is the collectionView, and 3rd parameter is the actual data that is to be displayed in the cells of collection View.

My lstString is as follows.
List<string> lstString = new List<string> { "A Thing", "Another", "BTopic gsrg Thing", "A Thing", "Another", "BTopic Thing", "AB", "Interest BTopic", "My Interest", "Other Toipc here", "Some Topic", "A Thing", "Another", "BTopic", "Interest", "My Interest", "Other Toipc here", "Some Topic", "My Interest", "Other Toipc here", "Some Topic", "Vivek Gupta", "My Other Friend" };

The list contains string element with dynamic number of text.

Then register a UICollectionView class for our custom UICollectionView cells.

6. Now create a custom UICollectionViewDelegateFlowLayout that will assign a dynamic width to our cell as per the string of text.

collectionView.Delegate = new CollectionViewFlowDelegate(lstString, CollectionFlowLayout);

and the whole code for UICollectionViewDelegateFlowLayout is below:


class CollectionViewFlowDelegate : UICollectionViewDelegateFlowLayout
        {
            List<string> lstStr;
            public CollectionViewFlowDelegate(List<string> lstString, UICollectionViewFlowLayout CollectionFlowLayout)
            {
                lstStr = lstString;

            }
            public override CGSize GetSizeForItem(UICollectionView collectionView, UICollectionViewLayout layout, NSIndexPath indexPath)
            {
                CGSize size = new NSString(lstStr.ElementAt(indexPath.Row).ToString()).GetSizeUsingAttributes(new UIStringAttributes(NSDictionary.FromObjectAndKey(AppFonts.TitleFontSemiBold(15), UIStringAttributeKey.Font)));
                size.Width += 20;
                size.Height += 20;
                collectionView.SystemLayoutSizeFittingSize(size, 1.0f, 1.0f);

                return size;
            }


        }

7: The datasource class :

 public class UIcollectionDInterestSource : UICollectionViewSource
        {           
            MyProfileController controller;
            List<string> lstStr;

            public UIcollectionDInterestSource(MyProfileController controller, UICollectionView collectionView, List<string> lstStr)
            {
                this.controller = controller;
                this.lstStr = lstStr;
            }

          

            public override nint NumberOfSections(UICollectionView collectionView)
            {
                return 1;

            }

            public override nint GetItemsCount(UICollectionView collectionView, nint section)
            {
                return lstStr.Count;
            }

            public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
            {
                var cell = (MyInterestCollectionViewCell)collectionView.DequeueReusableCell(MyInterestCollectionViewCell.CellId, indexPath);

                cell.UpdateCell(lstStr.ElementAt(indexPath.Row));
                cell.ContentView.AddGestureRecognizer(new UILongPressGestureRecognizer(LongPress));
                cell.ContentView.AddGestureRecognizer(new UITapGestureRecognizer(TapGesture));
                cell.ContentView.Layer.BorderColor = UIColor.Clear.FromHexString(AppTheme.AttendeeNetworkColor, 1.0f).CGColor;
                cell.ContentView.Layer.BorderWidth = 2.0f;
                cell.ContentView.Layer.CornerRadius = 4.0f;
                Console.WriteLine(cell.Frame);
                return cell;


            }

           
            public override void ItemHighlighted(UICollectionView collectionView, NSIndexPath indexPath)
            {
                var cell = collectionView.CellForItem(indexPath);
            }

            public override void ItemUnhighlighted(UICollectionView collectionView, NSIndexPath indexPath)
            {
                var cell = collectionView.CellForItem(indexPath);
            }

            public override bool ShouldHighlightItem(UICollectionView collectionView, NSIndexPath indexPath)
            {
                return true;
            }

            public override bool ShouldSelectItem(UICollectionView collectionView, NSIndexPath indexPath)
            {

                return true;
            }

            // for edit menu
            public override bool ShouldShowMenu(UICollectionView collectionView, NSIndexPath indexPath)
            {
                return false;
            }

            public override bool CanPerformAction(UICollectionView collectionView, Selector action, NSIndexPath indexPath, NSObject sender)
            {
                if (action == new Selector("custom"))
                    return true;
                else
                    return false;
            }

            public override void PerformAction(UICollectionView collectionView, Selector action, NSIndexPath indexPath, NSObject sender)
            {
                System.Diagnostics.Debug.WriteLine("code to perform action");
            }



        }
8. The output is as follows displayed in the image.