Right now, I'm generating unique IDs with childByAutoId(), but was wondering if there was a way to do this only generating numbers, no letters or other characters?
The reason is I need to be able to automatically send this key through imessage (part of how I send invites) and when it contains letters you're not able to automatically select and copy the key without copying the entire text message. With numbers only the key will be underlined and selectable.
Is there a way to either generate an ID with numbers only, or to selectively underline part of an iMessage with MFMessage in Swift?
Thanks!
I've need a similar option. When i create a new user; it will have a numberID which will be unique. I've tried .push() method which is for android, creates a uniqueID but with characters(letters) included. What i've done was something like this;
When i add a new user, i increment a value from different branch which is User2Key in this situation. And gave the value as key(parent) of newly added user.
When i delete or update a user, User2Key will be the same. If i add a new user then it will be incremented so every user will have uniqueID.
You can use a similar approach.
Hope this helps! Cheers!
Related
I am an iOS app developer. Right now, I need my app to update his/her scores in the database (Firestore) when a user tabs a button.
I only know that it is possible to add new documents to the database according to the official doc: https://firebase.google.com/docs/firestore/quickstart#swift. But can I simply update one key-value pair within a document at a time?
For example, I have to add 10 points to the user with ID: 1234 if he/she clicks the correct button. So first of all, I need to read the data according to the unique ID, and catch his/her current points. Then put back the points plus 10.
It looks like Firestorage only allows users to upload an entire document once a time.
Swift code snippet is appreciated!
You can update a single or multiple fields in a document with the updateData call.
To atomically increment a numeric value can you can use the FieldValue.increment operation. From that last link comes this example:
washingtonRef.updateData([
"population": FieldValue.increment(Int64(50))
])
This code increments the population field in the document by 50, and leave other fields in the document unmodified.
How do you use a zap to remove data from an existing field? For example, the fields "Name" and "Email" have data, but I need a zap that will just set those values as blank/null/empty.
The zap I'm using is for a Checklist in Process Street. There are several fields (i.e., email, name, etc.) that are already populated with data in the Checklist, and I want to remove those data. Of course if you just leave the fields blank in the zap, Zapier ignores them in the update. I've tried looking up environment variables but can't find anything, and blind guessing with inserting a space, "", {{NULL}}, " ", doesn't work. Thank you for your assistance!
The empty string will work in many cases, but if it's acting up, you could try adding a Formatter step and replacing the existing contents of the field (using the field you want to clear from an earlier step as the "find" part of find/replace) with the empty string (the replace part of find/replace). You can see this document for how the Formatter by Zapier app can be used:
https://zapier.com/apps/formatter/help#reformatting-text
This is a bit quirky, so if that doesn't work, you might try reaching out to customer service. They'll definitely have more specific advice for your Zap.
https://zapier.com/app/contact-us
I am having a drupal 7 node about software releases. The title field of the release is
"Release v6-05-01"
I need to construct a URL based on this title that goes like this http://example.com/html605/Class.html
I know hot to construct the URL but the "605" bit is tricky because I have no token for it.
I thought that maybe I could take the characters from the title one by one? Is this possible in Drupal 7?
One solution could be to add a new field (eg "version number", text field) to your content type to hold the "605" string, and then use this token (typically : [node:field_version_number]) to construct your URL. But you'll have one more field to manage when creating new nodes, and maybe a lot of work to process existing nodes.
Depending on how this number is constructed from the node title, you could try using Computed Field or Dynamic Field, and create a PHP computed field. In PHP you could build the version number with some substr logic based on the node title (its value is available in the PHP snippet). This way you don't have to fill the new field for each new node and existing nodes should be automatically updated.
Good luck
For a tag system, when entering a new item, I'd like the user to start typing a letter or two and see possible tags...similar to how SO tags work on the website i.e. Ajax.
Is there a way to do this on IOS?
Basically the Add Item screen has some empty text fields where you put the name etc.
I'd like to have an additional empty field where as you enter letters you see possible tags appear below and can then select one to tag the item.
The tags would be served from an entity or table so there would have to be a call to core data to supply them based on the letters typed.
Do I have to implement a full blown tableview to do this? Or is there a way to make the possible tags show up below the textfield box.
Thanks for any suggestions.
You could try a third party development in order to make what you want. In a recent project I have used this one:
https://github.com/EddyBorja/MLPAutoCompleteTextField
I have implemented multiple file uploads for existing records as seen here https://github.com/websymphony/Rails3-Paperclip-Uploadify
I would like to know if it is possible to implement multiple file uploads when creating a new record.
Since we need flash to do the multiple file uploads, how would it be possible to associate the uploaded files with the record if the record has not yet been created.
I have thought of a hack-ish way to essentially make a "draft" and update it. However, I hope there is a better way to do this.
There is no better than the kind of hackish way you present:
creating orphans objects and give them parents later or delete them (sad huh? :) )
creating parent object by default, add some confirmation field in the form so that you know what objects really have an owner, delete the rest.
BTW, you don't "need" flash for multiple uploads, see here: http://blueimp.github.com/jQuery-File-Upload/
Yes, you can use http://blueimp.github.com/jQuery-File-Upload/. But there are still some points you need to be careful.
Don't forget to remove appended array after you define the file field with "multiple". For example: replace "photo[image][]" with "photo[image]".Otherwise file uploaders like "carrierware" will not be working.
If you are using rails 3.2.13, the appended array will always appear no matter whether you set the name to be without appended array. You can use "file_field_tag" to resolve this problem. Please refer this issue to: https://github.com/tors/jquery-fileupload-rails/issues/36.
For the association:
You need to create a hidden text field which contains IDs of images that will be associated to the record you are going to create.
Upload images by "jquery-fileupload"(it is ajax), then get IDs of images from response bodies.
Set these IDs to the hidden field.