How to go about creating XLS file (Matlab/HTML/JS)? - html

I have been using MATLAB to ask plenty of questions via questdlg and then saving all the answers as data = {'Name of variable1', 'Name of variable2', etc}. I am on a MAC so xlswrite does not work. I have used xlwrite and it works when I hit run in MATLAB. I have compiled this via the Application compiler and included the xlwrite file. When running the file, the questions are asked, but the file is not created. This is a little odd as it works and creates the file in MATLAB directly.
I switched to dlmcell and this works in MATLAB but not when run externally. As this needs to run on Windows and MAC I would have to use dlmcell? (testing on mac, then distributing on mac and windows).
What I am trying to find out, is why would it work in MATLAB but not when compiled? If this is a big problem, then I thought HTML would be a good choice. Can I write data to .txt/.xls via HTML?
prompt = {'Enter serial number'};
dlg_title = 'Serial Number';
num_lines = 1;
defaultans = {'15'};
Serial_Number = inputdlg(prompt,dlg_title,num_lines,defaultans);
SN = char(Serial_Number) %ANSWER%
prompt = {'Enter your name'};
dlg_title = 'Your name';
num_lines = 1;
defaultans = {''};
Name = inputdlg(prompt,dlg_title,num_lines,defaultans);
User = char(Name) %ANSWER%
%%PREPERATION%%
LicensePI = 'Which license is installed?'; %QUESTION%
set(0,'DefaultImageVisible','off') %Disables icon
LicensePIAns = questdlg('Which license is installed?', 'Preperation', 'Basic', 'Medium','Advanced'); %ANSWER%
LicenseGen = 'Which type of temporary license was preferred?'; %QUESTION%
LicensGenAns = questdlg('Which type of temporary license was preferred?', 'Basic', 'Medium', 'Advanced'); %ANSWER%
%%PREPERATION%%
filename = 'Test.xls';
data = {SN, User, LicensePI, LicensePIAns, LicenseGen, LicensGenAns}
dlmcell('sat.txt',data);

Related

How can I use multi-line matching in a bump2version config file?

I want to use bump2version for a file that looks like this (it's a rust Cargo.toml):
[package]
name = "my_super_package"
version = "0.1.34"
...
[dependencies]
my_other_super_package = { path = "../yadayadayada", version = "0.1.34", registry = "crates-haha" }
...
In the .bumpversion.cfg file, I cannot just use
[bumpversion:file:Cargo.toml]
parse = qv\((?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
because that would accidentally also change the unrelated version of my_other_super_package that coincidentally has the same version number.
The bump2version docs say that search and replace can handle multi-line specs, so I tried
[bumpversion:file:Cargo.toml]
search = name = "my_super_package"\nversion = "{current_version}"
replace = name = "my_super_package"\nversion = "{new_version}"
but the newlines didn't seem to be matched. I also tried
[bumpversion:file:Cargo.toml]
parse = qv(^version = \((?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+))
but the "^version = " part seems to be ignored.
Help?
wandered same question, and found the answer.
File for bumping Cargo.lock and Cargo.toml (so git tree would be clean after VScode autobumping Cargo.lock file), the trick is to use tab symbols (maybe spaces will work as well, didn't test):
[bumpversion:file:Cargo.lock]
search = name = "my-project"
version = "{current_version}"
replace = name = "my-project"
version = "{new_version}"
so after bumping you get in Cargo.toml:
[package]
name = "my-project"
version = "1.2.2"

Samba Audit no filename appear

I'm using samba to provide shares to users. The sometimes claim their files have mysteriously disappeared so I am keen to track deletions.
Thus I set up full audit. Everything works, except the audit log is often missing the file name or has some sort of mystery code. For example;
Dec 12 17:46:04 server1 smbd_audit:
shared|shared|192.168.x.x|matt1|shared|2016/12/12
17:46:04|server1|file_id_create|ok|802:28200da:0
The last item should presumably be a file name. Why is there a number instead?
The relevant parts of smb.conf follows
[homes]
comment = Home Directories directory mask = 0775
browseable = yes
read only = no
create mask = 0775
directory mask = 0775
valid users = %S
writable = yes
vfs objects = recycle
recycle:repository = .RecycleBin
recycle:keeptree = yes
recycle:exclude = *.tmp, *.bak
vfs objects = full_audit
full_audit:prefix = %u|%U|%I|%m|%S|%T|%D
full_audit:success = mkdir rename unlink rmdir open
full_audit:failure = none
full_audit:facility = LOCAL5
full_audit:priority = NOTICE

Getting Multiple Values from a CSV and using them in a For Loop

I'm new to PowerShell, so I'm still getting used to the way variables and for loops are used, but I'd just like to have someone double check my script. I haven't run it yet, as it uses a set command and I'd rather be doubly sure the code works before testing. Once I get some input I'll run a very small number of users through it. The code is for assigning users intercall numbers.
I'm using an excel file that has 4 columns. The columns are labled "userprofilename", "RPTF", "RPTOLL", and "RPConfCode", same as the variables. Here is my code:
$accounts = ipcsv 'C:\Powershell-dest\intercall-numbers.csv'
$accounts | % {
$userprofilename = $_.userprofilename
$RPTF = $_.RPTF
$RPTOLL = $_.RPTOLL
$RPConfCode = $_.RPConfCode
Set-CsUserAcp -Identity $userprofilename -Name "InterCall" -Domain example.com -TollNumber $RPTOLL -TollFreeNumbers $RPTF -ParticipantPasscode $RPConfCode -Url http://www.intercall.com/l/dial-in-number-lookup.php}
I'll of course change "example.com" to the actual domain when I run it. Am I declaring/using the variables correctly?

Corona SDK JSON usage

I have an operating JSON library which I use to load an array of tile IDs. When I double click main.lua directly from file explorer, it runs great, but when I open Corona Simulator and open my project from there or build my project and run it on my testing device, it gives me a null reference error when I attempt to use the data I loaded.
Here is the function to load a table from a JSON file:
function fileIO.loadJSONFile (fileName)
local path = fileName
local contents = ""
local loadingTable = {}
local file = io.open (path, "r")
print (file)
if file then
local contents = file:read ("*a")
loadingTable = json.decode (contents)
io.close (file)
return loadingTable
end
return nil
end
Here is the usage:
function wr:renderChunkFile (path)
local data = fileIO.loadJSONFile (path)
self:renderChunk (data)
end
function wr:renderChunk (data)
local a, b = 1
if (self.img ~= nil) then
a = #self.img + 1
self.img[a] = {}
else
self.img[1] = {}
end
if (self.chunks ~= nil) then
b = #self.chunks + 1
self.chunks[b] = display.newGroup ()
else
self.chunks[1] = display.newGroup ()
end
for i = 1, #data do -- Y axis ERROR IS HERE
self.img[a][i] = {}
for j = 1, #data[i] do -- Z axis
self.img[a][i][j] = {}
for k = 1, #data[i][j] do -- X axis
if (data[i + 1] ~= nil) then
if (data[i + 1][j][k] < self.transparentLimit) then
self.img[a][i][j][k] = display.newImage ("images/tiles/"..data[i][j][k]..".png", k*self.tileWidth, display.contentHeight -j*self.tileDepth - i*self.tileThickness)
self.chunks[b]:insert (self.img[a][i][j][k])
elseif(data[i + 1] == nil) then
self.img[a][i][j][k] = display.newImage ("images/tiles/"..data[i][j][k]..".png", k*self.tileWidth, display.contentHeight -j*self.tileDepth - i*self.tileThickness)
self.chunks[b]:insert (self.img[a][i][j][k])
end
end
end
end
end
end
When it gets to the line for i = 1, #data do it tells me it is trying to access the length of a nil field. Where did I go wrong here?
EDIT: I feel the need to give a more clear explanation of what my problem is. I am getting inconsistent results from this program. When I select main.lua in file explorer and open it with Corona Simulator, it works. When I open Corona Simulator and internally navigate to main.lua, it does not work. When I build the project and test it on my device, it does not work. What I really need is some insight into Corona's JSON library and APK internal directory structure requirements (directory nesting limits, naming restrictions, etc.). If someone thinks of something else that might cause the issue I am having, please bring it up! I am open to anything.
Without seeing the entire error message and not knowing what the value of "path" is it's going to be hard to speculate. But Corona SDK uses four base directories:
system.ResourceDirectory -- Same folder as main.lua and is read-only
system.DocumentsDirectory -- Your writable folder where your data lives
system.CachesDirectory -- for downloaded files
system.TemporaryDirectory -- for temp files.
The last three, while in the simulator are in the project's Sandbox master folder. On device who knows where the folders really are.
In your case, if your JSON file is going to be included in with your downloadble app, your .json file should be in the same folder with your main.lua (or a sub folder) and referenced in system.ResourceDirectory.

How to use "Process Document From File" operator of RapidMiner in Java Code

I have just started using rapid miner for text classification. I have created a process in which i used "Process Document from Files" operator for tf-idf conversion. I want to ask how to use this operator in Java code ? I search on internet but all are using the already created process or word list generated from documents ? I want to start it from scratch i.e.
1 ) Process Documents From File
1.1) Tokenization
1.2) Filtering
1.3) Stemming
1.4) N-Gram
2) Validation
2.1) Training (K-NN)
2.2) Apply Model
May be source code and image below can help You:
String processDefinitionFileName = "/home/maximk/.RapidMiner5/repositories/Local Repository/processes/processOpenCSV.rmp";
File processDefinition = new File( processDefinitionFileName );
Process readCSV = new Process( processDefinition );
File csvFile = new File( "/home/maximk/test.cvs" );
IOObject inObject = new SimpleFileObject( csvFile );
IOContainer inParameters = new IOContainer( inObject );
IOContainer outParameters = readCSV.run( inParameters );
SimpleExampleSet resultDataSet = (SimpleExampleSet) outParameters.getElementAt( 0 );