DHTMLX Grid #stat_totals are wrong after filtering - dhtmlx

I have a grid that is loaded via JSON / ajax that has a combination of filters and stat counters in the header area.
The stat counters seem to work correctly until one of the filters are used, and then the numbers in the counts are off. Sometimes off by 1 or 2 others by 5 or 8 or 10 even.
I am having a hard time trying to debug this library and was hoping someone else has ran into the same issue and can point me in the right direction.
I am including my full grid setup, but if you need all of it, please let me know.
Sorry in advance, this formatting is not very good.
Thanks
var travelGrid;
travelGrid = new dhtmlXGridObject('travelGrid');
travelGrid.startFastOperations();
travelGrid.setImagePath("/javascripts/dhtmlxSuite_v501_pro/imgs/dhxgrid_web/");
travelGrid.setHeader("Starts,Ends,Due,Contacted,Completed,AVG Contact to Start,AVG Complete to Start,Assign Number,T&H Concierge,Completed,Status, Flight Status,Flight Agent,Flight Collector,Flight Volume,Rental Status,Rental Agent,Rental Collector,Rental Volume,Lodging Status,Lodging Agent,Lodging Ccollector,Lodging Volume,GTG?,Total",
null, ["","","","","","","","","","","","background-color:#ffce56;","background-color:#ffce56;","background-color:#ffce56;","background-color:#ffce56;","background-color:#ff6384;","background-color:#ff6384;","background-color:#ff6384;","background-color:#ff6384;","background-color:#36a2eb;","background-color:#36a2eb;","background-color:#36a2eb;","background-color:#36a2eb;","",""]);
travelGrid.attachHeader("#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#stat_average,#stat_average,#text_filter,#text_filter,#select_filter,#select_filter,#select_filter,#select_filter,#select_filter,#stat_total,#select_filter,#select_filter,#select_filter,#stat_total,#select_filter,#select_filter,#select_filter,#stat_total,#select_filter,#stat_count",
["","","","","","","text-align:center;","text-align:center;","","","","background-color:#ffce56;","background-color:#ffce56;","background-color:#ffce56;","background-color:#ffce56; text-align:center;","background-color:#ff6384;","background-color:#ff6384;","background-color:#ff6384;","background-color:#ff6384; text-align:center;","background-color:#36a2eb;","background-color:#36a2eb;","background-color:#36a2eb;","background-color:#36a2eb; text-align:center;","","text-align:center;"]);
travelGrid.setColumnIds("DATE_START,DATE_END,DATE_DUE,DATE_CONTACTED,DATE_COMPLETED,TTCONT,TTCOMP,ASSIGN_NUM,AGENT_COMPLETED,Completed,Status,FLIGHT,FLIGHT_AGENT,FLIGHT_COLLECTOR,FLIGHT_BOOKED,RENTAL,RENTAL_AGENT,RENTAL_COLLECTOR,RENTAL_BOOKED,LODGING,LODGING_AGENT,LODGING_COLLECTOR,LODGING_BOOKED,GTG?,TOTAL");
travelGrid.setInitWidths("*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*");
travelGrid.setColAlign("left,left,left,left,left,left,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center");
travelGrid.setColTypes("ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro");
travelGrid.setColSorting("date,date,date,date,date,int,int,int,str,str,str,str,str,str,str,str,str,str,str,str,str,int,str,int,str");
travelGrid.setDateFormat("%m/%d/%Y","%m/%d/%Y");
travelGrid.enableCellIds(true);
travelGrid.enableMultiselect(false);
travelGrid.stopFastOperations();
travelGrid.preventIECaching(true);
travelGrid.enableAutoWidth(true);
travelGrid.enableAutoHeight(true);
travelGrid.enableUndoRedo();
travelGrid.enableMultiline(true);
travelGrid.init();
travelGrid.load("/data/grid?" + $('#gridForm').serialize(), function(){
...
});
<div id="travelGrid"></div>

Related

How to use entrezpy and Biopython Entrez libraries to access ClinVar data from genomic position of variant

[Disclaimer: I have published this question 3 weeks ago in biostars, with no answers yet. I really would like to get some ideas/discussion to find a solution, so I post also here.
biostars post link: https://www.biostars.org/p/447413/]
For one of my projects of my PhD, I would like to access all variants, found in ClinVar db, that are in the same genomic position as the variant in each row of the input GSVar file. The language constraint is Python.
Up to now I have used entrezpy module: entrezpy.esearch.esearcher. Please see more for entrezpy at: https://entrezpy.readthedocs.io/en/master/
From the entrezpy docs I have followed this guide to access UIDs using the genomic position of a variant: https://entrezpy.readthedocs.io/en/master/tutorials/esearch/esearch_uids.html in code:
# first get UIDs for clinvar records of the same position
# credits: credits: https://entrezpy.readthedocs.io/en/master/tutorials/esearch/esearch_uids.html
chr = variants["chr"].split("chr")[1]
start, end = str(variants["start"]), str(variants["end"])
es = entrezpy.esearch.esearcher.Esearcher('esearcher', self.entrez_email)
genomic_pos = chr + "[chr]" + " AND " + start + ":" + end # + "[chrpos37]"
entrez_query = es.inquire(
{'db': 'clinvar',
'term': genomic_pos,
'retmax': 100000,
'retstart': 0,
'rettype': 'uilist'}) # 'usehistory': False
entrez_uids = entrez_query.get_result().uids
Then I have used Entrez from BioPython to get the available ClinVar records:
# process each VariationArchive of each UID
handle = Entrez.efetch(db='clinvar', id=current_entrez_uids, rettype='vcv')
clinvar_records = {}
tree = ET.parse(handle)
root = tree.getroot()
This approach is working. However, I have two main drawbacks:
entrezpy fulls up my log file recording all interaction with Entrez making the log file too big to be read by the hospital collaborator, who is variant curator.
entrezpy function, entrez_query.get_result().uids, will return all UIDs retrieved so far from all the requests (say a request for each variant in GSvar), thus this space inefficient retrieval. That is the entrez_uids list will quickly grow a lot as I process all variants from a GSVar file. The simple solution that I have implenented is to check which UIDs are new from the current request and then keep only those for Entrez.fetch(). However, I still need to keep all seen UIDs, from previous variants in order to be able to know which is the new UIDs. I do this in code by:
# first snippet's first lines go here
entrez_uids = entrez_query.get_result().uids
current_entrez_uids = [uid for uid in entrez_uids if uid not in self.all_entrez_uids_gsvar_file]
self.all_entrez_uids_gsvar_file += current_entrez_uids
Does anyone have suggestion(s) on how to address these two presented drawbacks?

How to disable all visitors cookies in Joomla 3.x

I'm trying to disable all visitor cookies for my Joomla website.
I found some tutorials, but they are for Joomla version:1.x
Any suggestions?
The solution is very similar to solution to remove cookies in Joomla version 1.x and 2.x. So we will use the same condition and principle.
If you change this two files then maybe something other will not work. Change this only if you know what are you doing and if you know that will everyting else work. Because you can break the whole website!
You must edit two files /libraries/src/Application/CMSApplication.php and libraries/joomla/session/handler/native.php
In libraries/src/Application/CMSApplication.php change code around line 166 and add if condition for whole code in method if (substr($_SERVER['SCRIPT_NAME'] , 0 , 14) == "/administrator"){
public function checkSession()
{
if (substr($_SERVER['SCRIPT_NAME'] , 0 , 14) == "/administrator"){ // added condition
$db = \JFactory::getDbo();
$session = \JFactory::getSession();
$user = \JFactory::getUser();
// ... rest of code
}
}
In libraries/joomla/session/handler/native.php change code around line 229 add if condition for whole code in method like in previous file
private function doSessionStart()
{
if (substr($_SERVER['SCRIPT_NAME'] , 0 , 14) == "/administrator"){ // added condition
// Register our function as shutdown method, so we can manipulate it
register_shutdown_function(array($this, 'save'));
// ... rest of code
}
}
This works in Joomla 3.8.2
Note: after every Joomla update you must edit this two files again and test if this solution still works.
Set the cookie-path "/administrator" in the Admin Joomla Settings (System => Configuration).
Then the session cookies are created only for the admin area.
To avoid all cookies for normal visitors, you need to follow the below steps.
First of all: Deactivate site statistics! Global configuration -> Statistics -> Statistics: No. This will stop the "mosvisitor" cookie.
Don't use the Template Chooser module, because it uses a cookie named "jos_user_template".
Be careful with components: Some might start their own PHP session.
Now to the main point: comment out line 697 of /includes/joomla.php like this:
// setcookie( $sessionCookieName, '-', false, '/' );
Additional: Comment out line 25 in /offline.php:
// session_start();
This seams to be an artifact of old versions.

Boost event logger

http://boost-log.sourceforge.net/libs/log/doc/html/log/detailed/sink_backends.html
In this page there is sample code to initialize boost windows event backends,
but when I run it it gives memory error at first line.
void init_logging()
{
// Create an event log sink
boost::shared_ptr< sink_t > sink(new sink_t());
sink->set_formatter
(
expr::format("%1%: [%2%] - %3%")
% expr::attr< unsigned int >("LineID")
% expr::attr< boost::posix_time::ptime >("TimeStamp")
% expr::smessage
);
// We'll have to map our custom levels to the event log event types
sinks::event_log::custom_event_type_mapping< severity_level > mapping("Severity");
mapping[normal] = sinks::event_log::info;
mapping[warning] = sinks::event_log::warning;
mapping[error] = sinks::event_log::error;
sink->locked_backend()->set_event_type_mapper(mapping);
// Add the sink to the core
logging::core::get()->add_sink(sink);
}
Here it fails to create sink_t object.
boost::shared_ptr< sink_t > sink(new sink_t());
Any idea what is the problem and how can I solve this?
Also If you know any other source that I can learn using boost event logging please write.
No answer yet...
But I have found a solution in a blog by Timo Geusch.
http://www.lonecpluspluscoder.com/2011/01/boost-log-preventing-the-unhandled-exception-in-windows-7-when-attempting-to-log-to-the-event-log/
The reason for this problem was that the registry key in HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\EventLog\ that the application needs access to both has to be present (if you’re not administrator, you don’t have the privileges to create it) and the user who runs the application also needs to be able to both read and write to it.

Typeahead remote call is triggering even if there are datas in local/prefetch

The remote call is trigging even if there are values in prefetch/local data.
Sample Code:
var jsonObj = ["Toronto", "Montreal", "Calgary", "Ottawa", "Edmonton", "Peterborough"];
$('input.countries-cities').typeahead([
{
name: 'Canada',
local: jsonObj,
remote: {
url: 'http://localhost/typeahead/ajaxcall.php?q=QUERY',
cache: true
},
limit: 3,
minLength: 1,
header: '<h3>Canada</h3>'
}
]);
What i expect is trigger remote call only if there are no matches in local. But each time i type locations the remote call is getting triggered. Any help will be highly appreciated.
I know this question is a couple months old, but I ran into a similar issue and found this answer.
The problem is that your limit is set to 3 and your search is turning up less results than your limit, thus triggering the remote call. If you had set your limit to 1, you wouldn't get a remote call unless there were no results.
Not a great design IMO, since you probably still want to see 3 results if there are 3 results. And worse, say your local/prefetch results only return 1 result...if your remote returns the same result, it will be duplicated in your list. I haven't found a solution to that problem yet.
In bloodhound.js replace
matches.length < this.limit ? cacheHit = ...
by
matches.length < 1 ? cacheHit = ...

"cacher layer" for google-generated images

The question is prompted by comment to an earlier question of mine. I've never heard of a cacher layer.
The suggestion was to cache google-generated images in this cacher-layer thingie. Can someone give the a pointer to the details of such a layer? "Details" = where does it live? how do I access it? and more.
Thanks so much!
I will explain what I meant.
First of all I needed this system because Google Chart API has some requests-daily CAP so I needed something to bypass it.
The engine was pretty simple.
Consider the vanilla solution: in your HTML you have your img' src directly poiniting to google.
<img src="//google.chart.api?params123">
With a cacher you will not point directly to Google but to your cacher engine:
<img src="//yourwebsite/googleImageCacher.php?id=123">
Now your googleImageCacher.php is dead simple:
It checks if the image requested is found in a cache (it could be a file or whatever) if it's not present then it will request it to google save it and echo.
Something like: (pseudocode)
$imageAssociation = array( '123' => '//google.chart.api?params123'
'image2' => '//google.chart.api?otherparma' );
if ( file_exists( 'imageCacheDir/' . $_GET['id'] ) ) {
echo file_get_contents('imageCacheDir/' . $_GET['id']);
} else {
//> Request the image to google
//> Save it in the imageCacheDir
//> Print it.
}
Of course you can simplement some expiration time in your googleImageCacher.php

Resources