Posts

Showing posts from April, 2015

sql - Aggregating Boolean Data in Access -

is there accepted/better method aggregate boolean data in access query? i have 2 related tables, first table contains grouped summary of data second. 1 of fields in second table boolean yes/no flag indicating row requires 'attention'. i planning on performing or across rows of second table , storing result in first table indicate 'at least one' of associated rows table 2 needs 'attention'. i see access stores false 0 , true -1 , have used sum/group , seem have achieved result aiming for. each true value (-1) sums , gives me negative number access seems happy interpret true. notice there doesn't seem way perform , operation (multiplication?) made me think method i'm using bit of hack , may have unintended consequences. why not using sum(-myflag) and compare count(*) ? can test both figures equal.

sql - MySQL trouble getting value from a third table in query -

i need retrieving value third table product_attribute | id_product_attribute | id_product | reference | ean13 | product_attribute_combination | id_attribute | id_product_attribute | attribute_lang | id_attribute | name | i did query below product list, want name attribute_lang , don't know how. can me on this? this have now select t1.id_product, t1.reference, t2.name, t1.price, if(length(trim(t1.ean13)) = 0, t1.id_product, t1.ean13) ean13 /*prefix*/product_attribute t1 inner join /*prefix*/product_lang t2 on (t1.id_product = t2.id_product , t2.id_lang = /*current_language_id*/) t1.id_product /*products_id_list*/ you need add 2 more joins: left join /*prefix*/product_attribute_combination t3 on t3.id_product_attribute=t1.id_product_attribute left join /*prefix*/attribute_lang t4 on t4.id_attribute=t3.id_attribute and add t4.name selected column the result this: select t1.id_product, t1.reference, t2.name, t1.price, if(length...

java - binary to decimal using CharAt( ) and length( ) -

ive written program converting binary decimal, wondering how can without using math.pow ( ) , using methods charat ( ) , length() thank you,, appreciated public class binarytodecimal{ public static void main(string[] args){ string binarystring = args[0]; int decimalvalue; int length = binarystring.length(); double j = 0; (int i=0; i< binarystring.length(); i++){ if (binarystring.charat(i)== '1'){ j = j+ math.pow(2, binarystring.length() - 1 - i); } } decimalvalue = (int) j; system.out.println(decimalvalue); } } you can try this: int j = 0; (int i=0; i< binarystring.length(); i++) { j <<= 1; if (binarystring.charat(i)== '1') { ++j; } }

jquery - HTML table with fixed header/columns - css solution - not working in Firefox -

i'm working on project client wants sticky headers/columns on table. can't use real script cause project have many objects in page , i'm losing speed , stuffs that. what succeed far creat hybrid of css javascript in scroll left/top elements after table scroll. working in ie 9, not cover opera, chrome, safari, maxthon; sadly doesn't work in ff need bit of solve this. i'll post here fiddle result page: http://jsfiddle.net/kordosoft/7v4rz/21/embedded/result/ working copy of fiddle: http://jsfiddle.net/kordosoft/7v4rz/21/ if open in different browsers work except ff. sticky headers: 1st 2 rows; sticky columns: 1st 2 columns; js: document.getelementsbyclassname("valuation")[0].onscroll = function () { var _left = document.getelementsbyclassname("valuation")[0].scrollleft; jquery('.valuation td[column="a"],.valuation td[column="b"]').css('left', _left); var _top = document....

Java: Get attribute of subclass without casting -

let's have superclass order , 2 subclasses vehicleorder , taskorder . both inherrit lot of methods superclass, have 1 specific field: vehicleorder has model , taskorder has task. now, in other class, have list of order . in method, need calculations based on order's specific field. my solution 'polluting' superclass order 2 methods getmodel() , gettask() , return null default , can overriden subclasses. other class checks null , if not null, makes calculations. doesn't feel right way though... as don't know subclass-types of general list of orders in other class, can't cast attribute. the other way fix using visitor pattern , feels bit of overkill.. it? is there clean way this? extract out common base class (or interface) both task , model can implement. let order refer type, instead of referring concrete types each order type. this may easier said done, depending on similarities/differences of task , model. may require refac...

Postgresql base64 encode -

i need convert db value base64encode. tried: select encode(cast(est_name text),'base64') establishments; it showing error [sql]select encode(string(cast(est_name text)),'base64') establishments; [err] error: function string(text) not exist line 1: select encode(string(cast(est_name text)),'base64') ... ^ hint: no function matches given name , argument types. might need add explicit type casts. where wrong? please help. in advance the encode function encodes bytea text. select encode(est_name::bytea, 'base64') establishments; http://www.postgresql.org/docs/current/static/functions-binarystring.html#functions-binarystring-other

javascript - Updating existing key value pair throws <Object> has no method 'push' error -

i'm trying update existing javascript object new key value , update existing value so $.each(eventsdata, function() { if (this.id== "eb_0") { this.push({ author_name: "john seeds" //new key value pair added. title: newtitle_var //to updated }); } }); console.log(this.eventsdata) my object looks this. [ object { id="eb_0", title="dayy", date=date, more...}, object { id="eb_1", title="dayz", date=date, more...}, object { id="eb_2", title="dayx", date=date, more...} ] currently console.log outputs following error. uncaught typeerror: object #<object> has no method 'push' could me figure out please? you use: $.each(eventsdata, function () { if (this.id == "eb_0") { this.author_name = "john seeds"; //new key value pair added. this.title = newtitle_var; //t...

c# - Javascript values not updating after dropdown selection -

i have value i'm passing server side c# code client side javascript need update based on dropdown selection. value gets changed required in c# logic value change never picked client. here c# code setting value protected void ddlcurrency_onselectedindexchanged(object sender, eventargs e) { dropdownlist ddlcurrencytype = (dropdownlist)upfilter.findcontrol("ddlcurrency"); currencyid = int.parse(ddlcurrencytype.selecteditem.value); } private void setcurrencysymbol() { if (currencyid == 2) { currencysymbol = "€"; } else { currencysymbol = "$"; } } and javascript variable var currencysymbol = "<%=currencysymbol%>"; the setcurrencysymbol method called in if(!page.ispostback) condition. here dropdownlist code <asp:dropdownlist runat="server" id="ddlcurrency" onselectedindexchanged="ddlcurrency_onselectedindexchanged" autopostback="true...

json - Rabl model extends -

i creating json outputs of rails models. i have 2 models: piece , set. relationships are: a pieces belongs set and a set has many pieces now, have started write rabl json templates both models , each outputs relationship items, eg: set outputs it's pieces , pieces outputs set belongs to. i ahve done separately due issue wondered best way of resolving issue convert template set allows pieces in use template piece, however, piece template outputs it's set use template set , keep looping , fall over. is there way around this? since writing question have gone ahead , built out , yes, issue has occurred. result json file 500 internal server error. is there way can conditionally add child pieces if set show json being rendered leave them out if index json rendered? solved using local variables. i passed local variable extend determine whether display inner content or not.

firefox - Html Form : bad mime type for .zip files -

situation i have following form : <form action="/url/to/action" method="post" enctype="multipart/form-data"> <ul> <li><label>file1 <input type="file" name="file1" /></label></li> <li><label>file2 <input type="file" name="file2" /></label></li> <li><input type="submit" value="import"/></li> </ul> </form> using firefox : when upload *.gz file, sent mime-type : application/x-gzip when upload *.xml file, sent mime-type : text/xml this ok. : when upload *.zip file, sent mime-type : text/html instead of application/zip (i checked content of post request in firebug console.) i'm pretty sure worked not long ago. question is bug related firefox ? has else experienced ? i'm running ff 29.0 / ubuntu 14.04. maybe try add mimet...

php - Iterate over object properties with keys from second array -

i call foreach loop on object , iterate on $this->_values , keys present in $this->_allowedfields . 1) $this->_values can contain data not $this->_allowedfields , should excluded foreach. 2) $this->_allowedfields will contain keys not in $this->_values , still need include step in foreach loop. how can achieve this? i have set class implement iterator , can call foreach loop on object's _values array, so: foreach($object $key => $value) { // stuff } solution found solution myself below when implementing iterator interface. public function rewind() { reset($this->_allowedfields); } public function current() { $key = current($this->_allowedfields); return $this->_values[$key]; } public function key() { $key = current($this->_allowedfields); return $key; } public function next() { next($this->_allowedfields); $key = current($this->_allowedfields); return $this->$this->_values[...

javascript - integrate ext js v4.2.1 with zend framework v1.11 -

i'm trying create application using zend framework , ext js client side. far i've created zend app using zend_tool. questions are: where put ext js libraries. where import them use in whole app i'm building. well reson can't comment on post.... doydoy let me more specific the project running, ext libraries in public/js, want layout app extjs, want know how communicate zend ext js to use js library, must put public directory (or subdirectory of public ) public/js/your_library.js to import library in app, can in controller: -> put in head: $this->view->headscript()->prependfile($this->view->baseurl().'/js/your_library.js'); -> put in bottom of body: $this->view->inlinescript()->prependfile($this->view->baseurl().'/js/your_library.js'); to call in layout -> in head: <head> <?php echo $this->headscript();?> </head> -> in bottom of boddy ...

javascript - Performance issue with lots of knockout nested writeable computeds -

i have knockout application have hierarchy of writeable computed observables below: function invoicevm() { self.isselected = ko.observable() self.selectedamount = ko.computed(function() { if (self.isselected()) return self.usdbalance; else return 0; } } function companyvm() { self.invoices = ko.observablearray() self.totalselectedamount = ko.computed(function () { var total = 0; (var = 0; < self.invoices().length; i++) { total += self.invoices()[i].selectedamount(); } return total; }); self.isselected = ko.computed({ read: function () { var isselected = true; (var = 0; < self.invoices().length; i++) { if (!self.invoices()[i].isselected()) isselected = false; } return isselected; }, write: function (value) { (var = 0; < self.invoices().length; ...

excel vba - web download stalled in VBA -

i've written simple vba program download stock quotes portfolio in google finance. works fine couple of hours , hangs up. in applications status bar says "connecting to" (internet?). once stuck won't respond esc key , have force end windows task manager. the portfolio accessed once every 5 minutes , data placed @ a1 copied separate page storage. code access portfolio is: with activesheet.querytables.add(connection:= _ "url;https://www.google.com/finance#", destination:=range("$a$1")) .name = "finance#" .fieldnames = true .rownumbers = false .filladjacentformulas = false .preserveformatting = true .refreshonfileopen = false .backgroundquery = true .refreshstyle = xloverwritecells .savepassword = false .savedata = true .adjustcolumnwidth = true .refreshperiod = 0 .webselectiontype = xlspecifiedtables .webformatting = xlwebformattingnone .webtables = """po...

css - Input effect on keyboard tab -> focus, but NOT on click -

when user 'tabs over' input, want focus effect displayed, on click, don't want visible. user hits tab , focussed on toggle button, toggle button have slight glowing outline, i'm able do. now, user clicks on toggle button or it's associated label, toggle changes usual, but , want glow never appear in first place, or disappear possible. i know .blur() , , right i'm having use settimeout lazy fix, i'd know if there's better way accomplish this, or if there's possibly css solution i think lot of front-end developers struggle find balance between aesthetics , best-practices accessibility. seems great compromise. here's how it. idea toggle outlining on when user uses tab key , turn off when click. js document.addeventlistener('keydown', function(e) { if (e.keycode === 9) { $('body').addclass('show-focus-outlines'); } }); document.addeventlistener('click', function(e) { $('body...

Can't access to Azure Storage folder using Lucene.Net -

we decided implement search functionality in our api developed in servicestack, decided use lucene.net since heard great indexer make searches. we created worker role job create indexes in azure storage folder, guided ourselves using leon cullen's tutorial . use azuredirectory library specified in post, use latest azure sdk. then in our api project added references lucene.net , azuredirectory too, our endpoint ended looking this: public object post(searchindex request) { list<product> products = new list<product>(); var pagesize = -1; var totalpages = -1; int.tryparse(configurationmanager.appsettings["pagesize"], out pagesize); if (request.page.equals(0)) { request.page = 1; } // azure settings azuredirectory azuredirectory ; try { // line access denied exception thrown @ azuredirectory = new azuredirec...

java - How do I retrieve the component type used at a specific cell in a JTable? -

i've created jtable columns contain variety of different components. last 5 columns either contain nothing (a defaulttablecellrenderer no value) or jradiobutton using custom renderer , editor. renderer creates , returns new radiobutton in cells need one, , want access these radio buttons panel class add them buttongroup . using following piece of code wrote: protected void setbuttongroups() { buttongroups = new arraylist<buttongroup>(); (int = 0; < tablemodel.getrowcount(); i++) { buttongroup currentgroup = new buttongroup(); (int j = 0; j < tablemodel.getcolumncount(); j++) { if (table.getcomponentat(i, j) != null) { currentgroup.add((jradiobutton)table.getcomponentat(i, j)); } } } buttongroups.add(currentgroup); } } getcomponentat() keeps returning null regardless of contained in cell, whether jcheckbox , jradiobutton , jcombobox ... returned null. is ...

android - Nested Fragments within ViewPager have zero height and width -

i have activity single fragment inside of it. inside fragment have viewpager pages fragments. makes paged fragments children of fragment inside activity. this: activity | | fragment | (viewpager) | | | | fragment fragment every often, seemingly @ random, fragments inside viewpager not display. looked @ view hierarchy in hierarchy viewer , noticed when happens child fragments (at bottom of picture) are in layout , root view of children has zero height , 0 width (as every view in hierarchy tree there down leaf views). viewpager have height , width, fragments pages not. if rotate device @ point, child fragments show up! i'm @ loss why happening. adapter i'm using viewpager requires fragmentmanager , , i'm using 1 fragment inside activity calling getchildfragmentmanager() . feel i'm doing i'm supposed do, not sure next on one. update: interestingly enough, if put code attaches adapter viewpager in...

c# - Linq query biz object to discover unique records..would this be a case for recursion -

not sure how go , hoping brainiacs here point me in right direction. have biz object collection , of course each item in top level collection has properties 1 of properties collection of related child records....and these child records have values looking for. so high level overview not moving closer... the parent object collection of events (in essence school classes) , related child collection instructors...such primary, secondary, aide, observer..etc. now idea create instructor calendar shows events bob..etc has month. so instructors on left (y axis) of calendar while days of month across top (x axis)....however mentioned instructors have mined out of biz obj. now @ stage in development can rework biz object if there better way should implement. now in limited knowledge base best come write foreach loop extract instructors querying 1 @ time...adding results collection , taking new collection , removing dupes or dupe check , don't insert during loop. something...

fortran - gfortran error: zgesvd in lapack -

i doing svd decomposition of square matrix a, a=u s vdag, , in fortran code, line reads lwork = -1 call zgesvd( 'a', 'a', a%d, a%d, a%m, a%d, s, u%m, u%d, vdag%m, vdag%d,work, lwork, rwork, info ) lwork = int(work(1));deallocate(work); allocate(work(lwork)) call zgesvd( 'a', 'a', a%d, a%d, a%m, a%d, s, u%m, u%d, vdag%m, vdag%d,work, lwork, rwork, info ) when compiled gfortran, went through no error or warning. when run program, shows error message: " ** on entry zgesvd parameter number 11 had illegal value " i not figure out went wrong. for reference, definitions of parameters: type cmatrix integer(4) d complex(8), allocatable :: m(:,:) end type type (cmatrix) a,u,vdag allocate(a%m(dim,dim),u%m(dim,dim),vdag%m(dim,dim)) a%d = dim; u%m = dim; vdag%d = dim real(8) s(dim) thanks in advance! xiaoyu p.s. should mentioned such program runs smoothly when compiled ifort, gfortran gives runtime error shown above --- pr...

mysql - SQL Query, Get data from multiple tables and query result -

i have table t1, contains contains columns (a , b, c ,d) in pk. and have more tables. , want data these tables. data per sql query these tables. sql query (query1) follows select t3.col1 a, t3.col4 f, t4.col h t3, t4 t3.col1 = t4.col2; now want data table t1 , above query1 result. select b , c , d , f, h t1, temp t1.a = temp.a; where temp above sql query1 result. how can achieve this? any suggestions. i'd suggest using explicit join in: select t1.b, t1.c, ..., t3.col1 a, t3.col4 f, t4.col h t3 join t4 on t3.col1 = t4.col2 join t1 on t1.a = t3.col1;

android - Count Total Number of List Items in a ListView -

how count total number of list items in listview ? i writing church application in populating list using images stored sd card, want count total number of list items. // upload whole list for(int position = 0; position < lstview.getadapter().getcount(); position++) { flags.put(position, true); } ((baseadapter) lstview.getadapter()).notifydatasetchanged(); } }); /*** images sdcard ***/ listsdcardimages = fetchsdcardimages(); // listview , imageadapter lstview = (listview) findviewbyid(r.id.listsdcardimages); lstview.setadapter(new listsdcardimagesadapter(this)); toast.maketext(getapplicationcontext(), "total number of items are:" + string.valueof(position), toast.length_long).show(); } everytime getting 0 total list view count lstview.getadapter().getcount() , so use toast.maket...

qt - QML stack trace during crash -

my project qt gui application in views in qml , models , business logic in c++. size of project has grown 100's of cpp , qml files debugging has becoming more , more difficult. in debug mode crashes produced in c++ code found stack trace linked source-code presented, crashes due qml code produces grayed out stack-trace (ie., pointing qt internals etc in cannot see qml file , line producing error). do know anyway that? using: c++11, qt/qml 5.2.0, qt creator 3.0 on mac (clang++, lldb combination) , windows (mingw g++ 4.8.0) if put breakpoint on javascript function in qml file breakpoint hit during course of debugging, problem when application crashes, i've no way of knowing qml file/line have participated in crash , can't put breakpoint beforehand - should show in stack-trace not (only shows grayed out stack-trace) i'm not sure it's possible. however, see this email simon on development mailing list: the nature of beast have 2 language environ...

Fault Tolerance in a Distributed Erlang -

how can have fault-tolerance in distributed application? far understand, supervision tree works supervising local process (if right?). how can supervise remote processes spawned on remote nodes. need supervise them , restart them in case of failure? look @ otp design principles chapter 9 distributed applications , sub chapters 9.4 failover , 9.5 takeover . if interested in topic should @ famous thesis making reliable distributed systems in presence of software errors , ton of published books topic. of materials on-line 3 free e-books , tutorial on erlang . example chaper distribution distribunomicon . tl;tr? long story short, wrote, have monitor each other supervisor tree , restart in case of failure. can reinvent wheel because erlang provides great tools doing or use existing solution form bare otp riak_core .

ide - eclipse doesn't start, no errors shown -

i have had eclipse working , completed projects already. however, eclipse not responding no obvious reason (doesn't start @ all). the error getting in .log file, , have included previous errors, is: . . . !entry org.eclipse.wst.xml.core 4 4 2014-05-06 23:58:03.611 !message istructureddocumentregion management failed. !stack 0 org.eclipse.wst.xml.core.internal.document.structureddocumentregionmanagementexception: istructureddocumentregion management failed. @ org.eclipse.wst.xml.core.internal.document.xmlmodelparser.removestructureddocumentregion(xmlmodelparser.java:2249) @ org.eclipse.wst.xml.core.internal.document.xmlmodelparser.removestructureddocumentregion(xmlmodelparser.java:2281) @ org.eclipse.wst.xml.core.internal.document.xmlmodelparser.replacestructureddocumentregions(xmlmodelparser.java:2339) @ org.eclipse.wst.xml.core.internal.document.dommodelimpl.nodesreplaced(dommodelimpl.java:737) @ org.eclipse.wst.sse.core.internal.text.basicstructureddo...

Drupal 7: Adding filters into View programmatically -

i created taxonomy view display content of different categories, , client want have different exposed filters different categories. example, shoes category should have filters color, shoe length, shoelace color, while clothes category should have filter material , color, while bag should not have category @ all. been trying things on own nothing works. searches on google found ways change existing filter's value, not creating whole new filter , injecting view. yolo people, suggestions? - , saying yolo meant live online i suggest using ' better exposed filters ' module views api. allows implement custom filters extending views_handler_filter class.

javafx - TreeView in a table cell Java FX 8 -

i have tableview in ui, displays user list database. 1 of column of table editable, when editing enabled cell of particular column becomes treeview, listing various options can chosen. just clarify, trying implement datepicker or colorpicker functionality on table cell, own list of items tree. the table defined this private tableview<user> usertable; the particular column displays tree view defined this private tablecolumn<user, treeview> col4; i set setcellfactory method display tree col4.setcellfactory(new callback<tablecolumn<user,treeview>, tablecell<user,treeview>>() { @override public tablecell<user, treeview> call( tablecolumn<user, treeview> param) { returns comboboxtablecell filled tree } }); in table, in corresponding column, when click cell, cell shows combo box , combobox on opening shows tree value. however when cell in no...