Posts

Showing posts from June, 2014

javascript - Filter an array of objects to only have the last occurrence of that object with the same certain property -

how filter array of objects have last occurrence of object same prop of foo? i.e given: [ {foo:1,id:1}, {foo:1,id:2}, {foo:2,id:3} ] i want back: [ {foo:1,id:2}, {foo:2,id:3} i'm using es6 can start here: this.data.filter((item,index,self)=> { return self.findindex(o => o.foo === item.foo); }) var index = {}; var data = [{foo:1,id:1},{foo:1,id:2},{foo:2,id:3}]; data.foreach(item => index[item.foo] = item); index[1]; // {foo:1,id:2} object.values(index) // [{foo:1,id:2},{foo:2,id:3}]

ios - Disable iPad from Guided Access Mode -

i have major problem , no idea why happening. have developed kiosk app client run in guided access mode in locations. periodically ipads enters in disabled ipad mode. ipads use invue presentation stands. need add that, no 1 knows guided access mode password. so questions are: it possible disable ipad thru programming? it possible disable ipad while browsing using wkwebview? it possible disable ipad if spike in energy detected , because of device restarted -> wrong passcode ? there other ways ipad can go disabled except wrong input of passcode? thanks in advance!

html - jQuery Select array not working -

html code: <select name="code[]"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> <select name="code[]"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> <select name="code[]"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> jquery code: var codes = $("input[name='code[]']").serializearray(); alert(codes); alert empty why happening selected value in select box. still, empty can please me. how can resolve error? the selector trying find inputs.. should change select. var codes = $("select[name='code[

openshift - How to ssh a openshift3 pod if replicas are more than one? -

if have multiple replicas of web service, how can ssh , investigate single pod? so have list pods , oc rsh pod name want : $ oc project my-project using project "my-project" on server "https://origin.my-company.com:8443". $ oc po my-pod-72-3eojp 1/1 running 0 8d my-pod-72-5bx0x 1/1 running 0 8d my-pod-72-8fgce 1/1 running 0 8d my-pod-72-c1twn 1/1 running 6 8d my-pod-72-kfcev 1/1 running 1 8d my-pod-72-lc39y 1/1 running 10 8d my-pod-72-s9664 1/1 running 11 8d my-pod-72-yt05k 1/1 running 10 8d #pick 1 , rsh it: $ oc rsh my-pod-72-s9664 sh-4.2$ now have shell opened in pod of replicated service. hope helped.

translation - How merge updated first language in poedit? -

i translated 100% .po file using poedit. got new .po , .mo files plugin developer 10 new sentences add in original language (left window). how add 10 sentences without loosing >100 translated? please tell me it's possible without restarting scratch! thanks.

Apply method used in type [Scala] -

this question has answer here: what apply method in scala, used in type definition 1 answer i skimming scala code, , find apply method used in type . example: type common = { def apply: {val func: {} => {val a: a}; val c: c} => {val b: b} } what above code mean? as understand, means common refers types includes apply method. but, questions kind of apply method mean? should inputs of apply method be? also, type common = { def apply({val func: {} => {val a: a}; val c: c} => {val b: b}) } what difference between 2 common type? this known structural type. means describe type structure instead of (only) name. type foo{val a: string} means "something has type foo has val a: string ". {val a: string} same anyref{val a: string} . {} means anyref{} , means same anyref . of course can use structural types in structural type

selective direction for voronoi diagram in matlab -

Image
how can create voronoi diagram on these squares in matlab, voronoi not enter yellow square? alternatively, lines of enters yellow ones. it possible put constrains on delaunay triangulation , , add more checks afterwards. maybe can you: close % generate random rectangels [x,y,w,h] format n = 8; w = 0.15; h = 0.05; rects = [rand(n,2),w*ones(n,1),h*ones(n,1)]; % convert [xmin ymin xmax ymax] format boxes = [rects(:,1:2), rects(:,1:2) + rects(:,3:4)]; % convert 1 single polygon (with missing vertexes) x = boxes(:,[1 3 3 1 1]); y = boxes(:,[2 2 4 4 2]); x(:,end+1) = nan; y(:,end+1) = nan; x = x';x = x(:); y = y';y = y(:); % polygon vertxes without nans xx = x;xx(6:6:end) = []; yy = y;yy(6:6:end) = []; % intersections between rectangles [xi,yi] = polyxpoly(x,y,x,y,'unique'); % remove intersections found inside rectangles in = any(bsxfun(@gt,xi',boxes(:,1)) & bsxfun(@lt,xi',boxes(:,3)) & ... bsxfun(@gt,yi',boxes(:,2)) & bsxfun(@lt,y

ruby on rails - Admin content on frontend with cancancan and activeadmin administrator -

i'm using activeadmin gem administration , cancancan authorization. i have problem admin authorization. nomethoderror in illustreportscontroller#index undefined method `admin?' # end if user.admin? can :manage, :all end my ability.rb this class ability include cancan::ability def initialize(user) user ||= user.new # guest user (not logged in) alias_action :create, :read, :update, :destroy, to: :crud can [:read], illustreport if user.id can [:crud], illustreport, {user_id: user.id} end if user.admin? can :manage, :all end end end and controller class illustreportscontroller < applicationcontroller load_and_authorize_resource i admin content on frontend. i'm looking help. i'm beginner , can't find mistake. have test lot of things searching in google , stack i'm stopped. thank you time.

java - Microservices with gRPC and REST using Spring Boot -

for project i'd set small microservice scenario using spring boot api gateway exposing rest , graphql clients, eureka service registry , 3 services. want services behind api gateway talk grpc because of performance reasons, @ same time still expose additional rest api. there clean way implement both types of interfaces on top of same business logic? , how gateway proxy clients' http requests grpc ones?

Edit jQuery dataTables info -

Image
i using jquery data table present table. have column has record active or inactive. want display count of number of column has value active & inactive right after shows showing 1 10 of 72 entries. my table like jquery <script type="text/javascript"> $(document).ready(function () { $('#example').datatable({ "blengthchange": true, "paging": true, "spaginationtype": "full_numbers" , //for different paging style "scrolly": 400, // scrolling "jqueryui": false, //enabling jquery ui(user interface) "lengthmenu": [[30, 50, 100, -1], [30, 25, 50, "all"]], drawcallback: function (settings) { var api = this.api(); // nu

java - Most efficient data type for an input of fixed numbers -

i have json coming java program. has particular field 6 fixed numbers: 0, 30, 60, 120, 240 or 480. possible in java choose better data type short? maybe using enum in form or representing input in bits taking advantage of knowing fixed input in advance? regarding enums, seem made different use case, oracle java docs enum, looks if use enum, still end creating int internally, don't see advantage in speed or memory. there missing? i tried google couldn't appropriate answer yet. first, observe numbers example follow pattern - constructed powers of 2 multiplied 30: 0 - 0 - 0*30 1 - 2 0 - 1*30 2 - 2 1 - 2*30 4 - 2 2 - 4*30 8 - 2 3 - 8*30 16 - 2 4 - 16*30 if store small number between 0 , 5, inclusive, can compute target number either look-up table, or simple bit shifting expression: byte b = ... // store value in variable of type "byte" int num = b!=0 ? 30*(1<<(b-1)): 0; note: since enum full-blown class, use or more space primi

guava - HazelCast Upgrade Issue from 2.5 to 3.8 -

i upgrading hazelcast 2.5 3.8 , after upgrading getting below exception : com.google.common.util.concurrent.uncheckedexecutionexception: java.lang.illegalstateexception: recursive load of: . . . @ com.google.common.cache.localcache$segment.get(localcache.java:2201) @ com.google.common.cache.localcache.get(localcache.java:3934) @ com.google.common.cache.localcache.getorload(localcache.java:3938) @ com.google.common.cache.localcache$localloadingcache.get(localcache.java:4821) @ com.google.common.cache.localcache$localloadingcache.getunchecked(localcache.java:4827) @ com.google.inject.internal.failablecache.get(failablecache.java:48) @ com.google.inject.internal.constructorinjectorstore.get(constructorinjectorstore.java:50) @ com.google.inject.internal.constructorbindingimpl.initialize(constructorbindingimpl.java:136) @ com.google.inject.internal.injectorimpl.initializejitbinding(injectorimpl.java:547) @

Java switch vs for loop performance -

i doing this: the first scenario: for(int i=0; i<50; i++){ // execute other code here switch(mycustomint){ case 1: case 2: case 3: // execude method1 break; case 4: // execute method2 break; } } the second scenario: for(int i=0; i<50; i++){ // execute other code here } switch(mycustomint){ case 1: case 2: case 3: for(int i=0; i<50; i++){ // execute method1 } break; case 4: for(int i=0; i<50; i++){ // execute method2 } break; } the question: the first scenario runs loop once, check switch statement 50 times. the second scenario runs loop twice, check switch statement once. which better way execute? know in today's technology, difference negligible

java - Client Program on PC connect to Server program on Android -

i trying make simple server app , client program in order extend their work in later time use them in graduation project i have client code java simple program on pc and have android thread in put server programm on android phone the server should listen ports and register them on accept the problem when run emulator , when use local address "127.0.0.1" on both client , server first start server , launches thread succefullt but when run client programm catches "connection refused exception " when build apk , launch server android phone on ip "192.168.3.100" server start the client runs correctly ,but when send number nothing shows in android activity any advice appreciated my server code package com.example.laptophome.securesys; /** * created laptop home on 13-apr-17. */ import android.content.context; import android.os.looper; import android.widget.toast; import java.io.inputstreamreader; import java.net

php - the value for my new input field is not saved -

i add new field 'pokemon' (text field) entity 'user' that, added property in class without problem (and getter/setters) /** @orm\column(type="string") */ protected $firstname; /** @orm\column(type="string") */ protected $lastname; /** @orm\column(type="string") */ protected $pokemon; then, user add form, added pokemon part : class participantform extends form { public function __construct($name = null) { parent::__construct('user'); $this->setattribute('class', 'form-horizontal'); $this->add([ 'name' => 'id', 'type' => 'hidden', ]); $this->add([ 'name' => 'firstname', 'type' => 'text', 'options' => [ 'label' => 'first name', ], ]);

C# Script to Convert the content of Excel sheet to Tabular format -

Image
i have bi report needs source data in tabular form in xls format. the source data triggered system tool on daily basis. in .xls format, simple formatting. when feeding data bi report, must converted tables. instead of manually updating excel file daily, want automate process. have script downloads excel file client tool , saves local system. so in 1 line need method below: input: desired output: note - writing script in c# windows application. below sample java code can used. import org.apache.poi.ss.util.areareference; import org.apache.poi.ss.util.cellreference; import org.apache.poi.xssf.usermodel.xssfsheet; import org.apache.poi.xssf.usermodel.xssftable; import org.apache.poi.xssf.usermodel.xssfworkbook; import org.openxmlformats.schemas.spreadsheetml.x2006.main.cttable; import org.openxmlformats.schemas.spreadsheetml.x2006.main.cttablecolumn; import org.openxmlformats.schemas.spreadsheetml.x2006.main.cttablecolumns;

oracle - SQL*PLUS Linux Client not backspacing upon linewrap -

first database class new oracle , sql*plus. when typing commands @ prompt if reach edge of terminal window , wrap next line unable return previous line using backspace. an example ( _ indicates position of cursor block): sql> !od -c <<< "test aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaathisisat est"_ if terminal wraps able backspace here: sql> !od -c <<< "test aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaathisisat _ once reach point no matter method use backspace, prompt not return previous line. strangely can resize terminal window bring cursor block previous line , continue backspacing not work. passing input od standard wrapped line comes out fine: 0000000 t e s t 0000020 * 0000120 t h s s t e s t \n however if change terminal size , cursor block stuck no matter positioned , execute command receive error: sp2-00

java - NullPointerException, integration test ejb -

i have web services many method, before "test it" manually soap, want junit , other framework interact database , use @ejb annotation. first example found, use dbunit , connected database , put row table(and works). when try reuse connection, , try directly invoke @stateless method have many error such nullpointer exception on ejb or on entity manager, tried complet different logic , use mockito, this: public class reportbeantest { //this stateless class private reportfc reportbean = new reportfc(); @before public void injectmockentitymanager() throws exception { entitymanager entitymanager = mock(entitymanager.class); reportbean.emreport = entitymanager; datefc datef= mock(datefc.class); reportbean.datef =datef; querysfc queryf= mock(querysfc .class); reportbean.queryf =queryf; reportbean.getreport("myreporta", new date(), new date()); } } and here reportfc.java : @stateless

python - How do I find a previous element in a list? -

n = 2 list1 = [1,4,6,2,8,9,90] how go finding number prior number n stored above in list1 , store in variable list1_result ? this should work: list1 = [1,4,6,2,8,9,90] n = 2 ind = list1.index(n) list1_result = list1[ind-1] # 6

java - How to compare objects of LocalDate and Calendar class? -

i trying compare dates 2 object having different types. there way convert calendar object localdater or vice-versa? thank :) public class abc{ public static void main(string args[]){ calendar c1= calendar.getinstance(); localdate c2= localdate.now(); system.out.println(c1.compareto(c2)); } } you need compare dates , let's that. using this answer reference: calendar calendar = calendar.getinstance(); localdate localdate = localdate.now(); localdate calendaraslocaldate = calendar.toinstant() .atzone(calendar.gettimezone().tozoneid()) .tolocaldate(); return calendaraslocaldate.compareto(localdate)

How to make a certificate that simulates a smart card for IIS site requiring client authentication -

i have project website authenticated smart card (dod cac). need make multiple test certificates site can use client authenticating session. seems possible have non-smartcard-based certificate user can choose client authentication. i feel comfortable saying because when hit dev site on macbook, shows me 2 apple certificates. won't work because our authentication process requires short sequence of numbers @ end of common name. i have tried many different things, cannot create certificate presents along dod cac certs when hitting site. in certificate manager mac certificate, doc cacs , test certs showing "client authentication" in intended purposes field. have self-signed cert used ca test cert in trusted roots. the dod certs have "smart card logon" , "client authentication" in intended purposes field. can specify 1 eku when using makecert.exe, can make certificate "client authentication" or "smart card logon" value, not both

cmd - C# run PStool from FORM -

i want run pstool windows form. tried code: system.diagnostics.process process = new system.diagnostics.process(); system.diagnostics.processstartinfo startinfo = new system.diagnostics.processstartinfo(); startinfo.windowstyle = system.diagnostics.processwindowstyle.normal; startinfo.filename = "cmd.exe"; startinfo.arguments = @"c:\\pstools\\psexec.exe \\\\" + dnsname+" cmd"; process.startinfo = startinfo; process.start(); but open command lint , not running command:"c:\pstools\psexec.exe \\" + dnsname+" cmd" what doing wrong? you can directly executed psexec setting it's exe filename. arguments accepted psexec can go in arguments property, so: startinfo.filename = @"c:\pstools\psexec.exe"; startinfo.arguments = string.format(@"\\{0} cmd", dnsname); keep in mind once indicated @

javascript - Issue parsing date format M/D/YYYY -

i have string date in format m/d/yyyy , i'm trying format new date() date. i've tried following , it's printing out invalid date . console.log(date) console.log(moment(date, "mm/dd/yyyy").todate()) console.log(moment(date, "m/d/yyyy").todate()) 3/10/2017 2017-10-03t04:00:00.000z 2017-10-03t04:00:00.000z 3/13/2017 invalid date invalid date https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.js this parses correctly without throws massive warning. var date = '2/23/2017'; console.log(moment(date, "mm/dd/yyyy").todate()) console.log(moment(date, "m/d/yyyy").todate()) var date = '3 / 13 / 2017'; console.log(moment(date, "mm/dd/yyyy").todate()) <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.js"></script> console.log(moment(date).todate()) you can try moment(date, "mm/dd/yyyy").todate();

c - fopen filename starts with weird dot -

Image
hi. as may see i'm trying save recent data c project inside log file files name corresponds actual time/date. while path combined , displayed correctly inside console file starts weird dot, more precise blank space followed dot , blank space, displayed in picture. i'm using windows 7 64bit , cygwin64. the relevant bits of code are: #include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> void save_to_file(char* timestamp, char* homepath, int generation) char* create_timestamp(char* timestamp) int main(){ char homepath[28] = "d:\\cygwin64\\home\\ignite\\log\\"; int generation = 0; char* timestamp = malloc (30 * sizeof(char)); create_timestamp(timestamp); save_to_file(timestamp, homepath, generation); } void save_to_file(char* timestamp, char* homepath, int generation){ char string[4]; char logchar[4] = "log"; char dot[] = {"."}; char fileend[5] = {"

Sharp edge with HTML and CSS only -

Image
it's more easy explain i'm trying achieve showing example. div{ width:100px;height:100px; border:3px solid #900; border-radius:0px 0px 140px 0px; } <div></div> i want draw sharp, direct line(point-to-point) between top-right , bottom-left corners. how do border-radius? are trying make right triangle border? div { width: 0; height: 0; border-style: solid; border-width: 200px 200px 0 0; border-color: #007bff transparent transparent transparent; position: relative; } div::before { width: 0; height: 0; border-style: solid; border-width: 182px 182px 0 0; border-color: white transparent transparent transparent; content: ''; display: block; top: -195px; left: 5px; position: absolute; z-index: 2; } <div></div> admittedly, is bit of wacky way you're after, requires precise manipulation correct - though it

ms word - Creating docx OOXML with c# -

i hoping point in correct direction, have never done, , googling getting me tied in knots. i want create word document (docx) c# on asp.net mvc application. populating template mail merge great. i have spent day googling , keep finding archived documentation. the following examples 2012 https://msdn.microsoft.com/en-us/library/office/bb491088.aspx because generate documents on server should avoid interop document manipulation. can use free libraries , sdks based on openxml difficult learn , error prone. it makes sense choose 1 among 3rd party toolkits job done quick , easy. start preparing ms word template documents placeholders data. can use c# load data reports , merge data templates final documents (docx, pdf, xps or image formats). here code used 1 such toolkit needed merging data database template pdf document: ienumerable<customer> customers = dataaccess.getcustomerbyid(15); documentgenerator dg = new documentgenerator(customers); documentgeneratio

yii - Yii2.0/Rules for dropdownlist -

i've following dropdownlist: <?= $form->field($model, 'urlaubsziel')->dropdownlist([ 1 => 'usa', 2 => 'mexico', 3 => 'deutschland', 4 => 'england', 5 => 'frankreich',],['prompt'=>'select country']);?> how define rule content of choice in public function rules(){}? ['urlaubsziel','string'] give me number,not content update code below. <?= $form->field($model, 'urlaubsziel')->dropdownlist([ 'usa' => 'usa', 'mexico' => 'mexico', 'deutschland' => 'deutschland', 'england' => 'england', 'frankreich' => 'frankreich',],['prompt'=>'select country']);?>

floating point - OpengL ES / Angle : rendering to single channel float texture -

i trying use shaders simple operations on large matrices/images. wrote code running regular opengl rendering single channel float textures in frame buffer objects, works fine. i need have run on different platforms (uwp + angle, android,...) i'm trying port code opengl es 2.0 ; can make work regular rgba images, doesn't float images. what works (output buffer 'data_out' contains result of render) format = gl_rgba; type = gl_unsigned_byte; internal_format = gl_rgba; glteximage2d(gl_texture_2d, 0, internal_format, width, height, 0, format, type, data (...) gldrawelements(gl_triangles, (2) * 3, gl_unsigned_short, 0); glreadpixels(0, 0, width, height, gl_rgba, gl_unsigned_byte, data_out); what doesn't work : format = gl_red_ext; type = gl_float; internal_format = gl_red_ext; glteximage2d(gl_texture_2d, 0, internal_format, width, height, 0, format, type, data); (...) glreadpixels(0, 0, width, height, gl_red_ext, gl_float, da

java - Generating Token (JWT) in Spring -

i building first spring rest api. have made registration , login, time secure these processes. store users informations , passwords (hashed) in database. i did this: @override protected void configure(httpsecurity http) throws exception { http.authorizerequests() .antmatchers("/register","/login").permitall() .anyrequest().authenticated().and() .csrf().disable(); } it gives permission access login/register , blocks other request. want use jwt , keep access functions logged in users. there easy way it? maybe has materials on it? thankful. ps. have followed tutorial here , , i've ended being able create , pass token, think "overrides" service implementation, returns empty response (token in header) , has hard coded credentials. want sent user custom response + token in header.

android - attach and detach a fragment from another -

i have 2 fragments. want update fragment #2 in background fragment #1. fragment #2 favorite list fragment... , in fragment #1, data json , populate listview. have refresh fragment #2 have new favorited item. decided reload fragment #2 when user clicks on bookmark icon fragment #1. i tried inside fragment #1: fragment frg = null; frg = getactivity().getsupportfragmentmanager().findfragmentbytag(fragment#2.mytag); final fragmenttransaction ft = getactivity().getsupportfragmentmanager().begintransaction(); ft.detach(frg); ft.attach(frg); ft.commit(); but frg returning null ... how can achieve this!?

html - How do I make slideToggle() in jQuery? -

i have been trying make tiny color picker other <input type="color"> , , wanted make popup jquery. tried code myself, didn't work. missing something? $(document).ready(function(){ $('#picker').click(function(){ $('#pickerwindow').toggleslide(); }); }); css #pickerwindow { display: none; background-color: #fff; } also, open other types of color picker suggestions. you sould use slidetoggle() ... not toggleslide() doesn't exist. $(document).ready(function(){ $('#picker').click(function(){ $('#pickerwindow').slidetoggle(); }); }); #pickerwindow { display: none; background-color: #fff; height:100px; width:100px; background-color:blue; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="pickerwindow"></div> <button id="picker">picker</button>

java - Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'memberDAO': Invocation of init method failed; -

i need competence in spring-boot project. when compile spring-boot project , inject service , dao objects errors: org.springframework.beans.factory.unsatisfieddependencyexception: error creating bean name 'greetingcontroller': unsatisfied dependency expressed through field 'memberservice'; nested exception org.springframework.beans.factory.unsatisfieddependencyexception: error creating bean name 'memberserviceimpl': unsatisfied dependency expressed through field 'memberdao'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'memberdao': invocation of init method failed; nested exception java.lang.abstractmethoderror: org.springframework.data.repository.core.support.repositoryfactorysupport.gettargetrepository(lorg/springframework/data/repository/core/repositoryinformation;)ljava/lang/object; @ org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor$autowiredfield

OAuth 1.0 A Invalid Signature when requesting request token (SalesForce/JIRA Integration) -

i've been trying darndest avoid asking question. i'm recieving invalid signature error when trying request request token jira within salesforce. response i'm getting is: 08:15:24:201 user_debug [30]|debug| oauth_problem=signature_invalid &oauth_signature=raopabpznms7aduujn1poclcyhwp4uryyx4j%2f%2bdtkb1sd4l1jcccys3p3raa8p7377mwlsimbtkhfl62jaxr5lv30rndjvuslcsvl3h47cvinhgdttmwwgukqjxhomsslpvcccqd7qsrmiqnnjsjcwd9ykjei2cxncwmqhnceqawjdzn3rd%2fbbenpf3g97wqwhjx%2ftyehqgk35otu00fhtw%2bix025stn3iignbyanlmoimagwqajeqjopuvva7tr2oainysl9%2bhmykqtocb7a9sn5rrwuqe4jua6eovypgzjnsgz4pfeimzu0etwqqhsfdqwodnoq5equ8w%2bpjm8ua%3d%3d &oauth_signature_base_string=post%26https%253a%252f%252fgnerbdev.atlassian.net%252fplugins%252fservlet%252foauth%252frequest-token%26oauth_consumer_key%253d3mvg9ki2hhaq33rwcph5bnzahbogfiicjj6hjvvfnhgu8awxgl6ps.vsezobcpqrxudcmev2baw%25253d%25253d%2526oauth_nonce%253d-6826921263934288296%2526oauth_signature_method%253drsa-sha1%2526oauth_ti

java - How to use dbunit annotation for junit only once? -

i use dbunit , junit annotion : @databasesetup(value = {"worktable.csv"}, type=databaseoperation.clean_insert) for each test. fills database csv. it's time consuming , want in 1 @beforeall method. seems using parameters not idea ( https://github.com/pragmatists/junitparams/issues/85 ). how ? thanks.

javascript - Younow onLoad (with greasemonkey) -

when loading younow website messagebox "start" pops twice. -how can fix this? // ==userscript== // @name test // @include https://www.younow.com/* // @version 1 // @grant none // @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js // ==/userscript== $(document).ready(function() { alert("start"); }); the alert acts way on website, maybe because of reload after call, prepend it's ok me. $(document).ready(function() { $('body').prepend("toto"); // code here }); also don't need use ready function, greasmonkey start script @ right time. but problem is: i suppose want stuff when ajax elements loaded. best way observe dom. since web site change current page using ajax requests on clicking , hashchange event doesn't work, use trick listen page change. with script can use alert function: // ==userscript== // @name test // @include https://www.younow.com/* // @

http - nodeMCU DeepSleep Configuration -

i working on configuring wemos d1 mini running nodemcu makes http post once every minute , go deepsleep, repeat. have pin32 & pin8 connected jumper cable specified nodemcu documentation. when run following code (omitting deepsleep), works fine not when include deepsleep code, fails make http post together, appreciated. init.lua -- configure network dofile("credentials.lua") -- dht22 sensor humidity&temperature dht22 = 5 status, temp, humi, temp_dec, humi_dec = dht.read(dht22) if status == dht.ok -- debugging, print console print("dht temperature: "..temp) print("dht humidity: "..humi) elseif status == dht.error_checksum print( "dht checksum error." ) elseif status == dht.error_timeout print( "dht timed out." ) end -- post request http.post('url', 'content-type: application/json\r\n', '{"humidity":'..humi..', "tempe

append - Can I generate multiple new records based on value in another table, in MS Access 2013? -

i'll qualify upfront admission not professional programmer or database designer. had specific problem solve - need manage great deal of information on employee benefit requests - , limited resources, , built database replace excel spreadsheet inherited. i'm learning go, , i'd find out is, can access i'm envisioning, or need adjust goal? the main tables database includes employees, requests, tasks, , activity (plus auxiliary tables used drop-down fields, etc.). each employee can have multiple requests, , each request, used tasks keep track of needs done, whom , when, see request through start finish (i'm user of dbase file itself, publish task list report involved). activity, expect, "journaling" feature keep track of what's been done, conversations, etc. what want speed process of task entry, since requests, taskflow pretty similar. created tables "task owner" , "task categories" - both related primary tasks table - sta

java - What is more effective, a huge condition, or a huge array? -

in app, have 2 fragments of each 1 has tridimensional array stores 2160 variables, of 720 it's float , 1440 it's integer. i have 2 options: 1 - continue huge tridimensional array. 2 - or huge condition. my concern application's performance on user's mobile phone. consume less time? memory array use high enough affect fragment loading? notes in app, variables it's constant values. the user answer series of questions in end display variables. there 3 issues: has 6 options has 15 options has 8 options but have 3 series of questions, in 1 of them display float variables. , in other two, display integer variables. actually, it's code. results_array[][][] it's big tridimensional array, made part of code, part dealing 720 float values. switch (rewardselected) { case 0: int count = 0; while (count < 6) { if(typepack == count) { int count2 = 0; while(count2 < 15) {

ruby - How can I assign a new value to an attribute for my Spreadsheet::Format in Rails? -

i trying format spreadsheet way want using spreadsheet gem in rails. however, can't seem modify existing format i've created. hoping point out i'm doing wrong, and/or point me in right direction. thanks! # create 2 formats alternating rows primary_format = spreadsheet::format.new color: :black, weight: :normal, size: 10, pattern_fg_color: :xls_color_42, pattern: 1, bottom: :thin, left: :thin, top: :thin, right: :thin, border_color: :white alternate_format = spreadsheet::format.new color: :black, weight: :normal, size: 10, pattern_fg_color: :xls_color_43, pattern: 1, bottom: :thin, left: :thin, top: :thin, right: :thin, border_color: :white # write out document, , text align center columns (1 , 4,5) search_result_records.each_with_index |player, index| # add row format (0..5).each |i| if (index+1).even? if == 1 || >= 4 primary_format.horizontal_align = :center else primary_format.h

r - How to use facet_grid() with geom_histogram() -

Image
i tried using facet_grid() first time. plotted histograms own data, , distribution seemed inaccurate when counted boxes manually on graph. replicated code using mtcars data, , problem seemed persist. here histogram produced ggplot: dfrm <- mtcars dfrm$am <- factor(dfrm$am, levels = c(0,1), labels = c("automatic", "manual")) dfrm$vs <- factor(dfrm$vs, levels = c(0,1), labels = c("v-engine", "straight-engine")) require(ggplot2) ggplot(dfrm, aes(x=dfrm[,"mpg"], fill=dfrm[,"am"], colour=dfrm[,"am"])) + geom_histogram(colour="transparent", position = "identity", alpha=0.2, bins = 10) + facet_grid(. ~ dfrm[,"vs"]) when count manually on histogram, count: v-engine, automatic: 14 v-engine, manual: 4 straight engine, automatic: 5 straight engine, manual: 9 this code counts how many of exist in actual data: require(pastecs) by(data=dfrm$am, indices = dfrm$vs, tabl

Looking for a 3D effect jQuery Slider -

Image
i have seen , used in project years ago can't recall or find again. hope i'm not breaking community standards asking help. i'm looking slider shown in picture; rest of slide hides behind main one:

asp.net - Differences between App.Config and Web.Config? -

when building desktop app in wpf can read documentation of problems , safely subsititute 'app.config' when people's answer's refer 'web.config'? if there glaring gotchas have out for? tnx read documentation : web.config , app.config the choice of configuration file name determined hosting environment choose service. if using iis host service, use web.config file. if using other hosting environment, use app.config file. in visual studio, file named app.config used create final configuration file. final name used configuration depends on assembly name. example, assembly named "cohowinery.exe" has final configuration file name of "cohowinery.exe.config". however, need modify app.config file. changes made file automatically made final application configuration file @ compile time. in using app.config, file configuration system merges app.config file content of machine.config file when

python 3.x - Why does input() always return a string? -

here code: age = input("how old you?: ") print (age) print (type(age)) result: how old you?: 35 35 class 'str' <<--- problem! but, if use.. age = int(input("how old you?: ")) print (age) print (type(age)) and entered "alex" how old you?: alex traceback (most recent call last): file "/users/kanapatgreenigorn/desktop/test.py", line 1, in age = int(input("how old you?: ")) valueerror: invalid literal int() base 10: 'alex' if want return string think default if want return number or integer can put int( in front of input. put in 'alex' , reason why came error because 'alex' string. not integer (which int)

join - How to show last commented post in mysql where are two tables involved? (post and comments) -

i have internal site forum. simple 1 has 2 tables: 1 forum posts , forum contents. i show list of posts , when user clicks on each item goes post comments. the forum posts ordered post date (in descending order), order update date, not new posts but new commented posts appear @ top . these 2 tables: create table foro ( foroid int unsigned not null auto_increment primary key, userid int(11) not null, estado char(7) not null default 'abierto', asunto char(200) null, fecha char(25) null, deprecated_userid int(11) null, deprecated_nodeid int(11) null, texto text null ) engine=innodb default charset=utf8; create table forocomentarios ( comentarioid int unsigned not null auto_increment primary key, foroid int(11) not null, userid int(11) not null, fecha char(25) null, deprecated_userid int(11) null, deprecated_nodeid int(11) null, texto text null ) engine=innodb default charset=utf8; and here how show forum po