Wednesday, 15 January 2025

Ajronmejden!

Chyba odkrycie sezonu. Jak ja mogłem takie coś przegapić w starych czasach? Od 2009 bodaj miałem kilka szt. (Aces High, Killers, Powerslave, Sanctuary, The Number of The Beast). Zresztą od człowieka, który już nie żyje... Unikam tylko ultra-długich żenujących chórków. Łuououołu... Wyjątek dla Heaven Can Wait, niech tam. Czasem się pojawiają i powodują skrępowanie, niczym Escape Wąsaczy. Ale pozbierane początki - lata 80. oczywiście - naprawdę dają radę.

Piękne jest też Sleduy za mnoj Arii. Zajebistość niepięknej, ale dobrej muzyki jest nie do przecenienia. Kto twierdzi inaczej - wiadomo... ten towarzysz się myli, proszę go wyprowadzić.

Thursday, 9 January 2025

proteza reklamy

Albo na odwrót. Wpadłem na jutup pooglądać hodowane bobry i wydry, a tu mie coś nazębnego wmuszajo. Dobra, koszt darmowości. Ale jak o "silikonowych" (przes si... nie, niemożliwe, żeby na si...) czymś-tam usłyszałem, to dałem spokój. A ciekawe, czy to niedoedukowany człeczyna czyta, czy może ej-aj.

Tuesday, 7 January 2025

pyqgis features

A word of warning - there's no documentation nor anything particularly useful below, just my angry rants against someone else's coding style, culture or ecosystem or whatever you may call it. 

Judging by the number of "reads" (5) on the blog that nobody visits except robots, I figured out that using the phrase "pyqgis features" for the title was rather stupid, since it's now most likely seen as two search keywords. Sorry, that was not my intention, even though I should have been able to figure it out, recently having finished some code that makes use of the QgsFeature object, among others. All I had in mind was something along the lines of "it's not a bug, it's a feature" ...

I get a lot of fun doing some voluntary work in the python/qgis world, just to help someone I like a lot - for the two magic words - "thank you". Helps me become a human being again. Not the too well known piece of a sociopath with empty eyes and no soul, paranoid psychotic heart of stone, my blood runs cold ...

So now goes my small donation for QGIS. Didn't mean anything bad, guyesses and guys and persons etc. - it's just me being a beginner, somewhat awkward and retarded.



---

Let ust seeth:

virtualLayer = QgsVectorLayer( 
    path = fileName,
    baseName = 'New CSV',
    providerLib = 'delimtedtext' 
)
 
assert virtualLayer.isValid()
 
Note the "i" lacking from providerLib's value.
And all I get is isValid() == False. Same with a non-existent file. 
 
PyQgis is nice, but from time to time just too fucking obscure. Looks as if it's so bad
w.r.t. python as python is, related to any decent language. Struggle, push your abilities to 
the limit ... 
 
Another pitfall: trying to add a fixed input file to a "processing tool", sitting in the scripts
directory. Hidden from the user, which may be ok - requiring them to choose the file from the
qgis' scripts directory seems like too much nonsense labour. 
 
Nb. - the tool doesn't even permit logging to a file, disregards exception throwing etc.,
tries its best on any data whatsoever and giving rather poor information on what went
wrong. Anyways, after fiddling around with absolute paths, all I got was some strange
file not found error, showing my file name with extension removed and glued together
with some GUID-like bunch of numbers and dashes or underscores. Shit! Ok, why not try 
 
p = Path.cwd() / 'some_file_name.csv'
path = p.resolve()
self.SecretInput = path.split('_')[0:3] + '.csv'

so as to cut out the GUID and give the correct file path to the "INPUT" part of the run call?
Guess what - the GUID is still there in the error message! Oh my.
 
Seems, according to wizards, that something like
 
class FixedCsvPath:
def Get() -> str:
return os.path.dirname(os.path.realpath(__file__)) + '/some_file_name.csv'
 
and calling FixedCsvPath.Get() in place of 'INPUT' : ... does the trick. Perhaps the same stuff
called explicitly gives the same result, but let's just follow the good book on b.s. like "separation
of concerns" etc. The code is dirty enough already.

Monday, 6 January 2025

Another nice exception message

"Pole jest zbyt małe, aby pomieścić wprowadzane dane. Spróbuj wstawić lub wkleić mniejszą ilość danych." says M$ talking to an Access thing. Which means "a field is too small to be able to accept the inserted data. Try to insert or paste smaller amount of data". 

Yeah, paste from the code. FFS, I have some 150 rows of stuff with more than 50 columns. And there is no knowledge whatsoever which field is too small. Only a field. Some braindead engineer did a copy-paste on column sizes, declaring each to be VARCHAR(100). Which meant probably that 90% of these were too large and 2-3 were too small.

It's no big deal, as Carl put it - just write a unit test that collects field lengths from the database creation sql and see which property of the data class that I'm trying to insert or update is too large. Access, my foot.