Lotus-1-2-3 (wk1) file parsing guidelines - javascript

I'm trying to make a little converter from wk1 (lotus-1-2-3) files to excel for a friend. The files have only simple data, no functions or anything really complicated.
I couldn't find anything related to guidelines to parse or documentation of wk1 file structure. I already tried going through libreoffice code but my C++ is very rusty (academic level, 6 years ago).
I usually code in PHP and JavaScript, and I didn't find anything related to this for these languages.
I believe I read somewhere that Lotus-1-2-3 is abandonware now, so I don't think is "illegal" or anything.
Is there any information available about this? What would be the best approach to "decoding" the data (other than that just give up)?
Thanks

For me there is no reason to re-invent the wheel...
There is a free software that can convert these files.
It is even available as portable app AND it has a command- line parameter to convert between formats:
soffice --headless --convert-to <TargetFileExtension>:<NameOfFilter> file_to_convert.xxx
So if you really need an "own" program: package it with the portable version of libreoffice and make a nice interface to select the source and target file and run the command line...

Related

How to compile Javascript console application locally?

I am a beginner in Javascript, I decided to practice Javascript by problem solving using it, I found an online judge that accepts Javascript V8 4.8.0 code.
So, I searched online to get that version of Javascript V8 on my machine, but I couldn't find any easy way, All the pages were explaining how to build it, and it seems to be a process that I don't need to go through.
Is there an easy way to compile and run command line apps written in Javascript on my machine?
Note: I don't want to use node.js because I tried using it's I/O and
as a beginner I think it is complex in some way.
Update: I found that package manager pbox.me which provides a version of V8 JavaScript Engine and I managed to install it.
Yet another problem appeared: whenever I try to run a js file writing d8 myfile.js in command line nothing happens as if it is an empty program, knowing that I tryied to d8.exe file and it is working, and I made sure the PATH is inserted in the environment variables.
What am I doing wrong?
The easiest way to get started with JavaScript is probably to use it in a browser. You can type simple things directly into the browser's JavaScript console (check the menu); or you can embed your code in a simple HTML document.
If you want, you can even pretty easily implement the readline()/print() functions, so you can pretend to be doing stdin/stdout based I/O: just read from an array of strings, and send output to console.log (or create DOM nodes if you want to be fancy and/or learn how to generate dynamic website content by hand).
Side note: V8 4.8 is severely outdated, don't use it to execute code you haven't written yourself.

Haxe externs for JS libraries

Does there exist any central place where all Haxe bindings for JS libraries are meant to be stored? Both if I want to find one, or submit one.
Is there some not outdated working tool to generate these bindings from TypeScript definitions?
Is there a binding for nodejs ws library?
http://lib.haxe.org also known as haxelib, the Haxe package manager. Other than that there are also libraries on Github, which you can install with haxelib git libname https://github.com/bla/bla.git
This kinda sounds like all libs are out of date. There is https://github.com/Simn/ts2hx as you might understand it is not a simple task to create such tool since TypeScript is a different (more dynamic) language and has a different type system which doesnt easily translate to haxe externs. In my experience this lib does 90% of the work. Also it isnt hard to create own externs, but I get you expect free direct-use libs. If tool/lib doesnt work please repot or contribute at the lib; Thats how opensource projects work.
I dont know
Hope this helps! Have a nice day!
Besides Haxelib, you can usually find a ton of stuff on GitHub (e.g. by searching for jsrequire <foo> language:haxe or other keywords). There are also some privately curated extern collections like clemos/js-kit, haxe-node-modules, abedev/npm
Simn/ts2hx is the only one that comes to mind
I found some externs, some of them inside other projects/libraries

Difficult to read source code for some web pages?

I have been trying to find an explanation for this, but everywhere I looked doesn't seem to answer my question. Essentially, whenever I look at the "view page source" option on a webpage like Facebook or my school's home page (gvsu.edu), the source code is just a huge wall of text. As a result, I have a few questions:
Is this how it looks in the editor? If not, why is it formatted this way when I look at the source code?
Is there any way to decipher this code so I can see how it works?
Are there any advantages to formatting the code this way?
Thanks.
Is this how it looks in the editor? If not, why is it formatted this way when I look at the source code?
no, usually programmers try to make code as readable as they can, this is a "minified" version of the code, it's done to make files smaller so people can receive it faster in their browsers.
Is there any way to decipher this code so I can see how it works?
you can use some online tool to like this, you will have to format html, css and javascript individually.
Are there any advantages to formatting the code this way?
already answered, but here I can add that usually you don't format the html/css/js that way, you have a tool that does that job for you like gulp-htmlmin, gulp uglify, cssmin or many others, and you work with a "development" version of the files, when you are done editing you run some scripts and they spit that minified version to you, so you can upload it to your server.

What was used to obfuscate this Javascript or how can I deobfuscate it?

I would appreciate if someone could identify what tool or process may have been used to obfuscate two files.
It is actually code that we hired an HTML5 developer to create. On delivery, some of the .js code was obfuscated. I did specify that we would get the source code, but for various reasons, I don't want to force that, at least not right now. I don't need to edit the source code yet, but I want to know my options and perhaps simplify the situation.
Here are small excerpts from the two files
data.js (from the start of the file)
{"project": [null,null,[[0,true,false,false,false,false,false,false,false,false],[1,true,false,false,false,false,false,false,false,false],[2,true,false,false,false,false,false,false,false,false],[3,false,true,true,true,true,false,false,false,false],[4,true,false,false,false,false,false,false,false,false],[5,false,true,true,true,true,true,true,true,false],[6,false,true,true,true,true,true,true,true,false],[7,false,true,true,true,true,true,true,true,false],[8,true,false,false,false,false,false,false,false,false]],[["t0",5,false,[],0,0,null,[["Default",5,false,1,0,false,3756169185149289,[["imgs/bg-sheet0.png",45907,0,0,1105,500,1,0.5004525184631348,0.5,[],[],0]]]],[],false,false,5609930934870015,[],null],["t1",5,false,[],0,0,null,[["Default",30,false,1,0,false,6181700866648787,[["imgs/m-sheet0.png",3199641,1,1,337,500,1,0.501483678817749,0.5,[],[],0],["imgs/m-sheet0.png",3199641,340,1,337,500,1,0.501483678817749,0.5,[],[],0],["imgs/m-sheet0.png",3199641,679,1,337,500,1,0.501483678817749,0.5,[],[],0],["imgs/m-sheet0.png",3199641,1018,1,337,500,1,0.501483678817749,0.5,[],[],0],["imgs/m-sheet0.png",3199641,1357,1,337,500,1,0.501483678817749,0.5,[],[],0],["imgs/m-sheet0.png",3199641,1696,1,337,500,1,0.501483678817749,0.5,[],[],0],["imgs/m-sheet0.png",3199641,1,503,337,500,1,0.501483678817749,0.5,[],[],0],[.....
runtime.js (also from the start of the file)
'use strict';var ba,ca,da,ea,fa,ga,B,ha,ja,ka,la,ma,na,oa,pa,qa,ta,ua,va,wa,xa,ya,Aa,Ba,O,Da,Ea,Fa,Ga,Ha,R,Ia,Ja,Ka,La,Na,Oa,Pa,Qa,Ra,Sa,Ta,Ua,Va,ab,bb,cb,db,eb,fb,gb,hb,ib,jb,kb,lb,nb,ob,pb,qb,rb,sb,tb,ub,vb,wb,xb,yb,zb,Ab,Bb,Cb,Db,Fb,Gb,Hb,Ib,Jb,Kb,Lb,Mb,Nb,Ob,Pb,Qb,Rb,Sb,Tb,Ub,Vb,Wb,Xb,Yb,Zb,$b,ac,bc,cc,dc,ec,fc,gc,hc,ic={},jc={};"function"!==typeof Object.getPrototypeOf&&(Object.getPrototypeOf="object"===typeof"test".__proto__?function(g){return g.__proto__}:function(g){return g.constructor.prototype});
(function(){function g(a,x,b,f){this.set(a,x,b,f)}function q(){this.xc=this.wc=this.zc=this.yc=this.Oc=this.Nc=this.gc=this.fc=0}function l(a,x,b,f){a<x?b<f?(y=a<b?a:b,p=x>f?x:f):(y=a<f?a:f,p=x>b?x:b):b<f?(y=x<b?x:b,p=a>f?a:f):(y=x<f?x:f,p=a>b?a:b)}function h(){this.items=this.ie=null;this.yi=0;I&&(this.ie=new Set);this.Gh=[];this.ef=!0}function e(a){P[w++]=a}function r(){this.R=this.jl=this.y=this.Rl=0}function c(a){this.qh=[];this.dp=this.fp=this.gp=this.ep=0;this.ej(a)}function b(a,x){this.Xl=a;this.Wl=x;this.cells={}}function t(a,x){this.Xl=;this.Wl=x;this.cells={}}function d(a,x,b){var f;return A.length?(f=A.pop(),f.Km=a,f.x=x,f.y=b,f):new ba(a,x,b)}function a(a,x,b){this.Km=a;this.x=x;this.y=b;this.Ab=new ca}function f(a,x,b){var f;return D.length?(f=D.pop(),f.Km=a,f.x=x,f.y=b,f):new da(a,x,b)}function m(a,x,b){this.Km=a;this.x=x;this.y=b;this.Ab=[];this.Ug=!0;this.fe=new ca;this.Lh=!1}function k(a,x){return a.Pd-x.Pd}ea=function(a){window.console&&window.console.log&&window.console.log(a)};
And from the end of the same file
h.zz=function(e){this.r=e};h.kz=function(e){this.Wh=e};h.sz=function(e){this.J=e};h.rz=function(e,g,c,b,l,d,a,f){this.r=e;this.J=g;this.Wh=c;h.Pt.apply(this,[b]);h.Tt.apply(this,[l]);h.Nt.apply(this,[d]);h.Yt.apply(this,[a]);this.Rb=f;this.zf()};q.eb={};q=q.eb;q.$y=function(e){e.u(this.L/(this.duration+this.na+this.Fa))};q.az=function(e){e.u(this.L)};q.Ps=function(e){e.u(this.duration)};q.Ey=function(e){e.u(this.na)};q.yy=function(e){e.u(this.Fa)};q.Gz=function(e){e.Nb(this.target)};q.Jz=function(e){e.u(this.value)};q.ag=function(e){e.Ea(this.ag?1:0)}})();functionc()return[tc,uc,wc,vc,sc,Z,zc,xc,yc,Ec,Ac,Fc,X.prototype.g.yo,zc.prototype.F.As,zc.prototype.g.Ns,zc.prototype.F.Ko,zc.prototype.F.Ho,zc.prototype.F.Io,zc.prototype.F.Jo,zc.prototype.F.ro,X.prototype.g.Dt,Z.prototype.F.Os,X.prototype.F.du,zc.prototype.F.Rt,Fc.prototype.F.Ut,Fc.prototype.F.Vt,Fc.prototype.F.Mo,Ac.prototype.F.$t,X.prototype.g.Ws,wc.prototype.g.Ys,Z.prototype.g.Ts,Z.prototype.F.Lt,X.prototype.g.cu,tc.prototype.F.Play,X.prototype.g.so,wc.prototype.F.Mt,wc.prototype.g.Dl,yc.prototype.g.Fl,sc.prototype.F.CallFunction,Z.prototype.F.Kt,X.prototype.F.Ot,X.prototype.F.Wt,X.prototype.g.Ks,Z.prototype.F.Zt,Z.prototype.F.St,Z.prototype.g.Xs,X.prototype.F.Gt,X.prototype.F.It,uc.prototype.F.Ss,X.prototype.F.Ms,Z.prototype.F.Qt,Z.prototype.eb.Hl,Ec.prototype.F.Et,Z.prototype.g.to,Ac.prototype.F.Ht,Z.prototype.g.Js,Fc.prototype.g.wo,Z.prototype.g.Hs,Z.prototype.g.Ls,X.prototype.F.Bs,X.prototype.F.au,Z.prototype.g.Is,sc.prototype.g.xj]};
There are many tools available to help deobfuscate code, plugins like javascript-deobfuscator and websites such as this and this can help in the process but sometimes if the obfuscation is incredibly complex or too deep some people have noted problems with performance etc.
As to what tool was used to obfuscate the code that list is also potentially very large as for many people obfuscation is common practice to protect the code as well as to reduce the memory requirement of a script. They are also widely available like this and this. It really depends on the level of obfuscation they wanted to reach.
here are some other popular options for obfuscation:
YUI Compressor
Google closure compiler
JSSCrambler

file layout and setuptools configuration for the python bit of a multi-language library

So we're writing a full-text search framework MongoDb. MongoDB is pretty much javascript-native, so we wrote the javascript library first, and it works.
Now I'm trying to write a python framework for it, which will be partially in python, but partially use those same stored javascript functions - the javascript functions are an intrinsic part of the library. On the other hand, the javascript framework does not depend on python. since they are pretty intertwined it seems like it's worthwhile keeping them in the same repository.
I'm trying to work out a way of structuring the whole project to give the javascript and python frameworks equal status (maybe a ruby driver or whatever in the future?), but still allow the python library to install nicely.
Currently it looks like this: (simplified a little)
javascript/jstest/test1.js
javascript/mongo-fulltext/search.js
javascript/mongo-fulltext/util.js
python/docs/indext.rst
python/tests/search_test.py
python/tests/__init__.py
python/mongofulltextsearch/__init__.py
python/mongofulltextsearch/mongo_search.py
python/mongofulltextsearch/util.py
python/setup.py
I've skipped out a few files for simplicity, but you get the general idea; it' a pretty much standard python project... except that it depends critcally ona whole bunch of javascript which is stored in a sibling directory tree.
What's the preferred setup for dealing with this kind of thing when it comes to setuptools? I can work out how to use package_data etc to install data files that live inside my python project as per the setuptools docs.
The problem is if i want to use setuptools to install stuff, including the javascript files from outside the python code tree, and then also access them in a consistent way when I'm developing the python code and when it is easy_installed to someone's site.
Is that supported behaviour for setuptools? Should i be using paver or distutils2 or Distribute or something? (basic distutils is not an option; the whole reason I'm doing this is to enable requirements tracking) How should i be reading the contents of those files into python scripts?
The short answer is that none of the Python distribution tools is going to do what you want, the exact way you want it. Even if you use distutils' data_files feature, you're still going to have to have your javascript files copied into your Python project directory (i.e., somewhere under the same directory as your setup.py.)
Given that, you might as well just copy the .js files to your package (i.e. alongside mongofulltextsearch/init.py) as part of your build process, and use package_data or include_package_data=True.
(Or alternatively, you could possibly use symlinks, externals, or some such, if your revision control system supports those. I believe that when building source distributions, the Python distribution tools convert symlinks to real files. At least, you could give that a try.)

Categories

Resources