Posts

Showing posts from August, 2010

angular - Converting AngularJS deffered promise to AngularX observable for JSOM -

i converting angularjs application angular 4 gets data sharepoint. using jsom , executequeryasync() method. i data executequeryasync() server , store in observable in service. code have transform old version (which not me) below. struggle syntax when converting service. have absolute no plan how convert angular 4. getallstatusreps($scope) { const deferred = $q.defer(); const ctx = sp.clientcontext.get_current(); const web = ctx.get_web(); const statuslist = web.get_lists().getbytitle(this.statuslistname); const twitterlist = web.get_lists().getbytitle(this.twitterlistname); const statreps = statuslist.getitems(this.getqueryforallstatusreps()); const twitreps = twitterlist.getitems(this.getqueryforallstatusreps()); const querytext = ` <view> <rowlimit>1</rowlimit> <viewfields>{0}</viewfields> <query> <where><isnotnull><fieldref name=...

powershell - Convert text file to ANSI format -

i running 2 powershell scripts. 1 powershell script adds host name text file. other powershell script appends ip address of machine same file. so, .txt file looks follows: hostname ipaddress but, file being saved in unicode format default. can that, text file stored in ansi format? i use powershell v2.0. [system.text.encoding]::default issinglebyte : true bodyname : iso-8859-1 encodingname : western european (windows) headername : windows-1252 webname : windows-1252 windowscodepage : 1252 isbrowserdisplay : true isbrowsersave : true ismailnewsdisplay : true ismailnewssave : true encoderfallback : system.text.internalencoderbestfitfallback decoderfallback : system.text.internaldecoderbestfitfallback isreadonly : true codepage : 1252 depending on how outputting text may need set encoding type. using out-file -encoding use type of ascii . depends on version of powershell you're using. see: ss64 out-file , set encoding ansi in powershell 2.0

angular - Progressive Web App With .NET Core and .cshtml Files -

Image
hello trying turn angular 2+ application progressive web app , running issues , not sure if using service worker correctly. have 2 main questions on how should setting up. first, seeing following error in console , not sure need change correct url "starturl"... site cannot installed: no matching service worker detected. may need reload page, or check service worker current page controls start url manifest here plugin in webpack (this seems generating manifest.json correctly not sure should using start_url). pulled example google developers blog. application resouces (service-worker.js, manifest.js, bundled js/css) going dist folder. new manifestplugin({ filename: 'manifest.json', seed: { name: "angular testing", short_name: "angular testing", theme_color: "#b92b27", background_color: "#ffffff", display: "standalone", orientation: "portra...

tensorflow - Removing then Inserting a New Middle Layer in a Keras Model -

given predefined keras model, trying first load in pre-trained weights, remove 1 3 of models internal (non-last few) layers, , replace layer. i can't seem find documentation on keras.io such thing or remove layers predefined model @ all. the model using ole vgg-16 network instantiated in function shown below: def model(self, output_shape): # prepare image input model img_input = input(shape=self._input_shape) # block 1 x = conv2d(64, (3, 3), activation='relu', padding='same', name='block1_conv1')(img_input) x = conv2d(64, (3, 3), activation='relu', padding='same', name='block1_conv2')(x) x = maxpooling2d((2, 2), strides=(2, 2), name='block1_pool')(x) # block 2 x = conv2d(128, (3, 3), activation='relu', padding='same', name='block2_conv1')(x) x = conv2d(128, (3, 3), activation='relu', padding='same', name='block2_conv2')(x) x =...

jquery - Loading javascript effect inside DIV element -

so found effect , i'm trying modify loaded inside div myeffect , example: <html> <head></head> <body> <div class="myeffect"></div> </body> </html> i tried changing variables i'm not javascript expert , can't work inside dic. effect covers whole screen top bottom. the code on codepen , can found here: https://codepen.io/emilykarp/pen/bvqxrm help welcome. hope helps var speeds = []; var count = 1; var colors = ['#bf1e2e', '#ee4037', '#dc5323', '#e1861b', '#e1921e', '#f7ac40', '#f7e930', '#d1da22', '#8bc43f', '#38b349', '#008d42', '#006738', '#29b473', '#00a69c', '#26a9e1', '#1a75bb', '#2a388f', '#262161', '#652d90', '#8e2792', '#9e1f64', '#d91c5c', '#ed297b', '#d91c5c', '#db1e5e...

opencv - cant find lopencv_core when install caffe -

cxx tools/extract_features.cpp cxx tools/compute_image_mean.cpp cxx tools/train_net.cpp cxx tools/device_query.cpp cxx tools/upgrade_solver_proto_text.cpp cxx tools/finetune_net.cpp cxx tools/upgrade_net_proto_text.cpp cxx tools/upgrade_net_proto_binary.cpp nvcc warning : 'compute_20', 'sm_20', , 'sm_21' architectures deprecated, , may removed in future release (use -wno-deprecated-gpu-targets suppress warning). cxx tools/convert_imageset.cpp nvcc warning : 'compute_20', 'sm_20', , 'sm_21' architectures deprecated, , may removed in future release (use -wno-deprecated-gpu-targets suppress warning). cxx tools/caffe.cpp cxx tools/test_net.cpp cxx examples/siamese/convert_mnist_siamese_data.cpp cxx examples/mnist/convert_mnist_data.cpp cxx examples/cpp_classification/classification.cpp cxx examples/cifar10/convert_cifar_data.cpp cxx .build_release/src/caffe/proto/caffe.pb.cc ar -o .build_release/lib/lenter code hereibcaffe.a ld -o .build_...

heap - How can you allocate a raw mutable pointer in stable Rust? -

i trying build naive implementation of custom string -like struct small string optimization. unions allowed in stable rust, came following code: struct large { capacity: usize, buffer: *mut u8, } struct small([u8; 16]); union container { large: large, small: small, } struct mystring { len: usize, container: container, } i can't seem find way how allocate *mut u8 . possible in stable rust? looks using alloc::heap work, available in nightly. if you'd allocate collection of u8 instead of single u8 , can create vec , convert constituent pieces, such calling as_mut_ptr : use std::mem; fn main() { let mut foo = vec![0; 1024]; // or vec::<u8>::with_capacity(1024); let ptr = foo.as_mut_ptr(); let cap = foo.capacity(); let len = foo.len(); mem::forget(foo); // avoid calling destructor! let foo_again = unsafe { vec::from_raw_parts(ptr, len, cap) }; // rebuild drop // *not* use `ptr` / `cap` / `len` anym...

AVAudioPlayer swift beginner help need -

anyone kind me, create function code in swift3? have button pressed plays sound "push" how can simplified when have lots of buttons, don't want add codes every button. var myaudio = avaudioplayer() // add sound { try myaudio = avaudioplayer(contentsof: nsurl(fileurlwithpath: bundle.main.path(forresource: "push", oftype: "mp3")!) url) } catch { nslog("no file!") } //call sound myaudio.play() no made changes i did func play(name : string){ { try myaudio = avaudioplayer(contentsof: nsurl(fileurlwithpath: bundle.main.path(forresource: name, oftype: "mp3")!) url) } catch { nslog("no file!") } } @ibaction func buttonfirst(_ sender: uibutton) { play(name: "push") myaudio.play() } @ibaction func buttonsecond(_ sender: uibutton) { ...

chart.js - chartjs: trying to rotate the y-Axis label -

i've tried things 'maxrotate' , 'rotate', placing them in scalelabel , on. couldn't find in docs. search results on google not of either. var mychart = new chart(ctx, { type: 'line', data: chartdata, options: { elements: { point: { radius: 0 } }, scales: { yaxes: [{ ticks: { beginatzero:true }, scalelabel: { display: true, labelstring: 'mw', }, }], xaxes: [ { gridlines: { display: false , color: "#ffffff" }, ticks: { callback: function(tick, index, array) { return (index % 2) ? "" : tick; } } }] } } });

azure - Visual Studio Cloud Explorer fails: Unable to retrieve subscription -

Image
i using visual studio 2017 , trying connect azure account remote debugging. when sign in account, sign me in say: unable retrieve subscriptions. try refreshing. i had few azure accounts. deleted 1 , disappeared. tried add 1 care right , still same error. any idea problem and/or solution be? much! update: server explorer fails. not great workaround, vs15 cloud explorer still working while vs17 not. also, vote here: https://developercommunity.visualstudio.com/content/problem/76138/cloud-explorer-unable-to-show-subscriptions.html

Codeigniter Ajax Datatable showing Error -

i have referred link make codeigniter datatable ajax based datatable. http://mbahcoding.com/tutorial/php/codeigniter/codeigniter-simple-server-side-datatable-example.html but showing error , not showing data in datatable. message: undefined index: length message: undefined index: start message: undefined index: draw please me remove these errors. my jquery $(document).ready(function(){ //ajax datatable //datatables var datatable = $('#datatables-suburb').datatable({ processing: true, //feature control processing indicator. serverside: true, //feature control datatables' server-side processing mode. order: [], //initial no order. // load data table's content ajax source ajax: { url: "<?php echo site_url('admin/states/state_table_ajax')?>", type: "post" }, //set column definition initialisation properties. co...

wordpress - WooCommerce Shortcode Pagination - again -

bringing on wp dev section. over years, there have been lot of folks have asked adding pagination woo shortcodes & woo has declined add functionality in, there have been couple of solutions. i've seen 1 ( link ) seems popular i've not been able make work on client's site. does here have experience particular bit of code & require shortcode change? specifically, particular client's shortcode [sale_products per_page="200"], can see why need institute pagination. if can cut down quarter of that, immensely. many in advance & tell me if i'm being obtuse, please. -jc

html - Regex not capturing newlines when used in sed or perl -

this question has answer here: how search , replace across multiple lines perl? 2 answers i have csv file i'm trying clean, , part of removing html tags inside of values. came across solution: sed -e 's/<[^>]*>//g' file.html thread . before trying out, tested regex ( /<[^>]*>/g ) using regexr . used following text sample: <asd> < asd > < asdsad adsad > on regexr, 3 tags matched, however, when use sed command remove tags, third tag remains, i.e. i'm left with: < asdsad adsad > i need able remove multiline tags well, many of tags in csv i'm attempting clean have attributes quotes, class="some-class-name" , , quotes messing csv formatting. i've tried perl command, perl supposed have better multiline handling. tried perl -pe 's/<[^>]*>//g' file , had same result se...

Expand EC2 amazon instance disk space -

l try install pytorch on amazon follow : conda install pytorch torchvision cuda80 -c soumith l following error : package plan installation in environment /home/ubuntu/anaconda2/envs/crnn: following new packages installed: cuda80: 1.0-0 soumith pytorch: 0.1.12-py27_2cu80 soumith [cuda80] torchvision: 0.1.8-py27_2 soumith proceed ([y]/n)? y condaerror: ioerror(28, 'no space left on device') condaerror: ioerror(28, 'no space left on device') condaerror: ioerror(28, 'no space left on device' when l run following command : df -h l following : filesystem size used avail use% mounted on udev 30g 0 30g 0% /dev tmpfs 6.0g 8.6m 6.0g 1% /run /dev/xvda1 7.7g 7.4g 361m 96% / tmpfs 30g 0 30g 0% /dev/shm tmpfs 5.0m 0 5.0m 0% /run/lock tmpfs 30g 0 30g 0% /sys/fs/cgroup tmpfs 6.0g 0 6.0g 0% /run/use...

c# - Critical section with state variable using Interlocked.Exchange -

i have critical section i'm trying protect using interlocked.exchange on member variable ( int _state ). code: if (interlocked.exchange(ref _state, 1) == 0) { // *** danger zone *** try { // } { _state = 0; } } _state read elsewhere determine state, required. my concern should exception occur in "danger zone", _state never set 0 , critical section never able entered again. is there better way of doing while still being able set state variable? should using double lock pattern?

user interface - Python Event binding on label , Event and binding in differents class -

my problem have binding label event , event in different classes dont know how assign label event in class.i try so: class windowinhalt(): def label(self): label = label(self.tkwindow, text="what fuck", fg="black",bg="lightyellow", font=('arial', 14)) label.bind("<button-1>", eventsbinding.test) #here assign label.place(x=300, y=50, width="200", height="20") and here event class: class eventsbinding(windowinhalt): def test(self, event): print("gedrückt") when start error: traceback (most recent call last): file "d:\programme\python\lib\tkinter\__init__.py", line 1699, in __call__ return self.func(*args) typeerror: callback() missing 1 required positional argument: 'event' if can me gratefull ^^ edit 1: here full code #mein erstes gui python programm mit tkinter #created: july,2017 #creator: yuto tkinter import * #class...

javascript - Prevent form from submitting when certain fields are empty -

i appreciate on one. tried use code other questions, unfortunately doesn't work. i trying prevent form submitting , show alert ("select dates continue")if 2 specific fields empty. in case " checkin " & " checkout " this code first input field: <input type="text" id="checkin" readonly="true" name="checkin" class="form-control search-input" placeholder="check-in date" data-provide="datepicker-inline" data-date-orientation="bottom" data-date-autoclose="true" data-date-start-date="now" data-date-format="<?php echo $javascriptlocal ?>" data-date-language="<?php echo $language ?>"required> <div class="input-group-addon search-icon-right" onclick="$('#checkin')[0].focus()" onfocus="$('#checkin')[0].focus()"> code second field: <input type="text...

elasticsearch - Logstash omitting daylight saving time when parsing date -

my log file contains timestamp without timezone indicator. in format dd-mmm-yyyy::hh:mm:ss my server located in central europe, in timezone utc+1 uses dst results in utc+2. a date in log file: 2017-07-25::17:30:00 parsed 2017-07-25t16:30:00z . should 2017-07-25t15:30:00z . in dst now. logstash seems consider timezone not dst. how can fix this? my logstash config: date { match => ["logdate", "dd-mmm-yyyy::hh:mm:ss"] target => "@timestamp" remove_field => "logdate" } you need specify timezone dates in: date { match => ["logdate", "dd-mmm-yyyy::hh:mm:ss"] target => "@timestamp" remove_field => "logdate" timezone => "europe/zurich" <-- add line } you may change "europe/zurich" whatever timezone makes sense you ( other list of time zones might of use )

spring - JBoss - Wildfly version -> NoSuchBeanDefinitionException -

Image
i had lines of code in web.xml file in java- spring application , worked fine jboss7.1 , windows 7. <context-param> <param-name>contextconfiglocation</param-name> <param-value> classpath*:my/package/name/datasourcebean.xml classpath*:my/package/name/mydaobeans.xml classpath*:my/package/name/service/myservicebeans.xml classpath*:/web-inf/mvc-dispatcher-servlet.xml </param-value> jboss7.1 not work unter windows 10 - therefore had upgrade jboss wildfly version. , version following error @ start time: cannot resolve reference bean 'mydaobean' while setting constructor argument; nested exception org.springframework.beans.factory.nosuchbeandefinitionexception: no bean named 'mydaobean' defined i looked application in standalone folder of jboss wildfly , there no xml- config file. work spriing tool suite version 3.8.3.release. question why xml- config files not packaged? [edit] here picture of project - seems /sr...

c# - How do ViewModels prevent malicious database changes? -

while looking @ this answer question why use viewmodels? , came across section: "a view should not contain non-presentational logic" , "you should not trust view" (because view user-provided). providing model object (potentially still connected active databasecontext) view can make malicious changes database. what refer to? if have userid , password in model , viewmodel, security come in? kind of check in controller? check? how determine can trust data view? handled antiforgery token? i believe answer referring over-post problem. when utilize entity class directly view, , particularly if save posted entity directly database, malicious user modify form post fields should not able modify. for example, let's had form allows user edit widgets. let's have row-level permissions, such user can edit widgets belong them. so, joe, our fictitious malicious user, edits widget he's allowed edit id 123. but, decides wants mess jane...

javascript - Have chromium web browser open up URL links in google chrome -

is there way this? i not entirely familiar how work basically, keep commonly used notetaking applications on chromium , have tons of url bookmarks here. i click link opens chromium default, nice if open active window have in chrome instead this way organize chrome apps follows: google chromium → common notetaking tools + bookmarks google chrome → web browsing google canary → of dev environment / app testing this reduce amount of time takes me transition between notetaking , citing docs, , reading material online so how can have chromium web browser open clicked url links in google chrome? default tamperscript? javascript? chrome settings? windows default app protocols?

Invoke multiple drag in iOS simulator -

just wondering how invoke multiple drag in ios simulator. can single item, how add current drag? you can't multitouch in simulator, can add items started drag: start dragging 1 item usual, hold down ctrl key , (while holding down ctrl ) release click trackpad. simulator drop 1 virtual finger (represented greyish circle) @ last position of drag , keep dragged object there. can stop holding ctrl , continue navigating app cursor , add items drag clicking on them. if want resume drag, click , hold circle , continue drag before. source: twitter

php - wordpress redirect is not working via form -

i have created custom form in footer.php , in form action have placed action=" , when submit form data saving not know how come when form submitted comes blog page of link url remain same not know why comes blogpage can anyine me out concern please <form class="booking-form" method="post" action="<?php the_permalink(); ?>"> <div class="form-group"> <h5> name </h5> <input type="text" class="form-control" name="name"> </div> <div class="form-group"> <h5> phone </h5> <input type="text" class="form-control" name="phone"> </div> <div class="form-group"> <h5> address </h5> <tex...

swift - Make images flow from right to left within a NSImageView on click -

Image
i wondering how possible animate change of image in imageview on os x. know fading in (and out), question how let images flow in (from right left) when user clicks on button display next/previous image. example, should "pageview" on ios, when scroll, on websites ( like swift 3... ). so user should able control image flow buttons , images shouldn't slide every 5 seconds or so. i attached picture of current storyboard. storyboard thanks answers! :-) this solution depends on third party library if like, flopageviewcontroller trick. may worthwhile go through code , try implement in house library may not actively updated. luck! image taken https://github.com/floschliep/flopageviewcontroller

java - Intellij IDEA failed to run -

Image
i error every time run idea, seems because use 64 bit running idea of 32 bit. i've searched, refers me use idea64.exe, can find it? intellij idea bundled 64-bit java version. 32-bit jdk not provided. if install on 32-bit system, there checkbox in installer automatically download , configure 32-bit runtime intellij idea. installer has options create both 32-bit , 64-bit executable shortcuts. if want run 64-bit version, use idea_home\bin\idea64.exe . or can download runtime version , unpack idea_home directory (so have idea_home\jre ). make sure start intellij idea bin\idea.exe instead of bin\idea64.exe . start intellij idea in 32-bit mode. another option download .zip version windows, has both 32-bit , 64-bit runtimes. can use either bin\idea.exe or bin\idea64.exe run (if on 64-bit system):

Sharing code across Swift OpenWhisk actions -

i'm trying out openwhisk actions in swift. better or worse, of openwhisk documentation javascript. when writing actions in javascript, looks can package code npm module , require/import action. swift, there's no indication there's way share code. found 1 sample project ( https://github.com/swiftontheserver/drinkchooser inestimable @rob-allen) uses clever trick of pre-processing source code files before building them: cat actions/_common.swift actions/myaction.swift > build/myaction.swift is there official way share code across actions? many thanks. building swift binaries locally , creating actions binaries allow this. swift's package manager generate multiple executables if have correct directory layout. this example project uses serverless framework build , deploy multiple binaries openwhisk actions. creating actions swift sources files not support providing multiple sources files code sharing.

regex - Spark column rlike converts int to boolean -

so i'm using regex spark's column rlike extract last digit string. problem after extracts digit, automatically gets converted boolean. there way me stop being automatically converted boolean? test.withcolumn("quarter", $"month".rlike("\\d+$")) for example: input: 2015 q 1 2015 q 1 2015 q 2 2015 q 2 output: true true true true expected: 1 1 2 2 i tried casting after integer returns 1 because gets converted boolean int. test.withcolumn("quarter", $"month".rlike("\\d+$").cast("integer")) spark has function extract matching regex, can use regexp_extract function this. scala> val df = seq("2015 q 1", "2015 q 1", "2015 q 2", "2015 q 2").todf("col1") df: org.apache.spark.sql.dataframe = [col1: string] scala> import org.apache.spark.sql.functions._ import org.apache.spark.sql.functions._ scala> df.withcolumn("quarter...

java - How to get a PessimisticLockException with JPA -

i trying jpa's support of database locking in order avoid concurrent requests in record. in scenario need use pesssimistic lock. got using following approach: entitymanager em; ... map<string,object> props = new hashmap<string,object>(); props.put("javax.persistence.lock.timeout", 0); em.find(myentity.class, id, lockmodetype.pessimistic_read, props) but approach handle locktimeoutexception instead of pessimisticlockexception . how handle pessimisticlockexception specifically ? according spec, pessimisticlockexception occurs on transaction-level rollback: when lock cannot obtained, , database locking failure results in transaction-level rollback, provider must throw pessimisticlockexception , ensure jta transaction or entitytransaction has been marked rollback. your transaction seems consists of single data retrieval query , persistence provider considers if lock error occurs on query, rollback considered statement-level rollb...

Get file extensions to populate into a ComboBox in C# -

so have folder imagens in many extensions .ico , .png , .jpg , etc. , i've populated combobox using code: string caminho = @"c:\users\user1\desktop\test\"; directoryinfo dir = new directoryinfo(caminho); fileinfo[] fi = dir.getfiles(); foreach (var ficheiro in fi) { string caminhof = caminho + ficheiro.tostring(); string extension = path.getextension(caminhof); combobox1.items.add(extension); } the code getting existing extensions in path , put on combobox , displays this: .ico .ico .ico .png .png .jpg .jpg and want display each 1 of existing extensions grouping them. could me that? you can file extension fileinfo . can use linq distinct() unique extensions. string caminho = @"c:\users\user1\desktop\test\"; directoryinfo dir = new directoryinfo(caminho); var extensions = dir.getfiles().select(fi => fi.extension).distinct(); foreach (var extension in extensions) { combobox1.items.add(extension); }

asp.net - Unable to launch the IIS Express Web server. Error gives when i run index.cshtml page -

when try run index.cshtml page popup message " unable launch iis express web server " application working machine1 or application not working machine2. machine2 runs other applications. i tried different way below url. "unable launch iis express web server" error my application built mvc5. can 1 me fix error?

java - Expanding a node of a JTree minimizes GridBagLayout -

Image
i have created simple swing application consists of jtoolbar, jtree , rsyntaxtextarea , inside gridbaglayout. the jtree has 1 top node , has 1 child node. complete ui jtoolbar, jtree , rsyntaxtextarea when expanding top node of jtree, whole gridbaglayout kind of "minimizes": i've googled phenominum, since there's no error message or else in console, i'm kind of helpless right now. i'm using following code create ui: rsyntaxtextarea textarea = new rsyntaxtextarea(50, 150); textarea.setsyntaxeditingstyle(syntaxconstants.syntax_style_java); textarea.setcodefoldingenabled(true); rtextscrollpane sp = new rtextscrollpane(textarea); cp.setlayout(new gridbaglayout()); gridbagconstraints c = new gridbagconstraints(); c.fill = gridbagconstraints.horizontal; c.gridx = 0; c.gridy = 0; cp.add(createtoolbar(), c); c.gridx = 0; c.gridy = 1; c.ipadx = 90; c.fill = gridbagconstraints.both; cp.add(createtree(), c); c.gridx = 1; c.gridy = 1; c.fill = gridbagco...

windows - is there any generic way to check os.Stdin or input redirected from null device? -

i check input redirected null device or not in go language.i got 1 way unix don't how deal windows or make generic.this did unix fd := os.stdin.fd() fmt.print(fmt.sprint("/proc/self/fd/", fd)) filename, err1 := os.readlink(fmt.sprint("/proc/self/fd/", fd)) if err1 != nil { fmt.print(err1) } fmt.println("filename:", filename)

condition - Add a word based on the column presents in MySQL -

consider coulumn_name1 = 'surgery' consider coulmn_name2 = 'leg' concat_ws(column_name1, ' on', column_name2) consider column_name1 = null above operation give ' on leg' if coulumn_name1 null don't want add ' on '. i used concat_ws( column_name1, if(coulumn_name1 null, '' ,' on '), column_name2) it's working fine. it's looking ugly. there simpler way it? in advance.

python - Why is try-finally valid, but not try-else-finally? -

i found python throwing syntaxerror @ me trying try without except : try: spam() else: eggs() finally: semprini() instead, forced write: try: spam() except: raise else: eggs() finally: semprini() which felt silly, want eggs() executed before semprini() — if put contents of else: -clause after finally: -clause executed after semprini() . although there has been try without except proposal in past, semantics different there implication except: pass , i.e. polar opposite of i'm after. interestingly, try: without either except: or else: is valid , can't have else: if don't have except: . although there may different way formulate same, alternatives i've thought of (probably) have subtly different behaviour. why presence of else: require presence of except: ? you should have written try: spam() eggs() finally: semprini() in absence of except clauses, else useless.

node.js - node-html-pdf businesscard example on Ubuntu -

i trying use node-html-pdf ( https://github.com/marcbachmann/node-html-pdf ) node module on ubuntu 16.04 , have started given businesscard example. unfortunately not able generate pdf. first of all, installed module locally. then copied businesscard.html , image.png project , tried execute following code no changes in it: var fs = require('fs'); var pdf = require('html-pdf'); var html = fs.readfilesync('./test/businesscard.html', 'utf8'); var options = { format: 'letter' }; pdf.create(html, options).tofile('./businesscard.pdf', function(err, res) { if (err) return console.log(err); console.log(res); // { filename: '/app/businesscard.pdf' } }); the result pdf 2 black pages (ok), correct texts, format larger, font not right , not image in it. looks basic configuration, missing path or similar... any clues? my guess if open .html file browser have same (or similar) output. probably link image src br...

kubernetes - How to scale the number of Ingress pods -

is there way scale number of ingress pods based on load? have: apiversion: extensions/v1beta1 kind: ingress metadata: name: my-service spec: rules: - host: my-service http: paths: - path: / backend: servicename: my-service serviceport: 80 and ingress controller appropriate nginx-ingress-controller . i had though ingress-controller handle scaling us? right way handle this? ingress can not scaled, ingress set of traffic routing rules , configuration. ingress controller on other hand can. the "dummy" way scale nginx-ingress number of nodes in cluster run daemonset. a more sophisticated aproach this, use horizontal pod autoscaling can scale based on resource utilisation. in both cases not scale ingress, ingress controller, meaning not related traffic/load 1 ingress, ingresses (of given type if have different)

java - gradle build daemon disappeared unexpectedly -

i error using android studio: error:unable start daemon process. problem might caused incorrect configuration of daemon. example, unrecognized jvm option used. please refer user guide chapter on daemon @ https://docs.gradle.org/3.3/userguide/gradle_daemon.html please read following process output find out more: # there insufficient memory java runtime environment continue. native memory allocation (malloc) failed allocate 1048576 bytes allocateheap an error report file more information saved as: c:\users\user.gradle\daemon\3.3\daemon\3.3\hs_err_pid10388.log and when try run get: gradle build daemon disappeared unexpectedly how solve error?

Flat NoSQL Firebase Data on Drill-Down Table -

i'm trying transition core data firebase can expand application beyond ios. i'm trying wrap brain around structuring data and, know subjective, i'm hoping on feedback experts: let's have 10,000 record database want able drill-down in table view of locations. each location may or may not have sub-headings. i'm considering structuring data follows: "locations": { "t774": { "title": "usa", "subline": "no" }, "t775": { "title": "canada", "subline": "no" }, "t776": { "title": "mexico", "subline": "no" }, "t777": { "title": "north carolina", "subline": "usa" }, "t4323": { "title": "south carolina", "subline": "usa" }, "t4354": { ...

java - I am getting a StackOverflow error in a hashfunction code but I cannot determine , can someone help me fix it/ -

i creating hash function myself university assignment. hash function works ... take string input , add ascii values of every character integer variable named sum. done in function named hash_func. in function named myhashfunc have used recursion decrease value of sum such can value lesser size of array in store data in using hash function. since using seperate chaining method resolve collisions , used linkedlist array. getting stack overflow error when function hash_func called inside myhashfunc. code given below:- package hashfunction; import java.util.linkedlist; import java.util.scanner; public class hashfunction { public static int myhashfunc(string str,int a){ int x=0; int sum = hash_func(str); if(sum<a) return sum; else{ x = x+sum%10; sum /= 10; return(myhashfunc(str, a)); } } public static int hash_func(string str) { int sum = 0; int len = str.length(); (int = 0; < len; i++) { if (str.charat(...

Using ACTION_BATTERY_LOW and ACTION_BATTERY_OKAY as trigger for synsing many android devices -

i'm trying find solution quite simple problem : playing video on large number of identical android devices @ same time. make clear, have make wall 100 7 inch sreens should play same videos @ same time. as syncing many devices wirelessly seems bit tricky, 1 idea use low-cost android tablets , replace battery direct wired 3v 3.7v connection, , use change of voltage 3.0v (low battery) 3.7v (full charge) trigger jump t=0 in pre-charged video. i've read signals action_battery_low , action_battery_okay emitted system. so, think using them triggering jump t=0 in video ? this solution allow me connect 2 wires tablets, , connecting them on batt (replacing battery), aesthetically better using micro-usb connector on side. does knows if can work ? syncing precision expect (all devices identical). if there little existing software that, i'm interesting in knowing ! or existing open source project modify, use sample, because i'm beginner in android programming... many...

android - Taking animations to the next level with React Native -

Image
i've been working react-native few months , think it's time me try take applications next level sweet animations , smooth user experience. here example of effects , experience i'd reproduce : you can see full dribbble post here : https://dribbble.com/shots/3582624-ticket-recommend (not mine) what example smooth scrolling effect , feeling get. tried similar feedback using scrollview , onscroll event animate each item, it's not not conclusive far. i know question quite open 1 , not specific component react-native i'd share our best practices , ideas create kind of applications. so feel free let me know if you've ever created or builded sort of animations or if have somewhere in bookmarks link tutorial or github me understand how works. thanks help! edit : clear, know wide range topic i'm looking here constructive discussion people sharing experiences (over opinions) backed facts , references.

vba - Is there a faster way to print a set of strings into a row in excel? -

my first pass @ involves using keyboard shortcut populate selected cell , row "may", "both", "derek", [today's date], , "uploaded". it's faster typing , want fast standard keyboard shortcuts; how can clean up? sub autofillbothmay() application.screenupdating = false ' keyboard shortcut: ctrl+shift+b activecell = "may" activecell.offset(0, 1) = "both" activecell.offset(0, 2) = "derek" activecell.offset(0, 3) = date activecell.offset(0, 4) = "uploaded" application.screenupdating = true end sub try as, activecell.resize(1, 6) = array("may", "both", "derek", date, "uploaded", true) don't bother application.screenupdating.

Inviting new user to private channel after inviting him by Slack API -

i invited new user slack team using slack api method users.admin.invite . need join him public , private channels. channels gave params in inviting request, private channels have trouble. not channels , have method join user it. method groups.invite need userid join him. possible add user in slack private channels (groups) using slack api? the undocumented api method users.admin.invite has channels property, can specify list of ids channels want new user automatically invited to. this works private channels (i tested confirm). need specify private channel id instead, start g instead of c . you can use api method groups.list correct private channel id. (private channels called groups in slack api) example request: https://slack.com/api/users.admin.invite?token=token&email=name@example.com&channels=g12345678 if still getting errors using approach due other issues, e.g. slack not recognize email address or access token not have admin right. for more...

project reactor - Why does not the runOn() method execute map operator on the next available thread from the pool when the current executing threads go to wait state? -

i trying execute following code on 4 core machine. have 5 threads in pool , within map operator, put executing thread sleep few seconds. i expect core put executing thread on sleep , when next event available, should perform map operation on next available thread thread pool, not behavior see. i see 4 threads pool go on wait 13 seconds , process next event after wait complete. why runon() method not executing map operator on next available thread pool when threads go wait state? i using reactor-core version '3.0.7.release' countdownlatch latch = new countdownlatch(10); executorservice executorservice = executors.newfixedthreadpool(5); flux<integer> flux = flux.just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); flux.parallel() .runon(schedulers.fromexecutorservice(executorservice)) .map(l -> { logger.log(reactorparalleltest.class, "map1", "inside run waiting 13 seconds"); try { thread.sleep(13000); } catch (interruptedexceptio...

javascript - How do make HTML page load after AngularJS gets response from database? -

i have table on html page data stored in database. want table or whole page loaded after data received. can this? angularjs code: angular.module("app", []).controller("controller", function($scope, $http) { $http({ method: 'post', url: 'updatecoins.php', data: {get: 1}, }).then(function(response){ $scope.db = response.data; }); }); the table gets filled this: <tr> <td>{{db[0]['percent']}}%</td> </tr> generally you'd use resolve router this. can this: angular.module("app", []).controller("controller", function($scope, $http) { $scope.dataloaded = false $http({ method: 'post', url: 'updatecoins.php', data: {get: 1}, }).then(function(response){ $scope.db = response.data; $scope.dataloaded = true }); }); then in html on outermost element load controller use ng-if="dataloaded"

cakephp - CakePhp3.2 ORM ResultSet and ORM Query Error running skeleton app on shared host -

been running cake app on shared host, worked great until recently. shared host supports apache,php 5.4.45 through php 7.0.21 , mysql server 5.6.35. fyi - skeleton app throws same error. error thrown way before database connection made. below error getting, same app works ok on local server. fatal error: class cake\orm\resultset contains 1 abstract method , must therefore declared abstract or implement remaining methods (iterator::current) in /projects/vendor/cakephp/cakephp/src/orm/resultset.php on line 593 fatal error: cannot instantiate abstract class cake\orm\resultset in /vendor/cakephp/cakephp/src/orm/query.php on line 922 looking forward insights on above. currently looks result of bug in php: https://github.com/cakephp/cakephp/issues/10936 https://github.com/cakephp/chronos/issues/147 https://bugs.php.net/bug.php?id=74833 make sure update latest cakephp version, , if problem persists, try switching php 5.6 until fixed php version, or workaround...

how to call a python program from html -

i have form in html action = "pyth.py" and pyth.py is #!/usr/bin/python print('content-type: text/html\r\n\r') print('<html><head></head><body>my first page</body></html>') so when click submit in form should run pyth.py , should give me html output. not. please me you have run python script in cgi-bin of webserver. html form action should action="/cgi-bin/pyth.py" . check out tutorial .

javascript - How can I use an Angular Material Datepicker with a reactive / model-driven form? -

i have reactive (model-driven) angular form multiple form groups (formgroupname) , controls. form-fields on form controlled , populated formbuilder in associate typescript file. i have text field on form i'm using collect date user. wanted associate angular material datepicker on field add "formcontrolname" attribute input field, error: error: more 1 custom value accessor matches form control path: ' -> ' i can't use ngmodel (switch template driven form) else on form model-driven , control sits within formgroupname block. did try putting ngmodel on here see happen , angular complained can't mix ngmodel in here. how can data-bind field (set initial value field on typescript side) , changes made user on template/view when form submitted while using angular material's datepicker? if angular material's date picker doesn't support model-driven forms, i'm willing use date-picker supports feature. my model looks (the field th...

html - Javascript element visbility not working -

i have code need with. google style search function , have separate page screen reader users. form looks this: <div id="main"> <input type="text" name="search" tabindex="<?php echo $tab++; ?>" onfocus="display_results_table()"><br> <input type="submit" name="submit" tabindex="<?php echo $tab++; ?>"> <input type="reset" name="reset" tabindex="<?php echo $tab++; ?>"> </div> <div id="results"> </div> the reason using php tab indexes don't have put them in manually , have element called results beneath that. have styled each element so: #main { border-radius: 1em; width: 50%; margin: 25%; background: #ffffff; border: #000000 medium solid; } #results { margin-left: 30%; width: 40%; margin-top: 10%; background: #ffffff; border: #000000 ...

ASP.NET MVC 5 Code first migration scheduler -

i can't seem view data on calendar. able save data scheduler/calendar , view data database table but, won't show in scheduler/calendar when refresh page. thinking wrong contentresult data() , can't figure out. private applicationdbcontext _context; public calendarcontroller() { _context = new applicationdbcontext(); } protected override void dispose(bool disposing) { _context.dispose(); } public actionresult index() { var sched = new dhxscheduler(this); sched.skin = dhxscheduler.skins.terrace; sched.loaddata = true; sched.enabledataprocessor = true; var data = new schedulerajaxdata(_context.events.select(e => new { e.id, e.text, e.start_date, e.end_date })); return view(sched); } public contentresult data() { return (new schedulerajaxdata( _context.events .select(e => new { e.id, e.text, e.start_date, e.end_date }) ...

html - CSS: parent element float apply on <a> tag content too -

this html code: <div class="pull-left small-text"> <?php if($page - 1 > 0): ?> <a href="<?php echo $page_link.'&p='.($page -1); ?>" class="btn btn-white"><i class="fa fa-chevron-right"></i></a> <?php endif; ?> <span><?php echo $page; ?> <?php echo $pages; ?></span> <?php if($page < $pages) : ?> <a href="<?php echo $page_link.'&p='.($page +1); ?>" class="btn btn-white"><i class="fa fa-chevron-left"></i></a> <?php endif; ?> </div> css: .btn { border:none; background: none; color: #fff; padding: 10px 30px; text-align: center; font-size: 0.9em; border-radius: 4px; } .pull-left{ float:left; } problem: when add pull-left class parent element , <a> t...

c# - SqlDependencyEx event inside Controller not getting fired -

i´m trying use sqldependencyex problem ondatachange event not getting fired inside controller, enabled service broker. here´s code: private const string connection_string = "server=lftcmcptp83;database=database;trusted_connection=true;multipleactiveresultsets=true; integrated security=false;user id=used_id;password=password"; private const string database_name = "db_name"; private const string table_name = "table_name"; private const string schema_name = "dbo"; private sqldependencyex sqldependency = new sqldependencyex(connection_string, database_name, table_name, schema_name); private void registernotification() { sqldependency.tablechanged += ondatachange; sqldependency.start(); } private void ondatachange(object sender, sqldependencyex.tablechangedeventargs e) { //code } public iactionresult create(){ registernotification(); } best regards ...