Posts

Showing posts from May, 2014

javascript - Polymer and firebase-auth -

i writing polymer web application. using firebase along firebase-auth db , authentication. i have main app.html element on index page custom my-login element pops when click login button contains firebase-auth element , login logic. far have been able log in firebase-auth element. however, after logging in my-login element, have not been able figure out how access login information on index.html page , of other pages in app. any idea on how this? can't find examples online of using login information on elements other 1 contains firebase-auth . here app.html : <dom-module id="my-app"> <link rel="import" type="css" href="../styles/app-theme.css"> <template> <app-router style="display:none;"> <app-route path="/" import="/elements/blog.html"></app-route> <app-route path="/artist" import="/elements/artist.htm

Excel VBA - Add new table columns with specific header names -

i have simple vba question. want macro add 4 new columns in table object, ("table1"). these named in order, left right: aht, target aht, transfers, target transfers the code have below adds columns fine, not sure how name 1 individually. also, please show me how loop section of code. thanks! sub inserttablecolumn() dim lst listobject dim currentsht worksheet set currentsht = activeworkbook.sheets("sheet1") set lst = activesheet.listobjects("table1") 'below code have looped lst.listcolumns.add lst.listcolumns.add lst.listcolumns.add lst.listcolumns.add end sub a variant array place store variables in looped sequence. sub inserttablecolumn() dim lst listobject dim currentsht worksheet dim h long, hdrs variant hdrs = array("aht", "target aht", "transfers", "target transfers") set currentsht = activeworkbook.sheets("sheet1") set lst = actives

Google web font "Open Sans" does not show up in the correct weight if also installed locally on Windows 7+10 -

i using "open sans" so: <script src="https://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js"></script> <script> webfont.load({ google: { families: ['open+sans:400,400italic,600,600italic,700,700italic:latin'] } }); </script> and works should, except on 2 of pcs (one "windows 7" , other 1 "windows 10") recent "chrome browser", there no difference between widths of 600 , 700. recent "edge" , "firefox" browsers good. i found out, on both machines "open sans" installed locally. on "windows 7" pc myself , on "windows 10" pc pre installed. after uninstalling local font on both pcs working fine. is kind of chrome bug? could not find online it. also, if other users have on "windows 10" pcs "open sans" locally pre installed, website developing show on chrome browser wrong weights "open sans" font. can somehow avoide

javascript - Error: Failed to lookup view "error" in views directory using handlebars -

hi new web development in node js. @ work today tasked setup environment web application. using handlebars, having trouble making 'view engine setup' work in order render 'views' files , layouts folder. have looked @ documentation , every stack overflow post similar issue, still nowhere. here code below server.js , architecture of app. appreciate feedback in advance! var express = require('express'); var path = require('path'); var handlebars = require('handlebars'); var exphbs = require('express-handlebars'); var app = express(); var cookieparser = require('cookie-parser'); var bodyparser = require('body-parser'); //view engine setup app.set('views', './views') app.engine('.hbs', exphbs({ defaultlayout: 'main', extname: '.hbs' })); app.set('view engine', '.hbs'); app.use(bodyparser.json()); app.use(bodyparser.u

scala - How to set up SSL with a TCP client in Akka 2.4.6? -

i trying set tcp connection on tls can't find recent documentation on that. found akka streams 2.2 did manage find 2.4.x. i have been looking @ this documentation thanks ! i think use tls object in akka streams. it create bidiflow use convert plaintext cypher text , vice versa.

why does $1 in yacc/bison has a value of 0 -

i have following production in bison spec: op : '+' { printf("%d %d %c\n", $1, '+', '+'); } when input + following output: 0 43 + can explain why $1 has value of 0, shouldn't 43? missing? edit there no flex file, can provide bison grammar: %{ #include <stdio.h> #include <ctype.h> #include <string.h> int yylex(); int yyerror(); %} %token number %% lexp : number | '(' op lexp-seq ')' ; op : '+' { printf("%d %d %c\n", $1, '+', '+'); } | '-' { printf("%d %d %c\n", $1, '-', '-'); } | '*' { printf("%d %d %c\n", $1, '*', '*'); } ; lexp-seq : lexp-seq lexp | lexp ; %% int main(int argc, char** argv) { if (2 == argc && (0 == strcmp("-g", argv[1]))) yydebug = 1; return yyparse(); } int yylex() { int c; /* eliminate blanks*/

javascript - How to GET JSON Object from URL in Node.js/Express -

i should preface post saying beginner , first time using node.js , express in real project. i have simple node.js/express project , want read json object url. afterwards, intend build url displays html external website using iframe. i read 'request' module online , know need along these lines: var express = require('express'); var router = express.router(); var request = require('request'); // urls app center rest functions var url = 'https://someserver.com/appserver/portal/api/1.0/results/recent'; /* list of recent reports */ router.get('/testapi', function(req, res, next) { res.render('testapi', { title: 'list recent reports' }); }); /* test: function report list */ router.get('/recentreports', function(req, res){ request({ url: url, json: true }, function (error, response, body) { if (!error && response.statuscode === 200) { console.log(body) // print json response }

javascript - Need to run for loop and WaitFor in sync CasperJS -

i have code below var casper = require('casper').create(); casper.on('remote.message', function (msg) { this.echo(msg); }); casper.start( << url >> , function () { this.echo(this.gettitle()); }); var resultobj = []; casper.thenclick("#addtocart").then(function () { // scrape else casper.options.waittimeout = 100000; var objectone = this.evaluate(somefunction, << variables >> ); //above function returns object casper.each(objectone, function (self, obj) { var anotherobject = this.evaluate(anotherfunction, << variables >> ); self.waitfor(function check() { var result = this.evaluate(thirdfunction, obj); if (result != 'no') { resultobj.push(result); } // result = 'yes'; return result != 'no'; this.evaluate(function () {}); }, function then() {

Array does not work in Javascript -

i tried make function returns array, output should "my name sarah adam" not return anything /*global s:true*/ var m = 'my name '; function updatemsg(h) { "use strict"; var el = m + h; s = ['adam', 'joseph']; return s; } var n1 = document.getelementbyid("msg"); n1.textcontent = updatemsg("sarah")[0]; you returning s (the array) - think want return concatenated message. in: updated include variable last names var m = 'my name '; function updatemsg(h, index) { "use strict"; var el = m + h; // array of last names var s = ['adam', 'joseph']; return el + ' ' + s[index]; // return concatenated string instead } var n1 = document.getelementbyid("msg"); n1.textcontent = updatemsg("sarah", 0); // invoke param // console log (confirmation) console.log(updatemsg("sarah", 0)); console.log(updatem

How to read Date from VB binary-file in java -

i have file produced visual basic program wrote years ago. trying convert data can read in replacement java program wrote. having problems converting vb date 8 byte double. have read this thread. going through steps, able convert date manually (0x00000000e080e440) (12/18/2014). little endian big endian decimal = 4.1991e4, 41991 represents correct date. trying write in java. other post references code swapping , have plucked code: /** * byte swap single double value. * * @param value value byte swap. * @return byte swapped representation. */ public static double swap (double value) { long longvalue = double.doubletolongbits (value); longvalue = swap (longvalue); return double.longbitstodouble (longvalue); } that code not compile. learning java bear me. code looks recursively calling itself, when calls (swap) passing longvalue long when swap expecting double. missing something? how can bytes swapped little endian big?

Nested FHIR Bundles -

can have fhir bundle( list of resources) within fhir bundle( list of fhir bundles) ? i'm building search api response should include list of resources , if resources have multiple related resources, should grouped in response fhir client can display without making additional api calls yes bundle can contain bundles. note, though, include resources in bundle directly, since they'll resolved url. nesting bundles makes harder client. (see how _include defined in spec @ http://hl7.org/fhir/search.html#include )

javascript - Convert date in UK format and Django format to real date -

i trying convert booking.date , in following format 01/06/2016 format 'eeee, mmmm d, y' (wednesday, june, 1, 2016) . i've tried following angularjs filter date doesn't seem working. suggestions? <p style="small">{{ booking.date | date:'fulldate' }}<br>{{ booking.time }}</p> i have date in format: 2016-05-31t19:18:24z elsewhere, there approach can take well? you should not use date constructor or date.parse parse strings (they equivalent parsing). manually parse strings, library can (there many chose from) if have 1 format simple function sufficient. to parse string in d/m/y format (which used, it's not peculiar uk in way m/d/y usa) , validate values, use function like: /* parse date string in d/m/y format ** @param {string} s - date string ** @returns {date} if date invalid, returns invalid date */ function parsedmy(s) { var b = (''+s).split(/\d/); var d = new date(b[2], --b[1], b[0]

ios - How do I tell my app where my Pod header files are? -

Image
the question how tell app pod header files are. the setting i inherited ios app else. wanted add locksmith app passwords. app had pods, pod install wasnt working gem installed cocoapods , worked. then pod installed locksmith , worked, until ran app again. the errors now these errors on pods never messed with. in bridge.h file first line gives error #import <tpkeyboardavoiding/tpkeyboardavoidingscrollview.h> #import <datetools/datetools.h> the error response is: /folders/appname/application/bridge.h:15:9: error: 'tpkeyboardavoiding/tpkeyboardavoidingscrollview.h' file not found #import <tpkeyboardavoiding/tpkeyboardavoidingscrollview.h> ^ <unknown>:0: error: failed import bridging header '/folders/appname/application/bridge.h' the thing exact same error occurs datetools if remove first line. so, seems path pods isnt working. i couldn't find pod paths located , issue. any appreciated edit 1 tpkeyboarda

maven - Build Shaded Java (jar) into a Win32 executable with Embedded JRE? -

so far i've tried launch4j did not have success making work. getting java.lang.noclassdeffounderror: is there way build shaded jar win32 executable (console app) embedded jre maven. user not have install java? you may use maven-shaded-plugin in combination launch4j-maven-plugin here example of this

swift - Today Widget - Conflict Autolayout Constraint When Locking the device -

i implementing today widget. first time getting hands onto today widget. i created today widget programmatically without using storyboard. learned post , did: 1. change info plist 2. enable "embedded content contains swift code" 3. add @objc(hgtodayviewcontroller) after import hgtodayviewcontroller inital view controller in loadview in hgtodayviewcontroller var mainview:hgtodayview! override func loadview() { self.mainview = hgtodayview(frame: cgrectzero) self.view = self.mainview } in hgtodayview: override init(frame: cgrect) { super.init(frame: frame) // self self.translatesautoresizingmaskintoconstraints = false // subview self.tableview = uitableview() self.tableview.translatesautoresizingmaskintoconstraints = false self.addsubview(self.tableview) // constraint self.setconstraint() // debug self.tableview.backgroundcolor = uicolor.redcolor() } in hgtodayview setconstraint method: func setconstraint() { // self.height

java - Regex to extract lines after the last occurence -

hi have paragraph : output 123 deepak everywhere deepak output 123 ankur everywhere deepak last deepak everywhere deepak i want extract after last occurrence of "output 123" "last" . expect : ankur everywhere deepak last i use regex pattern - (?<=(output))([^\\n]*)last . using this, : output 123 deepak everywhere deepak output 123 ankur everywhere deepak last can ? use tool - http://regexr.com?360ek you can use pattern , extract first capturing group: output\\b[^\\n]*\\s*((?>[^o\\s]++|\\s++(?!last\\b)|o(?!utput\\b))++)(?=\\s+last\b) details: output\\b[^\\n]*\\s* # begining (exclude final result # used anchor) ( # open capturing group (?>

Formatting the automated email send from google spreadsheet -

i have been looking on web , not find way format email sent google spreadsheet application. have tried using inline html elements, api escaping them , sending them plain text in email. have idea how format text? try using following code: ... var options = { htmlbody: '<b><i>test</i></b>' }; mailapp.sendemail('someone@domain.ext', 'test', 'test', options); ...

string - Bear and Steady gene - code optimisation(python) -

i have string containing a,g,c , t(length n). string steady if contains equal number of a,g,c , t(each n/4 times). need find minimum length of substring when replaced makes steady. https://www.hackerrank.com/challenges/bear-and-steady-gene suppose s1='aagaagaa' since n=8 ideally should have 2 a's, 2 t's, 2 g's , 2 c's. has excess a's 4. hence need substring contains @ least 4 a's. start taking 4 character substring left , if not found increase mnum(variable) 1(ie 5 variable substrings , on) aagaa answer. but it's slow. collections import counter import sys n=int(input()) #length of string s1=input() s=counter(s1) le=int(n/4) #ideal length of each element comp={'a':le,'g':le,'c':le,'t':le} #dictionary containing equal number of elements s.subtract(comp) #finding how each element ('a','g'...) in excess or loss a=[] b=[] x in s.values(): #storing frequency(s.valu

scala - Akka-Http: How to return a response from an actor? -

i using actor inside request "ask" pattern: val route = pathprefix("myapp") { path("search") { { (mainactorref ? dosomething("foo")).mapto[returningtype].map { result => complete(httpentity(contenttypes.`application/json`, result )) } } } } the problem main actor communicates other actors , gets answer 1 of actors this: class mainactor extends actor { override def receive: receive = { case d:dosomething => anotheractor ! dothis(d) // received anotheractor reply dothis case r:dothisresponse => // how send response “route”? pipe (future{r}) ??? } } how can send answer akka-http response? using "sender()" in main actor doesn't work won't right reference. should pass in dosomething reference use "tell" (!) inside main actor? how pass reference? use forward instead of tell in the mainactor when

javascript - Facebook FB.getLoginStatus doesn't fire Callback -

i know there similar questions here on stackoverflow, there wasn't solution me in of them , i'm pretty desperate right now. i'm writing facebook app , works pretty neat far. fb.getloginstatus function doesn't fire callback users (a small percentage). able reproduce error on 1 machine , happened there , on chrome. user got problem chrome. found out, works if move facebook api code on own page (have no explanation this, commented out rest of code , did work sometimes, many times not). moved own page , send data got on getloginstatus function other page. did work pc, still got entries in database didn't work other users. have no idea why callback doesn't called, hope can me, in advance! tldr: facebook api doesn't fire callback @ fb.getloginstatus function. happens on small percentage of machines , reproduce 2 machines (both on chrome, different user account, different os). code i'm using: https://jsfiddle.net/zfyb3zy4/ <script>

Using jQuery with HTML Text Links to Show/Hide Multiple DIVs -

i'm creating menu page local restaurant. @ top of page of text based links each portion of menu such as: appetizers | soups , salads | entrees the html markup these is: <a id="show_apps">appetizers</a> | <a id="show_soups">soups , salads</a> | <a id="show_entrees">entrees</a> my css setup this: #menu_container{ width: 650px; height: auto; padding-left: 30px; } #menu_container div{display:none;} and menu sections setup this <div id="menu_container"> <div id="menu_apps"> content of app section here </div> <div id="menu_soups"> content of soups section here </div> <div id="menu_entrees"> content of entrees section here </div> </div> what trying find solution when clicks on link each section show div if click on section, replace viewed div next one. example: user clicks on "appe

c++ - inf output computing line slopes -

i new @ c++. i wrote code below supposed tell me if 2 lines have intersection point, figured 2 lines equal "m" in y=mx+b equation should not intersect , others would. the program seems understanding this, unless slope of inputted line segment 0 outputs inf or -inf. why happening? #include <iostream> using namespace std; int main () { typedef double vector2d[2]; vector2d pointa, pointb, pointc, pointd; double lineseg1, lineseg2; double yes, no; cout << "enter x point a: "; cin >> pointa[0]; cout << "enter y point a: "; cin >> pointa[1]; cout << "point = (" << pointa[0] << "," << pointa[1] << ")" << endl; cout << "enter x point b: "; cin >> pointb[0]; cout << "enter y point b: "; cin >> pointb[1]; cout << "point b = (" << pointb[0] << "," << pointb[1] << &q

jquery - Take data from one div and insert into another section of page -

what best solution ... want take 3rd content div's image filename, link, , text), , duplicate first entry in old section. duplicating data contents, using div structure old section. differences in structure can see image path (one using featured, , other being boxart), , imgframenew , posterimage div. if need me clarify let me know little abstract, , difficult me describe in writing. <div class="new"> <div class="content"><div class="imgframenew"> <div class="posterimage" style="background:url(/media/images/featured/pic1.jpg);"></div></div> <div class="title"><a rel="/media/link1/">example 1</a></div></div> <div class="content"><div class="imgframenew"> <div class="posterimage" style="background:url(/media/images/featured/pic2.jpg);"></div></div> <div class="tit

class - Undefined reference to destructor error in c++? -

here class class email{ private: char to[100]; char from[100]; char subject[200]; char body[1000]; public: email(); email(char *za,char *od,char *tema, char *telo){ strcpy(to,za); strcpy(from,od); strcpy(subject,tema); strcpy(body,telo); } ~email(); void setto(char *to) {strcpy(this->to,to);} void setfrom(char *from) {strcpy(this->from,from);} void setsubject(char *subject) {strcpy(this->subject,subject);} void setbody (char *body) {strcpy(this->body,body);} char* getto () {return to;} char* getfrom () {return from;} char* getsubject () {return subject;} char* getbody () {return body;} void print () { cout<<"to: "<<to<<endl<<"from: "<<from<<endl<<"subject: "<<subject<<endl<<body; } }; and can see includes destructor. rest of program 1 function , main. int checkemail(char *p){ int n=0,

trying to run a testsuite for c with on a ruby server and it gives an error -

* starting server on port 18000 visit http://localhost:18000 view testsuite. * ******************************************************* [2016-06-01 16:44:22] info webrick 1.3.1 [2016-06-01 16:44:22] info ruby 1.9.3 (2013-11-22) [x86_64-linux] [2016-06-01 16:44:22] warn tcpserver error: address in use - bind(2) [2016-06-01 16:44:22] info webrick::httpserver#start: pid=2736 port=18000 //after searching through stackoverflow tried lsof -wni tcp:3000 , kill //-9 2376, didnt tried once more did work, dont know issue though

ios - Make Planar Grid And Axis Visible -

i looking display 3d planar grid , x,y,z axis in scnview, xcode 3d/asset editor/viewer. are there built-in properties/methods (have looked @ refc pages not see any)? or 1 need code rendering? pointer started on this? (surely has been done many times before)

list - pyspark collect_set or collect_list with groupby -

how can use collect_set or collect_list on dataframe after groupby . example: df.groupby('key').collect_set('values') . error: attributeerror: 'groupeddata' object has no attribute 'collect_set' you need use agg. example: from pyspark import sparkcontext pyspark.sql import hivecontext pyspark.sql import functions f sc = sparkcontext("local") sqlcontext = hivecontext(sc) df = sqlcontext.createdataframe([ ("a", none, none), ("a", "code1", none), ("a", "code2", "name2"), ], ["id", "code", "name"]) df.show() +---+-----+-----+ | id| code| name| +---+-----+-----+ | a| null| null| | a|code1| null| | a|code2|name2| +---+-----+-----+ note in above have create hivecontext. see https://stackoverflow.com/a/35529093/690430 dealing different spark versions. (df .groupby("id") .agg(f.collect_set("code"),

php - mime_content_type script replacement assistance -

i running on newer version of php, , depreciation of mime_content_type after loading github php script 2 sections of in it, wondering if might able can replace with? if (!function_exists('mime_content_type')) { throw new exception('program needs fileinfo php extension.'); } and $mimetype = mime_content_type($image); if ($mimetype != 'image/png' && $mimetype != 'image/jpg' && $mimetype != 'image/gif') { user_error('image mime type ' . $mimetype . ' not supported. image ignored', e_user_warning); return false; } any assistance appreciated thanks robert

frontend - Common way to store positions in a formatter -

i want write small editor specific language. in editor, able indent 1 or several lines (ie, adding white-spaces on left hand of each line); able format whole code (ie, alter white-spaces , newlines in appropriate locations). given program, front-end ocamllex , ocamlyacc build abstract syntax tree (ast) . know common ways store positions of elements in ast. one way guess append (start) position each element of ast. example, if type of expression defined follow: type expression = ... | e_int of int | e_function_ees of function.t * (expression list) it become: type expression = ... | e_int of position * int | e_function_ees of position * function.t * (expression list) then, if know length of each element, can infer position of in editor. common way so? don't find nice... you don't have repeat position each pattern. write 1 in end: type expression = ... | e_int of int | e_function_ees of function.t * (expression list) | e_loc o

optaplanner - Custom move implementation -

when creating custom move methods “getplanningentities” , “getplanningvalues” need implemented. in these methods entities , values need added in list , returned. in custom move changing multiple planning entity instances belong different planning entity classes. when turning on full_assert ok there no errors. i wanted know should order of planning entities returned “getplanningentities” same order of values returned “getplanningvalues” (this how wanted know how “getplanningentities” , “getplanningvalues” operate).i know used entitytabu , valuetabu. also when “equals” , “hashcode” methods called printing out text see when called doesn’t appear? move.equals() , hashcode() use movetabu (which isn't great, hardly ever use it). the order of return values of getplanningentities() , getplanningvalues() doesn't matter, return different type of elements in cases (except in chained cases). example in cloudbalancing, getplanningentities() returns collection o

visual studio - web.debug.config Transform not working -

Image
i don't know i'm doing wrong, feel i've tried everything. can't seem web.config of project transform web.debug.config changes. read someplace transformation takes place when being published. read slowcheetah handle this, installed project. doesn't make difference either. running vs 2012 express. debug using iis express local server installed vs. run firefox browser. web.config: <appsettings> <add key="siteurl" value="http://development.mysite.com/" /> </appsettings> web.debug.config: <appsettings> <add key="siteurl" value="http://localhost:4652/" xdt:transform="setattributes" xdt:locator="match(key)" /> </appsettings> i've tried using replace: <appsettings> <add key="siteurl" value="http://localhost:4652/" xdt:transform="replace" xdt:locator="match(key)" /> </appsett

reactjs - Idiomatic way to dispatch an action on a subcomponent in react redux without passing in props all the way through -

i learning how use react, redux, , react-redux , have rather simple need. want render akin following... -------------------------------- | title 1 |----------| | | description 1 | button 1 | | | desc... cont. |----------| | |------------------------------| | title 2 |----------| | | description 2 | button 2 | | | desc2... cont. |----------| | |------------------------------| | title 3 |----------| | | description 3 | button 3 | | | desc3... cont. |----------| | |------------------------------| this represents list of items . each item (3 shown in diagram) has title , description . when click button want perform action item , such displaying alert box item's title. i managed working sample based on redux tutorial . ended 1 container (smart) component named itemscontainer.tsx , 2 presentation (dumb) components named itemlist.tsx (the list) , item.tsx (an individual item). hierarchically looks this... app -- itemscontainer ---- it

Ruby Printing variable within a String, Phone Validation -

i'm trying variables output in string. when print below isn't formatting correctly new line each title , variable. print "user: #{names}\nphone: #{valid_phone?(number)}\n email: #{email}" i'm getting output: user: ["john", "doe\n"] phone: 555-555 email: johndoe@info.com output should appear as: user: john doe phone: (555)555-5555 email: johndoe@info.com i'm not getting phone number output in format of (555)555-5555. here full code. thanks!! name_pattern = /([\w\-\']{2,})([\s]+)([\w\-\']{2,})/ email_pattern = /\a([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i phone_pattern = /^(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})$/ def valid_name?(name) !!name.match(name_pattern) end puts "enter first , last name (john doe):

amazon s3 - nativescript-background-http file uploading to s3 -

based on nativescript: camera takepicture , upload nativescript-background-http i trying write class take care of file uploading s3 me. my upload function looks this: upload() { const format = enumsmodule.imageformat.png cameramodule.takepicture().then(img => { let savepath = fsmodule.knownfolders.documents().path; console.log('save path', savepath); let filename = "img_" + new date().gettime() + "." + format; console.log('filename', filename); let filepath = fsmodule.path.join(savepath, filename); console.log('filepath', filepath); if (img.savetofile(filepath, format)) { let s3upload = new s3upload(format, filename, filepath, this.progresscallback); s3upload.getsignedrequest() .then((url) => { alert(url); }) .catch(error => { console.log('error!&

javascript - HTML Add value in textbox -

i want add value in text box. text box created default value equal 10, button use function adding new text box limit 4. therefore, want add value continuously text box 1 text box 4 example: text box 1 value = 10 text box 2 value = 20 text box 3 value = 30 text box 4 value = 40 how can this? <script type="text/javascript"> //adding new line item function var = 1; function addnew(){ if (i <=3){ //if don't want limit, remove if condition i++; var div= document.createelement('div'); div.innerhtml = '<input type="text" name="lineitem_'+i+'" maxlength="2" size="2"><input type="button" onclick="removekid(this)" value="-">'; document.getelementbyid('addingitem').appendchild(div); } } </script> you want add value continuously text box 1 text box 4 ,

javascript - Ionic FacebookConnectPlugin -

Image
i trying implement facebook login in ionic application. when user try login via facebook @ first, says "invalid hash key." following below. after this, i've check hash key added on facebook developer site. keys displayed on app , written in facebook developer sites same following below: also, strange thing after happened, when tried login again facebook developer account, works. after this, try login normal facebook account, doesn't work. what's wrong , why happens? implemented codes here: $scope.fblogin = function(){ var fbloginparams = ['public_profile','email']; $ionicloading.show({template: '<ion-spinner icon="lines" class="spinner-calm"></ion-spinner><p>getting facebook login status...</p>'}); facebookconnectplugin.getloginstatus( function(response) //already facebook logined { //get profile facebook if (response.status == "con

regex - Implement a tokeniser in Python -

i trying implement tokeniser in python (without using nltk libraries) splits string words using blank spaces. example usage is: >> tokens = tokenise1(“a (small, simple) example”) >> tokens [‘a’, ‘(small,’, ‘simple)’, ‘example’] i can of way using regular expressions return value includes white spaces don't want. how correct return value per example usage? what have far is: def tokenise1(string): return re.split(r'(\s+)', string) and returns: ['', 'a', ' ', '(small,', ' ', 'simple)', ' ', 'example', ''] so need rid of white space in return the output having spaces because capture them using () . instead can split like re.split(r'\s+', string) ['a', '(small,', 'simple)', 'example'] \s+ matches 1 or more spaces.

jsp - How to call div tag in JavaScript function? -

<div id="cd-signup"> <!-- sign form --> <form name="joinform" class="cd-form" id="joinform" method="post"> <input type="hidden" name="act" value="register"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> ..... .... function testapi() { console.log('welcome! fetching information.... '); fb.api('/me?fields=id,name,email,permissions', function(response) { console.log('successfulllll login for: ' + response.name); name=response.name; alert(name+"===="+response.email); //here want call div tag }); } now i'm using facebook api , want call sign form, when finish facebook login. please me. d

android - json, listadapters and multiple on click activity for listviews -

Image
i using api calls pull out json entry , fill in list view. problem having implementing different listeners inside of list view. list view looks this: the listview implement onitemclick listener , checkbox listener. till able populate listview , generate onitemclick listener, failed implement checkbox listener. tries able invoke checkbox listener after listview item clicked , 1 of checkboxes(out of several). the code looks now: public class allprojects extends sherlocklistactivity{ arraylist<hashmap<string, string>> all_list; progressdialog progressdialog; actionmode mmode; listview list; layout layoutlist; checkbox projectcheckbox; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.projectlist); actionbar bar = getsupportactionbar(); bar.setdisplayshowtitleenabled(false); bar.setdisplayhomeasupen