3
0

coding thread


 invite response                
2022 Oct 18, 8:27pm   11,024 views  95 comments

by richwicks   ➕follow (2)   💰tip   ignore  

Since there are a significant number of nerds here, I wanted to start a thread for projects.

People seem to INSIST on using cloud storage, which removes your ability of privacy, so I'm going to write a strong encryption program using the NaCL librarary;

https://nacl.cr.yp.to/

The goal here is that the resulting encrypted data is impossible to recover without getting the original key. Keys are changed regularly, and being able to brute force one block will give the attacker no advantage in cracking the next block.

Also, it will be computationally expensive to attempt to crack even with specialized hardware. This increases energy consumption and slows down the encryption and decryption, but also will make brute force attacks 1000's of times slower.

« First        Comments 30 - 69 of 95       Last »     Search these comments

30   SunnyvaleCA   2023 Jun 13, 11:19pm  

richwicks says

I believe this solution can be made with a single calculation, with 3 edge cases

Perhaps your problem is different than the LeetCode one, but I don't think so.
Here's my understanding of a simplified version of the problem you had...
Suppose, for simplicity, the 0th CPU was the special one. If you give it 8 jobs then the whole set of CPUs get 8, 7, 6, 5, etc. jobs. The catch is that every CPU after the 7th needs to get 1 job (the minimum number of jobs) — not 0, -1, -2, -3, etc. So the distribution of jobs is non-linear and so the solution is not a polynomial. When the binary search "guesses" an answer, it can verify in constant time, so the algorithm runs in log(n) time. That might be "sloppy," but if the count of CPUs and count of jobs each fit in a 64-bit integer, logarithmic time will be nearly instantaneous on the worst possible input.
31   richwicks   2023 Jun 14, 1:33am  

SunnyvaleCA says


richwicks says


I believe this solution can be made with a single calculation, with 3 edge cases

Perhaps your problem is different than the LeetCode one, but I don't think so.
Here's my understanding of a simplified version of the problem you had...
Suppose, for simplicity, the 0th CPU was the special one. If you give it 8 jobs then the whole set of CPUs get 8, 7, 6, 5, etc. jobs. The catch is that every CPU after the 7th needs to get 1 job (the minimum number of jobs) — not 0, -1, -2, -3, etc. So the distribution of jobs is non-linear and so the solution is not a polynomial. When the binary search "guesses" an answer, it can verify in constant time, so the algorithm runs in log(n) time. That might be "sloppy," but if the count of CPUs and count of jobs each fit in a 64-bit integer, logarithmic time will be nearly instantaneous on the worst possible input.



OK, here's the solution, that doesn't quite work.

The problem is really you have an array (that's the CPUs) and every element in the array must contain at least "1". If you add up all the values of the array, you will have the value V.

No element in the array can be +/- 1 form an adjacent element in the array. The value next to to any adjacent element can't be more than 1 off, but the difference can be 0.

Find the maximum value you can place in the array with these constraints given that all values in the array need to add up to V

SO - here is what I did. I think of it as a volume. The value "V" is a volume

First, since V is really a volume, the minimum height can be calculated with:

V = W x H
H = V/W

We need 1/3rd of the volume to build the pyramid, so the max height is actually

2/3 V = W x H
H = (2/3 V) / W
H = 2 x V / W x 3

that's the height of the base, the rectangle.

Now, the area of a triangle is 1/2 x W x H. The volume of this is 1/3V

1/3V = 1/2 x W x h

h = 1/3V * 2 / W
h = 2/(3V x W)

Add H and h together, and you get the result.

BUT I'm ignoring a few constraints.

My mind is still baking on this problem. I think a binary search is a sloppy method to do it. I'm confident this can be done arithmetically with at most 3 constraints.

Fucking math. Give me a math problem, and I can't stop working on it until I solve it.

First, you subtract W (number of array elements) from the volume. then you calculate the rectangle, then produce the highest possible pyramid on top of that from the 1/3rd of that block. It's all integer math as well, so if you can't produce a block, you just have the remainder to work with, or if you can produce a block it's 1/3rd of the block PLUS the remainder. It's all complicated because of it being integer math, and I need to think more on it.

I bet this can be done with float math, and get within 1 of the true value, if not always being correct if you always round down.

But this neglects the edge cases where the top point is at the start of the array, or at the end of the array.
32   GNL   2023 Jun 14, 5:18am  

Can I take a poll with you all?
If you were starting from scratch, what would you use to create a commercial website?

What the site does: upload/download (domestic and overseas), payments, Google map and Google calendar to create schedules based on time/distance, overlays on photos until payment is made, cron jobs for deleting old files/images and emails, user rearranging/sorting images for slideshow displays, user registrations, api for transferring images and links to other websites and image mapping.

Also: when and/or what would make you recommend a client rewrite a company website?
33   fdhfoiehfeoi   2023 Jun 14, 8:09am  

richwicks says

Have them learn a very low level language like assembly (useless) to understand what the machine does.


Good callout. C or C++ are the still the preferred language for physical machines that have to do very high load operations. When I worked at Illumina, their DNA analysis SW was all C I believe.

Also forget to mention Python seems to be the language of choice for AI if you are interested in getting into that.
34   fdhfoiehfeoi   2023 Jun 14, 8:16am  

GNL says

If you were starting from scratch, what would you use to create a commercial website?


Before I left a former company, we were in the process of re-writing our travel site integration with EAN(Expedia) as a single page Python app. But I would guess most people would say Javascript, probably React?

Don't invest time in a re-write unless you will gain some significant improvements for your clients, increase your reach, something tangible that improves your bottom line. Worst case you have some massive security issues or you have spaghetti code you have to keep adding to that will make your site impossible to update, then you might have to consider it just for maintenance, but hopefully you've laid a better foundation than that.
35   Tenpoundbass   2023 Jun 14, 8:33am  

Do it in MVC

I once did a similar project for a Nautical Satellite company. I used Google Maps to place the ships coordinates and routes on Google maps.
I did it for a job interview for the company. I turned it around in about 4 days over a three day weekend, and the interviewer wasn't back on the fourth day.
The interviewer gave me an end point, that returned nothing but a bunch of numbers separated by a comma. I guessed that they were x and y coordinates. And ended up being right. Exploring the Help endpoint further I found the View, Details and Insert endpoints. When I emailed it back to them, the interviewer still wasn't back and was out for over two weeks. I ended up taking another job in the meantime. When the guy got back he was telling me that it was better than what they were expecting. No other candidate figured out what the end point was, or even returned the completed test project. All they wanted was someone to hit the end point, and realize what it was and anything beyond that would have been gravy. I was at the time, trying to really figure out MVC beyond using wizard and data connecters GUI's, that I found just so restricting and limited if you go by most common MVC documentation. That little project gave me insight on ways to use MVC that 90% of the people that use MVC don't believe is possible. They wanted me to start right away, but I already took the other job. So they asked me if they could use the test project I sent them as the foundation to build their software.

I still have a copy of that project if you are interested.
36   Tenpoundbass   2023 Jun 14, 8:41am  

NuttBoxer says

Don't invest time in a re-write unless you will gain some significant improvements for your clients, increase your reach, something tangible that improves your bottom line. Worst case you have some massive security issues or you have spaghetti code you have to keep adding to that will make your site impossible to update, then you might have to consider it just for maintenance, but hopefully you've laid a better foundation than that


Always do a rewrite. Normally by time you are called to bring a Customer's software to the next level. The previous developer had already coded the project into a hard corner. And the new business requirements would be impossible to factor in without creating a buggy broken system.
If the data model is good, and the enterprise is happy with it. Then the best and quickest way to do a rewrite is to use Code Generating SQL against the tables. I can stub out a whole Enterprise suite in under a week. Then only need to write the business logic layer and the client Scripts.

Examples below...
37   Tenpoundbass   2023 Jun 14, 8:42am  

declare @TableName sysname = 'TaxLine'
declare @result varchar(max) ='[DataObject(true)]
public class ' + @TableName + 'DB
{' + '
' + @TableName + 'Context DFctx = new ' + @TableName + 'Context();

public ' + @TableName + 'DB(){

}'

select @result = @result + CHAR(13)
+ ' [DataObjectMethod(DataObjectMethodType.Select)]
public List<' + @TableName + '> Select(int tableId, int _userid)
{
return DFctx.Get' + @TableName + 'singleton(tableId, _userid);
}
public ' + @TableName + 'Selects(int tableId, int _userid)
{
return DFctx.Get' + @TableName + '(tableId, _userid);
}
[DataObjectMethod(DataObjectMethodType.Select)]
public List<' + @TableName + '> Select(int _userid)
{
return DFctx.Get' + @TableName + '(_userid);
}
[DataObjectMethod(DataObjectMethodType.Insert)]
public void Insert(Dynamic' + @TableName + ' DTable, int _userid)
{
DFctx.Insert' + @TableName + '(DTable, _userid);
}

[DataObjectMethod(DataObjectMethodType.Update)]
public void Update(Dynamic' + @TableName + ' DTable, int _userid)
{
DFctx.Update' + @TableName + '(DTable, _userid);
}

[DataObjectMethod(DataObjectMethodType.Delete)]
public void Delete(' + @TableName + ' DTable, int _userid)
{
DFctx.Delete' + @TableName + '(DTable.' + @TableName + 'ID, _userid);
}
public int Get' + @TableName + 'Count(int _dyntbl)
{
return Get' + @TableName + 'Count(_dyntbl);
}
}'

print @result
38   Tenpoundbass   2023 Jun 14, 9:16am  

Tenpoundbass says

If the data model is good, and the enterprise is happy with it. Then the best and quickest way to do a rewrite is to use Code Generating SQL against the tables. I can stub out a whole Enterprise suite in under a week. Then only need to write the business logic layer and the client Scripts.


I would add, that I preferer to custom script out my own code generation per each project. I do not use Entity Frameworks because it adds way too much buggy sluggish overhead, it's hogs more resources than all of your project's code combined. All of my code generation is external and I plug it into the pages and classes I'm working on by hand. But I can script for any language and any model, for any purpose. Client HTML code, Object Classes, and Data Classes. EFF can not do that. Frameworks can generate cookie cutter code, but it's all the same code from project to project. You can't use Microsoft EFF to generate Python or Java code.
39   fdhfoiehfeoi   2023 Jun 14, 10:53am  

Tenpoundbass says


Always do a rewrite. Normally by time you are called to bring a Customer's software to the next level. The previous developer had already coded the project into a hard corner. And the new business requirements would be impossible to factor in without creating a buggy broken system.


I spent a month testing some API's for a guy who was monetizing a domain purchasing site. He hired an oversea's programmer who slapped a bunch of stuff together with no standardization, and some pretty big security gaps. I pointed it out to him, but due to the fact that he hadn't even launched yet, there wasn't much interest in doing anything beyond plugging the security gaps.

I work in software quality, so my first instinct is always to push for maintenance NOW, but it really does depend on where the business is at.
40   Tenpoundbass   2023 Jun 14, 1:57pm  

The hardest part for any Enterprise software, is getting it to the point to where it is now.
One of the biggest problem with rewrites is they come in thinking they are going to do a total data model redesign. These days they want to shoehorn software written for a unique business case in a unique industry with unique requirements. Into a one size fits all Cloud CRM and ERP. So they are forced to rewrite the whole business process logic and requirements. Any gaps not meeting previous requirements, they outsource to a third party service, lots of third party cloud services, to do what 90% of the companies should be home growing on their own. I try to understand the business reasons for the most fucked up head scratching code, and understand why the previous guy did it so ungracefully. There was always a reason, that even those cloud guys eventually run into. No matter how hard they try to ignore that complicated backwards, stupid way the previous guy was forced to do it. .
But if you take time to understand that you probably would have met the same trap, because you understood, what it was doing, how that process got added on after the fact. And you understand what it does and why it's important.. You can then figure how to gracefully make that process. You can make some of your most elegant impressive code you ever did. And in many ways, you owe it to the previous guy, and the problem he was faced with. That you then built on and made it work.

Most migrations and updated enterprise rewrite development lead, do not understand that process today.
41   GNL   2023 Jun 14, 2:33pm  

Tenpoundbass says

met the same trap, because you understood, what it was doing, how that process got added on after the fact. And you understand what it does and why it's important.. You can then figure how to gracefully make that process. You can make some of your most elegant impressive code you ever did. And in many ways, you owe it to the previous guy, and the problem he was faced with. That you then built on and made it work.

Most migrations and updated enterprise rewrite development lead, do not understand that process today.

I found your comment quite insightful. Yes, we've added many things after the fact because these add-ons were not envisioned at the time. Mission creep has to stop at some point also.
42   fdhfoiehfeoi   2023 Jun 14, 2:51pm  

Last company I worked at for a year and a half was supposed to be migrating their legacy infrastructure to the cloud. We were the last team in line to do this, so not charting new waters by any means. But the code was inherited probably a few times over, and almost no one on the team was there when it was written. I remember one of the engineers after an outage(there were many), comparing what he saw to duct-taping shit together, it was that fragile. Right before I left they had decided to pivot to just migrating to Kafka from MSMQ, and push the rest off, but I seriously suspect the team dev lead, and product owner will be fired when this stuff never completes.

Worst part, they kept dumping new feature requests on the team. I spent more than a few meetings telling them they needed to stop if they wanted migration to ever finish, but there was always an excuse.

My time at that company was split into 1/3 testing(my actual job), 1/3 helping manage process, and 1/3 on call for production issues(usually outages). I don't even want to look at prod support at my current place, still scarred from having to get up and answer alerts in the middle of the night.
43   HeadSet   2023 Jun 14, 4:43pm  

richwicks says

BTW: C++ has improved VASTLY since I last used it. It no longer sucks!

Funny you should say that. The current C++ redistributable somehow omits the msvcr100.dll which causes a graphics program I loaded yesterday to not run. Once I figured that out it was just a copy and paste from a computer that still had that dll.
44   richwicks   2023 Jun 14, 6:05pm  

HeadSet says

richwicks says


BTW: C++ has improved VASTLY since I last used it. It no longer sucks!

Funny you should say that. The current C++ redistributable somehow omits the msvcr100.dll which causes a graphics program I loaded yesterday to not run. Once I figured that out it was just a copy and paste from a computer that still had that dll.


I don't ever work under Windows. I just got fed up with their bullshit ages ago. It won't be long before you have to rent MS Windows, and pay a monthly fee for it. That's already true of MS Office.

I am never going to work under Windows again, ever.
45   HeadSet   2023 Jun 14, 6:39pm  

richwicks says

I am never going to work under Windows again, ever.

I hear you, but the software I like will not run on Linux, and Apple is just a pricey way to do the same thing.
46   richwicks   2023 Jun 14, 6:51pm  

HeadSet says

richwicks says


I am never going to work under Windows again, ever.

I hear you, but the software I like will not run on Linux, and Apple is just a pricey way to do the same thing.

If I have to use Windows, I fire up a virtualbox virtual machine.
47   Patrick   2023 Jun 14, 10:37pm  

GNL says


If you were starting from scratch, what would you use to create a commercial website?


@GNL

I used node.js to rewrite patrick.net a few years ago, and I'm very happy with it. Clearly I'm no visual artist, but performance and maintainability of my current version are the best of any website I've ever seen, if I may say so myself.

Having worked with React, and I learned to detest it as a low-performance ball of yarn. Hell, avoid all front-end frameworks and get people who've actually read most of https://developer.mozilla.org/en-US/ The browser already does everything you need, you just need to figure out how.

This site is one file, patrick_net.js, and all the code is in it except for some unavoidable npm libraries, such as for interfacing to mysql.

I was taught that css and client-side js should go in separate files. That's bullshit. You get dependency problems because of version skew, and clearly lower performance. Yes, external js and css files can be cached, but it's still faster performance-wise to have a single file and include the js and css just where you need them in the generated html. If you're pulling in giant external js and css files you have serious problems to begin with. Don't do that.

And the development speed from a single file is priceless! I literally never need to figure out what file any function or js snippet or css is in, because it's all in the same fucking file. Most programmers spend half their time searching various files for things. I never have to do that. And using ALE in vim to detect errors as I'm typing has saved me vast amounts of debugging time: https://medium.com/@victormours/better-linting-in-vim-with-ale-1e4b1d5789af

I got the single-file idea when I heard that a popular travel site was all one php file. The guy who made it was a newbie programmer, but damn, he hit on something super-useful with that naivete.

I also optimized the shit out of the database, and have a strict naming convention in the db that every column starts with the singular of the table name. So the users table has columns user_id, user_email, user_pass, ... Then when I'm looking in the code at fields I got from the db, I know exactly which table they are from, instantly.

Tons of lessons like that acquired over the last 25 years or so.
48   gabbar   2023 Jun 15, 3:16am  

richwicks says

You have to learn many high level languages, and a few lower level languages. You don't have to learn higher level languages well, it just introduces you to many concepts which you can implement elsewhere. The concept of a class in C++, brilliant idea, but it's trivial to implement that in C. You're just passing around a pointer to a C structure to every function. There, that is basically C++. C++ used to be nothing more than a preprocessor for C - it took in the C++ code, and through a bunch of macros and conversions, made a C file, and compiled that.

Student is already registered to take assembly language in Fall 2023. Thank you for the recommendation.
49   gabbar   2023 Jun 15, 3:17am  

Tenpoundbass says


The hardest part for any Enterprise software, is getting it to the point to where it is now.

How can a sophomore in computer science learn Enterprise software?
50   richwicks   2023 Jun 15, 4:42am  

gabbar says

Student is already registered to take assembly language in Fall 2023. Thank you for the recommendation.


If they're like me, they have to understand "how" always. Assembly explains it the "memory" of a chip is TINY. You have registers (the real memory) cache (fast memory), regularly memory (this is just fetched to put in the cache, and periodically written back), then virtual memory is sometimes incorrect called "cached memory" - this is when memory isn't being used very often, so it's written to disk for later retrieval.

IF they want, they can learn binary logic to compose gates, and ALUs and so on. This isn't necessary, but I had to know. I'm actually trained as a computer chip designer, very glad I didn't go into that. It's ridiculously complex and it's just really verilog and VHDL now. I can lay down metal and poly-silicon layers to make a chip. If they want to know this, just learn logic, learn what a CMOS gate is, just simple stuff.
51   GNL   2023 Jun 15, 5:51am  

Thanks guys. I can't imagine what a rewrite of my site would cost in terms of $$ and time.
52   Tenpoundbass   2023 Jun 15, 6:36am  

GNL says

I found your comment quite insightful. Yes, we've added many things after the fact because these add-ons were not envisioned at the time. Mission creep has to stop at some point also.


A common mistake for mission creep is what I call "the Fred exception" when a principal comes to you and says...
"You know that very elegant efficient process you made for the company that processes payments and late fees?
Well there's a customer named Fred, and we need to process treat Fred totally different, and you need to write an algorithm that will calculate what he owes and how he owes it differently but only on the second Thursday of every month. The rest of the time, treat Fred the same."
Most developers will begrudgingly go on and plug in verbose Fred exceptions, with if and nested case statements, parsing the name of every customer that comes through the system, every single time, wasting valuable resources and littering the code.

I always go back to the model first and add a new field in a table that will identify a new class of customers, and field for any qualifiers like aging and dates that I will use to treat those class of customers. So now any time anyone else needs a Fred exception, all you have to do is change their classification identifiers. Because there will always be another Fred, then your doing if or statements.

The turn around to treat Fred special might be a week longer often not though. But in the long run I save a ton of time, by not having Fred create more mission creep where I'm accommodating more process exceptions for Fred.

Believe it or not, it's the principals in meetings that will be against extending the project to accommodate a new classification. In their mind, it was their brilliant idea to quick and dirty just parse the whole enterprise for one single name treat differently. These are the same assholes that likes to bring up in those meetings if the Project is Sarbanes-Oxley compliant.
53   Tenpoundbass   2023 Jun 15, 6:56am  

gabbar says


How can a sophomore in computer science learn Enterprise software?


About a year after reading my first VB4 book from not knowing a damn thing about anything. Got my first job for a mail order catalog company.
It was converting a Data Flex Unix Server based CRM to a VB6 project. It paid for Shit, like $43K a year IIRC. I interviewed for the job and the guy that was leaving and moving on, which I was replacing. Gave me a quick Data Flex syntax tutorial.(He bought land in NC and was moving up there to farm)
Then he brought up Data Flex code for one of the forms, (it was a Dos client) and opened VB 5 at the time, VB 6 came out a few months after he left.
And had me migrate the code from Data Flex to VB. He saw I had the knack for it, and knew there was no damn way they were going to get a seasoned developer to work for $43K to do a job that typically was paying $60 to $80K a year even in 1997. He told the boss I was a great fit and I was there for three years before moving on. I moved on because the cheap fuck wouldn't raise beyond the 3% typical pay raise. Which was still keeping me below $50K after 3 years. I left there and got a job for $60K and never looked back.

I would tell the kid to put himself out there. I was damn lucky that my first job was a one man shop job. I was forced on the high dive that I would have never seen in a typical dev team environment. I wouldn't know 1/10th of what I know if not for that. I was in charge of setting up new HP servers, managing a Novel network in the graphics department, and moving it to a MS network with apple talk protocols. Installed and managed Exchange server, Biz Talk server. The guy that left had an agreement with the boss that he got the MSDN Enterprise subscription every year. Which I inherited. So I had all of MS toys at my disposal to really dig in and play with as a lab of sorts, both at home and at work on old defunct servers. It was how I justified staying there for three years for so cheap.

My explanation was how to get in the door. But how to learn it. He can do it the same way I did, by just jumping in the code and step debugging through it until he understands what the processes are doing. He should look for some sample project developers may have posted, that runs a business.
Like MS Adventure Works, or Nerd Diner, the MS sample Book publisher project. there's quite a few out there.

But the enterprise is being dominated by project leaders that want's to use out of the box CRM and ERP or Cloud services. It's the trend that has me looking for a new career path. I hope this is just a passing phase. Enterprise software development these days is more of a end user of a kluge management suite that you have to set up by filling in form values, than actually writing code. And roles I just took for granted something I need to do first before I can do other parts, now are separate duties held by gatekeepers who are behind 5 layers of SOP and process ticket systems and meetings before you can get done what I used to just do in a minute.

The IT admins have elevated themselves to the only hands on technical people in the organization, and their developers are nothing more than convoluted word processer users.
54   fdhfoiehfeoi   2023 Jun 15, 9:12am  

Tenpoundbass says

A common mistake for mission creep is what I call "the Fred exception"


Nothing wrong with the Fred exception if you charge for it, and make it clear any additional work needed for the Fred exception will be treated to a separate bill. That way you avoid endless customized maintenance for free. And I mean to the level that when you do a major refactor, if Fred's shit doesn't work anymore, you invite Fred back into the core product fold, or Fred pays again...
55   Tenpoundbass   2023 Jun 15, 9:58am  

NuttBoxer says

Nothing wrong with the Fred exception if you charge for it, and make it clear any additional work needed for the Fred exception will be treated to a separate bill. That way you avoid endless customized maintenance for free.


The other problem with doing it that way. When the next company comes behind you, you have a reputation for writing spaghetti code.
My motto is "There's always time to do it right!".
You can put time up front to prep and create the foundation for any task at hand. Or you can just hack it in, and butcher it until it's good enough.
The butchered solution requires constant massaging and manual manipulation. Eventually boiling over to the point that they have to rewrite it and do it right, months or years after tolerating the inferior work around solution.
And I have proven it time and time again. When I have integrated a new classification in a data model to accommodate future Fred exceptions without having to update the code next time. My counterparts from outside vendors end up taking months of rewrites, and work arounds, and often scratching that roll out, until the next big update. After my code was ready within hours, days or a week of the request.
56   Tenpoundbass   2023 Jun 15, 10:01am  

NuttBoxer says


Nothing wrong with the Fred exception if you charge for it, and make it clear any additional work needed for the Fred exception will be treated to a separate bill. That way you avoid endless customized maintenance for free. And I mean to the level that when you do a major refactor, if Fred's shit doesn't work anymore, you invite Fred back into the core product fold, or Fred pays again...

Also I consider tasks like that as a Data Plumber. The last thing I want to do is manual data entry, or sit there and plunger shit data through leaky code plumbing. I'll resign within a week.
My goal when I start work at a company. Is to write code that someone that isn't a programmer can manage with the tools I made them. After that its time for me to move on. If I were into that sort of thing, then I would have gone the IT route instead of the Developer route. I don't want to be that guy that has to log in at 3am to make sure a faulty shitty process completed without error codes.
57   fdhfoiehfeoi   2023 Jun 15, 10:36am  

As much as possible, give your users the ability to customize things on their end. A good CRM is worth years of development work. Current company is in the process of pulling all the customization back and focusing on just putting out a standard platform. Spoke with a couple people when I started as part of onboarding. Most common complaint I heard was how customization fucks everything up, and this was mostly coming from the business side.
58   SunnyvaleCA   2023 Jun 15, 11:26am  

Patrick says


I used node.js to rewrite patrick.net a few years ago, and I'm very happy with it. Clearly I'm no visual artist

This is one of the best websites out there. If I wanted to see the work of a "visual artist" I'd visit a museum.

Instead, we have:
• Clear, high-contrast text
• nothing animating, giggling, or making noise
• everything on the page searchable in local browser text search
• pertinent information displayed without information overload
• responds properly to browser window width resizing
• zero CPU usage after initial load and layout
• fast load times
59   Tenpoundbass   2023 Jun 15, 12:44pm  

NuttBoxer says


As much as possible, give your users the ability to customize things on their end.

The last company I worked for did Dye-sublimation printing on fabrics. The users could pick or upload a pattern, and order a sample size or a quantity of full yardage. I gave him a html based GUI that not only batched like fabrics, and a graphical layout of the samples before printing it. He could remove items, or move them around to accommodate their needs. Also to bring up a batch or a single item and reprint it. I gave him many tools for every gotcha we ever ran across that was outside of what my application could manage. Like report on the real available fabric at hand, or a report that shows stock needs to be moved to fulfil the order. Show the image didn't download for what ever reason, or the print error was due to the image being an improper format or wrong dimensions per the step repeat instructions(A serious error when that happens). The huge International consultant team ported that process to a cloud based MS 360 Cloud ERP. The end user I designed it for, says now the batch is just a list. It tells me nothing. The XML instructions that drives the print press is generated minutes after he batches it. Not Realtime, so if something fails or doesn't print. They don't find out about it until customers are moaning they didn't get it. With my system, he knew immediately . And because the new cloud system is purely a onetime one shot operation. The only way to reprint, is to tell the customer to cancel the order and send a new one. No guarantee it will make it either, if they don't' know that the image is screwed up.

More idiots that wondered. "What in the fuck did he do it like this for? All of this shit shouldn't be the guy that is printing the orders job!"
They are damn lucky they have that guy, I wrote him what he needed, and it was elegant and the industry leader. The consultant idiots wrote what they wanted him to have and it sucks and is nothing but problematic. When I wrote them the software, one of their Competitor/Partner developers were struggling generating a batch XML like I created. So the owner had me send them my code and massage them until they understood it. That really hurt, I should have left then rather than doing that.
60   HeadSet   2023 Jun 15, 8:13pm  

Tenpoundbass says

My goal when I start work at a company. Is to write code that someone that isn't a programmer can manage with the tools I made them.

THIS!!! People are running a business and the computer is just a tool. Just like how a traveler uses a car to go places and does not want to stop every few miles to reset engine timing.
61   richwicks   2023 Jul 25, 9:44pm  

I just asked ChatGPT to make an algorithm that would

1) scramble the bytes of the input randomly with a function
2) unscramble the output to produce the original data

It couldn't do it. It lied to me. It gave me code, that didn't work.

The more I play with AI, the less functional I realize it is. It's GREAT for starting with simple coding in languages you don't know, but ask it a somewhat difficult or unusual problem? It's worthless.

This idea that it will replace skilled workers, is bullshit. It's nowhere near that. It will always give you an answer, but if it's a tough one, it's most likely wrong, and there's no way to input data into it to correct it so it cannot learn from its errors. When you indicate it's made an error, this is apparently regarded as "hostility" and will disconnect. They really fucked up on the algorithm.
62   Blue   2023 Jul 26, 12:51am  

richwicks says

This idea that it will replace skilled workers, is bullshit. It's nowhere near that.

Very likely, the model they use in production has a cutoff with high probable nodes in the graph to be more 'reliable' and generic.
63   zzyzzx   2023 Jul 26, 7:01am  

Tenpoundbass says

So they asked me if they could use the test project I sent them as the foundation to build their software.


You should have charged them for it.
64   gabbar   2023 Jul 28, 10:48am  

Tenpoundbass says

I would tell the kid to put himself out there.

Thank you very much. He appreciates this recommendation.
65   richwicks   2023 Aug 2, 3:20pm  

gabbar says

Tenpoundbass says


I would tell the kid to put himself out there.

Thank you very much. He appreciates this recommendation.


I would also suggest your kid to make use of ChatGPT - it's not the wizard being sold to the public - I've used it.

It's tremendously good at basics, but ask it a hard problem, and it will produce nonsense.

For example, I asked it to produce a program to create two windows using curses (that's a very old library for terminals), and it did it. That saved me hours of work. I asked it to write a program to take in characters using Apache as they were typed, this is websockets, it suggested CGI which doesn't work.

It's great for a STARTING point, but worthless at new solutions. Apache can do this, but it requires a plugin. It didn't recognize this.
66   AD   2023 Aug 26, 10:43pm  

Open source AI that helps you write code, it is offered by Facebook and called "Llama AI for Coding"

https://about.fb.com/news/2023/08/code-llama-ai-for-coding/
67   Tenpoundbass   2023 Aug 27, 9:10am  

richwicks says


It's great for a STARTING point, but worthless at new solutions.


New Solutions, require using existing technology or libraries, in an off label fashion.
I'm often impressed, that I reuse a Library I wrote for one solution, but was able to tweak it to handle another problem that I originally didn't intend it to do.
AI will not make that connection. It uses the code libraries out there, in accordance to the documentation. I think it starts producing nonsense, because it took documentation too literal, with a broader stroke than intended.

I could write a parser that could pull relevant code out of documentation and provide a starting point.
I employ a method to crank out the working prototype and starting point, in a day or two that would take a team of 3 developers a couple weeks to do.
I build a few tables that hold meta data of the data models and structures, and then I script a SQL script to spit a long concatenated string that provides the Classes needed. .I have several flavors, for making the class objects, the data classes, code for the forms, as well as appropriate html, and javascript.
This is where I impress myself on how with a little tweaking these scripts bang out code for totally different methodologies, and design patterns for various solutions. I mean I can see it wouldn't be a far stretch to take what I have and convert it into some AI code gen thingy, that would impress the Hype Tech consumers..
68   richwicks   2024 Jan 9, 3:21pm  

ECC encryption and why it's superior to RSA.

ECC works with an elliptic curve, a quick explanation of what such a curve is can be found here:

https://www.youtube.com/watch?v=dCvB-mhkT0w

It works over a Galois Field (i.e. using modulo arithmetic). The video above explains point addition. Point multiplication is repeated addition just like it is with standard math. Scalar multiplication is when you have only one point - this is a special condition when you're adding the point P to P X number of times.

To understand why point addition follows the commutative property, you have to understand number theory to know why - just accept it does. The commutative property means that

G +
2G +
4G
----
7G

Where G is the generator point, which is the initial point where you do scalar multiplication. In order to quickly calculate any scalar point multiplication G is computed, then 2G, 4G ... 256G etc - but just doing repeated point addition. Again, see the video.

The secret key of ECC is just a random number usually in the range of:

0 - 2^{252} +27742317777372353535851937790883648493 (for Curve25519)

ECC curves have an order normally called n, which is the total number of points a generator G can reached with scalar multiplication. You can have a larger secret key than this, it doesn't matter, since it uses modulo addition, but you end up with a key that is larger than it needs to be. Generally the private key is a 256 bit number.

You can easily do scalar multiplication using the commutative property, but division is (so far) impossible.

To do Diffie-Hellman key exchange:

Alice picks a random number for her private key, and then computes the scalar multiple of this private key. The result of this calculation is the public key. Bob does the same. When Bob and Alice share their public keys, Alice takes Bob's public key (which is a point on the curve), and does scalar multiplication with her private key. Bob takes Alice's public key, and does scalar multiplication with his private key. The result is both end up with the same point on the curve.

For additional security, the result of the shared secret is hashed sometimes with a shared OPEN secret (a nonce), and the public keys in a given order.

The advantage of ECC key generation is that unlike RSA, it's immediate. Generating a private key is just picking a random number, and scalar multiplication is also very fast on the order of milliseconds, they keys are also smaller.

In short, RSA is crap, although ECC might have a fatal weakness. RSA depends on the inability to factor very large numbers, ECC depends on the inability to do point division although it's trivial to do point subtraction.
69   Patrick   2024 Jan 9, 3:31pm  

Is it possible to implement a replacement for SSL with no change to browsers and no centralized certificate authorities?

That would take care of encryption and MITM attacks and leave all the spook agencies out of it.

« First        Comments 30 - 69 of 95       Last »     Search these comments

Please register to comment:

api   best comments   contact   latest images   memes   one year ago   random   suggestions   gaiste