Can we use a text file to import the SQL code in TM1 turbointegrator process? - cognos-tm1

I have saved the SQL code in the text file in a path (e.g. C: /docs/test.txt) and trying to read and execute it in Tm1 TI process.
Here's the code:
content vInFileName = 'c:\documents\code.txt';
s_SQL = open('vInFileName',read,In), repeat, read_line_to_codes(In,X),writef(" "), writef(X),nl, X=end_of_file,!, nl, close(In) ;
vOutFileName = 'c:\documents\output.txt';
ASCIIOUTPUT(vOutFileName, s_SQL);

Short answer: yes. Your code is not a Turbointegrator code though.
Try looking at IBM TM1's ODBC TI reference pages: ODBC TurboIntegrator Functions

Related

Array of large amount of integers in xml string file Kotlin android Studio

I want to make a Spinner to select the age ofthe users of my app. I wanted to know how I could create an array of all integers between 0 and 10 in the string resource file .xml in android Studio.
This is what I thought I was going to do
<integer-array name="AgeArray">
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>10</item>
<item>12</item>
<item>13</item>
<item>14</item>
<item>15</item>
<item>16</item>
<item>17</item>
<item>18</item>
<item>19</item>
<item>20</item>
</integer-array>
But I thought that there must be a more elegant, more efficient way of creating such an array, or am I wrong?
Thanks in advance
You cannot write to a resource file (at runtime), resource files are read-only.
While developing you can create a scratch file in Android Studio, execute the following code and then copy-paste the result from the output panel to the resource file:
val list = (1..100).joinToString("\n") { " <item>$it</item>" }
val xml = "<integer-array name=\"AgeArray\">\n$list\n</integer-array>\n"
println(xml)

How to save table output in an exportable manner in Sage

I am a sage novice trying to export a table output to some image format (so that it might be shared). I tried using the .save() function as so:
my_table1 = table(my inputs)
result = my_table1.transpose()
result.save('here')
My table outputs properly after I run the program (not featured), but for some reason I receive the following error when I try and save the table:
"Error! /home/sage/Documents/here.sobj is not UTF-8 encoded
Saving disabled.
See Console for more details."
Any help in exporting this table is greatly appreciated. Additionally, if you require any more information please do not hesitate to ask!
Background: I am working in Jupyter for Sage on a browser via localhost/8000; not sure if that matters. My OS is Windows 10 and I am using Sage version 7.6.
Would LaTeX output help? Using an example in the documentation for table?:
rows = [['a', 'b', 'c'], [100,2,3], [4,5,60]]
table(rows)._latex_()
'\\begin{tabular}{lll}\na & b & c \\\\\n$100$ & $2$ & $3$ \\\\\n$4$ & $5$ & $60$ \\\\\n\\end{tabular}'
You could try for the html but that would be harder, because it returns a HTMLFragment object, and you'd need the MathJax for it to look right.
str(table(rows)._html_())
'<div class="notruncate">\n<table class="table_form">\n<tbody>\n<tr class ="row-a">\n<td>a</td>\n<td>b</td>\n<td>c</td>\n</tr>\n<tr class ="row-b">\n<td><script type="math/tex">100</script></td>\n<td><script type="math/tex">2</script></td>\n<td><script type="math/tex">3</script></td>\n</tr>\n<tr class ="row-a">\n<td><script type="math/tex">4</script></td>\n<td><script type="math/tex">5</script></td>\n<td><script type="math/tex">60</script></td>\n</tr>\n</tbody>\n</table>\n</div>'
In any case, the image wouldn't be savable as-is. Unless you took a screenshot!

Could not find the reference to GUID_DEVINTERFACE_NET class

I am using MS VS2008 to build my application. I need to use "GUID_DEVINTERFACE_NET " class to get the device interface list. But i could not find the reference to this class. I have even tried in MS VS2015 but could not the reference.
Below is the code snippet.
ULONG DeviceListLength = 0;
cr = CM_Get_Device_Interface_List_SizeW(&DeviceListLength,
(LPGUID)&GUID_DEVINTERFACE_NET,
NULL,
CM_GET_DEVICE_INTERFACE_LIST_PRESENT);
The Microsoft online documentation is not very detailed, but it does mention the header file Ndisguid.h. The filename might use a different case, but the Windows file system is not case-sensitive anyway:
#include <ndisguid.h>
references:
https://msdn.microsoft.com/en-us/library/windows/hardware/ff545922(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/hardware/ff538471(v=vs.85).aspx

Play Scala: How to access multiple databases with anorm and Magic[T]

I want to access two databases in Play Scala with anorm and Magic[T], (one is H2 and another is PostgreSQL). I just don't know how to config it...
I noticed that we can set another database connection in conf/application.conf
db_other.url=jdbc:mysql://localhost/test
db_other.driver=com.mysql.jdbc.Driver
db_other.user=root
db_other.pass=
However, how can I use it with Magic?
(I read the source code of Magic but don't understand it... my am a freshman of Scala)
Anyhow, if multiple database access is impossible with Magic[T] , I wish to do it with anorm, then how can I config it?
var sqlQuery = SQL( //I guess some config params should be set here, but how?
"""
select * from Country
"""
)
In play.api.db.DB it appears you can pass in a string of the name you defined in application.conf.
Then use one of the methods specified here: http://www.playframework.org/documentation/2.0/ScalaDatabase
# play.api.db.DB.class
def withConnection[A](name : scala.Predef.String)(block : scala.Function1[java.sql.Connection, A])(implicit app : play.api.Application) : A = { /* compiled code */ }

Octave select a file?

Does Octave have a good way to let the user select an input file? I've seen code like this for Matlab, but doesn't work in Octave.
A gui based method would be preferred, but some sort of command-line choice would work also. It would be great if there were some way to do this that would work in both Matlab and Octave.
I found this for Matlab but it does not work in Octave, even when you install Octave Forge Java package for the listdlg function. In Octave, dir() gives you:
647x1 struct array containing the fields:
name
date
bytes
isdir
datenum
statinfo
but I don't know how to convert this to an array of strings listdlg expects.
You have already the Octave Forge java package installed, so you can create instances of any java class and call any java method.
For example to create a JFileChooser and call the JFileChooser.showOpenDialog(Component parent) method:
frame = javaObject("javax.swing.JFrame");
frame.setBounds(0,0,100,100);
frame.setVisible(true);
fc = javaObject ("javax.swing.JFileChooser")
returnVal = fc.showOpenDialog(frame);
file = fc.getSelectedFile();
file.getName()
Btw. I had some troubles installing the package.
Here is a fix for Ubuntu. that worked also for my Debian Testing.
EDIT
#NoBugs In reply to your comment:
If you need to use listdlg you can do the following:
d = dir;
str = {d.name};
[sel,ok] = listdlg('PromptString','Select a file:',...
'SelectionMode','single',...
'ListString',str);
if ok == 1
disp(str{sel(1)});
end
This should be compatible with matlab, by I cannot test it right now.
If you want to select multiple files use this:
d = dir;
str = {d.name};
[sel,ok] = listdlg('PromptString','Select a file:',...
'SelectionMode','multiple',...
'ListString',str);
if ok == 1
imax = length(sel);
for i=1:1:imax
disp(str{sel(i)});
end
end
I never came across an open-file-dialog in octave.
If you are looking for a gui based method maybe guioctave can help you. I never used it, because it appears only be available for windows machines.
A possible solution would be to write a little script in octave, that would allow the user to parse through the directories and select a file like that.
Thought I'd provide an updated answer to this old question, since it is appearing in the 'related questions' field for other questions.
Octave provides the uigetdir and uigetfile functions, which do what you expect.

Resources