Posts

Showing posts from July, 2010

c++ - Cross-platform mySQL inconsistencies with character sets -

i have script creates database, couple of tables in , populates data. script made sqlite database on windows. 1 of tables in script named "abcß" ("abc+alt225"). next tried load script mysql thru mysql workbench. both server , workbench running on linux. after fixing syntax inconsistencies database created. tried query database , tables. tables queried successfully, 1 above. trying query "information_table.tables.table_name", name "abc\0d-61\0d63" gives different result original name. because of program crashing when run because sent table name codecvt_utf-8 encoder. the database , tables created default encoding. does know why i'm not seeing proper results? but importantly - presume program crashing because of characters outside of wchar_t/utf-8 encoding. i'm curious - should use convert sequence std::wstring? tia! edit: the code follows: class mysqldatabase { public: int loaddatabasedata(); protected: s...

javascript - Trying to edit a message that is displayed by innerHTML -

i trying edit welcome message have site using css. have message displays if first time user vists site , if repeat user using cookies. trying edit message div using css. here javascript code picks message display using cookies: window.onload = function welcomemessage(){ var visitdata = decodeuricomponent(document.cookie); if (visitdata.length == 0) document.getelementbyid('welcome').innerhtml = "<h4>welcome our website!</h4>"; else document.getelementbyid('welcome').innerhtml = "<h4>welcome our website. please browse site learn our services.</h4>"; var expiresdate = new date(); expiresdate.setfullyear(expiresdate.getfullyear() - 1); document.cookie = encodeuricomponent("expires=" + expiresdate.toutcstring()); } i have message displayed on html: <div id="welcome"></div> i use css align text , possibly more add border. reason when try use css fil...

software - Was there a 'git' in the 1990s? - Retrocomputing Stack Exchange

i seem remember using source code control system in early- mid-1990s called git. nuts? i used work @ ibm way then. didn't use big project, distinctly remember using it. possible? however, wikipedia says linus torvalds wrote in 2005, citing a short history of git : git created linus torvalds in 2005 development of linux kernel, other kernel developers contributing initial development. was there earlier version of source-control software same name, or may have functioned similarly? you nuts, unfortunately. thing that's called git didn't exist @ until linus invented after experience bitkeeper , , thinking distributed version control. linux didn't start using bitkeeper official mainline source tree until 2002, developers must have been using before that. bitkeeper didn't exist until late 90s (e.g. early-access beta in may 1999). one of major motivations creation bitkeeper's pricing change , making inconvenient developers work on linux ...

html - Chrome z index when animating slide in menu -

Image
i trying create slide in menu similar sidenav of https://material.angular.io/components/sidenav/overview except have fixed window can opened anywhere. the linked plnkr works correctly when run in plnkr window. running same code locally not work correctly. https://plnkr.co/edit/f5zolcf9hxlhzeu0bqil the slide in menu correctly positioned on top of rest of page background on other content. when running locally in chrome, menu , background overlay come front once animation complete. it looks elements being relatively positioned causes issue. when using simple flex layout , not using bootstrap, elements appear correctly in chrome. div around slider template seems correct issue in chrome not sure why. <div> <div class="slider__content" [class.slider--show-backdrop]="open"> <div>header</div> </div> <div class="slider-backdrop" [class.slider--show-...

c# - How to get the active SDK in VRTK? -

how set sdk active in vrtk? or, more helpful, how active camera , controller objects? possible? i think can use this: vrtk_sdkmanager.instance.loadedsetup.gameobject vrtk_sdkmanager.instance.loadedsetup.actualheadset vrtk_sdkmanager.instance.loadedsetup.actualleftcontroller etc. check this: https://vrtoolkit.readme.io/docs/vrtk_sdkmanager

linux - How to pass http headers using ffmpeg to play streaming? -

i need take screenshot streaming with: ffmpeg -y -ss 00:00:05 -i "http://xxxxx/live/767.ts" -vframes 1 -q:v 2 "/var/www/iptv/screenshots/file.jpg" most cases received message saying: " server returned 401 unauthorized (authorization failed) ". but, when running using vlc or kodi, url playing ok! this restriction on streaming webserver blocking access request without header. i have checked ffmpeg documentation , found no information streaming headers.

javascript - Alternative logical operator for more than two inputs with check value -

i have script in js: <script> $(document).ready(function () { $('#new_logo_box').click(function (event) { if (this.checked) { $('#basic_info').slidedown(400); } else { $('#basic_info').slideup(400);} }); }); </script> now want check more 1 input alternative logical operator. how should that? trying with: <script> $(document).ready(function () { $('#new_logo_box').click(function (event) || $('#renew_logo_box').click(function (event) { if (this.checked) { $('#basic_info').slidedown(400); } else { $('#basic_info').slideup(400);} }); }); </script> but not working... you can select each element separately , use add add event listener both of them: var newlogobox = $('#new_logo_box'); var renewlogobox ...

c# - LINQ to check each property of a list object to see if it's value is equal to a string -

i have list object contains positions properties in object. want check see if of these properties equal string (ie, "starter"). how can via linq without having check each position individually? for instance if have 18 positions properties of list item, , qb, rb , wr have value "starter" want positions returned in linq query. example: public class teamneeds { public string qb {get; set;} public string rb {get; set;} public string wr {get; set;} public string te {get; set;} .......etc, etc } list<teamneeds> needs = new list<teamneeds>(); i pull in info datatable team, there various things each position---starter, backup, depth, etc... in instance want find positions within list having "starter" value(ie, loop through properties of list item find properties values = "starter") here's methodology using reflection: class program { static void main(string[] args) { list<teamne...

python 2.7 - Ho can I store data in dictionary with specific keys -

below sample code snippet have been trying. for example my_dict = {} my_dict = [] new_dict = {} student_id = input("enter id: ") name = raw_input("enter name: ") course = raw_input("enter course: ") school = raw_input("enter school: ") new_dict['student_id'] = student_id new_dict['name'] = name new_dict['course'] = course new_dict['school'] = school my_dict[student_id].append( new_dict ) this codes generates error. how come expected output? key student_id. output = [{ '1': { 'student_id': '1', 'name': 'test name 1', 'course': 'course 1', 'school':'school 1' }, '2': { 'student_id': '2', 'name': 'test name 2', 'course': 'course 2', 'school': 'schoole 2' }, }] i believe mi...

module - What's the purpose of 'uses' directive in Java 9? -

java's serviceloader class officially baked java language. instead of looking providers in meta-inf/services can use provides <spiclass> <providerclass> what fail understand is, use of uses in service loading module declaration: uses <spiclass> quoting the state of module system the module system identify uses of services scanning class files in module artifacts invocations of serviceloader::load methods, both slow , unreliable. module uses particular service fundamental aspect of module’s definition, both efficiency , clarity express in module’s declaration uses clause: module java.sql { requires transitive java.logging; requires transitive java.xml; exports java.sql; exports javax.sql; exports javax.transaction.xa; uses java.sql.driver; } why fundamental module system know uses of particular service, how introduce efficiency? aren't services loaded lazily? why can't service loa...

php - MYSQL function that includes multiple queries, insert and select -

how can make function in mysql database can include queries insert table1 , select or in table, , parameters in function value delimiter $ create function registration(username varchar(15), password(15), level_user int(1), name varchar(30), email varchar(30), address varchar(50)) returns int begin insert users(username, password, level_user, created, modified) values('username', 'password', 'level_user'); insert employes(name, email, adrress) values('name','email', 'address'); end $ apart single quote issue have not provided data type password, have specified more fields insert users providing in values, employes may typo, name in values employes not provided , should username , must provide return statement if don't intend use in code. fix code check user not exist , set return value meaningful can check post execution. this code "works" drop function if exists registration; delimiter $$ create func...

ios - Array Elements continously appended -

im querying firebase , elements returning properly. when search twice 2 elements appear. means 2 elements appended array. should 1 , 1 thing comes search. 2 elements should not there if search twice. if self.postsarray.count == 0 { self.postsarray.append(newpost!) self.filteredposts = self.postsarray.filter { (post) -> bool in return post.title.lowercased().contains(stringvalue.lowercased()) } dispatchqueue.main.async { self.explorecollectionview?.reloaddata() } } else { post in self.postsarray { if post.key == newpost?.key{ self.filteredposts = self.postsarray.filter { (post) -> bool in return post.title.lowercased().contains(stringvalue.lowercased()) } dispatchqueue.m...

php - Is my hosting company messing me up here: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)? -

i use hosting company aplus.net, , can't seem past connection error i'm getting when trying process php write database content webpage, , curious if because database appears not on same server entire rest of hosting account, , if there way resolve in code? first attempt @ writing php, , know if code wrong, or if hosting company messing me up. (and either way, how fix it) here's code that's failing pull database: { $con = mysql_connect("localhost","2p5dq9vxmy240651","my_password"); if (!$con) { die('could not connect: ' . mysql_error()); } mysql_select_db("felineasthma_2p5dq9vxmy240651", $con); $users_name = $_post['name']; $users_comment = $_post['requests']; $users_name = mysql_real_escape_string($users_name); $users_comment = mysql_real_escape_string($users_comment); $inputid = $_get['id']; $query = " insert `felineasthma_2p5dq9vxmy240651`.`submissions` (`i...

webpack - html5 appcache, FALLBACK not working as expected when offline? -

i use webpack build app , use http-server server. use appcache-webpack-plugin generate xxx.appcache file. here appcache file: cache manifest # cc6ef4a61b5b0e9cd610 images/iverson.599c733dcdf601a1.jpg scripts/0.detailmodule.d6af6f108f3b17cd.js scripts/polyfills.8ec46231416fd920.js scripts/app.0a9c68a43debc635.js scripts/vendor.8810b552e33d9c8b.js scripts/0.detailmodule.d6af6f108f3b17cd.js.map scripts/polyfills.8ec46231416fd920.js.map scripts/app.0a9c68a43debc635.js.map scripts/vendor.8810b552e33d9c8b.js.map scripts/0.detailmodule.d6af6f108f3b17cd.js.gz scripts/polyfills.8ec46231416fd920.js.gz scripts/app.0a9c68a43debc635.js.gz scripts/vendor.8810b552e33d9c8b.js.gz index.html contacts.json network: * fallback: offline.html chrome 60.0.3112.101 disable cache option disabled steps: when first access, resources cached. i use application -> clear storage -> clear site data clear cached resources. i enabled network -> offline option , reload. ch...

firebase - Swift 3: FirebaseDB returning nil when child is present -

Image
i have linked firebase app. when i'm trying read data db, data present in snapshot. when child read, returns nil. here's code: func checkforduplicatescan(qrcode: string) { dataservice.ds.ref_samples.observesingleevent(of: .value, with: { (snapshot) in if let dict = snapshot.value as? [string:any] { print(dict) print(qrcode) print(dict["\(qrcode)"]) if let sampledict = dict[qrcode] as? [string:any] { print(sampledict) if let isscanned = sampledict["scanned"] as? bool { if isscanned == true { print("already scanned") let alert = uialertcontroller(title: "already redeemed", message: "this offer has been redeemed you. stay tuned.", preferredstyle: uialertcontrollerstyle.alert) alert.addaction(uialertaction(title: "ok", style: ui...

sql - How to move different value of src column to different columns -

i have following data sk_patient casenumber src status pen_dt -1 2345 popdb closed 2012-01-01 -1 235 popdb closed 2012-01-01 -1 245 jcare closed 2012-01-02 1244 2 popdb closed 2012-01-01 273 2345 popdb closed 2012-03-04 1244 23 jcare closed 2012-05-02 which needs converted following on basis of different src column value. sk_patient casenumber1 src1 status1 pen_dt1 casenumber2 src2 status2 pen_dt2 -1 2345 popdb closed 2012-01-01 245 jcare closed 2012-01-02 -1 235 popdb closed 2012-01-01 null null null null 1244 2 popdb closed 2012-01-01 23 jcare closed 2012-05-02 273 2345 popdb closed 2012-03-04 null null null null for example, for -1 have 3 rows, 2 of them has same src , them is, 3 row has...

c# - Roslyn: Why do many SymbolDisplay methods have equivalent instance counterparts on ISymbol? -

just curious, noticed there seem 2 ways of doing same thing when comes stringifying symbols in roslyn. can either do: // symbol type isymbol var symboltext = symbol.todisplaystring(); or var symboltext = symboldisplay.todisplaystring(symbol); it's same story tominimaldisplaystring , todisplayparts , , tominimaldisplayparts . why did roslyn team decide add both of these apis instead of making symboldisplay static methods internal? the symboldisplay class in csharp namespace. actual implementation formats symbol in c# display style. when call symbol.todisplaystring() getting symbol formatting in symbol's declaring language, may vb , not c#.

ruby on rails - Why is a symbol used next to the word "to" in the code below? -

this question has answer here: ruby: colon before vs after [duplicate] 4 answers coming php, not sure why symbol below used on right hand side of to. get '/posts/new', to: 'posts#new' is hash key , whats in quotes key? been looking @ rails tutorials , never seen hash in kind of form wondering... yes, correct, to: hash key. when hash last argument in list ruby allows forego use of curly braces. perhaps clearer when add parentheses , curly braces: get('/posts/new', { to: 'posts#new' }) that line calls get method 2 arguments. first argument string '/posts/new' . second 1 hash { to: 'posts#new' } .

Sync events of exchange server 2010 using PHP -

i need sync events from/to linux-php based crm system, exchange server 2010, using php only (not .net) browsed web days , many examples of office 365 , in .net irrelevant. i found library option of syncing both sides: https://github.com/jamesiarmes/php-ews before invest months of integration, can experts tell me if i'm going in right direction? there better ways sync events php-based system exchange server? thank you!

asp.net - Which One is More Secure between Response.Redirect or Server.Transfer on the same server -

i have been reading these 2 functions , considering pick 1 more secure. want use server.transfer because executes @ server side in sense. better use? server.transfer("myurl.aspx?id=1"); or response.redirect("myurl.aspx?id=2"); update: my question based on client side data security comes previous page rather url change. tl;dr: neither server.transfer or response.redirect offers security advantages on other. recommend not using server.transfer @ all, anti-pattern of modern http/web resource base paradigms, further explanation on below. use response.redirect , focus on authorization/identity security concerns. neither offers more security other. server/endpoint still allows http/https requests, request can sent server malicious client. you should prefer response.redirect on server.transfer . server.transfer asp.net web forms "code smell". asp.net web forms has never respected http, restful, stateless, resource request web ...

node.js - NodeJs : How to send very large data from server to client -

i using express framework. trying send large data server. client receives 200 ok status no data. gives error err_content_length_mismatch though sending content-length header server. content-length of response 2102619. take @ sending data in chunks , streams instead of @ once. https://medium.freecodecamp.org/node-js-streams-everything-you-need-to-know-c9141306be93 https://carlosrymer.com/using-node-streams-to-handle-large-file-uploads-24c1a0141b9c

java - test if a column is numeric scriptella -

am trying test if column numeric copied oracle database postgresql database through scriptella , here did scriptella . , please , new <?xml version="1.0" encoding="utf-8"?><!doctype etl system "http://scriptella.javaforge.com/dtd/etl.dtd"> <etl> <description> test script pour table article </description> <connection id="in" driver="oracle" url="jdbc:oracle:thin:@localhost:1521:xe" user="iptech" password="iptech" /> <connection id="out" driver="postgresql" url="jdbc:postgresql://localhost:5432/testmonoprix2" user="postgres" password="maher" /> <connection id="log" driver="text" /> <!-- printing debug information on console --> <connection id="java" driver="janino" /> <query connection-id=...

Urban Airship Push Notifications Webhook Server -

i need help. totally don't understand how setup push notifications open platforms. need open channel each user, can't via api. found webhook server, don't know how make set up. does have experience that? here links i'm using: https://www.urbanairship.com/push-notifications-explained https://docs.urbanairship.com/api/ua/#push-object https://docs.urbanairship.com/api/ua/#open-channel-object https://docs.urbanairship.com/api/ua/#open-channels-registration

json - Structuring a friend list in a Firebase database -

i looking best way (or @ least right way) implement friend system firebase database in each user in database has own information (his name, profile picture, email, etc.) , friend list. the problem can't think of good, efficient way store information inside database, example, if store data in following way - { "users": { "johnappleseed": { // name, profile picture url, email, phone, etc... "friends": { "alice": true, "bob": true, "james": true, "johnappleseed2": true, // ... } }, "johnappleseed2": { // ... } } } and want app show list of friends of user (which shows friends' names, profile pictures, etc.) still need perform server request each one of friends in list (while, afaik performing lots of server requests conside...

c# - Using interfaces in models with SQLite -

let's have interface this: public interface iuser { int id { get; } string name { get; } list<imonthlybudget> monthlybudget { get; } } and have model implements this: public class user : iuser { public int id { get; set; } public string name { get; set; } public list<imonthlybudget> monthlybudget { get; set; } } and here have imonthlybudget: public interface imonthlybudget { int id { get; } float monthlymax { get; } float currentspending { get; } float monthlyincome { get; } } now have models. issue comes using sqlite. sqlite can't understand real implementation of imonthlybudget. understand why, don't want remove interface , expose real implementation clients use these models. in project structure have core project has model interfaces, , model implementation in data access project. is there wrong how i'm approaching problem? assume i'm not first 1 run issue this. isn't normal practic...

swift - Share image via WhatsApp -

Image
i have in app button share image via whatsapp , work. there strange thing appears in menu of uidocumentinteractioncontroller on devices. code: let urlwhats = "whatsapp://app" if let urlstring = urlwhats.addingpercentencoding(withallowedcharacters:characterset.urlqueryallowed) { if let whatsappurl = url(string: urlstring) { if uiapplication.shared.canopenurl(whatsappurl url) { if let imagedata = uiimagejpegrepresentation(self.ivframedpicture.image!, 1.0) { let tempfile = url(fileurlwithpath: nshomedirectory()).appendingpathcomponent("/documents/whatsapptmp.wai") { try imagedata.write(to: tempfile, options: .atomic) self.documentinteractioncontroller = uidocumentinteractioncontroller(url: tempfile) self.documentinteractioncontroller.delegate = self self.documentinteractioncontro...

swift - Array declaration difference -

this question has answer here: confused swift array declarations 2 answers if have minute; i'm struggling understand difference between 2 declaration. know first 1 create new empty array of type string second declare existing array of type string ? thank you var array = [string] () var array:[string] = [] there no difference between declarations - both create empty string array

android - TabLayout changing to fully black -

Image
i have created tabs using tablayout. when changing tabs front , back, in middle tab, whole tab layout becomes black. else working fine when first or last tab, again shows perfectly. in middle tab creating problem. same code 2 tabs working perfectly. only 3 tab , in centre of these 3 tabs creates problem. when in first tab when in second (middle) tab android layout <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.design.widget.tablayout android:id="@+id/sliding_tabs" android:layout_width="match_parent" android:layout_height="wrap_content" app:tabmode="fixed" /> <android.support.v4.view.viewpager android:id="@+id/viewpager" android:layout_width="match_parent" android:layout_height="0px" ...

text - How to find seperated words in notepad++ -

hello have text file contains word this 137.147.138.224|ubnt|ubnt|australia 137.154.4.3|united states 137.175.134.200|ubnt|ubnt|canada and want find 137.154.4.3|united states keep in mind there may in place of 137.154.4.3|united states 155.186.7.9|india , 185.173.4.7|japan so have long list of words wanted find words contains 1 | said! to find lines have ip, | , country, can use regex pattern: \d+\.\d+\.\d+\.\d+\|[^|]+$ \d+\.\d+\.\d+\.\d+ # digits (1 or more) , dots \| # string literal [^|]+ # 1 or more characters not '|' $ # end of line demo

python - __init__ method that takes multiple arguments -

this question has answer here: what clean, pythonic way have multiple constructors in python? 11 answers i did create new datetime.date object class workdate(datetime.date): pass the functionality of workdate is( not important question ) when add timedelta object move weekday date. ie when add timedelta(1) on friday dated workdate return next monday dated workdate . how can __init__ workdate 1 of these 2 method create same result x = workdate(2017, 8, 3) y = workdate(datetime.date(2017, 8, 3)) did try not working initialization date object class workdate(datetime.date): def __init__(self, *args): if len(args) == 3: super(workdate, self).__init__(args[0], args[1], args[2]) elif len(args) == 1: self.year = args[0].year self.month = args[0].month self.day = args[0].day s...

How to add data to a patch plot in matlab? -

i using distmesh mesh sphere cut hemisphere after. major output of isosurface : pv=isosurface(x,y,z,reshape(fd([x(:),y(:),z(:)],varargin{:}),size(x)),0); p=pv.vertices; t=pv.faces; p1 = patch('faces',t,'vertices',p,'facecol',[.8,.9,1],'edgecol','k'); i need add more vertices surface, not sure how it, appreciated.

Not able to Draw the circle in Custom View android using onDraw(canvas) function? -

i not able draw circle using custom views in android. doesn't work, though basic code implementation, not working. can me same? this custom view class implementation: public class customview extends view { private paint paint; private int color; private float radius; public customview(context context) { super(context); init(); } public customview(context context, @nullable attributeset attrs) { super(context, attrs); typedarray ta = context.obtainstyledattributes(attrs, r.styleable.customview); color = ta.getcolor(r.styleable.customview_circlecolor, color.black); radius = ta.getfloat(r.styleable.customview_circlesize, 200f); ta.recycle(); init(); } @override protected void ondraw(canvas canvas) { super.ondraw(canvas); canvas.drawcircle(getwidth() / 2, getheight() / 2, radius, paint); } private void init() { paint = new paint(); ...

android - Get native JavaVM and JNIEnv handles in Xamarin c# project -

i have android native library use via p/invoke in xamarin c# project. initialization call library expects following parameters: javavm * javavm jnienv * jnienv void * activityobject on sample ndk project library, initialisation set (directly @ beginning of android_main entry point): javavm = app->activity->vm; activityobject = app->activity->clazz; jnienv set as: javavm->attachcurrentthread( javavm, &jnienv, null ); and initialize dll function called parameters. now initialize pointers c# xamarin project. app->activity point following anativeactivity need equivalent handles initialize in c# activity. so considering , activity object "act", need perform following: public unsafe class mainactivity : activity { [system.runtime.interopservices.dllimport("ndklib.so")] public static int initlibrary(intptr javavm, intptr jnienv, intptr activityobject); protected override void oncreate(bundle bundle) { ...

How to use str.find() function in python -

Image
what trying achieve want allow user input website google.com , goo.gl only. this, sample code in python console this: the returned result false correct because url meets criteria containing goo.gl . went on testing few more options url https://google.gl/lozxye , find() function return true because not meet criteria containing words 'google.com' or 'goo.gl'. my problem if assign variable url value below expected return true find() function above because not contain word 'goo.gl' @ all, yet return false . what wrong happening? how can validate url case above result expected? thanks. that line url = 'https://goo.glab/lozxye' does indeed contain 'goo.gl', not want because followed ab in url, changes top-level domain. one way around not search goo.gl //goo.gl/ . works in examples gave, , prevents both following , preceding characters change top-level domain. makes line url.find('//google.com/') == -1 ...

sql - mysql obtain running difference -

i have below table structure , data: ----------------------------- | date | accu. output | ----------------------------- | 2017-01-01 | 150 | | 2017-01-02 | 165 | | 2017-01-03 | 182 | | 2017-01-04 | 190 | | 2017-01-05 | 210 | ----------------------------- i need generate below output above dataset. can client side processing. trying write query this. ---------------------------------------------- | date | accu. output | daily output | ---------------------------------------------- | 2017-01-05 | 210 | 20 | | 2017-01-04 | 190 | 8 | | 2017-01-03 | 182 | 17 | | 2017-01-02 | 165 | 15 | | 2017-01-01 | 150 | 0 | ---------------------------------------------- daily output difference between current accu. output , previous day's accu. output. thanks here method uses left join: select t.*, coales...

junit - jenkins test results to Zephyr -

i have junit tests run each push git via jenkins report test results zephyr jira. i doing using jenkins pipeline, pipeline code: node{ stage 'connect git' .... stage 'run test' sh 'ant test' stage 'report test result' step ([class: 'junitresultarchiver' , testresults="reports/test-*.xml"]) step ([class: 'zfjreporter', serveradress:'....', projectkey:'....', versionkey:'1', cyclekey:'createnewcycle', cycleduration:'1 days', cycleprefix='']) } when running last stage next error: 'no known implementation of interface jenkins.tasks.simplebuildstep named zfjreporter' can please me. not fina answer issue. thanks. i suspect have found comment on this jira issue : "i add compatibility pipeline plugin, can run step of zephyr fro jita test management plugin" the commenter, ivan fernandez calvo, linked this ...

javascript - ERROR TypeError: Cannot set property 'abc' of undefined Angular2 -

i have input type file html element , want upload , read json file , store file's object content in local variable. suppose json object getting after reading file :- { name:{ firstname: "name1", lastname: "name2" } } now, want store object in variable after reading file, private jsondata = {}; readfile(eve){ let reader:any, target:eventtarget; reader= new filereader(); reader.onload = function(eve:any) { this.jsondata['json_def'] = json.parse(eve.target.result); console.log(this.json_def); } reader.readastext(eve.target.files[0]); } this error receiving in console when upload it: error typeerror: cannot set property 'json_def' of undefined @ filereader.reader.onload (create-model.component.ts:135) @ zonedelegate.invoke (zone.js:391) @ object.oninvoke (core.es5.js:3890) @ zonedelegate.invoke (zone.js:390) @ zone.runguarded (zone.js:154) @ filereader.<anonymous> (z...

jquery - how to implement follow map with cytoscape.js? -

Image
how use cytoscape.js achieve following figure? the midpoint of edge can moved. the color of lines on both sides of midpoint can different. thanks lot! you can use mid arrows, single edge isn't going drawn 2 edges. refer stylesheet docs: http://js.cytoscape.org/#style

nvd3.js - Passing array values to Nvd3 chart -

this array. var array = [{"month":"january","url":1,"ip":12}, {"month":"february","url":102,"ip":200},{"month":"march","url":192}, {"month":"june","ip":10}]; is there possible way pass these array x axis , y axis values in line chart?. i have tried this. function() { var array = [{"month":"january","md5":1,"ip":12}, {"month":"february","url":102,"ip":200},{"month":"march","url":192}, {"month":"june","ip":10}]; var data=[], data2=[]; <div id="chart"> <svg></svg> </div> (var = 0; < array.length; i++) { data.push({x: array[i].url, y: array[i].month}) data2.push({x: array[i].ip, y: array[i].month}); } return [ { values: data, key: 'url', colo...

php - De hash a password_hash with a cost -

if hash example password 20 times cost: $pass1=password_hash($pass, password_default, ['cost' => 20]) and store in database, how can let user login on website, if password_verify() know , de hash password "once time"? did need password_verify ($password,$storedpassword) 20 times? or there easier way it? saw password_needs_rehash, have tried use , didn't work. i found solution, after bit of time $pass1=password_hash($pass, password_default, ['cost' => 20]); password_verify($passwordinputbyuser, $pass1); so simple!

asynchronous - Simple UDP server OCaml/Async -

i'm trying simple udp server using ocaml , async api i'm stuck. can't make simple example work. let wait_for_datagram () : unit deferred.t = let port = 9999 in let addr = socket.address.inet.create unix.inet_addr.localhost ~port in let%bind socket = udp.bind addr in let socket = socket.fd socket in let stop = never () in let config = udp.config.create ~stop () in let callback buf _ : unit = failwith "got datagram" in udp.recvfrom_loop ~config socket callback i test with: echo -n "hello goodbye" > /dev/udp/localhost/9999 nothing happens in program. tried investigate other tools. i see destination unreachable packet wireshark , lsof shows me this: > lsof -i :9999 command pid user fd type device size/off node name main.exe 77564 nemo 5u ipv4 0x25251bcc3485235f 0t0 udp localhost:distinct what doing wrong here? the code looks ok me. think localhost resolved ipv6 addre...

c++ - Swift 4 + OpenCV - Detecting quadrilateral corners -

i using opencv 3 , swift 4 build simple application detect 4 corners of quadrilateral contained in acquired photo. for example, expect following input have following output . does opencv provide method obtain result? appreciated. detecting corners easy thing. there couple of direct opencv functions can you. here few things can work on- 1) harris corner detector. here. 2) shi-tomasi corner detector. here.

machine learning - Formal Concept Analysis data-sets -

i completing postgrad degree in information systems management , have been given thesis topic relates formal concept analysis. the objective compare open-source software able read data , represent in lattice diagram (an example application of concept explorer). additionally, performance of these tools need compared 1 another, varying data-set sizes etc. the main problem i'm experiencing finding data sets compliant these tools big enough test limits of each application, figuring out how accurately measure things such cpu time taken draw lattice diagram , other similar measures. data formal contexts follow binary relationship, such cross table shows how attributes , objects can related. as such, question find such data , how able manipulate data usable software concept explorer. p.s. new here, not sure if posted in right place!

java - StartActivityForResult go back -

i using startactivityforresult multiple activities. main activity initialize it. on second activity input values , pass third activity. now, when i'm on third activity want able go second activity if ever want edit values passed. should do? mainact.java protected void onactivityresult(int requestcode, int resultcode, intent data) { if (requestcode == request_code) { if (resultcode == activity.result_ok) { //something } } secondact.java intent vd2 = new intent(violatordetails1.this,violatordetails2.class); vd2.putextra("name",name); vd2.putextra("lname",lname); vd2.putextra("lnumber",lnumber); vd2.addflags(intent.flag_activity_new_task); vd2.addflags(intent.flag_activity_forward_result); startactivity(vd2); finish(); thirdact.java intent intent = new intent(); in...

php - Laravel: How to speed up foreach database update -

i got cron job want run every month, assigns random serial number each active customer. but takes long time run, 2000+ active customers , each customer gets 10 random serials, takes 20k+ update queries finish job. how speed up? foreach($subscriptions $subscription){ $updated_at = carbon::now()->todatetimestring(); foreach($games $game){ db::table('serials') ->wherenull('user_id') ->where('game_id', $game->game_id) ->limit(1) ->update([ 'user_id' => $subscription->user_id, 'updated_at' => $updated_at ]); } } you can try : foreach($subscriptions $subscription){ $updated_at = carbon::now()->todatetimestring(); foreach($games $game){ db::table('serials') ->wherenull('user_id') ->where('game_id', $game->game_id) ...

NativeScript pinchMove gesture event -

is there pinchmove gesture event? it's needed instagram zoom. couldn't find in docs. i tried args.getfocusx() , gives focused finger's location. opened github issue here , answer not related pinch moving. any idea?

uibutton - tvOS UICollectionView button focus on the cell -

i writting apple tv native app , have uicollectionview on viewcontroller. each cell of uicollectionview has 3 buttons on laid out in vertical line , able focus on them , have user click on focus 1 user can answer question on each cell. currently, focus engine not focusing on buttons on cell , not sure how tell focus engine should so. please provide instruction on how so? thanks, greg

java - Getting noClassDefFoundError for an eventuate program -

in eventuate program, getting below error, doubt dependency missing or version issue. actually followed https://github.com/eventuate-examples/eventuate-examples-java-spring-todo-list , tried build project using maven, doesn't work. or if guys have sample eventuate 'event driven' based project, please share me. error: caused by: java.lang.illegalstateexception: failed introspect annotated methods on class io.eventuate.javaclient.spring.common.eventuatecommonconfiguration @ org.springframework.core.type.standardannotationmetadata.getannotatedmethods(standardannotationmetadata.java:163) @ org.springframework.context.annotation.configurationclassparser.doprocessconfigurationclass(configurationclassparser.java:292) @ org.springframework.context.annotation.configurationclassparser.processconfigurationclass(configurationclassparser.java:232) @ org.springframework.context.annotation.configurationclassparser.processimports(configurationclassparser.java:510) caused by: j...

nlp - Pickel Error while storing Doc2vec gensim model -

i trying save gensim doc2vec model. model trained on 9m document vectors , vocabulary of around 1m words. getting pickel error. "top" shows program uses around 13gb of ram. think since need re-train model new documents , when required, saving parameters necessary. traceback (most recent call last): file "doc_2_vec.py", line 61, in <module> model.save("/data/model_wl_videos/model",pickle_protocol=2) file "/home/meghana/.local/lib/python2.7/site-packages/gensim/models/word2vec.py", line 1406, in save super(word2vec, self).save(*args, **kwargs) file "/home/meghana.negi/.local/lib/python2.7/site-packages/gensim/utils.py", line 504, in save pickle_protocol=pickle_protocol) file "/home/meghana/.local/lib/python2.7/site-packages/gensim/utils.py", line 376, in _smart_save pickle(self, fname, protocol=pickle_protocol) file "/home/meghana/.local/lib/python2.7/site-packages/gensim/utils.py", line 930, in pick...