Posts

Showing posts from August, 2013

PowerShell for-each loop output to file -

how output/append contents of foreach loop text file? the following below not working out. $groups = get-adgroup -properties * -filter * | {$_.name -like "www*"} foreach($g in $groups) { write-host " " write-host $g.name write-host "----------" get-adgroupmember -identity $g | select-object -property samaccountname out-file -filepath c:\test.txt -append } $output = foreach($g in $groups) { write-output " " write-output $g.name write-output "----------" get-adgroupmember -identity $g | select-object -property samaccountname } $output | out-file "c:\your\file.txt" all saves output of foreach loop variable $output , , dumps data file upon completion. note: write-host write host stream, , not output stream. changing write-output dump $output variable, , subsequently file upon loop completion. the reason original code isn't working y...

Spring Batch Job Execution does not show in Executions Tab -

i have spring batch job setup using javaconfig (entirely through java code) deploy on module in spring xd. typically, when launch job, should see in spring xd's admin-ui under executions tab. not mine, however, , have no clue why. i've spent hours scouring through documentation , looking answer, can't find anything. am missing something? there need put in job make work? cause spring xd not display job's execution under executions? if need me provide logs or something, let me know, although not seeing error in spring xd console output. edit: how job defined int code: return jobbuilderfactory.get("job") .incrementer(new runidincrementer()) .start(setupstep) .next(verifystep) ... .next(zipfilesstep) .next(teardownstep) .build(); does happen @ admin ui? can see job executions when run xd shell command job execution list ? if sure batch job gets executed n...

javascript - HTML Injection Windows RT WebView -

i'am trying insert values html document on windows universal app, html document located on webserver , i'am trying insert username , password saved on client device winphone or pc store app, know id , every thing elemts, cant figure out how insert string input value, can provied sample invokescript("smth", new string[] {smthelse}); or has better idea insert username , password html content of webview? i'am stuck here , realy need feature. thanks in advance add code below xaml , give go. if know id, can set value doing script injection page. private async void button_click(object sender, routedeventargs e) { string functionstring = string.format("document.getelementbyid('namediv').innertext = 'hello, {0}';", nametextbox.text); await webview1.invokescriptasync("eval", new string[] { functionstring }); } don't naughty. healy in tampa.

R: Posix (Unix) Time Crazy Conversion -

unix time 1435617000. as.date(1435617000,origin="01-01-1970") [1] "3930586-11-23" which wrong. i'm trying (a) correct date, which, per epoch converter gmt: mon, 29 jun 2015 22:30:00 gmt . how r tell me month, day, year, hour, minute & second? thank you. i think reason why happen because as.date converts arguments class date objects. in case not need date class posixct object because input, x vector, contains other informations as.date not able manage. problem right function appear, if when not specify right time zone tz argument (except case time zone same original time). the following code job. x <- 1435617000 as.posixct(x, origin = "1970-01-01", tz ="gmt") [1] "2015-06-29 22:30:00 gmt" use as.date just in case wanted date have complete unix time x , have divide 86400 (which number of seconds in day!) right date. as.date(x/86400l, origin = "1970-01-01") [1] "2015-06-29...

How to create equal-width columns in Python 2.7 with Tkinter -

how can force columns in tkinter application window of equal width? the tkdocs website states follows: the width of each column (or height of each row) depends on width or height of widgets contained within column or row. means when sketching out user interface, , dividing rows , columns, don't need worry each column or row being equal width [or height, presumably]. http://www.tkdocs.com/tutorial/grid.html but want columns equal width, preferably making width of all columns depend upon widest widget in any column. there way of achieving cleanly (i.e. not playing around cell padding until them same trial , error or arbitrarily assigning apparently adequate minimum width every column)? also, can selectively done some, not columns in grid (e.g. columns x and y are sized according widest widget in column x or y, column z sized according widest widget in column z)? to make gridded layout have columns have same width, you've got configure columns have same w...

Sql Server Aggregation or Pivot Table Query -

i'm trying write query tell me number of customers had number of transactions each week. don't know start query, i'd assume involves aggregate or pivot function. i'm working in sqlserver management studio. currently data looks first column customer id , each subsequent column week : |customer| 1 | 2| 3 |4 | ---------------------- |001 |1 | 0| 2 |2 | |002 |0 | 2| 1 |0 | |003 |0 | 4| 1 |1 | |004 |1 | 0| 0 |1 | i'd see return following: |visits |1 | 2| 3 |4 | ---------------------- |0 |2 | 2| 1 |0 | |1 |2 | 0| 2 |2 | |2 |0 | 1| 1 |1 | |4 |0 | 1| 0 |0 | what want count of customer transactions per week. e.g. during 1st week 2 customers (i.e. 002 , 003 ) had 0 transactions, 2 customers (i.e. 001 , 004 ) had 1 transaction, whereas 0 customers had more 1 transaction the query below result want, note has column names hard coded. it's easy add more week columns, if number of columns unknown might want solution ...

java - POI Named Cell - Drop down in all the rows does not have all the values -

i have strange issue when create excel drop downs using apache poi - named cell using below method. public static void createhugedropdown(xssfworkbook wb) { int = 0; string sheetname = "lookup"; string colname = "col1"; string mainsheet = "sheet1"; string[] strarray = new string[]{"10", "20", "30"}; xssfsheet sheet = wb.createsheet(sheetname); (string str : strarray) { sheet.createrow(i++).createcell(0).setcellvalue(str); } xssfname namedcell = wb.createname(); namedcell.setnamename(colname); string reference = sheetname + "!a1:a" + i; system.out.println(reference); namedcell.setreferstoformula(reference); xssfsheet sheet1 = wb.getsheet(mainsheet); int namedcellindex = wb.getnameindex(colname); namedcell = wb.getnameat(namedcellindex); areareference aref = new are...

ruby on rails - cocoon gem not passing parameters -

so although have used cocoon before, i'm still relatively new , whatever reason can't seem pass through parameters (i've tried 2 different applications , on fedora 22 , mac 10.10.4). for context i've been using standard rails forms in .erb , have both :post , :post_items have description. i'm using cocoon 1.2.6. so in application.js have //= require cocoon in post.rb class post < activerecord::base has_many :post_items accepts_nested_attributes_for :post_items, :reject_if => :all_blank, :allow_destroy => true validates :title, :post_items, presence: true validates :title, length: {maximum: 255} end in post_item.rb class postitem < activerecord::base belongs_to :post end and relevant controllers (posts_controller.rb): def index @post = post.new end def create params[:post][:ip_address] = request.remote_ip @post = post.create(post_params) if @post.save flash[:success] = "your post created" red...

hibernate - @OneToOne - Can't persist the second entity -

this first post , have problem hibernate @onetoone mapping. following link first example. have 2 model classes calls user , profile. every time, user registry, want create new user account given info , default profile user. problem code able generate user account, not profile. structure following: public class user { @onetoone(fetch=fetchtype.lazy, mappedby="profileuser", cascade=cascadetype.all) private profile profile; } public class profile { @id @generatedvalue(strategy=generationtype.identity) @column(name="profile_id") private long profileid; @onetoone @primarykeyjoincolumn private user profileuser; } @repository public userdao { public void createuser(user user) { currentsession().save(user); } } @service public userservice { @autowire userdao dao; @transactional public void createuser(user user) { profile profile = profile.createinstance(); profile.setprofileuser...

javascript - cannot get draggable working -

Image
im trying implement similiar this however using table ( datatable() ) instead of div using. its seems though method packs data object being passed drop container/callback cannot find of external-event classes so in drop callback end undefined eventobject function populateworkorders(){ var workorderstablebody = document.getelementbyid("workorderstablebody");//link containing element using getelementbyid or similar (i=0;i<workorders.length;i++) { //loops length of list var tr=document.createelement('tr'); //creates <ul> element tr.setattribute("class","external-event"); tr.setattribute("draggable","true"); var workorderid=document.createelement('td'); //chrome seems not variable "name" in instance workorderid.innerhtml=workorders[i].workorderid; //adds name tr.appendchild(workorderid); var workordertitle=document.createelement('td'); workord...

apache spark - SparkSQL, Thrift Server and Tableau -

i wondering if there way make sparksql table in sqlcontext directly visible other processes, example tableau. i did research on thrift server, didn't find specific explanation it. middleware between hive(database) , application(client)? if so, need write hive table in spark program? when use beeline check tables thrift server, there's field istemptable . know mean? i'm guessing temp table in sqlcontext of thrift server, because read spark driver program , cached tables visible through multiple programs . confusion here is, if driver program, workers? to summarize, where should write dataframe, or tables in sqlcontext to? method should use(like dataframe.write.mode(savemode.append).saveastable() )? should default settings used thrift server? or changes necessary? thanks i assume you've moved on now, comes across answer, thrift server broker between jdbc connection , sparksql. once you've got thrift running (see spark docs basic intro...

javascript - Issue with callbacks using Expressjs + JWT + Angularjs -

i have project using authentication based on jwt expressjs , angularjs , need use node-dbox in order access dropbox files of users. the problem comes when try save token of users comes dropbox, example of callback authorization https://www.dropbox.com/1/oauth/authorize?oauth_token=# { request_token.oauth_token } is there way, api built jsonwebtoken module, can know user token comes dropbox save database? use request_token access_token (using dropbox api) use access_token user id (using dropbox api). here documentation : oauth : https://www.dropbox.com/developers/reference/oauthguide api : https://www.dropbox.com/developers/core/docs

linux - SVN tag files selectively -

gurus- have process push modified files integration , production environment. have use 'tag' mechanism. process push files along folders integration environment , ui deployment process execute shell scripts copy files respective folders , run make utility or ant. for e.g. /root/dev/scripts/ folder have files f1 , f2 in branch, branch can used multiple developers @ same time. if suppose file f1 modified , should doing following steps. 1) identify files modified. 2) create tag out of files selectively. in example tag should contain /root/dev/scripts/f1. precisely question is, how can selectively find files , add tag retaining folder structure?

php - How to select a data from a table using the where and like statement and echo it -

i having issue on how select data database table using , statement. $hy=mysql_query("select (total) firstterm studentmark, subject studentmark.student_id='$name' , studentmark.year='$ya' , subject.code=studentmark.code , studentmark.term='$term' 'f%'"); $hm=mysql_num_rows($hy); $fetch=mysql_fetch_array($hy); echo $fetch['firstterm']; the issue 'f%' (first) in term has 89 total not selected in table 's%' (second) in term has 73 selected. there missing? the table below term | code |student_id|contass20asg|classwk10 |test2nd10|year |exam| total first | agr | john | 18 |5 | 7 |2011 | 59 | 89 second |agr2 |john | 13 |6 | 4 |2011 | 40 | 73 third |agr3 |john | 18 |6 | 8 |2011 | 34 | 64 first |bio |john | 12 ...

java - RestTemplate + ConnectionPoolTimeoutException: Timeout waiting for connection from pool -

i got error of sudden in production while application not under load. the issue happened when code tries send put message using spring rest template here code how initialing resttemplate private static final resttemplate resttemplate = new resttemplate(new httpcomponentsclienthttprequestfactory()); { list<httpmessageconverter<?>> messageconverters = new arraylist<httpmessageconverter<?>>(); jaxb2marshaller marshaller = new jaxb2marshaller(); marshaller.setclassestobebound(paymentsession.class); marshallinghttpmessageconverter marshallinghttpmessageconverter = new marshallinghttpmessageconverter(marshaller, marshaller); marshallinghttpmessageconverter.setsupportedmediatypes(arrays.aslist(mediatype.application_xml, mediatype.text_html)); messageconverters.add(marshallinghttpmessageconverter); resttemplate.setmessageconverters(messageconverters); } call put try { httpheaders headers = new httpheaders(); headers.set...

html - Capybara selector for a span within a -

hello i've been struggling should simple select capybara. i'm after on page : <a title="activity" class="" href="/changes">activity <span class="badge">1</span></a> i need assert there span.badge value 1 inside activity a tag. before posted this, printed page contents , did save_and_open_page , content there. this tried (which seemed promising cant find tag) : find(:xpath, "//a[contains(.,'activity')]") find(:xpath, "//a[contains(@title, \"activity\")]") find(:xpath, "//a[@title='activity']") find(:xpath, "//a", :text => /reactivity /i) and many other things not worth mentioning, how this? question update: i forgot mention html hidden on page part of sub menu. adding capybara.ignore_hidden_elements = false works kind of sux add global config test, other ideas? if understood correctly //a[@title="activity...

c# - SQS : Getting Number of message in the SQS Queue -

i working amazon-sqs, tried retrieve approximate number of attributes queue response null i using c# following code: getqueueattributesrequest attreq = new getqueueattributesrequest(); attreq.queueurl = "link queue"; getqueueattributesresponse response = client.getqueueattributes(attreq); console.writeline("app. messages: "+ response.approximatenumberofmessages); i getting null response request, sure there messages in queue well. you have explicitly specify attributes return getqueueattributes. didn't specify any, didn't return any. try adding approximatenumberofmessages attributenames collection on getqueueattributesrequest: getqueueattributesrequest attreq = new getqueueattributesrequest(); attreq.queueurl = "link queue"; attreq.attributenames.add("approximatenumberofmessages"); getqueueattributesresponse response = client.getqueueattributes(attreq); notes: this property might called attributename without l...

osx - How to resolve ruby gem conflict involving rake on mac? -

i attempting run rake under mac osx , getting below error. $ rake --trace rake aborted! gem::conflicterror: unable activate releasy-0.2.2, because rake-10.3.2 conflicts rake (~> 0.9.2.2) /library/ruby/site/2.0.0/rubygems/specification.rb:2112:in `raise_if_conflicts' /library/ruby/site/2.0.0/rubygems/specification.rb:1280:in `activate' /library/ruby/site/2.0.0/rubygems.rb:198:in `rescue in try_activate' /library/ruby/site/2.0.0/rubygems.rb:195:in `try_activate' /library/ruby/site/2.0.0/rubygems/core_ext/kernel_require.rb:126:in `rescue in require' /library/ruby/site/2.0.0/rubygems/core_ext/kernel_require.rb:39:in `require' /users/development/ruby/rakefile:5:in `<top (required)>' /library/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load' /library/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load_rakefile' /library/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:687:in `raw_load_rakefile...

node.js - Slack slash commands - show user-entered text? -

i'm working slack slash commands api , , works swimmingly bot ( https://github.com/jesseditson/slashbot ) far, except 1 thing: in other slash integrations (for instance giphy), when user types slash command, command output public chat, response posted: giphy integration http://oi.pxfx.io/image/0h0n0l1q2e0e/screen%20recording%202015-07-23%20at%2001.47%20pm.gif however when use custom slash command, original command not output @ all: no message http://oi.pxfx.io/image/061t2v402x10/screen%20recording%202015-07-23%20at%2001.49%20pm.gif i'm using incoming webhooks api post messages channel, works ok, responses disembodied , lacking context without original request. what i'd do: a user types /command that command echoed out chat room message can see (preferably if return 2xx url slash command hits) the response posted either inline, or via incoming webhook (either works me, having both option preferable) this appears possible via whatever giphy uses integ...

javascript - Not getting proper output when shifting values in array position -

Image
i having 1 array in source , destination this: markers.push({ "location": "chicago", "islocation": "yes" }); markers.push({ "location": "los angeles", "islocation": "yes" }); now when create points dynamic textbox add points in between source , destination. scenario 1 : 1st dynamic textbox input eg:abc markers[0]:chicago markers[1]:abc marker[2]:los angeles. scenario 2 : 2nd dynamic textbox input eg:pqr markers[0]:chicago markers[1]:abc markers[2]:pqr marker[3]:los angeles. scenario 3 : 3rd dynamic textbox input eg:lmn markers[0]:chicago markers[1]:abc markers[2]:pqr markers[3]:lmn marker[4]:los angeles. my first position fixed. code: // code goes here var cnt = 1; var maxnumberoftextboxallowed = 5; var autocomplete = []; var markers = []; markers.push({ "location": "chicago...

ios - Tree TableView with multiple NSMutablearray -

i try make tree table shopping app(main name,category name , sub category name) not getting proper.i using nsmutablearray please me. example ::: laptop (main name) ,company (category name),model (sub category name) my response : https://github.com/seletz/cocoatreeviewexample please refer link creating tree based table : http://sugartin.info/2011/07/20/447/

Writing in a file.txt a Latex's format of tables with java -

this question has answer here: how escape “\” characters in java 5 answers i'm trying automatically files.txt tables in latex's format, , want write java next string using .write writer.write("\centering"+"\r\n"); but i'm not allowed so, eclipse marks "\centering" , says invalid escape sequence (valid ones \b \t \n \f \r \" \' \\ ) i tried separating "\"+\centering" didn't work either there way this? you need escape backslash '\' doubling it: \\ writer.write("\\centering"+"\r\n");

ios - Download multiple files consecutively in background using swift and Xcode 6.3 -

i'm developing app xcode 6.3, swift 1 , alamofire download multiple files consecutively. start new download when previous 1 finished , want works in background. problem is: in debug mode , when device attached xcode, works fine. when become disconnected doesn't continue download in background. suggestion problem be? in proceed you cannot start new download in background. need either finish download after app again or change server logic combine multiple downloads 1 big download. have chance might complete, not guaranteed.

c++ - Optionally safety-checked cast on possibly incomplete type -

pursuant simple, intrusively reference-counted object system, have template<typename t> class handle , meant instantiated subclass of countedbase . handle<t> holds pointer t , , destructor calls decref (defined in countedbase ) on pointer. normally, cause problems when trying limit header dependencies using forward declarations: #include "handle.h" class foo; // forward declaration struct mystruct { handle<foo> foo; // okay, but... }; void bar() { mystruct ms; } // ...there's error here, implicit ~mystruct calls // handle<foo>::~handle(), wants foo complete // type can call foo::decref(). solve this, have // #include definition of foo. as solution, rewrote handle<t>::~handle() follows: template<typename t> handle<t>::~handle() { reinterpret_cast<countedbase*>(m_ptr)->decref(); } note i'm using reinterpret_cast here instead of static_cast , since reinterpret_cast doesn...

anaconda - How to set specific environment variables when activating conda environment? -

does know how automatically set environment variables when activating env in conda? have tried editing */bin/activate, adds new environment variables every new env created. want set env variables specific each env. use files $prefix/etc/conda/activate.d , $prefix/etc/conda/deactivate.d , $prefix path environment.

c# - Calculate target angle given current angle and target position? -

Image
i've been struggling think should simple problem: . i know current heading angle (say 15 deg), , given target gameobject's transform, want calculate angle should rotate towards face target. in above example want calculate 335ish deg. note need calculate target angle , have class that, given angle, takes care of rotating heading desired angle. i'm aware of transform.lookat() , other similar functions, don't apply in situation because reasons (in other class calculate euler quaternion , lerp until reach target angle, due project constraints, transform.lookat() doesn't work). in first approach, tried calculating angle theta dot product of vector3.forward , direction vector, didn't quite work right (either rotated forever or in wrong direction) targetangle = vector3.angle(vector3.forward, (target pos - current pos).normalized); i thought maybe if calculate current heading direction vector, take dot product of , target direction vector angle theta,...

ip address - ip mask pattern calculation -

i need exclude ip range tool. tool offers ability add mask pattern. instructions: instance, if enter 144.133.0.0/16 ips 144.133.0.0 - 144.133.255.255 selected. i have no idea how calculate correct mask need exclude following range (inclusive): 144.133.255.0 - 144.133.255.63 also, detail how got answer (would learn). thanks! the value in each octet ranges 0 255. (0000 0000 1111 1111). ip address starts 144 class b address. default mask class b 255.255.0.0 . notation 144.133.0.0/16 same using default mask 255.255.0.0 . hence there 1 subnet , range 144.133.0.0 144.133.255.255 . subnet mask 144.133.0.0/16 tells first 16 bits in mask. a subnet mask of 255.255.255.192 select hosts between hostmin: 144.133.0.1 , 144.133.0.62 . subnet mask of 255.255.255.192 same 144.133.0.0/26 .

ios - Function signature (NSError?) -> () is not compatible with expected type (error:NSError?) -> Void? -

![function signature (nserror?) -> () not compatible expected type (error:nserror?) -> void?] is error keep receiving while trying build in xcode 6.4, error arises on self.follow "(user, completionhandler" func signin(email:string, password:string) { pfuser.loginwithusernameinbackground(email, password: password) { (user: pfuser?, error: nserror?) -> void in if (user != nil) { var tabbarcontroller = tabbarcontroller() self.navigationcontroller?.pushviewcontroller(tabbarcontroller, animated: true) } else { println("sign in failure! alert user!") } } } func signup(email:string, password:string) { var user = pfuser() user.username = email user.email = email user.password = password user.signupinbackgroundwithblock { (succeeded: bool, error: nserror?) -> void in if error !== nil { s...

Write newlines before HTTP header -

recently trying upload large files (hundreds of megabytes) through browser on http. may take long time request complete, browser (chrome 43) seemed disconnecting after 5 minutes of not receiving response server. learned , confirmed if streamed newlines in http response, browser wouldn't disconnect, , upload succeeded after 10 minutes. i want use trick prevent disconnects, think means have set http response , headers before streaming newlines. i'd still able set 201, 202, 400, 500 etc status codes if goes wrong in request. i thinking might prepend http header newlines, , send headers, , response. allowed / browsers support that? if not, there better way prevent disconnects? it appear disallowed the specification : 6.1 status-line the first line of response message status-line, consisting of protocol version followed numeric status code , associated textual phrase, each element separated sp characters. no cr or lf allowed except in final crlf sequence....

c++ - Debug Assertion Failed! Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse) In program ended -

im doing physics simulation , have 2 classes, simulation , renderer . need have them reference each other , problem when pass reference renderer happens. here code: renderer.cpp renderer::renderer(simulation* _sim) { sim = new simulation(*_sim); } renderer::~renderer() { delete sim; } renderer.hpp class renderer { private: simulation* sim; public: renderer(simulation* _sim); ~renderer(); }; edit: here requested code (the thing draw it): renderer.cpp void renderer::draw() { for(auto obj : sim->objects) { glbegin(gl_points); for(auto p : obj) { glcolor3f(colors[p.id][0], colors[p.id][1], colors[p.id][2]); glvertex2f(p.x,p.y); } glend(); } } the error coming sim = new simulation(*_sim); , if remove it, no errors. no ideas of how fix it? fixed problem myself. double delete problem. simulation deleted when gonna delete it. i've removen delete sim .

dictionary - java.lang.ClassCastException: java.util.HashMap$EntrySet cannot be cast to java.util.Map$Entry -

i have overrriden method this @override public build auth (map.entry<string, string> auth) { this.mauth = auth; return this; } here trying call method in following way map<string, string> authentication = new hashmap<string , string> (); authentication.put("username" , "testname"); authentication.put("password" , "testpassword"); map.entry<string, string> authinfo =(entry<string , string>) authentication.entryset(); authmethod.auth(authinfo) while running getting java.lang.classcastexception: java.util.hashmap$entryset cannot cast java.util.map$entry how can pass map.entry<string, string> auth method you trying cast set single entry. you can use each entry item iterating set: iterator = authentication.entryset().iterator(); while (it.hasnext()) { map.entry entry = (map.entry)it.next(); //current entry in loop /* ...

visual studio - CMake - separating project configurations from target configurations -

i have executable, supports 2 rendering backends (gl , d3d), each implemented in separate static library. have project configurations permuted on debug-level (eg. debug, release, etc), , renderer, final configurations (debug_gl, debug_d3d, etc.). in previous question , learned how make per-configuration dependencies. my problem have additional static libraries, not dependent on renderer type. when create (cmake) project configurations above setting cmake_configuration_types , these static library projects configurations permuted renderer type. not want this, because configurations have separate object/library directories, etc., duplicates. my main focus generating visual studio, ideally generated solution along renderer backend libraries have full set of permutations, whereas non-renderer specific libraries have 'debug-level' configurations. somehow possible cmake? configuration set global whole project. each configuration built in own directory. e.g., descri...

python - unable to download files recursively using ftputil -

i trying write code should download files have been created in past 6 days. able print files not able download. please suggest wrong , me complete sript. import ftplib import ftputil import os import datetime now=datetime.datetime.now() print (now) ago=now-datetime.timedelta(days=6) print (ago) class mysession(ftplib.ftp): def __init__(self, host, userid, password, port): ftplib.ftp.__init__(self) self.connect(host, port) self.login(userid, password) ftp = ftputil.ftphost('host', 'user', 'pwd', port=21, session_factory=mysession) dir_dest=os.chdir('c:/python34/new folder') root,dirs,files in ftp.walk('windows triage' , topdown=true): name in files: path=ftp.path.join(root,name) st=ftp.stat(path) ctime=datetime.datetime.fromtimestamp(st.st_mtime) if ctime>ago: print(name) fname in name: fpath = ftp.path.join(roo...

node.js - Why does object exported in ES6 module have undefined methods? -

i have es6 class defined in es6 module exports instance of class: class myobject { constructor() { this.propertya = 1; this.propertyb = 2; } mymethod() { dostuff(); } } var theinstance = new myobject(); export default theinstance; when import module, mymethod undefined : import * theobject './my/module'; theobject.mymethod(); // error! undefined not method. the properties defined in constructor do exist. it's though object's prototype excluded, , members exported. i requiring 'babel/register' . why exporting object not working correctly? i figured out right after asking. looks there's difference between import * foo 'module' , import foo 'module' . works: import theobject './mymodule'; so wasn't matter of wrong thing being exported, being imported incorrectly.

matlab - Overwrote built in function - Standard deviation -

i want have std.m file standard deviation. in data fun toolbox, but, mistake, changed code , std command not working anymore. how can run original std (standard deviation) command? taking comments out, function std.m extremely simple: function y = std(varargin) y = sqrt(var(varargin{:})); this definition of standard deviation : square root of variance . set built-in functions read-only now don't go breaking var.m file because more complex , wonder if there copyright issue display listing here. to avoid problem of breaking built-in files, advisable set matlab toolbox files read only . remember old matlab installer giving option @ install time. don't know if installer still offers option, if not extremely easy manually (on windows , select folders, right-click properties , tick read only , accept propagate property subfolders , files). overloading once done, built-in files safe. can still modify default behavior of built-in function ove...

direct3d - Shortest path to loading an FBX sphere model into CDXUTSDKMesh or similar -

i'm porting old xna code d3d11, , uses fbx models. they're pretty basic re-create them in 3dsmax if needed, or convert if tool exists. all want able mesh loaded, ideally along lines of cdxutsdkmesh (but doesn't support fbx). looked @ content exporter still requires fbx sdk installed, , i'm hoping avoid that. is there reasonably simple way load fbx mesh, or can use 3dsmax export format -will- load via cdxutsdkmesh. what confuses me if -create- scene in visual studio via item->new, it's fbx model, can tell unsupported without doing fbx sdk. there must simpler way! thoughts? working .fbx files done autodesk fbx sdk. visual studio content pipeline using autodesk fbx sdk: installs autodesk fbx dlls. content exporter needs autodesk fbx dlls. generally speaking, fbx authoring , interchange format. games , 3d applications don't load fbx models directly, , instead load runtime format along lines of vbo , sdkmesh , or cmo --see the directxm...

lotus domino - New Replicas Lose Database Icon and Launch Properties -

i making replica copies of domino databases old server (r8.5.x) new server (r9.01) using domino administrator client doing files tab, selecting multiple databases, right-clicking , selecting new >> replics(s). this i've done many times on years, last few times i've done it, strange things happen: of new replicas missing database icon (the design element blank), , have lost database launch properties (where set open frameset). didn't happen time, time new replica's acls did not come on (and had default entries). this happens of application databases, , fine, of course, ones affected bigger , more important ones. 2 servers in different physical locations (this time in different cities in same state, time in different countries) - so, not sure if network latency factor. any ideas on may causing this? else running problem? --- (later...) posted on notes 9 forum, , mark gibson pointed me tech note potentially being issue large files going acr...

getCurrentPosition() for mediaplayer in android studio not works -

i'm programming media player android studio. want use getcurrentposition show time of music in each second give me 0. should do? public class playandpause extends service { mediaplayer mp; @override public void oncreate() { super.oncreate(); mp=mediaplayer.create(this, r.raw.s); } @override public void onstart(intent intent, int startid) { super.onstart(intent, startid); if(mainactivity.a==1) { mp.start(); toast.maketext(this, "music started!", toast.length_short).show(); } if(mainactivity.a==2) { mp.pause(); toast.maketext(this, "music paused!", toast.length_short).show(); } integer k=mp.getcurrentposition(); log.i("+++++++", k.tostring()); } @override public void ondestroy() { super.ondestroy(); mp.stop(); toast.maketext(this, "music stopped!", toast.length_short).show(); } @override public ibinder onbind(intent intent) { // todo: return communicat...

Openlayers 3 coordinate conversions -

newb alert: i'm new openlayers 3 , mapping in general. background in sql server, , end systems design. have no experience in html, javascript, web development etc. i'm sure simple issue can't seem figure out details. i've modified 1 of samples openlayers.org , doesn't behave expected. uses geojson object , draws points on map, don't end expected. apparently there conversion or happens. the sample used here: geojson example my test map here: test map the geojson object defined as var geojsonobject = { 'type': 'featurecollection', 'crs': { 'type': 'name', 'properties': { 'name': 'epsg:3857' } }, 'features': [ { 'type': 'feature', 'geometry': { 'type': ...

rcharts - rRharts shows in Rstudio and browser but not R viewer -

Image
morning community, i wanted ask quick question regarding rcharts graph outputs compared native r. question 1: why graphs rcharts displayed in browser rather viewer in r? question 2: how can force (or choose use) graphing function in native r instead? see these 2 screen shots: code native r: # simple scatterplot attach(mtcars) plot(wt, mpg, main="scatterplot example", xlab="car weight ", ylab="miles per gallon ", pch=19) code rchart: library(rcharts) mydata plot<-highcharts$new() plot$chart(polar = true, type = "line",height=null) plot$xaxis(categories=mydata$subject.id, tickmarkplacement= 'on', linewidth=1) plot$yaxis(gridlineinterpolation= 'circle', linewidth=1, min=null,max=null,endontick=t,tickinterval=10) plot$series(data = mydata[,"a"],name = "a", pointplacement="on") plot rchart data used subject.id b c 1 1 65 29 60 2 2 87 67 59 3 ...

java - dynamically selecting a radio button from a radio group -

i have stored previous selection of radio button in memory. when start activity has these radio buttons, show selected radio button selected. using java android studio. below copy of code: public void getselectedunits() { if (symbol.equals("g")) { radio_g.check(r.id.radiobuttong); toast.maketext(settingsscreen.this, " grams(g) selected", toast.length_long).show(); } else if (symbol.equals("kg")) { radio_g.check(r.id.radiobuttonkg); toast.maketext(settingsscreen.this, " kilograms(g) selected", toast.length_long).show(); } ... please note radio_g.check(r.id.radiobuttonx); statement crashes program, can idea trying accomplish. want set radio button selected during last visit activity selected. toast statements debugging , working fine. solution used: i got issue , able solve it, want update post in case reads in future. solution presented below, given o...

How to create trigger in phpmyadmin -

i having error when try create trigger in phpmyadmin. doing wrong? sql query: create trigger ins_social after insert on sa_users_social each row begin insert fsb2_users ( u_social_id, u_auth, u_nickname, u_email, u_avatar, u_signature, u_language, u_joined, u_sexe, u_rank_id ) values ('new.social_id', '1', 'username', 'email', 'photourl', 'description', 'fr', 'current_timestamp', 'gender', '0'); error: #1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near '' @ line 5 doesn't stored procedure, don't have put begin...end there. delete begin , try again? or, if need put begin there, can this: delimiter # create trigger ins_social after insert on sa_users_social each row begin insert fsb2_users ( u_social_id, u_auth, u_nickname, u_email, u_avatar, u_signature, u_language, u_joined, u_sexe, u_rank_i...

python - How to maximize non-analytic function over space of variables -

i have simple question thought there might solution online couldn't find 1 yet. i have (non-mathematical i.e. non-analytical) function computes value f based on set of variables a,b,c,d come set of files/databases/online crawling , want find set of variables a,b,c,d maximizes f. searching whole space of a,b,c,d not feasible, , using differentials / derivatives not possible since f not analytical. appreciate pointer packages/algorithms use please, or how started. of i've seen online python optimization seems analytical/math functions (f(x) = x^2 + ...) , not more non-analytical problems. for example: def f(a,b,c,d): ... lot of computations databases, etc using a,b,c,d different float values ... returns output # output float now, values of a,b,c,d each has possible values let's [0, 0.1, 0.2, ... 1.0]. values discrete , don't need extreme precision in optimization. now, want find set of values a,b,c,d gives me highest f. oh, , have no maximization...

glsl - Tangent calculation on a Sphere leaves missing faces at the South Pole -

Image
howdy wonderful folks! i doing planetary simulation of earth space , stuck @ normal mapping stage. went through bunch of tutorials on internet , wrote logic calculate tangents, pass them vertex shader , calculate normal in tbn space , use normal calculate lighting using phong model. seems work correctly @ south pole of planet, missing triangles , hence black spots: code calculating geometry of sphere goes along lines of: void sphere::generatemesh(){ float deltaphi = (float)pi/stacks; float deltatheta = (2 * (float)pi)/slices; for(float phi = 0; phi < pi ; phi += deltaphi){ for(float theta = 0; theta < 2*pi - 0.001; theta += deltatheta){ float x1 = -sinf(phi) * sinf(theta) * radius; float y1 = -cosf(phi) * radius; float z1 = -sinf(phi) * cosf(theta) * radius; float u1 = float( atan2(x1, z1) / (2 * pi) + 0.5 ); float v1 = float( -asin(y1) / (float)pi + 0.5 ); float x2 = -sinf...

javascript - Store and remote filtering -

i have store want set filter in beforequery event. the problem when this store.addfilter({property:'name', value: 'xxx'}); the actuall addfilter call send request, problem because fire beforequery event again. so add supresevent parameter function call store.addfilter({property:'name', value: 'xxx'}, true); but, in case request doesn't have filter param @ all. am missing ? all want add filter in beforequery event , let request there's property on store called autofilter . set false. it's private property, therefore it's not in doc.

python - "KeyError: 'PYTHONPATH'" message when updating Anaconda packahes on Mac OS X -

each time try update anaconda (version 3.15.1) packages on mac (os x 10.10.4), following message: error in sitecustomize; set pythonverbose traceback: keyerror: 'pythonpath' the rest of updating process seems run normally, i'd figure out causes message , how remove it. set pythonverbose environment variable suggested error message: pythonverbose=1 conda update --all that should give full traceback, should tell file error coming from.

How to document OData endpoints (swagger, swashbuckle, other)? -

what best way of documenting odata endpoints? there way use swashbuckle it? yes, try swashbuckle.odata . adds swashbuckle support odatacontrollers. see in action here: http://swashbuckleodata.azurewebsites.net/swagger

c++ - cast a pointer to member function in derived class to a pointer to abstract member function -

i'm trying seems should common i've been unable find discussing it. this post on stackoverflow similar i'm trying do, not quite same. i have abstract base class: #ifndef _abaseclass_h_ #define _abaseclass_h_ using namespace std; #include <iostream> #define call_mbr_func(object, ptr_to_mem_func) ((object).*(ptr_to_mem_func)) class abaseclass { public: typedef void (abaseclass::*abaseclass_mem_func)(); int a; int b; abaseclass(); abaseclass(int a, int b); virtual void function1(abaseclass_mem_func infunc) = 0; virtual void function2() = 0; }; #endif /* _aclass_h_ */ and have derived class: #ifndef _asubclass_h_ #define _asubclass_h_ using namespace std; #include <iostream> #include "abaseclass.h" /* simple class containing 2 ints , functions demonstrate passing via various methods. subclass of aclass*/ class asubclass: public abaseclass { public: asubclass(); asubclass(int a, int b); void function1...