Posts

Showing posts from March, 2012

Erlang understand recursion -

i have problems understanding recursion , hoping help. have 2 examples answers can't understand how outcomme calculated. f1(x, [x | ys]) -> [x] ++ f1(x, ys); f1(x, [y| xs]) -> tl(f1(y, xs)) ++ [x]; f1(x, []) -> [x,x]. if run code with: f1(2, [1,1,1,6]). -> [1,6,1,2] another example: f1(c, [f,b,d,d,a]) -> [b,f,c] can please explain me how function calculates? :) another recursion function can't grasp one: f2([x|xs]) when x > 2 -> [x|f2(xs)]; f2([x|xs]) -> [y|ys] = f2(xs), [y,x+y|ys]; f2([]) -> [1]. example: f2([3,1,2]). -> [3,1,2,3]. how that? thanks in advance :) these examples make use of erlang's pattern matching. the first clause of first example match if first element of list same first argument f1(x, [x | ys]) -> [x] ++ f1(x, ys); the second clause match other cases list not empty f1(x, [y| xs]) -> tl(f1(y, xs)) ++ [x]; and last clause matches empty list. f1(x, []) -> [x,x]. when ev

android - getLastLocation does not work on second time -

i'm using google play services user's last known connection. @override public void onconnected(bundle connectionhint) { final location lastlocation = locationservices.fusedlocationapi.getlastlocation( _googleapiclient); } @override protected void onresume() { super.onresume(); connecttogoogleplay(); } @override protected void onpause() { super.onpause(); if (_googleapiclient != null) { _googleapiclient.disconnect(); } } works expected. the problem occurs whenever i'm clicking on button , starting application again. app crashes because getlastlocation return null. formal documentation states - if location not available, should happen rarely, null returned. fine, know sure location exists, retrieved second ago. i did quick experiment , removed _googleapiclient.disconnect(); , works, somehow disconnect erases last location why ? missing ? a few thin

javascript - How to use angularjs to change the values of another select tag? -

i have 2 web api's calling. each value in first api type has id needs used filter second api category. json below: // types [{"id":1,"text":"hardware","description":"hardware"}, {"id":2,"text":"software,"description":"software"}"}]; // categories [{"id":1,"typeid":1,"parentid":0,"name":"printing"}, {"id":2,"typeid":1,"parentid":1,"name":"toner"}] first of all, have store selectedtypeid used filter array, , can call angular $filter in second array. sintax: $filter('filter')(array, expression, comparator) e.g: $filter('filter')($scope.categories, {typeid: $scope.selectedtypeid}, comparator)

cql - Column order when importing CSV into Cassandra with cqlsh -

i'm new cassandra. cql appears ignore column order in create table statement, , order columns primary key first , remaining columns in lexicographic order. understand that's how they're stored internally, coming traditional database perspective, disregarding column order , leaking implementation detail user surprising. documented anywhere? [cqlsh 4.1.1 | cassandra 2.1.8 | cql spec 3.1.1 | thrift protocol 19.39.0] cqlsh:test> create table test (c int primary key, b text, int); cqlsh:test> describe table test; create table test ( c int, int, b text, primary key (c) ) that makes difficult import csv file columns in order thought using. cqlsh:test> copy test stdin; [use \. on line end input] [copy] 1,abc,2 bad request: line 1:44 no viable alternative @ input ',' (... c, b) values ([abc],...) aborting import @ record #0 (line 1). previously-inserted values still present. 0 rows imported in 7.982 seconds. cqlsh:test> copy test stdin; [

sql server - SET NOCOUNT ON using ADO is not supressing PRINT messages -

in application using following code: set ors = oconn.execute("set nocount on; execute mysp;") mysp returns print messages , application returning them errors. how make print messages don't show won't trigger error in application? i tried set set nocount on; doesn't seem fix it. set nocount on suppresses (n) row(s) affected message. to stop print statements executing inside procedure, need remove them print statements procedure definition.

c# - Authenticating Mandrill Inbound Webhook Requests in .NET -

i'm using mandrill inbound webhooks call method in wcf api. request coming through, can parse it, etc. my problem lies in getting value of x-mandrill-signature header match signature i'm generating (based on process detailed here: https://mandrill.zendesk.com/hc/en-us/articles/205583257-authenticating-webhook-requests ). this i'm doing: list<string> keys = httpcontext.current.request.params.allkeys.tolist(); keys.sort(); string url = "mymandrillwebhookurl"; string mandrillkey = "mymandrillwebhookkey" foreach (var key in keys) { url += key; url += httpcontext.current.request.params[key]; } byte[] bytekey = system.text.encoding.ascii.getbytes(mandrillkey); byte[] bytevalue = system.text.encoding.ascii.getbytes(url); hmacsha1 myhmacsha1 = new hmacsha1(bytekey); byte[] hashvalue = myhmacsha1.computehash(bytevalue); string generatedsignature = c

linux - Installation problems with Mongo on Nitrous.io container -

i created ubuntu container on nitrous.io can develop on chromebook without chromebook's limitation. having trouble using mongodb. followed these steps install it: ~ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7f0ceb10 ~ echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list ~ sudo apt-get update ~ sudo apt-get install -y mongodb-org ~ sudo service mongod start i can't connect mongo through mongo shell. error message: mongodb shell version: 3.0.6 connecting to: test 2015-10-02t21:13:56.629+0000 w network failed connect 127.0.0.1:27017, reason: errno:111 connection refused 2015-10-02t21:13:56.630+0000 e query error: couldn't connect server 127.0.0.1:27017 (127.0.0.1), connection attempt failed @ connect (src/mongo/shell/mongo.js:179:14) @ (connect):1:6 @ src/mongo/shell/mongo.js:179 exception: connect failed i hav

javascript - setTimeout() target function never fires -

function redirecthome() { alert("here1"); function sethref() { alert("here2"); window.parent.location.href="fprindex.html?action=edit&aspect=<%=request("aspect")%>&id=<%=request("request_id")%>"; }; document.forms["form1"].submit(); var timer = settimeout( sethref, 1000 ); } redirecthome() called via button "onclick()" event. the first alert "here1" seen, "here2" never seen. what's wrong? what work if simply: function redirecthome() { document.forms["form1"].submit(); window.parent.location.href="fprindex.html?action=edit&aspect=<%=request("aspect")%>&id=<%=request("request_id")%>"; } what i'm effect 1 second delay time form submitted, time redirect happens - purely aesthetic reasons. what problem submit() call causing full post serv

eclipse - Maven offline build fails when it encouners google guava url with invalid character -

i need make tycho-maven build work in offline mode, can deploy environments no internet connection , let people run build downloaded artifacts third party code app depends on. product being built eclipse rcp product, using org.eclipse.tycho:target-platform-configuration plug-in load dependencies rcp target file. first run mvn -dmaven.repo.local=/some/path/ -dgeneratepom=true clean install create artifacts, , build succeeds. when run mvn -dmaven.repo.local=/some/path/ -o clean install fails because it's running in offline mode , there no local cache available http://download.eclipse.org/tools/cdt/releases/8.6 so run mvn -dmaven.repo.local=/some/path/ dependency:go-offline make download artifacts needs build, fails message: [error] failed execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:resolve-plugins (resolve-plugins) on project : nested: not transfer artifact com.google.guava:guava:jar:[10.0.1,14.0.1] from/to central ( https://repo.maven.a

unicode - How to determine whether a codec has a const ratio 'byte number per character'? -

given iana codec name (or, 1 of used in iconv/icu), easiest way determine whether codec has fixed width representation characters or not? use ucnv_isfixedwidth() : uerrorcode status; uconverter* converter = ucnv_open("koi8-r", &status); if (u_success(status)) { ubool is_fixed = ucnv_isfixedwidth(converter, &status); }

php - RegEx - Match all URLs in string, excluding ones in <iframe> tag? -

i'm using mediaembed ( https://github.com/dereuromark/mediaembed ) convert media urls in string respective embed code, it's catching media urls within iframes (already embedded). the expression i'm using match links is: "~[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]~" what need changed in order not match if url within iframe? solution code: '/(?<!=")(\b[\w]+:\/\/[\w-?&;#~=\.\/\@]+[\w\/])/'

Run a PHP Function when User Clicks a Link Using the Post Method -

what cleanest way run php code below instead of $_get, using $_post instead? <?php function run_my_function() { echo 'i ran php function!'; } if (isset($_get['run'])) { run_my_function(); } ?> <html> <body> <p>hello there! <a href="?run">run php function.</a></p> </body> </html> no , cannot send post request anchor tag. have use <form>

javascript - nested for loop only executing once -

i using javascript , jquery create simple 40x40 grid. here's nested loop this: function display_grid() { browser_grid='' $visible_grid = $('#grid'); for(i=0;i<40;i++){ $visible_grid.append('<div>'); for(i=0;i<40;i++){ $visible_grid.append("<div class='square'> </div>"); } $visible_grid.append('</div>'); } i expect create 40 divs each 40 divs inside each 1 of them. browser shows 1 row 40 divs. <div> <div class="square></div> <div class="square></div> <div class="square></div> ... </div> this want do, forty times. i'm not experienced js, i'm confused why first loop isn't executing 40 times. you need different variable name inner loop. function display_grid() { browser_grid=''; $vi

get text from index page to another using php -

is there way text page? here's example i have index.php , page1.php , page2.php now on index.php write below create page1 , page2.. <div id="pg1"><a href="page1.php">hello page 1</a></div> <div id="pg2"><a href="page2.php">hello page 2</a></div> now on page1 , page2 create divs below.. <div id="getpg1">when page1.php opened, here text on index.php on div id pg1. text div</div> <div id="getpg2">when page2.php opened, here text on index.php on div id pg2. text div</div> hope understand. means when page opened text pointed index.php sorry, took me moment fix here first. here go: on index.php put between <head></head> : <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $(&q

php - PDO can I reuse the same Statement Handle for multiple queries? -

i using pdo access data base , looping using 2 while loops fetch @ same time, seen below: $dbh = new pdo('mysql:host=localhost;dbname=database;charset=utf8',$dblogin,$dbpass); $sql = 'select * table'; $sth = $dbh->prepare($sql); $sth->execute(); while ($bm_table = $sth->fetch(pdo::fetch_assoc)) { //sql query $sql1 = 'query here'; $sth1 = $dbh->prepare($sql1); $sth1->execute(); //loops through using different handle, if used sth again? while ($row = $sth1->fetch(pdo::fetch_assoc)) { somefunction($bm_table,$row); } } as can see above using different statement handle (sth, sth1 etc.) necessary? or can use 1 statement handle everything. reason have used multiple handles $bm_table value uses sth, still in use while fetching $row wouldn't change value of $bm_table or stop fetch working? how handles pdo work? when in case have 2 simultaneous fetch loops running @ same time using same pdo connection. so main thing looking here if

javascript - knockout - pass child array with viewmodel data -

i have viewmodel following: var viewmodel = new function () { var self = this; self.id = ko.observable(); self.currentorder = { orderid: ko.observable(), firstcropid: ko.observable(), secondcropid: ko.observable(), productdatalist: ko.observablearray() }; <script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.0.0/knockout-min.js"></script> i trying pass viewmodel.currentorder mvc controller follows: self.saveorder = function () { var url = '@url.action("saveorder", "orders")'; $.mobile.loading('show'); var productinfo = {}; (i = 0; < 3; i++) { productinfo = { id: i, rate: + 11, variable: + 111 }; viewmodel.currentorder.productdatalist.push(productinfo); } $.ajax({ type: 'post', url: url, datatype: 'json

java - Creating a 2D array of a class that returns an array of char -

i have been trying desperately create 2d array of chars using classes keep getting stuck @ same point printed array combination of letters , numbers. have tried using tostring() system.out.print(board) not seem make difference. have functional version of program using array of chars. however, task have complete requires printing chars using array of class (in case gameitem). my display method follows: private void display(){ board = new gameitem[4][4]; for(int i=0; i<board.length; i++) { for(int j=0; j<board.length; j++) { board[i][j] = gameitem.gold; system.out.print(board); } system.out.print("\n"); } } and gameitem class contains: public class gameitem { static gameitem gold = new gameitem ('g'); public gameitem(char c){} } note required use constructor.

java - Send message to remote server with RabbitMQ -

i've been running issue lately. i'm trying send packets remote server using rabbitmq , java quite time , need help. here code looks connectionfactory factory = new connectionfactory(); //factory.sethost("localhost"); factory.setusername("dev"); factory.setpassword("/*user password*/"); factory.setvirtualhost("/"); //not sure means factory.sethost("/*remote server ip*/"); //is correct factory.setport(5672); connection = factory.newconnection(); i using windows server 2012, i've added rules firewall allow both udp & tcp on ports 5672 , 15672 inbound connections. these ports outgoing? assume i'd have allow on these ports on desktop well. know packets send , work locally, tested plenty of times. can't remote connection work without timing out. i'd love help! i think right create connection did configure broker sever (rabbitmq)? if not, @ beginning, default user name of broker server guest , pas

javascript - Autocomplete textbox options from JSON -

this answer close i'm trying do. i'm branching original plunker new plunker the original plunker has text box auto-completes auto-complete options hard coded in list. i've added service new plunker gets information stackoverflow badges in json. how can have auto-complete use json data provide list of badge names auto-complete options? <html lang="en"> <head> <meta charset="utf-8" /> <title>jquery ui autocomplete - default functionality</title> <script data-require="angular.js@1.3.9" data-semver="1.3.9" src="https://code.angularjs.org/1.3.9/angular.js"></script> <link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css" /> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>

c# - WeakReference, WeakEvents: Usefulness for dynamically loaded/unloaded server modules, DLLs? -

i thinking whether weakreferences , weakevents suitable in case of server modules interface. design? but question performance, there need invoke in weakevent pattern , accessing weakreference, perhaps too update: details server: has module manager, can load/unload dll's implementing classes shared interface, imodule, so module manager creates , keeps instances of imodule, modules: have name or unique code, need interact other modules, use theirs methods, properties, events, the issue when module gets instance of module(provided name example module manager), point there no guarantee module ever garbage collected before unload. but there generic class(weakrefmodule t: imodule) of given imodule implementation, constrained imodule, internally store weakreference on imodule. , given module expose public methods through extensions methods or inheritance based on weakrefmodule. hiding instance of module behind weakreference. same properties , events(weakeven

objective c - Swizzle something that was retained -

hi don't understand retain well. there code here: mappicon = [[nsimage imagenamed:@"nsapplicationicon"] retain]; i trying swizzle whenever ask image name nsapplicationicon give custom icon. still see original icon come sometimes. think it's because of retain thing? right? possible clear retain? make swizzle works 100% of time instead of 80% :( i read here retain wasnt able apply situation above: http://www.cocoawithlove.com/2010/06/assign-retain-copy-pitfalls-in-obj-c.html very trying swizzle here: https://dxr.mozilla.org/mozilla-central/source/widget/cocoa/nsmacdocksupport.mm?offset=200#140

javascript - Posting multiple arrays with $http service in Angular -

i using angular , have 2 arrays post node.js server processed , sent in confirmation email. thoughts on how submit these arrays? here 2 arrays: var array1 = vm.contacts; var array2 = vm.projects; $http service: data = array1; // possible add array2 here too? $http.post('http://localhost:9000/api/emails', data) .then(function(response) { console.log(response); }, function(response) { console.log('error',response); } you send object contains arrays. this: var vm = {}; vm.contacts = []; // array of contacts. vm.projects = []; // array of projects. var data = vm; // object arrays. in $http service: $http.post('http://localhost:9000/api/emails', data) .then(function (response) { console.log(response.data); // use response.data show response. }, function (response) { console.log('error', response); } updated: by way might send arrays of arrays. this: var vm = {}; vm.contacts = []; vm.projects = []; va

elisp - Emacs: open large files in external apps automatically -

i use emacs file manager , open large file (in dired or speedbar) xdg-open . can use defadvice abort-if-file-too-large function , how correctly? advising abort-if-file-too-large requires still raise error if opens file externally, otherwise find-file-noselect still try open file. also, want call external program when operation type passed abort-if-file-too-large indicates file being opened. following work, though might want tweak arguments call-process make fit scenario better: (defun open-outside-emacs (orig-fun size op-type filename) (if (not (string-equal op-type "open")) (apply orig-fun size op-type filename) (call-process "/usr/bin/xdg-open" nil 0 nil (expand-file-name filename)) (error "opened externally"))) (advice-add 'abort-if-file-too-large :around #'open-outside-emacs)

database - Taking and filtering MYSQL results on another params table -

Image
please me query. want projects_ids, contain params , values of params. when use 1 criteria (not three, image) - works , gaing results! when use all, think cpu trying record when 3 criterion passed. need projects_ids contains criterion. my solution @ time self-join. each param create "join" table on "projects_id", , add more statements new tables. 10 params = 10 joins.

how to convert 95900 into 09:59:00 format in php -

my sql query returns result 95900 when add 2 time (06:34:00 , 03:25:00) using sum(), wish php code converts result 95900 09:59:00 format. can helps me? novice php. i got desired answer using following sql functions: select sec_to_time( sum( time_to_sec( timespent ) ) ) timesum yourtablename

javascript - Cannot figure out why button is not showing -

i have button submit answers go on next question on quiz app. when try put in div quiz @ button disappears. doing wrong? appreciated. here code: var quizapp = quiz(questions, $('#quiz-area')); quizapp.questiondisplay(); // currentquestion = 0, valid question $('#next').on('click', quizapp.nextquestion); $('#totalquestions').text(questions.length); // todo: add event listener reset $('#reset').on('click', quizapp.reset); #quiz-area{ margin: 150px 160px; padding: 100px 40px 40px 40px; width: 500px; height: 400px; background-image: url("http://hardwoodhustle.com/wp-content/uploads/2014/03/hwh-bg1.jpg"); background-repeat: no-repeat; -webkit-background-size: cover; -mox-background-size: cover; -o-background-size: cover; background-size: cover; } div #quiz-area{ border: red 1px solid; } #quiz-area ul { border: 1px solid red; } #quiz-area li, #quiz-area ul { list-style-type: n

python - No module named sqlite3 exception -

i'm using boost::python in visual c++ application , have script wants connect sqlite database , read data it. in script, imported sqlite3 , works fine when run python idle but, when runs inside visual c++ application, exception: no module named _sqlite3 can tell me why happens? did miss here? even line in code returns same exception: boost::python::object objsqlite3 = boost::python::import("sqlite3"); i found problem!!! i install python via inno setup in silent mode. first time since there no python on system libraries copy if u again since try install python again (/i) , how mess library sqlite3 . so u need change inno setup script reinstall python if exists (/a) . ps : if have problem , don't use inno setup reinstall python fix problem. best regards

sql - Cache size and sort size in postgreSQL -

reading the article posgtresql effective settings, came across cache size , sort size concepts. there said, these 2 sizes don't depend on each other. both cache size , sort size affect memory usage, cannot maximize 1 without affecting other googling didn't useful results. far got, cache size can viewed select current_setting('shared_buffers') shared_buffers this returns size of shared buffers (i.e. cache). sort size? sort_mem parameter, mentioned in bruce's artice, same work_mem (e.g. http://postgresql.nabble.com/sort-mem-param-of-postgresql-conf-td1910195.html ). this parameter specifies amount of memory used sort , hash operations. part of local backend memory, while shared buffers reside in global memory of server. see doc: http://www.postgresql.org/docs/9.4/static/runtime-config-resource.html

oracle - existing state of package has been invalidated -

i facing error. i have 2 schema schema , schema b schema b contains table my_table in values being inserted. there triggger my_trigger written my_table in schemab each row create or replace trigger schemab.my_trigger on schemaa.my_table each row begin if inserting schemaa.my_package.my_procedure (:new.field_a,new.field_b, :new.field_c); end if; exception when others insert my_log(dbms_utility.format_error_stack,sysdate); end my_trigger; / after insert this trigger written on my_table of schemab calling procedure present in schema a. however when trigger being fired getting below error in logs error: ora-04061: existing state of package "schemaa.my_package" has been invalidated ora-04065: not executed, altered or dropped package "schemaa.my_package"

android - Current Location GPS Tracking Issue -

i followed tutorial http://www.androidhive.info/2012/07/android-gps-location-manager-tutorial/ when launch app lat:0 , long:0 shown on emulator , mobile device i using latest android studio , api 16 please open terminal , enter: telnet localhost 5554 then enter longitude latitude as: geo fix <longitude> <latitude> example: geo fix 88.556(longitude) 22.567(latitude) alternatively, can open android device monitor under tools -> android. there can set lat,lng value.

java - Change GTK3 tooltip color only for Eclipse running in Ubuntu -

i running eclipse mars on ubuntu 15.04. have seen instructions change gtk3 tooltip fg/bg color @ system-wide level. question how can change gtk3 tooltip fg/bg color eclipse without affecting other applications. (gtk3 , css not fields of expertise need here) i found way fix eclipse tooltip color without falling gtk2 , without affecting other application. the fix captured in script , can accessed here. https://github.com/kiranmohan/eclipse-gtk3-ubuntu the script makes copy of ambiance theme, modifies tooltip color , writes launcher eclipse new theme.

What options are there for a IP camera to webRTC/ORTC gateway? Onvif compatible or not -

there discussion on topic here not specific questions. can consider extension question asked there. googling gives 2 possible solutions: kurento , janus . questions have are: are there other options, opensource or otherwise? among these options, can share experience based upon actual use? is there list of ip cameras compatible such gateways? or what specific features must ip camera have able use such webrtc gateway? is correct if webrtc indeed takes off, webrtc support ip cameras matter of time, incorporated in standards such onvif? i not need application per se bare minimum other webrtc components can plugged in create application. issue not codec conversion related signalling (as distinct webrtc signalling anyway not standardized). discussed nicely on kurento here . i have read ip camera standards, in particular onvif. not looking compatibility standard different issue. i did take @ arguably popular opensource software cctv cameras: zoneminder bloated software,

c# - collection list and gridview -

i want add mark1,mark2,mark3,mark4,mark5 , assign sum show in gridview. i want add marks through function , assign sum property. how it? thanks public partial class form1 : form { public form1() { initializecomponent(); } private void procees() { list<student> ml= new list<student>(); student s1 = new student() { name = "ram", id = "gn01", mark1 = 90, mark2 = 89, mark3 = 75, mark4 = 45, mark5 = 65, sum = "" }; ml.add(s1); datagridview1.datasource = ml; } private void button1_click(object sender, eventargs e) { procees(); } } public class student { private string name; public string name { { return name; } set { name = value; } } private string id; public string id {

php - $http.get won't display in ionic framework -

hi new json , angular, have been struggling display data framework. blank page no error this controller .controller('petindexctrl', function($scope, petservice) { $scope.pets = petservice.all(); console.log($scope.pets); }) this factory .factory('petservice', function($http, $ionicplatform) { var markers = []; return { all: function(){ return $http.get("https://192.168.1.10/getevent.php").then(function(response){ markers = response; return markers; }); } } }); this ionic framework <scrip id="pet-index.html" type="text/ng-template"> <ion-view title="'rooms'"> <ion-content has-header="true" has-tabs="true"> <ion-list> <ion-item ng-repeat="pet in pets" type="item-text-wrap" href="#/tab/pet/{{pet.id}}"> <h3>{{ pet.prof }}</h3&g

python - incrementing key,value pair inside for loop iterating over dictionary -

how can increment key value pair inside loop while iterating on dictionary in python? for key,value in mydict.iteritems(): if condition: #inc key,value #something i have tried using next(mydict.iteritems()) , mydict.iteritems().next() in vain. i using python2.7. edit - know forloop automatically increments key,value pair. want manually increment next pair ( resulting in 2 increments). can't use continue because want both key value pair accessible @ same time. when increment, have current key value pair next. if use continue, lose access current , next key,value pair. do mean this? mydict = {'a': 1, 'b': 2, 'c': 3} items = mydict.iteritems() key,value in items: if key == 'b': # condition try: key,value = next(items) except stopiteration: break print(key, value) output: ('a', 1) ('c', 3)

plist - Copy all domain values to another computer using defaults write -

i trying copy r settings 1 mac another. can export values domain using defaults read org.r-project.r > r.plist however, cannot figure out how write values. tried following. defaults write org.r-project.r < r.plist this fails due incorrect command syntax (prints out help). each of following commands yields could not parse: "append. try single-quoting it. defaults write org.r-project.r `cat r.plist` defaults write org.r-project.r ''`cat r.plist`'' tmp=$(echo \'`cat r.defaults.plist`\') defaults write org.r-project.r $tmp if copy contents of $tmp variable above , paste directly command line, works. so, know there no syntax errors in r.plist.

java - Spring Boot Thymeleaf 3 external javascript template configuration -

i have spring boot application working oauth2 client. i'm using thymeleaf 3 template engine. these thymeleaf 3 related dependencies in build.gradle. compile('org.thymeleaf:thymeleaf:3.0.1.release') compile('org.thymeleaf:thymeleaf-spring4:3.0.1.release') compile('nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:2.0.4') compile('org.thymeleaf.extras:thymeleaf-extras-springsecurity4:3.0.1.release') it makes no difference if reference dependencies this: ext["thymeleaf.version"] = "3.0.2.release" ext["thymeleaf-layout-dialect.version"] = "2.1.1" dependencies { compile('org.springframework.boot:spring-boot-starter-thymeleaf') } i want able use thymeleaf 3's html , javascript template modes. html mode works, in javascript mode messagesource not working properly. here webmvcconfiguration class: @configuration public class webmvcconfig extends webmvcconfigureradapter implements applica

javascript - Fade effect does not work (Bootstrap 4) -

i've managed add alphabetical filter on index page. code gets inspired bootsnip here: https://bootsnipp.com/snippets/featured/portfolio-gallery-with-filtering-category . bootsnip based on bootstrap 3.3 my index page based on bootstrap 4 beta. is there reason why there no fade effect when click on letter filter albums? update: i have updated code according answer below. i'm using bootstrap cards i'm still stuck animations when apply filter: no fade or smooth effect... here new fiddle: https://jsfiddle.net/md8fkm0d/5/ $(document).ready(function(){ $(".filter-button").click(function(){ var value = $(this).attr('data-filter'); if(value == "all") { $('.filter').show('1000'); } else { $(".filter").not('.'+value).hide('3000'); $('.filter').filter('.'+value).show('3000'); } });

python abstract base classes, difference between mixin & abstract method -

Image
the following table shows varying abstract base classes used on python. however, bit confused (in context) what difference between abstract methods column , mixin methods column. 1 optionally implemented , other not? i've been mulling on , every 1 of "theories" doesn't seem right. reference anything in abstract methods column, have implement yourself. abc provides default implementations of methods in mixin methods column, implemented in terms of methods have write.

c# - Exception when creating on demand loactor for Azure Media Services asset -

i'm using azure functions accessing azure media services. have http trigger me streaming link video file. when try create on demand streaming locator server return following error: one or more errors occurred. microsoft.windowsazure.mediaservices.client: error occurred while processing request. locator's expirationdatetime cannot in past . here part of code: using system.net; using microsoft.windowsazure.mediaservices.client; ... public static readonly timespan expirationtimethreshold = timespan.fromhours(5); public static readonly datetime timeskew = datetime.utcnow.addminutes(-5); ... public static async task<httpresponsemessage> run(httprequestmessage req, tracewriter log) { string assetid = req.getquerynamevaluepairs().firstordefault(q => string.compare(q.key, "assetid", true) == 0).value; iasset wantedasset = _context.assets.where(a => a.id.equals(assetid)).firstordefault(); if (wantedasset == null) { return

Convert datetime in java -

i have convert datetime 1 format in java. here period im starting with: 2001-01-01t01:00z/2002-02-02t02:00z and here result need end with: 2002-02-02t02:00:00 so need second part of period , need add :00 seconds end , remove z. im not familiar date formats. 1 of these standard format? can use kind of library read , convert these datetimes? tl;dr interval.parse( input ) .getend() .atoffset( zoneoffset.utc ) .format( datetimeformatter.iso_local_date_time ) interval your input string period on standard iso 8601 format. represents pair of moments, z on end short zulu , means utc. slash character separates start , stop. parse interval class found in threeten-extra project. interval interval = interval.parse( input ) ; instant extract stop moment. instant instant = interval.getend() ; offsetdatetime i suspect should working objects instant rather manipulating string. if insist, generating formatted

image processing - How to remove the known background from captcha in C# -

Image
for example, there 2 pictures. captcha: background: how remove background captcha in c#? one simple method is: can iterate image's pixels. every pixel, need subtract background pixel value original corresponding pixel value. however, simple method is, not detect edges , not separate foreground background. therefore, see dots in resulted image, result of subtraction black dots of background. image in order achieve c#, need image processing library. if don't have one, can here details. if not want use method, can edge detection algorithms, these quite difficult. in addition, not guaranteed work these captcha images.

How do I trigger Xdebug from within a Vagrant's SSH via CURL? -

so have vagrant-driven instance, running 2 projects, , works swimmingly. project has server instance, , client instance. communicate on rest ... , there too. so, have xdebug set correctly - know this, because if call laravel client instance using cli curl outside homestead, passing ?xdebug_session_start=vagrant, picks in phpstorm , can debug normal: curl -v http://clientproject.dev?xdebug_session_start=vagrant now, if make exact same call , within homestead's cli (i.e. i've ssh'd vagrant box, , run curl command shown above), doesn't trigger. makes no sense me i've scoured net without joy, , i'm hoping fine citizens have come across this? i'm wanting can have server instance call client instance xdebug cookies in development, makes debugging easier developers. okay, after digging around , understanding bit more how xdebug works, realised wasn't working, because xdebug work, originating call must take place on same machine ide. be

mysql - How can I uniquely Insert data into a table without using Unique/Primary key keyword in SQL? Is there any other way? -

i want insert data columns no data can inserted more once! no data of same type/category can same! know easier / best way use defining attribute unique / primary key ... there others ways this! you can check data before inserting it, using group clause, or distinct or join. depends on requirement. for example, if data identical , using distinct enough: insert <yourtable> select distinct ... ... or directly check if data exists in table: inset <yourtable> select .... table s not exists(select 1 yourtable t t.type = s.type , t.category = s.category) and on..

php - Laravel upload any size of file in Google Drive -

i developing laravel 5.4 app running on php 7. using google drive storage.i trying upload large file,size of 200-300 mb or small file of 10-12 kb google drive storage using nao-pon/flysystem .for this,i have followed tutorial: https://gist.github.com/ivanvermeyen/cc7c59c185daad9d4e7cb8c661d7b89b . have changed php.ini this: post_max_size = 800m upload_max_filesize = 700m i can upload small file.the problem occurred when trying upload large file,size of 200-250 mb,the alotted php memory_limit surpasses , error. i have used controller method $files = $request->file('files'); if($request->hasfile('files')){ foreach ($files $file) { $name = $file->getclientoriginalname(); $disk = storage::disk('google'); $disk->put($name, file::get($file)); } } so,i have searched google, how can upload large file without surpassing memory_limit and amazon s3 , modified google drive: $disk = storage::disk('google'); $disk->

ios - Expand UITextView based on its content -

i'm trying expand uitextview change frame based on content. the textview should resize height when text inside of gets larger, , smaller when user deletes text. i tried many answers didn't work. using following 2 lines best answer question, , solved problem: expandingtextview.textcontainer.heighttrackstextview = true expandingtextview.isscrollenabled = false notes: expandingtextview: uitextview . textcontainer: nstextcontainer bounds of text inside expandingtextview. heighttrackstextview: bool if true, reciever adjust height based on expandingtextview height. in order expanding work, need disable textview scrolling by: isscrollenabled = false