.cabal file keeps reverting to template on save in Visual Studio Code - haskell

I've been going through the book Haskell Programming from First Principles and I've gotten to the section on testing where I've started to encounter this strange issue.
Whenever I try and edit the .cabal file for my project, every time I save it it reverts back to the template .cabal file that is generated when creating a project with stack.
I've tried saving without formatting and editing the file in Notes (I'm on Mac), saving, and then reopening the project in vscode (this also reverts the file to the template).
Does anyone have any idea what might be going on? I'm using the basic Haskell extension, the syntax highlighting extension, the debugging extension (which I have not gotten to work, anyway), and brittany for auto-formatting.
Thanks all!

When I checked my package.yaml (as referenced by #Koterpillar) I realized that it was acting as a generator of sorts for my .cabal file.
I then edited package.yaml with the information I needed and it fixed my issue. My .cabal file now contains the appropriate parameters.
Thanks #Koterpillar!

Related

Citation in TeXMaker new version

I have reinstalled TexMaker Editor and every time I try to use my .bib file for citations, I only see the ?? instead. I made sure I change the settings in the Quick Build to include the right one but nothing happens. I use the proper packages (I've already used them in a previous .tex file which works perfectly fine). The old file was created on the old version of TexMaker.
Alternatively, does anyone know ow to use a .bib bibliography on Overleaf?
enter image description here

Excel file retrieve original file extension or bypass fileformat-extension mismatch

We have a file that gets imported by a macro to extend Excel's macros functionality. This file has an extension .dll. The person who originally made this purposely changed the extension to dll to make it a bit less easy for users to just open it. All was well, but now the latest excel 2016 update gives an error "file format and extension mismatch".
which is correct. Now, in my opinion, I have 2 options.
change the extension to what it originally was (which I don't know).
bypass the extension/file format mismatch (which I don't know how to do and might pose a security risk).
I tried the following extensions: xla,xlam,xlsx,xlsb,xlm,xls,xll. but still get the same message.
Does anyone have a clue on how I can find out what the original file extension was?
I am not sure but the file might have been created in excel 2000 or 2007.
I found out that the issue is not with extension or file format but the problem was caused by AV/bit Defender which saw the file as a zip file started scanning inside and removed a single file inside thus causing excel to no longer recognise it as a valid file.
I noticed some weird behaviour as soon as I restored quite some files from backup, AV defender started using 95% cpu. after that I went into the logs and noticed defender thinks it is a trojan.
Thanks all for your input!

How to get source code for all build-depends using cabal?

I generated a new project using Yesod and am trying to go through the source to see how the pieces fit together. I am still a bit unfamiliar with most of the types so I have to keep a browser open where I hoogle/hayoo for types of things.
When I use Intellij for Java development I can usually just jump in to the source code of most of my dependencies. I wanted to try to replicate this for Haskell.
Since I am using vim for Haskell I thought I would just get the source for everything listed in build-depends and then generate a specific cabal_tags file and add that to vim's tags option.
My cabal skills are very rudimentary though. I noticed there is cabal get which can get the source for a package but it seems you need to explicitly specify the package and there doesn't seem to be an option for getting everything specified under build-depends in the .cabal file.

How to edit a .sx file

I am trying to edit an .sx file associated with this addon for microsoft test manager: Test Scribe
But if I make any change to the file in any editor test manager crashes. This should work since other people have said this is how they fixed the plugin not handling certain characters.
When I open the file in notepad++ it looks almost like an archive or something. Any ideas?
Figured it out, turns out it is using zip so you can open it and edit the files inside.

How do I rename an entire project in VC++ 2005

I've got a really large project I made for myself and rece3ntly a client asked for their own version of it with some modifications. The project name was rather silly and my client wants the source so I figured it'd be best if I renamed all my files from
sillyname.h
sillyname.cpp
sillyname.dsp
etc..
Unfortunatly after I added everything back together I can't see any way to change the project name itself. Plus now I'm getting this error on compilation.
main.obj : error LNK2001: unresolved external symbol __imp__InitCommonControls#0
Debug/New_Name_Thats_not_so_silly.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
There has to be an easier way to change all this, right?
Here is a Step by Step on Steve Andrews' blog (he works on Visual Studio at Microsoft)
I haven't verified this, but I've done this a number of times and if my memory serves me right, you can actually use the search-and-replace functionality in VS2005 to rename all instances of the string "X" to "Y" in any type of file.
Then you need to close the solution and change the project (and any other file with the same name regardless of extension) file name(s).
You will obviously need to do a full rebuild afterwards.
I find it always annoying too, to do this manually.
So I tried some tools available by googling- two didn't work (VS C++ here), dunno, if they are more useful for C#.
The following tool worked good for me: I have used the trial version, but I will pay 39,- bucks for it. For me it is worth it. It has also a VS add-in. VS 2013 was not supported directly, at least not mentioned, yet, when I looked:
http://www.kinook.com/CopyWiz
In-place rename didn't work (access error), but "rename-while-copying" worked fine.
But I really wonder, if it is so difficult as some programmers claim. For most parts file renaming and a search&replace of all occurences in all text files in the project dir should be a quite easy and working approach. Maybe someone can contibute what shall be so difficult.
The rational part of my brain forbids the dreaming part to program an own tool- I am lucky ! :-)
You can simply rename the .vcproj or .dsp file and then either create a new workspace (sln dsw) and include the renamed project or simply chnage the name inside the sln file (it's just xml) I can't remember the format of the old workspace but it's still text.
You can either manually rename and reinclude all the .cpp of edit the project file and rename them in there.
sorry don't know of refactoring tool that will do all this but there probably is one.
I assume that in addition to the renamed set of files, you also still maintain a complete "parallel" set of the original files in some other directory, am I right?
Assuming you have both versions, what I would do is:
Get a file comparison tool like Beyond Compare or DiffMerge and compare the old SLN file and the new SLN file side-by-side. Also do this for each "proj" file and any other "config" type files.
It is possible to edit these files by hand. Usually looking at what is different between two copies will help illuminate what you should do to get the second one working.
You might as well start tinkering with the renamed project by hand, anyway, given that it already isn't working. You can't make it much worse. And: you might learn some handy tricks about the XML structure of these files.
Even if you do make small mistakes when hand-tweaking this files, I have repeatedly been very impressed by how Visual Studio handles things. Visual Studio will usually tell you exactly where you got it wrong.

Resources