Posts

Showing posts from April, 2015

How to write data to a text file in python? -

this have far: def main(): infolist = [] count = 0 while true: firstname = input('please enter first name: ') mystring = str(firstname) lastname = input('please enter last name: ') mystring2 = str(lastname) telephoneno = input('please enter telephone number: ') mystring3 = str(telephoneno) contiinue = input('continue (y = yes): ') if contiinue == 'y': count = count + 1 else: print ("file written") break file = open('filename', 'a'); file.write(data.to_string()); file.close(); main() i'm trying program write input text file, allow new information added added text file, not erase whats been written. every time try run program there's problem main() , name error, data not defined? to add @clodion's answer use with keyword def main(): infoli...

angular - Multiline string with typescript - Angular2 -

Image
i'm angular2 beginner , i've written piece of code in dev/app.component.ts it works, when go browser "max brown displayed". want write template part on different lines this: but error in chrome console: uncaught typeerror: cannot read property 'split' of undefined wrap text in ` (backticks) instead of single quotes ' , can span multiple lines. var mystring = `abc def ghi`;

Issue when migrate from spring 3.2.2 to 4.2.3 Release -

trying upgrade trying upgrade `spring` 3.2.2 4.2.3. release facing below issue: [2/5/16 17:13:54:807 ist] 00000055 webapp com.ibm.ws.webcontainer.webapp.webapp log srve0292i: servlet message - [citicomp_war#citicomp.war]:.no spring webapplicationinitializer types detected on classpath com.ibm.ws.webcontainer.webapp.webapp log srve0292i: servlet message - [citicomp_war#citicomp.war]:.initializing spring root webapplicationcontext [2/5/16 17:13:57:930 ist] 00000055 webapp e com.ibm.ws.webcontainer.webapp.webapp notifyservletcontextcreated srve0283e: exception caught while initializing context: {0} org.springframework.beans.factory.beandefinitionstoreexception: failed parse configuration class [com.citigroup.ces.citicomp.boesdk.datatype.sdkconfig]; nested exception java.io.filenotfoundexception: not open servletcontext resource [/sdk_config.properties] ...

regex - python raw string escaping character -

a noob question. reading documentation on use of regexes in python. under impression using raw string treat '\' , not consider whatever following escape sequence. in example reading, however, >>> phonenumregex = re.compile(r'(\(\d\d\d\)) (\d\d\d-\d\d\d\d)') >>> mo = phonenumregex.search('my phone number (415) 555-4242.') >>> mo.group(1) '(415)' >>> mo.group(2) '555-4242' clearly, author has escaped '(' '\' . want understand how. thought putting 'r' @ bring treat '\' no differently. the \ in raw string literal literal \ , need use escape shorthand character classes , special regex characters with. the ( beginning of grouping construct , there must closing unescaped ) . these (...) never part of match . \( , \) literal ( , ) , these part of match. think of regex engine customer delivered string. re requires \d . when use "\d", python thinks es...

Hi,my application running fine manually when i run test in jmeter it sends 404 erros -

my application running fine manually, when run test in jmeter sends 404 errors , getting following error in jmeter console window uncaught exception java.lang.unsatisfiedlinkerror c:\progfiles\java\jre\bin\jpeg.dll not valid win 32 applictaion for jemter java above 1.6 required, refer prerequisotes http://jmeter.apache.org/usermanual/get-started.html . jmeter java application, jre or sdk first needs installed java_home environment variable. then find jmeter.bat file , add following lines @ top: set java_home=c:\java -- java installation folder set path=%java_home%\bin;%path

vb6 - VBA.FileSystem Dir -

in vb6 code m using vba.filesystem.dir file name directory path. returning empty string. please find below code call getfile.showopen //getfile commondialog control of vb6 txtfile.text = getfile.filetitle //correct file name returned if dir(getfile.filename) == "" // conditions come true..but ideally should not!!! but file resides in network location. can there permission issue? if yes, how see file in getfile.showopen dialog , dir() returns empty string? any on wrong in above code consider these points: afaik, double equal ( == ) not supported in vb6 dir = (whatever) can return "" if whatever directory or hidden file you trap name using if dir(whatever, vbdirectory or vbhidden or vbarchive or vbnormal) but still have test each see was. btw, it's better have variable receive dir , inspect that, rather inspecting dir itself. dim stgt$ stgt = dir(whatever) also, btw, alternative chking each type to inspect filelen. curi...

angularjs - Angular ui-grid: define columns in template -

the ui-grid documentation tells define columns in controller, this: $scope.gridoptions = { columndefs: [ { field: 'id', displayname: 'ref', width: "60" }, { field: 'title', displayname: 'title', width: "200" } ] } while works fine, feel belongs in template. there way setup columns this: <div ui-grid="gridoptions" class="mygrid" style="width:800px; height: 600px"> <ui-column field="id" width="60">ref</ui-column> <ui-column field="title" width="200">title</ui-column> </div>

php - CodeIgniter sub-sub-folder controller works localhost but not on server -

i'm having troubles structure on server environment: controllers -> controller_home.php -> folder 1/ -> controller_1.php -> controller_2.php -> folder 2/ -> controller_3.php controller.home.php works fine controller_1.php works fine controller_2.php works fine controller_3.php doesn't work - appears custom 404 page error i'm using codeigniter 3.0 version, , had trouble required first letter of each controllers uppercase. rename controllers , models files use first letter uppercase. i thought problem i'm having due folders inside controllers/ not uppercase, ain't because of that. i repeat the structure works on local environment . edit : requested, .htaccess file: options -indexes options +followsymlinks # set default file indexes directoryindex index.php <ifmodule mod_rewrite.c> # activate url rewriting rewriteengine on # not rewrite links documentation, as...

amazon-ecs-agent is always restarting -

i have autoscaling group on amazon, spawns server instances. my aws-cli config is: [default] s3 = signature_version = s3v4 addressing_style = path region = eu-central-1 my ecs-agent config gets read s3 aws-cli @ instance bootup , follows: ecs_cluster=cluster-mongodb ecs_engine_auth_type=dockercfg ecs_engine_auth_data={"domain.com":{"auth":"bsaewfgvewgf23g9hv3","email":""}} sadly ecs-agent on spawned instance restarting after 10 secs, instead of registering cluster "cluster-mongodb". the error log here: 2016-02-05t14:40:47z [info] starting agent: amazon ecs agent - v1.7.1 (007985c) 2016-02-05t14:40:47z [info] loading configuration 2016-02-05t14:40:47z [info] checkpointing enabled. attempting load state 2016-02-05t14:40:47z [info] loading state! module="statemanager" 2016-02-05t14:40:47z [info] detected docker versions [1.17 1.18 1.19 1.20] 2016-02-05t14:40:47z [info] registering instance ecs ...

javascript - hide/show tbody of dynamically created tables on click at thead -

as can see after run code, have multiple tables, let assume dynamically created php. try hide/show entire tbody of table if click @ it's thead . i give each table it's own id , write jquery code each table... since tables dynamically created, can't solve this. the current version of jquery script toggles tbody's if click on thead, instead of thead of table clicked. my idea solve create jquery code dynamically (but im not sure if work), before try this, know if there easier solution? i thought this: $("this tbody").css("display","none"); so selects tbody of thead clicked on. var main = function() { $toggle = true; $("thead").click ( function() { if ($toggle) { $toggle = false; $("tbody").css("display","none"); } else { $toggle ...

Is there any performance gain when using features from C# 6.0? -

do c# 6.0 features (like expression-bodied method-like members, using static , null-conditional operator or string interpolation) have impact on performance of program or @ least compiling time? new features asking myself when using them if there performance gain/issue. not really. new features merely syntactic sugar things possible in c#. the code generated new features, null-propagation operator, yield same c# code have had before. it make you better performing , possibly code quality better, thing.

Python 2.7 raw_input() EOF error in Gambas3- Raspberry Pi/Jessie OS -

the code, print 'hello world' raw_input() "works" when ran in python idle 2.7 in lxterminal ("python helloworld.py"). i made application thru gambas3 using interpreter python programming. when simulating, works , lxterminal shows output , exits when enter key pressed. after compiling, making software executable. ran application , ran code throws eof error. searched web, found lots of similar problems different approach. read pipe line couldn't understand. added python usage options -i -tt , -c no luck. idea whats causing error? this code run button in gambas3 incase ask. public sub runbtn_click() textarea3.text = "" try kill application.path & "tempfile.py" if exist(application.path & "tempfile.py") hfile = open application.path &/ "tempfile.py" write append else hfile = open application.path &/ "tempfile.py" write create endif print #hfile, textare...

osx - Cocoa app name isn't displayed in "Force Quit Applications" window -

Image
my mac app works menu item application, , can toggle dock icon on , off in settings. if dock icon shown, shows app name. but if open "force quit applications" window, app name isn't shown. where window name from? thanks! i think cfbundlename info.plist file. created new test app scratch , after launching i'm able see in "force quit applications" window out of box (os x el capitan 10.11.2)

php - why the mail doesnt send automatically? -

the idea send mails automatically users when left day expire suscription. $enviar = $datomespazysalvo[2] - $ayer; if($enviar == 1){ $nombre = $row_registroclientes['nombres'] + $row_registroclientes['apellidos']; $email = $row_registroclientes['correo']; $telefono = $row_registroclientes['telefono']; // multiple recipients $to = 'info@vulpini.co' . ', '; // note comma $to .= '$email'; // subject $subject = 'fight club bogota, información importante!!'; // message $message = ' <html> <head> <title>fight club bogota, información importante!!</title> </head> <body> <p>tu matricula vence mañana $datomespazysalvo[2]</p> <span>ponte en contacto con nosotros para renovar</span> </body> </...

mongodb - Misunderstanding error about ReactiveMongo -

i defined following class want modelize : case class record( recordkey: string, channels: map[string, channel], ) object record { implicit val recordformat = json.format[record] } now, want 1 object of type reactive mongo (in class): import scala.concurrent.duration._ import scala.concurrent.{future, await} import scala.concurrent.executioncontext.implicits.global import reactivemongo.api._ import reactivemongo.api.collections.bson.bsoncollection import reactivemongo.bson.bsondocument object test { val collection = connect() val timeout = 10.seconds def connect() : bsoncollection = { val config = configfactory.load() val driver = new mongodriver val connection = driver.connection(list(config.getstring("mongodb.uri"))) val db = connection("/toto") db.collection("foo") } def findrecord(recordkey : string) : record = { return test.collection ...

c++ - Qt handling QPushButton Autorepeat() behavior with isAutoRepeat() -

Image
i'm new qt , making widget interfaces pre-existing gui. i'd have widget continuously output 1 signal while user has pushbutton pressed , continuously output when released. by enabling autorepeat can have widget output signal while user pressing pushbutton, however, output signal switches between pressed() , released(). e.g. <> outputs: * pressed signal * released signal * pressed signal * released signal i've seen question been asked keypressevents i'm not sure how access isautorepeat() pushbuttons. can give me advice on this? one way can use timer object achieve this. below example, run 2 slot's when button pressed , released. code comment explain in detail. when button pressed & released text box show continuous time in milli-seconds. timer object emit timeout() signal in given interval. need stop , start alternate timers in button pressed / released signal. application created using qt creator "qt widgets application" ...

android - List view showing on another fragment -

i'm using view pager sliding panel inside, when panel expanded creates request of users , instantiates viewholders show them in list view, problem instantiated on wherever want, how can tell in fragment should instantiated. here code : @override public void onpanelanchored(view panel) { final view cview = panel; endpointinterface service = serviceauthgenerator.createservice(endpointinterface.class); currentid = sharedpreferences.getint("currentid", 0); call<list<ride>> call = service.getpassengers(currentride); call.enqueue(new callback<list<ride>>() { @override public void onresponse(response<list<ride>> response, retrofit retrofit) { if (response.issuccess() && !response.body().isempty()) { dialogx.dismiss(); arraylist<string> myusersname = new arraylist<>(); arraylist<string> myuserslastname = new arrayli...

python - Reading from file using dict comprehensions -

i regularly need read data (typically tab-separated value) files , convert them dicts. need map 1 of columns another, there processing of values (such stripping whitespace) well. i've been trying come dict comprehension pattern that, keep running small nuisances keep me implementing succinct , understandable way consistently. , have feeling there better way. so here (some of the) ways have tried, , went wrong: open(path) f: return {line.split("\t")[0].strip(): line.split("\t")[1].strip() line in f} this end using. allows me modify key , value in place, , work on of columns (e.g. if wanted map values third first column). obvious problem duplication of line.split() part. there way bind line.split("\t") temporary variable, or unpack values directly variables? open(path) f: return dict(line.split("\t")[:2] line in f) i came this. works nicely simple case (just mapping first second column, without processi...

java - Spring framework REST multivalue request parameter empty array -

i have rest endpoint (spring-boot-1.3.0-release -> spring-core-4.2.4.release) takes multiple instance string parameter @requestmapping(value = "/test", method = requestmethod.get) public responseentity<object> gettest(@requestparam(value = "testparam", required = false) string[] testparamarray) {} /test?testparam= => testparamarray has length 0 /test?testparam=&testparam= => testparamarray has length 2 (two empty string items) i expected first case single empty sting element in array there none. ideas on how achieve this? spring's stringtoarrayconverter responsible conversion. if take @ convert method: public object convert(object source, typedescriptor sourcetype, typedescriptor targettype) { if (source == null) { return null; } string string = (string) source; string[] fields = stringutils.commadelimitedlisttostringarray(string); object target = array.newinstance(tar...

How to send Filemaker fmp url from AutoIT -

i have filemaker 14 database executes compiled autoit script. autoit script heap of things filemaker can't , returns fmp:// url filemaker initiating filemaker script parameters passed in url. trouble can't seem figure out how send url request autoit. i have tried using winhttp object described here doesn't seem fmp:// protocol. have tried using run command in various configurations can't find 1 works. the url works fine through browser address bar need script sending request. database , autoit script on same pc. does know how might achieved? cheers! i feel silly having found solution simple. shellexecute ( "fmp://my/really/long/url" )

python - Django: GenericForeignKey and unique_together -

in application i'm working on i'm trying share access tokens within company. example: local office can use headquarter's tokens post on facebook page. class accesstoken(models.model): """abstract class access tokens.""" owner = models.foreignkey('publish.publisher') socialmediachannel = models.integerfield( choices=socialmediachannellist, null=false, blank=false ) lastupdate = models.datefield(auto_now=true) class meta: abstract = true since facebook, twitter , other social media sites handle access tokens in own way made , abstract class accesstoken. each site gets own class e.g. class facebookaccesstoken(accesstoken): # class stuff after doing reading found out must use genericforeignkey point classes inherit accesstoken . made following class: class shareaccesstoken(models.model): """share access tokens other publishers.""" sharedwith = ...

Javascript / jquery - Re-allow opening a modal after hiding it -

i used this question hiding modal after clicked outside it. $(document).mouseup(function (e) { var container = $(".messenger"); if (!container.is(e.target) // if target of click isn't container... && container.has(e.target).length === 0) // ... nor descendant of container { container.hide(); } }); in comments, rightfully said have add something, if not can't open modal again after has been hidden once remembering use $("your container selector").unbind( 'click', clickdocument ); beside .hide(). document don't keep listening clicks. – brasofilo so added line $(document).mouseup(function (e) { var container = $(".messenger"); if (!container.is(e.target) // if target of click isn't container... && container.has(e.target).length === 0) // ... nor descendant of container { container.hide(); container.unbind( 'click', clic...

python - Matplotlib spectrogram versus STFT -

i'm computing spectrogram matplotlib. specify nfft=512 resulting image has height of 257. tried stft (short time fourier transform) gives me 512 dimensional vectors (as expected). if plot result of stft can see half of 512 values mirrored 257 values (like matplotlib). can explain me why case? thought of ft basis transform, why introduce redundancy? thank you. the redundancy because input strictly real signal fft, dft result complex conjugate (hermitian) symmetric. redundancy due fact imaginary components of strictly real input zero. output of dft can include non-zero imaginary components indicate phase. thus, dft result has conjugate symmetric imaginary components in result cancel out between 2 dft result halves (same magnitudes, opposite phases), indicating strictly real input. also, lower 257 bins of basis transform have 512 degrees of (scaler)freedom, input. however, spectrogram throws away phase information, can display 257 unique values (magnitude-only). ...

how to iterate through two lists in python and match up corresponding items -

this question has answer here: how can iterate through 2 lists in parallel? 6 answers i have 2 lists: nums = [41.25, 38.75, 43.25, 37.25, 37.5, 43.75] sats = [g01, g03, g04, g11, g28, g32] note: first item in nums corresponds first item in sats, second item in nums corresponds second item in sats etc.. i want loop through nums , value less 39.00, want corresponding item sats? can help? for num,sat in zip(nums, sats): if num<39: # stuff

Javascript: Open Outlook and add attachments to new email -

i trying add attachment new email in outlook. like below (taken here ): function sendemail(){ try{ var theapp = new activexobject("outlook.application"); var objns = theapp.getnamespace('mapi'); var themailitem = theapp.createitem(0); // value 0 = mailitem themailitem.to = ('test@gmail.com'); themailitem.subject = ('test'); themailitem.body = ('test'); //themailitem.attachments.add("c\\file.txt"); themailitem.display(); } catch (err) { alert(err.message); } } it working (new email window opened in outlook , prefilled above data), when line supposed add attachment commented out. in case uncommented exception thrown "file cannot found", file exist. can manually added in outlook attachment. it looks outlooks trying find file cannot reason. tried forward slash, backslash, , double backslash -- no luck. tested in windows 7 , 8 same result. required work ie. ...

c# - To avoid re-run the code, click on Refresh page -

i have listview control in aspx page , control inside listview control: <asp:linkbutton id="addtocart" runat="server" commandargument='<%# eval("productid") %>' oncommand="addtocart_click">add cart</asp:linkbutton> and use code master page: <%@ page enableviewstate="true" viewstatemode="disabled" ... also, listview viewstatemode enabled. , code: protected void addtocart_click(object sender, commandeventargs e) { //insert product cart table } first, i'll click on addtocart , code executed. (this ok) but, code re-runs (insert product cart table) when click on refresh page!! you can redirect page addtocart_click callback. response.redirect("pageurl.aspx"); you refer pattern: http://en.wikipedia.org/wiki/post/redirect/get

vb.net - Show message box in Visual Basic -

Image
i have following screen below: i keep getting error "end of statement expected" shown below: how should end statements work? this run code when either radio button selected. i'd consider spending time looking @ other questions or other sources syntax help. public class greetings private sub radiobutton1_checkedchanged(sender object, e eventargs) handles radiobutton1.checkedchanged, radiobutton2.checkedchanged if radiobutton1.checked messagebox.show("hello") elseif radiobutton2.checked messagebox.show("goodbye") end if end sub end class

How to export Latex table to PDF in R? -

i produced table in r , used hmisc:latex convert latex, not sure how render latex result pdf table. here code: latex(tabular((preoculars +postoculars + loreals+ventral.scale+dorsal.scale.a+head.width+head.length+ temporals+supralabials+infralabials+subcaudals+dorsal.scale.b+dorsal.scale.c+ svl+tail.length+number.of.rings+sl) ~ ((subspecies)*((n=1) +mean+sd)), data=dat)) it depends on workflow - using rmarkdown, inside of rstudio, once have latex installed, can use (nb i'm using example data) .rmd file: --- output: pdf_document --- ```{r, results ='asis'} library(hmisc) library(tables) latex(tabular((species + 1) ~ (n=1) + format(digits=2)* (sepal.length + sepal.width)*(mean + sd), data=iris)) ``` then click convert pdf.

php - How to get the specific inner node with SimpleXml? -

my xml structured follow: <?xml version="1.0" ?> <user> <name> foo </name> <token> jfhsjfhksdjfhsjkfhksjfsdk </token> <connection> <host> localhost </host> <username> root </username> <dbname> test </dbname> <dbpass> 123456789 </dbpass> </connection> </user> <user> ... same structure... </user> i made code iterate through xml node: function getconstring($node) { $item = file_get_contents($_server['document_root'] . "con"); $nodes = new simplexmlelement($item); $result = $nodes[0]; foreach($result $item => $value) { if($item == "token") { return $value->__tostring(); } } } what i'm trying achieve when $node equal to: ...

import - How can I avoid typing the full namespace hierarchy for c# objects in Monodevelop ("using" isn't working)? -

Image
i have hierarchy of namespaces my.namespace.myobject in library. understanding if include using my.namespace; @ top of source file should able use object directly. unfortunately, works if type out entire my.namespace.myobject , neither namespace.myobject nor myobject alone work. in trying research i've found can happen when classes , namespaces share names not case me. it's hard google "using not working" haven't been able find else might relevant. a full example follows. in 1 project do: namespace { namespace namespace { public struct myobject {} } } then build produces dll file. in second project add dll reference , do: using my.namespace; public class anotherobject { public static void main() { //results in compilation error, while my.namespace.myobject doesn't myobject a; } } project a, compiled librarytest.dll : namespace firstlevel { namespace secondlevel { public class librar...

c++ - Class property includes instance of a template class (error C3857) -

i implementing binary tree class identical this one . however, in task, node struct must templated structure. therefore changed struct node to: template <typename t> class node { public: t data; node<t> *left, *right; } so far good, until added node instance btree member variable: class btree { // ...... private: template <typename t> node<t> *root = null; // error } error message says c3857: multiple template parameter lists not allowed. i tried move root = null btree 's default constructor, not work either. you cannot have templated variable declaration. there no way specify type use variable. can either make btree template , use type node template<typename t> class btree { // ...... private: node<t> *root = null; // error } or specify type of node want in btree class btree { // ...... private: node<some_type> *root = null; // error }

asp.net mvc - Get MaxLength value in .cshtml template -

in class have.. public class mymodel { [maxlength(30)] public string name { get; set; } } in view.. @html.antiforgerytoken() @html.editorformodel() and string.cshtml @model string @{ // how cetn maxvalue here ?? } @html.textbox(html.idformodel().tostring(), model, new { @class= "text-box single-line", placeholder=viewdata.modelmetadata.watermark }) here basic code attribute off property. // use nullable int remember (or use regular int , set default, whatever use-case is) int? maxlength; propertyinfo[] props = typeof(mymodel).getproperties(); foreach (propertyinfo prop in props) { object[] attrs = prop.getcustomattributes(true); foreach (object attr in attrs) { maxlengthattribute maxlengthattr = attr maxlengthattribute; if (maxlengthattr != null && prop.name.equals("name")) { maxlength = maxlengthattr.length } } } // check make sure got value. opti if (maxle...

C Array passed to a function: how to absolutely prevent it from being written? -

i prevent array of integer passed function being altered : use of const prevent being affected (= or ++ : compile error = ok) do not prevent being scanned ! (scanf : warnings compiler...how compile error... is there way ? edit 1: may not clear enough...i demonstrate that, when adding const, impossible modify content of array...but seems not impossible... edit 2: conlusion answers : c, impossible prevent array of integer passed function being modified inside function (-wall compiler option produce error instead of warning) i have read things placement of const not me. thanks help. example of code : #include <stdio.h> #define mysize 4 void testreadonly1(const int t[]) { unsigned int = 0; (i=0; i<mysize; i++) { /*t[i] = 0;*/ /* error : assignment read-only location */ } } void testreadonly2(const int t[]) { unsigned int = 0; (i=0; i<mysize; i++) { printf("%d ",i); scanf("%d",&t[i]...

sql server - Trouble with logic on how to query for all possible 5 number combinations of numbers 1 - 69 into SQL table -

edit: clarify, order of results matters in 1,2,3,4,5 , 5,4,3,2,1 should same record. i'm looking distinct combinations. i'm looking build sql database possible 5 number combinations of numbers 1 - 69 same number cannot used twice in single 5 number combination. result contain 11,238,513 records. i'm having trouble writing code work correctly logic @ play. i've attempted crazy macro in excel vba feel sql have simpler , quicker. i've asked similar doesn't me there ( how create list of 5 number permutations based on list of numbers ranging 1-69? ). i've tried variations of below, can't seem conceptualize how should attacking this. help? with range ( select num1 c test1 union select num2 test1 union select num3 test1 union select num4 test1 union select num5 test1) select * range r1,range r2,range r3,range r4,range r5 r1.c <> r2.c , r1.c<>r3.c , r1.c<>r4.c , r1.c<>r5.c , r2.c <> r3.c , r2.c<...

javascript - Mapbox/Leaflet: valid GeoJSON produces 'Uncaught Error: An API access token is required' -

i'm trying show point on map, using mapbox v2.2.1, loading geojson external url. this (valid) geojson @ external url: {"type": "featurecollection", "crs": {"type": "name", "properties": {"name": "epsg:4326"}}, "features": [{"geometry": {"type": "point", "coordinates": [-1.837797, 51.5630612]}, "type": "feature", "properties": {"name": "xxx"}}]} this mapbox code: var map = l.map(_this.el.mappanel).setview([52.905, -1.79], 6); var layer = l.mapbox.featurelayer().addto(map); layer.loadurl('index.geojson'); it produces error in console: uncaught error: api access token required use mapbox.js. see https://www.mapbox.com/mapbox.js/api/v2.2.1/api-access-tokens/ but if replace geojson polygon, , change absolutely nothing else, see map fine , have no such error: {"type": ...

forms - Mouseover created object (vba) -

well, i'm not pro in programming, i've been working on vba code awhile, , @ time i've put label objects 'manually' on form , calling me.controls.add function, setting new label config (autosize, width, pos etc...), caption assigned value of cell activeworkbook . ok until that. i'd use mousemove effect on these new created labels, , couldn't. one more thing: userform , let's call userform x , initializes first userform y window, in y userform click on button load , show userform x. so userform x creates labels when initializing, before showing up. i presume there's way 'reload' eighter 'refresh' userform x , understand created labels had been there , i'd able mousemove on them. how? here part of code: private sub userform_initialize() on error resume next c = 0 'counting labels name 'open source workbook if not isworkbookopen.isworkbookopen("book.xlsm...

bluemix shell doesn't respond to typing and has no prompt -

i've enabled debugging bluemix application , can debug using chrome debugger. when click on "open shell" bluemix developer console, /bluemix-debug/shell page new window button opens terminal-looking frame blinking cursor, typing doesn't show in frame , there's no prompt showing either.

c# - How to upcast generic type parameters -

when use reflection in case, created type can many generic types. basestephandler<basestepdatamodel> activator = (basestephandler<basestepdatamodel>)activator.createinstance(....); the created instance can childs of basestepdatamodel. basestephandler<onedatamodel> or basestephandler<twodatamodel> onedatamodel , twodatamodel extending basestepdatamodel. this exception get: unable cast object of type '....globalonboardingsteponehandler' type '....basestephandler`1[....basestepdatamodel]'. this declaration if globalonboardingsteponehandler. public class globalonboardingsteponehandler : basestephandler<globalonboardingsteponedatamodel>{} you getting exception because globalonboardingsteponehandler inherits basestephandler<globalonboardingsteponedatamodel> , not basestephandler<basestepdatamodel> . common mistake .net generics. generics not covariant type parameters. see: c#: cast generic...

dns - Block a specific port on a Juniper -

i trying out has juniper srx550. want block outbound port 53 on dhcp pool, , outbound port 53 except name-server set dhcp pool (in case ips set opendns, don’t think relevant. set system services dhcp pool 10.0.0.0/24 name-server 208.67.222.222 set name-server, have been unable find way block outbound dns aren’t going opendns servers. this config looks currently: dhcp { pool 10.0.0.0/24 { address-range low 10.0.0.10 high 10.0.0.254; name-server { 208.67.222.222; 208.67.220.220; } router { 10.0.0.1; } } } set security policies from-zone "name of dhcp range zone" to-zone "name of dns server zone" match source-address "name of dhcp range in address list" set security policies from-zone "name of dhcp range zone" to-zone "name of dns server zone" match destination-address "name of dns server in address list" set security poli...

r - bigrquery error after authentication -

i following error notification when try access bigquery r installed on windows 10 desktop machine. please can help. library(devtools) library(assertthat) library(bigrquery) project <- "jellyfish-gap" # put project id here sql <- "select year, month, day, weight_pounds [publicdata:samples.natality] limit 5" query_exec(sql, project = project) use local file cache oauth access credentials between r sessions? 1: yes 2: no selection: 2 waiting authentication in browser... press esc/ctrl + c abort authentication complete. error: > i not familiar bigrquery, looks incompatibility between bigrquery , httr 1.1.0: https://github.com/rstats-db/bigrquery/issues/86 see other question: bigrquery not connect , error message blank

c++ - Is there a smart way to inhibit hiding a operator function of base class by one of derived class -

i learning c++ while. make pointer class curiously recursive template pattern, following. unfortunately, did not work because default operator==() function of derived class hides operator==() function of base class. have smart way inhibit hiding operator function of base class 1 of derived class? or know way avoid issue? in case, append messages compiler. thank much. #include <vector> template <typename derived, typename t> class function0 { public: friend bool operator== (derived& org, derived& cmp) { // ***** line gives warning derived& org_value = static_cast<derived&>(org); derived& cmp_value = static_cast<derived&>(cmp); return *(org_value.value_) == *(cmp_value.value_); // *** old code: return org_value == cmp_value; } }; template <typename t, template <typename derived, typename t_t> class functions> class pointer : public functions<pointer<t,functions>, t> { publi...

React-Router-Redux hydrate store based on route path -

i'm making small web application react, redux, , react-router-redux. when visit main page, can submit form triggers async redux action makes call service- fetching data, hydrating store response, , showing response based on new redux-reduced props. that works fine, there lack of routing url //mywebsite.com/ . the issue having want able navigate //mywebsite.com/view/[id] hydrate store props calling async redux action. i haven't been able find specifically... direction great.

iframe - Unable to save text changes made by Javascript -

working with: text on web page using tools: javascripts ones found here: http://www.tweakandtrick.com/2011/03/javascript-tricks-edit-websites-in.html , here: http://createjs.org/ current problem: when text edited, there no way save changes in order comeback after refresh or reopening page, , changes lost. question: possible somehow save changes made text of page, , not loose them after page refresh/reset? limitations: no access webpage being edited. the goal: open random page, make changes text using javascript above, saving steps in such way, apply them later same or pc opening same page , running script. this fundamental javascript, changes makes temporary, lasting whilst page loaded in browser. javascript has no access computer file system of server stored nor file system browser , such, can not modify or write self or computer, other in cookies . as mentioned, can use , store cookies in user browser remember state of thing written long cookie not deleted ...

haskell - Why is pattern matching preferred in function definitions? -

i reading "learnyouahaskell" tutorial learnyouahaskell . there reads: pattern matching can used on tuples. if wanted make function takes 2 vectors in 2d space (that in form of pairs) , adds them together? add 2 vectors, add x components separately , y components separately. here's how have done if didn't know pattern matching: addvectors :: (num a) => (a, a) -> (a, a) -> (a, a) addvectors b = (fst + fst b, snd + snd b) well, works, there's better way it. let's modify function uses pattern matching. addvectors :: (num a) => (a, a) -> (a, a) -> (a, a) addvectors (x1, y1) (x2, y2) = (x1 + x2, y1 + y2) there go! better. note catch-all pattern. type of addvectors (in both cases) addvectors :: (num a) => (a, a) -> (a, a) - > (a, a) , guaranteed 2 pairs parameters. my question is: why pattern matching preferred preferred way, if both definitions result in same signature? i thin...

producer-consumer pattern using java and spring -

i need resolve problem using producer-consumer pattern using java , spring framework. problem new in spring framework (i have no idea) guide me in right direction how using spring? book or internet site can find example step step implementing producer-consumer pattern spring? you have 2 options: synchronous using applicationeventpublisher ( more ) asynchronous using spring reactor ( more )