Posts

Showing posts from April, 2015

Install Postfix dovecot with mysql backgroud -

i have spent 3 days install postfix, dovecot , mysql on vps server. has been frustrating process. have googled painfully 3 days , collected information piece piece , made combination work. just want list steps , configuration files together, useful undergoing painful process. make mysql ready, , create database postfix (or whatever name want), create mysql user postfix , grant privilege postfix database. create following tables: create table virtual_domains ( id int(11) not null auto_increment, name varchar(50) not null, primary key (id) ) engine=innodb default charset=utf8; create table virtual_aliases ( id int(11) not null auto_increment, domain_id int(11) not null, source varchar(100) not null, destination varchar(100) not null, primary key (id), foreign key (domain_id) references virtual_domains(id) on delete cascade ) engine=innodb default charset=utf8; create table virtual_users ( id int(11) not null auto_increment, domain_id int(11) not null, password varchar(32...

angularjs - Retrieving Linked Entry Fields in Contentful with Angular (Ionic) -

i'm new contentful , angular (working in ionic) , having difficulty sorting out how retrieve field data contentful entry's related content (aka "link"). as things stand, can list entries according 'terms' factory, , can move individual entry state in can list linked content by--obvious see here--just id. i feel can resolved in the/a factory, not quite sure how proceed. nothing i've tried has far worked. and, if it's case i'm going wrong, i'm happy told so. many in advance. services.js angular.module('app.services', ['ngresource']) .factory('terms', function ($resource, $log) { var apigetentries = 'https://cdn.contentful.com/spaces/space_id/entries?access_token=my_access_token'; var terms = $resource(apigetentries, null, { query: { method: 'get', isarray: true, transformresponse: function(data, headers) { var entriesraw = angular.fromjson(data); v...

C# formatting text (right align) -

i beginner learning c#, making mock shopping list receipt program manage shopping. generate .txt receipt having problem right align string here code; public static void generatenewreciept(customer customer) { list<shoppingitems> customerpurchaeditems; try { sw = file.appendtext("receipt.txt"); //customer object customer customers = customer; //list of items in list list<shoppinglist> customeritems = customer.customershoppinglist; datetime todaydandt = datetime.now; //making reciept layout sw.writeline("date generated: " + todaydandt.tostring("g", cultureinfo.createspecificculture("en-us"))); sw.writeline("customer: " + customer.fname + " " + customer.sname1); (int = 0; < customeritems.count; i++) { customerpurchaeditems = customeritems[i].shoppingitems; foreach (shoppingitems item ...

.net - ASP.NET routing w/ changing article name -

is possible ignore second last part of url asp.net routing? e.g. ../article-name-x/123456/ no matter how product name changes, point same article adding article id @ end , use point correct article. we have product hasn't got it's final name yet on announcement, need update when final name known. used initial url in our communication , don't want link broken later. can me out? if understood question right want route have both article name , id . you can use attribute routing in .net mvc . pass both name , id path parameters defined in route. in action can use 1 of them (or both) search article. first allow attribute routing in registerroutes method routes.mapmvcattributeroutes(); then define route attribute action [routeprefix("articles")] [route("{action=index}")] public class articlescontroller : controller { // e.g /articles public actionresult index() { … } // e.g. /articles/my-article-name/my-article...

binary search tree - BST on c++ error -

i tried create bst on cpp done class node in class tree because it's logical. header: class node; class tree { public: node* root; tree(); tree(int val); void insert(int val); class node { public: node(); node(int val); node* right; node* left; int val; }; }; implamation: tree::tree() { this->root = null; } tree::node::node() { } tree::node::node(int val) { this->val = val; this->left = null; this->right = null; } void tree::insert(int val) { this->root = new node(3); } i got error on this->root = new node(3); intellisense: value of type "tree::node *" cannot assigned entity of type "node *" error c2440 : '=' : cannot convert 'tree::node *' 'node *' what did done wrong please? root node* , new node (3) return node* problem? thanks!!! to understanding, in current implementation, declaring 2 cl...

sockets - Sending UPD packages from Azure Web App to statsD -

i'm trying gather statistic our web applications. we're hosting our applications on azure. it's web app resource containing 1 or many web jobs. monitoring tools i'm using: statsd.justeat nuget package (c# client sending statistics using udp) telegraf - hosted on ubuntu virtual machine, gathers data , each x seconds write them influxdb. listening on 8125 port. that's overview: overview diagram problem i'm having: when application hosted web job in azure, i'm not able send upd package telegraf. i'm not able exception or log telling me happened. trying send statistic: for host (public ip of virtual machine):8125 port for host (private ip of virtual machine):8125 port with scenario: console app - external network - public ip -> works ! web job (connected vnet) - public ip -> doesn't work ! (that's surprising) web job (connected vnet) - private ip -> doesn't work ! web job (disconnected vnet) - public ip -> d...

c++ - Adding std::vector<bool> to a Variant of Containers -

i'm wrapping c interface has load function returning value* object, points dynamic array of value objects: typedef struct value { union { int8_t i8; int16_t i16; int32_t i32; int64_t i64; bool b; } value; } value_t; the objects in given array of same type. my idea represent follows in c++: typedef boost::variant<std::vector<bool>, std::vector<int8_t>, std::vector<int16_t>, std::vector<int32_t>, std::vector<int64_t>, std::vector<std::string> > container; is reasonable , pitfalls should aware of? can there compiler specific issues regarding how bool defined? realize std::vector represented internally using bits , there additional issues in regard. i'm working c++98 compilers. since you're using boost, it's best use boost::containers::vector<bool> . container have behavior want.

Wordpress Edit Page not working -

i running on latest version of wordpress. i clicking on edit page of home page, however, wordpress not allowing me edit page. also when clicking on edit post, font white on visual editor , frustrating. so kindly please help. step perform deactivate plugins. yes... plugins. switch default 2014 theme. manually empty , refresh browser cache. only after perform 3 steps.. see content editor load properly. why need step you have deactivate plugins rule out possible interference plugin. you have switch default theme because... well... know works. you have manually empty browser cache because tinymce editor notorious holding onto , serving cached files server. now, after editor working again... reactivate theme. if continues working... it's not theme. begin reactivating plugins (one @ time) going check editor. you find faulty plugin (or theme) preventing editor displaying properly. "edit page" - of text in edit box in white font try ad...

javascript - How to have "and" and "or" conditions in jQuery selector -

i check if 2 separate divs returning true hasclass. if($('#first-name, #last-name').hasclass('has-focused')) { $('#personal-info').valid(); } this checks if either 1 has class 'has-focused'. instead this: if($('#first-name').hasclass('has-focused')&&$('#last-name').hasclass('has-focused')) { $('#personal-info').valid(); } however, solution feels bit clumsy. possible this. if($('#first-name'&&'#last-name').hasclass('has-focused')) { $('#personal-info').valid(); } you can't that, though can have filter based solution like if ($('#first-name, #last-name').not('.has-focused').length == 0) { $('#personal-info').valid(); }

python 3.x - Python3 - Error posting data to a stikked instance -

i'm writing python 3 (3.5) script act simple command line interface user's stikked install. api pretty straight forward, , documentation available . my post function is: def submit_paste(paste): global settings data = { 'title': settings['title'], 'name': settings['author'], 'text': paste, 'lang': settings['language'], 'private': settings['private'] } data = bytes(urllib.parse.urlencode(data).encode()) print(data) handler = urllib.request.urlopen(settings['url'], data) print(handler.read().decode('utf-8')) when run script, printed output of data, , message returned api. data encoding looks correct me, , outputs: b'private=0&text=hello%2c+world%0a&lang=text&title=untitled&name=jacob' as can see, contains text= attribute, 1 required api call work. i've been able post api...

node.js - How can you add route to Nodejs without restarting the server? -

searching way create "forgot password" page users. it must have following features: urls must unique , random individual user. decided use hash function this. urls must expire after users finish obtaining new password or after time-out period has ended. web-server cannot changed operation. webserver : node.js 5.2.0 module : expressjs 4.13.3 in understanding, node.js needs restart every time when add new/remove route . currently, colleague uses nodemon . although application, not ideal "forgot password" page due fact restarts web-server each time runs. question: what best technique scenario? what specific keyword question? you can add routes using path parameters in node (i assume you're using express.js, if clarify can modify answer). in case register route this: /api/v1/user/forgotpasswordendpoint/:unique_hash this match things such as /api/v1/user/forgotpasswordendpoint/12345 you can access 12345 through req.param...

WordPress WooCommerce Add to Cart only adds one product -

i'm quite new woocommerce , can not figure out one. i'm creating custom api (based on user requirement) , i'm letting user login in laravel using post request this: public function login (request $req) { global $woocommerce; $v = \validator::make($req->all(), [ 'username' => 'required|max:255', 'password' => 'required|max:255', ]); if ($v->passes()) { $user = wp_signon(['user_login'=>$req->input("username"),"user_password"=>$req->input("password")],true); if (is_wp_error($user) || !is_user_logged_in()) { return response(['success' => false, 'message' => "invalid username or password."], 401); } $key = md5($user->id . $user->user_login. (time() + 7200) . $user->email); $cookie = wp_generate_auth_cookie($user->id, (time() + 7200), "aut...

php - Laravel - Eager Load Single Item in a ManyToMany Realtionship -

in laravel, possible eager load 'first' item belongstomany relationship? in, return item relationship, rather collection ? from i've tried (and read) applying first() or limit('1') or other constraint not return individual item use accessor . i guess need latest , first , or such kind of single item collection, can this: public function items() { return $this->belongstomany(item::class); } public function getlatestitemattribute() { return $this->items->sortbydesc('created_at')->first(); } then can use: $yourmodel->latestitem; // single related model or null edit: mentioned @hkan in comment, above code result in fetching whole collection , working on it. said, can use alternatively relation object , directly query table: public function getlatestitemattribute() { return $this->items()->latest()->first(); } however, way run query whenever call $model->latestitem . result new copy of model, ...

html - Understanding responsive images and device pixel ratio -

Image
i'm trying implement responsive images on website using srcset , sizes. when testing on computer looks , works great. image downloaded next-largest image when compared current page width (page width of 500px retrieve 720px wide image). here's i'm using: <img src="image-240w.jpg" srcset="image-1140w.jpg 1140w, image-940w.jpg 940w, image-720w.jpg 720w, image-480w.jpg 480w, image-240w.jpg 240w" sizes="(max-width: 1140px) 100vw, 1140px"> on phone confused. have nexus 5x 1920x1080 resolution screen device pixel ratio of 2.5. viewport meta added page ( <meta name="viewport" content="width=device-width, initial-scale=1"> ) media queries respond expected--as if device on 400px wide (1080px/4 = 432px). support example below. 480px wide image which, expected, hangs past edge of page 48px. example b image 1140px wide larger 432px wide viewport. example c result of img ...

android - is there any way to configure gradle to check spelling in strings.xml? -

Image
i'd strings.xml checked spelling while building gradle. since use continuous integration need configured building command-line not in android studio. way it? ps. i've tried: lintoptions { abortonerror false // check *only* given issue id's check 'typos' } strings.xml: <resources> <string name="app_name">project</string> <!-- common words --> <string name="test_spelling">sdfsdfdfds</string> and ./gradlew assembledebug lint but got nothing: :app:lint ran lint on variant release: 0 issues found ran lint on variant debug: 0 issues found wrote html report file:/users/asmirnov/documents/dev/src/project/app/build/outputs/lint-results.html wrote xml report /users/asmirnov/documents/dev/src/project/app/build/outputs/lint-results.xml also i've checked lint --show : ... typos ----- summary: spelling error priority: 7 / 10 severity: warning category: correct...

html - Setting a responsive height to a container while vertically centering content -

i'm trying solve issue height of container should responsive when minimizes browser window. content in container should stay veritcally centered too. here's have far in codepen: http://codepen.io/anon/pen/pnzzoe the container blue box contains text. blue box should have same height dummy image when adjusting browser window size. thanks ahead help! code in codepen: html <html> <head> </head> <body> <div class="grid_12 alpha omega" id="llcontentcont"> <!-- row 1 --> <div class="llrow" id="llrow1"> <div class="llcontent"> <div class="grid_4 llfr alpha"> <div class="lltext"> <h3>header</h3> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. nullam hendrerit tristique sem, dictum ornare lectus.</p> </div> </div> ...

java - Is this a valid a way to use split? -

i trying practice identifying whether or not code valid looking @ it. can't find split method implementation looks this, , want know why. string[] names = "flowers,are,pretty".split(",",0); this valid. string[] names = "flowers,are,pretty".split(",",0); for(int i=0;i<names.length;i++) system.out.println(names[i]); for more info visit java docs

python - Saving JSON Get Responses in Django to DB? Do you fill in models and then call save? -

up until now, i've done of work through admin panel rather making requests json data api. let's wanting save data database. natural flow saving database or there better way of doing this? make request api , json response. example response: response = { 'name': bob } create django model object fields being set parts of json. example: model_ex(name=json['name'], , on...) model_ex.save() - makes call save db thanks!

How to change prefix key of tmux to Ctrl? -

i'd change prefix key of tmux c-b ctrl , tried following in .tmux.conf. doesn't work. unbind c-b set -g prefix c bind c send-prefix thanks as explained in answer @ unix stack exchange, can't done: ctrl , shift modifiers. these keys aren't transmitted applications running in terminal. rather, when press ctrl + shift + a , sends character or character sequence @ time press a key.

listview - Not able to enter and edit values in edit text android list view -

Image
am new list view in android , want enter different values manually in edit text in list view but able achieve , body guide me achieve it package com.example.limitscale.beautylog; import java.util.arraylist; import java.util.hashmap; import java.util.locale; import android.app.activity; import android.content.context; import android.content.intent; import android.content.sharedpreferences; import android.graphics.color; import android.text.editable; import android.text.textwatcher; import android.util.log; import android.view.layoutinflater; import android.view.view; import android.view.view.onclicklistener; import android.view.viewgroup; import android.widget.baseadapter; import android.widget.button; import android.widget.checkbox; import android.widget.compoundbutton; import android.widget.edittext; import android.widget.imagebutton; import android.widget.imageview; import android.widget.linearlayout; import android.widget.textview; import android.widget.toast; public cla...

php - How to check the submitted date is not before the today's date in laravel 5 request class? -

Image
here code in request class. public function rules() { return [ 'title' => 'required', 'eventdate' => 'required|date|before:today', ]; } public function messages(){ return [ 'title.required' => 'title required.', 'eventdate.before' => 'event date passed', 'eventdate.required' => 'event date required.', ]; }` this view class code @if($errors->has('eventdate.required')) <p style="color: red">{{$errors->first('eventdate.required')}}</p> @endif @if($errors->has('eventdate.before')) <p style="color: red">{{$errors->first('eventdate.before')}}</p> @endif i want compare submitted date today's date. if submitted date earlier date today's date, error message should displayed.but there should mistakes in code.

neural network - Rapidminer dummy coding mismatch -

i'm trying use neural network training on traindata , testing on testdata, do. however, data requires dummy coding of nominal features numerical. when that, trains neural network fails when applying test data (on apply exact same transformations/blocks) because of mismatch in dummy coding*. *the error message in lines of: v47=h not exist in testdata i checked , true testdata not have value 'h' @ in v47, while traindata has it. therefore, i'd ignore 'h' in v47, or replace it. any way easily ? keeping in mind might happen other features , going through features, 1 one, fix kind of issue, time consuming. perhaps there's way tackle this? thanks! this similar previous post this answer suggests combining test , training data cause possible values of nominal present splitting recover test , training sets again. possible additional nominal values retained in both splits. this may not suit possibility use data weights operator on training...

c# - Adding inherited generics to a generic list -

i'm trying add objects list, objects generics inherit interface. base class listeners: public class listener<t> : ilistener<t> t : icaller { public listener() { } public type getcallertype() { return typeof(t); } public virtual void received(connection connection, t obj) {} } example listener: public class clientpacketlistener<t> : listener<t> t : packet { } i want add them list: listener<icaller> listeners = new listener<icaller>(); in case, packet inherits icaller, should able cast down base types. error can't cast however. i've looked @ other questions, work generic <t> , not listener class. there way work or not? i think can resolve problem if change ilistener<t> declaration ilistener<out t> making t covariant . it should allow this ilistener<icaller> listener = new clientpacketlistener<packet>(); for more information read msdn o...

mysql - confluence install cause 500 exception HibernateException -

i use confluence , mysql make personal wiki. have in 500 exception hibernateexception . the log of confluence: caused by: com.atlassian.confluence.tenant.vacantexception: confluence vacant, call tenanted [public abstract net.sf.hibernate.session net.sf.hibernate.sessionfactory.opensession() throws net.sf.hibernate.hibernateexception] not allowed. @ com.atlassian.confluence.tenant.tenantgate$1.lambda$create$306(tenantgate.java:45) @ org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:171) what have done: confirm mysql connecter work correct. details in test mysql connerctor . reinstall serveral times, error appears too. google problem , find it, no anwse. see opensession() throws net.sf.hibernate.hibernateexception any helps welcome! download latest mysql-connector jar file , place under /confluence/web-inf/lib/ other libraries. stop , restart confluence instance. i had exact same exception ...

asp.net - Get uiculture using server expression tag in aspx page -

can uiculture of page using server expression in aspx page defined in globalization tag? <%= page.uiculture %> well pound out way it.. if have pls post. alert('<%= system.globalization.cultureinfo.currentuiculture %>'); this page helped.

swift - Realm data Insertion took over 7mins for big size json -

i use alamofire download big json data around 7mb , use realmswift store data @ realmobject , swiftyjson parse.my realm object insertion after finished download json seems slow @ insertion.was wrong bad code?please guide me. first of show simplest json : { { "start" : "40000", "end" : "1000000", "name" : "smith", "address" : "new york" },{...},more 7000 records... } here alamofireapi protocol import foundation import alamofire import swiftyjson protocol requestdataapiprotocol{ func didsuccessdownloadingdata(results:json,statuscode : int) func didfaildownloadingdata(err : nserror) } class requestdataapi{ var delegate : requestdataapiprotocol init(delegate: requestdataapiprotocol){ self.delegate=delegate } func post(requesturl:string,param:[string:string]){ alamofire.request(.get, requesturl, parameters: param) .validate(statuscod...

c++ - dijkstra implememtation giving wrong outputs -

i trying solve problem understanding of dijkstra algorithm .this mentioned problem : https://www.hackerrank.com/challenges/dijkstrashortreach . first testcase accepted others wrong.please hint me wrong implementation . far understand algorithm have implemented correctly here code: #include<bits/stdc++.h> using namespace std; #define max 100001 #define inf int_max #define pii pair< int, int > #define pb(x) push_back(x) int main() { int i, u, v, w, sz, nodes, edges, starting; int t; cin>>t; while(t--){ priority_queue< pii, vector< pii >, greater< pii > > q; vector< pii > g[max]; int d[max]; bool f[max]; // create graph scanf("%d %d", &nodes, &edges); for(i=0; i<edges; i++) { scanf("%d %d %d", &u, &v, &w); g[u].pb(pii(v, w)); g[v].pb(pii(u, w)); // undirected } scanf("%d", &starting); // initialize distance vector ...

android - Proguard removing ORMLite annotation in just one field -

i have class @databasetable(tablename = helloworld.table_name) public class helloworld { public static final string table_name = "hello_world"; public static final string col_id = "id"; public static final string col_text = "text"; private static final string col_subtext = "subtext"; @databasefield(columnname = col_id, generatedid = true) private int mid; @databasefield(columnname = col_text, uniquecombo = true) private string mtext; @databasefield(columnname = col_subtext, uniquecombo = true) private string msubtext; public helloworld() { } public helloworld(string text, string subtext) { mtext = language; msubtext = subtext; } public string gettext() { return mtext; } } this happens: when run android app in debug mode fine. when in release conf, proguard taking out @databasefield annotation id field. query: final list<helloworld> helloworld = mhelloworlddao.querybuilder() ...

node.js - Get key value from the list of JSON in NodeJS -

i receiving json object list of objects result=[{"key1":"value1","key2":"value2"}]. i trying retrieve values list in nodejs. used json.stringify(result) failed.i have trying iterate list for(var key in result) still no luck prints each character key. is facing such issue or have been through issue? please point me out way. if result string then: var obj = json.parse(result); var keys = object.keys(obj); (var = 0; < keys.length; i++) { console.log(obj[keys[i]]); }

postgresql - Efficient way to move large number of rows from one table to another new table using postgres -

i using postgresql database live project. in which, have 1 table 8 columns. table contains millions of rows, make search faster table, want delete , store old entries table new table. to so, know 1 approach: first select rows create new table store rows in table than delete main table. but takes time , not efficient. so want know best possible approach perform in postgresql database? postgresql version: 9.4.2. approx number of rows: 8000000 want move rows: 2000000 this sample code copying data between 2 table of same. here used different db, 1 production db , other testing db insert "table2" select * dblink('dbname=db1 dbname=db2 user=postgres password=root', 'select "col1","col2" "table1"') t1(a character varying,b character varying);

c# - Add Constructor Arguments To Ninject Binding -

i have asp.mvc project using ninject ioc container. have added binding separate class within infrastructure folder this: public class ninjectcontrollerfactory : defaultcontrollerfactory{ private readonly ikernel _ninjectkernal; public ninjectcontrollerfactory() { _ninjectkernal = new standardkernel(); psccheckcontext m = _ninjectkernal.get<psccheckcontext>(new iparameter[] { new constructorargument("appnamekey", "name of staff application"), new constructorargument("serverlocationnamekey", "location of application server") }); addbindings(); } so can see trying set 2 parameters web.config in constructor of psccheckcontext. c# application handles access db. addbindings() class maps interface classes concrete implementations expect: private void addbindings() { ... _ninjectkernal.bind<ipsccheckcontext>().to<psccheckcontext>(); } the problem having there 2 constructors i...

iOS : UILabel multiple lines - second line of label needs to start with 10 pixels -

Image
i facing 1 issue - have 1 label "1. seibl software made company , can purchased @ $500" when comes iphone 4s, label printing second line , second line starting under "1.". give space/margin/space label looks numbering format. try solution. might helps you. use nsattributedstring label, , set headindent of paragraph style : nsmutableparagraphstyle *style = [[nsparagraphstyle defaultparagraphstyle] mutablecopy]; style.headindent = 14; nsdictionary *attributes = @{ nsparagraphstyleattributename: style }; nsattributedstring *richtext = [[nsattributedstring alloc] initwithstring:@"so uilabel walks bar…" attributes:attributes]; self.narrowlabel.attributedtext = richtext; self.widelabel.attributedtext = richtext; result:

ios - UISearchBar hides behind UISearchController view -

Image
i have implemented custom uisearchbar , custom uisearchcontroller . both reside inside uitableviewcontroller controlled uinavigationcontroller . the animation of dismissing uisearchbar should move uisearchcontroller doesn't hides uisearchbar behind uisearchcontroller in image attached. couldn't figure out causes issue , idea welcome apparently issue caused calling reloadtable hosting table of uisearchcontroller . updating table after uisearchcontroller dismissed , not beforehand resolves issue.

ios - can't complete process of GPUImageMovieWriter completionBlock -

when completion block complete process set video brightness using gpuimage class, output video of 0 kb, , crashes on gpuimagemoviewriter.m file, , gives below error. proj_name(1232,0xb0219000) malloc: * mach_vm_map(size=8388608) failed (error code=3) * error: can't allocate region securely *** set breakpoint in malloc_error_break debug is here had worked using gpuimage video brightness?? gpuimagebrightnessfilter: adjusts brightness of image brightness: adjusted brightness (-1.0 - 1.0, 0.0 default) https://github.com/bradlarson/gpuimage check above link..

ruby on rails - Reducing the number of queries kaminari makes -

given following code: # items_controller class itemscontroller < applicationcontroller def show @files = @item.essences.page(params[:files_page]).per(params[:files_per_page]) end end and # items/_essences.html.haml = paginate @files, :param_name => :files_page %table.table %thead %tr = sortable :foo = sortable :bar = sortable :baz = sortable :aaa %th blah %tbody - if @files.empty? %tr %td no files available %td %td %td %td - else - @files.each |file| %tr %td= file.foo %td= file.bar %td= file.baz %td= file.aaa %td= blah %tr %td %b== #{@files.count} files %td== -- %td %b= number_to_human_size @files.sum(&:size) %td== -- %td== -- = paginate @files, :param_name => :files_page %p %button.per_page{:data => {:per => 10, :param_name ...

php - What password to store in database when user registers through OAuth2 (Example: google or facebook)? -

i have web application permits user register though normal html form, or via facebook or google. question password should store in database, because if oauth provider gives me relevant information email, name, age, etc... obviously not give password. correct password store in database? have few ideas: generate random 1 , send through email (not secure) add empty string. (they never able login using password because on acceptin login request validate password should contain more 5 characters, sounds hacky way it) make compulsory fill in password after registering through oauth provider. any thoughts? it depends entirely on application. authentication going run through 3rd party - i.e. googleauth? if is, there no need store password. if handle authentication in application give user option sign google/facebook or application. i see 3rd party authentication better user experience because don't have register on site. in mind, if sign on site require password,...

python - Tkinter - Run Event Function Upon Listbox Selection -

i have listboxselect event binding listbox, lb. using selection_set select item in listbox, binded function doesn't run. how can make function run when select item in listbox using selection_set when clicked? import tkinter tk class sampleapp(tk.tk): def __init__(self, *args, **kwargs): tk.tk.__init__(self, *args, **kwargs) self.lb = tk.listbox(self) x in range(20): self.lb.insert("end", x) self.lb.bind("<<listboxselect>>", self.onselect) self.lb.pack(side="top", fill="both", expand=true) def onselect(self, event): print(event.widget.get(event.widget.curselection()[0])) self.lb.selection_set(10) if __name__ == "__main__": app = sampleapp() app.mainloop() thanks lafexlos pointing me resource: http://wiki.tcl.tk/13939 what understood have generate virtual event discovered can done in tkinter using event_generate . ...

osx - Video Stress via Apple script -

i've been working on video stress script based on terminal quicktime, i'm having specific issue 1 part of playing multiple videos quicktime love opinions on cleaning up/running better right script can take 12 videos playing @ once, organizes them in single desktop, i'd love loop commands open them full screen (presentation mode) , bring out. process stresses graphics processer , ram , processor lot, why want it. code both seems inefficient , doesn't work. i've thought using window id's matrix of id's use control them, can't quite figure out. any how here simplified version of script fullscreen/unfullscreen mode. brings of videos out of presentation not of them, , not consistant amount (some times it's 1, times 2 or 3) i'd appreciate bit of help/advice tell application "quicktime player" set open_windows (every window visible true) set n count of open_windows repeat n times set presenting of document 1 true delay 5 ...

generics - Can we have a field implementing two or more interfaces in Java? -

this question has answer here: java generics wildcarding multiple classes 2 answers would possible create class this... public class container implements serializable { private final (map<object,object> & serializable) map; public container( (map<object,object> & serializable) map) { super(); this.map = map; } .... } basically, don't want bind map implementation class , make sure implementation implements both map , serializable interface. many idea , help. you can define generic type parameter having required type bounds : class container<e extends map<object,object> & serializable> implements serializable { private final e map; public container (e map) { super(); this.map = map; } }

Is it possible to have a one time payment with WooCommerce Subscriptions -

Image
i thinking setting subscription, wanted have 1 time payment of subscription, know if possible? for example, subscription $120 , 1 year. pay 1 time (at start) , after 1 year subscription expires. hoping woocommerce subscriptions can this. cheers have looked @ product settings subscriptions? can set billing interval, billing period, , duration of subscription.

java - javadoc.exe not found while running ant -

i trying run basic ant scripts , while doing facing following error: d:\{user...}\build.xml:31: javadoc failed: java.io.ioexception: cannot run program "javadoc.exe": createprocess error=2, system cannot find file specified i have tried searching solution , came following solutions: createprocess error=2 running javadoc ant i using jdk. still facing issue. javadoc.exe present in jdk\bin. i using inbuilt ant came ecplise kepler service release 2. if remove 'docs' target, it's running perfectly. this build.xml: <?xml version="1.0" encoding="utf-8"?> <project name="ant-test" default="main" basedir="."> <!-- sets variables can later used. --> <!-- value of property accessed via ${} --> <property name="src.dir" location="src" /> <property name="build.dir" location="bin" /> <property name="dist.dir" locati...

excel - Choose a, c, m in Linear Congruential Generator -

i looking implement linear congruential generator in excel. as know, must choose parameter of lcg a, c, m, , z0. wikipedia says that the period of general lcg @ m, , choices of factor less that. lcg have full period seed values if , if: m , offset c relatively prime, - 1 divisible prime factors of m, - 1 divisible 4 if m divisible 4. also, m, 0 < m – "modulus" a, 0 < < m – "multiplier" c, 0 < c < m – "increment" z0, 0 < z0 < m – "seed" or "start value" i need choose values, want z0 initial value 10113383, , rest random. nah, values has specified period , guaranteed no collisions duration of period? i've tried put values, a=13, c=911, m=11584577 , looks no collisions. i'm not sure if break rules or not. i regularly teach number theory , cryptography course have built library of programs in vba , python. using these, needed write 1 more: function gcd(num1 long, nu...

ruby - Rails 5.0.0.beta3 'rails-api'. (Bundler::GemRequireError) -

i trying test app on rails beta3. when trying run application on rails server following error (with stacktrace) /home/sambhav/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': there error while trying load gem 'rails-api'. (bundler::gemrequireerror) /home/sambhav/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require' /home/sambhav/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each' /home/sambhav/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require' /home/sambhav/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each' /home/sambhav/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require' /home/sambhav/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler.rb:99:in `require' /home/sambhav/caroobi/caroobi/config/application.rb:7:in `<top (r...

r - How to modify a single column with joins using dplyr -

i'm trying add new column data frame, based on levels of 1 (or few) factors. start data frame 2 factors , single variable library(dplyr) test <- data_frame(one = letters[1:5], 2 = letters[1:5], 3 = 6:10) and want add new column, four , has values levels of one , two . convenience, keep these new values in own little tables: new_fourth_a <- data_frame(one = "b", 4 = 47) new_fourth_b <- data_frame(two = c("c","e"), 4 = 42) the correct answer 1 2 3 4 (chr) (chr) (int) (dbl) 1 6 na 2 b b 7 47 3 c c 8 42 4 d d 9 na 5 e e 10 42 and best way think of accomplish via left_join() : test %>% left_join(new_fourth_a, = "one") %>% left_join(new_fourth_b, = "two") but ends duplicating four column. thing: allow easy checking see if there joins introduce more 1 value new column (ie check there 1 non-na value across each row in...