Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
nielsm
Jun 1, 2009



Cygwin probably hasn't changed much since early Windows XP and has to be really pessimistic about everything to implement a Unix'y API on top of Win32 from that era. It might be possible to improve the core code if you use newer APIs, but I'm just making uneducated guesses here.

Adbot
ADBOT LOVES YOU

mystes
May 31, 2006

Faith For Two posted:

I'm not sure what you mean by this but the reason my cygwin performance is bothering me is because I have to use cygwin at work, not wsl.

When we were deciding on what our toolchain would be, I assumed cygwin would be a better choice than wsl because wsl seemed like a bleeding-edge feature at the time. I didn't want to advocate for something I had only just heard about.

All I knew about Cygwin was that it's mainstream, and been around since forever. I figured in TYOL 2019, all the issues with it were probably ironed out.
IIRC, shell scripts are always really slow on cygwin in a way that probably isn't fixable. Other stuff can be faster, though.

At this point you should probably just live with it and then switch to WSL2 when it's stable.

lifg
Dec 4, 2000
<this tag left blank>
Muldoon
Cygwin has been slow everytime I’ve used it since 2005.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

lifg posted:

Cygwin has been slow everytime I’ve used it since 2005.

:same:
very slow

GoodluckJonathan
Oct 31, 2003

Dominoes posted:

Any microcontroller would do it, Arduino included. C is the standard language for this type of thing. I've been learning on an STM32Discovery, which includes the chip, a bunch of pins, and built-in LEDs to practice with.

Your microcontroller's interaction with your system, as you described it, would be output to a relay board like this, and input from sensors. This is a nice temp sensor. It uses something called a 1-wire input, which allows the controller to read the temp directly without using an ADC or calibration.

I offer no resources, since I learned using a Rust guide, which is a bit bleeding edge at this point.

You could also use a single-board computer like a Pi. It'll probably be about as easy to set up, but may be overkill in terms of price and power use.

Arduino, Pi, or other controller, you'll probably use a high-level Hardware Abstraction Level (HAL); going low-level means board/controller specifics that may not transfer well to other devices. If you use a HAL, your code will be more portable if you change device.

Neat, thanks.

fankey
Aug 31, 2001

I need a c or c++ based css parser embedded in my application for custom styling. It needs to run on Windows WPF ( via c++/cli ), Windows QT, Linux QT and iOS (objc). I'm currently using katana-parser ( https://github.com/hackers-painters/katana-parser ) and other than the complete lack of documentation and having to cast everything to actually use it it's working ok. The issue is that I'd now like to support some more 'esoteric' css features like custom properties and katana isn't built for that. As far as I can tell katana is pretty dead and they didn't bother to check in the flex source files used to generate the parser so modifying that might be difficult. libcss ( https://www.netsurf-browser.org/projects/libcss/ ) might be a possibility but it's not clear to me if it supports custom properties ( the headers don't look like they do ) and it also brings in a bunch of other dependencies which make it not ideal.

I only really need the library to parse the css and generate the rulesets - I handle all the selection/cascading/applying in my code. Any ideas on a full featured hopefully standalone css parser out there?

Volguus
Mar 3, 2009

fankey posted:

I need a c or c++ based css parser embedded in my application for custom styling. It needs to run on Windows WPF ( via c++/cli ), Windows QT, Linux QT and iOS (objc). I'm currently using katana-parser ( https://github.com/hackers-painters/katana-parser ) and other than the complete lack of documentation and having to cast everything to actually use it it's working ok. The issue is that I'd now like to support some more 'esoteric' css features like custom properties and katana isn't built for that. As far as I can tell katana is pretty dead and they didn't bother to check in the flex source files used to generate the parser so modifying that might be difficult. libcss ( https://www.netsurf-browser.org/projects/libcss/ ) might be a possibility but it's not clear to me if it supports custom properties ( the headers don't look like they do ) and it also brings in a bunch of other dependencies which make it not ideal.

I only really need the library to parse the css and generate the rulesets - I handle all the selection/cascading/applying in my code. Any ideas on a full featured hopefully standalone css parser out there?

Have you considered ANTLR? The have a CCS3 grammar published (https://github.com/antlr/grammars-v4/blob/master/css3/css3.g4), though I have never used it (the grammar) and cannot say how good or bad is it. But I have used ANTLR before for my custom parsing needs and it was quite good.

fankey
Aug 31, 2001

Volguus posted:

Have you considered ANTLR? The have a CCS3 grammar published (https://github.com/antlr/grammars-v4/blob/master/css3/css3.g4), though I have never used it (the grammar) and cannot say how good or bad is it. But I have used ANTLR before for my custom parsing needs and it was quite good.

This looks promising - thanks for the pointer. I was able to generate a parser based on the grammar and parse that using their C++ runtime. What's not clear to me is how I should go about traversing the document and pulling out data.

I generated a Visitor and if I just print out context->getText() in all the visitors I can see it traversing the document but I think using that pattern for a SAX like CSS parser would be painful and a better approach would be to traverse the parse tree myself. For the following CSS
code:
.class1
{
  color: red;
  background-color: rgb(255,255,2);
}
the visitor generates the following call tree
code:
--visitStylesheet
----visitWs
----visitNestedStatement
------visitKnownRuleset .class1
{
  color: red;
  background-color: rgb(255,255,2);
}


--------visitSelectorGroup
----------visitSelector .class1

------------visitSimpleSelectorSequence
--------------visitClassName .class1
----------------visitIdent class1
------------visitWs
--------visitWs
--------visitDeclarationList color: red;
  background-color: rgb(255,255,2);

----------visitKnownDeclaration color: red
------------visitGoodProperty color
--------------visitIdent color
--------------visitWs
------------visitWs
------------visitExpr red
--------------visitKnownTerm red
----------------visitIdent red
----------------visitWs
----------visitWs
----------visitWs
----------visitKnownDeclaration background-color: rgb(255,255,2)
------------visitGoodProperty background-color
--------------visitIdent background-color
--------------visitWs
------------visitWs
------------visitExpr rgb(255,255,2)
--------------visitKnownTerm rgb(255,255,2)
----------------visitFunction rgb(255,255,2)
------------------visitWs
------------------visitExpr 255,255,2
--------------------visitKnownTerm 255
----------------------visitNumber 255
----------------------visitWs
--------------------visitGoodOperator
----------------------visitWs
--------------------visitKnownTerm 255
----------------------visitNumber 255
----------------------visitWs
--------------------visitGoodOperator
----------------------visitWs
--------------------visitKnownTerm 2
----------------------visitNumber 2
----------------------visitWs
------------------visitWs
----------visitWs
--------visitWs
----visitNestedStatement
------visitKnownRuleset class2
{
  color: #332255;
}
--------visitSelectorGroup
----------visitSelector class2

------------visitSimpleSelectorSequence
--------------visitTypeSelector
----------------visitElementName
------------------visitIdent class2
------------visitWs
--------visitWs
--------visitDeclarationList color: #332255;

----------visitKnownDeclaration color: #332255
------------visitGoodProperty color
--------------visitIdent color
--------------visitWs
------------visitWs
------------visitExpr #332255
--------------visitKnownTerm #332255
----------------visitHexcolor
------------------visitWs
----------visitWs
----------visitWs
--------visitWs
Traversing that manually is possible but will require a lot of dynamic casting and checking for null - is that normal when using ANTLR? I can deal with that if that's the way things are done but I'd like to verify there's not a simpler approach that will get me what I need. The end result I'm looking for is a simple data structure like
code:
// pseudocodish...
rule_set_t 
{
  color_t color;
  color_t background_color;
}

stylesheet_t
{
  map<string,rule_set_t> type_selectors;
  map<string,rule_set_t> class_selectors;
}

Volguus
Mar 3, 2009
It's been a few years since I've done that (and I was using the C# bindings) but yes, I remember the visitors requiring a relatively elaborate handling. However, you don't need to implement everything (like visitIdent or visitWs ), just ignore the things that you don't care about and build your data structures according to your needs. There is also another way of parsing the input, via the listener pattern. Your specific use case can only decide which one is better, as both have advantages and disadvantages.

reversefungi
Nov 27, 2003

Master of the high hat!
Are there any providers that can host an (extremely) simple database for free/very low cost?

I'm volunteering to build out a small site for one of my communities and we need to have some sort of simple counter that anyone who visits the site can log their work. For example, Joe visits the site, hits a button and says that they made 10 widgets. Then Mary visits the site and submits the form saying they made 20 widgets. You refresh the page and there's a counter that displays 30 total widgets now made. I'm wondering, for a use case as simple and as common as this, is there any kind of free API or something that can help build this out? Until recently they've been using a google form to track submissions. I'm too lazy to spin up and deploy a backend just for this, and I figured it would be a good opportunity to see if something simple like this is exists. Right now I'm looking into Google Sheets as a potential option.

huhu
Feb 24, 2006

The Dark Wind posted:

Are there any providers that can host an (extremely) simple database for free/very low cost?

I'm volunteering to build out a small site for one of my communities and we need to have some sort of simple counter that anyone who visits the site can log their work. For example, Joe visits the site, hits a button and says that they made 10 widgets. Then Mary visits the site and submits the form saying they made 20 widgets. You refresh the page and there's a counter that displays 30 total widgets now made. I'm wondering, for a use case as simple and as common as this, is there any kind of free API or something that can help build this out? Until recently they've been using a google form to track submissions. I'm too lazy to spin up and deploy a backend just for this, and I figured it would be a good opportunity to see if something simple like this is exists. Right now I'm looking into Google Sheets as a potential option.

What's their backend now? Sqlite is super easy to setup depending on the backend.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

The Dark Wind posted:

Are there any providers that can host an (extremely) simple database for free/very low cost?

I'm volunteering to build out a small site for one of my communities and we need to have some sort of simple counter that anyone who visits the site can log their work. For example, Joe visits the site, hits a button and says that they made 10 widgets. Then Mary visits the site and submits the form saying they made 20 widgets. You refresh the page and there's a counter that displays 30 total widgets now made. I'm wondering, for a use case as simple and as common as this, is there any kind of free API or something that can help build this out? Until recently they've been using a google form to track submissions. I'm too lazy to spin up and deploy a backend just for this, and I figured it would be a good opportunity to see if something simple like this is exists. Right now I'm looking into Google Sheets as a potential option.

Google form that sends the result to Sheets, and then a pretty pivot table of the data that shows who's done what?

I know you can provide a read only iframe of a Google doc, I would be surprised if the same weren't true for Sheets.

Otherwise, get cheap webhosting with a MySQL db instance and spend an hour or two making a dead simple PHP page or two for this.

Volmarias fucked around with this message at 06:21 on Apr 13, 2020

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



huhu posted:

What's their backend now? Sqlite is super easy to setup depending on the backend.

IIRC SQLite isn't suitable for baking a web server unless the server will only ever handle one request at a time.

nielsm
Jun 1, 2009



Munkeymon posted:

IIRC SQLite isn't suitable for baking a web server unless the server will only ever handle one request at a time.

It can work if the database works as effectively read-only. It's only write operations that need to take an exclusive lock, it should be able to server multiple reads at once.

Cyril Sneer
Aug 8, 2004

Life would be simple in the forest except for Cyril Sneer. And his life would be simple except for The Raccoons.
Before I make a big effort post, is there a good thread somewhere for asking about software engineering / quality management approaches and best practices?

JawnV6
Jul 4, 2004

So hot ...

Cyril Sneer posted:

Before I make a big effort post, is there a good thread somewhere for asking about software engineering / quality management approaches and best practices?

there's a few gray threads that might be close
Oldie Programming: Career Advice, Questions, Change of Directions
Working in Development: I like my job and I want to do less of it.

mystes
May 31, 2006

Cyril Sneer posted:

Before I make a big effort post, is there a good thread somewhere for asking about software engineering / quality management approaches and best practices?
YOSPOS › terrible programming: Lower your expectations. Significantly.

Cyril Sneer
Aug 8, 2004

Life would be simple in the forest except for Cyril Sneer. And his life would be simple except for The Raccoons.
Cool! Thanks.

PawParole
Nov 16, 2019

Is it possible to create a bot that trawls your instagrams followers bio and pulls out relevant information?

SAVE-LISP-AND-DIE
Nov 4, 2010
Yes.

The keyword you're looking for is "web scraping"

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



SAVE-LISP-AND-DIE posted:

Yes.

The keyword you're looking for is "web scraping"

They also have an API https://www.instagram.com/developer/

CapnAndy
Feb 27, 2004

Some teeth long for ripping, gleaming wet from black dog gums. So you keep your eyes closed at the end. You don't want to see such a mouth up close. before the bite, before its oblivion in the goring of your soft parts, the speckled lips will curl back in a whinny of excitement. You just know it.
I do not know much about nuget; I have some nuget packages another guy did and I've been able to piggyback off his work enough to keep them updated. But now I have a problem I can't figure out. The .nuspec file has code like this:
code:
<Target Name="Compile" AfterTargets="Compile">
	<Exec Condition="Exists('$(ProjectDir)obj\$(ConfigurationName)\$(TargetFileName)')" 
	Command="&quot;$(SolutionDir)packages\$(PackageDir)\program.exe do stuff" />
</Target>
Which has been fine until now because we've only used it for .NET Framework stuff. But when I installed it on a .NET Core project, it failed with File Not Found errors, because nuget doesn't install to SolutionDir\packages\PackageDir, it installs to UserDir\.nuget\packages\PackageDir.

Is there a solution to this besides just making two nuget solutions, one for Framework and one for Core? Some way to detect framework and execute a command with the appropriate location string?

feedmegin
Jul 30, 2008

nielsm posted:

Cygwin probably hasn't changed much since early Windows XP and has to be really pessimistic about everything to implement a Unix'y API on top of Win32 from that era. It might be possible to improve the core code if you use newer APIs, but I'm just making uneducated guesses here.

A fairly fundamental issue is Windows doesn't have fork () and Cygwin can't magically add it to the NT kernel. Meanwhile WSL2 is a tightly integrated Linux kernel VM and doesn't have that problem.

The Fool
Oct 16, 2003


A while ago I built a cli wrapper for the api of a saas application we use.

Now I want to build a gui wrapper for that to assist non-technical users with doing bulk edits of data.

They'll be doing the actual editing in excel, but using my application to set upload/download parameters and preview changes.

I plan on using C# for this application. What are the best options to make the UI not look total rear end? Should I be using WinForm, WPF or something else?

Good Sphere
Jun 16, 2018

edit: I have it installed on my local machine. For some reason I was trying to install Horizon before Laravel? I have no idea why. I'm still confused about how all this works.

Anyone use Laravel? Hopefully this can be considered the right place for this, because it's more about an installation problem, and having a fundamental understanding of Laravel.

I'm using this installation guide. I'm using Mac OS 10.14.6. I thought I had already created a project folder, and I'm on the second step for the command php artisan horizon:install that I'm trying to run in Terminal which gives me the response Could not open input file: artisan, which obviously means I'm in the wrong place. I know I'm supposed to run it in my project folder, but where? My directory structure is as follows:

Good Sphere fucked around with this message at 16:34 on Apr 21, 2020

Mr Shiny Pants
Nov 12, 2012

The Fool posted:

A while ago I built a cli wrapper for the api of a saas application we use.

Now I want to build a gui wrapper for that to assist non-technical users with doing bulk edits of data.

They'll be doing the actual editing in excel, but using my application to set upload/download parameters and preview changes.

I plan on using C# for this application. What are the best options to make the UI not look total rear end? Should I be using WinForm, WPF or something else?

Why not create an Excel add-in that does the upload/download?

The Fool
Oct 16, 2003


Mr Shiny Pants posted:

Why not create an Excel add-in that does the upload/download?

I'd rather pour acid in my eyes.

mystes
May 31, 2006

Mr Shiny Pants posted:

Why not create an Excel add-in that does the upload/download?
I almost suggested this as a joke (envisioning VSTO).

It might actually not be that bad with the pointless new javascript add-in system though.

JawnV6
Jul 4, 2004

So hot ...
I've seen Excel used to provide a GUI to non-software folks. You'd plug in motor values or whatever and it used a thunk of VBA to speak to the embedded device over a COM port and pull back live sensor readings. Why you'd dismiss it out of hand as a GUI for... handling Excel data? was it? anyway, it doesn't seem that much of a stretch.

mystes
May 31, 2006

JawnV6 posted:

I've seen Excel used to provide a GUI to non-software folks. You'd plug in motor values or whatever and it used a thunk of VBA to speak to the embedded device over a COM port and pull back live sensor readings. Why you'd dismiss it out of hand as a GUI for... handling Excel data? was it? anyway, it doesn't seem that much of a stretch.
I wouldn't recommend using VBA in a worksheet simply because you shouldn't train users to enable VBA in random worksheets in 2020.

I suppose you could make a VBA extension but that will probably make interfacing with the rest api or whatever a huge pain in the butt, and if you're going the extension route you might as well use javascript or VSTO or whatever since it will make your life much easier (you could use Excel DNA but there isn't really any point if you're not doing something that's a good fit with the dll add-in api).

Incidentally, you might be able to use power query or something to download the data from a rest api directly in Excel, but that wouldn't directly solve the uploading problem.

One advantage of the new javascript add-in api is that IIRC it makes creating a sidepane dead simple (I want to say you can use React or something but I only briefly messed around with it a while ago).

mystes fucked around with this message at 17:29 on Apr 21, 2020

The Fool
Oct 16, 2003


JawnV6 posted:

I've seen Excel used to provide a GUI to non-software folks. You'd plug in motor values or whatever and it used a thunk of VBA to speak to the embedded device over a COM port and pull back live sensor readings. Why you'd dismiss it out of hand as a GUI for... handling Excel data? was it? anyway, it doesn't seem that much of a stretch.

I have a cli wrapper for an api that is capable of producing and consuming csv’s, that part is already done. I’m just looking at setting up a ui wrapper for the cli.

I also really don’t want to do anything in VBA, we already have a bunch of fragile excel add-ins that our finance department uses and I don’t want to add to that.

mystes
May 31, 2006

The Fool posted:

I have a cli wrapper for an api that is capable of producing and consuming csv’s, that part is already done. I’m just looking at setting up a ui wrapper for the cli.

I also really don’t want to do anything in VBA, we already have a bunch of fragile excel add-ins that our finance department uses and I don’t want to add to that.
Winforms is perfectly good if you just want to whip together something simple, IMO.

There may be more potential problems with reliably roundtripping CSV files using Excel but it might not be an issue depending on your data (I think at a certain point people tend to give up and generate xlsx files but it's much more of a PITA if you actually have to read them again).

mystes fucked around with this message at 18:04 on Apr 21, 2020

TheReverend
Jun 21, 2005

Anyone know a good free or ope source test case management suite :)

fankey
Aug 31, 2001

I'm trying to match the following syntax
code:
foo(--bar) --> get 'bar'

or

foo(--bar, butt) --> get 'bar' and 'butt'

or

foo(--bar, butt, doublebutt ) --> get 'bar' and 'butt, doublebutt' ( note both of these I want in a single group )
using .NET style regex. I have the following which appears to work
code:
      Regex regex = new Regex(@"foo\(\s*--([_a-zA-Z][_a-zA-Z0-9\-]*)(,.+)?\)");
The only downside is that the comma and whitespace are included in the capture with the optional argument. I can't move them outside the group and make them optional there since they are a required part of the optional argument. It's pretty straightforward to just trim off the excess but I was curious if there's an approach that doesn't require that extra step.

nielsm
Jun 1, 2009



I think the .NET regex library also has non-greedy matching, and non-capturing groups.

code:
(:?,\s*(.+?)\s*)(:?,\s*(.+?)\s*)?
(:?x) is a non-capturing group that matches "x", meaning you have a group that you can repeat or make optional without causing a subexpression capture to occur.
x+? and x*? are non-greedy repetitions, meaning they will match as few characters as possible rather than as many as possible.

fankey
Aug 31, 2001

nielsm posted:

I think the .NET regex library also has non-greedy matching, and non-capturing groups.

code:
(:?,\s*(.+?)\s*)(:?,\s*(.+?)\s*)?
(:?x) is a non-capturing group that matches "x", meaning you have a group that you can repeat or make optional without causing a subexpression capture to occur.
x+? and x*? are non-greedy repetitions, meaning they will match as few characters as possible rather than as many as possible.
Thanks, that worked perfectly except I had to use ?: instead of :?, at least on .NET.

PoizenJam
Dec 2, 2006

Damn!!!
It's PoizenJam!!!
I'm trying to build a cheap script that listens for a hotkey, upon which it:

1.) Reads a text file on my hard drive (e.g. songinfo.txt contains the text 'Nirvana - Smells Like Teen Spirit')
2.) Creates a text string from the content (e.g. '!sr Nirvana - Smells Like Teen Spirit')
3.) Sends the created string to Twitch chat (either by passing it to a bot, using my own account in a browser window, or chat via. OBS window whatever's easiest)
4.) Doesn't steal focus from the currently active window

Requirements 3 and 4 put me out of my comfort zone of programming a little. I rarely develop code that interfaces with browser content; more of a statistics guy, python and r. What would be the best language or method of accomplishing this task? JavaScript? The program is simple enough that I'm sure I could learn the required syntax.

PoizenJam fucked around with this message at 07:11 on Apr 25, 2020

nielsm
Jun 1, 2009



Look into AutoHotkey.

It sounds unrealistic to have it directly interact with a browser, that kind of UI automation will almost certainly violate your 4th requirement. You should do it via an API, either directly to the stream chat or to a bot that participates in the stream chat.

mystes
May 31, 2006

nielsm posted:

It sounds unrealistic to have it directly interact with a browser, that kind of UI automation will almost certainly violate your 4th requirement. You should do it via an API, either directly to the stream chat or to a bot that participates in the stream chat.
You can definitely do 3 without violating 4 using something like Selenium. (But you are still much, much better off using an API if one is available.)

Adbot
ADBOT LOVES YOU

RPATDO_LAMD
Mar 22, 2013

🐘🪠🍆
Twitch chat definitely has some kinda API, since there are desktop apps for it.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply