ALTER DATABASE databasename SET SINGLE_USER WITH ROLLBACK IMMEDIATE ALTER DATABASE databasename SET MULTI_USER
How to retrieve SQL query of QaaWS using BO Java RE SDK
QaaWS is stored as Webi document on the server
To check that QaaWS is represented as Webi document, you can open Query Builder and run the following SQL:
SELECT * FROM CI_APPOBJECTS WHERE SI_KIND='QaaWS'
The property SI_FILES describes the location of the files corresponding to QaaWS and it is actually the WID file:

The following code prints queries for all QaaWS found in CMS:
IInfoObjects objs = infoStore.query("SELECT * FROM CI_APPOBJECTS WHERE SI_KIND='QaaWS'"); System.out.println("Number of QaaWS found: " + objs.size()); for (Object obj : objs) { IInfoObject infoObj = (IInfoObject)obj; System.out.println("------ " + infoObj.getTitle() + " ------"); DocumentInstance widoc = wiRepEngine.openDocument(infoObj.getID()); printQuery(widoc); widoc.closeDocument(); }
The function printing SQL of Webi document
public static void printQuery(DocumentInstance widoc) { DataProviders dps = widoc.getDataProviders(); for (int i = 0; i < dps.getCount(); ++i) { DataProvider dp = (DataProvider)dps.getItem(i); if (dp instanceof SQLDataProvider) { SQLDataProvider sdp = (SQLDataProvider)dp; ArrayList<TreeNode> nodes = getListOfTreeNodes(sdp.getSQLContainer(), true); for (TreeNode node : nodes) { if (node instanceof SQLSelectStatement) { SQLSelectStatement query = (SQLSelectStatement)node; System.out.println(query.getSQL()); } } } } }
Auxiliary functions
The following function finds the list of all nodes in the tree. It might be more convenient then writing recursion:
public static ArrayList<TreeNode> getListOfTreeNodes(TreeNode root, boolean onlyLeaves) { ArrayList<TreeNode> nodes = new ArrayList<TreeNode>(); treeNodeTraversal(root, nodes, onlyLeaves); return nodes; } private static void treeNodeTraversal(TreeNode node, ArrayList<TreeNode> nodes, boolean onlyLeaves) { if (!onlyLeaves || node.isLeaf()) { nodes.add(node); } for (int i = 0; i < node.getChildCount(); ++i) { treeNodeTraversal(node.getChildAt(i), nodes, onlyLeaves); } }
How to Create a Folder in CMS using BO Java SDK
public static void createFolder( IInfoStore infoStore, String name, String description, String parentCUID) throws SDKException { IPluginMgr pluginMgr = infoStore.getPluginMgr(); IPluginInfo plugin = pluginMgr.getPluginInfo(CeKind.FOLDER); IInfoObjects newInfoObjects = infoStore.newInfoObjectCollection(); newInfoObjects.add(plugin); IInfoObject infoObject = (IInfoObject)newInfoObjects.get(0); infoObject.setTitle(name); infoObject.setDescription(description); infoObject.properties().setProperty(CePropertyID.SI_PARENT_CUID, parentCUID); infoStore.commit(newInfoObjects); }
Handling Ctrl+C in a C# console tool (Designer SDK)
Handling exceptions is not enough to make clean up (quit Designer). The following code handles Ctrl+C.
using System; using Designer; namespace ConsoleApplication1 { class Program { delegate void CleanUpMethod(); static void Main(string[] args) { Application application = new Application(); CleanUpMethod cleanUp = delegate { application.Quit(); }; Console.CancelKeyPress += delegate { cleanUp(); }; try { application.LogonDialog(); // ... some code here ... } catch (Exception ex) { Console.WriteLine(ex.ToString()); } finally { cleanUp(); } } } }
Mouse pointer disappearing in Windows 7
I had a problem – my mouse pointer was disappearing after waking up computer on occasion. Nothing helped except System Restore which was not actually very neat solution as restoration also removed important system changes or software.
I spend few hours searching internet for the solution but have not found anything that solved my problem.
What worked for me was to uninstall all mouse drivers and reboot the computer.


Personal File Sharing
If you need easy accessible personal file store, there are a lot of them on the web. Another solution is to use google blobstore service – a geek's choise :)

import urllib from google.appengine.ext import blobstore from google.appengine.ext import webapp from google.appengine.ext.webapp import blobstore_handlers from google.appengine.ext.webapp.util import run_wsgi_app class MainHandler(webapp.RequestHandler): def get(self): upload_url = blobstore.create_upload_url('/upload') self.response.out.write("""<html> <body style="font-family:arial,sans-serif;"> <form action="%s" method="POST" enctype="multipart/form-data"> Upload File:<br/> <input type="file" name="file"/> <input type="submit" name="submit" value="Submit"/> </form>""" % upload_url) for b in blobstore.BlobInfo.all(): self.response.out.write("""<li> <a href="/serve/%s">%s</a> (<a href="/delete/%s">Delete</a>)""" % (str(b.key()), str(b.filename), str(b.key()))) self.response.out.write("</body></html>") class UploadHandler(blobstore_handlers.BlobstoreUploadHandler): def post(self): self.redirect('/') class ServeHandler(blobstore_handlers.BlobstoreDownloadHandler): def get(self, resource): resource = str(urllib.unquote(resource)) blob_info = blobstore.BlobInfo.get(resource) self.send_blob(blob_info, save_as=blob_info.filename) class DeleteHandler(webapp.RequestHandler): def get(self, resource): resource = str(urllib.unquote(resource)) blob_info = blobstore.BlobInfo.get(resource) blob_info.delete() self.redirect('/') def main(): application = webapp.WSGIApplication( [('/', MainHandler), ('/upload', UploadHandler), ('/delete/([^/]+)?', DeleteHandler), ('/serve/([^/]+)?', ServeHandler), ], debug=True) run_wsgi_app(application) if __name__ == '__main__': main()
Cell Borders in Web Intelligence
Web Intelligence cell borders function differently from the borders in Excel. The border in Web Intelligence can have different color from sides. For example, left of two adjacent cells can have gray right border, right can have black left border. The color of the border on the screen depends on the rendering algorithm, i.e. browser, presentation format (PDF, HTML, XLS), View/Edit mode.
To demonstrate this, let's create a report, add a table with three objects to it. Select the middle column and change its borders to be black from each side:

The result can be the following:

You can change spacing between cells and see the cells and the borders:

To make sure that borders are always displayed correctly, set the same color from both sides:

Without spacing, the border will look as desired:

How to fix "Session timed out" (Tomcat)

Resolution
- Stop Tomcat
- Edit "web.xml" files in the following folders (do not forget to make a copy before editing):
- "[Tomcat55 Directory]\webapps\InfoViewApp\WEB-INF",
- "[Tomcat55 Directory]\webapps\InfoViewAppActions\WEB-INF" ,
- "[Tomcat55 Directory]\webapps\AnalyticalReporting\WEB-INF",
- "[Tomcat55 Directory]\webapps\PlatformServices\WEB-INF",
- "[Tomcat55 Directory]\Conf"
- Set the session timeout to 60 minutes
- <session-timeout>60</session-timeout>
- Save and close the "web.xml" file.
- Clean the "Work" directory. Go into "[Tomcat55 Directory]\Work\Catalina\localhost" and delete the following temporary directories (or move somewhere):
- AnalyticalReporting
- InfoViewApp
- InfoViewAppActions
- PlatformServices
- Start Tomcat
- Launch the CMC. Login and go to the Servers tab
- Edit the properties for "ServerName.WebintelligenceProcessingServer" and set the following:
- Idle Connection Timeout (minutes): = 60
- Timeout Before Recycling (seconds): = 3600
- Save and close
- Restart "ServerName.WebintelligenceProcessingServer".
- Test.
Configuring Eclipse on Windows to Use With Google App Engine
The post "Configuring Eclipse on Windows to Use With Google App Engine" on Google has not been updated since 2008. Here is the updated version for Eclipse 3.7 (Indigo).
Before you start, download and install the following components:
- Python – e.g. Python 2.7.2 Windows Installer for Windows
- Eclipse – e.g. Eclipse Classic 3.7
- Google App Engine SDK – e.g. GoogleAppEngine-1.6.0.msi
Python Google App Engine Calculator
Couple of months ago, accidentally I found myself on a conference for Python developers. I thought "what the hell am I doing here". Ok, now I got into an interesting project and have to learn Python… :)
My first program – Calculator:)

import webapp2 class MainPage(webapp2.RequestHandler): def get(self): # build a list of operations f = {'+': lambda x, y: str(float(x) + float(y)), '-': lambda x, y: str(float(x) - float(y)), '*': lambda x, y: str(float(x) * float(y)), '/': lambda x, y: str(float(x) / float(y)), 'C': lambda x, y: "", } # get page parameters x = self.request.get('x') y = self.request.get('y') operator = self.request.get('operator') # calculate result = "" try: result = f[operator](x, y) except ValueError: result = "Error: Incorrect Number" except ZeroDivisionError: result = "Error: Division by zero" except KeyError: pass # build HTML response buttons = "".join(["<input type='submit' name='operator' value='" + o + "'>" for o in sorted(f.keys())]) self.response.out.write("""<html> <body> <form action='/' method='get' autocomplete='off'> <input type='text' name='x' value='%s'/><br/> <input type='text' name='y'/><br/> %s </form> </body> </html>""" % (result, buttons)) app = webapp2.WSGIApplication([('/', MainPage)], debug=True)