Posts

Showing posts from July, 2014

python - Applying a function to a column in SQL to create a new column -

i have function in python apply column of data in sql table from nltk import regexptokenizer import string def get_word_count(doc): tokenizer = regexptokenizer(r'\w+') doc_tokens = tokenizer.tokenize(doc) counted_words = {} word in doc_tokens: try: counted_words[word] = int(counted_words[word]) + 1 except keyerror: counted_words[word] = int(1) return counted_words pyrattle.eq.postgres.models import * session = session() q = session.query(rawdocument) in q: get_word_count(i) new_ob = ten_q() new_ob.tf_dict_phrases = my_tf_dict session.add(new_ob) session.commit() i plan use sqlalchemy perform this, not know how go it.

python - Directional Many-to-many self referencing ORM in SQLAlchemy using Association Pattern -

i tried quite while , didn't find solution specific problem, apologize in advance. suppose have following model tables users , follows: ________ src ________ | user |-1------------*-| follow | |--------| |--------| | id | | src_id | | | | dst_id | | | | string | |________|-1------------*-|________| dst notice that there different semantics depending on foreign keys. i'm trying achieve through "association pattern" ( described here ), can work. looks this: class follow(base): __tablename__ = 'follows' # src_id = column(biginteger, foreignkey('users.id'), primary_key=true) dst_id = column(biginteger, foreignkey('users.id'), primary_key=true) src = relationship("user", back_populates="followers", foreign_keys=[src_id]) dst = relationship("u

WinZip Command Line File Release -

i'm using wzunzip.exe unzip file in batch mode, not release zip file after it's done, causing program hang or not run next scheduled time. there "exit" or "quit" commands can insert after main command? in nutshell: grab zip file ftp, extract content correct folder, delete zip file. daily. appears me winzip keeps hold on file after it's done. can do. here code, simple that: rem *** run ftp-import routine c:\windows\system32\ftp.exe -s:c:\ftp_temp\ftpimport.txt rem *** unzip cd c:\program files\winzip wzunzip -o c:\ftp_temp\myarchive.zip k:\mypath\myfiles rem *** delete downloaded zip cd c:\ftp_temp del c:\ftp_temp\myarchive.zip

javascript - Jquery element with dot in tag name -

jquery when tag string contains dot. when hard coded, query expected value, if tag obtained function , concatenated, query fails. var tagwithdot = gettag(...) // tagwithdot === 'tag.withdot' console.log(tagwithdot === 'tag.withdot') // true console.log('#' + tagwithdot === '#tag.withdot') // true console.log('#' + tagwithdot.replace('.', '\\.') === '#tag\\.withdot') // true console.log($('#' + tagwithdot.replace('.', '\\.')) === $('#tag\\.withdot')) // false console.log($(('#' + tagwithdot.replace('.', '\\.'))) === $('#tag\\.withdot')) // false instead of replacing manually . \\. stuff use jquery's escapeselector var tagwithdot = "#tag.withdot"; console.log( $.escapeselector(tagwithdot) ); <script src="//code.jquery.com/jquery-3.1.0.js"></script>

python - KeyError in Pandas when passing concatenated string as key -

i have dataframe 'df' has column 'call_id' 1 of values '888'. have following variables: c = 'call_id' v = '888' q = 'df[c] == v' df[df[c] == v] working fine. however, df[q] giving me key error. suggestions ? df[q] looking column named 'df[c] == v' . not equivalent df[c] == v , since first thing string , second thing python expression.

matrix - How can I save multi variable results in a data structure using Pari? -

i have function loops on input , produces 0 or more results, each result consisting of 3 numbers. want keep results in data structure (e.g., matrix or vector of vectors) don't know how many entries there until loop terminates. need able extract column of results (e.g.the first variable of each entry) easily. first off, please @ pari/gp reference vectors/matrices stuff: https://pari.math.u-bordeaux.fr/dochtml/html-stable/vectors__matrices__linear_algebra_and_sets.html . you can use matrix in loop follows: entries = mat(); for(i = 1, 1000, { your_entry = [i, i+1, i+2]; entries = matconcat([entries; mat(your_entry)]); }); print(matsize(entries)) gp> [1000, 3] print(entries[,1]) \\ fetch 1st column hope, helps.

javascript - setTimeout and recursive IFFEs, nested!? How to calculate the delay. -

this problem has reminded me regarding js skills... :( i feel i'm right on cusp i'm struggling understand conceptually , it's not syntax issue feel cracked it. what need i'm trying console.log series of strings, 1 letter @ time. there needs delay between each letter outputted, 300ms. there must delay between each string outputted, 2000ms. there 2 strings in example array, solution must support dynamic number of strings. my current code (can pasted console) var stringlist = ['first test','second test'], stringlistlen = stringlist.length; for(var = 0; < stringlistlen; i++){ // begin first string , read it's length iterations var stringnumber = 0; var currentstring = stringlist[stringnumber]; var currentstringlen = currentstring.length; // see word clarification @ point in code console.log(currentstring); (function (i) { settimeout(function () {

c# - IsMouseOver and DragLeave not working properly -

i have grid/panel on ui can take drop action. control grid dynamically created content in (a viewbox containing stack panel of borders if matters). when drag relevant information grid want change (regenerate) internal content , when drops or leaves should go normal. have 'change it' , 'put back' methods working fine, i'm having trouble determining when call them. i have drag enter , drag leave events on grid. enter works great, leave not. mouse gets on top of content inside of grid fires drag leave event, changes content (and if puts out of child content fires drag enter again , flashes). my first thought determine if mouse still on grid , ditch out without putting content back. doesn't seem working. here code drag leave: private void grid_dragleave(object sender, drageventargs e) { var wizard = datacontext wizardvm; var gd = sender grid; if (wizard == null || gd == null || gd.ismouseover || gd.

vuejs2 - Using v-model with a prop on VUE.JS -

i'm trying use data coming prop v-model, following code works, warning. <template> <div> <b-form-input v-model="value" @change="postpost()"></b-form-input> </div> </template> <script> import axios 'axios'; export default { props: { value: string }, methods: { postpost() { axios.put('/trajectory/inclination', { body: this.value }) .then(response => { }) .catch(e => { this.errors.push(e) }) } } } </script> the warning says: "avoid mutating prop directly since value overwritten whenever parent component re-renders. instead, use data or computed property based on prop's value. prop being mutated: "value" so changed , i'm usi

go - How do you print multiline exec output in golang -

i'm trying write simple golang program lists files in directory. whenever shell command yields multiple lines, registers in go array for example, when try following: import ( "log" "os/exec" "fmt" ) func main (){ out,err := exec.command("ls").output() if err != nil { log.fatal(err) } fmt.println(out) } i end output [101 108 105 109 115 116 97 116 115 46 105 109 108 10 101 110 118 10 115 99 114 97 116 99 104 10 115 114 99 10] i feel common thing wasn't able find on here anywhere. the return type of first value output []byte . fmt.println displaying numeric values of each slice element. to show desired result of output of command, can either convert byte slice string or use format string %s verb: fmt.println(string(out)) or: fmt.printf("%s\n", out)

html - Rendering newline in text for a div when working with Flask as the backend? -

this question has answer here: passing html template using flask/jinja2 3 answers i using flask backend , reading piece of text file contains newlines \n . wish render text inside div. so, replacing \n <br> , passing render_template() method. @app.route('/') @app.route('/index') def index(): content = read_file('filename.csv') content = content.replace('\\n','<br>') return render_tempate('index.html',text=content) however, doing shows br tag text. underlying html shows br tag being interpreted &lt;br&gt; <div>some text &lt;br&gt; more text</br> how can fix , render newline inside div? in index.html , change {{text}} tags {{text|safe}} . default, html strings escaped in render_template , , |safe needed turn off.

How to get rows with No values in SQL Server? -

i have table holds financial transactions data per account. **fintransmaster table:** ------------------------------------ |acctid |fintrnscode|businessday | ------------------------------------ |1234567 |intrst |2017-09-09 | ------------------------------------ |1234567 |charge |2017-09-08 | ------------------------------------ |1234567 |pymnt |2017-09-01 | ------------------------------------ |1234567 |intrst |2017-08-19 | ------------------------------------ |1234567 |intrst |2017-08-09 | ------------------------------------ |1234567 |charge |2017-08-04 | ------------------------------------ |1234567 |pymnt |2017-08-01 | ------------------------------------ |1234567 |intrst |2017-07-19 | ------------------------------------ i want select last time payment made on each account. so code follows: select acctid ,[fintranscode] --,max([businessday]) --tried line, doesn't work --,isnull(max([businessday

mysql - Is it different a SQL query inside of stored procedure than a SQL executed from PHP? -

let me explain. i used large select sentence multiple joins inside php code. it's big because joins depends on values first tables (something if table1.column_a=1 alias_b=table2.column_a, if table1.column_a=2 alias_b=table3.column_b, ...) , because send condition html form can changed dynamically (sometimes have some_date>='2017/09/01' , turn more complex some_date>='2017/09/01' , (name j%on not sec_name='doe' ) ..."). i received instruction of make stored procedure query , more time take analyze can't find way make query dynamic without putting inside of string stored procedure , receiving condition stored procedure parametter (in stored procedure have somthing set @sql = concat('select ... join ... join... ',param_condition); prepare stmt @sql;..." ) my question is... same sending sql php? yes, preparing , executing statement stored procedure pretty same sending query php. difference whether work of conca

xml - Xamarin Microcharts extension namespace not recognised -

i building app in xamarin forms. trying simple chart element appear on page when loaded. i have installed microcharts.forms v0.6.2 package aloïs deniel use in xamarin forms application. when add line <forms:chartview x:name="chart1"/> litechartpage.xaml file, on compile error. 'forms' undeclared prefix. line 8, position 6. i have using microcharts; in litechartpage.xaml.cs file. here xaml code <?xml version="1.0" encoding="utf-8" ?> <contentpage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:app1" xmlns:chart="clr-namespace:microcharts.forms;assembly=microcharts.forms" x:class="app1.litechartpage"> <forms:chartview x:name="chart1"/> </contentpage> here litechartpage.xaml.cs code: using system; u

android - using custom view "SignatureView" to capture user signature -

im trying have signatureview capture user's signature after fill form, codes not making draw. found drawing codes on youtube , tried them not draw anything, although scroll lock working. following code the xml signatureview <signatureview android:background="#ffffff" android:layout_width="match_parent" android:layout_height="400dp" android:id="@+id/signatureview"/> the code signatureview enable drawing public class signatureview extends view { public static int brush_size = 5; public static final int default_color = color.black; public static final int defaul_bg_color = color.white; private static final float touch_tolerance = 4; private float mx, my; private path mpath; private paint mpaint; private arraylist<fingerpath> paths = new arraylist<>(); private int currentcolor; private int backgroundcolor = defaul_bg_color; private int strokewidth; private bitmap mbitm

java - How to test nested Object in with Spring MockMVC? -

i have controller post method test. method post book reader's reading list. grab authenticated user reader. book class has field reader type. following code uses contains(samepropertyvaluesas(expectedbook)) , reader instance location different expectedreader created obviously. what correct way test such nested object in mockmvc? @test @withuserdetails("z") public void addbookshouldshowthebookinreadinglist() throws exception { final string booktitle = "book a"; final string bookauthor = "jk"; final string isbn = "1234567890"; final string description = "yet book."; mockmvc.perform(post("/readinglist") .contenttype(mediatype.application_form_urlencoded) .param("title", booktitle) .param("author", bookauthor) .param("isbn", isbn) .param("description", description) .with(csrf()))

On Ruby's Thor, How to show the command usage from within the application -

i'm building cli using ruby , thor , print on screen command usage if no option passed. something on line of pseudo code bellow: class test < thor desc 'test', 'test' options :run_command def run_command if options.empty? # print usage end end end im using following hack (and i'm not proud of it! =p): class test < thor desc 'test', 'test' options :run_command def run_command if options.empty? puts `my_test_command run_command` end end end what proper way this? you can use command_help display information command: require 'thor' class test < thor desc 'run_command --from=from', 'test usage help' option :from def run_command unless options[:from] test.command_help(thor::base.shell.new, 'run_command') return end puts "called command #{options[:from]}" end end test.start and running no options

theano cuda - mod.cu(66): error: identifier "cudnnSetFilterNdDescriptor_v4" is undefined -

Image
when compile python produce written theano in linux.i got compile error in picture.all path set well.this error appeared no operation. i've seen such error when running theano 0.9 cuda 8 , cudnn 6. error fixed if using cudnn 5.15 instead.

winapi - How to detect mouse click multiple times using Visual C++? -

i have started working win32 api. trying create simple window application writes hello world when run it. want catch clicks , give same 'hello world' text window once again(not going delete first one.) different -random if possible- font/color. got show first 'hello world' , got catch first click , show 'hello world' second time. couldn't manage other clicks. how can solve this? here got far: case wm_lbuttondown: { hdc = getdc(hwnd); hfont hfont, holdfont; hfont = (hfont)getstockobject(ansi_var_font); if (holdfont = (hfont)selectobject(hdc, hfont)) { textout(hdc, 10, 50, text("hello world"), strlen("hello world")); selectobject(hdc, holdfont); } textscreen(hwnd, i); endpaint(hwnd, &ps); releasedc(hwnd, hdc); }

angular - Building an Ionic App with offline support that will eventually be used as desktop application -

a friend's company needs app workers in field spend lot of time offline , on ipad's filling out reports have basic intelligence (applying prices, looking previous settings, etc) first reaction tell him make ionic app. the twist company wants to, on time, add usability whatever app make other office work total in-house solution office/paperwork needs , more traditional web app accessed type of device without real need offline support other aspects. reading ionic's desktop compatibility (like here ) made me feel better can't wonder if better in long run make progressive web app (probably angular). does have experience in similar project? or wrong in considering using ionic this? or should use phonegap or different option? thanks , input!

javascript - What are registry and defined under require.s.contexts._? -

what require.s.contexts._.defined , require.s.contexts._.registry ? are modules in registry object defined ? require.s.contexts contains private data regarding contexts requirejs knows about. default context if not use context configuration option called _ require.s.contexts._ contains private data regarding default context. the registry field of context data contains map hold module information temporarily . module in map after has been requested until has been loaded. the defined field contains map of modules defined in context. conceivably access directly there's no clear reason since require.defined(id) tell whether module named id defined in context require belongs. (different contexts different instances of require require function knows context originated from.)

Using Android TextWatcher with multiple user input values and Update thses values -

i new android. try develop android application total amount of user input items. here sketch of application. enter image description here user must enter first row col1 , col 2. first row col3 can enter or not. in sub 1 textview total value of first row should display. value should display in result textview. likewise if user inserts data second row, values must enter under col1 , col2. if user likes, can enter value under col 3. second row total value should display in sub 2 textview. if user enter values second row, result textview should automatically update total value of sub 1 , sub 2 textviews. try follows, cannot find correct way this. please if helps me solve this, thankful. java class public class addtwo extends appcompatactivity { edittext edit1, edit2, edit3; edittext edit4, edit5, edit6; textview textviewsub1, textviewsub2, textviewresult; /** * called when activity first created. */ @override public void oncreate(bundle icicle)

ios - Filter array objects by have a property or not in Objective-C -

i have array, objects has property "settings". i want objects doesn't contains settings.settinga. are there anyway without using loop? edit: i have array of profile objects. profile object has many properties, 1 of them is: @property (nonatomic) profilesettings *settings; profilesettings object has property: @property (nonatomic) nsstring *settinga; @property (nonatomic) nsstring *settingb; @property (nonatomic) nsstring *settingc; each profile can has profilesettings (not all) settings. are there anyway without using loop? yes. your statement suggests know how test individual object determine whether wish include or exclude it, not wish write test in loop. so: use filterarrayusingpredicate: process array whole; use predicatewithblock: create predicate block; and write logic test object in block. block passed object array , must return bool indicating whether keep include ( yes ) or not in result. hth

office365 - How to mention user in microsoft teams? -

i using webhook url post messages teams in microsoft teams. want able mention users when send { "text": "hello world @user1"} i plain text hello world @user1 . i looking way mention user.

swift - iOS FB app invite without dialog -

i noticed instagram gives list of facebook friends invite button next each one. when click it, user notified on facebook i'm requesting join instagram. as far aware, thought way app requests dialog. how instagram then?

c++ - Compilation error: "stddef.h: No such file or directory" -

whenever try compile code ends error: in file included /usr/include/wchar.h:6:0, /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/cwchar:44, /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/bits/postypes.h:40, /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/iosfwd:40, /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/ios:38, /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/ostream:38, /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/iostream:39, test.cpp:1: /usr/include/sys/reent.h:14:20: fatal error: stddef.h: no such file or directory #include <stddef.h> ^ compilation terminated. the code trying compile is: #include <iostream> using namespace std; int main() { cout << "hello world! :d"; return 0; } the error because gcc-core package , gcc-g++ not of same version. either downgrade 1 of them solve problem or update both librari

PHP - How to SCP local file from BASH OSX to remote via SSH with Password in PHP? -

i want php send myfile.txt remote ssh uses password login. from osx bash use command send file manually: scp /users/myname/documents/myfile.txt root@192.168.1.116:/docs/myfile.txt since need via php, made upload.sh bash script: #!/usr/bin/expect spawn scp /users/myname/documents/myfile.txt root@192.168.1.116:/docs/myfile.txt expect "root@192.168.1.116's password:" send "mypassword\r" interact i can run above code with: ./update.sh in terminal , sends file want. now problem when add bash script in php, dont send file. i have tried: exec('/library/webserver/update.sh 2>&1', $output); print_r($output); and stuck @ error/msg: array ( [0] => spawn scp /users/myname/documents/myfile.txt root@192.168.1.116:/docs/myfile.txt [1] => root@192.168.1.116's password: ) in bash password sent , ok, via php dont uploads file. noticed first time run via php said ssh host keys dont match, copied .ssh folder server root

php forms return data back to .html page -

this should pretty simple questions can't seam find simple answer. of questions find deal same jquery. i have php page accepts post data, places in array, passes array api, , receives success/error api. i have html page form. when submit form passes form data php file. all return success/error message's variable html file. don't care if page reloads, don't want fancy features i'm trying simple test have forgotten php 101. or direction references appreciated. html: <div style="width: 400px; margin: 150px auto;"> <form action="api3.php" method="post"> <input type="text" placeholder="first name" name="fname"><br><br> <input type="text" placeholder="last name" name="lname"><br><br> <input type="email" placeholder="email" name="email"><br><br>

javascript - Uncaught ReferenceError: $this is not defined ajax -

Image
i'm new in javascript , ajax. want make dynamic select option list this. but there error when try compile using google chrome developer (press f12). here script : <div class="container"> <div class="row"> <div class="col-md-offset-3 col-lg-6"> <h1 class="text-center">ajax & codeigniter select box dependent</h1> <div class="form-group"> <label for="country">country</label> <select class="form-control" name="country" id="country"> <option value="">select country</option> <?php foreach ($countries $country) : ?> <option value="<?php echo $country->country_id; ?>"><?php echo $country->country_name; ?&g

php - i do not get any error running website on mamp but nothing is displayed -

i using mamp free version on windows10 using default ports (80, 80, 3306). working directory "dynamicwebsites.com" inside mamp/htdocs sub-directory. have "includes" sub-directory "header.php" , "footer.php" files. calling header.php , footer.php in index.php (which in root folder i.e. inside "dynamicwebsites.com) i have 3 statements in index.php file <?php echo"index.php dynamicwebsite.com"; <?php include('includes/header.php'); ?> <?php include('includes/footer.php'); ?> the above code displays message. however, if place echo function between 2 include functions nothing displayed. have tried moving "header.php" , "footer.php" root folder , use <?php include('header.php');?> statement, result same. message displayed echo function means php working. never had problem using mamp when installed wordpress locally. however, facing problems running php scripts

xaml - How to add Entry Control inside Grid View in Xamarin Forms? -

Image
i facing problem add entry inside grid view control. have list view have data checkbox , entry. if user selects item, can add quantity of item in entry. facing issue adding entry in grid view. entry displayed half. text not displayed correctly. adding entry in xaml as. <stacklayout> <label text="items"></label> <listview x:name="itemslistview" rowheight="60"> <listview.itemtemplate> <datatemplate> <viewcell> <viewcell.view> <grid padding="5,0" rowspacing="1" columnspacing="1" > <grid.rowdefinitions> <rowdefinition height="*"/> </grid.rowdefinitions>

python - multi-indexing pandas dataframe -

i wondering how multiple indexes dataframe based on list groups elements column. since better show example, here script displays have, , want: def ungroup_column(df, column, split_column = none): ''' # summary takes dataframe column contains lists , spreads items in list on many rows similar pandas.melt(), acts on lists within column # example input datframe: farm_id animals 0 1 [pig, sheep, dog] 1 2 [duck] 2 3 [pig, horse] 3 4 [sheep, horse] output dataframe: farm_id animals 0 1 pig 0 1 sheep 0 1 dog 1 2 duck 2 3 pig 2 3 horse 3 4 sheep 3 4 horse # arguments df: (pandas.dataframe) dataframe act upon column: (string

Install a component again during repair by WIX installer -

i want write on registry when install product. could've done inside component. <component win64='$(var.win64)' id='registrysetup' guid='840d9dc3-3f98-4597-a089-d649ec3e7feb' directory='targetdir'> <registrykey root="hklm" key='[utillregkey]' forcecreateoninstall='yes' forcedeleteonuninstall='yes' > <permission user="everyone" genericall="yes" /> </registrykey> </component> [utillregkey] generated custom action, value differ each time runs. now need run installer change mode, , works. when run on change mode need run above compnent again make registry key. is there way that? edit: what meant "run on change mode" is, if installer runs second time "maintenancetypedlg" opened. , has 3 buttons "change", "repair" & "remove". (i customizing wixui_mondo ) i changed dialog use chang

php - Confused about echo "{$a[0]['download']}" -

i accidentally tested today, can explain me why works , is? $a = array( array( 'download' => '1500k' ) ); echo "test-{$a[0]['download']}"; output : test-1500k double quotes evaluate string expression , extract variable , put value instead. single quote show string as is . if want more detail can see this answer in so.

java - what is the replacement of getJdbcTemplate() in spring.jdbc 4.2.5 i m using spring-4.2.5,spring-jdbc.4.2.5.mvn3 -

@override public page<keyclient> getkeyclients(keyclient searchclient, list<integer> selectedclients, boolean isexclude, int pageno, int pagesize) throws dataaccessexception { stringbuffer query = new stringbuffer(get_client_list); stringbuffer query1 = new stringbuffer(get_client_list_count); /*stringbuffer query2 = new stringbuffer(get_client_list1); stringbuffer query3 = new stringbuffer(get_client_list_count1);*/ /*map<string, object> params = new hashmap<string, object>(); params = buildqueryforclients(searchclient, selectedclients, isexclude, query);*/ object[] params = buildqueryforclients(searchclient, selectedclients, isexclude, query, query1); paginationhelper<keyclient> ph = new paginationhelper<keyclient>(); return ph.fetchpage(getjdbctemplate(), query1.tostring(), query.tostring(), params, pa

python - make ndarray containg string and int -

how make ndarray reading csv file like 12,employed,32,happy,1 21,unemployed,31,poor,0 34,rich,45,unhapppy,0 note: file can large output array: [[12,"employed",32,"happy",1] [21,"unemployed",31,"poor",0] [34,"rich",45,"unhapppy",0]] while reading csv file using np.genfromtxt(filename,delimiter = ",",dtype = none) make 1-d array of tuples , dtype = int make strings nan use read_csv first , dataframe.values convert numpy array : import pandas pd df = pd.read_csv('file', header=none) print(df) 0 1 2 3 4 0 12 employed 32 happy 1 1 21 unemployed 31 poor 0 2 34 rich 45 unhapppy 0 arr = df.values print(arr) [[12 'employed' 32 'happy' 1] [21 'unemployed' 31 'poor' 0] [34 'rich' 45 'unhapppy' 0]]

ember.js - torii facebook ember get user and name -

hi want name , email facebook authentication via torii , simple-auth, don't know how recovery data. can login via facebook can't name or email. could helpme please this code: //import base 'ember-simple-auth/authenticators/base'; import ember 'ember'; import toriiauthenticator 'ember-simple-auth/authenticators/torii'; export default toriiauthenticator.extend({ torii: ember.inject.service() }); this component login-form import ember 'ember'; export default ember.component.extend({ actions:{ facebooklogin(){ this.get('session').authenticate('authenticator:torii', 'facebook-oauth2').then((data)=>{ alert("logueado" + data); }); } } }); and torii-provider // app/torii-providers/facebook.js import facebookoauth2provider 'torii/providers/facebook-oauth2'; export default facebookoauth2provider.extend({ fetch(data) { return data; } }

c++ - Case insensitive gnu make compilation -

i encountered problem of project compilations under linux. make command swarms: in file included hellfire.h:18:0, creatures.cpp:2: daemons.h:7:41: fatal error: coolblackdaemon.h: no such file or directory #include "coolblackdaemon.h" but ls says coolblackdaemon.h there is. so, there such way make gnu make compilation case insensitive? may there magical key, or few magical words makefile, knows?

bash - How to set a property of a json file and replace in one command using jq -

this question has answer here: how update single value in json document using jq? 1 answer how update single value in json document using jq? doesn't have answer question. read json file. update value. replace file. expecting one inline command using jq assume have following json file. { "name": "app", "value": "one", ... } i want update value field "two". resulting json file should like { "name": "app", "value": "two", ... } what simplest bash command , windows bat command this. here demonstration of solution uses sponge bash-3.2$ cat data.json { "name": "app", "value": "one" } bash-3.2$ jq -m '.value="two"' < data.json | sponge data.json bash-3.2$ cat data.jso

Organising/Establishing own Cloud Server -

i have been reading cloud computing many days , have got of concepts. looking forward perform experiments , create cool projects , wish create own cloud space, in without taking of aws, azure, rackspce, etc. want create myself totally. how can achieve this?

python - First name of Pandas column with sorted list -

suppose have following dataframe: df = pd.dataframe({'ab': [['ab', 'ef', 'bd'], ['abc', 'efg', 'cd'], ['bd', 'aaaa']], 'cd': [['xy', 'gh'], ['trs', 'abc'], ['ab', 'bcd', 'efg']], 'ef': [['uxyz', 'abc'], ['peter', 'adam'], ['ab', 'zz', 'bd']]}) df ab cd ef 0 [ab, ef, bd] [xy, gh] [uxyz, abc] 1 [abc, efg, cd] [trs, abc] [peter, adam] 2 [bd, aaaa] [ab, bcd, efg] [ab, zz, bd] i want extract column contains sorted list. in case cd , since ['ab','bcd','efg'] sorted in ascending order. guaranteed no list empty , contain @ least 2 elements. stuck @ how combine applymap , sort function using pandas ? tried come solution here couldn't figure out way c

python - Return values from a list where difference != 2 -

i have list e.g. my_list = [1, 3, 5, 7, 14, 16, 18, 22, 28, 30, 32, 41, 43] i want function return values list difference between value , previous value not equal 2 , e.g. function return [1, 14, 22, 28, 41] above list. note first value of my_list appear first value of output. input lists of non-zero length , order of 100's. so far have this: def get_output(array): start = [array[0]] in range(1, len(array)-1): if (array[i] - array[i-1]) != 2: start.append(array[i]) return start is there vectorised solution faster, bearing in mind applying function thousands of input arrays? to avoid using inefficient np.concat , use np.ediff1 instead of np.diff , takes to_begin argument pre-pend result: >>> my_list = [1, 3, 5, 7, 14, 16, 18, 22, 28, 30, 32, 41, 43] >>> arr = np.array(my_list) >>> np.ediff1d(arr, to_begin=0) array([0, 2, 2, 2, 7, 2, 2, 4, 6, 2, 2, 9, 2]) so now, using boolean-indexing: >

javascript - Jquery - Javascipt, checked checkbox by value which is the value is part of array -

i have lot of checkbox have value this <input name="selection[]" value="2282,2283,2284,2285,2286,2287,2288,2289,2290,2298,2299,2300" type="checkbox"> <input name="selection[]" value="1429,1432,1450,1451,1462,1469" type="checkbox"> <input name="selection[]" value="667,669,679,683,685,686,687" type="checkbox"> if have array named temp whic have data this: array [ 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2289, 2290, 2298, 2299 , 2300 ] how can checked checkbox have value stringify of array, in case first checkbox ? so far, code : $(document).on('pjax:complete', function(data){ var temp = $('#print-sticker-keren').attr('data-print').split(',').map(number); // array : array [ 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2289, 2290, 2298, 2299 , 2300 ] (i=0; i!=temp.length;i++) { var checkb

SugarCRM 6.5 custom module print pdf layout -

i newly sugarcrm 6.5 developer, have create custom module details print pdf confused in controller action , view.detail page. how create print pdf, please me. controller function protected function action_printinvoice(){ global $current_user, $db, $region; $db = dbmanagerfactory::getinstance(); $id = $_post['record']; $sql = "select gn.client_name, gn.client_address, gn.client_address_city, gn.client_address_state, gn.client_address_country, gn.client_address_postalcode, gn.id, gn.recipient_name, gn.recipient_address_city, gn.recipient_address_state, gn.recipient_address_country, gn.recipient_address_postalcode, gn.recipient_address, gn.recipient_vat_id, gn.recipient_tax_no, gn.recipient_name, gn.invoice_number ginvo_client_invoice_id, " . " gcstm.* " . "from ginvo_client_invoice gn " . " inner join ginvo_client_invoice_cstm gcstm on gn.id=gcstm.id_c " . "where "

php - Upgrading existing ICU on CentOS6.9 -

all total newbie here , not developer. php script wish install uses yii framework requires higher version of icu default 4.2.1 on centos 6. so background - a) on ibm baremetal servers , softlayer support sucks b) have me on centos 6.9 c) php 5, 6 7 running d) php pear installed e) installed intl extension via easyapache on cpanel/whm across 3 flavors of php running f) script said needed icu 49 or higher (they have renamed versions 2 digit combos latest 59) i looked these 2 links http://lty.in/guuqfn http://lty.in/ym8ptm using first link followed step step have reached step pecl needs invoked on sever there no pecl - despite php-pear being active extension i stuck here "pecl install intl" i cant seem figure out how pecl installed on php-pear or if required...under bin there no sub-directory pecl also 2 more points - a) should uninstall easyapache based intl first? b) please note defauly icu 4.2.1 old version exits please , provide simple , clear steps

What type of language Kotlin is? Pure OOP's or Functional -

i'm learning kotlin . having java background know, java pure object oriented language. has inside class main function. that's why i'm wondering kotlin true object oriented language? because possible write functionl programs kotlin. package functions fun sayhello(name: string): string { val personname = name return "hello $personname" } fun main(args: array<string>) { println(sayhello("netra")) } actually language analysts not regard java purely object oriented language @ all. code needing in class not test, , better test in language object. in java, many language elements, notably methods , functions (functions long time missing added through lambdas) not available objects. kotlin correct many of flaws of java in being oo, although java has been correcting these flaws. said kotlin considered more 'oo' java, largely benefit of being newer design able correct errors of past. being able write functions, po