How to get the time and date details from pasteboard - iphone

when i copy the content in iphone the content is available in the pastebpard ,how do i get the time and date from the pasteboard

By putting a date and time on the pasteboard in the first place?
Your comment fills in some rather critical missing information. I suggest that you edit your question to include the missing information.
(1) if there is a date & time in what is copied, you'll need to detect it and parse it. How you do that is entirely dependent on what is being copied.
(2) If you want the date/time of when the pasteboard was taken, then you would want to look to the UIPasteboard's API. There isn't anything that captures the date of when a pasteboard was created, though.
Now, if you are looking to see if the pasteboard has changed since the last time you looked, use the [changeCount][2].

Related

NSStream Event Timer - iPhone

All,
Is there a way to have a minimum time to keep a stream open before it closes? For some reason, my stream is closing prematurely which is causing errors elsewhere. I need to keep it open to make sure ALL of the data is gathered, and then it can run the other code.
Thanks,
James
In the case that someone falls upon this question later, I ended up creating nested if statements to pull it off.
Basically, there is one statement that checks if the end tag is not found (for my code, the END of the ENTIRE data that I should be receiving is </SessionData> - So, I did if([outputString rangeOfString:#"</SessionData>"].location == NSNotFound). I created a string called totalOutput that would have the outputString added onto the end of totalOutput until the </SessionData> is found.
If anyone ever needs help, just go ahead and comment on here and I can give more information.

USe NSCoding To Create User Editable Plist

I'm trying to create a user editable plist where the user can store a custom created workout routine including strings referenced from another data.plist in the app bundle.
I'm assuming NSCoding is the best way to go about this. So far I have the interface setup as a nav bar and table view.
I want it to be blank be default and the user has to press the "+" that is in the top right of the nav bar. Then he could enter a name for an entry in an array, for example chest day, or bicep day. And within that array, will be a dictionary or another array of strings of the particular exercises for that day, for example bench press, or bicep curl.
This plist needs to be editable so it will be going in the users document folder and not in the app bundle.
Example:
Top array consists of Chest Day, Back Day, Leg Day. Within Chest Day dictionary, include bench press, chest pull, pushup, etc.
Update:
Adding this method to search for routine file;
-(void)loadData
{
if(YES)
{
NSString* documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString* routineFile = [documentsPath stringByAppendingPathComponent:#"routine.plist"];
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:routineFile];
}
else
{
//load file
}
}
NSCoding is the protocol used by NSArchiver, NSKeyedArchiver, etc., not for serializing an array into a property list.
Forget about the idea that the user is going to edit a property list. The user is going to edit data in your app -- the fact that it's stored as a property list is just an implementation detail. When your app starts, you read the data stored in the data file. The user edits it, looks at it, whatever. At some point later, perhaps after each edit, perhaps just before the app quits, you write the data back out to the file. Since it's a property list, don't worry about updating the file; you already have all the data, so write a whole new property list and then use that file to replace the old one.
Perhaps I'm wrong and you really do intend for the user to edit the property list by hand, with a text editor. This would be a mistake. It's great the property lists are human readable, but asking your users to edit your raw data files by hand is a strong indication that your app is broken. The whole purpose of your app is to keep track of this information for the user; if they wanted to use a text editor to manage it, they wouldn't need your app. So, with that said, I hope I'm not wrong. ;-)
I don't think I'd use NSCoding for this - if all you're working with is standard plist objects like NSArray, NSDictionary, and NSString, the top array's -writeToFile:atomically: method is an easy way to do the job.

For anyone familiar with the "TableViewSuite" sample code in apple dev center

In the "sample code" in iOS Dev Center there is a TableViewSuite.
In the first example SimpleTableView the simulator provides a list of time zones by country.
I can not find the list they are pulling from!
it appears to be an array but I can't find the actual words that are coming up on the simulator screen in Xcode.
I've learned about plists and dictionarys and Arrays and simply can't find where the names are coming from.
I found this line:
// Retrieve the array of known time zone names, then sort the array and pass it to the root view controller.
NSArray *timeZones = [NSTimeZone knownTimeZoneNames];
rootViewController.timeZoneNames = [timeZones sortedArrayUsingSelector:#selector(localizedCaseInsensitiveCompare:)];
Again, where is it retrieving the information from?
Thanks again.
They're coming from this message:
[NSTimeZone knownTimeZoneNames]
Which is documented as such:
Returns an array of strings listing the IDs of all the time zones known to the system.
So essentially they're predefined somewhere in iOS and the names are simply being queried off the system.
+[NSTimeZone knownTimeZoneNames] gets the list of time zones from the system itself. There is no list in the project.

Words Per Minute Iphone SDK

I need to calculate words per minute while typing in textfield. It is typing speed calculator and it provides user text need to be typed in the lable above textfield. Please give me some idea how to get started and what events to use.
Thanks you.
UITextField lets you set a delegate implementing UITextFieldDelegate. That object will be sent textField:shouldChangeCharactersInRange:replacementString: for each edit the user does (for example entering a char).
In there you can implement your logic - saving the timestamp of the first entry, comparing each entry against the correct string, and then, when the entire string has been entered by the user, dividing the number of words with the spent time.

C#: Take Out Image Portion of JPEG to Backup Metadata?

This will be a little backwards from the typical approach.
I've used ExifTool for metadata manipulation before, but I really want to keep the best metadata backup I can before I make anything permanent.
What I want to do is remove the compressed image portion of a JPEG file to leave everything else intact. That's backing up EXIF, Makernotes, IPTC, XMP, etc whether at the beginning or end of the file.
What I've tried so far is to strip all metadata from a copy of the original JPEG, and use it as a basis of what bytes will be taken out of the original. After looking at the raw data, it doesn't seem like the stripped copy is contiguous in the original copy. There may be some header information still remaining in the stripped version. I don't really know. Not a good way to do it, I suppose.
Are there any markers that will absolutely tell me where the compressed JPEG image data starts and ends? I understand that JPEG files have 0xFFD8 and 0xFFD9 to mark the start and end of the image, but have come to find out that metadata is actually between those markers.
I'm using C#.
Thank you.
To do this properly you need to fully parse the JPEG/JFIF format and discard anything you don't want. Metadata is all kept in APP segments or trailers after the JPEG EOI, so presumably you will toss everything else. Full parsing of a JPEG/JFIF is not trivial, and for this I refer you to the JPEF/JFIF specification.
You can use the JpegSegmentReader class from my MetadataExtractor library to retrieve specific segments from a JPEG image.