imageSourceModule.fromFile(path) returns null in nativescript - nativescript
Code is:
let folder = fileSystemModule.knownFolders.currentApp();
let path = fileSystemModule.path.join(folder.path,img.src.android);
let abc = imageSourceModule.fromPath(path);
Related
DocuSign Require Signing Document Twice with Different Tabs
I have a document that is using tabs to fill a document. The document is signed before and after completion of a task. Is it possible to modify tabs on an envelope - then re-generate an DocuSign_eSign::RecipientViewRequest (still having the initial signature / fields)? Thus far I've been able to generate two DocuSign_eSign::RecipientViewRequest, but cannot figure out how to change the tabs in between signing: PRE_SIGNER = 'pre_signer' POST_SIGNER = 'post_signer' PRIVATE_KEY = CREDENTIALS['private_key'] PUBLIC_KEY = CREDENTIALS['public_key'] USER_ID = CREDENTIALS['user_id'] CLIENT_ID = CREDENTIALS['client_id'] ACCOUNT_ID = CREDENTIALS['account_id'] BASE_URL = CREDENTIALS['base_url'] configuration = DocuSign_eSign::Configuration.new configuration.host = "#{BASE_URL}/restapi" configuration.debugging = true api_client = DocuSign_eSign::ApiClient.new(configuration) api_client.base_path = BASE_URL envelope_api = DocuSign_eSign::EnvelopesApi.new(api_client) pre_signer_text = DocuSign_eSign::Text.new pre_signer_text.value = 'Alpha' pre_signer_text.tab_label = 'pre_value' pre_signer = DocuSign_eSign::Signer.new pre_signer.role_name = PRE_SIGNER pre_signer.client_user_id = PRE_SIGNER pre_signer.recipient_id = 1 pre_signer.name = 'Kevin Sylvestre' pre_signer.email = 'kevin#fake.com' pre_signer.tabs = DocuSign_eSign::Tabs.new pre_signer.tabs.text_tabs = [pre_signer_text] post_signer = DocuSign_eSign::Signer.new post_signer.role_name = POST_SIGNER post_signer.client_user_id = POST_SIGNER post_signer.recipient_id = 2 post_signer.name = 'Kevin Sylvestre' post_signer.email = 'kevin#fake.com' post_signer.tabs = DocuSign_eSign::Tabs.new post_signer.tabs.text_tabs = [] server_template = DocuSign_eSign::ServerTemplate.new server_template.sequence = 0 server_template.template_id = TEMPLATE_ID inline_template = DocuSign_eSign::InlineTemplate.new inline_template.sequence = 0 inline_template.recipients = DocuSign_eSign::Recipients.new inline_template.recipients.signers = [ pre_signer, post_signer, ] composite_template = DocuSign_eSign::CompositeTemplate.new composite_template.server_templates = [server_template] composite_template.inline_templates = [inline_template] envelope_event = DocuSign_eSign::EnvelopeEvent.new envelope_event.envelope_event_status_code = 'completed' envelope_definition = DocuSign_eSign::EnvelopeDefinition.new envelope_definition.status = 'sent' envelope_definition.composite_templates = [composite_template] api_client.request_jwt_user_token(CLIENT_ID, USER_ID, PRIVATE_KEY) envelope = envelope_api.create_envelope(ACCOUNT_ID, envelope_definition) pre_signer_recipient_view_request = DocuSign_eSign::RecipientViewRequest.new pre_signer_recipient_view_request.authentication_method = 'none' pre_signer_recipient_view_request.client_user_id = PRE_SIGNER pre_signer_recipient_view_request.user_name = 'Kevin Sylvestre' pre_signer_recipient_view_request.email = 'kevin#fake.com' pre_signer_recipient_view_request.return_url = 'https://ksylvest.com' pre_recipient_view = envelope_api.create_recipient_view(ACCOUNT_ID, envelope.envelope_id, pre_signer_recipient_view_request) url = pre_recipient_view.url `open #{url}` puts "Continue?" gets # at this point I'd like to enter values for tabs... post_signer_text = DocuSign_eSign::Text.new post_signer_text.value = 'Omega' post_signer_text.tab_label = 'post_value' post_signer_recipient_view_request = DocuSign_eSign::RecipientViewRequest.new post_signer_recipient_view_request.authentication_method = 'none' post_signer_recipient_view_request.client_user_id = POST_SIGNER post_signer_recipient_view_request.user_name = 'Kevin Sylvestre' post_signer_recipient_view_request.email = 'kevin#fake.com' post_signer_recipient_view_request.return_url = 'https://ksylvest.com' post_recipient_view = envelope_api.create_recipient_view(ACCOUNT_ID, envelope.envelope_id, post_signer_recipient_view_request) url = post_recipient_view.url `open #{url}`
You could add the same person to sign twice, as two separate recipients that are the same person. You can generate different recipient views. You can set the routing order to be different. Only reason I didn't post this as an answer is that you may mean that you need to pause the envelope? you can add tabs using your code where you have post_signer.tabs, but if you want to modify existing tabs that came from the template then you have to create the envelope in draft mode ("created") and then make a different API call to modify the tabs and then a final API call to send it. Another option is to pause the envelope and "correct" it. Pause envelope workflow code examples https://github.com/docusign/docusign-esign-ruby-client/blob/c477b07c2f578214fdf7d0c5a33355f01e9a0b4e/lib/docusign_esign/api/envelopes_api.rb#L6132 update_recipients() method should do the trick...
Shorter Uri in Codeigniter
I have it -> $route['posts/index'] = 'posts/index'; $route['posts/create'] = 'posts/create'; $route['posts/update'] = 'posts/update'; $route['posts/(:any)'] = 'posts/view/$1'; $route['posts'] = 'posts/index'; has it got way to short $route['posts/index'],$route['posts/create'],$route['posts/update'] etc to one code ? idk like $route['posts/(:any)'] = 'posts/$2'; ?
Context Free Grammar for English Sounding Names
I am currently writing an application that will generate random data; specifically, random names. I have made some decent progress, but am not satisfied with many of the generated names. The problem lies in my production rules, which I've attached to the bottom of this post. The basic idea is: consonant, vowel, consonant, vowel, but some consonants themselves map to vowels (such as b< VO >). I have not fully created the rules yet, but the final idea would follow the format shown below. However, rather than finishing it, I would like to make a better basis for the production rules. I have tried to find a reference that discusses either: a CFG already created for English-sounding words, or an English reference that disassembles the basic format of letter combinations for words. Unfortunately, I have not been able to find a useful resource to help me advance farther than I already have. Does anyone know of a place I should look, or a reference I can look at? ALSO: in your opinion, do you believe a context-sensitive grammar might work better? //the following will deal with single vowels and consonants var CO = ['b','c','d','f','g','h','j','k','l','m','n','p','qu','r','s','t','v','w','x','y','z']; CO.probabilities = [2.41,4.49,6.87,3.59,3.25,9.84,0.24,1.24,6.5,3.88,10.9,3.11,0.153,9.67,10.2,14.6,1.58,3.81,0.242,3.19,0.12]; CO.name = "CO"; var VO = ['a','e','i','o','u']; VO.probabilities = [21.43,33.33,18.28,19.7,7.23]; VO.name = "VO"; var LETTER = ['<VO>','<CO>']; LETTER.probabilities = [38.1,61.9]; LETTER.name = "LETTER"; //the following deal with connsonant pairs var BH = ['c','p','r','s','t']; //the fisrt part of a th, ph, sh, pair (before H) BH.probabilities = [20,10,20,25,25]; BH.name = "BH"; var BL = ['b','c','f','g','p','s']; //before letter l BL.probabilities = [10,20,10,10,25,25] BL.name = "BL"; var COP = ['<BH>h','<BL>l'] //consonant pairs COP.probabilities = [50,50]; COP.name = "COP"; //this is a generic syllable, that does not take grammar rules into consideration var SYL = ['<CO><VO>','<VO><CO>','<CO><VO><VO>']; SYL.probabilities = [50,20,30]; SYL.name = "SYL"; //the following deal with mid word syllablse var CLOSED = ['<CO><VO><CO>','<CO><VO><CO><CO>']; CLOSED.probabilities = [75,25]; CLOSED.name = "CLOSED"; var OPEN = ['<CO><VO>','<CO><CO><VO>']; OPEN.probabilities = [60,40]; OPEN.name = "OPEN"; var VR = ['<VO>r']; //vowel-r VR.probabilities = [100]; VR.name = "VR"; var MID = ['<CLOSED>','<OPEN>','<VR>']; MID.probabilities = [33,33,33]; MID.name = "MID"; //the following will deal with ending syllables var VCE = ['<VO><CO>e','<LETTER><VO><CO>e']; VCE.probabilities = [75,25]; VCE.name = "VCE"; var CLE = ['<CO>le']; CLE.probabilities = [100]; CLE.name = "CLE"; var OE = ['tion','age','ive']; //other endings OE.probabilities = [33,33,33]; OE.name = "OE"; var ES = ['<VCE>','<CLE>','<OE>','<VR>']; //contains all ending syllables ES.probabilities = [40,40,20]; ES.name = "ES"; var rules = [CO,VO,BH,BL,COP,LETTER,SYL,CLOSED,OPEN,VR,MID,VCE,CLE,OE,ES]; //These are some highly-defined production rules var streetSuffix = ['road','street','way','avenue','drive','grove','lane','gardens','place','crescent','close','square','hill','circus','mews','vale','rise','mead']; streetSuffix.probabilities = [15,15,5,10,5,2.7,2.7,2.7,2.7,2.7,2.7,2.7,2.7,2.7,2.7,2.7,2.7,2.7]; var states = ['Alabama','Alaska','American Samoa','Arizona','Arkansas','California','Colorado','Connecticut','Delaware','Florida','Georgia','Guam','Hawaii','Idaho','Illinois','Indiana','Iowa','Kansas','Kentucky','Louisiana','Maine','Marshall Islands','Maryland','Massachusetts','Michigan','Minnesota','Mississippi','Missouri','Montana','Nebraska','Nevada','New Hampshire','New Jersey','New Mexico','New York','North Carolina','North Dakota','Ohio','Oklahoma','Oregon','Palau','Pennsylvania','Puerto Rico','Rhode Island','South Carolina','South Dakota','Tennessee','Texas','Utah','Vermont','Virgin Island','Virginia','Washington','West Virginia','Wisconsin','Wyoming']; var cityNewWordSuffix = ['city','town','']; var cityEndWordSuffix = ['polis','ville','ford','furt','forth','shire','berg','gurg','borough','brough','field','kirk','bury','stadt','']; var siteSuffix = ['com','org','net','edu']; /** This will generate a random name of Length length */ function generateRandomName() { //string will be random length of CO VO pattern for now var result; result = "<COP><VO><MID><VO><ES>"; while (hasNonTerminal(result)) { result = replaceFirstNonTerminal(result); } return result; } Here are a few words generated by the machine in its current state: "cheiroene", "sloeraase", "sledehgeute", "rhaorenone", "rheerisute", "chaereehe", "sletraoege", "sluureese", "chaheyleete", "chierauhe", "ploclooate", "glawofhaice", "thanisgoage", "slelaodose", "blaereode", "shihudeife", "slaereene", "pleheaele", "rhepicsaile", "ploeruoge", "sliareuhe", "thaereafe", "thaaraeke", "cheoreate", "shofetniote", "phiraoese", "clilniueye", "slepceikede", "cligloueohe", "phitleoime",
Convert SQL Statement to Predicate or NSExpression
I am facing a problem with converting below SQL to NSExpression SELECT id,trait1,trait2,trait3,sum(trait1+trait2+trait3) as total FROM `bookings` GROUP BY id order by total desc Below is my code in this code I am only able to add the two key values not three key values. func aggregateProductsInContext(context:NSManagedObjectContext) { var expressionDescriptions = [AnyObject]() expressionDescriptions.append("name") let expressionDescription = NSExpressionDescription() expressionDescription.name = "Sold" let exp1 = NSExpression(forKeyPath: "trait1") let exp3 = NSExpression(forKeyPath: "trait2") let exp3 = NSExpression(forKeyPath: "trait3") let stas = NSExpression(forFunction:"add:to:", arguments:[exp1,exp3]) expressionDescription.expression = stas expressionDescription.expressionResultType = .Integer64AttributeType expressionDescriptions.append(expressionDescription) let request = NSFetchRequest(entityName: "booking") request.propertiesToGroupBy = ["name"] request.resultType = .DictionaryResultType request.sortDescriptors = [NSSortDescriptor(key: "name", ascending: true)] request.propertiesToFetch = expressionDescriptions var results:[[String:AnyObject]]? do { results = try context.executeFetchRequest(request) as? [[String:AnyObject]] } catch _ { results = nil } print(results) } Please find the attached images of actual table values and resulted values for reference. Thanks! My Solution: I am able to solve my problem by doing this let ec = NSExpression(forFunction:"add:to:", arguments:[exp1,exp2]) let ec1 = NSExpression(forFunction:"add:to:", arguments:[ec,exp3]) let ec2 = NSExpression(forFunction:"add:to:", arguments:[ec1,exp4]) let ec3 = NSExpression(forFunction:"add:to:", arguments:[ec2,exp5]) If there is any other way to achieve this, please let me know Thanks!
Here is the solution which I had implemented and it's work fine. let ec = NSExpression(forFunction:"add:to:", arguments:[exp1,exp2]) let ec1 = NSExpression(forFunction:"add:to:", arguments:[ec,exp3]) let ec2 = NSExpression(forFunction:"add:to:", arguments:[ec1,exp4]) let ec3 = NSExpression(forFunction:"add:to:", arguments:[ec2,exp5]) But I am sure there must be some other good way to do that. If any one have any other solution. please let me know. Thanks!
gdata.data.PhoneNumber: How do I get the type of Phone Number?
Using the class gdata.data.PhoneNumber, how do I get the type (Home/Business/Mobile/etc.) of that phone number? This is the documentation I am referencing: https://gdata-python-client.googlecode.com/hg/pydocs/gdata.data.html#PhoneNumber
The "rel" attribute should be what you are looking for. This is example code from https://github.com/google/gdata-python-client/blob/master/tests/gdata_tests/contacts/service_test.py: # Create a new entry new_entry = gdata.contacts.ContactEntry() new_entry.title = atom.Title(text='Elizabeth Bennet') new_entry.content = atom.Content(text='Test Notes') new_entry.email.append(gdata.contacts.Email( rel='http://schemas.google.com/g/2005#work', primary='true', address='liz#gmail.com')) new_entry.phone_number.append(gdata.contacts.PhoneNumber( rel='http://schemas.google.com/g/2005#work', text='(206)555-1212')) new_entry.organization = gdata.contacts.Organization( org_name=gdata.contacts.OrgName(text='TestCo.'), rel='http://schemas.google.com/g/2005#work') It doesn't access the "rel" attribute but it is there, I swear :) Once you get a PhoneNumer instance you can print every attribute with the built-in dir() function: print(dir(phone_number)) The following is a list of "rel"s (https://github.com/google/gdata-python-client/blob/master/src/gdata/data.py). I don't know whether all are applicable to phone numbers or not but it may be useful for checking the type: FAX_REL = 'http://schemas.google.com/g/2005#fax' HOME_REL = 'http://schemas.google.com/g/2005#home' HOME_FAX_REL = 'http://schemas.google.com/g/2005#home_fax' ISDN_REL = 'http://schemas.google.com/g/2005#isdn' MAIN_REL = 'http://schemas.google.com/g/2005#main' MOBILE_REL = 'http://schemas.google.com/g/2005#mobile' OTHER_REL = 'http://schemas.google.com/g/2005#other' OTHER_FAX_REL = 'http://schemas.google.com/g/2005#other_fax' PAGER_REL = 'http://schemas.google.com/g/2005#pager' RADIO_REL = 'http://schemas.google.com/g/2005#radio' TELEX_REL = 'http://schemas.google.com/g/2005#telex' TTL_TDD_REL = 'http://schemas.google.com/g/2005#tty_tdd' WORK_REL = 'http://schemas.google.com/g/2005#work' WORK_FAX_REL = 'http://schemas.google.com/g/2005#work_fax' WORK_MOBILE_REL = 'http://schemas.google.com/g/2005#work_mobile' WORK_PAGER_REL = 'http://schemas.google.com/g/2005#work_pager' NETMEETING_REL = 'http://schemas.google.com/g/2005#netmeeting' Those OTHER "rel"s can (or maybe should?) be joined with the object's "label" attribute.