Showing posts with label tool. Show all posts
Showing posts with label tool. Show all posts

Wednesday, January 18, 2017

C# code generation for databases

Hi,

today I found SQLMetal.exe... https://msdn.microsoft.com/en-us/library/bb386987(v=vs.110).aspx

It is part of the visual studio installation and can create c# and vb code for different kind of db artefacts... I am curious how this works in comparison to Entity Framework (= T4).

kr,
Daniel

Tuesday, January 3, 2017

vim as a command line util

For quick find, edit, search and/or replace actions vi | vim | gvim is a perfect tool. A research question for me was: is it also a tool for automation? I wanted to search and replace strings with vi-syntax through a batch file (yeah... using windows makes the thing even more special) which can be scheduled or called on demand.

... and yes... it works. see: http://stackoverflow.com/questions/6945558/calling-search-and-replace-functions-for-vim-from-within-a-bash-script ... the trick is to start in "Ex-Mode" ... (see: documentation), but unfortunately it did not worked for me... I was not able to make it work in my script... no idea why... but:


then I found the -c option which is simple and works perfectly... -c executes a command like substitutions or other stuff and can be used in a chain of "-c"s.



my test-environment:
echo. >> data.txt
del data.txt
echo data data data > data.txt
cls

type data.txt
gvim -c %%s/data/0101/g -c wq data.txt
echo _____________________________________________________
type data.txt

it outputs data before the substitution and 0101 after it... perfect!

kr,
Daniel

Thursday, December 8, 2016

REST APIs

found 2 very nice projects which are used to develop REST APIs. They are designed high level and can be used for code generation and documentation.


  • http://swagger.io/
  • http://raml.org/

with the ability to move swagger to raml using the project swagger to raml ( http://raml.org/projects/projects#q:swagger2raml ).

Important for me: both work with Java and .NET ... Swagger even has Client Generation for Angular (1 and 2).

Currently not available: .NET WebApi which would be great.

kr,
Daniel

Tuesday, December 6, 2016

sqlcmd nowadays

Hi,

it is quite uncommon for MS-SQL Server-DBAs to work in command line (or much more uncommon in comparison to oracle or pg-sql DBAs). Nevertheless there is a tool from the stone-age called sqlcmd which has very nice features and which is actively developed by Microsoft up to now. See here: http://www.sqlserverspecialists.com/2012/10/sqlcmd-commands-sql-server-tool.html and https://msdn.microsoft.com/en-us/library/ms162773.aspx .

Main thing is:
- connect to different db
- call dos commands (mixing up OS and DB)
- set and use variables
- load sql files for execution
- redirect output to filestreams (file, stdout, stderr)
- change output format to XML

... even if this sounds quite limited it is still helpful for many purposes like e.g.: scheduled tasks. Especially the OS / DB combination is often very useful if you need to wait for the execution of A to start db-job B.

In SQL Server Management Studio the so called sqlcmd-mode to be used inside the query window is implemented which allows a limited feature set in comparison to the command line features seen above. See: https://msdn.microsoft.com/en-us/library/ms174187.aspx

Using SQL Server Agent you need to use an Operating-System Job-Step to work with sqlcmd (like with any other OS application). See an article about differences between TSQL-JobSteps and CmdExec using sqlcmd here: http://www.travisgan.com/2014/04/sql-server-agent-job-and-sqlcmd.html

So finally: with sqlcmd scripting can be improved by using variables, call different scripts and call the OS. In the original command line version it has some possibilities (like opening a dedicated admin connection) which are nice, but another very helpful thing is that it is kept small and performant.

Kr,
Daniel

simple secure data safe

Hi,

today I added a new github repo which contains a script toggling a folder to be

1) a password secured file or
2) a data folder to work in

https://github.com/starkeeny/SSDS

I will go on working on this, but I think it is a nice start for securing my data.

Btw: there is a nice hint from codeproject related to the topic of securing data http://www.codeproject.com/Articles/1151836/How-to-hide-your-files-in-windows-using-unmounted , but I think to remove the drive letter from a drive is not my favourite solution. Nevertheless as a user I wouldn't have expected to find data on an "un-named" drive... so this is a nice and still simple trick...


Kr,
Daniel

Thursday, May 19, 2016

Backup

Today i wanted to backup my PC. There are 1000 possible ways to. My favorite solution would be: having 5 Dropbox accounts (1 for each device) with unlimited storage... 

Unfortunately this is only possible with a paid team or business license... So... No... Also any other cloud solution costs...

A possible opportunity was owncloud ... an on-premise solution with support for mobile devices. After spending hours installing a wamp-server and owncloud i found out that this can not be hosted on windows (since a couple of version ... Attention there are youtube tutorials for windows -> legacy! No windows support)

I decided to use copy jobs like robocopy or freefilesync for my PC (all directories except: windows and "program files"). This works great...

Last improvement i found is btsync (bit torrent synchronization), which copies directories over the internet. The sync-app is implemented for a lot of devices, so finally I found a way to backup my mobile phones too! yes!

Wednesday, February 24, 2016

My first hour with prolog (Prolog 101)

I started with prolog and it is hard. It really is!
Here I found a portable "IDE" http://portableapps.com/apps/development/swi-prolog_portable and here a video how to use it: https://www.youtube.com/watch?v=6Dh7eux76a8 .
I created a test project to summarize a list of numbers:
File > Edit > [select a file with following content: *.pl]

sumOfItems([], 0).
sumOfItems([H | T], Output) :-
    sumOfItems(T, OutputInner),
    Output is H + OutputInner.

File > Consult > [select same file]
1 ?- sumOfItems([1,2,3,4,5],X).
X = 15.
... from now on changes to the file are taken over if they were compiled.
To check that I added the following function and compiled:
avgOfItems([], 0).
avgOfItems([H], Result) :-
 Result is H.
avgOfItems([H|T], Result) :-
 avgOfItems(T, ResultInner),
 Result is (H + ResultInner)/2.
avgOfItems was callable...

kind regards,
Daniel

Wednesday, February 3, 2016

writing an executable in javascipt

Hi,

today I played around with javascript and its possibilities. To execute js in the browser was a quite non-innovative approach. That windows-8/10 apps can be written in js was also not new to me.The missing element to cover all kinds of applications was the desktop application. After 10 seconds of google-ing I found out that this works too. Even better, it works in combination with the .net framework which opens up a lot of possibilities.

The following code snippets show my test case. The resources I used were: http://www.phpied.com/make-your-javascript-a-windows-exe/ and additionally to check for the ability to use WPF components (yes that works too) https://social.msdn.microsoft.com/Forums/vstudio/en-US/bb41013f-e915-4743-81b0-8bea2d9acebb/jscriptnet-wpf?forum=netfxjscript .

make.bat
@echo off
del program.exe
"c:\Windows\Microsoft.NET\Framework\v4.0.30319\jsc" "program.js"
program.exe

program.js
import System;
import System.Windows.Forms;
function outputMessageBox(text) {
 MessageBox.Show(text, "output message");
};
 
function output(text) {
 Console.Write(text);
};
 
output('hello world');
outputMessageBox('hi');


I am looking forward to find a use case for it :-)

kind regards,
Daniel

Friday, October 30, 2015

Reporting solutions

Hi,

today I had a look on reporting software... of course I did not consider the hardcore solutions for big corporations like Cognos, tibco, microStrategy,...

After some research I decided to pick the following solutions to dig deeper:
- SAP: Crystal Reports
- Microsoft: SSRS
- Eclipse: BIRT
- tibco: JasperReports
- jsreport
- sealreport
- Pentaho

The free solutions looked mature enough to kick the commercial solutions out of my evaluation.
jsreport seems to have currently fewer features than the others (even if the concept looks quite straight-forward for web-solutions), so I kicked it.
seal-reports is open source, but the full power of the solution will not be unleashed until buying a license (when I understood it right), so I kicked it.

- Eclipse: BIRT
- tibco: JasperReports
- Pentaho

These are exactly the solutions as described in http://opensource.com/business/14/6/three-open-source-business-tools ... Because I want to stay focused on reporting and not on BI I removed Pentaho from the list ( http://www.pentaho.com/ seemed to stress the data integration and the setup of a cube) and choose BIRT because of a lot of opinions on the web like  http://stackoverflow.com/questions/2513534/birt-vs-jasper-reports .

A good comment of the opensource.com-link above introduced the page www.reportserver.net which seems to be a good extension to the BIRT technology.

must criterias for the reporting solution:
- db interface
- pdf output
- web output
- IDE for power-users
- active development / community
- command line support

kind regards,
Daniel

Monday, May 11, 2015

Tool for load tests and performance tests

I needed to make some load and performance tests ... I thought about using the visual studio components, but I realized that I have no studio installed on the machine where I wanted to make my testing ... I needed another tool! Test Studio of Telerik costs 80$ a month ... #dislike

Finally I thought about using an open source tool. After some google search I found some opportunities ( http://blazemeter.com/blog/open-source-load-testing-tools-which-one-should-you-use ), but JMeter seems to be outstanding...

... and it worked for me! The following tutorial with 20 minutes was enough to setup my first easy use case...


kind regards,
Daniel

Saturday, March 28, 2015

DB diff tools

made some research on database tools for comparing databases about changes and differences...

free

non-free


The solution of simego seems to be one of these hidden heroes in the universe nobody knows but saves life all day... I really really like this product... 

it supports the following features in the current version/release 3.4.000 (copy from the original page):

  • Fast access to your database without the bloat
  • Edit Table Data
  • Execute Ad-Hoc SQL Queries
  • Create and Edit Stored Procedures, Views, Functions and Triggers
  • Compare Database Schema and Synchronise the Changes or generate a Change Script.
  • Compare SQL Data and Synchronise the Changes or generate a Change Script.
  • Export Data to Xml, CSV and Excel File Formats
  • Automatic Code Generation from SQL Schema
  • Multi Window Layout
  • Cached database registration for fast start up time
  • 64 Bit and 32 Bit versions
  • Export data (CSV File, Excel File, XML File and SQL Script)
  • import
  • compare schema
  • compare data
  • generate code (VB.NET, C#)
  • automation abilities (NANT Build process integration)
kind regards, 
Daniel

Tuesday, February 3, 2015

MongoDB

The last few days I had a look on MongoDB (using windows)...

MongoDB was developed by a company called 10gen and was open-sourced in 2009. The reason they started building a database was simply the lack of usable NoSql databases for their own service. 2013 they renamed their company to MongoDB Inc. to express their new focus. A key player here is Dwight Merriman.

MongoDB itself is a C++ open source NoSQL schemaless (but can be used with a schema) document store (IaaS) storing BSON (Binary JSON) documents with JavaScript as procedure language and good scaling behavior (CAP theorem: partial consistency).

Installation process is well documented and worked for me without any troubles. Best thing is that it can be skipped using mongoDB portable (e.g.: ZWAMP is a portable windows web-stack with mongo). The only thing to do is to create a config file or set --dbpath to a folder with the data and start mongod (daemon). Another nice feature is the ootb http-interface (can be enabled by argument) and the --rest switch which allows basic data querying.

Tools:

  • php MongoDB admin
  • MMS: Mongo Management Service
  • Mongo Shell (ootb)
  • RoboMongo
  • MongoVUE
  • Query Translator ( http://www.querymongo.com/ )
    e.g.: translates 'select * from x where _id <= "3"' to '
    db['x'].find({"_id": { "$lte" : "3" }});'
The following code (php) shows my first tries with mongoDB (I used dBug http://dbug.ospinto.com/ http://sourceforge.net/projects/php-dbug/ for visualization)



  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
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php 
 header('Pragma: no-cache');
 include_once('dbug\dbug.php'); // its open source and a single file to copy http://dbug.ospinto.com/
 if (!class_exists('Mongo')) die("Mongo support required. Install mongo pecl extension with 'pecl install mongo; echo \"extension=mongo.so\" >> php.ini'");

 // returns a connection object to work with
 function Connect()
 {
  try
  {
     return new Mongo('mongodb://localhost:27017', array('connect' => true));
  }
  catch (MongoConnectionException $ex)
  {
     error_log($ex->getMessage());
     die("Failed to connect to MongoDB");
  }
 }

 function ShowDBs()
 {
  $dbs = Connect()->listDBs();
  new dBug($dbs);
  echo "<hr />";
 }

 function CreateDB($name)
 {
  $mongo = Connect();
  $mongo->selectDB($name)->createCollection('__tmp_collection_');
  $mongo->selectDB($name)->dropCollection('__tmp_collection_');
   }
   
 function DropDB($name)
 {
  Connect()
   ->selectDB($name)
   ->drop ();
 }

 function CreateCollection($db, $col)
 {
  Connect()
   ->selectDB($db)
   ->createCollection($col);
 }

 function AddDocument($db, $col, $doc)
 {
  Connect()
   ->selectDB($db)
   ->selectCollection($col)
   ->save($doc);
 }

 function ShowDocuments($db, $col)
 {
  $cur = Connect()
   ->selectDB($db)
   ->selectCollection($col)
   ->find();
  
  foreach($cur as $data) 
  {
   echo "\n<div style='float:left;margin-right:10px'>\n";
   new dBug($data);
   echo "\n</div>\n";
  }
 }

 function CreateSPToAddNumbers($db,$col)
 {
  Connect()
   ->selectDB($db)
   ->selectCollection('system.js')
   ->save(array(
    '_id'   =>                        'addNumbers',
    'value' => new MongoCode('function addNumbers(x, y) { return x + y; }')
   ));
   
 }

 function CallSPToAddNumbers($db, $col)
 {
  echo "<div style='clear:left'/><div style='padding-top:40px'>Calculation: 30 + 12 = ";
  var_dump(Connect()->selectDB($db)->execute(
    'function(x, y) { return addNumbers(x,y); }', 
    array(30, 12)));
  echo "</div>";
 }

?>

<html>
<head><title>mongo test</title></head>
<body>
<?php

 //ShowDBs();
 DropDB('CC');

 //ShowDBs();
 CreateDB('CC');
 // die();
 
 //ShowDBs();
 CreateCollection('CC','x');
 // die();
 
 AddDocument('CC','x', array("_id" => "1", "name" => "John",     "details" => array("born" => "1986", "status" => "tired")));
 AddDocument('CC','x', array("_id" => "2", "name" => "Lenny",    "details" => array("born" => "1981", "status" => "tired")));
 AddDocument('CC','x', array("_id" => "3", "name" => "Frank",    "details" => array(                  "status" => "tired")));
 AddDocument('CC','x', array("_id" => "4", "name" => "Ryan",     "details" => array("born" => "1988", "status" => "tired")));
 AddDocument('CC','x', array("_id" => "5", "name" => "Will",     "details" => array("born" => "1990", "status" => "tired")));

 ShowDocuments('CC','x');

 CreateSPToAddNumbers('CC','x');
 CallSPToAddNumbers  ('CC','x');
?>
</body>
</html>

... the code drops and then creates a db 'CC' (cloud computing) with a collection x with 5 documents then shows the document and the result of an example function.

kr, Daniel

Monday, February 2, 2015

Prototyping (Part 1)

I am currently doing some research on "prototyping". My interests concentrate on desktop applications and how requirements can be validated. In some cases a lack of understanding costs days, weeks, months or years of time. The earlier errors are found or not made the less costs arise to get back on track. So I think some additional costs and time spending is nothing compared to a completely misunderstood requirement (the more important the more expensive).

In this post I concentrate on software found in an - as good as infinite - list on http://c2.com/cgi/wiki?GuiPrototypingTools ...

What I am looking for is a software which:

  • shows screens
  • offers walk-through-prototyping 
  • is optimized for web pages and windows desktop applications
  • can handle code extensions to enrich the prototype
  • uses .NET or JavaScript for enrichment
  • optional: can use photography (e.g.: paper prototypes) as base of work
before creating a list of possible matching tools here a tool for android which inspired me: POP https://popapp.in/ ... it is really amazing. I would recommend to try it if you build mobile apps! ... but I don't, so I keep on looking for an alternative. (See also: http://alternativeto.net/software/pop--prototyping/ )

My top 10 tools from the link list above are (with focus to the mentioned requirements / price-schemas: commercial, single-user license):
unmentioned till here: Big 3rd party vendors like telerik or infragistics built their own prototyping software. It makes sense to use their products when you use their libraries, because the prototypes are nearer to the final result (less imagination needed by the customer).

The prototyping market is currently focusing on app development and web development (clear trend). Enterprise applications (what I think often means desktop applications) are only supported by good established, bigger products. My requirements are not met by any product (found nothing after hours of research and even after looking tons of other listing pages, which are mostly subsets of the mentioned list). 

Some smart guys on the net advised to use paper only, others talk about their experience with pure drawing programs, but in my opinion such prototyping is not close enough to the final product to validate customer needs. Other opinions are to use lightswitch or other RAD tools, but I think they aren't the right way to validate the requirements either. I think this is also a bad idea because you turn from "no code" to "code it all", but it brings us to an important question:

Who should build a prototype and why? 

For validating business requirements I advice a requirements engineer, project manager or management guy. Validating technical questions like: "we want an interface, can we technically get it up and running" will be done by a technical engineer and is completely different to the other situation. I think I will dive deeper into this question in a following post.

Anyway, I think that this time there is a chance to build a product which has unique features on the market and I am looking forward to do something in this area...

kr, Daniel

Thursday, October 16, 2014