Questions Tagged with #Data annotations

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.

How to specify a min but no max decimal using the range data annotation attribute?

I would like to specify that a decimal field for a price must be >= 0 but I don't really want to impose a max value. Here's what I have so far...I'm not sure what the correct way to do this is. [Ran..

How to add "required" attribute to mvc razor viewmodel text input editor

I have the following MVC 5 Razor HTML helper: @Html.TextBoxFor(m => m.ShortName, new { @class = "form-control", @placeholder = "short name"}) I need this field to be required (i.e. have a red..

ASP.NET MVC: Custom Validation by DataAnnotation

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 ..

displayname attribute vs display attribute

What is difference between DisplayName attribute and Display attribute in ASP.NET MVC?..

Assign format of DateTime with data annotations?

I have this attribute in my view model: [DataType(DataType.DateTime)] public DateTime? StartDate { get; set; } If I want to display the date, or populate a textbox with the date, I have these: <..

Int or Number DataType for DataAnnotation validation attribute

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 ..

Disable Required validation attribute under certain circumstances

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..

Entity Framework code first unique column

I am using Entity Framework 4.3 and using Code Fist. I have a class public class User { public int UserId{get;set;} public string UserName{get;set;} } How do I tell Entity Framework that Us..

Why can't I reference System.ComponentModel.DataAnnotations?

I'm trying to use DataAnnotations in my WPF project to specify a maximum length of strings, with the following: using System.ComponentModel.DataAnnotations; However, I get the error The type or..

How do I specify the columns and rows of a multiline Editor-For in ASP.MVC?

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..

DataAnnotations validation (Regular Expression) in mvc 4 - razor view

The DataAnnotations validator not working in mvc 4 razor view, when using the special characters in the regular expression. Model: [StringLength(100)] [Display(Description = "First Name")] [..

Ant build failed: "Target "build..xml" does not exist"

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] Could not load definitions fr..

Android toolbar center title and custom font

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..

How to split data into 3 sets (train, validation and test)?

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..

Raise an event whenever a property's value changed?

There is a property, it's named ImageFullPath1 public string ImageFullPath1 {get; set; } I'm going fire an event whenever its value changed. I am aware of changing INotifyPropertyChanged, but I wan..

Converting Dictionary to List?

I'm trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict['Capital']="London" dict['Food']="Fish&Chips" dict['2012']="Olym..

Google Maps Android API v2 - Interactive InfoWindow (like in original android google maps)

I am trying to a make custom InfoWindow after a click on a marker with the new Google Maps API v2. I want it to look like in the original maps application by Google. Like this: When I have ImageBut..

Android SDK Setup under Windows 7 Pro 64 bit

The short version of my issue at hand, Windows 7 Professional x64 Java JDK 1.6.0_17 x64 Eclipse Galileo w\ADT Plugin installed Android SDKtools r04 Since the Android SDK download now only include..

CocoaPods Errors on Project Build

I'm unable to build a project that uses CocoaPods. I get the following errors: diff: /../Podfile.lock: No such file or directory diff: Manifest.lock: No such file or directory error: The sandbox is ..

How can I write these variables into one line of code in C#?

I am new to C#, literally on page 50, and i am curious as to how to write these variables in one line of code: using System; using System.Collections.Generic; using System.Linq; using System.Text; n..

how to rotate text left 90 degree and cell size is adjusted according to text in html

Suppose i have table with some rows and column,so i want to rotate text in cells something like this: problem is when i rotate text using style : #rotate { -moz-transform: rotate(-90.0deg); ..

Enable remote connections for SQL Server Express 2012

I just installed SQL Server Express 2012 on my home server. I'm trying to connect to it from Visual Studio 2012 from my desktop PC, and repeatedly getting the well-known error: A network-related ..

How can I find the current OS in Python?

Possible Duplicate: Python: What OS am I running on? As the title says, how can I find the current operating system in python?..

How to upload files to server using Putty (ssh)

Can someone help me with commands? I'm trying to upload file to server based on linux...

MySQL stored procedure return value

I have to create an SP that returns a value if it's valid or not. But it doesn't return anything and I don't know, why? CREATE DEFINER=`root`@`localhost` PROCEDURE `validar_egreso`( IN codigo_pro..

Multiple markers Google Map API v3 from array of addresses and avoid OVER_QUERY_LIMIT while geocoding on pageLoad

I have to implement the multiple markers functionality from array of addresses. The string of addresses are being fetched from the database. My array of addresses looks like this var address = &..

What does the "$" sign mean in jQuery or JavaScript?

Possible Duplicate: What is the meaning of “$” sign in JavaScript Now this must seem to be an easy and stupid question to ask but I must know why we use the dollar ($) symbol in..

What is the reason for the error message "System cannot find the path specified"?

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..

What is the difference between res.end() and res.send()?

I'm a beginner in Express.js and I'm confused by these two keywords: res.end() and res.send(). Are they the same or different?..

JSF rendered multiple combined conditions

I need to give condition like if((a == 12 and b == 13) or(a == 12 and b == 15)) in JSF rendered attribute. Can anyone help?..

Scala how can I count the number of occurrences in a list

val list = List(1,2,4,2,4,7,3,2,4) I want to implement it like this: list.count(2) (returns 3)...

Local variable referenced before assignment?

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..

How to read input with multiple lines in Java

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..

how to log in to mysql and query the database from linux terminal

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..

Facebook login "given URL not allowed by application configuration"

I've added facebook login to my site. However, when I click the button, I get a red box that says: Invalid Argument Given URL is not allowed by the Application configuration. If I continue to log..

How to properly set the 100% DIV height to match document/window height?

I have a wrapper positioned to center with an y-repeated background image: <body> <div id="wrapper"> ...some content </div> </body> #wrapper{ width: 900px; ma..

MySQL - length() vs char_length()

What's the main difference between length() and char_length()? I believe it has something to do with binary and non-binary strings. Is there any practical reason to store strings as binary? mysql&g..

Run a string as a command within a Bash script

I have a Bash script that builds a string to run as a command Script: #! /bin/bash matchdir="/home/joao/robocup/runner_workdir/matches/testmatch/" teamAComm="`pwd`/" teamBComm="`pwd`/" inc..

How to increase the vertical split window size in Vim

: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..

How to deploy a Java Web Application (.war) on tomcat?

I have a .war file of a Java Web Application. Now I want to upload it to my ftp server so that I can execute it. What steps I should perform to run it? The context path of the webapp is /mywebapp E..

Angular - res.json() is not a function

I am having an issue with my API Service. This service connects to my nodejs backend api. The error says ERROR TypeError: res.json is not a function I am getting this error after recently updated..

Using union and order by clause in mysql

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..

nginx- duplicate default server error

In my error log i get [emerg] 10619#0: a duplicate default server for in /etc/nginx/sites-enabled/ on Line 4 I have: server_name; Any sugge..

PHP Fatal error: Cannot access empty property

I'm new to php and I have executed below code. <?php class my_class{ var $my_value = array(); function my_class ($value){ $this->my_value[] = $value; } function set_va..

Javascript: convert 24-hour time-of-day string to 12-hour time with AM/PM and no timezone

The server is sending a string in this format: 18:00:00. This is a time-of-day value independent of any date. How to convert it to 6:00PM in Javascript? I could prepend today's date as a string to the..

Throw away local commits in Git

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. Obviously,..

How to print the contents of RDD?

I'm attempting to print the contents of a collection to the Spark console. I have a type: linesWithSessionId: org.apache.spark.rdd.RDD[String] = FilteredRDD[3] And I use the command: scala> li..

Foreach Control in form, how can I do something to all the TextBoxes in my Form?

How can I use a Foreach Statement to do something to my TextBoxes? foreach (Control X in this.Controls) { Check if the controls is a TextBox, if it is delete it's .Text letters. } ..

What is Bootstrap?

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 ..

Java: Static Class?

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?..

Evaluate a string with a switch in C++

I want to evaluate a string with a switch but when I read the string entered by the user throws me the following error. #include<iostream> using namespace std; int main() { string ..

TypeError: unhashable type: 'numpy.ndarray'

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..

how to align img inside the div to the right?

I would like to know how to align the image inside the div on the right side?..

Javascript Print iframe contents only

This is my code <script> var body = "dddddd" var script = "<script>window.print();</scr'+'ipt>"; var newWin = $("#printf")[0].contentWindow.document;; newWin.clo..

Bootstrap Columns Not Working

Can't figure out why the columns aren't being structured with this HTML: <div class="container"> <div class="row"> <div class="col-md-12"> <div class="col..

console.writeline and System.out.println

What exactly is the technical difference between console.writeline and System.out.println? I know that System.out.println writes to standard output but is this not the same thing as the console? I ..

How to define Typescript Map of key value pair. where key is a number and value is an array of objects

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..

How to reference image resources in XAML?

I put an Image control on a Window and I would like to display an image that is stored in a project resource file named "Resources.resx". The name of the image in the resource file is 'Search'. Coul..

How to add a primary key to a MySQL table?

This is what I tried but it fails: alter table goods add column `id` int(10) unsigned primary AUTO_INCREMENT; Does anyone have a tip?..

Setting DEBUG = False causes 500 Error

Once I change the DEBUG = False, my site will generate 500 (using wsgi & runserver), and there is no error info in Apache error log and it will run normally when I change debug to True ...

dplyr change many data types

I have a data.frame: dat <- data.frame(fac1 = c(1, 2), fac2 = c(4, 5), fac3 = c(7, 8), dbl1 = c('1', '2'), dbl2 = c('4', '5')..

How to set ssh timeout?

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 ..

Pandas split column of lists into multiple columns

I have a pandas DataFrame with one column: import pandas as pd df = pd.DataFrame( data={ "teams": [ ["SF", "NYG"], ["SF", "NYG"], ["SF", "NYG"], ..

Quicksort: Choosing the pivot

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..

Get a list of all the files in a directory (recursive)

I'm trying to get (not print, that's easy) the list of files in a directory and its sub directories. I've tried: def folder = "C:\\DevEnv\\Projects\\Generic"; def baseDir = new File(folder); files =..

Recursively list all files in a directory including files in symlink directories

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..

Understanding ASP.NET Eval() and Bind()

Can anyone show me some absolutely minimal ASP.NET code to understand Eval() and Bind()? It is best if you provide me with two separate code-snippets or may be web-links...

Java 'file.delete()' Is not Deleting Specified File

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..

How to import a .cer certificate into a java keystore?

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..

Is there a way to take the first 1000 rows of a Spark Dataframe?

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..

Storing Data in MySQL as JSON

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. ..

Getting the first character of a string with $str[0]

I want to get the first letter of a string and I've noticed that $str[0] works great. I am just not sure whether this is 'good practice', as that notation is generally used with arrays. This feature d..

How to add additional fields to form before submit?

Is there a way to use javascript and JQuery to add some additional fields to be sent from a HTTP form using POST? I mean: <form action="somewhere" method="POST" id="form"> <input type="su..

How to avoid the "divide by zero" error in SQL?

I have this error message: Msg 8134, Level 16, State 1, Line 1 Divide by zero error encountered. What is the best way to write SQL code so that I will never see this error message again? I coul..

How can I give access to a private GitHub repository?

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 ..

Rerouting stdin and stdout from C

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..

Dump Mongo Collection into JSON format

Is there any way to dump mongo collection into json format? Either on the shell or using java driver.I am looking for the one with best performance...

How to run different python versions in cmd

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..

How to keep Docker container running after starting services?

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..

MySQL - Operand should contain 1 column(s)

While working on a system I'm creating, I attempted to use the following query in my project: SELECT,, topics.post_count, topics.view_count, COUNT( posts.solved_post ) AS solved..

Can a local variable's memory be accessed outside its scope?

I have the following code. #include <iostream> int * foo() { int a = 5; return &a; } int main() { int* p = foo(); std::cout << *p; *p = 8; std::cout <<..

Difference between Divide and Conquer Algo and Dynamic Programming

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..

T-SQL STOP or ABORT command in SQL Server

Is there a command in Microsoft SQL Server T-SQL to tell the script to stop processing? I have a script that I want to keep for archival purposes, but I don't want anyone to run it...

How to get the latest file in a folder?

I need to get the latest file of a folder using python. While using the code: max(files, key = os.path.getctime) I am getting the below error: FileNotFoundError: [WinError 2] The system cannot f..

How to import module when module name has a '-' dash or hyphen in it?

I want to import This works: foobar = __import__("foo-bar") This does not: from "foo-bar" import * My question: Is there any way that I can use the above format i.e., from "foo-bar" ..

How to center cell contents of a LaTeX table whose columns have fixed widths?

Consider the following piece of LaTeX code: \begin{tabular}{p{1in}p{1in}} A & B\\ C & D\\ \end{tabular} How can I make the contents of each cell aligned in the center of the cell rather t..

How to make <a href=""> link look like a button?

I have this button image: I was wondering whether it would be possible to make a simple <a href="">some words</a> and style that link to appear as that button? If it is possible, how do..

Right mime type for SVG images with fonts embedded

This is the usual SVG mime type: image/svg+xml And it works great. However, when embedding an SVG font, chrome tells you the mime type is incorrect, obviously because you return a font instead of a..

java.math.BigInteger cannot be cast to java.lang.Integer

I'm getting the following exception. Caused by: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Integer with the following code List queryResult = query.list..

PostgreSQL: Modify OWNER on all tables simultaneously in PostgreSQL

How do I modify the owner of all tables in a PostgreSQL database? I tried ALTER TABLE * OWNER TO new_owner but it doesn't support the asterisk syntax...

How to remove title bar from the android activity?

Can someone please help me with the issue.I want my activity as full screen and want to remove title from the screen.I have tried several ways but not able to remove it. Activity Code : public clas..

"Keep Me Logged In" - the best approach

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..

Error: "Input is not proper UTF-8, indicate encoding !" using PHP's simplexml_load_string

I'm getting the error: parser error : Input is not proper UTF-8, indicate encoding ! Bytes: 0xED 0x6E 0x2C 0x20 When trying to process an XML response using simplexml_load_string from a 3rd party so..

How to install package from github repo in Yarn

When I use npm install fancyapps/fancybox#v2.6.1 --save, so fancybox package at v2.6.1 tag will be installed. This behavior is described in docs I want to ask, how to do this with yarn? Is this comm..

How to set image button backgroundimage for different state?

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..

Leading zeros for Int in Swift

I'd like to convert an Int in Swift to a String with leading zeros. For example consider this code: for myInt in 1 ... 3 { print("\(myInt)") } Currently the result of it is: 1 2 3 But I want..

How to check if a string is null in python

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..

Run script with rc.local: script works, but not at boot

I have a node.js script which need to start at boot and run under the www-data user. During development I always started the script with: su www-data -c 'node /var/www/php-jobs/manager.js I saw exa..

How to extract file name from path?

How do I extract the filename myfile.pdf from C:\Documents\myfile.pdf in VBA?..

What is the purpose and use of **kwargs?

What are the uses for **kwargs in Python? I know you can do an objects.filter on a table and pass in a **kwargs argument.   Can I also do this for specifying time deltas i.e. timedelta(hours = ..

Eclipse: The resource is not on the build path of a Java project

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..

Longer object length is not a multiple of shorter object length?

I don't understand why R gives me a warning about "Longer object length is not a multiple of shorter object length" I have this object which is generated by doing an aggregate over an xts se..

The I/O operation has been aborted because of either a thread exit or an application request

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..

How to implement the Softmax function in Python

From the Udacity's deep learning class, the softmax of y_i is simply the exponential divided by the sum of exponential of the whole Y vector: Where S(y_i) is the softmax function of y_i and e is th..

How can I count occurrences with groupBy?

I want to collect the items in a stream into a map which groups equal objects together, and maps to the number of occurrences. List<String> list = Arrays.asList("Hello", "Hello&qu..

How can I fetch all items from a DynamoDB table without specifying the primary key?

I have a table called products with primary key Id. I want to select all items in the table. This is the code is I'm using: $batch_get_response = $dynamodb->batch_get_item(array( 'RequestItems..

codeigniter, result() vs. result_array()

I use both result() and result_array(). Usually i like to get my result as array thats why i use result_array() mostly.. But i want to know which is the better approach that i should follow, Which o..

Splitting strings using a delimiter in python

OK so I have a string that has this: Dan|warrior|54 I'm trying to make so I can use python and split it using | as the delimiter. Here's what I have so far: #!/usr/bin/env python dan = 'dan|warrio..

Update style of a component onScroll in React.js

I have built a component in React which is supposed to update its own style on window scroll to create a parallax effect. The component render method looks like this: function() { let sty..

How to fix the height of a <div> element?

I've defined my div's height in a stylesheet: .topbar{ width:100%; height:70px; background-color:#475; } But as soon as text is entered into the div, the divs height changes. Any ideas?..

How to disable gradle 'offline mode' in android studio?

I am new to android studio IDE development. Every time when I imported a sample project that developed in the android studio, I am getting this error.. No cached version of

How to Generate Unique Public and Private Key via RSA

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..

BLOB to String, SQL Server

I have a text string stored as a BLOB data type in a database. I want to extract it by an SQL select query, but I have problems converting/casting from BLOB to readable text. I've tried e.g. select ..

Creating a byte array from a stream

What is the prefered method for creating a byte array from an input stream? Here is my current solution with .NET 3.5. Stream s; byte[] b; using (BinaryReader br = new BinaryReader(s)) { b = ..

Easy way of running the same junit test over and over?

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..

Visual Studio keyboard shortcut to automatically add the needed 'using' statement

What is the keyboard shortcut to expand the little red line that gives you the menu where you can choose to have the necessary using statement added to the top of the file?..

os.walk without digging into directories below

How do I limit os.walk to only return files in the directory I provide it? def _dir_list(self, dir_name, whitelist): outputList = [] for root, dirs, files in os.walk(dir_name): for f ..

Facebook share button and custom text

Is there any way to make facebook share button which post custom text on the wall or news feed?..

Array length in angularjs returns undefined

JS: function UserController($scope, User, Group){ $scope.users = User.query(); $scope.isNewUser = function(){ var len = $scope.users.lenght; console.log(len); /..

The container 'Maven Dependencies' references non existing library - STS

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 ..

add new row in gridview after binding C#,

I want to add a new blank row to the gridview after binding as seen in the picture when clicking the link button below. The textboxes inside the gridview should remain the same if there is any data ..

Renaming Columns in an SQL SELECT Statement

I would like to rename the columns in the results of a SELECT expression. Of course, the following doesn't work: SELECT * AS foobar_* FROM `foobar` As I'm new to SQL, I think I'm just missing a co..

How to add elements of a Java8 stream into an existing List

Javadoc of Collector shows how to collect elements of a stream into a new List. Is there an one-liner that adds the results into an existing ArrayList?..

Setting background color for a JFrame

Just how do you set the background color for a JFrame?..

.NET code to send ZPL to Zebra printers

Is there a way to send ZPL (Zebra Programming Language) to a printer in .NET? I have the code to do this in Delphi, but it is not pretty and I would rather not try to recreate it in .NET as it is...

Why does git perform fast-forward merges by default?

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..

Total Number of Row Resultset getRow Method

Read the Following Code: public class selectTable { public static ResultSet rSet; public static int total=0; public static ResultSet onLoad_Opetations(Connection Conn, int rownum,String sql) { int r..

Create a batch file to copy and rename file

I need to write a batch file that copies a file to a new folder and renames it. At the moment, my batch file consists of only this command: COPY ABC.PDF \\Documents As you can see, it only copies..

How do I connect to a MySQL Database in Python?

How do I connect to a MySQL database using a python program?..

Flushing footer to bottom of the page, twitter bootstrap

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..

Pass by Reference / Value in C++

I would like to clarify the differences between by value and by reference. I drew a picture So, for passing by value, a copy of an identical object is created with a different reference, and the..

Laravel $q->where() between dates

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..

R: Plotting a 3D surface from x, y, z

imagine I have a 3 columns matrix x, y, z where z is a function of x and y. I know how to plot a "scatter plot" of these points with plot3d(x,y,z) But if I want a surface instead I must use other co..

How do I rename a MySQL schema?

Possible Duplicate: how does one rename a schema in MySQL Is there a MySQL statement for renaming a schema? I know about RENAME {DATABASE | SCHEMA} db_name TO new_db_name;, but that stateme..


Does anyone know how I can do an inner joins and alias values within so they won't overwrite each other? It might look more clear if you see my code: SELECT home, away,, g.date_start ..

How do you view ALL text from an ntext or nvarchar(max) in SSMS?

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 ..

how can I debug a jar at runtime?

I'm into a quite strange position (from my java-newbie point of view): using Eclipse I wrote a "java program" (some .java files with classes into) which essentially (batch) reads a text *.csv file, ..

How to implement a secure REST API with node.js

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..

How can I insert into a BLOB column from an insert statement in sqldeveloper?

Is it possible to insert into a BLOB column in oracle using sqldeveloper? i.e. something like: insert into mytable(id, myblob) values (1,'some magic here'); ..

Why am I getting this error Premature end of file?

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..

Adding an external directory to Tomcat classpath

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..

iOS 11, 12, and 13 installed certificates not trusted automatically (self signed)

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..

Default port for SQL Server

I need to know the default port settings for the following services SQL Server SQL Browser SQL Reporting services SQL Analysis services I neeed to know the port settings for these services for di..

"detached entity passed to persist error" with JPA/EJB code

I am trying to run this basic JPA/EJB code: public static void main(String[] args){ UserBean user = new UserBean(); user.setId(1); user.setUserName("name1"); user...

Recursively find files with a specific extension

I'm trying to find files with specific extensions. For example, I want to find all .pdf and .jpg files that's named Robert I know I can do this command $ find . -name '*.h' -o -name '*.cpp' but ..

Pass parameter to controller from @Html.ActionLink MVC 4

In this line: @Html.ActionLink("Reply", "BlogReplyCommentAdd", "Blog", new { blogPostId = blogPostId, replyblogPostmodel = Model, captchaValid = Model.AddNewComment.DisplayCaptcha }..

Python using enumerate inside list comprehension

Lets suppose I have a list like this: mylist = ["a","b","c","d"] To get the values printed along with their index I can use Python's enumerate function like this >>> for i,j in enumerate(..

Writing to a new file if it doesn't exist, and appending to a file if it does

I have a program which writes a user's highscore to a text file. The file is named by the user when they choose a playername. If the file with that specific username already exists, then the program..

Replace console output in Python

I'm wondering how I could create one of those nifty console counters in Python as in certain C/C++-programs. I've got a loop doing things and the current output is along the lines of: Doing thing 0 ..

Playing mp3 song on python

I want to play my song (mp3) from python, can you give me a simplest command to do that? This is not correct: import wave w ="e:/LOCAL/Betrayer/Metalik Klinik1-Anak Sekolah.mp3","r") ..

Python Threading String Arguments

I have a problem with Python threading and sending a string in the arguments. def processLine(line) : print "hello"; return; . dRecieved = connFile.readline(); processThread = threading.Th..

Prompt for user input in PowerShell

I want to prompt the user for a series of inputs, including a password and a filename. I have an example of using host.ui.prompt, which seems sensible, but I can't understand the return. Is there a ..

Extracting double-digit months and days from a Python date

Is there a way to extract month and day using isoformats? Lets assume today's date is March 8, 2013. >>> d = >>> d.month 3 >>> 8 I want: >..

Replace tabs with spaces in vim

I would like to convert tab to spaces in gVim. I added the following line to my _vimrc: set tabstop=2 It works to stop at two spaces but it still looks like one tab key is inserted (I tried to use ..

What is the path for the startup folder in windows 2008 server

Is there a folder to keep programs to run while doing starting of the system. As like this "C:\Users\All Users\Microsoft\Windows\Start Menu\Programs\Startup"??. Thanks, Varun..

The developers of this app have not set up this app properly for Facebook Login?

I'm trying to make login with Facebook available in my script. I've done everything, but when I attempt to login with a Facebook account I get this error from Facebook: Error App Not Setup: T..

How can I generate an ObjectId with mongoose?

I'd like to generate a MongoDB ObjectId with Mongoose. Is there a way to access the ObjectId constructor from Mongoose? This question is about generating a new ObjectId from scratch. The generated I..

Bootstrap 3 grid with no gap

I am trying to create a 2 column grid, with literally a 50% with no margins or padding. How do I achieve this with Bootstrap 3 I tried this but end up with negative margins at tablet/desktop break p..

ViewPager and fragments — what's the right way to store fragment's state?

Fragments seem to be very nice for separation of UI logic into some modules. But along with ViewPager its lifecycle is still misty to me. So Guru thoughts are badly needed! Edit See dumb solution b..

How to compare strings in C conditional preprocessor-directives

I have to do something like this in C. It works only if I use a char, but I need a string. How can I do this? #define USER "jack" // jack or queen #if USER == "jack" #define USER_VS "queen" #elif US..

Importing Excel into a DataTable Quickly

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..

Can I set a TTL for @Cacheable

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..

Parsing JSON objects for HTML table

I am trying to display a "leaderboard" table based on JSON data. I have read a lot about the JSON format and overcome some initial obstacles, but my Javascript knowledge is very limited and I need he..

Populating a ListView using an ArrayList?

My Android app needs to populate the ListView using the data from an ArrayList. I have trouble doing this. Can someone please help me with the code?..

How to center a (background) image within a div?

Is it possible to center a background image in a div? I have tried just about everything - but no success: <div id="doit"> Lorem Ipsum ... </div> //CSS #doit { background-image: url(im..

Parsing json and searching through it

I have this code import json from pprint import pprint json_data=open('bookmarks.json') jdata = json.load(json_data) pprint (jdata) json_data.close() How can I search through it for u'uri': u'http..

Create a Path from String in Java7

How can I create a java.nio.file.Path object from a String object in Java 7? I.e. String textPath = "c:/dir1/dir2/dir3"; Path path = ?; where ? is the missing code that uses textPath...

How to fix: fatal error: openssl/opensslv.h: No such file or directory in RedHat 7

I have RedHat Enterprise Linux Server 7, and I downloaded the linux kernel version 4.12.10 which I am trying to compile but when I execute the following command: make modules I get the following er..

How to upgrade docker container after its image changed

Let's say I have pulled the official mysql:5.6.21 image. I have deployed this image by creating several docker containers. These containers have been running for some time until MySQL 5.6.22 is rel..

Javascript Src Path

Hello I'm having some trouble with the following code within my Index.html file: <SCRIPT LANGUAGE="JavaScript" SRC="clock.js"></SCRIPT> This works when my Index.html file is in the same..

Add line break to ::after or ::before pseudo-element content

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..

How to delete Project from Google Developers Console

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..

How to disable an Android button?

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" ..

Export DataTable to Excel File

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..

How to get the unique ID of an object which overrides hashCode()?

When a class in Java doesn't override hashCode(), printing an instance of this class gives a nice unique number. The Javadoc of Object says about hashCode(): As much as is reasonably practical, ..

HttpContext.Current.Session is null when routing requests

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..

How to wait for 2 seconds?

How does one cause a delay in execution for a specified number of seconds? This doesn't do it: WAITFOR DELAY '00:02'; What is the correct format?..

Integer.toString(int i) vs String.valueOf(int i)

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..

How do you pull first 100 characters of a string in PHP

I am looking for a way to pull the first 100 characters from a string variable to put in another variable for printing. Is there a function that can do this easily? For example: $string1 = "I am ..

How to center div vertically inside of absolutely positioned parent div

I am trying to get blue container in the middle of pink one, however seems vertical-align: middle; doesn't do the job in that case. <div style="display: block; position: absolute; left: 50px; top:..

commands not found on zsh

I am using the z Shell (zsh) instead of the default bash, and something wrong happen so that all commands who used to work are no longer recognized: ls zsh: command not found: ls open -e .zshrc zsh:..

How to get the start time of a long-running Linux process?

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..

Understanding REST: Verbs, error codes, and authentication

I am looking for a way to wrap APIs around default functions in my PHP-based web applications, databases and CMSs. I have looked around and found several "skeleton" frameworks. In addition to the an..

How to get UTF-8 working in Java webapps?

I need to get UTF-8 working in my Java webapp (servlets + JSP, no framework used) to support äöå etc. for regular Finnish text and Cyrillic alphabets like ??? for special cases. My setup is the fo..

How to convert wstring into string?

The question is how to convert wstring to string? I have next example : #include <string> #include <iostream> int main() { std::wstring ws = L"Hello"; std::string s( ws.begin(),..

Export to CSV using jQuery and html

I have a tabular data which I need to export to csv without using any external plugin or api. I used the method passing the mime types but faced issues like below: How to determine whethe..

How to make a PHP SOAP call using the SoapClient class

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 ..

Java 8 forEach with index

Is there a way to build a forEach method in Java 8 that iterates with an index? Ideally I'd like something like this: params.forEach((idx, e) -> query.bind(idx, e)); The best I could do right no..

PHP7 : install ext-dom issue

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..

How to get child element by class name?

I'm trying to get the child span that has a class = 4. Here is an example element: <div id="test"> <span class="one"></span> <span class="two"></span> <span class=..

What is the difference between const int*, const int * const, and int const *?

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 ..

How do I correctly clone a JavaScript object?

I have an object x. I'd like to copy it as object y, such that changes to y do not modify x. I realized that copying objects derived from built-in JavaScript objects will result in extra, unwanted pro..

How to get different colored lines for different plots in a single figure?

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..

What is the difference between __dirname and ./ in node.js?

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..

Stop node.js program from command line

I have a simple TCP server that listens on a port. var net = require("net"); var server = net.createServer(function(socket) { socket.end("Hello!\n"); }); server.listen(7777); I start it with ..

VT-x is disabled in the BIOS for both all CPU modes (VERR_VMX_MSR_ALL_VMX_DISABLED)

Downloaded Xamarin Android Player and with >>next>> progress installed Virtual Box. When I tried to start an emulator I got Failed to initialized device (name Of the emulator) VboxManager Commendt ..

Java 8, Streams to find the duplicate elements

I am trying to list out duplicate elements in the integer list say for eg, List<Integer> numbers = Arrays.asList(new Integer[]{1,2,1,3,4,4}); using Streams of jdk 8. Has anybody tried out..

Re-enabling window.alert in Chrome

I accidently checked the "disable alerts from this site" box in Chrome, and now I cannot get any window.alert to work on my localhost. I have tried resetting the settings in advanced but no luck...

Delete newline in Vim

Is there a way to delete the newline at the end of a line in Vim, so that the next line is appended to the current line? For example: Evaluator<T>(): _bestPos(){ } I'd like to put this a..

Google Maps API - how to get latitude and longitude from Autocomplete without showing the map?

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. _x000D_ _x000D_..

Add leading zeroes to number in Java?

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..

How to show code but hide output in RMarkdown?

I want my html file to show the code, but not the output of this chunk: ```{r echo=True, include=FALSE} fun <- function(b) { for(a in b) {print(a) return(a * a)} } y &l..

How to disable an input type=text?

I want to disable writing in an input field of type text using JavaScript, if possible. The input field is populated from a database; that is why I don't want the user to modify its value...

How to undo the last commit in git

By mistake, I did git add . and git commit in the develop branch. But luckily, I did not do git push. So I wanted to revert it back to original state. I tried git reset --soft and git reset HEAD --h..

How to trim leading and trailing white spaces of a string?

Which is the effective way to trim the leading and trailing white spaces of string variable in Go?..

Including a css file in a blade template?

I want to include a css file in my Laravel blade template. I've tried: @include(public_path('css/styles.css')) But it says view does not exist. It does exist. How can I include a css file? Pleas..

Print <div id="printarea"></div> only?

How do I print the indicated div (without manually disabling all other content on the page)? I want to avoid a new preview dialog, so creating a new window with this content is not useful. The page ..

How to transfer data from JSP to servlet when submitting HTML form

I have a JSP page with an HTML form: <form action="SERVLET"> <input type="text" name="name"/><br> <input type="text" name="group"/> <input type="text" n..

Check if a Windows service exists and delete in PowerShell

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 ..

Passing an array/list into a Python function

I've been looking at passing arrays, or lists, as Python tends to call them, into a function. I read something about using *args, such as: def someFunc(*args) for x in args print x Bu..

Normalize columns of pandas data frame

I have a dataframe in pandas where each column has different value range. For example: df: A B C 1000 10 0.5 765 5 0.35 800 7 0.09 Any idea how I can normalize the columns of this ..