Posts

Showing posts from January, 2014

c# - Add existing Web Api project to existing Mvc project -

i have 2 projects in solution, mvc project , web api project. best way go utilizing web api project within mvc application? options have come far: deploy both projects , use helper class interact api (javascript or server side) add reference web api project adds api functionality mvc project (not sure how integrate api project mvc project correctly, how this?) if there better alternative please share. in folder controllers have files this: namespace beerdev.controllers { public class homecontroller : controller { public actionresult index() { viewbag.title = "home"; return view(); } } } and create folder called controllersapi files this: namespace beerdev.controllersapi { public class homecontroller : apicontroller { public ihttpactionresult get() { string beers; using (streamreader sr = new streamreader(hostingenvironment.mappath("~/mo

sql - Returning all data in one row -

in postgresql database, have multiple reference data tables. example: - gender(id:serial, name:varchar) - sexuality(id:serial, name:varchar) - location(id:serial,name:varchar) to retrieve of information in of tables doing 3 separate select statements. example: - "select name gender; - "select name sexuality; - "select name location; how can make 1 call returns 1 row this: referencedata(allgenders:varchar[], allsexualities:varchar[], alllocations:varchar[]) i able able client side --> var genders = results.row[0].allgenders; gender in genders { print(gender); } you can use array_agg aggragate function combine values multiple rows single array, e.g. select array_agg(name) gender will return genders single array. if want information 3 tables @ once, can that: select (select array_agg(name) gender), (select array_agg(name) sexuality), (select array_agg(name) location);

java - How to pass the name of the fragment to an Asynctask class? -

i have class works fine, because put name of fragment need receive information back... class call more 1 fragment need pass name parameter don't know how pass , how receive it. this async class public class asyncfragment extends asynctask<string, void, string> { subirfotos container; public asyncfragment(subirfotos f) { this.container = f; } @override protected string doinbackground(string... params) { try { thread.sleep(3000); // takes 3 seconds }catch(exception ex) {} return "dni activo "+params[0]+ " " + params[1]; } @override protected void onpreexecute() { super.onpreexecute(); container.showprogressbar(); } @override protected void onpostexecute(string result) { super.onpostexecute(result); // activity can null if thrown out android while task running! if(container!=null && container.getactivity()

powershell - How to get the Windows install date of virtual machines in a cluster? -

i have 127 virtual machines in hyper-v cluster 6 nodes. i'm trying nice list of windows install dates each vm using powershell. have far, returns install dates of nodes. $clusternodes = get-clusternode foreach($item in $clusternodes) { gcim win32_operatingsystem | select name, installdate } how extend grabs info vms instead of nodes themselves? i don't have hyper-v host (much less cluster) @ hand, i'd try following: enumerate cluster nodes enumerate vms on each node get network adapter each vm expand ip address(es) each adapter , select one run get-wmiobject query against each selected ip address something (untested): get-clusternode -cluster clustername | foreach-object { get-vm -computer $_.name | get-vmnetworkadapter | select-object -expand ipaddresses | where-object { $_ -like '192.168.23.*' } | foreach-object { get-wmiobject -computer $_ -class win32_operatingsystem | select-object __server, name,

ios - Save number in Label even when restart app -

i'm trying save number tapped on button shown on label. want number tapped on button save in label when close app , add additional tapps saved number. import uikit import iad class viewcontroller: uiviewcontroller, adbannerviewdelegate { @iboutlet var taplabel: uilabel! @iboutlet var banner: adbannerview! var taps = 0 override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. banner.hidden = true banner.delegate = self self.candisplaybannerads = true } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } func bannerviewactionshouldbegin(banner: adbannerview!, willleaveapplication willleave: bool) -> bool { return true } func bannerviewdidloadad(banner: adbannerview!) { banner.hidden = false } @ibaction func button(sender:

javascript - parse js file for Java Application -

i'm using jsoup parse html website. there 2 option lists dynamically created multidimensional array in javascript file. since dynamically created jsoup can't parse results in html. however, data need located in js file. ideally i'd able periodically load file , persist / refresh array data file local database on android application. js file in question here , website showing lists here there way download selected aspects of file manipulate in java, dom in html? you use webview javascriptinterface or use rhino engine. latter approach described below. first download rhino (current version 1.7.7.1) copy rhino jar (e.g. rhino-1.7.7.1.jar ) lib folder libs folder in android project. add build.gradle (module: app) file dependency: dependencies { [other dependencies] compile files('libs/rhino-1.7.7.1.jar') } the following example activity loads script file, modifies script (see comments) , executes functions populate arrays. arrays retr

regex - RE to NFA Thompson's construction steps ((c|a)b*)* -

Image
i tried convert ((c|a)b*)* nfa using thompsom's construction have understood wrong because outcome isn't 1 supposed be. glad if point mistake. thompson's construction rules: 1)every nfa has start state , accepting state. 2)no transition, except starting one, allowed enter start state. 3)no transition exits accepting state. 4)an ε-transition connects 2 states used start or accepting states res 5)a state can have @ maximum 2 incoming , 2 exiting ε-transitions 6)a state can @ maximum 1 incoming , 1 exiting transition specific character of alphanumerics used. step 1 : created nfas each character step 2 : parenthesis have priority created c|a step 3 : created b* step 4 : combined c|a , b* create (c|a)b* step 5 : , @ last created ((c|a)b*)* the difference correct solution in last nfa (the example doesn't show steps , states got renumbered in end) there no s9. s8 ε-transists s5 , s5 ε-transists s10. makes sense me if b* didn't have s9 sta

android - How to get a custom toolbar aligned with the action bar? -

Image
in order action-buttons toolbar, have implemented custom-toolbar in layout button images can defined. in activity_main layout file, refer custom-toolbar layout via include instruction. it works extend in 1 line @ top of action bar both contents appear: program title , overflow menu icon plus button custom-toolbar. problem below line second empty row appears no content. means, height of action bar doubled , unwanted area overlapping canvas. here screenshot of phenomena: i have searched documents addressing did not find mapping case. furthermore have tried kind of constellations in layout file (e.g. in respect postion of include instruction) did not achieve change. tried different sizes of image file without change. current size 3k 80x49 pixel. here code reduced show case relevant lines: import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.support.v7.widget.toolbar; import android.view.menu; import android.view.view; public class mainac

typescript - get child element in angular 2 -

please have @ below code. import { component,viewchild,querylist,viewchildren } '@angular/core' @component ({ selector : 'other-component', template : ` <h2>othercomponent<h2> <table #tab id="tab"> <tr *ngfor="let val of valarray"> <td>{{val}}</td> <input type="checkbox" [value]="val"> </tr> </table> <button (click)="getchecked()">click me</button>` }) export class othercomponent{ valarray = ['one','two','three','four']; @viewchild ('tab') elem; getchecked = () => { console.log (this.elem.nativeelement.children[0].children) } } at end of table row there checkbox has been assigned row value (json object) want collect checked boxes in angular 2. in plain javascript can below var yy = document.getelem

scala - Slick cannot change HikariCP connectionTimeout -

i'm trying change maximumpoolsize , connectiontimeout parameters hikaricp slick database, here settings inside of application.conf testnet3databaseurl { datasourceclass = "slick.jdbc.databaseurldatasource" driver = "slick.driver.postgresdriver$" db { driver="org.postgresql.driver" url="jdbc:postgresql://localhost:5432/bitcoins-spv-node-testnet3" user="bitcoins-spv-node-admin" password="" queuesize=5000 numthreads=8 } connectiontimeout=3000 maximumpoolsize=100 } now, when try , use database, error saying exception: java.sql.sqltimeoutexception: timeout after 1000ms of waiting connection. why isn't timeout being set 3000ms have specified in application.conf ? this stupid mistake on part, here settings need be: testnet3databaseurl { datasourceclass = "slick.jdbc.databaseurldatasource" driver = "slick.driver.postgresdriver$" db { driv

powershell - Increment using 2 digit number -

i have following code append incremental number beggining of each filename. how can make start 01 instead of 1. $files = get-childitem "c:\test" $i = 1 foreach ($file in $files) { $newname = "$i" + $file rename-item $($file.fullname) $newname $i++ } several ways this, use -f (format) operator. here's how i'd write in pipeline: get-childitem "c:\test" | foreach-object -begin { $i=1 } { rename-item $_ -newname ("{0:d2}{1}" -f ($i++, $_.name)) } p.s. forget it's possible eliminate foreach-object using delay-bind scriptblock. comes in particularly handy rename-item: $i = 1 get-childitem "c:\test" | rename-item -newname {"{0:d2}{1}" -f ($i++, $_.name)}

javascript - React native: How to move Input from center to top with animation? -

i'm trying code input, moved center top when user start typing text. how can change justifycontent: 'center' justifycontent: 'flex-start' animation? or maybe there way? my code: <view style={styles.container}> <searchinput onchangetext={this.handleinputchange} /> </view> and styles: const styles = { container: { flex: 1, alignitems: 'stretch', justifycontent: 'center', flexdirection: 'column' } }; you should able achieve free using layoutanimation . this do, things left out: handlefocus = () => { layoutanimation.easeineaseout(); this.setstate({ issearching: true, }); }; render() { const style = { justifycontent: this.state.issearching ? 'flex-start' : 'center', }; return ( <textinput onfocus={this.handlefocus} style={style} /> ); } if doesn't work, doubt, have use animated .

javascript - Trigger script on scroll -

jquery({somevalue: 0}).animate({somevalue: 38}, { duration: 1500, easing:'swing', step: function() { $('#grow1').text(math.ceil(this.somevalue)); } }); how can make sure animation doesn't start until user scrolls down particular div? you can use http://scrollmagic.io . allows define triggers in page , execute callbacks (in case animation) when triggers reached user. take @ example: http://scrollmagic.io/examples/basic/custom_actions.html hope you

python - How to make a complexType that extends a simpleType -

i have implement service spyne exposes specific wsdl right i'm unable replicate definition: <xs:complextype name="mytype"> <xs:simplecontent> <xs:extension base="xs:string"> <xs:attribute name="version" type="xs:string"/> </xs:extension> </xs:simplecontent> </xs:complextype> so far best able achieve class mytype(complexmodel): __namespace__ = "uri:my-ns" __extends__ = primitive.unicode version = xmlattribute(primitive.unicode) that raise attributeerror if "patch" models/complex.py [1] obtain: <xs:complextype name="mytype"> <xs:complexcontent> <xs:extension base="xs:string"> <xs:attribute name="version " type="xs:string"/> </xs:extension> </xs:complexcontent> </xs:complextype> almost there! comple

apache - .conf file to redirect naked domain to page -

i have craft cms site, has generated specific page–let's call "domain.com/page-x"–and want edit .conf file new domain redirect domain2.com straight page. thing since it's not flat file, can't use documentroot point directly in server, i've used redirect permanent , i'm not sure if that'll work @ intended: <virtualhost *:80> servername domain2.com serveralias www.domain2.com redirect permanent / domain.com/page-x customlog /var/log/httpd/website.lc-access.log combined errorlog /var/log/httpd/website.lc-error.log </virtualhost> is correct? the correct way: redirect permanent / http://domain.com/page-x/ always include scheme (http/https) always match slashes in source , target.

elasticsearch - Kafka-Connect vs Filebeat & Logstash -

i'm looking consume kafka , save data hadoop , elasticsearch. i've seen 2 ways of doing currently: using filebeat consume kafka , send es , using kafka-connect framework. there kafka-connect-hdfs , kafka-connect-elasticsearch module. i'm not sure 1 use send streaming data. though think if want @ point take data kafka , place cassandra can use kafka-connect module no such feature exists filebeat. kafka connect can handle streaming data , bit more flexible. if going elastic, filebeat clean integration log sources. however, if going kafka number of different sinks, kafka connect want. i'd recommend checking out connector hub see examples of open source connectors @ disposal http://www.confluent.io/product/connectors/

c# - 16bit CRC-ITU calculation for Concox tracker -

Image
i creating c# code server program receives data concox tr06 gps tracker via tcp: http://www.iconcox.com/uploads/soft/140920/1-140920023130.pdf when first starting up, tracker sends login message, needs acknowledged before send position data. first problem that, according documentation, acknowledge message 18 bytes long, yet example provide 10 bytes long: p.s. in table above, "bits" column i'm pretty sure should labelled "bytes" instead... now, main problem in calculating error check. according documentation: the check code generated crc-itu checking method. check codes of data in structure of protocol, packet length information serial number (including "packet length" , "information serial number"), values of crc-itu. ok, in above example, need calculate crc on 0x05 0x01 0x00 0x01 now, i'm guessing it's 16 bit crc, according diagram above, crc 2 bytes long. i've implemented 2 different crc implementations found

scipy - How to force SVC to treat a user-provided kernel as sparse -

svc appears treat kernels can take sparse matrices differently don't. however, if user-provided kernel written take sparse matrices, , sparse matrix provided during fit, still converts sparse matrix dense , treats kernel dense because kernel not 1 of sparse kernels pre-defined in scikit-learn. is there way force svc recognize kernel sparse , not convert sparse matrix dense before passing kernel? edit 1: minimal working example as example, if upon creation, svc passed string "linear" kernel, linear kernel used, sparse matrices passed directly linear kernel, , support vectors stored sparse matrices if sparse matrix provided when fitting. however, if instead linear_kernel function passed svc, sparse matrices converted ndarray before passing kernel, , support vectors stored ndarray. import numpy np scipy.sparse import csr_matrix sklearn.metrics.pairwise import linear_kernel sklearn.svm import svc def make_random_sparsemat(m, n=1024, p=.94): """

java - Need to use table alias inside @Formula annotation in Hibernate -

is there way reference current table's alias inside of @formula annotation in hibernate? want use rrn() function takes in table name or alias if table aliased parameter. tried specifying table name directly in annotation won't work because table aliased. i tried {alias} hoping may available didn't work either. @formula("rrn({alias})") i'm looking generate query this: select alias.column1, alias.column2, alias.column3, rrn(alias) table alias

excel - Google Sheets evaluates only first condition in array in SUMIFS statement -

i found example in excel 1 can use array set or conditions. want in google sheets i'm not sure how. using same syntax doesn't work. sum(sumifs({}) excel university report sales 30,050 => formula: =sum(sumifs($c$18:$c$28,$b$18:$b$28,{"sales-labor","sales-hardware","sales-software"})) cos 21,136 gross profit 8,914 sg&a 2,054 net income 6,860 data account amount sales-labor 15,050 sales-hardware 10,779 sales-software 4,221 cos-labor 9,058 cos-hardware 8,172 cos-software 3,906 supplies 256 marketing 1,200 trade shows 200 telephone 299 internet 99 if pop same values google sheets , same formula marked above, you'll value of first criteria. source: http://www.excel-university.com/sumifs-with-or/ a simple solution use sumproduct , isnumber(match) =sumproduct( $c$18:$c$28, isnumber(match( b18:b28, {"sales-labor","sales-hardware",&quo

ruby on rails - Stop sidekiq worker when user logs out -

i want perform background job when user logged in. when user logged in, start worker: warden::manager.after_authentication |user,auth,opts| imapworker.perform_async(user.id) end all imapworker use ruby's net::imap api wait new emails come in remote email server. uses imap's idle functionality wait new events. class imapworker include sidekiq::worker def perform(user_id) user = user.find(user_id) imap = net::imap.new('imap.gmail.com',993,true) imap.login(user.email, user.password) imap.select('inbox') imap.add_response_handler |resp| if resp.kind_of?(net::imap::untaggedresponse) , resp.name == "exists" check_email end end imap.idle end end now when user logs out, want end worker. know in devise , can hook log out functionality such: warden::manager.before_logout |user,auth,opts| ... end but how stop sidekiq worker? require 'sidekiq/api'; sidekiq::pro

javascript - What is the difference between BrokenPipeError and ConnectionAbortedError? -

i playing eventlet's websocket . when connect websocket browser, , close websocket browser, connectionabortederror raised on server side, eventlet's documentation states brokenpipeerror should raised. i read python's documentation brokenpipeerror , connectionabortederror don't understand difference. here javascript code : var socket = new websocket('ws://...'); socket.onmessage = function(m){console.log(m.data);}; socket.close();

excel - Columns to multiple rows -

Image
this question has answer here: excel macro(vba) transpose multiple columns multiple rows 2 answers i macro convert following name color1 color2 color3 color4 jane blue pink red teal john red black green gold to name color jane blue jane pink jane red jane teal john red john black john green john gold i have tried using built-in transpose tool, not seem work. seems need custom script... with data in rows 2 , 3 , pick cell , enter: =index($a$2:$a$9999,roundup(rows($1:1)/4,0)) next enter: =offset($b$2,roundup(rows($1:1)/4,0)-1,mod(rows($1:1)-1,4)) and copy these down: if love macros, have macro deposit , copy formulas.

mongodb - Unable to connect specific mongo instance port -

today morning i'm able create 2 different mongo instances on port 27010 , 37010 , i'm able replicate using mongo-connector. after system restart i'm not able connect port 37010 using below command. c:\program files\mongodb 2.6 standard\bin>mongo --port 37010 mongodb shell version: 2.6.12 connecting to: 127.0.0.1:37010/test 2016-09-12t18:08:14.733-0500 warning: failed connect 127.0.0.1:37010, reason: errno:10061 no connection made because target machine actively refused it. 2016-09-12t18:08:14.756-0500 error: couldn't connect server 127.0.0.1:37010 (127.0.0.1), connection attempt failed @ src/mongo/shell/mongo.js:148 exception: connect failed it working fine if give mongo connecting default port of 27010. morning faced same problem deleted mongo windows service , running without mongo windows service. again i'm facing same problem. kindly advise. below config files. mongo.config.txt ##store data here dbpath=c:\program files\mongodb 2.6 standard\data

Why does the virtual keyboard show for hidden input element on Chrome on Android, but not other devices? -

steps reproduce: 1) go https://hsf.ipass.com . 2) document.activeelement input element id=find-near-location not visible. it's collapsed in hamburger menu. 3) tap anywhere on map w/o pin. can tap on pin, has other interactions muddies issue. 4) virtual keyboard pops up. 5) document.activeelement still find-near-location. it seems bug in chrome on android, google-fu failing me. i running issue on android 6.0.1 chrome 52.0.2743.98. it turns out bootstrap's .collapse class not use display:none or visibility:hidden avoid element being rendered, required per https://www.w3.org/tr/html5/editing.html#focus-management .

powershell - Visual Studio/TFS 2012 - Retrieve original filepath from .tmp files in comparison -

Image
i'm working on developing specific comparison tool in visual studio 2012 tfs 2012 installed, , having trouble getting around tfs's use of temporary files comparison. in tools > options > source control > visual studio tfs > configure user tools... , shown here: i'm modifying command comparing .xml files, , tfs gives me following options add command lines parameters powershell: the issue is, i'm calling custom powershell script processing , determine action take based on files being compared. however, of information required process actual source control filepath of each file; appear stored in command line args %1 , %2 . unfortunately, tfs uses .tmp files perform comparisons, each of paths points .tmp (stored in local appdata) file instead of original .xml filepath need. the contents of files not have information i'm looking for, , filepath guaranteed to. there way @ use other of command line arguments provided tfs pass through original

php - How would I set up behat to check to see if I am on a route with a dynamic number? -

in behat check see if route going correct route, issue everytime visit route number changes. how set behat number after wards , let pass. have is: then should on "/clinic/participant/create/{id}" that bracket {id} dynamic , if possible either ignore last id or put wildcard of sort on whatever passed here works long number. this work around, still know if there easier way / cleaner way this. public function ishouldbeonroute($url) { $urlarray = explode('/', $url); $urlpath = $this->getsession()->getcurrenturl(); $urlpatharray = explode('/', $urlpath); $testedurl = join('/', $urlarray) . end($urlpatharray); $this->assertsession()->addressequals($testedurl); } assuming url existing link can see, create custom step gets href attribute , visit url. for example: i on create participant page this step should contain: - find element -> attribute href, save in variable - use visit variable the

ruby - Arel::Table @aliases memory leak when used in Rails 5 -

one sentence summary question: cause arel::table 's @aliases array grow in size every search done using activerecord? i have written simple web application using rails 5. when load tested it, memory usage increased indefinitely. after 2.2 million requests, process 1gb of resident memory size. i investigated getting heap dumps before, right after, , 10 minutes after executing load test 100,000 requests. analyzed heap dumps using the heap dump diffing tool found here . says there 398,000 leaked objects created arel::table#alias() . this statement seems culprit: @aliases << node i confirmed arel::table 's @aliases array source of memory leak adding call uniq! in installed version of arel::table#alias() : def alias name = "#{self.name}_2" nodes::tablealias.new(self, name).tap |node| @aliases << node end @aliases.uniq! # locally added line end with modification arel, app's memory usage remained flat duration of load test. as

c++ - Getting range of vector without creating a new subvector -

i'm trying create recursive function each time accepts vector, this: std::vector<int> mergesort(std::vector<int> &main_vector) { //.......... rest of code ....... middle = get_midpoint(unsorted_vector); first_temp.insert(first_temp.begin(), main_vector.begin(), middle); second_temp.insert(second_temp.begin(), middle, main_vector.end()); first_half = mergesort(first_temp); second_half = mergesort(second_temp); //.......... rest of code ....... return main_vector; } here i'm trying pass vector each time call function mergesort again. had create 2 temporary vectors first_temp , second_temp , because don't know how extract range main_vector without creating new temporary vector hold value. is there way won't need create holder vectors ? main_vector[0:n] or ? traditional way use iterator range: template <typename iterator> void mergesort(iterator begin, iterator end) { const auto middle = get_midpoint_it(beg

android - Is the procedure correct to write Characteristic in Bluetooth Low Energy? -

i have button in mainactivity used write byte[] ble device: <button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="write char" android:id="@+id/button2" android:onclick="onclickwrite" /> and function onclickwrite is public void onclickwrite(view v){ if(mbluetoothleservice != null) { byte [] data= new byte[3]; data[0] = (byte)(0 & 0xff); data[1] = (byte)(255 & 0xff); data[2] = (byte)(0 & 0xff); mbluetoothleservice.senddata(data); } } where senddata modified function in class [bluetoothleservice][1] . worked when press button. however, let careful @ senddata function. searches service , characteristic again when press button. correct procedure write characteristic in ble? public void senddata(byte[] data){ string lservice = "00001c00-d102-11e1-9b23-00025b00a5a5"; string lcharacterist

typeclass - Haskell Recursive Type Classes -

i want create recursive instance type based on tuples. looking similar this: class provider b getinstance :: -> b instance provider b => provider (x, a) b getinstance (x, a) = getinstance instance provider (b, x) b getinstance (b, _) = b tryfunc1 :: int tryfunc1 = let provider = ("test", (10, ())) :: (string, (int, ())) in getinstance provider tryfunc2 :: string tryfunc2 = let provider = ("test", (10, ())) :: (string, (int, ())) in getinstance provider unfortunatelly, haskell fails solve instance. reason? the solution stop using deprecated overlappinginstances pragma , start using per instance overlapping , overlappable pragmas. change: instance {-# overlappable #-} provider b => provider (x, a) b getinstance (x, a) = getinstance instance {-# overlapping #-} provider (b, x) b getinstance (b, _) = b i tryfunc1 10 , tryfunc2 "test" . technically need either overlappable or overlapping pragma, b

angularjs - angular-drag-and-drop-lists drop zone won't work if the dnd-list is an empty array -

in scenario drop zone empty, created empty array dnd-list. noticed angular-drag-and-drop-lists not working - dragover , drop callback not called either. i created plunker demo this: http://plnkr.co/edit/umoa2bk1ub8gjval6uab?p=preview it won't work until open scripts.js , change array contain (e.g. empty object). intended behavior, or defect? // won't work $scope.selectedproducts = []; // following line works // $scope.selectedproducts = [{}]; i posted github , got answer there. need make sure both height , width of dropzone bigger 0. i updated css in plunker accordingly , made work. /* newly added make sure empty dropzone available drop */ ul { height: 36px; }

codeigniter - Unable to call model function from the controller -

i having problem code, below error follow ( ! ) fatal error: call undefined method agentie_model::get_agentii_list() in c:\wamp\…controllers\fk_controller.php on line 65 controller:fk_controller public function __construct() { parent::__construct(); $this->load->model('agentie_model'); $this->load->model('fk_model'); } public function add2() { $this->load->model('agentie_model'); $data['principal'] = $this->agentie_model->get_agentii_list(); //here error(line 65) $this->load->view('lista_agentii', $data); } model:agentie_model private $_table = "agentii"; public function get_agentii_list() { $query = $this->db->get($this->_table); return $query->result(); } view:lista_agentii echo "lista agentii:</br>"; foreach($principal $list) { echo $list->nume_agentie; } public function __construct() { parent

oracle - SQL - How to select row by compare date from 2 table -

i have 2 table that: table1: id | company_name | rank | first_regist_date 1 1 2017-09-01 2 b 2 2017-09-05 table 2: id | company_name | rank | first_regist_date 1 3 2017-09-03 2 c 4 2017-09-04 i need select company data first_regist_date , rank in case of company have 2 first regist date, choose earlier date , rank greater (ex: company above have first date: 2017-09-01) the expect result that: company - rank 3 - date:2017-09-01 please have me select in case this technically answers question avoids elephant in room (which id takes preference?). both tables have id's may overlap ({b,c} have id of 2) rules need defined id takes preference other table id's renamed to. select company_name ,min(first_regist_date) regist_date ( select * #table1 union sele

awk field separator with in the xml -

i have xml file following data. <record record_no = "2" error_code="100">&quot;18383531&quot;;&quot;22677833&quot;;&quot;21459732&quot;;&quot;41001&quot;;&quot;394034&quot;;&quot;0208&quot;;&quot;prime lending - ;corporate - 2201&quot;;&quot;&quot;;&quot;prime lending - lacey - 2508&quot;;&quot;prime lending - lacey - 2508&quot;;&quot;1&quot;;&quot;rrvc&quot;;&quot;tiffany poe&quot;;&quot;heidi&quot;;&quot;bundy&quot;;&quot;000002274&quot;;&quot;2.0&quot;;&quot;18.0&quot;;&quot;2&quot;;&quot;362661&quot;;&quot;rejected irs&quot;;&quot;a1aaa&quot;;&quot;20160720&quot;;&quot;1021&quot;;&quot;hedi &amp; bundy&quot;;&quot;4985045838&quot;;&quot;ppassess&quot;;&quot;web&quot;;&quot;3683000826&quot;;&quot;823&quot;;&

python - NoReverseMatch Reverse for 'profile_user' with arguments '()' and keyword arguments '{}' not found -

views.py @login_required def profile_edit(request): profile, created = userprofile.objects.get_or_create(user=request.user) form = userprofileform(request.post or none, request.files or none, instance=profile) if form.is_valid(): instance = form.save(commit=false) instance.user = request.user instance.save() return redirect('profile_user') context = { "title": 'edit profile', "form":form, } return render(request, 'profiles/userprofile_form.html', context) main url there no name space given , profile url follows. url(r'^profile/(?p<username>[\w.@+-]+)$', profile_view, name='profile_user'), could solve please? your url requires named argument username . have give redirect() keyword argument. example: redirect('view-name', username='joe')

java - SQLException related to insert database values using ArrayList -

iam new java , trying develop small swing app, have inquiry model class containing getters , setters , constructions , iam getting input user in jframe. im getting error java.sql.sqlexception: @ least 1 parameter current statement uninitialized " when run code. public class makeandreply_inquiry { string in_id=null; string in_title=null; string in_msg=null; date in_date; connection con; public void insertinquirytodb(arraylist<inquiry> arrlist){ try { dateformat dateformat = new simpledateformat("yyyy/mm/dd hh:mm:ss"); in_date = new date(); system.out.println(dateformat.format(in_date)); //2014/08/06 15:59:48 iterator<inquiry> iter = arrlist.iterator(); while(iter.hasnext()) { inquiry inq = iter.next(); in_id=inq.getin_id(); in_title=inq.getin_title(); in_msg=inq.getin_msg(); } con = new

data structures - How to test efficiently Dijkstra algorithm -

i working on existing implementation of dijkstra , 1 of deliverable test whether implementation efficient solution issue @ hand or recommend alternate algorithm. question is... how should baseline existing dijkstra algorithm compare alternate? narrow scope, client using dijkstra dynamically chose best tariffs plan b2b consumers. make sense? dijkstra algorithm find shortest path in graph. test , see how effective that, need compare other algorithms. bellman–ford algorithm, a* search algorithm , etc. important notes other performance, there other important issues dijkstra doesn't work negative values. why bellman-ford has been used instead in many problems. also, dijkstra has different implementations. dijkstra's algorithm list o(v 2) while dijkstra's algorithm modified binary heap o((e + v) log v) , dijkstra's algorithm fibonacci heap o(e + v log v). bellman–ford algorithm o(ve). conclusion if need see 1 better work, first see parameters matte

java - How to get Injection of broadcaster factory to work in atmosphere? -

i have following code form here: https://github.com/atmosphere/atmosphere/wiki/getting-broadcasterfactory-and-atmosphereresourcefactory-with-2.2-and-newer @inject @named("/chat") broadcasterfactory factory; but jboss eap 6.4.7 not working, can't deploy war because of missing dependencies. the beans.xml looks this: <beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"> </beans> and in pom have following dependencies: <dependency> <groupid>org.atmosphere</groupid> <artifactid>atmosphere-annotations</artifactid> <version>2.4.6</version> </dependency> <dependency> <groupid>org.atmosphere</groupid> <a

pointers - Confusion when assigning address using C -

i trying assign address of 1 of structure, named node, 1 named tmp, has same type--node. however, address of tmp less 8 address of node. why that? thanks! #include <stdio.h> #include <stdlib.h> typedef struct _node { int data; struct _node *next; }node; int main() { node *node = (node*)malloc(sizeof(node)); node *tmp; tmp = node; printf("%d\n",&node); printf("%d\n",&tmp); } i guessing expected output same both lines. for happen, have print values of pointers, not addresses of pointers. after tmp = node; the value of tmp same value of node addresses of 2 variables going different. i suspect meant use: printf("%p\n", node); // use %p pointers, not %d printf("%p\n", tmp);

sql server - group records bases on one column name in data set and display all the values corresponding to the column for which records are grouped in SQL -

this question has answer here: simulating group_concat mysql function in microsoft sql server 2005? 9 answers for example, if have data-set below id item 1 2 b 3 c 1 b 1 c 2 then need sql query gives output below: id item 1 a, b, c 2 b, 3 c that how group based on id , display values pertaining column attributes in sql. replace table names table name , use below query: select src.id, src.items [items] ( select distinct t2.id, ( stuff((select t1.item + ',' [text()] [yourtable-name] t1 t1.id = t2.id order t1.id xml path ('')),1,1,'') ) [items] [yourtablename] t2 ) [src]

angularjs - bower install ECONFLICT unable to find suitable version for angular-bootstrap -

when run command 'bower install angular-ui-select' gives me error econflict unable find suitable version angular-bootstrap. bower.json follows. bower.json follows. { "name": "analytics tool", "version": "1.0.0", "authors": [ "janith widarshana" ], "license": "ios", "homepage": "", "ignore": [ "**/.*", "node_modules", "public/libs" ], "dependencies": { "jquery": "~2.1.x", "jquery-ui": "~1.11.x", "jquery-custom-scrollbar": "0.5.x", "bootstrap": "~3.3.*", "angular": "~1.4.*", "angular-resource": "~1.4.*", "angular-animate": "~1.4.*", "angular-mocks": "~1.4.*", "angular-bootstrap": "~2.1

python - Unexpected StandardScaler fit_transform output -

i trying scale pandas series standardscaler().fit_transform(). however, output array of zeros. the input series has length of 201, when do: print values[:5] i list of floats below: 0 1943.0 1 508.0 2 1657.0 3 872.0 4 693.0 when apply scaler: x = preprocessing.standardscaler().fit_transform(values) print x output: [[ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.

angular - Unexpected value 'DecoratorFactory' imported by the module 'TempModule' -

in sample application have written feature module "tempmodule" , below code. import { ngmodule } '@angular/core'; import { commonmodule} '@angular/common'; import { temponecomponent } './temp.one.component'; import { temptwocomponent } './temp.two.component'; import { temprouting } './temp.routing'; @ngmodule({ declarations: [ temponecomponent, temptwocomponent], imports: [ ngmodule, commonmodule, temprouting] }) export class tempmodule {} i referring tempmodule in root module , below root module code import { ngmodule } '@angular/core'; import { browsermodule } '@angular/platform-browser'; import { formsmodule } '@angular/forms'; //-- routing import import { routing, approutingproviders} './app.routing'; //-- root component import import { appcomponent } './app.component'; import { appaboutcomponent } './app-about.compone

qt - Qtquick qml : How to seperate Logic from UI in Qtquick UI Application? -

suppose, want seperate logic code ui code myapp.qml , myappform.ui.qml. ui.qml not support javascript logic, example,mouse events. suppose, following problem. //myappform.ui.qml import qtquick 2.4 item { rectangle { id: rectangle1 color: "#a0ebfb" anchors.fill: parent mousearea { id: mouse1 anchors.fill: parent } } } the above ui code. need separate logic code as, //myapp.qml import qtquick 2.4 myappform { mouse1{ onclicked: { rectangle1.color = 'red' } } } obviously, above not work. asking how similar. thanks. you can extend mouse area using alias property. here modified code. //myappform.ui.qml item { property alias rectmousearea: mouse1 rectangle { id: rectangle1 color: "#a0ebfb" anchors.fill: parent mousearea { id: mouse1 anchors.fill: parent } } } //myapp.qml import qtqu

graph - Records deduplication(linkage) algorithms -

i have standart record deduplication task: have alot records text ( or other ) fields , of them corresponding same entity. merging of such records goal of task. there used , simple statistical approachs kind of tasks " probabilistic record linkage ". of them more precise , more complicated exploit same ideas https://github.com/datamade/dedupe : try weight somehow each field measure of similarity , linear composition of weighted differences measure of whole record similarity. but tasks have alot of unknown fields, amount of similar fields rather large : record1 : propa = ; propb = unknown ; propc = unknown ; .... record2 : propa = ; propb = b ; propc = unknown ; .... record3 : propa = unkown ; propb = b ; propc = d ; .... record4 : propa = a2 ; propb = unknown ; propc = unknown ; .... record5 : propa = a2 ; propb = b2 ; propc = unknown ; .... record6 : propa = x2 ; propb = b2 ; propc = d2 ; .... in case record1 can linked record3 via record2 more record4 record

javascript - Loop through nested object properties nunjucks -

i have nested object this contract: { packages: [ { servicepoint: { producttype: { name: 'name1' } }, packages: [ { servicepoint: { producttype: { name: 'name1' } } }, { servicepoint: { producttype: { name: 'name2' } } } ] } ] } i loop through nested object , find producttype.name values if it's exists. , create elements <button type="button">{{ servicepoint.producttype.name }}</button> i this {% servicepo