Data Annotations are used by frameworks such as ASP.NET MVC to enable a model-based validation approach and enforce consistent validation throughout the application, both on client and server side. They were first introduced in ASP.NET MVC 2. In addition to ASP.NET MVC, they can also be used with other technologies such as Entity Framework, either through manual placement of attributes on properties, or automatic generation with T4 templates.
I have a Model with 4 properties which are of type string. I know you can validate the length of a single property by using the StringLength annotation. However I want to validate the length of the 4 ..
On my MVC3 project, I store score prediction for football/soccer/hockey/... sport game. So one of properties of my prediction class looks like this:
[Range(0, 15, ErrorMessage = "Can only be between ..
I was wondering if it is possible to disable the Required validation attribute in certain controller actions. I am wondering this because on one of my edit forms I do not require the user to enter val..
In ASP.MVC 3, how do I specify the columns and rows for a multiline EditorFor (textarea)? I am using [UIHint("MultilineText")], but can't find any documentation on how to add attributes for the text a..
When I run the ant file in verbose mode, I got an error like the one below. Does anyone have any ideas what is going wrong? I am new to this
antlib:org.apache.tools.ant] Could not load definitions fr..
I'm trying to figure out the right way to use a custom font for the toolbar title, and center it in the toolbar (client requirement).
At the moment, i'm using the good old ActionBar, and I was settin..
I have a pandas dataframe and I wish to divide it to 3 separate sets. I know that using train_test_split from sklearn.cross_validation, one can divide the data in two sets (train and test). However, I..
I have folder run in folder system32. When I run cmd from within Total Commander opening a command prompt window with C:\Users\admin as current directory and want to go into that folder, the following..
I am using the PyQt library to take a screenshot of a webpage, then reading through a CSV file of different URLs. I am keeping a variable feed that incremements everytime a URL is processed and theref..
Our professor is making us do some basic programming with Java, he gave a website and everything to register and submit our questions, for today I need to do this one example I feel like I'm on the ri..
I am using debian linux.
I have a linux machine on which mysql is install.
I can log in to my linux machine using root user as well as other user.
I can connect to mysql database on linux machine from..
:vsplit (short form: :vs) split the Vim viewport vertically. :30vs splits the viewport, making the new window 30 characters wide. Once this 30 char window is created, how would one change it's size to..
I want to use order by with union in mysql query.
I am fetching different types of record based on different criteria from a table based on distance for a search on my site.
The first select query ret..
Due to some bad cherry-picking, my local Git repository is currently five commits ahead of the origin, and not in a good state. I want to get rid of all these commits and start over again.
There are a lot of questions here related to Bootstrap. I see a lot of people using it. So I tried to research it, and I found the official Bootstrap site, but there was only a download section and a ..
I have a class full of utility functions. Instantiating an instance of it makes no semantic sense, but I still want to call its methods. What is the best way to deal with this? Static class? Abstract?..
From a text file containing three columns of data I want to be able to just take a slice of data from all three columns where the values in the first column are equal to the values defined in above. I..
In my angular2 app i want to create a map which takes a number as key and returns an array of objects. I am currently implementing in following way but no luck. How should i implement it or should i u..
I'm executing a script connecting via password-less SSH on a remote host. I want to set a timeout, so that if the remote host is taking an infinite time to run, I want to come out of that ssh session ..
When implementing Quicksort, one of the things you have to do is to choose a pivot. But when I look at pseudocode like the one below, it is not clear how I should choose the pivot. First element of li..
Suppose I have a directory /dir inside which there are 3 symlinks to other directories
/dir/dir11, /dir/dir12, and /dir/dir13. I want to list all the files in dir including the ones in dir11, dir12 a..
This is currently what I have to delete the file but it's not working. I thought it may be permission problems or something but it wasn't. The file that I am testing with is empty and exists, so not s..
During the development of a Java webservice client I ran into a problem. Authentication for the webservice is using a client certificate, a username and a password. The client certificate I received f..
I am using the randomSplitfunction to get a small amount of a dataframe to use in dev purposes and I end up just taking the first df that is returned by this function.
val df_subset = data.randomSpli..
I thought this was a n00b thing to do. And, so, I've never done it. Then I saw that FriendFeed did this and actually made their DB scale better and decreased latency. I'm curious if I should do this. ..
I want to get the first letter of a string and I've noticed that $str works great. I am just not sure whether this is 'good practice', as that notation is generally used with arrays. This feature d..
I have a private git repository and I would like to extend its access to a member of my team. Will I be able to do it through the Github website? I have the username of my member.
I have tried to do ..
I want to reopen the stdin and stdout (and perhaps stderr while I'm at it) filehandles, so that future calls to printf() or putchar() or puts() will go to a file, and future calls to getc() and such w..
How can I configure windows command dialog to run different python versions in it? For example when I type python2 it runs python 2.7 and when I type python3 it runs python 3.3? I know how to configur..
I've seen a bunch of tutorials that seem do the same thing I'm trying to do, but for some reason my Docker containers exit. Basically, I'm setting up a web-server and a few daemons inside a Docker con..
While working on a system I'm creating, I attempted to use the following query in my project:
COUNT( posts.solved_post ) AS solved..
What is the difference between Divide and Conquer Algorithms and Dynamic Programming Algorithms? How are the two terms different? I do not understand the difference between them.
Please take a simple..
My web application uses sessions to store information about the user once they've logged in, and to maintain that information as they travel from page to page within the app. In this specific applicat..
I want imagebutton with two states i) normal ii) touch(or click).
I have set normal image in the imagebutton background and I am trying to change image(pressed) from onclick method, but it doesn't ch..
I have a value cookie that is returned from a POST call using Python.
I need to check whether the cookie value is empty or null.
Thus I need a function or expression for the if condition.
How can I do..
I have been given a Source Folder (src) of a Java Project. I have created a .project file, kept it inside that folder and imported that Project into Eclipse 3.6 through the Import Existing Projects in..
My application is working as a client application for a bank server. The application is sending a request and getting a response from the bank. This application is normally working fine, but sometimes..
I am building a custom shopping cart where CC numbers and Exp date will be stored in a database until processing (then deleted). I need to encrypt this data (obviously).
I want to use the RSACryptoSe..
Like the title says, I'm looking for some simple way to run JUnit 4.x tests several times in a row automatically using Eclipse.
An example would be running the same test 10 times in a row and reporti..
I'm using win8 previously I had been running Eclipse Juno on my pc but from now on I wanted to start using STS, I am getting the below error as soon as I create a new project. I deleted my .m2 folder ..
Coming from mercurial, I use branches to organize features.
Naturally, I want to see this work-flow in my history as well.
I started my new project using git and finished my first feature. When mergi..
I am generally familiar with the technique of flushing a footer using css.
But I am having some trouble getting this approach to work for Twitter bootstrap, most likely due to the fact that Twitter b..
I am trying to get my cron to only get Projects that are due to recur/renew in the next 7 days to send out reminder emails. I've just found out my logic doesn't quite work.
I currently have the query..
How do you view ALL text from an NTEXT or NVARCHAR(max) in SQL Server Management Studio? By default, it only seems to return the first few hundred characters (255?) but sometimes I just want a quick ..
I start planning a REST API with node.js ,express and mongodb. The API provides data for a website (public and private area) and maybe later a mobile app. The frontend will be developed with AngularJS..
I am trying to parse an XML response, but I am failing miserably. I thought initially
that the xml was just not being returned in the response, so I crafted up the code below with a direct link to my..
I have a folder in my C: drive as C:\app_config\java_app
This folder contains some locale specific property files.
I have a java class (PrjPropertilesLocator) that loads the property files based on d..
On our internal network, we use a self-signed CA certificate. This has worked fine for years, in both Safari and our iOS product, all the way through iOS 10. We simply install the CA certificate on an..
I am trying to read an Excel file into a list of Data.DataTable, although with my current method it can take a very long time. I essentually go Worksheet by Worksheet, cell by cell, and it tends to ta..
I am trying out the @Cacheable annotation support for Spring 3.1 and wondering if there is any way to make the cached data clear out after a time by setting a TTL?
Right now from what I can see I need..
I am trying to display a "leaderboard" table based on JSON data.
I do not have access to the HTML or PHP for a page and can only edit via CSS. I've been doing modifications on a site and adding text via the ::after or ::before pseudo-elements and have found that es..
Seems like Google services are increasingly harder to manage.
Now i want to delete a project ID that was previously created in another test account.
Assuming that I could recreate it in another accou..
I have created a layout that contains two buttons, Next and Previous. In between the buttons I'm generating some dynamic views. So when I first launch the application I want to disable the "Previous" ..
I have a DataTable with 30+ columns and 6500+ rows.I need to dump the whole DataTable values into an Excel file.Can anyone please help with the C# code.I need each column value to be in a cell.To be p..
Without routing, HttpContext.Current.Session is there so I know that the StateServer is working. When I route my requests, HttpContext.Current.Session is null in the routed page. I am using .NET 3.5 s..
I am wondering why the method String.valueOf(int i) exists ? I am using this method to convert int into String and just discovered the Integer.toString(int i) method.
After looking the implementation..
Is it possible to get the start time of an old running process? It seems that ps will report the date (not the time) if it wasn't started today, and only the year if it wasn't started this year. Is th..
I have a tabular data which I need to export to csv without using any external plugin or api. I used the window.open method passing the mime types but faced issues like below:
How to determine whethe..
I'm used to writing PHP code, but do not often use Object-Oriented coding. I now need to interact with SOAP (as a client) and am not able to get the syntax right. I've got a WSDL file which allows me ..
I'm running laravel 5.4 on Ubuntu 16.04 server with PHP7. trying to install cviebrock/eloquent-sluggable package throw some error:
pish@let:/home/sherk/ftp/www$ sudo composer require cviebrock/eloque..
I always mess up how to use const int*, const int * const, and int const * correctly. Is there a set of rules defining what you can and cannot do?
I want to know all the do's and all don'ts in terms ..
I am using matplotlib to create the plots. I have to identify each plot with a different color which should be automatically generated by Python.
Can you please give me a method to put different colo..
When programming in Node.js and referencing files that are located somewhere in relation to your current directory, is there any reason to use the __dirname variable instead of just a regular ./? I've..
I'm trying to get latitude and longitude from Autocomplete Google Maps API without showing the map. In my script autocompletion works well, but I can't get the latitude and longitude.
Is there a better way of getting this result? This function fails if num has more digits than digits, and I feel like it should be in the library somewhere (like Integer.toString(x,"%3d") or something..
I am currently writing a deployment script that installs a number of Windows services.
The services names are versioned, so I want to delete the prior Windows service version as part of the installs ..