Posts

Showing posts from January, 2010

Laravel 5.1 command bus no default mappings -

i'd informations laravel 5.1 command bus. far see in 5.0 there busserviceprovider in app/providers namespace provided default behaviour resolving command handler class worked smoothly. created project straight 5.1 version , file not present in version leaving commands created with php artisan make:command --handler useless if don't map command handler manually or not create self-handling command. normal behaviour or there missing ? the command bus deprecated in move 5.0 5.1; see these tweets more. they've been replaced job s, can run both synchronous or async.

python - Mayavi set location of mlab.orientation_axes() in mayavi scene - axis indicator -

i trying visualize point trajectories mayavi , change frame frame interactively. therefore adapted this example. i axis indicator in window appear @ (0, 0, 0), with self.scene.mlab.orientation_axes() i can not define position , axes permanently displayed in scene. if press "toggle axis indicator" additional 1 appears. tried work self.scene.mlab.axes() and according options not give desired optic. have axes appear @ 0 point when pressing button in interactive window.can of here?

LDAP Authentication with PHP -

how ldap authentication php i connect ldap server in xampp. the ldap bind successful but working on code error shows <?php $ldapbasedomain = 'ou=employee,dc=domainname'; $ldapserver = 'domainname'; $ldapusername = 'xxx'; $ldappassword = 'yyy'; if (!empty($_post['username']) && !empty($_post['password'])) { if (!preg_match('/^[a-za-z0-9\-]+$/', $_post['username'])) { die('please enter valid username'); } if (!$ldapconnection = @ldap_connect($ldapserver)) { die('could not connect ldap server'); } if (!@ldap_bind($ldapconnection, $ldapusername, $ldappassword)) { die('could not bind ldap server'); } if (!$ldapsearch = @ldap_search($ldapconnection, $ldapbasedomain, $_post['username'])) { die('could not complete ldap search'); } $ldapcount = @ldap_count_entries($ldapconnecti

android - How to do RelativeLayout with images like gridview? -

Image
i neew display images gridview in scrollview. as read not right use gridview in scrollview. need big image text, list ao images , thet in 1 fragment need scrollview, first one, images without text there way display images programmatically 1 after in relativelayout(like in gridview)? here got, not working, images overlay each other. (string pic : mflat.getadv_pics()){ i++; imageview imageview = new imageview(mactivity); imageview.setid(i); relativelayout.layoutparams params = new relativelayout.layoutparams(relativelayout.layoutparams.wrap_content, relativelayout.layoutparams.wrap_content); params.addrule(relativelayout.align_parent_left, relativelayout.true); params.addrule(relativelayout.right_of, i-1); imageview.setlayoutparams(params); log.d("!!!!", "" + + "|" + imageview.getid()); log.d("!!!!", "http://****" + p

c# - Getting keyValuePair based on filtering of keys -

i use mydictionary.keys.where sequence returns keys (my predicate imposes conditions on keys). need associated values , not sure how easily, sure miss basic functionality.. var dict = new dictionary<string, long>(); something like: ienumerable<long> myvalues = dict.where(x => x.key == "a" || x.key == "b") .select(x => x.value); that return value s wanted or ienumerable<keyvaluepair<string, long>> myvalues = dict.where(x => x.key == "a" || x.key == "b"); the last return full keyvaluepair<string, long> , 2 properties ( key , value ) another (slower) solution: ienumerable<long> myvalues = dict.keys.where(x => x == "a" || x == "b") .select(x => dict[x]); it slower because after filtering lookup dictionary key s found.

ios - How can we get SBJSON connectionDidFinishLoading method inside array or Dictionary data in another class -

i want 1 class array data in class(i.e connectiondidfinishloading array data want in mainview class) backgroundclass.h #import <uikit/uikit.h> #import "json.h" @interface backgroundclass : uiviewcontroller<nsurlconnectiondatadelegate> @end backgroundclass.m @interface backgroundclass () { nsmutabledata * webdata; nsurlconnection * connection; nsmutablearray * array; } @end @implementation backgroundclass - (void)viewdidload { array = [[nsmutablearray alloc]init]; nsurl * url = [nsurl urlwithstring:@"http://api.kivaws.org/v1/loans/search.json?status=fundraising"]; nsurlrequest * request = [nsurlrequest requestwithurl:url]; connection = [nsurlconnection connectionwithrequest:request delegate:self]; if(connection) { webdata = [[nsmutabledata alloc]init]; } [super viewdidload];

javascript - figure caption on hover center text -

in fiddle http://jsfiddle.net/sldhsbou/ have "x" appears when hovering absolutely centered no matter size of image is. in addition why there no transition when mouse moves outside figure there when mouse moves in? <table border=1 style="width: 100%;"> <tr><td colspan=6 style="border-bottom: medium solid gray;">&nbsp;</td></tr> <tr> <td class="left" style="width: 25%; background-color: cyan;"> <table border=2 style="width: 100%;"> <tr> <td style="border: thin solid #ff9900;"> <div class="img-wrap"> <figure class="cap-bottom"> <img src="http://placehold.it/300x200" /> <figcaption> &l

javascript - Extend Coffeescript subclass function from parent in marionette -

i've got "formview" class in marionette application sets lot of things form submissions around app. use every time there form. i've got helpers want pass every form template via templatehelpers method, want able add additional templatehelpers in children. so: class views.formview extends marionette.itemview templatehelpers: -> helpers: marionette.concerns.helpers class views.newuser extends views.formview templatehelpers: -> variable: @something i want able access both @variable , @helpers template newuser . additionally, know how handle (via _.extends ) if templatehelpers object, need function. is possible? , if so, how? in backbone, when inherit class, backbone give subclass __super__ property (double underscore @ both ends) prototype of parent class. within views.newuser class, can prototype via view.newuser.__super__ . then, can call templatehelpers on object. here's how did ( live example @ jsbin ): views = {}

Need excel coding to pushing the incoming flow jobs -

i have query , create excel template should update me time required required jobs comes in instance have 30 employee can work works on 20 request 1 -2 effort involved 3 hours i.e 180 minutes if have 20 request incoming how can automatically excel whould update time required may 210 minutes or 240 minutes somehting can u guide me

select from table only if the id exist in that table mysql pdo php -

i want create select query using join on 3 or more tables. have 3 tables namely t1 , t2 , t3 , common column id existing in 3 tables. want select 3 table if id exists in table query this. select * t1 inner join t2 on t1.id = t2.id inner join t3 on t2.id = t3.id t1.id = 1 , t2.id = 1 , t3.id = 1 the query returning values if id exists in 3 tables. if not in table example t3 not return anything. looking way if not exist in t3 should proceed select t1 , t2 is need? select * t1 inner join t2 on t1.id = t2.id left join t3 on t2.id = t3.id t1.id = 1 , t2.id = 1 , (t3.id = null or t3.id = 1)

sql - PostgreSQL function execute query -

i want run sql query if condition met, following error: error: separate $ chain unfinished in or near «$func$ my sql query is: create or replace function myfunc() returns table(dateticket date, timeticket time, userid integer, my_all bigint) $func$ begin if (select count(distinct(dateticket)) tickets) = 1 return query execute 'select t.* (select distinct on (userid) dateticket, timeticket, userid, count(*) on (partition userid) my_all tickets t order userid, dateticket, timeticket) t order my_all, dateticket, timeticket'; else return query execute 'select t.* (select distinct on (userid) dateticket, timeticket, userid, count(*) on (partition userid) my_all tickets t order userid, dateticket, timeticket) t order my_all desc, dateticket desc, timeticket desc

Rails nested layouts - possible to use turbolinks 3 replace partial? -

after learning react-router , ember routing, appreciate idea of nested ui. trying figure out way push partials divs in 'native' rails , stumbled on simple way of editing in place. plans/index.html.erb <% @posts.each |post| %> <div id="content"> <a onclick="turbolinks.visit('/posts/8/edit', {change: 'content'})" >edit</a> </div> <% end %> plans/edit.html.erb <div id="content"> <%= form_for @post |form| %> <%= form.text_field :name %> <% end %> </div> since both files have id="content" correctly puts edit.html.erb content index file in place while maintaining rest of page state. i way feels, nicer creating remote request, adding controller action, creating new js.erb file, , forcing dom update jquery. super handy making nested tabbed content or master/detail pages simple html. however code above, how access post id in turb

c++ - Compile time checking for the number of arguments in a variadic template -

i made generic n-dimensional array class, want make safer compile-time checks. the constructor , operator() expected work correctly when number of arguments given equals dimension . still, if write code like array<int, 2> a(1, 2, 3); //3 dimensions 2d array == crash or array<int> a(1); //plain 1d array std::cout << a(1, 2); //segfault it silently compiles, , need run debugger, it's quite confusing debug variadic templates. can think of way provide compile time check correct number of arguments matching dimension? template<typename t, int dimension = 1> class array { private: std::unique_ptr<t[]> pointer; int size[dimension]; int realsize; public: array() { } template<typename... ns> array(ns... ns) : realsize(1) { create(1, ns...); } private: template<typename... ns> void create(int d, int n, ns... ns) { realsize *= n; size[d - 1] = n;

java - Best way to pass values from JTextField into a method? -

currently working on bmr/tdee calculator. calculator consists of taking users age, gender, weight , height, , uses information calculate bmr , tdee value. i've created gui this, , final step actual calculations. (some minor changes left i.e. changing height panel thats irrelevant question). what best way pass instance variables static methods? jtextfield's instance variables within class, , have 2 methods calculate bmr , tdee respectively (static methods). code posted below. the variables need use pretty textfield ones, , these need passed calcbmr() , calctdee(). initial idea make of these variables static , use gettext() , plug these values formula i'm using, goes along lines of: 10 x weight (kg) + 6.25 x height (cm) - 5 x age (y) + 5. does way sound feasible or there better way given code? advice on how efficiently appreciated. public class bmrcalcv2 extends jframe { // frames , main panels static jframe mainframe; static jpanel mainpanel;

javascript - Multiple angular directives referring to the same template -

i've found myself in situation have 2 isolate scope directives (each managing differentiated scope , dom state) referring single template. .directive1... scope: {}, templateurl: 'template1', .directive2... scope: {}, templateurl: 'template1', i'm used having 1-to-1 relationship between directives , templates, , model (2 directives - - 1 template) has me veering pattern. is there reason shouldn't have multiple isolate scope directives referring same template? is in violation of 'best practices' design pattern thought? are there other design considerations should taking account here? if directive1 , directive2 similar in form , function, don't see issue in reusing same template. although, if similar may mean should 1 directive parameters/options passed on scope? i add need clear in naming of directives/templates involved in 2-to-1 situation similar, ex: 'apple' directive , 'orange' directiv

Angularjs: ngRoute error injection with angular Material -

i leaning angular.js , want add ngroute start making applications routes, have problem, when add ngroute module (this module loads ngmaterial , nganimate , , ngaria ), browser throws me error angular doesn't work anymore. app.js (function(angular) { var app = angular.module('organizer', ['ngmaterial', 'nganimate', 'ngaria', 'ngroute']); app.config(function($mdthemingprovider, $httpprovider) { // config theme $mdthemingprovider.theme('default') .primarypalette('blue-grey'); // config http post // use x-www-form-urlencoded content-type $httpprovider.defaults.headers.post['content-type'] = 'application/x-www-form-urlencoded;charset=utf-8'; /** * workhorse; converts object x-www-form-urlencoded serialization. * @param {object} obj * @return {string} */ var param = function(obj) {

r - ggvis - add_legend with multiple data and position legend inside graph -

Image
i'm trying add legends arbitrary text in ggvis plot using data different dataframes. have tried using add_legend() have not idea parameters use. using plot() simple using legend() function has been hard find way using ggvis() here simple example of have using plot() : df1 = data.frame(x = sample(1:10), y = sample(1:10)) df2 = data.frame(x = 1:10, y = 1:10) df3 = data.frame(x = 1:10, y = sqrt(1:10)) plot(df1) lines(df2$x, df2$y, col = "red") lines(df3$x, df3$y, col = "green") legend("topleft", c("data 2","data 3"), lty = 1, col = c("red","green")) now, using ggvis() can plot points , lines different datasets can not find way put legends using add_legend() , here code using ggvis() : df1 %>% ggvis(x=~x,y=~y) %>% layer_points() %>% layer_paths(x=~x,y=~y,data = df2, stroke := "red") %>% layer_paths(x=~x,y=~y,data = df3, stroke := "green") i appreciate help. than

angularjs - Protractor - Page Object is not updating when the DOM elements are changed -

i testing spa built angular.js , im using page objects pattern write tests. in app have number of lists updated. example there list of attachments update when ever attachments added/removed. add attachment have modal window , when upload file , click ok. file uploads , lists update. i have written 2 page objects, 1 upload modal window , other 1 preview of attachment list. in tests first current count of attachments click on button activate modal window , attach file. take count of attachments in preview page , compare incremented 1. tests fails. page object not updated , still shows attachment count 2. test it('should attach file when file selected , ok button pressed.', function () { var currentfilecount = viewmeetingtabpage.getmeetingattachmentcount(); viewmeetingpage.clickaddattachmentbutton(); addattchmentpage.attachfile(); addattchmentpage.clickconfimattachfilebutton(); currentfilecount.then(function (

javascript - JS to populate Bootstrap modal with selected text only seems to work once -

i'm using boostrap create modal dialog allows users enter comments on given page. wanted expand allow me capture selected text , add content field in modal: $( document ).on("shown.bs.modal", function(){ var selectedtext = ''; var selectedtext = window.getselection().tostring(); if(selectedtext != "") { $('#comment_content').val("> " + selectedtext); } }); #comment_content id of input field modal form. this works great first time modal shown, fails work on subsequent uses. whenever click comment button selected text: %a.btn.btn-primary.btn-sm{:id => 'comments_toggle', "data-toggle" => "modal", "data-target" => "#commentmodal"} post comment i modal back, selection isn't applied #comment_content field. the other interesting thing, perhaps, won't work on page reload, either. until tab page destroyed, or until go page, every click of button text

ruby on rails - How to make a discourse plugin available for public posts? -

i've developed discourse plugin successfully. however, need logged in discourse in order see plugin working. any ideas? disclosure: user @dariomac , question owner, part of our organization. you have skip ensure_logged_in in before_filter of controller. add line plugin controller: skip_before_filter :ensure_logged_in, only: :

cd drive - Win32_LogicalDisk Access Property Always Unknown in PowerShell -

i'm using simple script check status of cd/dvd drives on machine. want able tell if drive writable. have following test code: $script_obj = new-object -comobject wscript.shell $drives = @(get-wmiobject win32_logicaldisk -filter 'drivetype=5') $script_obj.popup($drives[0].deviceid + " " + $drives[0].access) this show drive letter of cd/dvd drive on machine, access parameter comes 0 (unknown) though have writable cd inserted drive. have tried formatting cd used same usb device (as opposed music cd) can open browse file structure (there no files), doesn't change anything. isn't access property supposed give me 2 or 3 or 4 instead of 0? edit: i tried inserting playable dvd , cd. dvd doesn't read, cd works though. able burn cd , play on normal cd player. throughout process ran command given jan below , got same output every time: ps c:\users\ian> get-wmiobject win32_cdromdrive | select caption, drive, mediatype, access caption

Reading a file to matrix in C -

i "debug assertion failed" error when try compile code. can please explain wrong it? think i've done wrong fscanf function. thank you. #include<stdio.h> #include<stdlib.h> #include<malloc.h> void input(file *fp, int **a,int m) { int i,j; for(i=0;i<m;i++) { for(j=0;j<m;j++) { fscanf(fp, "%d\n", *(a+i)+j); } } } int main() { file*fp; int m,n,**a,i,j; scanf("%d",&m); fp=fopen("abc.txt","r"); a=(int**)malloc(m*sizeof(int*)); for(i=0;i<m;i++) *(a+i)=(int*)malloc(m*sizeof(int)); input(fp,a,m); for(i=0;i<m;i++) { for(j=0;j<m;j++) { printf("%d ",*((a+i)+j)); } printf("\n"); } free(a); return 0; } there several issues here, directly answer question, not providing address fscanf() store integer finds. without

mysql - Spring Boot and Dao -

Image
i have uploaded public project on github: https://github.com/sotish/springmvc11.git my model class is: import javax.persistence.column; import javax.persistence.entity; import javax.persistence.generatedvalue; import javax.persistence.generationtype; import javax.persistence.table; import org.springframework.boot.orm.jpa.entityscan; import org.springframework.data.annotation.id; @entityscan @entity @table(name = "student") public class student { @id @generatedvalue(strategy = generationtype.auto) private int id; @column(nullable= false, unique=true) private string firstname; @column(nullable= false, unique=true) private string lastname; @column(nullable= false, unique=true) private int age; @column(nullable= false) private string email; //getter , setters public int getid() { return id; } public

Meteor 1.1 - Deploying with Neo4j database -

i have network visualization app uses neo4j database. deploy app neo4j database, have never deployed meteor app other default, mongodb. i use graphenedb ( http://www.graphenedb.com/ ). have working locally using neo4j command line tool, getting run while deployed different beast. how deploy meteor app neo4j database? there meteor package solves this. wrote article on medium takes through process if find in position: https://medium.com/@samcorcos/connecting-meteor-to-a-neo4j-database-and-deploying-with-graphenedb-3321966c3102

Android - Changing Fragments within an Activity -

i creating android app uses main activity, , several fragments. main activity min "control" everything, , each fragment displays different screen different information. here of code main activity: public class mainmenu extends fragmentactivity implements firstmenu.fragmentlistener, checklist.fragmentlistener, tool.fragmentlistener{ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main_menu); firstmenu firstmenu = new firstmenu(); getsupportfragmentmanager().begintransaction().add(r.id.fragment_container, firstmenu).commit(); } public void changescreen() { checklist checklist = new checklist(); android.support.v4.app.fragmenttransaction transaction = getsupportfragmentmanager().begintransaction(); transaction.replace(r.id.fragment_container, checklist); transaction.addtobackstack(null); transaction.commit(); } public void changescre

xpages - Managing custom document locking to prevent conflict document -

i have custom document process built ssjs object. when click on edit button in document in read mode, call method sets lock date/time , lock owner in backend document , returns true. changedocumentmode simple action can used change document edit mode. however, first time save document (such simple action), creates conflict document. frontend document not aware of backend document modification , save did before going edit mode. if change process let document locking code set 2 backend doc fields , use context.redirecttopage, document opens edit mode , saving ui not create conflict documents. however, if after using code unlock document use open page simple action go "previous page" exit document, goes read mode instead of closing document. sure initial redirecttopage disrupted history , causes problem. the question: have suggestion on how can lock document before going edit mode, go edit mode, save without causing conflict documents, , still able exit using open page s

php - preg_replace not working in snippet -

i tying use following modx evo snippet (naming "removespace") output tv removing space in string: <?php $string1 = "[*longtitle*]"; $string = preg_replace('/\s+/', '', $string1); return $string; ?> but calling snippet [[removespace]] in template not produce string space removed. produces string is. but inserting text "hello world" in $string1 variable produces result without space. any solution? you can not use modx tags inside snippets, need use $modx->documentobject['variable-name'] so code this: <?php $string1 = $modx->documentobject['longtitle']; $string = preg_replace('/\s+/', '', $string1); return $string; ?>

How do I clone my git reposity to a remote machine? -

i have git repo set on computer. have remote machine can ssh into. want clone repo remote machine (and keep them in sync push , pull). how do this? i've ever cloned github. 1) initialize bare git repository on remote machine. ssh remote_machine mkdir my_project cd my_project git init --bare git update-server-info # if planning serve via http 2) configure local repo able pull/push remote one. git remote add origin git@remote_machine:my_project.git git push -u origin master now both machine in sync.

ios - How to delete a UIButton? -

Image
i'm not able delete uibutton @ top left in screen shot below. please tell me how can remove completely. here can see need change settings avoid error plain style

events - AMChart handleClick to retrieve data from database based on item clicked -

i'm using amchart stacked chart report test execution status db. php file query feed dataloader , stacked columns displays pass, fail , norun count data each category. i'm trying use handleclick function make column clickable , once clicked, query fired retrieve data specific column's pass, fail or norun count data , displays data on same page. i'm not sure how implement this. appreciated! below have far, clicking column triggers alert name of category , count, goal able trigger php file parameters passed in , display data db, // add click listener chart.addlistener("clickgraphitem", handleclick); function handleclick(event) { alert(event.item.category + ": " + event.item.values.value); } the issue has been resolved using json (converted db data in php) , ajax display. within handleclick call js function , pass in graph variables query inside php needs.

Retrieve index of newly added row - for loop in R -

i trying retrieve index of newly-added row, added via loop. starting beginning, have list of matrices of p-values, each variable number of rows , columns. because not groups have adequate number of treated individuals run t-tests. following prints console when access sample list: $group1 normal treatment 1 treatment 2 treatment 1 1 na na treatment 2 1 1 na treatment 3 1 1 1 $group2 normal treatment 2 treatment 2 1 na treatment 4 1 1 i every group have same number of rows , columns, in correct order, missing values filled in nas. sample of like: $group1 normal treatment 1 treatment 2 treatment 3 treatment 1 1 na na

CURL Post xml data to soap service return wsdl XML in php -

i trying response using curl request. soap service running fine soap-client. using curl not getting proper response. here code sample: $bookingrq = '<?xml version="1.0" encoding="utf-8"?> <soap-env:envelope xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"> <soap-env:header> <interface xmlns="http://api.hotels-vacation.com/documentation/xml/ota/4/2011b/" channelidentifierid="his_vacation_xml4h" version="2011b" interface="vacation quick connect xml 4 ota"> <componentinfo user="xmlhisjp" pwd="5kh86rsr" componenttype="hotel" /> </interface> </soap-env:header> <soap-env:body requestid="201505101528000000001" transaction="ota_hotelresrq"> &l