Questions Tagged with #Declarative programming

Declarative programming is a paradigm of expressing the logic of a computer program or computation without explicit describing its control flow.

What is the difference between declarative and imperative paradigm in programming?

I have been searching the web looking for a definition for declarative and imperative programming that would shed some light for me. However, the language used at some of the resources that I have fou..

Computing cross-correlation function?

In R, I am using ccf or acf to compute the pair-wise cross-correlation function so that I can find out which shift gives me the maximum value. From the looks of it, R gives me a normalized sequence of..

Copy files on Windows Command Line with Progress

I need to copy files using Windows command-line (available on XP Pro or later by default) and show progress during the process. The progress indicator could be in a terminal or a GUI window. It is in..

How to convert a String into an array of Strings containing one character each

I have a small problem here.I need to convert a string read from console into each character of string. For example string: "aabbab" I want to this string into array of string.How would I do that? ..

What is the 'realtime' process priority setting for?

From what I've read in the past, you're encouraged not to change the priority of your Windows applications programmatically, and if you do, you should never change them to 'Realtime'. What does the 'R..

apache mod_rewrite is not working or not enabled

I have installed rewrite_module and modified php.ini on Apache. I create rewrite.php and .htaccess files, but it's not working. My filesystem folders like: /var/www/html /var/www/html/test /var/www..

jQuery UI dialog positioning

I am trying to use the jQuery dialog UI library in order to position a dialog next to some text when it is hovered over. The jQuery dialog takes a position parameter which is measured from the top le..

Setting Elastic search limit to "unlimited"

How can i get all the results from elastic search as the results only display limit to 10 only. ihave got a query like: @data = :load => true do size 15 query do..

CSS - center two images in css side by side

I am trying to center two images side by side, but for some reason it always displays the images beneath each other. Does anyone know how I could get them centered and next to each other? Thanks! HT..

jQuery: select an element's class and id at the same time?

I've got some links that I want to select class and id at the same time. This is because I've got 2 different behaviours. When a class of links got one class name they behave in one way, when the sam..

import sun.misc.BASE64Encoder results in error compiled in Eclipse

For this two imports; import sun.misc.BASE64Encoder; import sun.misc.BASE64Decoder; I got this error: Access restriction: The type BASE64Decoder is not accessible due to restriction on required li..

Bootstrap Modal before form Submit

I'm new to Modals, I have a Form and when the user clicks submit, It will show a Modal confirming if the user wants to submit, the modal also contains the user input from the form fields. I searched a..

C# difference between == and Equals()

I have a condition in a silverlight application that compares 2 strings, for some reason when I use == it returns false while .Equals() returns true. Here is the code: if (((ListBoxItem)lstBaseMenu...

Get path to execution directory of Windows Forms application

I would like to get the path to the execution directory of a Windows Forms application. (That is, the directory in which the executable is located.) Does anyone know of a built-in method in .NET to d..

Spring MVC: how to create a default controller for index page?

I'm trying to do one of those standard spring mvc hello world applications but with the twist that I'd like to map the controller to the root. (for example:

Validating input using java.util.Scanner

I'm taking user input from using a java.util.Scanner. I need to validate the input for things like: It must be a non-negative number It must be an alphabetical letter ... etc What's the ..

Javascript | Set all values of an array

Code var cool = new Array(3); cool[setAll] = 42; //cool[setAll] is just a pseudo selector.. alert(cool); Result A alert message: 42,42,42 How do I change/set all values of an array to a specifi..

Getting multiple keys of specified value of a generic Dictionary?

It's easy to get the value of a key from a .NET generic Dictionary: Dictionary<int, string> greek = new Dictionary<int, string>(); greek.Add(1, "Alpha"); greek.Add(2, "Beta"); string seco..

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

How can I run a windows batch file but hide the command window?

How can I run a windows batch file but hiding the command window? I dont want cmd.exe to be visible on screen when the file is being executed. Is this possible?..

Plotting two variables as lines using ggplot2 on the same graph

A very newbish question, but say I have data like this: test_data <- data.frame( var0 = 100 + c(0, cumsum(runif(49, -20, 20))), var1 = 150 + c(0, cumsum(runif(49, -10, 10))), date = ..

Open a Web Page in a Windows Batch FIle

I have a batch file that does a bunch of things and at the end needs to open up a web browser to a page. Is there a way to, in essence, call ShellExecute on a http to open the web page? Windows Comma..

Trigger event on body load complete js/jquery

I want to trigger one event on page load complete using javascript/jquery. Is there any way to trigger event or call a simple function once page loading fully completes. Please suggest folks if you ..

Fatal error: Call to undefined function: ldap_connect()

I get this error when using WAMP: Fatal error: Call to undefined function: ldap_connect() I have already edited the php.ini folder and enabled php_ldap.dll. For some reason only some of the ext..

Razor View throwing "The name 'model' does not exist in the current context"

After significant refactoring in my MVC 4 application, and Razor shows this error while debugging Views: The name 'model' does not exist in the current context. This is the offending line of cod..

How can I check a C# variable is an empty string "" or null?

I am looking for the simplest way to do a check. I have a variable that can be equal to "" or null. Is there just one function that can check if it's not "" or null?..

hasNext in Python iterators?

Haven't Python iterators got a hasNext method?..

Mixing a PHP variable with a string literal

Say I have a variable $test and it's defined as: $test = 'cheese' I want to output cheesey, which I can do like this: echo $test . 'y' But I would prefer to simplify the code to something more lik..

Short IF - ELSE statement

I'm trying to make my code more readable, so I decided to use some short IF statements. Here's my code which doesn't work ("not a statement"): jXPanel6.isVisible() ? jXPanel6.setVisible(true) : jXP..

Search and get a line in Python

Is there a way to search, from a string, a line containing another string and retrieve the entire line? For example: string = qwertyuiop asdfghjkl zxcvbnm token qwerty asdfghj..

Use underscore inside Angular controllers

How do I use underscore library inside angularjs controllers? On this post: AngularJS limitTo by last 2 records somebody suggested to assign an _ variable to the rootScope so that the library will b..

TypeError: ufunc 'add' did not contain a loop with signature matching types

I am creating bag of words representation of the sentence. Then taking the words that exist in the sentence to compare to the file "vectors.txt", in order to get their embedding vectors. After getting..

Error in eval(expr, envir, enclos) : object not found

I cannot understand what is going wrong here. data.train <- read.table("Assign2.WineComplete.csv",sep=",",header=T) # Building decision tree Train <- data.frame(residual.sugar=data.train$resid..

SSL handshake alert: unrecognized_name error since upgrade to Java 1.7.0

I upgraded from Java 1.6 to Java 1.7 today. Since then an error occur when I try to establish a connection to my webserver over SSL: handshake alert: unrecognized..

Default Activity not found in Android Studio

I just upgraded to Android Studio 0.2.8 and I am getting an error that says "Default Activity not found" when I try to edit the run configurations. When I launch Android Studio I get this error "Acce..

Read a plain text file with php

I have a text file with this information in my server: Data1 Data2 Data3 . . . DataN How do I read all the information from the text file (line by line) using PHP?..

How to get the list of all printers in computer

I need to get the list of all printers that connect to computer? How I can do it in C#, WinForms?..

How can I solve Exception in thread "main" java.lang.NullPointerException error

I am having a problem at a Java program. Exception in thread "main" java.lang.NullPointerException at twoten.TwoTenB.<init>( at javapractice.JavaPractice.main(

SQL grammar for SELECT MIN(DATE)

I have a table with structure: id(INT PK), title(VARCHAR), date(DATE) How do I select all distinct titles with their earliest date? Apparently, SELECT DISTINCT title, MIN(date) FROM table doesn't wo..

Should methods in a Java interface be declared with or without a public access modifier?

Should methods in a Java interface be declared with or without the public access modifier? Technically it doesn't matter, of course. A class method that implements an interface is always public. But ..

Is the buildSessionFactory() Configuration method deprecated in Hibernate

When I updated the Hibernate version from 3.6.8 to 4.0.0, I got a warning about deprecated method buildSessionFactory() in this line: private static final SessionFactory sessionFactory = new..

How to remove duplicate values from an array in PHP

How can I remove duplicate values from an array in PHP?..

C++ "Access violation reading location" Error

I have the following Vertex struct in a Graph class: struct Vertex { string country; string city; double lon; double lat; vector<edge> *adj; Vertex(string country, stri..

Running multiple AsyncTasks at the same time -- not possible?

I'm trying to run two AsyncTasks at the same time. (Platform is Android 1.5, HTC Hero.) However, only the first gets executed. Here's a simple snippet to describe my problem: public class AndroidJunk..

How to solve npm install throwing fsevents warning on non-MAC OS?

Following warning is being thrown on npm install command - npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\rea ct-scripts\node_modules\fsevents): npm WARN notsup SKIPPING..

git diff between cloned and original remote repository

I have cloned a github repository and made no changes locally. Github repository moved forward with commits on the same branch. How do I find a diff between my local repository and the original gith..

Android Button Onclick

OK I'm new to android dev's and Java, so I'm having problems with on click method here's my code. I know I've gotta be close, thanks in advance. All I want my button to do is, when its clicked on the ..

How to change facebook login button with my custom image

My script has code like this echo '<p class="wdfb_login_button"><fb:login-button scope="' . Wdfb_Permissions::get_permissions() . '" redirect-url="' . wdfb_get_login_redirect() . '..

Troubleshooting BadImageFormatException

I have a Windows service written in C# using Visual Studio 2010 and targeting the full .NET Framework 4. When I run from a Debug build the service runs as expected. However, when I run it from a Rel..

How do I REALLY reset the Visual Studio window layout?

I had a plugin installed in Visual Studio 2008, and it created some extra dockable windows. I have uninstalled it, and I can't get rid of the windows it created - I close them, but they always come b..

Split a large pandas dataframe

I have a large dataframe with 423244 lines. I want to split this in to 4. I tried the following code which gave an error? ValueError: array split does not result in an equal division for item in np.s..

The EXECUTE permission was denied on the object 'xxxxxxx', database 'zzzzzzz', schema 'dbo'

I'm having problems executing a function. Here's what I did: Create a function using SQL Server Management Studio. It was successfully created. I then tried executing the newly created function and..

Access props inside quotes in React JSX

In JSX, how do you reference a value from props from inside a quoted attribute value? For example: <img className="image" src="images/{this.props.image}" /> The resulting HTML output is: &l..

Display string as html in mvc view

I have a controller which generates a string containing html markup. When it displays on views, it is displayed as a simple string containing all tags. I tried to use an Html helper to encode/decode t..

how to get text from textview

if I have set text in textview in such way, which is not problem: tv.setText("" + ANS[i]); this simply getting from this way. String a = tv.getText().toString(); int A = Integer.parseI..

How to hide column of DataGridView when using custom DataSource?

I have a small app in c#, it has a DataGridView that gets filled using: grid.DataSource = MyDatasource array; MyClass hold the structure for the columns, it looks something like this: class MyDatas..

How to use Regular Expressions (Regex) in Microsoft Excel both in-cell and loops

How can I use regular expressions in Excel and take advantage of Excel's powerful grid-like setup for data manipulation? In-cell function to return a matched pattern or replaced value in a string. S..

how to make password textbox value visible when hover an icon

Good day all, I have a form that has a password field: <input type="password" name="password" size="30" /> Naturally, the input text will be replaced by (*). So if the user typed 123 the bo..

Using an authorization header with Fetch in React Native

I'm trying to use fetch in React Native to grab information from the Product Hunt API. I've obtained the proper Access Token and have saved it to State, but don't seem to be able to pass it along with..

Error in Eclipse: "The project cannot be built until build path errors are resolved"

I am a computer science student learning Java, so I do some work at home and at college on a mixture of Linux and Windows. I have a problem after copying a new project into the Eclipse workspace. The ..

WAMP error: Forbidden You don't have permission to access /phpmyadmin/ on this server

I am new to WAMP and I have just installed it today. The setup went well and localhost seems to work, but when I try to access phpMyAdmin I get this error: Forbidden You don't have permission t..

What is Scala's yield?

I understand Ruby and Python's yield. What does Scala's yield do?..

Adding items to an object through the .push() method

I'm doing a loop through few input elements of 'checkbox' type. After that, I'm adding values and checked attributes to an array. This is my code: var stuff = {}; $('form input[type=checkbox]').each(..

Owl Carousel Won't Autoplay

I'm using the Owl Carousel on my site. According to their documentation, this piece of JavaScript should work: <script> $("#intro").owlCarousel({ // Most important owl features //Autoplay aut..

disable a hyperlink using jQuery

<a href="gohere.aspx" class="my-link">Click me</a> I did $('.my-link').attr('disabled', true); but it didn't work Is there an easy way to disable the hyperlink using jquery? Remove ..

How to align content of a div to the bottom

Say I have the following CSS and HTML code: _x000D_ _x000D_ #header {_x000D_ height: 150px;_x000D_ }_x000D_ <div id="header">_x000D_ <h1>Header title</h1>_x000D_ Header conten..

How to convert a multipart file to File?

Can any one tell me what is a the best way to convert a multipart file (org.springframework.web.multipart.MultipartFile) to File ( ? In my spring mvc web project i'm getting uploaded fi..

What is a StackOverflowError?

What is a StackOverflowError, what causes it, and how should I deal with them?..

How to assign colors to categorical variables in ggplot2 that have stable mapping?

I've been getting up to speed with R in the last month. Here is my question: What is a good way to assign colors to categorical variables in ggplot2 that have stable mapping? I need consistent color..

PHP Get all subdirectories of a given directory

How can I get all sub-directories of a given directory without files, .(current directory) or ..(parent directory) and then use each directory in a function?..

Setting background colour of Android layout element

I am trying to, somewhat clone the design of an activity from a set of slides on Android UI design. However I am having a problem with a very simple task. I have created the layout as shown in the im..

jQuery: value.attr is not a function

I have this snipped in my page: $('#category_sorting_form_save').click(function(){ var elements = $("#category_sorting_elements > div"); $.each(elements, function(key, value) { con..

How to move up a directory with Terminal in OS X

When I launch a new Terminal window, it starts me in 'Macintosh HD/Users/MyName'. How can I back out of my user directory, back up to the top level?..

This version of Android Studio cannot open this project, please retry with Android Studio 3.4 or newer

This version of Android Studio cannot open this project, please retry with Android Studio 3.4 or newer. but my android studio version is 3.2.1 and there is no new update from Google..

PostgreSQL: Show tables in PostgreSQL

What's the equivalent to show tables (from MySQL) in PostgreSQL?..

How to bind a List to a ComboBox?

I want to connect a BindingSource to a list of class objects and then objects value to a ComboBox. Can anyone suggest how to do it? public class Country { public string Name { get; set; } pub..

Angular 2 - innerHTML styling

I am getting chunks of HTML codes from HTTP calls. I put the HTML blocks in a variable and insert it on my page with[innerHTML] but i can not style the inserted HTML block. Does anyone have any sugges..

Sort array by firstname (alphabetically) in Javascript

I got an array (see below for one object in the array) that I need to sort by firstname using JavaScript. How can I do it? var user = { bio: null, email: "[email protected]", firstname: "Anna..

Is "else if" faster than "switch() case"?

I'm an ex Pascal guy, currently learning C#. My question is the following: Is the code below faster than making a switch? int a = 5; if (a == 1) { .... } else if(a == 2) { .... } else if(a ..

PHP how to get the base domain/url?

function url(){ if(isset($_SERVER['HTTPS'])){ $protocol = ($_SERVER['HTTPS'] && $_SERVER['HTTPS'] != "off") ? "https" : "http"; } else{ $protocol = 'http'; } ..

Simple pagination in javascript

I am trying to make pagination for my site. ( CODE: var someVar = 50; function someStupidFunction() { if (objJson.length > 50) { document.getElemen..

How to merge a transparent png image with another image using PIL

I have a transparent png image "foo.png" and I've opened another image with im ="foo2.png"); now what i need is to merge foo.png with foo2.png. ( foo.png contains some text and I want..

Can't access Tomcat using IP address

I'm running a Tomcat 5.5 instance (port: 8089) on Windows 7. The server runs correctly if I open http://localhost:8089/ but it gives me an error (Connection refused) on I ..

IIS Manager in Windows 10

How do you open IIS (Internet Information Services) Manager using Windows 10? I have installed the developer preview of Windows 10 and can't seem to find IIS Manager? It is not in Control Panel > Ad..

Adding HTML entities using CSS content

How do you use the CSS content property to add HTML entities? Using something like this just prints &nbsp; to the screen instead of the non-breaking space: .breadcrumbs a:before { content: '..

Visual Studio Code - Convert spaces to tabs

I have both TypeScript and HTML files in my project, in both files tabs are converted to spaces. I want to turn the auto-conversion off and make sure that my project has only tabs. Edit: With this set..

Efficient way to apply multiple filters to pandas DataFrame or Series

I have a scenario where a user wants to apply several filters to a Pandas DataFrame or Series object. Essentially, I want to efficiently chain a bunch of filtering (comparison operations) together th..

What is the difference between join and merge in Pandas?

Suppose I have two DataFrames like so: left = pd.DataFrame({'key1': ['foo', 'bar'], 'lval': [1, 2]}) right = pd.DataFrame({'key2': ['foo', 'bar'], 'rval': [4, 5]}) I want to merge them, so I try s..

Convert pandas DataFrame into list of lists

I have a pandas data frame like this: admit gpa gre rank 0 3.61 380 3 1 3.67 660 3 1 3.19 640 4 0 2.93 520 4 Now I want to get a list of rows in pandas like: ..

Unable to Build using MAVEN with ERROR - Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile

I have been trying to build a code using maven. But I am stuck with an error. The code is available on this github repo. google-play-crawler My system configurations as shown by maven is followning: ..

How to calculate the number of days between two dates?

I am calculating the number of days between the 'from' and 'to' date. For example, if the from date is 13/04/2010 and the to date is 15/04/2010 the result should be How do I get the result using Jav..

How to list all functions in a Python module?

I have a Python module installed on my system and I'd like to be able to see what functions/classes/methods are available in it. I want to call the help function on each one. In Ruby I can do somethin..

How to use Tomcat 8 in Eclipse?

EDIT 2014-02-07: Eclipse Luna is here, and support for Tomcat 8 is included in the bundled WTP : ) Happy days! Tomcat 8 is still in development, but you can get it here. Now there is a RC version on ..

How to check if an email address is real or valid using PHP

I found some websites that claim to verify if email addresses are valid. Is it possible to check if an email address is valid using just PHP? <?php if($_POST['email'] != ''){ // The e..

How do I insert values into a Map<K, V>?

I am trying to create a map of strings to strings. Below is what I've tried but neither method works. What's wrong with it? public class Data { private final Map<String, String> data = new ..

What is "not assignable to parameter of type never" error in typescript?

Code is: const foo = (foo: string) => { const result = [] result.push(foo) } I get the following TS error: [ts] Argument of type 'string' is not assignable to parameter of type 'never'. ..

java.sql.SQLException: Fail to convert to internal representation

I'm trying execute following query: String query = "select entity, from Site entity"; List resultList = entityManager.createQuery(query).getResultList(); And take exception: [...] Cause..

Responsive iframe using Bootstrap

I am using Bootstrap. I have a text which contains 2 or 3 iframes based embed videos. This data is fetched from database. How can I make these iframes responsive? Example Code: <div class="row..

Count number of rows matching a criteria

I am looking for a command in R which is equivalent of this SQL statement. I want this to be a very simple basic solution without using complex functions OR dplyr type of packages. Select count(*) as..

How do I get the current date and time in PHP?

Which PHP function can return the current date/time?..

How can I use a custom font in Java?

I wrote a program in Java that uses a special font that by default doesn't exist on any operating system. Is it possible in Java to add this special font to the operation system? For example, in Wind..

SET NAMES utf8 in MySQL?

I often see something similar to this below in PHP scripts using MySQL query("SET NAMES utf8"); I have never had to do this for any project yet so I have a couple basic questions about it. I..

Java stack overflow error - how to increase the stack size in Eclipse?

I am running a program that I've written in Java in Eclipse. The program has a very deep level of recursion for very large inputs. For smaller inputs the program runs fine however when large inputs ar..

Running Jupyter via command line on Windows

I have installed Jupyter on Windows 10, Python 3.x via $ pip install jupyter The installation works fine, even though I did restart the terminal. But trying to run $ jupyter notebook gives the follo..

python dataframe pandas drop column using int

I understand that to drop a column you use df.drop('column name', axis=1). Is there a way to drop a column using a numerical index instead of the column name?..

How to cast List<Object> to List<MyClass>

This does not compile, any suggestion appreciated. ... List<Object> list = getList(); return (List<Customer>) list; Compiler says: cannot cast List<Object> to List<Custome..

how to start stop tomcat server using CMD?

I set the path for the tomcat and set all variables like JAVA_HOME=C:\Program Files (x86)\Java\jdk1.6.0_22 CATALINA_HOME=G:\springwork\server\apache-tomcat-6.0.29 CLASSPATH=G:\springwork\server\apac..

"Unmappable character for encoding UTF-8" error

I'm getting a compile error at the following method. public static boolean isValidPasswd(String passwd) { String reg = "^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[~#;:?/@&!\"'%*=¬.,-])(?=[^\\s]..

PostgreSQL : cast string to date DD/MM/YYYY

I'm trying to cast a CHARACTER VARYING column to a DATE but I need a date format like this : DD/MM/YYYY. I use the following SQL query : ALTER TABLE test ALTER COLUMN date TYPE DATE using to_date(da..

How to use RANK() in SQL Server

I have a problem using RANK() in SQL Server. Here’s my code: SELECT contendernum, totals, RANK() OVER (PARTITION BY ContenderNum ORDER BY totals ASC) AS xRank FROM ( SELECT Conte..

Find object in list that has attribute equal to some value (that meets any condition)

I've got list of objects. I want to find one (first or whatever) object in this list that has attribute (or method result - whatever) equal to value. What's is the best way to find it? Here's test cas..

Change NULL values in Datetime format to empty string

I have a table which contains 'NULL' values which are of type 'Datetime'. Now i have to convert those into empty string but when when i use convert function ISNULL( [Accrued Out of Default] ,'' ) h..

JS: Uncaught TypeError: object is not a function (onclick)

Edit: Here's a JSfiddle Edit2: The error is on this line: <input type="button" value="totalbandwidthresult" onclick="javascript:totalbandwidth();"> Trying to have a button perform a calculat..

Removing white space around a saved image in matplotlib

I need to take an image and save it after some process. The figure looks fine when I display it, but after saving the figure, I got some white space around the saved image. I have tried the 'tight' op..

How to set up java logging using a properties file? (java.util.logging)

I have a stupid java logging problem: I'm loading the logging configuration from my app configuration file - but it just doesn't log anything after reading the file (which looks pretty much like the e..

npm ERR! Error: EPERM: operation not permitted, rename

When I execute npm install I get this error npm ERR! Error: EPERM: operation not permitted, rename C:\projects******\node_modules\react-async-script' -> 'C:\projects*******\node_modules.react-asy..

C# RSA encryption/decryption with transmission

I've seen plenty of encryption/decryption tutorials and examples on the net in C# that use the System.Security.Cryptography.RSACryptoServiceProvider, but what I'm hoping to be able to do is: Create ..

How to add title to subplots in Matplotlib?

I have one figure which contains many subplots. fig = plt.figure(num=None, figsize=(26, 12), dpi=80, facecolor='w', edgecolor='k') fig.canvas.set_window_title('Window Title') # Returns the Axes inst..

Controlling a USB power supply (on/off) with Linux

Is it possible to turn on/off power supplies from USB manually with Linux? There's this external USB cooling fan (the kind you use to cool yourself off, not the PC), and it would be nice to be able t..


For simplicity, assume all relevant fields are NOT NULL. You can do: SELECT table1.this, table2.that, table2.somethingelse FROM table1, table2 WHERE table1.foreignkey = table2.primarykey..

Confirmation before closing of tab/browser

How to ask confirmation from user before he leaves the page as in gmail? I searched for this question in various places, but all that they mention is the use of javascript window.unload & window...

Gunicorn worker timeout error

I have setup gunicorn with 3 workers 30 worker connections and using eventlet worker class. It is setup behind Nginx. After every few requests, I see this in the logs. [ERROR] gunicorn.error: WORKER ..

Reversing an Array in Java

If I have an array like this: 1 4 9 16 9 7 4 9 11 What is the best way to reverse the array so that it looks like this: 11 9 4 7 9 16 9 4 1 I have the code below, but I feel it is a little ted..

Extract MSI from EXE

I want to extract the MSI of an EXE setup to publish over a network. For example, using Universal Extractor, but it doesn't work for Java Runtime Environment...

Where can I get a list of Ansible pre-defined variables?

I see that Ansible provide some pre-defined variables that we can use in playbooks and template files. For example, the host ip address is ansible_eth0.ipv4.address. Googleing and searching the docs I..

Emulator: ERROR: x86 emulation currently requires hardware acceleration

I tried to run my Hello World application in Android Studio. I got the following error: Emulator: ERROR: x86 emulation currently requires hardware acceleration! Please ensure Intel HAXM is properly i..

Converting string to integer

PrinterLabel = Printer + PrinterNumber If Floors = 1 And (PrinterLabel) > 127 Then Wscript.Echo "Invalid Printer11 Selection " Wscript.Quit End If If Floors = 2 And PrinterLabel >..

In Java, should I escape a single quotation mark (') in String (double quoted)?

In Java, \' denotes a single quotation mark (single quote) character, and \" denotes a double quotation mark (double quote) character. So, String s = "I\'m a human."; works well. However, String s =..

No resource identifier found for attribute '...' in package ''

I've imported a project from Eclipse to Android studio. It utilizes a custom view: xmlns:app="" I get errors in the lines below from activity_ro.xml f..

Most efficient way to create a zero filled JavaScript array?

What is the most efficient way to create an arbitrary length zero filled array in JavaScript?..

How to convert all tables in database to one collation?

I'm getting error: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '='" I tried changing both tables manually to utf8_general_ci,IMPLICIT but I'..

PHP shell_exec() vs exec()

I'm struggling to understand the difference between shell_exec() and exec()... I've always used exec() to execute server side commands, when would I use shell_exec()? Is shell_exec() just a shorthan..

How to pass multiple parameters in thread in VB

I'm looking to pass two or more parameters to a thread in VB 2008. The following method (modified) works fine without parameters, and my status bar gets updated very cool-y. But I can't seem to make ..

Can I access variables from another file?

Is it possible to use a variable in a file called first.js inside another file called second.js? first.js contains a variable called colorcodes...

What is the difference between C# and .NET?

May I know what is the difference between C# and .NET? When I think of C#, right away I would say it is a .NET language, but when I search for job posts, they require candidates to have C# and .NET ex..

How can I sort an ArrayList of Strings in Java?

I have Strings that are put into an ArrayList randomly. private ArrayList<String> teamsName = new ArrayList<String>(); String[] helper; For example: teamsName.add(helper[0]) where hel..

Same font except its weight seems different on different browsers

The text is correctly displayed in Chrome. I want it to display this way in all browsers. How can I do this? I was able to fix this in Safari with -webkit-font-smoothing: antialiased; Chrome: Fire..

How to tell CRAN to install package dependencies automatically?

I develop a package in R and when I check and build it in my local computer it works properly. But when I tried it in CRAN, I get a package dependencies error. My package depends on two functions of o..

Compare integer in bash, unary operator expected

The following code gives [: -ge: unary operator expected when i=0 if [ $i -ge 2 ] then #some code fi why?..

jQuery - Create hidden form element on the fly

What is the simplest way to dynamically create a hidden input form field using jQuery?..

How can I specify system properties in Tomcat configuration on startup?

I understand that I can specify system properties to Tomcat by passing arguments with the -D parameter, for example "-Dmy.prop=value". I am wondering if there is a cleaner way of doing this by specif..

Install / upgrade gradle on Mac OS X

How do I install/upgrade gradle for Mac?..

jQuery multiselect drop down menu

I have a simple html multi select drop down list: <select id="transactionType" multiple="multiple" size="10"> <option value="ALLOC">ALLOC</option> <option value="LOAD1">LO..

Selecting Folder Destination in Java?

I am a newbie to Java. I am trying to dynamically choose the file location to save the outcome of my project (to be initiated at the very start of my project). I worked around with a few FileDialog ex..

how to kill the tty in unix

This is the result of the finger command (Today(Monday) when I (Vidya) logged in) sekic1083 [6:14am] [/home/vidya] -> finger Name Tty Idle Login Time Where Felix pts/0 -..

What is the best way to know if all the variables in a Class are null?

This would mean that the class was initialized, but the variables were not set. A sample Class: public class User { String id = null; String name = null; public String getId() { ..

Using multiprocessing.Process with a maximum number of simultaneous processes

I have the Python code: from multiprocessing import Process def f(name): print 'hello', name if __name__ == '__main__': for i in range(0, MAX_PROCESSES): p = Process(target=f, args=..

is there a 'block until condition becomes true' function in java?

I'm writing a listener thread for a server, and at the moment I'm using: while (true){ try { if (condition){ //do something condition=false; } slee..

print variable and a string in python

Alright, I know how to print variables and strings. But how can I print something like "My string" card.price (it is my variable). I mean, here is my code: print "I have " (and here I would like to p..

How do I get the position selected in a RecyclerView?

I am experimenting with the support library's recyclerview and cards. I have a recyclerview of cards. Each card has an 'x' icon at the top right corner to remove it: The card xml, list_item.xml: &..

How to prevent a click on a '#' link from jumping to top of page?

I'm currently using <a> tags with jQuery to initiate things like click events, etc. Example is <a href="#" class="someclass">Text</a> But I hate how the '#' makes the page jump to..

"git checkout <commit id>" is changing branch to "no branch"

I am working on a branch in git. When I do git checkout <commit id> (commit id obtained from git log ), it is getting committed to that particular change but branch is changed to <No-branc..

Launch custom android application from android browser

Can anybody please guide me regarding how to launch my android application from the android browser? ..

How to close existing connections to a DB

I want to close the existing connections to an MS SQL Server so that I can do a restore on that database programatically...

What does "async: false" do in jQuery.ajax()?

Specifically, how does it differ from the default ( async: true ) ? In what circumstances would I want to explicit set async to false, and does it have something to do with preventing other events o..

IDEA: javac: source release 1.7 requires target release 1.7

When running a JUnit test, using IntelliJ IDEA, I get How can I correct this? Using SDK 1.7 Module language level is 1.7 Maven build works fine. (That's why I believe this in IDEA configuration..

How do I get user IP address in django?

How do I get user's IP in django? I have a view like this: # Create your views from django.contrib.gis.utils import GeoIP from django.template import RequestContext from django.shortcuts import ren..

Running PowerShell as another user, and launching a script

I won't get into all the details of why I need this, but users must be able to launch PowerShell as a service account and when PowerShell loads it needs to run a script. I already can launch PowerShel..

Controlling Spacing Between Table Cells

I'm trying to create a table where each cell has a background color with white space between them. But I seem to be having trouble doing this. I tried setting td margins but it seems to have no effec..

Reading the selected value from asp:RadioButtonList using jQuery

I've got code similar to the following... <p><label>Do you have buffet facilities?</label> <asp:RadioButtonList ID="blnBuffetMealFacilities:chk" runat="server"> <asp:..

Append text using StreamWriter

This is probably a pretty simple question. In C# I'm trying to write a simple method, called my "DebugWrite" method, to write out any exceptions caught within my program to a text file stored locally..

Git error: src refspec master does not match any

I need to create a repo named carboncake. I tried this: Cloned the gitosis-admin repository to my local machine $ git clone [email protected]:repositories/gitosis-admin.git $ cd gitosis-admin $ ..

How disable / remove android activity label and label bar?

Is there anyway to remove activity label bar and label itself which is set by default from application label? I'd like to have whole layout from my design and need to remove the label bar and label w..

How copy data from Excel to a table using Oracle SQL Developer

Is there any alternative way to copy the data from Excel sheet and paste it into a table using Oracle SQL Developer!? For now I am using (PL/SQL Developer) by writing (for update) at the end of the s..

How do I disable orientation change on Android?

I have an application that I just would like to use in portrait mode, so I have defined android:screenOrientation="portrait" in the manifest XML. This works OK for the HTC Magic phone (and prevents or..

Creating a segue programmatically

I have a common UIViewController that all my UIViewsControllers extend to reuse some common operations. I want to set up a segue on this "Common" UIViewController so that all the other UIViewControll..

Could not establish trust relationship for SSL/TLS secure channel -- SOAP

I have a simple web service call, generated by a .NET (C#) 2.0 windows app, via the web service proxy generated by Visual Studio, for a web service also written in C# (2.0). This has worked for severa..

Is there a Google Keep API?

Is there a API for Google Keep? I want to make a windows 8 app for Google Keep, so that it synchronizes with your phone. I looked into the Drive SDK because Google Keep is a extension of Google Driv..

Importing files from different folder

I have the following folder structure. application +-- app ¦   +-- folder ¦   +-- +-- app2 +-- some_folder +-- I want to import some functions from ..

how to load url into div tag

I have a <div id="content"> want to load url: content into my code: <html> <head> <script type="text/javascript"> $(document).rea..

How do I return multiple values from a function?

The canonical way to return multiple values in languages that support it is often tupling. Option: Using a tuple Consider this trivial example: def f(x): y0 = x + 1 y1 = x * 3 y2 = y0 ** y3 re..

Default Xmxsize in Java 8 (max heap size)

In the oracle documentation I found: -Xmxsize Specifies the maximum size (in bytes) of the memory allocation pool in bytes ... The default value is chosen at runtime based on system configuratio..

Constantly print Subprocess output while process is running

To launch programs from my Python-scripts, I'm using the following method: def execute(command): process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) ..

jquery: how to get the value of id attribute?

Basic jquery question. I have an option element as below. <option class='select_continent' value='7'>Antarctica</option> jquery $(".select_continent").click(function () { alert(th..

Set a button background image iPhone programmatically

In Xcode, how do you set the background of a UIButton as an image? Or, how can you set a background gradient in the UIButton?..

How do I store data in local storage using Angularjs?

Currently I am using a service to perform an action, namely retrieve data from the server and then store the data on the server itself. Instead of this, I want to put the data into local storage inst..

How do I convert a C# List<string[]> to a Javascript array?

I have a datatable that I'm converting into a List, serializing it and passing it to my view using a viewmodel. My viewmodel looks like this: public class AddressModel { public string Addresses .. vs onClick

I have a huge jQuery application, and I'm using the below two methods for click events. First method HTML <div id="myDiv">Some Content</div> jQuery $('#myDiv').click(function(){ ..

Implement a loading indicator for a jQuery AJAX call

I have a Bootstrap modal which is launched from a link. For about 3 seconds it just sits there blank, while the AJAX query fetches the data from the database. How can I implement some sort of a loadin..

How do I resolve "Please make sure that the file is accessible and that it is a valid assembly or COM component"?

I am building a project with OpenCV in C#. It requires a dll file called cvextern.dll. but, when adding this file as a reference, this message appears :- a reference "cvextern.dll" can't be added, Pl..

How to convert JSON to string?

Possible Duplicate: Convert JS object to JSON string I have a JSON object in JS, and I would like to convert it to string. Is it a function for this? Thanks in advance,..

How to sparsely checkout only one single file from a git repository?

How do I checkout just one file from a git repo?..

Excel Formula to SUMIF date falls in particular month

I have excel data in following format. Date Amount 03-Jan-13 430.00 25-Jan-13 96.00 10-Jan-13 440.00 28-Feb-13 72.10 28-Feb-13 72.30 I need to sum the amount field only if the..

Convert String To date in PHP

How can I convert this string 05/Feb/2010:14:00:01 to unixtime ? ..

Access all Environment properties as a Map or Properties object

I am using annotations to configure my spring environment like this: @Configuration ... @PropertySource("classpath:/config/") ... public class GeneralApplicationConfiguration implem..

Can you do a For Each Row loop using MySQL?

My question is related to the answer found in this post by user Consultuning on Oct 22 '09 at 18:31: mysql query to dynamically convert row data to columns It appears that Consultuning's answer cont..

How to convert NSNumber to NSString

So I have an NSArray "myArray" with NSNumbers and NSStrings. I need them in another UIView so i go like this: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPa..

How to call a mysql stored procedure, with arguments, from command line?

How can I call a stored procedure from command line? I have a procedure: CREATE DEFINER=`root`@`localhost` PROCEDURE `insertEvent`(IN `dateTimeIN` DATETIME) NO SQL BEGIN SET @eventIDOut = NU..

Can you "compile" PHP code and upload a binary-ish file, which will just be run by the byte code interpreter?

I know that PHP is compiled to byte code before it is run on the server, and then that byte code can be cached so that the whole script doesn't have to be re-interpreted with every web access. But ca..

Hibernate Criteria Join with 3 Tables

I am looking for a hibernate criteria to get following: Dokument.class is mapped to Role roleId Role.class has a ContactPerson contactId Contact.class FirstName LastName I want to search for First..

MySql export schema without data

I'm using a MySql database with a Java program, now I want to give the program to somebody else. How to export the MySql database structure without the data in it, just the structure?..

Clear back stack using fragments

I ported my Android app to honeycomb and I did a big refactor in order to use fragments. In my previous version, when I pressed the Home button I used to do a ACTIVITY_CLEAR_TOP in order to reset the ..

auto increment ID in H2 database

Is there a way to have an auto_incrementing BIGINT ID for a table. It can be defined like so id bigint auto_increment but that has no effect (it does not increment automatically). I would like to i..

Apache Tomcat Not Showing in Eclipse Server Runtime Environments

I have tomcat 5.5 installed, running and verifiable at http://localhost:8080/. The Tomcat menu option appears in the Eclipse menu bar and I can start and stop Tomcat from there. In Eclipse, it does no..

Remove tracking branches no longer on remote

Is there a simple way to delete all tracking branches whose remote equivalent no longer exists? Example: Branches (local and remote) master origin/master origin/bug-fix-a origin/bug-fix-b origin/b..

How to load a jar file at runtime

I was asked to build a java system that will have the ability to load new code (expansions) while running. How do I re-load a jar file while my code is running? or how do I load a new jar? Obviously..

How can I combine flexbox and vertical scroll in a full-height app?

I want to use a full-height app using flexbox. I found what I want using old flexbox layout module (display: box; and other things) in this link: CSS3 Flexbox full-height app and overflow This is a c..

What is the difference between the dot (.) operator and -> in C++?

What is the difference between the dot (.) operator and -> in C++?..

Responsive dropdown navbar with angular-ui bootstrap (done in the correct angular kind of way)

I've created a JSFiddle with a dropdown navbar using angular-ui-boostrap's module "ui.bootstrap.dropdownToggle": <div class="navbar navbar-fixed-top"> <div c..

What does the keyword "transient" mean in Java?

I saw somewhere transient private TrackDAO trackDAO; ..

CSS3 opacity gradient?

I am looking to create an effect like this, but my website has a dynamic background-color. Note that this example uses a white overlay, which does not work with different backgrounds. p { width: ..