Posts

Showing posts from February, 2014

node.js - why do I get 'extra' characters when I decrypt a cookie from .NET using Nodejs? -

i have application running on nodejs. when receive cookie encrypted using .net framework can decrypt it: see this i used solution provided stackoverflow question. result similar this expected hmac: 88e332b9a27b8f6f8d805ae718c562c1c8b721ed actual hmac: 6beaff25834e72357fd40e80e76458091224fae8 hex: 010112ea9a47b2f2ce08fe121e7d78b6f2ce0801085400650073007400550073006500720016540065007300740020007400650073007400730073006f006e002c00200072006f006c0066007a006f007200012f00ff1d892908d9c497bd804f5f22eab043ff6368702c utf-8: ��g���}x�testusertest testsson, rolfzor/���ė��o_"��c�chp, what don't understand encoding characters result of utf-8? causing unicode characters showup? buffer issue when trying decrypt message? fwiw: thing being encrypted number, 123412341234 .

python - Adding return values of two sum() e.g sum()+sum() and store it new list -

a = map(int, raw_input().split()) n = len(a) in range(0, n): start_sum = sum(a[0:i+1]) # calculate sum of first last_sum = sum(a[-(n-i):]) # calculate sum of last n-i now have store sum of start_sum , last_sum , store in new list b index same i .like below b[i] = start_sum + last_sum how implement this. new python. great. one solution be: a = map(int, raw_input().split()) b = [] in range(0, n): start_sum = sum(a[0:i+1]) # calculate sum of first last_sum = sum(a[-(n-i):]) # calculate sum of last n-i b.append(start_sum + last_sum) other solutions possible... problem had, b had not been created list n places, putting @ place i fail.

algebra - solve linear and quadratic style equations in C# -

hi friends need suggestions requirement input in string example x^2 + x^2 + 4x + 9x + x = 10 + 1 * 2 % 4 need slove , find value of x link below link we need validation of input did need suggestions how can solve these equations using c# i split equation , create function numeric array , operators trying figure out logic how can process suggestions? public class calculation { string[] opers = new string[] { "+", "-", "/", "*", "%", "^" }; public string process(string value) { string result = string.empty; string[] equations = value.split('='); calculate(equations[0]); calculate(equations[1]); return result; } private string calculate(string eq) { string result = eq; string variable = string.empty; list<string> numberlist = new list<string>(); list<string> operatorlist = new list<string>();

python - Can pip install from setup.cfg, as if installing from a requirements file? -

according setuptools documentation , setuptools version 30.3.0 (december 8, 2016) "allows using configuration files (usually setup.cfg ) define package’s metadata , other options supplied setup() function". similar running pip install -r requirements.txt install python packages requirements file, there way ask pip install packages listed in install_requires option of setup.cfg configuration file? no, pip not have facilities parsing requirements setup.cfg . install dependencies along main package(s) provided in setup.py .

html5 - Sort and display items in a list randomly every time using pure static html(5) -

i have big list of products (10.000 unique items). have them in text file, can produce them in format (one per row, csv, etc.) i want build web page using static html or html5 (no javascript) every time when loaded or refreshed display in ordered or un-ordered list randomly chosen 25 unique items out of total of 10.000 (or round robin, etc.). is there way this? thank you. if want absolutely no javascript(or scripting), short answer is not possible. html markup language , cannot perform such scripting tasks. here w3c docs html5 , capabilities: html5

javascript - tag not working :: Uncaught DOMException: Blocked a frame with origin -

<ins class='dcmads' style='display:inline-block;width:300px;height:250px' data-dcm-placement='n318802.271411collective/b20308605.205372624' data-dcm-rendering-mode='iframe' data-dcm-https-only data-dcm-resettable-device-id='' data-dcm-app-id=''> <script src='https://www.googletagservices.com/dcm/dcmads.js'></script> </ins> above mentioned tag generate 300x250 banner image along tracking event, have wrapped 300x250 image trackers in server , generated tag. tag not rendering now, if change rendering type iframe script able preview things.i want tag working iframe, please let me know ideas

ruby on rails - check prawn pdf content after rendering with rspec -

i'm trying test content of pdf generated prawn, sure information entered comes order. 1 in response, firstly i'm not sure content totally clean , secondly how read content? i'm trying pdf-inspector i'm not sure i'm doing right way. in spec file : get :invoice, params: {id: order.number, order_token: order.guest_token, format: :pdf}, format: :pdf pdf_doc = response.body rendered_pdf = pdf_doc.render text_analysis = pdf::inspector::text.analyze(rendered_pdf) puts text_analysis.strings rspec result : 1) spree::orderscontroller#with right token should not return empty pdf failure/error: rendered_pdf = pdf_doc.render nomethoderror: undefined method `render' #<string:0x0056490fd3b7c0> # ./spec/controllers/spree/frontend/orders_controller_decorator_spec.rb:43:in `block (3 levels) in <top (required)>' finished in 17.42 seconds (files took 8.08 seconds load) 1 example, 1 failure and response.body : "%pdf-1.3\

php - Why am I getting File Does Not Exist error on App Engine when it's there in Storage, Using Laravel-Excel -

running php on app engine, laravel 5.1. the app failing on \excel::load($path); statement afterwards when @ app engine storage path file there. here code: $file = $file->move($destpath,$filename); $path = $file->getpathname(); if (in_array($file->getextension(), ['xlsx', 'xlsm', 'xltx', 'xltm', 'xls', 'xlt'])){ $newfile = \excel::load($path); //fails here $info = $newfile->store('csv', storage_path('imports'), true); \file::delete($path); $path = $info['full']; } i tried putting sleep between file->move statement didn't have effect. any suggestions appreciated. since first posted here's we've tried. we tried uploading spreadsheet directly (by passing $file->move) , loading that. didn't work. on theory open office writing file wasn't compatible, tried file save using excel. didn&

javascript - Cannot find name of module loaded with require() -

i pulling in javascript file @ top of react file (i using typescript way): let flodialog = require('../public/js/flo-dialog.min'); then there property dialog class: dialog: flodialog = null; notice type should flodialog. name of prototype object contained in module. then in constructor initialize dialog so: constructor() { super(); this.dialog = new flodialog({ effect: { fade: true }, position: 'fixed' }); } and later on call function on dialog prototype object open dialog. code work, but getting typescript error : ts2304: cannot find name 'flodialog'. on dialog: flodialog = null; line. the module file looks this: var flodialog=function(t){this.id=date.now(),this.cloak=this.rendercloakhtml()...etc..etc... (minified code) if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { module.exports = flodialog; } so export prototype object module.

Swift iOS -How to set UIView's Height Anchor <= To A Label's Intrinsic Text Size? 'NSLayoutConstraint' is not convertible to 'Bool' -

Image
i have programmatic view label inside of i'm pinning bottom of navbar. there dynamic text inside of label , want view label in @ least 64 pts or bigger if height of text makes smaller. the intrinsic size of text label sets view @ noticeable height. setviewandlabel(dynamictext: "unknown error\nplease try request again\error: 123") however intrinsic size of text makes height small: setviewandlabel(dynamictext: "message deleted!") the message deleted! should more along lines of: i used return keys set don't think that's correct way go because different messages generated: setviewandlabel(dynamictext: "\nmessage deleted!\n") i tried: if myview.heightanchor.constraint(lessthanorequaltoconstant: 64){ myview.heightanchor.constraint(equaltoconstant: 64).isactive = true } but error: 'nslayoutconstraint' not convertible 'bool' what's best way set height view label in minimum height? var my

php - Add global logs in app - what about SOLID -

i have php app, isn't compilant solid principles, whole team tries refactore code on changes. must add global logs (stored in 1 of databases), saved on creations on updates on models. models don't use orm. first solution: create static logger , call after operation on model: public function save(objectentity $entity) { // code prepare entity $this->insert($entity); logger::savelog('object has been saved'); // or maybe better - separate classes logs interface logger::save(new logobjectentitysave()); } but... correct? think not compilant solid , not make new mess in current. should add - on models, or maybe on controllers after calling model saving: public function saveaction() { // controller code here $model->save($objectentity); logger::save(new logobjectentitysave()); } but there question: 1 action save , update data in model (i add new element when don't have existing id)? if/else , 2 log classes.. still looks

data science - Need some help trying to get my Python mortgage amortization calculator to work properly -

so, starting graduate program in data science in spring 2018 , trying acquainted python before then, having difficulty problem working on force myself better understand how works. here exact description of problem: in problem, create mortgage calculator takes input principal loan amount, interest rate, , monthly payment. output, calculator should generate amortization table, , compute how many years , months took pay off mortgage, , report total amount of payments on time. in mortgage, bank lends amount of principal purchase house @ interest rate. every month, amount owe (the balance) first increases due interest: 1/12 of interest rate times current balance. balance decreases due monthly payment. example, suppose borrow $100,000 @ 5% annual interest, $500 monthly payments. in first month, interest increases balance $416.67, , payment reduces $500, remaining balance of $99,916.67. in second month, interest charge $416.32, , remaining balance $99,832.99. if continue process,

android - How can I replicate Bluetooth devices sending key presses to listening apps? -

i want replicate behavior of bluetooth headset, if button on pressed sends "play-pause" command phone. doesn't know receive command --- whether it's music app a, music app b, video player, etc --- yet still works. i want create program can same thing (but programatically). however, i'm running issue can't seem find way inject key events whatever listening them. to clear, i not listening these events, want send "play_pause" event whatever app listening it. there must way, since bluetooth keyboards, headsets, etc able it. assume have root access (and potentially own system image on phone, though i'd rather not go far). how can accomplish this?

swing - Java checkbox state in another class -

how pass actual checkbox state (true/false) gui class class? want run part of code if checkbox in gui selected. guess has if statement (highlithed part below) cant working. public class csvtoxls { public static void main() throws ioexception { //here enter path directory. //for example: path workdir = paths.get("c:\\users\\kamil\desktop\\csvtoxlspython\\nowy folder (2)") jfilechooser jfc = new jfilechooser(filesystemview.getfilesystemview().gethomedirectory()); jfc.setdialogtitle("wybierz folder konwersji: "); jfc.setfileselectionmode(jfilechooser.directories_only); jfc.setacceptallfilefilterused(false); int returnvalue = jfc.showsavedialog(null); if (returnvalue == jfilechooser.approve_option) { if (jfc.getselectedfile().isdirectory()) { system.out.println("you selected directory: " + jfc.getselectedfile()); string z; //@suppresswarnings("deprecation")

android studio - Kotlin suppress 'condition is always true' -

wasting more time scouring through countless number of inspections (which know how enable , disable), cannot find way disable particular inspection of 'condition true' kotlin (not java) file in android studio. know i'm doing , don't need inspection @ all, more appropriately, i'd suppress file or class or function or anything. incredibly frustrating, always. //i'm aware condition below true if(android_sucks) { fml() } in android studio, put text cursor in condition you'd suppress, press alt+enter on keyboard , pops up: 💡 simplify expression ⯈ press right arrow on keyboard, select of options like, example: disable inspection suppress 'constantconditionif' statement/fun/class/file

javascript - lambda s3.headObject write to dynamodb table -

i new @ lambda , trying develop lambda function grab metadata header s3 object s3.headobject , write dynamodb table (checksum value). cors set expose headers , not working , times out. can tell me what's wrong lambda code? appreciated, in advance! var aws = require('aws-sdk'); var dynamo = new aws.dynamodb.documentclient({region: 'us-east-1'}); var s3 = new aws.s3(); //specify parameters event write specified db table exports.handler = function(event, context, callback) { var checksum = s3.headobject( { bucket: unescape(event.records[0].s3.bucket.name), key: unescape(event.records[0].s3.object.key) }, function(err, data) { if (err) { console.log(err); context.done('error', 'error getting s3 object: ' + err); } else { return (this.httpresponse.headers['x-amz-meta-checksu

php - Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." in Swift 3 -

i'm working on project , below swift code. when run error. error domain=nscocoaerrordomain code=3840 "json text did not start array or object , option allow fragments not set." userinfo={nsdebugdescription=json text did not start array or object , option allow fragments not set.} also check response database says has valid content length. because of error cannot want. from response print in code; optional(<nshttpurlresponse: 0x608000233bc0> { url: http://192.168.1.99/insertdata.php } { status code: 200, headers { connection = "keep-alive"; "content-length" = 10; "content-type" = "text/html; charset=utf-8"; date = "wed, 13 sep 2017 21:37:38 gmt"; "keep-alive" = "timeout=5, max=100"; server = "apache/2.4.10 (raspbian)"; } })` this code. let urlofsmartcf = url(string: "http://192.168.1.99/insertdata.php") let request = nsmutableurlrequest(ur

java - ProgressBar and multithreading javafx -

i have applications search page , specified number of links. each link retrieved separate thread. simple code this: public class getlinkthread implements runnable { public int page; public getlinkthread(int page) { this.page = page; } @override public void run() { try { parser.parseandaddlinktoset(page);//this method links sites , save set } catch (ioexception e) { e.printstacktrace(); } } } in parseandaddlinktoset(int page) method string root = "www.example.com/" + page; send page number crawled links. and run this: executorservice executorservice = executors.newcachedthreadpool(); for(int = 1 ; < 4 ; i++){//in case run 3 threads executorservice.execute(new getlinkthread(i)); } executorservice.shutdown(); executorservice.awaittermination(1, timeunit.hours); i want make progressbar when downloading links show link being downloaded given thread. can m

Set the parent of an Aurelia Dialog -

aurelia dialog puts ui elements @ root of document (or near). is there way configure dialog places in document? (i trying make dialog part of router page rather part of overall document.) yes can, stated official doc: http://aurelia.io/hub.html#/doc/article/aurelia/dialog/latest/dialog-basics/5 in controller settings part, there config property name host , can pass element here anchor dialog, instead of default document.body doc: host : allows providing element parent dialog - if not provided body used.

masm - Subtract in assembly Language using a constant variable -

include irvine32.inc cr equ 13 lf equ 10 .data currentyear dword 2017 year dword ? yearmsg byte "enter year: ", 0 summsg byte "years have passed = ", cr, lf, 0 dig1 byte ? digsum byte ? .code main proc ; start call clrscr lea edx, year ; store call writestring call readdec ; input dig1 mov byte ptr year, al call crlf lea edx, yearmsg ; print "enter year: " call writestring call readdec ; input dig1 mov dig1, al call crlf mov al, byte ptr year ; digsum = year - dig1 sub al, dig1 mov digsum, al lea edx, summsg ; print "sum = "; digsum call writestring movzx eax, digsum call writedec call cr

asterisk - SNOM300 and SNOM710 Different Template in FreePBX EPM version 2.10.1.2 -

can please @ link below , let me know if there solution that. regarding different snom model templates in freepbx epm. https://community.freepbx.org/t/snom300-and-snom710-different-template-in-freepbx-epm-version-2-10-1-2/43891 thanks.

scala - How to traverse a Set[Future[Option[User]]] and mutate a map -

i have mutable map contains users: val usermap = mutable.map.empty[int, user] // int user.id now need load new users, , add them map. have following api methods: def getnewusers(): seq[int] def getuser(userid: int): future[option[user]] so first users need load: val newuserids: set[int] = api.getnewusers i need load each user, not sure how getuser returns future[option[user]]. i tried this: api.getnewusers().map( getuser(_) ) but returns set[future[option[user]]] i'm not sure how use set[future[option[user]]] update usermap now. you'll have wait of futures finish. can use future.sequence transform set[future[_]] future[set] , can wait them finish: val s: set[scala.concurrent.future[some[user]]] = set(future(some(user(1))), future(some(user(2)))) val f: future[set[some[user]]] = future.sequence(s) f.map(users => users.foreach(u => /* code here */)) however, using mutable map may dangerous because it's possible open race condit

redis - Which caching mechanism to use in my spring application in below scenarios -

we using spring boot application maria db database. getting data difference services , storing in our database. , while calling other service need fetch data db (based on mapping) , call service. avoid database hit, want cache mapping data in cache , use retrieve data , call service api. so our ask - add data in cache when gets created in database (could add up-to millions records) , remove cache when status of 1 of column value "xyz" (for example) or based on eviction policy. should use in-memory cache using hazelcast/ehcache or redis/couch base? please suggest. thanks i agree rick in terms of don't build until need it, important these days think of caching layer fit later , how integrate (for example using interfaces). adding non-prepared system possible more expensive (in terms of hours) , complicated. ok actual question; disclaimer: hazelcast employee in general caching hazelcast, ehcache, redis , others candidates. first question want ask tho

Spark Production setup and its execution -

if spark running in own cluster(not hadoop cluster), in spark application, rdd = sparkcontext.textfile("hdfs://.../file.txt") when data (for ex 1 tb of data)actually transferred spark executor nodes processing? how data split across nodes? is ha feature , fault tolerance available way of replication in executor nodes well? is feasible peek worker nodes see location of data files? is spark installed on distributed cluster bring processing closer data. ex, in cassandra cluster or hbase cluster, or hadoop cluster i bit confused spark setup , execution. can point me links clears above queries?

python - How to loop through a 2d list/tuple in a certain order and user input? -

i want make 2d list/tuple , loop through user input, mean advance 1 "block" of list/tuple when user gives input to. like: 1 4 7 2 5 8 3 6 9 so start in 1 default program should ask user input advance or not advance through list , display contained section. when last number reached (in case 9) go beginning , keep going indefinitely. i have thinking how hours , reached conclusion programming knowledge pretty basic solve on own... sadly. i'm beginner after all. i have tried many things scratched everything, not seeing here. a while loop , counter work problem: s = [[1, 4, 7], [2, 5, 8], [3, 6, 9]] answer = "y" count = 0 while answer == "y": if count == len(s): count = 0 in s[count]: print(i) answer = input("do want continue?")[0].lower() count += 1

python - Reading a text document and converting it to a string -

i'm trying make basic script reads specified text document, asks string of characters replace , replace it, saves it: from tkinter import tk, filedialog tkinter.filedialog import askopenfilename tk().withdraw() def openfile(): filename = askopenfilename(initialdir="c:/users", filetypes = (("text file", "*.txt"),("all files","*.*")), title = "open document.") open(filename, 'r') f: textfile = f.read() openfile() print(textfile) there's error when running script , selecting file traceback (most recent call last): file "c:\users\****\documents\python\find , replace\replace.py", line 11, in <module> print(textfile) nameerror: name 'textfile' not defined game on: find what's different: from tkinter import tk, filedialog tkinter.filedialog import askopenfilename tk().withdraw() def openfile(): filename = askopenfilename(initialdir="c:

python - Read TF Record file takes very long -

trying go through tensorflow tutorial here; build tf record file ~100 images, , when try following, kernel hangs; why happening? tf record file not large 30mb+ or so, shouldn't take long read them in: import tensorflow tf import os print(os.path.exists("../carmakesorter/train-00000-of-00001")) filenameq = tf.train.string_input_producer(["../carmakesorter/train-00000-of-00001"],num_epochs=none) # object read records recordreader = tf.tfrecordreader() # read full set of features single example key, fullexample = recordreader.read(filenameq) # parse full example its' component features. features = tf.parse_single_example( fullexample, features={ 'image/height': tf.fixedlenfeature([], tf.int64), 'image/width': tf.fixedlenfeature([], tf.int64), 'image/colorspace': tf.fixedlenfeature([], dtype=tf.string,default_value=''), 'image/channels': tf.fixedlenfeature([], tf.int64)

Spring Boot Security Invalid URLs pending forever -

i've got problem when uploading spring boot app server, locally works perfect. the server brand new digitalocean droplet ubuntu 16.04 in manually install mysql server , jre. the app running @ mydummyserver.com:8080. if go there shows me login page @ mydummyserver.com:8080/login the problem whenever enter invalid url (for example: mydummyserver.com:8080/invalid) browser stuck there. if go see network tab (on chrome devtools) can see request marked pending same thing if wget url. i expect spring boot security redirect me login page it's not happening. same jar on local computer works fine , redirects me login. also, app friend that's working flawlessly on server exact same thing in server, guess need setup on server. in security config have anyrequest().authenticated() set thank much!

ruby on rails - Linking post to authenticated user - How do I use current_user in the controller? (devise) -

i using rails "getting started" blog post exercise, , trying integrate devise authentication , authoring of posts. when creating article, author should logged-in user. i getting error when trying create article. know error in articles controller, can't seem figure out how grab current logged-in author kick off creation of article. believe did relationship between author , article. error: undefined method `articles' nil:nilclass author model: class author < applicationrecord has_many :articles # include default devise modules. others available are: # :confirmable, :lockable, :timeoutable , :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable end articles model: class article < applicationrecord belongs_to :author has_many :comments, dependent: :destroy validates :title, presence: true, length: { minimum: 5 } end articles controller: class articlescontr

Connect to SQL Server DB with Active Directory Universal Authentication using Python -

Image
first, i'm not developer apologize if redundant or unhelpful question. in microsoft sql server management studio, able connect server using active directory universal authentication, can't figure out way using python. when login application, after click connect, azure login screen pops up, , able login username: myname@domain.com , password. however, when try connect using pyodbc following code, error below: import pyodbc def main(): servername = "name.database.windows.net" dbname = "databasename" connection = pyodbc.connect("driver={sql server};server=" + servername + ";database=" + dbname + ";uid=myname@domain.com;pwd=mypassword") cursor = connection.cursor() data = cursor.execute("select * sometable;") alldata = data.fetchall() connection.close() in alldata: print(i) if __name__== "__main__": main() pyodbc.p

processing - object instances created on xformed and rotated grids -

in fiddle below, i've drawn circles @ points along recursive tree structure. https://jsfiddle.net/ypbprzzv/4/ the tree structure simplified version of 1 found here: https://processing.org/examples/tree.html what if instead of drawing circles @ (0, -h) on transformed , rotated grids, they're being drawn in fiddle, wanted hang pendulums hang in unrotated y direction (down). if pendulums instances of object class, easy add new instance instead of (or in addition to) drawing circle. void branch(float h) { h *= 0.6; if (h > 10) { pushmatrix(); rotate(a); line(0, 0, 0, -h); fill(0, 175, 0, 100); if (h < 50) { // add new pendulum here, @ (0, -h) ellipse(0, -h, 5, 5); } translate(0, -h); branch(h); popmatrix(); } // closing if statement } // closing branch function i have tried because wanted keep code brief, have not included it. pendulums indeed hang, in wacky directions, since when create these instances,

Using Swift, why when pressing one UIStepper affect both steppers? -

Image
i writing application in swift 3.0 using xcode. i have 2 steppers on iphone , when press 1 of them, both text boxes affected. want 1 text box affected. ] does have sender.value? how state when want 1 label affected? here code: //the birthdate action increase or decrease age @ibaction func birthdatestepperaction(_ sender: uistepper) { //when age stepper pressed, value sent textbox actualagelbl.text = string(sender.value) } //the weight action increase or decrease weight @ibaction func weightstepperaction(_ sender: uistepper) { //when weight stepper pressed, value sent textbox actualweightlbl.text = string(sender.value) } here before pressing stepper: here after pressing stepper thanks in advance. probably connected same @ibaction 2 stepper. see below screen shot-

debugging - VSCode node.js debug using runtimeArgs -

i trying setup launch config nodejs app uses nodemon. have valid working nodejs configuration, trying use custom commands package.json file, not successful in. this here launch.json file { "version": "0.2.0", "configurations": [ { "type": "node", "request" : "launch", "name": "launch program", "program": "${workspaceroot}/app.js", "runtimeargs": [ "run-script", "start" ], "protocol": "inspector", "console": "integratedterminal" } ], "compounds": [] } this here script section of package.json file: "scripts": { "start": "nodemon app.js", "inspect": "nodemon --inspect-brk ./app.js&qu

mysql - Rails Mysql2::Error: SHOW command denied to user -

i hope can me, i'm having troubles ruby on rails 4.2.7, i'm trying copy information external db rails app using select() keeps giving me error: mysql2::error: show command denied user 'rouser'@'fixed-185-188-150-30.totalplay.net' table 'areas': show create table program (activerecord::statementinvalid) checking rails log, displays executes sql: select idprogram, programname, status `program` and same error above. but if connect manually same external database same user , password mysql workbench, , run same sql statement, works fine, table exists in external db. i'm using rails 4.2.7 , mysql2 0.3.18 if execute show grants table in mysql workbench this: 'grant select (idprogram, programname, status) on mydbname . program 'rouser'@'%'

c# different result on different cpu -

i wrote ai online mobile game in c#. have lots of computations ai players , getting different results on server (for validation of game result) , clients. guess it's because of different results of double variable in different cpu architectures. hence, i'm looking solution solve once , all. i've tried rounding of computations 4 digits , didn't work , since c# doesn't have bigdecimal (like java) , couldn't find implementation, can't use either. tried using decimal instead of double math functions cos , sin doesn't accept decimal. in experience either rounding errors on float types, or because using random number generator relies on part of machines architecture. if using math.random maybe have @ different psuedo-random number generator (or rolling own). also ok momentarily update state of ai on client server i.e. use server source of truth. if update enough shouldn't apparent diversions happening.

lotus notes - db.search & wildcard character & lotusscript -

i doing db.search , search in such way status ( field here ) come result, want use wildcard "*", can please me here below should work ? @contains(status;"*") thanks if want find non-empty status, don't need wildcarding. use this: status <> "" if care existence of status field, whether it's filled in or empty, can use @isavailable(status)

What's the best way to semi-automate syncthing for identical deployments? -

i'd able deploy syncthing multiple systems, , have way bootstrap configuration (e.g. ~/.config/syncthing/config.xml ) set of folders shared, , better yet, existing set of systems share to. problem device id seems attached individual folders, understandable given how syncthing works. is there notion of partial config allow automated?

Android NDK OpenGL crashing -

i trying setup opengl using android ndk. followed along tutorials , reason when run project crashes , throws following warning: .unsatisfiedlinkerror: no implementation found void projectname.androidgl.graphicsclass.init() however code imports library: system.loadlibrary("native-lib"); and if change name throws different error, , in file contains jniexport void jnicall java_projectname_androidgl_graphicsclass_init(jnienv*) { initializeopengl(); } i feel should looking for. have specify functions expose? edit: figured out. required add extern "c" before each function.

php - select by two condition and split by attribute -

Image
how can retrieve data in image: my database looks this select trans_id, badge_id, user_id, comp_id, amount, cash, subsidy, trans_date trans_details for details query: select user_id,count(1) txn,sum(amount),sum(cash),sum(subsidy) trans_details group user_id; for totals query: select count(1) txn,sum(amount),sum(cash),sum(subsidy) trans_details;

javascript - IE11 no download prompt, always tries to open -

i have function download text file server. works on chrome not work ie 11. please me. , regards. // file name url. var filename = url.substring(url.lastindexof("/") + 1).split("?")[0]; var xhr = new xmlhttprequest(); xhr.open('get', url, true); xhr.responsetype = 'blob '; xhr.onload = function () { var = document.createelement('a'); a.href = window.url.createobjecturl(xhr.response); // xhr.response blob a.download = filename; // set file name. a.style.display = 'none'; document.body.appendchild(a); a.click(); }; xhr.send(); xhr.onerror = function (e) { alert("error " + e.target.status + " occurred while receiving document."); };

html5 - Html page margin error -

Image
i want correct margin of website. tried nothing worked far. there might problem html code or css code. here screenshot of site: i have added properties align text in navbar centered , applied linear gradients. the problem fluid container has margin error. not sure i'm doing wrong. appreciated. thanks in advance. .navbar-defaul { color: #cc3333; background-color: #cc3333; } @font-face { font-family: blanch-condensed; src: url(blanch_condensed.otf); } @font-face { font-family: hardware-condensed; src: url(ddchardware-condensed.otf); } .logo { width: 43%; height: 43%; background-size: auto 100%; background-repeat: no-repeat; margin: auto; display: block; } #gradiente1 { background: linear-gradient( rgb(0, 171, 235) 20%, rgba(136, 222, 255, 1.00) 75%); } .nav.navbar-nav li { color: black; } .navbar-default { margin: auto; background: greenyellow; } .nav.navb

append to google spreadsheets query function -

i using query function in google sheets copy 1 column tab: =query(tabname!$a:$y, "select j") i modify imported column, (examples below), can't: =query(tabname!$a:$y, "select j")+1 error: 'function add parameter 1 expects number values. 'estado civil?' text , cannot coerced number.' or =right(query(tabname!$a:$y, "select j"),2) error: 'formula parse error' why not? for =query(tabname!$a:$y, "select j")+1 to work, j must number, it? for work, =right(query(tabname!$a:$y, "select j"),2) j must string. in case both works fine. if want whole column,you need enclose in arrayformula this. =arrayformula(right(query(tabname!$a:$y, "select j"),2))

database - Query a Neo4j graph includes all labels of nodes and type of relationship distinctly -

Image
i'm new @ neo4j , i'm wondering there way query graph vertices labels of nodes , edges type of relationship in database? time! for upper versions neo4j 3.0 can use below query // related, , how call db.schema() you can find query in neo4j browser console

ios - How to programatically generate n UILabels and add to View? -

i newbie in ios development. my goal to: generate n uilabels uilabel *label0 = [[uilabel alloc]init] uilabel *label1 = [[uilabel alloc]init] ... uilabel *label n = [[uilabel alloc]init]; add each uilabel view using addsubview to generate n uilabels (please correct me if doing in wrong way), declared nsmutabledictionay in viewcontroller.h @property (strong,nonatomic)nsmutabledictionary *uilabelsdictionary; in viewcontroller.m self.uilabelsdictionary = [[nsmutabledictionary alloc]init]; int yoffset = 40; for(int i=0;i<10;i++) { yoffset = yoffset+40; [self.uilabelsdictionary setobject:[[uilabel alloc]initwithframe:cgrectmake(10, yoffset, self.view.frame.size.width, self.view.frame.size.width)] forkey:[nsstring stringwithformat:@"label%d",i]]; } nslog(@"%@",self.uilabelsdictionary); i stuck on next step. how read each uilabel stored in dictionary uilabel , add view? dictionary output label0 = "<uilabel: 0x7f83dbd08

java - How to make regular expression to allow optional prefix and suffix extraction -

as title described, regular expression should serve purpose on extract information given string, prefix of string (optional) , suffix of string (optional) so prefix_group_1_suffix returns group_1 when prefix 'prefix_' , suffix _suffix prefix_group_1 returns group_1 when prefix 'prefix_' , suffix null <-- code can't handle situation group_1_suffix returns group_1 when prefix 'null' , suffix _suffix group_1 returns group_1 when prefix 'null' , suffix null <-- code can't handle situation here code, found doesn't work when string itemname = ""; string prefix = "test_"; string suffix = ""; string itemstring = prefix + "item_1" + suffix; string prefix_quote = "".equals(prefix) ? "" : pattern.quote(prefix); string suffix_quote = "".equals(suffix) ? "" : pattern.quote(suffix); string regex = prefix_quote + "

javascript - Populate third select element depending on option from second select that has been populated from first select option, using ajax -

so, have working code got site [mitrajit's tech blog][1][1]: http://www.mitrajit.com/populate-dropdown-list-based-selection-another-dropdown-list-using-ajax/ now, after populating second select element, i'd populate third element basing on options second populated select element. i'm trying reuse same code it's not working. ideas on how go it?

vue.js - How can I reload a vue component? -

i know solution update prop data : this.selectedcontinent = "" but want use solution after read reference, solution : this.$forceupdate() i try it, not work demo , full code : https://jsfiddle.net/lgxrcc5p/13/ you can click button test try it i need solution other update property data you can use object.assign assign initial data properties. instead of this.$forceupdate() you should use object.assign(this.$data,this.$options.data.call(this)) . here using this.$options.data original data , assigning values this.$data. see updated fiddle link . update : another method: link

Unable to insert values into a table using MySQL in Python -

i want update table values created in python script in mysql database. here line problem: dbcursor.execute("insert solution (problemname, tourlength, date, author, algorithm, runningtime, tour) values ('%s', '%d', '%s', '%s', '%s', '%d', '%s')" % (sys.argv[1], bestdist, "foo bar", "curdate()", "greedy + 2-opt", timeallowed, bestroute)) dbconnection.commit() it generating error: pymysql.err.internalerror: (1136, "column count doesn't match value count @ row 1") i've tried googling problem , searching website solution, none of ones i've found match mine. fixes have not solved problem because of this. not sure can @ point. can see, of column names match values , formatted variables. what causing problem? create table if not exists solution ( solutionid int(11) not null auto_increment, problemname varchar(32) not null, tourlength double not null, dat

java - Spring MVC Safe way to Upload, generate and download a file -

i´m working on webapp spring mvc , maven. have following process: first of user has upload file. afterwards uploaded file edited. last not least want create download contains edited file. the first step "upload file" works well. have controller contains following post method: @requestmapping(value = "/circleup", method = requestmethod.post) public string circleuppost(httpservletrequest request, model model, // @modelattribute("circleupform") circleupform circleupform) { return this.doupload(request, model, circleupform); } private string doupload(httpservletrequest request, model model, // circleupform circleupform) { file file = circleupform.getfile(); if (file != null) { try { //some edit stuff serialize(file, serializationmodeenum.standard); } catch (exception e) { e.printstacktrace(); } } model

vb.net - import csv file data in datagridview and reimport if it already exists -

i new file handling using vb.net.please suggest me code check data before importing file whether existing data match file data or not per situation mentioned below.my data looks this:- 2008,20, 3,65,3.48 5,rocky,4.53 6,total,7.65 here,first line year,week,.second line onward product code,description , cost. have read first line , check if data corresponding year , week exists.if display message box whether want re import data or not. here code:- private const ext_filter string = "csv (comma delimited) (*.csv)|*.csv|all files (*.*)|*.*" #region "opencsvfile" private sub opencsvfile() openfiledialog1.filter = ext_filter openfiledialog1.filterindex = 1 openfiledialog1.filename = "" openfiledialog1.title = "" if me.openfiledialog1.showdialog(me) = windows.forms.dialogresult.ok txtfilename.text = openfiledialog1.filename 'bulkinsert(openfiledialog1.fi

angularjs - How to remove last page with using $window.history.back() -

Image
in code, logics executed belows. showing items list in main page. click 1 item , move detail page. i wanna change something, click edit button , move edit page. edit , finish editing click confirm button. when click button, execute $state.go('root.detail', {cat_id : $scope.cat_id}, {location: 'replace'}); . then move detail page. through these, location history has successive detail page. i know cannot handle history. and think using $window.histroy.back(); more appropriate instead of using $state.go('root.detail', {cat_id : $scope.cat_id}, {location: 'replace'}); to remove history. anyone have idea solve this? . . . i add paint files make easy understanding want. :) 1. 2. 3.

security - Is this invocation of "openssl s_client -connect" actually querying OCSP responder servers to confirm the current validity of certificates? -

i curious whether invocation of single line of openssl command line interface has ability perform complete ocsp verification protocol, e.g. query ocsp responder servers in chain confirm current validity of certificates. to see if might so, specified -cafile option /dev/null , hoping avoid cached certificates being used in lieu of lookup: as explained in @pepo 's answer, server certificate chain sent part of basic tls1.2 handshake specified in rfc 5246 (more details in update below) # openssl s_client -cafile /dev/null -connect www.equifaxsecurity2017.com:443 which gave output: connected(00000003) depth=3 c = us, o = equifax, ou = equifax secure certificate authority verify return:1 depth=2 c = us, o = geotrust inc., cn = geotrust global ca verify return:1 depth=1 c = us, o = geotrust inc., ou = domain validated ssl, cn = geotrust dv ssl ca - g3 verify return:1 depth=0 cn = www.equifaxsecurity2017.com verify return:1 --- certificate chain 0 s:/cn=www.equifaxsecurity