Git: Using repositories/branches for source separation
0
Git is a wonderful and easy way to manage your source code of any kind of project and using GitHub as the central is a smart move. Especially when you developing a web project it is always good to have a staging site where you can see the latest stage of the development in a production-like environment.
But what if your company wants you to separate the source code into development, staging and production stages? You can use branches even completely separated repositories to achieve that.
In my current project I’ve set up this branching system with a single repository:
- master
- protected/development
- protected/staging
- protected/production
- [...] all other branches from my team
Note: the prefix protected/ is a valid prefix for branch names
The workflow is:
- everything that is in
masterwill be pushed periodically toprotected/development - as soon as changes in
protected/developmentare detected, the development site will be deployed - every morning the latest source from
protected/developmentwill be pushed toprotected/stagingand the staging deployment site is started - once we are happy with the state of the staging site, we decide to manually start the deployment of the production site by pushing the source from
protected/stagingtoprotected/production - using the
protected/*branches directly by the team members is not allowed
We are using JetBrains Teamcity to manage and execute these steps automatically. One of these steps is a shell script to synchronize the git branches.
you can call this script as following: ./sync_repos.sh [path_to_work_in] [ssh/http-origin] [ssh/http-destination] [origin-branch] [destination-branch]
example: ./sync_repos.sh ~/repos/dev git@github.com:user/project.git git@github.com:user/project.git protected/development protected/staging
Note: The path_to_work_in is necessary to create a bare repository as working base
Bonus: here is a script that makes a backup of you whole repository including the tags.
Have fun setting up your own branching system!
Why you shouldn’t use Entity Framework with Transactions
0EntityFramework
This is a .net ORM Mapper Framework from Microsoft to help you talking with your Database in an object oriented manner. Wikipedia
Database Transaction
A database transaction, by definition, must be atomic, consistent, isolated and durable. Database practitioners often refer to these properties of database transactions using the acronym ACID. Transactions in a database environment have two main purposes:
- To provide reliable units of work that allow correct recovery from failures and keep a database consistent even in cases of system failure, when execution stops (completely or partially) and many operations upon a database remain uncompleted, with unclear status.
- To provide isolation between programs accessing a database concurrently. If this isolation is not provided, the program’s outcome are possibly erroneous. Wikipedia
.NET Transactions
A .NET Transaction can be used in different ways by different frameworks to support transactions. The .NET Transaction itself is not connected with the database by any means. MSDN
.NET Transactions and the EntityFramework
If you are using the Entity Framework during an opened TransactionScope, EntityFramework will open a new Transaction right with the next command that will be sent to the Database (CRUD Operation).
Consider this code block:
The database.SaveChanges() call sends your changes to the database and executes them but they are not really persisted because you are in the database transaction scope. transaction.Complete() actually finishes the database transaction and your data is saved.
That behavior is actually cool and very useful, right?
NO. Absolutely not. full stop.
Why not using .NET Transactions along with EntityFramework
The default isolation mode is read committed and fits perfectly to 99% of your needs, eg. reading data. When you want to save the changes you made to the database (Create, Update, Delete), EntityFramework is smart enough to create a transaction without your notice behind the scenes to wrap the changes. You can be sure that everything will be saved or every change will be discarded (Atomicity).
By using transactions in EntityFramework, you change that behavior and force every CRUD operation during a transaction scope to be executed in serializable isolation mode which is the highest and most blocking type. No process will be able to access the tables you have touched (even reading from it) during your transaction. That can lead to Deadlocks pretty fast and you want to avoid them at all costs!
That’s how the code looks like without the explicit usage of transactions:
Rule of Thumb: Save only once per task and don’t use transactions.
Free Open Source Sotware
0Recently I watched A tour through open source creative tools from Máirín Duffy Strode, Sr. Interaction Designer from Red Hat Inc. and I thought is is a good idea to put this list of GREAT software onto this blog. Enjoy!
Drawing
Photographie / Imaging
Darktable Raw Image Editor
CMYKTool Rich Converter for CMYK from/to RGB
Office
Xournal
Calligra Suite BrainDump, Flow (Diagram / Flowcharts), Karbon (Vector Graphics), Kexi (Visual Database Creator), Krita (Sketching, Painting), Plan (Project Management), Stages (Presentations), Sheets (Calculation, Spreadsheet), Words (Writing)
Scribus Desktop Publishing like InDesign
Audio
Audacity Rich Music Editor
Hydrogen Advanced Drum Machine
MIXXX Free DJ Software
3D / Animation / Movies
Blender 3D 3D Modeling, Rigging, Animation, Raytrace Rendering, Physics and Particles, Game Engine, UV Editing, Movie editing, Raw Footage tracking, Image Compositing and many many more
Synfig Studio
Kdenlive Video Editor
GNOME Specials
Gnome Color Manager
Wacom Control Panel
Sharing Service
Sparkleshare Uses GIT under the hood and can be self hosted.
WPF Localization Extension v2.1.0
0The new version arrives and I have some highlights to point out:
- First of all: ITS FREE (and will stay free)
- Obtain stable results in
- WPF applications using .NET 3.5 and higher
- New: Silverlight 5.0 applications
- New: Localization source/provider can be changed freely at arbitrary nodes
- Use the Provider property in LocalizeDictionary to change the provider for the particular sub tree
- Use the DefaultProvider property to set the provider for the whole application
- Built-in RESX provider for resource file lookup (Default) – fully backward compatible to older versions of this extension
- Interface for custom providers
- Notification about provider changes and errors
- Get the list of all available cultures from a provider – or just take the bindable merged list from LocalizeDictionary
- CSV provider project in the Tests folder as an example for custom providers
(more…)
Unique Ball Wallpaper
2Hi there,
I’ve created a wallpaper in a couple of hours playing around with particles and cycles and that was the outcomming:
I used particles, cycles, glowing materials and the compositor.
how do you like it?
WCF & WebAPI JSON Dictionary
0Imagine you want to serialize a Dictionary<string, string> for wcf json output.
The JSON output would look like this:
[
{
Key: "key1",
Value: "value1"
},
{
Key: "key2",
Value: "value2"
}
]
But you want a correct JSON dictionary format:
{
"key1": "value1",
"key2": "value2"
}
Automated Web Deployment with MSBuild and MSDeploy
4If you are looking for an automated web deployment process you will inevitably come to MSBuild.
There are many tutorials out there how to set up a command line call for MSBuild but you wont find a documentation how to publish a generated package with MSDeploy.
But this is especially needed is you want to use “-setParam” for a tokenized (transformed) web.config file and wont / can’t change the SetParameter.xml!
(The names of the parameters for -setParam can be found in the SetParameter.xml file in the same directory as the Package.zip. They are also act as default values if not set in the command line call. )
So I wrote this quick tutorial how to get command line call for MSDeploy.
(Please consider that the paths you will later use are absolute / relative to the working directory.)
Step 1: Get the publish ready with MSBuild
Before we will get some further results please get your deployment call working.
msbuild.exe
SomeWebProject.csproj
/P:Configuration=Release
/P:DeployOnBuild=True
/P:DeployTarget=MSDeployPublish
/P:MsDeployServiceUrl=https://TargetServer/MsDeploy.axd
/P:AllowUntrustedCertificate=True
/P:MSDeployPublishMethod=WMSvc
/P:CreatePackageOnPublish=True
/P:UserName=Username
/P:Password=Password
/P:DeployIisAppPath=TargetWebSite/TargetWebApp
Configuration: This is the configuration you will use eg. Debug, Release or a custom one
AllowUntrustedCertificate: You will need this if you do not have a valid certificate on the server
DeployIisAppPath: The name of the target website eg. “Default Web Site/MyWebApp”
TargetWebSite/TargetWebApp: Please consider the different usages below!
Step 2: Get the command line for MSDeploy
Append the parameter “/P:UseMsdeployExe=True” to the msbuild.exe call. If you do so, you will see the call in the console like this:
MSDeployPublish:
Start Web Deploy Publish the Application/package to https:/TargetServer/MsDeploy.axd?site=TargetWebSite …
Running msdeploy.exe.
msdeploy.exe -source:package=’C:\SomeWebProject\obj\Release\Package\SomeWebProject.zip‘ -dest:auto,ComputerName=’https://TargetServer:8172/MsDeploy.axd?site=TargetWebSite‘,UserName=’Username‘,Password=’Password‘,IncludeAcls=’False’,AuthType=’Basic’ -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -allowUntrusted -retryAttempts=2
Gotcha! This is the important MSDeploy command line call.
Step 3: Get the two things together
now we can split the automatic deployment of MSBuild into 1. create only the package with MSBuild and 2. only deploy with MSDeploy.
msbuild.exe
SomeWebProject.csproj
/P:Configuration=Release
/P:DeployOnBuild=True
/P:CreatePackageOnPublish=True
msdeploy.exe
-source:package=’C:\SomeWebProject\obj\Release\Package\SomeWebProject.zip‘
-dest:auto,ComputerName=’https://TargetServer:8172/MsDeploy.axd?site=TargetWebSite‘,UserName=’Username‘,Password=’Password‘,IncludeAcls=’False’,AuthType=’Basic’
-verb:sync
-disableLink:AppPoolExtension
-disableLink:ContentExtension
-disableLink:CertificateExtension
-allowUntrusted
-retryAttempts=2
-setParam:’IIS Web Application Name’=’TargetWebSite/TargetWebApp‘
Have a nice day.
Sunrise Mood Logo
0As i saw the advertisement from Pro7 for the “Comedy Dienstag” i want to reproduce this effect:
This is my interpretation:
The colors and the strong reflection is my personal taste.
The .blend file can be downloaded HERE.
Sculpt-Brush Tips
2With Blender 2.59 we got a very new and stable version to play with.
While exploring the new features i found two new functions!





