Blog Archives


SACalendar is a customizable iOS 7 Calendar.

Download here

Logging service for Swift – Swell

Swell is a logging utility for Swift and Objective C.


????Turn on logging during development, turn them off when building for the App Store
????Enable or disable logging for specific classes
????Different log levels allow for finer-grained control of logging within a class
????Log to the console, text file, or a custom location
????Log message isn’t computed when logging is disabled (thanks to the @auto_closure feature)

Download here

How to create ring ton for iPhone using iTunes

Create iPhone ringtone is a fairly easy process.

  1. Start iTunes and find the song (MP3) you want to convert.
  2. Using song info, in the Options tab, check the Start Time and Stop Time boxes, then enter times for each (no more than 30 seconds). Click OK.
  3. From song sub-menu (right-click) choose Create AAC Version. New 30-second version of the song will be added immediately.
  4. Copy this new song out of iTunes and into the folder of your choice.
  5. Delete the 30-second version from iTunes and revert the Start Time/Stop Time changes to the original.
  6. In the folder containing the 30-second AAC file you dragged out of iTunes, change the file extension from .m4a to .m4r. Double-click it and it immediately gets added to iTunes’ ringtone library.
  7. Finally, sync your iPhone to get this new ring ton into ringtone list.

Autolayout views evenly spaced

Good solution to autolayout evenly spaced components in the view.


[self.view addConstraints:       [NSLayoutConstraint constraintsForEvenDistributionOfItems:@[label1, label2, label3, label4]                                          relativeToCenterOfItem:self.view                                                      vertically:YES]];


@interface NSLayoutConstraint (EvenDistribution)    /**   * Returns constraints that will cause a set of views to be evenly distributed horizontally   * or vertically relative to the center of another item. This is used to maintain an even   * distribution of subviews even when the superview is resized.   */  + (NSArray *) constraintsForEvenDistributionOfItems:(NSArray *)views                               relativeToCenterOfItem:(id)toView                                           vertically:(BOOL)vertically;    @end


@implementation NSLayoutConstraint (EvenDistribution)    +(NSArray *)constraintsForEvenDistributionOfItems:(NSArray *)views                             relativeToCenterOfItem:(id)toView vertically:(BOOL)vertically  {      NSMutableArray *constraints = [NSMutableArray new];      NSLayoutAttribute attr = vertically ? NSLayoutAttributeCenterY : NSLayoutAttributeCenterX;        for (NSUInteger i = 0; i < [views count]; i++) {          id view = views[i];          CGFloat multiplier = (2*i + 2) / (CGFloat)([views count] + 1);          NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:view                                                                        attribute:attr                                                                        relatedBy:NSLayoutRelationEqual                                                                           toItem:toView                                                                        attribute:attr                                                                       multiplier:multiplier                                                                         constant:0];          [constraints addObject:constraint];      }        return constraints;  }  @end  

Objective-C execute once


Making code run only once is simple with Objective-C:

static dispatch_once_t once;  dispatch_once(&once, ^ {  // Code to run once  });  

Make sure that you properly define once variable.

FreeNAS UPS configuration

I am using a small UPS CyberPower 425VA with my FreeNAS server. After upgrading to latest 8.2 (BETA3), the UPS services stopped working.

I had similar issue in the past, but manage to find compatible selection of arguments and UPS monitor was working great (even get email while been in Spain on vacation about power outage).

But now, it wan’t start at all:

Jun 16 11:20:17 freenas notifier: Network UPS Tools – Generic HID driver 0.35 (2.6.2)
Jun 16 11:20:17 freenas notifier: USB communication driver 0.31
Jun 16 11:20:17 freenas notifier: No matching HID UPS found
Jun 16 11:20:17 freenas notifier: Driver failed to start (exit status=1)
Jun 16 11:20:17 freenas notifier: Network UPS Tools – UPS driver controller 2.6.2

After several attempts and search on internet I found a link to this article: usbhid-ups and APC Smart-UPS 1500

So once I get report from usbhid-ups, which correspond to my UPS connection (see below), I grab VendorID and ProductID:

0.001034 Checking device (0764/0501) (/dev/usb//dev/ugen0.2)
4.886523 – VendorID: 0764
4.886550 – ProductID: 0501
4.886557 – Manufacturer: unknown
4.886566 – Product: unknown
4.886573 – Serial Number: unknown
4.886579 – Bus: /dev/usb

and changed UPS Settings for service:

Note: make sure you put few spaces in front of each line.

Once settings are saved, start the UPS service.


How to find the soil type in your area.

I was looking for an information about soil type in my area and come across the online GIST system Web Soil Survey, which give me all information I need to know.

You will need select an area of interest using Soil Survey area section and pressing on “Set AOI”.

Navigate to soil map and navigate the map to see your area.

Setting up IIS 6 for HTTPS

In order to set IIS 6 to respond HTTPS requests the server must be configured with Certificate.
The certificate can be requested from Certificate Authorities, or you can simply self certificate the server.
For the second option you need to follow these simple steps:
1) Download and Install IIS 6.0 Resource Kit Tools from:

2) Once IIS Resource Kit installed, open IIS Metabase Explorer (Start menu->Programs->IIS Resources->Metabase Explorer). Go to LM->W3SVC and select the items on the left to see on the right a description of them and find your virtual site (the default Web Site usually has ID 1). At this point, suppose the site has ID=123 you have to issue run from command prompt (you might need to change current directory to ‘Program FilesIIS ResourcesSelfSSL’):

SelfSSL / /V:365 /S:123


/N:CN is the name of your site on the internet (or LAN)
/V: sets the number of days before the new certify expires
/S: is the ID we found

After this command line is completed, the site is ready to go.

iOS 4: Exchange Mail, Contacts, or Calendars may not sync after update

I know you guys have iPhones, this may be interesting for you.  If you know anyone else using iPhones with Exchange server, you might want to read this:

NTP: Timing is Everything

What’s the one thing that you see criminals, spies and other mysterious individuals doing just prior to embarking on a caper? If you said, “synchronize their watches” you guessed correctly. And, why do they do it? Because timing is everything. The Network Time Protocol (NTP) does the same thing for your systems and for the same reasons; it keeps them synchronized.

Why is system time synchronization so important? If you’ve ever seen the message, “modification times are in the future” or had the misfortune to have your SAN or network attached storage deny access to a system or user account because of a time sync problem, you know why. Time sychronization is also important when you need to compare logged events between a system and a network device. (more >)

WP Like Button Plugin by Free WordPress Templates