Posts

Showing posts from July, 2011

database - ejabberd PostgreSQL chat persistence table -

i using odbc auth_method in ejabberd , using postgres database. need see chat history (messages) made between 2 users in database. followed these steps: 1) createdb myejabberd; 2) psql myejabberd < /path/to/my/pg.sql 3) create user ejabberduser; 4) commented auth_method: odbc , enabled auth_method: odbc . 5) odbc configuration, use postgres enabled odbc_type: pgsql odbc_server: "localhost" odbc_database: "myejabberd" odbc_username: "ejabberduser" odbc_password: "ejabberd" 6) tried run admin http://localhost:5280/admin . works fine , made between 2 users using adium. i can see registered users in users table cant able find out table chat history stored. please help. as default, message history not stored in database. you may want message archive management (xep-0313, aka mam) xmpp extension, supported in ejabberd 15.06 . you can use mod_mam (message archive management - xep-0313) module. works perfect. ,...

regex - Remove characters from python output -

this question has answer here: concatenate item in list strings 4 answers i have written python code print recommended product id's having product id of product. getting output as:- ['503821321','503821331','504821322','503821343'] i want output as:- 503821321, 503821331, 504821322, 503821343 what should do? in advance. in [77]: ', '.join(['503821321','503821331','504821322','503821343']) out[77]: '503821321, 503821331, 504821322, 503821343' in [78]: print(', '.join(['503821321','503821331','504821322','503821343'])) 503821321, 503821331, 504821322, 503821343

hashmap - Lookup table for counting number of set bits in an Integer -

was trying solve popular interview question - http://www.careercup.com/question?id=3406682 there 2 approaches able grasp - brian kernighan's algo - bits counting algorithm (brian kernighan) in integer time complexity lookup table. i assume when people use lookup table, mean hashmap integer key, , count of number of set bits value. how 1 construct lookup table? use brian's algo to count number of bits first time encounter integer, put in hashtable, , next time encounter integer, retrieve value hashtable? ps: aware of hardware , software api's available perform popcount (integer.bitcount()), in context of interview question, not allowed use methods. integers can directly used index arrays; e.g. have simple array of unsigned 8bit integers containing set-bit-count 0x0001, 0x0002, 0x0003... , array[number_to_test] . you don't need implement hash function map 16 bit integer can order can have function!

javascript - minify the signalr/hubs file -

i'm using signalr in app , referencing so: <script src="/signalr/hubs" type="text/javascript"></script> of course signalr generated javascript dynamically on fly. when run yslow better performance of web application complains singalr/hubs not minified. surely when click on link shows js, small snippet sample: /*! * asp.net signalr javascript library v2.1.1 * http://signalr.net/ * * copyright microsoft open technologies, inc. rights reserved. * licensed under apache 2.0 * https://github.com/signalr/signalr/blob/master/license.md * */ /// <reference path="..\..\signalr.client.js\scripts\jquery-1.6.4.js" /> /// <reference path="jquery.signalr.js" /> (function ($, window, undefined) { /// <param name="$" type="jquery" /> "use strict"; if (typeof ($.signalr) !== "function") { throw new error("signalr: signalr not loaded. please ensu...

c++ - "if" statement with "or" operator not working -

trying have program make user renter input if choose number isn't 1 2 or 3. whenever type 1 2 or 3 still wants me re enter integer. did use or operator wrong? #include <iostream> #include <string> using namespace std; int main() { cout << "choose option 1,2 or 3: \n"; cout << "1: drop single chip 1 slot \n"; cout << "2: drop multiple chips 1 slot \n"; cout << "3: quit program \n"; int choice; cin >> choice; if (choice != 1||2||3) { cout << "please enter 1 2 or 3 \n"; cin >> choice; } else { cout << "it worked \n"; } } this condition in if statement if (choice != 1||2||3) is equivalent to if ( ( choice != 1 ) || 2 || 3 ) so equal true because if choice != 1 evaluates false nevertheless expressions 2 , 3 unequal 0 , consequ...

c++ - fallback to alternate function when templated function instantiation fails -

i need store pointers instanced template functions , when function cannot instanced store pointer empty function instead. looked sfinae dont think applies here. struct staticentity { double position; }; struct dynamicentity { double position; double speed; }; class movesystem { public: template <typename t> void update(t& entity, double dt) { entity.position += entity.speed*dt; } }; typedef void (*updateentitiesfunc)(void* system, void* entity, double dt); template <typename s, typename e> static void update(void* system, void* entity, double dt) { // here if inner function cannot instanced skip , "nothing" instead ((s*)system)->update(*(e*)entity, dt); } int main() { updateentitiesfunc uf = update<movesystem, dynamicentity>; updateentitiesfunc uf2 = update<movesystem, staticentity>; //^ not compile // gives error: 'struct staticentity' has no member named 'speed...

java - Jersey Client - How to send List in a form with a POST request -

i using jersey client send post requests web server. have been building form object key-value pairs. however, have send list within request. here's abridged version of code // phone pojo consisting of few strings public void request(list<phone> phones) { form form = new form(); form.add("phones", phones); clientresponse response = webservice.getresponsefromserver(form); string output = response.getentity(string.class); system.out.println(output); } public static clientresponse getresponsefromserver(form form) { client client = createclient(); webresource webresource = client.resource(path); return webresource.type(mediatype.application_form_urlencoded).post(clientresponse.class, form); } unfortunately, doesn't seem work, , 400 bad request error. when send request directly {"phones":[{"areacode":"217","countrycode":"01","number":"3812565"}]} ...

Verify if the second character is a letter in SQL -

i want put condition in query have column should contain second position alphabet. how achieve this? i've tried _[a-z]% in clause not working. i've tried [a-z]% . any inputs please? you can use regular expression matching in query. example: select * `test` `name` regexp '^.[a-za-z].*'; that match name column test table against regex verifies if second character either lowercase or uppercase alphabet letter. also see sql fiddle example of data , doesn't match.

mpandroidchart - Zoom out to show hidden entries -

Image
i'm struggling of entries showing in chart. here's looks like pinchzoom enabled, can't zoom out anymore. is there way programmatically zoom out more, or set bounds of view? check documentation of yaxis . there lot of ways extend range of axis. pretty sure wrong setup.

How to index nested lists in Python? -

i have nested list shown below: a = [('a', 'b', 'c'), ('d', 'e', 'f'), ('g', 'h', 'i')] and trying print first element of each list using code: a = [('a', 'b', 'c'), ('d', 'e', 'f'), ('g', 'h', 'i')] print a[:][0] but following output: ('a', 'b', 'c') required output: ('a', 'd', 'g') how output in python? a[:] creates copy of whole list, after element 0 of copy. you need use list comprehension here: [tup[0] tup in a] to list, or use tuple() generator expression tuple: tuple(tup[0] tup in a) demo: >>> = [('a', 'b', 'c'), ('d', 'e', 'f'), ('g', 'h', 'i')] >>> [tup[0] tup in a] ['a', 'd', 'g'] >>> tuple(tup[0] tup in a) ('...

python - Update dictionary items with a for loop -

i update dictionary items in loop here have: >>> d = {} >>> in range(0,5): ... d.update({"result": i}) >>> d {'result': 4} but want d have following items: {'result': 0,'result': 1,'result': 2,'result': 3,'result': 4} as mentioned, whole idea of dictionaries have unique keys. can have 'result' key , list value, keep appending list. >>> d = {} >>> in range(0,5): ... d.setdefault('result', []) ... d['result'].append(i) >>> d {'result': [0, 1, 2, 3, 4]}

php - Loading second app into its own namespace - which database will it use? -

as subject says, really. assume have 2 apps, namespaced app_a , app_b . app_a has app_b imported git submodule , autoloaded via composer.json . when call app_b\somemodel->somemethod() from app_a controller , model query database configured in app_b 's config files, or inherit config values app_a ? short answer: won't inherit app_b's config files. expanded answer: app_a loaded it's config files. call app_b\somemodel::somemethod() app_a , app_a's configuration used. have 2 independent applications 'knowledge' of each others state need define communication method between 2 such message queues(mq), http, sockets, streams etc etc. never import app_b submodule of app_a , vice versa unless you're ok app_*'s classes being used in context of loaded application stack. another option @ hmvc or heirarchical mvc pattern. possibly give solution problem without keeping applications separate. there bundle in laravel 3 enabling hmvc hav...

vb.net - Prime Number Visual Basic -

i have assignment , says: you have been provided working program named prime. has 1 input single integer. when “find prime number” button pushed, nth prime number identified. for example: if 4 entered , button clicked, response “the 4th prime number 7” displayed. , if 9 entered, response “the 9th prime number 23” displayed. the program 100% accurate, correct locates nth prime. problem comes in when try find larger prime number. for example: if 10000 entered , button clicked, response “the 10000th prime number 104729” displayed. correct answer; however, took on 48 seconds on i7 computer find solution. imagine how long take find millionth prime number. task analyze problem find more efficient solution make program more useful. first must understand how code provided works. there exercise @ end of document. use run code hand. once understand how works, analyze problem of finding prime number make program operate more efficiently. reason why program slow larg...

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

i install web server database on raspberry pi (little computer). computer has 1gb ram. i want know best combination: linux distribution , web server , dbms run local server multiple users minimal latency, use php on server. , best settings performance , not have bugs (memory usage, disable plugin, disable service, etc)? i thought light debian , lighttpd server , sqlite database. solution? i think lighttpd + sqlite great choice. linux distro, debian @ centos or tiny core linux , although i'm not sure of compatibility pi. obviously, can't go wrong raspbian if want use in production , more stable performance, few more pi's , set them in cluster .

ios - Get back variable value from another swift file -

first of all, sorry title not precise. so, have file data.swift informations import foundation class data { class entry { let filename : string let heading : string let referenceville: string init(fname : string, heading : string, referenceville : string) { self.heading = heading self.filename = fname self.referenceville = referenceville } } var places = [ entry(fname: "bordeaux.jpg", heading: "heading 1", referenceville : "bordeaux"), entry(fname: "lyon.jpg", heading: "heading 2", referenceville : "lyon") ] var bordeaux = [ entry(fname: "lemarais.jpg", heading: "le marais", referenceville : "lemarais"), entry(fname: "montmartre.jpg", heading: "montmartre", referenceville : "montmartre"), entry(fname: "perelachaise....

PHP POST method upload -

Image
i'm having trouble debugging why processing of file upload not working. i've created html5 file uploader on page calls upload.php. upload.php // file should saved in same folder upload.php $uploaddir = '/'; $uploadfile = $uploaddir . basename($_files['filetoupload']['name']); echo '<pre>'; if (move_uploaded_file($_files['filetoupload']['tmp_name'], $uploadfile)) { echo "file valid, , uploaded.\n"; } else { echo "possible file upload attack!\n"; } echo 'here more debugging info:'; print_r($_files); print "</pre>"; the result of debug shows me following: move_uploaded_file appears return false , not being able move uploaded file temp location specified location. i've made sure set permissions on folder upload.php resides , file should save 777. question there way more information why file not saved me understand did wrong ? // file s...

javascript - Operator '+' cannot be applied to types 'String' and 'String' in TypeScript -

i new typescript trying play it. face wired problem. when try concatenate 2 string type using + operator it's give error operator '+' cannot applied types 'string' , 'string' my code snap is var firstname: string = 'foo'; var lastname: string = 'bar'; var name = firstname + lastname; if use string instead string or add '' it works fine. checked, within javascript can use + on 2 string object why it's show error in typescript ? bug or feature ? missing something. detail explanation appreciated. string not same string . use string unless really, know you're to. the upper-case name string refers boxed version of primitive string. these should avoided wherever possible -- don't behave normal string s in subtle , unexpected ways (for example typeof new string('hello') "object" , not "string" ).

c# - EF Code First "String or binary would be truncated" when running Update-Database -

my migration looks this: public override void up() { addcolumn("dbo.targettable", "table1id", c => c.int(nullable: false)); addforeignkey("dbo.targettable", "table1id", "dbo.table1", "id"); addcolumn("dbo.targettable", "table2id", c => c.int(nullable: false)); addforeignkey("dbo.targettable", "table2id", "dbo.table2", "id"); } public override void down() { dropforeignkey("dbo.targettable", "table1id", "dbo.table1", "id"); dropcolumn("dbo.targettable", "table1id", c => c.int(nullable: false)); dropforeignkey("dbo.targettable", "table2id", "dbo.table2", "id"); dropcolumn("dbo.targettable", "table2id", c => c.int(nullable: false)); } and when ...

arrays - Javascript function returning the function itself? -

i have small bit of code giving me headache. needs location (in case array representing longitude , latitude). planner.js: var plan = function (lawnmower, yard) { var currentpos = lawnmower.position; alert(currentlong); lawnmower: var longitude = homelongitude, latitude = homelatitude; var getposition = function() { return [longitude, latitude]; }; that.position = getposition; when alert gets called returns getposition after equal sign. heres pic i'm novice @ js. you forgot () when call getposition , instead of assigning result that.position you're assigning entire function: that.position = getposition(); //parenthesis!

c# - Midi-dot-net playing notes simultaneously and to high delay -

after resolving problem noteon key event (thank justin) noticed 2 problems: high delay , impossible playing simultaneously. firstable use if statment: if (nutka == "a0" && msg.velocity != 0) { clock.schedule(new noteonmessage(outputdevice, channel.channel1, pitch.a0, 80, 2)); } and works excelent, no delay, allows me use midi pitch not .wav files. when use other possibility play note (from files added resources): soundplayer notea0 = new soundplayer(properties.resources.a0); notea0.play(); looks , works ok soundplayer don't allow me play notes simultaneously. another way trying wmp library: var notea0 = new wmplib.windowsmediaplayer(); notea0.url = @"c:\sounds\piano\a0.wav"; ok... plays simultaneous kind funny thing happens, more notes play bigger delay (delay between press key , hear sound) have , programm stuck on playing (still got noteon messages)...looks memory buffer gone or that? the last thing trying check directx libr...

javascript - NodeJS package dependencies -

i have defined npm package following dependencies: "dependencies": { "kwire": "0.0.1" } i create new project folder node_modules folder in root , package.json , , run npm install --save my-package . i end my-package being placed in node_modules , , dependencies being placed in inner node_modules folder, within my-package folder. this seems normal. when fire node.js repl my-project folder , write: var m = require('my-package'); it results in error kwire not defined. it falling on over line inside my-package : require('kwire'); what need ensure my-package can see kwire ? i suggest using "files": [] inside package.json file. typical workflow structure package.json : "dependencies": { "package1": "latest", "package2": "latest" ... }, "files": [ "index.js", "lib/" ] inside index.js p...

android - ScrollView not scrolling and application restart on orientation change -

i building android application connects bluetooth module. when application created, thread connect module executed. when rotate phone, application restarts , connection thread run again. around this, added android:configchanges="orientation|screensize" android:windowsoftinputmode="adjustresize|statehidden" to android manifest file. application doesn't restarted, scrollview used in activity not scroll. idea scrollview scrollable , prevent application restarting? here xml file <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent"> <scrollview android:layout_width="match_parent" android:layout_height="match_parent" android:fillviewport="true" android:layout_above="@+id/imageview"> <linearlayout ...

angularjs - CSS transitionend event not detected with ng-hide -

i have angular app in use nganimate make nghide , ngshow transitions better. trying transitionend event not seem register ng-hide, ng-hide-remove, or ng-hide-add classes. event fired class , transition had. know why events don't fire angular classes? would appreciate help!

PHP DOMXPath query to return value -

i want , show title, tel, fax , address if exist. html code : <div id="id1"> <div class="ab"> <ul> <li class="title"> agence x </li> <li class="tel"> 060000000</li> <li class="fax"> 06000000</li> <li class="address> address </li> </ul> </div> <div class="ab"> //the same class name <ul> <li class="titre"> agence x </li> <li class="tel"> 060000000</li> <li class="fax"> 06000000</li> </ul> </div> <div>...</div> </div> i wrote code didn't know how write condition "if node class name 'address' or 'fax' or 'tel' exist' x . here code: $...

python - Converting a PDF file to Base64 to index into Elasticsearch -

i need index pdfs elasticsearch. that, need convert files base64. using attachment mapping . i used following python code convert file base64 encoded string: from elasticsearch import elasticsearch import base64 import constants def index_pdf(pdf_filename): encoded = "" open(pdf_filename) f: data = f.readlines() line in data: encoded += base64.b64encode(f.readline()) return encoded if __name__ == "__main__": encoded_pdf = index_pdf("test.pdf") index_dsl = { "pdf_id": "1", "text": encoded_pdf } constants.es_client.index( index=constants.index_name, doc_type=constants.type_name, body=index_dsl, id="1" ) the creation of index document indexing works fine. issue don't think file has been encoded in right way. tried encoding file using online tools , different encoding bigger compared...

php - Giving error while genrating pdf -

i developing website in symfony framework. have generate pdf using spraedpdfgeneratorbundle . in localhost working fine. when check on server got error. the exit status code '127' says went wrong: stderr: "sh: java: command not found" stdout: "" command: java -djava.awt.headless=true -jar "/home/bwcmm/public_html/ps/drp/vendor/spraed/pdf-generator-bundle/spraed/pdfgeneratorbundle/resources/java/spraed-pdf-generator.jar" --html "/tmp/tmp558d2d71e4d98." --pdf "/tmp/output558d2d71e3a1a.pdf" --encoding utf-8. please help. ensure environment variable "java" set. error suggests, java cannot found. to check if java installed type java --version in command line interface.

elasticsearch - Trying to understand how to update a mapping without requiring a complete rebuild of the index? -

from page: https://www.elastic.co/blog/changing-mapping-with-zero-downtime states: i don't care old data if want change datatype single field, , don't care fact old data not searchable? in case, have few options: delete mapping if delete mapping specific type, can use put_mapping api. create new mapping type in existing index. ... my situation is, have column string, , want change long... according document, sounds should able do: curl -x delete localhost:9200/my_index/_mapping/property_to_change and do curl -xput 'http://localhost:9200/my_index/_mapping/property_to_change' -d ' { "my_index" : { "properties" : { "property_to_change" : {"type" : "long", "store" : true } } } } ' am misunderstanding this? have go through trouble of creating alias? there not simple way can change 1 property's type? i find documentation regarding ...

fluid - Edit Treeview in TYPO3 flux -

i want edit sys category in fluidcontent template. using: typo3 6.2.13 flux 7.2.1 fluidcontent 4.2.2 fluidpages 3.2.3 vhs 2.3.3 trying alway says have select element: <flux:field.tree table="sys_category" parentfield="parent" maxlevels="10" expandall="1" name="syscategories" size="20" width="900"> <flux:wizard.edit label="edit" /> </flux:field.tree> adding flux:wizard.edit flux:field.relation don't work. doing wrong? create folder , add categories in it. and use below code. pid in flux:wizard.list , flux:wizard.add folder id. <flux:field.tree table="sys_category" parentfield="parent" maxlevels="10" expandall="1" name="syscategories" size="20" width="900" /> <flux:field.input name="settings.systemcategoy" label="system category"> <flux...

Set order of mouse click events javascript -

i have 2 elements - parent , child. both have on click event handlers. if click on child element both event handlers run - parent's first child's (at least on chrome). don't know how browser determines order run events in, there way set order child's click event happens before parent's click event? i have found lot of questions , answers regarding order of different events (mousedown, click, etc.), can't find regarding order of same event on different elements. thanks in advance! are sure parent's runs first? events bubble innermost element outermost element (your child click handler should trigger before parent). http://api.jquery.com/on/ : the majority of browser events bubble, or propagate, deepest, innermost element (the event target) in document occur way body , document element. in internet explorer 8 , lower, few events such change , submit not natively bubble that said, if want behavior of parent element execute first following:...

sql server 2008 - split ssrs expression between 2 words -

i have requirement split result 3 separate expressions, using sql server 2008. the result example. "person: man tel: yes rel: christian msg: misc text" i need split into: "person: man" "tel: yes" "rel: christian" "msg: misc text" i have been using iif statement return bit before "tel" cant return between tel , rel etc. part before colon remain static whichever result returned in dataset, part after colon (of length too) before getting next section. can please? other similar questions on forum have been helpful first expression, later ones little more difficult. for sql method works test did: select left(txt, charindex('tel:',txt)-2) part1, substring(txt, charindex('tel:',txt), charindex('rel:',txt)-charindex('tel:',txt)) part2, substring(txt, charindex('rel:',txt), charindex('msg:',txt)-charindex('rel:',txt)) part3, right(txt, len(txt...

c - Segmentation fault around MD5 code -

while running md5 code, taking maximum 64 characters length of input @ run time. whenever giving more 64 characters, showing inconsistency detected ld.so: dl-fini.c: 205: _dl_fini: assertion ns != 0 || == nloaded failed! i need hash 10kb of input (only string). need change in header file? can tell me solution please? md5.h #ifndef header_md5_h #define header_md5_h #include <openssl/e_os2.h> #include <stddef.h> #ifdef __cplusplus extern "c" { #endif #ifdef openssl_no_md5 #error md5 disabled. #endif /* * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * ! md5_long has @ least 32 bits wide. if it's wider, ! * ! md5_long_log2 has defined along. ! * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ #if defined(__lp64__) #define md5_long unsigned long #elif defined(openssl_sys_cray) || defined(__ilp64__) #define md5_long unsigned long #define md5_long_log2 3 /* * _cray not...

python - Entry widget doesn't work -

i'm new python , need problem. how user input on canvas? i've tried taking out x= , y= doesn't work... after run module says "non-keyword arg after keyword arg". please help. from tkinter import* def main(): global window global tkinter global canvas window = tk() canvas = canvas(window, width=400, height=300, bg='blue') e1 = entry(canvas) canvas.create_window(window=e1, x=100,y=100) e1.pack() canvas.pack() window.mainloop() main() the position of created window has passed first 2 arguments, not keyword arguments. canvas.create_window(100, 100, window=e1) also, entry widget doesn't need packed when used in manner, e1.pack() line should removed entirely.

PHP/ MySQL issue -

i have on 10,000 products won't able create new web page each 1 or add each 1 cms individually. here's have: a cms allows me mass-upload using csv file a cpanel godaddy server mysql databases correct me if i'm wrong process adding product: connect cms cpanel server add products cms using csv file create database in mysql ont godaddy server. add php website oriduct page extract product information. i'm confused how product information transferred cms database in mysql when cms installed , connected database -which should regular setup- import products csv via cs.cart import : in administration panel, go administration > import data > products . make sure fields in csv file have same names ones listed under products section on page. check whether values of fields have correct format. more information correct format read imported fields format article. in import options section, specify following settings [...] click im...

excel - How to use set ranges -

i looking way improve on better way write piece of code that'll if there clients "first list" in "second list" , copy data on sheet named "found". it goes this: dim row long, row2 long, found long dim id string, prtgtid string, gtid2 string application.screenupdating = false prtgtid = "b" gtid2 = "d" row = 2 row2 = 2 found = 0 while row <= cells(rows.count, prtgtid).end(xlup).row id = cells(row, prtgtid) sheets("second list").select while row2 <= cells(rows.count, gtid2).end(xlup).row if (id = cells(row2, gtid2)) rows(row2).select selection.copy sheets("found").select rows(2).select selection.insert shift:=xldown sheets("first list").select rows(row).select selection.copy sheets("found").select rows(2).select selection.insert shif...

ubuntu - MATLAB still opens GUI after -nodesktop and -nosplash options -

i want open matlab without gui, pretty running linux terminal. reason adding -nodesktop , -nosplash flags aren't working. maybe there must sort of default settings, overwriting these flags? there way check this? maybe i'm missing flag? $ matlab -nodesktop -nosplash other details: matlab 2012b, ran on ubuntu 12.04. running: $ matlab -nodesktop -nosplash -nojvm -nodisplay doesn't work either. you try workaround, worked me in simple test (though i'm not running ubuntu 12.04, ymmv): before call matlab , set display variable non-valid value. instance: export display=:10.0 matlab for me, produces terminal matlab session without display or splash, without command-line options.

regex - Use Regular Expression to match a repeated pattern -

Image
look @ simple string: https://regex101.com/r/iu8ue5/2 using repeated capturing, can please show me expression match capturing group 1: aaa capturing group 2: bbb capturing group 3: ccc problem have such pattern in middle of string , number of delimiters (here: 4) varies need have repeated regex. use pcre dialect. thanks to match 3 consecutive letters in pcre, can use \p{l} shorthand class {3} limiting quantifier: \p{l}{3} see demo mind need add g flag on regex101.com enable multiple matching. or, can split non-letters \p{l}+ regex if there no matching multiple occurrences functionality.

java - How to force IntelliJ to download javadocs with Maven? -

Image
i have following descriptions maven entries in project structure: javadoc file absent in filesystem. simultaneously, present in central repository. why not downloaded , how download force? update these options on already: have tried recompile, close/open etc after setting them... click on "maven projects" (make sure tool buttons on) on right side of intelij , click on "download documentation". also, future downloading can go file -> settings -> build,execution, deployment, -> build tools -> maven -> importing -> mark "documentation" checkbox , apply settings

javascript - When element clicked, find closest element relative to this element with another class and toggle it -

i missing here. when row class one clicked, want find closest row class two , toggle (show/hide) it. $(".one").on('click', function() { $(this).find('.two').toggle(); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <table> <tr class="one"> <td> hello </td> </tr> <tr> <td> world </td> </tr> <tr class="two"> <td> foo </td> </tr> <tr class="two"> <td> bar </td> </tr> </table> something this: $(".one").on('click', function() { $(this).nextall('.two:first').toggle(); }); http://jsfiddle.net/derekl/5ossufmj/

javascript - For loop creating infinite object tree -

i have 2 loops creating object: function newimage(){ image = {}; var temp = {} for(i=0;i!=250;i++){ temp[i] = {}; } image = temp; for(i=0;i!=250;i++){ image[i] = temp; } } this should create object 250 values, each being object contains 250 objects. however, creates object creates 250 values, fills 250 values, , loops while. haven't found end of tree, doesn't freeze leading me believe finite. i've checked iterations 50 , works way (it doesn't make long tree). seems if happening during last iterations. here's full thing. var temp = {} for(i=0;i!=250;i++){ temp[i] = {}; } the lines above create object , populate 250 other objects (so far good). then image = temp; sets image (global) variable temp (so image contains 250 objects) then: for(i=0;i!=250;i++){ image[i] = temp; } this replaces each of 250 objects (overwriting previous assignments) reference parent object object has 250 attributes ...

javascript - How to create a custom pick up and delivery option in woocommerce cart page -

Image
i have shopping cart setup on website using woocommerce , set want achive there create custom radio buttons select option delivery/pickup. if user select pickup option no shipping charged or if user select delivery option $12.00 flat rate/order charged along timings save meta key , value later on creating order. following image elaborate to achieve had created custom plugin stuck add shipping amount. question asked here: can't update shipping amount while checkout in woocommerce(wordpress) but didn't response. appritiated. correct answer posted here can't update shipping amount while checkout in woocommerce(wordpress) using following hook function woo_add_cart_fee() { wc()->cart->add_fee('shipping ', wc()->session->get('ship_val')); } add_action('woocommerce_cart_calculate_fees', 'woo_add_cart_fee'); and date can inserted adding custom field on cart page using add_meta_box()

python - Reshaping numpy array without using two for loops -

i have 2 numpy arrays import numpy np x = np.linspace(1e10, 1e12, num=50) # 50 values y = np.linspace(1e5, 1e7, num=50) # 50 values x.shape # output (50,) y.shape # output (50,) i create function returns array shaped (50,50) such first x value x0 evaluated y values, etc. the current function using complicated, let's use easier example. let's function is def func(x,y): return x**2 + y**2 how shape (50,50) array? @ moment, output 50 values. use loop inside array? something like: np.array([[func(x,y) in x] j in y) but without using 2 loops. takes forever run. edit: has been requested share "complicated" function. here goes: there data vector 1d numpy array of 4000 measurements. there "normalized_matrix", shaped (4000,4000)---it nothing special, matrix entry values of integers between 0 , 1, e.g. 0.5567878. these 2 "given" inputs. my function returns matrix multiplication product of transpose(datavector) * matrix *...

Git Clone from GitHub over https with two-factor authentication -

i began using two-factor authentication on github, , unable use git on https on private repos in usual way: peter@computer:~$ git clone https://github.com/[...]/myprivaterepo cloning 'myprivaterepo'... username 'https://github.com': [...] password 'https://[...]@github.com': remote: invalid username or password. fatal: authentication failed 'https://github.com/[...]/myprivaterepo/' if disable two-factor authentication can use before: peter@computer:~$ git clone https://github.com/[...]/myprivaterepo cloning 'myprivaterepo'... username 'https://github.com': [...] password 'https://[...]@github.com': remote: counting objects: 147, done. remote: total 147 (delta 0), reused 0 (delta 0), pack-reused 147 receiving objects: 100% (147/147), 22.70 kib | 0 bytes/s, done. resolving deltas: 100% (87/87), done. checking connectivity... done. i know can use ssh , works, there way can keep two-factor authentication while still bein...

c++ - Increase Rcpp compile speed -

i using rcpp write r package, uses c++ code, each time r cmd build <package name> , needs long time compile whole packages, since there couple of cpp files. there way can compile changed files/new files, instead of recompiling everything? thank much! i have makevars file this: pkg_cxxflags=-std=gnu++11 pkg_libs=-l. -lall the best trick know deploy awesome frontend ccache linux distros have, , os x has (in brew iirc). can used both g++ , clang . so in ~/.r/makevars have ver= ccache=ccache cc=$(ccache) gcc$(ver) cxx=$(ccache) g++$(ver) shlib_cxxld=g++$(ver) fc=ccache gfortran$(ver) #fc=gfortran f77=$(ccache) gfortran$(ver) where ver empty 4.9 default. if re-build same package on , over, compile-time fast unchanged code leads object files being retrieved.