Posts

Showing posts from January, 2015

c# - DataView.Count() returns more than one value -

i'm kinda new i'll try specific possible.. i'm trying create button that'll display 2 dates in form. i've written this: dataview dv = new dataview(datacomerciodataset.comex); dv.sort = "id"; int ixe = dv.find(idtextbox.text); datetime embarque = convert.todatetime(dv[ixe]["fechaembarque"]); otherform.fechaembarquedatetimepicker.value = embarque; datetime vencimiento = convert.todatetime(dv[ixe]["fechavencimiento"]); otherform.fechavencimientodatetimepicker.value = vencimiento; otherform.idbox1.text = dv[ixe]["id"].tostring(); this.comextableadapter.fillby3(this.datacomerciodataset.comex, c41textbox.text); now, when click button catches exception showing it's dbnull object. decide test adding this: if (dv.count == 1) { messagebox.show("1"); } if (dv.count == 0) ; { messagebox.show("0"); } and shows both! since exception states it's dbnull reckon dv.find must returning 0, figure th

regex - Weather data scraping and extraction in R -

i'm working on research project , assigned bit of data scraping , writing code in r can extract current temperature particular zip code site such wunderground.com. may bit of abstract question know how following: can extract current temperature of particular zip code doing this: temps <- readlines("http://www.wunderground.com/q/zmw:20904.1.99999") edit(temps) temps //gives me source code website can @ line contains temperature ldata <- temps[lnumber] ldata # have few gsub functions extracts # numerical data (57.8 example) line of code i have cvs file contains zip code of every city in country , have imported in r. arranged in table according zip, city , state. challenge write method (using java analogy here because i'm new r) extracts 6-7 consecutive zip codes (after particular 1 specified) , runs above code modifying link within readlines function , putting in respective zip code after link segment zmw:xxxxx , running afte

debugging - Which debugger works with a "16 bits C to assembly" hybrid program? -

(it not mere recommendation question; couldn't find debugger myself. guess not breaking rules?) the program's compiled turbo assembler, turbo linker , borlandc compilers. in intel x86 architecture. (i required use outdated programs; not choice.) is there simple debugger go it? need track contents of registers, variables , flags during program's execution.

python - How can I create an empty Pandas DataFrame with specific columns? -

this question has answer here: setting columns empty pandas dataframe 2 answers i've got dataframe initialized same columns, doesn't have data: import pandas pd data = [] df = pd.dataframe(data, columns=['a', 'b', 'c']) but fails error: traceback (most recent call last): … valueerror: shape of passed values (0, 0), indices imply (3, 0) how can create empty dataframe columns? as of pandas version 0.16.1 , passing data = [] works: in [85]: df = pd.dataframe([], columns=['a', 'b', 'c']) in [86]: df out[86]: empty dataframe columns: [a, b, c] index: [] for older versions of pandas, don't pass data : in [69]: df = pd.dataframe(columns=['a', 'b', 'c']) in [70]: df out[70]: empty dataframe columns: [a, b, c] index: [] or pass data=none : in [71]: df = pd.da

domain driven design - Normalized or Denormalized Data in Microservices and Service Composition -

so our development team has been working towards microservices past 6-8 months , have picked lot of steam. we have experienced several gotcha moments in time, , humble enough know in many more move closer moving our platform production. one area can't quite put finger on how treat our data between our service boundaries. hear lot of statements form large companies have implemented microservices, can never seem straight advice , reasoning. specifically, given 2 service domains user , contacts ,and assuming user has contact object associated it, options each of these 2 service domains in regards managing own data? should user have contactid stored it, or should store entire contact object? i have seen many reliable service oriented development teams (netflix,amazon,nike,etc) make statements such following: "normalization root of evil..." "break shared..." "share nothing..." well, statements wrong. modularisation findi

sorting - Sort same value column by second column using Java Comparator -

i having trouble adding column on sorting have. have list , column info sort follow: void sortresults(mytablemodel model, list<myresultdetail> list) { collections.sort(list, new beancomparator(model.getsort(), new comparator<comparable>() { @override public int compare(comparable o1, comparable o2) { if(o1 == null) { return -1; } else if(o2 == null) { return 1; } else if(o1.) else { return o1.compareto(o2); } } })); } in above code using field name mytablemodel sort result. works fine if sorting on 1 column. trying add sorting based on 2 columns. for example class myresultdetail { private string firstcol; private string secondcol; private string thirdcol; ..... } if user want sort secondcol have sort equal secondcol value firstcol .

passport.js - PassportJS, AngularJS, $rootScope function is not defined -

i’m building app 1 admin able log in , edit content. when logged in app serve private html doc structure instead of not logged in being presented normal public docs. i’m using angular-route, session , passport authentication. want check if user logged in whenever link page on site. so, if go somewhere they’re not authorized be, can’t edit content on site. i’m getting $injector:modulerr when run app on localhost. referenceerror says checkauth not defined. i tried creating global variable using $rootscope suggested here : app.run(['$rootscope', '$http', function($rootscope, $http){ $rootscope.checkauth = function(){ console.log("rootscope things happening"); $http.get('/login/loggedin').success(function(user){ if (user !== '0') { console.log('authenticated'); return true; } else { console.log('not authenticated');

java - javax.jms.ConnectionFactory only connecting when logged in a root -

i executing following code on rhel 6 box root , runs perfectly. when execute user lesser permissions javax.naming.namingexception: failed connect server. servers tride: [remote://myserver::myport]. seems permission issue have of files program accesses set 777. what causing happen? update apparently not resolve host name ip address unless root. using ipaddress instead (i use iputils resolve later). getting follwoing errors: javax.jms.jmsexception: failed create session factory @ org.hornetq.jms.client.hornetqconnectionfactory.createconnectioninternal(hornetqconnectionfactory.java:587) @ org.hornetq.jms.client.hornetqconnectionfactory.createconnection(hornetqconnectionfactory.java:107) @ myclass.run(myclass.java:172) @ java.lang.thread.run(thread.java:744) caused by: hornetqexception[errortype=not_connected message=hq119007: cannot connect server(s). tried available servers.] @ org.hornetq.core.client.impl.serverlocatorimpl.createsessionf

When calling the jquery function php is returning other columns -

this jquery: <script> (function($) { $(document).ready(function() { var $container = $("#info_e1"); var refreshid = setinterval(function() { $container.load('stare-e1.php'); }, 5000); }); })(jquery); </script> inside table have <tr id='info_e1'> <?php include 'stare-e1.php'?> </tr> and php looks this: <?php ...... $stmt = $db->query($query); $result = $stmt -> fetchall(); foreach( $result $row ) { echo "<td><strong>producator</strong></td>"; echo "<td>".$row['producator']."</td></tr>"; echo "<tr><td><strong>microcontroler:port</strong></td>"; echo "<td>".$row['uc'].":".$row['port']."</td></tr>"; echo "<tr><td><stron

javascript - Async readFile module.exports in node.js -

i'm sorry for, might naive question, i`m trying figure out how node works, problem this: what need send object/file fs.readfile through require , module.exports. have tried this in 1 file (call app.js) code reading file: var fs = require('fs'); var file_contents = undefined; var callback_reader = function(err, data) { if (err) return console.error(err); file_contents = data.tostring().split('\n'); } module.exports = { parsefile: function(file_path) { fs.readfile(file_path.tostring(), 'utf-8', callback_reader); } } and in other file, (call main.js) need use contents of file read readfile this var file_importer = require('./app.js') file_importer.parsefile(real_path_to_file); but if try console.log of last line undefined object. know because callback not execute before console.log i`m unsure how achieve communication. so changed code little bit use callbacks. seems can't use "return" asyncronous f

javascript - PHP Cookie Not Setting via AJAX -

i'm trying set php cookie via ajax. i'm putting 1 variable ("listingid") cookie name. if hard code name (eg. "cmappin220") cookie sets correctly, require variable in name identify it. ajax: function myfunc(listingid){ $.ajax({ url: 'cookie.php', type: 'post', data: {listingid:listingid}, datatype: 'html' }).success(function(data){ $('.div66').html(data); }).fail(function(jqxhr, errmsg) { alert("request failed: " + errmsg); }); } in "cookie.php" this doesn't work: <?php $cookiename = 'cmappin' . $_post['listingid']; setcookie($cookiename, '1', time()+30); ?> this works: <?php $cookiename = 'cmappin220'; setcookie($cookiename, '1', time()+30); ?> your problem in post data data: {listingid:listingid} you're not quoting name of parameter it's pul

linux - Using gflags library in ubuntu -

i having problem installing gflags. if use apt-get written in ( https://github.com/gflags/gflags/blob/master/install.md ) following error sudo apt-get install gflags reading package lists... done building dependency tree reading state information... done e: unable locate package gflags how can install gflags? on ubuntu or debian machine can related packages doing this: $ apt-cache search gflags output on machine (ubuntu 14.04): libgflags-dev - commandline flags module c++ (development files) libgflags-doc - documentation of gflags libgflags2 - commandline flags module c++ (shared library) python-gflags - python implementation of google command line flags module python-google-apputils - google application utilities python so, presume install using it's full name this: $ sudo apt-get install libgflags2 libgflags-dev

quantifiers - Regex searching for time doesn't want to be non-greedy -

i'm trying run regex in spiceworks parse through email headers select first instance of time ticket assignment purposes. the regex works, picks instances of time rather one. here's regex: \.*(0[1]|1[3-7]):\d\d:\d\d i've tried make in non-greedy doing this: \.*?(0[1]|1[3-7]):\d\d:\d\d doesn't seem work. putting question mark in front of quantifier didn't purpose. what solution make regex non-greedy or pick first instance? thanks, andrew n. edit: i'm trying achieve regex "13:04:57" instead of whole date. sample string: received: 127.0.0.1 smtp id co5csp22954317qdb; wed, 6 may 2015 13:02:22 -0700 (pdt) x-received: 127.0.0.1 smtp id j185mr26699743oig.68.1430928141923; wed, 06 may 2015 13:02:21 -0700 (pdt) you can use lookahead based regex match first instance of time matched regex: /^(?:(?!(?:0[1]|1[3-7]):\d\d:\d\d).)*((?:0[1]|1[3-7]):\d\d:\d\d)/m (?!...) negative lookahead makes sure there no other instance of time before

php - Database connection error (2): Could not connect to MySQL -

i getting error on joomla site. please note: i have checked configuration file , there no error in it. i error few times day. without making change gets connected , time error appears. can please in this. thanks dani this happens when mysql server overloaded, , stops responding. if on shared hosting, should ask moved less crowded server. if on vps (with fair use policy) or on dedicated server, should enable , check slow query log slow queries causing mysql server crash.

javascript - $scope not capturing variable in Angular -

i'm having problem want understand why behaving - i'm trying use last button on html page user 'jid' chat application, , way tried ng-model='jid' , ng-model='jid.jid', while in controller trying define in few ways $scope.jid' or $scope.jid = ""; or $scope.jid = {}; i'm confused why aren't working, because when put $scope.user.jid, using $scope.user = {} assume, works fine. not when made new $scope variable $scope.jid? when that, console prints out empty object. .controller('chatctrl', function($scope, $stateparams, $rootscope, $ionicloading) { console.log("inside chatctrl"); qb.createsession(function(err,result){ console.log('session create callback', err, result); console.log(json.stringify(err)); console.log(json.stringify(result)); }); $scope.settings = {}; $scope.user = {}; $scope.error = {}; $scope.jid = {}; $scope.signinclick = function() {

php - resizing image with gd or imagick so that it cover its transparent part -

i have image customizing plugin having stage of 1000x700 user can upload his/her pic , design in stage area. now if user doesn't use full staging area , use part of stage let 800x400. final image of 1000x700 transparent background having user's design in middle of it. now question is, want stretch user design on full canvas out white background. how can using php gd or imagick (not manually)? $dstimage = imagecreatetruecolor(1000, 700); $black = imagecolorallocate($dstimage, 0, 0, 0); // make background transparent imagecolortransparent($dstimage, $black); $srcimage = imagecreatefrompng('srcimg.png'); imagecopymerge($dstimage, $srcimage, 0, 0, 0, 800, 400, 1000, 700); imagepng($dstimage, 'outputnewimg.png');

html - Css removing margin or padding in columns -

Image
removing column padding or margins create tiling effect using bootstrap 3 <div class="row"> <div class="col-md-4"> <div class="hexagon-wrapper hex_size"> <div class="hexagon"> </div> </div> </div> <div class="col-md-4"> <div class="hexagon-wrapper hex_size"> <div class="hexagon"> </div> </div> </div> <div class="col-md-4"> <div class="hexagon-wrapper hex_size"> <div class="hexagon"> </div> </div> </div> //row 2 <div class="row"> <div class="col-md-4"> <div class="hexagon-wrapper hex_size"> <div class="hexagon"> </div> </div> </div> <div class=&

unix - I'm learning about shebangs. How do I make it work with node.js in a Mac terminal? -

i have: #!/usr/bin/env node console.log("it works!"); i learned env finds node program , interprets node. checked env exists in /usr/bin. when call node itworks.js works , outputs it works! . however, understand, should able call itworks.js without node due shebang. when make command says -bash: itworks.js: command not found . could me shebang work? first of need make file executable: chmod +x itworks.js then need call specifying path well. either: /where/it/is/on/disk/itworks.js or: ./itworks.js

regex - How to write and match regular expressions in /bin/sh script? -

i writing shell script limited unix-based microkernel doesn't have bash! /bin/sh can't run following lines reasons. if [[ `uname` =~ (qnx|qnx) ]]; read -p "what dev prefix use? " dev_prefix if [[ $dev_prefix =~ ^[a-z0-9_-]+@[a-z0-9_-"."]+:.*$ ]]; for 1st , 3rd lines, complains missing expression operator, , 2nd line says no coprocess! can shed light on differences between /bin/bash , /bin/sh scripts? you can use equivalent script in /bin/sh : if uname | grep -eq '(qnx|qnx)'; printf "what dev prefix use? " read dev_prefix if echo "$dev_prefix" | grep -eq '^[a-z0-9_-]+@[a-z0-9_-"."]+:'; ... fi fi

ios - How to find the biggest text size that fits a UILabel or UIButton using autolayout? -

given layout set using constraints, how find biggest text size fits labels , buttons? you can use adjustsfontsizetofitwidth labels cares width, not height. , don't understand how button labels work... i posted answer related question , wanted ask again since other question bit forgotten , don't know how buttons.

javascript - Changing the global scope in JS -

say have iframe running inside of parent window. i have single script loaded inside iframe , want script have access variables inside of parent. rather saying window.parent.x time, possible declare: window= window.parent; inside of iframe ? window protected variable js, not able override it. can, however, store window.parent in var , use that: var parentwindow = window.parent;

logback - How to enable trace/debugging output with Anorm on Play 2.4.0 -

with play 2.4.0 anorm got moved external package , logging got changed logback ( http://logback.qos.ch ) all , class/package names obvious tracing sql calls. the "obvious" (based on import statements) <logger name="anorm" level="trace" /> did nothing , tried <logger name="anorm.sql" level="trace" /> just in case needed more specific. google searches dead needed i'm @ loss. anyone? you can intercept calls going thru jdbc driver using log4jdbc i have used jpa/hibernate , hikary on play 2.4, setup should identically since influences jdbc layer. add library build.sbt: "org.bgee.log4jdbc-log4j2" % "log4jdbc-log4j2-jdbc4" % "1.12" adjust config. add log4jdbc, log4jdbc automatically detects underlying driver string: mysql. if using obscure jdbc driver, can configure using config options - see docs below. db.default.url="jdbc:log4jdbc:mysql://l

Google Cloud Dataflow: Can't parse proto using TextIO.Read -

here's code pcollection<myproto> pcollection = p.apply(textio.read.from( "gs://my_bucket/*") .withcoder(proto2coder.of(myproto.class))); but fails error caused by: com.google.protobuf.invalidprotocolbufferexception: protocol message contained invalid tag (zero). the file when downloaded locally parses fine. i've tried same thing using stringutf8coder , bytearraycoder, no dice. any help? should not using textio? other options have? textio splits file lines , applies coder each line. naturally, doesn't work formats not line-based. suppose files contain single serialized proto each, correct? in case have 2 options: create own source , reader classes (see generic documentation on creating sources , sinks ) subclassing filebasedformat . treat act of processing files pardo - create in-memory pcollection containing filenames process (using create.of() ) , pipe through pardo takes filename , parses file protobuf;

java - Avoid creation of object wrapper type/value in MOXy (JAXB+JSON) -

i'm using moxy 2.6 (jaxb+json). i want objectelement , stringelement marshalled same way, moxy creates wrapper object when fields typed object. objectelement.java public class objectelement { public object testvar = "testvalue"; } stringelement.java public class stringelement { public string testvar = "testvalue"; } demo.java import javax.xml.bind.jaxbcontext; import javax.xml.bind.marshaller; import org.eclipse.persistence.jaxb.jaxbcontextfactory; import org.eclipse.persistence.jaxb.marshallerproperties; import org.eclipse.persistence.oxm.mediatype; public class demo { public static void main(string[] args) throws exception { jaxbcontext jc = jaxbcontextfactory.createcontext(new class[] { objectelement.class, stringelement.class }, null); marshaller marshaller = jc.createmarshaller(); marshaller.setproperty(marshallerproperties.media_type, mediatype.application_json); system.out.println("obj

dateadd() is not working as desired to find the date of 7 days from now sql-server -

i trying find date of 7 days specific date. tried select @fromdate = dateadd(day,-7, max(last_update)), @todate= max(last_update) vwabc but not working , when tried following every thing works fine. select @fromdate = '20150601', @todate = max(last_update) vwabc i cant understand, whats problem. please help. this worked me through reference stackoverflow question select @fromdate = convert(date, dateadd(day,-7, max(last_update)),101), @todate= max(last_update) vwabc

error define a template haskell function -

i beginning learn template haskell, want create function receive string param define name function generate build_p5 :: string -> [dec] build_p5 name = [ fund p1 [ clause [tupp [varp a,varp b]] (normalb (appe (vare c) (vare a))) [fund c [clause [varp a] (normalb (vare a)) []]] ] ] p1 = mkname name = mkname "a" b = mkname "b" c = mkname "ident" to run definition : $(build_p5 "hola") but when run program following error couldn't match type ‘[dec]’ ‘q [dec]’ expected type: decsq actual type: [dec] in expression: build_p5 "hola" correct code build_p2 :: monad m => string -> m [dec] build_p2 name = return [ fund p1 [ clause [tupp [varp a,varp b]] (normalb (appe (vare c) (vare a))) [fund c [clause [varp a] (normalb (vare a)) []]] ] ] p1 = mkname name = mkname "a" b = mkname "b" c = mkname "ident"

arrays - Java ArrayIndexOutOfBoundsException: 14 when using getMatrix() -

this question has answer here: how avoid arrayindexoutofboundsexception or indexoutofboundsexception? [duplicate] 2 answers i have constructor map() attributes sector , matrix creates , array of 23x14 , numerical matrix of 23x14, have constructor mapfermi() sets specific numerical matrix , names each sector according numerical value of each matrix cell, when i've run test of notnull error arrayindexoutofboundsexception on first line of getmatrix method in mapfermi constructor, isn't getmatrix()[i][j] supposed return numeric value of cell[i][j] of numeric matrix set previuosly? public class map { protected sector [][] sector; private int matrix [][]; private static final int x=23; private static final int y=14; public map (){ sector = new sector[x][y]; (int i=0; < x; i++){ (int j=0; j<y; j++) {

sitecore8 - uCommerce Product Appears on Sitecore site without publishing -

just started doing development ucommerce , sitecore way products start appear on site seems odd. in avenue clothing demo site if create new product within ucommerce admin starts appear in product listings, if click view product page 404 returned sitecore items haven't been published yet. is right? there's no way of adding / editing product without taking effect on website? or have got configed wrong. also have similar issue removing products. way can see delete product through ucommerce ui, leaves behind sitecore items. the recent version of ucommerce sitecore connector runs in live mode, experience design far know. it due performance issues on publishing. expect fix don't know of timeline it.

How to get first instance to last instance of a number in a string in javascript regex/ object error? -

i have string "{\"id\":\"35112914\"}" obtained after json.stringify . want number 35112914 or first instance of number ,i.e. 3 last ,i.e., 4 . there other way of approaching ? edit: had stringify because of weird error getting. while accessing property of object, getting undefined answer , made number inaccessible. stringify atleast shows number . edit 2 : my code written in node makes curl request rest api . curl.request(optionsrun, function (error, response) { console.log(response); settimeout(function () { id = response ; console.log(id["id"]) ; },2000) ; }) ; output: {"id":"35113281"} undefined you need parse response js object before can access using js object methods: curl.request(optionsrun, function (error, response) { var id = json.parse(response); settimeout(function () { consol

unity3d - unity 2D 5.0: collision with colliders, one with "is trigger" checked and one with "is trigger" unchecked -

i beginner in unity 5.0. it hard describe problem, included 3 images. please see following: http://frankiegamescom.ipage.com/question.html please help. thanks. i don't think should changing istrigger property of car_player in code. looks better solution: leave box colliders on car , road blocks not triggers. let grass's box collider trigger. 2d rigidbodies need on the road blocks , car. car should stop when hitting road block if you're moving correctly; rigidbody2d.addforce or velocity . if using transform.translate then think need add rect.overlaps infront of car , check collisions manually. edit: looking @ screenshots again, looks leaving cars istrigger false , leaving grass colliders istrigger true might solve problem. , maybe use ontriggerstay2d to pass multiplier drag.

javascript - Is it possible to print web content on thermal printer? -

do think it's possible print web content on thermal print ? , possible print without pressing button ? i refresh page every 30s , if there new order displays on screen , print prints directly without asking anything. created new page information print , print page. edit : there script permits print whatever content want without passing interface ?

How to not load all database records in my TListbox in Firemonkey Delphi XE8 -

i have multi device project in delphi xe8. have tlistbox component load database records. the problem list can big , loading take long. want load partially , when scroll down load new records. how do that? right load every record of table using tfdquery. update: after timing have realized problem doesn't lay loading records database, rather creating tlistboxitems in tlistbox. still want pretty same, load database records not create tlistboxitems of them. from embarcadero wiki on tfdquery can set blockreadsize for bde-enabled datasets, setting blockreadsize causes dataset fetch database information in blocks of blockreadsize records, buffers. minimizes traffic between application , database server. another thing can try fetchoptions of tfdquery have rowsetsize property i don't have @ moment firemonkey can test this.

sql - get All distinct (by ID) Users list and count only thoose who is Active -

i need distinct user list , count thoose active , like id | count | active 1 | 0 | false 2 | 1 | true 3 | 6 | true but when do select id,count(*) users active='true' group id i got distinct active id | count | active 2 | 1 | true 3 | 6 | true how write query want? you need move condition aggregate: select id, sum(case when active='true' 1 else 0 end) users group id

git - Source control - Ignore files when committing on Xcode -

there files (like break points list file -xcbkptlist) keep on emerging when commit code branch in xcode source control. have tried use git ignore in following way: i've opened textedit , add following: build/* .ds_store *.xcuserdatad *.xcbkptlist i saved file in root directory of project , named .gitignore files still emerged. all needed make work: add git ignore file project tree. remove file don't want committed, commit , , add the file again.( files ignore still being tracked) another way remove them git manually using: git rm --cached <files>

how to create tablespace with set initial size in Postgresql? -

i have, in oracle, following sql command create tablespace initial size: create tablespace tb1 datafile 'file.f' size 10m autoextend on; i didn't find same sql command postgresql. according research there is't possibility set field in postgres. i need set because increases performance of application. in short: can't the way oracle stores data different way postgres it. postgres doesn't store in single (tablespace) file way oracle it. a tablespace not file in oracle it's directory postgres stores files tables located in tablespace. , because it's directory "pointer", there no initial size can specify.

php - SQL join table in array fields -

is real select data multiple tables inner join and put in array field? example have tables users, user_details, user_clients table users have next columns: [id, login, password] table user_details have: [first_name, last_name, profile_pic, fk_userid] and table user_clients contains information clients belong user: [client_name, client_phone, client_address, fk_userid] one user can have many clients user_clients . so can data next sql queryes: $usergeneraldata = $db->query("select * users inner join user_details on(users.id = user_details) users.id = 13"); and query user clients array $arruserclients = $db->query("select * user_clients fk_userid=13"); but can same, 1 query? clean output without duplication , array field of user_clients ? if i'll use typical inner join user_clients duplication data, this: [0] => array ( [id] => 13 [login] => rob [password] => 123 [first_name]

mysql - Rails Active Record group or ignore duplicate results from query -

Image
i have active record query returns list of tags search query. i'm rendering json use in tag search. the issue query return multiple tags of same kind. there ignore multiples or group multiples? here's query (sorry it's quite long one): tag.joins("inner join taggings on taggings.tag_id = tags.id inner join posts on taggings.taggable_id = posts.id inner join buckets on posts.bucket_id = buckets.id inner join memberships on memberships.bucket_id = buckets.id").where(memberships: {user_id: current_user.id, accepted: true}).where("name ?" , "#{params[:query]}%") for example, when search 'illustration' 2 posts tagged illustration returned , i'd group one: thanks! you should able chain .uniq onto end of query bring unique records. or try .distinct http://apidock.com/rails/activerecord/querymethods/distinct

c++ - wxButton still looking selected after next button gets selected -

there several wxbutton on panel. wxbutton blinks when focused, after new button gets selected, previous not stop blink. 2 of them looking selected, e.g. if third gets selected first 1 looks fine etc. i tried stopping propagation of setfocus events, subclassing wxbutton , overriding methods bool acceptsfocusfromkeyboard() const { return false; } virtual bool acceptsfocus() const { return false; } but without results. this happens on windows 7, win 8.1 , mac looks expected. anyone had same problem? you shouldn't have special focus work correctly, make sure not intercept, without skipping, focus events doing can indeed break things mentioned in documentation . if can reproduce problem simple changes in 1 of wxwidgets samples wxwidgets 3, please open ticket explaining how it.

google app engine - The remote RPC to the application server failed for the call datastore_v3.Put() -

i'm using google app engine, java, managed vm , maven-gcloud-plugin. when run app locally (mvn gcloud:run) random exceptions when write datastore (via objectify) saying: the remote rpc application server failed call datastore_v3.put() my code doesn't more that public class testdaoimpl implements testdao { @override public void save(test test) { ofy().save().entity(test).now(); } } on actual app engine instance, seems run fine though... does know why happening , how prevent it? thanks

javascript - Access json data from angularjs -

here json file: { "countries":[ { "country": "india", "cities" : [{ "name": "bangalore", "rank": "40" }, { "name": "mumbai", "rank": "32" }, { "name": "kolkata", "rank": "54" }, { "name": "chennai", "rank": "42" }] }, { "country": "china", "cities":[{"name": "guangzhou", "rank": "111" }, { "name": "fuzhou", "rank": "21" }, { "name": "beijing", "rank": "90" }, { "name": &qu

mysql - Yii2 : Getting unknown property when using findBySql -

i'm using findbysql() data database, want show data in view table. this code on controller : $sql = "select presensi.presensi_tanggal 'tanggal', sum(if( hadir.keteranganhadir_id='1',1,0)) 'hadir', sum(if( hadir.keteranganhadir_id='2',1,0)) 'tidak_hadir', count(*) 'total' hadir, keteranganhadir, presensi hadir.keteranganhadir_id = keteranganhadir.keteranganhadir_id , hadir.presensi_id = presensi.presensi_id group presensi.presensi_tanggal"; $model = hadir::findbysql($sql)->all(); return $this->render('index', [ 'hadir' => $model, ]); so, want show 'tanggal', 'hadir', 'tidak hadir' , 'total'. in view, <?php foreach($hadir $data): ?> <tr> <td></td> <td class="tbl_column_name"><?=$data->tanggal;?></td> <td class="tbl_column_name"><?=

ip - List ALL devices on local network? -

i have tried arp -a lot , has listed some devices, not of them. ifconfig shows ip address , mac address , other useful information, doesn't show of devices on local network. there command shows ip addresses? arp -a show mac addresses stored in local arp cache , computer connected to. when i'm trying see every device in local network have scan it. example if have 192.168.1.0/24 network can do: $ in `seq 1 254`; ping -c 1 -q 192.168.1.$i & done you try ping every computer in network. of course not every computer answer ping. why can't rely on ping. need check arp cache. $ arp -a | grep 192.168.1. | grep ether this command show arp cache filtered computers in network , answered on arp requests (in 99% cases full list of devices in network - remember arp entry not removed when device disconnects).

php - Docker and package managers in production -

i'm developing php application want have running using docker containers. i'm using composer package manager pulls in dependencies. code kept in git repository except dependencies. to running on local machine i'm using docker-compose (fig). mount application code (include vendor folder) volume on containers. here docker-compose.yml file. nginx: image: nginx:1.9 links: - php volumes: - conf/nginx/default.conf:/etc/nginx/conf.d/default.conf - src:/var/www/html ports: - "80:80" php: image: php:5.6.9-fpm links: - memcached volumes: - conf/php/php.ini /usr/local/etc/php/php.ini - src:/var/www/html volumes_from: - nginx what don't understand how push production or staging environment. understand it's best ship in container without having run package manager, because might fail or packages might not identical packages on local machine. came following docker-

java - Why android studio 1.2.1.1 automatically only support ONE test file? -

Image
i wanted add 2 different test files in project. 1 instrumental tests , other 1 junit tests. i have added src/androidtest/java file project. worked perfectly, java file changed color green, when added src/test/java didn't work. file appears in gold(?) , not reconised automatically ide. i thought problem of gradle configuration , tried reconfigure build.gradle , didn't work. so started clean branch , added, firstly, file /src/test/java see going happend. worked. green. couldn't add /src/androidtest/java, because not reconized. why happening? can have both files @ same time? first: second: tap on "build variants" view, docked default on left side of android studio window. you see, towards top, drop-down entitled "test artifact". choices there "android instrumentation tests" , "unit tests". controls whether androidtest/ or test/ being actively managed ide @ point in time. reminiscent of how android studio ha

Insert hyperlink to a local folder in Excel with Python -

the piece of code reads excel file. excel file holds information such customer job numbers, customer names, sites, works description ect.. what code when completed (i hope) read last line of worksheet (this taken counter on worksheet @ cell 'p1'), create folders based on cell content, , create hyperlink on worksheet open lowest local folder created. i have extracted info need worksheet understand folders need created, not able write hyperlink cell on row in column b. #insert hyperlink folder def folder_hyperlink(last_row_position, destination): cols = 'b' rows = str(last_row_position) position = cols + rows final_position = "".join(position) print final_position # check value # statement below should insert hyperlink in eps.xlsm > worksheet jobnoeps @ column b , last completed row. ws.cell(final_position).hyperlink = destination the complete code below here section meant create hyperlink. have tried 'xlswriter&#

php - How to enable warning for mismatched typehint for method call? -

Image
i have method expecting int : /** * @param int $someint */ public function methodexpectingint($someint) { // stuff } yet when called somewhere when passing object it, warning occur in phpstorm. /** * @return void */ public function somemethod() { $this->methodexpectingint(23); // no warning int fine $this->methodexpectingint(new \object()); // gets warning in phpstorm \o/ $this->methodexpectingint("this string should issue warning"); // no warning yet string $this->methodexpectingint(null); // no warning yet null $this->methodexpectingint(2.9); // no warning yet float } it this:

What does "=>" mean in Scala? -

what "=>" mean in example below? trait myservice[e <: entity[id]] extends management { this: repository[e] => // code } in example means this has of type repository[e] . means trait myservice can mixed classes extending repository[e] .

php - website not working after moving from local to the server -

am using codeigniter 2.2 , os ubuntu 14.04 . have developed website using codeigniter on localhost. working fine. now have moved site real server http://hotlunchorders.com/ . getting error. internal server error server encountered internal error or misconfiguration , unable complete request. please contact server administrator, webmaster@hotlunchorders.com , inform them of time error occurred, , might have done may have caused error. more information error may available in server error log. additionally, 500 internal server error error encountered while trying use errordocument handle request. my .htaccess file rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule .* index.php/$0 [pt,l] errorlog file in server [thu jun 04 08:00:35 2015] [error] [client 67.213.90.137] softexception in application.cpp:256: file "/home/hotlunchorders/public_html/index.php" writeable group [thu jun

What is the point of maven's OpenPGP signatures if anyone can create and upload any keys? -

sonatype requires (non-snapshot version) artifacts gpg-signed; public openpgp keys should uploaded (mit) key server. but can create openpgp key name e-mail , upload them key server. there (as far know; or wrong?) no automatic mechanism in place associate particular software project/library particular public key. sure, if wants check authenticity of artifacts, 1 can request public key software authors, or perhaps key published somewhere (in way associates particular software project); since can not done automatically, hardly ever it. so seems whole openpgp-signing procedure, being quite technical , time-consuming, serves more instill false sense of security providing security average user. so shouldn't there automatic/streamlined way associate software projects openpgp keys make whole thing secure? applying openpgp signatures allows others verify authorship through web of trust. indeed is rather complicated approach rather steep learning curve, not enforced defa

jQuery Regex not triggering if statement -

** edit ** regex not accepting lowercase. adding did trick. additionally had escape \ out again in order past part of regex work. working 1 jquery following: var email = new regexp('^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,4}$', 'i'); i want verify email regex. in current code see executing function not going if statement though regex matches. $('#email').keyup(function() { var input = $(this).val(); var email = new regexp('^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$'); if (email.test(input)) { console.log('inside if'); } console.log('outside if'); }); regex seems fine, need set case insensitive flag: $('#email').keyup(function() { var input = $(this).val(); var email = new regexp('^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$', 'i'); if (email.test(input)) { console.log('inside if'); } console.log('outside if'); });

sql-server-2008 R2-split-time-intervals-given-by-starttime-endtime-at-selected-point -

i have table has following data create table #tempstudentschedulingrecord( seq_id int identity(1,1), student_id int , periodnumber int , cpstarttime datetime , cpendtime datetime , dateitem datetime , firstsegmentendtime datetime, secondsegmentendtime datetime ) now insert #tempstudentschedulingrecord values(2730,1,'1900-01-01 07:25:00.000','1900-01-01 08:20:00.000','2010-10-05 00:00:00.000','2015-05-27 09:45:00.000','2015-05-27 16:00:00.000') insert #tempstudentschedulingrecord values(2730,1,'1900-01-01 08:25:00.000','1900-01-01 10:00:00.000','2010-10-05 00:00:00.000','2015-05-27 09:45:00.000','2015-05-27 16:00:00.000') insert #tempstudentschedulingrecord values(2730,1,'1900-01-01 10:05:00.000','1900-01-01 11:35:00.000','2010-10-05 00:00:00.000','2015-05-27 09:45:00.000','2015-05-27 16:00:00.000') now here firstsegmenttim

ruby on rails - Gem::Ext::BuildError: ERROR: Failed to build gem native extension. - tharindu -

gem::ext::builderror: error: failed build gem native extension. c:/railsinstaller/ruby2.1.0/bin/ruby.exe extconf.rb invalid drive specification. unable imagemagick version * extconf.rb failed * not create makefile due reason, lack of necessary libraries and/or headers. check mkmf.log file more details. may need configuration options. provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=c:/railsinstaller/ruby2.1.0/bin/ruby extconf failed, exit code 1 gem files remain installed in c:/railsinstaller/ruby2.1.0/lib/ruby/gems/2.1 .0/gems/rmagick-2.15.2 inspection. results logged c:/railsinstaller/ruby2.1.0/lib/ruby/gems/2.1.0/extensions/x86 -mingw32/2.1.0/rmagick-2.15.2/gem_make.out error occurred while inst

email - How can i block web mail URL from public access? -

i looking solution block web mail url public access. for. e.g: http://mail.sample.com/ or http://sample.com/webmail i need block url public access.how can it? you need ask authentication & or authorization on page , check on code depending on framework u use. can basic authentication, digest authentication, forms-based authentication, etc. otherwise u may restrict server accept specific ip addresses.

database - DB bulk validation and upload -

i designing application involve bulk upload of records postgres db (lets call schema db-1). uploads done every week. size range few million billion records. data going uploaded needs validated/cleansed first need conform constaints , format of db-1. thinking of adopting following approach: everytime new upload needs done, new schema created (lets call db-2 - staging place) same db-1 but lenient constraints . make sure data gets loaded in db-2 start with. run validation process on data. thinking middleware process when realized amount of data processed, kind of started thinking coding validation+cleansing layer in db - set of stored procs run on db-2, check data , generate report records not conform rules (ie constaints present in db-1, data format etc). after this, data needs changed again @ source, step 1 repeated , if looks ok, select db-1 db-2 shift valid data final desitnation. what opinion on above process? obvious/hidden issues see here? suggestions make better welcom

python - Is it possible to list instances with no VPC using Boto get_only_instances()? -

there aws account instances in vpc , in ec2 classic. try list them separately using get_only_instances() method, seems filters doesn't work not set argument (vpc:none). import boto import boto.ec2 conn = boto.ec2_connect_to_region('us-east-1', profile_name='qa') = conn.get_only_instances(filters={'vpc_id':'vpc-a0876691'}) # len(a) > 0, , should b = conn.get_only_instances(filters={'vpc_id':none}) # len(b) = 0, should > 0 btw. see following approach work fine: b = [i in conn.get_only_instances() if not i.vpc_id] # len(b) > 0, , should the call get_only_instances ends making call describeinstances endpoint in api . specifically, boto use filter 'vpc-id', stated in above linked documentation 'the id of vpc instance running in.' unfortunately, haven't found way query via boto denote boolean "not" operation. i'm adding answer state don't think it's possible. to work arou

ios - Merging two recorded videos gives opposite orientation output -

i trying merge 2 recorded videos code: func exportvideo3() { transprentview.hidden = false activityindicator.startanimating() let composition = avmutablecomposition() let trackvideo = composition.addmutabletrackwithmediatype(avmediatypevideo, preferredtrackid: cmpersistenttrackid()) let trackaudio = composition.addmutabletrackwithmediatype(avmediatypeaudio, preferredtrackid: cmpersistenttrackid()) var inserttime = kcmtimezero let path = nsfilemanager.defaultmanager().urlfordirectory(.documentdirectory, indomain: .userdomainmask, appropriateforurl: nil, create: false, error: nil)!.path! index in 1...2 { let movieurl = index == 1 ? video1url : video2url let sourceasset = avurlasset(url: movieurl, options: nil) let tracks = sourceasset.trackswithmediatype(avmediatypevideo) let audios = sourceasset.trackswithmediatype(avmediatypeaudio) if tracks.count > 0{ let assettrack:avassettrack = tracks[0]