iphone sinin and sinup code - iphone

i want the solution of below question, i dont know how to store sinup information in Plist, can any one knows please help.
Thanks in advance
Use  Dummy  data  but  the  dummy  data  must  not  be  in  the  code  ,it  should  either   be   in   an   external   file   (plist/xml)   or   in   a   separate   constant   file.This   improves   the   code  management.  
All  screens  must  comply  to  Portrait  and  Landscape  View  Mode    
1.   The   App   will   begin   with   the   Login   Screen,   The   screen   should   be   having   same   functionality  as  any  website.  
     a.  Login  
     b.  Sign  Up  
     c.  Maximum  Tries  (3)  then  lock  the  app  
     d.   Requires   Answer   to   secret   question   to   unlock   which   will   be   accepted   in   sign   up

If you are looking for storing small data like user credentials look for NSUserDefault.
For automatic login, if the user has logged in previously look this.

You can create a new .plist file to store the information.
Add New File in your project, of type "Property list". Its under the "Resource tab", on "Mac OS X" in the left pane of your xcode.
Once created, Now add new items in to it. The "Key" will be used the retrieve the value through the coding.
To retrieve the values in the coding, from .plist file, you can use this code:
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
NSDictionary* defaultSettings = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:#"YOUR_PLIST_FILE_NAME.plist" ofType:nil]];
[defaults registerDefaults:defaultSettings];
NSString *sName = [defaultSettings objectForKey:#"Name"]; //the Name is the Key in .plist file, so its corresponding value will be fetched and store in sName variable
NSString *defaultDomain = [defaultSettings objectForKey:#"domain"];
I hope it helps :)

Related

Check if a file or directory has a specific alternative data stream attached to it?

I am writing a function or a commandlet (I want to call it Set-Metadata) that will allow me to attach metadata information to directories and files. Its for a file manager columns that expect ADS data
I am currently stuck on the logic part.
Before I write any metadata to a file via its NTFS ADS I would first like to check if the file has a specific stream so that I don't overwrite anything and instead append text to the stream.
function Set-MetaData(
    [Parameter(Mandatory=$true, ValueFromPipeline=$true)]
    [string]
    $Path,
    [Alias("C", "Cat")] #Replace Column Content
    [String]$Category,
    [Alias("PC", "PCat")] #Prefix to the content in  Column
    [String]$PCategory,
    [Alias("SC", "SCat")] #Suffix to the content in  Column
   
    [String]$SCategory){
        process {
        Switch ($PSBoundParameters.Keys){
            'Category'{
            }'PCategory'{
            }'SCategory'{
                if(...) #file has a stream called "multitags.txt"
                # Add-Content -Path $Path -Stream  multitags.txt -Value $Category
    }}
}
I have taken the liberty to cross post this question on other forums as well.
Any help would be greatly appreciated!

How can we split a column with multiple values separated by "space" delimiter into multiple rows in Qlik using any logic

I have one requirements as below. Suppose I have a column with below values
rowno          Column
1                MS Teams slack skype
2                 slack
3                 skype
I want to split the first row as below 
rowno          Column
1              MS Teams
1              slack
1              skype
2              slack
3              skype
How I can not use sub field function since it will split MS Teams to MS ,Teams. Instead can I use wildmatch? Please suggest how I can achieve this in Qlik Sense?
I'd probably do it in 2 parts... first to replace the MS Teams value with MS_Teams and then do the subfield. You could add another part to get rid of the _ at the end.
Table:
Load
rowno,
subfield(Column_clean,' ') as Column;
Load
rowno,
replace(Column,'MS Teams','MS_Teams') as Column_clean
from source;

Callbacks not rendered as native Facebook messages?

According to this scenario.
Used to test it using sample message - text. And it works fine.
I should implement that by using buttons (callbacks).
The real problem is :
Sample text :
context.Activity.Id
"mid.$cAAOmNGtaSJ9i1_f223cprKylFOpb"
on button click (callback) :
context.Activity.Id
"9Yw5TAcq1qr"
This is the code i used to post human support button :
msg.AttachmentLayout = AttachmentLayoutTypes.Carousel;
                    msg.Attachments = new List<Attachment>();
 
                    ThumbnailCard thumbnailCard2 = new ThumbnailCard()
                    {
                        Buttons = new List<CardAction>
                        {
                                new CardAction ()
                            {
                                Value = "Method_Support",
                                Type = "postBack",
                                Title = "Human Support"
 
                            },
                        },
                    };
                    msg.Attachments.Add(thumbnailCard2.ToAttachment());
                    await context.PostAsync(msg);
It returns activity.Id : 9Yw5TAcq1qr - as i already mentioned. I can't use that id to query Facebook graph api.
What's the best way to handle scenario like this ?
Is it possible to render all incoming messages as native Facebook (sample-text) messages ?
Is it possible to make call to graph api using callback's activity.id ?
Following my previous answer about how to link the Activity from botFramework to the messages in Conversation in Facebook's Graph API, I had a look to your problem.
Analysis
From my point of view, there is a strange thing in this Activity.Id value because on Facebook's side, all messages have the same id format, even for callbacks.
Here is a capture of 2 messages (1st one is the latest one) from Facebook Graph API:
{
"data": [{
"messages": {
"data": [
{
"id": "m_mid.$cAAC3Jml0RcBi2JK3Clcp01uu8FFe",
"message": "Human support"
},
{
"id": "m_mid.$cAAC3Jml0RcBi2I5bXlcp0kScM7af",
"message": ""
}
]
},
"id": "t_mid.$..."
}]
}
Message with empty text is a ThumbnailCard with a CardAction inside (type = postback, Value = Method_HumanSupport)
Human support is what is sent on the click on the CardAction
What is surprising is that on the bot side, for those 2 messages we have the following values for Activity.Id:
For "id": "m_mid.$cAAC3Jml0RcBi2I5bXlcp0kScM7af" (my Thumbnail) => mid.$cAAC3Jml0RcBi2I5bXlcp0kScM7af, so it's matching
For "id": "m_mid.$cAAC3Jml0RcBi2JK3Clcp01uu8FFe" (the callback) => DWhE2C0VO79, no match at all
For information my ThumbnailCard is made like the OP said:
var msg = context.MakeMessage();
msg.AttachmentLayout = AttachmentLayoutTypes.Carousel;
msg.Attachments = new List<Attachment>();
msg.Text = "updates & support";
ThumbnailCard thumbnailCard2 = new ThumbnailCard()
{
Buttons = new List<CardAction>
{
new CardAction ()
{
Value = "Method_HumanSupport",
Type = "postBack",
Title = "Human support"
}
}
};
I will add a question on Bot Framework GitHub Project.
Edit: issue logged: https://github.com/Microsoft/BotBuilder/issues/2950
Workaround
There are several workaround that will depend on your global use cases: you could try to log the Activity.Id of a "normal" message in the discussion and use this value later when your callback is clicked, or you can also try to change your flow to avoid making this kind of link between Bot Framework and Facebook Graph API.

parse acsm in iphone app

I am new to iOS development. I am working on an ePUB reader app for iPad.
The server sends me file with .acsm extension. Its an XML formatted file. Now I need to parse this acsm file and download the book.
The server side developer says that its working and he's able to download the ebook using Adobe Digital Editions.
What should I do to download the actual book and display it?
These are the contents of acsm file:
<fulfillmentToken fulfillmentType="buy" auth="user" xmlns="http://ns.adobe.com/adept">
 <distributor>urn:uuid:861ac232-6f99-4be5-8b78-28d3aa1a1200</distributor>
 <operatorURL>http://litstage.cloudapp.net:8080/fulfillment/</operatorURL>
 <transaction>ACS4-6490845051477798803551940</transaction>
 <expiration>2012-12-05T10:57:33+00:00</expiration>
 <resourceItemInfo>
   <resource>urn:uuid:45c004e9-ff9f-4117-94b9-c6776176fa62</resource>
   <resourceItem>0</resourceItem>
   <metadata>
     <dc:title xmlns:dc="http://purl.org/dc/elements/1.1/">The Divine Comedy</dc:title>
     <dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Dante, Alighieri</dc:creator>
     <dc:publisher xmlns:dc="http://purl.org/dc/elements/1.1/">FeedBooks (www.feedbooks.com)</dc:publisher>
     <dc:identifier xmlns:dc="http://purl.org/dc/elements/1.1/">urn:uuid:7d0300ba-2381-11dd-8c0f-001cc049a027</dc:identifier>
     <dc:format xmlns:dc="http://purl.org/dc/elements/1.1/">application/epub+zip</dc:format>
     <dc:language xmlns:dc="http://purl.org/dc/elements/1.1/">en</dc:language>
     <thumbnailURL>http://litstage.cloudapp.net:8080/media/45c004e9-ff9f-4117-94b9-c6776176fa62.jpg</thumbnailURL>
   </metadata>
   <licenseToken>
     <resource>urn:uuid:45c004e9-ff9f-4117-94b9-c6776176fa62</resource>
     <permissions>
       <display/>
       <excerpt/>
       <print/>
       <play/>
     </permissions>
   </licenseToken>
 </resourceItemInfo>
 <hmac>gGIGmkDLFpWda2dWchW3E46O9oA=</hmac>
</fulfillmentToken>

Update plist from background

Is it possible to read or write to plist when the application is in background state?
It is not possible to read your plist when your application is in the background, because your application is not running more than 10 minutes in the background state. There are only three options for keeping your application running more than 10 minutes in the background.
If you want to read and write your plist, do this when your application comes to the foreground state. For this you can read and write your plist in the application became active delegate method.
try this one..
- (void)readPlist
{
    NSString *filePath = #"/System/Library/CoreServices/SystemVersion.plist";
        NSMutableDictionary* plistDict = [[NSMutableDictionary alloc] initWithContentsOfFile:filePath];
       
        NSString *value;
        value = [plistDict objectForKey:#"ProductVersion"];
     
        /* You could now call the string "value" from somewhere to return the value of the string in the .plist specified, for the specified key. */
}
- (void)writeToPlist
{
    NSString *filePath = #"/System/Library/CoreServices/SystemVersion.plist";
        NSMutableDictionary* plistDict = [[NSMutableDictionary alloc] initWithContentsOfFile:filePath];
       
        [plistDict setValue:#"1.1.1" forKey:#"ProductVersion"];
        [plistDict writeToFile:filePath atomically: YES];
/* This would change the firmware version in the plist to 1.1.1 by initing the NSDictionary with the plist, then changing the value of the string in the key "ProductVersion" to what you specified */
}
Hope this helps you!