Posts

Showing posts from April, 2014

typescript - Angular 4 input range filter Json -

hello creating search pipe in angular4 filter company team size json data range input 0 100. range filter not working, new typescript , angular4, please did basic code not getting logic. the range pipe - @pipe({ name: 'range' }) export class checkboxpipe implements pipetransform { transform(value: any, args?: any): { console.log('args', args); return args ? value.filter(sal => { return sal.team }) : value; } } range input box - 0 <input type="range" min="0" max="100" [(ngmodel)]="team" name="team" /> 100 list filter - <div *ngfor="let joblist of joblist | range: team"> {{joblist.team}} </div> change transform() this, transform(value: any, team?: any): { return (team || team === 0) ? value.filter(sal => { return sal.team }) : value; } see if fixed issue. update: not sure on guess ngmode...

Does Sitecore 8 keep role based security -

i used sitecore actively version 5 through 7, haven't had work on 2 years now. colleague of mine asking security because had heard assertion item permissions must assigned on user user basis , there no concept of role. can definitively answer experience , documentation sitecore version 7 , below both allowed , highly encouraged conforming accepted best practice of assigning access based on role/group , cannot imagine world have gone away in version 8, have no documentation or actual experience version 8 definitively still supports role based security. there working version 8 can confirm? yes sitecore 8 supports role based security , practice define security based on roles instead of users.

gradle - How to stop buildSrc from automatically applying groovy-all jar as a dependency? -

Image
i have gradle project set up, has buildsrc module inside of it. inside buildsrc , in build.gradle , have following: dependencies { compile 'org.codehaus.groovy:groovy-all:2.4.12' ... } when trying build project, receive following error message: 2:07:13 pm: executing external task 'build --stacktrace'... :buildsrc:compilejava no-source :buildsrc:compilegroovy failed failure: build failed exception. * went wrong: execution failed task ':buildsrc:compilegroovy'. > java.lang.exceptionininitializererror (no error message) in stacktrace, see following error: caused by: groovy.lang.groovyruntimeexception: conflicting module versions. module [groovy-all loaded in version 2.4.11 , trying load version 2.4.12 ... 15 more so, when @ project structure, see groovy-all-2.4.11.jar automatically being loaded buildsrc module. if remove compile dependency groovy in build.gradle , work, there way force module use version of groovy want? ...

r - convert long df to wide df with duplicates/triplicates -

consider have df, df <- data.frame(x=c(1:12), y=rep(0:2, 4), z=rep(letters[1:2], 6)) df$y <- as.factor(df$y) df <- arrange(df, y, z) df x y z 1 1 0 2 7 0 3 4 0 b 4 10 0 b 5 5 1 6 11 1 7 2 1 b 8 8 1 b 9 3 2 10 9 2 11 6 2 b 12 12 2 b how can df_wide this: z 0 1 2 1 5 3 7 11 9 b 4 2 6 b 10 8 12 do.call(cbind, lapply(split(df, df$y), function(a) setnames(object = data.frame(a$x, row.names = paste0(as.character(a$z), 1:nrow(a))), nm = a$y[1]))) # 0 1 2 #a1 1 5 3 #a2 7 11 9 #b3 4 2 6 #b4 10 8 12

c# - CreateMap for IEnumerable -

i have automapper profile , while working senior developer gave me pointer create map ienumerable, got coded stuck. i tried this createmap<ienumerable<businessinfo>, ienumerable<adminviewmodel.account>>().forallmembers(i => i.ignore()); createmap<ienumerable<businessinfo>, ienumerable<adminviewmodel.account>>() .formember(i => i.company, opt => opt.mapfrom(p => p.company)) but company errored because doesn't contain definition company... think missing unsure is. why mapping ienumerable<type> ? reason why doesn't contain definition of company because it's collection. you of mapping businessinfo , adminviewmodel.account . mapper.createmap<businessinfo, adminviewmodel.account>()... // usual or w/e custom mapping want. then like... var adminaccountviewmodel = mapper.map<ienumerable<businessinfo>, ienumerable<adminviewmodel.account>>(businessinfo);

SSL connection error with urllib2 and httplib in jython -

i trying ssl connection urllib2 , httplib in jython. trows error _socket.sslerror: [errno 1] illegal state exception here code data={event.getitem().getactioncommand()} headers= {"content-type": "application/x-www-form-urlencoded", "accept": "text/plain"} url="requestb.in" req=httplib.httpsconnection(url) req.request("post", "/yaw83yya", data, headers) response = conn.getresponse() print response i have tried urllib got same error

wordpress - WooCommerce and letters in Postcode -

we have wordpress site using woocommerce. canadian customers wanted place order wc doesn't allow letters in post code. canadian post code may r2c or a1a rather standard ##### or #####-####. how can set woocommerce allows post/zip codes letters rather numbers?

java - Exception handling with Retrofit2 -

i learning how use retrofit2 in trouble. is way catch response object on retrofit2.retrofit , throw exception if http response code out of range 2xx? i implementing jax-rs rest services rest methods call rest apis collect information , handle http error on jax-rs side: public class hellorest { @get("/ping") public string ping() throws ioexception { helloservice client = helloservicebuilder.getinstance(); string response = client.sayhello().execute().body(); logger.info(response); } @get ("echo/{msg}") public string echo(@pathparam("msg") string msg) throws ioexception { helloservice client = helloservicebuilder.getinstance(); string response = client.echo(msg).execute().body(); logger.info(response); return response; } } first, have realized execute() method throws ioexception had add rest methods signatures. okay, can handle jax-rs. but best way handle erro...

python 3.x - Different score every time I run sklearn model with random_state set -

i'm trying determine why every time rerun model obtain different score. i've defined: # numpy seed (don't know if needed, figured couldn't hurt) np.random.seed(42) # tried re-seeding every time ran `cross_val_predict()` block, didn't work either # cross-validator random_state set cv5 = kfold(n_splits=5, random_state=42, shuffle=true) # scoring rmse of natural logs (to match kaggle competition i'm trying) def custom_scorer(actual, predicted): actual = np.log1p(actual) predicted = np.log1p(predicted) return np.sqrt(np.sum(np.square(actual-predicted))/len(actual)) then ran once cv=cv5 : # running gridsearchcv rf_test = randomforestregressor(n_jobs = -1) params = {'max_depth': [20,30,40], 'n_estimators': [500], 'max_features': [100,140,160]} gscv = gridsearchcv(estimator=rf_test, param_grid=params, cv=cv5, n_jobs=-1, verbose=1) gscv.fit(xtrain,ytrain) print(gscv.best_estimator_) after running gscv.best_estima...

multithreading - What's the best language that can make two processes start and run in exact concurrence? -

do note both have start @ same time , same priorities. doesnt mean need end @ same time too. as our friend eugene sh. commented, no language can force it, languages may simulate quite well. witch language choose depend on kind of system you're planing develop. example, if want develop desktop software, c# , java options. if want develop system microcontroler, can use ladder or labview.

python - ImportError: No module named 'Crypto' on a Mac -

here situation: mymachine:systemtest user$ pip3 install --upgrade pycrypto requirement up-to-date: pycrypto in /usr/local/lib/python3.6/site-packages mymachine:systemtest user$ echo $pythonpath /users/user/private/space/server:/users/user/private/space/client:/usr/local/lib/python3.6/site-packages mymachine:systemtest user$ python3 -c "import crypto" traceback (most recent call last): file: "<string>", line 1, in <module> modulenotfounderror: no module named 'crypto' is special mac thing? how make sure python3 uses crypto module? with -m switch, should run python3 -m crypto . no need import. or run python3 -c "import crypto"

node.js - Mocha tests not running in root directory -

i have following start script in node: "test": "mocha **/*.test.js" this tests files in subdirectories, not files in root, missing here? have tried using absolute paths? try <root folder name>/**/*/.test.js

ChartJS does not display when using local Chart.js file -

i having problem getting chart.js display chart when using chart.min.js file installed result of using: npm install chart.js --save (however, if use cdn supplied file - chart display) to avoid putting paths code, copied chart.min.js file install directory: ./node_modules/chart_js/dist/chart.min.js directory web page is. right file copy? anyways, when reload app browser, blank display. there no error messages @ all. however, if instead use cdn supplied file: <script src="https://cdnjs.cloudflare.com/ajax/libs/chart.js/0.2.0/chart.min.js" type="text/javascript"></script> everything works. chart displays. here html file: <html> <head> <meta charset="utf-8"/> <title>chart.js demo</title> <script src="chart.min.js" </script> </head> <body> <h1>chart.js sample</h1> <canvas id="countries" width="600" height="400...

sql - How to generate a date range + count earlier dates from another table in PostgreSQL? -

i have following table: links : created_at active 2017-08-12 15:46:01 false 2017-08-13 15:46:01 true 2017-08-14 15:46:01 true 2017-08-15 15:46:01 false when given date range, have extract time series tells me how many active links created on date equal or smaller current (rolling) date. output (for date range 2017-08-12 - 2017-08-17): day count 2017-08-12 0 (there 0 active links created on 2017-08-12 , earlier) 2017-08-13 1 (there 1 active link created on 2017-08-13 , earlier) 2017-08-14 2 (there 2 active links created on 2017-08-14 , earlier) 2017-08-15 2 ... 2017-08-16 2 2017-08-17 2 i came following query generating dates: select date_trunc('day', dd):: date generate_series ( '2017-08-12'::timestamp , '2017-08-17'::timestamp , '1 day'::interval) dd but rolling counts confuse me , unsure how continue. can solved window function? this should fastest: select day::date , ...

linux - Backing tempfs with disk instead of RAM/SWAP -

i want limit size of folder, process cannot write more x mb data folder. looks not possible in linux folders can done on tempfs filesystem . so can create tempfs filesystem , set size limit on it. but problem tempfs backed ram (and swap) not acceptable case run out of disk space. can tempfs existing folder on disk? i want create around 50 such directories , set cap of 500mb on each of those. edit 1: following command do? sudo mount -t tmpfs /tmp /tmp/mnt/aks2 i guess mounts folder /tmp mountpoint /tmp/mnt/aks2 . mean /tmp/mnt/aks2 mount point backed /tmp folder instead of ram? if yes why -t tmpfs in command? no. create filesystem in file of maximum size desired , loopmount instead. e.g.: dd if=/dev/zero of=image.img bs=1mib count=500 mke2fs image.img sudo mount image.img /mnt

ionic framework - Communication between app.component.ts and another component angular 2 -

i beginner in angular 2 since want move app angular 1 more efficient. , don't understand how make communication between 2 components available. case think special because want send data app.component.ts home.ts . these 2 classes not in same directory . here architecture of app : >src > app - app.component.ts //where data generated - 2 lateral menus - app.html //html associated app.component.ts - app.module.ts - app.scss > pages > home - home.html //home page - home.ts - home.scss first in file app.html have button : <ion-menu [content]="content" side="left" id="menuparameter"> <ion-header> <ion-toolbar color="default"> <ion-title>menu1</ion-title> </ion-toolbar> </ion-header> <ion-content> <ion-list> <...

python - subprocess.call unexpected indent -

i developing python addon kodi, , i'm new python. so, have issuse script. i want, when mode none call child = subprocess.call(["c:/kreiraj_listu.exe", "-k"]) but "error contents: ('unexpected indent', ('c:\users\user\appdata\roaming\kodi\addons\plugin.video.example\main.py', 44, 1, '\tsubprocess.call(["c:/kreiraj_listu.exe", "-k"])\n'))" here code: if mode none: child = subprocess.call(["c:/kreiraj_listu.exe", "-k"]) url = build_url({'mode': 'folder', 'foldername': 'folder one'}) li = xbmcgui.listitem('folder one', iconimage='defaultfolder.png') xbmcplugin.adddirectoryitem(handle=addon_handle, url=url, listitem=li, isfolder=true) xbmcplugin.endofdirectory(addon_handle) if put "child" before "if" script works go loop. if put "child" in "if...

Android marshmallow 6.0, ADB and SD Low Space Available -

i'm noob here, did partitioning of sd internal using adb shell success , have migrated , restarted phone. however, i'm having issue of low space availbe whenever try download new app or game. the partitioning going can see building in new partiton overall space available smaller expected, actually, didn't change same before partitioning. please me in matter i'm noob android , don't want go other company 😁 more info: phone: samsung grand prime plus firmware: marshmallow 6.0.1 internal: 8gb sd: 64gb sandisk ultra

WooCommerce associate 'alternate widget' products to membership plan(s) -

i have installation of woocommerce out-of-box product types dont suit our needs. trying 'loosely' build subscription site in reviewing others plugins etc..none seemed fit our requirements and/or didnt feel 'solid'. flow: user purchase membership plan (woo membership plan product) , gain access page list out available 'widgets products' based on purchased plan. on page test active memberships etc...and show appropriate widget products. 'widget products' = non-woo commerce product type (ie. ppt, vimeo, yt, other asset can put on web page. etc..) currently relationship between purchased membership plan , widget products based on string categories associated widget products via acf pro form fields , string tested each membership plan on newly accessed page. issue: cateogry , membership plan string tests work... not maintainable admin pov, question. ideal: find memberships user active in , return widget products related membership, i.e. no strin...

ibm mq - 1 way SSL with MQIPT and tomcat docker -

i trying connect mqipt having 1 way ssl enabled. below spring configuration <bean id="connectionfactory" class="org.springframework.jms.connection.singleconnectionfactory"> <property name="targetconnectionfactory"> <ref bean="mqqueueconnectionfactory" /> </property> </bean> <bean id="mqqueueconnectionfactory" class="com.ibm.mq.jms.mqqueueconnectionfactory"> <property name="hostname" value="xx.xx.xx.xx" /> <property name="port" value="xxxx" /> <property name="queuemanager" value="qm" /> <property name="transporttype" value="1" /> <property name="channel" value="ssl.chnl" /> <property name="sslciphersuite" value="ssl_rsa_with_aes_256_cbc_sha"/>...

git - Cannot commit after reverting one file from previous commit -

Image
what did: i had file wrongly deleted in previous commit. in "version control" -> "log" clicked "revert selected changes" on file in changelist on right. android studio showed "patch applied" after nothing happened — didn't appear in changelist. how commit revert? android studio's "revert" not equivalent git revert . behaves svn revert discarding changes before svn commit , or git checkout -- filepath discarding changes before git add . it seems android studio not have git revert button. in command line instead. if previous commit touches few files, assuming commit a, git checkout a^ -- filepath "revert" 1 file , add , commit.

http - Intercepting Network Requests in Python -

i found this python library dealing http , wondering if there way of intercepting requests made on webpage using python. for example, if wanted grab network request matched string , requests content, so?

android activity to libGdx screen -

how possible move android activity libgdx screen . implementing facebook api in libgdx game. whenever press facebook button in game, takes me android activity logs me facebook , displays information using interface in core project. public void loginfacebook() { handler.post(new runnable() { @override public void run() { intent intent = new intent(context, loginactivity.class); context.startactivity(intent); } }); } now i'm wondering how achieve same thing reversed. how can move results page (android) mainmenu screen (libgdx core)? any screen of libgdx nothing more type of view of androidlauncher activity. when open other activity using interface activity having libgdx view paused , fold in background. you can use intent move libgdx activity activity. intent intent = new intent(this, androidlauncher.class); startactivity(intent); or possibly finish() can go previous...

Android: permission denied for window type 2038 using TYPE_APPLICATION_OVERLAY -

i trying create view above other applications: windowmanager.layoutparams paramsdirectorview = new windowmanager.layoutparams( windowmanager.layoutparams.wrap_content, windowmanager.layoutparams.wrap_content, windowmanager.layoutparams.type_application_overlay, windowmanager.layoutparams.flag_not_focusable, pixelformat.translucent); i have looked in other responses , found following things "drawing on applications": i have android.permission.system_alert_window in manifest i doing settings.candrawoverlays(this) check which comes true. i have done located here permission denied window type i still getting "-- permission denied window type 2038" error. of using type_phone , works, deprecated , says use type_application_overlay. can 1 follow on type_phone answer not resolution "patch work" solution deprecated in android o. i running on android 7.1.2 android.view.windowmanager$badtokenexception: un...

How do I extract information from a JSON object in Javascript? -

this question has answer here: how return response asynchronous call? 21 answers i want city given api , display it. output on console undefined.this have far: $.getjson("http://ip-api.com/json", function(data1){ city = data1.city; $("#city").html(city); }); console.log(city); how can successfully? $.getjson("http://ip-api.com/json", function(data1) { city = data1.city; $("#city").html(city); console.log(city); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="city"></div>

sql server - Is there a way to specify the database when defining Tedious configuration (Node.js)? -

according tedious getting started guide , connecting database done this: var connection = require('tedious').connection; var config = { username: 'test', password: 'test', server: '192.168.1.210', // if you're on windows azure, need this: options: {encrypt: true} }; var connection = new connection(config); connection.on('connect', function(err) { // if no error, go... executestatement(); } ); once connection has been established, query can performed this: var request = require('tedious').request; function executestatement() { request = new request("select 42, 'hello world'", function(err, rowcount) { if (err) { console.log(err); } else { console.log(rowcount + ' rows'); } }); request.on('row', function(columns) { columns.foreach(function(...

php - my code please help syntax error, unexpected '=>' (T_DOUBLE_ARROW) -

this question has answer here: php parse/syntax errors; , how solve them? 11 answers my code please have tried several times , error in $data =('nidn' => $this->input->post('nidn', true)); $pswd=('pswd' => $this->input->post('pswd', true)) ` public function cek_login() { $data =('nidn' => $this->input->post('nidn', true)); $pswd=('pswd' => $this->input->post('pswd', true)); $this->load->model('level_user'); // load model_user $hasil = $this->level_user->cek_user($data,$pswd); ` if assigning variable array, should add text array before brackets: $data = array('nidn' => $this->input->post('nidn', true)); or, $data = ['nidn' =...

asp.net - After web deploy from visual studio, do I need to run dotnet ef update database to perform migration? -

sorry if question bit long. couldn't figure out how phrase other way. i deployed application google cloud via vs 2017 web deploy. , in settings tabs there section can specify database connection string apply database migration. please let me know if wrong here though destination database migration applied to. so have set same connection string database connection string runtime , clicked on deploy. everything seems deployed without error messages. when launch application came error message described in link: asp-net-core-deployment-to-iis-error-development-environment-should-not-be-enab so followed instructions , when browse page, error message saying that applying existing migrations applicationdbcontext may resolve issue and see 'apply migrations ' blue button. my question , have run migrations in command line after web deployment normally? or did go wrong preparation of deployment, configuration or else? thanks! my question is, h...

pyspark - How to set spark.sql.pivotMaxValues in python? -

maybe question related how set pivotmaxvalues in pyspark? . haven't find clear answer this. so, how change spark.sql.pivotmaxvalues in code or configuration file? can find configuration file?

How do I delete/clean Kafka queued messages without deleting Topic -

is there way delete queue messages without deleting kafka topics? want delete queue messages when activating consumer. i know there several ways like: resetting retention time $ ./bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000 deleting kafka files $ rm -rf /data/kafka-logs/<topic/partition_name> in 0.11 or higher can run bin/kafka-delete-records.sh command mark messages deletion. https://github.com/apache/kafka/blob/trunk/bin/kafka-delete-records.sh for example publish 100 messages seq 100 | ./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic mytest then delete 90 of 100 messages new kafka-delete-records.sh command line tool ./bin/kafka-delete-records.sh --bootstrap-server localhost:9092 --offset-json-file ./offsetfile.json where offsetfile.json contains {"partitions": [{"topic": “mytest", "partition": 0, "offset": 90}], ...

validate all object value with the same validation function php laravel -

Image
above result of dd() 1 of object , right did is //$car object variable $car->corporate_id = some_function($car->corporate_id); $car->corporate_name = some_function($car->corporate_name); $car->member_id = some_function($car->member_id); instead doing above ways , how can achieve $data = some_function($car); //it go through $car properties , run same validation can tell me how achieve this? the function body this if(!is_object($car)) return 'function expect car object'; if(isset($car->corporate_id)) $car->corporate_id = some_other_function($car->corporate_id); if(isset($car->corporate_name)) $car->corporate_id = some_other_function($car->corporate_name); ........... return $car;

Access Denied in excel VBA when using web.send -

i checking stock price in excel macro using following code. however, received during "web.send" run-time error '-2147024891 (80070005)': access denied since fine until yesterday , there no other information cannot figure out reason. can check this? thank much. sub checkindex() sheets("temp").range("a:a").clear url = "https://www.google.com.hk/finance?q=indexhangseng:hsi" set web = createobject("microsoft.xmlhttp") web.open "get", url, false web.send webdata = split(web.responsetext, vblf) j = 0 ubound(webdata) thisworkbook.worksheets("temp").cells(j + 1, 1).numberformatlocal = "@" thisworkbook.worksheets("temp").cells(j + 1, 1).value = webdata(j) next j end sub

r - Rstan or rstanarm code for Bayesian GLM model -

i new bayesian modelling , r. looking predict next rows value of "amount" column of dataset given below using rstan or rstanarm in bayesian glm. highly appreciated , augment knowledge in rstan. data: library(data.table) df <- fread("year lag amount yearno 2001 12 187572 1 2001 24 331364 1 2001 36 354886 1 2001 48 361970 1 2001 60 365251 1 2001 72 366729 1 2001 84 368047 1 2001 96 368775 1 2001 108 369457 1 2001 120 369709 1 2001 132 370048 1 2001 144 370109 1 2011 156 370152 1 ")

android - Google Play App Signing + Eclipse + Google Play Services -

i accidentally enrolled eclipse game google play app signing. somehow thought mandatory, know isn't. google doesn't allow step enrollment i'm stuck it. suggestions , tutorials found on internet related android studio. can't find how use certificates eclipse. now read once enroll can't sign anymore original key. reasons, still works in case. can export game eclipse , sign original key, upload google play developer console , gets accepted. works fine. can publish update. but, 1 thing seems not work google play services. users can't sign in. now strange thing apk export eclipse working 100% when install manually on device. leaderboard working. once upload , publish same apk , download play store, leaderboard (and google play services) not working anymore. guess because google automatically re-signs new certificates google play app signing thing. think have 2 sha-1 certificates. 1 local machine , 1 google play app signing. , have upload certificate sha-1. ...

mysql - Invalid update SQL in DataGrip -

Image
i wrote mysql update sql on datagrip update wrong data: update common_express_track set step = 135 express_id in (33, 235, 237) , business_source = 0 , step = 0 , content = 'out delivery' order content; i executed it, console showed "61 rows affected in 7s 530ms" , executed query statement make sure data has been modified. select * common_express_track express_id in (33, 235, 237) , business_source = 0 , step = 0 , content = 'out delivery' order content; then console shows "0 rows retrieved in 3s 751ms". but when restart datagrip , execute query statement again, got 61 rows, means update statement didn't work, don't know why, because cache or something? how solve problem? when execute queries should use autocommit then clicking on table in database view see refresh try use autocommit query , refresh when browse data. should help.

Wait for authentication response from server before executing any Angularjs app -

i have angularjs app (bootstrapped using ng-admin) contained within admin backend initial login handled via ldap. when angular app loads first time, needs make api call (using restangular) server fetch token plus derive separate api url use. once token returned, it's stored in localstorage , passed subsequent api calls. because i'm not logging in in separate view, can't usual checking (via request interceptor or otherwise) see if token present , redirect login page if not. what i've tried checking in request interceptor see if token present in localstorage, , if not, make api call , set it. however, because it's async, additional calls continue made , fail. i've tried checking in run method. request interceptor: restangularprovider.addfullrequestinterceptor(function(element, operation, what, url, headers, params) { if (!localstorage.accesstoken) { // no access token, stop additional requests until access token exists? return false; ...

excel - Create Sub array variable name sheet -

i have 1 array sheet names called sheetnames , want generate sub array of returns true @ condition (if). try have loop cell value onto different sheets, evaluating condition cell.value = "s" . when checks first d column (z = 4) want make same check (if condition) columns d dr @ same row. i need similar result if use formula @ diary!c7 = if (element!d6 = "s",concatenate (element!b1, ", "), ""), if (element1!d6 = "s",concatenate (element1!b1, ", "), ""), .... if (element!e6 = "s",concatenate (element!b1, ", "), ""), if (element1!e6 = "s",concatenate (element1!b1, ", "), "") .... ) where element sheet name taken array sheet names condition (code s or code). sheetnames 1 array book sheets , fsheet (filtered sheet condition) array filtered (with condition if). when can populate fsheet array each sheet test condition must concatenate it...

python - Can I combine multiple for loops? -

i have following code, can please me make more elegant: for hex in numdb: print_file1(hex, output_file1) hex in numx1: print_file1(hex, output_file2) hex in numac: print_file2(hex, output_file2)

regex - Regular expression pattern -

i looking create regular expression work iis url rewrite rules. looking expression match first 2 instance, not third. looking return name of folder2 whenever there isn't file name present on end of line. folder1/folder2 folder1/folder2/ folder1/folder2/file.htm ^folder1/([^/]*)/?$ i thought expression return name of second folder, optional /, when second folder and/or slash end of line. matching first example , none of slashes. try sample of regex: folder1[\/]{1}([^\/]+)[\/]{0,1}[\n] demo

xpath - Selenium Webdriver: stale element reference -

am getting below error: stale element reference: element not attached page document. when select country country dropdown page gets refreshed since have used 'onchange' attribute, when try locate rest of fields in form throwing me stated exception. note: have cross verified locators before , after page gets loaded, there no change in of locators used id's. here html, <form method="post" action="/eclaims/app" name="mainform" id="mainform" accept-charset="utf-8"> <div style="display: none;"> <input type="hidden" name="formids" value="iferrors,haserrors,if,if_0,statusdate1,if_1,if_3,if_5,if_7,if_2,calldate,if_8,if_4,countrylist,if_9,if_6,languagelist,if_10,if_11,if_12,customeremail,if_13,if_14,customertitle,if_15,customerfirstname,if_16,if_17,customerlastname,if_18,customercompany,if_19,if_20,if_21,customerfaxphonecode,customerfaxnumber,if...

Prioritize an Object within a Firebase Query -

i have following structure in firebase database -- user-posts ---- -kekdik4k3k5wjnc ------ title: "batman greatest hero" ------ body: "there no other hero compare here..." ---- -k34idfgklksdcxq ------ title: "superman weak" ------ body: "let's talk shoddy, overrated alien m..." say want query objects /user-posts node, post -kekdik4k3k5wjnc set/sorted first element. can done in firebase? if so, combined limittofirst ? don't see exact functionality in documentation may have overlooked. i'm looking avoid manipulating array myself if can it. any input appreciated? say have usersref node in database, , post object id, title , body in project, combine queryorderedbykey , querylimited so: func userpostobserver(_ completion: @escaping () -> ()) { guard let currentuserid = auth.auth().currentuser?.uid else { return } usersref.child(currentuserid).child("po...

visual studio - T4 generating Script.PostDeploy.sql sqlcmd -

i want generate script.postdeploy.sql on sqlproj, using t4 template , have 2 issues: first, have sql var read within .tt in order define wich folder want load files build final script. possible? second, when run .tt, writes sql, changes action in fike properties postdeploy build. there way of changing instead of editing sqlproj? ( here )

curl - Apache proxy not authenticating correctly against Remote -

we have client's remote server(where don't have access to) serves api. authentication protected outside, white-listed against 1 of our server ip (server-a). the idea setup proxy in our server-a remote server. it's not accepting requests hoped. we use curl requests headers pass authentication details. authenticates , runs fine our server-a. not proxy set in server-a. conf : loadmodule proxy_module modules/mod_proxy.so loadmodule proxy_http_module modules/mod_proxy_http.so <virtualhost *:80> servername proxy.myserver.com proxypass /api/ http://api.remoteserver.com/ .... </virtualhost> curl : curl -v --header "username: username" --header 'password: password' --header "customerguid: 123456789" http://proxy.myserver.com/api/ this curl request runs fine proxy server(server-a), not anywhere else!! what missing here? looking @ proxy idea little wrong? solved : since wasn't sure how remote serve...

ember.js - EmberJS: refreshing a data model does not update associated computed properties -

let's there route capabilities update it's data when requested user (assume backend returns different data same call, maybe it's stock data, or random numbers). export default ember.route.extend({ model() { return this.get('store').findall('foo'); }, actions: { invalidatemodel() { this.refresh(); } } }); now, component consuming model directly update view expected. model: {{#each model |m|}}{{m.bar}}{{/each}} <button {{action "refreshmodel"}}>refresh model</button> but, if component using computed property observing model, updates not carry through. template model: {{#each computedmodel |m|}}{{m}}{{/each}} <br> <button {{action "refreshmodel"}}>refresh model</button> component computedmodel: ember.computed('model', function() { return this.get('model').map(function(m) { return `computed: ${m.data.bar}`; }); }), for full repro, can ch...

linux - What is a difference between sar %ifutil and nicstat %Util? -

nicstat sar the first nicstat 3 second sar -n dev 3 why eth0 network interface util diffrent between sar %ifutil , nicstat %util

uiimageview - Fade in/out Image in UIIamgeView happens with no duration -

i have uiiamge created programmatically in viewdidload of detailviewcontroller . .transitioncrossdissolve between current image image. problem once detailviewcontroller displayed switch happens right away no matter duration . never see first image. using following code. let rect = cgrect(x: 0, y: uiapplication.shared.statusbarframe.height, width: view.frame.size.width, height: view.frame.size.height / 3.0) let imageview = uiimageview(frame: rect) imageview.image = #imageliteral(resourcename: "head1") imageview.contentmode = .scaleaspectfill imageview.clipstobounds = true view.addsubview(imageview) uiview.transition(with: imageview, duration: 16.0, options: .transitioncrossdissolve, animations: { imageview.image = #imageliteral(resourcename: "head3") }, completion: nil) try start animation in viewdidappear delegate. think thats p...

Angular get nested element using directive on parent -

here code have <parent my-directive [tohide]="childref"> <child bottom right #childref> <button>some text </button> </child > </parent > here have my-directive on parent element , want access child , apply style it. so in directive, have following. export class mydirective { @input("tohide") localref; constructor(public element:elementref,public renderer:renderer) { console.log('hello mydirective directive'); } ngafterviewinit() { console.log("all transtition set"); console.log(this.localref); this.renderer.setelementstyle(this.localref, 'webkittransition', 'transform 500ms,top 500ms'); } as can see using this.renderer set style on element following. error error: uncaught (in promise): typeerror: el.style undefined any in regard appritiated. if <child> plain html element (no component) should work (added nativeelement ) this.r...

web services - SAP Webservice - Could not establish connection to network in C# -

i trying connect pda sap using sap web service. my visual studio version visual studio 2008 professional edition. followed great tutorial create/consume sap web service using soap manager i have added web service in c# project , please find below code. sap_wsdl.z_web_service_name service = new pda_app.sap_wsdl.z_web_service_name(); sap_wsdl.zmmbatchputawayfromphp data = new pda_app.sap_wsdl.zmmbatchputawayfromphp(); data.pbktxt = "test"; networkcredential cred = new networkcredential(); cred.username = "xxxxx"; cred.password = "******"; service.credentials = cred; service.proxy = new webproxy("ip" , 1); sap_wsdl.zmmbatchputawayfromphpresponse response = new pda_app.sap_wsdl.zmmbatchputawayfromphpresponse(); response = service.zmmbatchputawayfromphp(data); after deploying getting exception(webexception unhandled) not establish connection network. system....

python 3.x - Making functions that randomly pick pixel and read colors -

i trying make function picks pixel point randomly in image , reads color(rgb) of it. however, entirely stuck it. can give me idea? i glad helps. thank you. btw i'm using python 3.4.4 . below got far: def color_of_pixel(image,win): y in range(0,image.getheight()): x in range(0,image.getwidth()): get_color=getpixel(x,y) print(get_color)    there many first 1 use default python random library import random x,y = image.shape #assume image numpy array or nested list aka plt.imread() = random.randint(0, len(x)) j = random.randint(0, len(y)) return pixel[i][j] you can run loop if want generate more 1 random pixel way use numpy random can use similar way did above can generate many random number @ once https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.randint.html

Ulimits in docker host vs container -

Image
i wasn't able find straight answer, question, here is: lets have host has max open files 1024: [root@host]# ulimit -a open files (-n) 1024 and docker container running in host : [root@container]# ulimit -a open files (-n) 1048576 so have problem in container if try open more 1024 files? think real limit in case container 1024 files. think? the real limit 1048576. have @ right part of image, shows containers isolated processes, running on same operating system: as every system call in container handled directly host os, ulimit displayed (1048576) comes directly host os , value used. the difference in ulimits have been caused a docker configuration , example. (note vms , different: guest os might display value of 1048576, open calls in end handled host os, impose limit of 1024)

ios - Property of mutable type 'NSMutableDictionary' has 'copy' attribute; an immutable object will be stored instead -

Image
i using xcode9 , tried analyse project.then got following issue like property of mutable type 'nsmutabledictionary' has 'copy' attribute; immutable object stored instead please go through image shows analyze issue how resolve issue? it's analyzer issue , can ignore it. just change type copy -> strong ? @property ( nonatomic, strong) nsmutabledictionary *parameters; you can explicit use mutablecopy , change setter _ parameters = [parameters mutablecopy]; more friendly access. or use self.parameters = [yourdictionaryname mutablecopy];

python - Pandas add column from one dataframe to another based on a join -

Image
assume have 2 dataframes. want add column of dataframe 1 dataframe 2 based on column lookup. if join not possible, want in column constant (so can filter that). graphically: code: import pandas pd import numpy np data = np.array([['','col1','col2'], ['row1','2','two'], ['row2','1','one']] ) data2 = np.array([['','col3','col4'], ['row1','1','t1'], ['row2','2','t2'], ['row3','3','t3']] ) df = pd.dataframe(data=data[1:,1:], index=data[1:,0], columns=data[0,1:]) df2 = pd.dataframe(data=data2[1:,1:], index=data2[1:,0], columns=data2[0,1:]) result_df = df2 + join col2 based on df2.col3 = df.col1. add string constant if join fails. pri...

.net - Why LoadLibrary does't load a dll in asmx webservice -

i developed web service (asmx ), added "defaultwebsite" in iis 8.0, called local workstation now. i attached dll library (first.dll) "solution ->addreference->browse" mechanism in visual studio 2015. the "first.dll" .net vs2015 assembly , needs call "second.dll" code: using system.runtime.interopservices; ... namespace fistdlllibrary { public class first { #region dllimport [dllimport("d:\\pathto\\kernel32.dll", charset = charset.auto,setlasterror = true, entrypoint = "loadlibrarya")] internal static extern intptr loadlibrary([in,marshalas(unmanagedtype.lpstr)] string lpfilename); #endregion ... private intptr hmodule; ... public first() //the constructor of library class { hmodule = loadlibrary("c:\\thepath\\second.dll"); if (hmodule == intptr.zero) { win32lasterror = marshal.getlastwin32error(); lasterror = 1; return; }...

c# - invalidJsonBody error posting to log analytics rest api -

hi im trying out new log analytics rest api example can found here: https://dev.loganalytics.io/documentation/authorization/api-keys running aforementioned error in title full code here: "{\"error\":{\"message\":\"the request had invalid properties\",\"code\":\"badargumenterror\",\"innererror\":{\"code\":\"queryvalidationerror\",\"message\":\"failed parsing query\",\"details\":[{\"code\":\"invalidjsonbody\",\"message\":\"unexpected token \\\"\",\"target\":null}]}}}" my code can found below feel im missing simple here dont know i'm going wrong: static void main(string[] args) { try { var client = new program(); client.execasync().wait(); } catch(exception e) { console.writeline(e); console.readline(); } ...

windows - How to prevent my process from CreateToolhelp32Snapshot? -

is there way prevent process detecting process using createtoolhelp32snapshot? if in environment need protect users these users need non-admin users , can create service or task runs different user cannot killed. if absolutely need hide process , chosen method injection & hooking there @ least 6 things need hook in user-mode: the toolhelp api the nt4 process api in psapi.dll the undocumented native nt api the terminal server api performance counters wmi a "better" solution remove process psactiveprocesshead list need in kernel-mode , means writing custom driver. if go down route program labeled malware/rootkit security tools (and rightly so).

javascript - maintain ajax pagination upon clicking back button in Laravel 5.3 application -

i'am making use of laravel pagination($data->links()) ajax pagination using below code. $(document).on("click", '.pagination a', function(e) { e.preventdefault(); var url = $(this).attr('href'); loadarts(url); }); function loadarts(url) { $.ajax({ url : url }).done(function (data) { $(".image-masonry").html(data); jsintializations() }).fail(function () { alert('articles not loaded.'); }); } it's working fine, upon clicking button inner page, browser returning page1. here controller function public function index(request $request) { $arts = art::with('artist')->orderby('id','asc')->paginate(10); if($request->ajax()){ return view('art::art.list', compact('arts'); } return view('art::art.index', compact('arts'); } .image-masonary class in index.blade.php contents...

php - Class LumenServiceProvider Not Found -

while using lumen 5.5 tymon jwt auth 0.5.12 , cannot generate secret key. [symfony\component\debug\exception\fatalthrowableerror] class 'tymon\jwtauth\providers\lumenserviceprovider' not found i followed method described tymon lumen specifically. https://github.com/tymondesigns/jwt-auth/issues/1102 please reffer link - http://www.akaita.com/post/json-web-token-authentication-for-lumen-5-tymon-jwt-auth/ hope you.

java - REST API filtering with related resources best practices -

what best practice include related resources in search query? my resources are: /projects /participants /questions /questionanswers the query like: participants are: - between age of 20 , 40 and, - male and, - selected answer x of question y would /participants?search=gender:male,age>=20,age<=40,question:x,answer:y is there better or standard way type of queries? you can use object serialization & filters. like: /participants?filter={gender={male}, age={between={20, 40}}, question={x}, answer={y}} for given example with: gender = male, female age = (1...99) or between={start, end} or till={end} or from={start} etc.. in case , have possibility filter more specific and/or combined. combination example: /participants?filter={gender={male, female}, age={21,22, 23, from={40}}, question={x}, answer={y}} result: gender male , female age 21, 22, 23 , 40 till 99 (or want)

ios - Digits.sharedInstance() crashing on devices -

i integrated digits fabric while ago in ios project authenticate users phone numbers , working fine until when app started crashing due following line of code initialize digits in our project: digits.sharedinstance().start(withconsumerkey: "myconsumerkey", consumersecret: "myconsumersecret") giving following error: terminating app due uncaught exception 'nsinvalidargumentexception', reason: ' -[nsurl initfileurlwithpath:]: nil string parameter' i have tried options couldn't find solution appreciated. i deleted digits pods , reinstalled it, started working warning have upgrade new phone authentication service firebase digits has been acquired google.

listview - Addding a list item at a particular index in list view and finding the index of the list item in list view in appcelerator -

i want first find out index (i) of particular list item in list view , append list below (i+1) in appcelerator. not able understand documentation this, can please me out it? here can find sample, might link alloy sample section

What does it mean to be a private member (c++ classes)? -

i little confused private data members in c++ classes. new coding , still in middle of 'classes' chapter might ahead of myself, feel missing piece of information: let's have code: class clocktype; { public: void settime(int,int,int); . . . private: int hr; int min; int sec; }; and create object myclock. clocktype myclock; myclock::settime(hour,minute,min) { if (0<= hour && hour < 24) hr = hour; if (0<= minute && minute <60) min = minute; if ( 0<= second && second<60) sec = second; } myclock.settime(5,24,54); my textbook says can't this: myclock.hr = 5; because hr private data member , object myclock has access public members. isn't practically doing in settime function anyways? understand accessing myclock.hr through public member function. still struggling logic behind that. mean private data member then? ...

Why do strings returned by TensorFlow show up with a 'b' prefix in Python 3? -

i finished installing tensorflow 1.3 on rpi 3. when validating installation (according https://www.tensorflow.org/install/install_sources ) somehow lowercase "b" shown up. see these codes: root@raspberrypi:/home/pi# python python 3.4.2 (default, oct 19 2014, 13:31:11) [gcc 4.9.1] on linux type "help", "copyright", "credits" or "license" more information. >>> import tensorflow tf >>> hello = tf.constant('hello, tensorflow!') >>> sess = tf.session() >>> print(sess.run(hello)) b'hello, tensorflow!' >>> no, it's not bug. installation fine, normal behavior. the b before string due tensorflow internal representation of strings. tensorflow represents strings byte array, when "extract" them (from graph, tensorflow's internal representation, python enviroment) using sess.run(hello) bytes type , not str type. you can verify using type function...