Posts

Showing posts from August, 2012

Creating a BEFORE INSERT TRIGGER IN MYSQL -

i need creating before insert trigger on mysql bench. im new please. create table `quincyninying`.`toytracking` ( `toyid` int not null, `toyname` varchar(50) null, `toycost` decimal null, `toyaction` varchar(50) null, `actiondate` datetime null, primary key (`toyid`)); create table `quincyninying`.`toy` ( `toyid` int not null, `toyname` varchar(50) null, `toycost` decimal null, primary key (`toyid`)); create before insert trigger on toy table adds record toytracking table information toy table record being inserted, hard coded toyaction ‘insert’ , current date , time record inserted. error 1054: unknown column 'inserted' in 'new' sql statement: create definer = current_user trigger `quincyninying`.`toy_before_insert` before insert on `toy` each row begin if new.inserted set @toyaction = 'delete'; else set @toyaction = 'new'; end if; insert `quincyninying`.`toytracking` (toyid, toyname, toycost, toyaction

javascript - GET API call working in webbrowser or postman but not jquery -

i have issue since yesterday calling api jquery code. when call http://sub.domain.com/congresses/id via web browser (chrome , safari), works fine. when call same route via jquery call, "get http://sub.domain.com/congresses/id net::err_failed" i didn't log in apache access.log nor error log (i host front-end , api). here jquery code : $(function(){ $.ajax({ async: true, url: "http://sub.domain.com/congresses/17", datatype: "application/json", method: "get", crossdomain: true, success : function(data){ populateapp(data); }, error : function(){ populateapp(local_data); } }); addtohomescreen(); }); when run "developper server" on 3000 port, don't log when use jquery code. i'm using apache passenge

Javascript Web Push: where can I get "auth" key? -

i'm stating using web push notification; don't know can find auth key: var pushsubscription = { endpoint: '< push subscription url >', keys: { p256dh: '< user public encryption key >', auth: '< ???? user auth secret ???? >' } }; i can endpoint , p256dh serviceworker>registeration.pushmanager.getsubscription() not auth key. thanks you can use getkey method both p256dh , auth (see the specs or the example specs ). it's simpler call json.stringify on pushsubscription object returned getsubscription promise.

xaml - Background gesture Recognizer not working for ios in xamarin.forms popup -

for xamarin.froms have created popup : and have used showpopup give background popup if click outside poup poup closed ,its working fine in xamarin.android ios gesture rcognizer background view not working if have popup on top of background view <stacklayout x:name="showpopups" padding="0" backgroundcolor="#99000000" horizontaloptions="fillandexpand" isvisible="{binding showpopup}" verticaloptions="fillandexpand"> <stacklayout.gesturerecognizers> <tapgesturerecognizer command="{binding onclosepopupcommand}" /> </stacklayout.gesturerecognizers> </stacklayout> for background popup in xamarin.forms..gesture recoginizer working fine background poup android ios command="{binding onclosepopupcommand} not getting called ..any suggestion implement it you need run command on ui thread : device.begininvokeonmainthread(() => { run

php - Ajax is not working in Codeigniter -

ajax not working : want update 1 record using code igniter framework. when passing po_id below url. ajax not working. without passing id below ajax working. <a class="btn btn-success" href="<?php echo base_url('inventory_c/view_purchase_update/'.$result->po_id);?>">update</a> controller: public function view_purchase_update() { $data['pitems'] = $this->inventory_m->purchase_items_update($po_id); $data['sname'] = $this->inventory_m->getsuppname($supplier_id); $data['sid'] = $this->inventory_m->getsuppid($po_id); $this->load->view('superadmin/editable_purchase_update',$data); } ajax code: $.ajax({ type: "post", url: "add_temp_purchase", cache: false, data: 'itemnum='+itemnum+'&itemname='+itemname+'&costprice='+costprice+'&quantity='+quantity+'&a

javascript - got property undefined when fetching data in ajax using vue.js -

i have got undefined when alert param fetching ajax using vue.js, here code. test.json return: [ {isactive: false,name: test} ] js: new vue({ el: '#viewport', data: { test_data: [] }, mounted: function () { this.fetchtestdata(); }, methods: { fetchtestdata: function () { $.get(test.json, function (data) { this.test_data = data; alert(this.test_data.isactive); }); } } }); i beginner of vue.js, hope have reply, thanks. if fetching data test.json file, first need because that's not validate json: [ { "isactive": false, "name": "test" } ] and need use bind because this not referring vue instance fetchtestdata: function () { $.get('test.json', function (data) { this.test_data = data; alert(this.test_data[0].isactive); }.bind(this)); } and accessing data this.test_data[0].isactive becaus

dataframe - Subset the data based on a unique value in R -

this question has answer here: subset data frame based on number of rows per group 2 answers i have data below test=data.frame("name"=c("a","a","a","a","b","b","c"), value=c(10,11,12,13,14,15,16)) i want subset test data based on non-repeated name "c", want show data below: name value c 16 i try test[table(test$name)>1,] , output wrong. please give me hint, thanks!! using data.frame such, table.freq <- as.data.frame(table(test$name)) test[test$name %in% table.freq$var1[table.freq$freq==1],] # name value #7 c 16 or using which test[test$name %in% names(which(table(test$name)==1)),] # name value #7 c 16

$_COOKIE shows cookie, INSPECT doesnt! why? -

Image
can tell me why firebug inspect doesnt display cookies, while displayed $_cookie ? i use: setcookie($name,$value,time()+999999, '/wp/3/',null,null,true); you're passing true 7th parameter setcookie . per setcookie documentation , 7th parameter $httponly parameter. when set true, makes cookie accessible only via http, , nothing else--including scripts. quote: httponly when true cookie made accessible through http protocol. means cookie won't accessible scripting languages, such javascript. has been suggested setting can reduce identity theft through xss attacks (although not supported browsers), claim disputed. added in php 5.2.0. true or false you wither need pass false , or omit (since function defaults optional parameter false .)

Unable to advance ioslides slides with Shiny apps -

hopefully simple question. have ioslides presentation in markdown , have created slides shiny figures. shiny figures have checkbox pick different variables plot. once make selections on checkbox no longer able advance ioslides presentation next slide (mouse, spacebar or arrow keys). general advice appreciated. cheers, court

laravel - Class 'App\Providers\URL' not found when upload to read server -

i upgrade laravel4.2 laravel5.3 , work in localhost when upload server got below errors. whoops, looks went wrong. 1/1 fatalthrowableerror in appserviceprovider.php line 18: class 'app\providers\url' not found in appserviceprovider.php line 18 @ appserviceprovider->boot() @ call_user_func_array(array(object(appserviceprovider), 'boot'), array()) in container.php line 508 @ container->call(array(object(appserviceprovider), 'boot')) in /var/www/backoffice/vendor/laravel/framework/src/illuminate/foundation/application.php line 769 @ application->bootprovider(object(appserviceprovider)) in /var/www/backoffice/vendor/laravel/framework/src/illuminate/foundation/application.php line 752 @ application->illuminate\foundation\{closure}(object(appserviceprovider), '15') @ array_walk(array(object(eventserviceprovider), object(routingserviceprovider), object(authserviceprovider), object(cookieserviceprovider), object(databaseserviceprovider), obj

swift - Create design chat with picture like whatsapp in IOS xamarin -

Image
how create design chatting whatsapp (ios xamarin). in picture below: my code: contentview.addconstraints(nslayoutconstraint.fromvisualformat("h:|[bubble]", 0,"bubble", bubbleimageview)); contentview.addconstraints(nslayoutconstraint.fromvisualformat("v:|-2-[bubble]-2-|",0,"bubble", bubbleimageview )); bubbleimageview.addconstraints(nslayoutconstraint.fromvisualformat("h:[bubble(>=48)]",0,"bubble", bubbleimageview)); //setting layout image picture var vspacetopattch = nslayoutconstraint.create(imgpicture, nslayoutattribute.top, nslayoutrelation.equal, bubbleimageview, nslayoutattribute.top, 1, 10); contentview.addconstraint(vspacetopattch); //setting layout message label var vspacetop = nslayoutconstraint.create(messagelabel, nslayoutattribute.top, nslayoutrelation.equal, bubbleimageview, nslayoutattribute.top, 1, 10); contentview.a

c# - MariaDB cant insert data with entity framework 5.0 -

i have problem inserting data in database. have 3 tables created heidesql , linked 3 tables foreign key. 1st table (many one) 2nd table (one many) 3rd table. when try insert new data db.savechanges(); throws insert exception tells me cant match foreign key because 2 or more objects have same primary key. have 1 id-field in each table auto_increment. use id-field of 2nd table link in first , 3rd one. problem everytime create new database object insert add same object belongs 2nd table db-object stays same. same object 1st table. might mistage , how can fix this? code , pic of database attached. hope helps understand problem. cheers, only3lue db.zeichnungs.add(zeichnung); db.projekts.add(projekt); db.tags.add(tag); } try { db.savechanges(); } ...

random - What is the point of the inc variable in the PCG RNG? -

from this code : // *really* minimal pcg32 code / (c) 2014 m.e. o'neill / pcg-random.org // licensed under apache license 2.0 (no warranty, etc. see website) typedef struct { uint64_t state; uint64_t inc; } pcg32_random_t; uint32_t pcg32_random_r(pcg32_random_t* rng) { uint64_t oldstate = rng->state; // advance internal state rng->state = oldstate * 6364136223846793005ull + (rng->inc|1); // calculate output function (xsh rr), uses old state max ilp uint32_t xorshifted = ((oldstate >> 18u) ^ oldstate) >> 27u; uint32_t rot = oldstate >> 59u; return (xorshifted >> rot) | (xorshifted << ((-rot) & 31)); } what point of rng->inc ? never written far can see. i think it’s seed – stream selector, precise. take @ code on github , pcg32_srandom_r function: // pcg32_srandom(initstate, initseq) // pcg32_srandom_r(rng, initstate, initseq): // seed rng. specified in 2 parts, state initializer , /

orientdb2.2 - Is it possible to import line-wise JSON into OrientDB using their ETL tool? -

i have bunch of files (~10gb each) each line represents single json object. want import them in streaming mode, looks not supported right (orientdb v.2.2.12). there workarounds? , recommended way case? looks json can transformed odocument in code block: { "code": { "language": "javascript", "code": "(new com.orientechnologies.orient.core.record.impl.odocument()).fromjson(input);" } } if experience errors like: error in pipeline execution: com.orientechnologies.orient.core.exception.oserializationexception: found invalid } character @ position 112 of text then ensure multiline option set off. "extractor": { "row": { "multiline": false } }

excel - Email Workbooks based on Workbook name to different addresses -

Image
i have code opens dialog box allows user select excel sheet, filters country column (11), copies , pastes country new workbook, names new workbook after country, repeats action next country, saves , closes each workbook. currently before closes workbook sends newly created workbooks email address. i want if workbook named "belgium" email jane.doe@email.com, if workbook named "bulagria" email john.doe@email.com , on. different countries emailed different addresses. my email code here public sub mail_workbook_outlook_1() 'working in excel 2000-2016 'this example send last saved version of activeworkbook 'for tips see: http://www.rondebruin.nl/win/winmail/outlook/tips.htm dim outapp object dim outmail object set outapp = createobject("outlook.application") set outmail = outapp.createitem(0) on error resume next outmail .to = "philip.connell@email.com" .cc = "" .bcc =

scala - How to choose the output collection type in Seq.map? -

i'd implement like: def f(s: seq[int]): vector[string] = s.map(_.tostring).tovector but i'd create directly output vector without executing map first, making whatever seq, before copying vector. seq.map takes implicit canbuilfrom parameters induces collection output type. tried s.map(...)(vector.canbuildfrom[string]) gives error: found : scala.collection.generic.canbuildfrom[vector.coll,string,scala.collection.immutable.vector[string]] (which expands to) scala.collection.generic.canbuildfrom[scala.collection.immutable.vector[_],string,scala.collection.immutable.vector[string]] required: scala.collection.generic.canbuildfrom[seq[int],string,vector[string]] def f(s: seq[int]): vector[string] = s.map(_.tostring)(vector.canbuildfrom[string]) basically doesn't infer correctly first type argument of canbuildfrom how can done ? breakout you're looking for def f(s: seq[int]): vector[string] = s.map(_.tostring)(collection.breakout) f

using hashed passwords in php code -

i want put passwords in our source-code in extern file , access them via php function. don't want have them there in clear text idea hash them. the question how can decrypt them when needed in application. (there no manual password entry) or wrong way solve problem? greetings ant !! you can use crypt() save passwords public function validatepassword($password) { return $this->password === crypt($password, 'hash'); } crypt

Most efficient way to replace NAs in a data frame based on a subset of other row factors (using median as an estimate) in R -

i estimate values of numeric variable in data frame based on median of same variable given other factors. replace na's numeric variable these estimates. i have data frame this: fac1 fac2 var1 20 b 30 b 5 b b 10 . . . i have used agregate function find these medians each combination of factors: a = 22 b = 28 b = 12 b b = 8 so na's in var1 replaced corresponding median based on combinations of factors. i understand may done replacing missing values each subset of data individually, become tedious given more 2 factors. wondering if there more efficient ways result. you haven't provided sample data based on question, think should work. as @roland mentioned no need calculate median separately. assuming dataframe df . every group (here fac1 , fac2 ) calculate median removing na values. further select indices has na values , replace groups median value. df$var1[is.na(df$var1)] <- ave(df$var1,df$fac1,

asp.net - No executable found matching command dotnet-projectmodel-server -

i'm getting error when opening .net core projetcs in vs 2015 community: the following error ocurred attempting run project model server process (1.0.0-preview-003585). unable start process. no executable found matching command "dotnet-projectmodel-server". it working until yesterday. i've tried reinstall .net core sdk , repair vs installation. some tips? i had same problem. able fix uninstalling microsoft .net core 1.0.1 - sdk preview 3 (x64) , reinstalling .net core 1.1 sdk here: https://www.microsoft.com/net/core#windowscmd

hadoop - Can we use HDFS to store git repositories? -

i want create scalable git repository both high availability, automatic failover , performance. think hdfs suited such cases. don't know if possible use git repositories. can show example? how use hdfs store git repository? probably bit lengthy should work use fuse (mountablehdfs) once able mount hdfs other file system , should able use mount (hdfs) store git repository. see below links details https://wiki.apache.org/hadoop/mountablehdfs http://www.cloudera.com/documentation/cdh/5-1-x/cdh5-installation-guide/cdh5ig_hdfs_mountable.html

java - Is it Good to make so many methods for even small task also? -

i want know many developers same thing decrease size of long method , create many small sized methods same task. want know affects performance of application or not? functions should short, between 5-15 lines personal "rule of thumb" when coding in java or c#. size several reasons: it fits on screen without scrolling it's conceptual size can hold in head it's meaningful enough require function in own right (as standalone, meaningful chunk of logic) a function smaller 5 lines hint perhaps breaking code (which makes harder read / understand if need navigate between functions). either or your're forgetting special cases / error handling! but don't think helpful set absolute rule, there valid exceptions / reasons diverge rule: a one-line accessor function performs type cast acceptable in situations. there short useful functions (e.g. swap mentioned user unknown) need less 5 lines. not big deal, few 3 line functions don't harm code bas

ruby - Converting an ElasticBeanstalk environment to a Docker container -

i running several ruby applications in elasticbeanstalk in aws. i'd developers have ability run applications locally in docker containers. however, ruby applications have never been run anywhere other in beanstalk, haven't inherited documentation re. how deployed. beanstalk uses passenger standalone running on amazon linux. applications configured passing "environment properties" environment the beanstalk configuration. has attempted or similar before? i'm hoping matter of running amazon linux docker container passenger standalone, setting environment variables, , dropping ruby code correct directory, suspect more complex this.

Using Linux eeprom (at24) driver from another driver -

we have 24xx eeprom on our custom board; it’s hooked device tree , can read/write userspace. i’m developing driver control misc gpio’s , , i’d able read eeprom . (the contents won’t changing @ – it’ll write-protected). i’m struggling figure out whether/how driver can hook at24 driver somehow? (perhaps “if (chip.setup) chip.setup(&at24->macc, chip.context)” , can’t spot how use this) or other ‘best’ methods there might chip driver. ( kernel 4.4)

jquery - How to prevent FOUT with dotdotdot? -

i using dotdotdot plugin cut off texts. the problem on slower devices flash of unformatted output - loads whole text , after moment dotdotdot fires , cuts off. if want see example, open their site on smartphone - @ first example blocks see both blocks full text , after moment right block cut off. is there can prevent this?

linux - How to pass variable within printf -

i trying echo variable within printf. first prompt user input using command below printf 'specify lrus [default 128]: ' ;read -r lrus next prompts user again see if wants input used previous question: printf 'are sure want $lrus lrus: ' ;read -r ans for example output below: specify lrus [default 128]: 60 sure want 60 lrus: yes the above output trying achieve allowing pass previous input variable next question using printf. your problem using single-quotes. parameters not expanded within single quotes. parameters expanded in double-quotes, though: printf "are sure want $lrus lrus: " note there's no need separate print; it's better use -p argument read (that understands terminal width, 1 thing): read -p "specify lrus [default 128]: " -r lrus read -p "are sure want $lrus lrus? " -r ans

angular - Unable to route from on page component to another page -

Image
i new in angular 2,i using ng2-admin template in angular 2.0.0 version. want route pages component if user logged in route dashboard page.currently using "route.navigate(['dashboard'])" after call function gives me error undefined routes. following component side code: my module.ts file my login routing component : and main routing component : please me out, thanks you have import { routermodule, routes } '@angular/router'; , have declare routes below in app.ts or main.ts : const routes: routes = [ { path: '', redirectto: '/dashboard', pathmatch: 'full' }, { path: 'dashboard', component: dashboardcomponent }, ]; @ngmodule({ imports: [ routermodule.forroot(routes) ], exports: [ routermodule ] }) then can use routes in corresponding component below: this.router.navigate(['/dashboard']); adding new function : gotodashboard() { console.log("coming"); console.log(th

javascript - How to highlight a filed cell when user clicks on a button -

i have build system allows clients complete questionnaire. in order complete questionnaire user has enter unique number pulls data different database using stored procedure. anyway trying when client complete questionnaire , click on create id cell/fieldset highlighted know client has completed questionnaire. still improving front end development bit of help. posted front end (view) code because work needs done. can guide me with javascript/jquery <fieldset style="width:1200px;"> <legend>storequestions</legend> @html.hiddenfor(model => model.storeid) <div class="editor-label"> <h3>what condition item in when received it? (1 - poor, 2 - standard, 3 - , 4 - excellent)</h3> </div> <input type="submit" value="create" class="button"> [httppost] [validateantiforgerytoken] public actionresult create(storequestions storequestions) { if (modelstate.

scala - About how to create a custom org.apache.spark.sql.types.StructType schema object starting from a json file programmatically -

i have create custom org.apache.spark.sql.types.structtype schema object info json file, json file can anything, have parametriced within property file. this how looks property file: //ruta al esquema del fichero output (por defecto se infiere el esquema del parquet destino). si existe, el esquema será en formato json, aplicable dataframe (ver structtype.fromjson) schema.parquet=/users/xxxx/desktop/generated_schema.json writing.mode=overwrite separator=; header=false the file generated_schema.json looks like: {"type" : "struct","fields" : [ {"name" : "codigo","type" : "string","nullable" : true}, {"name":"otro", "type":"string", "nullable":true}, {"name":"vacio", "type":"string", "nullable":true},{"name":"final","type":"string","nullable":true} ]}

java - Junit formatted test report -

Image
i using code generating junit report soapui test cases. <target name="gen-reports"> <junitreport todir="${test.reports}"> <fileset dir="${test.reports}"> <include name="test-*.xml"/> </fileset> <report todir="${test.reports}/report"/> </junitreport> </target> test.reports folder data soapui report present. , report generating properly. on 1 page of error looks this: but in second , third errors showing html tags not html page. reason of error?

jdbc - Informix Dynamic Server Version 11.70 symbol trademark converted to question mark -

ibm informix dynamic server version 11.70 on rhel 2.6 some info select distinct dbs_collate sysmaster:sysdbslocale; dbs_collate ----------- en_us.819 my jdbc jdbc.ep.ifx.url=jdbc:informix-sqli://server:9999/testdb:informixserver=test_shm;ifx_use_strenc=true; the table create table test ( id serial, notes nchar(5120) ); what trying achieve use web-base app add text informix table thru jdbc text can including symbols (eg copyright, trademark) what works i can add whatever text,symbols table, but symbol eg trademark saved "?". my question how make symbol saved , displayed instead of being converted "?" some characters not represented in en_us.819 . can see how looks at: https://en.wikipedia.org/wiki/iso/iec_8859-1 there copyright , reserved characters while cannot see trade mark . i have made simple jython program inserts such characters informix database. test database uses polish encoding pl_pl.1250 . insert test_nch

sql - Hardcoding function parameter yields 5x speed up -

i have following stored procedure generate dynamic query. given list of conditions/filters, finds visitors belong given app . app_id passed in argument. if call function app id, , use argument in dynamic query, runs in around 200ms. however, if hardcode app_id , runs in < 20ms. here example of how invoke procedure select id find_matching_visitors('my_app_id', '{}', '{( field = ''app_name'' , string_value ilike ''my awesome app'' )}') any ideas ideas why? create or replace function find_matching_visitors(app_id text, default_filters text[], custom_filters text[]) returns table ( id varchar ) $body$ declare default_filterstring text; custom_filterstring text; default_filter_length integer; custom_filter_length integer; sql varchar; begin default_filter_length := coalesce(array_length(default_filters, 1), 0); custom_filter_le

c# - I want to count number of occurance of specific group in Generic List -

this question has answer here: linq groupby , count 3 answers i have 2 class . public class employee { public string firstname { get; set; } public string lastname { get; set; } } i have data above class , please check below . list<employee> lstemployee = new list<employee>(); lstemployee.add(new employee() { firstname = "ronak", lastname = "patel" }); lstemployee.add(new employee() { firstname = "ronak", lastname = "patel" }); lstemployee.add(new employee() { firstname = "sanjay", lastname = "patel" }); lstemployee.add(new employee() { firstname = "ronak", lastname = "patel" }); lstemployee.add(new employee() { firstname = "sanjay", lastname = "patel" }); lstemployee.add(new employee() { firstname = "ronak", lastname

listview - View List - Android Studio = Navigation Drawer Layout -

i beginner in android studio , need help. i'm trying make app on navigation drawer layout. so, found tutorial how specific layout when click on in navigation drawer menu https://www.youtube.com/watch?v=ju837bqobfg&list=plqic834sj9lcamgq8jhpsrqpd9nfnjg0q works perfect! just want make viewlist in 1 layout of them i'm refering main navigation menu found next tutorial ( http://www.viralandroid.com/2016/04/start-new-activity-from-android-listview-onitem-clicked.html ). i tried apply listview tutorial on brand-new project , works perfectly! problem when want apply project have used navigation on specific layouts fragments. says there duplication. here mainactivity: package com.example.martin.ultimateenglish; import android.os.bundle; import android.support.design.widget.floatingactionbutton; import android.support.design.widget.snackbar; import android.view.view; import android.support.design.widget.navigationview; import android.support.v4.view.gravi

ios - Issue with launch image in iPhone 6S plus and iPhone 7 plus -

i quite new xcode. have images launch screen of app. have added them using drag , drop icons (images.xassets -> launchimage). all of them works in devices except iphone 6s plus , iphone 7 plus. my contents.json file looks this { "images" : [ { "orientation" : "portrait", "idiom" : "iphone", "extent" : "full-screen", "scale" : "1x" }, { "orientation" : "portrait", "idiom" : "iphone", "filename" : "ios_portrait_640x1136.png", "extent" : "full-screen", "scale" : "2x" }, { "orientation" : "portrait", "idiom" : "iphone", "filename" : "ios_portrait_640x1136-1.png", "extent" : "full-screen", "subtype" : "retina4", "scale" : "2x" }, { "or

xml - Security namespace does not support decoration of element [custom-filter] -

i need perform custom authorization, i've predetermined authenticationmanager , loginurlauthenticationentrypoint , set usernamepasswordauthenticationfilter . here spring-security.xml : <beans xmlns="http://www.springframework.org/schema/beans" xmlns:security="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd"> <security:http auto-config="false" entry-point-ref="alterauthenticationentrypoint" create-session="always" use-expressions="true"> <security:intercept-url pattern="/blog**" access="hasrole('role_admin')"/> &

Get the all field fromone documents Elasticsearch java -

i'm trying fields 1 document have lowest price. using min can particular price. how should retrieve in fields of 1 document. i have written code retrieves min price aggregationbuilder aggregation = aggregationbuilders.nested("nestedagg").path("carspecpojo") .subaggregation(aggregationbuilders.min("carspecagg").field("carspecpojo.price")); searchquery searchquery = (searchquery) new nativesearchquerybuilder() .addaggregation(aggregation).build(); aggregations aggregations = elasticsearchtemplate.query(searchquery, new resultsextractor<aggregations>() { @override public aggregations extract(searchresponse response) { return response.getaggregations(); }}); nested nest = aggregations.get("nestedagg"); min min = nest.getaggregations().get("carspecagg"); and elastic document "brand_name": "maruti", &quo

php - onbeforeunload / onunload when user reset/shut down computer -

i have field in database register if window open. i have onbeforeunload / onunload function delete cell when user close window. the problem when user "reset" / "shut down" computer query not sent , don't know why. can me?

java - How to get Junit class name in another class -

below junit runner need class name runtest in class. @runwith(cucumber.class) @cucumberoptions( features = { "src/test/resources/features/automated" }, tags = { "@create_account_without_entering_mandatory_fields", "~@tobeskipped","~@p2" } , dryrun = false, monochrome = true, glue = "tv.nativ.mio.automation.stepdef", plugin = {"html:target/cucumber", "json:target/cucumber/cucumber1.json"}) public class runtest { } i have tried thread.dumpstack() , thread.currentthread().getstacktrace() not getting class runtest in list i wouldn't recommend that, can remember test class in static variable. in test: @beforeclass public static void beforeclass() { // holder class static variable, create currentclassholder.setclass(runtest.class); } you can such thing in every test class , there..

Modify ServiceReferences.ClientConfig file using bat before deploying SilverLight solution -

my team developing silverlight application , switching our solution https on our server use http locally. so, in xap file results when building app there servicereferences.clientconfig having configuration web services referenced in project. issue have configuration when running locally , have other configuration when deploy it. decided alter servicereferences.clientconfig before building because otherwise encapsulated in .xap file. using msbuild in bat file deploy solution. config file: <configuration> <system.servicemodel> <bindings> <custombinding> <binding name="custombinarybinding"> <binarymessageencoding /> <httptransport maxreceivedmessagesize="2147483647" maxbuffersize="2147483647" /> </binding> </custombinding> </bindings> <client> <endpoin

linux - check owners of run control scripts -

to secure computer want sure "root", "sys", "bin" owners of run control scripts.. this far : find -l /etc/rc* -ls | awk '$5 !="root" { print $0 }' is there better way achieve ? thanks to find files not owned root use: find -l /etc/rc* ! -user root to check 3 user names named in question use: find -l /etc/rc* ! -user sys -a ! -user sys -a ! -user bin

Debugging and tracking Hotjar data -

Image
recently, our company started using hotjar collect usage data. first time using service, made mistakes, made me search method debugging. after reading official documentation, forums, stackoverflow, found nothing. what have do/modify enable debugging in hotjar? you can enable debugging in tracking script. add following line in h._hjsettings line: hjdebug:true <!-- hotjar tracking code www.example.com --> <script> (function(h,o,t,j,a,r){ h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)}; h._hjsettings={hjid:1,hjsv:5,hjdebug:true}; a=o.getelementsbytagname('head')[0]; r=o.createelement('script');r.async=1; r.src=t+h._hjsettings.hjid+j+h._hjsettings.hjsv; a.appendchild(r); })(window,document,'//static.hotjar.com/c/hotjar-','.js?sv='); </script> when use tracking code way, console display happens during process. me, helpful helped me make sure virtual page views registered without

JSON object creation using PHP - from fetched values of database columns -

i new php. working on project of recommendation system. here fetching values database "userid" , "items". and, want create json object this { "john": ["a", "b", "c", "d", "e"], "alex": ["a", "b", "x", "y", "z"], "me": ["a", "b", "c", "f", "r"] } but getting [ { "john": ["a", "b", "c", "d", "e"], }, { "alex": ["a", "b", "x", "y", "z"], }, { "me": ["a", "b", "c", "f", "r"] } ] this code have tried, <?php include "init.php";//database connection $sql = "select * orders"; $result = mysqli_query($connec

Azure Active Directory user Reset Password button disabled for Global Admin -

i have user both co-admin in azure subscription global admin in ad tenant in question. need him able reset passwords users, button appears disabled him. assistance appreciated, thank you! based on test, reset password feature not able new azure portal in preview. can reset password users old portal . note: not able reset password users synced on-premise. need manage password these users on-premise.

xml - Creating Virtual Machines using PowerCLI based on data from CSV File -

i attempting find out how or whether possible create powercli script handle creating virtual machines (vm's) within specific clusters based on csv file. i have found solutions involve having powercli read xml files , want determine if csv file data option , if so, how go doing it. background: users input vm specification data excel 'request' form, vba script used translate data csv file , wondering if possible have powercli script read resulting csv files data create vm's specified values (to reviewed prior executing ensure data correct/relevant). thank may provide received vmware community site , able retrieve simple script create vms powercli: #specify path of .csv file import vm settings $csvpath = "c:\newvmlist.csv" $csvfile = import-csv $csvpath $vmhost = get-vmhost "$($csvfile.vmhost)" $portgroup = get-virtualportgroup -name "$($csvfile.vlan)" -vmhost $vmhost new-vm -name "$($csvfile.name)" -

increment in for loop javascript -

i don't know why can't increment value in loop normally. for (var = 0; < 5; i++) { var number= 0 number++ console.log(number); } that's simple example,and 5 times number 1 in console,insted of 0,1,2,3,4. how can make work? you're declaring variable inside loop, happens every time loop runs. move declaration outside... var number = 0; (var = 0; < 5; i++) { number++; console.log(number); }

java - Singleton injected in Interceptor multiple instantiations -

i using jboss eap 6.4.10 in project , have set @singleton @startup . singleton @inject ed @interceptor because use methods in interceptor. so far good, works, noticed @postconstruct method of @singleton not called once, nay called 496 times. wonder why happening. cant inject singleton in interceptor? i figured out problem. had imported import javax.ejb.singleton; instead of import javax.inject.singleton;

operating system - About CPU operation and I/O processing -

my question why want have cpu's operation overlap of i/o processing. have been thinking optimization , such yet arrive @ conclusion. if able answer question, great. :d i/o slow compared operating frequency of cpu. suppose have 1ghz cpu that's capable of executing 1 instruction every clock cycle. means cpu able execute 1 instruction every nanosecond. now let's assume want fetch data hard drive. disk operations take place in milisecond scale, , we'll assume drives fast enough fetch data in 1ms. if cpu sit around , wait disk fetch data, cpu waste 1 million nanoseconds doing nothing, whereas executing 1 million instructions task. when program has lot of io access, wasted cycles stacks , become noticeable if let cpu wait , nothing. why it's idea overlap computation io cpu cycles aren't wasted. this why computer becomes super unresponsive when main memory full, , cpu has page disk. cpu cannot perform useful task unless data needs has been retrie

php - Ionic Framework - Check Email Availability From MySQL Database Using Ajax -

checking email address availability of user on ng-keyup via ajax using mysql db. i'm not able figure out error. please go through code below. have added function checkemail() controller don't know correct way call functions in controller. html <label class="item item-input item-stacked-label"> <span class="input-label">email</span> <input type="text" id="email" name="email" ng-keyup="checkemail()" placeholder="email" ng-model="data.email"> <span id="email_status"></span> app.js angular.module('starter.controllers', []).controller('registrationctrl', function ($scope, $http) { function checkemail() { var email = document.getelementbyid("email").value; if (email) { $.ajax({ type: 'post', url: 'http://proittechnology.com/dev/stylr/checkemai

ssl - how to check if https sites are supported on windows OS? -

https sites accessible on windows xp sp3 (after enabling tls in ie settings/ registry) not accessible on windows xp sp2(after enabling tls settings). how can programmatically find os version , service pack support secured connection (https). can use alternative (http) link connect.

Building Tree Structure using XSLT with inclusion of counters -

i have below xml , need need convert expected output xml using xslt have acheived in input xml have referenced topmost node has subnodes follows: <?xml version="1.0"?> <referenced> <name>poctree/poctree.services:getreferencesforservices</name> <lock_status>3</lock_status> <type> <svc_type>flow</svc_type> <svc_subtype>default</svc_subtype> </type> <path/> <ispub>false</ispub> <isnotification>false</isnotification> <isflowservicedisabled>false</isflowservicedisabled> <status>reference</status> <reference> <name>wmroot/wm.server.ns.dependency:getreferenced</name> <lock_status>2</lock_status> <type> <svc_type>java</svc_type> <svc_subtype>unknown</svc_subtype> </type> <path>/flow path;1.0/invoke;0</path> &