Friday, June 28, 2013

tuning Fossil SCM Ticketing system to show only own tickets



This work is placed in the Public Domain by the original author, Alexandru Toth

Reasons to choose Fossil

Surprisingly, CGI programs written in C such as Fossil are CPU are memory conscious.
Contrary to popular belief, doing FastCGI in a scripting language results in a process that stays alive for a long time, consuming memory. This is a problem in shared servers. (Translation = tried to run a certain ticketing system written in Ruby On Rails with FastCGI, which used all my memory quota)

Hiding navigation except Tickets, Admin, Login

Others had requested similar topics.
From Admin > Header keep only the Home, Tickets, Administration and Login < li > items

Initializing the ticket creator with the user

From Admin > Tickets > New Ticket Page insert the bold line near the top . For example the existing subsystem field is used, but you can roll your own.
set status Open
set subsystem $login 
if {$mutype eq "HTML"} { 

Showing only own tickets

This works by returning an error message instead of rendering the Admin > Tickets > View Ticket and Edit Ticket pages. Bellow the subsystem field was populated with the ticket creator. You can use another field.
Place at the top this code snippet: 
if { ($login ne "revj") && ($login ne "$subsystem" ) } {
error "unauthorised"

Protecting hidden navigation with mod_rewrite

Even if the navigation to Timeline was hidden, typing the URL would still work. With the help of Apache's mod_rewrite it is possible to allow only access to Tickets and Administration. There must be a file called denied.html. RewriteEngine on

RewriteBase /
RewriteRule ^(.*)/timeline /fossil/denied.html [NC,L]
RewriteRule ^(.*)/files /fossil/denied.html [NC,L]
RewriteRule ^(.*)/dir /fossil/denied.html [NC,L]
RewriteRule ^(.*)/fileage /fossil/denied.html [NC,L]
RewriteRule ^(.*)/brlist /fossil/denied.html [NC,L]
RewriteRule ^(.*)/taglist /fossil/denied.html [NC,L]
RewriteRule ^(.*)/tagtimeline /fossil/denied.html [NC,L]
RewriteRule ^(.*)/wiki /fossil/denied.html [NC,L]
RewriteRule ^(.*)/eventedit /fossil/denied.html [NC,L]
...
look at http://www.fossil-scm.org/xfer/help for full list of URL, you may want to block some more
...

RewriteRule ^(.*)rss /fossil/denied.html [NC,L] 

Alternatively, one can block the URL with 403 error (forbidden):
RewriteRule ^(.*)/timeline - [F,L] 

Adding Search

Look at here about searching.

Styling CSS

From Admin > CSS insert the code bellow at the end. This was largely copied from the ISC licensed codebase behind http://chiselapp.com
#navigation { float: right; } ul#main-navigation { margin: 10px 20px 0px 20px; text-align: right; color: #34495E; font-size: 14px; } ul#main-navigation li { display: inline; vertical-align: center; padding: 5px 10px 5px 0; } ul#main-navigation li a { color: #34495E; text-decoration: none; } ul#main-navigation li.color1 { color: #fff; padding: 5px 10px 5px 10px; background-color:#6880CA; /*767396 ; 6880CA; 6880CA; 4684AB , B07645;*/ -webkit-border-radius:4px; -moz-border-radius:4px; -ms-border-radius:4px; -o-border-radius:4px; border-radius:4px; -webkit-font-smoothing:antialiased; } ul#main-navigation li.color2 { color: #fff; padding: 5px 10px 5px 10px; background-color:#E74C3C; /*#A7BABE;*/ -webkit-border-radius:4px; -moz-border-radius:4px; -ms-border-radius:4px; -o-border-radius:4px; border-radius:4px; -webkit-font-smoothing:antialiased; } ul#main-navigation li.color1 a { color: #fff; } ul#main-navigation li.color2 a { color: #fff; } h1 { padding: 0px 10px 0px 10px; margin: 0 0 0 0; }

Wednesday, May 25, 2011

PHP Proxy for QlikView sever

It is quite counter-intuitive that the server-settings for QVS have to be configured in Internet Explorer's settings page, using the same account that is used to run QVS service. Not to mention that whenever the account decides to configure itself as "roaming profile", or the domain policy for Internet explorer is changed, or .. the settings are lost = maps don't work.

Here is another way , where there is a local Apache web server running PHP and acting getting the Google maps thry the same proxy that is configured in Internet Explorer. It uses Windows authentication for the proxy server.

Probaly you can write the equivalent in other webserver (ex IIS ) and other programming language .

$usr = 'user:password';

$proxy = '10.11.12.13:8080';

//force header to JPEG

header("Content-type: image/jpeg\n\n");

//same GET parameters as with Google Maps

$url = 'http://maps.google.com/staticmap?center=' . $_GET['center'] .

'&zoom=' . $_GET['zoom'] .

'&maptype=' . $_GET['maptype'] .

'&size=' . $_GET['size'] .

'&key=' . $_GET['key'];

// create a new cURL resource

$ch = curl_init();

// set URL and other appropriate options

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_HEADER, 0);

//curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, TRUE);

curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_NTLM);

curl_setopt($ch, CURLOPT_PROXY, $proxy);

curl_setopt($ch, CURLOPT_PROXYUSERPWD, $usr);

// grab URL and pass it to the browser

curl_exec($ch);

// close cURL resource, and free up system resources

curl_close($ch);

?>

Monday, May 9, 2011

video about Reverse Snowflake Joins

Hi,

Here is a nice video about RevJ : http://www.youtube.com/watch?v=UPZctPW9Nmc

-Alex

Friday, September 10, 2010

QVPR as a directed graph - part 2

The QlikView 9 management console does not show complex dependencies between tasks , triggers, source documents. Also when deleting tasks there might be "orphaned" categories etc, not visible otherwise.

Let's render it with old and reliable Graphviz. So how does a big graph look like? For example like this (with names removed, due to usual non disclosure agreements)

In case you wonder why it looks small, you probably are using Internet Explorer and it's built-in Adobe SVG viewer. Those lack scrollbars when rendering SVG files, but one can right click and "zoom out" few times. Highly recommend to use any normal browser capable of rendering SVG such as Firefox, or Safari, or Chrome.

-Alex

Tuesday, September 7, 2010

reload metadata


One is able to parse the *.qvw.log files for statements loading from database tables, Excel files or reading / writing to QVD files. again, rendering with Graphviz gives a nice directed graph





QVPR as a directed graph

It takes 11 clicks to get QEMC open the “indented” task dependency. And you still don’t see it properly ..



Wouldn’t a directed graph be easier to understand?

The one bellow is made by extracting task dependencies from Trigger.xml , task names from ExternalProgramTask.XML, PauseTask.xml, DocumentTask.xml; document names from Sourcedocument.xml; categories from Category.xml . Rendering with Graphviz .

It looks as there are 3 reload tasks for same document. Adding also source document confirms it.




Tasks bellow do the same thing. It is easier to replace two external tasks with one (and make the calls from the batch file)

Adding the source documents will not create a mess.


Thursday, March 4, 2010

QlikView : memory limits

My client has several large machines ( 128+ Gb memory, 16+ processor cores) for developer use. There can be tens of instances of qv.exe developer tool running fine at the same time.

That is, until somebody makes a loop in the script, and loads several millions rows, and consumes all available virtual memory. In that case programs (and Windows services) will randomly fail with variations of "out of memory" and "not enough resources". In rare cases memory shortage is so bad that Windows will corrupt disk and registry .

Here is a very good remedy, inspired from Unix "ulimit": kill all processes consuming more than X amount of memory. Of course it is hard to say a correct limit. With current amounts of data, well behaved documents use up 30 Gb memory, and bad scripts consume in excess of 100 Gb memory and crash. There must be a sanity limit somewhere in between.

powershell -command "& {get-process qv | Where-Object {$_.PeakVirtualMemorySize64 -gt 50000000000 } | Stop-Process } "

Powershell is not particularly fast, but other command line tools (ex from Sysinternals) do not display correctly memory usage for 64 bit processes.

Script above is scheduled every 10 minutes, and has improved a lot the availability of the servers. Of course, here and there some developer starts yelling, but so far there was always something wrong with those QVW files. My favourite so far: Export 50 million rows (with calculated columns) to Excel ..

-Alex