mardi 22 septembre 2009

Left Join, Right Join Using LINQ

How we can handle a trouble when passing a left or Right join within the context of Linq?

var LeftJoin = from t1 in Table1
join t2 in table2
on t1.ID equals t2.ID into JoinedT
from T2 in JoinedT .DefaultIfEmpty()
select new
T1 = T1.Name,
T2 = description

to make the same to Right join just invert the side of the Join

vendredi 18 septembre 2009

cracking a router

Originally Posted by thorin View Post
What are you hoping to learn/prove from doing this? Do you really think all those dictionaries exist online because they don't work? Do you somehow not believe that password policies exist for a reason?

Just crunch the numbers. The dictionary to store all 9 character passwords with all printable characters in is basically impossible to store:
or would take too long to compute on the fly. So unless you have the solution to free & clean energy and aren't sharing AND the CIA/NSA etc know you're hiding it, you have nothing to worry about, apply standard password policies and save yourself a lot of wasted time.

The end goal here is: A friend of mine has invited me to see how secure his WEP network is, with a dictionary-word-based router password.

I just think it's a waste of time to begin with alphanumeric plus symbols when many networks will merely use lower-case alphabetic passwords.

Certainly it's faster to go through dictionary words and then try them with numerical suffixes, versus a brute-force.

jeudi 17 septembre 2009

triggers with a computed column insertion

I had the problem of inserting a row from a table to another because of a computed column cannot have a explicit value on a insert statement. Then I realize i had to take off the name of the column (computed column) in order to insert the row. I make sense , but since I'm pretty scat this things could happen.

the error was resolved with the following trigger code:

CREATE TRIGGER insertanotaVario

on NotaIngreso

select (idnota,notadescripcion, curso1, curso2, curso3)

// Note: do not add the field that is the average calculated from the column(computed column).

mardi 8 septembre 2009

Decimal vs Float (Single) or Double

When you need to deal with a number that is a fraction, what do you specify for its type? If you are like most programmers I know, you’ll reach for Float (Single if you are using VB) or Double.

If you are working with currency, though, this could get you into a lot of trouble.

Here’s why.

When you store a number into a float, you are not storing an exact number. This is because the number you are storing is an approximation of the number you entered. When you store a number, the integer portion of the number gets priority and the fractional part gets entered as close as is possible given the size of the type you are storing it as.

That is, a Double will be able to save the information more accurately than the Float, but neither of them will store the information precisely.

And that’s just storing a number we enter directly. What happens if we need to multiply or divide that number?

For simplicity, let’s just say we need to divide a dollar by three. How would that get stored accurately into a float or a double? The answer is that it won’t. It will store as many threes on the right side of the decimal as possible.

This is what the Decimal data type was created for. A decimal data type deals with the data more like we would if we were dealing with the problem with paper and pencil. In effect, a decimal data type is similar to an integer that has a decimal point.

taked from :

lundi 7 septembre 2009

Posteando en StackOverflow

Esta era mi pregunta

I want to convert my float field into a decimal field; I want a precision of 11,2 in my decimal field, but when I tried to change the type of my field(example: Amount) I get an error: "Arithmetic overflow error converting float to data type numeric. The statement has been terminated." My field is decimal(11,2) at the table, and my max and min values are: 1,603,837,393.70 < -- > -1,688,000,000.00(amount).
select Id,AccountId, cast(Amount as decimal(12,2)) as Amount,
(AmountB as decimal(12,2)) as AmountB
FROM myTable

Esta fue la respuesta.

But a value of "1,603,837,393.70" would require decimal(12,2) - 12 digits in all, 2 after the decimal point.

Maybe you misinterpreted the way the decimal(11,2) works? This would mean total of 11 digits - 9 to the left, 2 to the right of the decimal point.

See the MSDN docs for decimal and numeric types:

decimal[ (p[ , s] )] and numeric[ (p[, s] )]

p (precision)

The maximum total number of decimal digits that can be stored, both to the left and to the right of the decimal point.

vendredi 4 septembre 2009

con un poco de paciencia....

hoy me encontre esta imagen , que tome antes de salir de ICASA.... ah como pasa el tiempo.

Brayan Recinos Corado
Ingenieria de Software
Unidad de Servicios Compartidos
( (+502) 66209720 Ext. 113176

¡Cuenta con Nosotros, nuestra pasión es servirte cada día mejor!

traduciendo de vb for aplications a t-sql (ver. 1)

el query de la macro sin el valor de cadena que nos enviand en el texto.

qry = " SELECT GLProcessEntry.ProcessEntryId, GLAccount.MethodId, GLAccount.AccountId, GLAccount.OffSetAccountId,GLProcessEntryDetail.CcyAmount, "
qry = qry & " GLProcessEntryDetail.CADAmount, PeriodCcyRate.Quote, Round([CCyAmount]*[Quote]-[CADAmount],2) AS EntryAmount "
qry = qry & " FROM CfgCieMethodQuoteStatus,GLAccount,GLProcessEntry,GLProcessEntryDetail,PeriodCcyRate "
qry = qry & " WHERE GLProcessEntry.ProcessEntryId = GLProcessEntryDetail.ProcessEntryId "
qry = qry & " AND GLAccount.CieId = GLProcessEntry.CieId "
qry = qry & " AND GLAccount.AccountId = GLProcessEntryDetail.AccountId "
qry = qry & " AND GLAccount.CCy = PeriodCcyRate.Ccy "
qry = qry & " AND GLProcessEntry.PeriodId = PeriodCcyRate.PeriodId "
qry = qry & " AND CfgCieMethodQuoteStatus.QuoteStatusId = PeriodCcyRate.QuoteStatusId "
qry = qry & " AND CfgCieMethodQuoteStatus.MethodId = GLAccount.MethodId "
qry = qry & " AND CfgCieMethodQuoteStatus.CieId = GLAccount.CieId "
qry = qry & " AND GLProcessEntry.ProcessEntryId=" & ProcessEntryId
qry = qry & " AND GLAccount.MethodId=" & MethodId
If MethodId = 1 Then
qry = qry & " AND GLPRocessEntryDetail.AmountTypeId = 0 "
qry = qry & " AND ((Round([CCyAmount]*[Quote]-[CADAmount],2))<>0)"

qry = qry & " AND GLPRocessEntryDetail.AmountTypeId = 1 "
qry = qry & " AND ((Round([CCyAmount]*[Quote]-[CADAmount],2))<>0)"
End If

la traduccion al t- sql

SELECT GLProcessEntry.ProcessEntryId, GLAccount.MethodId, GLAccount.AccountId, GLAccount.OffSetAccountId,GLProcessEntryDetail.CcyAmount,
GLProcessEntryDetail.CADAmount, PeriodCcyRate.Quote, Round([CCyAmount]*[Quote]-[CADAmount],2) AS EntryAmount
FROM CfgCieMethodQuoteStatus
INNER JOIN PeriodCcyRate on CfgCieMethodQuoteStatus.QuoteStatusId = PeriodCcyRate.QuoteStatusId
INNER JOIN GLAccount ON CfgCieMethodQuoteStatus.MethodId =GLAccount.MethodId
INNER JOIN GLProcessEntryDetail ON GLAccount.AccountId=GLProcessEntryDetail.AccountId
INNER JOIN RefCompany ON RefCompany.CieId = CfgCieMethodQuoteStatus.CieId
INNER JOIN RefDivision ON GLAccount.DivisionId = RefDivision.DivisionId
INNER JOIN GLProcessEntry ON GLProcessEntry.PeriodId = PeriodCcyRate.PeriodId
AND GLProcessEntry.ProcessEntryId = GLProcessEntryDetail.ProcessEntryId
WHERE GLPRocessEntryDetail.AmountTypeId = 0
and GLProcessEntry.ProcessEntryId = 169
AND GLAccount.MethodId = 1
and GLProcessEntryDetail.CADAmount = 0

jeudi 3 septembre 2009

metodo filtrado para Combos

habia un llenado de combos muy malo que tenia y mi companiero Christian me limpio el codigo. Me gusto como lo hizo......jajajajajaj

private void FillComboboxes()
var db = new RevaluationDataContext();
var periods = db.CfgPeriods.OrderByDescending(p=> p.EndDate)
.Select(p => new { p.PeriodId, Name = p.Name + " " + p.PeriodYear });

-- tirando la expresion para el ultimo periodo .

var latestPeriodId = db.GLProcessEntries.OrderByDescending(p => p.ProcessEntryId).First().PeriodId;

y llenando el combo.
PeriodRadComboBox.DataSource = periods;
PeriodRadComboBox.DataValueField = "PeriodId";
PeriodRadComboBox.DataTextField = "Name";
PeriodRadComboBox.SelectedValue = latestPeriodId.ToString();
// fill Version radcombobox
var periodId = int.Parse(PeriodRadComboBox.SelectedValue);
var version = db.GLProcessEntries.Where(pde => pde.PeriodId == periodId)
.Select(pde => new {pde.VersionId})


aqui ya le damos el databind y todo lo demas para el combo.


mercredi 2 septembre 2009

Filtering and Negating

var db = new RevaluationDataContext();
var query = from rcm in db.RefConversionMethods
where !rcm.MethodName.Contains("Rien")
select new
e.Result = query;

filtrando atraves de una negacion.

Are Aussies the most racist people in the world?

Ocker trash Dee wrote:
No the Aussies as you call them are simple pure trash of the British Isles mostly and have a world class low-life inferiority complex. They are just ignorant racist inbred pretenders and Americunt wanna-bes. Most people can't understand their anal horrible sounding strine accent anyway so who cares. A few million gutter white trash at the bottom of the planet downunder on stolen Aboriginal land really don't count for much. Just a pathetic penal colony of arse-kissers as as ex-Singaporean PM Lee Kwan Yue called them "WHITE TRASH OF ASIA".
Now do plan on attending the "one nation" klan bake at Bondi eh..LOL


Notice how a lot of people voted the Muslims to be the most racists and while a some radical Muslims f*cktards did a few "lulz terrorizing", the everyone just automatically generalize whole Muslims as such.

No, no, I'm not arguing or against some of the people beliefs towards Muslims. In fact, it gave me an awesome opportunity to troll the heck out of these people. I just hope more new people came in and feel butthurt as I'm about to unleash. So, ta-ta, terrorizing, away!


would say non-whites are the most racist. Their countries ain't even multiCULTural or multiracial. Well, apart from South Africa, but white people are murdered there every single day!
When i travel in the city, African and Paki refugees always refer to me as "white boy" or some other term which relates to my race. Even when on holiday abroad to other parts of Europe, i've always had a bad experience with people of colour.

So yes, from my own personael experience, blacks and Arabs tend to be the most racist, especially towards whites!

mardi 1 septembre 2009

blofeando o realidad sobre linq

encontre esto sobre linq quien sabe si sera verdad??

n a typical management speak post, the ADO.Net team has killed the Linq to SQL project. I think this is a mistake from Microsoft part. Regardless of how this affects NHibernate (more users to us, yeah!), I think that this is a big mistake

Doing something like this is spitting in the face of everyone who investment time and money in the Linq to SQL framework, only to be left hanging in the wind, with a dead end software and a costly porting process if they ever want to see new features. Linq to SQL is a decent base level OR/M, and I had had several people tell me that they are willing to accept its current deficiencies, knowing that this will be fixed in the next version. Now, there isn't going to be a next version, and that is really bad for Microsoft reputation.

group by linq y sum(aggregate function)

Aqui un par de ejemplitos con group y sum

var pcs = from a in db.Addresses
group a by a.PostalCode into g
select new {
PostalCode = g.Key,
Orders = (int?)g.Sum(addr => addr.SalesOrderHeaders_ShipTo.Count) ?? 0,
OrderValue = (decimal?)g.Sum(addr => addr.SalesOrderHeaders_ShipTo.Sum(o => o.SubTotal + o.Freight)) ?? 0m


var processInfoByThreadCount =
from process in Process.GetProcesses()
group process by process.Threads.Count into g
orderby g.Key descending
select new { ThreadCount = g.Key,
ProcessCount = g.Count(),
ThreadSum = g.Sum( p => p.Threads.Count )

-- tomado de --------