quinta-feira, 30 de maio de 2013
Convert string to stream
Sometimes you need to convert string to stream.
That's a very easy way to do it.
string Content = "Your string"
MemoryStream mStrm = new MemoryStream(Encoding.ASCII.GetBytes(Content));
If you have just installed SQL2008 Express
Hey folks!
Maybe you have just installed SQL2008 express and can't figure out where is the IDE to create database tables and stuff. In my case I looked for this IDE for hours.
Finally I found out that when you install the express edition, it doesn't install the IDE to administrate the database.
You have to download the
Microsoft® SQL Server® 2008 Management Studio Express
http://www.microsoft.com/en-us/download/details.aspx?id=7593
I know, I know, it's pretty obvious.
terça-feira, 28 de maio de 2013
How do we solve problems with quotes when it comes to insert?
Sometimes we have to insert text with quotes in database tables, but when we try to format the query problems happen.
Example:
Be Table a with a Column c1. And c1 is a column type text.
string lsql = "insert into a (c1) values ('[here you put your string value]')";
SqlConnection lConn = new SqlConnection([you connectionstring]);
SqlCommand lCmd = new SqlCommand(lsql, lCon);
lCon.open();
lCmd.ExecuteNonQuery();
lCon.close();
This is going to work if you string value has no quotes. If there's quotes you're gonna receive a message like
You have fewer fields parameters than values
// ********************************************************************* //
You can do a lot of manouvers, but theres a technique wich I consider the most elegant of all.
string lsql = "insert into a (c1) values (@yourstring)";
SqlConnection lConn = new SqlConnection([you connectionstring]);
SqlCommand lCmd = new SqlCommand(lsql, lCon);
// Parameters are very usefull when it comes to texts with quotes
lCmd.Parameters.Add(new SqlParameter("@TextFile", System.Data.SqlDbType.Text,5000,"textFile"));
lCmd.Parameters["@yourstring"].Value = [here you set your string];
lCon.open();
lCmd.ExecuteNonQuery();
lCon.close();
And voilà! Done!
Example:
Be Table a with a Column c1. And c1 is a column type text.
string lsql = "insert into a (c1) values ('[here you put your string value]')";
SqlConnection lConn = new SqlConnection([you connectionstring]);
SqlCommand lCmd = new SqlCommand(lsql, lCon);
lCon.open();
lCmd.ExecuteNonQuery();
lCon.close();
This is going to work if you string value has no quotes. If there's quotes you're gonna receive a message like
You have fewer fields parameters than values
// ********************************************************************* //
You can do a lot of manouvers, but theres a technique wich I consider the most elegant of all.
string lsql = "insert into a (c1) values (@yourstring)";
SqlConnection lConn = new SqlConnection([you connectionstring]);
SqlCommand lCmd = new SqlCommand(lsql, lCon);
// Parameters are very usefull when it comes to texts with quotes
lCmd.Parameters.Add(new SqlParameter("@TextFile", System.Data.SqlDbType.Text,5000,"textFile"));
lCmd.Parameters["@yourstring"].Value = [here you set your string];
lCon.open();
lCmd.ExecuteNonQuery();
lCon.close();
And voilà! Done!
ITILV3 - Day 25
Deming Cycle
Goal: Steady, ongoing improvement.
Deming Cycle stages and activities:
1 - Plan - Plan for improvement, design or revise processes.
2 - Do - Implement the plan, manage the process.
3 - Check - Monitor, measure and review the processes.
4 - Act - Improve the processes
The Plan, Do, Check, Act (PDCA) Deming Cycle should be repeated over and over to implement Continual Improvement.
It's a very good surprise to find out that ITIL has PDCA. A very effective technique and very simple to understand too.
segunda-feira, 27 de maio de 2013
ITILV3 - Day24
Demand Management
1 - Coordinates supply with demand.
What's the difference between Analyzing, Anticipation and Coordination? If you analyze and anticipate aren't you coordinating?
2 - Analyzes customer patterns of business activity (PBA) -
I think here comes the Big Data phenomena.
3 - Anticipates customer demand for services -
Big Data again, or a good administration of Data Ware House.
segunda-feira, 20 de maio de 2013
O que é gearing factor?
O gearing pode ser encarado como uma espécie de impedância relacionada aos pontos de função de um determinado código.
Quanto maior o gearing, mais linhas de código serão necessárias para se completar um ponto de função.
Parece uma conversa meio esquisita mas é o seguinte:
Se o gearing de CSharp é 62
E o número de linhas de código válidas são 150
Isso perfaz 2,419 PF.
Gearing CSharp = Gearing Factor
LOC
Onde encontrar esses fatores?
http://www.isbsg.org/
Apesar de parecer um site gratuito não é.
Preço de um relatório contendo estatísticas da indústria mundial
U$ 63,5
Há!
quinta-feira, 16 de maio de 2013
How to identify slash asterisk using C# and Regex
This is very very annoyin. It took me a lot of time to figure out how to identify /* and */.
The code bellow do the following: it find the occurrences of /* and */
==============================================================
Method 1
//Get all left slashs with asterisk.
public static ArrayList getAllMatches(string pText)
{
ArrayList arrMatches = new ArrayList();
string stringToTest = pText;
const string patternToMatch = @"/\*";
Regex regex = new Regex(patternToMatch, RegexOptions.Compiled);
MatchCollection matches = regex.Matches(stringToTest);
foreach (Match match in matches)
{
arrMatches.Add(match.Index);
}
return arrMatches;
}
=================================================================
Method 2
//Get all right slashs with asterisk.
public static ArrayList getAllMatches(string pText)
{
ArrayList arrMatches = new ArrayList();
string stringToTest = pText;
const string patternToMatch = @"\*/";
Regex regex = new Regex(patternToMatch, RegexOptions.Compiled);
MatchCollection matches = regex.Matches(stringToTest);
foreach (Match match in matches)
{
arrMatches.Add(match.Index);
}
return arrMatches;
}
I hope it is useful for you folks.
ITILV3 - Day 23
Definitive Media LIbrary (DML)
A Definitive Media Library (DML) refers to one or more secure locations where licenses, documentation, and the authorized versions of all software configuration items (CIs) are stored.
That was always a mistery for me. How and where are all the licenses stored?
The DML is managed and controlled by Service Asset and Configuration Management (SACM).
http://acolyst.com/wp-content/uploads/2010/12/service-asset-and-configuration-management.pdf
As organizations embrace the knowledge that IT service excellence is a contributor to
effective competition, many stumble when attempting to achieve this end. What these
enterprises are striving for is a true conversion to IT Service Management (ITSM),
which focuses on creating and managing services across their lifecycles — from planning
and delivering new IT services to maintaining and supporting day-to-day activities. A key
step toward meeting these goals, Software Asset and Configuration Management (SACM),
helps to manage the data needed to facilitate ITSM. Unfortunately, many organizations lack
formal guidelines for the best ways to embark on the SACM journey, and therefore struggle
when attempting to achieve true ITSM and service excellence.
My question is: Is SACM a software? Is it a concept?
A Definitive Media Library (DML) refers to one or more secure locations where licenses, documentation, and the authorized versions of all software configuration items (CIs) are stored.
That was always a mistery for me. How and where are all the licenses stored?
The DML is managed and controlled by Service Asset and Configuration Management (SACM).
http://acolyst.com/wp-content/uploads/2010/12/service-asset-and-configuration-management.pdf
As organizations embrace the knowledge that IT service excellence is a contributor to
effective competition, many stumble when attempting to achieve this end. What these
enterprises are striving for is a true conversion to IT Service Management (ITSM),
which focuses on creating and managing services across their lifecycles — from planning
and delivering new IT services to maintaining and supporting day-to-day activities. A key
step toward meeting these goals, Software Asset and Configuration Management (SACM),
helps to manage the data needed to facilitate ITSM. Unfortunately, many organizations lack
formal guidelines for the best ways to embark on the SACM journey, and therefore struggle
when attempting to achieve true ITSM and service excellence.
My question is: Is SACM a software? Is it a concept?
segunda-feira, 13 de maio de 2013
ITILV3 - Day 22
Core ITIL Publications
The Five Core ITIL Publications cover each stage of the service lifecycle:
1 - Service Strategy
2 - Service Design
3 - Service Transition
4 - Service Operation
5 - Continual Service Improvement
I didn't get it.
What are the five core ITIL Publications? Service lifecycle? Service Strategy is a core publication or a service stage? For me it's service stage.
What do you think about it?
The Five Core ITIL Publications cover each stage of the service lifecycle:
1 - Service Strategy
2 - Service Design
3 - Service Transition
4 - Service Operation
5 - Continual Service Improvement
I didn't get it.
What are the five core ITIL Publications? Service lifecycle? Service Strategy is a core publication or a service stage? For me it's service stage.
What do you think about it?
sexta-feira, 10 de maio de 2013
Exemplo simples de regular expression (CSharp, Regular Expression)
Neste exemplo coloquei no pattern de busca uma chave.
ArrayList getMatches(string pText)
{
ArrayList arrMatches = new ArrayList();
string stringToTest = pText;
const string patternToMatch = "}";
Regex regex = new Regex(patternToMatch, RegexOptions.Compiled);
MatchCollection matches = regex.Matches(stringToTest);
foreach (Match match in matches)
{
arrMatches.Add(match.Index);
}
return arrMatches;
}
O que este código faz
1 - Cria um array
2 - Utiliza um patter de busca "{". Serão procuradas todas as chaves do texto passado.
3 - Utilizou-se o regular expression para procurar as chaves.
4 - Populou-se o array iniciado no começo.
Pronto, acabou.
ArrayList getMatches(string pText)
{
ArrayList arrMatches = new ArrayList();
string stringToTest = pText;
const string patternToMatch = "}";
Regex regex = new Regex(patternToMatch, RegexOptions.Compiled);
MatchCollection matches = regex.Matches(stringToTest);
foreach (Match match in matches)
{
arrMatches.Add(match.Index);
}
return arrMatches;
}
O que este código faz
1 - Cria um array
2 - Utiliza um patter de busca "{". Serão procuradas todas as chaves do texto passado.
3 - Utilizou-se o regular expression para procurar as chaves.
4 - Populou-se o array iniciado no começo.
Pronto, acabou.
quinta-feira, 9 de maio de 2013
ITILv3 - Day 21
Continual Service Improvement: Role of Measurement
Measurements are the actual readings of a specific metric.
In CSI (as well as all processes), measurements are used for four reasons:
1 - Validate (actions already taken)
OK
2 - Direct (activity)
OK
3 - Justify (a course of action)
OK
4 - Intervene (when necessary)
The reasons why measurments are important are pretty obvious. No comments are necessary about day 21.
As I said in the beginning, ITIL is the science of the obvious.
domingo, 5 de maio de 2013
ITILV3 - Day 20
Continual Service Improvement (CSI);
Purpose
Continual Service Improvement vital questions to consider:
What do we need to measure?
Huummmm, maybe that is easy.
Why do we need to measure it?
Huuummm, without numbers any discussion is void.
Continual Service Improvement (CSI) Objectives:
1 - Improve service quality
Quality is not a very trivial thing to define.
2 - Improve process efficiency
Efficiency, well... if I define performance as a sign of efficiency, it would make sense.
3 - Improve cost effectiveness
Does it mean to save money, or somehting like that?
The CSI Register is a database (part of the SKMS) that records every improvement initiative.
Well, I found out something about SKMS and CMS. Bottomline, SKMS is God!
http://www.itskeptic.org/what-difference-between-cms-and-skms
The SKMS contains everything you can possibly imagine:
provide full lifecycle management from acquisition to disposal for a 'complete' inventory of CIs ST p65
...where those CIs include business cases, plans, managemkent, organisation, knowledge, people, processes, capital, systems, apps, information, infrastructure, facilities, people, service models, acceptance criteria, tangible and intangible assets, software, requirements and agreements, media, spares... ST p67-68
Contain the "experience of staff" ST p 147
contain data about "weather, user numbers and behaviour, organisation's performance figures" ST p 147
record supplier's and partners' requirements, abilities and expectations ST p 147
record user skill levels ST p 147
record and relate all RFCs, incidents, problems, known errors and releases ST p77
group, classify and define CIs ST p72
uniquely name and label all CIs ST p72
relate all these items with multiple types of relationships including compoentn breakdown structure, composition of a service, ownership, dependencies, release packaging, product makeup, supporting documentation... ST p72-73 including "part of", "connected to", "uses" and "installed on" ST p77
integrate data from document stores, file stores, CMDB, events and alerts, legacy systems, and enterprise applications, integrated via schema mapping, reconcilaition, synchronisation, ETL and/or mining ST fig4.39 p151
provide tools against this integrated data for query and analysis, reporting, forecasting, modelling and dashboards ST fig4.39 p151
take baselines and snapshots of all this dataST p77
perform verification and audit of all this data ST p81
be based on a Service Management information model ST p150
measure the use made of the data ST p151
evaluate usefulness of reports produced ST p151
whereas the CMS only contains NEARLY everything you can possibly imagine. The CMS contains ALL the information and related files for the following CI types (ST p67)
business case, service management plans, lifecycle plans, service design packages, release and change plans, test plans
management, organisation, processes, knowledge [???], people
financial capital, systems, applications, information, data, infrastructure and facilities, financial capital [again, must be important], people [again]
service model
service package [not to be confused with a service design package]
release package
service acceptance criteria
business strategy or other policies, regulatory or statutory requirements
tangible (datacentre) and intangible assets such as software
customer requirements and agreements,
releases from suppliers
external services
interface CIs [wtf they are]
sexta-feira, 3 de maio de 2013
Para desenvolver com o mínimo
Se você gosta de programar e já tem conhecimento profundo de C#, mas detesta IDEs que consomem toda a memória do computador, considere instalar a versão express.
Para quem faz aplicações sem interface, engines B2B e afins (que é o meu caso), a versão expressão é uma ótima alternativa.
Para quem faz aplicações sem interface, engines B2B e afins (que é o meu caso), a versão expressão é uma ótima alternativa.
Assinar:
Postagens (Atom)