`stack` and the file path limit on Windows - ghc

Eventually I hit the file path limit while using simplelocalnet.
In https://www.fpcomplete.com/blog/2015/08/stack-ghc-windows Michael Snoyman explains a (rather obvious) workaround as last point: Move my code under a shorter path.
Is there any functionality implemented in stack/ghc yet that fixes that bug?

Stack has been shortening some internal file paths on Windows for a few versions now by using an 8 character hash. AFAIK no other measures to alleviate the issue are planned.
So, to use stack on Windows it's still a good idea to set STACK_ROOT to c:\stack or an even shorter path.
Regarding GHC, I'm not sure what they should do about it or how it's even their problem, but I wouldn't know either.

You can increase Window's NTFS path size limit to roughly 32,000 characters by modifying your registry and enabling long path names:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem]
"LongPathsEnabled"=dword:00000001

Related

QFile: cannot retrieve size from PHYSICALDRIVE

I wrote a tool which was originally thought for analyzing hard disc images. Now I'm trying to use this tool for live analyzis of computer systems, means my tool tries to access the physical drive.
I implemented my tool in QT accessing the images using the QFile class. Instead of images I hand over the physical drive, under windows it is \.\PHYSICALDRIVE0.
I was wondering first I didnt get any errors, I can open the device, I can seek, get the position, almost everything. The only thing I have problems with is retrieving the drive size with size().
Some code example:
QFile file( "\\.\PHYSICALDRIVE0" );
file.open( QIODevice::ReadOnly );
file.size(); //returns 0
I'm not too deep into QT, probably this is some easy thing. I would like to thank everybody who has an idea what is the reason.
thanks in advance!
QFileInfo may be able to help you out. It sounds like opening a read only file at that part of windows partition is allowed maybe even if it doesn't exist. There might be a chance that the call of GetLastError() may give more information why a file size of zero was returned.
With QFileInfo, you can check to make sure it exists before it opens.
You may end up needing some platform specific calls to be able to work with Physical Drives:
Volume to physical drive
It looks like there may be some example code of looking at partitions with PartMod on SourceForge.
As a side note of querying sizes of file folders, I thought it had to be cached somewhere by the operating system, or had to be calculated at the time of the query in many cases. I know it seems like that happens when looking at folder properties in Windows or Get Info on OSX.
Also, looking at the Volume to physical drive answers, there is a field there for the extent length. I think this is what you are looking for.
Hope that helps.

Is there any way to download all google Webfont's in all formats?

First of all i am well aware of this Question and i have a strong feeling that it was closed because it was asked by a google critic.
My sub-question is: Am i right to assume that the processing that is described here is done after the ttf creation meaning it would not be possible to just batch convert them all together? If please tell me how (on linux)
Even if it would prefer the actually files google serves rather then having web services or tools convert them because google might done this the absolute best way possible!
I have some feeling that there is something out there, somewhere. Because it maybe just needs a script that changes the browser referrer and asks google http responses, downloads them and renames them to names based on the 'local' fontname in the css. In addition some web scraping to the the font names and the possible variation (bold/normal/...)
This is why i am trying this again in addition to that: I am a web Programmer i need this for my localhost web development so this is a this is a perfectly valid question for Stack Overflow in my mind and i am sure many have the desire to get hands of all fonts an easy way. So please at least migrate it somewhere it you think its not a valid question!
Extract the list of available fonts from https://fonts.google.com/metadata/fonts. Then use goog-webfont-dl to download all the formats of each font. I used the command cat ~/fonts.txt| while read line; do goog-webfont-dl -a -f $line;done to download each font in the list. Here is a gist with all the fonts up to 2016-07-12.

How to query the containing partition of a file with KDE/Qt4?

I'm using KDE, and I'm toying with the idea of hacking the code for Dolphin File Manager (and potentially Konqueror if necessary) to get context-sensitive drag and drop behaviour (i.e. files are moved within the same partition, or copied if they're moved across partitions or the source is read only).
To do this, I think I'd need to find out the containing partition of the source and destination (easy enough on Windows using the drive letter, but on Linux, as mount points can be almost anywhere, it can't be reliably derived from the file path), and compare them.
Does anyone know how I can find out the partition that contains a given file?
It must be possible - I know Nautilus provides this sort of behaviour, but I'm not familiar enough with GTK to track down the appropriate section in the source code to see how its done...
Qt doesn't provide API for this. For POSIX, have a look at stat.
For KDE, you can use KIO::stat() to get mostly the same info as POSIX' stat function but asynchronously.
The device id should be in the field UDS_DEVICE_ID of the result.

Protect.exe for AutoLISP code protection

I am developing an architectural LISP-based package for a member of the IntelliCAD consortium. Per recommendations I have found on websites, I have used the Kelvinator to deformat and disguise some of the code. Now I am attempting to use Protect.exe to encrypt the code. The exe seemed to work until I tried to put use a folder name in the output file name thus:
protect es.lsp L kelvinated\protected\es.lsp
First of all, can I do this? Will protect.exe work like this, or do the input and output file have to be in the same folder?
Also, one time I tried this and I got a "stack overflow" error. Therefore, I am here.
Kelvinator/protect et al are pretty old utilities, do you know the last time they were updated? Subtitle, they may expect old school 8.3 file / folder names.
As for "will this work?", I cannot say, as I use different schemes to protect my work when writing lisp for others (vlx/fas, bricscad's encryptor, my own loader / obfuscators ...).
A stack overflow in this context suggests a recursion error, perhaps when it tries to reconcile the pathing you're providing.
Have you tried to use the DOS short path? Putting the path in quotes? Using forward slashes? Using double backslashes?
What happens if you pass "/?" (and alternates) on the command line, does it provide any help?
Finally, if it refuses to process the files unless they share they same directory you could always front end with with a batch file that does the housekeeping for you.
Michael.

Where does RegexBuddy store its working data between uses?

Ok, so I'm an idiot.
So I was working on a regex that took way to long to craft. After perfecting it, I upgraded my work machine with a blazing fast hard drive and realized that I never saved the regex anywhere and simply used RegexBuddy's autosave to store it. Dumb dumb dumb.
I sent a copy of the regex to a coworker but now he can't find it (or the record of our communication). My best hope of finding the regex is to find it in RegexBuddy on the old hard drive. RegexBuddy automatically saves whatever you were working on each time you close it. I've done some preliminary searches to try to determine where it actually saves that working data but I'm having no success.
This question is the result of my dumb behavior but I thought it was a good chance to finally ask a question here.
On my XP box, it was in the registry here:
HKEY_CURRENT_USER\Software\JGsoft\RegexBuddy3\History
There were two REG_BINARY keys called Action0 and Action1 that had hex data containing my two regexes from the history.
The test data that I was testing the regex against was here:
C:\Documents and Settings\<username>\Application Data\JGsoft\RegexBuddy 3
It depends on the OS, of cause, but on Windows I would guess the application data directory. I can't remember the path on xp but on vista it's something like this:
C:\Users\ user name \AppData\
And then it would probably be here:
C:\Users\ user name \AppData\roaming

Resources