Posts by Andre Figueiredo • 5,030 points
79 posts
-
3
votes1
answer750
viewsQ: How to update field in SQL table without blocking it?
I have a table with many records in production (almost 3 million), and I need to update a field with a very simple query: UPDATE tabela SET enviado = 1 WHERE enviado is null About 2.5 million will…
sqlasked Andre Figueiredo 5,030 -
54
votes2
answers29269
viewsQ: Why green = blue + yellow, but RGB yellow = green and red?
Why the color formation in the RGB does not follow the same pattern of nature, and yet it works? For example: In RGB, yellow = red and green: #FF0000 + #00FF00 = #FFFF00. But if we take a yellow…
-
8
votes1
answer3364
viewsQ: Validate decimal numbers in Javascript
What is the simplest and correct way to validate a Javascript decimal number? For example, how to implement a function IsNumeric that has the following test cases: IsNumeric('-1') true…
-
5
votes1
answer195
viewsA: Group by with Lillo
That’s how it works, but I’m not sure it’s the best way: var result = from a in mdc.SBE_AA_Aulas join av in mdc.SBE_AA_AvaliacaoAlunos on a.id equals av.SBE_AA_Aula_id group new {a, av} by…
-
4
votes1
answer50
viewsQ: Why is the default for an access modifier "protected" in . NET?
Unless I’m mistaken, the default when no class modifier is defined, for example, is assumed to be the protected: class LoremIpsum { ... } Is there any special reason for this? Which?…
.netasked Andre Figueiredo 5,030 -
63
votes3
answers24262
viewsQ: What is the difference between Ienumerable, Iqueryable and List?
What’s the difference between Ienumerable, Iqueryable and List no . NET? When it’s best to use one or the other? Why does Resharper suggest that I modify the return of that function, for example,…
-
5
votes2
answers338
viewsA: JSON performance to power an entire website
Since your site is pure HTML, I believe you don’t have much output. According to this link, a JSON with about 1000 paragraphs (~700KB) should use about: 15MB in the IE 35MB in Chrome 200MB in…
-
2
votes1
answer579
viewsA: How to read this text and separate the names of each person using Artificial Intelligence?
One of the solutions, step by step: Step 1: Barter ) e for , - last player of a position and positions as "Coach", "Striker", minus "Goalkeepers" (tale after): texto = texto.Replace(") e",…
-
3
votes2
answers7317
viewsA: How to create user with encryption password?
The easiest way is to add a library by Nuget (Manage Nuget Packages...). There are countless libraries for this. It’s better this way, because the algorithm should be much more tested, and by the…
-
2
votes1
answer570
viewsA: Format JSON wrong web api
The purpose of the webapi is that you return the strongly typed result and the API takes care of giving the parse to the JSON (or XML) format. The way you are doing is by returning a JSON from a…
-
20
votes4
answers6633
viewsQ: What is the difference between pre and post increment in Javascript?
The most common and known form of increment is the post: for (var i = 0; i < 10; i++){ console.log(i); } However, I then see the pre-decrease: for (var i = 0; i < 10; ++i){ console.log(i); }…
javascriptasked Andre Figueiredo 5,030 -
15
votes1
answer5340
viewsQ: Difference between high-order and first-class functions
In functional language, what is the difference between high-order functions (high-order functions) and first-class functions (first-class functins)? In Javascript, what would be the difference…
-
14
votes2
answers25606
viewsA: What kind of data (double, float or decimal) should I use to represent currency in . NET with C#?
The most appropriate is decimal, according to MSDN itself: Compared to floating point types, the decimal type has more precision and a short break, which makes it appropriate for financial and…
-
24
votes5
answers41630
viewsA: Mysql Limit Equivalent in SQL Server
As of SQL Server 2005, you can also use ROW_NUMBER: SELECT TOP (100) * FROM ( SELECT row_number() OVER (ORDER BY coluna1 ASC) AS row_number, * FROM Tabela ) TabelaNumerada WHERE row_number > 50…
-
3
votes1
answer369
viewsA: CSS several backgrounds
Here’s an example that works: http://jsfiddle.net/dke7L/ Remember to make the Ivs that come inside body transparent. Anything that comes in the body of the page will appear above the body…
-
2
votes5
answers2197
viewsA: How to create a switch.. case with value ranges?
There are several ways. Switch With switch That’s what comes to mind: int mes = (int)System.Math.Floor((decimal)dias / 30); switch(mes){ case 0: break; case 1: // faz uma coisa break; case 2: // faz…
-
2
votes1
answer1124
viewsA: Link to a div on another page does not work
What prevents being positioned correctly is the CSS property position: relative. Place the 2 elements as position: static, or without such a definition, because static is the standard.…
-
8
votes1
answer135
viewsQ: Why Math.round(-0.2) returns "-0" and not "0"
I had a problem with Javascript today that I will describe: I have a collection of values, for example: US 11.3123 Brazil -0.2291 UK 0.4501 I want to show the values without the decimal places,…
javascriptasked Andre Figueiredo 5,030 -
0
votes2
answers671
viewsA: Select with transition in change with onchange
The site mentioned as example use the following script (adapted): .find('.price-value').fadeOut('fast', function(){ $(this).html('R$ ' + price_discount_split[0] +',<sup class="sup">' +…
-
1
votes2
answers314
viewsA: Return a class in jQuery
Option 1: You can use the method itself serialize jQuery: $.ajax({ ... data: $('#form').serialize(), ... }); HTML <form id="form"> <input type="hidden" id="txtGeoTo" name="txtGeoTo" />…
-
11
votes5
answers6123
viewsA: Physical Exclusion vs Logical Exclusion
Generally, use the physical exclusion only when you know for sure that you will no longer need the record in the table. Use the logical exclusion when it may be possible that you: can need to…
sqlanswered Andre Figueiredo 5,030 -
2
votes2
answers387
viewsA: How to create a View for this Template case?
To post an array of elements to the Controller transparently, you must index the property name for each of the checkboxes. You must pass to the Controller each element, to have the ID and Checked…
-
5
votes4
answers4043
viewsA: Best practices in using BD connections via Entity Framework
Usually the DataContext is instantiated in each object (a CRUD of Users for example, therefore Class Users). It is not good practice to use it as Singleton or static [ref 1], (sigleton != Static).…
-
5
votes3
answers4097
viewsA: How to randomly color Divs with a Javascript Color Array?
You can use Math.() var arrCores = ['#f00', '#0f0', '#0ff']; setInterval(function(){ document.getElementById('divRandom').style.backgroundColor = arrCores[Math.round(Math.random()*(arrCoresSize-1))]…
-
2
votes2
answers256
viewsQ: Number of variable parameters in C#
I know you can do this. But I can’t find how. How do I make a function accept a variable number of parameters of the same type, similar as an array? So I can just call it that:…
-
4
votes5
answers2480
viewsA: Check if day exists in month
A simple Datetime.Tryparse or Datetime.Parse whether the date proposed in string is a valid date already taking into account the different days of each leap month and years: public bool…
-
1
votes1
answer1601
viewsA: Pass parameters in a VB6 application
The syntax error is on this line: objFuncao.Consultar(ByVal cnpj As String) The correct would simply be: objFuncao.Consultar(cnpj) This format is used in the function signature: ByVal [nome…
-
0
votes4
answers1519
viewsA: How to change the appearance of the site according to the device used, without having to script on the client or server?
A start would be: Use properties max-height, 'max-width', overflow: hidden, etc.. Use media query in the same css used for larger devices: @media screen and (max-width: 1024px){ img.bg { left: 50%;…
-
6
votes9
answers2644
viewsA: Best practice for creating if
The question is pertinent yes if the code block in if contains high computational complexity, written in the database or in files, etc.. The ideal between the two would be the (A). Why…