Igor Delovski Board Forum Index Igor Delovski Board
My Own Personal Slashdot!
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Environment, Date & Time

 
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> Mac Cocoa
Mac Cocoa  
Author Message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Fri Oct 10, 2008 5:32 pm    Post subject: Environment, Date & Time Reply with quote

SO - Determining when an EDGE connection comes back after a drop-
out on an iPhone


"My problem is that I start getting false negatives when on an EDGE network,
the phone has connectivity, but the app thinks this isn't the case."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Sun Dec 14, 2008 1:08 am    Post subject: Reply with quote

SO - Cocoa equivalent of .NET’s Environment.SpecialFolder for saving
preferences/settings?


"How do I get the reference to a folder for storing per-user-per-application
settings when writing an Objective-C Cocoa app in Xcode?"
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Fri Jun 19, 2009 4:21 pm    Post subject: Reply with quote

SO - Is it possible to detect if the cellular network is available?

"I'm working on an iPhone app and I'd like to be able to check if the phone is
able to make phone calls (and warn the user if not). This could be due to no
cellular service being available or if the user has placed the phone in airpla-
ne mode."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Sun Jul 05, 2009 4:19 pm    Post subject: Reply with quote

iphonedevsdk.com - Is it possible to retrieve these information?

"It does not enumerate every single app, instead it uses the MobileInstalla-
tion cache which is always up-to-date with SpringBoard and holds the Info
dictionaries of all apps installed. Although you're not "supposed" to access
the cache, it's readable my App Store apps. Here is my code which at least
works perfectly fine with the Simulator..."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Mon Jul 06, 2009 12:10 am    Post subject: Reply with quote

SO - How to Check for an active Internet Connection on iPhone SDK?

"The Reachability class is not shipped with the SDK, but rather a part of this
Apple sample application. Just download it and copy Reachability.h/m to your
project. Also, you have to add the SystemConfiguration framework to your
project."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Wed Jul 22, 2009 12:04 am    Post subject: Reply with quote

SO - how do I detect the iPhone orientation before rotating

"If that property doesn't get set until some later time, you might try expe-
rimenting with performSelector:afterDelay: to initialize the UI after a small
delay."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Sun Aug 30, 2009 11:40 pm    Post subject: Reply with quote

praveenmatanam.wordpress.com - How to get country name from iPhone locale settings

Code:
NSString *countryCode = [locale objectForKey: NSLocaleCountryCode];
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Sun Nov 22, 2009 5:07 am    Post subject: Reply with quote

MF - Black status bar (as seen in home screen) possible?

"The only way (and the best way) is to modify the Info.plist in Xcode of your
App."
Back to top
View user's profile Send private message Visit poster's website
XNote
Kapetan


Joined: 16 Jun 2006
Posts: 532

PostPosted: Tue Jun 08, 2010 1:57 pm    Post subject: Reply with quote

SO - How to convert NSDate into unix timestamp iphone sdk

"A Unix timestamp is the number of seconds since 00:00:00 UTC January 1,
1970. It's represented by the type time_t, which is usually a signed 32-bit
integer type (long or int)."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Wed Jun 16, 2010 8:09 pm    Post subject: Reply with quote

so - iPhone iOS 4 addTimeInterval deprecated

"I'm using addTimeInterval for creating local notification but it seems that it
is now deprecated (iOS 4)."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Wed Oct 27, 2010 10:18 pm    Post subject: Reply with quote

iphonedevsdk.com - How To Get Date And Time

"I have tried using that to get the month and the day too. But I cannot get it
too work.

NSCalendarUnit, NSDate, NSDateComponents,..."

Code:
sprintf(aString, "The current time is %s\n", [[[NSDate  date]
    descriptionWithCalendarFormat:@"%H:%M:%S %Z" timeZone:nil
    locale:[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]]
        UTF8String]);
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Mon Nov 01, 2010 9:43 pm    Post subject: Reply with quote

CocoaWithLove - Control and configuration of applications through Info.plist

"The default fields: identifiers, icons and version numbers, How Xcode builds
the Info.plist, Reading from the Info.plist in your program, Essential iPhone
Info.plist entries & Essential Mac OS X Info.plist entries."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Thu Nov 18, 2010 10:01 pm    Post subject: Reply with quote

Jeff LaMarche - A Category on NSDate

"Among these methods are one that takes a date with a datetime value
and turns it into a date without time, a method that calculates a new dates
that is a certain number of days after the date, and a method that calcu-
lates the difference between two dates given in days."


Code:
@interface NSDate(Misc)
+ (NSDate *)dateWithoutTime;
- (NSDate *)dateByAddingDays:(NSInteger)numDays;
- (NSDate *)dateAsDateWithoutTime;
- (int)differenceInDaysTo:(NSDate *)toDate;
- (NSString *)formattedDateString;
- (NSString *)formattedStringUsingFormat:(NSString *)dateFormat;
@end
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Mon Dec 13, 2010 11:30 pm    Post subject: Reply with quote

SO - Is there a documented way to set the iPhone orientation?

"To rotate a view, you just need to set the status bar orientation and
transform the view's coordinates appropriately..."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Mon Dec 20, 2010 10:17 am    Post subject: Reply with quote

MF - Getting a country list in Cocoa


"Something like this should work:"

Code:
NSMutableArray *countryNamesArray = [NSMutableArray array];
NSLocale *current = [NSLocale currentLocale];
for (NSString *countryCode in [NSLocale ISOCountryCodes])
{
   [countryNamesArray addObject:[current displayNameForKey:NSLocaleCountryCode value:countryCode]];
}
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Tue Jan 25, 2011 9:32 pm    Post subject: Reply with quote

SO - Initialize a NSDate object with a specific time

Code:
NSDate *today = [NSDate date];
NSCalendar *gregorian = [[NSCalendar alloc]
                         initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *weekdayComponents =
                    [gregorian components:(NSDayCalendarUnit | NSWeekdayCalendarUnit) fromDate:today];
[weekdayComponents setHour:12];
[weekdayComponents setMinute:10];
[weekdayComponents setSeconds:30];


"I think will set using today's date and then you can create NSDateComponents from that and set time values."
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Fri Apr 08, 2011 9:06 pm    Post subject: Reply with quote

iphonedevsdk.com - Display Version Number in Application

Code:
NSString* version = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleVersionKey];
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Thu Jun 09, 2011 12:12 pm    Post subject: Reply with quote

Cocoa With Love: WorldTimeConverter: Dates and timezones in Cocoa

"A timezone is represented by ... NSTimeZone... The truly valuable infor-
mation, the data which makes world time conversion possible, comes from
two class methods on NSTimeZone — the knownTimeZoneNames method
and the timeZoneWithName: method. Between the two methods, you can
obtain access to a nearly complete list of world time zones."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Wed Apr 11, 2012 1:42 am    Post subject: Reply with quote

so - Time Zone Problems with NSDate+InternetTime Class

"I'm using a class of NSDate+InternetTime to help with parsing XMLs for
Calendars, Blogs, etc. I am in Central Time Zone and when I view the
TableView showing each RSS Item, the time listed is correct. However, if
a user is in EST it shows an hour later, and earlier times for Mountain and
Pacific Time Zones. Any ideas why this may be?"
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Wed Apr 11, 2012 2:17 am    Post subject: Reply with quote

Michael Waterfall - NSDate from Internet Date & Time String

"An NSDate class method (intended for use in a category) that will attempt
to return an NSDate from a formatted internet date time string (RFC822 or
RFC3339)."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Mon Jul 09, 2012 10:20 pm    Post subject: Reply with quote

github.com - gekitz / UIDevice-with-UniqueIdentifier-for-iOS-5

"Brings back the unique identifier support under iOS 5, it uses the device's
mac address in combination with the bundle identifier to generate a new
hashed unique identifier."


Referer: UIDevice uniqueIdentifier Deprecated - What To Do Now?

"Do not use the uniqueIdentifier property. To create a unique identifier
specific to your app, you can call the CFUUIDCreate function to create
a UUID, and write it to the defaults database using the NSUserDefaults
class."
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Tue Jul 10, 2012 4:25 pm    Post subject: Reply with quote

github - mwaterfall / MWFeedParser

See also: GTMNSString+HTML.m & NSDate+InternetDateTime.m

Cool - Ref:

"Check out my NSString category for HTML. Here are the methods available:

- (NSString *)stringByConvertingHTMLToPlainText;
- (NSString *)stringByDecodingHTMLEntities;
- (NSString *)stringByEncodingHTMLEntities;
- (NSString *)stringWithNewLinesAsBRs;
- (NSString *)stringByRemovingNewLinesAndWhitespace;"
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Wed Jan 23, 2013 5:06 pm    Post subject: Reply with quote

github.com - Universal-iOS-App-Template / UniversalExample-Info.plist

Code:
   <key>UIInterfaceOrientation</key>
   <string>UIInterfaceOrientationPortrait</string>
   <key>UIInterfaceOrientation~ipad</key>
   <string>UIInterfaceOrientationPortrait</string>
   <key>UIStatusBarStyle</key>
   <string>UIStatusBarStyleDefault</string>
   <key>UISupportedInterfaceOrientations</key>
   <array>
      <string>UIInterfaceOrientationPortrait</string>
      <string>UIInterfaceOrientationPortraitUpsideDown</string>
      <string>UIInterfaceOrientationLandscapeLeft</string>
      <string>UIInterfaceOrientationLandscapeRight</string>
   </array>
   <key>UISupportedInterfaceOrientations~ipad</key>
   <array>
      <string>UIInterfaceOrientationPortrait</string>
      <string>UIInterfaceOrientationPortraitUpsideDown</string>
      <string>UIInterfaceOrientationLandscapeLeft</string>
      <string>UIInterfaceOrientationLandscapeRight</string>
   </array>
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Wed Mar 06, 2013 4:32 pm    Post subject: Reply with quote

waracle - iPhone NSDateFormatter date formatting table

"This blog is for two reasons: my sanity and yours. The number of times I’ve
had to google this information only to lose the bookmark or scroll through
the 5 mile long page at unicode.org trying to locate the NSDateFormatter
string beggers belief and yes, you’d think I would know it off by heart now."
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Mon Sep 30, 2013 2:55 pm    Post subject: Reply with quote

How to get iOS device MAC address programmatically

"Now iOS 7 devices – are always returning a MAC address of 02:00:00:00:00:00.

So better use [UIDevice identifierForVendor]."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Thu Oct 03, 2013 4:58 pm    Post subject: Reply with quote

MF - Remove iPad status bar (iPhone App)

"Is it possible for the App to remove the status bar when running on iPad,
when the App is not a Universal App (compiled only for iPhone) ?"
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Thu Nov 07, 2013 12:43 am    Post subject: Reply with quote

so - Are there drawbacks to Snow Leopard's new “sudden termination” mechanism?

"Certainly you can use it in an app with user documents. As you say, the
app can signal when it is or is not ready to be nuked, so it can just say
"please don't kill me" if there are any unsaved documents."
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Mon Jan 13, 2014 12:13 am    Post subject: Reply with quote

vpdn - A closer look at the iOS7 App Switcher

"Apple has revamped the app switcher in iOS7 and now present screenshots
alongside with the app icon. Supplementing the notifications system, the app
switcher gives running apps one extra channel to communicate their current
state. In terms of real estate, the card associated with each running app is
the largest visual representation outside of the app itself."
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Sun Apr 13, 2014 10:48 pm    Post subject: Reply with quote

github.com - iStats

"Quick attempt at writing a Ruby wrapper for a small C library that interacts
with the IOKit library (apple) to get the CPU temperature. Will expand to
more hardware data and stats in the future."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Sun Jan 07, 2018 5:52 pm    Post subject: Reply with quote

so - Difference between 'YYYY' and 'yyyy' in NSDateFormatter

"A common mistake is to use YYYY. yyyy specifies the calendar year whereas
YYYY specifies the year (of 'Week of Year'), used in the ISO year-week
calendar. In most cases, yyyy and YYYY yield the same number, however they
may be different. Typically you should use the calendar year."
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3025
Location: Europe

PostPosted: Sat Jul 20, 2019 2:39 pm    Post subject: Reply with quote

so - How to determine if locale's date format is Month/Day or Day/Month?

"In an ideal world, I want to use NSDateFormatterShortStyle, but just not
display the year (only month & day#). What's the best way to accomplish
this?"


Code:
BOOL dayFirst = [[NSDateFormatter dateFormatFromTemplate:@"MMMMd" options:0 locale:[NSLocale currentLocale]] hasPrefix:@"d"];
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Tue Jul 30, 2019 4:21 pm    Post subject: Reply with quote

r - Do not forget about iOS 13's dark mode!

"The plist file trick:
<key>UIUserInterfaceStyle</key>
<string>Light</string>
This will overwrite the current users iphone settings. See it as a quick fix.But a better solution is to fully integrate the user interface styles.
You can also override it for specific ViewControllers.
https://developer.apple.com/documentation/uikit/uiuserinterfacestyle "
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3522
Location: Zagreb

PostPosted: Fri Oct 23, 2020 11:43 am    Post subject: Reply with quote

r - Falsehoods programmers believe about time zones

"I soon discovered just how wrong I was. One after another, I kept learning
the falsehood of yet another "fact" that had seemed obviously true. Eventually
my original vision became literally impossible to pull off without making serious
compromises (more about that in a future blog post).

Hopefully this list will help you avoid the landmines I stepped on. All the
falsehoods below are ones I'd considered true at some point in my adult life."
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> Mac Cocoa All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Delovski.hr
Powered by php-B.B. © 2001, 2005 php-B.B. Group