Posts

Showing posts from September, 2014

python - How to pass local variables from one function into another? -

i trying make text-based game having troubles passing variables 1 function another. figured out how modify variable inside function , return new values overwrite original. what need how room1() , room2() variables something1(x) , something2(y) , main() unlock if statement. should have 2 different or 1 function something1(x) , something2(y) ? this general sample code problem i'm having: def something1(x): x += 0 return x def something2(y): y += 0 return y def main(): print("1. try open door") print("2. go room1") print("3. go room2") choice = int(input("enter selection: ") if choice == "1": # trying if statement work variables # don't know function or parameters pass in order work if x == 3 , y == 2: print("you're free") else: print("you're not free") elif choice == "2": ...

alignment - CSS align text left in center div with automatic line break -

Image
there quite few answers similar topic, none of helped me problem. what i'd have list of horizontal items (for menu), 100% width of parent (for used flex ). text inside items should break automatically (without <br /> , don't know texts in advance) aligned left , broken box should in middle of item. when hovered (as shown in example), entire item (including paddings) should change background color. paddings left , right inside elements should method determined automatically, menu responsive (on mobile padding 0 , or large screens accordingly bigger). i've attached simplified snippet of closest thing got desired result. no matter how change html structure or css, can't left align text when items centered (this overrides left align). but not care if result different, long work without without manual work every item :). i'd appreciate help! thanks! * { margin: 0; padding: 0; } ul { /* simulate small screen...

php - href link from svg object -

i created svg rectangle text "my text" in it. i'd add clickable link text "my text" using href attributes (or else) redirect site php file. but, rectangle text "my text" without link. <?php echo "<svg width='1100' height='1620'>"; echo "<rect x='450' y='30' width='200' height='30' style='fill:white stroke:black;stroke-width:2'></rect>"; $my_text = "my text"; echo "<text x='473' y='51' font-family='verdana' font-size='18' fill='black' > <a href='index.php'>$my_text</a></text>"; echo "</svg>"; ?> at moment (2016-11-12) browsers not consistent on isssue. certain contemporary browsers (and should) understand href : <svg width="1100" height="1620"> <rect x="450" y="30...

java - Exception while creating index - Spring Data MongoDB -

i'm using spring-data spring-data mongodb map entity class using @compoundindexes annotation in i'm specifying indexes both names , definitions. in production environment, decided needed change of attributes of index based on actual data. every time application starts up, fails load because failure create index matching specification in annotation results , exception thrown during initialization process (as seen below). is there anyway of configuring spring data , mongodb these exceptions logged not fail start of container? exception while creating index ! com.mongodb.mongocommandexception: command failed error 86: 'trying create index same name event_source_link_type_at_id_idx different key spec **** vs existing spec *****' on server 127.0.0.1:27017. full response { "ok" : 0.0, "errmsg" : "trying create index same name event_source_link_type_at_id_idx different key spec **** vs existing spec *****", "code" : 86 } ! @ com...

java - The same info in navigation header and custom toolbar - Android Studio -

i've got problem. i've got navigation header , info there working. xml (textview): <textview android:id="@+id/nav_drawer_total_credits" android:layout_width="182dp" android:layout_height="wrap_content" android:textsize="17sp" android:textcolor="@color/md_brown_700" android:layout_margintop="8dp" android:layout_marginleft="16dp" android:text="points:"/> in activity main.java: navigationtotalcredittextview = (textview) findviewbyid(r.id.nav_drawer_total_credits); navigationtotalcredittextview.settext("points: " + preferenceconnector.readinteger(aicontext, preferenceconnector.walletpoints, 0)); i used same id of textview in toolbar layout included in mainactivity xml: <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center...

ajax-datatables-rails aggregate functions are not allowed in WHERE -

i have implemented ajax-datatables-rails 1 table raw records query using group class listcontractorsdatatable < ajaxdatatablesrails::base def view_columns # declare strings in format: modelname.column_name # or in aliased_join_table.column_name format @view_columns ||= { id: { source: "contractor.id", cond: :eq }, name: { source: "contractor.name" }, city: { source: "contractor.city" }, ico: { source: "contractor.ico" }, country: { source: "contractor.country" }, count: {source: "contract.count"} } end def_delegators :@view, :link_to, :showcontractor_path, :content_tag def data records.map |contractor| { # example: id: contractor.id, name: link_to(contractor.name, showcontractor_path(contractor.id)), city: contractor.city, ico: contractor.ico, country: contractor.country, count: ...

c# - how do I make object face player? -

i've been following various stackoverflow answers, , think found code works, before put code, i've got figure out whether or not how unity knows way "front" of object. transform.lookat(target); i'm trying use above code enemy object face player. when place object scene, how let unity know way front of object? (i.e. place airplane object scene. "i" know way front, "unity" know way front?) thank in advance. from https://docs.unity3d.com/scriptreference/transform.lookat.html rotates transform forward vector points @ /target/'s current position. from https://docs.unity3d.com/scriptreference/vector3-forward.html shorthand writing vector3(0, 0, 1). front same forward vector , forward vector pointing @ object z axis.

cmd - powershell remove-item windows server 2012 not working -

i have win-server 2012 , c:\ disk full. ive got file "win2012r22.iso" 4gb old 1 2014 (not in use in of hyper-v`s) , , cannot delete using powershell administrator. there way/command remove file can free space? directory: c:\ mode lastwritetime length name ---- ------------- ------ ---- d---- 10/27/2015 7:05 59 d---- 10/27/2015 7:04 59free d---- 5/11/2015 6:21 currports d---- 12/9/2014 8:39 ibmmegaraid d---- 12/9/2014 8:32 ibm_support d---- 7/26/2012 12:21 perflogs d-r-- 12/13/2014 1:14 program files d---- 12/13/2014 1:14 program files (x86) d-r-- 11/7/2012 10:51 users d---- 10/28/2016 7:51 windows -a--- 11/10/2012 2:15 5268344 59.exe -a--- 10/27/2015 6:54 37533435 59free.exe -a--- 10/27/2015 7:02...

How to access lists saved as files with Python? -

i doing natural language processing python (2.7.9) , nltk (3.2.1). way doing things, every time run program part-of-speech tagging on large corpus. the resulting tagged corpus looks larger version of this: [('a', 'dt'), ('better', 'jjr'), ('widower', 'jjr'), ('than', 'in'), ('my', 'prp$'), ('father', 'nn'), ('.', '.'), ('aunt', 'nnp'), ('sybil', 'nnp'), ('had', 'vbd'), ('pink-rimmed', 'jj'), ('azure', 'jj'), ('eyes', 'nns'), ('and', 'cc'), ('a', 'dt'), ('waxen', 'jj'), ('complexion', 'nn'), ('.', '.'), ('she', 'prp'), ('wrote', 'vbd'), ('poetry', 'nn'), ('.', '.'), ('she', 'prp'), ('was', 'vbd'), (...

php - Simple website won't open image on desktop using __DIR__ -

<!doctype html> <html> <head> <title>this hello world page</title> </head> <body> <h1>hello world</h1> <img src= "<?php echo __dir__ .'/pic.png' ?>"> </body> </html> i can't figure out why code isn't showing image. made sure name file .php extension , put both files in same folder (the desktop). the eventual goal upload entire folder server. within folder, there index.php file , image. how can point file image? if pic.png in same directory, work. <img src="pic.png"> also, move img tag body .

c++ - What is an undefined reference/unresolved external symbol error and how do I fix it? -

what undefined reference/unresolved external symbol errors? common causes , how fix/prevent them? feel free edit/add own. compiling c++ program takes place in several steps, specified 2.2 (credits keith thompson reference) : the precedence among syntax rules of translation specified following phases [see footnote] . physical source file characters mapped, in implementation-defined manner, basic source character set (introducing new-line characters end-of-line indicators) if necessary. [snip] each instance of backslash character (\) followed new-line character deleted, splicing physical source lines form logical source lines. [snip] the source file decomposed preprocessing tokens (2.5) , sequences of white-space characters (including comments). [snip] preprocessing directives executed, macro invocations expanded, , _pragma unary operator expressions executed. [snip] each source character set member in character literal or string literal, e...

Extract integer from list using python -

extract integer list test = query_database("select sum(try) tries number=?", (nb,)) print test the result got [(100,)] and when extract value list : for in test: print the result (100,) how extract 100 integer no parenthesis , commas ? since list consists of tuples have first tuples value in tuple this for in test: j in i: #itertae tuple list print(j)

ios - UITableViewCell not displaying text correctly -

Image
i have list of data search items , select 1 of them expand selected cell. when clear out search text in search bar, wish display original list. able display items in original list, except cell selected during search doesn't updated. attaching snapshots , code better understanding: notice row #3 in first image has text "a.b. road" whereas same row in third image uses same cell in second image (it should updated "a.b. road") using custom cell , tried creating new cell everytime instead of reusing existing cell. didn't help. code: - (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath { nsstring *celltext = [self.branchlist objectatindex:[indexpath row]]; uifont *cellfont = [uifont fontwithname:@"helvetica" size:17.0]; cgsize labelsize = [celltext boundingrectwithsize:cgsizemake(tableview.frame.size.width, maxfloat) options:nsstringdrawinguseslinefragmentorigin attributes:@{nsfontatt...

c# - Object List View Highlight Renderer with Composite Filters -

i'm trying filter object list view composite filter (i.e. multiple filter conditions) default highlight text renderer renders text of first filter. is there way make apply filters or better yet use multiple text renderers 1 each filter? i'm using control characters (&& , ||) delimit search terms some c&p code illustrate public void filter (string txt, matchkind matchkind) { bool filterbyall; ienumerable<string> terms = splitsearchterms(txt, out filterbyall); list<imodelfilter> modelfilters = new list<imodelfilter>(); foreach (string term in terms) { imodelfilter filter; switch (matchkind) { case matchkind.contains: default: filter = textmatchfilter.contains(_olv, term); break; case matchkind.prefix: filter = textmatchfilter.prefix(_olv, term); break; case matchkind.regex: ...

Remove SharePoint Workflow Template programatically -

Image
when using sharepoint designer 2013, under "workflows" option in navigation pane can view , remove workflow templates. is possible same programatically (preferably via powershell)? an old question, faced same problem , determined deleting folder within hidden "workflows" list in site how remove template: $web = get-spweb $siteurl $templates = $web.workflowtemplates | where-object {$_.name -eq "send reminder email"} if ($templates.count -gt 0) { $web.lists["workflows"].rootfolder.subfolders.delete("send reminder email") }

transitioning from r to Python - dplyr-like operations in pandas -

i'm used using r. if had in r this: library(dplyr) df = df %>% mutate( xyz = sum(x+y+z), weekcheck = ifelse( week > 3 & x*2 > 4, 'yes',week), # multi-step if statement xyz_plus_3 = xyz + 3 ) df = pd.dataframe({ 'x': np.random.uniform(1., 168., 20), 'y': np.random.uniform(7., 334., 20), 'z': np.random.uniform(1.7, 20.7, 20), 'month': [5,6,7,8]*5, 'week': np.random.randint(1,4, 20) }) i know theres assign can't figure out syntax chaining these operations together, particularly using ifelse sort of thing. anyone attempt break down me? if don't know r think code common sense.. you'd need 2 assign calls , syntax not pretty: (df.assign(xyz=df[['x', 'y', 'z']].sum(axis=1), weekcheck=np.where((df['week']>3) & (df['x']*2>4), ...

javascript - Targeting even rows of table through jQuery -

i want give orange color rows through jquery in table. but not working me. below html code: <!doctype html> <html lang="en"> <head> <title> </title> <meta charset="utf-8" /> <link rel="stylesheet" type="text/css" href="css/custom.css" /> </head> <body> <table class="mytable"> <tr> <td> 1 </td> <td> 2 </td> </tr> <tr> <td> 3 </td> <td> 4 </td> </tr> <tr> <td> 5 </td> <td> ...

php - How will i pass the value to the following format? -

i trying pass value function following url: search?channelids=1,2,3&streamname=wew&page=0&size=10 code inside function: $this->request->set("url","broadcasts/pubic/search"); $this->request->set_fields(array( 'channelids'=>$channel_ids, 'streamname'=>$stream_name, 'page'=>$page, 'size'=>$size )); $result = $this->request->send(); here pass values in format.how give pass value channelids=1,2,3? use http_build_query url formation. $channel_ids=array("channelids"=>1, "channelids"=>2, "channelids"=>3); $stream_name="wew"; $page=0; $size=10; $getlivebroadcast = $api-searchbroadcast($channel_ids,$stream_name,$page,$size); how set value? you can use urlencode function encode channel ids. function may like: $this->request->set("url","broadcasts/pubic/search"); $this->re...

php - What is pgv_si and pgv_pvi -

i'm using phpv7, found there pgv_si , pgv_pvi . can't find them php.net official website. knows that? the code below: var_dump('cookie', $_cookie); i understand generated cookie, don't know for... those variables in cookies, set server. please read documentation on cookies, not have connection php itself.

Run tensorflow through SSH -

when run tensorflow training code through ssh, got following error: qxcbconnection: not connect display this happens due summary object saving models. how fix error? try x11forwarding using -y flag, e.g.: ssh -y user@server

How to fetch data from two tables in MySQL and count each one? -

how can write in 1 query ? i have 2 tables 1 likes called (late): id name s_id 1 6 2 6 3 b 5 4 c 8 5 6 6 6 7 c 8 8 c 8 the other 1 likes called (absent): id name s_id 1 6 2 6 3 6 4 6 5 6 6 6 7 b 5 8 c 8 i want results table: where (count late) counts times of late , (count absent) counts time of absents. name count late count absent 4 6 b 1 1 c 3 1 i tried this: this didn't work ! select * (select name, count(*) '# count absent' absent group s_id) t1 inner join (select name, count(*) '# count late' late group s_id) t2 on t1.s_id = t2.s_id ; use union of 2 tables: lates , absents... sum number of lates , absents. try...

java - Apache Metamodel How to add foreign keys while creating tables -

i've written code create tables apache metamodel: datacontext.executeupdate(new updatescript() { @override public void run(updatecallback updatecallback) { updatecallback.createtable(schema, "atable").withcolumn("id").oftype(columntype.integer) .withcolumn("anothertableid").oftype(columntype.integer).execute(); updatecallback.createtable(schema, "anothertable").withcolumn("id").oftype(columntype.integer).execute(); } } how can add relationship between these tables? you try: datacontext.executeupdate(new updatescript() { @override public void run(updatecallback updatecallback) { table atable = updatecallback.createtable(schema, "atable") .withcolumn("id").oftype(columntype.integer) .withcolumn("anothertableid").oftype(columntype.integer).execute(); table a...

R converting a character to a date -

this question has answer here: converting year , month (“yyyy-mm” format) date? 8 answers i have character string of type dec 2016 , want convert date. i tried: dates1 <- c("dec 2016", "feb 2017", "nov 2018") dates2 <- as.date(dates1,format="%b %y") but did not work. thank help. dates1 <- c("dec 2016", "feb 2017", "nov 2018") library(zoo) dates2 <- as.date(as.yearmon(dates1)) dates2 [1] "2016-12-01" "2017-02-01" "2018-11-01" class(dates2) [1] "date" you should googling.

gtk - C++ gtkmm vertical menu bar -

Image
i trying make vertical menu bar multiple different tabs (each tab contains multiple sub-childs , each sub-child may contain sub-sub child) application should this. however, couldn't find way , best achieve below using notebook widget, not find way include sub-child through notebook widget. i have tried using menubar menubar make horizontal toolbar , there no way make vertical. is there specific widgets use achieve that? thanks.

ubuntu - Execute Pin Tool on 32-bit -

i used pin tool on ubuntu 64-bit these instructions: $ cd source/tools/simpleexamples $ make target=intel64 $../../../pin -t obj-intel64/pinatrace.so -- /bin/ls $ ad pintrace.out i succeded pick pin trace file. but now, same on lubuntu 32-bit, unfortunately not work. tried replace intel64 ia32, not work more.

assembly - Assembler i8080 Multiplying two 16bits numbers -

i have prepare program i8080 processor. program have multiplying 2 16b numbers. don't know how check multiplier bit bit. e.g 1111 * 1011 = first bit of 1011 1 add 1111 second bit 1 add 11110 third bit 0 don't add 111100 forth 1 add 1111000 result 1111+11110+1111000=10100101 and problem how chceck bits of multiplier? thanks help probably easiest way shift right , check carry, otherwise have keep changing bit test , that's hard, register pair. shifting bit annoying on 8080 since a can rotated. let's multiplier in bc (and multiplicand in hl , result in de can shift multiplicand dad h , takes xchg add-to-result happens less often) mov a, b ora ; reset carry rar mov b, mov a, c rar mov c, jnc skipadd using ora a ensures multiplier goes zero, allows exit test such as: mov a, b ora c jnz looptop if unroll 16 can fill bc left carry left shift of multiplicand, won't make difference.

javascript - Polymerfire TypeError -

i new polymer , i'm trying save user data using firebase-document component. here relevant code snippets: component initialization: <firebase-document id="document" app-name="nameoftheapp" path="[[userdatapath]]" data="{{userdata}}"> </firebase-document> and javascript part: polymer({ is: 'registration-view', properties: { userdata: object, userdatapath: { type: string, notify: true } }, debugfunction: function () { user = this.domhost.user; this.userdatapath = '/users/' + user.uid; this.userdata.firstname = "fname"; this.userdata.lastname = "lname"; console.log(user); console.log(this.userdatapath); this.$.document.save(this.userdatapath).then(function () { ...

gradle - Issue while integrating the project with new android studio installation -

Image
i have installed latest android studio on machine , trying run project building on machine. having gradle build fail , don't know thing causing problem. apply plugin: 'com.android.application' android { compilesdkversion 24 buildtoolsversion "24.0.0" defaultconfig { applicationid "com.example.mudasir.login" minsdkversion 16 targetsdkversion 24 versioncode 1 versionname "1.0" multidexenabled true } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } packagingoptions{ exclude'meta-inf/notice.txt' exclude'meta-inf/notice' exclude'meta-inf/notice.txt' exclude'meta-inf/license.txt' exclude'meta-inf/license' exclude'meta-inf/licens...

Multi-step registration and security -

assume have registration process in multiple steps: initial form asks information (first , last names, id number, phone number, email address) after form submitted, second step consists of verifying phone number sending code needs entered next then, need verify id number using credit card. my question is: should create account after initial form submitted? or should create account @ end when steps successful? if go second solution, implies information kept in temporary registration session until end of process information passed api create account. what best practices?

python - How to decrease value of a variable with time -

here code game making, on lines 9-13 trying make hunger variable decrease every 180 seconds 10, not working. import threading print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") print(" welcome game") print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") health = 100 stamina = 100 hunger = 100 def hungerdecrease(h): global hunger threading.timer(180,hungerdecrease).start() h -= 10 hungerdecrease(hunger) while health > 0 , stamina >0 , hunger >0: if hunger <50: print("you hungry.") if stamina <10: print("you feeling exhausted.") if health <50: print("you unhealthy.") print("you dead") first, don't need pass value since pass copy. make variable global. then, while loop needs passive delay or you're looping 100% active cpu. you have protect against concurrent access of health variable, using thread.lock anot...

Javascript regex for Twig templates contents -

i use rich text editor allow online modification of twig templates. twig template engine using following syntax display variables: {{ object.property }} it uses functions generate urls, such as: {{ url('mr_message_read', {id: message.id}) }} now want display, next editor, list of twig variables and functions used in template. this, retrieve current content html twig "keywords" shown above. extract keywords, use regex below: var reg = /{{[^}]+}}/g; var match = text.match(reg); console.log( match ); this work work example 1 not example 2 , twig function requires } string. so, tried several other syntaxes allow " anything except }} ". none of them seem fit: var reg = /{{[^}]+}}/g; // ignores second example var reg = /{{[^}}]+}}/g; // idem var reg = /{{[^}}]*}}/g; // idem var reg = /{{(^}}+)}}/; // null var reg = /{{(^}})+}}/; // null var reg = /\{\{[^\}\}]+\}\}/g; // ignores second example var reg = /\{\{[^}}]+\}...

c# - Simple accord.net machine learning example -

i’m new machine learning , new accord.net (i code c#). i want create simple project @ simple time series of data oscillate, want accord.net learn , predict next value be. this data (time series) should like: x - y 1 - 1 2 - 2 3 - 3 4 - 2 5 - 1 6 - 2 7 - 3 8 - 2 9 - 1 then want predict following: x - y 10 - 2 11 - 3 12 - 2 13 - 1 14 - 2 15 - 3 can guys me out examples on how solve it? a simple way use accord id3 decision tree. the trick work out inputs use - can't train on x - tree won't learn future values of x - can build features derived x (or previous values of y) useful. normally problems - make each prediction based on features derived previous values of y (the thing being predicted) rather x. assumes can observe y sequentially between each prediction (you can't predict arbitary x) i'll stick question presented. i had go @ building accord id3 decision tree solve problem below. used few different values of x % n fe...

debian - Thunar can't access (samba) shares throught "Browse Network" -

x86_64 debian stretch kernel version 4.7.8-1 xfce i wasn't able open shares (samba) thunar in browse network ( network:/// ). in location bar saw bad dns-sd names, when tried access shares. names this: network:///dnssd-domain-tetris%2520-%2520smb%255cscifs._smb._tcp where tetris name of server so guessed problem in special characters (spaces etc.). i searched dns-sd name created service avahi . edit file on server: /etc/avahi/services/smb.service , replace string single word (name) of server. (or use "%h" automatically insert server name) before: <?xml version="1.0" standalone='no'?> <!doctype service-group system "avahi-service.dtd"> <service-group> <name replace-wildcards="yes">%h - _smb/cifs</name> <service> <type>_smb._tcp</type> <port>445</port> </service> </service-group> after: <?xml version="1.0...

r - more columns than column name on txt file -

i have txt file , read in r command: read.table("c:/users/vatlidak/my documents/documents/untitled.txt", header=true) r returns me following command: "more columns column name" txt file: height shoesize gender location 1 181 44 male city center 4 170 43 female city center 5 172 43 female city center 13 175 42 male out of city 14 181 44 male out of city 15 180 43 male out of city 16 177 43 female out of city 17 133 41 male out of city if myfile contains path/filename replace each of first 4 stretches of whitespace on every line comma , re-read using read.csv . no packages used. l <- readlines(myfile) ## for(i in 1:4) l <- sub("\\s+", ",", l) df <- read.csv(text = l) giving: > df height shoesize gender location 1 181 44 male city center 4 170 43 female city center 5 172 43 female city center 13 175 ...

elasticsearch - Need care for filter order? -

there lot of articles talk filter order of es on internet.but lot of them out of date. i want know in es after version 2.+ ,i need care of filter order? such as,there 1000000 docs field1 equals value1 ,and there 100 docs field2 equals value2 . 1. { "bool": { "filter": [ { "term": { "field1": "value1" }}, { "term": { "field2": "value2" }} ] }} 2. { "bool": { "filter": [ { "term": { "field2": "value2" }}, { "term": { "field1": "value1" }} ] }} there difference of dsl1 , dsl2 ?

swift3 - swift 3 - HTTPCookieStorage cookies for url cannot call -

i'm trying fetch array of cookies specified url , following error: cannot call value of non-function type '[httpcookie]?' this syntax: if let cookies = httpcookiestorage.shared.cookies(for: baseurl) { cookie in cookies { } } what's problem?

jQuery UI datepicker performance on select -

i've got instance of jquery ui datepicker here: https://app.shvitz.com.au/en/listings/11-yoga-in-the-park wait couple of seconds load on right side of page. i'm experiencing strange performance issues when selecting dates. can view source in calendar.js, relevant part: function onselect(date, instance) { var mdate = moment(date, "dd-mm-yyyy"); var $timeslots = rendertimeslots(mdate); $container.children('.timeslots-container').remove(); $container.append($timeslots); } function rendertimeslots(date) { if (!date) date = moment(calendar.datepicker('getdate').gettime()); var times = availabilities.filter(function (a) { return moment(a.start_time).startof('day').issame(date.startof('day')); }); function availtoprice(a) { function getprice(a) { if (!api.getshared()) return 66; var left = a.capacity - a.bookings; switch (left) { ...

vue.js - Avoid mutating a prop directly since the value will be overwritten -

i have common problem upgrading vue 2.0 i getting warning: avoid mutating prop directly since value overwritten whenever parent component re-renders. instead, use data or computed property based on prop's value. prop being mutated: "username" (found in component <guestmenu>) i read documentation many times still can't understand how fix it. username , password declared in main vue app. here code: var guestmenu = vue.extend({ props : ['username', 'password'], template: ` <div id="auth"> <form class="form-inline pull-right"> <div class="form-group"> <label class="sr-only" for="username">user name</label> <input type="username" v-model="username" class="form-control" id="username" placeholder="username"> ...

How to update texture for every frame in vulkan? -

as question title says, want update texture every frame. i got idea : create vkimage texture buffer bellow configurations : initiallayout = vk_image_layout_preinitialized usage= vk_image_usage_sampled_bit and it's memory type vk_memory_property_host_visible_bit | vk_memory_property_host_coherent_bit in draw loop : first frame : map texure data vkimage (use vkmapmemory ). change vkimage layout vk_image_layout_preinitialized vk_image_layout_shader_read_only_optimal . use vkimage texture buffer. second frame: the layout vk_image_layout_shader_read_only_optimal after first frame , can map next texure data vkimage directly without change it's layout ? if can not that, layout can change vkimage ? in vkspec 11.4 says : the new layout used in transition must not vk_image_layout_undefined or vk_image_layout_preinitialized so , can not change layout _preinitialized . appreciated. for case not need layout_preinitialized . ...

matrix - matlab showing 0 for small number values product -

i have matrix elements have small values. taking product of elements of matrix 100 times. if take matrix 10*10 shows output when take matrix 100*100 shows 0. think shows 0 because product appears small value. how take product small value should display. try typing: format long it should , rounding problem. format 8 decimals. if want go matlab default settings type: format short

c++ - How to call Fortran dll with function as argument in C -

i use vs2013 , intel visual fortran, make dll fortran code. in fortran subroutine, has 3 arguments, "fa" passing function, "a" passing array, "b" passing number. doesn't work when call in vc++. update: well... program above chaotic, remodify program below. create fortran dll can pass array sum elements , call c function. module callctest use, intrinsic :: iso_c_binding implicit none private public callcfun contains subroutine callcfun(a,b) bind(c,name = "callcfun") !dec$ attributes dllexport :: callcfun implicit none real(c_double), dimension(*):: !receive array c type(c_funptr), value :: b ! receive c function real, parameter::pi=3.14159 integer :: real :: sum = 0.0 = 1,3 ! sum array elements sum = sum+a(i) end write(*,*) 'total',sum return end subroutine callcfun end module callctest and c code call fortran subroutine: #include "stdafx.h...

swift - fatal error at runtime with Realm using LInkingOjbects -

getting following fatal error. fatal error: 'try!' expression unexpectedly raised error: error domain=io.realm code=1 "schema validation failed due following errors: - property 'gearmodel.category' declared origin of linking objects property 'categoryrepository.gearlist' links type 'categorymodel'" userinfo={nslocalizeddescription=schema validation failed due following errors: - property 'gearmodel.category' declared origin of linking objects property 'categoryrepository.gearlist' links type 'categorymodel', error code=1}: object models here: gear model assigned 1 category import foundation import realmswift class gearmodel: object{ dynamic var gearid = nsuuid().uuidstring dynamic var name = "" dynamic var manufacturer = "" dynamic var sortorder = 0 dynamic var category: categorymodel? override class func primarykey() -> string? {return "g...