Skip to main content

Posts

How to Cache NSDateFormatter?

Recent posts

Zooming Images with Text in an iOS Scroll View

You have an image containing text. As such, there’s lots of sharp edges. You want to put this image into a scroll view and allow the user to zoom in with a pinch gesture. This is very easy to implement in iOS. Technically, you don’t even need to write code. This can all be done in Interface Builder. However, the further the image is zoomed the blurrier it looks. Solution 1 Start with a fully zoomed of the image and scale it down when initially adding it to the scroll view. After all, it’s much easier to scale an image down and keep it looking good than it is to scale it up. So during the whole zoom operation the image being displayed is a scaled down version of the original. This would work great except that iOS doesn’t apply the right interpolation when scaling the original large down to fit into the initial smaller frame. You would think self.imageView.layer.minificationFilter = kCAFilterTrilinear; would do the trick but it doesn’t. I could be doi

The Python Code Handbook (free book with 40 code examples)

Introducing the Python Code Handbook from FreeCodeCamp that are worth your time: 1. This handbook will teach you Python for beginners through a series of helpful code examples. You'll learn basic data structures, loops, and if-then logic. It also includes plenty of project-oriented learning resources you can use to dive even deeper. (full handbook):  https://www.freecodecamp.org/news/python-code-examples-simple-python-program-example/ 2. freeCodeCamp just published this course to help you pass the Google Associate Cloud Engineer certification exam. If you want to work as a DevOps or a SysAdmin, this cert may be worth your time. You'll learn Cloud Engineering fundamentals, Virtual Private Cloud concepts, networking, Kubernetes, and High Availability Computing. (20 hour YouTube course):  https://www.freecodecamp.org/news/google-cloud-digital-leader-certification-study-course-pass-the-exam-with-this-free-20-hour-course/ 3. React Router 6 just came out a few months ago, and freeCod

Vertical Labels in iOS (using Objective-C)

View transformations are something you might wanna need to learn more about. While rethinking the iPad interface for his UTC Chart app, it occurred to mluton to use vertical labels. After a bit of research this is what he came up with. - (void)viewDidLoad { [super viewDidLoad]; NSString *string = @"Lorem Ipsum"; UIFont *font = [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline]; UILabel *label = [[UILabel alloc] init]; label.font = font; label.text = string; CGSize size = [string sizeWithAttributes:@{NSFontAttributeName:font}]; label.frame = CGRectMake(40, 40, size.width, size.height); [label.layer setAnchorPoint:CGPointMake(0.0, 0.0)]; label.transform = CGAffineTransformMakeRotation((M_PI) / 2); [self.view addSubview:label]; } The frame and setAnchorPoint values can be modified to achieve desired positioning. He chose to bypass any potential autolayout/transform conflicts by creating the label progr

Globals and Swift (Language)

We’re all aware that global variables are bad and that we shouldn’t do globals. Right? Well... Sometimes you need globally available information like user interface idiom or OS version. This information is available from UIDevice and you can grab it from anywhere in your app. Testing Device Idiom and OS Version in Swift if UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Phone { ... } if UIDevice.currentDevice().systemVersion.compare("8.0", options: NSStringCompareOptions.NumericSearch) != NSComparisonResult.OrderedAscending { ... } However, that’s a lot type type and isn’t easy to read either. In Objective-C we could use macros in the pre-compiled header to make application code easier to read and write.

Sample Database in CI Wizard Demos Explained

In this video, the design of the sample relational database used throughout the demos of CodeIgniter Wizard is explained using an E-R diagram. Originally designed in Navicat ( https://www.arclerit.com/navicat/?ref=YToperand ) the E-R diagram shows the entities named 'countries', 'cities' and 'people' which are linked via foreign key definitions. The 'People' table contains about every kind of data column to demonstrate a use case for various data types, so the code generator happens to produce code for a variety of fields. To learn about the new features of CodeIgniter Wizard, you can view https://youtu.be/msSVRN5tY88 For an end-to-end, 9-minute demo, watch https://youtu.be/fo2wmzZ2p3I To take a closer look at what the generated code looks like, see https://youtu.be/6Gh1LU1pV-I APP STORE LINK https://apps.apple.com/app/codeigniter-wizard/id1531951619 PRODUCT WEB SITE https://www.ozar.net/products/codeigniterwizard/?ref=DAVElopment FAQ https

New Features of CodeIgniter Wizard PHP RAD Tool

CodeIgniter Wizard is a Rapid Application Development (RAD) tool and a code generator for PHP MySQL which helps quickly generate MySQL/MariaDB database-driven web applications as an advanced starting point with all the C.R.U.D. functionality, with administrative interfaces based on version 4 of the CodeIgniter framework.  As of version 1.1 of CodeIgniter Wizard, users can select the what data to be referenced before generation of dropdown fields and radio buttons without having to rely solely on foreign keys defined in the database.And Some of the generated application configuration settings are now in the Preferences panel. Generated form code is now more elegant and less verbose using the new old() function instead of set_value(). For an end-to-end, 9-minute demo, watch https://youtu.be/fo2wmzZ2p3I To take a closer look at what the generated code looks like, see https://youtu.be/6Gh1LU1pV-I APP STORE LINK https://apps.apple.com/app/codeigniter-wizard/id1531951619 PRODUCT W