Posts

Showing posts from July, 2010

c - What are the best to ways measure latencies from user space to kernel space? -

i have measure latency between user space program driver interacts with. send packet through application. latecny between write in user space corresponding write function in kernel i used clock_gettime clock_monotonic in user space , getrawmonotonic in kernel (driver) , when see difference, huge (around 4ms). using wrong approach. so, best ways this? to measure single context switch user- kernel-space, try use tsc (time stamp counter). available on x86 , arms, user- , kernel-space. more info tsc on wikipedia: https://en.wikipedia.org/wiki/time_stamp_counter bsd-licensed implementation x86 could found here , for 64-bit arm here. also, comments suggested, consider use standard tool available measure round-trip latency, i.e. use-to-kernel , back.

Host ASP.NET Core with multiple version dotnet runtime like Django's virtualenv? -

i have vm run centos 7.1 , apache serve asp.net core 1.1 application. let individual web application use own target runtime. example: eshop web-> dotnet core 1.0 blog web -> dotnet core 1.1 testing site -> 2.0.0 beta ... i read post , recommend use docker, vm have 8gb ram , limit cpu power, django virtual environment target different version each applications. thanks you. you don't need special tooling make happen. .net core supports side-by-side installations. the way dotnet selects runtime use using contents of (appname).runtimeconfig.json file. sdk generate file when build app. if compiled "netcoreapp1.0", build output contain file, , should this: { "runtimeoptions": { "framework": { "name": "microsoft.netcore.app", "version": "1.0.4" } } } if have installed dotnet /usr/share/dotnet/ , when execute "dotnet app.dll" load runtime /usr/share...

windows - MySQL Silent Install error: More than one package matches 'server;5.7.18' and the silent flag was given -

i'm attempting write batch script install instance of mysql server onto clean windows virtual machine. while i'm attempting command line instructions, powershell ok solution also. the problem i'm having using mysqlinstallerconsole.exe can't figure out parameters pass in order server installed. batch file: @echo off echo installing mysql server. please wait... msiexec /i "mysql-installer-community-5.7.19.0.msi" /qn echo configurating mysql server... cd "c:\program files (x86)\mysql\mysql installer windows" mysqlinstallerconsole.exe install server;5.7.19.0:*:port=3306;serverid=2:type=developer;username=root;password=root;role=dbmanager echo installation pause output: c:\program files (x86)\mysql\mysql installer windows>mysqlinstallerconsole.exe install server;5.7.18:*:port=3306;serverid=2:type=developer;username=root;password=root;role=dbmanager -silent =================== start initialization =================== mysql installe...

java - Spring Boot Content Negotiating ViewResolver -

i'm working on spring boot project lists users in table, can create .pdf itext. when try hit unknown endpoint such as: http://localhost:8080/blablabla , browser tries download blank page(blablabla) instead of showing whitelabel error page(404). http://localhost:8080/admin/protected_path , browser tries download blank page (protected_path) instead of showing whitelabel error page(403). http://localhost:8080/login (mapped loginpage.jsp) opens correctly(without trying download blank page) http://localhost:8080/downloadpdf opens correctly, downloads desired pdf our local machine. how should configure webconfig display white label error pages correctly(without trying download endpoint) ? import org.springframework.context.annotation.bean; import org.springframework.context.annotation.configuration; import org.springframework.http.mediatype; import org.springframework.web.accept.contentnegotiationmanager; import org.springframework.web.servlet.viewresolver; import...

reactjs - Uploading an image to mongodb using Multer with Express and Axios -

i trying make small application allows admin user enter name, price , image of product can viewed on page. details sent mongo database performed via axios post front end. can send name , price no problem can seen on front end dynamically, however, unable send image mongo database i've been trying achieve quite time. i using multer , axios try , sent file on application react app. think problem "req.file" within end of application. code below endpoint: api.js var express = require('express'); var bodyparser = require('body-parser'); var cors = require('cors') var app = express(); var mongodb = require('mongodb'); var path = require('path'); var fsextra = require('fs-extra'); var fs = require('fs') var util = require('util') var multer = require('multer') var upload = multer( {dest: __dirname + '/uploads'} ) var ejs ...

Oracle ODI 11g - Multiple Files of different formats -

i using oracle odi 11.1.1.7. have 6, pipe delimited files. each file has different number of columns. number of columns fixed in each file. know format. want load these files in single table in database. can create odi process steps in sequential order , call interfaces created these files accomplish task. there better way this? creating 1 interface can work these files. can through loop? in advance. unfortunately these files have different structure (number of columns), need have different source datastore each of them need different interfaces. if structure same, use 1 datastore , 1 interface. need use variable filename in datastore definition , create loop in package change value of variable , execute interface loading file.

javascript - jQuery I want to add an active class to the linked ID of an anchor tag -

i've written alphabet navigation program- have anchor linked linked h4 tags. when click a-tag, want element matching id have class of active. when click anchor tag, removes class of active , assigns element. here's have far: <ul class="no-bullet inline"> <li><a class="scroller" href="#a"><strong>a</strong></a></li> <li><a class="scroller" href="#b"><strong>b</strong></a></li> <li><a class="scroller" href="#c"><strong>c</strong></a></li> </ul> <h4 class="alpha-heading" id="a"><strong>a</strong></h4> <h4 class="alpha-heading" id="b"><strong>b</strong></h4> <h4 class="alpha-heading" id="c"><strong>c</strong></h4...

excel - How to get the newly inserted worksheet -

so have pivottable , in column c there field showing details each record using this for i=7 10 data.range("c" & i).showdetail = true set wn = thisworkbook.worksheets(1) next now works fine problem set wn = thisworkbook.worksheets(1) assigns wn first worksheet data.range("c" & i).showdetail = true inserts new worksheet has details @ 1st or 2nd position. want know new worksheet inserted , assign wn it. do have make array or list keeps record of existing worksheets , check new 1 everytime? or there easy way determine newest worksheet in workbook irrespective of position. look @ activesheet . showdetail creates new sheet , activates - set wn=activesheet should work. sub test() dim c range dim wrksht worksheet thisworkbook.worksheets("sheet2").pivottables(1) each c in .databodyrange.resize(, 1) c.showdetail = true set wrksht = activesheet debug.print wrksht.na...

python - Arduino to Raspberry Pi serial communication creates only random chars after a few seconds -

Image
for project need raspberry pi communicate several peripheral components, 2 of them arduinos. 1 causes problem pro mini 3.3 v atmega328. arduino receives input 2 sensors , transfer data raspberry pi via serial. python code serial-package used on raspberry establishes connection every 50 ms. when input raspberry printed, first few lines correct after two, 3 seconds printed lines random chars. my python code looks this: import serial ser = serial.serial('/dev/ttys0', 115200, timeout=1) if ser.isopen(): ser.close() ser.open() ... # loop try: ser.write("1") ser_line = ser.readline() print ser_line ... the arduino code: #include <wire.h> #include "sparkfunhtu21d.h" #include <fdc1004.h> fdc1004 fdc(fdc1004_400hz); htu21d myhumidity; int capdac = 0; void setup() { wire.begin(); serial.begin(115200); myhumidity.begin(); } void loop() { string datastring = ""; data...

android - SQLite Extensions exception: ManyToOne relationship destination must have Primary Key -

you can see error in title. there table classes: public class cars : table { [notnull] public string name { get; set; } [foreignkey(typeof(models)), notnull] public int model_out_id { get; set; } [foreignkey(typeof(bodies)), notnull] public int body_out_id { get; set; } [maxlength(50)] public string vin { get; set; } [maxlength(4), notnull] public int year { get; set; } [indexed, notnull] public long created_at { get; set; } = datetime.now.gettimestamp(); [manytoone(cascadeoperations = cascadeoperation.cascaderead)] public models model { get; set; } [manytoone(cascadeoperations = cascadeoperation.cascaderead)] public bodies body { get; set; } [onetomany] public list<carglasses> carglasses { get; set; } public cars() { } } public class models : tablelibrary { [primarykey, notnull] public int out_id { get; set; } [notnull] public string name { get; set; } [foreignkey(ty...

linux - What happens after fork() when SO_REUSEPORT is set for a socket -

i'd know there difference socket in linux kernal between below 2 cases. 1. process create socket so_reuseport flag , bind it. process b bind on same socket. 2. process create socket so_reuseport flag , bind it. process fork() generate process b. in both cases, process , b can listen on same socket, there difference socket in kernel? flag so_reuseport effective in case 2?

node.js - Why does not “npm install” rewrite package-lock.json? And also not generate new one if not exist? -

i'm expecting see changes in package-lock.json file after adding new dependency in package.json , running npm install - package-lock.json not changing. settings: node version 6.11.0 npm version 3.10.10 have tried delete old package-lock.json, after run npm install - no new file generated. can please tell me how renew package-lock.json? edit: me , coworker have different npm versions, have package-lock.json in codebase, not able renew because current npm version not supporting feature. after update working fine. why not “npm install” rewrite package-lock.json? because point of package-lock.json tell npm modules install, if present. if not present, npm writes "cache" dependency tree subsequent installs. just rm package-lock.json , install again update package-lock.json and not generate new 1 if not exist? if not getting package-lock.json generated, have old version of npm doesn't support it, or have configured npm not generate (whi...

sql server - Looping for each column name of a MSSQL table using php -

if have [x] [y] [z] columns inside [mytable] table in mssql, know how can loop through each of them using php in order have of columns' name? reason because potentially delete or add column php code make dynamic without having hardcode php page. basically, if have php code similar following, foreach( column $columname in [sql table]) echo "$columname"; // else } it awesome. select data information_schema.columns system view. filtered on table name. select column_name information_schema.columns table_name = 'mytable' returns column_name ----------- x y z this gives resultset containing column names, loop through , use values.

java - Run external jar inside another jar -

it possible run jar have inside jar class? i´m trying run command class java -cp //file:/d:/users/nb38tv/workspace/f2e-core/f2e-mock/f2e-test-framework/target/f2e-test-framework-1.8.3-snapshot.jar!/h2/sakila-h2-master/h2-1.3.161.jar -ifexists -tcp -web -tcpallowothers but java complain since cannot find jar. if remove ! path receive error unrecognized option: -ifexists error: not create java virtual machine. error: fatal exception has occurred. program exit. it not possible execute jar embedded in jar that, if possible, java command line incorrect. because -ifexists (and other options) interpreted commandline options of java executable. you same error message if extract h2-1.3.161.jar f2e-test-framework-1.8.3-snapshot.jar , tried execute same command line. it either need use -jar instead of -cp , or need specify class run before -ifexists .

reportbuilder3.0 - Show/Hide column based on expression - column header issue -

how hide column header based on expression in report builder 3.0 ? want show/hide column based on expression. column shown/hidden base on expression value expected. column header visible irrespective of result of expression. there way show/hide column header based on expression?

How does f(s(s(s(s(s(s(1)))))),C) work on Prolog? -

i practicing textbook , cannot find reason when see result. on prolog data base, shows f(1,one). f(s(1),two). f(s(s(1)),three). f(s(s(s(x))),n) :- f(x,n). when run program f(s(s(s(s(s(s(1)))))),c). the response of program "c = one." how work? prolog simple. programs consist of rules of form to_prove_this :- must_prove_this, and_this. % , perhaps also, to_prove_this :- must_otherwise_prove_this, and_this_too. so program means 1. prove `f( 1, one)` :- there's no need prove more. 2. prove `f( s(1), two)` :- there's no need prove more. 3. prove `f( s(s(1)), three)` :- there's no need prove more. 4. prove `f( s(s(s(x))), n)` :- must prove `f( x, n)`. so start to prove: f( s(s(s(s(s(s(1)))))), c). can rule 1. used? | `f( s(s(s(s(s(s(1)))))), c)` similar `f(1,one)`? | | `f` similar `f`? | | -- yes. | | `s(s(s(s(s(s(1))))))` similar `1`? | | -- no. | -- no, `f( s(s(s(s(s(s(1)))))), c)` , `f(1,one)` not simi...

Accelerate vDSP FFT resulting in NaN under demanding scenario -

i'm using vdsp framework real-time audio application based on fft computation. after having lots of problems trying figure out why algorithm producing incorrect results, found out following comment on official vdsp fft code ( demonstratefft.c , lines 242, 416, 548) /* 0 signal before timing because repeated ffts on non-zero data can cause abnormalities such infinities, nans, , subnormal numbers. */ in order reproduce error, comment line 247 (no 0 signal) , add similar following line @ line 273 (just after vdsp_fft_zrip method) if (isnan(observed.realp[0])) printf("iteration %lu: nan\n",i); // work of components of observed it interesting observe reducing n (i.e. increasing amount of ffts per time unit) makes zrip algorithm fail before, kinds of makes sense since comment advices performing repeated ffts. the behavior observed vdsp_fft_zrop algorithm. i'm wondering what's point performing ffts of "zero data" advised on comment. ...

doctrine - Symfony - StateFieldPathExpression or SingleValuedAssociationField expected -

i use query builder of symfony , have query: ->select('partial detail.{id}') ->from('shopware\models\article\detail', 'detail') ->innerjoin('detail.attribute', 'attr') ->leftjoin('detail.article', 'article') now have custom model outside of scope following relation: class supplier { /** * @var \shopware\models\article\supplier * @orm\manytomany(targetentity="\shopware\models\article\supplier") * @orm\jointable(name="fp_demand_planning_supplier_manufacturers", joincolumns={@orm\joincolumn(name="supplier_id", referencedcolumnname="id")}, inversejoincolumns={@orm\joincolumn(name="manufacturer_id", referencedcolumnname="id", unique=true)}) */ private $manufacturers; on article side model \shopware\models\article\supplier stored in article.supplier . so want join custom model query above follows: ->select('partial...

JavaFX WebEngine load performance issue? -

is aware of issues load() method of webengine in javafx? i've been using pulselogger improve performance of application , pointed me method loads url webengine. put simple timers see hold in method causes long pulse , indicates load method issue. takes >300ms complete call. docs should doing loading asynchronously looking @ source bit of work before putting on background thread? there suggestions how improve performance here, i've read needs called on fx application thread? thanks in advance

osx - Can I downgrade Xcode 8 back to Xcode 7? -

i have been working on project using xcode recently, , looked instructions on website, code xcode 7.1, , have xcode 8! tried type in exact code website there way many errors, there way downgrade can continue project? you can download both xcode 8 , xcode 7 computer. can't downgrade xcode when update it. you try download here

unix - Using variables in command line -

i wrote code , works great need use variables instead static numbers scopes 8 , 16 cat /etc/passwd | sed '/^#/d' | sed -n 'n;p' | sed 's/:\(.*\) //g' | sed 's/ /,/g' | sed 's/\(.*\),/\1./' | sort -r | sed 's/*rav://g' | sed "s/:.*//" | rev | sed -n -e '8,16p' | xargs | sed -e 's/ /, /g' | sed '/:[0-9]*$/ ! s/$/./' i've changed code cat /etc/passwd | sed '/^#/d' | sed -n 'n;p' | sed 's/:\(.*\) //g' | sed 's/ /,/g' | sed 's/\(.*\),/\1./' | sort -r | sed 's/*rav://g' | sed "s/:.*//" | rev | sed -n -e '$ft_line1,$ft_line2+p' | xargs | sed -e 's/ /, /g' | sed '/:[0-9]*$/ ! s/$/./' but got error sed: 1: "$ft_line1,$ft_line2p": invalid command code f variables enclosed inside single quotes not expanded shell , hence sed command sees argument $ft_line1,$ft_line2p literally. use double quotes ,...

Python returning key value pair from JSON object -

this question has answer here: python accessing nested json data 4 answers i'm trying return 'publisher' , 'title' values of first entry in json object. { "count": 30, "recipes": [{ "publisher": "closet cooking", "f2f_url": "htt//food2forkcom/view/35171", "title": "buffalo chicken grilled cheese sandwich", "source_url": "htt//wwwclosetcookingcom/2011/08/buffalo-chicken-grilled-cheese-sandwich.html", "recipe_id": "35171", "image_url": "htt//staticfood2forkcom/buffalo2bchicken2bgrilled2bcheese2bsandwich2b5002b4983f2702fe4.jpg", "social_rank": 100.0, "publisher_url": "htt//closetcooking.com" }, { ...

java - JPA alternative of Hibernate Projections.property -

folks! trying limit amount of columns fetched db , found this: hibernate criteria query specific columns criteria cr = session.createcriteria(user.class) .setprojection(projections.projectionlist() .add(projections.property("id"), "id") .add(projections.property("name"), "name")) .setresulttransformer(transformers.aliastobean(user.class)); list<user> list = cr.list(); this works awesome when use hibernate, trying same jpa (jpa provider hibernate tho). is possible jpa? mean limit columns criteriabuilder , map specific object? also, saw this: https://docs.jboss.org/hibernate/orm/5.0/userguide/html_single/chapters/query/criteria/criteria.html hibernate offers older, legacy org.hibernate.criteria api should considered deprecated. no feature development target apis. eventually, hibernate-specific criteria features ported extensions jpa javax.persistence.criteria.criteriaquery. details on org.hibernate.crit...

Visual Studio 2017 extension not binding 'Insert' key to a command -

i've written small extension containing own legacy macros use customising visual studio editor. in visual studio 2015, following instruction bound 'insert' key command "cmdidbrieflinepaste". unfortunately same line not work in visual studio 2017: <keybindings> <keybinding guid="guiddanbarpackagecmdset" id="cmdidbrieflinepaste" editor="guidvsstd97" key1="vk_insert" /> </keybindings> if add mod1="alt" works (but 'alt' pressed, isn't want). manually unassigning insert key "edit.overtypemode" makes no difference. could please tell me either: a) there way make work? b) alternatively, how add command visual studio's "all commands" can perform mapping manually through visual studio's options dialog? well, found question i'd posted several years ago: when implementing vspackage (vsix) vs2015, how new commands listed in options-keybo...

performance - Lag/Animation issues on newer android versions (Marshmallow and up) -

i've made app various custom views , multiple fragments; problem animations/translations perfect on android lollipop, on marshmallow , nougat there lag/delay when clicking on buttons , opening pages , animations bit slow well. i'm not sure problem , how can solved; if required, here gradle file: apply plugin: 'com.android.application' android { compilesdkversion 25 buildtoolsversion "25.0.2" defaultconfig { applicationid "com.app.myapp" minsdkversion 19 targetsdkversion 25 versioncode 1 versionname "1.0" testinstrumentationrunner "android.support.test.runner.androidjunitrunner" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) androidtestcompile('com.android.support.test.espresso:espresso-cor...

azure data lake - u-sql issue using gzip and virtual column -

i have strange issue u-sql job process zipped files. if run u-sql on normal csv file works fine. if gzip file doenst work anymore (generating e_runtime_user_extract_encoding_error: encoding error occured after processing 0 record(s) in vertex' input split.) so code works declare @path string = "output/{ids}/{*}.csv"; @data = extract string, b string, c string, d string, ids string @path using extractors.csv(skipfirstnrows:1, silent: true); @output = select * @data ids == "test"; output @output "output/res.csv" using outputters.csv(quoting : false, outputheader: true); this code not work (gz version of file) declare @path string = "output/{ids}/{*}.csv.gz"; @data = extract string, b string, c string, d string, ids string @path using extractors.csv(skipfirstnrows:1, silent: true); @outpu...

sorting - Solr boost query sort by whether result is boosted then by another field -

i'm using solr run query on 1 of our cores. suppose documents have 2 fields: id, , name. have separate list of ids i'm grabbing database , passing query boost results. if document gets returned in query , id in list goes top of results, , if gets returned in query , id not in list goes below in list. former "boost". query - http://mysolrserver:8983/solr/mycore/myqueryhandler?q=smith&start=0&rows=25&bq=id%3a(36+or+76+or+90+or+224+or+391) i able boost query working need boosted results in alphabetical order name, non boosted results under in alphabetical order name. need know user &sort= parameter. &sort=score%20desc,name+asc not work. i've looked on lot of documentation, still don't know if possible. appreciated. thanks! solr version 6.0.1. using solrnet interface solr, think can figure out solrnet part if know url's &sort= parameter value needs be. the closest match requirement query elevation component[1] ....

python - Circular Dependency Error in Django -

having issue when running makemigrations/migrate django project. getting error: traceback (most recent call last): file "manage.py", line 10, in <module> execute_from_command_line(sys.argv) file "c:\users\crstu\appdata\local\programs\python\python36-32\lib\site-packages\django\core\management\__init__.py", line 353, in execute_from_command_line utility.execute() file "c:\users\crstu\appdata\local\programs\python\python36-32\lib\site-packages\django\core\management\__init__.py", line 345, in execute self.fetch_command(subcommand).run_from_argv(self.argv) file "c:\users\crstu\appdata\local\programs\python\python36-32\lib\site-packages\django\core\management\base.py", line 348, in run_from_argv self.execute(*args, **cmd_options) file "c:\users\crstu\appdata\local\programs\python\python36-32\lib\site-packages\django\core\management\base.py", line 399, in execute output = self.handle(*args, **opti...

C++ weird error strstr -

Image
check screenshot, have no idea what's wrong it can me? if (strstr(pmaterial->gettexturegroupname(), "world textures")) { pmaterial->colormodulate(0.5, 0.5, 0.5); } 1: c2665 'strstr': none of 2 overloads convert argument types 2: e0304 no instance of overloaded function "strstr" matches argument list your gettexturegroupname() function of std::string type. std::strstr() function not accept std::string parameter. use string c_str() member function instead: if (std::strstr(pmaterial->gettexturegroupname().c_str(), "world textures")){ pmaterial->colormodulate(0.5, 0.5, 0.5); } rather falling c style strings should explore std::string facilities pointed out in comments. modified example uses std::string::find member function: if (pmaterial->gettexturegroupname().find("world textures")!= std::string::npos){ pmaterial->colormodulate(0.5, 0.5, 0....

css - How to get Flexbox to allow an input to be 100% width? -

i have following flexbox form powered bootstrap 4. https://jsfiddle.net/kkt0k2bs/1/ i have media query resize form elements smaller display. on larger displays, want form items inline, on smaller screens, want form elements stacked , @ 100%. the input not going 100% width on smaller displays... how can enable code width 100% on smaller displays? html: <div class="form-mod"> <form class="form-inline justify-content-center d-inline-flex"> <div class="form-group"> <div> <input type="text" name="email" value="" placeholder="enter email..." class="form-control"> </div> </div> <div class="form-group"> <button type="submit" class="btn btn-primary">request invite</button> </div> ...

VBA Excel Unfiltering but not unhiding rows -

i writing code filter data , copy it. after which, want unfilter original state. using activesheet.showalldata statement unhides hidden rows well. there set of code allows me unfilter filtered data not unhide rows hidden? thanks answering edit: code if helps. sub copytoamortizing() dim tbl range dim visiblecells integer dim lr long sheets("template").select columns("a:az").entirecolumn.hidden = false if not activesheet.autofilter nothing cells.autofilter range("a5:ab5").select range(selection, selection.end(xldown)).select set tbl = selection activesheet.range("$a$3:$n$9999").autofilter field:=1, criteria1:= _ "amortizing item" on error goto point2 visiblecells = tbl.specialcells(xlcelltypevisible).rows.count if visiblecells >= 1 range("a3").select selection.end(xldown).activate lr = activecell.row range("b3", cells(lr, 12)).select selection.copy sheets("amortizingitems").select r...

analogue argmax for list of multidimensional arrays (PYTHON) -

is there efficient way of finding element occurs in list given element array of length 2? example: l = [(1,0),(1,0),(1,1),(0,0),(1,0)] i return: (1,0) appears often. appears simple can't find way this. you use collections.counter >>> import collections >>> l = [(1,0),(1,0),(1,1),(0,0),(1,0)] >>> c = collections.counter(l) >>> c.most_common(1) [((1, 0), 3)] otherwise can use max lambda key argument >>> max(l, key = lambda i: l.count(i)) (1, 0)

opencv - Keystone effect -

i have fixed pinhole camera. aim flat panel , take image. tilt flat panel , take image. there way convert pixels real-world coordinates, getting rid of keystoning? matrix that. i tried going real-world coordinates pixels using https://www.mathworks.com/help/vision/ref/cameramatrix.html throws not trapezoid shape parallelogram. loaded calibration image need directly above chessboard or what? even so, need convert pixels real-world, there way invert 4x3 camera matrix if valid method? thanks. you asking things: removing keystone not require knowing 3d world location of panel. need 3x3 homography matrix mapping "keystoned" version of panel "flat" one. you can compute homography given minimum of 4 pixel correspondences between 2 images. in opencv use "findhomographymat" purpose.

php - Publish Content in Drupal by One Editor Only -

im new admin educational e learning portal developed drupal, current status of publishing content verified or reviewed 2 moderators or editors. question : how make (1) editor publish content after reviewing instead of 2? the current flow, "teacher" publish educational content ( needs review: , editor reviews content , chooses 1 of following: 1) initial approve 2) send edit " teacher" 3) publish - in order publish editor must review , publish available published content. the used workflow default workbench flow, nothing there mentions 2 editors must review, where can find such code edit? in module block ? thank you!

python - Making __dict__ A Property -

why work: class bunch(dict): def __init__(self, *args, **kwargs): super(bunch, self).__init__(*args, **kwargs) self.__dict__ = self b = bunch() b["a"] = 1 print(b.a) albeit circular reference: import sys print(sys.getrefcount(b)) # ref count 3 when 2 but not this: class bunch(dict): @property def __dict__(self): return self b = bunch() b["a"] = 1 b.a # raises attributeerror while __dict__ attribute outward appearances, there's special behavior being implemented behind scenes bypassing descriptor logic created property . the default __dict__ attribute is property. (it's not literally property , it's implemented through descriptor protocol, property .) when set self.__dict__ = self , goes through __dict__ descriptor's __set__ method , replaces dict used instance attributes. however, python doesn't use __dict__ descriptor find instance dict when performing attribute operatio...

sql - MySQL Not like query -

i compare table1 , table2 specified column string , want return unmatched records table1 . it works great when use other way 'like' , return matching result. but looking unmatched records. here sample tables table 1 ---------------------------------- no. designid 1 c12345 2 c16 3 c20 table 2 ---------------------- no. designoption 1 online-c12345-print 2 online-c16-proof $db->fetchallcolumn(select distinct(a.designid) table1 a, table2 b b.designoption not concat('%', a.designid, '%')); with join example $db->fetchallcolumn(select distinct(a.designid) table1 inner join table2 b on b.designoption not concat('%', a.designid, '%')); expected result: c20 instead records table1 any appreciated. assuming query works, use outer join: select distinct a.designid table1 left join table2 b on b.designop...

ruby on rails cannot use permit.require -

i'm trying build simple blog on rails 5 . have created post model: create_table "posts", force: :cascade |t| t.string "title" t.text "body" t.integer "category_id" t.integer "author_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false end and controller methods: def new @post = post.new @categories = category.all end def create @post = post.new(post_params) if @post_save redirect_to posts_path, :notice => "post has benn created" else render "new" end end def post_params params.require(:post).permit(:title, :body, :category_id) end when try add post via html form nothing happens. page form reloaded , post not saved. doing wrong? that's because there's typo in create method @post_save must @post.save def create @post = post.new(post_params) if @post.save redirect_to...

c++ - Merge HoughLines -

Image
i stuck @ 1 point in code. firstly short clarification i'm doing: input there's image of floor. canny , houghlinesp algorithm want segment whole wall in many "small" parts, see here, @ same time the ideal output (here without canny), get - segment between 2 red lines. alright, since actually outout here i wonder how merge lines, cloose each other. example lines 2,4,3,5,6 should 1 line , count one. line 7 till 15 should one, second line. of course, did research , tried this: #include <opencv/cv.h> #include <opencv/highgui.h> #include <opencv2/opencv.hpp> #include <opencv2/core/core.hpp> #include <experimental/filesystem> using namespace cv; using namespace std; mat srcreal = //here's image http://imgur.com/a/kcjp6 mat src, dst, cdst; vector<vec4i> lines; void wallmapping(mat src) { scalar mu, sigma; meanstddev(src, mu, sigma); canny(src, dst, mu.val[0] - sigma.val[0], mu.val[0] + sigma.val[0], 3, fal...

r - Creating a new column where each element is the count of subsets of two other columns, loop free -

this question has answer here: count number of observations/rows per group , add result data frame 7 answers i have data frame looks table below keeps track of person visiting store in month. want create new column, total_visits, count of number of times id visited store during month. in below example, date 6-13 , id 23, total_visits have 3 in row date == 6-13, , id == 23. date id 6-13 23 6-13 34 6-13 23 6-13 23 7-13 23 data frame i'm looking date id total_visits 6-13 23 3 6-13 34 1 6-13 23 3 6-13 23 3 7-13 23 1 while assume there sort of acast function ensure don't have loop through (30,000 rows), ok loop if vectorization did not work. you can use dplyr package: library(dplyr) df %>% group_by(date, id) %>% mutate(total_visits = n()) # # tibble: 5 x 3 # # g...

How do I make a transparent background for an Android soft keyboard? -

Image
i'm developing soft keyboard, , i'm trying make background transparent. following images test purposes, i'm going want whole thing semi-transparent except few floating buttons, entire horizontal portion of screen remaining active register keypresses. this first image shows happens when activate keyboard via omnibar in chrome. i've given background slight pink tint can see - chrome creates dark semitransparent mask on entire screen, , keyboard shows on top of intended: but if launch keyboard via textbox, shown here, there's light gray element shows behind , goes across entire screen. here can see pink tint sitting on top of it: my question is: how rid of light gray element showing behind keyboard background? i'm not sure comes from, or how can make changes it. suggestions!

python - How to get two dataframes from one csv with multiple index columns -

i have csv file that: time [s],channel 0-analog, time [s],reset-digital, time [s],channel 1-digital, time [s],channel 2-digital, time [s],channel 3-digital -0.002204166666667, 2048.000000000000000, -0.002204166666667, 1, -0.002204166666667, 0, -0.002204166666667, 1, -0.002204166666667, 1 -0.002204000000000, 2048.000000000000000, -0.001124000000000, 0, -0.001504666666667, 1, -0.001448500000000, 0, -0.000199666666667, 0 -0.002203833333333, 2048.000000000000000, -0.000000000000000, 1, 0.000301666666667, 0, 0.000841666666667, 1, 0.000056333333333, 1 -0.002203666666667, 2048.000000000000000, 0.000550833333333, 0, 0.000932000000000, 1, 0.003178666666667, 0, 0.002361000000000, 0 -0.002203500000000, 2048.000000000000000, 0.003259333333333, 1, 0.002538166666667, 0, 0.005142333333333, 1, 0.004062000000000, 1 -0.002203333333333, 2048.000000000000000, 0.005602833333333, 0, ... and want have single data frame 1 time "line". the idea create 2 data frames , merge them 1 resp colum...

javascript - Why does .prop("type") return "text" on a datetime input? -

given simple code: <html> <body> <input type="datetime" id="theinput"/> <script type="text/javascript" src="./jquery-3.2.1.min.js"></script> <script type="text/javascript"> $(document).ready(function (){ alert($("#theinput").prop("type")); }); </script> </body> </html> you'd think messagebox "datetime", wouldn't it? apparently doesn't, says "text". how , why jquery deciding ignore wrote type? shouldn't able write arbitrary type "type" property , see messaged me? there list of jquery thinks types should be? (and aside, don't attempt put jsfiddle or codepen. both of reason refuse run javascript. don't know if i'm not allowed use "prop" or if i'm not allowed search id, or what.) inputs of type datetime aren't supported anymore . ...

jsf - How to pass timestamp based dynamic parameter to a URL in h:outputLink? -

i need call third party application jsf page, return html content. html content displayed on pop-up window. the third-party url service expects key based on current unix time-stamp. can generate complete request url when user clicks on hyperlink otherwise key invalid (key valid 5 minutes only) i tried below option, in case key generated when page rendered , if user clicks on hyperlink after 5 mintues link invalid. also, authentication key generation process, not want in javascript due security reasons. <h:outputlink onclick="window.open('#{testmbean.thirdpartylink}','thirdparty','menubar=no, status=no, scrollbars=yes, resizable=yes, toolbar=no, location=yes'); return false; "> link number </h:outputlink> i tried well, same behavior <h:outputlink onclick="#{indexbean.jspopup()}">#{indexbean.linkname}</h:outputlink> public string jspopup() { return "javascript:void window.open('" + getr...

build.gradle - Error building release flavor for Android application -

i'm studying basics of build types , trying create release , debug flavors app. firstly, i've created directory config in root folder of app. generated signed apk key , set path config directory. made following changes in build.gradle. following build.gradle file. apply plugin: 'com.android.application' android { compilesdkversion 25 buildtoolsversion "26.0.0" defaultconfig { applicationid "com.example.sarthak.chitchatmessagingapp" minsdkversion 21 targetsdkversion 25 versioncode 1 versionname "1.0" testinstrumentationrunner "android.support.test.runner.androidjunitrunner" } signingconfigs { chitchatreleaseconfig { storefile file("../config/releaseapkkey.jks"); storepassword("123456"); keyalias("releaseapkkey"); keypassword("123456"); } } buildtypes { debug { minifyenabled false proguardfiles ge...

Ansible failed while installing Mysql -

ansible failed while installing mysql fatal: [cvhnd-comm-s-alberto]: failed! => {"changed": false, "failed": true, "gid": 0, "group": "root", "mode": "0755", "msg": "chown failed: failed user mysql", "owner": "root", "path": "/home/mysql/.aws", "size": 4096, "state": "directory", "uid": 0} please me it looks trying change ownership of /home/mysql/.aws use mysql when happens, user not yet created. should try changing order of operations installation of mysql package manager come before operation.

excel - vLookup from highlighted cells -

i have highlighted cells in columns, want open new workbooks according these cells value . can this, ı want specify place of these cells value in new workbooks. (i.e cells(2,6) ). can succeed in finding cells, use vlookup . know complicated have solve . used find method ; dim rfound range sheets("sheet1") set rfound = .cells.find(what:=resimno) end dim gcell range set gcell = activesheet.cells.find(resimno) 'vlookup twb.sheets("sheet1") gcell.offset(0, 1).activate gcell.offset(0, 1).value = application.vlookup(resimno, tbl.range, 2, false) gcell.offset(0, 3).value = application.vlookup(.cells(p, 2), tbl.range, 4, false) gcell.offset(0, 4).value = application.vlookup(.cells(p, 2...

python - Get intersection from list of tuples -

i have 2 list of tuples a = [('head1','a'),('head2','b'),('head3','x'),('head4','z')] b = [('head5','u'),('head6','w'),('head7','x'),('head8','y'),('head9','z')] i want take intersection of 2nd element of each tuple example set {a[0][0],a[0][1],a[0][2],a[0][3]} intersection set {b[0][0],b[0][1],b[0][2],b[0][3],b[0][4]} list a , b such returns first element mapping of tuple if intersection value exist. resulting output should following: res = [('head3','head7'),('head4','head9')] so far have tried this: x = [(a[i][0],b[j][0]) in range(len(a)) j in range(len(b)) if a[0][i] == b[0][j]] but got error indexerror: tuple index out of range what correct , fastest way of doing ? you can following in python 3. create dicts lists, taking intersection of keys both dicts, fetch corresponding val...

java - How can I check to see if a valueChanged event of a Swing JList was changed via click or mouse? -

here's example code, using groovy's swingbuilder create code valuechanged event of jlist: mainlist.valuechanged = { event -> if (event.isadjusting) { index = mainlist.selectedindex otherlist.clearselection() otherindex = otherlist.selectedindex } else { mainlistselected = true clearjlist(otherlist) } } i have 2 jlist's, , function kind of controls list allowed selected via mainlistselected variable. have change int eindex want use selection based on whether or not it's index mainlist or otherlist i've read event.isadjusting, , fires twice on mouse click event. knowledge, think move out of there, need things happen differently if mouse causes event opposed using arrows. however, code, using arrow key navigation prevents index ever changing.