Gesture Recognizing in iOS
Gesture Recognizing in iOS
1)Tapping (UITapGestureRecognizer): Tapping one or more fingers on the screen.
2)Long Pressing (UILongPressGestureRecognizer): Pressing one or more fingers to the screen for a specific period of time.
3)Pinching (UIPinchGestureRecognizer): Pinching to close or expand something.
4)Rotating (UIRotationGestureRecognizer): Sliding two fingers in a circular moton.
5)Swiping (UISwipGestureRecognizer): Swiping with one ormore fingers in a specific direction.
6)Panning (UIPanGestureRecognizer): Touching and dragging.
7) Shaking : Physically shaking the iOS device.
see also iOS Layers
framework for Email Application in iOS
Which framework need for Email Application in iOS
- MessageUI.framework
see also sqlite access controls
add column in already created table.
How to add column in already created table.
- ALTER TABLE table-name ADD COLUMN column-name column-type;
ex : - ALTER TABLE Student ADD COLUMN StudentID Integer;
see also sqlite operators
rename table in SQLite3
How to rename table in SQLite3
- ALTER TABLE old-table-name RENAME TO new-table-name;
see also Deleting SQLite3 table
model transition style
What are the model transition style.?
- There are four transition style.
1) UIModelTransitionStyleFilpHorizontal
2) UIModelPresentationPageSheet
3) UIModelTransitionStyleCoverVertical
4) UIModelTransitionStyleCrossDissolve
see also History of Mobile OS
custom font in ios
How to set custom font on table text labels.
- Cellobj.textLabel.font=[UIFont fontWithName=@”tahoma” size=18.0];
see also touchesEnded:withEvent method
UIPickerViewDelegate methods
UIPickerViewDelegate methods
- All are the @optional method.
- Following method are some selected important method for more read on Apple offical document.
- 1) -(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger *)component;
- 2) -(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component;
- 3) -(CGFloat)pickerView : (UIPickerView *)pickerView widthForComponent:(NSInteger)component;
4) -(CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent(NSInteger)component;
read about Memory Management in SQLite3
require method of UIPickerViewDataSource
Which are the required method in UIPickerViewDataSource method
- There are two required method.
-(NSInteger)pickerView:(UIPickerView *)pickerView;
-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component;
Quartz 2D and OpenGL ES
What is Quartz 2D and OpenGL ES
- Quartz 2D is a part of the Core Graphics framework and OpenGL ES is a cross-platfrom graphics library called OpenGL.
- OpenGL ES is a slimmed down version of another cross-platform graphic library called OpenGL.
- OpenGL ES is a subset of OpenGL designed specifically for embedded systems such as the iPhone.
- Quartz is a set of functions, datatypes, and objects.
touchesEnded:withEvent method
Explain touchesEnded:withEvent method
- Gets called when the user lifts that finger off of the screen. Just like in the touchesMoved:withEvent: method, all we do is store off the final location in the lastTouch variable and indicate that the view needs to be redrawn.
ouchesMoved:withEvent method.
Explain touchesMoved:withEvent method.
- Gets continuously called while the user is dragging a finger on the screen.
Memory Managment in SQLite3
Memory Managment in SQLite3.
- When SQLite needs to dynamically allocate memory, it normally calls the default memory handler of the underlying operating system. This causes SQLite to allocate its memory from the application heap.
- SQLite memory management functions:
- sqlite3_malloc()
- sqlite3_realloc()
- sqlite3_free()
- void* sqlite3_malloc( int numBytes ) Allocates and returns a buffer of the size specified. If the memory cannot be allocated, a NULL pointer is returned. Memory will always be 8-byte (64-bit) aligned.
- void* sqlite3_realloc( void *buffer, int numBytes ) Used to resize a memory allocation. Buffers can be made larger or smaller. Given a buffer previously returned by sqlite3_malloc() and a byte count, *_realloc() will alloc new buffer of the specified size and copy as much of the old buffer as will fit into the new buffer. It will then free the old buffer and return the new buffer. If the new buffer cannot be allocated, a NULL is returned and the original buffer is not freed.
- void sqlite3_free( void *buffer )
- Releases a memory buffer previously allocated by sqlite3_malloc() or sqlite3_realloc().
What is VFS
What is VFS
- VFS stand for Virtual File System.
- VFS module use to use with database connection.
- The VFS system acts as an abstraction layer between the SQLite library and any underlying storage system (such as a filesystem).
- In nearly all cases, you will want to use the default VFS module and can simply pass in a NULL pointer.
QLite standerd return codes
What are the SQLite standerd return codes
- SQLITE_OK Operation successful
SQLITE_ERROR Generic error
SQLITE_INTERNAL Internal SQLite library error
SQLITE_PERM Access permission denied
SQLITE_ABORT User code or SQL requested an abort
SQLITE_BUSY A database file is locked (usually recoverable)
SQLITE_LOCKED A table is locked
SQLITE_NOMEM Memory allocation failed
SQLITE_READONLY Attempted to write to a read-only database
SQLITE_INTERRUPT sqlite3_interrupt() was called
SQLITE_IOERR Some type of I/O error
SQLITE_CORRUPT Database file is malformed
SQLITE_FULL Database is full
SQLITE_CANTOPEN Unable to open requested database file
SQLITE_EMPTY Database file is empty
SQLITE_SCHEMA Database schema has changed
SQLITE_TOOBIG TEXT or BLOB exceeds limit
SQLITE_CONSTRAINT Abort due to constraint violation
SQLITE_MISMATCH Datatype mismatch
SQLITE_MISUSE API used incorrectly
SQLITE_NOLFS Host OS cannot provide required functionality
SQLITE_AUTH Authorization denied
SQLITE_FORMAT Auxiliary database format error
SQLITE_RANGE Bad bind parameter index
SQLITE_NOTADB File is not a database
For More Information Please Visit
swamios |
SQLite3 database connection functions and commands
SQLite3 database connection functions and commands.
- 1)sqlite3_open() – will result in a database with the default UTF-8 encoding.
2)sqlite3_open_v2() – will result in a database with the default UTF-8 encoding.
3)sqlite3_open_16() – is used to create a database, the default string encoding will be UTF-16 in the native byte order of the machine.
4)sqlite3_close() – To close and release a database connection.
5)sqlite3_errmsg() – This allows the caller to retrive an error message.
6)sqlite3_stmt – Once a database connection is established, we can start to execute SQL commands. This is normally done by preparing and stepping through statements.
7)sqlite3_prepare_v2() – The prepare process converts an SQL command string into a prepared statement. - *note : Preparing an SQL statement causes the command string to be parsed and converted into a set of byte-code commands. This byte-code is fed into SQLite’s Virtual Database Engine (VDBE) for execution.
8)sqlite3_step() – To execute the VDBE code.
9)sqlite3_column_count() – Returns the number of columns in the statement result.
10)sqlite3_column_name()/sqlite3_column_name16() – returns the name of the specified column as a UTF8 or UTF16 encoded string.
11)sqlite3_finalize()
12)sqlite3_reset()
13)sqlite3_free()
14)sqlite3_column_type() – return the native type (strong class) of the value found in the specified column.
15)sqlite3_column_blob() – returns a pointer to the BLOB value from the given column.
16)sqlite3_column_double() – returns a 64-bit floating-point value from the given column.
17)sqlite3_column_int() – returns a 32-bit signed integer from the given column.
18)sqlite3_column_int64() – return a 64-bit signed integer from the given column.
19)sqlite3_column_text()/sqlite3_column_text16() – returns a pointer to a UTF-8 or UTF-16 encoded string from the given column.
20)sqlite3_column_value() – returns a pointer to an unprotected sqlite3_value.
21)sqlite3_column_type() – to return undefined results.
22)sqlite3_column_bytes() – returns the number of byte in a BLOB or in a UTF-8 text value.
23)sqlite3_column_bytes16() – returns the number of bytes in UTF-16 encoded text value,including the terminator.
24)sqlite3_reset() – reset a prepared statements so that it is ready for another execution.
For More Information Please Visit
swamios |
Posting on Facebook in iOS
How to post on facebook in iOS.
- step 1- Select the singleView Application and give the name as ViewController& subClassOf UIViewController
- step 2- Add framework. select project ->> build phases ->> Link Binary With Libraries and search the “Social.framework” and click on add button again one more time search and add “Accounts.framework”
- step 3- in your viewController.h neccesary to import the framework.
- in viewController.h
- #import <UIKit/UIKit.h>
#import “Social/Social.h”
#import “Accounts/Accounts.h” - @interface ViewController : UIViewController
{
SLComposeViewController *mySLComoserSheet;
} - -(IBAction)PostToFacebook:(id)sender;
- @end
- After that go on viewController.m
- #import “viewController.h”
@interface viewController()
@end@implementation viewController
-(void)viewDidLoad
{
[super viewDidLoad];
}
-(IBAction)PostToFacebook:(id)sender
{ - mySLComoserSheet = [[SLComposeViewController alloc]init];
mySLComoserSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[mySLComoserSheet setInitialText:@”Hellow Steve post on Facebook”];
[self presentViewController:mySLComposerSheet animated:YES completion:NULL];} - step 4- this is a imporatant step. Select storybord > select viewController and add one Button in the view with the POST ON FB name.
- after that don’t forgot the connection PostToFacebook action method to Button. select touchUpInside.
- step 5 – using command+B build your project and command+R run ur project in simulator. run and test.
GROUP BY in SQLite
GROUP BY Example in SQLite using count,sum,average,HAVING
- First create table.
- CREATE TABLE x ( a, b );
INSERT INTO x VALUES ( 1, ‘Alice’ );
INSERT INTO x VALUES ( 2, ‘Bob’ );
INSERT INTO x VALUES ( 3, ‘Charlie’ ); - CREATE TABLE y ( c, d );
INSERT INTO y VALUES ( 1, 3.14159 );
INSERT INTO y VALUES ( 1, 2.71828 );
INSERT INTO y VALUES ( 2, 1.61803 ); - CREATE TABLE z ( a, e );
INSERT INTO z VALUES ( 1, 100 );
INSERT INTO z VALUES ( 1, 150 );
INSERT INTO z VALUES ( 3, 300 );
INSERT INTO z VALUES ( 9, 900 ); - select a, count(a) as count from z group by a;
|a|count
|1|2
|3|1
|9|1 - select a, sum(e) AS total from z group by a;
|a|total
|1|250
|3|300
|9|900 - sqlite> select a, sum(e), count(e),
…> sum(e)/count(e) as expr, avg(e) as agg
…> from z group by a;
|a| sum(e) |count(e) |expr| agg
|1| 250 |2 |125| 125.0
|3| 300 |1 |300| 300.0
|9| 900 |1 |900| 900.0 - select a, sum(e) as
For More Information Please Visit
swamios |
WHERE Example in SQLite using BETWEEN
WHERE Example in SQLite using BETWEEN
- First create table.
- CREATE TABLE x ( a, b );
INSERT INTO x VALUES ( 1, ‘Alice’ );
INSERT INTO x VALUES ( 2, ‘Bob’ );
INSERT INTO x VALUES ( 3, ‘Charlie’ ); - CREATE TABLE y ( c, d );
INSERT INTO y VALUES ( 1, 3.14159 );
INSERT INTO y VALUES ( 1, 2.71828 );
INSERT INTO y VALUES ( 2, 1.61803 ); - CREATE TABLE z ( a, e );
INSERT INTO z VALUES ( 1, 100 );
INSERT INTO z VALUES ( 1, 150 );
INSERT INTO z VALUES ( 3, 300 );
INSERT INTO z VALUES ( 9, 900 ); - select * from x where b= ‘Alice’;
|a|b
|1|Alice - range of values.
- select * from y where d between 1.0 and 3.0
|c|d
|1|2.71828
|2|1.61803 - sum of c and d
- select c,d c+d as sum from y where sum<4.0;
|c| d | sum
|1| 2.71828| 3.71828
|2| 1.61803| 3.61803
For More Information Please Visit
Example of joins in SQLite
Example using JOIN,AS,CROSS JOIN,JOIN ON,OUTER JOIN, Compound JOIN,Self JOIN
- First create table.
- CREATE TABLE x ( a, b );
INSERT INTO x VALUES ( 1, ‘Alice’ );
INSERT INTO x VALUES ( 2, ‘Bob’ );
INSERT INTO x VALUES ( 3, ‘Charlie’ ); - CREATE TABLE y ( c, d );
INSERT INTO y VALUES ( 1, 3.14159 );
INSERT INTO y VALUES ( 1, 2.71828 );
INSERT INTO y VALUES ( 2, 1.61803 ); - CREATE TABLE z ( a, e );
INSERT INTO z VALUES ( 1, 100 );
INSERT INTO z VALUES ( 1, 150 );
INSERT INTO z VALUES ( 3, 300 );
INSERT INTO z VALUES ( 9, 900 ); - select * from x;
- | a | b |
| 1 | Alice |
| 2 | Bob |
| 3 | Charlie| - select d, d*d AS dSquared FROM y;AS|d |dSquared
|3.14159 |9.8695877281
|2.71828 |7.3890461584
|1.61803 |2.6180210809here y table create time column name is c and d. after using select command using AS change the name.JOIN,CROSS JOIN - select * from x join y;
select * from x cross join y;
select * from x,y; - |a |b |c |d
|1 |Alice |1 |3.14159
|1 |Alice |1 |2.71828
|1 |Alice |2 |1.61803
|2 |Bob |1 |3.14159
|2 |Bob |1 |2.71828
|2 |Bob |2 |1.61803
|3 |Charlie |1 |3.14159
|3 |Charlie |1 |2.71828
|3 |Charlie |2 |1.61803JOIN…ON - select * from x join y on a=c;
|a| b |c| d
|1| Alice |1| 3.14159
|1| Alice |1| 2.71828
|2| Bob |2| 1.61803 - select * from x join z on x.a =z.a;
|a| b |a| e
|1| Alice |1| 100
|1| Alice |1| 150
|3| Charlie |3| 300OUTER JOIN - select * from x left outer join z using (a);
|a| b |e
|1| Alice |100
|1| Alice |150
|2| Bob |[NULL]
|3| Charlie |300Compound JOIN - select * from x join y on x.a = y.c left outer join z on y.c = z.a;|a| b |c| d | a| e
|1| Alice |1| 3.14159| 1| 100
|1| Alice |1| 3.14159| 1| 150
|1| Alice |1| 2.71828| 1| 100
|1| Alice |1| 2.71828| 1| 150
|2| Bob |2| 1.61803| [NULL]| [NULL]Self JOIN - select * from x as x1 join x as x2 on x1.a+1=x2.a;
|a| b |a| b
|1| Alice |2| Bob
|2| Bob |3| Charlie
For More Information Please Visit
FROM Clause in SQLite
Explain FROM Clause in SQLite
- The FROM clause takes one or more source tables from the database and combines them into one large table.
- Tables are combined using the JOIN operator.
- Three or more tables can be joined together by stringing a series of JOIN operator together.
- Joins are the most important and most powerful database operator. Joins are the only way to bring together information stored in different tables.
swamios |
Save-Points in SQLite
Whait is Save-Points in SQLite.
- SQLite also support save-point.
- Savepoints allow you to mark specific points in the transaction. You can then accept or rollback to individual save-points without having to commit or rollback an entire transaction. Unlike transactions, you can have more than one save-point active at the same time.
- Save-points are sometime called nested transaction.
- You can create a save-point with the SAVEPOINT command.
- Command : SAVEPOINT savepoint_name
- Save-points act as a stack. Whenever you create a new one, it is put at the top of the stack. Save-point identifiers do not need to be unique. If the same save-point identifier is used more than once, the one nearest to the top of the stack is used.
- To release a save-point and accept all of the proposed changes made since the savepoint was set, use the
- RELEASE command:
- RELEASE [SAVEPOINT] savepoint_name
- To cancel a set of commands and undo everything back to where a save-point was set, use the ROLLBACK TO command:
ROLLBACK [TRANSACTION] TO [SAVEPOINT] savepoint_name
swamios |
Virtual tables in SQLite
What is Virtual tables in SQLite.
- Virtual tables can be used to connect any data source to SQLite, including other databases.
- A virtual table is created with the CREATE VIRTUAL TABLE command.
- Virtual tables cannot be made temporary, nor do they allow for an IF NOT EXISTS clause. To drop a virtual table, you use the normal DROP TABLE command.
Deleting SQLite table
How to delete SQLite table.
- Using DROP TABLE commands.
- Drop Table commnads deletes a table and all of the data it contains.
- synatax : drop table table_name
SQLite Datatypes
How many datatypes support in SQLite or SQLite Datatypes are.
- SQLite support only five concrete datatypes.i.e NULL,Integer,Float,Text,BLOB.
- 1) NULL – A NULL is considered its own distinct type. A NULL type does not hold a value. Literal NULLs are represented by the keyword NULL.
- 2)Integer – size is 8 bytes. range -9,223,372,036,854,775,808 to +9,223,372, 036,854,775,807,(19 digits)
- 3)Float – A floating-point number, stored as an 8-byte value in the processor’s native format. For nearly all modern processors, this is an IEEE 754 double-precision number. Literal floating-point numbers are represented by any bare series of numeric digits that include a decimal point or exponent.
- 4)Text -A variable-length string, stored using the database encoding (UTF-8, UTF-16BE, or UTF-16LE). Literal text values are represented using character strings in single quotes.
- 5)BLOB – A length of raw bytes, copied exactly as provided. Literal BLOBs are represented as hexadecimal text strings preceded by an x. For example, the notation x’1234ABCD’ represents a 4-byte BLOB. BLOB stands for Binary Large OBject.
For More Information Please Visit
Explain DCL
Explain DCL
- DCL stand for Data Control Language.
- By usign DCL you can give file permission using its grant or revoke access control.
- DCL commands used to allow or deny specific data user permision to utilize or access specific resource within a database.
- DCL commands used to allow or deny group of users permision to utilize or access specific resource within a database.
- ex of DCL commands.
- GRANT – used to assign a permission.
- REVOKE – used to delete and existing permission
Explain TCL
Explain TCL
- TCL stand for Transaction Control Language.
- DML and DDL is the TCL.
- TCL commands can be used to control transaction of DML amd DDL commands.
- ex of TCL commands.
BEGIN – used to begin a multistatement transaction.
COMMIT – used to end and accept a transaction.
swamios research and technology |
Explain DDL
Explain DDL
- DDL stand for Data Defination Language.
- By using DDL refers to command that define the structure of table, views, indexes and other data containers and objects within the database.
- ex of DDL commands.
CREATE TABLE – used to create new tbl.
DROP VIEW – used to delete a view.
SWAMIOS |
SQLite Operators
SQLite Operators
- SQLite support unary prefix operators.
1) – +
2) ~
3) NOT (for boolean expr..)
4) || (for string concatenation)
5) + – * / % (standerd arithmetic operators)
6) | & << >> (bitwise operator or, and, shift-high,shift-low)
7) < <= => > (Comparison test operator less-than, less-than or equal, greater-than or equal, greater-than)
8) = == != <> (Equality test operator. = and == will test for equality while != and <> test for inequality.
9) IN LIKE GLOB MATCH REGEXP(these are five keywords)
10) AND OR (Logical operators)
swamios |
SQL statement terminated with a semicolon
SQL statement terminated with a “;”(semicolon).
- If you’re using an interactive application, such as the sqlite3 command-line tool, then you’ll need to use a semicolon to indicate the end of a statement.
What is Amalgamation.
What is Amalgamation.
- The official code distribution is known as the amalgamation. The amalgamation is a single C source file that contains the entire SQLite core. It is created by assembling the individual development files into a single C source file that is almost 4 megabytes in size and over 100,000 lines long.
- The amalgamation has two main advantages. First, with everything in one file, it is extremely easy to integrate SQLite into a host application. Many projects simply copy the amalgamation files into their own source directories. It is also possible to compile the SQLite core into a library and simply link the library into your application.Second, the amalgamation also helps improve performance. Many compiler optimizations are limited to a single translation unit. In C, that’s a single source file. By putting the whole library into a single file, a good optimizer can process the whole package at once.
- When working with the amalgamation, there are four important source files:
1)sqlite3.c
2)sqlite3.h
3)sqlite3ext.h
4)shell.c - sqlite3.c and sqlite3.h, are all that is needed to integrate SQLite into most applications.
- The shell.c file contains the source code for the sqlite3 command-line shell. All of these files can be built on Linux, Mac OS X, or Windows, without any additional configuration files.
swamios |
For More Information Please Visit
SQLite Access Control.
SQLite Access Control.
- SQLite database has no authentication data.
- SQLite dependes on filesystem permission to control access to the raw database file.
- There are three type/limit of access
1)read/write access.
2)read-only access.
3)write access
Can SQLite able to access read-only database file.?
Ans:- Yes.
swamios |
For More Information Please Visit
Creating table in SQLite3
How to create table in SQLite3
- Syntax: create table if not exixts table_name (column-def [, column-def]*[,constraint]* note: constraint means give primary key autoinc etc…
OR - Syntax: create table table_name(columnField, columnDataType)
- Query: create table if not exists dummyData(dummyId integer, dummyName text);
Subscribe to:
Posts (Atom)