Skip to main content

Posts

Showing posts from March, 2019

How to set up git server on local network (Windows tutorial)

It is just easy as 1, 2, 3: 1) Go to folder, where you want to initialize server. Give it a name without spaces (or you will need to use quotes everywhere later to access this folder!) 2) Open git bash in this folder 3) Type git init yourpreferredname.git --bare (Note: you can try to name your folder without ‘.git’ at the end but in some cases it led to troubles later) Congrats! You’ve just set up your server! Let’s find out how to connect to it 4) Choose where you want to initialize client repository and open git bash there. Type: git clone <path_to_your_server> IMPORTANT! DO NOT FORGET TO CHANGE BACKSLASH (‘\’) IN THE PATH TO DIRECT SLASH(‘/’) Congrats! You can use this repository as usual and open it with your favorite git client. Ok, but how to connect to this server from another computer in local network? Easy! 5) Firstly go to Control Panel > Network And Sharing Center > Change advanced sharing settings Tick turn on network ...

Zipping up files from a MemoryStream

Recently I needed to write some .NET code that zipped up some files and downloaded the zip without touching the file system. I struggled to find a good example, so I thought I’d post the code here … Assuming that we’ve got the source files in memory in the following structure: 1 2 3 4 5 6 public class SourceFile {      public string Name { get ; set ; }      public string Extension { get ; set ; }      public Byte [ ] FileBytes { get ; set ; } } We can use the following code to zip these files up and send the zip in the response: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 public ActionResult Index ( ) {      // get the source files      List < SourceFile > sourceFiles ...