Posts by Miguel Angelo • 28,526 points
429 posts
-
25
votes2
answers883
viewsA: Is there a null coalescence operator in javascript? Just like the C#? operator
Behaviour similar to that of the operator ?? of C# no javascript, using the or logical: ||. There are however some differences, and for this we have to understand what the operator || of javascript…
javascriptanswered Miguel Angelo 28,526 -
32
votes7
answers78990
viewsA: How does this if/Else work with "?" and ":"?
Javascript Conditionals Overview Javascript is a really interesting language in this regard. In addition to language structures for flow control if/else, switch and others, and also the ternary…
-
2
votes3
answers1421
viewsA: How to call a function in javascript through a text box?
All objects defined via direct code at the root of the scope will stop at the object window, and so you can do so: window["nome do método"](); So will call the function you want by name.…
javascriptanswered Miguel Angelo 28,526 -
2
votes3
answers2054
viewsA: Protect the connection string in a . NET Winforms application?
According to this article in English, the SQL Server connection component will already encrypt the important parts of the connection string during connection, such as password and username... unless…
-
6
votes2
answers256
viewsA: Number of variable parameters in C#
Use the keyword params, which allows you to indicate that an array argument will receive a list of parameters without having to pass an array explicitly. public void MeuMetodo(params object[]…
-
-1
votes3
answers918
viewsA: Alternative to check if the window is a popup
Direct from the MDN: window.opener Use: var parentWindow = window.opener; Check if the property window.opener is null, if it is, it is because it was not opened by another window, if it is not null,…
-
3
votes4
answers298
viewsA: How to implement an Objectset wrapper that works with Linqtoentities?
Possibly you will need to implement the interface IObjectSet<TEntity> so that the Entity-framework can know how to work with this object, otherwise Entity will interpret this object as being…
-
3
votes4
answers1175
viewsA: Function to expand list
Put a class in all dictionary elements: <div class="dic-item" id="A">...</div> <div class="dic-item" id="B">...</div> <div class="dic-item" id="C">...</div> ...…
-
4
votes2
answers12377
viewsA: Decoder for Open Source CAPTCHA
Captcha breaking routines are usually made for a specific captcha. Usually you should treat the image before trying to read it with an OCR, trying to make the letters black on a white background.…
-
1
votes4
answers7116
viewsA: How to hide the time of a "Datetime?" field in the user interface?
As you are manually displaying the date by doing Tostring(), you just specify a formatter: item.DataInicial.ToString("dd/MM/yyyy") MSDN documentation on the Tostring(string method)…
-
1
votes2
answers599
viewsA: How to update backgroundWorker.Reportprogress() through a class in another project?
The strategy I would use would be to pass a delegate who serves to notify progress, who will be called by the other thread whenever there is progress, and then within that delegate, would update the…
-
1
votes6
answers5869
viewsA: How to know the number of a week in each month
I just built the method you want to generate dates, given the week of the month and the weekday: /// <summary> /// Gera uma data, dados ano, mês, semana do mês e dia da semana. /// A semana do…
-
1
votes3
answers3924
viewsA: How to know the week of a given month?
Solving your problem in the simplest way: one is iterating directly on dates. Stay like this: var date = new DateTime(2014, 2, 4); var intervaloSemanas = 2; var diasDaSemana = new DayOfWeek[] {…
-
10
votes4
answers2252
viewsA: What is the advantage of hiding the class constructor in favor of a static method (no .NET)?
There are two standards (which I remember now) that benefit from builders that are not public: Factory Singleton Neither of these two patterns benefits from a static construction method... Singleton…
-
4
votes1
answer1363
viewsA: Is there a way in ASP.Net MVC, in the controller to access a variable in sessionstorage or localstorage?
You can use the Signaler, which is a project developed by Microsoft so that the server can communicate with the browser, and send information to it, and then back to the server. It is possible to…
-
2
votes2
answers147
viewsA: Is there in the framework . Net, any delayed reading class?
As it was said that the class Lazy<T> is available in versions only from . Net 4, here is an implementation for anyone who needs something similar, which is the one I was using earlier, and…
-
5
votes2
answers147
viewsQ: Is there in the framework . Net, any delayed reading class?
I wonder if in . Net there is some class that allows me to tell her how to read a data, but that DO NOT read immediately... only later when requested, this class reads and stores the value, in case…
-
0
votes4
answers491
viewsA: How to get the name of the property to which a lambda expression refers?
Well, just to summarize the answers already given, and based on them, I created two auxiliary methods to help in this task when necessary, depending on the lambda format used: public String…
-
4
votes4
answers491
viewsQ: How to get the name of the property to which a lambda expression refers?
I have a lambda expression being translated into an expression tree (Expression Tree) as follows: Expression<Func<object>> expr = () => x.NomeDaPropriedade; How do I get the name of…
-
2
votes3
answers10204
viewsA: How to put a value that is saved in the database in a combobox?
Next, if you click on the list of Items, objects of type A, can only be used in the property SelectedItem objects that compare with this type. The following example does not work because of this:…
-
1
votes1
answer218
viewsA: How to change settings for a Binding Source?
C# projects typically store connection strings within a file .config present at the root of the application. Usually, it is only a matter of placing a connection string that references an external…
-
4
votes2
answers2443
viewsQ: T-SQL with case sensitive like
Is it possible to make a query in SQL Server 2008 with sensitive like? Actually, I’m looking in a column with a list of acronyms, which represent system flags, which differentiate uppercase and…
-
27
votes5
answers6588
viewsA: Should error messages apologize?
There are two very different cases in my view: Exceptions for the developer Error messages for end user Text of Exceptions I think an exception should always be as explanatory as possible, in order…
-
6
votes4
answers1904
viewsQ: How to control when localstorage data expires?
I’m storing some data on localstorage browser and would like to set an expiration date for that data, but I do not find a way to control when these data expire. These data have some control over…
-
5
votes3
answers2321
viewsA: Increment version automatically, and get version number via code
For add-on only, you can also edit the attribute AssemblyVersion by the project configuration dialog box, in the project properties... the shortcut is usually ALT + ENTER, and then click on Assembly…
-
9
votes3
answers2321
viewsQ: Increment version automatically, and get version number via code
In the software in which I am working there are users, whose doubts should be met by observing the version number of the software. Something like 10.0.1.1000 configured in project properties. I…
-
48
votes7
answers20675
viewsA: What are lambda Expressions? And what’s the point of using them?
What are lambda expressions? Lambda expressions are those of type A going to B, meaning primarily a transformation. In C#, there are constant, and multiparametrized Lambdas. In C#, a lambda…
-
17
votes7
answers9251
viewsA: In C#, what is the await keyword for?
What does await mean The keyword await serves to make asynchronous calls, so that if the method being called is slow, all that comes after the call using await is suspended, waiting to be executed…
-
8
votes6
answers8101
viewsQ: How to take the current date and add "n" minutes in this value?
I can get the current date simply with new Date(), but how do I add an amount of minutes to this value? If there is a way to add milliseconds, it may also be.