Instead of the verbose setOnClickListener:
RxView.clicks(submitButton).subscribe(o -> log("submit button clicked!"));Observable
.just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)| // *********** Using a custom image for a UITableViewCell's accessoryView and having it respond to UITableViewDelegate | |
| UIImage *image = [UIImage imageNamed:@"MenuSectionHeaderArrow.png"]; | |
| UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| CGRect frame = CGRectMake(0.0, 0.0, image.size.width, image.size.height); | |
| button.frame = frame; // match the button's size with the image size | |
| [button setBackgroundImage:image forState:UIControlStateNormal]; | |
| // set the button's target to this table view controller so we can interpret touch events and map that to a NSIndexSet |
##Creating a timer with Grand Central Dispatch
At the following is the implementation file of a sample class that shows, how to make a timer with the help of Grand Central Dispatch. The timer fires on a global queue, just change the queue to the main queue or any custom queue and the timer fires on this queue and not on the global queue anymore.
#import <Foundation/Foundation.h>
@interface SampleClass : NSObject
- (void)startTimer;| #include "uart.h" | |
| #include <sys/types.h> | |
| #include <sys/stat.h> | |
| #include <termios.h> | |
| #include <fcntl.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> |
| #!/bin/bash | |
| # store the current dir | |
| CUR_DIR=$(pwd) | |
| # Let the person running the script know what's going on. | |
| echo "\n\033[1mPulling in latest changes for all repositories...\033[0m\n" | |
| # Find all git repositories and update it to the master latest revision | |
| for i in $(find . -name ".git" | cut -c 3-); do |
| ## Solve Every Sudoku Puzzle | |
| ## See http://norvig.com/sudoku.html | |
| ## Throughout this program we have: | |
| ## r is a row, e.g. 'A' | |
| ## c is a column, e.g. '3' | |
| ## s is a square, e.g. 'A3' | |
| ## d is a digit, e.g. '9' | |
| ## u is a unit, e.g. ['A1','B1','C1','D1','E1','F1','G1','H1','I1'] |
| // Make sure to include this at the top of AppDelegate.m | |
| @import UserNotifications; | |
| - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
| // Override point for customization after application launch. | |
| // Check Notification Settings on launch | |
| [[UNUserNotificationCenter currentNotificationCenter] getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) { | |
| switch (settings.authorizationStatus) { | |
| // This means we have not yet asked for notification permissions | |
| case UNAuthorizationStatusNotDetermined: |
(Serial port or com port? - Serial ports are often refered as COM ports. It is the same to be short. You can read abut it in the Wiki article )
| # -*- coding: utf-8 -*- | |
| import sys | |
| import threading | |
| import queue | |
| # from kivy.compat import queue | |
| import serial | |
| import time | |
| import kivy | |
| kivy.require('1.9.0') |
| #!/usr/bin/env python | |
| """Simple HTTP Server With Upload. | |
| This module builds on BaseHTTPServer by implementing the standard GET | |
| and HEAD requests in a fairly straightforward manner. | |
| """ |