Posts

Showing posts from February, 2010

ecmascript 6 - ES6 for of - is iterable evaluated only once? -

consider simple of: for (const elem of document.getelementsbytagname('*') { // elem } does getelementsbytagname evaluated once or on each iteration ? thx! in case, it's evaluated once obtain iterable , uses obtain iterator . reuses iterator grab values , pass them for block. it's similar doing following generator function: function* getintegers(max) { (let = 0; <= max; i++) { yield i; } } const iterator = getintegers(15); while (true) { const { done, value } = iterator.next(); if (done) { break; } console.log(value); } as noted loganfsmyth , generator functions return iterator directly. note: generator functions can used for..of construct . see this article on mdn more info.

height - android Navigation Bar hiding and persantage of usable screen overlap -

Image
my problem persantage of usable screen . application working ı assume if ı change dimension of screen (for example galaxy s8+) down. this how working fine strong text and wrong one the problem related navigationbar. tried set machparent params , use programmatically displaymetrics metrics = this.getresources().getdisplaymetrics(); width = metrics.widthpixels; height = metrics.heightpixels - utils.getstatusbarheight(getcontext()); code. not working in galaxy s8+ when hide navigationbar. can me fold? edit. mean height of screen doesnt work.

pyspark - Spark function for loading parquet file on memory -

i have rdd loaded parquet file using sparksql data_rdd = sqlcontext.read.parquet(filename).rdd i have noticed actual reading file operation gets executed once there aggregation function triggering spark job. i need measure computation time of job without time takes read data file. (i.e. same input rdd(dataframe) there because created sparksql) is there function triggers loading of file on executors memory? i have tried .cache() seems it's still triggering reading operation part of job. spark lazy , computations needs. can .cache() .count() lines: data_rdd = sqlcontext.read.parquet(filename).rdd data_rdd.cache() data_rdd.count() any set of computations follow start cached state of data_rdd since read whole table using count() .

excel - how to assign position to the inserted shapes basing on cell values -

depending on cell values a1= 234 , b1 = 435 , these ""a1 value = x -coordinates "" , "b1 = y - coordinate " . these both cell values gives position inserted shape (rectangle) in excel sheet. so when ever these values change dynamically not manually, position of respective shape ( rectangle) should change accordingly. write macro values cell , set top & left properties of shape(rectangle in case). sub moverectangle() activesheet.shapes("rectangle 1") .left = cells(1, "a").value 'x - coordinate .top = cells(1, "b").value 'y - coordinate end end sub then attach macro event of value changed of these cell, have call macro worksheet_change event. set macro trigger automatically when cell's values changes. private sub worksheet_change(byval target range) if target.address = "$a$1" or target.address = "$b$1" call moverectangle ...

java - Retrofit response after activity finish -

after user logged in successfully, there api call user information. before response close activity , start home activity. public void onresponse(call<loginresponse> call, response<loginresponse> response) { //save token // call rest service user info , update user records on db. // update notification token info //go home page intent intent = new intent(signinactivity.this, homeactivity.class); startactivity(intent); finish(); } how can make call rest calls outside activity. app can handle onreponse after close activity. in general how can call api background activity (eg: update database.) without interaction . (response doesn't depend on activity) the easiest solution use static method. can call methods anywhere. if want update ui elements inside method, pass ui elements parameters static method.

class - How to create Flutter route for Stateful Widget? -

i'm getting navigator operation requested context not include navigator. error log flutter app. examples see "stateless" widgets think may issue or code? how can route loginpage ? here code without navigator or route... void main() { runapp(new myapp()); } final googlesignin = new googlesignin(); final fb = firebasedatabase.instance.reference(); final auth = firebaseauth.instance; class myapp extends statefulwidget { @override _myappstate createstate() => new _myappstate(); } class _myappstate extends state<myapp> { string _platformversion = 'unknown'; @override initstate() { super.initstate(); initplatformstate(); } // platform messages asynchronous, initialize in async method. initplatformstate() async { string platformversion; // platform messages may fail, use try/catch platformexception. try { platformversi...

javascript - How to write js or css for deleting class and writing class when you click another -

<nav class="mynav"> <ul id="mynavigation"> <li><a class="active" href="#hm">main</a></li> /* active class */ <li><a href="#pj">projects</a></li> <li><a href="#port">port</a></li> <li><a href="#contact">contact</a></li> </ul> </nav> how write css or js for.... if click projects (tag a) code should working this <nav class="mynav"> <ul id="mynavigation"> <li><a class="" href="#hm">main</a></li> <li><a class="active" href="#pj">projects</a></li> /* active class */ <li><a href="#port">port</a></li> <li><a href="#contact">contact</a></li...

javascript - Correct userid not getting sent during post event -

hi hope can have gifts plugin not including userid in request , therefore fails work, bellow js code. when check request body viewed in console shows to_user=&gift_id=18&msg= can see no userid being sent to_user in console view if add to_user=532&gift_id=18&msg= , posts gift sent expected. this code on modal popup <script type="text/javascript"> if( false ){ $('#gift-modal').show(); } $('.giftimage').on('click',function(){ $('.giftimage').removeclass('activegift'); $(this).addclass('activegift'); }) $('#send_gift').on('click',function(){ var gift = $(this).parent().parent().find('.giftimage.activegift'); var gift_price =gift.data('price'); var gift_id =gift.data('giftid'); var msg=''; data={to_user: $('#userid_gift').val() , gift_id:gift_id , msg:msg}; $.ajax({ type: "post"...

Python: Int() Conversion & Division Issue Value Error -

so i've been working on encryption program , can't decryption function work. :( working integer can't use int() convert string one: print(text[:text.find(" ")]) #27042626280828082886 print(chr(int(text[:text.find(" ")]) / int(algorithmsalt))) # algorithmsalt 13521313140414041443 and error: file "c:\users\spike\documents\software\programming\softwaredev\7qp.py", line 69, in decrypt print(chr(int(text[:text.find(" ")]) / int(algorithmsalt))) valueerror: invalid literal int() base 10: ''

database - How to format a specific string of data in PHP? -

so, have .txt file full of data of uses of program on site. format goes follows: ~input|methodused|user|userinfo|month|day|year|hour|minute\n every time uses program, adds line text file. i'm working on statistics page. i'm wondering 3 things: how manage string of entries (using file_get_contents) to: get uses in specific day (say 08|17|17 ) in day, common user and/or input and overall, common user and/or input i assume difference in code between finding common user , common input hardly any. can me accomplish any, or 3 of these tasks in php? i'm aware of php's explode() function , assume necessary complete task. know way of handling data not best, not want change it. have months of data stored way. if failed add information necessary complete task, please let me know. like mario suggesting, put data in database, , make simple stats looking for. i'll show example of doing sqlite3 database. first, you'd want import data. use file_ge...

javascript - How to bring Google Maps polygons within a certain coordinates? -

i using google maps javascript library. have database polygons stored , bring ones fit in given coordinates. lets standing @ lat 99.42333, long -99.169333... how can bring polygons 1km around me? huge table of polygons, testing each imposible. i thinking of adding 2 more columns "quadrant_lat" , "quadrant_lng" , wrapping rows matching guess not right way. any ideas? thank you an efficient solution create geo indexes polygons in database. of modern databases come geo-indexing , querying capabilities pre-bundled or provide plugin/library this. the geo indexes can used search polygons within x meters radius given lat-long pair. simplest of geo searches, however, can lot more advanced processing 2d/3d geo indexes. on map view/client, use google maps apis render polygons returned geo query. if database not have geo capabilities, need write code heavy lifting yourself. solution depend on size of dataset. what database using , how many polygons th...

Bitwise operations: C vs. Python -

i'm faced weird problem here. consider piece of code: #include <stdio.h> int main() { printf("%u\n", (55 & 00000111) + 1); return 0; } this code, upon being compiled , executed, yields 2 result. python, on other hand, yields this: >>> (55 & 0b00000111) + 1 8 why different results? c doesn't have literal binary. 00000111 not binary literal assumed. instead interpreted octal 111 (or decimal 73) 0 prefix denotes octal in c. in case of python 0b00000111 proper binary literal (note b after 0 prefix). that's why getting different results in c , python. in case want use binary literal in c code, in opinion best way use hexadecimal literal starting 0x since 1 hex digit equivalent 4 binary digits , it's easy convert hex literal binary literal , vice versa. example, have used 0x7 in example. printf("%u\n", (55 & 0x7) + 1);

javascript - display: none is flickering content that should be hidden when loading the webpage -

so building toy website , getting undesired behavior. in html file homepage, have 2 distinct <body> tags sets. tags follows <body class = "intro">...</body> <body class = "home">...</body> the behavior going there button within "intro" class when clicked, hide "intro" class , display "home" class. issue is, when load webpage, "home" class displays second , gets covered "intro" class. not want "home" class being displayed @ until button clicked. i not have javascript using (at moment @ least, planning on adding in later once have of html , css set up). i have tried linking external style sheet , tried inline css read body{ display: none; } but inline css, content "home" class displayed second before content disppears. know do? double (or more) body tags invalid syntax. html should have 1 body. instead try using 2 divs

python - A decorator which converts string to number -

this question has answer here: can't modify list elements in loop python [duplicate] 5 answers i use decorators convert numbers in string format int/float value, here how trying it def str_to_int(func): """ wrapper converts string value integer """ def wrapper(*args, **kwargs): arg in args: arg = int(arg) return func(*args, **kwargs) return wrapper @str_to_int def number_as_string(a, b, c): return a,b,c print (number_as_string('1', '2', '3')) output ('1', '2', '3') however, wanted below (1, 2, 3) the above output generate below code def str_to_int(func): """ wrapper converts string value integer """ def wrapper(x, y, z): return int(x), int(y), in...

php - sqlite error when running phpunit in laravel -

i working on project while , working in memmory sqlite , working fine reinstalled mamp , getting below error when run phpunit lluminate\database\queryexception: not find driver (sql: select * sqlite_master type = 'table' , name = migrations) i checked have below dll's there installed in mamp sqlite extension=php_pdo_sqlite.dll extension=php_sqlite3.dll and present in same location extension_dir = "c:\mamp\bin\php\php7.0.0\ext\" is pointing.. so confused of next work.. appreciated..

php - How to make template for wizard in angular 4? -

i want make wizard module in angular4, , wizard has many diferent submodules (form, auth button, checklist, forks, etc). how can backend template wich build in backend side , process on client side. ( https://www.gosuslugi.ru/10059/3 ) for backend use php framework. at moment i'm processing every submodule using request on backend, , think wrong way.

c++ - cannot convert from 'double' to 'const std::_Vector_iterator<std::_Vector_val<std::_Simple_types<double>>>' -

i trying convert cusp based code plain c++ code. original cusp code typedef typename cusp::array1d<double> arr; typedef typename arr::iterator it; typedef cusp::array1d_view<it> view; i wrote equivalent in c++ as: typedef typename std::vector<real> arr; typedef typename arr::iterator it; typedef std::vector<it> view; view x_view; the purpose of view store coordinates , related properties (velocities etc.) of multiple objects , use as: x_view = view(x.begin(), x.end()); then x_view used inside cusp function cusp::blas::axpbypcz . there alternative function in plain c++ or boost. in cusp array1d_view class 1d vector container wraps data various iterators in array1d datatype. want convert in equivalent stl .

Extract string from a String in c# -

how can this: mu6aquvx/ywxpymfkote5kycrmzjaz21hawwuy29t/?app_redirect=false" from link: https://facebook.com/accounts/confirm_email/mu6aquvx/ywxpymfkote5kycrmzjaz21hawwuy29t/?app_redirect=false" extracting string:? #039;ll see posts in feed.</p></td></tr><tr style=""><td height="30" style="line-height:30px;" colspan="1">&nbsp;</td></tr><tr><td style=""><a href="https://facebook.com/accounts/confirm_email/mu6aquvx/ywxpymfkote5kycrmzjaz21hawwuy29t/?app_redirect=false" style="color:#3b5998;text-decoration:none;display:block;width:370px;"><table border="0" width="100%" cellspacing="0" cellpadding="0" style="border-collapse:collapse;"><tr> you can use below function string between 2 words: public static string gettextbetween(string source, string leftword, string...

java - Managing the password of an android application -

i developing secure android application! want manage password in secure way, mean don't want save password or private key . there password manager? or should generate myself? you don't store password- login , returned token. token send future access. secures password without need encryption. if you're more paranoid , want protect token well, use andrid keystore https://developer.android.com/training/articles/keystore.html secure private key (and generate private key on device, no need/good reason use same 1 on devices).

javascript - Drop down list to PHP SQL DATABASE -

how can txttrackid database, 1 dropdown list <label><b>track/section</b></label></br> <select id="soflow" name="track_type" onchange="add1()"> <option value="">select tracks</option> <option value="abm">abm</option> <option value="stem">stem</option> <option va;lue="ict">ict</option> <option value="has">has</option> <option value="bm">bm</option> <option value="humms">humms</option> </select> <input id="txttrackid" class="txttrackid" name="txttrackid" type="text"> </br> and here javascript code <script> function add1() { var ddlvalue = document.getelementbyid("soflow").value; var up1 = document.getelementbyid("txttrackid"); //console....

ionic2 - How to make a prod build in "Ionic upload" command? -

i want use ionic deploy service in ionic cloud. when run ionic upload command, dev build triggered instead of prod build. is possible create --prod build , upload? one of major reasons multiple configurations in code bundled --prod build only. ionic upload --deploy=dev [info] running app-scripts build: [09:55:59] build dev started ... [09:55:59] clean started ... [09:55:59] clean finished in 1 ms you pipe npm scripts run ionic --prod first , ionic upload "scripts":{ "custom-upload":"ionic cordova build --prod | ionic upload" } and run in terminal $: npm custom-upload this still run dev build think prod build should packaged well. not can specify build type in ionic upload command, makes me think ionic upload not upload production build ionic view. , if case might want consider changing configurations setup in prod build set used if not on localhost instead on based on build.

excel - Getting XML Node value when Namespace is present using VBA -

i want navigate , details of xml document. has namespace. due namespace in multiblock element, getting lists.length zero.(please refer vba code below) please guide. in advance reading. :) xml document is: <?xml version="1.0" encoding="utf-16"?> <multiblock xmlns="x-schema:configfileschema.xml"> <erdbversion> <dbversion>14.0</dbversion> <dbdesc>erdb release exp431.1-49.0</dbdesc> <dbguid>56cfaf87-53a9-4042-8b4f-4cf94868416e</dbguid> <dblangid>enu</dblangid> </erdbversion> <block> <blockdef> <blockname>j60aov1136</blockname> <entityname>j60aov1136</entityname> <blockid>20031267</blockid> <blockguid>d11bf0db-803d-49fc-a594-d234abd1e156 </blockguid> <blockdesc>exported on (mm-dd-yy hh:mm) 07-31- 2017 10:12</blockdesc...

Naming for Python context manager that ensures balanced push/pop calls to a stack? -

for api's use stack , push/pop, mismatch in calls push/pop cause serious problems (crashing if we're wrapping c api example) . in case context manager may used, errors in script don't result in invalid state. for example, this: item = stack.push() item.do_stuff() # if raises exception, bad things may happen! stack.pop() could written as: with stack.push_pop_context() item: item.do_stuff() to ensure push & pop run. is there convention naming kind of function? - push_pop_context

node.js - Error in importing socket library client side -

i craeting server using express js , when client side want import socket.io.js library error get http://localhost:3000/ net::err_connection_refused and when tried access http://localhost:3000/socket.io/socket.io.js error cannot /socket.io/socket.io.js my client side code <script src="/socket.io/socket.io.js"></script> <script type="text/javascript"> var socket = io("http://localhost:3000"); </script>

jquery - Update DataTable content with ajax -

i working datatables ajax generate table when page loads. first part of code works fine. have dropdown filtering users in datatable. can choose usersname , send post request controller , generates json data. can't find way how send json data , update datatable. here code: public actionresult individualuser() { var taskanswer = new list<taskanswerview>(); return view(taskanswer); } public actionresult individualusergetdata(string id) { var = datetime.now; var applicationuser = db.users.firstordefault(x => x.username == id); if (applicationuser != null) { var userid = applicationuser.id; var user = db.users.find(userid); var list = db.tasksmodels .join(db.tasktousers, t => t.tasksmodelid, usr => usr.tasksmodelid, (t, usr) => new { t, usr }) .where(t1 => t1.usr.useridint == user.applicationuserid) .select(t1 => new { t1.t.heading, ...

Nagios core check: Is it possible to pipe sort -u in a check command? -

is possible |sort -u in check command? #check_active_node define command{ command_name check_active_node_list command_line /usr/lib/nagios/plugins/check_active_node.sh '$arg1$' '$arg2$'|sort -u normally no. pipe character "|" not allowed part of line being executed nagios - there important security reasons this. there ways around it, i'd not recommend using of them. best solution modify plugin (create check_active_node_custom.sh , edit that), , add ever sorting need script itself. remember nagios system expects return codes , text plugin, , should still function expected after edits.

MyBatis: How to return custom map -

here table: create table `constant` ( `type` varchar(45) not null, `param` varchar(45) not null, `value` varchar(255) not null default '', primary key (`type`,`param`) ) engine=innodb default charset=utf8; i want param map key , value map value, little confused getting simple way. my code: @select("select param, value constant type = #{type}") @mapkey("param") map<string, string> getconstantbytype(@param("type") string type); you have create result handler work. when calling method pass result handler resulthandler class: public class someresulthandler implements resulthandler<object> { private map<string, string> map = new hashmap<string, string>(); @override public void handleresult(resultcontext<?> resultcontext) { try { @suppresswarnings("unchecked") map<string, object> result = (map<string, string>) resultcontext.getresultobject(); ...

scala - How to make a parquet file from a case class without using spark? -

i know can make parquet file dataframe. suppose that, have class class below: case class person( id: string, name: string, roll: option[int] ) now, have seq[ person ] , want make parquet file sequence of person. in case, won't use spark. so, how can make parquet file using scala/play seq[ person ]?

node.js - How to handle asynchronous in Javascript? -

asynchronous in socket.io i use 2 variables online (to count number of online people currently) , total variable (count total number of people visited). problem when reload page continuously online variable has not decreased, has increased. io.on('connection', function(sock) { sock.on('disconnect', function() { sock.broadcast.emit('client-disconnect', --online); }) io.sockets.emit('client-connection',{ onl: ++online, tol: ++total }); } the connections being left open not closed when page either refreshed or closed. listen page events able close connection before page removed: window.onbeforeunload = function(e) { sock.disconnect(); };

amazon web services - Unable to locate Container folder in aufs/diff -

Image
i unable find docker container id folder in aufs/diff folder: if remove container or local images (using rm / rmi ) can see few folders getting deleted aufs/diff folder. how mapping take place between containerid / imageid , directory name inside aufs/diff folder? edit: output of docker info root@ip-172-31-34-158:/home/ubuntu# docker info containers: 1 running: 0 paused: 0 stopped: 1 images: 1 server version: 1.12.6 storage driver: aufs root dir: /var/lib/docker/aufs backing filesystem: extfs dirs: 7 dirperm1 supported: true logging driver: json-file cgroup driver: cgroupfs plugins: volume: local network: overlay host bridge null swarm: inactive runtimes: runc default runtime: runc security options: apparmor seccomp kernel version: 4.4.0-1022-aws operating system: ubuntu 16.04.2 lts ostype: linux architecture: x86_64 cpus: 1 total memory: 990.9 mib name: ip-172-31-34-158 id: w6fs:jolt:b2dt:xn4l:ddn5:5q3g:riti:ibsn:spmc:dih3:tcpt:igzo docker root dir: /var/lib...

ios - DidSelectItemAtIndexPath not called for UITableView inside UIScrollView -

my self.view has uiscrollview subview. uiscrollview has container uiview , holds many uitableview 's subviews. these subviews configured using autolayout constraints. so scrollview horizontally scrollable. have uilongpressgesture inside uiscrollview . my problem didselectitematindexpath not called while tapping on cells inside uitableview . have set canceltouchesinview no uilongpressgesture still didselectitematindexpath doesn't called. i don't want add uitapgesturerecognizer uiscollview , manually trigger didselectitematindexpath , since i'm doing operations in uitableview delegate methods. how can make uitableview responds of delegate methods ?

android - Vector are not showing at all after enabling & using Vector Drawable Library -

i trying implement vector drawable library. updated code per below ran new problem. images/vector are not showing @ all . gradle file apply plugin: 'com.android.application' android { compilesdkversion 26 buildtoolsversion "26.0.0" defaultconfig { applicationid "com.kanudo.ten" minsdkversion 14 targetsdkversion 26 versioncode 1 versionname "1.0" vectordrawables.usesupportlibrary = true testinstrumentationrunner "android.support.test.runner.androidjunitrunner" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { implementation filetree(dir: 'libs', include: ['*.jar']) androidtestimplementation('com.android.support.test.espresso:espresso-core:3.0.0', { exclude gro...

akka - Can I change which Actor handles a TCP connection? -

after having "registered" actor handle tcp connection, can re-assign later on actor? i want because: step 1: have actor listening socket. io(tcp) ! bind(self, new inetsocketaddress("localhost", 12345)) step 2: receive incoming connection. @ point all know remote address (hostname , port). based on register actor handle incoming data connection. def receive = { case connected(remote, local) => sender ! register(handleractor(remote)) } step 3: first messages exchanged. i have more application level information connection , i'd actor placed somewhere else in hierarchy handle it.

ios - How To Set Total1 And Total2 Value Into Label When User Scrolls on Both Segment Of picker View (Dynamically)? -

func pickerview(_ pickerview: uipickerview, didselectrow row: int, incomponent component: int) { if component == 0 { lbl1.text = pdata[0][row] lbl1.adjustsfontsizetofitwidth = true img1.image = uiimage(named : pdata[0][row]) price1.text = pricedata[row] total1 = int(pricedata[row]) ?? 0 } else if component == 1 { lbl2.text = pdata[1][row] lbl2.adjustsfontsizetofitwidth = true img2.image = uiimage(named : imgdata[row]) price2.text = pricedata2[row] total2 = int(pricedata2[row]) ?? 0 } totalprice.text = string(total1! + total2!) } when user scroll on 1 segment total becomes nil , app crashes how can store both total 1 , total 2 variable show sum of price user you can use coalescing operator prevent force unwrap: totalprice.text = string((total1 ?? 0) + (total2 ?? 0)) https://en.wikipedia.org/wiki/null_coalescing_operator

php some image files cannot be uploaded -

i have problem image uploads. have checked posts on stackoverflow issue , tried people recommended in comments nothing works. most images files works fine upload files wont work. example jpg files works , jpg files doesnt. , same png , other file extensions. first thought size increased size 500000000 , still doesnt work... thinking maybe upload limit in php.ini. i tried raise limit , uncomment limit , restart apache still wont work. problem? here upload script <?php $allowedexts = array("gif", "jpeg", "jpg", "png", "gif", "jpeg", "jpg", "png"); $temp = explode(".", $_files["file"]["name"]); $extension = end($temp); if ((($_files["file"]["type"] == "image/gif") || ($_files["file"]["type"] == "image/jpeg") || ($_files["file"]["type"] == "image/jpg") || ($_files["file...

selenium - Ruby. Errors. DataMapper -

try use datamapper on macbook , got such error: /users/roger/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems /specification.rb:2288:in `raise_if_conflicts': unable activate dm-serializer-1.2.2, because json-2.1.0 conflicts json (~> 1.6) (gem::conflicterror) i try uninstall json , install new. if before ruby complain json 1.6 complain 2.10. don't know.. same script on ubuntu server work datamapper without problem got selenium error: /usr/lib/ruby/2.3.0/net/protocol.rb:158:in `rbuf_fill': net::readtimeout (net::readtimeout) /usr/lib/ruby/2.3.0/net/protocol.rb:136:in `readuntil' /usr/lib/ruby/2.3.0/net/protocol.rb:146:in `readline' /usr/lib/ruby/2.3.0/net/http/response.rb:40:in `read_status_line' /usr/lib/ruby/2.3.0/net/http/response.rb:29:in `read_new' /usr/lib/ruby/2.3.0/net/http.rb:1437:in `block in transport_request' /usr/lib/ruby/2.3.0/net/http.rb:1434:in `catch' /usr/lib/ruby/2.3.0/net/http.rb:...

css - Media Queries min-width VS max-width for responsive website -

since long time im using below media queries make responsive websites // large devices (desktops, less 1200px) @media (max-width: 1199px) { ... } // medium devices (tablets, less 992px) @media (max-width: 991px) { ... } // small devices (landscape phones, less 768px) @media (max-width: 767px) { ... } // small devices (portrait phones, less 576px) @media (max-width: 575px) { ... } but when checked bootsrap 4 , notes using below queries /* small. above 34em (544px) */ @media screen , (min-width: 34em) { ... } /* medium. above 48em (768px) */ @media screen , (min-width: 48em) { ... } /* large. above 62em (992px) */ @media screen , (min-width: 62em) { ... } /* large. above 75em (1200px) */ @media screen , (min-width: 75em) { ... } im wondering should continue on way or better follow bootsrap way , , why deside start small device larg device? thank you in current form, question opinion based. have been better ask if knows reasons behind bootstrap...

java - Android ListView not refreshing until scrolled -

i have faced strange listview . i have fragment message listener inside, populates listview data. so, when initialize fragment activity's oncreate , listview refreshing on new messages (i'm using notifydatasetchanged method). if replace/add fragment onclicklistener inside activity, listview stops refreshing until drag manually. problem occurs on api 16 level, on api 25 it's working great in both cases. listview initialization: messageslistview = (listview)rootview.findviewbyid(r.id.messageslistview); messages_adapter = new messageadapter(getactivity(), messageslistview); //set autoscroll of listview when new message arrives messageslistview.settranscriptmode( listview.transcript_mode_always_scroll); messageslistview.setstackfrombottom(true); messageslistview.setadapter(messages_adapter); refreshing method: (inside adapter class) public void add(mymessage object) { //arraylist<mymessage> messages messages.add(object); notifydatasetch...

java - RabbitMQ Consumer only consumes a portion of the messages sent -

i sending small number of messages rabbitmq, consumer consumes 2 of them. find below code producer & consumer: @component public class producer implements commandlinerunner { private final rabbittemplate rabbittemplate; private final consumer receiver; private final configurableapplicationcontext context; public producer(consumer receiver, rabbittemplate rabbittemplate, configurableapplicationcontext context) { this.receiver = receiver; this.rabbittemplate = rabbittemplate; this.context = context; } private list<message> extractphonenumbernumbers(string path){ list<message> messages = new arraylist(); try{ bufferedreader filereader = new bufferedreader( new inputstreamreader(new classpathresource(path).getinputstream())); jsonreader reader = new jsonreader(filereader); gson gson = new gsonbuilder().create(); messages = new gson().fromjson(reader, new typetoken<list<message>...

ssl - CRL Signature Validation against Issuer -

i have truststore containing certificates of known trusted cas. now, i'm writing service download certificate revocation lists (crls) ensure certificates in incoming ssl connections not revoked. before must verify crl valid , coming valid source. following code helps me validate crl against issuer provided know it's issuer. fileinputstream = new fileinputstream("mytruststore"); keystore keystore = keystore.getinstance(keystore.getdefaulttype()); keystore.load(is, "somepassword".tochararray()); x509certificate cert = (x509certificate) keystore.getcertificate("signer"); publickey key = cert.getpublickey(); crl.verify(key); now, given have truststore full of root ca certificates , crl, how verify crl when don't know issuer signed crl?

webpack - Error: Unexpected token: punc () -

i'm trying build project uses webpack. uglifyjs options looks this: new uglifyjsplugin({ sourcemap: false, uglifyoptions: { compress: { warnings: false, }, output: { comments: false, }, }, }), what error: unexpected token: punc ()) [index-3d0ae630eaa0a0128a00.js:145853,20] i have found topic saying might problem webpack uglify plugin, i've switched uglifyjs-webpack-plugin . any ideas?

Unable to create google cloud storage bucket in a zone [terraform] -

i trying create gcs bucket using terraform in region us-west1-a storage-class regional . getting error when doing * google_storage_bucket.terraform-state: 1 error(s) occurred: * google_storage_bucket.terraform-state: googleapi: error 400: combination of locationconstraint , storageclass provided not supported project, invalid here .tf file have right resource "google_storage_bucket" "terraform-state" { name = "terraform-state" storage_class = "${var.storage-class}" } provider "google" { credentials = "${file("${path.module}/../credentials/account.json")}" project = "${var.project-name}" region = "${var.region}" } variable "region" { default = "us-west1" # oregon } variable "project-name" { default = "my-project" } variable "location" { default = "us" } variable "storage-class"...

java - failed 2 times due to AM Container for 'attemptid' exited with exitCode: -1000 -

Image
i new in hadoop (i using hadoop-2.7.3) , trying wordcount example. sample youtube in while moving jar file hadoop, getting error like 'failed 2 times due container appattempt_1503226867501_0002_000002 exited exitcode: -1000' don't have idea issue. missing settings?

c# - Method call of 2 identical, newly created objects returns in different times -

i run test of murmurhash implementation .net. below code: murmurhash3 m = new system.data.hashfunction.murmurhash3(32); m.computehash(10); the first time executes takes 5 milliseconds while subsequent time takes 0 milliseconds (as expected). according believe true, using new keyword in parameter-less constructor should return identical starting objects. happens during method call of first object doesn't happen in subsequent method call of object of same type?

php - Notice: Undefined offset: 1 in line 23 -

this question has answer here: how add elements empty array in php? 7 answers for school project needed change mysql database mongodb. this old code working fine: $movies = ''; $count = 0; while($row_movie = mysqli_fetch_assoc($result)){ $count++; $movies[$count] .= "{ value: '".$row_movie['naam']."', data:'".$row_movie['idproduct']."' }"; } now made foreach loop handle mongodb collection: $collection = $colproduct; $products = $collection->find(); $result = $collection->find(); $movies = ''; $count = 0; foreach($result $row_movie){ $count++; $movies[$count] .= $row_movie['naam']; print_r($movies); } but error: notice: undefined offset: 1 in d:\wamp64\www\examen.yvde.nl\currency-autocomplete.php on line 23 (this line: $movies[$count] .= $row_movie[...

Python Aiohttp: Regarding utility of the Session object -

here below 1 working piece of code scrape links website of interactive brokers. in documentation of aiohttp use aiohttp.clientsession() object "sessions" reused 1 requests another. can see multiple requests example ( here instance ) 1 session created per request...? interest of session object? import asyncio aiohttp import clientsession exchanges_by_locs=[] inst_type_dicts=[] async def inst_types(url): async clientsession() session: async session.get(url) response: response = await response.text() html = lxml.html.fromstring(response) p=html.xpath('//*[@id="toptabs"]/ul/li') e in p: inst=dict(inst_type=e.find('a/span').text, url='https://www.interactivebrokers.com'+e.find('a').attrib['href']) inst_type_dicts.append(inst) async def inst_by_loc(inst): url=inst['url'] print("start:...

My Bisection method in c++ -

i'm study computer science in 4 degree , i'm trouble bisection method implementation in c++. error code run 1 time , end, tried changes result :( if can me, please it. saw alternative done codes, not helped me because different. my code following: #include <iostream> #include <math.h> using namespace std; double funcao(double x) { double resultado; resultado = x*log10(x)-1; return resultado; } double e(double xk,double xkant) { double resultado =0; resultado= fabs((xk-(xkant))/xk); cout<<"o resultado de e é: "<<resultado<<"\n\n"; return resultado; } // 1)metodo da bissecção: // este programa implementa o método da bissecção para obter raíz int main() { setlocale(lc_all,"portuguese"); double a,b,xk,xkant,erro; xkant=0; a=2.0; b=3.0; //cout<<"digite o valor(double) para o erro \n"<<"erro: "; erro=0.005; while(e(...

reactjs - Good practice to fetch detail api data in react-redux app -

whats best practice fetch details data in react app when dealing multiple master details view? for example if have - /rest/departments api returns list of departments - /rest/departments/:departmentid/employees api return employees within department. to fetch departments use: componentdidmount() { this.props.dispatch(fetchdepartments()); } but ill need logic fetch employees per department. great idea call employee action creator each department in department reducer logic? dispatching employees actions in render method not idea me. surely bad idea call employee action creator inside department reducer, reducers should pure functions; should in fetchdepartments action creator. anyway, if need employees every department (not selected one), not ideal make many api calls: if possible, ask backend developers have endpoint returns array of departments and, each department, embedded array of employees, if numbers aren't big of course...

php - codeigniter query builder will update db with just about anything -

i'm new codeigniter , trying mind around query builder functionality. have update method pass user entered data update record in db. i've noticed seems successful no matter kind of junk data throw @ it, , i'm wondering if there's setting or need change, or what. as can see below, in model i'm bypassing user entered value , putting in junk data , still successful. inserts 0000-00-00. dob in db date datatype. i success result this, , updates db, techically successful. have controls in place prevent junk data ever being sent model, doesn't give me warm fuzzies knowing behaving way. controller: $updateresult = $this->patients_model->update_patient_profile($this->data['post_data']); if($updateresult === true) { $this->data['patient_profile'] = $this->patients_model->get_patient_profile($patientid); $this->data['update_result'] = true; $this->load->view('index', $this->...