Jasper reports – multiple queries per .jrxml file

Using a <queryString> tag in a jasper document only allows one SQL statement. In fact you can add as many SQL statements as you like but only the first one will be processed.

But since almost any report will nicely do with more than one query, the way to achieve it is to use <subDataset> and <datasetRun>. Although these 2 can be used as many times as needed, per jasper document, they can only be embedded in certain tags so be sure you check out the manual.

Example:

<subDataset name="datasetGroupFolders" uuid="0433f4f3-39f4-4505-841a-e5621c781b01"> 
    <parameter name="GroupFoldersParam" class="java.lang.String"/> 
    <queryString> 
        <![CDATA[SELECT STUFF((SELECT ', ' + CollectionName FROM GroupCollections WHERE $X{IN, CollectionID, GroupFoldersParam} FOR XML PATH('')) ,1,1,'') AS GroupFolders]]> 
    </queryString> 
    <field name="GroupFolders" class="java.lang.String"/> 
</subDataset>

 

<componentElement> 
    <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="65" width="552" height="15" isRemoveLineWhenBlank="true" uuid="fc7d22c7-8c60-4ecb-974f-c842becc4bf7"/> 
    <jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical"> 
        <datasetRun subDataset="datasetGroupFolders" uuid="1e20fa2b-bb3a-475f-b721-5a13d3c374eb"> 
            <datasetParameter name="GroupFoldersParam"> 
                <datasetParameterExpression><![CDATA[$P{GROUP_FOLDERS}]]></datasetParameterExpression> 
            </datasetParameter> 
        </datasetRun> 
        <jr:listContents height="15"> 
            <textField isStretchWithOverflow="true"> 
                <reportElement stretchType="RelativeToTallestObject" x="0" y="0" width="552" height="15" uuid="eac696b9-e20f-48a3-b70d-b186f5e649d6"/> 
                <textFieldExpression><![CDATA[IF($F{GroupFolders}.isEmpty(), "", "Group folders: "+$F{GroupFolders})]]></textFieldExpression> 
            </textField> 
        </jr:listContents> 
    </jr:list> 
</componentElement>

 

 

Advertisements

Powershell – code snipets

  • set the Run As Administrator flag on a shortcut
$bytes = [System.IO.File]::ReadAllBytes("$Home\Desktop\Some Shortcut.lnk")
$bytes[0x15] = $bytes[0x15] -bor 0x20 #set byte 21 (0x15) bit 6 (0x20) ON
[System.IO.File]::WriteAllBytes("$Home\Desktop\Some Shortcut.lnk", $bytes)
  • count the number of objects returned by a […] command
[...] | Measure-Object | %{$_.Count}
  • command equivalent to well known *nix ‘tail’
Get-Content -Tail 10 -Wait
  • listing IP addresses for current system
Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=$true -ComputerName . | Format-Table -Property IPAddress
  • getting the user currently logged on
Get-CimInstance -ClassName Win32_ComputerSsytem -Property UserName
  • command equivalent to well known *nix ‘grep’
ls | where {$_ -match '.txt'}
  • delete everything from Recycle Bin
$Recycler = (New-Object -ComObject Shell.Application).NameSpace(0xa)
$Recycler.items() | foreach { rm $_.path -force -recurse }
  • generate GUID
[guid]::NewGuid().ToString()
  • OS version
(Get-WmiObject -class Win32_OperatingSystem).Caption
  • username
[Environment]::UserName
  • SQL instances
(Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server').InstalledInstances

IIS error 503: Service unavailable

Very frustrating stuff getting error 503 corroborated with the following entry in the event viewer:

The worker process for application pool ‘DefaultAppPool’ encountered an error ‘Cannot read configuration file
‘ trying to read configuration data from file ‘\\?\<EMPTY>’, line number ‘0’. The data field contains the error code.

This happened to me after a Windows 7 system was upgraded to Windows 10 Pro x64, and enabling IIS. The default IIS page on the localhost wouldn’t show up.

Instead the HTTP error 503 would be front page and center.

Solution: bit of hint to resolve it was from the default IIS pool, DefaultAppPool, which wouldn’t -ever- start!

Navigating on the local file system: C:\inetpub\temp\appPools you should find a folder named DefaultAppPool. In my case I had a shortcut! That needs to be corrected, something like this:

  • run inetmgr
  • locate the default pool (or any other pool that fails to start)
  • click on pool’s name from the right pane chose View Applications
  • change the pool of the application to something else
  • go back to the list of pools and delete the invalid pool
  • then recreate DefaultAppPool / invalid pool
  • click the pool that the application got changed, the View Applications and assign back the default pool to it
  • restart IIS

At this stage the DefaultAppPool foder should appear in the C:\intepub\temp\appPools and the default, or your local website, should load up.

No more pesky error 503!

TeamViewer: Not ready. Please check your connection

TeamViewer proved to be a nice piece of software every now and then.

Have been using it since version 5 and up to it’s latest v12 incarnation, on systems spanning from Linux, OSX and of course Windows.

This morning thou, on a Windows 7 64bit system, the v12 of TeamViewer (which has been up and happy for like forever) refused to SignIn with it’s back-end; the error:

Not ready. Please check your connection.

It just kept throwing this message whatever I was doing:

  • reset the system
  • uninstall and reinstall
  • disable the Antivirus (Webroot secure Anywhere)

One think did help but I’m not happy about it:

  • turning off the system’s Firewall

 

Is the datastore flag /Scenario/GlobalFlags/AreProductFeaturesSupported set did not pass

That’s the error I got when attempting to install SQL Server 2008 R2 on a system running Windows 10 Enterprise x64:

Is the datastore flag /Scenario/GlobalFlags/AreProductFeaturesSupported set did not pass

An extremely easy fix is to run the SqlSupport.msi package, which is part of the installation media from which the SQL Server 2008 R2 is installed (just search it in there).

The SqlSupport.msi runs pretty quickly and on the face of things doesn’t do much.. well apart from fixing the above error.

Then it’s again back to the main installer, in order to catch errors in the act I’m running it like this:

.\setup.exe /CONFIGURATIONFILE=ConfigurationFile.ini

It did run almost normal and up until almost the very end where it stopped yet again with another error:

Condition "Is the user's scenario set to EditionUpgrade" did not pass

Steps I did to get over this second error:

  • run all of the below from an Administrator account
  • backup the user databases (if needed)
  • completely remove all SQL Server 2008 (and related) packages from Control Panel -> Programs and Features
  • backup the registry
  • reboot the computer
  • delete the following registry keys (using regedit): HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server and HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer
  • go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall and delete all the sub-keys referencing SQL Server
  • go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services and delete all keys referencing SQL Server
  • delete the SQL Server folder from: C:\Program Files\Microsoft SQL Server
  • reboot the computer
  • reinstall SQL Server 2008 R2

 

Thoughts on technology

You can chose to play bridge at a club, or online.

If you’re short on time but you’re still keen on staying alert and fresh in your bridge endeavors then it’s a must to play whenever you can.. like you know: on your way forth and back from work, when you’re stuck in traffic, in a queue of your choice, or waiting for the sleep to come.

So your close friends must be the GIB robots from BBO (Bridge Base Online). You can buy them for a period of time (say a day) and use them to play for money. Or you can open a table with 3 other robots for a quickie.. like a game of 4 or an unlimited stream of hands. You get the picture..

But my take is from another angle. So for every one of us lonely and sad players of bridge there is a potential of 3 robots ready and willing. Are they smart enough, well that’s another story. However, they are there!

But let’s extend this: for every one of us sad and lonely human beings there is always a computer waiting (if you don’t have one or yours gets some ransomware.. ha ha – again another subject but still very close), and there’s also another:

  • smartphone waiting
  • smart fridge waiting
  • smart TV waiting
  • smart car waiting.. Tesla
  • smart wearable waiting
  • tablet
  • RF chip
  • something technical smart and ready enough to help us out
  • Software (in all of them)

Help us.. you say!

Hmm, the other day my little one asked an interesting question, when do numbers finish, as in 1, 2, 3..

Well, my question of same sorts would be: where does smart pieces of technology finish?

Are these numbers double / triple (in stocks waiting to be shipped, or live and kicking) more than humans! Somehow we, humans live and kicking, have created a dormant army of devices which at the moment help us out.. still.

 

Prayer for parents

(‘Ruga pentru parinti’ by Adrian Paunescu, he was a Romanian poet, journalist and politician, 1943 – 2010; this is my interpretation from original)

 

Enigmatically silents
Almost finishing their craft
Near us but they’ll depart
Our sweet dear, dear parents.
Oh God please call them, back
All their hardship long and done
Call and make them young once more
Even younger than we are.

 

For the ones who gave us birth
Issue something just because
And delay their passing cross
Bless them start afresh on earth.
They payed off all of their life
For their children’s many bungle
Oh God keep them all alive
Keep them parents who’ll be gone.

 

Pay attention how they go
Pay attention how they’re gone
Candle’s light this crib alone
They are silent like a snow.
Illnesses of soul and flesh
Take us all into our grave
Whilst we’re here, while they are
Hang in near to your parents.

 

And this earth keeps filling in
Saying goodbye rips us apart
Why oh why, my dear father!
Why oh why, my dear mother!
Oh and why these longest faces
My dear daughter and dear son
I’m the one who’s time is closer
My dears I’ll go too in little while.

 

Why oh why, my dear father!
Why oh why, my dear mother!
You be safe, my dear son!
You be safe, my dear daughter!
Oh dear father, oh dear son,
Oh dear mother, dear daughter.