Tuesday, December 8, 2009
the query did it
Monday, December 7, 2009
few sql tips
Thursday, December 3, 2009
javascript quick short ones
if (btn) btn.click();
Tuesday, December 1, 2009
Xtreme Programming
Ground rules:
- small team (2 to 12)
- continuous access to customers
- OO design and code (Smalltalk, Java)
- change management system (code and tests)
- the system is always “working” (growing functionality over time)
- overall development cycle – between 4 and 12 months
- new release to customer every 2-3 months
- internal iterations every two weeks
- not for life-critical systems (heart monitor, nuclear power plant, avionics systems, etc.)
Some Rules of Extreme Programming
Planning rules- do project planning via “user stories”
- plan a series of very small internal releases
- start each day with a “stand-up meeting”
- keep the design simple (use the simplest thing that could work)
- refactor as needed
- talk with the customer throughout the coding process
- always code in pairs
- code unit tests first
- follow coding standards
- unit tests for all code
- acceptance tests for each user story
Information on XP
Books:- Extreme Programming Explained (Kent Beck)
- Planning Extreme Programming (Beck and Fowler)
- Questioning Extreme Programming (McBreen)
A day in the life of an XP developer
First thing in the morning: developer attends a stand-up meeting with the rest of the team (10-15 min)- developer chooses a task (part of a user story); chooses a development partner for the day
- write new unit tests, check them into the change management system
- write new code, check it in
- fix things that need to be changed in existing code; rerun the unit tests
- run the new unit tests; run the acceptance tests for the user story
Planning an XP project
User Stories- Capture requirements “in the users’ words”
- Small, discrete, testable
- Include scenarios
- May include business interactions outside system
- Users own stories
- Developers set and own estimates
- Users set priorities – “business value”
- Joint goal: group stories into iterations
- Business value
- “Worst first”
Planning an XP project
- Interview the customer; write user stories on index cards
- Developers give development estimates for each story
- estimates in “ideal person-days”
- estimates based on experience with similar problems
- If a story is too big, split it into smaller stories
- Create a release plan – list the stories in each release
- highest priority or “risky” items early
- Track execution of the plan
- Post the user stories on a bulletin board (in time order)
- Check off each user story after the code is complete and the acceptance tests have passed
Examples of User Stories
see http://www.c2.com/cgi/wiki?UserStoryExamplesPair Programming
One important practice in XP: all code is reviewed as it is written- how does pair programming work?
- two developers, one workstation
- one person is the driver, the other is the navigator
- the navigator suggests design alternatives, checks for conformance to coding standards, prevents driver from writing unreadable code
- pair assignments usually change every day
- reduces the need for elaborate design documentation
- pair programming actually improves productivity
Agile characteristics
Most of the agile processes are “controlled chaos”:- short development iterations, with product “shipped” to either a customer or a pseudo-customer at regular intervals
- continuous testing – such as daily regression tests
- collecting customer requirements using scenarios or use cases
- small team sizes
- informal modeling techniques – CRC cards, simple drawings on whiteboards
- adaptive planning techniques – plans are updated based on intermediate results and reprioritization by the customers
Agile versus XP
Most agile process are less radical than XP:- don’t require pair programming
- multiple roles, not just “general-purpose developer”
- various methods of iteration planning
- existing heavyweight processes can be adapted to be more “agile”
Which agile process?
Scrum- Scrum is a very general iteration management process, which can be used in conjunction with any methodology
- development activities are in 30-day “sprints”
- OOPSLA experience report on “agile” version of Rational Unified Process
- oopsla.acm.org/extra/pracreports/MakingRUPAgile-Report.pdf
- much lighter than XP, but the team must define their own “required project documentation”
- see Agile Modeling by Scott Ambler for ideas
- good for a team of 4 to 6 people
Books on Agile Processes
- Crystal Clear: Writing Effective Use Cases (Cockburn)
- Scrum: Agile Software Development With Scrum (Schwaber and Beedle)
- Adaptive Software Development: Adaptive Software Development (Highsmith)
- DSDM: DSDM, Dynamic Systems Development Method: The Method in Practice (Stapleton)
- Lean Development: Lean Development: A Toolkit for Software Development Managers (Poppendieck)
- full text at http://www.poppendieck.com/ld.htm
Monday, November 30, 2009
how-do-i-know-if-have-rsi-or-carpal-tunnel
Wednesday, November 25, 2009
here they are Semantics.
Thursday, November 19, 2009
IIS over Home Basic Windows Vista
Depending on which version of Vista you have, install ASP or upgrade to a version which supports IIS.
- Windows Vista Home Premium Edition
- Windows Vista Professional Edition
- Windows Vista Ultimate Edition
Wednesday, November 18, 2009
Adding a value with Insert instead of Add method
Tuesday, November 17, 2009
formating a datetimepicker
private void picker_Loaded(object sender, RoutedEventArgs e)// the datapicker's load event.
{
this.picker.Text = DateTime.Now.ToString("dd-MMM-yyyy");
}
private void picker_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
{
this.picker.Text = this.picker.SelectedDate.Value.ToString("dd-MMM-yyyy");
}
a quit of a short example
var valueDate = valueDatePicker.SelectedDate.Value.ToString("s");
returns the set with the ISO format (yyyy-mm-dd)
Friday, November 13, 2009
list of Code answers by Scott Hanselman's
Everyone who writes code
- Describe the difference between a Thread and a Process?
- What is a Windows Service and how does its lifecycle differ from a "standard" EXE?
- What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memory for the system? How would this affect a system design?
- What is the difference between an EXE and a DLL?
- What is strong-typing versus weak-typing? Which is preferred? Why?
- Corillian's product is a "Component Container." Name at least 3 component containers that ship now with the Windows Server Family.
- What is a PID? How is it useful when troubleshooting a system?
- How many processes can listen on a single TCP/IP port?
- What is the GAC? What problem does it solve?
Senior Developers/Architects
- What’s wrong with a line like this? DateTime.Parse(myString);
- What are PDBs? Where must they be located for debugging to work?
- What is cyclomatic complexity and why is it important?
- Write a standard lock() plus “double check” to create a critical section around a variable access.
- What is FullTrust? Do GAC’ed assemblies have FullTrust?
- What benefit does your code receive if you decorate it with attributes demanding specific Security permissions?
- What does this do? gacutil /l | find /i "Corillian"
- What does this do? sn -t foo.dll
- What ports must be open for DCOM over a firewall? What is the purpose of Port 135?
- Contrast OOP and SOA. What are tenets of each?
- How does the XmlSerializer work? What ACL permissions does a process using it require?
- Why is catch(Exception) almost always a bad idea?
- What is the difference between Debug.Write and Trace.Write? When should each be used?
- What is the difference between a Debug and Release build? Is there a significant speed difference? Why or why not?
- Does JITting occur per-assembly or per-method? How does this affect the working set?
- Contrast the use of an abstract base class against an interface?
- What is the difference between a.Equals(b) and a == b?
- In the context of a comparison, what is object identity versus object equivalence?
- How would one do a deep copy in .NET?
- Explain current thinking around IClonable.
- What is boxing?
- Is string a value type or a reference type?
- What is the significance of the "PropertySpecified" pattern used by the XmlSerializer? What problem does it attempt to solve?
- Why are out parameters a bad idea in .NET? Are they?
- Can attributes be placed on specific parameters to a method? Why is this useful?
Thursday, November 12, 2009
ItemDataBound, ItemCommand
ItemCommand will be fired when the control in datagrid is operated.
Wednesday, November 11, 2009
getting done things
Tuesday, November 10, 2009
Die Mauer ist gefallen
Saturday, November 7, 2009
Controls and differente stuff
Hide SideBar of Wizard Control
<asp:Wizard DisplaySideBar="false" >
applying validation group to previous and next button in a wizard control
Friday, November 6, 2009
about how to calculate a checkin -checkout at nights
the solution to the date is like these in the case we just care for the entrance.
Thursday, November 5, 2009
Changes with a list
foreach(ListItem itemlist in MyListBox.Items)
{
db.MyEntities.InsertOnSubmit(new MyEntity()
{
Id = variableId,
name = itemlist.Value
});
}
with a child:
foreach (ListItem col in SListBox.Items)
{
newentityMaster.Childentity.Add(new Childentity {
FilterId = newfilter.id,
ColumnName = col.Value,
});
}
getting my changes performed (DML, insert, delete, updates).
db.GetChangeSet().Inserts
Visual Studio ShortCuts
Here are some helpful keyboard shortcut keys for Visual Studio 2008. You probably know most, but some you won't know. For instance, did you know that Ctrl+. is the same as Sift+Alt+F10?
Note: Some of the shortcuts won't work in all environment configurations (web, C#, etc).
To use, hold down the control key and hit the key combination. Works on the whole document, a specific line, or a selection of code.
Update References/ Add Using Statement (Ctrl +. or Shift +Alt +F10)
I'm referring to the underline that appears under a variable to perform an action like add a using statement, or refacter a method or class name. Not sure what it's called but I use it all the time. Ex:ClassName
List Members (Ctrl +J or Ctrl +K, L)
Displays the autocomplete list for classes, methods, or properties.
List Parameter Info (Ctrl +Shift +Space or Ctrl +K +P)
Lists the parameters for a method. Use this shortcut when your cursor is inside the parenthesis of a method.
Auto Format (Ctrl +K, D or Ctrl +E, D)
Formats C#, VB, ASPX, Javascript, CSS, XML, XSL, and HTML code according to generally accepted formatting standards for the respective programming language. Makes code look nice and neat.
Quick Watch (Ctrl +Alt +Q)
Highlight some code and hit these shortcut keys to display the Quick Watch dialog.
Comment / Uncomment (Ctrl +K, C / Ctrl +K, U)
Comments or uncomments a block of code. Works with C#, VB, ASPX.
Code Bookmarks
Use these to bookmark a line of code. You can cycle through the bookmarks across any file within a project. Bookmarks come in very handy, try it out.
Set/Unset Bookmark (Ctrl +K, K)
Next Bookmark (Ctrl +K, N)
Surround With (Ctrl +S)
Surrounds a block of code with a code snippet.
Build & Debug Shortcuts
Set/Unset Breakpoint (F9)
Build (F6 or Ctrl +Shift +B)
Start Debugging (F5)
Start Without Debugging (Ctrl +F5)
Stop Debugging (Shift +F5)
Continue (F5)
Step Over (F10)
Step Into (F11)
Step Out (Shift +F11)
Wednesday, November 4, 2009
error on Membership.GetAllUser();
listbox.DataSource = Membership.GetAllUsers();
so here's the code snippet used to solve the fact
Monday, November 2, 2009
order by in LINQ (basic example)
var firstFilter = db.Filters.OrderByDescending(f => f.id).FirstOrDefault();
Monday, October 26, 2009
Creating an insertion from a Table with Select
Thursday, October 15, 2009
droping all connections with sql server
USE master
go
DECLARE @dbname sysname
SET @dbname = 'name of database you want to drop connections from'
DECLARE @spid int
SELECT @spid = min(spid) from master.dbo.sysprocesses where dbid = db_id(@dbname)
WHILE @spid IS NOT NULL
BEGIN
EXECUTE ('KILL ' + @spid)
SELECT @spid = min(spid) from master.dbo.sysprocesses where dbid = db_id(@dbname) AND spid > @spid
END
If you want to drop all the connections to a database immediately
USE master
GO
ALTER DATABASE database name
SET OFFLINE WITH ROLLBACK IMMEDIATE
ALTER DATABASE database name
SET ONLINE
or if you are in a hurry there is an option that says"drop all database connections" as a checkbox in the window displayed for the detach task and you just check it and does close the connections.
Tuesday, October 13, 2009
NO JOINS IN ORACLE
This is what it says in Oracle site. So that's the end point of it. Here are the examples
Using Join Queries: Examples The following examples show various ways of joining tables in a query. In the first example, an equijoin returns the name and job of each employee and the number and name of the department in which the employee works:
SELECT last_name, job_id, departments.department_id, department_name
FROM employees, departments
WHERE employees.department_id = departments.department_id
ORDER BY last_name;
Using Self Joins: Example The following query uses a self join to return the name of each employee along with the name of the employee's manager. A WHERE
clause is added to shorten the output.
SELECT e1.last_name||' works for '||e2.last_name
"Employees and Their Managers"
FROM employees e1, employees e2
WHERE e1.manager_id = e2.employee_id
AND e1.last_name LIKE 'R%';
for more info go to : http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_10002.htm#i2066611
Examples taked from the site.
System Provider
If you are using asp.net 1.1 then go to your machine.config file and in process model section try to chnage user name as "system";
if you are in 2.0 version do the same thing some times you might not find the process model section at all then try add the same section it self.
you can find out the machine.config file in the following location:for 2.0 version i think u are using 2.0
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG
System. Debug
Oracle 10g with C# & asp.net
Tools to be used for the test.
- Oracle 10g Express.
- Visual Studio.Net
Thursday, October 8, 2009
Response to Grid backcolor in Row With Ajax
on a different way:
|
on the server side:
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
var radAjaxManager = RadAjaxManager.GetCurrent(Page);
radAjaxManager.ClientEvents.OnResponseEnd = "gridRowColor";
}
Friday, October 2, 2009
Anthroposophy
Taked from wikipedia.
Thursday, October 1, 2009
Linq with Outer Join, Ternary and orderby with linq
join rc in db.RefCycles on lfp.CycleId equals rc.CycleId
into JoinedRc
from rc in JoinedRc.DefaultIfEmpty()
join rf in db.RefFrequencies on lfp.Frequency equals rf.FrequencyId
orderby lfp.LogFundingId descending
select new
{
lfp.LogFundingId,
lfp.LogActionId,
lfp.FundingId,
lfp.FundingCode,
lfp.InstrumentCode,
LogActionDescription = lfp.RefLogAction.Description,
lfp.ApplicableDate,
lfp.Description,
rf.Frequency,
lfp.RollOverDay,
CycleDesc = lfp.CycleId != null ? rc.CycleDesc : "",
lfp.CCY,
lfp.CycleId,
lfp.IsConfirmed,
lfp.LastUser,
lfp.LastModified
};
as you can see the CycleDesc comes with a empty string if the CycleId doesn't bring a value since can be null.
Tuesday, September 22, 2009
Left Join, Right Join Using 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
Friday, September 18, 2009
cracking a router
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.
http://forums.remote-exploit.org/newbie-area/18312-best-method-crack-router-password.html
Thursday, September 17, 2009
triggers with a computed column insertion
the error was resolved with the following trigger code:
CREATE TRIGGER insertanotaVario
on NotaIngreso
SET IDENTITY_INSERT Nota ON
select (idnota,notadescripcion, curso1, curso2, curso3)
FROM INSERTED
SET IDENTITY_INSERT Nota OFF
// Note: do not add the field that is the average calculated from the column(computed column).
Tuesday, September 8, 2009
Decimal vs Float (Single) 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 : http://blog.dmbcllc.com/2008/10/14/decimal-vs-float-single-or-double/
Monday, September 7, 2009
Posteando en StackOverflow
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,
cast(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.
Friday, September 4, 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
* brayanrecinos@icasa.com.gt
traduciendo de vb for aplications a t-sql (ver. 1)
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)"
Else
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