Posts

Building and Running Python Scripts with Xcode

Hi, If you want to run python file from xcode, you can follow this link which I have followed.  https://medium.com/sourleangchhean/using-xcode-to-execute-pythons-code-98be65c1ea8a Here is few steps which I have done.   Download and install python (If not already downloaded)(I have downloaded 3.9 version) Check if it available in at /usr/local/bin/python3 Right Click on Python3 then select Show Original Get in to that location in terminal. (Open terminal type cd and drag drop that location file) in my case path is " cd /Library/Frameworks/Python.framework/Versions/3.9/bin/"  Type "ln python3.9 python39" This is for terminal part. Now create new xcode project  File > New > Project > Cross-platform > External Build System > Next Enter Name and  Enter a name (e.g. PythonLearning), and enter the path from  above Step(i.e  /usr/local/bin/python3 ) into the “Build Tool” line. Click Next.  Create a Python file Choose File > New, select macOS > Other &g

Hacker Rank problem solution

1. Sort Item based on the  column  : - ( void ) viewDidLoad {     [ super viewDidLoad ];     // Do any additional setup after loading the view, typically from a nib.     NSArray *ary = [ self fetchItemsToDisplay : @[ @"Item4,10,15" , @"Item2,3,4" , @"Item3,17,8" ] sortParameter : @(1) sortOrder : @(0) itemPerPage : @(2) pageNumber : @(1) ];     NSLog ( @"%@" ,ary);      } - ( NSArray *) fetchItemsToDisplay :( NSArray *)items sortParameter :( NSNumber *)sortParameter sortOrder :( NSNumber *)sortOrder itemPerPage :( NSNumber *)itemPerPage pageNumber :( NSNumber *)pageNumber {          NSMutableArray *itemArray = [ NSMutableArray new ];          for ( int i = 0 ; i<items. count ; i++) {         NSString *item = items[i];         NSArray *itemDetails = [item componentsSeparatedByString : @"," ];                  ItemModel *itemModel = [[ ItemModel alloc ] init ];  

What does -ObjC and -all_load mean?

The -ObjC Linker Flag (https://developer.apple.com/library/mac/qa/qa1490/_index.html) Passing the  -ObjC  option to the linker causes it to load  all  members of static libraries that implement any Objective-C class or category. -all_Load Linker Flag (http://stackoverflow.com/questions/2906147/what-does-the-all-load-linker-flag-do) -all_load forces the linker to load all object files from every archive it sees, even those without Objective-C code.

TDD - Test Driven Development

Test Cases Link- http://www.infinite-loop.dk/blog/2011/04/unittesting-asynchronous-network-access/ http://stackoverflow.com/questions/15609219/testing-asynchronous-call-in-unit-test-in-ios http://blog.typpz.com/2014/04/27/xcode-5-test-uitableview-with-xctest-framework/ http://restlessthinker.com/?p=150

Twitter Error Domain=HTTP Code=404 objective c

Error : Request  failed with error: Error Domain=HTTP Code=404 "The operation couldn’t be completed. (HTTP error 404.)" Solution  : Verson1 of the API is  deprecated  now. This document may describe an outdated version of the API. Please move  as soon as possible  to Version1.1(https://dev.twitter.com/docs/api/1.1) Go through this document. https://dev.twitter.com/docs/api/1.1/post/direct_messages/new Point to be noted Api should be in json format. Api version v1.1 receiver and sender should follow each other. Example Request POST  : https://api.twitter.com/1.1/direct_messages/new.json POST Data  : text=hello Rajneesh&screen_name=rajneesh071

Create your own framework in Objective C.

Important link http://blog.db-in.com/universal-framework-for-ios/ http://jaym2503.blogspot.in/2012/09/how-to-create-custom-ios-framework.html

AttributedString - decorated text.

Image
NSMutableAttributedString :  NSAttributedString  and its mutable counterpart  NSMutableAttributedString  are used to draw decorated text.  You can create strings with attributes that describe how the string should look when drawn.  Show OutLine String on button : If you want to show outline text on button then you can use NSMutableAttributedString. NSMutableAttributedString * title =[[ NSMutableAttributedString alloc ] initWithString :@ "Rajneesh071" ]; [ title setAttributes :@{ NSStrokeWidthAttributeName : @ 3 , NSStrokeColorAttributeName : [ UIColor blueColor ] } range : NSMakeRange ( 0 , [ title length ])]; [ yourButton setAttributedTitle : title forState : UIControlStateNormal ]; OutPut : Play with text font :  I f you want to change font name and font size then you can do like this. NSMutableAttributedString *string = [[ NSMutableAttributedString alloc ] initWithString : self .