Posts

Showing posts from February, 2014

ruby on rails - Custom HTML Error Wrappers for Form Elements -

i find way customize default error html <div class="field_with_errors"></div> to take own classes: <div class="clearfix error"> <label for="errorinput">input error</label> <div class="input"> <input class="xlarge error" id="errorinput" name="errorinput" size="30" type="text"> <span class="help-inline">small snippet of text</span> </div> </div> i have found railscast 2007 uses rails 2, believe. http://railscasts.com/episodes/39-customize-field-error . seems rails 3 might have more friendly way customize html? also, doesn't show way add error class directly input want. the method explained in link posted still used today vanilla form builders in rails . so, if wanted wrap input mention, create method overriding actionview::base.field_error_pr

performance - Time complexity of the following function -

please me giving time complexity analysis of following function. function (n) { for( = 1 ; <= n ; + + ) { for( j = 1 ; j <= n ; j+ = ) { print( “*” ) ; } } } i feel should n + n*log(n). one cycle it's o(n); cycle inside cycle it's o(n^2); this case should be: n*log(n) - (n/1 + n/2 + n/3 + … + n/n) each iteration number reducing (in n division n), plus n, first iteration cycle; so, final answer is: n + n*log(n). checked assumption simple test , numbers, looks good.

Capture output of ssh connection to SonicWall in vb.net -

i'm surprised isn't out there already, guess needs trailblazer. ok, part of pci compliance firewall rules need reviewed periodically. thought doing right, apparently not. i've been put on correct path , trying automation possible. end, trying connect sonicwall firewall using .net program (specifically vb.net) (that trying write) , execute following command "show nat-policies xml" , capture xml output (i service groups, address objects , address groups), shred in database. initially, tried ssh.net giving me error connection being closed. little research says ssh.net has issues trying connect sonicwall firewall , should try using tamir.sharpssh. tried that, first attempt, when executed connect statement, waited didn't move past statement. tried second example , complained host keys. i know sonicwall firewall configured ssh because can connect using putty , information (in convoluted way, can it). here code call hangs: imports tamir.sharpssh imp

javascript - Cannot find module 'ReactNative' from 'react-native.js' w/ Jest -

i'm attempting use jest ( v20.0.0 ) w/ react native application ( v0.42.0 ) when run yarn jest following error: yarn jest v0.27.5 $ jest fail __tests__/routing/router-test.js ● test suite failed run cannot find module 'reactnative' 'react-native.js' @ resolver.resolvemodule (node_modules/jest-resolve/build/index.js:179:17) @ object.<anonymous> (node_modules/react-native/libraries/react-native/react-native.js:188:25) here jest portion of package.json "jest": { "testpathignorepatterns": [ "/node_modules/" ], "transformignorepatterns": [ "node_modules/(?!react-native|react-native-geocoding)/" ], "globals": { "__dev__": false }, "collectcoverage": false }, update #1 here's failing test file (i stripped out except import , error persists). import 'react-native'; import react 'react

Creating device-specific custom Android Layouts -

my company ships android app preloaded on android device use industrial production equipment make. have both "phone" , "tablet" format devices, devices of different resolutions, locales, etc. i'm familiar having different xml folders "layout" "layout-land", different image resources "drawable-hdpi", "drawable-mdpi"; different language resources "values-ru", values-ro", etc. now have customer wants load our app on own oddball aspect-ratio , resolution android device, supply with, want make custom layout device. assuming make layout folder called "layout-custom1", how tell code use that layout folder instead of defaulting regular layout or layout-land folders? i'd in 1 place in code because our app has zillion screens/activities , i'd prefer not have in before calling every setcontentview() . and on subject, call can make in java ask device i'm running on? edit: i'

python - major ticks with locator_params -

Image
i cannot display major ticks of 1st, 2nd, 3rd y-axis @ same level. if have @ figure below 1 can see that: y-left axis has 10 bins (grid on) 1st y-right axis has 7 bins , major ticks not aligned of y-left axis 2nd y-right axis has 9 bins , major ticks not aligned neither ones of y-left axis or 1st y-right axis. i had found topics here suggest use "locator_parameters": plt.locator_params(axis='y', nbins=10) but haven't manage make work in case. want have 10 bins y-axis , want major ticks aligned. import numpy np import pandas pd import matplotlib.pyplot plt matplotlib import rcparams %matplotlib inline x = np.random.rand(20) y1 = x*5 y2 = x*5 + 0.2 y3 = x*x*3.5 + 0.2*x y4 = x*5 + 0.2*x ylimmin = 0 ylimmax = 2.1 linewidth = 1.0 fontsize = 24 subtitle = "" plt.rcparams.update({'axes.labelsize': 'small'}) fig = plt.figure(figsize=(21,29.7)) ax11

Do all language bindings of Selenium support same functionality -

i reading selenium documentation (eg http://www.seleniumhq.org/docs/04_webdriver_advanced.jsp ) , notice examples not available in javascript. due incomplete documentation or functionality not implemented in javascript binding? shall learn selenium using java binding or binding ok? i think support same functionality. remember trying figure out vs options on our mvc project. great product bad documentation :)

sql - Selecting from one table and modifying it before importing -

i have since modified process , simplified. in past, had 2 tables, tablename , result. tablename had column (56th of 90) named cnty char(3). second table, result, had field 000 + cnty. field titled area. trying insert cnty values tablename, add 3 zeros @ beginning , place them in result table under column, area. now have both columns in result. area blank now. cnty contains values in tablename (79954 of them). sample data area employment busdesc cnty 410 gas station 003 desired result area employment busdesc cnty 000003 410 gas station 003 try following query: update dbo.result set area = concat('000',cnty); hope helps!

Continuously run a Python script from Node.js -

i have python code trying link node.js. what want start python script , have continuously running , able call functions in script node. i have tried using python-shell module , works great running script haven't figured out how call specific functions python file. here .js code working with: var mypythonscriptpath = 'junk.py'; // use python shell var pythonshell = require('python-shell'); var pyshell = new pythonshell(mypythonscriptpath); pythonshell.run('junk.py', function (err) { if (err) throw err; console.log('finished'); }); pyshell.end(function (err) { if (err){ throw err; }; console.log('finished'); });

Android divide activity into two parts -

Image
currently i'm developing application android tablet. search method or approach divide screen 2 pieces , make subview visible. don't know found effect (ios or android app). for illustration have 2 pictures attached: after click on view x subview should appear below (the rest of screen moved down): does know effect? greetings! in android studio, can inflate fragment activity. here's example: in main2activity.java public class main2activity extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main2); final framelayout framelayout = (framelayout) findviewbyid(r.id.framelayout); button btn = (button) findviewbyid(r.id.button3); btn.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { plusonefragment myf = new plusonefra

python - QAbstractButton Image streches over full width of the column -

Image
i subclassing qabstractbutton class create clickable icon accesses user files. did following tutorial here: https://coolchevy.org.ua/2016/06/20/basic-example-how-to-code-a-image-button-in-pyqt/ the problem running qabsractbutton size. adding widget qgridlayout. on grid, right above button greater width. image takes size of column , stretches shown here is there way adjust size of qabstractbutton before added screen? have tried .setmaximumwidth, doesn't have method. thanks! update w/ code def init_ui(self): self.settings_button=qpushbutton("email settings") self.templates_button=templatebutton(qpixmap('templates.png')) self.layout.addwidget(self.templates_button,0,4) self.layout.addwidget(self.settings_button,1,4)` class templatebutton(qabstractbutton): def __init__(self,pixmap): super(templatebutton, self).__init__() self.pixmap = pixmap def paintevent(self, event): pix = self.pixmap if self

haskell - Yesod - Should user profile pictures be stored in the static directory? -

currently profile pictures users upload saved /static/avatars/{upload-date}. generate staticr route image via information stored in database (they added @ runtime staticr route doesn't exist). the problem i've run when user updates profile picture still old 1 due caching of static files. there way around or should storing images somewhere else? if how go accessing images /avatars/{upload-date}/{userid}.png? i know create route along lines of /avatars/#day/#userid i'm not sure how ".png" or ".jpg" appended that. or write handler function. i know create route along lines of /avatars/#day/#userid i'm not sure how ".png" or ".jpg" appended th there no need url should end png or jpeg extension. need make sure content type header set properly. or write handler function. that's quite simple. if serving png images, have use functions sendfile , typepng serve them: myavatarhandler = sendfile typepn

codeship - An image does not exist locally with the tag -

i'm playing codeship. when codeship try push docker image private registry have error: build error: image push error image myprivateregistry.com/sancho/test:latest, image not exist locally tag: myprivateregistry.com/sancho/test 2017-09-11t20:08:44.814z test build/pull started 2017-09-11t20:09:23.019z test build/pull finished 2017-09-11t20:09:23.019z test build/push started test 2017-09-11t20:09:23.156z test push refers repository [myprivateregistry.com/sancho/test] my codeship-steps.yml - service: test type: push image_name: myprivateregistry.com/sancho/test registry: https://myprivateregistry.com encrypted_dockercfg_path: dockercfg.encrypted do see error in configruation ? i add image_tag: latest and work !

windows - How to install TF r1.3? - Tensorflow-gpu package not found from pip3 packages on win10 -

i tried install tensorflow-gpu r1.3 on windows 10 using python 3.6. when try install through pip3 said in tf webpage, error message: could not find version satisfies requirement tensorflow-gpu (from versions: ) no matching distribution found tensorflow-gpu after googling found suggestions pip should upgraded, up-to-date this: requirement up-to-date: pip in c:... also when run pip3 search tensorflow find lots of other tf related packages, neither tensorflow nor tensorflow-gpu . so how can latest tensorflow-gpu installed , preferably through pip3? tensoflow-gpu available 64-bit python. need install 64-bit python 3.6 , pip3 install tensoflow-gpu .

How to get intented rendering of GHC source code documentation? -

stg source code looks quite unappealing in raw form. there more readable version available online or need generate it?

angular - Error '403 disallowed_useragent' logging to google via angularfire on a mobile browser -

Image
i developing project angularfire2 v4.0.0-rc.2 in angular4 , publishing on firebase. the logins facebook , google both working on desktop browser , on native android app. when try login within chrome via mobile browser, got following error: i've found many post google blocking access webviews none give answer how fix problem without workarounds not specific firebase. the error occurs either using angularfire signin popup , redirect. any thoughts?

vb.net - Transparency when Printing a Form in Visual Basic -

i having problem printing form in visual basic. when form sent printer, white background printed gray. i have tried making background color of form white, transparent, , "window" (under system) on backcolor property. however, have noticed still happens when printing pdf, printing pdf external program. notice of text appears "pixelated". have tried changing printer settings well, no avail. esentially, "greyed" part background of printed program. whole piece of paper not greyed out, background of form itself. between pixelation , this, believe may issue quality of output program gives when printing form, whether file or directly printer. how can edit print code/settings in program avoid this? edit: wanted see if problem printer, opened form print, used snip tool instead (the screen capture tool built windows). when printed captured image, looked fine. therefore, know issue way visual basic captures form. code provided below: printfor

hibernate - QueryDSL SubQuery not working - IllegalArgumentException: Parameter value did not match expected type -

i'm trying run query subquery in querydsl 4.1.4. equivalent in version 3.x worked can't seem work in version 4.1.4. not sure if i'm missing or if there bug. input appreciated! here relevant code: pathbuilder productentity = ...; pathbuilder categoryentity = ...; jpqlquery query = queryfactory.get().query(); query.distinct(); filteredclause subquery = jpaexpressions .select(productentity.get("id", long.class)) .from(categoryentity) .innerjoin(categoryentity.get("products"), productentity) .where(categoryentity.get("id", long.class).eq(categoryid)); query.where(productentity.get("id", long.class).notin(subquery)); query.fetch(); with above, following exception: java.lang.illegalargumentexception: parameter value [select product.id category category inner join treat(category.products product) product category.id = ?1] did not match expected type [java.lang.long (n/a)] @ org.hibernate.jpa.spi.basequery

python - reconstruct the source file from string output -

i use stepic3 hide data. multiple files compressed zip file, hidden message. however, when use following code from pil import image import stepic def enc_(): im = image.open("secret.png") text = str(open("source.zip", "rb").read()) im = stepic.encode(im, text) im.save('stegolena.png','png') def dec_(): im1=image.open('stegolena.png') out = stepic.decode(im1) plaintext = open("out.zip", "w") plaintext.write(out) plaintext.close() i error complete trace traceback (most recent call last): file "c:\users\sherif\onedrive\pyhton projects\kivy tests\simple.py", line 28, in <module> enc_() file "c:\users\sherif\onedrive\pyhton projects\kivy tests\simple.py", line 8, in enc_ im = stepic.encode(im, text) file "c:\users\sherif\onedrive\pyhton projects\kivy tests\stepic.py", line 89, in encode encode_inplace(image, data)

c# - How to change the database name in Entity Framework -

i'm trying find way change database name in web.config , context. no other info in connection string changes database name. public apicontext(string dbname = "myfirstdb") : base("originalcontext") { this.database.connection.connectionstring = this.database.connection.connectionstring.replace("myfirstdb", dbname); } the way can find achieve replace name, can see few problems in future, example if need go or need point database. using mysql. any appreciated. ** edit ** [dbconfigurationtype(typeof(mysql.data.entity.mysqlefconfiguration))] public class apicontext : dbcontext { public apicontext() : base("mycontext") { } public void setdatabasename(string name) { var currentdatabase = this.database.connection.database; this.database.connection.connectionstring = this.database.connection.connectionstring.replace(currentdatabase, name); } would work if call "setdatabasename(strin

react native - this.props.navigation loses value when called in my POST method -

inside register page have method gets called , register's user. when try navigate login page after registering user cannot read property 'navigation' of undefined . code sendajax = () => { //this.props.navigation returns value , can navigate 'login' if(!regex.test(this.state.email)){ }else if(this.state.password != this.state.confirmpwd){ alert.alert("the passwords don't match!"); }else{ const fn = encodeuricomponent(this.state.firstname); ... const hashdigest = sha256(p); const requestbody = `firstname=${fn}... //post fetch("http://localhost:3000/users", { method: "post", mode: "cors", headers: { "content-type": "application/x-www-form-urlencoded" }, body: requestbody }).then(function (res, next) { console.log("fetch request ", json.stringify(res.ok)); if(res.ok){

javascript - Test an array of values in Ember.js? -

is there way test array of inputs (on same test) in ember.js? server-side, use library https://github.com/fluentsoftware/data-driven achieve functionality. something works in pinch: test('adds 1 input', function(assert) { let service = this.subject(); [{ v: 0, r: 1}, { v: 5, r: 6}].foreach(function (i) { service.set('num', i.v); assert.equal(service.get('num2'), i.r); }); }); the problem lose well-named tests , few other niceties.

vue.js - Vuex: Tracking Mutations On Object/Class Properties -

i'm attempting track mutations on properties in other js classes or objects, changes aren't being broadcasted views include them, while other properties defined in state object broadcasted when mutated. vuex store export default new vuex.store({ state: { audio: new audio() }, getters: { duration: state => { return state.audio.duration }, currenttime: state => { return state.audio.currenttime } } }); vue template <template> <div class="component"> {{ currenttime }} :: {{ duration }} </div> </template> <script> export default { name: 'component', computed: { currenttime() { return this.$store.getters.currenttime }, duration() { return this.$store.getters.duration } } } </script> current time , duration always "0" in template. there built-in mechanisms track these mutations, or need write custom solution, such unfort

windows - Browsers detect my site as There is an issue with this website's security certificate -

i developed simple php page , installed in iis in server. want available in internet. opened 443 port,and on internet able visit page. problem browsers display following message when accessing page: "there problem website's security certificate" did wrong when configuring iis? how can solve it? short answer is, need certificate signed trusted source , not locally generated on server. you can free certificate let's encrypt project. there popular tool iis available @ https://github.com/lone-coder/letsencrypt-win-simple . another solution buy certificate. start 4 usd / year , go there.

summary - Summarize each category of rows in one column using R -

Image
i'm wondering if possible in r: have 2 columns. column (primaryhistory2.dept) has bunch of categorical data, column b (primaryhistry2.act.enroll) has numbers , nas . i want summary of column b each category in column a. like, "nut" in column a, want see min , max , mean , median , nas , etc. , see every category. when use summary() command. not sure if possible.. thank in advance! @moody_mudskipper results i'm looking for. without column names it's hard read. and base r, it's not doing counts nas, see lot of nas in file. very possible using dplyr library: library(dplyr) most.of.the.answer = df %>% group_by(primaryhistory2.dept) %>% summarise(min = min(primaryhistry2.act.enroll, na.rm = true), max = max(primaryhistry2.act.enroll, na.rm = true), mean = mean(primaryhistry2.act.enroll, na.rm = true), median = median(primaryhistry2.act.enroll, na.rm = true)) (assuming dataframe called df ) for counting na's, try dp

ruby on rails - CamaleonCms::Admin::Installers#index -

i'm trying install camaleon cms on existing app. got tables migrated , stuff. trying configure custom theme, restarted server , got error. have no idea caused it. ideas? had used camaleon? can't find documentation on it. cameleon error

vb.net - Copy worksheet to another workbook VB in different excel instance -

i need copy worksheet 1 workbook workbook in different excel instance. got error ('exception hresult: 0x800a03ec) @ "inputsht.copy(after:=chartsheet)" line when using below code, can tell me wrong please.(excelwb defined public var.) private sub chartinexcelbtn_click(sender object, e routedeventargs) handles chartinexcelbtn.click dim excelwb excel.workbook dim inputsht worksheet dim chartfile excel.application = new microsoft.office.interop.excel.application() dim chartworkbook excel.workbook dim chartsheet excel.worksheet excelwb = system.runtime.interopservices.marshal.bindtomoniker(xlfile) inputsht = excelwb.worksheets("input") chartworkbook = chartfile.workbooks.add chartsheet = chartworkbook.worksheets.add 'inputsht.copy(after:=chartworkbook.worksheets("sheet1")) inputsht.copy(after:=chartsheet) chartfile.visible = true end sub i found answer in below link: copy worksheet

java - Unable to run spark, phoenix/hbase with Spring Boot: Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path -

when try compile/build spring boot project spark/phoenix dependencies, says there's many slf4j's, , when try exclude package, throws above error. how can them work together? buildscript { ext { springbootversion = '1.5.6.release' } repositories { mavencentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springbootversion}") } } apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'org.springframework.boot' version = '0.0.1-snapshot' sourcecompatibility = 1.8 repositories { mavencentral() } //this doesn't work configurations { compile.exclude group:'ch.qos.logback' } dependencies { compile('org.springframework.boot:spring-boot-starter') /* excluding here didn't work */ compile(

How to iterate thru an arraylist and do an action every X times using for loops? Java -

i'm trying iterate thru arraylist of strings made of lines of parsed html. how can use double loop print 0-353, while printing line every 4? help what must go each line, check see if either world, country, members, or activity. add 4 of data object, every time finish filling object must start new object add array list of objects. <a id='slu-world-301' class='server-list__world-link' href='http://oldschool.runescape.com/game?world=301'>old school 1</a> <td class='server-list__row-cell server-list__row-cell--country server-list__row-cell--us'>united states</td> <td class='server-list__row-cell server-list__row-cell--type'>free</td> <td class='server-list__row-cell'>trade - free</td> <a id='slu-world-302' class='server-list__world-link' href='http://oldschool.runescape.com/game?world=302'>old school 2</a> <td

android - Set vector drawable programmatically pre lolipop -

very common problem twist couldn't find solution for. setting vector programmatically. want able change tint color programmatically too. found solutions such programmatically tint support vector imageview iv = .... drawable d = vectordrawablecompat.create(getresources(), r.drawable.ic_exit_to_app_24dp, null); d = drawablecompat.wrap(d); drawablecompat.settint(d, headertitlecolor); iv.setimagedrawable(d); the main problem comes iv.setimagedrawable(d); i found prelolipop accepts setting view's drawable with iv.setimageresource(int resource) i couldn't find solutions setting drawable file. any suggestions? use appcompatimageview has setimagedrawable() method.

laravel - Specific Method in Laravel5.4 Yajra Datatable -

when i'm using normal query of datatable works, public function gethmodatatable() { $hmo = hmo::query(); return datatables::eloquent($hmo) ->addcolumn('action', function($row) { return '<a href="/hmo/principal/'. $row->id .'/edit" class="btn btn-primary">update</a>'; }) ->make(true); } but when i'm using specific query attached, doesnt work public function gethmopendingdatatable() { $hmo = hmo::gethmopending(); return datatables::eloquent($hmo) ->addcolumn('action', function($row) { return '<a href="/hmo/principal/pending'. $row->id .'/edit" class="btn btn-primary">update</a>'; }) ->make(true); } what did follow new way of https://github.com/yajra/laravel-datatables can use whatever need return datatables()->of(user::query())->tojson(); return datatables()->of(db::tabl

javascript - How to draw a quarter circle in Semantic-UI -

Image
i'm using semantic-ui icons , not use canvas. how can draw quarter circle line @ big thin circle javascript? here fiddle https://jsfiddle.net/6kwxpogu/ <h3 class="ui grey header">my badge</h3> <div class="ui segment"> <i class="huge icons"> <i class="big thin circle grey icon"></i> <i class="trophy yellow inside icon"></i> </i> <i class="huge icons"> <i class="big thin circle grey icon"></i> <i class="star half empty yellow inside icon"></i> </i> </div>

html - Make div scrollable no scrollbar -

once again have read many posts on topic none of suggested solutions work. have solution, however, not know why works , appreciate insight. below solution found on so: hide scroll bar, while still being able scroll html <!doctype html> <html lang="en"> <head> <title>testing</title> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> </head> <body> <div class="hidden-xs hidden-sm col-md-3" id="parent"> <div id="child"> test text here </div> </div> </body> </html> css #parent { padding: 0px; border-width: 1px; border-style: solid; height: calc(100vh); overflow: hidden; } #child { width: 100%; height: 100%; overflow-y: scroll; padding-right: 17px; /* increase/decrease value cross-browser compatibility */ } the above n

regex - Extracting first sentence from a paragraph -

is there way can extract first sentence paragraph. can regex used here. if yes how? say example paragraph below has 2 sentences, , need first sentence: "the japanese loan available @ 0.1% interest rate on oct. 25 , india able repay in 50 years. repayment begin 15 years after loan received." my desired output: japanese loan available @ 0.1% interest rate on oct. 25 , india able repay in 50 years. how can that? there vba code using regex can used here? regards karan regular expressions can used. following uses simple typical definition of "end of sentence": . , ! or ? followed either 1) @ least 1 space capital letter, or 2) end of text. public function thefirstsentence(byref text string) string new vbscript_regexp_55.regexp .pattern = ".*?[.!?](?= +[a-z]|$)" if .test(text) thefirstsentence = .execute(text)(0).value else thefirstsentence = vbnullstring end if end end function just remember enable

javascript - WebGL color buffer issue: [GL_INVALID_OPERATION : glDrawArrays] -

Image
i trying starting learning webgl; got proof of concept working without color, tried added color adding colorbuffer = gl.createbuffer(); gl.bindbuffer(gl.array_buffer, colorbuffer); gl.bufferdata (gl.array_buffer, new float32array( 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, ), gl.static_draw); colorattribute = gl.getattriblocation(program, 'color'); gl.enablevertexattribarray(colorattribute); gl.vertexattribpointer(colorattribute, 4, gl.float, false, 0, 0); where gl webglrenderingcontext, program compiled program vertex , fragment shader attached colorbuffer , colorattribute null variables in main code, , changing gl_fragcolor = vec4(0.2, 0.4, 0.6, 1); to gl_fragcolor = vcolor; in fragment shader source(commenting shader body not make error go away); got following error: [.offscreen-for-webgl-0000000005bb7940]gl error :gl_invalid_operation : gldrawarrays: attempt access out of range vertices in attribute 1 which strange because color

php - How to alphabetical book title using query -

i want alphabetical a-z using query , code $user_query=mysqli_query($dbcon,"select * book book_title regexp '^[^a-za-z]' ")or die(mysqli_error($dbcon)); but didn't worked. database table you can use order alphabetical order- select * `book` order book.book_title asc

nat - body_bytes_sent in nginx access log with read timed out -

i facing read timed out exception api server occurs once or twice day. i investigated nginx access log , tomcat log , found pattern. when read timed out exception occurs, '$body_bytes_sent' in nginx access log 201. know, size of '$body_bytes_sent' variable depends on response data. '$body_bytes_sent' is: number of bytes sent client, not counting response header; variable compatible “%b” parameter of mod_log_config apache module i think body related read timed out when $body_bytes_sent 201. however, have no idea sends read timed out data. using closeablehttpclient , read timed out 20 sec , host send response in 2 sec. the route of request host tomcat -> nginx -> nat -> host. nat send read timed out data because host send response before read timed out occured? also, tomcat log is: [2017-09-05 17:00:25] [debug] o.a.h.i.c.loggingmanagedhttpclientconnection.onrequestsubmitted[135] http-outgoing-1096 >> post /test/cancel http/1.1

PHP Amazon URL Redirect Check -

i have searched forum & there posts related url redirect verification. e.g. php: check if url redirects? however codes not working me hence posting details in resolution or point doing wrong? my requirement: there 2 amazon url: url1 (does not redirect): http://www.amazon.in/gp/offer-listing/8184954018/?tag=30061200-21 url2 (redirects): http://www.amazon.in/gp/offer-listing/b00ea0q3pw/?tag=30061200-21 what require verify of these redirects else. so far have tried following code & few other variation of them yields same result both url1 & url2 above not redirected. <?php $url="http://www.amazon.in/gp/offer-listing/b00ea0q3pw/?tag=30061200-21"; $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_timeout, '60'); // in seconds curl_setopt($ch, curlopt_header, 1); curl_setopt($ch, curlopt_nobody, 1); curl_setopt($ch, curlopt_followlocation, 1); curl_setopt($ch, curlopt_returntransfer, 1); $res = curl_exec($ch

use lodash javascript to full join two-dimensional array -

i have 2 two-dimensional array. var arr1=[[1,20],[2,30]]; var arr2=[[2,40],[3,50]]; this expected output: [[1,20,null],[2,30,40],[3,null,50]] it full join of 2 data frames. logic similar pseudo code: df1.join(df2, df1[col_1] == df2[col_1], 'full') but case two-dimensional array. can lodash this? if not, how in vanilla javascript? well, lodash can't this, can: function flatten2d(arr1, arr2) { const o1 = _.frompairs(arr1); const o2 = _.frompairs(arr2); const result = []; _.foreach(o1, (v, k) => { const v2 = o2[k] || null; result.push([k|0, v, v2]); delete o2[k]; }); _.foreach(o2, (v, k) => { const v1 = o1[k] || null; result.push([k|0, v1, v]); }); return result; } testing: flatten2d([[1,20],[2,30]], [[2,40],[3,50]]) result: [[1,20,null], [2,30,40], [3,null,50]]

java - Android ClassNotFoundException On 4.4, 5.0 and 5.1 Devices -

Image
i'm receiving extremely minimal error message, on play dev console . appears bug affecting many 4.4, 5.0 , 5.1 devices , error same on each: java.lang.runtimeexception: @ android.app.loadedapk.makeapplication (loadedapk.java:572) @ android.app.activitythread.handlebindapplication (activitythread.java:4760) @ android.app.activitythread.access$1500 (activitythread.java:170) @ android.app.activitythread$h.handlemessage (activitythread.java:1502) @ android.os.handler.dispatchmessage (handler.java:111) @ android.os.looper.loop (looper.java:194) @ android.app.activitythread.main (activitythread.java:5568) @ java.lang.reflect.method.invoke (method.java) @ java.lang.reflect.method.invoke (method.java:372) @ com.android.internal.os.zygoteinit$methodandargscaller.run (zygoteinit.java:955) @ com.android.internal.os.zygoteinit.main (zygoteinit.java:750) caused by: java.lang.classnotfoundexception: @ dalvik.system.basedexclassloader.findclass (basedexclassloader.

javascript - Scroll to element ID if ng-model is true AngularJS -

i have page display list (result of search input). i'm using ng-model capture input text: ng-model="search_text" . thing want autoscroll div containing list every time model has something. if empty should nothing, if written in search_text should trick , auto-scroll down list results. you achieve simple directive in demo fiddle . uses $anchorscroll() implement auto-scroll feature. view <div ng-controller="myctrl"> <input ng-model="searchtext" type="text"> <div id="list" auto-scroller id-to-scroll-to="'list'" trigger="searchtext"> list </div> </div> angularjs application / directive var myapp = angular.module('myapp',[]); myapp.controller('myctrl', function ($scope) {}); myapp.directive('autoscroller', function ($location, $anchorscroll, $timeout) { return { restrit: 'a', scope: {

node.js - IBM Mobile First - mfpdev-cli Installation Failure -

i have issue while installing npm mfpdev-cli (ibm mobile first cli). i using node v 6.11.2 npm v 5.4.1 i unable install mfpdev-cli. getting below error: error message: npm err! path /users/divya/desktop/mfp/mdo-windows-support/package.json npm err! code enopackagejson npm err! errno -2 npm err! syscall open npm err! package.json enoent: no such file or directory, open '/users/divya/desktop/mfp/mdo-windows-support/package.json' npm err! package.json npm can't find package.json file in current directory. npm err! complete log of run can found in: npm err! /users/divya/.npm/_logs/2017-09-12t03_05_20_995z-debug.log message: i ran installation in current working directory has package.json file error says package.json doesn't exist. path, showing not right- "/users/divya/desktop/mfp/mdo-windows-support/package.json". has "users/divya/desktop/mfp/nzrb-tab-mobilefirst/package.json". how change path? i not sure causing issue. appre

c - Logical AND statement -

is statement correct in c-language? a && b && c i want check ((a==2) && (b==3) && (c==4)) .is usage of logical and correct? yes, usage correct. can , many expressions want.

c++ - std::maps with user-defined types as key -

i'm wondering why can't use stl maps user-defined classes. when compile code below, cryptic error message. mean? also, why happening user-defined types? (primitive types okay when used key) c:\mingw\bin..\lib\gcc\mingw32\3.4.5........\include\c++\3.4.5\bits\stl_function.h||in member function `bool std::less<_tp>::operator()(const _tp&, const _tp&) const [with _tp = class1]':| c:\mingw\bin..\lib\gcc\mingw32\3.4.5........\include\c++\3.4.5\bits\stl_map.h|338|instantiated `_tp& std::map<_key, _tp, _compare, _alloc>::operator[](const _key&) [with _key = class1, _tp = int, _compare = std::less, _alloc = std::allocator >]'| c:\users\admin\documents\dev\sandbox\sandbox\sandbox.cpp|24|instantiated here| c:\mingw\bin..\lib\gcc\mingw32\3.4.5........\include\c++\3.4.5\bits\stl_function.h|227|error: no match 'operator<' in '__x < __y'| ||=== build finished: 1 errors, 0 warnings ===|

google chrome - Exception in thread "main" java.lang.IllegalStateException: in selenium -

following code: import org.openqa.selenium.webdriver; import org.openqa.selenium.chrome.chromedriver; import java.util.concurrent.timeunit; import org.openqa.selenium.by; public class browser { public static void main(string args[]){ webdriver driver= new chromedriver(); driver.manage().timeouts().implicitlywait(10, timeunit.seconds); driver.get("https://q-apis-two.iot-build.qa.covapp.io/#/dashboard"); driver.manage().window().maximize(); driver.findelement(by.id("user")).sendkeys("q-apis-two_admin"); driver.findelement(by.id("password")).sendkeys("covisint111"); driver.manage().timeouts().implicitlywait(60,timeunit.seconds); driver.findelement(by.classname("btn btn-lg btn-primary btn-block")).click(); driver.close(); } } it throws following error: exception in thread "main" java.lang.illegalstateexception: path driver executable must set webdriver.chrome.driver s

Can I store firebase data & run the application functions in offline mode in React-native? -

i found tutorials offline mode firebase react-native still don't know how can enable thing in application. so, how can store recieved data , run functions in offline mode? you can search on persistence in firebase component use , set true an popular 1 react-native-firebase and can set in it's configuration-options

java - How to "pre-load" a fragments view tree? -

i have app uses fragments display view (wether or not shouldn´t discussed here please.) i have fragment ifirstfragment modally shows isecondfragment . view tree (= xml file) of isecondfragment rather complex (many views). on slow devices notice significant loading time (~1 second) when displaying isecondfragment . i want reduce "loading time" instant using code. call hack, trick, or common sense: public class mainactivity extends appcompatactivity { firstfragment ifirstfragment; secondfragment isecondfragment; fragmenttransaction ifragmenttransaction; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); ifirstfragment = new firstfragment(); isecondfragment = new secondfragment(); // adding isecondfragment , instantly hide it, view inflated. ifragmenttransaction= getsupportfragmentmanager().begintransaction(); ifragmenttransaction.add(r.id.fragmen

how to select default items in angular material 2 select multiple -

i'm working on angular 2 material app, have case there multiselect element , in have list checkbox can select multiple items @ time. i'm able to angular material component, want 2-3 items checked default, , if select/deselect particular item, should checked/selected flag true/false. <md-select multiple="true" [(mgmodel)]="test"> <md-option *ngfor="let l of list" [value]="l"> {{l.name}} </md-option> </md-select> var list = [{name:'abc'},{name:'cbv'},{name:'hgf'},{name:'rty'},{name:'fdv'},{name:'vbg'}] var test = [{{name:'abc'},{name:'cbv'}] is there other way around or m going wrong where. your test array should contain elements list array: list = [{name:'abc'},{name:'cbv'},{name:'hgf'},{name:'rty'},{name:'fdv'},{name:'vbg'}]; test = this.list.slice(0,2); plunker example

c# - Matlab .dll not working after OleDbDataReader without MS Office installed -

in c# program (winform) use matlab dll. worked fine until added oledbdatareader read data excel file. once oledbdatareader called, program not want enter dll anymore. no errors, no exceptions, no nothing! quits message: the program '[2900] myprogram.exe' has exited code 1 (0x1). i working on pc without ms office installed. once installed it, worked fine. question is, know why matlab dll having troubles oledbdatareader when ms office not installed?

angular - How to pass data through JSON to jsPDF autotable -

download() { var columns = [ { title: "producto", datakey: "producto" }, { title: "fecha", datakey: "fecha" } ]; var data = [{ "producto": "ddf", "fecha": "cwx" }]; var doc = new jspdf('p', 'pt'); console.log("1", data); console.log("2", columns); doc.autotable(columns, data); doc.save('table.pdf'); //console.log("3", data); //this.pdfserviceservice.getall().subscribe(c => { // console.log("4", this.country = c.pdfdata) // this.data = this.country; //}); }; <button (click)="download()">generate pdf</button> i want pass data ( var data ) through json data. i'm not able pass data doc auto table. link have tried: https://www.npmjs.com/package/jspdf-autotable

c# - UpdateProgress not appearing on second click of same button -

updateprogress appear first time, when click on button btnsubmit. when click same button next time updateprogress not appearing. other things works well. using updateprogress show gif image while sending e-mail client. first client updateprogress appear second other 'n' updateprogress not appearing. please asking question second time in stack overflow code below shows updateprogress <asp:updatepanel id="up1" runat="server"> <contenttemplate> <asp:updateprogress id="updprogress" runat="server"> <progresstemplate> <div class="modal"> <div class="center"> <span style="padding-left: 10px"><b>please wait..</b></span> <img alt="" src="../images/preloader_3.gif" width="50