Posts

Showing posts from June, 2012

javascript - how to retrieve data into textfields when i select an option in droplist -

<strong>type of party</strong> <select name="p_name"> <?php $sql = mysqli_query($con, "select * party"); while ($row = $sql->fetch_array()){ echo '<option value="'.$row['type_party'].'">'.$row['type_party'].'</option>'; } ?> </select> <p> <strong>max no. of children</strong> <input type="text" id="txt" name="nocc" placeholder="type children" required="required" /> </p> i want retrieve data in textfield corresponding data of option select in droplist. in table: have id , type_party , capacity , , want receive capacity in textfield when select type_party in dropdownlist. please me out. given, use jquery, achieved storing capacity in data attribute. <strong>type of party</strong> <select name="p_nam

postgresql - OSM: Import ways without tag using osm2pgsql -

i have special problem when importing osm data osm2pgsql. searching days on how import ways not have tag part of relation (which has tags) postgresdb. take following way example: http://www.openstreetmap.org/way/50126690 can see not have tags part of relation http://www.openstreetmap.org/relation/2 … 81/12.3246 tagged cross country slope. when import data postgresql, way 50126690 not imported. when use --hstore option should keep objects if believe documentation on http://www.volkerschatz.com/net/osm/osm2pgsql-usage.htm way not imported planet_osm_line table. default.style looks that: # osmtype tag datatype flags node,way access text linear node,way addr:housename text linear node,way addr:housenumber text linear node,way addr:interpolation text linear node,way admin_level text linear node,way aerialway text linear node,way aeroway text polygon node,way amenity text

c# - String.join array from last element -

i have scenario getting comma separated string lastname, firstname. have convert firstname lastname. my code below: public static void main(string [] args) { var str = "lastname, firstname": var strarr = str.split(','); array. reverse(strarr); var output = string.join(" ", strarr); } is there better way this, in 1 line or using linq? yes there reverse extension method ienumerables: var output = string.join(" ",str.split(',').reverse());

html - mysql & php select * query not working -

i have table in db called sales. each row has value in column federal. want collect federals in array within code, doesn't work , dont know why... please help! thanks! <?php $db = mysqli_connect("server", "usr", "pw", "db"); $federalres = $db->query("select * `sales` `state` = 'Österreich'"); //gets every row state = 'Österreich' $federals = array(); // empty array collect federals while ($row = $federalres->fetch_object()) { if (!in_array($row->federal, $federals)) { // check if federal in array array_push($federals, $row->federal); // adds federal array } } sort($federals); // sorts array alphabetically foreach ($federals $key => $value): ?> <li><?php echo $value ?></li> <?php endforeac

How divide the dataset into equal quantile in matlab -

i converting isi paper code project. main loop executed received great difficulty in section bellow: // database divided equal quintiles , these quintiles assigned numbers 5 1. therefore, 20% of customers purchased company assigned number 5. next step involves sorting frequently, monetary. therefore, database divided 125 equal groups (cells) according recency, frequency, , monetary value. customers/products high scores profitable please regarding syntax dividing dataset equal quantiles , on. thanks

c# - Date filter for facebook conversation/messages using graph API -

i using facebook graph api reading facebook conversation messages using following url https://developers.facebook.com/docs/graph-api/reference/v2.8/conversation/messages/ like- t_mid.1466951718460:2af7cf802579518c97/messages conversation may have many messages downloaded. there way add date filter while reading messages conversation? if possible, can please share should querystring that

dynamic - How to use a parameter column name value in postgresql? -

i have issue need calculate variable on basis of different start , end date can change per client. currently, have implemented solution below:- for example: created static table : ref_table columns : training_start_date, training_end_date values : isb_start_dt , isb_end_dt i.e. 1 row. table created if client wants use dates, values can changed to values : cs_start_dt , cs_end_dt or anything. note: table contain 1 row @ time. query used: create table ref_table(training_start_date varchar(30), training_end_date varchar(30); insert ref_table values('isb_start_dt','isb_end_dt') now, there sql query use table , calculate features using that, there lot of columns , features being used in query giving sample code. sample code: create or replace view prm_vw select s2.*, case when newvalue < 0 null else newvalue end newvalue1 ( select

Exception in thread "main" - java.util.InputMismatchException error? -

Image
i getting error , don't know what's problem: exception in thread "main" java.util.inputmismatchexception @ java.util.scanner.throwfor(unknown source) @ java.util.scanner.next(unknown source) @ java.util.scanner.nextint(unknown source) @ java.util.scanner.nextint(unknown source) @ productratings.loadfile(productratings.java:45) @ productratings.main(productratings.java:178) here's code: in first photo error in line of 45 (customer.setcustomerid(scanner.nextint();) and other part of code: in second photo error in line of 178(ratingmgr.loadfile();) public static void main(string[] args) { string filename="ratings.txt"; productratings ratingmgr=new productratings(filename); try { ratingmgr.loadfile(); string typename[]={"all","national","international","national doctor"}; for(int i=0;i<typename.length;i++) { system.out.println("average rating

Barcode Scanner With Image capture in Xamarin.forms -

i have implemented barcode scanner in xamarin application using xzing.net.mobile.forms component.which gives me bar code number. if want capture image @ same time of scanning .is there other plug in available give me image bar code. appreciated. in advance. i think can use zxing.mobile.barcodewriter (it should exists xamarin forms) public static imagesource qr(string data, int w, int h, int m) { var gen = new barcodewriter { format = barcodeformat.qr_code, options = new zxing.common.encodingoptions { height = h, width = w, margin = m } }; var bytes = gen.write(data); return imagesource.fromstream(() => new memorystream(bytes)); }

c++ - Casting operator-overloading to return 2-dim array to access external library -

class m33 { public: double m[3][3]; double (*getm())[3] { return m; } }; // call jpl cspice f2c generated routine // void mxm_c ( const double m1 [3][3], // const double m2 [3][3], // double mout[3][3] ) void test() { m33 m1; m33 m2; m33 mout; mxm_c( m1.m, m2.m, mout.m ); // works mxm_c( m1.getm(), m2.getm(), mout.getm() ); // works } using vs2013. question: possible use casting operator such as... operator double*[3] () // not compile { return m; } thereby allowing coding style shortcut? mxm_c( m1, m2, mout ); // not work yes, can such operator. when complex types involved, it's best introduce alias: using ptr = double (*)[3]; operator ptr() { return getm(); } [live example]

linq - EntityFramework Core Union Select - Null Related Data -

to better picture, trying have feed composed different elements (i'll try make example short possible) : public class feeddto { public int type { get; set; } public datetime date { get; set; } [jsonproperty(nullvaluehandling = nullvaluehandling.ignore)] public commentdto comment { get; set; } [jsonproperty(nullvaluehandling = nullvaluehandling.ignore)] public likedto { get; set; } public static feeddto setcomment(comment comment, int userid) { return new feeddto { type = activity_feed_type.comment, date = comment.createdate, comment = comment.adapt(userid) }; } public static feeddto setlike(like like, int userid) { return new feeddto { type = activity_feed_type.like, date = like.createdate, = like.adapt(userid) };

database - How to convert composite attribute E/R diagram in UML diagram? -

Image
i have entity person , has attribute "address" . attribute address, has attribute "street name" , "zip code" . now, asked make uml diagram , have no clue on how make when have attribute of attribute. i have already: person id << pk >> address: string but should "street name" , "zip code", now? part of "address", how state in uml? me, schema one: , after have question model storage, have @ least 2 choices : 2 tables association or embed adress in person table. , last point how model annotation in uml ... not know official answer. maybe 3 options exist : use comment describe that, define 1 ste

php - Symfony2 - CalendarBundle - How to fetch user informations from database to render on calendar -

so, new symfony , i'm trying create functional calendar based application events rendered database using calendar-bundle . passing documentation able make relationship between users , events rendered on calendar i'm stuck passing particular data, more user name. below shown evententity responsible calendar event's details. <?php namespace adesigns\calendarbundle\entity; /** * class holding calendar event's details. * * @author mike yudin <mikeyudin@gmail.com> */ class evententity { /** * @var mixed unique identifier of event (optional). */ protected $id; /** * @var string title/label of calendar event. */ protected $title; /** * @var string url relative current path. */ protected $url; /** * @var string html color code bg color of event label. */ protected $bgcolor; /** * @var string html color code foregorund color of event label. */ protected $fgcolor; /** * @var string css class event label */ protected $cssclass; /** * @var \d

changing a specific index bit in a binary number in Scheme(Racket) -

i need implement in scheme possibility change specific bit in binary number. the input : 1.binary number , 2.index of bit change, 3.value set in index. how can implemented? here beginning of solution. can see what's need done in remaining case? ; bit-index->number : natural -> natural ; return number in binary notation has 1 in position n ; , has zeros elsewhere (define (bit-index->number n) (expt 2 n)) ; example (displayln (number->string (bit-index->number 3) 2)) ; 1000 ; is-bit-set? : index natural -> boolean ; bit n set in number x? (define (is-bit-set? n x) ; bitwise-and 0 unless bit n set in number x (not (zero? (bitwise-and (bit-index->number n) x)))) (define (set-bit! n x b) (cond [(= b 1) ; need set bit n in x 1 (cond [(is-bit-set? n x) x] ; set [else (+ x (bit-index->number n))])] ; add 2^n [(= b 0) ; <what goes here?> ]))

java - Set up both TTL and TTI in Ehcache 3 XML configuration -

what trying accomplish set both ttl (time live) , tti (time idle) cache, key either expires after ttl time or can expired earlier in case in hasn't been accessed tti period. in ehcache 2 possible following configuration: <cache name="my.custom.cache" timetoidleseconds="10" timetoliveseconds="120"> </cache> in ehcache 3 analogous configuration block looks following: <cache alias="my.custom.cache"> <expiry> <tti unit="seconds">10</tti> <ttl unit="minutes">2</ttl> </expiry> </cache> the problem such configuration considered invalid since ehcache.xsd states there should one option under expiry tag (either tti or ttl , not both). as mentioned louis jacomet on mailing list : in order achieve want, need create custom expiry , can expirations.builder() introduced in 3.3.1, or custom implementation of ex

error while adding tags to a post in rails -

i wanted add tags products in rails project, watched youtube video how ( https://www.youtube.com/watch?v=rzx5mrca0pc&t=254s ) did did, when add new product error - 'new product 1 error prohibited product being saved: user must exist' , right above new product form how fix it. my routes rails.application.routes.draw devise_for :users, :controllers => { :registrations => "registrations"} resources :products 'home/contactus' 'home/login' 'home/store' 'home/blogs' 'home/index' resources :home root 'home#index' my product model class product < activerecord::base belongs_to :user has_many :taggings, dependent: :destroy has_many :tags, through: :taggings def self.tagged_with(name) tag.find_by!(name: name).products end def all_tags=(names) # names="music, spotify" self.tags = names.split(',').map |name| ta

angularjs - How to specify date only in angular-bootstrap-datetimepicker -

it seems insist on making choose time also. went through read me several times , i'm not seeing how date. https://github.com/dalelotts/angular-bootstrap-datetimepicker you need set minview day in config datetimepicker-config="{'minview':'day'}" . restricts selection till level. so, making day , won't let select further day s. this: <datetimepicker ng-model="date" datetimepicker-config="{'minview':'day'}" /> that should it!

android - How to use preference fragment -

i have following code preferences named settings. want code happens if l click item lets list dialog , select text size. want text size of activities changed. settings.xml <preferencescreen android:title="settings" android:summary="setrings text size , background colour"> <intent android:targetpackage="com.ecb" android:targetclass= "com.ecb.hymbook.hym1"/> </preferencescreen> <checkboxpreference android:key="checkbox_preference" android:title="@string/ title_checkbox_preference" android:summary="@string/ summary_checkbox_preference" /> </preferencecategory> <preferencecategory android:title="@string/ dialog_based_preferences"> <listpreference android:key="list_preference" android:title="@string/ title_list_pr

HighCharts Export Server Fails To Return JPG or PNG Images -

i have updated our internal highcharts eport server uses java , phantomjs lastest available git repo . solved issues having when changed out code pages support international character sets. however, now, regardless of chart data size or complexity attempts return jpg or png images fail server responding: oops.., timeout converting svg, file big, or maybe have syntax error in javascript callback? i have tried increasing wait timeout , allowed data size tomcat pass through no avail. simple basic demo charts fail render (like demo ). the interesting part svg , pdf export fine - , return image/document instantly while png/jpg attempts hit max timeout. i @ loss why occurs on our export server. if revert older export version jpg/png exports fine - , using same configuration properties timeouts. tried node.js version of export server locally , exports fine (as using export.highcharts.com). how png/jpg exports work? setup using windows server 2012 apache tomcat 8 ,

wpf - Not scoping static vars properly in C# -

i'm new c# - first program. i'm trying create public static variables , constants use anywhere in program. - wrong - way have tried declare them in separate class in same namespace out of context main program. it's wpf application. code looks this: namespace testxyz { class publicvars { public const int buffonelength = 10000; public static int[] buff1 = new int[buffonelength]; public const int bufftwolength = 2500; public static int[] buff2 = new int[bufftwolength]; private void fillbuff1() { buff1[0] = 8; buff1[1] = 3; //etc } private void fillbuff2() { buff2[0] = 5; buff2[1] = 7; //etc } } } second file: namespace testxyz { public partial class mainwindow : window { public mainwindow() { initializecomponent(); } public s

android - Unable to Create EndPoint with RxJava and Reterofit2 -

i following github link consume api using reterofit , rxjava while changing type call observer in interface class getting error message. type 'java.util.observable' doesnot have type parameters apiclient: public class apiclient { public static final string base_url = "*********"; private static retrofit retrofit = null; public static retrofit getclient() { final okhttpclient okhttpclient = new okhttpclient.builder() .readtimeout(60, timeunit.seconds) .connecttimeout(60, timeunit.seconds) .build(); if (retrofit==null) { gson gson = new gsonbuilder() .setlenient() .create(); retrofit = new retrofit.builder() .addcalladapterfactory(rxjava2calladapterfactory.create()) .baseurl(base_url) .client(okhttpclient) .addconverterfactory(gsonconverte

r - Character frequency in a string -

i want create function 2 arguments show me frequency of character in given word: x <- word, y <- letter. so, created following function: frequency <- function(x,y) { word <- strsplit(x,"") counter <- 0 (i in 1:length(word)){ if (word[i] == y) counter=counter+1 } print(counter) } the basic idea of function split characters of given word, iterate on them , increase value of counter if condition met. function returns value of 0. what's cause of this? as noted frank, better avoid loops. can so: word <-"word" y <-"d" sum(unlist(strsplit(word,""))==y) [1] 1

java - Passing value to JSP in spring -

i have 3 tabs href links, <ul > <li class="active"> <a href="#tab_0" id="tab1" data-toggle="tab">search booking id</a> </li> <li> <a href="#tab_1" id="tab2" data-toggle="tab">today's booking</a> </li> <li> <a href="#tab_2" id="tab3" data-toggle="tab">search date</a> </li> </ul> when submitting form in each tab, i'm passing value server know tab i've selected, using hidden input field < input type=hidden value="tab1" id="view"/>. want same value on jsp page , select corresponding tab, on page load. i'm using spring framework. tried adding additional object in modelandview, modelandview model = new modelandview(); model.addobject("view", view); and script code i

java - Camel File: Stop route when all files are processed -

i have camel route <routes xmlns="http://camel.apache.org/schema/spring"> <route startuporder="1"> <from uri="file:d:\work\eclipse_workspace\dataengine_git_2\src\data" /> <unmarshal> <csv delimiter="|" quotedisabled="true" /> </unmarshal> <to uri="bean:csvprocessor?method=processnew" /> </route> </routes> it continuously polls directory. i want stop polling if job triggered once. if files processed route should stop how can ?? i tried below <from uri="timer:foo?repeatcount=1" /> <pollenrich> <constant>file:d:\work\eclipse_workspace\dataengine_git_2\src\data</constant> </pollenrich> but still polls continuously note: using spring camel. you can subscribe oncompletion callback (which invoked when exchange complete). , can stop route usi

c++ - Why is Runtime Error popping up? -

can please me in this? why runtime error popping up? in advance:) not c++. #include <iostream> #include<sys/types.h> #include<sys/ipc.h> #include<sys/shm.h> #include<string.h> #include<unistd.h> #define key 123456 using namespace std; int main() { int shmid=shmget(key, 128, 0666); char* addr1=(char*)shmat(shmid, 0, 0); strcpy(addr1, "hello"); int pid=fork(); if(pid!=0) { char* addr2=(char*)shmat(shmid,0,0); std::cout<<"\n"<<addr1; std::cout<<"\n"<<addr2; sleep(2); std::cout<<"\n"<<addr1; std::cout<<"\n"&l

Why are the configuration styles inconsistent in gradle? -

i new gradle , few things of gradle confuses me. things appear inconsistent coding / configuration style. for example, when configure repository jcenter or mavencentral call function / method e.g. jcenter. repositories { jcenter() } however, in same file, when try configure dependency not call functions / methods anymore. dependencies { classpath 'com.android.tools.build:gradle:2.3.1' } and there variables getting values productflavors { prod { versionname = "1.0-paid" } mock { versionname = "1.0-free" } } i sure there reason behind perceived inconcistency not find when read through documentation. explain reason? actually these examples not different. classpath 'com.android.tools.build:gradle:2.3.1' is function call well. groovy (the language in gradle build scripts written) allows leave out parenthesis around arguments in many cases.

internet explorer 11 - "content" tag in PolymerJs 1.0 not rendering table rows properly in IE11 -

<template is="dom-repeat" items="[[distchildren]]"> <px-column title> <content select=".item[[item]]" style="text-align: left"></content> </px-column> </template> i filling content in table using above code in polymer 1.0. chrome renders data properly. ie gets column values first column , it's getting messed up. attached image better comparison , understanding. enter image description here any appreciated. thanks sanjay.s

wordpress - HTML: Unable to find an error -

Image
when i'm viewing site chrome or egde, i'm getting html error in sidebar (the whole sidebar isn't clickable). i've tried find error validator.w3.org - wasn't successful. maybe can take @ - nice. (it's wordpress site) i got work!! change css #sidebar saying z-index: -1 z-index: 5 or high number. under media query having webkit minimum pixel ratio of 0. -1 means behind other elements making click element in front of it. having higher number means going on top of page instead behind something.

java - Do i need to create new Callable object for each thread? -

here 2 options 1) create 1 callable , submit multiple times callable<string> callable = new mycallable(); for(int i=0; i< 100; i++){ future<string> future = executor.submit(callable); list.add(future); } 2) create multiple callables each thread for(int i=0; i< 100; i++){ future<string> future = executor.submit(new mycallable()); list.add(future); } what best practice? if mycallable thread-safe class can reuse same instance of it, otherwise, end race conditions , inconsistent results. in other words, if mycallable tries hold state not synchronized properly, can't use same instance . for example, below mycallable class, can't reuse same instance across multiple threads (i.e., can't share executor.submit(singleinstance) ): //non-thread safe callable implementation public class mycallable implements callable<string> { private int i; @override

ios - NavigationBarButton Not Showing -

Image
is common issue when connecting tabbarcontroller using storyboard?.instantiateviewcontroller(withidentifier:) , navigationbarbuttons don't show ? , there proper way fix particular issue ? because when connect views using segue, buttons show fine on navigationbar .. please help. it's big project, couldn't take picture of whole project small part of it.

django - How to get files stored in Elastic Beanstalk instance? -

i have django (1.10) app running in elastic beanstalk. want dump apps data fixtures , download these fixtures local machine (to replicate in local database). so far, i've eb ssh'ed instance , dumped data ~/myapp_current.json. but can not find way copy file local machine. there no eb scp command.

PHP-MySQL Email type Messages sender's name storing debate -

i'm working on building database messaging system work more email rather chat. i've come across little debate whether should allow sender's name static or dynamic. what mean is, should save current user's display name when message sent or name pulled user's personal details? means if user changes his/her display name, take effect on every message ever received others. in project, not forsee users changing display names bound happen , not sure approach take. the thing comes mind if dynamically, confusing messages of given user , not find them because name has changed. any pointers? this come down how want application function. both points raised valid. if implementing feature believe go route of having usernames change dynamically. save past aliases of each user in separate table, , have page/widget display them. example, when user opens message x user hover on name , past aliases show in modal. or click on name, directed user's profile h

jquery - How use colorbox on fotorama plugin? -

i'm trying use fotorama plugin data-nav='thumb' colorbox on big image. seems work, can't give width or height @ color box. that's code: <div class='fotorama' data-nav='thumbs' data-width='100%' data-ratio='700/467' data-max-width='100%'> <div data-img='my_img' class='img-responsive' alt=''> <a class='color-box' href='link_to_my_img'></a> </div> </div> and jquery: <script type='text/javascript'> jquery(document).ready(function(){ jquery('.color-box').colorbox({ maxwidth: '10%', maxheight: '10%', rel: '.color-box', current:''}); }); </script> i've set 10% see better size of image, 1 still big. there solution take control of colorbox? thanks!!

Gradle Include Pattern -

our project started separating our unit , integration tests, used contained within same package. created task kick off our integration tests: task inttest(type: test){ systemproperty ..., system.properties[...] systemproperty ..., system.properties[...] include '**/*int*.java','**/*.func*.java','my.path.to.api.files.*' } however i"ve noticed none of our integration nor functional tests running. can see our pattern looks correct. ideas why they're not being kicked off? i running cli using gradle :application:inttest this works correctly. had dependency issue breaking us. my app.gradle file inheriting common.gradle file. common.gradle file had same name 1 of tasks, breaking tests. changed name , works now.

How do I get images to update dynamically with a slider in actionscript 3? -

here dilemma. use image stacks lot here alpha channels. want call images in series using slider. getting concatenated string pull image folder. can not images load dynamically when slide slider bar. i using frame number change file name pull next frame. can image show if put loader outside of function, when put loader in function error after error saying file cannot located. here code stands : var imgloader = new loader(); var str1 = string (".jpg"); var slidervalue:uint = myslider.sliderknob.x / 3; addeventlistener(event.enter_frame, onenterframe); function onenterframe(event:event):void { slidervalue = myslider.sliderknob.x / 3; status_txt.text = "slider position is: "+slidervalue; filetext.text = "sketch_0"+slidervalue+".jpg"; imgloader.load( new urlrequest ( "sketch_0"+slidervalue+".jpg")); addchild(imgloader); setchildindex(imgloader, 0); } first thing up, need load 1 image without slid

java - Spring: request-payload with only one element -

i want implement web-service consumes 1 named parameter in request-payload. in curl view should smth like: curl -x patch myurl.net/my_service -d "{mysingleparameter: 49}" i'm trying spring, wondered map such payload method must declare new class. like: ... public static class payloadwithsingleparammsp{ public long mysingleparameter; } @requestmapping(value = "my_service", method = requestmethod.patch) public string myservice(@requestbody payloadwithsingleparammsp payload){ long valuewhichireallyneed = payload.mysingleparameter; //do job ... } ... but there way take value need (mysingleparameter) directly? you have couple options: @requestmapping(value = "my_service", method = requestmethod.patch) public string myservice(@requestbody objectnode payload){ long valuewhichireallyneed = payload.get("mysingleparameter").aslong(); //do job ... } or @requestmapping(value = "my_

cordova - Asp.Net Identity in Custom Authentication of my .Net backend -

i have asp.net mvc application using asp.net identity users , roles in azure, need create cordova mobile app using .net backend same functions in mvc. creation of users , roles done in mvc app. i have use same database , users mvc app using. how can use asp.net identity in custom authentication of mobile .net backend authenticate users in mobile application.

java - Object conversion from InputStream - Spring integration -

i trying send object on tcp serialization in client-server application. tcp client written on android system , use objectoutputstream send object. tcp server written spring integration , try read object using deserializer. this: <int-ip:tcp-connection-factory id="hosserver" serializer="connectionserializedeserialize" deserializer="connectionserializedeserialize" ..... > in class implements serializer , deserializer interfaces createing objectinputstream inputsream argument in deserializer method. working fine moment try connect 1 more time server. receive eofexception during reading object form objectinputstream readobject() method. public class commandconverter implements serializer<command>, deserializer<command>{ private objectinputstream ois = null; private objectoutputstream oos = null; private commandbuilder commandbuilder = new commandbuilder(); public command deserialize(inputstream inputstream)

python - sparse_softmax_cross_entropy_with_logits results is worse than softmax_cross_entropy_with_logits -

i implement classic image classification problem tensorflow, have 9 classes, first use softmax_cross_entropy_with_logits classifier , train network, after steps gives 99% train accuracy, then test same problem sparse_softmax_cross_entropy_with_logits time doesn't converge @ all,(train accuracy around 0.10 , 0.20) only information, softmax_cross_entropy_with_logits , use [batch_size, num_classes] dtype float32 labels, , sparse_softmax_cross_entropy_with_logits use [batch_size] dtype int32 labels. does have idea? update: this code: def costfun(self): self.y_ = tf.reshape(self.y_, [-1]) return tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(self.score_, self.y_)) def updatefun(self): return tf.train.adamoptimizer(learning_rate = self.lr_).minimize(self.cost_) def perffun(self): correct_pred = tf.equal(tf.argmax(self.score_,1), tf.argmax(y,1)) return(tf.reduce_mean(tf.cast(correct_pred, tf.float32))) def __init__(self,x,y,lr,lyr

When doing a sort in typescript I get a git bash compiler type error -

when doing sort in typescript git bash error code works fine i'm using webpack angular version 4 typescript in angular cli. when doing ng serve typescript arithmetic operator error. the sort function has issue below. sort code looks fine in terms of js when in ts doesnt compile. here's code works fails when compiling in typescript: getalljobs = (): void => { this.recentjobs = []; let alljobs = []; this.jobservice.getalljobs().then((alljobs: any) => { //error here - sort error here in typescript compiler alljobs.sort((a: any, b: any) => { return new date(b.sortdate) - new date(a.sortdate); }); }); } typescript complains because thinks since date object , using arithmetic operators, incompatible. happens in javascript when (new date(b.sortdate)).valueof() - (new date(a.sortdate)).valueof(); new date().valueof() returns number. you can use + operator coerce date numbe

javascript - How to chain dispatch in ngrx? -

eg this.store.dispatch(this.nowchannellistactions.togglechannel(channel)); this.store.dispatch(this.playersearchactions.searchcurrentquery()); in above code want second dispatch start after completetion of reducers , effects of first. dispatch being asynchronus , yet not returning , not proving callback either, can't figure out how that.

amazon web services - S3fs mount error -

i using s3fs mounting wrt s3 bucket my s3 bucket aes256 encrypted mount command is s3fs -o dbglevel=info -o allow_other -o use_sse=1 -o use_cache=/tmp bucketname /s3mnt doing dont error message , mount not happening /var/log/messages has these error s3fs.cpp:s3fs_check_service(3765): invalid credentials - result of checking service apr 14 12:23:31 ip-10-245-10-14 s3fs[74691]: curl.cpp:checkbucket(2899): check bucket failed, s3 response: <?xml version="1.0" encoding="utf-8"?> <error> <code>accessdenied</code> <message>access denied</message> <requestid>2f78b1bc9ac11266</requestid> <hostid>lonyfl8dx8dqbnooqoudwwi7pyzwixzl3lewoicjy39pllmgnfbgwhvsrof4uglvccdfkhvxxa4=</hostid> </error> any help? amazon emits error incorrect credentials. make sure $home/.passwd-s3fs or /etc/passwd-s3fs correct.

Query in rails with specific time zone -

i trying make query timezone set in application query grouping default utc time zone. how can use time zone set in config file? i have following code: trans = table.order("date(created_at)").group("date(created_at)").limit(30) trans.count.each |key,value| labels_array.push key sales_array.push value end trans.sum(:amount).each |key,value| revenue_array.push value end i think set # application.rb config.time_zone = 'your timezone' that's change rails timezone not activerecard (continue save in utc). if want change activerecord timezone # application.rb config.time_zone = 'your timezone' config.active_record.default_timezone = :local my opinion - it's not bad think it's practice when system in utc (database, cache, etc.). you can group timezone using sql #mysql example .group("date(convert_tz(your_field, 'utc','<name of time zone>'))")

reactjs - Cannot get react-i18next to read JSON files via FETCH backend -

Image
i'm trying use react-i18next on client using i18next-fetch-backend , , though can json translation files via browser, screwy how they're being handled during init routine. for record, i'm using create-react-app basis of front-end react application, if makes difference, , far of testing in localhost (with react app on localhost:3000, , "server" on localhost:8000). here's init file: import i18n 'i18next'; import languagedetector 'i18next-browser-languagedetector'; import cache 'i18next-localstorage-cache'; import fetch 'i18next-fetch-backend'; i18n .use(languagedetector) .use(cache) .use(fetch) .init({ fallbacklng: 'en', ns: ['common','app'], defaultns: 'common', preload: ['en'], wait: true, backend: { loadpath: 'http://localhost:8000/static/locales/{{lng}}/{{ns}}.json', addpath: 'http://localhost:8000/static/locales/{{

database - How to pull up a form based on matching criteria? -

i creating access database data entry. of right now, have welcome screen asks participant number , date evaluation completed. after that, raters taken next form fill out data gathered participant. there way have access pull completed form if participant number , date matches , has been entered? help! more 1 way accomplish. 1 approach apply filter criteria when opening form. simple example: if not isnull(dlookup("fieldname", "tablename", "criteria here")) docmd.openform "form name", , , "criteria here" else docmd.openform "form name", , , , , acformadd, "new data here" end if also, ways pass new data opened form , populate fields of new record. 1 approach use openargs argument of openform (the 'new data here' shown in example). , code behind second form pull values openargs. if me.newrecord 'code extract data elements openargs , populate fields 'or if opening scre