iOS app with Swift + SQLite Cipher

If you need an iOS app done in Swift that requires an encrypted SQLite database, these are the steps for a simple and under full control solution:

  1. Create a new Swift project and then close XCode
  2. Go to Terminal and from app folder create a pod file, using: pod init
  3. Edit Podfile and add the following line: pod 'SQLCipher'
  4. From Terminal install the pod, using: pod install
  5. Open the xcworkspace file and you will see both the project and Pods in XCode

Formatting UITextField - border, padding and color

A quick solution to format (border, color, padding) an UITextField is: UITextField+Format.h
#import 
@interface UITextField (Border_Color_Padding)
- (void)borderAndColor:(CGFloat)borderWidth paddingLeft:(BOOL)pad 
forLeft:(BOOL)left forTop:(BOOL)top forRight:(BOOL)right forBottom:(BOOL)bottom 
forColor:(UIColor *)color;
- (void)borderLeftAndColor:(CGFloat)borderWidth paddingLeft:(BOOL)pad 
forColor:(UIColor *)color;
- (void)borderTopAndColor:(CGFloat)borderWidth paddingLeft:(BOOL)pad 
forColor:(UIColor *)color;
- (void)borderRightAndColor:(CGFloat)borderWidth paddingLeft:(BOOL)pad 
forColor:(UIColor *)color;
- (void)borderBottomAndColor:(CGFloat)borderWidth paddingLeft:(BOOL)pad 
forColor:(UIColor *)color;
@end

Formatting UILabel - border and color

A quick solution to add borders to an UILabel is: UILabel+Border.h
#import 
@interface UILabel (Border_Color)
- (void)borderAndColor:(CGFloat)borderWidth forLeft:(BOOL)left forTop:(BOOL)top 
forRight:(BOOL)right forBottom:(BOOL)bottom forColor:(UIColor *)color;
- (void)borderLeftAndColor:(CGFloat)borderWidth forColor:(UIColor *)color;
- (void)borderTopAndColor:(CGFloat)borderWidth forColor:(UIColor *)color;
- (void)borderRightAndColor:(CGFloat)borderWidth forColor:(UIColor *)color;
- (void)borderBottomAndColor:(CGFloat)borderWidth forColor:(UIColor *)color;
@end

Formatting UILabel - bold and color

There are different options to format a text in an iOS app. If you want to place it inside an UILabel, a solution is to use the following code: UILabel+Bold_Color.h
#import 
@interface UILabel (Bold_Color)
- (void)boldSubstring:(NSString*)substring;
- (void)boldRange:(NSRange)range;
- (void)boldAndColorSubstring:(NSString*)substring forColor:(UIColor *)color;
- (void)boldAndColorRange:(NSRange)range forColor:(UIColor *)color;
@end

Load html file with images to UIWebView

Sometimes you want to load a html file with images into a UIWebView on IOS SDK. This is how you can do it, this will work but will not load images that you have in html.
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"tab1" 
ofType:@"html"];
    
NSString* htmlString = [NSString stringWithContentsOfFile:htmlFile 
encoding:NSUTF8StringEncoding error:nil];
[self.webViewInfoText loadHTMLString:htmlString baseURL:nil];

Mysql generate alias column - replace non-ascii characters

Ever needed an alias column after a lot of data is inserted in table? This happened to us this week, we had to add alias column and remove non-ascii characters. This was the easy solution that we have found :).
UPDATE table_name 
    SET column_alias = REPLACE(CONVERT(column_nume USING ascii), '?', '');

Prevent multiple tabs on C# web applications

We have recently been challenged to update a web application, we needed to do a security improvement on certain pages to prevent them from being opened on multiple tabs. The application would need to allow the user to open a new tab and the first tab that was opened to show an invalid access message. The outcome would be that a user can have a page opened only in one tab of a browser. I will refer in this post only to this problem, in the next post will discuss about multiple log-ins in different browser security issue. So after applying both solutions that I found, you would have an application that prevents certain pages to be opened in multiple tabs, and prevents multiple log-ins on different locations and browsers.

Pure CSS Speech Bubble

General CSS elements:
.tooltipMask {
	-webkit-border-radius: 15px 15px 15px 15px;
	-moz-border-radius: 15px 15px 15px 15px;
	border-radius: 15px 15px 15px 15px;
	-webkit-box-shadow: 2px 2px 4px #333;  
	-moz-box-shadow: 2px 2px 4px #333;
	box-shadow: 2px 2px 4px #333;
	filter: progid:DXImageTransform.Microsoft.Shadow(color='#969696', Direction=145, Strength=3);
	overflow:hidden;
	width:320px;
	z-index:3;
}

SQ Money - New Android Personal Expense Manager!

SQ Money is the simplest way to manage your personal finances. This application helps you budget and track your spending. Add financial details like income from salaries, winnings, or sales, and enter your expenses from dating to travel.

How To Install & Use SVN On LINUX

Download and install TortoiseSVN (http://tortoisesvn.net/downloads.html) Create a folder where you are going to store all the files / documents you will use via TortoiseSVN (e.g. svnProjects) Checkout subversion (this should only be done once): >> svn checkout https://yourhost.com/svn/repos

Categories

Archive