Single Responsibility Principle (SRP)

The following is one of the five fundamental principles which can help you to write a better, cleaner, and maintainable code. These principles were introduced by “Uncle” Bob C. Martin and the acronym “S.O.L.I.D.” was introduced by Michael Fathers. The original main source of the information can be found on the personal blog of Uncle Bob.

First, I would do a general overview and later I will be going into the small details.

Overview

Lets see what the acronym “S.O.L.I.D.” means:

  • Single Responsibility Principle (SRP): “A class should have only a single responsibility… There should never be more than one reason for a class to change”.
  • Open / Close Principle (OCP): Open for extension; however, closed for modification.
  • Liskovs Substitution Principle (LSP): Without altering the correctness of the program, objects should be replaceable with instances of their sub-types.
  • Interface segregation Principle (ISP): Instead of a huge fat general-purpose interface, we should create many client-specific interfaces.
  • Dependency Inversion Principle (DIP): “Depend upon Abstractions. Do not depend upon concretions.”

 

Single Responsibility Principle (SRP)

“A class should have only a single responsibility… There should never be more than one reason for a class to change”… what does that means? This mean two separate things:

  1. Your class should concentrate on doing only one thing and that one thing should be its only responsibility.
    If your class do more than one thing, which means more than one responsibility, you should break it down in smaller classes in which each takes care of only one responsibility.
  2. If that one only thing changes, then you are allowed to change the structure of such class, else don’t touch it.

In other words, lets say you wrote a class have the responsibility of using the modem and takes care of the protocol of communication, you should brake this into two classes. One class will take care of using the modem, the other class will take care of the protocol of communication.

 

SRP-Figure-1

 

Why? The first reason is maintenance. Since each class only concentrates on one responsibility, it will be easier to maintain them plus they will be smaller on size. The second reason is re-usability. In this case, we could have a different hardware than a modem, lets say Bluetooth, and don’t need to rewrite again the communication protocol.

 

SRP-Figure-2

If out of the blue, you have more than one type of communication protocol (TCP, UDP, etc.) then perhaps you want to separate this class into small classes in which each class takes care of one type of protocol.

drawit-diagramBy now, you must be getting the idea.


Single Responsibility Principle (SRP) and Test-Driven Development (TDD)

Test-Driven Development and Single Responsibility Principle go hand by hand pretty nicely.
For those who don’t know, the idea of Test-Driven Development is to follow a cycle that works as follow:

Step 1: Write a test case first.
Step 2: Write the minimum code to pass that test case.
Step 3: Restructure your existing code without changing its external behavior.
Step 4: Go to Step 1 and apply all steps with the next feature.

So, if you write test cases for small classes that have a single responsibility, your classes will become solid blocks that you can use while knowing that they pass all the tests you designed before.


Single Responsibility Principle (SRP) and Model-View-Controller (MVC)

The Model-View-Controller is a framework in which you separate user interface (View), from the business logic (Controller) and the data (Model). In this way, you should be able to reuse these components and make a better and cleaner code. However, I found out that what is being called a controller is actually being used as a “View Controller” which holds business logic and controls the view behavior. This can become a huge mess. Therefore, I would advice that you keep the business logic separated from the view and the follow is an example:

MVVCC-

In this way, the view takes care of the interaction with the user, the view controller, takes cares of any changes that must be done to the view, the controller is the business logic, and the model is the data. This should follow the idea of Single Responsibility Principle and allow for an easier application of Test-Driven Development.

 

Share
Leave a comment

Jog 101 for iOS is Postponed

iOS Simulator Screen Shot Jun 17, 2015, 4.26.07 PMTip of my hat to the Apple Review Team because they had found a bug which I cannot replicate plus I can’t decrypt the crash report they gave me. Even do, I re-read over and over again the guideline that is supposed to teach how to read the crash report.

I really wish Apple would have a better crash report and I don’t seem to be the only one. This quite annoying to me because I spend a lot of time researching, rewriting code, and testing for possible bugs. I try to be as meticulous as possible when doing my work so I can make a bugs free applications but the information provided by them is quite useless.

Previously, my application got rejected for reasons not involved with possible bugs in the application.

The first time, it got rejected because I didn’t write an extensive testing documentation up to Apple standards. Apple doesn’t provide any documentation or example on how to write a testing documentation to their standards so I will have to create one on my own and cross my fingers.

The second time the apple reviewer couldn’t understand why I did provide a section to control the music on the device.I explained that I found that users don’t wish to exit the application, set up the music and then return to the application. This section was added for the convenience of the user. Personally, I don’t understand why I was asked this question. It doesn’t break any of the guidelines.

The third time, I was ask “In addition, what is the purpose of the location background mode in the app? Does location need to be on persistently while the app is in the background?”. It is a jogging application. It needs to record the location of the user even when phone is locked. It needs to indicate the user when it gets the awards. It needs to keep the timer running so knows when to tell the user when to do each exercise. It needs to be keep the application alive when the device is locked. I guess that the short explanation I added when submitting the application was no good enough. So, I will have to add some Alert box or section to make it clear.

While this happens, I test many application in the app store such as FallOut Shelter which is full of bugs and crash all the time. I talk with other iOS developers and the picture I get is that only those application coming from big corporations are allowed to be reviewed “lightly” while individual programmers are attack like crazy.

So based on all this, I decided to go back to the drawing board and start everything again from zero regardless on how annoying is that in hopes that I can pass the Apple review.

The good thing is that I, my family and friend keep using my application successfully. I am getting nice feedback from them and I am happy that they are using it successfully. I installed them on their devices directly TestFlight only allow me to share when review pass successfully and because some of them have iOS7.

Since I am a thinker, more than a whiner, here are some ideas for the Apple Team Reviewers:

  • Run the application in debug and record the logs when the application fail them. Your crash report is quite useless and people add logs in their program for the purpose on finding the bugs easier.
  • Explain why you asking your questions. Questions no related with bugs give the idea that you are trying to come up with excuses to not approve an application.

It is very rare to me to write this kind of articles where I am angry. Normally, I prefer to never write something negative on the Internet; however, the Apple Review Team makes me feel like I am hopeless in my hopes to publish my application.

 

Share
Leave a comment

Jog 101 for iOS

Jog 101 Splash image on iOSJog 101 is a simple application based on the walk/run technique design for those who don’t have endurance or fitness to run for long periods of time.

Set the amount of minutes you wish to warm up. Then, the amount of minutes you wish to run and/or walk plus the number of repetitions. The application will tell you when you should warm up, run and/or walk.

Warm Up + [ (Run + Walk) x Repetitions] = Total exercise time in minutes

 

 

 

 

 

 

 

Features

  • Exercise and time indicator
  • Notifications using voice instructions and vibrations
  • Workout distance and time measurement
  • Running pace calculations
  • Control media player and volume
  • Award system based on distance accomplished
  • Route display

ScreenShots

 

This application was made in Xcode using Swift 1.2

 

DISCLAIMER
By using this program you are agreeing to accept full responsibility for your actions and recognize that all risk of injury or illness, which may occur to you, is your responsibility; therefore, you expressly relinquish and release any claims, which you may have against the author of this program, Alejandro G. Carlstein Ramos Mejia, and/or any of his affiliates. This program was not created as a medical advice and/or as a substitute for medical and/or physician counseling. Please seek the guidance and care of your doctor and/or physician before using this program.

HOW TO USE
The program follows this equation: Warm Up + [(Run + Walk) x Repetitions] = Total time; where “Warm Up”, “Run”, and “Walk” are the minutes you spend doing each exercise and “Repetitions” is the number of times you do “Run” and/or “Walk” exercise.

  1. Go to “New Run” section
  2. Select the minutes you wish to warm up and press “Next” or do not select any minutes and skip.
  3. Select the minutes you wish to run and/or walk, plus the number of repetitions. Then, press next.
  4. Press Start to begin you exercise.
  5. Listen for the instructions on when switch to each exercise.

Vibrations were added to help you recognize when the program is switching exercises.

F.A.Q
• Why can’t I hear the voice?
Your iPhone’s ringer is in silence. Check the ringer’s switch on the side of your iphone.

SPECIAL THANKS TO
• My parents, Ricardo G. Carlstein and Susana Ramos Mejia, for giving me their support and encouraging me to do my best.
• My sister, Marina Carlstein Ramos Mejia, for her tips in design.
• My brother-in-law, Marc Singleton, for correcting my horrifying grammar when I ask his for help.
• My friend David W. Corrigan and Candece Corrigan for their support.
• My friend Vanina Escudero for her encouragement.
• Bell’s Beginner’s Running Clinic in Colorado for introducing me to their methodology of running when I was a member. Best investment I have done.

END USER LICENSE AGREEMENT (“EULA”
This End User License Agreement (“EULA”) is a legal agreement between Alejandro G. Carlstein and his affiliates and You concerning Jog 101 software (excluding Open Programs defined later) licensed hereunder Alejandro G. Carlstein and his affiliates. Clicking the accept icon or otherwise using the Jog 101 software constitutes Your agreement with and acceptance of this EULA. If You do not accept this EULA, You will NOT be authorized to use the Jog 101.
A. LICENSE GRANT
1.    Development License: Alejandro G. Carlstein Ramos Mejia and his affiliates hereby grants You a limited, non-exclusive, non-transferable license to install and use the Jog 101 software for which You have paid any applicable fee(s), solely for Your internal use in the development of embedded applications (“Your Application”) for distribution to Your customers. The Jog 101 software may be used only by the number of users for which You have paid a Subscription and/or Software Development License Fee, if applicable. A Subscription or Development License may be transferred from one user to another only on a permanent (not temporary) basis. Only Your employees and contractors that agree to the terms of this EULA may access or use the Jog 101 software. Alejandro G. Carlstein Ramos Mejia and his affiliates may offer certain Jog 101 software on a “Floating License” basis. If You pay any applicable fee(s) for a Floating License, You shall have the license right to permit the specified number of concurrent users to access and use the Jog 101 software. In addition, You hereby certify that You: (a) are not a citizen of, nor located in, any of the countries prohibited from receiving United States (“US”) exports, or prohibited from transacting with US citizens pursuant to US embargoes or other sanctions; (b) are not prohibited from receiving US exports by being listed on any export denial list published by the: US State Department – Directorate of Defense Trade Controls, US Treasury Department – Office of Foreign Assets Control, or US Department of Commerce – Bureau of Industry and Security; and, (c) will not export or re-export US-origin products or technology obtained from Alejandro G. Carlstein Ramos Mejia and his affiliates in violation of US export regulations. You acknowledge that Alejandro G. Carlstein Ramos Mejia and his affiliates has the right, but not the obligation, to periodically audit Your use of the Jog 101 software to ensure Your compliance with these Terms and applicable laws. You agree to immediately notify Alejandro G. Carlstein Ramos Mejia and his affiliates of any unauthorized use of the Jog 101 software, Your account or any other breach of security of which You become aware.
2.    Trial Software: If the Jog 101 software is used for evaluation purpose only then the license granted hereunder is a limited, non-exclusive, non-transferable, revocable license to install and use the Trial Software solely during the License Period for internal review and testing of the Trial Software. This license grant shall terminate immediately and without further notice upon expiration of the License Period, at which time You shall return to Alejandro G. Carlstein Ramos Mejia and his affiliates, or certify as destroyed, all Trial Software and related documentation. “License Period” means (subject to earlier termination as set forth in Section F below) the period of time beginning with the date upon which You first install the Trial Software and ending upon the earliest occurrence of any of the following events: (i) You purchase a subscription and technical support for Jog 101 software; or (ii) End date of the agreed upon trial period.
3.    Pre-Release Software: If the Jog 101 software has not yet been made generally available for licensing by the public (“Pre-Release Software”), then the license granted hereunder is a limited, non-exclusive, non-transferable, revocable license to install and use the Pre-Release Software solely during the License Period for internal review and testing of the Pre-Release Software. This license grant shall terminate immediately and without further notice upon expiration of the License Period, at which time You shall return to Alejandro G. Carlstein Ramos Mejia and his affiliates, or certify as destroyed, all Pre-Release Software and related documentation. “License Period” means (subject to earlier termination as set forth in Section F below) the period of time beginning with the date upon which You first install the Pre-Release Software and ending upon the earliest occurrence of any of the following events: (i) the Pre-Release Software is released and made generally available for licensing by the public; or (ii) Alejandro G. Carlstein Ramos Mejia and his affiliates notifies You of its intent to cancel this EULA as it applies to Pre-Release Software (in which case the License Period will end thirty (30) days after such notification)
B. RESTRICTIONS
1.    Jog 101 software: Except as expressly set forth above, You may not: (i) use, copy, disclose, distribute, modify, or create derivative works of the Jog 101 software; (ii) use the Jog 101 software for outsourcing, time-sharing, for the benefit of any third party, or in competition with Alejandro G. Carlstein Ramos Mejia and his affiliates; (iii) cause or allow any portion of the Jog 101 software to be subject to any open source license except to the extent that such portion is provided to You by Alejandro G. Carlstein Ramos Mejia and his affiliates under the terms of such open source license; (iv) decompile, disassemble or reverse engineer the Jog 101 software, or permit any third parties, including end-users of Your Application, to do so; (v) export or import the Jog 101 software or Your Application in violation of any applicable U.S. laws or regulations, including U.S. Department of Commerce Export Administration Regulations, or permit any end-user to do so; or (vi) permit end-users to copy, distribute, transfer, modify or create derivatives of the Jog 101 software, except as part of Your Application in a manner consistent with Your obligations as set forth in this EULA.
2.    Records/Audit: You shall maintain complete and accurate records of each of Your employees and contractors that use the Jog 101 software for a period of three (3) years. In the event that one or more of such employees or contractors is no longer employed by You, You may substitute a replacement, provided that such records are promptly updated accordingly. Alejandro G. Carlstein Ramos Mejia and his affiliates may inspect such records upon request at any time during the term of this EULA and for three years thereafter.
3.    Interoperability:In the event that You require information to achieve interoperability of the Jog 101 software with another software program or hardware device, You shall request such information as necessary from Alejandro G. Carlstein Ramos Mejia and his affiliates. Alejandro G. Carlstein Ramos Mejia and his affiliates may, in its sole discretion, provide such information, and shall, in any case, respond to any such request with information concerning its decision.
4.    General: All rights not expressly granted herein are expressly reserved.
C. FEES AND OTHER CONSIDERATION
1.    The license granted to You in this EULA for Jog 101 software is contingent upon Your payment to Alejandro G. Carlstein Ramos Mejia and his affiliates of the Subscription or License Fees for the Jog 101 software, if applicable, in accordance with Alejandro G. Carlstein Ramos Mejia and his affiliates’ pricing policies current as of the date of Your acquisition of the Jog 101 software.
2.    Subscription Fees, License Fees and any applicable Annual Technical Support Fee for Your first year of Jog 101 software use are due and payable in advance of Your use of the Jog 101 software, unless other payment terms are mutually agreed by both parties in writing.
3.    Any applicable License Fees and Technical Support Fees are exclusive of any applicable taxes. You agree that You shall be responsible for the payment of all taxes related to the Jog 101 software, Your Application, and this EULA, other than taxes based upon Alejandro G. Carlstein Ramos Mejia and his affiliates’ income.
4.    Additional Consideration – Publicity: In further consideration of the licenses granted hereunder, You agree to permit Alejandro G. Carlstein Ramos Mejia and his affiliates to use Your name and trademarks to identify You as a Alejandro G. Carlstein Ramos Mejia and his affiliates customer on Alejandro G. Carlstein Ramos Mejia and his affiliates’ web site(s), in Alejandro G. Carlstein Ramos Mejia and his affiliates marketing materials and in other sales and marketing activities. Alejandro G. Carlstein Ramos Mejia and his affiliates agrees to cooperate with You in reasonable publicity efforts involving the Jog 101 software, such as, for example, media releases and marketing materials in accordance with Your reasonable request.
D. INTELLECTUAL PROPERTY RIGHTS
1.    General: Alejandro G. Carlstein Ramos Mejia and his affiliates holds and retains all right, title and interest in and to the Jog 101 software, the related source code, any and all modifications to or derivatives of the Jog 101 software, and any and all associated patents, copyrights, and other intellectual property rights. All Jog 101 software is unpublished and confidential.
2.    Third Party: Certain portions of the Jog 101 software may be subject to the ownership rights of Alejandro G. Carlstein Ramos Mejia and his affiliates’ licensors and incorporated under license to Alejandro G. Carlstein Ramos Mejia and his affiliates. You will find any relevant information about third party ownership rights in the relevant notice, license and/or copyright files included with the programs. You retain all ownership to Your Application.
3.    Government: If you are acquiring the Jog 101 software on behalf of the U.S. Government, the following provisions apply: (i) if the Jog 101 software is supplied to DoD or any related agency or service, the Programs are classified as “Commercial Computer Software” and the Government is acquiring only rights as set forth in this EULA; and (ii) if the Jog 101 software is supplied to any other unit or agency of the U.S. Government, the Jog 101 software is considered “restricted computer software” and the Government’s rights in the Jog 101 software are set forth in the Federal Acquisition Regulations. The Contractor for the Programs is Alejandro G. Carlstein Ramos Mejia and his affiliates Corporation, 428 Forbes Avenue, Suite 2100, Pittsburgh, Pennsylvania 15219.
4.    Open Programs: This EULA does not apply to the Linux kernel or any other software tools, drivers or other components identified as subject to an open source license in the relevant notice, license and/or copyright files included with the programs (collectively the “Open Programs”). Open Programs may be supplied in the same electronic file transmission as the Jog 101 software, but are separate and distinct programs. The Jog 101 software is not subject to the GPL or any other open source license.
5.    Marks: You and Alejandro G. Carlstein Ramos Mejia and his affiliates hereby grants to the other the non-transferable, non-assignable, revocable right and license to use the other’s name and trademarks (“Marks”) solely in fulfillment of obligations and exercise of rights under this EULA. Each party shall adhere to each other’s policies regarding use of the other’s Marks, and shall retain the right to revoke permission to use such Marks.
6.    Injunctive Relief: You hereby acknowledge and agree that the Jog 101 software and related source code are proprietary and confidential to Alejandro G. Carlstein Ramos Mejia and his affiliates and that the Jog 101 software and related source code contain valuable Alejandro G. Carlstein Ramos Mejia and his affiliates trade secrets, the disclosure of which would cause Alejandro G. Carlstein Ramos Mejia and his affiliates irreparable harm for which monetary compensation would be inadequate. You therefore further agree that if You breach Your obligations under this EULA, Alejandro G. Carlstein Ramos Mejia and his affiliates shall be entitled to injunctive relief from a court of competent jurisdiction without the need to post any bond or demonstrate actual damages.
E. TECHNICAL SUPPORT
1.    Alejandro G. Carlstein Ramos Mejia and his affiliates Technical Support consists of the support described on the Alejandro G. Carlstein Ramos Mejia and his affiliates web sites, including http://www.jog101.com and http://www.acarlstein.com
2.    Installation of the Jog 101 software may require entry of specific key codes issued by Alejandro G. Carlstein Ramos Mejia and his affiliates to You. You agree to the use of these key codes in accordance with this EULA and with the Terms of Service for the Alejandro G. Carlstein Ramos Mejia and his affiliates Service, to hold these key codes in confidence and to not disclose them to any third parties.
F. TERM AND TERMINATION
1.    This EULA shall become effective on the date of Your first use of the Jog 101 software and shall remain in full force and effect until terminated under this Section F.
2.    The rights granted under the License Grant section of this EULA shall automatically terminate if You breach any of the provisions contained herein, including any failure to pay license fees, if applicable. You may terminate the License Grant section of this EULA at any time upon notice to Alejandro G. Carlstein Ramos Mejia and his affiliates. Such termination will not entitle You to any refund of any fees. All other provisions of this EULA shall survive any such termination.
G. NO WARRANTY
1.    The Jog 101 software is provided “AS IS” without warranty of any kind, express or implied, including without limitation any implied warranties of merchantability, fitness for a particular purpose or non-infringement.
2.    Pre-Release Software may not be fully tested, debugged, or otherwise readied for production use. Any information provided by Alejandro G. Carlstein Ramos Mejia and his affiliates regarding the development status of Pre-Release Software is for Informational Purposes Only.
H. INDEMNIFICATION
You agree to indemnify, defend and hold Alejandro G. Carlstein Ramos Mejia and his affiliates harmless from and against any and all claims, suits, damages, costs and expenses arising from Your use of the Jog 101 software, howsoever arising.
I. INFRINGEMENT
1.    Alejandro G. Carlstein Ramos Mejia and his affiliates will defend or settle, at its option and expense, any action brought against You in the United States, Canada, Japan, or member state of the European Union which alleges that any standard, generally supported Jog 101 software infringes a patent or copyright or misappropriates a trade secret in such jurisdiction. Alejandro G. Carlstein Ramos Mejia and his affiliates will pay any costs and damages finally awarded against You that are attributable to the action.You understand and agree that as conditions to Alejandro G. Carlstein Ramos Mejia and his affiliates’ obligations under this section must: (a) notify Alejandro G. Carlstein Ramos Mejia and his affiliates promptly in writing of the action; (b) provide Alejandro G. Carlstein Ramos Mejia and his affiliates all reasonable information and assistance to settle or defend the action; and (c) grant Alejandro G. Carlstein Ramos Mejia and his affiliates sole authority and control of the defense or settlement of the action.
2.    If a claim is made under Subsection 1 Alejandro G. Carlstein Ramos Mejia and his affiliates may, at its option and expense, either: (a) replace or modify the Jog 101 software so that it becomes non-infringing; (b) procure for You the right to continue using the Jog 101 software; or (c) require the return of the Jog 101 software and refund to You any fees paid, less a reasonable allowance for use.
3.    Alejandro G. Carlstein Ramos Mejia and his affiliates has no liability to You if the claim is based upon: (a) the combination of the Jog 101 software with any product not furnished by Alejandro G. Carlstein Ramos Mejia and his affiliates; (b) the modification of the Jog 101 software other than by Alejandro G. Carlstein Ramos Mejia and his affiliates or as directed by Alejandro G. Carlstein Ramos Mejia and his affiliates; (c) the continued use of the infringing Jog 101 software when Alejandro G. Carlstein Ramos Mejia and his affiliates has provided You with a current unaltered release of a non-infringing Jog 101 software in accordance with Subsection 2(a); (d) the use of Jog 101 software as part of an infringing process; (e) a product that You make, use, or sells; (f) any Trial Software or Pre-release Software; (g) any third party software provided by Alejandro G. Carlstein Ramos Mejia and his affiliates’ licensors who do not provide such indemnification to You or (h) infringement by You that is deemed willful. In the case of (h), You shall reimburse Alejandro G. Carlstein Ramos Mejia and his affiliates for its reasonable attorney fees and other costs related to the action.
4.    THIS SECTION I IS SUBJECT TO SECTION J AND STATES THE ENTIRE LIABILITY OF ALEJANDRO G. CARLSTEIN RAMOS MEJIA AND HIS AFFILIATES AND ITS LICENSORS AND YOUR SOLE AND EXCLUSIVE REMEDY WITH RESPECT TO ANY ALLEGED PATENT OR COPYRIGHT INFRINGEMENT OR TRADE SECRET MISAPPROPRIATION BY ANY JOG 101 SOFTWARE LICENSED UNDER THIS AGREEMENT
J. LIMITATION OF LIABILITY
To the maximum extent permitted by applicable law and notwithstanding the failure of any remedy to fulfill its essential purpose: In no event shall Alejandro G. Carlstein Ramos Mejia and his affiliates, Alejandro G. Carlstein Ramos Mejia and his affiliates’ officers, directors, employees, agents, or distributors be liable to You or any other party for any loss or damages or legal fees arising from or related to the use of the Jog 101 software, howsoever arising, or any damages related to this EULA in excess of the amount of fees paid hereunder in the twelve (12) months preceding the event giving rise to the claim; and, in no event shall Alejandro G. Carlstein Ramos Mejia and his affiliates, Alejandro G. Carlstein Ramos Mejia and his affiliates’ officers, directors, employees, agents, or distributors be liable for any indirect, special, punitive, or consequential damages, including without limitation, loss of profits, howsoever arising, even if informed of the possibility of such damages.
K. DISPUTE RESOLUTION
In the event of a dispute between You and Alejandro G. Carlstein Ramos Mejia and his affiliates arising in connection with this EULA, such dispute shall be resolved, at Alejandro G. Carlstein Ramos Mejia and his affiliates’ sole option, by binding arbitration under the rules and auspices of the American Arbitration Association. Arbitration shall take place in the Commonwealth of Pennsylvania, U.S.A. The foregoing shall not prevent Alejandro G. Carlstein Ramos Mejia and his affiliates from seeking applicable injunctive relief in a court of competent jurisdiction.
L. CHOICE OF LAW AND FORUM
This EULA shall be governed for all purposes by the laws of the Commonwealth of Pennsylvania, excluding choice of law provisions. Any action or proceeding seeking to enforce any provision of, or based on any right arising out of, this EULA may be brought against You or Alejandro G. Carlstein Ramos Mejia and his affiliates in any of the courts of the Commonwealth of Pennsylvania, including United States District Courts. You consent to the jurisdiction of such courts in any such action or proceeding and waive any objection to venue laid therein. Process in any action or proceeding referred to in the preceding sentence may be served on either party to this EULA anywhere in the world. You expressly agree that the United Nations Convention on Contracts for the International Sale of Goods will not apply to this EULA.
M. GENERAL
This EULA contains the entire agreement and understanding between You and Alejandro G. Carlstein Ramos Mejia and his affiliates. Additional or conflicting terms on any purchase order or other document issued by You will have no force or effect against Alejandro G. Carlstein Ramos Mejia and his affiliates. This EULA may not be modified or appended except by an agreement in writing signed by the party against whom enforcement is sought. If any provision of this EULA is held to be invalid or unenforceable under any circumstances, its application in any other circumstances and the remaining provisions of this EULA shall not be affected. This EULA may not be assigned by You without the prior written consent of Alejandro G. Carlstein Ramos Mejia and his affiliates. No waiver by either party of any rights under this EULA will be effective unless such waiver is in a writing signed by the party against whom enforcement is sought. Any notices relating to this EULA should be sent via receipted delivery to Alejandro G. Carlstein Ramos Mejia and his affiliates 3005 Swan Point Ct., Evans CO 80620

TERMS AND CONDITIONS
This agreement applies as between you, the User, the owner(s) of this Application. Your agreement to comply with and be bound by these terms and conditions is deemed to occur upon your first use of the Application. If you do not agree to be bound by these Terms and Conditions, you should stop using the Application immediately.
1. Definitions and Interpretation
In this Agreement the following terms shall have the following meanings:
•    “Author(s)” means Alejandro G. Carlstein Ramos Mejia and his affiliates.
•    “Application” Means the iPhone application “Jog101” developed by Author(s) and its associated web site.
•    “User” / “Users” means any third party that accesses the Jog 101 application or any application done by Author(s) and is not employed by Author(s) and acting in the course of their employment;
•    “Content” means any text, graphics, images, audio, video, software, data compilations and any other form of information capable of being stored in a computer that appears on or forms part of this Application;
•    “Service” means collectively any online facilities, tools, services or information that Author(s) makes available through the Application either now or in the future;
•    “System” means any online communications infrastructure that Author(s) makes available through the Application either now or in the future.
2. Intellectual Property
2.1 Subject to the exceptions in Clause 3 of these Terms and Conditions, all Content included on the Application, unless uploaded by Users, including, but not limited to, text, graphics, logos, icons, images, sound clips, video clips, data compilations, page layout, underlying code and software is the property of Author(s), or our affiliates. By continuing to use the Application you acknowledge that such material is protected by applicable Unites States and International intellectual property and other laws.
2.2 Subject to Clause 4 of these Terms and Conditions you may print, reproduce, copy, distribute, store or in any other fashion re-use Content from the Application for personal purposes only unless otherwise indicated on the Application or unless given express written permission to do so by Author(s). Personal use includes, but is not limited to, recreational use, social use, and use in education as a student or teacher. Specifically you agree that:
2.2.1 you will not use the Content of the Application for commercial purposes; and
2.2.2 you will not systematically copy Content from the Application with a view to creating or compiling any form of comprehensive collection, compilation, directory or database unless given express written permission to do so by Author(s).
3. Third Party Intellectual Property
Where expressly indicated, certain Content and the Intellectual Property Rights subsisting therein belongs to other parties. This Content, unless expressly stated to be so, is not covered by any permission granted by Clause 2 of these Terms and Conditions to use Content from the Application. Any such Content will be accompanied by a notice providing the contact details of the owner and any separate use policy that may be relevant.
4. Fair Use of Intellectual Property
Material from the Application may be re-used without written permission where any of the exceptions detailed in the U.S. Patents and Copyright law apply.
5. Links to Other Web Sites
This Application may contain links to other sites. Unless expressly stated, these sites are not under the control of Author(s) or that of our affiliates. We assume no responsibility for the content of such web sites and disclaim liability for any and all forms of loss or damage arising out of the use of them. The inclusion of a link to another site from this Application does not imply any endorsement of the sites themselves or of those in control of them.
6. Use of Communications Facilities and Content Submission
6.1 When using the communication facilities of the Application and when submitting Content to the Application you should do so in accordance with the following rules:
6.1.1 you must not use obscene or vulgar language;
6.1.2 you must not submit Content that is unlawful or otherwise objectionable. This includes, but is not limited to, Content that is abusive, threatening, harassing, defamatory, ageist, sexist or racist;
6.1.3 you must not submit Content that is intended to promote or incite violence;
6.1.4 it is advised that posts on message boards, chat facilities or similar and communications with Author(s) are made using the English language(s) as we may be unable to respond to enquiries submitted in any other languages;
6.1.5 content submissions are required to be made using the English language(s). Content in any other language may be removed at our sole discretion;
6.1.6 you must not include links to other web sites containing any of the above types of Content;
6.1.7 the means by which you identify yourself must not violate these terms of use or any applicable laws;
6.1.8 you must not engage in any form of commercial advertising. This does not prohibit references to businesses for non-promotional purposes including references where advertising may be incidental;
6.1.9 you must not impersonate other people, particularly employees and representatives of Author(s) or our affiliates;
6.1.10 you must not submit material that may contain viruses or any other software or instructions that may damage or disrupt other software, computer hardware or communications networks; and
6.1.11 you must not use our Application for unauthorised mass-communication such as “spam” or “junk mail”.
6.2 You acknowledge that Author(s) reserves the right to monitor any and all communications made to us or using our System.
6.3 In order to use the message facility of the Application and any other communication facility that may be added in the future or to submit Content, you may be required to submit certain personal details. By continuing to use this Application you represent and warrant that:
6.3.1 any information you do submit is accurate and truthful; and
6.3.2 you will keep this information accurate and up-to-date.
6.4 By submitting Content you warrant and represent that you are the author of such Content or that you have acquired all of the appropriate rights and / or permissions to use the Content in this fashion. Further, you waive all moral rights in the Content to be named as its author and grant Author(s) a licence to modify the Content as necessary for its inclusion in the Application. Author(s) accepts no responsibility or liability for any infringement of third party rights by such Content.
6.5 Unless a User informs Author(s) otherwise, in advance of posting, in writing, and Author(s) agrees to any terms or restrictions, all Content submitted is for publication on the Application and Website and other such uses as Author(s) may deem appropriate under a royalty-free, perpetual basis.
6.6 Author(s) will not be liable in any way or under any circumstances for any loss or damage that you may incur as a result of such Content, nor for any errors or omissions in the Content. Use of and reliance upon such Content is entirely at your own risk.
6.7 Content submitted by Users is not screened by Author(s) prior to appearing online. We retain the right to exercise our sole discretion to remove or relocate any Content as we deem appropriate without the consent of the author. We shall be under no obligation to exercise such discretion. If you wish to enquire as to the removal of Content, please submit your query to contact@shinydevelopment.com. This does not constitute an undertaking to explain our actions.
7. Termination and Suspension
In the event that any of the provisions of Sub-Clause 6.1, above, are not followed, Author(s) reserves the right to suspend or terminate your access to the Service. Any Users banned in this way must not attempt to use the Website under any other name or by using the access credentials of another User, with or without the permission of that User.
8. Privacy
Use of the Application is also governed by our privacy policy which is incorporated into these Terms and Conditions by this reference. To view the Privacy Policy, please click on the link above.
9. Disclaimers
9.1 Author(s) makes no warranty or representation that the Application will meet your requirements, that it will be of satisfactory quality, that it will be fit for a particular purpose, that it will not infringe the rights of third parties, that it will be compatible with all systems, that it will be secure and that all information provided will be accurate. We make no guarantee of any specific results from the use of our Services.
9.2 No part of this Application is intended to constitute advice and the Content of this Application should not be relied upon when making any decisions or taking any action of any kind.
9.3 Commercial use of the Content of this Application is forbidden under Clause 2.2.1 of these Terms and Conditions. Any such use constitutes a breach of these Terms and Conditions and Author(s) makes no representation or warranty that this Content is suitable for use in commercial situations or that it constitutes accurate data and / or advice on which business decisions can be based.
9.4 Whilst every effort has been made to ensure that all descriptions of services available from Author(s) correspond to the actual services available, Author(s) is not responsible for any variations from these descriptions.
10. Availability of the Application
The Service is provided “as is” and on an “as available” basis. We give no warranty that the Service will be free of defects and / or faults. To the maximum extent permitted by the law we provide no warranties (express or implied) of fitness for a particular purpose, accuracy of information, compatibility and satisfactory quality.
Author(s) accepts no liability for any disruption or non-availability of the Application resulting from external causes including, but not limited to, ISP equipment failure, host equipment failure, communications network failure, power failure, natural events, acts of war or legal restrictions and censorship.
11. Limitation of Liability
11.1 To the maximum extent permitted by law, Author(s) accepts no liability for any direct or indirect loss or damage, foreseeable or otherwise, including any indirect, consequential, special or exemplary damages arising from the use of the Application or any information contained therein. Users should be aware that they use the Application and its Content at their own risk.
11.2 Nothing in these terms and conditions excludes or restricts Author(s)’s liability for death or personal injury resulting from any negligence or fraud on the part of Author(s).
11.3 Whilst every effort has been made to ensure that these terms and conditions adhere strictly with the relevant provisions of the Consumer Affairs Act, in the event that any of these terms are found to be unlawful, invalid or otherwise unenforceable, that term is to be deemed severed from these terms and conditions and shall not affect the validity and enforceability of the remaining terms and conditions. This term shall apply only within jurisdictions where a particular term is illegal.
12. No Waiver
In the event that any party to these Terms and Conditions fails to exercise any right or remedy contained herein, this shall not be construed as a waiver of that right or remedy.
13. Previous Terms and Conditions
In the event of any conflict between these Terms and Conditions and any prior versions thereof, the provisions of these Terms and Conditions shall prevail unless it is expressly stated otherwise.
14. Notices
All notices / communications shall be given to us either by post to our Premises (see address above) or by email info@developingdreams.net. Such notice will be deemed received 3 days after posting if sent by first class post, the day of sending if the email is received in full on a business day and on the next business day if the email is sent on a weekend or public holiday.
15. Law and Jurisdiction
These terms and conditions and the relationship between you and Author(s) shall be governed by and construed in accordance with the Law of United States of America and Author(s) and you agree to submit to the exclusive jurisdiction of the Courts of United States of America.

 

PRIVACY POLICY
The author, Alejandro G. Carlstein Ramos Mejia, operates the website http://jog101.com and application Job 101. The author have to policy of respecting your privacy regarding any information we may collect while operating our website.
Usage Statistics
Like most website operators, Author collects non-personally-identifying information of the sort that web browsers and servers typically make available, such as the browser type, language preference, referring site, and the date and time of each visitor request. Author’ purpose in collecting non-personally identifying information is to better understand how Author’ visitors use its website. From time to time, Author may release non-personally-identifying information in the aggregate, e.g., by publishing a report on trends in the usage of its website.
Author may also collect non-personally-identifying information from use of its software applications such as computer or device type, version of underlying operating system and version of the software being used.
Author may also collects potentially personally-identifying information like Internet Protocol (IP) addresses. In case Author does collect any potentially personally-identifying information, Author does not use such information to identify its visitors, however, and does not disclose such information, other than under the same circumstances that it uses and discloses personally-identifying information, as described below.
Gathering of Personally-Identifying Information
Certain visitors to Author’s website choose to interact with Author in ways that require Author to gather personally-identifying information. The amount and type of information that Author gathers depends on the nature of the interaction. In each case, Author collects such information only insofar as is necessary or appropriate to fulfill the purpose of the visitor’s interaction with Author. Author does not disclose personally-identifying information other than as described below. And visitors can always refuse to supply personally-identifying information, with the caveat that it may prevent them from engaging in certain website-related activities.
Protection of Certain Personally-Identifying Information
Author discloses potentially personally-identifying and personally-identifying information only to those of its employees, contractors and affiliated organizations that (i) need to know that information in order to process it on Author’s behalf or to provide services available at Author’s websites, and (ii) that have agreed not to disclose it to others. Some of those employees, contractors and affiliated organizations may be located outside of your home country; by using Author’s websites, you consent to the transfer of such information to them. Author will not rent or sell potentially personally-identifying and personally-identifying information to anyone. Other than to its employees, contractors and affiliated organizations, as described above, Author discloses potentially personally-identifying and personally-identifying information only when required to do so by law, or when Author believes in good faith that disclosure is reasonably necessary to protect the property or rights of Author, third parties or the public at large. If you are a registered user of a Author website and have supplied your email address, Author may occasionally send you an email to tell you about new features, solicit your feedback, or just keep you up to date with what’s going on with Author and our products. We primarily use our various product blogs and Twitter to communicate this type of information, so we expect to keep this type of email to a minimum. If you send us a request (for example via a support email or via one of our feedback mechanisms), we reserve the right to publish it in order to help us clarify or respond to your request or to help us support other users. Author takes all measures reasonably necessary to protect against the unauthorized access, use, alteration or destruction of potentially personally-identifying and personally-identifying information.
Cookies
A cookie is a string of information that a website stores on a visitor’s computer, and that the visitor’s browser provides to the website each time the visitor returns. Author uses cookies to help Author identify and track visitors, their usage of Author website, and their website access preferences. Author visitors who do not wish to have cookies placed on their computers should set their browsers to refuse cookies before using Author’s websites, with the drawback that certain features of Author’s websites may not function properly without the aid of cookies.
Privacy Policy Changes
Although most changes are likely to be minor, Author may change its Privacy Policy from time to time, and in Author’s sole discretion. Author encourages visitors to frequently check this page for any changes to its Privacy Policy. Your continued use of Author’s sites after any change in this Privacy Policy will constitute your acceptance of such change.

Share
Leave a comment

Swift: UIPickerView: Get the Columns Width plus Set Columns Label

The following swift code will give show you how to obtain the width from the first column plus how to set up all the columns’ label

func pickerView(pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusingView view: UIView!) -> UIView {
       
 
        // Display the first column's width
        // The value 0 is to point to the first column regardless if you have one or multiple columns
        NSLog("Width: \(pickerView.rowSizeForComponent(0).width)")
        
        let pickerLabel : UILabel = UILabel()
       
       // pickerViewLabelTextForComponentRow is a custom made function to obtain what text will go in each row  
        pickerLabel.text = pickerViewLabelTextForComponentRow(component, row: row)
        pickerLabel.textAlignment = NSTextAlignment.Center
        pickerLabel.textColor = UIColor.blackColor()
        pickerLabel.font = UIFont.boldSystemFontOfSize(13.0)
        pickerLabel.backgroundColor = UIColor.lightGrayColor()

       // If you wish to set up the labels individually in each column, use the value of the parameter component with a control condition such as if or switch
        
        return pickerLabel
    }
Share
Leave a comment

Playing with Swift

Let say that we have an array of strings:

var cities: [String] = [“San Francisco”, “Denver”];

You can change one string elements of this array given an index.
In this case we change from “San Francisco” to Miami:

cities[0] = “Miami”;

 

Now, let assume we wish to print the last letter of the first string in the array.

This first intent fails:

println(cities[0][advance(cities[0].startIndex, 4)]);

This will fail too:

let index = 4;
println(cities[0][index]);

 

However, this will success:
println(cities[0][advance(cities[0].startIndex, 4)]);

Share
Leave a comment