Posts

Showing posts from May, 2014

objective c - Get rid of the animation completion delay -

every time when use completion of animation, there kind of delay. how can make sure delay not there anymore? this part of code: [self dismissviewcontrolleranimated:yes completion:^ { [presentingviewcontroller presentviewcontroller:load animated:yes completion:nil]; }]; do not dismiss animated if don't wish animate. if animate, completion fire when animation complete, hence delay.

system verilog - SystemVerilog memory coding style -

i've coded 2 versions of single-port synchronous ram variable read/write width. however, first design results in 1307 alms utilization, while second results in 757 alms utilization, both compiled quartus prime 16.0.0 build 211 lite edition. idea why? first vesion: typedef enum logic [2:0] {char, uchar, short, ushort, int} datatype; module memory(input datatype datatype, input [31:0] storedata, input [6:0] address, input clock, store, write, output logic excep, output [31:0] loaddata); logic [1:0][1:0][7:0] memory [0:31]; always_ff @(posedge clock) case (datatype) char: if (store) memory[address[6:2]][address[1]][address[0]] <= storedata[7:0]; else loaddata <= {{24{memory[address[6:2]][address[1]][address[0]][7]}}, memory[address[6:2]][address[1]][address[0]]}; uchar: if (store) memory[address[6:2]][address[1]][address[0]] <= storedata[7:0]; else loaddata ...

java - Customize jasper reports at the runtime of the program -

i have created reporting system using jasper reports in java. in system, need customize or align text fields in report during runtime. possible redesign report during runtime? if so, how can done. it should deleting field not relevant , relocate fields such changing co-ordinates drag , drop. how or other alternative solutions available. don't want create scratch using dynamic reports. have details in detail band. data in detail band

Forming groups of spatio-temporally near trajectories in R or PostgreSQL -

i'm doing trajectory analysis using r , postgresql. in order form groups of trajectory segments successive positions spatio-temporally near, i've created following table. i'm still missing column group_id , question about. bike_id1 datetime bike_id2 near group_id 1 2016-05-28 11:00:00 2 true 1 1 2016-05-28 11:00:05 2 true 1 1 2016-05-28 11:00:10 2 false na [...] 2 2016-05-28 11:00:05 3 true 1 2 2016-05-28 11:00:10 3 true 1 this result of multiple comparisons between each trajectory every other (all combinations without repetitions) , inner join on datetime (sampled on multiple of 5 seconds). shows positions, bike 1 , 2 sampled @ same time , spatially near (some arbitrary threshold). now i'd give away unique ids segments 2 bikes spatio-temporally near ( group_id ). this i'm stuck...

spring - Get annoted method endpoints for JMS -

is there way through can find configured methodjmslistenerendpoint's through annotations? i want register these end points different message listener containers. @jmslistener(destination = "testqueue") public void process(string msg) { system.out.println(msg); } //todo connections foreach(connections){ //todo annotated endpoints prototype foreach(endpoint){ methodjmslistenerendpoint processendpoint = endpoint; registrar.registerendpoint(processendpoint,containerfactory(connection)); } } depends on provider can use configuration customizer bean hornetqconfigurationcustomizer manipulate settings during bean initialization. if configuration should adoptive , manageable in runtime should not use @jmslistener annotation @ all. register them in code spring advises: jms

numpy - Fast incremental update of the mean and covariance in Python -

i have python script need update mean , co-variance matrix. doing each time new data point $x$ (a vector), recompute mean , covariance follows: data.append(x) # `data` list of lists of floats (i.e., x list of floats) self.mean = np.mean( data, axis=0) # self.mean list representing center of data self.cov = np.cov( data, rowvar=0) the problem is not fast enough me. there anyway more efficient incrementally updating mean , cov without re-computing them based on data ? computing mean incrementally should easy , can figure out. main problem how update covariance matrix self.cov . i'd keeping track of sum , sum of squares. in __init__ : self.sumx = 0 self.sumx2 = 0 and in append: data.append(x) self.sumx += x self.sumx2 += x * x[:,np,newaxis] self.mean = sumx / len(data) self.cov = (self.sumx2 - self.mean * self.mean[:,np,newaxis]) / len(data) noting [:,np.newaxis] broadcasting find produce of every pair of elements

Segmentation fault while using insertion sort -

i try implement insertion algorithm calling insort function. somehow, along way made mistakes terminal print out segmentation faults. please help. thanks! int main(int argv,char *argc[]){ int a[argv-2]; for(int i=1;i<argv;i++){ a[i-1]=atoi(*(argc+i)); } insort(&a,argv-1,0); for(int i=0;i<argv-1;i++){ printf("%d",a[i]); } printf("\n"); return 0; } int insort(int *a[],int size,int n){ int temp; if(n<size){ for(int i=n;i>=0 && *(a+i)>*(a+i-1);i--){ temp=*(a+i-1); *(a+i-1)=*(a+i); *(a+i)=temp; } } return insort(a,size,n++); } when compiling program, pay attention warnings compiler emits. for each of warnings, have understand why given , how fix properly. $ gcc -std=c99 insort.c insort.c:7:9: warning: implicit declaration of function 'atoi' [-wimplicit-function-declaration] insort.c:11:9: warning: imp...

javascript - what type of modules/features/functionalities should be included in front-end development -

i'm doing web applications, business applications , websites, etc. animation, forms, ui-grid concerns. i have done least amount of unit test ever possible in development cycles, , because used angularjs, unit testing supposed easy. besides usual calculations , string manipulations type of things should unit test? features? modules? how front-end unit test come play?

android - How to clear Firebase Crash reports? -

i using firebase crash reporting service android. see add firebase android project can 1 me clear crash report firebase console or way remove firebase crash android api?

java - Servlet: HTTP Status 404 - /Test/SimpleServletPath -

Image
this question has answer here: servlet returns “http status 404 requested resource (/servlet) not available” 1 answer i have created small dynamic web project understand mechanism of java servlet when run simpleservlet on server getting http status 404 error when typing url http://localhost:8082/test/ getting content of index.html file rendered. dont have web.xml file. how can run servlet on server? simpleservlet package org.user; import java.io.ioexception; import java.io.printwriter; import javax.servlet.servletcontext; import javax.servlet.servletexception; import javax.servlet.annotation.webservlet; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; import javax.servlet.http.httpsession; @webservlet(description = "a simple servlet", urlpatterns = { "/simplese...

c++ - assign white color with .at() not work -

i wrote algorithm future erosion implementation. i'm testing algorithm i've got problem: when try color pixel white colour image column black , white, otherwise if set each pixel black worked. how can solve? here's code mat morph_op_manager::erode_img(mat image) { //stucture element attribute int strel_rows = 5; int strel_cols = 5; // center structure element attribute int cr = 3; int cc = 3; //number of columns/rows after strel center int nrac = strel_rows - cr ; int ncac = strel_cols - cr ; int min_val = 255; (int = cr-1 ; <image.rows-nrac ; i++) { (int j = cc-1; j < image.cols-ncac ; j++) { (int ii = 0; ii <strel_rows ; ii++) { (int jj = 0; jj <strel_cols ; jj++) { image.at<int>(i-(nrac-ii),j-(ncac-jj)) = 255; } } } } i'm working opencv in c++, file black , white image .tiff. here's output i don't see how declared image object bet of type cv_8u ....

Does QBFC work with QuickBooks Server Database Manager -

i've tried looking on intuit's site , have not managed find answer question. i need know if , how can use qbsdm qbfc. currently, not seem work me if i'm pointing @ company file. for quickbooks integrated application, must have quickbooks installed on computer sdk/integrated application installed on. always point integrated app @ quickbooks company file, regardless of sort of environment/client-server set you're running. the server database manager has no effect what-so-ever, , has literally nothing integrated applications - irrelevant.

Codeigniter - Parse error: syntax error, unexpected '-', expecting '{' -

i'm new in codeigniter programming , i'm having problems link controller. i've got homepage (home.php) wich i've go page. home.php <?php defined('basepath') or exit('no direct script access allowed'); ?> <!-- default home page --> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>animania manager</title> <link rel="stylesheet" href="application/styles/foundation.css"> <link rel="stylesheet" href="application/styles/app.css"> <link rel="stylesheet" href="https://cdn.datatables.net/1.10.11/css/jquery.datatables.min.css" /> <link rel="stylesheet" href="application/styles/reset.css"> <!-- css reset --> <link rel=...

javascript - React 15.1.0, Pass entire state from parent to child -

Image
i using react 15.1.0 . suppose there parent "p" component, , contains child component "c". in older versions of react, when wanted pass entire state child, used {...this.state} , used {this.props.something} child component. is there simple way in latest latest react 15.1.0 above instance? note: need pass entire state , not individual props. <div> {react.cloneelement(this.props.children, { title: this.state.title })} </div> what expecting below; <div> {react.cloneelement(this.props.children, {...this.state})} </div> in parent component have below code; var app = react.createclass({ getinitialstate() { return{ status: 'disconnected', title: 'hello world' } }, render() { return( <div> <header title={this.state.title} /> <div> {react.cloneelement(this.prop...

sql - Nested COUNT with WHERE clause in SELECT statement -

i'm novice in sql scripts , trying counts table count 3 different ways, count(1) not issue, next 2 counts slow. there individual indexes on columns used in clause still slow. there easier , better way these count? in following code want unique customerid's on each parent-select group timestamp: (select count(distinct al2.customerid) actionlog al2 convert(varchar(10),al2.timestamp,110) = convert(varchar(10),al1.timestamp,110) , al2.actiontypeid = al1.actiontypeid , al2.campaignid = al1.campaignid , al2.eventid = al1.eventid , case when charindex('?', al2.url) > 0 left(url, charindex('?', al2.url)-1) else url end = case when charindex('?', al1.url) > 0 left(url, charindex('?', al1.url)-1) else url end , al2.timestamp between dateadd(dd, datediff(dd, 0, getdate()),-7) , dateadd(dd, datediff(dd, 0, getdate()),0)) count_total_dayunique the next 1 want new unique customerid's have not been part of parent-select group clause before...

google cardboard - GvrViewer.Instance.Triggered seems to be true during two frames -

the official documentation says: true 1 complete frame after each pull. however following log executed twice per tap on screen: void update(){ if (gvrviewer.instance.triggered { debug.log("tap detected"); } } a workaround removing private public bool triggered { get; private set; } in gvrviewer . setting false manually within above if clause. not elegant solution though... it silly mistake. there 2 objects script attached. that's why executed twice!

asp.net web api2 - Web Api call not reaching action? -

Image
i have webapiconfig setup this: public static class webapiconfig { public static void register(httpconfiguration config) { config.maphttpattributeroutes(); config.routes.maphttproute( name: "defaultapi", routetemplate: "api/{controller}/{id}", defaults: new { id = routeparameter.optional } ); } } i have registered route in global.asax follows: protected void application_start() { arearegistration.registerallareas(); filterconfig.registerglobalfilters(globalfilters.filters); routeconfig.registerroutes(routetable.routes); bundleconfig.registerbundles(bundletable.bundles); webapiconfig.register(globalconfiguration.configuration); } my web api controller class looks this: [routeprefix("api/upload")] public class uploadcontroller : apicontroller { [httpget] [route("")] public string upload() { ...

jquery - How to force/guide scrolling to the nearest element only? -

an example of website stellar.js . problem is, using parallax library (scrollmagic) , don't want redo website stellar. how this? (jquery acceptable.) edit: forgot mention sections full-page. this lets user scroll , when stops bounces next position. scrollto($(".start")); $(document).on('mousewheel ', function(e) { //e.preventdefault(); /** optional, might want try **/ /** elements bounce to: **/ var $elements = $("div[data-scrollbolock]"); /** next/previous element based on scrolling direction: **/ var $elementtoscrollto = $elements.eq(0); var scrolldirection = "down"; if (e.originalevent.wheeldelta >= 0) { scrolldirection = "up"; $elements = $($elements.get().reverse()); } $elements.each(function() { var scrolltop = $(window).scrolltop(), elementoffset = $(this).offset().top, distance = (elementoffset - scrolltop); if (scroll...

ios - WatchConnectivity sendMessage:replyHandler: don't work when linker have flag -ObjC -

i have project external libraries, project use -objc linker flag these libraries. without -objc project crash. , want add support watch os 2. have problem: until linker has flag -objc method -sendmessage:replyhandler: return error like error domain=wcerrordomain code=7014 "payload not delivered." userinfo={nslocalizeddescription=payload not delivered.} i can't delete flag (-objc), watch doesn't work. if user tap @ button need send info iphone. , ways sending info have problems too. system add messages queue , keep them forever. have ideas ? linker flag should not effect watchkit connectivity. here several troubleshooting procedures. you have make sure delegate method implemented on device receives message. -(void)session:(wcsession *)session didreceivemessage:(nsdictionary<nsstring *,id> *)message in comments, said data sending simple dictionary. watchkit connectivity doesn't allow send custom class objects. also try restart simul...

sas - How to determine the length of an array? -

if dont know exact length of array after transpose, there way output it? or use it, without manually looking through output data? example, if transpose on number of pills dispensed, number variable each 'id' , want specify array in regression, there way without finding value via manual visual inspection? proc phreg data=...; array start{*} start1-start????; i=1 ?????; if start{i}<t2event var=1; end; model ......... as corollary if know less say, 100, , specify 100, there consequence? thanks! the dim() function returns dimensions of array. can use : suffix make variable list of names start same letters. array start{*} start: ; i=1 dim(start);

mysql - Add log in credentials to PHP file command -

i trying read file web address requires log in. have parameter as: $data = file("http://rotoguru1.com/cgi-bin/mlb-dbd-2016.pl?&start=$dt"); the website defines log in with: username access key <form name=login action=http://rotoguru1.com/cgi-bin/getcred.pl method=post > <input name=geturl type=hidden value="http://rotoguru1.com/cgi-bin/mlb-dbd-2016.pl?" > username: &nbsp;<input name=user type=text length=20 value= ><br> access key: <input name=key type=password length=11 > &nbsp; <input type=submit value="log in" ><br></form></td> how add these definitions script? this code send parameters perl script , , read it's response be, complete html code, along http response headers, have deal well! $url = "http://rotoguru1.com/cgi-bin/getcred.pl"; $usrname=''; // user name here $access='';//your access key here $myvars = 'user=...

ruby on rails - "random: nonblocking pool" initialization taking a long time on Ubuntu 16.04 Server -

on ubuntu 16.04 server (kernel 4.4.0-22) takes 2-5 minutes initialize "random: nonblocking pool" according /var/log/syslog, compared ubuntu 14.04: may 28 18:10:42 foo kernel: [ 277.447574] random: nonblocking pool initialized this happened lot faster on ubuntu 14.04 (kernel 3.13.0-79): may 27 06:28:56 foo kernel: [ 14.859194] random: nonblocking pool initialized i observed on digitalocean vms. it's causing trouble rails applications because unicorn server seems wait pool become available before starting up. what reasonable time initialization step? why take longer on ubuntu 16.04? is reasonable application wait pool become available or might dependency on pool bug on application side? "apt-get install rng-tools" makes ubuntu use available hardware number generators fixes issue - pool ready in 10s instead of minutes then.

postgresql - Creating an array/slice to store DB Query results in Golang -

i'm getting started golang , i'm attempting read several rows postgres users table , store result array of user structs model row. type user struct { id int title string } func find_users(db *sql.db) { // query db rows, err := db.query(`select u.id, u.title users u;`) if err != nil { log.fatal(err) } // initialize array slice of users. size use here? // don't know number of results beforehand var users = make([]user, ????) // loop through each result record, creating user struct each row defer rows.close() := 0; rows.next(); i++ { err := rows.scan(&id, &title) if err != nil { log.fatal(err) } log.println(id, title) users[i] = user{id: id, title: title} } // .... stuff } as can see, problem want initialize array or slice beforehand store db records, don't know ahead of time how many records there going be. i weighing few different approaches, , wanted find out o...

java - How to send serial data via Bluetooth to an unspecified device? -

i use following code arduino uno: #include <softwareserial.h> softwareserial device(2, 3); void setup() { device.begin(9600); } void loop() { device.println("33,89,156,203,978,0,0;"); } no specific device send set. if want receive data on laptop (running ubuntu 14.04) call: sudo rfcomm bind rfcomm0 [mac address] 1 and screen /dev/rfcomm0 in terminal instance , works. how can achieve same behaviour android app? following example code specifies device. cannot find other code. additionally works when listen on laptop incoming connection this: sudo rfcomm listen rfcomm0 [mac address] i want android app work arduino example. how can achieve that? unfortunately android doesn't appear have low level classic bluetooth apis allow broadcast type behavior. makes sense android intended go power limited devices , active radios use energy. if required use classic bluetooth (3.x) , android handle sending or receiving broadcast type b...

php - Sending an uploaded file as attachment but not saving to server -

this might noob-ish question, new file uploading , mail sending. please bare me... i have contact form on website allows user send files attachments email. reasoning that, not need or want every image uploaded website server, when using form input file gets uploaded anyways. it makes sense form uploads file function know if inevitable or if there way still send images attachments not have uploaded server. regards pulled answer https://stackoverflow.com/a/23849972/ (and having spent time find them solution). sidenote: upvoted answer pulled from, know. "i assigned $_files['attachment']['tmp_name'] temporary variable , worked! dont know why solved me. here's code" // swiftmail commands ==================================== require_once('./swiftmailer/lib/swift_required.php'); $transport = swift_smtptransport::newinstance('smtp.host.com', 587) ->setusername('email@host.com') ->setpassword('pass')...

jquery - Set Height On a Container, After Re-sizing an Inner Element -

my website displays list of members. each list item has photo, title (member's name) , small excerpt. on large screens, list 1 row. on smaller screen, row collapse 3 columns , 2 columns (less 768px). i want each item have equal height, each 'row' (on smaller devices) contains equal number of items. this common task, write quick function called on $(window).load() , on $(window).resize(). the problem i'm having job, (i'm assuming) fact - before set height of member items, first set height of element within each member item. inner element photo, resize every time window resized. (i because photos must appear circles, need change each photo's height it's width changes). i can't determine problem is, can see final height set on each member item short, , each items content overflows it's height. happens on resizing window, only, , work fine on initial page load. this mark item (a member): <div class="col-xs-6 col-sm-4 col-md-3...

Google's Web Service API via iOS requires a server? -

i've seen in few tutorials google's places web service api prohibited being used directly mobile device. still true? i wouldn't call easy, after setting server key without restricted ips/referrers, seems function fine me. have searched quite bit official documentation google specifies case, have yet find concrete. see being idea additional security, requirement? the places api policies document has section mobile applications, doesn't mention restriction regarding using web service directly mobile device. https://developers.google.com/places/web-service/policies

c - How to draw titlebar with XCB -

i working on simple window manager in c libxcb , trying decorate window titlebar, icon , min/max/close buttons. i test wm in xephyr. can spawn new xterm window, move around , resize it. decorate new xterm window (or other app matter), has titlebar, icon , min/max/close buttons. on linux machine i've installed gtk theme, , if launch firefox example, window gets decorated after set theme in settings. in case think it's gtk applies window decorations. how work? i read ewmh window property, _net_wm_window_type , can used determine how handle decorating window. think check if window type _net_wm_window_type_normal , wm_name app , manually draw titlebar on top of it. is how should draw window decorations normally? or can use gtk (or else) this? so in case think it's gtk applies window decorations. how work? correct. gtk apps tell window manager not decorate them setting border width 0. suggestion implement that: if window sets border width of 0, ignor...

templates - C++ templated class and generics are not working -

i have this: template<class e, class p> class listenerinterface { public: virtual listenerresponse handleevent(e<p> *event) const = 0; }; but e , p both templated classes default template parameters. and i'm getting this: error: expected ')' virtual listenerresponse handleevent(e<p> *event) const = 0; using cmake -std=c++14 -wall -w -pedantic here "minimal, complete, , verifiable" example demonstrates not how resolve immediate error, how create listener class implements listenerinterface , while satisfying condition that: e , p both templated classes default template parameters. first, define classes correspond p , e in example: template <typename t = int> class payload { public: payload (const t & value) : value(value) {} const t value; }; template <typename t = payload<>> class event { public: event (const t & payload) : payload(payload) {} const t payload; }; next, ...

Multithreading or Asynchronous for Python GTK/Socket Server/Data Writing -

i'm new python, socket, multithreading , asynchronous programming. i'm wondering best approach implement server receives , sends data between client such unity3d game , plot out these data in gui using python gtk while writing these data text file in real time. make things bit more complicated, data comes eyetracker receives gaze data @ speed of 300 ms. given these requirements, better use threads or async? moreover, should creating udp or tcp server exchange data? if more information needed, please let me know. thanks. use tcp. udp used things video/audio streaming. that's not case here. as async vs thread in unity, suggest go thread. easier , guaranteed network code not slowing unity down in way. unity3d game , plot out these data in gui using python gtk if receiving data eye tracker, should able plot data unity. if requirement use python still possible make server/cleint connection between unity , python app.

amazon ec2 - How can I start an instance from the new EC2 CLI? -

i have ec2 micro instance. can start console, ssh (using .pem file) , visit website hosts. using old ec2 cli, can start instance , perform other actions including ssh , website access. i having trouble new ec2 cli. when "aws ec2 start-instances --instance-ids i-xxx" message "a client error (invalidinstanceid.notfound) occurred when calling startinstances operation: instance id 'i-xxx' not exist". clearly instance exists, don't message indicating. here of thinking: one difference between old , new cli the later used .pem files whereas new interface uses access key pairs. instance has access key pair associated is, have tried credentials can find, , none of them change anything). i tried created iam user , new access key pair it. behavior in cases unchanged (start console or old cli, web access, ssh) not using new cli. i realize there means updating access key pairs detaching volume (as described here ), process looks little scary me. i...

symfony - Getting current route twig -

Image
i want current route on twig , used 2 code fail code 1: {% if app.request.get('_route') == 'my_route' %} //do {% endif %} code 2: {% if app.request.attributes.get == 'my_route' %} //do {% endif %} use "app_dev.php" @ end of url debug , check route being used @ bottom. example show "route1" here: then in twig template can use this: {% if app.request.attributes.get('_route') == 'route1' %} <h1>test</h1> {% endif %} i verified works. i'm using symfony3 though. maybe try instead of "app.request.attributes.get()", try these: app.request.pathinfo app.request.uri see if work. also if route indeed null , try: {% if app.request.attributes.get('_route') == '' %} <h1>test</h1> {% endif %}

Indenting in a txt file from python script in terminal -

im trying write python script make txt file if there isn't current 1 , add "indent me somewhere onto next line" text it. wondering how text indented in middle of string onto next line least amount of python. everyone. import sys if not os.path.exists(/users/you/desktop/aimemory.txt) : memory = open("aimemory.txt","w") print("created new memory") else : print("accessing memory") memory = open("aimemory.txt", "r") print(memory.read()) memory.close() memory = open("aimemory.txt", "a") memory.write("indent me somewhere onto next line") you need put tab character , linefeed @ end, like: memory.write("\tindent me somewhere onto next line\n")

php - Set time zone for strtotime function -

i'm setting daily countdown deadline date. code works fine. the issue that, according php manual , function use default time zone: each parameter of function uses default time zone unless time zone specified in parameter. i need able specify time zone. the sections i've read in manual not entirely clear how this. here's code: <?php $date = strtotime("september 30, 2016 11:59 pm"); $remaining = $date - time(); // number of seconds remaining $days_remaining = floor($remaining / 86400); $hours_remaining = floor(($remaining % 86400) / 3600); // display final 5 days echo "$days_remaining days remaining"; ?> is there simple way integrate pacific time zone code above? my guess make first line of code: date_default_timezone_set('america/los_angeles'); but i'm not sure work , don't want change time zone other scripts. i'm open alternative methods achieving goal. you can capture existing defaul...

How can I style and animate a checkbox with jquery? -

i have html checkbox input on frontend interface. all want know is, best way go styling standard tickbox nicer? maybe slider-switch? i don't want individual browsers styling how want to. should use pure jquery, or jqui, or there plugin? there plugins this, start, want animate tickbox. http://damirfoy.com/icheck/ this solution: http://tympanus.net/codrops/2013/10/15/animated-checkboxes-and-radio-buttons-with-svg/ the article comes source code in depth explanation. know it's been forever since question asked thought relay it's been helpful me.

ruby on rails - Active record get all instance that do not match condition -

i have following ar query returns array of rooms (the rooms not available in time period given) : rooms = room.joins(:bookings).where("(bookings.start_date >= ? , bookings.start_date <= ?) or (bookings.end_date >= ? , bookings.end_date <= ?) or (bookings.start_date <= ? , bookings.end_date >= ?)", from, to, from, to, from, to) i want modify query returns other rooms; ones available in requested time period. right result givent following : all_rooms = room.all available_rooms = all_rooms - rooms but directly want available rooms in single query. added .not doesnt give me right result : rooms = room.joins(:bookings).where.not("(bookings.start_date >= ? , bookings.start_date <= ?) or (bookings.end_date >= ? , bookings.end_date <= ?) or (bookings.start_date <= ? , bookings.end_date >= ?)", from, to, from, to, from, to) how should modify query ? let's say: a = (bookings.start_date >= ? , bookings.start...

linux - create password for user with only ssh key -

i have user on linux machine. user logs in using ssh key. user not have password. want create password user, password required access application (r-studio server) trying run. to create password user, can use: sudo passwd youruser

java - How to check the size() or isEmpty() for ConcurrentLinkedQueue -

i trying prototype simple structure web crawler in java. until prototype trying below: initialize queue list of starting urls take out url queue , submit new thread do work , add url set of visited urls for queue of starting urls, using concurrentlinkedqueue synchronizing. spawn new threads using executorservice . but while creating new thread, application needs check if concurrentlinkedqueue empty or not. tried using: .size() .isempty() but both seem not returning true state of concurrentlinkedqueue . the problem in below block: while (!crawler.geturl_horizon().isempty()) { workers.submitnewworkerthread(crawler); } and because of this, executorservice creates threads in limit, if input 2 urls. is there problem way multi-threading being implemented here? if not, better way check state of concurrentlinkedqueue? starting class application: public class crawlerapp { private static crawler crawler; public static void...

vsts - How to sign the assembly in Visual Studio Team Services Build definition -

i need create build definition in team services, visual studio online, want sign assembly , manifest file after build. basically have key file in server, want load , sign assemblies , manifest files click-once application. could please me on how do? note: i know manually going visual studio project properties->signing tab , select checkbox options , publish, want part of build definition out of box in vsts you're using hosted agent, server tfs installed on builds solution. since you'll need code signing certificate installed on build server you'll need connect own agent vsts has tfs installed on it. upside using own build server maximum flexibility, have maintain infrastructure. in past route had take in order build , sign clickonce outlook addin.

Return more than one value or an array from a function in C without using pointer or structure -

can return more 1 value function or array without using pointer or structure? if yes,then how? you can't. in c, every function returns either no value, not return or returns 1 value. can't return more 1 value except using 1 of things exclude or writing value global variable caller can read, that's bad idea.

utf 8 - VIM - no UTF-8 in menu -

Image
i added set encoding=utf-8 _vimrc file. text in files ok in menu there no utf-8 letters. problem here? without set encoding=utf-8 there no utf-8 in files menu ok. problem exists in gui menu (as on pictrure). file encodings ok. i solved it. added lines config file: set langmenu=pl_pl let $lang = 'pl_pl' source $vimruntime/delmenu.vim source $vimruntime/menu.vim

c# - Class in a list -

i understand in c# class passed reference. mean when store said class in list stored reference well, or better said c# style "pointer" of sorts? mean list n elements of class not take memory n times size of class n times size of reference class? or thinking wrong? you're right. if create n elements of class t, , class t uses, say, 10 bytes, takes on order of 10*n memory. if store in list<t> , still have 10*n memory objects, plus n times size of c# reference , list overhead. if store same elements in 2 lists, have 10*n objects, plus 2*n references, , 2 times list overhead. they're pointing @ same underlying objects.

java - How to create a two dimensional parcelable array of parcelables: -

i have following parcelable object: public class cgamecard implements parcelable { ... private int mx; private int my; private string mobjectname; private int mstate; public cgamecard(int ax, int ay, string aobjectname) { mx = ax; = ay; mobjectname = aobjectname; mstate = card_state_not_matched; } public int getx() { return mx; } public int gety() { return my; } public string getobjectname(){ return mobjectname; } public int getstate() { return mstate; } ... @override public int describecontents() { return 0; } @override public void writetoparcel(parcel dest, int flags) { dest.writeint(this.mx); dest.writeint(this.my); dest.writestring(this.mobjectname); dest.writeint(this.mstate); } protected cgamecard(parcel in) { this.mx = in.readint(); this.my = in.readi...