How to create a password field in xcode - xcode4

I am trying to make an iPhone App in which i will make user to login into their account.
For this i want userID and Password from the user. My question is how i can make a password
field in which whatever I enter will be shown as "*".

Sounds like you are looking for "setSecureTextEntry" on a "UITextField" object.
Also known as the "secureTextEntry" property in the "UITextInputTraits" protocol.
You can call this programatically via calling ".secureTextEntry = YES" on the "UITextField" object you want to be set for passwords.
You can also set it in Interface Builder (look for "Secure" checkbox in your text field Attributes inspector). It looks like this:
And in newer version of Xcode:

Update for Xcode 12.2+
My opinion is programmatic declaration of properties are easier to toggle back and forth.
Programmatically in Swift 5:
myPasswordTextField.isSecureTextEntry = true

Related

QFileDialog prompt to overwrite if selection changed

I would like a QFileDialog to prompt for overwrite confirmation only if the selection changed. Is there any way to achieve this?
Currently, I'm getting a save file name as follows:
data_file_name = QtGui.QFileDialog.getSaveFileName(self, "Data File", selected, self.FILTER_DATA_FILE)
If I'm re-saving an open project, selected is the name of the project file. If I'm creating a new project, selected is the name of the directory where the user most recently saved a project. If I enter a file name that doesn't exist (regardless of the value of selected), I don't get prompted for confirmation, as desired. However, if the selected name is a file that exists, also regardless of the value of selected, I always get promoted for confirmation. I would like the following behaviour:
If the dialog has a default selection and the user does not change this selection, do not prompt for confirmation.
Else if the user enters a file name that does not currently exist, do not prompt for confirmation.
Else prompt for confirmation. (I don't particularly care what happens if the user enters the empty string as a file name.)
I'm currently using Qt 4, though I'm not against upgrading to Qt 5 if that would make my life easier.
It looks like what I want isn't possible: QFileDialog::accept() doesn't provide any mechanism for that sort of customization. I'll have to disable overwrite confirmation in my dialog and implement that logic myself.

Drupal 7: Webform-Emails: Send value of a field without its label?

I have a Webform on Drupal 7 and I am using it to email the administrator whenever an end user submits an entry on this form.
In the email template, I have defined a custom template and I am sending the data using
%email_values token.
However, I also want to send the value of a particular field on this form but not its label.
So I tried using %email[key] where key is the key of that field.
But this sends the label of the field as well as its value.
How can I avoid sending the label data in the email?
With Webform 3.x, it did not work at all on my website.
BUT, i've updated to webform 4.x, and it now works with the code :
Dear [submission:values:first_name],
It shows:
Dear Jean-Charles,
Thank you to user3641116, it helped!
Webform previously used its own custom token system to provide common tokens such as %title, %username, or %value[key]. In Webform 4.x, we use the token system provided by Drupal 7 core, which uses a format such as [node:title], [current-user:name], or [submission:values:key].
For all values: [submission:values]
D6 >> D7
%email[$key] [submission:values:$key]
%value[$key] [submission:values:$key:nolabel]
Example: [submission:values:your_details:first_name:nolabel]
See this for more examples: https://drupal.org/node/1609324
Well, this link solves the problem:
Drupal - Tokens for Webform Component Values
https://drupal.org/node/1010648
I used %values[key] to get submitted values.

Sitecore context in HttpModule

I created simple HttpModule, all what I need is just get is valid Sitecore.Context inside but during processing I see that my Sitecore.Context is some kind of default.
I can get Sitecore user that log in to Sitecore, etc.
How to fix it ?
I assume you have a Sitecore Context, but it is null or set to the wrong site or language.
You can change the context like this:
// switch to the preferred site
Sitecore.Context.SetActiveSite("yourSiteName");
// set the preferred database
Sitecore.Context.Database = Sitecore.Configuration.Factory.GetDatabase("master");
// set the preferred language
Language language = Sitecore.Globalization.Language.Parse("en");
Sitecore.Context.SetLanguage = (language, false);
You probably also want to switch back to the original settings after your processing is done. So it is wise to "save" the original settings in a variable so you can change them back afterwards
Take a look at John West's posts on Sitecore pipelines for some background on how the context is being established.
http://www.sitecore.net/Community/Technical-Blogs/John-West-Sitecore-Blog/Posts/2011/05/All-About-Pipelines-in-the-Sitecore-ASPNET-CMS.aspx
and
http://www.sitecore.net/Community/Technical-Blogs/John-West-Sitecore-Blog/Posts/2011/05/Important-Pipelines-in-the-Sitecore-ASPNET-CMS.aspx
The following blog post on creating and running custom pipelines should give you an idea how to implement your own pipeline.
http://adeneys.wordpress.com/2008/08/27/creating-and-running-custom-pipelines-in-sitecore/

Take data from a field from exsisting node and make that the default value of a field in different content type

I don't know if I'm on the right track but I'm trying to let users of my web site create there own versions of pages on my web site.
Basically I'd like to make our documentation used as a starting point where they just add details and make a new page for themselves in the process.
I have a 'book' content type that I have changed with CCK and a 'client edits' content type that uses a nodereferencefromURL widget to link itself to the book node.
So simple version of what I'm saying is I have a link on my book pages that creates a node using client edits content type. I would like to put some fields on the client edits content type that take the values of some of the fields from the book page it is linked from.
I'm sure I'm missing something as I would have thought someone would have tried this before but I can't even find a hint on how to go about this.
All I really need is a point in the right direction if my current thinking is wrong.
Current thinking is that I use a php script to get the default value for a field on the new node add screen that drags the value for a field from the book I'm linking from.
I'm thinking this is the case because there is an option for default values for the field in cck manage fields that lets you put in a php value to return a default value for your field.
Am I on the right track or is there already a module or process that does what I'm talking about and I'm just too dumb to find it.
This sounds a little strange, are your client edits going to be a diff from the original node or just coppied data?
I would prehaps do it a more simple way, just have book nodes, and have different fields disaply depending on who edits it (enable the content_permissions module). That way you can use the node clone module to create the users copy.
You will need to make a module to contain your custom php code.
I ended up using rules to save information from the user and the cloned node into hidden fields.
One that saved the original node ID into a field when ever you create content of that type unless the url ends with Clone. This means that when you create the clone the original node ID is kept in the field.
That made it easy to use a views argument that took the node ID to make the clone appear along side the original when a user visits the original page.
The second rule trick was to compute a field that saved the "store name" from the profile of the user only when saving clone content.
This meant that there was a hidden field on the clone that stored the info so I could then use another views argument to restrict the view to only people with the same store name in their profile.
I am no good with PHP but I managed to find a snippet (can't remember where) that returns the store name of the current logged in user as the argument.
global $user;
profile_load_profile($user);
return $user->profile_store_name;

change user_profile_form form fields order

When a user login , the user will be redirect to a user profile page, which has a My account field set.
the field set has 2 fields, "Username: ", "Email address:". those 2 fields are generated by drupal.
those 2 field contained in a form which has a id ("user_profile_form") . I want to change the order of those 2 fields.
I have tried to intercept 'user_profile_form' , inside hook_form_alter.
code as follow:
$form['account']['name']['#weight'] = 1;
but that did not success, drupal did not even rendering the 'name' field, so no username: showed on browser.
What you did is absolutely correct, and probably did work. You can change the weight of the fields with the method described above.
The username field is not always rendered. The reason is that a persmission is required: change own username. If that perm is not set, you wont be allowed to alter you username and the field wont be shown.
Info on debugging.
Your info alone is not quite enough to debug. From what you describe, you are doing the right thing, but other modules could be making things a bit tricky for you. The devel module is quite good when it comes to debugging, ti defines two functions I use a lot when debugging:
dpm() pretty prints the variable to the message area using krumo.
dd() Prints / saves a variable to a log file. Useful when you can't view messages on the screen.
I would suggest that you look at the $form variable before and after you alter it.
Things that could make it go wrong:
Did you remember to pass the $form variable by reference using the & notation?
Is another module altering your form after you?
Are you checking for the correct form id, so you alter the correct form?
These are some pointers, before you bring more info, all I can do is guess to what your problem exactly can be. I did something like this a few days ago so I know what you describe shouldn't be a problem.

Resources