Posts

Showing posts from January, 2015

mysql - Optimize slow query in WordPress plugin "Better WordPress Recent Comments" -

i'm optimizing queries against mysql , slow queries log shows me wordpress plugin "better wordpress recent comments" widget shows last 5 recent comments grouped posts, uses 1.26 seconds query db long time website - when next website click away. here slow query: query_time: 1.265625 lock_time: 0.000000 rows_sent: 6 rows_examined: 288634 set timestamp=1443741678; select wpcoms.* ( select *, @num := if(@post_id = comment_post_id, @num + 1, 1) row_number, @post_id := comment_post_id cpid wp_comments comment_approved = 1 order comment_post_id desc, comment_id desc ) wpcoms wpcoms.row_number <= 2 order wpcoms.comment_date desc limit 6; rows examined says 288.634, database consists of 96.000 comments. surely should possible improve few comments examined in short time instead, there few recent posted comments shows. thanks. one of main problems see inner query, select *, @num... because results in full table scan cause mysql not use comment_approved i...

msbuild - Wildcard pattern does not match literal dot? -

in targets file, have following item group: <itemgroup> <mygroup include="$(msbuildthisfiledirectory)..\dist\**\*.*"> </mygroup> </itemgroup> i want match files have extension (contain dot in name), pattern above matching files have no extension (e.g., readme). doing wrong? you may in 2 steps : <itemgroup> <tmp include="$(msbuildthisfiledirectory)..\dist\**\*.*"> </tmp> <mygroup include="@(tmp)" condition="'%(tmp.extension)' != ''" > </mygroup> </itemgroup> <message text="@(mygroup)" /> <message text="@(tmp)" />

angularjs - How do you set up a relationship between properties of two angular controllers? -

say i've got adamcontroller adam , anujcontroller anuj . want anuj.anujprop have j appended every time adam.adamprop changes. how done? best way? here 4 possible ways came with. ranked them in order feel best. events - http://plnkr.co/edit/4ad8e47daosuutrphikn?p=preview method on factory - http://plnkr.co/edit/vixab8ljdtow5yyfnlmv?p=preview factory + $watch - http://plnkr.co/edit/1zvz9edarcgpomzvrjmd?p=preview $scope inheritance - http://plnkr.co/edit/3b7tzpi5y4ccwwyxuk25?p=preview the $scope inheritance approach feels "messy". event driven approach on factory approaches because feel there's sort of overhead associated factories, , if it's going used 1 purpose, overhead isn't worth it. plus, seems events for. put (2) ahead of (3) because $watch hurts performance. events angular .module('app', []) .controller('adamcontroller', adamcontroller) .controller('anujcontroller', anujcontroller) ...

json - Android - displaying wrong data in toast when i click on list view item -

when click on particular id, showing other id data, check below code understand problem whats wrong code, found not saving position in this, if problem give hints public feedlistadapter(activity activity, list<feeditem> movieitems) { this.activity = activity; this.feeditems = movieitems; // this.intentcontext = activity; } @override public int getcount() { return feeditems.size(); } @override public object getitem(int location) { return feeditems.get(location); } @override public long getitemid(int position) { return position; } @override public view getview(int position, view convertview, viewgroup parent) { if (inflater == null) inflater = (layoutinflater) activity .getsystemservice(context.layout_inflater_service); if (convertview == null) convertview = inflater.inflate(r.layout.list_news_feed, null); if (imageloader == null) imageloader = volleyapplication.getinstance().getimageloader...

arrays - Postgres ordering table by element in large data set -

i have tricky problem trying find efficient way of ordering set of objects (~1000 rows) contain large (~5 million) number of indexed data points. in case need query allows me order table specific datapoint. each datapoint 16-bit unsigned integer. i solving problem using large array: object table: id serial not null, category_id integer, description text, name character varying(255), created_at timestamp without time zone not null, updated_at timestamp without time zone not null, data integer[], gist index: create index object_rdtree_idx on object using gist (data gist__intbig_ops) this index not being used when select query, , not anyway. each day array field updated new set of ~5 million values i have webserver needs list objects ordered value of particular data point: example query: select name, data[3916863] weight object order weight desc currently, takes 2.5 seconds perform query. question: there better approach? happy insertion...

initialization - Why do I have to override my init in Swift now? -

import foundation class student: nsobject { var name: string var year: int var major: string var gpa : string init(name:string, year:int, major:string, gpa:string) { self.name = name self.year = year self.major = major self.gpa = gpa } convenience init() { //calls longer init method written above } } -- the error shows atthe line of convenience init overriding declaration requires 'override' keyword i've tried googling , reading guides on initializers in swift, seems able make initializers fine without overriding anything. it looks convenience initializer empty why error. example if change to: convenience init() { self.init(name: "", year: 0, major: "nothing", gpa: "4.0") } the error go away. i wonder why set student inherit nsobject. doesn't necessary class.

html - asp.net - Create contatenated href tag in a repeater element -

i have repeater on asp.net page, bound datareader in code-behind. i'd turn 1 of repeater elements href of anchor tag. repeater element name of file, , want user able click on tag download file. this post got me pretty close; repeater element looks this: <%#eval("documentname")%> and anchor looks this: <a href= "docs/?<%#eval("documentname")%>"><%#eval("documentname")%></a> this opens docs subfolder in directory listing of entire docs folder. want 'open/save file' dialog open when user clicks href, not go separate page lists files in docs directory. instead of linking page lists files, link actual document. if documents static files in docs folder, , documentname file name, removing question mark link should trick. <a href="docs/<%#eval("documentname")%>"><%#eval("documentname")%></a> note, removed space after href= in link....

arrays - "Value error: Mixing iteration and read methods would lose data "message while extracting numbers from a string from a .txt file using python -

i have program grabs numbers .txt file , puts array . problem numbers not isolated or ordered . .txt file looks this: g40 z=10 a=30 x10 y50 a=30 x40 y15 a=50 x39 y14 g40 z=11 a=30 x10 y50 a=30 x40 y15 a=50 x39 y14 the output should new .txt file has following array format x y z 10 50 10 40 15 10 39 14 10 10 50 11 40 15 11 39 14 11 this have done far, although i'm not sure how write output new file... inputfile = open('circletest1.gcode' , 'r') def find_between( s, first, last ): try: start = s.index( first ) + len( first ) end = s.index( last, start ) return s[start:end] except valueerror: return "" in range(203): inputfile.next() # skip first 203 lines while true: my_text = inputfile.readline() z = find_between(my_text, "z =", " ") x = find_between(my_text, "x", " ") y = find_between(my_text, "y", " ") print...

javascript - Group objects in array by property -

i have started pick coding seriously. :) came across problem seems complicated me. how group following products promotions type? var data = [ { name:'product1', price:'40', promotion:[ { name:'buy 3 30% off', code:'ewq123' }, { name:'free gift', code:'abc140' } ] }, { name:'product2', price:'40', promotion:[ { name:'buy 3 30% off', code:'ewq123' } ] }, { name:'product3', price:'40', promotion:[ { name:'buy 3 30% off', code:'ewq123' } ] }, { name:'product4', price:'40' }, { name:'product5', price:'40', promotion:[ {name:'30% off', c...

io - Is there a way to use the namelist I/O feature to read in a derived type with allocatable components? -

is there way use namelist i/o feature read in derived type allocatable components? the thing i've been able find https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/269585 ended on unhelpful note. edit: i have user-defined derived types need filled information input file. so, i'm trying find convenient way of doing that. namelist seems route because succinct (basically 2 lines). 1 create namelist , namelist read. namelist seems choice because in text file forces show each value goes find highly preferable having list of values compiler knows exact order of. makes more work if or else needs know value corresponds variable, , more work keep clean when inevitably new value needed. i'm trying of basic form: !where mytype_t type has @ least 1 allocatable array in type(mytype_t) :: thing namelist /nmlthing/ thing open(1, file"input.txt") read(1, nml=nmlthing) i may misunderstanding user-defined i/o procedures,...

How to loop through same column on specific sheets in excel vba? -

hi stackoverflow community: i'd loop through same column on 3 specific sheets in workbook. understand there needs along lines of code similar what's been posted here , here , can't seem them work , instead receive error '1004', "application-defined or object-defined error". additional notes: entered "for each ws in workbook.sheets" after declarations, , "next" @ end before "end sub". tried processing code after "r=1" in code below , received same 1004 error. tried "next" after loop code , still looped through first sheet. this code: sub makewordlist() dim inputsheet worksheet dim wordlistsheet worksheet dim puncchars variant, x variant dim long, r long dim txt string dim wordcnt long dim allwords range dim pc pivotcache dim pt pivottable application.screenupdating = false set inputsheet = activesheet set wordlistsheet = worksheets.add(after:=worksheets(sheets.count)) wordlists...

javascript - React Router cannot read ToUpperCase of undefined... basic example -

i have correct dependencies installed (react , react-router here) , using basic example react router github page... cannot rid of error. my react router @ 0.13.3 & react @ 0.13.3 well. here's code, in jsx: import "../css/master.scss"; import react 'react'; import { router, route, link } 'react-router'; const app = react.createclass({ render() { return ( <div> <h1>app</h1> <ul> <li> <link to="about">about</link> </li> </ul> {this.props.children} </div> ) } }) const = react.createclass({ render() { return <h3>about</h3> } }) const contact = react.createclass({ render() { return <h3>contact</h3> } }) const routes = { p...

laravel - How do I get just the most recent set of changes in the revisionable package? -

currently have revisionable trait correctly storing , fetching history of model goes through change. each update model creates record per field changed. is possible group records change? example time: round 1 $model = mymodel::find(1); $model->a = 5; $model->b = 6; $model->save(); this results in following entries +----------+--------+-----+-----------+-----------+--------------+ | rev_type | rev_id | key | old_value | new_value | created_at | +----------+--------+-----+-----------+-----------+--------------+ | mymodel | 1 | | 0 | 5 | [first date] | | mymodel | 1 | b | 0 | 6 | [first date] | +----------+--------+-----+-----------+-----------+--------------+ round 2 $model = mymodel::find(1); $model->a = 555; $model->b = 666; $model->save(); this results in following entries +----------+--------+-----+-----------+-----------+---------------+ | rev_type | rev_id | key | old_value | new_value | ...

sql server - SQL select menus which have no submenu -

i have table in sql server having title , id , refer . refer indicates item submenu of other. sample table: id   |  refer  |   title 1    |   0   |   menu 1 2    |    0  |   menu 2 3    |   1   |   submenu of 1 4    |   1   |   submenu of 1 i need query select items has no submenu (in case menu 2). have solved asp code counts submenus , omits unwanted results need pure sql query . sql fiddle demo select t1.* yourtable t1 left join yourtable t2 on t1.id = t2.refer t2.refer null , t1.refer=0

java - Transformation the screen coordinates to stage coordinates -

when call line gdx.input.gety(); screen origin top left corner, stage coordinates in buttom left corener. how can transform screen coordinates stage coordinates ? (without using camera) i.e. how can make screen origin in bottom left corner ? you should use screentostagecoordinates stage method. example of getting input position vector is: vector2 position = stage.screentostagecoordinates( new vector2(gdx.input.getx(), gdx.input.gety()) );

Why is this Java code not working calculate average max and min? -

i supposed build program gets grades in class , calculates min , max , average ask if want continue. code used it's still not working. can see mistake is? public class calculateavgmaxmin { public static void main(string[] args) { scanner input = new scanner(system.in); // declares scanner input linkedlist<integer> list = new linkedlist<integer>(); // declare new linkedlist of variables grades int answer = 1; // declare variable answer =1 { // start of loop system.out.print("please enter name of course:"); // gives prompt enter name of course // goes next line string course=input.nextline(); // declare course string , sets value input system.out.println("please enter scores " + course + " on single line , type -1 @ end"); //prompts user enter scores class in 1 line , -1 stop int max=-100; // declare max integer = -100 ...

vi - How to turn off autoindent -

i cannot seem turn off autoindent in vi. seems limited comment character # if begin new line spaces , # following lines begin same, though dont want that. behavior not reproduced if begin new line spaces or tabs. have following set noautoindent nocindent nosmartindent nocopyindent not sure whether matters nocindent following set too nocindent comments=:# after spending time on this, able come solution (actually, two). turns out formatoptions getting set "croql" reason, when opened file. solution disable "r" option. can find more details on "r" option here http://vimdoc.sourceforge.net/htmldoc/change.html#fo-table solution 1 :set formatoptions-=r the short form work :set fo-=r solution 2 :set fo=tcql to confirm changes in place, use following command :set fo option "r" should not present.

html - Relative Positioned Child in Absolute Positioned Child... (Help) -

all right, i'm trying understand how positioning code works , make responsive in website. every bug i've come across i've been able fix myself through research online , constant staring (lol). however, i've come across rather irritating issue... the issue -i have div positioned relative (id: news_content) , within div positioned absolute (id: page). when try move news_content using positioning commands top , left, left 1 reacting. while top command isn't moving news_content @ all. /*global*/ body { margin:0; padding:0; } div { margin:0; padding:0; top:0; left:0; bottom:0; right:0; } table { margin:0; padding:0; border-spacing:0; } /*global divs*/ #page { position:absolute; top:0; bottom:0; left:0; right:0; } #nav_main { background-color:black; width:100%; height:14%; position:fixed; z-index:0; } /*navigation*/ #nav_content { ...

javascript - Jquery show div content onload and hide of the first click -

i have created side menu bar menu items has id's 'h1-1', 'h1-2','h1-3' , on. when first load page need show 'h1-1' content. i've written code $(document).ready(function() { window.onload = $('#h1-1').show(); }); but here, when click other menu item first, 'h1-1' content still show on page , clicked list item content showing below 'h1-1' content . however when 'h1-1' first , click other list items, works fine (when 'h1-1' first, 'h1-1' content still showing , click other list item 'h1-1' content go away , show clicked item content). i've tried write hide 'h1-1' content on first click then, 'h1-1' content not showing when click 'h1-1' list item itself. can suggest way how can solve this.. fiddle demo you relying on content of curpage hide previous page, initialize "". instead, set first page. var curp...

php - ActiveMQ Remote Broker -

i'm activemq - stomp php- beginner. how can connect remote broker on stomp, producer in php. if connect broker on same machine this: $stompcon = new stomp('tcp://localhost:61613'); $stompcon->connect(); $stompcon->send('/queue/notifications.test', $mapmessage); $stompcon->disconnect(); it connects ok, when try on external server like: $stompcon = new stomp('tcp://181.61.50.8:61613',$user,$pass); $stompcon->connect(); $stompcon->send('/queue/notifications.test', $mapmessage); $stompcon->disconnect(); it doesn't connect. knows how can connect remote broker on machine? error messsage: internal server error the server encountered internal error or misconfiguration , unable complete request. please contact server administrator, webmaster , inform them of time error occurred, , might have done may have caused error. more information error may available in server error log. a...

javascript - AngularJS resource + Slim Framework only gets a single data -

Image
i'm creating restful single page application using slim framework end , angularjs front end. far, create, retrieve all, , delete working when try retrieve single data, single field works. here code: studentcontroller.js angular .module('studentinfoapp') .factory('student', student) .controller('studentscontroller', studentscontroller) .config(config); function config($routeprovider) { $routeprovider .when('/', { controller: 'studentscontroller', templateurl: 'app/views/student-list.html' }); } function student($resource) { //return $resource('/students/:id'); return $resource("/students/:id", {}, { query: { method: "get", isarray: true } }); } function studentscontroller(student, $scope, $http) { $scope.inputform = {}; $scope.students = null; function clearinput() { $scope.inputform = { fname: '',...

c# - Authentication encryption or server side verification -

i have set of public apis take in id , parameters. clients (could browsers or mobile phones), each having own int ids, can interact these public apis. of course, don't want situation client changes id , send request screwing things other people thus, when authentication takes place, guid sent client authentication token. subsequent request must include authentication token. on server, end in db match guid id. if match, process can go forward otherwise unauthorizedaccessexception thrown. works fine , dandy. but of course, problem every operation db up. did caching caching authentication token has own issues (tears tears). one other way encrypt , pass in query string. when request comes in, have decrypt string see if it's valid. there no free lunch there. asp.net sets encrypted cookie authentication. view state encrypts things in hidden field. encrypted cookie doesn't work me since i'm passing around json/soap (some clients send json send xml). ...

configuration - Local static server without trailing slash -

what's simplest way run static server without trailing slashes locally? ideally, i'd use tools come installed latest version of os x. unfortunately, python -m simplehttpserver 8000 and ruby -run -ehttpd . -p8000 both 301 redirect /about /about/ . i want opposite. see more static server one-liners . note : static site talks rest api uses rack. unless has better solution, use rack::static . true, rack doesn't come installed latest version of os x, need anyway run rest api static site talks to. see heroku dev center: creating static sites in ruby rack . please update answer completed code. thanks!

.net - Npgsql Command with Multiple Statements -

in npgsql v2, use following code update record, , return updated record values using single npgsql command. the command.commandtext property contains both update statement , select statement. idea being when command.executereader called both commands run, results select command returned (since last command). after upgrading npgsql version 3.0.3.0 value in datareader (from select statement) still original value, , not updated 1 (the return dr("action") line in code). have tried every different isolationlevel , give same results (as though select statement not seeing updated value insert statement). value updated in database (if re-query record has updated value). i can split , use 2 separate npgsqlcommand (one insert, , second select), don't want create second round-trip server. this simplified function, purpose of real function update record on db server, , update object in application other fields server updated (such "last_updated" timestamp fie...

How to solve i++ loop error in Python? -

my code giving following error: indexerror: list index out of range know if there way use similar i++ loop java in python code print "name" + iten list every iten of list positioning. sorry if seems bit confusing beginner hard explain somethings :p ex: i = 0 "name" + list[0] = 1 "price" + list[1] = 2 "name" + list[2] code: import pickle list1 = [] ans = " " class product: def __init__(self, name, price): self.name = name self.price = price while ans != 'no': ans = input("would add new product, 'yes' or 'no': ") if ans == 'no': break if ans == 'yes': name = input("what product name?") price = input("what product price?") list1.append(name) list1.append(price) output = open("save1.pkl", 'wb') pickle.dump(list1, output,pickle.highest_protocol) output.close(...

angularjs - Ionic custom modal animation -

ionic modal comes standard animation of slide-in-up . possible can change animation fade-in ? you can add own animation css, ex: .slide-in-right { -webkit-transform: translatex(100%); transform: translatex(100%); } .slide-in-right.ng-enter, .slide-in-right > .ng-enter { -webkit-transition: cubic-bezier(0.1, 0.7, 0.1, 1) 400ms; transition: cubic-bezier(0.1, 0.7, 0.1, 1) 400ms; } .slide-in-right.ng-enter-active, .slide-in-right > .ng-enter-active { -webkit-transform: translatex(0); transform: translatex(0); } .slide-in-right.ng-leave, .slide-in-right > .ng-leave { -webkit-transition: ease-in-out 250ms; transition: ease-in-out 250ms; } and usage 'slide-in-right' the same 'fade-in' https://forum.ionicframework.com/t/slide-in-right-animation-for-ionicmodal/18882

Bash script - array of strings? -

i'm new bash script coding, i've put want reboot services on server (in case crash) however, i'm hitting stumbling block @ basic point: #!/bin/bash declare -a arr=(tomcat7 nginx mysql); ...gives error: script-checks.sh: 3: script-checks.sh: syntax error: "(" unexpected i've tried quoted well: declare -a arr=("tomcat7" "nginx" "mysql"); i don't understand why i'm getting error though. looks i'm using correct syntax: http://www.thegeekstuff.com/2010/06/bash-array-tutorial/ please advise (i'm coming perl background, quite different me - appologies if i've missing stupid!) your script not run bash . suppose uses sh .

python - APScheduler doesn't work with UWSGI -

i'm using django 1.8 , apscheduler run workers on intervals. works django's development server (e.g. ./manage.py runserver ) when setup project uwsgi , master=true , uwsgi worker can't requests nginx , browser shows 504 gateway timed-out error after 1-2min loading. when change master=false fine. here uwsgi config: [uwsgi] chdir = /var/www/projectname/backend/projectname module = projectname.wsgi:application wsgi-file = /var/www/projectname/backend/projectname/projectname/wsgi.py uid = root gid = root virtualenv = /var/www/venv/ master = false processes = 4 socket = :8080 logto = /var/www/projectname/log/uwsgi.log env = django_settings_module=projectname.settings enable-threads = true please note i'm using django's appconfig run scheduler once. there problem uwsgi config or it's because of django? consider uwsgi mules background tasks...

android - 'Unable to contact the firebase server' -

i working on ionic hybrid mobile app using angularfire. implementing email/password authentication using $firebaseauth service. working on chrome browser when installed on android device giving error 'unable contact firebase server.' andorid application has full network access permission , permissions use data , wify. code , apk link https://github.com/ajayparsana/myfirebaseapp please help. i have installed cordova inappbrowser & whitelist plugin , add below lines in config.xml file after line solve problem <access origin="*" /> <allow-navigation href="*" /> <allow-intent href="*.firebaseio.com" /> <allow-intent href="auth.firebase.com" />

polymorphism - An unexpected universe level -

here definition similar 1 in data.list.all : open import data.vec data {α π} {a : set α} (p : -> set π) : ∀ {n} -> vec n -> set π []ₐ : p [] _∷ₐ_ : ∀ {n x} {xs : vec n} -> p x -> p xs -> p (x ∷ xs) why all lie in set π ? agda version 2.4.3. agda 2.4.2.4 , agda 2.4.2.5 (the maintenance branch) report expected error when all lives in set π , accepted agda 2.4.3 (the master branch). please reports issue in agda bug tracker .

android - Trying to draw image in css -

i'm trying save network requests,thats why want implement close button of mobile page in css. used img2css website generate css, here solution: looks pretty bad in old mobile devices : here screenshot android 4.3 @ left side css solution @ right side original image. see css bit ugly. suggestions how draw simple close button in css? you can simplify awful lot, , learn basic css: span.close { display:block; width:32px; height:32px; color:#666; border:1px solid #666; border-radius:50%; font-size:28px; line-height:1; text-align:center; } <span class="close">&times;</span>

PHP Javascript - Insert variable into total parameter of PayPal checkout -

i have code here checkout on website: <div id="paypal-button"></div> <script> paypal.button.render({ env: 'sandbox', client: { sandbox: 'xxxxxx', production: 'xxxxxx' }, commit: true, payment: function(data, actions) { return actions.payment.create({ payment: { transactions: [ { amount: { total: '14.50', currency: 'gbp' } } ] } }); }, onauthorize: function(data, actions) { return actions.payment.execute().then(function(payment) { }); } }, '#paypal-button'); </script> instead of having price set '14...

typescript - Generic type works with function argument for map but not single value -

interface datageneric { value: number; } function transform<d extends datageneric>(data: datageneric[], get_value: (record: d) => number) { // works without error let values = data.map(get_value); // following line errors with: // argument of type 'datageneric' not assignable parameter of type 'd'. // values = data.map(d => get_value(d)); // works without error, why type assertion needed? values = data.map(d => get_value(d d)); } i'm wondering why type assertion needed when passing single value get_value ? typescript 2.3.4 the reason need cast d or error: argument of type 'datageneric' not assignable parameter of type 'd' is this: interface datageneric2 extends datageneric { value2: string; } transform([{ value: 3 }], (record: datageneric2) => { return record.value2.length; }); in example, function being passed get_value expects values of type datagen...

r - Plot two igraph networks using the same coordinates and same placement in the plot frame -

i trying plot network changes in time. network starts number of nodes , edges , each time step of nodes , edges removed. i want able plot network nodes in same place in each. when try this. nodes shift position in plot frame if relation each other same. i making network change gif small changes annoying. think change may occur when large fraction of nodes removed not sure. the code below illustrates using er graph. library(igraph); library(dplyr) #generate random graph set.seed(500) randomgraph <- sample_gnm(1000, 2500) #name nodes v(randomgraph)$name <- paste0("node", 1:1000) #get coordinates of nodes coords <- layout_with_fr(randomgraph) %>% as_tibble %>% bind_cols(data_frame(names = names(v(randomgraph)))) #delete random vertices deletevertex <-sample( v(randomgraph)$name, 400) randomgraph2 <-delete.vertices(randomgraph, deletevertex) #get coordinates of remaining nodes netcoords <- data_frame(names = names(v(randomgraph2)...

error on openssl build on win10 with visual studio 2017 -

im try compile telegram desktop source github when try comple openssl command nmake -f ms\nt.mak instructions got error : error c2065: 'errno': undeclared identifier windows : 10 visual studio : 2017 error log : d:\tbuild\libraries\openssl>nmake -f ms\nt.mak microsoft (r) program maintenance utility version 14.10.25019.0 copyright (c) microsoft corporation. rights reserved. building openssl cl /fotmp32\cryptlib.obj -iinc32 -itmp32 /mt /ox /o2 /ob2 -dopenssl_threads -ddso_win32 -w3 -gs0 -gf -gy -nolo go -dopenssl_sysname_win32 -dwin32_lean_and_mean -dl_endian -d_crt_secure_no_deprecate -dopenssl_bn_asm_part_words -dope nssl_ia32_sse2 -dopenssl_bn_asm_mont -dopenssl_bn_asm_gf2m -dsha1_asm -dsha256_asm -dsha512_asm -dmd5_asm -drmd160_asm - daes_asm -dvpaes_asm -dwhirlpool_asm -dghash_asm -dopenssl_no_rc5 -dopenssl_no_md2 -dopenssl_no_ssl2 -dopenssl_no_krb5 - dopenssl_no_jpake -dopenssl_no_weak_ssl_ciphers -dopenssl_no_dy...

python - Adding a field to a ManyToManyField -

so im working on django app. in admin can create shop packs people order. so i've created model different items pack can include. after little research, found out needed manytomanyfield this. so created model manytomanyfield connects shop items model. aka itemsincluded = models.manytomanyfield(shopitems) works can items , that. my problem can add items want how many pcs u in each item. should integerfield. i have tried option though in manytomanyfield. didn't work. and im stuck here because can't find things how it. ideas? just reference here model , admin model (all imports correct done) models.py class shoppakker(models.model): navn = models.charfield(max_length=255, null=false) description = models.textfield(null=false) pris = models.integerfield(null=false) item_include = models.manytomanyfield(kioskitem) def __str__(self): return self.navn admin.py admin.site.register(shoppakker) though method item_include = mode...

xslt - how to transform xml file to graphml file -

<?xml version="1.0" encoding="iso-8859-1"?> <fmimodeldescription fmiversion="1.0" modelname="bouncingball" modelidentifier="bouncingball" guid="{8c4e810f-3df3-4a00-8276-176fa3c9f003}" numberofcontinuousstates="2" numberofeventindicators="1"> <modelvariables> <scalarvariable name="h" valuereference="0" description="height, used state"> <real start="1" fixed="true"/> </scalarvariable> <scalarvariable name="der(h)" valuereference="1" description="velocity of ball"> <real/> </scalarvariable> <scalarvariable name="v" valuereference="2" description="velocity of ball, used state"> <real/> </scalarvariable> <scalarvariable name="der(v)" valuereference="3" description=...

reactjs - Customizing my location button in airbnb/react-native-maps -

Image
i have used airbnb/react-native-maps designing tracking based apps. have designed custom search box. problem is, search box overlaps location button. there way customize location button , changing alignment position? have attached photo more specification. here sample code have used <mapview provider={provider_google} style={styles.map} region={{ latitude: this.props.initialposition.latitude, longitude: this.props.initialposition.longitude, latitudedelta: latitude_delta, longitudedelta: longitude_delta }} zoomenabled={true} minzoomlevel={5} maxzoomlevel={20} showsmylocationbutton={true} showsuserlocation={true} ... ... ... > {....

if statement - shell script if condition too many arguments -

/root/mp3/ path contains below file. want move file contain letter "in" other folder 2017-02-10-12-11-05-in.talaw 2017-02-10-12-11-05-out.talaw 2017-02-10-12-12-05-in.alaw 2017-02-10-12-12-05-out.alaw $files=/root/mp3/* f in "$files" ef=$(ls $f | awk -f"." '{print $1}' | awk -f "-" '{print $nf}') #to check in file if [ $ef = "in" ] #if file contian "in" letter move other folder ) mv /files /sotrage fi done getting error many arguments @ if [ $ef = "in" ] if tried if [ "$ef" == "in" ] not getting current output using if [ $ef = "in" ] compare if file contains "in" then should move files conatians in other folder really want mv -t /destination /root/mp3/*-in.* you having problems due you're storing pattern in variable: $files=/root/mp3/* f in "$files"; at point, $f contains ...

Picamera python code mmal out of resoures -

recently changed picamera because old 1 doesn't work. new picamera makes error when use python code. import picamera cam = picaemr.picamera() cam.capture() print("captured") mmal: mmal_vc_port_enable: failed enable port vc.null_sink:in:0(opqv): enospc mmal: mmal_port_enable: failed enable connected port (vc.null_sink:in:0(opqv))0x804fc0 (enospc) mmal: mmal_connection_enable: output port couldn't enabled traceback (most recent call last): file "cameratest.py", line 3, in cam = picamera.picamera() file "/usr/lib/python2.7/dist-packages/picamera/camera.py", line 433, in init self._init_preview() file "/usr/lib/python2.7/dist-packages/picamera/camera.py", line 513, in _init_preview self, self._camera.outputs[self.camera_preview_port]) file "/usr/lib/python2.7/dist-packages/picamera/renderers.py", line 558, in init self.renderer.inputs[0].connect(source).enable() file ...

html - CSS transition to turn corner triangle into rectangle panel -

i want create corner in panel take on whole surface of panel when hovered. so far have : https://jsfiddle.net/nk8wc5lx/ html <div class="col-md-4 mb-4"> <div class="panel panel-default1"> <div class="panel-body"> <div class='amg-corner-button_wrap'> <div class='amg-corner-button'></div> <span class='amg-corner-button_text'>text goes here</span> </div> </div> <!-- panel body --> </div> <!-- panel default --> </div> <!-- col md 4 --> css .panel-default1 { padding-top: 10px; border-radius: 20px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.10); height: 400px; width: 100%; overflow: hidden; margin: 0 auto; position: relative; } .amg-corner-button_wrap { display: block; position: absolute; bottom: 0; right: ...

nginx disallow direct file access, allow domain only -

i need advise how implement following rules nginx: if user requests domain.com (or domain) directly, send him node.js application (proxy_pass http://localhost:8080 ;), if user requests file or other url directly, not clear top domain name, serve /img.png file. any ideas how implement that? here go: if ($request_uri != "/") { rewrite ^ /img.png last; } location /img.png { internal; root /path/to/image; }

linux - Programmatically add phone numbers to contacts -

i want programmatically add phone number in order check whether phone number exists in instagram, telegram, whatsapp etc. how possible realize such kind of app? (maybe linux distribution loaded docker vps android emulator, using telegram/instagram/whatsapp api's info)

c# - detect which item is selected by the hand pointer (not mouse) in listbox wpf -

is there similar way detect item in listbox wpf had been selected kinect v2 hand pointer? tried use selected trigger on listbox , error says: 'listbox' not contain definition 'selected' , no extension method 'selected' accepting first argument of type 'listbox' <listbox x:name="listbox" verticalalignment="bottom" itemtemplate="{dynamicresource itemtemplate11}" itemssource="{binding collection}" selected="listbox_selected"> <listbox.itemspanel> <itemspaneltemplate> <stackpanel orientation="horizontal"/> </itemspaneltemplate> </listbox.itemspanel> </listbox> public partial class mainwindow { /// <summary> /// initializes new instance of <see cref="mainwindow"/> class....

ruby on rails - Sort a resource based on the number of associated resources of other type -

i have movie model has many comments, want sort them (movies) using sql inside active record based on number of associated comments per movie. how can achieve behavior in efficient way. i want on fly without counter cache column you can this @top_ten_movies = comment.includes(:movie).group(:movie_id).count(:id).sort_by{|k, v| v}.reverse.first(10) include(:movie) prevent n+1 in sql group(:movie_id) = grouping based on movie each comment sort_by{|k,v|v} = result array of array example [[3,15],[0,10][2,7],...] for first part [3,15] = meaning movie id = 3, has 15 comments you can access array @top_ten_movies[0] = first movie has top comments default ascending, reverse descending comments

maven - Exclude external dependent jars been take up during Spring Boot Configuration -

i have spring boot project dependent on spring project dtos defined follows . <dependency> <groupid>com.suvankar</groupid> <artifactid>my-core</artifactid> <version>1.0-release</version> </dependency> my-core jar internally have beans defined . dont want load beans my-core jar in current project. use dto's present in my-core jar . how can tell spring boot not load beans my-core . or there way in maven can include package contains dto's .

oop - Java, Object Oriented Programming -

can me followings please: - have gomuku class extend model, , need copy constructor instead of re-initializing everything, call model constructor gomuku class: //this model constructor public model ( model other ) { this.w = other.w; this.h = other.h; this.blacksturn = other.blacksturn; this.gamestarted = other.gamestarted; this.gameover = other.gameover; this.blackwon = other.blackwon; this.whitewon = other.whitewon; if (other.w <= 0 || other.h <=0) return; this.board = new piece[other.h][other.w]; this.winningsequence = new arraylist<>(); for(int r=0; r<other.h; r++){ for(int c=0; c<other.w; c++){ this.board[r][c] = piece.none; } } } //this gomuku public gomoku ( gomoku other ){ //i want call model constructor instead of initializing in here. //other.winningsequence = new arraylist<>(); } assuming have copy constructor in model. need y use model ...