Posts

Showing posts from February, 2015

python - How to solve the issue of the conflict of anaconda and virtualenv -

i using virtualenv time , had installed anaconda. tried activate virtual environment using way of anaconda source activate helloworld . (indeed don't remember if command typed in). , environment had been activated. when tried run notebook, said libraries didn't exist if had installed them in environment. not until did realize had activated wrong environment. , close tab , cd hellowworld , did source bin/activate . late. got output prepending /home/lcc/anaconda3/envs/bin path , environment not activated expectedly. know how solve issue? thanks! here full content of activate file under /hello/world : #!/bin/bash # determine directory containing script if [[ -n $bash_version ]]; _script_location=${bash_source[0]} shell="bash" elif [[ -n $zsh_version ]]; _script_location=${funcstack[1]} shell="zsh" else echo "only bash , zsh supported" return 1 fi _conda_dir=$(dirname "$_script_location") if [ $# -gt 1 ];

java - hibernate select data from two tables -

i have 2 tables: authors , books author: @entity @table (name="authors") public class author implements java.io.serializable { private integer id; private string name; private string lastname; /*book list*/ private set<book> books= new hashset<book>(0); public author() { } public author(string name, string lastname) { this.name = name; this.lastname = lastname; } public author(string name, string lastname, set<book> books) { this.name = name; this.lastname = lastname; this.books = books; } @id @generatedvalue(strategy = generationtype.identity) @column(name = "author_id", unique = true, nullable = false) public integer getid() { return id; } public void setid(integer id) { this.id = id; } @column(name = "author_name", unique = true, nullable = false, length = 10) public string getname() { return name; } public void setname(string name) { this.name = name; } @column(name = "autho

javascript - Regex: Minimum 13 characters and WITHIN 13 characters maximum 3 characters -

i need expression validates, this: 1234-567.890-123 min 13 numbers max 3 special characters ("-" , .) <-- no matter where my solution [0-9]{13,}[-\.]{0,3} can't work validates: 1234567890123.-. if ordering of characters in string not matters, can use ^(?=(?:[\d.-]){13,}$)(?=(?:\d*\d){13,})(?!(?:[^.-]*[.-]){4}).*$ regex breakdown ^ #starting of string (?=(?:[\d.-]){13,}$) #lookahead sees string contains digits, . , - (?=(?:\d*\d){13,}) #lookahead match 13 digits (?!(?:[^.-]*[.-]){4}) #looahead number of . , - not equal 4 .* $ middle part (?= #lookahead (?:\d*\d) #match non-digits , digit. {13,} #repeat @ least 13 times.in simple words, matching @ least 13 digits. )

ios - How To Match NSUserDefaults and CoreData Attribute and Get Data if both are same -

here have entity named cliptable fetching clip related information of users here want fetch clip information particular user logged in,for have stored user_id using nsuserdefaults. , clip table has attribute named created_by_user, userid of particular user stores clip. using created_by_user attribute , user_id nsuserdefaults want check whether both same. , if both same clip record of particular user only. below code able show clip record of user in tableview using nsfetchresultcontroller. want records particular user only. hard time doing this. appreciated. user_id [nsuserdefaults standarduserdefaults] stringforkey:@"userid"] -(void)fetch:(nsstring*)catgeory :(bool)all{ appdelegate *delegate = [[uiapplication sharedapplication] delegate]; self.managedobjectcontext = delegate.managedobjectcontext; nsfetchrequest *fetchrequest = [[nsfetchrequest alloc] initwithentityname:@"cliptable"]; // add sort descriptors [fetchrequest setsortdescriptors:@[[nssortdescri

html - Make xf:output a clickable link -

i have xquery instance defined: <xf:instance id="table" xmlns=""> <results> <result> <interfacename></interfacename> <reportdate></reportdate> <testresult></testresult> <filelink></filelink> <filename></filename> </result> </results> </xf:instance> later 'replace' instance submission , retrieving information xquery: <xf:submission id="showtable" method="post" replace="instance" ref="instance('table')" instance="table"> <xf:resource value="concat('/exist/rest/db/xquery/returntable.xq?interface=',instance('defaultinstance')//interfac

C# Selenium - one ChromeDriver for multiple forms? -

i have few forms , i'd have them operating on 1 webdriver. somehow possible? tried creating driver in new class couldnt pass forms. code in form: selenium1 sel = new selenium1(); sel.create(); chromedriver driver = sel.get(); class code: namespace vulcan2 { public class selenium1 { chromedriver driverx; public void create() { chromedriver driverx = new chromedriver(); } public chromedriver driver() { return driverx; } } } you can turn driver class static class: static public class selenium1 { static chromedriver driverx; static public void create() { driverx = new chromedriver(); } static public chromedriver driver() { return driverx; } } and may call this: selenium1.driver().close();

Eclipse: Dynamic Web Project -

how create "dynamic web project" in eclipse? i trying learn primefaces. trying follow video tutorial here supposed go file->new , create dynamic web project. not have option however. i have tried "install new software" , search there, have not found it. doing wrong? thanks! you require eclipse java ee developer tools . install them using instructions @ https://wiki.eclipse.org/wtp_faq#how_do_i_install_wtp.3f .

php - Convert multidimensional array with key and value -

i have php array like: array ( [11] => array ( [0] => foo [1] => bar [2] => hello ) [14] => array ( [0] => world [1] => love ) [22] => array ( [0] => stack [1] => overflow [2] => yep [3] => man ) ) i want result as: array ( 'foo' => '11', 'bar' => '11', 'hello' => '11', 'world' => '14', 'love' => '14', 'stack' => '22', 'overflow' => '22', 'yep' => '22', 'man' => '22' ) tried foreach inside foreach still not make way. there 2 levels. you didn't show foreach attempt, it's simple: foreach($array $key => $val) { foreach($val $v) { $result[$v] = $key; } } you wrap inner foreach in if(in_array()) if aren't guaranteed arra

angularjs - How to split angular code in two script file for single page application -

i have single page application want split code in 2 separate js files, - script1.js - var app = angular.module("angularjs", ["ui.router"]) .config(function ($stateprovider) { $stateprovider .state("home", { url:"/home", templateurl: "template/home.html", controller: "homecontroller", controlleras: "homectrl" }) .state("courses", { url: "/courses", templateurl: "template/courses.html", controller: "coursescontroller", controlleras: "coursectrl" })

c# - Base Expander Style, override header color -

Image
is possible create sort of base expander style , override background color of header in derived style? in application i'm using expanders lot , change background color of header. know copy&paste style , edit color, nicer create new style based on "base style" , setting header's background color. not know how access color. it's color of line: below i'd change (the border in header): border name="border"... cannot access "border" in setter of derived style... this (base) style: <style targettype="expander" x:key="expanderstyle"> <setter property="background" value="{dynamicresource {x:static systemcolors.controldarkbrushkey}}"/> <setter property="foreground" value="{dynamicresource {x:static systemcolors.controltextcolor}}"/> <setter property="template"> <setter.value> <!-- control template expande

android - How to have badge icon at corner of a layout -

Image
i wanted have badge @ corner of layout . managed badge inside layout not able achieve @ corner of . currently code gives me : what want : want have badge on right top corner of layout . i want : toolbar.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="@dimen/toolbar_height" android:background="@color/toolbar_color" android:contentinsetleft="0dp" android:contentinsetstart="0dp" android:elevation="4dp" android:theme="@style/themeoverlay.appcompat.dark" app:contentinsetleft="0dp" app:contentinsetstart="0dp"> <linearlayout

knockout.js - firing custom extender of one observable when another computed observable is changed -

i trying create own validation without using knockout validation library. trying create common validate extender can type of validations want do. doing passing type of validation , required flag in object extender. problem having validate method fires when password field changed , not when passwordvisible property changed. causing problem when password empty , when passwordvisible property changed, attempt empty password not considered change , hence not firing extender. <!doctype html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8" /> <title></title> </head> <body> <script type="text/javascript" src="knockout-3.4.0.js"></script> name:<input type="text" data-bind="value:name" /><br /> user: <input type="checkbox" data-bind="checked:alreadyuser" /><br />

ios - UITableView didSelect delegate doesnt gets called? -

in app, have added uitableview on scrollview. have disabled scrolling in table view. so, scrollview scrolls, have adjusted scroll view content size tableview frame. so, can access cells. consider, there 5 rows visible in screen, if tap of row, didselectrowatindexpath method gets called. if scroll down, 6th cell , tap on it. method doesnt gets called. same issues happens uicollectionview. the reason why have added is. when scroll scroll view, view in should fixed in top , tableview behind should go on scrolling. might have seen in many of apps in android. so, have used scrollview didscroll delegate offset position. per it, make view fixed , vice versa. make height of uitableview same content height of table. set content size of uiscrollview height of uitableview here brief example demonstrate cgrect rect = tbltopics.frame; rect.size.height = tbltopics.contentsize.height; tbltopics.frame = rect; self.scrlvwfacultydtl.contentsize = cgsizemake(self.scrlvwfacult

rx java - Usage of Apache Flink and RxJava -

i'm using apache flink , using rxjava inside of it, questions is: using both of them appropriate? because flink operations map functions , inside of them use rx intensively, take tuples flink , make asynchronous operations them (go db, write queue , on), don't ended using of methods flink expose me , programs steps returns json when rxjava ends processing. can tell me if correct usage of flink or if there aa better way of need do. (like use pass observables between flink steps or that). thanks. flink has powerful tools handle state (e.g. in windows) [1,2], makes possible avoid calls other systems. example, instead of handling state in external key-value store, use (checkpointed) keyvaluestate in flink. handling state inside of flink more efficient/faster calling external systems/databases. a problem asynchronous calls in flink programs can flink faster called systems, result in increasing number of open futures, leading memory problems. so, think, suggested

mysql - Get result in single query rather then three different query -

table structure , sample data create table if not exists `orders` ( `id` int(11) not null auto_increment, `customer_id` int(11) not null, `restaurant_id` int(11) not null, `bill_id` int(11) not null, `source_id` int(1) not null, `order_medium_id` int(11) not null, `purchase_method` varchar(255) not null, `totalamount` int(11) not null, `delivery_charg` int(11) not null, `discount` int(11) not null, `vat` int(11) not null, `total_price` int(11) not null default '0', `date_created` timestamp not null default current_timestamp on update current_timestamp, primary key (`id`), key `customer_id` (`customer_id`), key `source_id` (`source_id`), key `restaurant_id` (`restaurant_id`), key `bill_id` (`bill_id`) ) engine=innodb default charset=latin1 auto_increment=22 ; -- -- dumping data table `orders` -- insert `orders` (`id`, `customer_id`, `restaurant_id`, `bill_id`, `source_id`, `order_medium_id`, `purchase_method`, `totalamount`, `delivery

pandas - How to create a dataframe from dictionary with auto-increment index -

i understand create dataframe, need specify index dictionary, else 'valueerror: if using scalar values, must pass index' error. however, how create dataframe dictionary index auto-increment number? you can construct index using np.arange , pass len of dict: pd.dataframe(your_dict, index = np.arange(len(your_dict))) however, if have single value scalar values in dict it's more appropriate have single row: in [165]: d = {'a':1,'b':3} pd.dataframe(d, index=[0]) out[165]: b 0 1 3 or can use from_dict , pass orient='index' : in [166]: d = {'a':1,'b':3} pd.dataframe.from_dict(d, orient='index') out[166]: 0 1 b 3

Bluebird Promise.map child_process.execFile - read output from callback -

i brand new bluebird , trying instantiate multiple child_process.execfile 's using promise.map , read/combine of stdout @ completion. right now, in order execute 1 execfile , read error , stdout , , stderr this: child_process.execfile("node", [ script, 1 ], function (error, stdout, stderr) { ... }); i can achieve same thing block of code here var promise = require('bluebird'); var execfile = require('child_process').execfile; execfile = promise.promisify(execfile); var print = "print.js"; execfile("node", [ script, 1 ]).then( function (stdout) { console.log(stdout); }, function (stderr) { console.log(stderr); }); when attempt using bluebird , map , modeling it, more or less, around this example. want take example above , able call multiple command line arguments, this: arr = [1,2,3,4,5,6] promise.map(arr, function(i) { return execfile("node", [ script, 1 ]) }).then( function (array_of_all_s

security - PHP 7.0.8 missing Curl constant -

i installed php 7.0.8 version here: http://rpms.remirepo.net/wizard/ from phpinfo: php version 7.0.8 then installed latest version curl, show in phpinfo: curl information 7.49.1 this page shows new curl option has been added 7.0.7: i.e. curlopt_pinnedpublickey http://php.net/manual/en/function.curl-setopt.php but when run code echo curlopt_pinnedpublickey its return string, not integer.... or using in curl: curl_setopt($ch, curlopt_pinnedpublickey, "sha256//teyzgg/8dvpuksaescb3tsvlehby6w9q63txhoif0tg="); it doesn't work either... ===== edit: add php info and here phpinfo: https://www.dropbox.com/s/9xdmx9i67rabcql/phpinfo%28%29.html?dl=0

python - Anaconda on Ubuntu - Error in permission to update using conda command -

on laptop on windows 8.1 have vmware , ubuntu 16.4 installed. i installed anaconda 2.7 (x64) on it. directory anaconda installed, is: /home/anaconda2/ when tried use following command update packages, got errors mentioned below: conda update --all error error: missing write permissions in: /home/anaconda2 i tried use sudo , tried writing following permission under visudo madhu all=(all:all) nothing worked.... can please me? what this.... sudo chown -r madhu /home/anaconda2/

If I overload equals should I still override haschode in java? -

i know should override hascode everytime override equals overloading? should still override hashcode? side note: before posting question i've read should avoid overloading equals in first place i'd still know should if i'd choose overload it. no hash-based collection ever use overloaded equals() method. it's method, , decide should do. contract entirely yours. but i'll repeat said in question: shouldn't overload equals() in first place. if do, should @ least make consistent actual equals(object) method avoid confusions. , since should consistent equals(), means need override equals(object), , override hashcode().

android - Validate IBAN using org.apache.commons.validator -

in android project have edittext user can insert iban i validate iban this, using org.apache.commons.validator ibancheckdigit ibancheckdigit = new ibancheckdigit(); boolean validiban = ibancheckdigit.isvalid(textiban.gettext().tostring()); but 'isvalid" returns true when write things "jjjhh" or "asdasd" there better way validate iban ? ibancheckdigit not check format of iban number, check digits. iban length, structure, etc. you. alternative, use iban4j validates structure, length, etc. too.

java - How find a certain process using JNA? -

i´m working on java program. has run app administrator and, when execution ends, things. in beginning, used string cmd[] = new string [3]; cmd [0] = "cmd"; cmd [1] = "/c"; cmd [2] = "runas /user:..." process p = runtime.getruntime().exec(cmd); but problem cannot enter password (i tried it, didn´t find solution). after, used jna make it, this: boolean createprocesswithlogonw (wstring lpusername, wstring lpdomain, wstring lppassword, int dwlogonflags, wstring lpapplicationname, wstring lpcommandline, int dwcreationflags, pointer lpenvironment, wstring lpcurrentdirectory, startupinfo lpstartupinfo, process_information lpprocessinfo); here, problem how make wait execution of program until process ends (maybe, in jna, there forms this, big , don´t know how it...) i thought way it, don´t know if it´s possible... this: kernel32 kernel32 = (kernel32) native.loadlibrary(kernel32.class, w32apiopt

python - Pygame not checking keyevents after another happens -

i moving sprite on x-axis. moving left , right. when press both left , right @ same time stop moving properly. i trying make when user presses both keys , lets go of one, continue moving in direction still pressed. weirdly works while holding right , letting go of left. continues moving right. when hold left , tap right stops moving until press right again. i commented out ideas had make work, failed me. i sure simple fix or logic failure on part. i have worked couple hours on this. thanks responses ahead of time. import pygame import time import random import sys import math pygame.init() displaywidth = 1200 displayheight = 800 white = (255,255,255) black = (0,0,0) gamedisplay = pygame.display.set_mode((displaywidth, displayheight)) pygame.display.set_caption('game 3') clock = pygame.time.clock() class firstsquare: def __init__(self,player_x,player_y): self.x = player_x self.y = player_y self.width = 100 self.heigh

r - Using Multiple scale_fill_manual in ggplot2 -

assuming have data frame such: date <- seq(as.date("1990-03-01"), = 'quarters', length.out=100) date<- as.yearqtr(date, format="%y-%m-%d") <- runif(100, 500, 2000) b <- runif(100, 200, 1000) c <- runif(100, 1000, 5000) df <- data.frame(date, a, b, c) i create heatmap using ggplot2 apply different conditional discrete colour scale each variable , b based on percentile of each of value. i.e. values below 25th percentile > red, values between 25th 50th percentile > orange, values between 50th 75th percentile > yellow, values between 75th 100th percentile > green. i create heatmap on ggplot geom_tiles using melt function , making x=date , y=variable, fill=value. however, take value of variables 1 vector , give 25th percentile based on combined values. there way separately condition scale_fill_manual based on percentiles of individual variables a, b, c. in case need apply multiple scale_fill_manual functions. alternativel

java - Understanding high system CPU usage on web server on Windows -

note have couple of close votes post. not sure why since no 1 has commented question how our custom written java server , calls socket reads can interact windows os , produce high system cpu usage, therefore believe correct forum post question rather sysadmin area. i have custom java server serving tcp connections of couple of different types (some web, raw) , 1 of our customers having issues occasional periods of high cpu + high system cpu. we may have reproduced on our test server running on windows server 2008 on vmware. during failover 1 server or during other network events cause number of clients (40-80) re-establish connections simultaneously see high cpu usage including high system cpu (>50% average spikes of on 70%). these clients typically maintain tcp sockets server during failover see perhaps 80-160 sockets being reconnected , serviced. we have used kernrate profile during 1 of these periods , having hard time understanding results. kernrate reports low i

c# - I want to delete an image on longpress on the image in canvas -

i have use given below code display image on canvas , want delete displayed image on long press on image. try contextmenu not works. please tell me how can or used contextmenu it private void stickers1_selectionchanged(object sender, selectionchangedeventargs e) { var selecteditem = e.addeditems[0] stickersimagelistmodel; stickers1.visibility = visibility.collapsed; // taking image list stickersimagelistmodel of images , bind imageitem varaible image imageitem = new image(); bitmapimage image = new bitmapimage(new system.uri(selecteditem.imageurl, urikind.absolute)); imageitem.source = image; //add images on canvas my_canvas.children.add(imageitem); imageitem.allowdrop = true; // drag , drop images on canvas imageitem.manipulationmode = manipulationmodes.all; imageitem.manipulationdelta += drag_manipulationdelta; compositetransform ct = new compositetransform(); imageitem.rendertra

android - How to suppress talkback programatically? -

is there way make talkback suppress when open application , resume when stop application? while typically cannot toggle talkback app, possible if user grants app "write secure settings" system permission adb, since can directly modify flags indicate system accessibility services enabled. see answer of similar question full details: https://stackoverflow.com/a/44461236/494879

c# - Entity Framework Linq set property of an object without additional projection by SELECT -

i'm implementing inheritance scenario entity framework 6. inheritance exists on dto level, i.e. have 2 classes foo , bar : foo , have first method selects iqueryable<foo> , several methods select additional properties specific inheriting classes bar. normally, have code from foo in selectfoo() join baradditionalprops in ..... select new bar{ id = foo.id, description = foo.description, baz = baradditionalprops.baz} which give nice single sql query result. this, unfortunately, means properties foo have copied during second projection (first 1 inside selectfoo ). in real life code mean 20+ properties copied in every method using selectfoo . i (code prepared in linqpad, assume this == efcontext): void main() { (from barbase in selectt<bar>() join field in this.fields on barbase.id equals field.productid let _1 = barbase.baz = field.baz // part fails exception // expression tree

javascript - CSS Styling fill space left in the left of the element and the right of the element -

imagine element, centered in container, has width, don't know exact width, text , want left space , right space same , colored, this: ----------------- test ----------------- #left { background-color: red; } #middle { width: 200px; /* might different */ } #right { background-color: red; } <div id="left"></div> <div id="middle"></div> <div id="right"></div> .container{ display:flex; } .main-body{ flex:1 1 auto; } #left{ background-color: red; } #middle{ width: 200px; text-align:center; } #right{ background-color: red; } <div class="container"> <div class="main-body" id="left"></div> <div id="middle">hello</div> <div class="main-body" id="right"></div> </div>

Jquery checkbox checked after clicking one checkbox -

i have 1 table.inside table have 2 <td> .first <td> has 1 checkbox , second <td> has sections contains checkboxes.onclick of checkbox of first <td> ,it should check checkboxes of other <td> .this code using datatable. for (var = 0; < tmpcolumns.length; i++) { var obj = new object(); var table = ""; obj.title = tmpcolumns[i].touppercase(); obj.data = tmpcolumns[i]; obj.defaultcontent = ""; columns.push(obj); if(type == "table" && == 0) { obj.render = function (data, type, row, meta) { table = row.name; select = '<section> <label class="checkbox" style="padding-left: 1em;"><input type="checkbox" id = "checkall" " data-table-name="' + table + '">' + table + ' <i></i><

ruby - Rails possible function arguments -

i'm quite new rails , want improve workflow. i'd know can possible function parameters general rails functions. e.g: i want use render function. arguments can pass it? in order answer question went api.rubyonrails.org . tells me function signature: render(*args, &block) and don't more before. to more information read through ruby on rails guide layouts , rendering (which great). if found looking it's not acceptable way possible options. i'm searching more concise. how know can pass in things :partial or :layout function? looking through actual source code option. that's not handy. this render function example. occurred me in several places wanted use function , couldn't find documentation of capable of doing. you can pass partial name want render argument follows : <%= render :partial => 'partial_name' %> or can pass params follows : <%= render :partial => 'users', :collection => @u

javascript - Clear previous data before request -

i've got html-template loads data controller's array , keeps them in table. have directive, makes transclusion table rows. data array being filled on api-requests. after new requests i've got request results merged in table. 1 set of rows being added each request instead of clearing previous results. i've debugged on controller code check state of array , it's being cleared before each request. that's sure. new results added previous. think reason might in template of transclusion directive. the template looks like: <div class="row"> <div class="col-md-12"> <div id="results" ng-show="results.length > 0"> <table class="table result-table"> <thead> <tr> <th>1</th> <th>2</th> <th>3</th>

mysql - how to query record with multiple condition using yii framework -

i want results satisfy (age=20, name=jim) or (age=30, name=allen) or (age=40, name=sam), how write query code yii? if use yii 1: $criteria = new cdbcriteria(); $criteria->addcondition('age = :age1 , name = :name1', 'or'); $criteria->addcondition('age = :age2 , name = :name2', 'or'); $criteria->addcondition('age = :age3 , name = :name3', 'or'); $criteria->params = [ ':age1' => 20, ':age2' => 30, ':age3' => 40, ':name1' => 'jim', ':name2' => 'allen', ':name3' => 'sam', ]; $result = yourmodelname::model()->findall($criteria);

javascript - Modify Google autocomplete predictions with my predictions -

i working on gmaps project , using gmaps javascript apiv3. have included gmaps search box gives predictions calling autocomplete service. predictions fetches service ok, in addition want show prediction database well. i have created: var input = document.getelementbyid('pac-input'); var searchbox = new google.maps.places.searchbox(input); map.controls[google.maps.controlposition.top_left].push(input); searchbox gives predictions expected. instead of default predictions given autocompleteservice, want add predictions well. i cannot find tutorials/guides in internet , other questions question, maybe not possible because prediction on autocomplete based on places library . you can check in introduction part of autocomplete . autocomplete feature of places library in google maps javascript api. can use autocomplete give applications type-ahead-search behavior of google maps search field. when user starts typing address, autocomplete fill in rest.

postgresql - How to create nested comment and reply tree with a common table expression -

Image
i thought had solved this, alas haven't. i looking postgresql pump out comments , replies in order can rendered client side no additional sort. i have following common table expression have tried multiple things have yet output need. with recursive comment_tree ( select id cte_id, reply_to cte_reply_to, "createdat" cte_date, body cte_body, commenter_id cte_commenter_id, 1 level, array[0] sort, article_id "comments" reply_to null union select c.id, c.reply_to, c."createdat", c.body, c.commenter_id, p.level + 1 level, p.sort || p.level, c.article_id "comments" c join comment_tree p on c.reply_to = p.cte_id) select sort, cte_body body, cte_id id, cte_reply_to reply_to, cte_date "createdat", cte_commenter_id commenter_id, level comment_

angularjs - Angular.js Function not loading in directive -

i creating directive in angular , trying understand why function link not loading, if insert console.log('i working'); before function link able see message in console. but if insert console log inside link function not load in page, ideas happenning? why cannot console.log message in function link? angular.module('components').directive('slider', [ 'jquery', function slider($) { 'use strict'; var scope = {}; console.log('i working'); function link($scope, $element) { console.log('function link loading'); $('.slider').slick({ centermode: false, infinite: false, centerpadding: '2px', slidestoshow: 6, speed: 200, index: 2, variablewidth: true, responsive: [{ breakpoint: 768, settings: { arrows: false, centermode: true, centerpadding: '40px', slidestoshow: 3 } }, { breakpoint: 480, settings: {

python - Merge a lot of df using pandas -

i have big df , use 'chunksize' divide it. after that use loop go through interval of df , next loop condition , next want merge of df. try 'concat(df)' return error. method 'join' not convenient because have 400 df. how can concatenate this? code el = pd.read_csv('df2.csv', iterator=true, chunksize=100000) buys = pd.read_excel('smartphone.xlsx') buys['date'] = pd.to_datetime(buys['date']) dates1 = buys['date'] ids1 = buys['id'] in el: i['used_at'] = pd.to_datetime(i['used_at']) df = i.sort_values(['id', 'used_at']) dates = df['used_at'] ids = df['id'] urls = df['url'] i, (id, date, url, id1, date1) in enumerate(zip(ids, dates, urls, ids1, dates1)): df1 = df[(df['id'] == ids1[i]) & (df['used_at'] < (dates1[i] + dateutil.relativedelta.relativedelta(days=5)).replace(hour=0, minute=0, second=0)) & (df['used_at'] >

Chain together methods in Python as in Ruby -

in ruby, 1 can chain methods so: a = [2,3,1] b = a.sort.reverse which sets value of variable b [3,2,1] while leaving a same. i'd perform similar operations in python. far, shortest way have found is: import copy = [2,3,1] b = copy.copy(a) b.sort() b.reverse() that is, 5 lines of code instead of 2. there no simpler way? clarification: original answer found below. commented, question on chaining in general , not in specific case. clarification on can found @ end of answer. you can write down pretty directly. a = [2,3,1] b = sorted(a, reverse=true) even if want use methods, can rather straightforward well: a = [2,3,1] b = a.copy() # a[:] in python2 b.sort(reverse=true) python tends rather picky implicit cloning. copying references cheap, copying objects expensive. since many python types mutable, 1 can introduce subtle bugs when things cloned (or not) accident. thus, interfaces need explicitly clone things. chaining methods in python possibl