Posts

Showing posts from July, 2015

arm - Assembly Language: How to stick a list of array into a word? -

how combine array of 4 byte 1 32-bit. first item should go significant nibble of result. store result in 32-bit variable result. input: [list] = 0xc, 0x2, 0x6, 0x9 (each item byte, use dcb define variable of type byte) output: [result] = 0x0c020609 edit answer: add r1, r0 mov r1, r1, lsl #8 add r0, r0, #8 add r1, r0 mov r1, r1, lsl #8 add r0, r0, #8 add r1, r0 mov r1, r1, lsl #8 add r0, r0, #8 add r1, r0 what you're describing same thing treating 4 contiguous bytes 32-bit integer stored in big-endian byte-order. according gcc (on godbolt compiler explorer ), best way byte-swap big-endian arm-native endian instruction arm provides explicitly purpose: rev r0, r0 #include <stdint.h> #include <endian.h> #include <string.h> // type-punning unions alternative memcpy char array int union be_bytes { uint32_t be_word; char bytes[4]; }; uint32_t be_bytes_to_native( char *array ) { union be_bytes tmp; memcpy(tmp.bytes, array, 4);

ajax - How to make a DELETE http request with Javascript (not jQuery) -

i'm trying figure out how make delete request using javascript. have service written in java spring controller url working on has method = requestmethod.delete . url is, say, http://192.168.50.51/my-service/deletelocation/{value1}/{value2}/{value3} . in javascript, have ajax function so: ajaxfunction : function(url, callback, httpmethod) { var xhttp = new xmlhttprequest(); xhttp.onreadystatechange = function() { if (xhttp.readystate == 4 && xhttp.status == 200) { var jsonparse = json.parse(xhttp.responsetext); callback(jsonparse); } } xhttp.open(httpmethod, url, true); xhttp.send(); } when want use delete url, have event handler attached button runs method: deleteconfirm : function() { var valuel = this.value1; var value2 = document.getelementbyid('element-id').getattribute('data-element'); var value3 = document.getelementbyid('element-id&

How to force Inno Setup to set the installation folder dynamically -

i creating installation package , user should able install on specific location only. in order read registry values in [code] section determine installation path. having installation path need force inno setup set installation folder specific location @ run-time. is possible in inno setup? section of script should used if so? thanks. use scripted constant set default installation path; use disabledirpage directive prevent user modifying it. [setup] defaultdirname={code:getdefaultdirname} disabledirpage=yes [code] function getdefaultdirname(param: string): string; begin result := ...; end;

windows installer - Wix install to multiple remote machines -

i'm new wix , wondering if there's way install files several machines on same network single msi? the installer prompt user machine names , installer install on each of machines. microsoft active directory 's group policy used this. tutorial see example this link.

php - Mocking SecurityContext in Symfony2 using PHPUnit -

these mocks: $this->user->method('getcustomerid') ->willreturn($this->customerid); $this->usertoken->method('getuser') ->willreturn($this->user); $this->securitycontext->method('gettoken') ->willreturn($this->usertoken); $this->securitycontext->expects($this->once()) ->method('isgranted') ->will($this->returnvalue(true)); and code of class testing: $token = $securitycontext->gettoken(); $isfullyauthenticated = $securitycontext->isgranted('is_authenticated_fully'); it throws error: symfony\component\security\core\exception\authenticationcredentialsnotfoundexception: security context contains no authentication token. 1 possible reason may there no firewall configured url. i have no idea @ point, though mocks intercepted call methods , returned whatever wanted. in case seems isgrante

rest - HATEOAS and links/actions -

i'm trying wrap head around how (and if to) implement hateoas in api. 1 of concept of feeding client actions appropriate in current situation. i'm not sure if i'm implementing idea correctly. let's have resource type order status can changed, can have different statuses ( processing , accepted , declined , expired , successful). should create following json object: { ... "links": { "accept": "http://example.com/order/1/accept", "decline": "http://example.com/order/1/decline" } } or creating unnecessary actions here? , if above correct, should status changed patch, or get? , if patch, how 1 know (defeating purpose of hypermedia)? edit: forgot add order id let's have resource type order status can changed, can have different statuses (processing, accepted, declined, expired, successful). warning: unless domain happens document management, may getting tangle if tr

java - Can't Run Android application in Eclipse -

Image
my problem can't run android application within eclipse. when click run shows me form there's no "android application" choice! if must use eclipse, need download android plugin eclipse. however, google no longer supports this. in order develop recent version of android have download android studio instead.

input - Html/CSS/JavaScript -

i doing site can write text in input fields, there 3 option menus can change text color, background color , font-style. when choose options background color , the text color outside input field change...what going change in field? edit: can change background text color in input field, cannot change font style...i cant see whats wrong? <!doctype html> <html> <head> <title>visitkort</title> <link rel='stylesheet' type='text/css' href='style.css' /> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script type="text/javascript"> function skrivut() { var foretag = document.getelementbyid('foretag'); foretag.value = document.getelementbyid('foretagtext').value; var efternamn = document.getelementbyid('efternamn'); efternamn.value = document.

css3 - How do I make a CSS drop shadow responsive? -

Image
i have following drop-shadow applied svg image. problem when site scaled down lower res shadow gets further , further away image. drop-shadow filter not allow use percentages. #turqlogo img { display: block; margin: auto; width: 4%; -webkit-filter: drop-shadow(.5em 0px 0px black); /* chrome, safari, opera */ filter: drop-shadow(.5em 0px 0px black); } anyone have trick make shadow stay in same position site being viewed @ different resolutions? use 1vw instead of .5em. 1vw = 1% of viewport width. -webkit-filter: drop-shadow(1vw 0px 0px black); /* chrome, safari, opera */ filter: drop-shadow(1vw 0px 0px black); example, svg drop shadow keeps it's distance when scaled:

java - JavaFX pannable GridPane -

for current project, need large grid transparent background 1 can zoom , pan across. tried use scrollpane setpannable(true) , discovered scrollpane background remain opague when call setstyle("-fx-background-color: transparent") or setstyle("-fx-background: transparent") . easy option eliminated, need make gridpane in question directly pannable. i've tried several things already, including trying bind mouse position gridpane 's translate property(which quite didn't work), , failed more promising alternative work properly: gridpane gridview = new gridpane(); int x; int y; gridview.setondragentered( (event) -> { x = event.getx(); y = event.gety(); }); gridview.setondragdetected( (event) -> { gridview.settranslatex(x - event.getx()); gridview.settranslatey(y - event.gety()); }); however, makes map jump , left, rather make pan mouse intended. managed figure out. 1 remai

mysql - Cannot add foreign key constraint -

i have created database "webportal". , "user" table script drop table if exists `user`; create table `user` ( `id` int(11) not null auto_increment, `username` varchar(255) default null, `password` varchar(255) default null, `firstname` varchar(255) default null, `lastname` varchar(255) default null, `dateregistered` date default null, `skypeid` int(11) default null, primary key (`id`) ) engine=innodb auto_increment=4 default charset=utf8; and 1 "catalog" table script. drop table if exists `catalog`; create table catalog( `id` int(11) not null auto_increment, `user_id` int(11) not null, `link` varchar(100) not null, `comment` varchar(100) not null, `inserdate` date default null, `content` longblob not null, primary key (`id`), constraint `fk_catalog` foreign key (`user_id`) references `user` (`id`) on delete cascade on update cascade ) engine=innodb default charset=utf8; and when try execute second script in

Converting txt file as HTML in Powershell Send-MailMessage -

Image
i have log file created batch process in below format. step datetime description #0 09/12/2016 17:02:20 testtablecount.ps1 started step 1 #1 09/12/2016 17:02:21 table etl.processlog empty . failed i want add body of email using send-mailmessage in powershell. i wrote code converts text file html , adds table in body of mail. code: $body = get-content $logfile | out-string $body = $body -replace '^(\s+)\s+(\s+)\s+(\s+)', '<tr><th style = "border: 1px solid black; background: #dddddd; padding: 5px;">$1</th><th style = "border: 1px solid black; background: #dddddd; padding: 5px;">$2</th><th style = "border: 1px solid black; background: #dddddd; padding: 5px;">$3</th></tr>' $body = $body -replace '\n(\s+)\s+(\s+)\s+(\s+)', '<tr><td style = "border: 1px solid black; padding: 5px;">$1</td><td style = "border: 1px solid b

python - scikit ShuffleSplit raising pandas "IndexError: index N is out of bounds for axis 0 with size M" -

Image
i'm trying use scikit's gridsearch find best alpha lasso, , 1 of parameters want iterate cross validation split. so, i'm doing: # x_train := pandas dataframe no index (auto numbered index) , 62064 rows # y_train := pandas 1-column dataframe no index (auto numbered index) , 62064 rows sklearn import linear_model lm sklearn import cross_validation cv sklearn import grid_search model = lm.lassocv(eps=0.001, n_alphas=1000) params = {"cv": [cv.shufflesplit(n=len(x_train), test_size=0.2), cv.shufflesplit(n=len(x_train), test_size=0.1)]} m_model = grid_search.gridsearchcv(model, params) m_model.fit(x_train, y_train) but raises exception --------------------------------------------------------------------------- indexerror traceback (most recent call last) <ipython-input-113-f791cb0644c1> in <module>() 10 m_model = grid_search.gridsearchcv(model, params) 11 ---> 12 m_model.fit(x_train

c - A zero byte allocation should be considered a leak? -

this question has answer here: what's point in malloc(0)? 17 answers i'm checking memory allocation poolmon c application, after uninstall still have 1 allocation 0 bytes. can considered memory leak? it's implementation defined. but malloc(0) must free()'d.

java - Android Studio build errors with jack enabled -

so switched android studio default jdk java 8, use lambda expressions. had enable jack let gradle build, when try rebuild applicaiton, getting 3 different errors seem coming jack. can't seem find root of of these problems, , stay building j8. insight or appreciated. here errors getting during build: 1) error:library reading phase: type javax.inject.named file 'c:\users\nicholas\androidstudioprojects\baseintegrations\app\build\intermediates\jill\debug\packaged\javax.inject-2.4.0-b10-e2682135301b663484690f1d3a4a523bcea2a732.jar' has been imported file 'c:\users\nicholas\androidstudioprojects\baseintegrations\app\build\intermediates\jill\debug\packaged\javax.inject-1-4a242883e90a864db3b80da68e11a844f842d2df.jar', type 'javax.inject.named' (see property 'jack.import.type.policy' type collision policy) 2) error:com.android.jack.jackabortexception: library reading phase: type javax.inject.named file 'c:\users\ni

validation - How to retry a method after an exception in java? -

i creating program takes input user.now want re-run input option if user enters invalid command. here integer input preferred if user inputs text, want catch exception , rerun method. i have tried turns me infinite loop.what best way achieve this. great if helps me on this. boolean retry = true; while(retry){ try{ //considering response user system.out.print("\nenter command : "); f_continue = processresponse(scanner.nextint()); retry = false; }catch(inputmismatchexception e){ system.err.println("\nplease input valid command 1-5 or 0 exit"); } } if enter other integer, nextint() throw exception, , entered still in input buffer, next time call nextint() , read same bad input. should first call hasnextint() see if input integer; if not, call nextline() skip bad input (and write message telling user re-try). or can call scanner.nextline() in

python - Create new shapely polygon by subtracting the intersection with another polygon -

Image
i have 2 shapely multipolygon instances (made of lon,lat points) intersect @ various parts. i'm trying loop through, determine if there's intersection between 2 polygons, , create new polygon excludes intersection. attached image, don't want red circle overlap yellow contour, want edge yellow contour starts. i've tried following instructions here doesn't change output @ all, plus don't want merge them 1 cascading union. i'm not getting error messages, when add these multipolygons kml file (just raw text manipulation in python, no fancy program) they're still showing circles without modifications. # multipol1 , multipol2 shapely multipolygons shapely.ops import cascaded_union itertools import combinations shapely.geometry import polygon,multipolygon outmulti = [] pol in multipoly1: pol2 in multipoly2: if pol.intersects(pol2)==true: # if intersect, create new polygon # pol minus intersection interse

Mongodb Native Query -

my data mongodb { "_id" : objectid("57d718ddd4c618cbf04772d6"), "_class" : "io.core.entity.layer", "name" : "u2", "layermembers" : [ { "permission" : "owner", "user" : { "_id" : objectid("57d440c3d4c60e2f13553216"), "namesurname" : "user 2", "email" : "user2@email.com" }, "isowner" : true }, { "permission" : "edit", "user" : { "_id" : objectid("57d44050d4c62bfdc8a9fd30"), "namesurname" : "user 1", "email" : "user@email.com" }, "isowner" : false } ] } my queries; db.getcollection('layer').find({$and: [{"layermembers.user._id":

android - AfterViews method not called in fragment? -

i using android annotation in fragment class @afterviews annotated method not getting called. here code: @efragment(r.layout.fragment_onboarding_base) public class addentityfragment extends fragment { @viewbyid viewpager onboardingviewpager; public static addentityfragment newinstance() { addentityfragment addentityfragment = new addentityfragment(); return addentityfragment; } @afterviews void afterviewcreated(){ onboardingviewpager.setadapter(new customonboardingpageradapter(getchildfragmentmanager(), getcontext())); } } what doing wrong here? checked debug point it's not going inside afterviewcreated() method. appreciable. the problem not using generated class. should instead: addentityfragment fragment = addentityfragment_.builder().build(); // add fragment in transaction

const - Does C++ support STL-compatible immutable record types? -

a number of languages have support immutable types – once have constructed value of such type, cannot modified in way. won't digress benefits of such types, has been discussed extensively elsewhere. (see e.g. http://codebetter.com/patricksmacchia/2008/01/13/immutable-types-understand-them-and-use-them/ ) i create lightweight immutable record type in c++. obvious way of doing const members. example: struct coordinates { const double x; const double y; }; unfortunately, type declared in way doesn't support copy assignment, , such can't used stl containers, pretty fatal drawback. don't think there way around this, grateful know if can see one. for it's worth, far can see, c++ conflating 2 things: a) whether can assign new value variable, , b) whether "values" (=objects) can modified after constructed. distinction clearer in e.g. scala, 1 has val vs var : var can have new value bound it, val cannot immutable , mutable objects, part

php - Wordpress load next page on mousewheel -

i want implement page in wordpress: http://www.spendeeapp.com/ basically, loading next post on mousescroll functionality i can replicate mousescroll action thru jquery $(document).ready(function(){ $(document) .on('mousewheel dommousescroll swipedown swipeup', function(){ // }) }); php: <div id="content"> <h1>main area</h1> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <h1><?php the_title(); ?></h1> <h4>posted on <?php the_time('f js, y') ?></h4> <p><?php the_content(__('(more...)')); ?></p> <hr> <?php endwhile; else: ?> <p><?php _e('sorry, no posts matched criteria.'); ?></p><?php endif; ?> </div> my question is, how can load next post thru event, , di

amazon web services - Rails backend 500 errors for old assets -

when deploy new version on server new asset versions, see 500 errors reported amazon. in logs, see request seem try fetch old versions of assets (old asset digest) f, [2016-09-12t22:47:46.657377 #6663] fatal -- : [1a552b90-e121-4817-8d22-28d02677c12a] actioncontroller::routingerror (no route matches [get] "/assets/application-3d5482837991d4fb95e72bd2c8ea9c08b07b349115db14016c71d86b5e295fc2.js"): i quite disturbed when see logs this, i'm not sure what's happening on client side : browser not render js/css @ all, or poll server again new assets ?? since have never witnessed html-only page rendering after server updates, assume okay, ?. i'm using many developer tools, fiddling cache options, , i'm thinking maybe users browse without things experience error pages... exception notifier doesn't throw email/notification errors getting amazon message alerts load balancer 500 errors. aws/elb - metricname: httpcode_backend_5xx - d

sql - DISTINCT with GROUP BY in MySQL -

if i'm selecting distinct values, group results, values distinct within each grouping, or across groupings? for example: month | id | 01 | 17 01 | 17 01 | 19 04 | 17 04 | 20 if run select month, count(distinct id) table group month what counts 2 months? you 2 each month. here sql fiddle showing results.

c++ - MinGW-w64 string array crashing -

if try compile , run this #include <string> int main() { std::string strs[5]; return 0; } i error message of the procedure entry point znst7__cxx1112basic_stringicst11char_traitsicesaiceec1ev not located in dynamic link library (path exe). i using mingw-w64 gcc version 6.2.0 (i686-posix-dwarf-rev1) , have tried (i686-posix-sjlj-rev1). is there compiler version not encounter bug or can code make compile?

drupal - Cannot duplicate mysql database using phpmyadmin export/import on same server -

i trying duplicate 1 of databases on remote bluehost server in order setup dev , stage environment drupal website. dev setup/populated , working fine, trying duplicate dev database. using phpmyadmin on windows (php 5.2.17, mysql 5.5.42). have done following steps: created site_stage database exported/dumped tables site_dev db compressed sql.gz file imported tables site_stage db import fails $1064 error: insert `cache_bootstrap` (`cid`, `data`, `expire`, `created`, `serialized`, `tags`, `checksum`) values ('system_list', 0x613a323a7b733a353a227468656d65223b613a31333a7b733a363a2262617274696b223b433a33313a2244727570616c5c436f72655c457874656e73696f6e5c457874656e73696f6e223a323339343a7b613a31363a7b733a343a2274797065223b733a353a227468656d65223b733a383a22706174686e616d65223b733a33343a22636f72652f7468656d65732f62617274696b2f62617274696b2e696e666f2e796d6c223b733a383a2266696c656e616d65223b733a31323a2262617274696b2e7468656d65223b733a373a2273756270617468223b733a31333a22746865

ruby on rails - How to get application.yaml file after cloning repository -

i have computer , computer b. have created application.yaml file in rails application using figaro gem on computer a. then, cloned repository computer b local environment , noticed missing application.yaml file. is there way recover this? the file config/application.yml not included in repository security the readme say: ... creates commented config/application.yml file , adds .gitignore ... the idea not have passwords, api key , other in repository. you have write configuration.yml file in each computer have sistem.

How to configure Webpack DevTools workspaces? -

how configure webpack devtools workspaces? began developing webpack. before compilation has been through ruby (the console), , through dev tools chrome canary, scss/css file , sourcemap files saved locally, , updated. screen dev tools chrome: prntscr.com/cgxr6z question: need detailed action algorithm. how make dev tools canary, showed changes in scss/js files rather after full page reload? thank help) config webpack: var webpack = require('webpack'); var path = require('path'); var extracttextplugin = require("extract-text-webpack-plugin"); var plugins = []; var production = false; if (production) { plugins.push( new webpack.optimize.uglifyjsplugin({ compress: { warnings: false } }) ); } plugins.push( new extracttextplugin( path.join( '..', 'css', 'theme.css' ) ) ); module.exports = { entry: [ './js/theme.js' ], output: { path: '../assets/js&

javascript - How do I input a number / time of 01:10 from my code? -

i have working code below input number/tme in textbox. code below functioning want set textbox value 00:00 , edit function code second jsfiddle edited code not going idea. in second jsfiddle want input time of 05:30 code replacing number input user textbox 0 function maskedtextboxdpsdeparture() { var mymask = "__:__"; var mycorrectionout2 = document.getelementbyid("departure"); var mytext = ""; var mynumbers = []; var myoutput = "" var thelastpos = 1; mytext = mycorrectionout2.value; //get numbers (var = 0; < mytext.length; i++) { if (!isnan(mytext.charat(i)) && mytext.charat(i) != " ") { mynumbers.push(mytext.charat(i)); } } //write on mask (var j = 0; j < mymask.length; j++) { if (mymask.charat(j) == "_") { //replace "_" number if (mynumbers.length == 0) myoutput = myoutput +

python - Numpy : Calculating the average of values between two indices -

i need calculate average of values between 2 indices. lets indices 3 , 10, , sum values between them , divide number of values. easiest way using loop starting 3, going until 10, summing 'em up, , dividing. seems non-pythonic way , considering functionalities numpy offers, thought maybe there shorter way using numpy magic. suggestion appriciated to access elements between 2 indices i , j can use slicing: slice_of_array = array[i: j+1] # use j if not want index j included and average calculated np.average , in case want weight number of elements, can use np.mean : import numpy np mean_of_slice = np.mean(slice_of_array) or in 1 go (using indices): i = 3 j = 10 np.mean(array[i: j+1])

2 decimal places in Java, Just started doing Java in class last week -

started taking java class @ school , doing credit , need figuring out how have 2 decimal places. thank help. christopher import java.util.scanner; public class chaptertwoex8 { public static void main(string[] args) { //create scanner object read keyboard input. scanner keyboard = new scanner(system.in); //declare constants final double sales_tax_rate = 0.07; final double tip = 0.15; //declare variables double yourmealsprice; double wifemealsprice; double sum; double tip; double totalcostofmeal; double salestax; //get prices of meals. system.out.println("please enter price of wives meal."); wifemealsprice = keyboard.nextdouble(); system.out.println("please enter price of meal."); yourmealsprice = keyboard.nextdouble(); //calculate cost of meals. sum = (double) wifemealsprice + yourmealsprice; //calcute sales tax salestax = (double) sum * sales_tax_rate; //calcute tip tip = (double)

styles - how to change font color in wiki on github -

i can't change font color in wiki on github. <div style="color: red">test</div> <font color="red">test</font> unfortunetly, cannot include style directives in gfm . here complete " markdown cheatsheet ", , shows element <style> missing. that being said, can use diff code style highlighting red , green: ```diff + highlighted in green - highlighted in red ```

autocomplete - Cannot auto-complete c++ in vs code -

hey started using vs code , having weird issue. code won't auto complete. have installed c/c++ extension , have "c_cpp_properties.json" file containning following { "configurations": [ { "name": "mac", "includepath": ["/usr/include"] }, { "name": "linux", "includepath": ["/usr/include"] }, { "name": "win32", "includepath": ["c:/program files (x86)/microsoft visual studio 14.0/vc/include"] } ] } before ask have copied proper include path "/usr/include" did simple test wrote 1 line "vkinstance instance;" compiled , ran fine whenever start type vkinstance never comes auto complete. weirdly stuff auto completes fine , other stuff doesn't example "vkcreateinstance" shows i'm t

c# - Unity interception doesn't work as expected -

i use unity aop framework, doesn't work expected. please check code below. container.registertype<iperson, person>(new interceptor<transparentproxyinterceptor>(), new interceptionbehavior<logginginterceptionbehavior>(), new injectionconstructor(container.resolve<iplay>(), container.resolve<ieat>())); var person = container.resolve<iperson>(); person.play(); person.eat(); ((ianimal)person).sleep(); console.read(); public imethodreturn invoke(imethodinvocation input, getnextinterceptionbehaviordelegate getnext) { console.writeline(string.format("invoking method {0} begin", input.methodbase)); var result = getnext()(input, getnext); if (result.exception != null) { console.writeline("{0} throws exception", input.methodbase); } else { console.writeline(string.format("invoking method {0} end", input.methodbase)); } return result; } when container

angularjs - MEAN Stack App - Splitting UI and backend code between 2 servers -

for mean stack based application, i'm wanting run ui code on 1 server , backend code on server. aware of github projects show mean project setup in fashion? server w/the ui code, shouldn't have controllers, services, daos, mongodb configuration "db.js" or running mongodb instance. backend code on 2nd server have of controllers, services, daos, rest api, mongodb config "db.js" , running mongodb instance should present. i'm hoping examples. there tons of mean examples out on net , in github, haven't found example split mean stack between different servers i'm wanting.

c++ - protected destructor object allocation on heap vs stack -

if destructor protected, why allocating object on stack not allowed, allocating on heap allowed? class foo { public: foo() { } protected: ~foo() { } }; int main() { foo* objonheap = new foo(); // compiles fine foo objonstack; // complains destructor protected return 0; } when create object automatic storage duration (the standard term call "on stack"), implicitly destroyed when object goes out of scope. requires publicly accessible destructor. when allocate object dynamically new , not happen. dynamically allocated object destroyed if explicitly (e.g. delete ). aren't trying that, don't error. error if did this: delete objonheap;

excel - Creating VBA Chart using Array -

i trying create excel chart using vb6. instead of feeding excel range im trying feed array. , im getting error. code im working on private sub createchart(optional byval charttitle string _ , optional byval xaxis excel.range _ , optional byval yaxis excel.range _ , optional byval columnname string _ , optional byval legendposition xllegendposition = xllegendpositionright _ , optional byval rowindex long = 2 _ , optional byref charttype string = xllinemarkers _ , optional byval plotareacolorindex long = 2 _ , optional byval issetlegend boolean = false _ , optional byval issetlegendstyle boolean = false _ , optional byval legendstylevalue long = 1) const constchartleft = 64 const constchartheight = 300 const constchartwidth = 700 dim xlchart excel.chartobject dim seriescount long dim colorindex long dim j long mworkshee

Python serial.readline() not blocking -

i'm trying use hardware serial port devices python, i'm having timing issues. if send interrogation command device, should respond data. if try read incoming data quickly, receives nothing. import serial device = serial.serial("/dev/ttyusb0", 9600, timeout=0) device.flushinput() device.write("command") response = device.readline() print response '' the readline() command isn't blocking , waiting new line should. there simple workaround? i couldn't add commend add answer. can reference this stackoverflow thread . attempted similar question. seems put data reading in loop , continuously looped on while data came in. have ask 1 thing if take approach, when stop collecting data , jump out of loop? can try , continue read data, when collecting, if nothing has come in few milliseconds, jump out , take data , want it. you can try like: while true: serial.flushinput() serial.write(command) incommingbytes = seria

sql - How can I change timezone and go back previous timezone -

my project libary version mybatis 3.1 postgresql 9.2 i want change connection timezone before select query. , timezone. first, try it. set timezone in mapper xml. set timezone = 'asia/seoul' ; select now(); set timezone = 'utc'; i think if error occurs when select query, timezone not set utc. if timezone not set utc, query on different request utc time. second, try it. sqlsession injected spring di. sqlsession.selectone(namespace.settimezone, 'asia/seoul'); sqlsession.selectone(namespace.selectnow); sqlsession.selectone(namespace.settimezone, 'utc'); i think. 3 sqlsession may not same connection. how can change timezone , go previous timezone? if process transactions, 3 sqlsession happens same connection? use transaction. it mybatis worth salt, support database transactions, , has use same connection statements within 1 transaction. i don't know if mybatis can this, in postgresql can use set local change parameter du

javascript - how to set currency change(cents) into a superscript using AngularJS currency? -

Image
i turn price tag format: is possible in angularjs? decimals in superscript format. far i'm using filer {{ pricetag | currency}} displays to: if need build custom filter this, how go about? i'm not familiar angular filters, i'm still noob. i found code, removes decimals. maybe if can modify , grab decimals in separate variable. angular.module('your-module', []) .filter('mycurrency', [ '$filter', '$locale', function ($filter, $locale) { var currency = $filter('currency'), formats = $locale.number_formats; return function (amount, symbol) { var value = currency(amount, symbol); return value.replace( new regexp('\\' + formats.decimal_sep + '\\d{2}'), ''); } }]); or regex set apart decimals , turn 2 scopes. scope.price = '24' , scope.change = '92' . again, how go splitting price tag w/ regex. your appreciated.

html - How to fix the code for hovering an image, then show a bigger version of that image with the same resolution? -

Image
i writing website , here outlook . ideally, want show me same image, bigger size , same resolution. did having 2 identical images, 1 big 1 small. here code: the "heading div" banner on top while "content div" image have hover effect. played around , looked many different ways solve online, still cannot figure out how so, can me out please? added: more direct on trying do, made axure mock up: http://muzuf7.axshare.com . idea here having smaller image on inside tile , having mouse-hover function. when hover smaller image, bigger image shows on top of smaller image. clear if interact axure mock did. if understanding correctly, can following can increase image's size on hover contain within div using overflow: hidden . can use transitions , whatnot make effect prettier here: html: <div class="content"> <div id="magic"> <a id="hover"><img src="img.png" alt="vienna parlia

algorithm - how does raft deal with log in this senario? -

Image
assume d elected leader in above picture, how deal log index 11 , 12. in opinion, should delete 2 logs, don't find clues in raft paper how deal logs above senario. if (d) elected leader, replicate log followers, won't remove items @ index 11 & 12. see section 5.3 on log replication in raft paper says in raft, leader handles inconsistencies forcing followers’ logs duplicate own. means conflicting entries in follower logs overwritten entries leader’s log. the rules around leader election ensure safe decision make.

java - NDK and OpenCV setup in Android Studio -

i imported module "opencv android" android studio , tried implement image processing features in java code. most of opencv methods core.multiply , core.add work fine, however, found opencv methods mat.put() , mat.get() not quite efficient, , program run slow in device. so, questions are, if set ndk in android studio, make program run faster? (i think program more efficient if use pointer in c++, not sure if correct) i use opencv methods mat.get() , mat.put() in way, bitmap bitmap = bitmapfactory.decoderesource(this.getresources(), r.drawable.testphoto); mat m1 = new mat(bitmap.getheight(), bitmap.getwidth(), cvtype.cv_8uc4); mat m2 = m1.clone(); utils.bitmaptomat(bitmap, m1); byte[] arr = new byte[(int)(m1.total() * m1.channels())]; m1.get(0,0,arr); //some processing here... m2.put(0,0,arr); so, there more efficient way use mat.get() , mat.put()? if using ndk better way, how can set both opencv , ndk in android project? tr

ios - Is Peripheral side implementation is needed at all in real practice -

i new corebluetooth, can understand peripheral side implementation required when using iphone/ipad device ble device, wanted know if peripheral implementation required @ while communicating actual ble devices heart rate monitors & speakers etc. please help, suggestions highly appreciated. you don't need use cbperipheralmanager in case, use cbperipheral objects retrieved cbcentralmanager

android - pass array data as parameter volley -

i have array this arrayname[{"code" : "abc","code2":"cba",}] i want send paramaters,put in getparam() function volley server the problem similiar volley pass array parameters any how it? thanks in advance for this, have make jsonarrayrequest. in volley there jsonarrayrequest class use 1 jsonarray request. this method available in jsonarrayrequest class. public jsonarrayrequest(int method, string url, jsonarray jsonrequest, listener<jsonarray> listener, errorlistener errorlistener) { super(method, url, (jsonrequest == null) ? null : jsonrequest.tostring(), listener, errorlistener); } may you: jsonarray jarrayinput=new jsonarray(); jsonobject jobjectinput=new jsonobject(); jobjectinput.put("code", abc); jobjectinput.put("code2", cba); jarrayinput.put(jobjectinput); jsonarrayrequest request = new jsonarrayrequest(method.post, /*your base url*/, jarr

css3 - z-index property of @media print css is not applying while printing the page -

result expected. actual o/p here css classes: <html> <head> <style> @media print { .h6 { text-align: left; padding-left: 30px; position: relative; z-index: 2; } .line-center { margin: 0; padding: 0 10px; background: #fff; display: inline-block; } .h6:after { content: ""; position: absolute; top: 50%; left: 0; right: 0; border-top: solid 1px lightgrey; z-index: -1; } } .h6 { text-align: left; padding-left: 30px; position: relative; z-index: 2; } .line-center { margin: 0; padding: 0 10px; background: #fff; display: inline-block; } .h6:after { content: ""; position: absolute; top: 50%; left: 0; right: 0; border-top: solid 1px lightgrey; z-index: -1; } <style> <head> <body> <h6 class="h6"><span class="line-center">hello stackoverflow</span></h6> </body>

continuous integration - A local run of expect script works fine, but hangs when ran through gitlab CI -

i'm writing expect file connect handle interaction remote device using script looks following, , facing few problems it. mainly, when run script stand-alone or interactively (on runner), works wish, when plug in code testing using gitlab ci on 1 of runners, has following problems: the command spawn /usr/bin/scp $rsafile remote:/var/root/id_rsa.pub doesn't seem show in ci log (though first spawn /usr/bin/ssh remote command shows up) - suspect it's not being called @ all. the same spawn command persistently gives me following message until script stops executing @ next interact command: "warning: permanently added 'fe80::cccc:48ff:fe33:3344%en4' (ecdsa) list of known hosts.\r\r\n" interact complains spawn id exp0 not open (which assume may because scp command not working properly) here's code: spawn /usr/bin/ssh remote expect { -re ".*assword:.*" { exp_send "password\r"; exp_continue }

oracle - no data in dbms_output when fetched via DBMS_SQL -

i'm trying retrieving first name, last name , salary of employees via dbms_sql package. below code executed no details printed. excepted output: king artur 15000 ................ jimmy fallon 16000 current output: pl/sql procedure completed. declare sh integer ; output binary_integer; -- salary number(10) := 10000; l_firstname varchar2(50); l_lastname varchar2(50); l_salary number(10); begin -- sh := dbms_sql.open_cursor; dbms_sql.parse(sh,'select first_name,last_name,salary employees salary > :salary_value',dbms_sql.native); dbms_sql.bind_variable(sh,':salary_value',salary); dbms_sql.define_column(sh,1,l_firstname, 30); dbms_sql.define_column(sh,2,l_lastname, 30); dbms_sql.define_column(sh,3,l_salary); output := dbms_sql.execute(sh); <<dbms_sql_loop>> loop exit when dbms_sql.fetch_rows(sh) = 0; /* ||retrieve data || */ dbms_output.put_line(l_firstname ||' '||l_lastname||' ' || l_salary); dbms_sql.define_colum

sql - How to extract tuples from a table using the projection criteria as month name in oracle? -

i have table 'emp' schema defined as(empno, ename,hiredate) ,i trying project out names of employees joined in moth of january , wrote below query not printing records ,it works fine if don't use clause , else not working . select ename emp ( to_char(to_date(extract(month hiredate),'mm'),'month')) 'january'​ please guide me making mistake . it unnecessarily complicated. try run select: select hiredate,extract(month hiredate) emp then if january 1 select , there arent mistakes, can use: select ename emp extract(month hiredate)=1

python - RawPostDataException: You cannot access body after reading from request's data stream -

i hosting site on google cloud , got work beautifully , of sudden start getting error.. 01:16:22.222 internal server error: /api/v1/auth/login/ (/base/data/home/apps/s~crs-portal/1.395605052160854207/lib/django/core/handlers/exception.py:124) traceback (most recent call last): file "/base/data/home/apps/s~crs-portal/1.395605052160854207/lib/django/core/handlers/exception.py", line 39, in inner response = get_response(request) file "/base/data/home/apps/s~crs-portal/1.395605052160854207/lib/django/core/handlers/base.py", line 249, in _legacy_get_response response = self._get_response(request) file "/base/data/home/apps/s~crs-portal/1.395605052160854207/lib/django/core/handlers/base.py", line 187, in _get_response response = self.process_exception_by_middleware(e, request) file "/base/data/home/apps/s~crs-portal/1.395605052160854207/lib/django/core/handlers/base.py", line 185, in _get_response response = wrapped_callba