Skip to main content

Not fashionable enough to be arrested

 I’ve been playing with .Net on one of my projects now and we’re using C#. Other teams are in the enterprise. Or the so called Java. You know what I mean, “the IMPLS”. Now I’m diverting. Anyway, Java people on the other teams have check styles. Ok, let’s just call them jTeam for now. Checking styles are one way to set rules on your codes. Some people usually think it’s useless but I have my liking to it. I think codes should be beautiful as oppose to fanciness. I don’t like fancy, simple is useful and should be at least beautiful. What I mean with beautiful is that code shouldn’t be messy. One example is spacing. Having code like x = y+z; and in another code there’s z=y + x * 2; There’s not much of a problem here. It’s just that the spacing is inconsistent. And I think it shouldn’t be that way. I think it’s irritating to look at.

Checking all of these inconsistencies in about 2000 lines of code is awful. Horrible if you’ve got tens of thousands of lines or hundreds. But do not fear. Then came check styles. jTeam has all these and I think most of them don’t quite get that .Net has also this. It’s because some teams don’t even unit test. Now I’m not saying unit testing is fun. Sometimes it’s time consuming but sometimes it pays to get testing done. What I’m saying is I think some (teams) don’t even know unit testing. Especially in our .Net colleagues. I for one, is not good with unit testing but not knowing it or whatever it is, is I think dangerous. It’s like sticking your noses to things you only knew. And to think they’re here about 5 years working, with no unit tests at all. Peligroso. Our .Net teams are bound to be discriminated. Sad.

Anyway as I said, we have check styles and it’s called StyleCop. I tried implementing it in one of the projects I’m managing as a development lead. We use SharpDevelop 3.2 and 4.2 for 2008 and 2010 project formats. Style cop is fun. All you got to do is set rules. You can do this by opening the style configuration file. Usually SharpDevelop has some default value in the Source Analysis project tabs. StyleCop has also some default configuration file in the installation directory. Usualy I just copy the default and put it to the src directory of our project and modify it to fit our needs. In SharpDevelop, point the style configuration file to where we paste the modified default. That’s it. It’s fun and not so difficult too.

But wait you would say. SharpDevelop didn’t find the task? We need to tell SharpDevelop to find StyleCop. Go to Options and in the Tools tree view, click Source Analysis, find the StyleCop installation directory and choose Microsoft.StyleCop.dll. Clik OK and we’re done.

Comments

Popular posts from this blog

Restoring .dat data to MSSQL

This is just a document in case I forgot to restore data files to MSSQL. I had this problem before when a colleague gave me a .dat files to be restored to SQL server. I had a 2008 version of the server and had no trouble restoring it. The problem is, I forgot how I did it when I had a new PC and I upgraded it to 2012 SQL server. But this is a simple task (although I had a full day remembering how I did it and I had no luck finding the solution from google). First off, click restore, like so I had trouble with the database whether or not to add a new database and restore the file to it, or not. Simple answer is no need. With the next image you can see that the configuration is very simple. Just set it to device as the source and find the .mdf file. It automatically displays a suggestion for the database name and you're done. Click OK and wait a couple of minutes for SQL server to restore the data. [EDIT] In case you are restoring a backup file without an extension. You c...

How to Backup using SQL Server Data

 Sometimes Task->Generate Scripts takes too time to backup especially when you want to backup only selected tables in the database. This can be done easily with bcp, issuing the command in your power shell dumps the data in tab-delimited values into a file. \> bcp "DATABASE.dbo.TABLE" out "C:\Downloads\TABLE.sql" -c -S "HOSTNAME" -U USERNAME -P PASSWORD Hope this helps, this is very useful for migrating data and for seeders where some tables are only needed to be seeded into the database as dependent values for other tables. We are heavily using this technique for testing. As for reference, here's our use case Dump data into .sql files Seed using QueryFromFile Run automation; this can insert new values to other tables based from the seed data from .sql file Rollback new values We need to rollback each time since we want to have data the same as it was so we can run each time and expect the same results for our testing. If not, there should be err...

Monero is your friendly neighbor - no not really, I mean friendly CPU miner

Monero is another one of those crypto currency that was really big news in 2017. Now the year ends and hoping for a fresh start in 2018. Just got my masternode up and so far so good. X11 is the algo chosen by Sucre so it's not really friendly to CPU. Now, back to Monero. Its algorithm is Cryptonite and it's friendly to miners that only has CPU. First off, get your monero wallet here . As for me, I do use FreeWallet so I don't worry other app/web for every wallet that I have. Anyway, if you get your monero wallet address, that's OK. All we have to do is to find pool to mine. I use MineXMR as it's simpler. You can choose whatever you like, just search for "monero mining pools" and you get bunch to choose from. Get the miner here, extract it to your location of choice and edit the config.json file. {     "algo": "cryptonight",  // cryptonight (default) or cryptonight-lite     "av": 0,                // algorithm var...