Questions Tagged with #Antivirus integration

CodeIgniter: Unable to connect to your database server using the provided settings Error Message

I have been using CI just fine using the MySQL driver. I want to use the MySQL driver instead, but as soon as I change it (just add the ‘i’ at the end of MySQL, and added the port number) I get th..

Find row in datatable with specific id

I have two columns in a datatable: ID, Calls. How do I find what the value of Calls is where ID = 5? 5 could be anynumber, its just for example. Each row has a unique ID. ..

Convert row to column header for Pandas DataFrame,

The data I have to work with is a bit messy.. It has header names inside of its data. How can I choose a row from an existing pandas dataframe and make it (rename it to) a column header? I want to do..

Find the most common element in a list

What is an efficient way to find the most common element in a Python list? My list items may not be hashable so can't use a dictionary. Also in case of draws the item with the lowest index should be ..

"implements Runnable" vs "extends Thread" in Java

From what time I've spent with threads in Java, I've found these two ways to write threads: With implements Runnable: public class MyRunnable implements Runnable { public void run() { //..

Should I check in folder "node_modules" to Git when creating a Node.js app on Heroku?

I followed the basic getting started instructions for Node.js on Heroku here: https://devcenter.heroku.com/categories/nodejs These instruction don't tell you to create a .gitignore node_modules, and t..

How can I find matching values in two arrays?

I have two arrays, and I want to be able to compare the two and only return the values that match. For example both arrays have the value cat so that is what will be returned. I haven't found anything..

React.js: How to append a component on click?

I'm new to React and I'm puzzled on something kind of basic. I need to append a component to the DOM after the DOM is rendered, on a click event. My initial attempt is as follows, and it doesn't wor..

Multiple -and -or in PowerShell Where-Object statement

PS H:\> Invoke-Command -computername SERVERNAME { Get-ChildItem -path E:\dfsroots\datastore2\public} | Where-Object {{ $_.e xtension-match "xls" -or $_.extension-match "xlk" } -and { $_.creationti..

creating a random number using MYSQL

I would like to know is there a way to select randomly generated number between 100 and 500 along with a select query. Eg: SELECT name, address, random_number FROM users I dont have to store this n..

Unfortunately MyApp has stopped. How can I solve this?

I am developing an application, and everytime I run it, I get the message: Unfortunately, MyApp has stopped. What can I do to solve this? About this question - obviously inspired by What is a..

Set System.Drawing.Color values

Hi how to set R G B values in System.Drawing.Color.G ? which is like System.Drawing.Color.G=255; is not allowed because its read only Property or indexer 'System.Drawing.Color.G' cannot be assigned..

Rotating a point about another point (2D)

I'm trying to make a card game where the cards fan out. Right now to display it Im using the Allegro API which has a function: al_draw_rotated_bitmap(OBJECT_TO_ROTATE,CENTER_X,CENTER_Y,X ,Y,D..

How to query MongoDB with "like"?

I want to query something with SQL's like query: SELECT * FROM users WHERE name LIKE '%m%' How to do I achieve the same in MongoDB? I can't find an operator for like in the documentation...

Relative URLs in WordPress

I've always found it frustrating in WordPress that images, files, links, etc. are inserted into WordPress with an absolute URL instead of relative URL. A relative url is much more convenient for switc..

IO Error: The Network Adapter could not establish the connection

I am new to Oracle, and am trying to run a simple example code with Java, but am getting this error when executing the code.. I am able to start up the listener via CMD and am also able to run SQL Plu..

Powershell Get-ChildItem most recent file in directory

We produce files with date in the name. (* below is the wildcard for the date) I want to grab the last file and the folder that contains the file also has a date(month only) in its title. I am using ..

How do you pass a function as a parameter in C?

I want to create a function that performs a function passed by parameter on a set of data. How do you pass a function as a parameter in C?..

Prevent screen rotation on Android

I have one of my activities which I would like to prevent from rotating because I'm starting an AsyncTask, and screen rotation makes it restart. Is there a way to tell this activity "DO NOT ROTATE th..

Connect to SQL Server database from Node.js

The question duplicates some older questions, but the things may have changed since then. Is there some official support for connecting to SQL Server from Node.js (e.g. official library from MS)? Or ..

Is it possible to play music during calls so that the partner can hear it ? Android

I'm trying to make and app like Call Cheater(Originally developed for Symbian OS) Is it possible to play a music during a phone conversation where receiver and caller should hear the same sound or mu..

How to exclude a directory from ant fileset, based on directories contents

How can I create an ant fileset which excludes certain directories based on the contents of the directory? I use ant to create a distribution jar which has each localization in separate directories, ..

How to grey out a button?

I have a button defined as shown below. When I want to disable it I use my_btn.setEnabled(false), but I would also like to grey it out. How can I do that? Thanks <Button android:id="@+id/buy_btn"..

Mysql service is missing

I have installed Mysql server locally and everything was working Ok but today when I tried to get a connection to the local db, I got an error. After checking services showed that the MySql service is..

Stopping Docker containers by image name - Ubuntu

On Ubuntu 14.04 (Trusty Tahr) I'm looking for a way to stop a running container and the only information I have is the image name that was used in the Docker run command. Is there a command to..

How do you generate a random double uniformly distributed between 0 and 1 from C++?

How do you generate a random double uniformly distributed between 0 and 1 from C++? Of course I can think of some answers, but I'd like to know what the standard practice is, to have: Good standard..

Number of occurrences of a character in a string

I am trying to get the number of occurrences of a certain character such as & in the following string. string test = "key1=value1&key2=value2&key3=value3"; How do I determine that there..

Check if Cell value exists in Column, and then get the value of the NEXT Cell

After checking if a cell value exists in a column, I need to get the value of the cell next to the matching cell. For instance, I check if the value in cell A1 exists in column B, and assuming it matc..

TypeError: got multiple values for argument

I read the other threads that had to do with this error and it seems that my problem has an interesting distinct difference than all the posts I read so far, namely, all the other posts so far have th..

How to print to console when using Qt

I'm using Qt4 and C++ for making some programs in computer graphics. I need to be able to print some variables in my console at run-time, not debugging, but cout doesn't seem to work even if I add the..

T-SQL get SELECTed value of stored procedure

In T-SQL, this is allowed: DECLARE @SelectedValue int SELECT @SelectedValue = MyIntField FROM MyTable WHERE MyPrimaryKeyField = 1 So, it's possible to get the value of a SELECT and stuff it in a va..

jQuery callback for multiple ajax calls

I want to make three ajax calls in a click event. Each ajax call does a distinct operation and returns back data that is needed for a final callback. The calls themselves are not dependent on one anot..

Remove trailing comma from comma-separated string

I got String from the database which have multiple commas (,) . I want to remove the last comma but I can't really find a simple way of doing it. What I have: kushalhs, mayurvm, narendrabz, What I w..

What is causing this error - "Fatal error: Unable to find local grunt"

I removed the old version of grunt first, then I installed the new grunt version, and then I got this error: D:\www\grunt-test\grunt grunt-cli: The grunt command line interface. (v0.1.4) Fa..

placeholder for select tag

Is it possible to have a placeholder on a select tag? <select placeholder="select your beverage"> <option>Tea</option> <option>coffee</option> <option>..

Split an integer into digits to compute an ISBN checksum

I'm writing a program which calculates the check digit of an ISBN number. I have to read the user's input (nine digits of an ISBN) into an integer variable, and then multiply the last digit by 2, the ..

How to remove listview all items

In my app, if you click on a button then i want to remove all the listview items. Here, i am using the base adapter for adding the items to the list view. How can i remove the listview items dynamic..

How do I get the row count of a Pandas DataFrame?

I'm trying to get the number of rows of dataframe df with Pandas, and here is my code. Method 1: total_rows = df.count print total_rows + 1 Method 2: total_rows = df['First_columnn_label'].count prin..

How would I find the second largest salary from the employee table?

How would I go about querying for the second largest salary from all employees in my Employee table?..

java.lang.Exception: No runnable methods exception in running JUnits

I am trying to run the JUnit on my Linux command prompt /opt/junit/ contains the necessary JARS(hamcrest-core-1.3.jar and junit.jar) and class files and I am using the following command to run the JUn..

How can I add a space in between two outputs?

This is the code I am working with. public void displayCustomerInfo() { System.out.println(Name + Income); } I use a separate main method with this code to call the method above: first.displa..

How to Decode Json object in laravel and apply foreach loop on that in laravel

i am getting this request.    { "area": [ { "area": "kothrud" }, { "area": "katraj" } ] } and i want to provide response to this by se..

Access iframe elements in JavaScript

I have a webpage where there is a textarea within an iframe. I need to read the value of this textarea from its child page using JavaScript. Presently by using window.parent.getelementbyID().value in..

hidden field in php

For hidden fields, can i use a field of the type <input type="hidden" name="field_name" value="<?php print $var; ?>"/> and retrieve it after the GET / POST method as $_GET['field_name']..

What are the benefits of learning Vim?

As a programmer I spend a lot of hours at the keyboard and I've been doing it for the last 12 years, more or less. If there's something I've never gotten used to during all this time, it's these annoy..

Powershell folder size of folders without listing Subdirectories

I have found several resources that use the following script to get folder sizes $colItems = (Get-ChildItem $startFolder -recurse | Where-Object {$_.PSIsContainer -eq $True} | Sort-Object) foreach ($..

CSS: How can I set image size relative to parent height?

I am trying to figure out how to re-size an image so that it keeps it ratio of width to height, but gets re-sized until the height of the image matches the height of the containing div. I have these i..

Find index of last occurrence of a substring in a string

I want to find the position (or index) of the last occurrence of a certain substring in given input string str. For example, suppose the input string is str = 'hello' and the substring is target = 'l..

Python Matplotlib Y-Axis ticks on Right Side of Plot

I have a simple line plot and need to move the y-axis ticks from the (default) left side of the plot to the right side. Any thoughts on how to do this?..

Modifying location.hash without page scrolling

We've got a few pages using ajax to load in content and there's a few occasions where we need to deep link into a page. Instead of having a link to "Users" and telling people to click "settings" it's ..

How to scan multiple paths using the @ComponentScan annotation?

I'm using Spring 3.1 and bootstrapping an application using the @Configuration and @ComponentScan attributes. The actual start is done with new AnnotationConfigApplicationContext(MyRootConfiguration..

Start an external application from a Google Chrome Extension?

How to start an external application from a Google Chrome Extension? So basically I have an executable file which does the job when you launch it. I need to be able to start it without a window (it i..

How to convert a string into double and vice versa?

I want to convert a string into a double and after doing some math on it, convert it back to a string. How do I do this in Objective-C? Is there a way to round a double to the nearest integer too?..

Cygwin Make bash command not found

I installed cygwin with all the packages on windows 7 64 bit. For some reason the make command is giving me an error: bash make: command not found. I checked and in my bin folder, there is no make.exe..

How to pass the password to su/sudo/ssh without overriding the TTY?

I'm writing a C Shell program that will be doing su or sudo or ssh. They all want their passwords in console input (the TTY) rather than stdin or the command line. Does anybody know a solution? Sett..

How do I compare two files using Eclipse? Is there any option provided by Eclipse?

How do I compare two files using Eclipse? (Currently I am using WinMerge.)..

How do I catch an Ajax query post error?

I would like to catch the error and show the appropriate message if the Ajax request fails. My code is like the following, but I could not manage to catch the failing Ajax request. function getAjaxD..

Nginx 403 forbidden for all files

I have nginx installed with PHP-FPM on a CentOS 5 box, but am struggling to get it to serve any of my files - whether PHP or not. Nginx is running as www-data:www-data, and the default "Welcome to ng..

Oracle listener not running and won't start

I am getting the following errors while from the lsnrctl status command: C:\Users\pna105>lsnrctl stat LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 08-OCT-2014 17:53 :55 Copy..

How do you comment an MS-access Query?

How does one add a comment to an MS Access Query, to provide a description of what it does? Once added, how can one retrieve such comments programmatically?..

How many concurrent AJAX (XmlHttpRequest) requests are allowed in popular browsers?

In Firefox 3, the answer is 6 per domain: as soon as a 7th XmlHttpRequest (on any tab) to the same domain is fired, it is queued until one of the other 6 finish. What are the numbers for the other ma..

Converting milliseconds to minutes and seconds with Javascript

Soundcloud's API gives the duration of it's tracks as milliseconds. JSON looks like this: "duration": 298999 I've tried many functions I found on here to no avail. I'm just looking for something to..

How to use adb pull command?

Possible Duplicate: How to copy selected files from Android with adb pull I am using adb pull command like this: adb pull /sdcard/*.trace C:/ but i show me remote object '/sdcard/*.trace..

calculating number of days between 2 columns of dates in data frame

I have a data frame which has two columns of dates in the format yyyy/mm/dd. I am trying to calculate the number of days between these two dates for each observation within the data frame (and create ..

Android global variable

How can I create global variable keep remain values around the life cycle of the application regardless which activity running...

Creating a file name as a timestamp in a batch job

We have a batch job that runs every day and copies a file to a pickup folder. I want to also take a copy of that file and drop it into an archive folder with the filename yyyy-MM-dd.log What's the..

including parameters in OPENQUERY

How can I use a parameter inside sql openquery, such as: SELECT * FROM OPENQUERY([NameOfLinkedSERVER], 'SELECT * FROM TABLENAME where field1=@someParameter') T1 INNER JOIN MYSQLSERVER.DATABASE.DBO.T..

Table with fixed header and fixed column on pure css

I need to create a html table (or something similar looking) with a fixed header and a fixed first column. Every solution I've seen so far uses Javascript or jQuery to set scrollTop/scrollLeft, but ..

A transport-level error has occurred when receiving results from the server

I'm getting a SQL Server error: A transport-level error has occurred when receiving results from the server. (provider: Shared Memory Provider, error: 0 - The handle is invalid.) I'm run..

Set session variable in laravel

I would like to set a variable in the session using laravel this way Session::set('variableName')=$value; but the problem is that I don't know where to put this code, 'cause I would like to set it ..

Textarea that can do syntax highlighting on the fly?

I am storing a number of HTML blocks inside a CMS for reasons of easier maintenance. They are represented by <textarea>s. Does anybody know a JavaScript Widget of some sort that can do syntax h..

How to find the largest file in a directory and its subdirectories?

We're just starting a UNIX class and are learning a variety of Bash commands. Our assignment involves performing various commands on a directory that has a number of folders under it as well. I know..

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

How does OAuth 2 protect against things like replay attacks using the Security Token?

As I understand it, the following chain of events occurs in OAuth 2 in order for Site-A to access User's information from Site-B. Site-A registers on Site-B, and obtains a Secret and an ID. When Use..

How do you do a limit query in JPQL or HQL?

In Hibernate 3, is there a way to do the equivalent of the following MySQL limit in HQL? select * from a_table order by a_table_column desc limit 0, 20; I don't want to use setMaxResults if possibl..

Renaming files using node.js

I am quite new in using JS, so I will try to be as specific as I can :) I have a folder with 260 .png files with different country names: Afghanistan.png, Albania.png, Algeria.png, etc. I have a .js..

Capturing mobile phone traffic on Wireshark

How can I capture mobile phone traffic on Wireshark?..

How to change CSS using jQuery?

I am trying to change the CSS using jQuery: _x000D_ _x000D_ $(init);_x000D_ _x000D_ function init() {_x000D_ $("h1").css("backgroundColor", "yellow");_x000D_ $("#myParagraph").css({"backg..

python pandas remove duplicate columns

What is the easiest way to remove duplicate columns from a dataframe? I am reading a text file that has duplicate columns via: import pandas as pd df=pd.read_table(fname) The column names are: T..

Regular expression for a string that does not start with a sequence

I'm processing a bunch of tables using this program, but I need to ignore ones that start with the label "tbd_". So far I have something like [^tbd_] but that simply not match those characters. ..

Grep and Python

I need a way of searching a file using grep via a regular expression from the Unix command line. For example when I type in the command line: python pythonfile.py 'RE' 'file-to-be-searched' I need ..

Angular ng-class if else

I'd like to know how to do to make the False ng-class. page.isSelected(1) is TRUE if the page if the page is selected, else FALSE <div id="homePage" ng-class="{ center: page.isSelected(1) }"> ..

Difference between DTO, VO, POJO, JavaBeans?

Have seen some similar questions: What is the difference between a JavaBean and a POJO? What is the Difference Between POJO (Plain Old Java Object) and DTO (Data Transfer Object)? Can you also ple..

How to get directory size in PHP

function foldersize($path) { $total_size = 0; $files = scandir($path); foreach($files as $t) { if (is_dir(rtrim($path, '/') . '/' . $t)) { if ($t<>"." && $t<>"..")..

Making an API call in Python with an API that requires a bearer token

Looking for some help with integrating a JSON API call into a Python program. I am looking to integrate the following API into a Python .py program to allow it to be called and the response to be pri..

Bootstrap full responsive navbar with logo or brand name text

I would like to do a full responsive navbar with specified height in Twitter Bootstrap 3.1.1, where the brand could consists of image (logo) or text. html: <nav class="navbar navbar-inverse navb..

Storing a file in a database as opposed to the file system?

Generally, how bad of a performance hit is storing a file in a database (specifically mssql) as opposed to the file system? I can't come up with a reason outside of application portability that I wou..

Enable/disable buttons with Angular

I'm making an web-app in angular 4 and there is a question i came up with. It's the following: I use a property called currentLesson. This property has a variable number from 1 to 6. In my component..

How do I get the XML SOAP request of an WCF Web service request?

I'm calling this web service within code and I would like to see the XML, but I can't find a property that exposes it...

Only allow Numbers in input Tag without Javascript

I am fairly new. I am creating a webpage that ask a user for their ID. I want it to be a required field and only allow numbers. I appreciate if you lead me in the correct direction. this is what I ha..

bootstrap popover not showing on top of all elements

I'm working on a bootstrap site and after updating to bootstrap 2.2 from 2.0 everything worked except the popover. The popovers still show up fine, but they don't show up on top of all other elements..

AVD Manager - Cannot Create Android Virtual Device

I just installed the Android Eclipse Plugin and the Android SDK from Google yesterday. I open the AVD Manager window by going to Window -> Android Virtual Device Manager. I then click "New" and am ..

How to format background color using twitter bootstrap?

I am playing with the styles on the website here: http://www.grabapper.com I am trying to include background-color #2ba6cb on the hero unit. When I include: <div class="row" style ='background-c..

wamp server mysql user id and password

I have wamp installed , I want to know how to create username and password in mysql...

Get Cell Value from a DataTable in C#

Here is a DataTable dt, which has lots of data. I want to get the specific Cell Value from the DataTable, say Cell[i,j]. Where, i -> Rows and j -> Columns. I will iterate i,j's value with two forlo..

Android basics: running code in the UI thread

In the viewpoint of running code in the UI thread, is there any difference between: MainActivity.this.runOnUiThread(new Runnable() { public void run() { Log.d("UI thread", "I am the UI th..

Mongoose delete array element in document and save

I have an array in my model document. I would like to delete elements in that array based on a key I provide and then update MongoDB. Is this possible? Here's my attempt: var mongoose = require('..

What causes signal 'SIGILL'?

I'm porting some C++ code to Android using NDK and GCC. The code basically runs. At one point, when debugging in Eclipse, the call Dabbler::Android::Factory* pFactory = new Dabbler::Android::Factory;..

Best way to store chat messages in a database?

I'm building a chat app and I want a full history off all messages ever sent in the chat conversation. At the moment I am storing each message as a single row in a table called 'messages'. I am aware ..

Android, canvas: How do I clear (delete contents of) a canvas (= bitmaps), living in a surfaceView?

In order to make a simple game, I used a template that draws a canvas with bitmaps like this: private void doDraw(Canvas canvas) { for (int i=0;i<8;i++) for (int j=0;j<9;j++) ..

Get full path of a file with FileUpload Control

I am working on a web application which uses the FileUpload control. I have an xls file in the full filepath 'C:\Mailid.xls' that I am attempting to upload. When I use the command FileUpload1.Poste..

Is there a timeout for idle PostgreSQL connections?

1 S postgres 5038 876 0 80 0 - 11962 sk_wai 09:57 ? 00:00:00 postgres: postgres my_app ::1(45035) idle 1 ..

Difference between jar and war in Java

What is the difference between a .jar and a .war file? Is it only the file extension or is there something more?..

Calling UserForm_Initialize() in a Module

How can I call UserForm_Initialize() in a Module instead of the UserForm code object?..

How do I create a transparent Activity on Android?

I want to create a transparent Activity on top of another activity. How can I achieve this?..

Get img src with PHP

I would like to get the SRC attribute into a variable in this example: <img border="0" src="/images/image.jpg" alt="Image" width="100" height="100" /> So for example - I would like to get a v..

How to change menu item text dynamically in Android

I'm trying to change the title of a menu item from outside of the onOptionsItemSelected(MenuItem item) method. I already do the following; public boolean onOptionsItemSelected(MenuItem item) { try..

How to mark a build unstable in Jenkins when running shell scripts

In a project I'm working on, we are using shell scripts to execute different tasks. Some are sh/bash scripts that run rsync, and some are PHP scripts. One of the PHP scripts is running some integratio..

Transitions on the CSS display property

I'm currently designing a CSS 'mega dropdown' menu - basically a regular CSS-only dropdown menu, but one that contains different types of content. At the moment, it appears that CSS 3 transition..

Changing Jenkins build number

Is there a way to change the build number that is sent via email after a job completes? The problem is that are product builds are NOT being done by Jenkins, so we want to be able to get the build nu..

PHP foreach change original array values

I am very new in multi dimensional arrays, and this is bugging me big time. My array is as following: $fields = array( "names" => array( "type" => "text", "class"..

Find duplicate values in R

I have a table with 21638 unique* rows: vocabulary <- read.table("http://socserv.socsci.mcmaster.ca/jfox/Books/Applied-Regression-2E/datasets/Vocabulary.txt", header=T) This table has five colum..

$(document).ready shorthand

Is the following shorthand for $(document).ready? (function($){ //some code })(jQuery); I see this pattern used a lot, but I'm unable to find any reference to it. If it is shorthand for $(documen..

Could not load file or assembly 'System.Data.SQLite'

I've installed ELMAH 1.1 .Net 3.5 x64 in my ASP.NET project and now I'm getting this error (whenever I try to see any page): Could not load file or assembly 'System.Data.SQLite, Version=1.0.61.0..

Set value of textarea in jQuery

I am attempting to set a value in a textarea field using jquery with the following code: $("textarea#ExampleMessage").attr("value", result.exampleMessage); The issue is, once this code executes, it..

Flexbox not working in Internet Explorer 11

This piece of code works fine in Firefox, Chrome and Edge, but it does not work properly in IE11 because of flex model, apparently. How can I fix it? This is how it looks in Firefox This is how it..

INNER JOIN in UPDATE sql for DB2

Is there a way to use joins in update statements for DB2? Google has really let me down on this one This is roughly what I'm trying to achieve (... except obviously working ....) update file1 inner..

Change URL parameters

I have this URL: site.fwx?position=1&archiveid=5000&columns=5&rows=20&sorting=ModifiedTimeAsc what I need is to be able to change the 'rows' url param value to something i specify, ..

Conditional WHERE clause in SQL Server

I am creating a SQL query in which I need a conditional where clause. It should be something like this: SELECT DateAppr, TimeAppr, TAT, LaserLTR, Permit, LtrPrinter, J..

How to hide elements without having them take space on the page?

I'm using visibility:hidden to hide certain elements, but they still take up space on the page while hidden. How can I make them totally disappear visually, as though they are not in the DOM at all (..

Eclipse: How to build an executable jar with external jar?

I am trying to build an executable jar program which depends on external jar downloaded. In my project, I included them in the build path and can be run and debug within eclipse. When I tried to expo..

How do I escape a single quote in SQL Server?

I'm trying to insert some text data into a table in SQL Server 9. The text includes a single quote('). How do I escape that? I tried using two single quotes, but it threw me some errors. eg. inser..

angular.service vs angular.factory

I have seen both angular.factory() and angular.service() used to declare services; however, I cannot find angular.service anywhere in official documentation. What is the difference between the two me..

How do I kill a VMware virtual machine that won't die?

I've got a virtual machine running on a server that I can't stop or reboot - I can't log onto it anymore and I can't stop it using the VMware server console. There are other VM's running so rebooting..

How to change an application icon programmatically in Android?

Is it possible to change an application icon directly from the program? I mean, change icon.png in the res\drawable folder. I would like to let users to change application's icon from the program so n..

Android WebView progress bar

I have looked at a question similar to this here but as I am a newbie could someone explain how to get this to work in a WebView or at least how to set a 10 second time delay so people know that it's ..

PHP Regex to check date is in YYYY-MM-DD format

I'm trying to check that dates entered by end users are in the YYYY-MM-DD. Regex has never been my strong point, I keep getting a false return value for the preg_match() I have setup. So I'm assuming..

Can I call an overloaded constructor from another constructor of the same class in C#?

Can I call an overloaded constructor from another constructor of the same class in C#?..

How to set selected item of Spinner by value, not by position?

I have a update view, where I need to preselect the value stored in database for a Spinner. I was having in mind something like this, but the Adapter has no indexOf method, so I am stuck. void setSp..

How to detect when a youtube video finishes playing?

I am working on a site that has a ton of embedded youtube videos, the client wants to show a popup whenever a video stops splaying. I looked at the youtube api and there seems to be a way to detect w..

Why does ANT tell me that JAVA_HOME is wrong when it is not?

I get the error: C:\dev\ws\springapp\build.xml:81: Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath. Perhaps JAVA_HOME does not point to the JDK. It is currently set..

Error loading MySQLdb Module 'Did you install mysqlclient or MySQL-python?'

I am using windows 10 command line for a django project using python34 however, I am facing difficulties with SQL. I have already installed mysqlclient using pip install mysqlclient==1.3.5 and locat..

Any good, visual HTML5 Editor or IDE?

Well it looks like Dreamweaver CS5 will try to smoother the HTML5 thing for a few more years (weeks actually). Seems like the next rung down is right to Notepad! Anyone know a good HTML5 editor with ..

Create array of regex matches

In Java, I am trying to return all regex matches to an array but it seems that you can only check whether the pattern matches something or not (boolean). How can I use a regex match to form an array ..

How to refer environment variable in POM.xml?

I am using maven as build tool. I have set an environment variable called env. How can I get access to this environment variable's value in the pom.xml file?..

What is the difference between square brackets and parentheses in a regex?

Here is a regular expression I created to use in JavaScript: var reg_num = /^(7|8|9)\d{9}$/ Here is another one suggested by my team member. var reg_num = /^[7|8|9][\d]{9}$/ The rule is to valid..

MS SQL compare dates?

I have 2 dates (datetimes): date1 = 2010-12-31 15:13:48.593 date2 = 2010-12-31 00:00:00.000 Its the same day, just different times. Comparing date1 and date2 using <= doesnt work because of the d..

Completely Remove MySQL Ubuntu 14.04 LTS

I somehow have messed up my MySQL on my Ubuntu server and cannot fix it. I have tried every single combination of apt-get remove --purge mysql-server, apt-get autoremove, apt-get purge, Googled for ho..

How to change collation of database, table, column?

The database is latin1_general_ci now and I want to change collation to utf8mb4_general_ci. Is there any setting in PhpMyAdmin to change collation of database, table, column? Rather than changing one..

Callback when CSS3 transition finishes

I'd like to fade out an element (transitioning its opacity to 0) and then when finished remove the element from the DOM. In jQuery this is straight forward since you can specify the "Remove" to happe..

How to connect access database in c#

I have access database file with 7 tables in it but I don't know how to connect and show all tables, If some one can help me? this is my code but it doesn't show anything private void button1_Click..

How different is Objective-C from C++?

What are the main differences between Objective-C and C++ in terms of the syntax, features, paradigms, frameworks and libraries? *Important: My goal is not to start a performance war between the two ..

c# open a new form then close the current form?

For example, Assume that I'm in form 1 then I want: Open form 2( from a button in form 1) Close form 1 Focus on form 2 ..

How to do multiple line editing?

I want to edit multiple lines in eclipse, but I can't find any short cut or Plugin. In Geany I just press ctrl+alt+up/down I can add / edit multiple lines. Maybe this example can explain what I mean:..

How do you easily horizontally center a <div> using CSS?

I'm trying to horizontally center a <div> block element on a page and have it set to a minimum width. What is the simplest way to do this? I want the <div> element to be inline with rest o..

Boolean operators && and ||

According to the R language definition, the difference between & and && (correspondingly | and ||) is that the former is vectorized while the latter is not. According to the help text, I ..

Netbeans how to set command line arguments in Java

I am trying to set command line arguments in a Netbeans 7.1 Java project on Windows 7 64 bit. Netbeans is not passing the arguments I give it. I go to Project --> Properties --> Run --> and type th..

Programmatically add new column to DataGridView

I have a DataGridView bound to a DataTable. The DataTable is populated from a database query. The table contains a column named BestBefore. BestBefore is a date formatted as a string (SQLite doesn't h..

Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'

I am getting the Error System.IO.FileLoadException : Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its depende..

JQuery, setTimeout not working

I'm still new to JQuery, on the way to getting my ajax example to work i got stalled with setTimeout. I have broken it down to to where it should add "." to the div every second. The relevant code ..

JSON: why are forward slashes escaped?

The reason for this "escapes" me. JSON escapes the forward slash, so a hash {a: "a/b/c"} is serialized as {"a":"a\/b\/c"} instead of {"a":"a/b/c"}. Why?..

SQL Select between dates

I am running sqlite to select data between two ranges for a sales report. To select the data from between two dates I use the following statement: SELECT * FROM test WHERE date BETWEEN "11/1/2011"..

EF LINQ include multiple and nested entities

Ok, I have tri-leveled entities with the following hierarchy: Course -> Module -> Chapter Here was the original EF LINQ statement: Course course = db.Courses .Include(i => i.Modul..

URL Encoding using C#

I have an application which sends a POST request to the VB forum software and logs someone in (without setting cookies or anything). Once the user is logged in I create a variable that creates a path..

Sql Server equivalent of a COUNTIF aggregate function

I'm building a query with a GROUP BY clause that needs the ability to count records based only on a certain condition (e.g. count only records where a certain column value is equal to 1). SELECT UID..

Difference between dates in JavaScript

How to find the difference between two dates?..

How can I disable mod_security in .htaccess file?

How can we disable mod_security by using .htaccess file on Apache server? I am using WordPress on my personal domain and posting a post which content has some code block and as per my hosting provide..

Differences between Emacs and Vim

Without getting into a religious argument about why one is better than the other, what are the practical differences between Emacs and Vim? I'm looking to learn one or the other, but I realize the lea..

Moving items around in an ArrayList

I've been playing around with ArrayLists. What I'm trying to achieve is a method to do something like this: Item 1 Item 2 Item 3 Item 4 I'm trying to be able to move items up in the list, unless it..

Are the days of passing const std::string & as a parameter over?

I heard a recent talk by Herb Sutter who suggested that the reasons to pass std::vector and std::string by const & are largely gone. He suggested that writing a function such as the following is ..

Updating a JSON object using Javascript

How can i update the following JSON object dynamically using javascript or Jquery? var jsonObj = [{'Id':'1','Username':'Ray','FatherName':'Thompson'}, {'Id':'2','Username':'Steve','F..

SQL Server Pivot Table with multiple column aggregates

I've got a table: create table mytransactions(country varchar(30), totalcount int, numericmonth int, chardate char(20), totalamount money) The table has these records: insert into mytransactions(..

usr/bin/ld: cannot find -l<nameOfTheLibrary>

I'm trying to compile my program and it returns this error : usr/bin/ld: cannot find -l<nameOfTheLibrary> in my makefile I use the command g++ and link to my library which is a symbolic link ..

Mapping two integers to one, in a unique and deterministic way

Imagine two positive integers A and B. I want to combine these two into a single integer C. There can be no other integers D and E which combine to C. So combining them with the addition operator do..

What's the best way to determine which version of Oracle client I'm running?

The subject says it all: What is the best way to determine the exact version of the oracle client I'm running? Our clients are all running Windows. I found one suggestion to run the tnsping utility..

:after and :before pseudo-element selectors in Sass

How can I use the :before and :after pseudo-element selectors following the syntax of Sass or, alternatively, SCSS? Like this: p margin: 2em auto > a color: red :before content: "" ..

Can I change the Android startActivity() transition animation?

I am starting an activity and would rather have a alpha fade-in for startActivity(), and a fade-out for the finish(). How can I go about this in the Android SDK?..

How do I log a Python error with debug information?

I am printing Python exception messages to a log file with logging.error: import logging try: 1/0 except ZeroDivisionError as e: logging.error(e) # ERROR:root:division by zero Is it possib..

What is the best way to implement constants in Java?

I've seen examples like this: public class MaxSeconds { public static final int MAX_SECONDS = 25; } and supposed that I could have a Constants class to wrap constants in, declaring them static ..

Best way to detect when a user leaves a web page?

What is the best way to detect if a user leaves a web page? The onunload JavaScript event doesn't work every time (the HTTP request takes longer than the time required to terminate the browser). Cre..

Is ini_set('max_execution_time', 0) a bad idea?

Is there a good reason not to set the PHP configuration variable max_execution_time to 0? A coworker recently checked in a change to a file that added: ini_set('max_execution_time', 0); The defaul..

How can I format a number into a string with leading zeros?

I have a number that I need to convert to a string. First I used this: Key = i.ToString(); But I realize it's being sorted in a strange order and so I need to pad it with zeros. How could I do this..

Start a fragment via Intent within a Fragment

I want to launch a new fragment to view some data. Currently, I have a main activity that has a bunch of actionbar tabs, each of which is a fragment. So, within a tab fragment, I have a button, charts..

How to generate UL Li list from string array using jquery?

I have string array like 'United States', 'Canada', 'Argentina', 'Armenia', 'Aruba', 'Australia', 'Austria', 'Azerbaijan', 'Bahamas', 'Bangladesh', 'Belarus', 'Belgium'**, ... etc. I want c..

How do I delay a function call for 5 seconds?

I want widget.Rotator.rotate() to be delayed 5 seconds between calls... how do I do this in jQuery... it seems like jQuery's delay() wouldn't work for this.....

How to check if a String is numeric in Java

How would you check if a String was a number before parsing it?..

Enable CORS in fetch api

I am getting the following error message that unable me to continue Failed to load https://site/data.json: Response to preflight request doesn't pass access control check: No 'Access-Control-All..

Is calling destructor manually always a sign of bad design?

I was thinking: they say if you're calling destructor manually - you're doing something wrong. But is it always the case? Are there any counter-examples? Situations where it is neccessary to call it m..

convert xml to java object using jaxb (unmarshal)

I have the following XML and I need to convert it into a java object. <tests> <test-data> <title>BookTitle</title> <book>BookName</book> ..

How can I merge two commits into one if I already started rebase?

I am trying to merge 2 commits into 1, so I followed “squashing commits with rebase” from git ready. I ran git rebase --interactive HEAD~2 In the resulting editor, I change pick to squ..

Make page to tell browser not to cache/preserve input values

Most browsers cache form input values. So when the user refreshes a page, the inputs have the same values. Here's my problem. When a user clicks Save, the server validates POSTed data (e.g. checked p..

Differences between "java -cp" and "java -jar"?

What is the difference between running a Java application withjava -cp CLASSPATH and java -jar JAR_FILE_PATH? Is one of them preferred to the other for running a Java application? I mean which one of ..

Div height 100% and expands to fit content

I have a div element on my page with its height set to 100%. The height of the body is also set to 100%. The inner div has a background and all that and is different from the body background. This wo..

jQuery not working with IE 11

Object doesn't support property or method 'addEventListener' 'jQuery' is undefined I'm using IE 11, /jquery-2.1.1.min.js jquery-migrate-1.1.1.js and jquery-ui-1.11.0.custom/jquery-ui.js (theme..

How to convert a DataFrame back to normal RDD in pyspark?

I need to use the (rdd.)partitionBy(npartitions, custom_partitioner) method that is not available on the DataFrame. All of the DataFrame methods refer only to DataFrame results. So then how to c..

Is it possible to set UIView border properties from interface builder?

Is it possible to control UIView border properties (color, thickness, etc...) directly from interface builder or I can only do it programmatically?..

How to add a .dll reference to a project in Visual Studio

I am just beginning to use the MailSystem.NET library. However, I cannot figure out where to add the .dll files so I can reference the namespaces in my classes. Can someone please help me? I am using ..

GIT clone repo across local file system in windows

I am a complete Noob when it comes to GIT. I have been just taking my first steps over the last few days. I setup a repo on my laptop, pulled down the Trunk from an SVN project (had some issues with..

How to override Bootstrap's Panel heading background color?

I'm using a Panel from Bootstrap however for the heading I want to use my own background color for the heading. When I don't put panel-heading class for the div, the layout gets screwed. So I thought ..

How to check if AlarmManager already has an alarm set?

When my app starts, I want it to check if a particular alarm (registered via AlarmManager) is already set and running. Results from google seem to indicate that there is no way to do this. Is this sti..

How do I print bold text in Python?

How do I print bold text in Python? For example: print "hello" What should I do so that the text “hello” is displayed in bold?..

python error: no module named pylab

I am new to Python and want to use its plot functionality to create graphs. I am using ubuntu 12.04. I followed the Python installation steps from http://eli.thegreenplace.net/2011/10/10/installing-py..

How to use order by with union all in sql?

I tried the sql query given below: SELECT * FROM (SELECT * FROM TABLE_A ORDER BY COLUMN_1)DUMMY_TABLE UNION ALL SELECT * FROM TABLE_B It results in the following error: The ORDER BY clause ..

How to automatically crop and center an image

Given any arbitrary image, I want to crop a square from the center of the image and display it within a given square. This question is similar to this: CSS Display an Image Resized and Cropped, but I..

Bundler: Command not found

I am hosting on a vps, ubuntu 10.04, rails 3, ruby and mysql installed correctly by following some tutorials. If I run bundle check or bundle install I get the error '-bash: bundle: command not found'..

How to upgrade safely php version in wamp server

I downloaded latest wamp server and I installed in my system with php version 5.5.12 and now I want to upgrade php version to 5.5.27 with safely.. How can I upgrade?..

Making a UITableView scroll when text field is selected

After a lot of trial and error, I'm giving up and asking the question. I've seen a lot of people with similar problems but can't get all the answers to work right. I have a UITableView which is compo..

Create Local SQL Server database

I've used SQL Server Management Studio before, but only when the server is already up and running. I need to start from the beginning and create my own instance on the local computer. The instructio..

Java string split with "." (dot)

Why does the second line of this code throw ArrayIndexOutOfBoundsException? String filename = "D:/some folder/001.docx"; String extensionRemoved = filename.split(".")[0]; While this works: String ..

Refreshing data in RecyclerView and keeping its scroll position

How does one refresh the data displayed in RecyclerView (calling notifyDataSetChanged on its adapter) and make sure that the scroll position is reset to exactly where it was? In case of good ol' Lis..