Posts

Showing posts from August, 2011

javascript - Function that to look up then perform task -

i trying write short script looks see if class or id present in document. if following: $(".tab_item").removeclass("tab_item_color"); $(this).addclass("tab_item_color"); you can use length property on jquery object. example: if( $('.your-class').length ) { $(".tab_item").removeclass("tab_item_color"); } the if() block execute if there element in dom has class of your-class .

Simplest way to convert a number list to a readable string in VBA -

given array of numbers: [1,3,4,5,8,9,11] what's simplest way in vba convert list readable string, e.g: 1, 3-5, 8-9, 11 i rewrite vb.net function vba it's quite long winded , end longer in vba. public shared function groupednumbers(nums list(of long)) if nums nothing orelse nums.count = 0 return "-" if nums.count = 1 return nums(0) dim lnums = nums.distinct().orderby(function(m) m).tolist dim curpos long = 1 dim lastnum long = lnums(0) dim long = 0 dim numstr string = lnums(0) dim isgap boolean = false until >= lnums.count - 1 until >= lnums.count - 1 orelse lnums(i) + 1 <> lnums(i + 1) += 1 isgap = true loop if isgap numstr += "-" & lnums(i) end if if <> lnums.count - 1 numstr += ", " & lnums(i + 1) isgap = false += 1 end if loop return numst

c# - IIS replace part of url -

i'm trying replace "se" "sv" in url using url rewrite in iis. url this: www.somedomain.com/ se /baadmarked/baade and should this: www.somedomain.com/ sv /baadmarked/baade my current rule this: <rule name="se sv" patternsyntax="ecmascript" stopprocessing="true"> <match url="(.*)" /> <action type="redirect" url="{c:1}sv{c:3}" appendquerystring="false" /> <conditions logicalgrouping="matchany"> <add input="{http_host}{query_string}" pattern="(.*)(se)(.*)" /> </conditions> </rule> i've tried lot, nothing gets job done. it sounds want use rewrite feature , not redirect feature. the rule should this: <rule name="se sv"> <match url="^(.*)/se/(.*)" /> <action type="rewrite" url="{r:1}/sv/{r:2}" /> </rule>

how to order list that has date and a word in sql server -

case when prefinallist.truckbooked null 'immediate' else cast(prefinallist.previous_date varchar) end eta the list contain either the word immediate or datetime . how show immediate on top , date in acending. you can try use order this: order (`eta` = 'immediate') asc or can use case statement inside order like order case when eta = 'immediate' 1 else 2 end

regex - Rexex Everything after the "." but ignore "|" -

i have 2 variations of text string: 10.09.2016 | 45 min. | swr fernsehen | ut or 07.09.2016 | 57 min. wdr fernsehen i looking end with: swr fernsehen | ut and wdr fernsehen this have tried capturing group: \\.\s(.*) this returns: | swr fernsehen | ut wdr fernsehen i cant work out how " take after "." ignore "|" any ideas? you may use following regular expression: .*\.(?:\s*\|)?\s*(.*) see regex demo the .*\. match , including last . (because * greedy quantifier), (?:\s*\|)? match 1 or 0 sequences of 0+ whitespaces + | , \s* - 0 or more whitespaces , (.*) grab rest group 1, access group contents tool/language features.

android - unable to get data save in database in fragment containing recyclerview -

i'm working on integrating database save & contact information retrieved in fragment contain recyclerview. app directly crashing when started. fatal exception: main process: com.example.admin.navigationdrawer_demo, pid: 15637 java.lang.runtimeexception: unable start activity componentinfo{com.example.admin.navigationdrawer_demo/com.example.admin.navigationdrawer_demo.mainactivity}: java.lang.nullpointerexception: attempt invoke virtual method 'android.database.sqlite.sqlitedatabase android.content.context.openorcreatedatabase(java.lang.string, int, android.database.sqlite.sqlitedatabase$cursorfactory, android.database.databaseerrorhandler)' on null object reference @ android.app.activitythread.performlaunchactivity(activitythread.java:2416) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2476) @ android.app.activitythread.-wrap11(activitythread.java) @ android.app.activitythread$h.handlemessage(activitythread.java:1344) @

java - No Persistence provider found -

i getting following error when using jboss 4.2.3 ga , configured ms-sql.ds file. created entity bean ejb3 , trying access entity bean ejb 2.1 session bean. first of all, wanted check if possible. because when use entitymanager or entitymanagerfactory , entitymanager comming null. instead if use entitymanagerfactory , gives error saying: javax.persistence.persistenceexception: no persistence provider entitymanager named ejbcomponentpu below class public class testbean implements sessionbean { //pass persistence unit entitymanager. @persistencecontext(unitname="ejbcomponentpu") private entitymanager entitymanager; my project folder structure is: src - has packages. inside have meta-inf folder has persistence.xml file thanks help. this persistence.xml file. <?xml version="1.0" encoding="utf-8"?> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://

asp.net - How can I restrict export options in SSRS rdlc file using report properties or writing custom code in report code section? -

i have googled many links handle above requirement using report viewer @ server side only. i want solution @ end only. for ex: while creating\modifying rdlc file, possible restrict export options ? either using report properties or writing custom code in report code section. i have worked on rdl files & not rdlc's don't have idea it. i hope question stands correctly under stack standards ! thanks, edit: not possible duplicate questions because question focusing on how achieve requirement in report without making changes in configuration files @ server. other questions\answers focused on changes in configuration files @ server. it not possible restrict export options using report custom code or report property. closest thing can using report properties hide report components based on globals!renderformat.isinteractive built-in field. however, can customize report viewer web app change exporting options matching needs. report viewer has several pr

java - Compare Same Function Output in different moments -

i've trouble comparison between same function output in different moments. public int get_csv_number_lane() { return csvfile.numberlane(); //this func return number of lane in csv file } in main form want save value , open thread . thread checks if (old saved value != new value){do something} int number_of_lane = get_csv_number_lane(); thread() { if(number_of_lane != get_csv_number_lane()) { println("number of lane changes"); number_of_lane = get_csv_number_lane(); } } i have function return line of csv file. during execution file can change. have thread checks if old value (line of cvs @ start) different new value (line of csv now) , something. problem check: old value new value. my question is, how can fix that, how can store old value , check new one? if familiar executorservice, can use similar type of - scheduledexecutorservice: an executorservice can schedule commands run after given delay, or execute periodica

python - ModelForm won't validate because missing value, but model field has null=True -

i have problem modelform trying assign '' field (it saves fine if provide primary key of product , it's not compulsory field, , won't save if field left blank). take orm it's trying set field '' but: shouldn't '' coerced none , and; why isn't model form trying set field none in first place instead of '' ? models.py class question(models.model): fk_product = models.foreignkey(product, on_delete=models.set_null, null=true, related_name="product_question") forms.py class questionform(forms.modelform): fk_product=forms.choicefield(required=false) class meta: model = question fields = ['fk_product',] the error: cannot assign "''": "question.fk_product" must "product" instance. the view code produces error: questionmodelformset = modelformset_factory(question, form=questionform,

perl - Grep elements from array that exists in output -

is there way use grep find elements exists in specific array? example : my @ips ={"10.20.30","12.13.14","30.40.50"}; $cmd = `netstat -aa | grep -c ips[0] or ips[1] or ips[2] ` print "$cmd"; i want cmd return number of ips (only found in array) exists in output of netstat command. know can use " | " or condition assume not know number of elements in array. your @ips array not contain think contains. think wanted: my @ips = ("10.20.30","12.13.14","30.40.50"); and i'd write as: my @ips = qw(10.20.30 12.13.14 30.40.50); i know can use " | " or condition assume not know number of elements in array i don't think matters @ all. # need quotemeta() escape dots $ip_str = join '|', map { quotemeta $_ } @ips; $ip_re = qr/$ip_str/; # keep of processing possible in perl-space @found = grep { /$ip_str/ } `netstat -aa`; scalar @found; an alternative regex,

wordpress - wp_email is not working if I am including header in function -

i using wordpress function wp_mail() send email. following function working fine $send_email= wp_mail( $to, ' succesfully applied', $message); if including $headers not working. following code $headers=array("from: test <test@gmail.com>"); $send_email= wp_mail( $to, 'succesfully applied', $message, $headers ); you have use: $headers = 'from: name <test@gmail.com>' . "\r\n"; to send mail in wordpress.

ruby on rails - Creating has_one association within the same model -

let consider below model. user{ id:number(primary_key), column1:string, column2:string) now, column1 can string, column2 can either null, or have values column1. column1 , column2 can't same. i.e. column2 foreign key , reference column1. how create has_one relationship these constraints. something like, has_one :master_agreement, :class_name => 'user', :foreign_key => 'column2', :primary_key => 'column1' but above mentioned doesn't work me. to setup self-joining relationship in rails want use belongs_to not has_one key difference belongs_to places foreign key column on model's table - while has_one places on other end. class user < activerecord::base belongs_to :company # references users.company_id has_one :company # references companies.user_id end lets consider system have hierarchy of categories: class category < activerecord::base belongs_to :parent, class_name: 'category' has_man

java - Android options menu does not work? -

i have single activity in project. created options menu 3 items. don't know why not work me. every time select item item id 0. res/menu/m1.xml: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/item1" android:title="one"> </item> <item android:id="@+id/item2" android:title="two"> </item> <item android:id="@+id/item3" android:title="three"> </item> </menu> activity: public class mainactivity extends activity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); } @override public boolean oncreateoptionsmenu(menu menu) { menu.add("1"); menu.add("2");

excel - VBA - Select method failed -

i pretty new vba, sorry if problem obvious more experienced users. tried read couple of answers similar question, , fix problem still facing same problem. my code is: workbooks("xxx.xls").activate ' setting column width workbooks("xxx.xls").worksheets("xxx").cells.select selection.columnwidth = 10 ' filtering xxx funds workbooks("xxx.xls").worksheets("xxx").rows("1:1").select selection.autofilter field:=3, criteria1:="=*xxx*" ' add new sheet , rename sheets.add after:=worksheets(worksheets.count) activesheet.name = "xxx_f" 'copying needed information workbooks("xxx.xls").worksheets("xxx").range("a1:c1").select range(selection, selection.end(xldown)).select selection.copy the error getting "run time error '1004': select method of range class failed" on third line bottom. tried fix adding line (i.e. activating workbook want work fi

c - How to write multiple slave i2c client device driver? -

i trying develop driver embedded board. driver supposed open interface v4l2 , communicate 2 devices using i2c . driver act master. i can't seem understand how i2c_device_id array , i2c_add_driver functions work. read documentation in kernel source won't me on multiple slave clients. do have have 2 seperate probe functions? do have call i2c_add_driver 2 times? if not how going able save 2 different clients able send different bytes different addresses. i pasting code here. tried instantiate 2 i2c_drivers , called i2c_driver_add 2 times , implemented i2c probe seperately. code doesn't work telling me foo1 registered when calls i2c_add_driver second time. i defined 2 blocks under i2c1 in dts file like: &i2c1 { ... foo0: foo0@00 { compatible = "bar,foo0"; reg = <0x00>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_ipu1_2>; clocks = <&clks imx6qdl_clk_cko>

javascript - Unable to render JSON data in react component -

i trying parse json ajax call display table using react datatable component. problem facing when try put data in state variable using set state method, not able access required data. json looks like: { "search": [ { "title": "star wars: episode iv - new hope", "year": "1977", "imdbid": "tt0076759", "type": "movie", "poster": "http://ia.media-imdb.com/images/m/mv5botiymdy2ngqtogjjni00otk4lwfhmdgtyme3m2niyzm0ytvmxkeyxkfqcgdeqxvyntu1ntcwotk@._v1_sx300.jpg" }, { "title": "star wars: episode v - empire strikes back", "year": "1980", "imdbid": "tt0080684", "type": "movie", "poster": "http://ia.media-imdb.com/images/m/mv5bmje2mzqwmtgxn15bml5banbnxkftztcwmdqznjk2oq@@._v1_sx300.jpg" }, { "ti

python - Flask does not take WTForms input -

i'm tring create app flask wtforms. in controller.py have: @mod_private.route('/portfolio/', methods=['get', 'post']) @login_required def portfolio(): print "in portfolio" # read form = createcoinsform(request.form) if request.method == 'post' , form.validate_on_submit(): print form.coins.data #i cannot take value return render_template("private/portfolio.html",form=form) return render_template("private/portfolio.html",form=form) in forms.py: class createcoinsform(form): coins = integerfield('coins', [datarequired('num required'), numberrange(min=0, max=10)]) and template <form method="post" action="/private/portfolio/" accept-charset="utf-8" role="form"> <p> {{ form.coins }}</p> <p><input type=submit value=generate>

java - How to store the matched condition in a variable which can be clicked using selenium -

i have value in excel , checking existence in array of elements in drop down. condition passes, want store , click. tried store in string but, not clickable. tried store in web element failed. kindly help. list<webelement> countrylist = driver.findelements(by.cssselector("ul.ui-multiselect-checkboxes li label[for*='ddlbu'] span")); list<string> all_countrylist = new arraylist<>(); thread.sleep(1000); string selectedcountry = driver.findelement(by.xpath("html/body/div[9]/ul/li[2]/label/span")).gettext(); webelement clickselectedcountry = driver.findelement(by.xpath("html/body/div[9]/ul/li[2]/label/span")); thread.sleep(1000); for(int cui = 0; cui < countrylist.size(); cui++) { all_countrylist.add(countrylist.get(cui).gettext()); if((countrylist.get(cui).gettext()).equalsignorecase(countrysheet.getcell(0, 2).getcontents())) { system.out.println("the country " + (countrysheet.getcell(0, 2).getco

html - How to have different heights between rows for each column? -

i've been using bootstrap grid system , have encountered issue taller div automatically sets height entire row. here problem: http://prntscr.com/cf7cbh this summary of code: <div class="container"> <div class="row"> <div class="row col-lg-4">small div</div> <div class="row col-lg-2">small div</div> </div> <div class="row"> <div class="col-lg-6">tall div</div> </div> </div> or <div class="container"> <div class="row"> <div class="col-lg-4">small div</div> <div class=" col-lg-2">small div</div> <div class="col-lg-6">tall div</div> </div> </div> what can in order have different heights? thank you

javascript - How to insert Google maps into Wordpress -

i want insert google maps wordpress site. because want circles on map can't use plugins insert map me. want use code site maps javascript api should work think. copied code , inserted on page editor can show js , html. browser key, replaced code @ specified place , confirmed domain. src="https://maps.googleapis.com/maps/api/js?key=my_key&signed_in=true&callback=initmap"> but nothing show @ page. no error, no maps, no empty space. now thought reason don't add version. (if no version added automatically experimental version used) nevertheless tried v=3 should release version. src="https://maps.googleapis.com/maps/api/js?v=3key=my_key&signed_in=true&callback=initmap"> and errors noapikeys , invalidversion , missingkeymaperror . why ? version should valid , key well. made many different tutorials , stuff nothing works. did knows change work? here whole code, same on google page. <!doctype html> <html> &

Java JNA with Pascal Performance -

i have algorithm timetable optmization problem written in pascal takes 1 2 hours complete. i want make graphical interface in java algorithm. i research java native access (jna), making dll pascal algorithm , using in java. my problem performance issue method, want ask if performance using jna+pascal slower if used pascal , why.

c# - How to handle SEH exception in the SafeFileHandle finalizer? -

i see on environments, safefilehandle 's finalizer throw sehexception because finalizer trying close closed handle. the issue sehexception must thrown if debugger connected. in other cases, should nothing closehandle api. but without debuggers on clean envs (no antiviruses, vs or that), observing such problem. looks .net or windows bug. i see 1 solution - write custom safefilehandle handle sehexception in dispose. need refactor huge project , replace safefilehandles . is there way unhandledexception handler swallow exception or abort thread causing ( gc finilizer thread)? ideas?

php - Two forms on the same page - errors messages visibles just in first one -

i have 2 steps forms on different modal each. 3 steps on first 1 (#form1) , same on second 1 (#form2). inputs , elements different names , id . links validation pages (one step)are working. problem errors messages don't appear on second form. made verification error containers id (one id form too). idea why ? try resolve coding array2 of errors form2 no error messages visible. $(".step1").click(function() { var data = { 'data1' : jquery("input[name=data1]:checked", "#forml").val(), 'data2' : jquery('#data2').val(), 'data3' : jquery('#data3').val(), }; jquery.ajax({ url : '/mysite/parsers/check.php', method : 'post', type : 'post', data : data, success : function(data){ if (data != 'passed') { jquery('#list_errors').html(data); } if (data.re

c# - HttpRequest.GetResponse() taking too much time -

i have outlook addin application i'm connecting salesforce. i'm trying request data sf api returns result in less 1 second, code takes 5-15 seconds complete. i have tried set proxy null. here code: system.net.servicepointmanager.securityprotocol = system.net.securityprotocoltype.tls12; system.net.webrequest req = system.net.webrequest.create(uri); if (includecustomheader == true) { req.headers.add("authorization: oauth " + servicemanager.token.access_token); req.headers.add("x-prettyprint:1"); req.contenttype = "application/json"; } else { req.contenttype = "application/x-www-form-urlencoded"; } req.method = "post"; req.proxy = null; byte[] data = system.text.encoding.ascii.getbytes(payload); req.contentlength = data.length; using (var responsestream = req.getrequeststream()) { responsestream.write(data, 0, data.length);

Max date from multiple tables -

i new tableau. have found several answers here can't make them apply. may don't know enough yet. want max date show 1 time. have tried {fixed: max([date])} keeps giving me max date of entire table, not project title. have tried solution tableau community called max group_am , no avail. here screenshot of real data , results. created dummy sheet see if help. i've been working on off , on (mostly on)for 3 weeks. it's work , i'm stumped. format of tableau report . cannot attach workbook. here's dummy data name (name table task status (project closeout table) project title (project table) project sub code (project table) note (note table) insert date( note table) cool, dennis incomplete recreate support team tan-21622 project opened jan. 11, 2014 kartwright, laura incomplete accounts receivable tan-64500 project closed oct. 12, 2012 cool, dennis incomplete recreate support team tan-21622-4 project reopened april 1, 201

android - FingerprintManagerCompat method had issues with Samsung devices -

problem java.lang.securityexception: permission denial: getcurrentuser() pid=#####, uid=##### requires android.permission.interact_across_users @ android.os.parcel.readexception(parcel.java:1620) @ android.os.parcel.readexception(parcel.java:1573) @ android.hardware.fingerprint.ifingerprintservice$stub$proxy.hasenrolledfingerprints(ifingerprintservice.java:503) @ android.hardware.fingerprint.fingerprintmanager.hasenrolledfingerprints(fingerprintmanager.java:768) @ android.support.v4.hardware.fingerprint.fingerprintmanagercompatapi23.hasenrolledfingerprints(fingerprintmanagercompatapi23.java:39) @ android.support.v4.hardware.fingerprint.fingerprintmanagercompat$api23fingerprintmanagercompatimpl.hasenrolledfingerprints(fingerprintmanagercompat.java:239) @ android.support.v4.hardware.fingerprint.fingerprintmanagercompat.hasenrolledfingerprints(fingerprintmanagercompat.java:66) this issue has occurred on samsung devices: galaxy s6 active (marinelteatt

reporting services - Converting an Excel Formula into SQL Report Builder Expression -

i have been given excel formula , need work in ssrs report builder 3.0 expression, original excel formula: if(a01>12,round(a01/24,0),1) instead of cell a01 value field in ssrs called [diff] essentially expression round number of hours number of days hours aren't inputted in 24's. thanks try: =iif(fields!diff.value>12,round(fields!diff.value/24.0),1) let me know if helps.

php - Nginx $http_x_requested_with is empty -

why nginx doesn't return $http_x_requested_with when im making ajax request ? did need module compiled nginx make work ? how can detect otherwise if request ajax in php-fpm ? fastcgi_params: fastcgi_param script_filename $document_root$fastcgi_script_name; fastcgi_param query_string $query_string; fastcgi_param request_method $request_method; fastcgi_param content_type $content_type; fastcgi_param content_length $content_length; fastcgi_param script_name $fastcgi_script_name; fastcgi_param request_uri $request_uri; fastcgi_param document_uri $document_uri; fastcgi_param document_root $document_root; fastcgi_param server_protocol $server_protocol; fastcgi_param request_scheme $scheme; fastcgi_param https $https if_not_empty; fastcgi_param gateway_interface cgi/1.1; fastcgi_param server_software nginx/$nginx_version; fastcgi_param remote_addr $remote_addr; fastcgi_param remote

java - How to read http request properly? -

how read http request using inputstream? used read this: inputstream in = address.openstream(); bufferedreader reader = new bufferedreader(new inputstreamreader(in)); stringbuilder result = new stringbuilder(); string line; while((line = reader.readline()) != null) { result.append(line); } system.out.println(result.tostring()); but reader.readline() blocked, because there no guarantee null line reached. of course can read content-length header , read request in loop: for (int = 0; < contentlength; i++) { int = br.read(); body.append((char) a); } but if content-length set big(i guess set manually purpose), br.read() blocked. try read bytes directly inputstream this: byte[] bytes = getbytes(is); public static byte[] getbytes(inputstream is) throws ioexception { int len; int size = 1024; byte[] buf; if (is instanceof bytearrayinputstream) { size = is.available();

linux - Replacing multiple fdatasync() calls with a single sync() call -

i have application thousands of files being updated. periodically application needs commit changes disk, , calling fdatasync() , takes significant amount of time (minutes). [reducing number of files being written not option me.] at same time, noticed if ran sync command command line, return faster. documentation seems guarantee pending writes reached disk. the question is: sync() system call give same (or stronger) durability guarantees multiple fdatasync() calls? if not, there way fsync() multiple file descriptors in 1 call?

Artifactory Old Versions -

so i'd quite mirror entire repo seems that's no easy (as evidenced how use artifactory mirror linux distributions? ) one question have, let's have remote repo setup in artifactory, , have set never expire cache. happens when package deleted source repo in artifactory's cache? can still install via apt/yum or whatever? example of ubuntu ppas, seem delete older versions when superceded, i'd use artifactory able version freeze packages. in general, once artifact has been cached (i.e downloaded @ least once), should not concerned state of artifact in upstream repository. why artifactory excels in situations cannot depend on own in-house repository. but full answer bit more complicated that. artifactory uses call "expirable resources". these files periodically "expire" according period defined in "metadata retrieval cache period" parameter of remote repository - see cache settings section discusses parameter among other

php - Check mysqli Insert Query excuted ok and display message and send email -

i creating registration form project, nothing secure or advanced, still new php etc. i insert data needed login table , customer tbl, data inserts fine. cant code check worked , fire off email , display message user. i have tried using value retrieved database there user registered successfuly. if($userid != null) { $msg1 = "thank you! registered, please check email verification link verify new account! "; $col1 = "green"; //require_once "mail.php"; require_once "inc/email.php"; } i have tried if($query) { $msg1 = "thank you! registered, please check email verification link verify new account! "; $col1 = "green"; //require_once "mail.php"; require_once "inc/email.php"; } thanks, edit - here code, <?php in

vsts - Where are TFS 2015 custom build tasks stored? -

Image
we use tfs 2015 on premise. tfs 2015 custom build tasks stored? or how can download existing build task? i know can download build tasks github. not looking for. they're stored internally in database. easiest way "extract them" install local agent, create build definition targets agent , add task want. queue build , agent download task , store them in subfolder under agent's working directory called "tasks". grab contents there. you'll able push task using tfx build tasks upload command. if you're downloading tasks vsts installation onpremise tfs server, may need access specific task version, service may ahead , may have other dependencies have not been deployed tfs server. another thing note when downloading task vsts, may have preview flag set true in it's task.json , these tasks can uploaded, invisible in tfs, before uploading them should remove reference "preview": true task.json completely.

apache2 - Bitnami Django Stack - not importing modules -

i tried deploying django application on windows machine using bitnami's django stack. however, when try access project via localhost/myapp/ , error stating can't load modules/python libraries. checked via pip , have these modules installed. seems error applies modules/python libraries. how solve this? thanks! when install bitnami django stack, ask changing association setting python following message: "this option lets change windows properties associate python files new python going installed. if have own python may want disable feature." if decided use python instead of 1 installed stack, have must ensure have installed python in system , modules , libraries loaded, otherwise won't able use of them.

Using Powershell to build a list of computer model numbers in our Domain? -

as title states, trying determine every computer model used in our domain. new company, , have been placed in charge of producing new encryption solution end point devices. knowing computer models in our domain, able determine machines have tpm 1.2 chip, , ones don't (almost 15k devices). not need pretty, i'm open ideas. more or less want list (text or csv sorting purposes) can quantify models , research. here's have far: get-adcomputer -filter {name -like 'ml*'} | select -expand name | foreach { if (test-connection $_ -count 1 -quiet) {get-wmiobject -class win32_computersystem -computername $_} select-object -property model | export-csv "c:\scripts\models.csv"} else { add-content -value $_ c:\scripts\not.responding.txt} i know there problems this. right i'm having trouble querying ad , passing computer name variable only. because of this, ping test fails, , exports failed text file. failed text file indicates variable in

javascript - Knex resolving empty set after insert -

i'm trying setup basic database connection in node using postgresql , knex , i'm having trouble getting seems simple insert work. i'm basing of code on example code in knex github repo. the issue seems first insert (where add admin user) resolving empty set of rows (not sure since documentation doesn't contain info on rows or row sets far can find). here code: const knex = require("knex")({ client: "postgres", connection: { host : "127.0.0.1", user : "postgres", password : "my password goes here", database : "issue-tracker", charset : "utf8" } }); knex.schema .droptableifexists("tickets") .droptableifexists("users") .createtable("users", createusertable) .createtable("tickets", createtickettable) .then(() => addtestdata()) .then(() => console.log("done")) .catch((e) => console.log(e))

image - How to plot a picture in R and change its background color -

my goal plot r colored map of human body, , use here simplified example of smiley. see 2 options stuck both: 1) extracting different areas of body using photoshop, , plotting them on top of each other: r link = "http://images.clipartpanda.com/clipart-smiley-face-9czenapce.jpeg" download.file(link,basename(link)) jj <- readjpeg("clipart-smiley-face-9czenapce.jpeg",native=true) plot(1, type="n", axes=f, xlab="", ylab="") rasterimage(jj,0.7,0.6,1,1) i way like rasterimage(jj,0.7,0.6,1,1, col="yellow") but rasterimage works opaque pictures :/ 2) defining polygon interactively clicking on picture, save polygon plot later on top of original pic. way create map of human body. maps countries , rely on available geographical data. is there way "draw" in r lines , define polygons in easy way?

html - Hide/Show element if IE - Javascript -

i working script pops alert if user or isn't using ie. instead of this, i'd show or hide div element in page. i have tried unsuccessfully here: http://fiddle.jshell.net/shhv1lx3/2/ working alert demo here: http://fiddle.jshell.net/shhv1lx3/3/ function getieversion() { var sagent = window.navigator.useragent; var idx = sagent.indexof("msie"); // if ie, return version number. if (idx > 0) return parseint(sagent.substring(idx+ 5, sagent.indexof(".", idx))); // if ie 11 updated user agent string. else if (!!navigator.useragent.match(/trident\/7\./)) return 11; else return 0; //it not ie } var e = document.getelementbyid(ie); var e2 = document.getelementbyid(chrome); if (getieversion() > 0) alert("this ie " + getieversion()); e.style.display = 'block'; e2.style.display = 'none'; else alert("this not ie."); e.style.display = '

android - Unwanted whitespace around Floating Action Button -

Image
what's happening here? looks fab being greedy (left screenshot) , acts when turn on "show layout boundaries" in debug menu (right screenshot). activity_main.xml : <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" tools:context="com.registrationmax.recordbook.mainactivity"> <android.support.design.widget.appbarlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/appbar" android:them

sum vs np.nansum weirdness while summing columns with same name on a pandas dataframe - python -

taking inspiration discussion here on ( merge columns within dataframe have same name ), tried method suggested and, while works while using function sum() doesn't when using np.nansum : import pandas pd import numpy np df = pd.dataframe(np.random.rand(100,4), columns=['a', 'a','b','b'], index=pd.date_range('2011-1-1', periods=100)) print(df.head(3)) sum() case: print(df.groupby(df.columns, axis=1).apply(sum, axis=1).head(3)) b 2011-01-01 1.328933 1.678469 2011-01-02 1.878389 1.343327 2011-01-03 0.964278 1.302857 np.nansum() case: print(df.groupby(df.columns, axis=1).apply(np.nansum, axis=1).head(3)) [1.32893299939, 1.87838886222, 0.964278430632,... b [1.67846885234, 1.34332662587, 1.30285727348, ... dtype: object any idea why? the issue np.nansum converts input numpy array, loses column information ( sum doesn't this). result, groupby doesn't column information