Quantcast
Channel: User David Silva-Barrera - Stack Overflow
Browsing latest articles
Browse All 37 View Live

Comment by David Silva-Barrera on Best way to store multiple enums in database

I don't see it as Magic Number, you are storing the unique int identifier of the enum value in the database, if this is wrong then so is storing the primary key of a table in another table as foreign...

View Article



Comment by David Silva-Barrera on Best way to store multiple enums in database

Dear JDB, please read the question again. Notice he is specific about using the Enum. He wants to use a simple Column to store the values, he knows he have multiple values (he mentioned comma possible...

View Article

Comment by David Silva-Barrera on Will someone please explain RESULT_FIRST_USER

Please Andrew, use @KatedralPillon comment to complete your answer, because the question points to the autor knowing what you just said but the real part is missing. With KatedralPillon's comment the...

View Article

Comment by David Silva-Barrera on The cast to value type 'Double' failed...

There are no 2 queries but only one. The Where method does not actually make a query but prepares one and the call to Any makes the real db-query. Any way I prefer the @Jitendra Pancholi solution,...

View Article

Comment by David Silva-Barrera on Need an ASP.NET MVC long running process...

I made it work, but it waits for return result; in SomeTaskAsync before it makes all the calls to SomeTaskProgress. I can see the flow only by using with breakpoints, cause in the Browser all changes...

View Article


Comment by David Silva-Barrera on How to get the clicked ListView cell in...

Possible duplicate of Handle click on a sub-item of ListView

View Article

Comment by David Silva-Barrera on How to pass data using submit() in javascript?

The idea was right, but the code didn't work. The way for modifying the value was the problem. It worked for me (with jQuery): $('input[name="variable"]').val(true);

View Article

Comment by David Silva-Barrera on ES2015 import doesn't work (even at...

You have to be careful because it is affected by the use of "file:///" protocol.

View Article


Comment by David Silva-Barrera on Show/Hide the console window of a C#...

The trick was awesome to know about, it works nice and solved my problem (hard-hiding the console). Nevertheless let notice it is not the answer for the question.

View Article


Comment by David Silva-Barrera on C#: How to make sure a settings variable...

For me: CommonSettings.Default.Context.ContainsKey(str) (VS 2019, .NET4.5)

View Article

Comment by David Silva-Barrera on Refresh listview so that it shows the...

WinForm ListView does not have ScrollIntoView(ListViewItem x)

View Article

Comment by David Silva-Barrera on Open DateTimePicker C# control...

Works nicely, simple, clear!!!! Thanks

View Article

Comment by David Silva-Barrera on Why does my RSS feed duplicate some entries?

The pubDate also influences the RSS aggregator. An item with the same guid but a different pubDate will be treated as a change and gets repeated sometimes.

View Article


Comment by David Silva-Barrera on OutOfMemoryException in wcf

The solution in this case was the configuration of the WindowsSecuredbasicHttpBinding; defining max values override default values.

View Article

Answer by David Silva-Barrera for Change value of R.string programmatically

Maybe you want to "modify" the string.xml so when it is required by the activity again it uses the new value, for example to keep a new dynamic title after screen rotation. First, you can't modify the...

View Article


.Net Entity Framework scaffolding for inherited classes

I'm working visual studio 2010, mvc 4. I'm applying a model first approach and I have a hierarchy of some classes. VS scaffolding works well with all other classes even base class for hierarchy, but...

View Article

Answer by David Silva-Barrera for .Net Entity Framework scaffolding for...

By now I found and insteresting solution but I'm still looking for something less tricky. Let's me explain:EDMX only adds base class to ModelContainer: public DbSet Personas { get; set; }With it its...

View Article


Answer by David Silva-Barrera for How to convert DataGridView Column from...

You can use the function typeof(). Like this:DataGridView1.Columns(4).ValueType = typeof(Decimal);

View Article

Answer by David Silva-Barrera for Wpf dragdrop, how to visually reject the...

You didn't say if you use the DragOver even. Maybe you're setting e.Effect = DragDropEffects.All; in this even and it will be fired repeatedly after you enter the target control instead of DragEnter...

View Article

Answer by David Silva-Barrera for Entity Framework 6 Mixed Stored Procedure...

I was looking for that mixture too. DbSet has a method called SqlQuery where you can place your custom SELECT queries (with some warnings). You can call Store Procedures too.Take a look at this:...

View Article

Answer by David Silva-Barrera for C# - Combining matching results from SQL...

You can't sum the meals'cause you will get a single number, but you can group by name column and get a table where meals are summarized:select user_id, name, sum(meals) from datatable group by user_id,...

View Article


Answer by David Silva-Barrera for How to use EditorFor inside a foreach

Is there any other reason (example apart) for explicitly using the foreach yourself? You could make a Custom Editor (or Display) helper for User class and make @Html.EditorFor(model=>model.Users)....

View Article


Answer by David Silva-Barrera for mvc dropdown binding for an int in razor view

Using ViewBag will work too:You have the property HoursToWait in your ViewModel. public class MyViewModel{ public int HoursToWait { get; set;}}...and in the Controller's GET method: var Values = new...

View Article

Answer by David Silva-Barrera for VisualStudio2010 Debugging - The process...

My problem started after creating a custom control and drag and drop it to the toolbox palette for use it in design forms. First appeared a warning saying that there was a redundance between the custom...

View Article

Answer by David Silva-Barrera for How can i set the html id attribute in razor

I just tested this solution with MVC5 .net 4.5.1. I was trying to set manually the form Id because I was going to have several forms in the same page and I needed to control then separatelly with JS...

View Article


Answer by David Silva-Barrera for Add border-bottom to table row

<td style="border-bottom-style: solid; border-bottom: thick dotted #ff0000; ">You can do the same to the whole row as well.There is border-bottom-style,...

View Article

Answer by David Silva-Barrera for EF6 - Is there a way to clear EF cache /...

I have been using SqlQuery from dbset for this purpose, this way:context.xdbset.SqlQuery("storedprocedure; select * from xdbset"); The query calls the stored procedure and then calls select *... which...

View Article

Answer by David Silva-Barrera for Build error: "The process cannot access the...

Just check the references and remove the self-reference to the project.Explanation: My problem started after creating a custom control and drag and drop it to the toolbox palette for use it in design...

View Article

Answer by David Silva-Barrera for Row Level Security with Entity Framework

I found a way to do it using Postgres and an Extension called Veil. It actually works (designed for) using Views for all operations (select, update,delete,insert) and verifying permissions in WHERE...

View Article



Answer by David Silva-Barrera for Deny Switching to Tabpage in a tabcontrol

You can use the Selecting event of the TabControl. It is of type: TabControlCancelEventHandler and it have a parameter of type TabControlCancelEventArgs with the attribute Cancel. private void...

View Article

Answer by David Silva-Barrera for Error: execution failed for task...

I got this log error (after PC restarted):Executing tasks: [:app:assembleDebug][Fatal Error] :1:1: Content is not allowed in prolog.:app:buildInfoDebugLoader FAILED:app:buildInfoGeneratorDebugThe...

View Article

Answer by David Silva-Barrera for C# ListView Column Width Auto

There is another useful method called AutoResizeColumn which allows you to auto size a specific column with the required parameter.You can call it like this:listview1.AutoResizeColumn(1,...

View Article

Answer by David Silva-Barrera for TabControl Context Menu

I was looking for a solution for the exact same problem.After testing both @nisar and @BFree answers I came to this (I also had the TabControl` inside a Panel somewhere in the Form):Create tabcontrol1...

View Article


Answer by David Silva-Barrera for Entity Framework 6 Error Unable to load the...

When you copy an EDMX from one project to another, you must be careful with the name of the folder where you originally created the EDMX, because it's reflected in the app.config (or web.config), in...

View Article

Answer by David Silva-Barrera for FileDescriptora Missing Characters

IntPtr fileDescriptorPointer = (IntPtr)((long)fileGroupDescriptorWPointer + Marshal.SizeOf(fileGroupDescriptorWPointer) - 4);fileDescriptorPointer = (IntPtr)((long)fileDescriptorPointer +...

View Article

Answer by David Silva-Barrera for Open DateTimePicker C# control...

I liked some of the previous ideas and finished with this (tested) Mix:public static class Extensions { public static void Open(this DateTimePicker obj) { obj.Select(); SendKeys.Send("%{DOWN}");...

View Article


Answer by David Silva-Barrera for How to add 'ON DELETE CASCADE' in ALTER...

As explained before:ALTER TABLE TABLENAMEdrop CONSTRAINT FK_CONSTRAINTNAME;ALTER TABLE TABLENAMEADD CONSTRAINT FK_CONSTRAINTNAME FOREIGN KEY (FId) REFERENCES OTHERTABLE (Id) ON DELETE CASCADE ON UPDATE...

View Article

Browsing latest articles
Browse All 37 View Live




Latest Images