Followers

Wednesday, August 22, 2012

IPhone & J2ME APPLICATION DEVELOPER: Iphone Numeric sorting

IPhone & J2ME APPLICATION DEVELOPER: Iphone Numeric sorting

Iphone Numeric sorting

Iphone Numeric sorting For Array objects

NSArray *unsortedArray = [NSArray arrayWithObjects:@"Hello", @"4", @"Hi", @"5", @"2", @"10", @"1", nil];
NSArray *sortedArray = [unsortedArray sortedArrayUsingComparator:^(id firstObject, id secondObject) {
   
return [((NSString *)firstObject) compare:((NSString *)secondObject) options:NSNumericSearch];
}];


Iphone Numeric sorting string For Array objects

Tuesday, January 4, 2011

iphone basic question

http://www.otierney.net/objective-c.html#inheritance

http://www.google.co.in/#hl=en&q=id+in+objective-c&aq=f&aqi=&aql=&oq=&gs_rfai=&fp=bc4921db69ff5ed7

http://en.wikipedia.org/wiki/Objective-C#Interfaces_and_implementations

http://en.wikipedia.org/wiki/Cocoa_(API)

http://www.google.co.in/#hl=en&q=what+is+ns+in+objective-c&aq=9m&aqi=g8g-m2&aql=&oq=ns+in+&gs_rfai=&fp=bc4921db69ff5ed7

Tuesday, August 31, 2010

Model-view-controller

The Smalltalk teams at Xerox PARC eventually settled on a design philosophy that led to easy development and high code reuse. Known as "model-view-controller" (MVC), the concept breaks an application into three sets of interacting object classes. Model classes represent raw data, such as documents, settings files, or objects in memory. Views are, as the name implies, visual representations of the data in the model. Controller classes contain logic which links the models to their views, and maintains state to keep them synchronized.

Cocoa's design is a strict application of MVC principles. Under OpenStep, most of the classes provided were either high-level View classes (in AppKit) or one of a number of relatively low-level model classes like NSString. Compared to similar MVC systems, OpenStep lacked a strong model layer. There was no stock class which represented a "document," for instance. During the transition to Cocoa, the model layer was expanded greatly, introducing a number of pre-rolled classes to provide functionality common to desktop applications.

In Mac OS X 10.3, Apple introduced the NSController family of classes, which provide predefined behavior for the controller layer. These classes are considered part of the Cocoa Bindings system, which also makes extensive use of protocols such as Key-Value Observing and Key-Value Binding. The term 'binding' refers to a relationship between two objects, often between a view and a controller. Bindings allow the developer to focus more on declarative relationships rather than orchestrating fine-grained behavior.

With the arrival of Mac OS X 10.4, Apple extended this foundation further by introducing the Core Data framework, which standardizes change tracking and persistence in the model layer. In effect, the framework greatly simplifies the process of making changes to application data, undoing changes (if necessary), saving data to disk, and reading it back in.

By providing framework support for all three MVC layers, Apple's goal is to reduce the amount of boilerplate or "glue" code that developers have to write, freeing up resources to spend time on application-specific features.

Main frameworks

Cocoa consists primarily of two Objective-C object libraries called frameworks. Frameworks are functionally similar to shared libraries, a compiled object that can be dynamically loaded into a program's address space at runtime, but frameworks add associated resources, header files, and documentation.

Foundation Kit, or more commonly simply Foundation, first appeared in OpenStep. On Mac OS X, it is based on Core Foundation. Foundation is a generic object-oriented library providing string and value manipulation, containers and iteration, distributed computing, run loops, and other functions that are not directly tied to the graphical user interface. The "NS" prefix, used for all classes and constants in the framework, comes from Cocoa's NeXTSTEP heritage.

Application Kit or AppKit is directly descended from the original NeXTSTEP Application Kit. It contains code with which programs can create and interact with graphical user interfaces. AppKit is built on top of Foundation, and uses the same "NS" prefix.

A key part of the Cocoa architecture is its comprehensive views model. This is organized along conventional lines for an application framework, but is based on the PDF drawing model provided by Quartz. This allows creation of custom drawing content using PostScript-like drawing commands, which also allows automatic printer support and so forth. Since the Cocoa framework manages all the clipping, scrolling, scaling and other chores of drawing graphics, the programmer is freed from implementing basic infrastructure and can concentrate only on the unique aspects of an application's content.

Memory Management concept in objective-c

•Memory Management◦Up until now I've kind of dodged memory management in Objective-C. Sure you can call dealloc on an object, but what happens if the object contains pointers to other objects? One has to be concerned about freeing the memory of those objects as well. Also how does the Foundation framework manage memory when you create classes from it? This will all be explained.

◦Note: everything up until this point has been properly memory managed, incase you're wondering.

◦Retain and Release

■Retain and release are two methods inherited from any object that has NSObject as a parent. Each object has an internal counter that can be used to keep track of the number references an object has. So if you have 3 referneces, you don't want to dealloc yourself. However once you reach 0, you should dealloc yourself. [object retain] increments the counter by 1 (which starts at 1) and [object release] decrements it by 1. If the [object release] invocation causes the count to reach 0, dealloc is then called.

■Fraction.m
...
-(void) dealloc {
printf( "Deallocing fraction\n" );
[super dealloc];
}


...■Based on an example in "Programming in Objective-C," Copyright © 2004 by Sams Publishing. Used with permission


■main.m
#import "Fraction.h"
#import

int main( int argc, const char *argv[] ) {
Fraction *frac1 = [[Fraction alloc] init];
Fraction *frac2 = [[Fraction alloc] init];

// print current counts
printf( "Fraction 1 retain count: %i\n", [frac1 retainCount] );
printf( "Fraction 2 retain count: %i\n", [frac2 retainCount] );

// increment them
[frac1 retain]; // 2
[frac1 retain]; // 3
[frac2 retain]; // 2

// print current counts
printf( "Fraction 1 retain count: %i\n", [frac1 retainCount] );
printf( "Fraction 2 retain count: %i\n", [frac2 retainCount] );

// decrement
[frac1 release]; // 2
[frac2 release]; // 1

// print current counts
printf( "Fraction 1 retain count: %i\n", [frac1 retainCount] );
printf( "Fraction 2 retain count: %i\n", [frac2 retainCount] );

// release them until they dealloc themselves
[frac1 release]; // 1
[frac1 release]; // 0
[frac2 release]; // 0
}

■output
Fraction 1 retain count: 1
Fraction 2 retain count: 1
Fraction 1 retain count: 3
Fraction 2 retain count: 2
Fraction 1 retain count: 2
Fraction 2 retain count: 1
Deallocing fraction
Deallocing fraction

■The retain calls increment the counter. The release calls decrement it. One can get the count as an int by calling [obj retainCount]. Once the retainCount reaches 0, both objects dealloc themselves and you can see this when both print out "Deallocing fraction."

◦Dealloc

■When your object contains other objects, you must free them whenever you yourself dealloc. One of the nice advantages to Objective-C is you can pass messages to nil, so there isn't a lot of error checking to release an object.

■Based on an example in "Programming in Objective-C," Copyright © 2004 by Sams Publishing. Used with permission

■AddressCard.h
#import
#import

@interface AddressCard: NSObject {
NSString *first;
NSString *last;
NSString *email;
}

-(AddressCard*) initWithFirst: (NSString*) f
last: (NSString*) l
email: (NSString*) e;
-(NSString*) first;
-(NSString*) last;
-(NSString*) email;
-(void) setFirst: (NSString*) f;
-(void) setLast: (NSString*) l;
-(void) setEmail: (NSString*) e;
-(void) setFirst: (NSString*) f
last: (NSString*) l
email: (NSString*) e;
-(void) setFirst: (NSString*) f last: (NSString*) l;
-(void) print;
@end

■AddressCard.m
#import "AddressCard.h"
#import

@implementation AddressCard
-(AddressCard*) initWithFirst: (NSString*) f
last: (NSString*) l
email: (NSString*) e {
self = [super init];

if ( self ) {
[self setFirst: f last: l email: e];
}

return self;
}

-(NSString*) first {
return first;
}

-(NSString*) last {
return last;
}

-(NSString*) email {
return email;
}

-(void) setFirst: (NSString*) f {
[f retain];
[first release];
first = f;
}

-(void) setLast: (NSString*) l {
[l retain];
[last release];
last = l;
}

-(void) setEmail: (NSString*) e {
[e retain];
[email release];
email = e;
}

-(void) setFirst: (NSString*) f
last: (NSString*) l
email: (NSString*) e {
[self setFirst: f];
[self setLast: l];
[self setEmail: e];
}

-(void) setFirst: (NSString*) f last: (NSString*) l {
[self setFirst: f];
[self setLast: l];
}

-(void) print {
printf( "%s %s <%s>", [first cString],
[last cString],
[email cString] );
}

-(void) dealloc {
[first release];
[last release];
[email release];

[super dealloc];
}
@end■main.m
#import "AddressCard.h"
#import
#import

int main( int argc, const char *argv[] ) {
NSString *first =[[NSString alloc] initWithCString: "Tom"];
NSString *last = [[NSString alloc] initWithCString: "Jones"];
NSString *email = [[NSString alloc] initWithCString: "tom@jones.com"];
AddressCard *tom = [[AddressCard alloc] initWithFirst: first
last: last
email: email];

// we're done with the strings, so we must dealloc them
[first release];
[last release];
[email release];

// print to show the retain count
printf( "Retain count: %i\n", [[tom first] retainCount] );
[tom print];
printf( "\n" );

// free memory
[tom release];

return 0;
}

■output
Retain count: 1
Tom Jones

■This example shows not only how to make a dealloc method, as shown in AddressCard.m, but one way to do member variables.

■The order of the 3 operations in each set method is very important. Lets say you'return passing a parameter of yourself to one of your methods (a bit of an odd example, but this can happen). If you release first, THEN retain you will destruct yourself! That's why you should always 1) retain 2) release 3) set the value.

■Normally one wouldn't initialize variables with C strings because they don't support unicode. The next example, with NSAutoreleasePool shows the proper way to do strings and initializing.

■This is just one way of handling member variable memory management. One way to handle this is to create copies inside your set methods.

◦Autorelease Pool

■When you want to start doing more programming using NSString and other Foundation framework classes you need a more flexible system. This system is using Autorelease pools.

■When developing Mac Cocoa applications, the auto release pool is setup automatically for you.

■Based on an example in "Programming in Objective-C," Copyright © 2004 by Sams Publishing. Used with permission

■main.m
#import
#import
#import

int main( int argc, const char *argv[] ) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSString *str1 = @"constant string";
NSString *str2 = [NSString stringWithString: @"string managed by the pool"];
NSString *str3 = [[NSString alloc] initWithString: @"self managed string"];

// print the strings
printf( "%s retain count: %x\n", [str1 cString], [str1 retainCount] );
printf( "%s retain count: %x\n", [str2 cString], [str2 retainCount] );
printf( "%s retain count: %x\n", [str3 cString], [str3 retainCount] );

// free memory
[str3 release];

// free pool
[pool release];
return 0;
}

■output
constant string retain count: ffffffff
string managed by the pool retain count: 1
self managed string retain count: 1

■If you run this you'll notice a few things. One is that the retainCount of str1 is ffffffff.

■The other is, I only release str3, yet this program is memory management perfect. The reason is the first constant string is added to the autorelease pool automatically. The other string is made using stringWithString. This method creates a string that is owned by NSString class, which also puts it in the auto release pool.

■It's important to remember, for proper memory management, that convience methods like [NSString stringWithString: @"String"] use autorelease pools, but alloc methods like [[NSString alloc] initWithString: @"String"] do not use autorelease pools for managing memory.

■There are two ways to manage memory in Objective-C: 1) retain and release or 2) retain and release/autorelease.

■For each retain, there must be one release OR one autorelease.

■The following example shows what I mean by this
■Based on an example in "Programming in Objective-C," Copyright © 2004 by Sams Publishing. Used with permission
■Fraction.h
...
+(Fraction*) fractionWithNumerator: (int) n denominator: (int) d;
...
■Fraction.m
...
+(Fraction*) fractionWithNumerator: (int) n denominator: (int) d {
Fraction *ret = [[Fraction alloc] initWithNumerator: n denominator: d];
[ret autorelease];

return ret;
}
...■main.m
#import
#import "Fraction.h"
#import

int main( int argc, const char *argv[] ) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
Fraction *frac1 = [Fraction fractionWithNumerator: 2 denominator: 5];
Fraction *frac2 = [Fraction fractionWithNumerator: 1 denominator: 3];

// print frac 1
printf( "Fraction 1: " );
[frac1 print];
printf( "\n" );

// print frac 2
printf( "Fraction 2: " );
[frac2 print];
printf( "\n" );

// this causes a segmentation fault
//[frac1 release];

// release the pool and all objects in it
[pool release];
return 0;
}

■output
Fraction 1: 2/5
Fraction 2: 1/3

■In this example, the method is a class level method. After the object is created, autorelease is called on it. Inside the body of the main method, I never call release on the object.

■The reason this works is because: for every retain, one release or autorelease must be called. The object's retain count starts out as 1, and I called autorelease on it once. This means 1 - 1 = 0. Once the autorelease pool is released, it counts the autorelease calls on all objects and decrements them with [obj release] with the same number of times autorelease was called per object.

■As the comment says, uncommenting that line causes a segment fault. Since autorelease was already called on the object, calling release on it, and then releasing the autorelease pool would attempt to call dealloc on an object that is nil, which is not valid. The end math is 1 (creation) - 1 (release) - 1 (autorelease) = -1.

■Auto release pools can be dynamically created for large amounts of temporary objects. All one must do is create a pool, perform any large chunk of code that creates lots of temporary objects, then release the pool. As you may wonder, it this means it is possible to have more than one auto release pool at a time.

Memory management

One feature of the Cocoa environment is its facility for managing dynamically allocated memory. Cocoa's NSObject class, from which most classes, both vendor and user, are derived, implements a reference counting scheme for memory management. Objects derived from the NSObject root class respond to a retain and a release message and keep a retain count which can be queried by sending a retainCount message. A newly allocated object created with alloc or copy has a retain count of one. Sending that object a retain message increments the retain count, while sending it a release message decrements the retain count. When an object's retain count reaches zero, it is deallocated similar to a C++ destructor. dealloc is not guaranteed to be invoked. This reference counting approach is very similar to that of Microsoft's COM, which features the IUnknown interface. IUnknown provides equivalents to retain and release in the form of AddRef and Release.

"NS" stands for Next Step Heritage in objective-c

NS all the time in various class names, but have yet to come across an explanation for the meaning?

Examples:

•NSObject
•NSString
•NSArray


Answer : NextStep heritage

Foundation Kit, or more commonly simply Foundation, first appeared in OpenStep. On Mac OS X, it is based on Core Foundation. Foundation is a generic object-oriented library providing string and value manipulation, containers and iteration, distributed computing, run loops, and other functions that are not directly tied to the graphical user interface. The "NS" prefix, used for all classes and constants in the framework, comes from Cocoa's NeXTSTEP heritage.

Thursday, August 26, 2010

Sqllite

appdelegate

=============================================
- (void) copyDatabaseIfNeeded {

//Using NSFileManager we can perform many file system operations.
NSFileManager *fileManager = [NSFileManager defaultManager];
NSError *error;
NSString *dbPath = [self getDBPath];
BOOL success = [fileManager fileExistsAtPath:dbPath];

if(!success) {

NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"example.sql"];
success = [fileManager copyItemAtPath:defaultDBPath toPath:dbPath error:&error];

if (!success)
NSAssert1(0, @"Failed to create writable database file with message '%@'.", [error localizedDescription]);
}
else {
NSLog(@"open");
}

}

- (NSString *) getDBPath {

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory , NSUserDomainMask, YES);
NSString *documentsDir = [paths objectAtIndex:0];
return [documentsDir stringByAppendingPathComponent:@"example.sql"];
}
=====================================================

view control

========================================================

static sqlite3 *database = nil;
#import


appDelegate = (CompassDictionaryAppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate copyDatabaseIfNeeded];



- (IBAction)MyFavoritesAction:(id)sender {
appDelegate.favorite = [NSMutableArray new];
[self SelectDatabase:[appDelegate getDBPath]];

MyFavorites *myfav = [[MyFavorites alloc] initWithNibName:@"MyFavorites" bundle:nil];
[self presentModalViewController:myfav animated:NO];
[myfav release];
}
------------------

-(void)SelectDatabase:(NSString*)DBPath{
appDelegate = (CompassDictionaryAppDelegate *)[[UIApplication sharedApplication] delegate];

if (sqlite3_open([DBPath UTF8String], &database) == SQLITE_OK) {

const char *sql = "select fav_title,fav_text from fav_list order by fav_title";
sqlite3_stmt *selectstmt;
if(sqlite3_prepare_v2(database, sql, -1, &selectstmt, NULL) == SQLITE_OK) {

while(sqlite3_step(selectstmt) == SQLITE_ROW) {
FavoriteData *data=[[FavoriteData alloc] init];
//sqlite3_bind_text(addStmt, 1, [data.name UTF8String], -1, SQLITE_TRANSIENT);
NSString *coffeeObj = [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectstmt, 1)];
// NSLog(@"name man ->%@",coffeeObj);
data.description = coffeeObj;
NSString *coffeeObj1 = [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectstmt, 0)];
//NSLog(@"name man ->%@",coffeeObj1);
data.name = coffeeObj1;
//NSLog(@"favourite_id---->%i",(NSInteger)sqlite3_column_int(selectstmt, 0));
//NSLog(@"search_list_id-->%i",(NSInteger)sqlite3_column_int(selectstmt, 1));
//NSLog(@"%i",coffeeObj.userid);
[appDelegate.favorite addObject:data];
}
}
sqlite3_finalize(selectstmt);
}
NSLog(@"close database");
sqlite3_close(database); //Even though the open call failed, close the database connection to release all the memory.

//NSLog(@"favourite_id---->%i",(NSInteger)sqlite3_column_int(selectstmt2, 0));
//NSLog(@"search_list_id-->%i",(NSInteger)sqlite3_column_int(selectstmt2, 1));
}

Parse xml

- (ParseXml *) initparserxml:(AdMeAppDelegate *) appDelegate1 {
[super init];
appDelegate = (AdMeAppDelegate *)[[UIApplication sharedApplication] delegate];
appDelegate = appDelegate1;
NSLog(@"inside parse XML in parse XML");
return self;
}

- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName
attributes:(NSDictionary *)attributeDict {

if([elementName isEqualToString:@"adme"]) {
//Initialize the array.
appDelegate.listData = [[NSMutableArray alloc] init];
} else if([elementName isEqualToString:@"campaign"]) {

//Initialize the campaign.
adetails = [[XmlData alloc] init];

//Extract the attribute here.
adetails.campaign_id = [[attributeDict objectForKey:@"campaign_id"] stringValue];

NSLog(@"Reading id value :%i", adetails.campaign_id);
}

NSLog(@"Processing Element: %@", elementName);
}

- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {

currentElementValue = [[NSMutableString alloc] initWithString:string];

/*if(!currentElementValue)
currentElementValue = [[NSMutableString alloc] initWithString:string];
else
[currentElementValue appendString:string];
*/
NSLog(@"Processing Value: %@", currentElementValue);

}


- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {

if([elementName isEqualToString:@"adme"])
{

if([appDelegate.listData count] == 0) {
appDelegate.listData = [[NSMutableArray alloc] init];
adetails = [[XmlData alloc] init];
adetails.campaign_name = @"No campaign in list";
[appDelegate.listData addObject:adetails];
[adetails release];
adetails = nil;
}
return;
}


//There is nothing to do if we encounter the Books element here.
//If we encounter the Book element howevere, we want to add the campaign object to the array
// and release the object.
if([elementName isEqualToString:@"campaign"]) {
[appDelegate.listData addObject:adetails];
[adetails release];
adetails = nil;
}
else
[adetails setValue:currentElementValue forKey:elementName];

[currentElementValue release];
currentElementValue = nil;
}
------------------------------------------------------------------------------

view control
------------------------------------------------------------------------------

- (void)loadView {
}
*/

- (void)parseXML:(NSData *)data {
NSLog(@"inside parse XML in test list");
NSAttributedString *output = [NSString stringWithCString:[data bytes] length:[data length]];
NSString *mystr = [NSString localizedStringWithFormat:@"%@data:",output];
NSLog(@"data is %@",mystr);
printf("HTTP RESPONSE : - %s\n",&mystr);

NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithData:data];
ParseXml *parser = [[ParseXml alloc] initparserxml:appDelegate];
[xmlParser setDelegate:parser];
[xmlParser setShouldProcessNamespaces:NO];
[xmlParser setShouldReportNamespacePrefixes:NO];
[xmlParser setShouldResolveExternalEntities:NO];


BOOL success = [xmlParser parse];
if(success)
NSLog(@"no errors");
else
NSLog(@"error !!!");
}


- (void)getListView {
NSData *data;
NSLog(@"Inside getList view");
NSString *listview_url = [NSString stringWithFormat:@"%@%@",appDelegate.HTTPS_BASE_URL,appDelegate.XML_VIEW_URL];
NSURL *listurl = [NSURL URLWithString:listview_url];
NSHTTPURLResponse *response;
NSError *error;
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:listurl];
[request setHTTPMethod:@"GET"];
[request setHTTPShouldHandleCookies:YES];
request = [NSMutableURLRequest requestWithURL:listurl];


data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
if([response statusCode] == 200) {
[self parseXML:data];
//UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Warning !" message:@"Got 200 status" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil];
//[alert show];

} else {
//UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Warning !" message:@"Error" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil];
//[alert show];
}
}


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
inc = 0.0;
appDelegate = (AdMeAppDelegate *) [[UIApplication sharedApplication] delegate];
[self getListView];
tableView.backgroundColor = [UIColor blackColor];
[super viewDidLoad];
}

Tuesday, December 16, 2008

Doesn't Open on add/remove program in your pc

what will you do ?(Doesn't Open on add/remove program in Ur PC).

issue: c:drive memory is full but not open in add/remove program.
no disk space at least 25.0mb available in this drive.

Come To This Way:
First you have download to the CCLEANER software about this link."http://www.ccleaner.com/download/builds/downloading-slim

second you not will be install c:drive in ccleaner. you have installed to be D;Drive
installation successfully. then open your desktop icon in the ccleaner.To be open dialog box and next you have to choose tools icon.


After successfully open all the list of software details in c:drive then you will be remove particular program.

Saturday, December 13, 2008

mobile protection - Application registration files

localisable_resource_file

MobileProtection.rls

rls_string STRING_r_short_caption "MobileProtection"
rls_string STRING_r_caption "MobileProtection"
rls_string STRING_r_icon_file "\\resource\\apps\\MobileProtection.mbm"

MobileProtection.rss


#include "eikon.rh"
#include "MobileProtection.rls"
#include "MobileProtection.hrh"
#include "avkon.rsg"
#include "avkon.rh"
#include "avkon.mbg"

#ifdef EKA2
#include "appinfo.rh"
#endif


// RESOURCE DEFINITIONS

RESOURCE RSS_SIGNATURE { }

RESOURCE TBUF { buf = "MobileProtection"; }

RESOURCE EIK_APP_INFO
{
status_pane = r_MobileProtection_status_pane;
}


MobileProtection_loc.rss

#include "appinfo.rh"
#include "MobileProtection.rls"

RESOURCE LOCALISABLE_APP_INFO r_MobileProtection_localisable_app_info
{
short_caption = STRING_r_short_caption;

caption_and_icon =
CAPTION_AND_ICON_INFO
{
caption = STRING_r_caption;
number_of_icons = 4;
icon_file = STRING_r_icon_file;
};
}


MobileProtection_reg.rss



#include "appinfo.rh>"
#include "MobileProtection.rsg"

UID2 KUidAppRegistrationResourceFile
UID3 0x0CA24F85 // application UID

RESOURCE APP_REGISTRATION_INFO
{
app_file = "MobileProtection";

localisable_resource_file = "\\resource\\apps\\MobileProtection_loc";

embeddability = KAppNotEmbeddable;
newfile = KAppDoesNotSupportNewFile;
}

Friday, November 7, 2008

5 Foods for a Better

5 Foods for a Better Mood

1) Oatmeal
Oatmeal may help if you find yourself feeling irritable and cranky. It is rich in soluble fiber, which helps to smooth out blood sugar levels by slowing the absorption of sugar into the blood.

Oatmeal is also a great food to help you stick with your diet plan, because the soluble fiber in oatmeal forms a gel that slows the emptying of your stomach so you don't feel hungry quickly.

Other foods high in soluble fiber are: beans, peas, barley, citrus fruits, strawberries and apples.







What to try:

Add tasty toppings to oatmeal, such as:

* Low-fat granola and skim milk
* Coarsely chopped apple or unsweetened chunky applesauce with cinnamon
* Strawberries and sliced almonds

2) Walnuts
Walnuts have long been thought of as a "brain food" because of their wrinkled, bi-lobed (brainlike) appearance. But now we know that walnuts are an excellent source of omega-3 essential fatty acids, a type of fat that's needed for brain cells and mood-lifting neurotransmitters to function properly and possible help some people with depression.

Other foods rich in omega-3 fatty acids include salmon, sardines, flaxseeds, and omega-3 fortified eggs.

What to try:

* Instead of reaching for a muffin as a snack, try walnuts and an apple. The fiber and good fat will also curb your appetite for longer.
* Try mixing crushed walnuts into yogurt as a snack.
* Sprinkle walnuts over salads.

3) Tea
Although caffeine has been shown to lead to a more positive mood and improved performance, it's a fine line.

Too much caffeine can make you dependent and make you nervous, irritable, hypersensitive or bring on headaches.

What to try:

* A good strategy is to limit yourself to no more than one 8 oz. cup of coffee a day. Instead of that second cup, try making a cup of green tea. You can find it in teabag form in most grocery stores.
* Another option: chai. It's an Indian tea made with regular black tea plus spices such as cardamom and cinnamon. The spices also add a natural sweetness to the tea, which may help you cut back on sugar and sweeteners.
* If you're in the mood to try a new herbal tea, consider rooibos. Rooibos is a reddish brown tea that tastes more like regular black tea than other herbal teas.

Like chai, rooibos also has a hint of natural sweetness, which makes it a good option for people trying to lose weight.

Try hot rooibos tea plain, with a wedge of lemon, or with milk. It also makes a great iced tea.

Rooibos can be found in health food stores, some grocery stores, online, and increasingly, in cafes and restaurants that serve herbal tea.

4) Salmon
In the past few years, research has suggested that vitamin D may increase the levels of serotonin, one of the key neurotransmitters influencing our mood, and that it may help to relieve mood disorders.

We get vitamin D mainly through exposure to sunlight and in lesser amounts, through food.

But a recent study found that in Boston, exposure to sunlight during the months of November through February does not produce any significant amounts of vitamin D in skin.

What to try:

* Canned salmon with bones is rich in vitamin D. It is also an excellent source of omega-3 fatty acids.
* Instead of tuna for your sandwiches, opt for canned Alaskan pink or sockeye salmon with bones. Choose water-packed salmon, which is lower in calories than the oil-packed.
* Other foods high in vitamin D are fortified milk and fortified soy milk.


5) Lentils
A member of the legume family, lentils are an excellent source of folate, a B vitamin that appears to be essential for mood and proper nerve function in the brain.

Low levels of folate have been linked to depression. In fact, a Harvard study showed that 38 percent of depressed women are deficient in folate.

Although researchers don't yet fully understand the connection, folate deficiency appears to impair the metabolism of serotonin, dopamine, and noradrenaline, neurotransmitters important for mood.

A cup of cooked lentils provides 90% of the recommended daily allowance of folic acid. A healthy bonus: lentils contain protein and fiber, which are filling and help to stabilize blood sugar.

Other sources of folate include: fortified breakfast cereals, green vegetables such as spinach and broccoli, liver, and beans.

What to try:

* Toss cooked lentils with cherry tomatoes, sliced bell peppers, and carrots for an easy salad.
* Try making lentil soup.
* If beans make you gassy, use Beano.

Wednesday, November 5, 2008

rpm stands for Redhat Package Manager.

MySQL installation with RPMMySQL installation with RPM. rpm stands for Redhat Package Manager. It is a utility which makes it easy to add, remove, or update software from your system. ...
www.phaget4.org/Nomad/rpminstall.html - 4k - Cached - Similar pages

Tuesday, November 4, 2008

Apache Tomcat Directory Traversal Vulnerability

Title: Apache Tomcat Directory Traversal Vulnerability
Author: Simon Ryeo(bar4mi (at) gmail.com, barami (at) ahnlab.com)
Severity: High
Impact: Remote File Disclosure
Vulnerable Version: prior to 6.0.18
Solution:
- Best Choice: Upgrade to 6.0.18 (http://tomcat.apache.org)
- Hot fix: Disable allowLinking or do not set URIencoding to utf8 in order to avoid this vulnerability.
- Tomcat 5.5.x and 4.1.x Users: The fix will be included in the next releases. Please apply the hot fix until next release.
References:
- http://tomcat.apache.org/security.html
- http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-2938
History:
- 07.17.2008: Initiate notify (To Apache Security Team)
- 08.02.2008: Responsed this problem fixed and released new version
- 08.05.2008: Notify disclosure (To Apache Tomcat Security Team)
- 08.10.2008: Responsed with some suggestions.

Description
As Apache Security Team, this problem occurs because of JAVA side.
If your context.xml or server.xml allows 'allowLinking'and 'URIencoding' as
'UTF-8', an attacker can obtain your important system files.(e.g. /etc/passwd)

Exploit
If your webroot directory has three depth(e.g /usr/local/wwwroot), An
attacker can access arbitrary files as below. (Proof-of-concept)

http://www.target.com/%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/foo/bar

# milw0rm.com [2008-08-11]

What is the difference between UTF-8, UTF-16?

ISO
UTF-8 uses variable byte to store a Unicode. In different code range, it has its own code length, varies from 1 byte to 6 bytes. Because it varies from 8 bits (1 byte), it is so called "UTF-8". UTF-8 is suitable for using on Internet, networks or some kind of applications that needs to use slow connection. Unicode (or UCS) Transformation Format, 16-bit encoding form

How do I get UTF-8?

Tomcat FAQ - Miscellaneous Questions
It is not broken, your tag probably is. Many bug reports have been filed about this. Here is the bug report with all the gory details.

What can I do with a UTF-8 string?

Perl-XML Frequently Asked Questions
You could obviously convert a UTF-8 encoded string to some other encoding, but before we get on to that, let's look at what you can do with it in its 'natural state'. If you wish to display the string in a web browser, no conversion is necessary. Modern browsers can understand UTF-8 directly, as can be seen on this page on the kermit project web site (some characters in the page will not display correctly without the correct fonts installed but that's a font issue rather than an encoding issue).

How to you handle UTF-8?

Grapeshot - Developer - FAQs
Grapeshot has a very professional approach to a multitude of character sets. Grapeshot indexing routines identify the character set in use within a document and introduces appropriate stemming routines as part of tokenising the words or phrases within the incoming text. Tokenisation includes word splitting or character separation, as well as dealing with the ideosyncracies of punctuation within each language.

What is the UTF-8 encoding?

Java Internationalization FAQ
UTF-8 stands for Unicode (or UCS) Transformation Format, 8-bit encoding form. It is a transmission format for Unicode that uses 8-bit code units.