Posts

bash - determining directory and its path in focused window (linux) -

so design quite few webpages , quite annoyed time construct default head title body tags etc, , have general templates , wondering how create script in bash 1. determine directory open in focused window , 2. copy whichever template template directory have made if want blank php file basic html tags or html file basic required tags can copied on effortlessly simple shortcut can map. i know how in except determining directory of open file window(the gui not terminal) , haven't had luck googling idea, appreciated you can tty of window, , use send command. i've heard of tool called "ttyecho" though i've never used it, supposedly can used send command different pty (another window).

ios - Waypoint Optimisation - MapKit / APIs / Traveling Salesman -

many threads on topic, , found answer work - using mapquest api. but closed. http://devblog.mapquest.com/2015/05/01/looking-for-a-free-open-appkey-read-this/ i tried google maps api, many keys tried them noting worked - effort simple not using google maps. i found this, https://github.com/project-osrm/osrm-backend/wiki/server-api works great - clean , simple doesn't allow set start , end location. best route when passing in list. there this, http://www.gebweb.net/optimap/ not sure if can access api ? anyone solved issue ? maybe local sort using items long / lat position , calculate distance between points rather use api ? using this waypoints.sort { let distancea = newstart.location.distancebetween($0.location) let distanceb = newstart.location.distancebetween($1.location) return distancea < distanceb }

rest - Running Python RESTful API on Amazon EC2 -

i have working restful api written in python works in local machine. having serious trouble getting started amazon ec2. have managed create account , managed create instance , , lauch instance well. have connected instance via ssh , passed credentials. have required file (app.py) on ec2. have no idea how run it. if run ssh terminal, still local service. how make public restful api? like firewall, have open server's ports. via adding rules security group while you're configuring ec2 instance. add http rule, , allow ip addresses (0.0.0.0/0) access that. see here: http://docs.aws.amazon.com/awsec2/latest/userguide/using-network-security.html#adding-security-group-rule you can set ssh, https, , other secure ports here (but don't want accessing ssh!).

javascript - dataTables.js not resizing properly. Table overflows window still -

i using datatables.js https://datatables.net/ using responsive extension , can not table responsively resize. insight grand. the table overflows window. if expand way out columns shown, doesn't start hiding columns until 3rd column off screen i have created jsfiddle code. $(document).ready(function() { // setup - add text input each footer cell $('#table_assets tfoot th').each(function() { var title = $('#table_assets thead th').eq($(this).index()).text(); $(this).html('<input type="text" style="max-width:80px;" />'); }); // datatable var table = $('#table_assets').datatable({ responsive: true, "autowidth": false, "order": [ [13, "desc"] ], initcomplete: function() { var r = $('#table_assets tfoot tr'); r.find('th').each(function() { $(this).css('padding', 8); }); ...

java - Annotation mapping vs. XML mapping and deleting an entity -

i working migrating project pure jpa annotation based mapping xml mapping , running issue when trying delete (remove) , entity , children. works in xml mapping , not work annotation mapping. the xml mapping looks this: <set name="evaluations" order-by="evaldate desc" table="evaluation" lazy="true" inverse="true" cascade="delete"> <key column="requestid" /> <one-to-many class="org.stuff.model.evaluation" /> </set> the annotation mapping, far can tell this: @onetomany(orphanremoval=true) @joincolumn(name = "requestid") @orderby("evaldate desc") private set<evaluation> evaluations = new treeset<>(); this uni-directional relationship. the jpa code delete entity is: servicerequest sr = em.getreference(servicerequest.class, id); em.remove(sr); where above evaluation child object of servicerequest . hibernate 4.3.7 jpa impl usin...

Ruby On Rails callbacks don't work on Heroku, but work locally -

i've been working on school appplication using rails_admin. working fine locally when push heroku callbacks defined in models not used, not simple. come asking if has encountered problem before or me interpret logs because cannot find reason this. first, gemfile looks like: source 'https://rubygems.org' ruby '2.2.0' group :development, :test gem 'railroady' end # documenting models automatically gem 'annotate', '~> 2.6.6' # styling html using sass gem 'bourbon' gem 'neat' gem 'bitters' # using creating sql triggers inside models gem 'hairtrigger' # creating seed data files existing data in database gem 'seed_dump' # used translations of mailer , account confirmations gem 'devise-i18n' # user permissions , login gem 'devise' gem 'cancancan', '~> 1.10' gem "rolify" gem "figaro" gem "rails_admin" # bundle edge rails in...

c++ - Basic I2C read/write failure on Beaglebone -

i writing program access who_am_i registers on accelerometer , gyroscope via i2c on beaglebone black. here basic code.` int main(void) { char rxbuffer[40]; char txbuffer[32]; int gyroaddress = 0x20; int acceleroaddress = 0x1e; int tenbitaddress = 0; int opresult = 0; int i2cfd = open("/dev/i2c-1",o_rdwr); opresult = ioctl(i2cfd, i2c_tenbit, tenbitaddress); opresult = ioctl(i2cfd,i2c_slave, acceleroaddress); memset(rxbuffer, 0, sizeof(rxbuffer)); memset(txbuffer, 0, sizeof(txbuffer)); txbuffer[0] = 0x0d; opresult = write(i2cfd, txbuffer, 1); if (opresult !=1) printf("no ack bit!\n"); opresult = read(i2cfd, rxbuffer, 1); printf("part id: %d\n", (int)rxbuffer[0]); //for gyro opresult = ioctl(i2cfd, i2c_slave, gyroaddress); txbuffer[0] = 0x0c; opresult = write(i2cfd, txbuffer, 1); if (opresult != 1) printf("no ack bit!\n"); opresult = read(i2cfd, rxbuffer, 1); printf("part id: %d\n", (int)rxbuffer[0]); } ` part id both 0 when...