Jump to content


HaddockDev's Content

There have been 24 items by HaddockDev (Search limited from 10-February 22)


By content type

See this member's

Sort by                Order  

#272314 What do you want to see in my web browser?

Posted by HaddockDev on 27 November 2017 - 12:41 AM in General

View PostExerro, on 26 November 2017 - 07:07 PM, said:

'NFC' capabilities
Imagine walking into a shop on a server, opening your browser, and seeing a little "Shop wants to show this page" message. You open it and are redirected to the store's page.
Also, imagine placing an order from home, then going into a collection booth where it takes you to a page allowing you log in and get your items.
Hmm. That does sound interesting.

View PostExerro, on 26 November 2017 - 07:07 PM, said:

Animations, animations everywhere!
Animations are awesome. They make a simple UI look good and make it far cleaner looking and more intuitive to use. I'd go CSS-like with `x-transition` and stuff.
I could add some half-baked animation support with some sort of CSS, also I could allow scripts to be loaded as the page is rendered. I'll think about that.

View PostExerro, on 26 November 2017 - 07:07 PM, said:

RGB colour support
New versions of CC support palette changing, which means you can now use full RGB colour (as long as you limit it to 16 distinct colours before rendering). Why not go even further and add in RGBA? (I've done this, it works surprisingly well)
Sure! I'll have to do some hacky things, like having only 4 or so colors available to add custom values (luckily the browser only uses a gray/white theme, so it might work out well)

View PostExerro, on 26 November 2017 - 07:07 PM, said:

Web support
No more `pastebin run X` installers... just navigate to `http://someurl.domain/installer.markup` and have a web page that asks to install the program and shows some info about it too.
I was doing a thing a while ago with OneOS and pkg to install apps, so I might possibly be able to add that.

View PostExerro, on 26 November 2017 - 07:07 PM, said:

Really powerful layout elements
Lists, flows, layouts, and grids - these are the 4 core layout components for me. Lists just sequentially show their children (potentially with reverse order, alignment, etc), flows do the same but wrap when the content goes past the boundary (e.g. the width of the container), layouts position children with absolute positions, but still support things like `50%` for an X value, and grids... are grids.
You should also be able to use constant sizes, relative (X%) sizes, something like "use up this ratio of the remaining space", and "use as little space as possible" (e.g. for text, images, or nested containers).
That was something I plan to add. In some things, I have the align variable so I could use something with that.

View PostExerro, on 26 November 2017 - 07:07 PM, said:

Scrolling support
> There is also no scrolling support, either.
Add it! Scrolling is important, and **way** easier to do with the backend (the browser).
Probably could do that with messing with Y. I'll think about it.

View PostExerro, on 26 November 2017 - 07:07 PM, said:

Styles
Being able to apply a particular style to a multitude of similar elements at once is really important. I think CSS does it quite well, but it's also kinda limited (no variables and somewhat limited selectors).
I was thinking about adding some lua-table configuration or something halfway through writing this post, so I could probably add something like a "lst" (lua style table) tag or something.

I also noticed you had mentioned protocols. I do have protocols in Mercury, with local:/// (the extra / is not a typo, there is just no host), and rdnt://, and pages built into the browser as mercury:// domains, like mercury://home.

View PostWilma456, on 26 November 2017 - 07:40 PM, said:

Does it works mit normal HTML Websites (I know, that CSS and JS are not suported)?
No, it doesn't. It uses its own subset of XML with HTML like tags, as much as I can.



#272258 What do you want to see in my web browser?

Posted by HaddockDev on 26 November 2017 - 05:16 PM in General

Following the release of Firefox Quantum, I decided to make a web browser, a kinda-rendering engine, along with my own subset of HTML using a url parser, and a XML parser. The browser is more hacked-together than anything, but it currently features modem support, local file support, scripts, <text> with x,y and b(ack)g(round) and f(ore)g(ground) support, <a> but only href and x/y/fg/bg, <br>, <hr> using teletext characters, which makes it nice, buttons which invokes the scripts, and probably other things I don't remember.

The script part is very sandboxed. No print, no write, no nothing. You got math and string APIs, then ask/alert functions, a copy of the XML parsed page to edit it, and other things. It is specifically made to be really restricted and secure. Also, scripts can ONLY be invoked by using buttons. You define the scripts, give it an id, then you create a button with the script id as a tag. And only then will scripts work.

There is also no scrolling support, either. You can probably implement this in your page using buttons and scripts.

Screenshots!

So, I'm not entirely sure if I explained everything well (probably not), but I want your thoughts and suggestions for this. It'd be nice.

Thanks for your responses in advance.



#271792 How can you switch between ipairs and pairs?

Posted by HaddockDev on 12 November 2017 - 03:38 PM in Ask a Pro

View PostExerro, on 12 November 2017 - 03:25 PM, said:

What's the form of `self.Scene.View`? If it's a list with indexes (1..n) then there's no reason `ipairs` shouldn't work. Otherwise, you'll have to use pairs.

It is a table holding objects. Keys are IDs, values are OOP classes/tables.

Anyways, I think I've fixed it. It was more of an error on my part, but I think the problem was the names on the for loop and (i)pairs, maybe even my misunderstanding of this stuff. after further testing, it was. also, i didn't edit because of my internet being bad n stuff.
But, thanks anyways.



#271788 How can you switch between ipairs and pairs?

Posted by HaddockDev on 12 November 2017 - 03:06 PM in Ask a Pro

View PostSquidDev, on 12 November 2017 - 02:34 PM, said:

-snip
Why not just use pairs then? If that works, is there any reason to use ipairs? I'm afraid I'm a little confused about the question, as it's not entirely clear what your problem is or what you're trying to achieve - a little more code and context would be useful.
I can't just use pairs. If I throw another button into the mix, I need to use ipairs.
Basically, I have 2 buttons. They both work perfectly fine using pairs. Can't use ipairs though. (probably because of the way i'm storing them: id, then OOP class)
If I throw another button into the mix, making it 3 buttons, I can use ipairs, but not pairs. If I use pairs, then nothing works.

Here's a little more code, this is from the API
elseif e[1] == "mouse_click" then
            --find what it clicked on
            local x = e[3]
            local y = e[4]
            local button = e[2]
            for id,t in pairs(self.Scene.View) do
                if t.X <= x and t.Width + t.X >= x then --x matches
                    if t.Y <= y and (t.Height or 1) + t.Y >= y then --y matches, this is the right object
                        if t["OnClick"] ~= nil and type(t["OnClick"]) == "function" then
                            t:OnClick(x,y,button)
                        end
                        break
                    end
                end
            end
I look through all the objects in the scene using pairs, see if the X and Y matches up (and they do, but not in ipairs with 2 or pairs with 3), then call the OnClick function.
It works with pairs using this code:
local me = QuickDraw.Init() --initing stuff
QuickDraw.AddObject(button) --defined earlier
me.Scene.BG = colors.black
me.Scene:Add("button", "b1")
me.Scene:Add("button", "b2")
--defining properties and stuff
...but if I through in another button, (me.Scene:Add("button","b3")), then pairs doesn't work and I have to switch to ipairs.

That's the best that I can explain it, anyway.
my internet sucks at the moment too, so its hard to post things and it takes a long time for it to go through



#271786 How can you switch between ipairs and pairs?

Posted by HaddockDev on 12 November 2017 - 02:32 PM in Ask a Pro

View PostKingofGamesYami, on 12 November 2017 - 02:03 PM, said:

What? Why would you need to do that?
I have a program that tests the various functions of my API, and when I have 2 buttons, I can click neither of them unless I'm using pairs.

View PostKingofGamesYami, on 12 November 2017 - 02:03 PM, said:

I suppose you could write your own pairs-ish function, but I seriously doubt it's worth the effort.
I probably could, but most likely not.



#271784 How can you switch between ipairs and pairs?

Posted by HaddockDev on 12 November 2017 - 01:48 PM in Ask a Pro

I have a GUI API that allows me to create, well, GUIs. Problem is that I need to switch between ipairs and pairs in order for clicking to work.

Here's where clicking is handled (in a for loop), and sorry for my cruddy coding and OOP.
...
for k,v in ipairs(self.Scene.View) do
...

Thanks in advance.



#271100 QuickPaint

Posted by HaddockDev on 22 October 2017 - 11:15 PM in Programs

Posted Image


QuickPaint is a simple paint program. And when I say simple, I mean its a WYSIWYG (what you see is what you get) program.
The files are also compatible with Paint (from the default ROM). Although it doesn't like loading files that were originally made by Paint, you can load files that were made with QuickPaint and also touched by Paint. (loading directly from paint = bad; making picture in quickpaint, then editing a little in paint = ok) Why? Paint has support for transparency. QuickPaint doesn't.

What makes it Quick?
It isn't. If anything, its a little slower due to the way I program my GUIs!
The "Quick" prefix comes from programs I make, because they're simple. (and no, you can't find these on the web)

What are its features?
  • Makes pictures
  • Somewhat cross-compatibility with Paint
  • Clears (by pressing C)
  • Saves/loads
  • Click the red circle at the upper right hand corner of the screen to quit.
There really isn't much to say. It's a paint program!

How to use:
You use it like a Paint program.
Keybinds: (S)ave, (L)oad, ©lear
Press ? to get help from the program.

Where can I download this?
You can get it on PasteBin - pastebin get 1KAd2e20

Licensing
Under GPLv3. Just PM me if you want to do something like include it in your OS.



#269198 SimpleAdore - wireless made easy

Posted by HaddockDev on 23 August 2017 - 09:55 PM in APIs and Utilities

View PostDave-ee Jones, on 22 August 2017 - 01:10 AM, said:

--snip
However you did make it easier for people to receive a message on a channel. Where you have '_1' that is the side that the message came in on, and '_2' is the channel you are asked to reply on, so that would be the channel the sender would have open so it can catch your reply.

It's a good start though, and it certainly makes it a bit easier for people to use for simple purposes, so I would say you achieved your goal.
Yep, you got it right. I made this to make it easier for prototyping (and doors) but it could be used for simple modem projects.
The side and the reply channel aren't used because of my standards of modem thingys (throwaway the side, and assume reply channel is sender channel + 1) but in a way it kinda makes it easier, I guess.



#269145 SimpleAdore - wireless made easy

Posted by HaddockDev on 21 August 2017 - 02:48 AM in APIs and Utilities

adore the not so amazing

SimpleAdore

wireless made kinda simple, i guess


So... what is this again?
This is a rapid prototyping wireless library thingy that makes wireless easier.
You only need to call about 3 or so functions to get on the air, plus transmitting and receiving is a lot easier, considering you just call the Recieve function or the Transmit function and it does all the work for you.

Why is SimpleAdore named SimpleAdore?
tl;dr recycling code
I was developing a Door Lock API named Adore, and nothing worked so I rewrote it but 90% of it was non-door-lock code stuff so I took that out, cleaned it up a bit and here we are.

What can this be used for?
Anything that uses modems/rednet. For testing, I used this to make a what-you-see-is-what-you-get wireless door lock (which will be released soon).
And guess what? It is 78 lines smaller than my door lock without the library on the server side, and it is 61 lines smaller on the client side.

Also, for the license: this is under a GPLv3 license.
You may use this in your program, just attribute me and you're in the clear.

Where can I download this?
From PasteBin - pastebin get mXGfG7Kw SimpleAdore

Docs

Current issues:
  • No check for if you actually setup the modem by running WrapModem
  • Automatic modem discovery thingy is touchy/doesn't work



#266390 How to make the Multitasking OS like OneOS?

Posted by HaddockDev on 16 April 2017 - 11:53 PM in Ask a Pro

SquidDev's right. If you want to make a multitasking OS, and you aren't that good at Lua: you are going to be in for a very long time.
Things you are going to have to learn: sandboxing, courotines, the event system, filesystem, a ton of Lua syntax, and much much more.

A good idea is to browse the CC wiki if your new to Lua because it will provide you with a lot of information and tutorials and such.

TL;DR: learn lots of lua, browse the wiki, use tutorials for help, and use Ask A Pro if your really stumped.



#266310 OneOS Version 2 - The All in One Operating System

Posted by HaddockDev on 15 April 2017 - 03:52 PM in Operating Systems

View PostWattanaMC, on 06 April 2017 - 07:36 PM, said:

Fix crashes on craftos 1.7 please
OneOS isn't being developed anymore.
Which, means it isn't being fixed anymore.



#265096 Lempel Ziv Welch (LZW) Compression

Posted by HaddockDev on 25 February 2017 - 11:52 AM in APIs and Utilities

View PostKingofGamesYami, on 14 February 2017 - 03:44 PM, said:

Read the first four lines of the file you linked.

Specifically,

Quote

This code is MIT licensed, see http://www.opensourc...mit-license.php
© 2013 - Guava

Ah, my bad. I'll write a little notice now.



#264772 Lempel Ziv Welch (LZW) Compression

Posted by HaddockDev on 14 February 2017 - 02:43 PM in APIs and Utilities

View PostBomb Bloke, on 14 February 2017 - 12:03 AM, said:

Don't forget to follow the terms of the original license!
There was none, so I just ported it. But, I still gave credit.

View PostBomb Bloke, on 14 February 2017 - 12:03 AM, said:

You might consider adding linebreak codes, such as \n and perhaps \r, to your dictionary. Tabs (\009) wouldn't hurt either.

Yeah, I could. I'll update it later.



#264752 Lempel Ziv Welch (LZW) Compression

Posted by HaddockDev on 13 February 2017 - 06:32 PM in APIs and Utilities

LZW is a sorta not really kinda compression algorithm thingy created by Abraham Lempel, Jacob Ziv, and Terry Welch hence the name, Lempel Ziv Welch. It is used in the *nix program compress, and GIF images.

I have ported somebody's implementation of it in Lua, you can find the original here.

It isn't really that bad, but it has it's quirks. (Shaves 1 character off of "This is a test.", your mileage may vary.)
It is also fast, less than a second for "This is a test."

Usage

You can download it with: pastebin get WZKTR9q4 lzw
Yeah, I know about the typos. I originally thought it was LWZ.
Also, sorry about the sad mush of a post I made. Couldn't upload much because were dealing with a storm at the moment

The API is licensed under MIT because of the original file.
You can find a layman term page for MIT here.



#264344 Hacking an OS

Posted by HaddockDev on 02 February 2017 - 10:27 PM in Ask a Pro

View PostTechnicalCoding, on 02 February 2017 - 10:14 PM, said:

The hard solution is to create your own IDE which would check if there is any errors with the LUA code that the user creates and print them out, this prevents that the user can "Crash" the OS, then also create a folder for every user that the user is limited to. for example 'users/Username/scripts' and inside this scripts folder the user can create folders and edit files, but are limited to go out of that folder.

I am currently working on an Advanced operating system and I would happily be doing a collab with you!

I am also very experienced in web languages and will create a appstore for my OS, also I will use online login forms and register forms so the user can connect to the forums and socket servers. And include graphical content such as a draw function to create boxes,

another of my current project is similar to cshtml or asp.net, basically create luahtml, so basically you will be able to use html, and create script tags where lua code will be executed. And a lot of custom events and clickable guis, etc.

Please add me on skype: technicalcoding
if you want to collaborate with me :)

Just because your linting something doesn't mean its completely crash proof.
The least you could do is loadstring and xpcall it, but that means when it crashes, instead of getting sad it will do a function instead of erroring out.



#264343 Does any Linux user experience that too?

Posted by HaddockDev on 02 February 2017 - 10:26 PM in General

View PostPiorjade, on 02 February 2017 - 10:09 PM, said:

View PostHaddock, on 02 February 2017 - 08:32 PM, said:

I've been running Plasma 5.8 on Kubuntu 16.04 and haven't been experiencing problems.
yet.
The funny thing is that I'm on a wayyyy lower end card and computer (AMD A10 with built in Radeon (Linux says its a AMD Gallium 0.4) on a laptop, sigh)
At least I think it's lower end.

tl;dr such working wow no problem much fast

Yeah KDE worked for me too.
Now try something like XFCE or Unity and tell me if that happens like it did for me! :)

In past experiences when testing Unity 8 it worked fine for me.
Haven't tested XFCE yet, I'll do it later tonight.

The only thing I could think of that might be slowing it down is the rendering.
I can't recall any time I've had to wait a few seconds for a Java program to show up to be completely honest.



#264340 Hacking an OS

Posted by HaddockDev on 02 February 2017 - 10:03 PM in Ask a Pro

View PostAnavrins, on 02 February 2017 - 09:57 PM, said:

View PostHaddock, on 02 February 2017 - 08:21 PM, said:

You could do some encryption (not recommended though)
Maybe have the user input a password to decrypt the system files on startup, so if somebody puts in a disk they wouldn't be able to modify the files without knowing the users password.
To be honest, I find it really flawed, but its worth a try.
In case you're referencing my post, just letting you know that both programs I stated does not decrypt on startup, but overrides fs.open to read an encrypted file and return an unencrypted handler.
Data never get's decrypted on disk, only in memory.
Of course your method is flawed, but not this one.
No, wasn't referencing your post, and yes I know that method has more holes than account password management in Windows.

[offtopic]No offence, but your program reminds me of the OneHalf virus of the MS-DOS days.[/offtopic]



#264338 Chameleon - your thoughts!

Posted by HaddockDev on 02 February 2017 - 09:56 PM in General

This is a project I've been working on for the past few days. It is a EFI-like bootloader (Kinda like the Mac bootloader)

It works like the Mac bootloader (or so I think), basically it gives you a second to put in a boot modifier and then loads Mac OS.
Basically, I have a front end (shown below) which is basically a looping loading screen. It may look like it is doing nothing but in reality it has a script running in the background. The script sets up the environment, then says "Hey, I'm finished, you can run this function now!". The function in question (ChameleonDone) MUST be defined in the script, or else the bootloader gets sad.

Posted Image

So far, I've been able to make OneOS able to run under Chameleon.
Posted Image
(You don't get to see the animation since it's in a emulator, it's that fast.)
(Another note, for some reason OneOS boots faster in Chameleon than it's native bootloader. It might be that I stripped a lot of code that was not needed though)

So, this is the tl;dr version of what Chameleon does:
  • waits for boot modifier (z for shell, x for custom startup script)
  • launches /boot
  • while the animation is playing, the script is doing things to setup the environment (?)
  • once the script is done it will launch the ChameleonDone function
  • ???
  • Profit!
There is a log function too, but it is mainly used for scripts.

I am going to release the source sometime tonight, along with the OneOS script.
Chameleon
OneOS start script (save to /boot)

Anyways, I'd like your thoughts on this and on how I could improve it.
Thanks for any feedback.

I'm not entirely sure if I'm/anybodys going to use this, but I decided to make it anyway.



#264336 Does any Linux user experience that too?

Posted by HaddockDev on 02 February 2017 - 08:32 PM in General

I've been running Plasma 5.8 on Kubuntu 16.04 and haven't been experiencing problems.
yet.
The funny thing is that I'm on a wayyyy lower end card and computer (AMD A10 with built in Radeon (Linux says its a AMD Gallium 0.4) on a laptop, sigh)
At least I think it's lower end.

tl;dr such working wow no problem much fast



#264335 Hacking an OS

Posted by HaddockDev on 02 February 2017 - 08:21 PM in Ask a Pro

You could do some encryption (not recommended though)
Maybe have the user input a password to decrypt the system files on startup, so if somebody puts in a disk they wouldn't be able to modify the files without knowing the users password.
To be honest, I find it really flawed, but its worth a try.

Another idea if your testing security is to publish it on GitHub and get a few people to break the security.
One more idea is to go do something like Google does when it finds out that Chrome OS has been tampered with. Still, flawed.

The only other piece of advice I can give is to think like an attacker:
Think of attack vector. Try attack vector. Fix if required.
Rinse and repeat.



#264334 Making programs inside a program

Posted by HaddockDev on 02 February 2017 - 08:02 PM in Ask a Pro

A good idea if your making a program is to use [[ and ]] for multi line strings(?).
If you need to supply some custom variables (maybe iteration of program) a good idea is to concatenate your variable to the start.
Here's a sample program you could hack on:
local code = [[
print("This is program number " .. n .. "!") --Notice the absence of n being defined.
]]
write("How many programs do you want to make? ")
inp = read()
amount = tonumber(inp)
if inp == nil then --Check if its actually a number
  error("Not a number")
end
for i=1,amount do --basically for(int i = 0; i < amount; i++) for some languages
  print("Program " .. i)
  local h = fs.open("program" .. i, "w") --open file in write mode
  h.write("local n = " .. i .. "\n") --add the n variable
  h.write(code) --write our code
  h.close() --close the file
end

If you run it, and give it say 5 programs to make, run one of them and it should output "This is program number <number>!"



#263490 pkg | Packager with rotate encryption!

Posted by HaddockDev on 07 January 2017 - 01:34 PM in APIs and Utilities

View PostLupus590, on 30 December 2016 - 03:41 PM, said:

View Postemerald, on 30 December 2016 - 03:10 PM, said:

Hey, can I use this and package an edited version of this by default with my OS? Because my OS will come with a tool to package software and basing it off of this would be the quickest way to do it.

View PostHaddock, on 26 November 2016 - 03:05 PM, said:

Yes, you can use it in your program, following CC-BY-ND.

Edit: Just realized, you want to edit it which the license doesn't allow.

@Haddock, Creative Commons is not designed for code, you may want to try another license. Also, why don't you want modifications? Would a state changes clause be ok?

Yeah, I'd go for a state changes clause. I don't mind people making changes, in fact it's more of a "state me and it's ok" kind of thing.
And I know Creative Commons isn't really for code, more of media. I was starting to regret putting that in as my default license, I'll change it later on today.

This was more of a minor project to be honest, I love FOSS and all of my minor programs are under some sort of Creative Commons (if I remember correctly) because I thought it was kinda fair, well, its more of what you see is what you get and if your unsure/need permissions PM me.

I'll update my licenses to maybe something more friendlier, like GPL or MIT.

View Postemerald, on 30 December 2016 - 03:10 PM, said:

Hey, can I use this and package an edited version of this by default with my OS? Because my OS will come with a tool to package software and basing it off of this would be the quickest way to do it.

Yeah, go ahead.



#262402 tableDump - a simple way to save a table to a file and view it

Posted by HaddockDev on 02 December 2016 - 08:22 PM in APIs and Utilities

View PostBomb Bloke, on 02 December 2016 - 03:34 AM, said:

textutils.serialise() is also unable to handle functions.

View PostStekeblad, on 02 December 2016 - 03:14 PM, said:

I wrote this because textutils cant handle functions inside a table.
Oh, sorry for my mistake then. Well, technically it could by using string.dump on a function combined with loadstring, but I'm not exactly sure if that'd work or not.



#262388 tableDump - a simple way to save a table to a file and view it

Posted by HaddockDev on 02 December 2016 - 03:02 AM in APIs and Utilities

Couldn't you just use textutils, instead of writing some functions? (But I do admit, nice code)
Something like
function save(table, file)
local h = fs.open(file, "w")
h.write(textutils.serialize(table))
h.close()
end

--fyi, i did not make this code really nice and functional, its a "do as i say, and dont complain" kinda thing

function load(file)
local h = fs.open(file,"r")
local r = h.readAll()
h.close()
return textutils.unserialize(r)
end
Not trying to criticise you, but CC already has an API for it. You did do a good job of coding it though.
[offtopic]Now I'm having flashbacks to creating the pkg encryption function, bad times.[/offtopic]