Questions Tagged with #Minimum spanning tree

A minimum spanning tree (MST) or minimum weight spanning tree is a spanning tree of a connected, undirected graph with the least possible weight.

When should I use Kruskal as opposed to Prim (and vice versa)?

I was wondering when one should use Prim's algorithm and when Kruskal's to find the minimum spanning tree? They both have easy logics, same worst cases, and only difference is implementation which mig..

MySQL SELECT query string matching

Normally, when querying a database with SELECT, its common to want to find the records that match a given search string. For example: SELECT * FROM customers WHERE name LIKE '%Bob Smith%'; That qu..

With ' N ' no of nodes, how many different Binary and Binary Search Trees possible?

For Binary trees: There's no need to consider tree node values, I am only interested in different tree topologies with 'N' nodes. For Binary Search Tree: We have to consider tree node values...

What is the correct way of reading from a TCP socket in C/C++?

Here's my code: // Not all headers are relevant to the code snippet. #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <net..

Defining a variable with or without export

What is export for? What is the difference between: export name=value and name=value ..

Spring Rest POST Json RequestBody Content type not supported

When I try to post new object with post method. RequestBody could not recognize contentType. Spring is already configured and POST could work with others objects, but not this specific one. org.sprin..

Regex: Use start of line/end of line signs (^ or $) in different context

While doing some small regex task I came upon this problem. I have a string that is a list of tags that looks e.g like this: foo,bar,qux,garp,wobble,thud What I needed to do was to check if a cer..

How to wait until WebBrowser is completely loaded in VB.NET?

I am using the WebBrowser control in my VB.NET application to load a few URLs ( ~10-15) and save their HTML source in a text file. However, my code doesn't write the source of the current page rather ..

get current date from [NSDate date] but set the time to 10:00 am

How can I reset the current date retrieved from [NSDate date] but then change the time to 10:00 in the morning...

Change variable name in for loop using R

I have a for loop: for (i in 1:10){ Ai=d+rnorm(3)} What I would like to do is have A1, A2,A3...A10 and I have the variable i in the variable name. It doesn't work this way, but I'm probably missin..

Java how to replace 2 or more spaces with single space in string and delete leading and trailing spaces

Looking for quick, simple way in Java to change this string " hello there " to something that looks like this "hello there" where I replace all those multiple spaces with a single space, ..

CSV parsing in Java - working example..?

I want to write a program for a school java project to parse some CSV I do not know. I do know the datatype of each column - although I do not know the delimiter. The problem I do not even marginally..

How to get `DOM Element` in Angular 2?

I have a component that has a <p> element. It's (click) event will change it into a <textarea>. So, the user can edit the data. My question is: How can I make the focus on the textarea? H..

How to check if a float value is a whole number

I am trying to find the largest cube root that is a whole number, that is less than 12,000. processing = True n = 12000 while processing: n -= 1 if n ** (1/3) == #checks to see if this has d..

How To Show And Hide Input Fields Based On Radio Button Selection

Here is the code to show input fields depending on radio selection like: SCRIPT <script type="text/javascript"> function yesnoCheck() { if (document.getElementById('yesCheck').che..

The remote certificate is invalid according to the validation procedure

Running the following code, I get an exception: using (var client = new Pop3Client()) { client.Connect(provider.ServerWithoutPort, provider.Port, true); } The Exception I get: The remote certi..

Laravel - Pass more than one variable to view

I have this site and one of its pages creates a simple list of people from the database. I need to add one specific person to a variable I can access. How do I modify the return $view->with('perso..

invalid command code ., despite escaping periods, using sed

Being forced to use CVS for a current client and the address changed for the remote repo. The only way I can find to change the remote address in my local code is a recursive search and replace. Howe..

VBA Date as integer

is there a way to get the underlying integer for Date function in VBA ? I'm referring to the integer stored by Excel to describe dates in memory in terms of number of days (when time is included it ca..

`IF` statement with 3 possible answers each based on 3 different ranges

I have 3 ranges of numbers and the answer depends on the range. 75-79=0.255 80-84=0.327 85+ =0.559 I tried to create an equation that accounts for the ranges, however Excel states that I have en..

How can you make a custom keyboard in Android?

I want to make a custom keyboard. I don't know how to do it using XML and Java. The following picture is a model of the keyboard I want to make. It only needs numbers. ..

How to get highcharts dates in the x axis?

Is there a standard way to get dates on the x-axis for Highcharts? Can't find it in their documentation: http://www.highcharts.com/ref/#xAxis--type When my time range is large enough, it shows dates..

macOS on VMware doesn't recognize iOS device

I am using Mac OS in VMWare for iOS app development. After updating the OS and Xcode, the iOS device isn't available so I cannot test it. When the device is plugged in to the PC, the device appears ..

What is the difference between printf() and puts() in C?

I know you can print with printf() and puts(). I can also see that printf() allows you to interpolate variables and do formatting. Is puts() merely a primitive version of printf(). Should it be used ..

Any way to break if statement in PHP?

Is there any command in PHP to stop executing the current or parent if statement, same as break or break(1) for switch/loop. For example $arr=array('a','b'); foreach($arr as $val) { break; echo "..

Image library for Python 3

What is python-3 using instead of PIL for manipulating Images?..

How to restore default perspective settings in Eclipse IDE

I was playing around with perspectives, such as the Customizing perspective ,I've closed too many windows, and even menu is not visible now . and now would now like to restore the Perspective back t..

[INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]

I have an issue with third party libraries that are imported to my project. I read quite a lot of articles about that but do not get any information how properly handle it. I put my classes .so to t..

Eclipse and Windows newlines

I had to move my Eclipse workspace from Linux to Windows when my desktop crashed. A week later I copy it back to Linux, code happily, commit to CVS. And alas, windows newlines have polluted many files..

Can you nest html forms?

Is it possible to nest html forms like this <form name="mainForm"> <form name="subForm"> </form> </form> so that both forms work? My friend is having problems with this,..

Regex to get NUMBER only from String

I recieve "7+" or "5+" or "+5" from XML and wants to extract only the number from string using Regex. e.g Regex.Match() function stringThatHaveCharacters = stringThatHaveCharacters.Trim(); ..

Regex to check if valid URL that ends in .jpg, .png, or .gif

I would like users to submit a URL that is valid but also is an image, ending with .jpg, .png, or .gif...

Return a value if no rows are found in Microsoft tSQL

Using a Microsoft version of SQL, here's my simple query. If I query a record that doesn't exist then I will get nothing returned. I'd prefer that false (0) is returned in that scenario. Looking for t..

How can I pass a member function where a free function is expected?

The question is the following: consider this piece of code: #include <iostream> class aClass { public: void aTest(int a, int b) { printf("%d + %d = %d", a, b, a + b);..

Python dictionary get multiple values

Sry if this question already exists, but I've been searching for quite some time now. I have a dictionary in python, and what I want to do is get some values from it as a list, but I don't know if th..

How to check if current thread is not main thread

I need to check if the thread running a certain piece of code is the main (UI) thread or not. How can I achieve this?..

Pandas: Looking up the list of sheets in an excel file

The new version of Pandas uses the following interface to load Excel files: read_excel('path_to_file.xls', 'Sheet1', index_col=None, na_values=['NA']) but what if I don't know the sheets that are a..

Python: Remove division decimal

I have made a program that divides numbers and then returns the number, But the thing is that when it returns the number it has a decimal like this: 2.0 But I want it to give me: 2 so is there a..

Converting string from snake_case to CamelCase in Ruby

I am trying to convert a name from snake case to camel case. Are there any built-in methods? Eg: "app_user" to "AppUser" (I have a string "app_user" I want to convert that to model AppUser)...

How To Convert A Number To an ASCII Character?

I want to create an application where user would input a number and the program will throw back a character to the user. Edit: How about vice versa, changing a ascii character into number?..

How do you obtain a Drawable object from a resource id in android package?

I need to get a Drawable object to display on an image button. Is there a way to use the code below (or something like it) to get an object from the android.R.drawable.* package? for example if drawa..

Failed to load c++ bson extension

A total node noob here. I've been trying to set up a sample node app but the following error keeps popping up every time I try to run: node app Failed to load c++ bson extension, using pure JS v..

HTML embed autoplay="false", but still plays automatically

On the front page of this website, there is a sticky post titled "National Radio Advertising Campaign ForACURE" which contains the following HTML: <embed type="audio/x-wav" src="http://www.foracur..

How do I combine 2 javascript variables into a string

I would like to join a js variable together with another to create another variable name... so it would be look like; for (i=1;i<=2;i++){ var marker = new google.maps.Marker({ position:"myLatl..

How to test my servlet using JUnit

I have created a web system using Java Servlets and now want to make JUnit testing. My dataManager is just a basic piece of code that submits it to the database. How would you test a Servlet with JUni..

Export MySQL database using PHP only

What would be a piece of PHP code for exporting a MySQL database to a .sql file? I don't have shell access so I can't use exec. I've found some code but I looked through the code and this code is old..

laravel Eloquent ORM delete() method

Hi I am studying laravel. I use Eloquent ORM delete method but I get a different result.Not true or false but null. I set an resource route and there is a destroy method in UsersController. public fu..

Can you style an html radio button to look like a checkbox?

I have an html form that a user will fill out and print. Once printed, these forms will be faxed or mailed to a government agency, and need to look close enough like the original form published by sa..

how to remove new lines and returns from php string?

A php variable contains the following string: <p>text</p> <p>text2</p> <ul> <li>item1</li> <li>item2</li> </ul> I want to remove all the ..

Global variables in Javascript across multiple files

A bunch of my JavaScript code is in an external file called helpers.js. Inside the HTML that calls this JavaScript code I find myself in need of knowing if a certain function from helpers.js has been ..

Image Greyscale with CSS & re-color on mouse-over?

I am looking to take an icon that is colored (and will be a link) and turn it greyscale until the user places their mouse over the icon (where it would then color the image). Is this possible to do, ..

MySQL Select Date Equal to Today

I'm trying to run a mysql select statement where it looks at today's date and only returns results that signed up on that current day. I've currently tried the following, but it doesn't seem to work. ..

How can you remove all documents from a collection with Mongoose?

I know how to... Remove a single document. Remove the collection itself. Remove all documents from the collection with Mongo. But I don't know how to remove all documents from the collection with ..

How to make the HTML link activated by clicking on the <li>?

I have the following markup, <ul id="menu"> <li><a href="#">Something1</a></li> <li><a href="#">Something2</a></li> <..

How to add a bot to a Telegram Group?

I've been trying to add a bot to my Telegram group in Android Device but I am not able to do so. I tried @bot_name, /bot_name, but it doesn't work. Is it possible to add a bot to the group or should I..

jQuery - keydown / keypress /keyup ENTERKEY detection?

Trying to get jQuery to detect enter input, but space and other keys are detected, enter isn't detected. What's wrong below: $("#entersomething").keyup(function(e) { alert("up"); var code =..

Change Input to Upper Case

JS: <script type="text/css"> $(function() { $('#upper').keyup(function() { this.value = this.value.toUpperCase(); }); }); </script> HTML <div id="search"> ..

How to Execute SQL Script File in Java?

I want to execute an SQL script file in Java without reading the entire file content into a big query and executing it. Is there any other standard way?..

Is SMTP based on TCP or UDP?

Is SMTP based on TCP or UDP ? I really can't confirm it . In my opinion, SMTP should be based on UDP, but someone told me that is must be TCP...

Mailto links do nothing in Chrome but work in Firefox?

It seems like the mailto links we're embedding in our website fail to do anything in Chrome, though they work in Firefox. Simple example here: http://jsfiddle.net/wAPNH/ <a href='mailto:test@test..

How to remove all of the data in a table using Django

I have two questions: How do I delete a table in Django? How do I remove all the data in the table? This is my code, which is not successful: Reporter.objects.delete() ..

Another Repeated column in mapping for entity error

Despite all of the others post, I can't find a solution for this error with GlassFish, on MacOSX, NetBeans 7.2. Here the error : SEVERE: Exception while invoking class org.glassfish.persistence.jpa.J..

Row count with PDO

There are many conflicting statements around. What is the best way to get the row count using PDO in PHP? Before using PDO, I just simply used mysql_num_rows. fetchAll is something I won't want becaus..

What is the purpose of meshgrid in Python / NumPy?

Can someone explain to me what is the purpose of meshgrid function in Numpy? I know it creates some kind of grid of coordinates for plotting, but I can't really see the direct benefit of it. I am stu..

How to asynchronously call a method in Java

I've been looking at Go's goroutines lately and thought it would be nice to have something similar in Java. As far as I've searched the common way to parallelize a method call is to do something like:..

Uncaught ReferenceError: React is not defined

I am trying to make ReactJS work with rails using this tutorial. I am getting this error: Uncaught ReferenceError: React is not defined But I can access the React object in browser console I als..

Transaction isolation levels relation with locks on table

I have read about 4 levels of isolation: Isolation Level Dirty Read Nonrepeatable Read Phantom Read READ UNCOMMITTED Permitted Permitted Permitted READ COMMITTED ..

"Fatal error: Unable to find local grunt." when running "grunt" command

I uninstalled grunt with following command. npm uninstall -g grunt Then I again installed grunt with following command. npm install -g grunt-cli Visit following link: https://npmjs.org/package/..

curl : (1) Protocol https not supported or disabled in libcurl

I'm trying to install the Rails environments on Ubuntu 11.04. When I launch the command rvm install 1.9.2 --with-openssl-dir=/usr/local the following error is received: curl : (1) Protocol https not ..

How to serve up images in Angular2?

I am trying to put the relative path to one of my images in my assets folder in an image src tag in my Angular2 app. I set a variable in my component to 'fullImagePath' and used that in my template. I..

jQuery: what is the best way to restrict "number"-only input for textboxes? (allow decimal points)

What is the best way to restrict "number"-only input for textboxes? I am looking for something that allows decimal points. I see a lot of examples. But have yet to decide which one to use. Update f..

How to use XPath in Python?

What are the libraries that support XPath? Is there a full implementation? How is the library used? Where is its website?..

Getting android.content.res.Resources$NotFoundException: exception even when the resource is present in android

Please let me know where I am going wrong to get the error. I am creating an app which have one of its activity to be only in landscape mode. So I added the following in AndroidManifest.xml file <..

Spring Boot War deployed to Tomcat

I am trying to deploy a Spring Boot app to Tomcat, because I want to deploy to AWS. I created a WAR file, but it does not seem to run on Tomcat, even though it is visible. Details: 0. Here is my app:..

Where can I find decent visio templates/diagrams for software architecture?

Anyone have any good urls for templates or diagram examples in Visio 2007 to be used in software architecture?..

How to Delete Session Cookie?

How to dynamically, via javascript, delete a session cookie, without manually restarting the browser? I read somewhere that session cookie is retained in browser memory and will be removed when the b..

How to define the basic HTTP authentication using cURL correctly?

I'm learning Apigility (Apigility docu -> REST Service Tutorial) and trying to send a POST request with basic authentication via cURL: $ curl -X POST -i -H "Content-Type: application/hal+json" -H "Au..

How to fix Error: "Could not find schema information for the attribute/element" by creating schema

I have a windows forms application written in VS2010 with C# and get the following errors in the app.config file: Message 4 Could not find schema information for the attribute 'name' Message 8 Co..

Java collections convert a string to a list of characters

I would like to convert the string containing abc to a list of characters and a hashset of characters. How can I do that in Java ? List<Character> charList = new ArrayList<Character>("ab..

Execute a stored procedure in another stored procedure in SQL server

How can i execute a stored procedure in another stored procedure in SQL server? How will I pass the parameters of the second procedure.?..

Referring to a Column Alias in a WHERE Clause

SELECT logcount, logUserID, maxlogtm , DATEDIFF(day, maxlogtm, GETDATE()) AS daysdiff FROM statslogsummary WHERE daysdiff > 120 I get "invalid column name daysdiff". Maxlogtm is a date..

Execute PHP function with onclick

I am searching for a simple solution to call a PHP function only when a-tag is clicked. PHP: function removeday() { ... } HTML: <a href="" onclick="removeday()" class="deletebtn">Delete<..

What is a simple command line program or script to backup SQL server databases?

I've been too lax with performing DB backups on our internal servers. Is there a simple command line program that I can use to backup certain databases in SQL Server 2005? Or is there a simple VBScr..

include external .js file in node.js app

I have an app.js node application. As this file is starting to grow, I would like to move some part of the code in some other files that I would "require" or "include" in the app.js file. I'm trying ..

How to write trycatch in R

I want to write trycatch code to deal with error in downloading from the web. url <- c( "http://stat.ethz.ch/R-manual/R-devel/library/base/html/connections.html", "http://en.wikipedia.org/..

How to remove part of a string before a ":" in javascript?

If I have a string Abc: Lorem ipsum sit amet, how can I use JavaScript/jQuery to remove the string before the : including the :. For example the above string will become: Lorem ipsum sit amet...

Increment a value in Postgres

I'm a little new to postgres. I want to take a value (which is an integer) in a field in a postgres table and increment it by one. For example if the table 'totals' had 2 columns, 'name' and 'total', ..

How to add a delay for a 2 or 3 seconds

How can I add a delay to a program in C#? ..

ignoring any 'bin' directory on a git project

I have a directory structure like this: .git/ .gitignore main/ ... tools/ ... ... Inside main and tools, and any other directory, at any level, there can be a 'bin' directory, which I want to i..

This API project is not authorized to use this API. Please ensure that this API is activated in the APIs Console

I have a latitude, and longitude : "-27.0000,133.0000". I want produce a map base on that. I've tried go to this link https://maps.googleapis.com/maps/api/geocode/json?latlng=-27.0000,133.0000&..

IF Statement multiple conditions, same statement

Hey all, looking to reduce the code on my c# if statements as there are several repeating factors and was wondering if a trimmer solution is possible. I currently have 2 if statements that need to ca..

Run a script in Dockerfile

I'm trying to run a script during my building process in my Dockerfile. But it doesn't seems to work. I tried that way: FROM php:7-fpm ADD bootstrap.sh / ENTRYPOINT ["/bin/bash", "/boot..

When saving, how can you check if a field has changed?

In my model I have : class Alias(MyBaseModel): remote_image = models.URLField(max_length=500, null=True, help_text="A URL that is downloaded and cached for the image. Only used when the alias is..

Error while inserting date - Incorrect date value:

I have a column called today and the type is DATE. When I try to add the date in the format '07-25-2012' I get the following error: Unable to run query:Incorrect date value: '07-25-2012' for colu..

Submit a form in a popup, and then close the popup

This seemed so trivial when I started off with it! My objective is this: When user clicks on a button, open up a form in a new window. Once the form is submitted, close the popup and return to the ..

Notepad++ cached files location

On the most recent versions of Notepad++, when the application is closed, unsaved files are maintained when the application is restarted. I presume that those files are cached on a temporary files. W..

Correct way to remove plugin from Eclipse

Last times, I'm facing problem of removing plugins from Eclipse. symptoms: 1. if removing thru already installed menu,that can't reinstall correctly and have several perspectives - e.g. for SQL Expl..

How to open VMDK File of the Google-Chrome-OS bundle 2012?

As you all know, Google-Chrome-OS is released in VMWare Image File, VMDK. I've downloaded it , however, I couldn't open it with VMWare Work Station and VMWare Player. Also I've tried to open with V..

Does Django scale?

I'm building a web application with Django. The reasons I chose Django were: I wanted to work with free/open-source tools. I like Python and feel it's a long-term language, whereas regarding Ruby I ..

Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed

I have a grid view on my page and I want to export it to the Excel Sheet, Below is the code I had written to do this task, here I am already passing the dataset to the method to bind the grid and btnE..

Customize UITableView header section

I want to customize UITableView header for each section. So far, I've implemented -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section this UITabelViewDelegate meth..

True/False vs 0/1 in MySQL

Which is faster in a MySQL database? Booleans, or using zero and one to represent boolean values? My frontend just has a yes/no radio button...

jQuery UI Sortable, then write order into a database

I want to use the jQuery UI sortable function to allow users to set an order and then on change, write it to the database and update it. Can someone write an example on how this would be done?..

Is there a way to check which CSS styles are being used or not used on a web page?

Want to know which CSS styles are currently being used on a web page...

CSS to hide INPUT BUTTON value text

I am currently styling an <input type='button'/> element with the following CSS: background: transparent url(someimage); color: transparent; I want the button to show as an image, but I don't..

How do I turn off autocommit for a MySQL client?

I have a web app that has been written with the assumption that autocommit is turned on on the database, so I don't want to make any changes there. However all the documentation I can find only seems ..

Get filename from file pointer

If I have a file pointer is it possible to get the filename? fp = open("C:\hello.txt") Is it possible to get "hello.txt" using fp?..

How to open SharePoint files in Chrome/Firefox

In Internet Explorer, I can open Sharepoint files directly from their links so the file in Sharepoint is automatically updated when I save it. But in Chrome, it asks to download the file instead of ju..

How do you fix a bad merge, and replay your good commits onto a fixed merge?

I accidentally committed an unwanted file (filename.orig while resolving a merge) to my repository several commits ago, without me noticing it until now. I want to completely delete the file from the ..

SQL like search string starts with

Learning SQL. Have a simple table games with field title. I want to search based on title. If I have a game called Age of Empires III: Dynasties, and I use LIKE with parameter Age of Empires III: Dyna..

Adding elements to an xml file in C#

I have an XML file formatted like this: <Snippets> <Snippet name="abc"> <SnippetCode> testcode1 </SnippetCode> </Snippet> <Snippet name="xyz">..

SQL Server equivalent to Oracle's CREATE OR REPLACE VIEW

In Oracle, I can re-create a view with a single statement, as shown here: CREATE OR REPLACE VIEW MY_VIEW AS SELECT SOME_FIELD FROM SOME_TABLE WHERE SOME_CONDITIONS As the syntax implies, this will ..

Java get month string from integer

Is there a better way to compact this method i.e. reduce the cyclomatic complexity by avoid the switch cases? String monthString; switch (month) { case 1: monthString = "January"..

Why are empty catch blocks a bad idea?

I've just seen a question on try-catch, which people (including Jon Skeet) say empty catch blocks are a really bad idea? Why this? Is there no situation where an empty catch is not a wrong design deci..

Converting Long to Date in Java returns 1970

I have list with long values (for example: 1220227200, 1220832000, 1221436800...) which I downloaded from web service. I must convert it to Dates. Unfortunately this way, for example: Date d = new Da..

How to suppress scientific notation when printing float values?

Here's my code: x = 1.0 y = 100000.0 print x/y My quotient displays as 1.00000e-05. Is there any way to suppress scientific notation and make it display as 0.00001? I'm going to use the result..

How to show MessageBox on asp.net?

if I need to show a MessageBox on my ASP.NET WebForm, how to do it? I try: Messagebox.show("dd"); But it's not working...

How to handle floats and decimal separators with html5 input type number

Im building web app which is mainly for mobile browsers. Im using input fields with number type, so (most) mobile browsers invokes only number keyboard for better user experience. This web app is main..

JavaScript push to array

How do I push new values to the following array? json = {"cool":"34.33","alsocool":"45454"} I tried json.push("coolness":"34.33");, but it didn't work...

How to make a progress bar

How would one go about making a progress bar in html/css/javascript. I don't really want to use Flash. Something along the lines of what can be found here: http://dustincurtis.com/about.html All I re..

PHP - regex to allow letters and numbers only

I have tried: preg_match("/^[a-zA-Z0-9]", $value) but im doing something wrong i guess...

RegEx for matching "A-Z, a-z, 0-9, _" and "."

I need a regex which will allow only A-Z, a-z, 0-9, the _ character, and dot (.) in the input. I tried: [A-Za-z0-9_.] But, it did not work. How can I fix it?..

104, 'Connection reset by peer' socket error, or When does closing a socket result in a RST rather than FIN?

We're developing a Python web service and a client web site in parallel. When we make an HTTP request from the client to the service, one call consistently raises a socket.error in socket.py, in read..

Error: Could not find or load main class

I am having trouble compiling and running my Java code, intended to allow me to interface Java with a shared object for Vensim, a simulation modeling package. The following code compiles without erro..

How can I find and run the keytool

I am reading an development guide of Facebook Developers at here It says that I must use keytool to export the signature for my app such as: keytool -exportcert -alias androiddebugkey -keystore ~/...

Is there an equivalent of lsusb for OS X

This question seems to be all over google, but the answers all point to using System Profiler. That's nice, but with System Profiler all you get is something that looks like this: DasKeyb..

How do I handle a click anywhere in the page, even when a certain element stops the propagation?

We are working on a JavaScript tool that has older code in it, so we cannot re-write the whole tool. Now, a menu was added position fixed to the bottom and the client would very much like it to have ..

Link to all Visual Studio $ variables

I was having a look at $(Configuration),$(ProjectDir) etc. in Visual Studio 2008 for Prebuild events. Is there a link to all of these variables with a definition for each one of them?..

Call method in directive controller from other controller

I have a directive that has its own controller. See the below code: var popdown = angular.module('xModules',[]); popdown.directive('popdown', function () { var PopdownController = function ($sco..

If statement for strings in python?

I am a total beginner and have been looking at http://en.wikibooks.org/wiki/Python_Programming/Conditional_Statements but I can not understand the problem here. It is pretty simple, if the user enters..

How do I schedule a task to run at periodic intervals?

I was trying some codes to implement a scheduled task and came up with these codes . import java.util.*; class Task extends TimerTask { int count = 1; // run is a abstract method that def..

Java: object to byte[] and byte[] to object converter (for Tokyo Cabinet)

I need to convert objects to a byte[] to be stored in the Tokyo Cabinet key-value store. I also need to unbyte the byte[] to an Object when reading from the key-value store. Are there any packages ou..

WinError 2 The system cannot find the file specified (Python)

I have a Fortran program and want to execute it in python for multiple files. I have 2000 input files but in my Fortran code I am able to run only one file at a time. How should I call the Fortran pro..

How to print variables without spaces between values

I would like to know how to remove additional spaces when I print something. Like when I do: print 'Value is "', value, '"' The output will be: Value is " 42 " But I want: Value is "42" Is t..

How do you force a makefile to rebuild a target

I have a makefile that builds and then calls another makefile. Since this makefile calls more makefiles that does the work it doesnt really change. Thus it keeps thinking the project is built and upto..

How to make a Python script run like a service or daemon in Linux

I have written a Python script that checks a certain e-mail address and passes new e-mails to an external program. How can I get this script to execute 24/7, such as turning it into daemon or service..

BAT file to open CMD in current directory

I have many scripts which I interact with from the command line. Everytime I need to use them, I have to open a command line window and copy+paste and CD to the path to the directory they are in. This..

How can I make a time delay in Python?

I would like to know how to put a time delay in a Python script...

How to inject Javascript in WebBrowser control?

I've tried this: string newScript = textBox1.Text; HtmlElement head = browserCtrl.Document.GetElementsByTagName("head")[0]; HtmlElement scriptEl = browserCtrl.Document.CreateElement("script"); lblSta..

@UniqueConstraint and @Column(unique = true) in hibernate annotation

What is difference between @UniqueConstraint and @Column(unique = true)? For example: @Table( name = "product_serial_group_mask", uniqueConstraints = {@UniqueConstraint(columnNames = {"mask",..

How to change file encoding in NetBeans?

I want to change encoding of file in NetBeans IDE (ver 6.9.1), let's say from ANSII to UTF-8. How can I do that? EDIT: I will be more precise. I don't want to change the default encoding in NetBeans...

SQL Query with NOT LIKE IN

Please help me to write a sql query with the conditions as 'NOT LIKE IN' Select * from Table1 where EmpPU NOT Like IN ('%CSE%', '%ECE%', '%EEE%') Getting error...

Why is Visual Studio 2013 very slow?

I'm running Visual Studio 2013 Pro (RTM version) on my formatted PC (Windows 8.1 fresh install). I don't know why, but Visual Studio 2013 Pro is very very slow! Slow for building, debugging, navigati..

How to set bot's status

So I'm trying to make my bot's streaming to be with depression but I've tried multiple things and they don't work. I've tried these methods: client.user.setPresence({ game: { name: 'with depression' ..

ansible: lineinfile for several lines?

The same way there is a module lineinfile to add one line in a file, is there a way to add several lines? I do not want to use a template because you have to provide the whole file. I just want to ad..

What is an IIS application pool?

What exactly is an application pool? What is its purpose?..

Does the join order matter in SQL?

Disregarding performance, will I get the same result from query A and B below? How about C and D? -- A select * from a left join b on <blahblah> left join c on &l..

Add 2 hours to current time in MySQL?

Which is the valid syntax of this query in MySQL? SELECT * FROM courses WHERE (now() + 2 hours) > start_time note: start_time is a field of courses table..

How to monitor the memory usage of Node.js?

How can I monitor the memory usage of Node.js?..

VBA paste range

I have simple goal of copying range and pasting it into another spreadsheet. The following code below gives copies, but does not paste. Sub Normalize() Dim Ticker As Range Sheets("Sheet1")...

Why does Math.Round(2.5) return 2 instead of 3?

In C#, the result of Math.Round(2.5) is 2. It is supposed to be 3, isn't it? Why is it 2 instead in C#?..

PHP display current server path

I need to setup a path in my php but I currently don't know the path. I need to configure the paths to the uploads directory Should look like this below: /srv/www/uploads/ My uploads.php file is in t..

Good Hash Function for Strings

I'm trying to think up a good hash function for strings. And I was thinking it might be a good idea to sum up the unicode values for the first five characters in the string (assuming it has five, oth..

Confusion: @NotNull vs. @Column(nullable = false) with JPA and Hibernate

When they appear on a field/getter of an @Entity, what is the difference between them? (I persist the Entity through Hibernate). What framework and/or specification each one of them belongs to? @NotN..

Use awk to find average of a column

I'm attempting to find the average of the second column of data using awk for a class. This is my current code, with the framework my instructor provided: #!/bin/awk ### This script currently prints..

Bash command line and input limit

Is there some sort of character limit imposed in bash (or other shells) for how long an input can be? If so, what is that character limit? I.e. Is it possible to write a command in bash that is too l..

Change the Textbox height?

How do I change the height of a textbox ? Neither of the below work: this.TextBox1.Size = new System.Drawing.Size(173, 100); or this.TextBox1.Size.Height = 100; I wanted to be able to change th..

How to read a PEM RSA private key from .NET

I've got an RSA private key in PEM format, is there a straight forward way to read that from .NET and instantiate an RSACryptoServiceProvider to decrypt data encrypted with the corresponding public ke..

List of enum values in java

Is it possible to create ArrayList of enum values (and manipulate it)? For example: enum MyEnum { ONE, TWO } MyEnum my = MyEnum.ONE; List <?> al = new ArrayList <?>(); al.add(my); al...

Creating a LINQ select from multiple tables

This query works great: var pageObject = (from op in db.ObjectPermissions join pg in db.Pages on op.ObjectPermissionName equals page.PageName where pg.PageID == pa..

Excel VBA: Copying multiple sheets into new workbook

I have an error message of 'Object Required' when I run this sub. I have a version for copying each specific sheet, which works fine, but this sub is for all sheets within the WB ie to copy each one'..

Is it possible to pass parameters programmatically in a Microsoft Access update query?

I have a query that's rather large, joining over a dozen tables, and I want to pull back records based on an id field (e.g.: between nStartID and nEndID). I created two parameters and tested them as ..

How does ApplicationContextAware work in Spring?

In spring, if a bean implements ApplicationContextAware, then it is able to access the applicationContext. Therefore it is able to get other beans. e.g. public class SpringContextUtil implements App..

Parse JSON with R

I am fairly new to R, but the more use it, the more I see how powerful it really is over SAS or SPSS. Just one of the major benefits, as I see them, is the ability to get and analyze data from the we..

Rotating and spacing axis labels in ggplot2

I have a plot where the x-axis is a factor whose labels are long. While probably not an ideal visualization, for now I'd like to simply rotate these labels to be vertical. I've figured this part out..

Deleting specific rows from DataTable

I want to delete some rows from DataTable, but it gives an error like this, Collection was modified; enumeration operation might not execute I use for deleting this code, foreach(DataRow dr..

stale element reference: element is not attached to the page document

I have list which has multiple links under each section. Each section has same links I need to click a particular link under each section. I have written the below code but when it executes it gives m..

Efficient way to remove keys with empty strings from a dict

I have a dict and would like to remove all the keys for which there are empty value strings. metadata = {u'Composite:PreviewImage': u'(Binary data 101973 bytes)', u'EXIF:CFAPattern2': u''..

Eclipse Workspaces: What for and why?

I have seen, read and thought of different ways of using workspaces (per project, per application (multi-asseted or not), per program language, per target (web-development, plugins,..), and so on) and..

How to print a date in a regular format?

This is my code: import datetime today = datetime.date.today() print(today) This prints: 2008-11-22 which is exactly what I want. But, I have a list I'm appending this to and then suddenly everyth..

Remove Fragment Page from ViewPager in Android

I'm trying to dynamically add and remove Fragments from a ViewPager, adding works without any problems, but removing doesn't work as expected. Everytime I want to remove the current item, the last on..

How to Configure SSL for Amazon S3 bucket

I am using an Amazon S3 bucket for uploading and downloading of data using my .NET application. Now my question is: I want to access my S3 bucket using SSL. Is it possible to implement SSL for an Amaz..

How do I calculate r-squared using Python and Numpy?

I'm using Python and Numpy to calculate a best fit polynomial of arbitrary degree. I pass a list of x values, y values, and the degree of the polynomial I want to fit (linear, quadratic, etc.). This..

MVC4 input field placeholder

Does MVC4 by default support placeholders for generated input fields? I didn't found anything so I am trying to implement my own but unfortunately Prompt = "E-Mail" is not passed to ViewData.ModelMeta..

HTML5 Video not working in IE 11

I have a video archive that I have working in everything except IE 11. I get the error "Error: Unsupported video type or invalid file path" when loaded in IE 11. Below is the HTML I am using. <vid..

Python PIP Install throws TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'

Using pip install for any module apparently on my Ubuntu 16.04 system with python 2.7.11+ throws this error: TypeError: unsupported operand type(s) for -=: 'Retry' and 'int' What is wrong with pip?..

How to determine the encoding of text?

I received some text that is encoded, but I don't know what charset was used. Is there a way to determine the encoding of a text file using Python? How can I detect the encoding/codepage of a text fil..

PHP cURL HTTP CODE return 0

I dont understand when I echo $httpCode I always get 0, I was expecting 404 when I change $html_brand into a broken url. Is there anything that I miss or do not know of? Thanks. //check if url exist..

There are No resources that can be added or removed from the server

I have created a Dynamic web project, but I am not able to deploy it into Apache Tomcat Server 6.0. I am getting this error when I try to deploy my project: There are No resources that can be add..

How can change width of dropdown list?

I have a listbox and I want to decrease its width. Here is my code: <select name="wgtmsr" id="wgtmsr" style="width: 50px;"> <option value="kg">Kg</option> <option value="gm"..

Convert array of indices to 1-hot encoded numpy array

Let's say I have a 1d numpy array a = array([1,0,3]) I would like to encode this as a 2D one-hot array b = array([[0,1,0,0], [1,0,0,0], [0,0,0,1]]) Is there a quick way to do this? Quicker than jus..

Spring Boot java.lang.NoClassDefFoundError: javax/servlet/Filter

I Started a new project with Spring Boot 1.2.3. I'm getting error java.lang.NoClassDefFoundError: javax/servlet/Filter Gradle Dependencies: dependencies { compile("org.springframework.boot:s..

Convert .pem to .crt and .key

Can anyone tell me the correct way/command to extract/convert the certificate .crt and private key .key files from a .pem file? I just read they are interchangable, but not how...

javax.net.ssl.SSLException: Received fatal alert: protocol_version

Has anyone encountered this error before? I'm new to SSL, is there anything obviously wrong with my ClientHello that I'm missing? That exception is thrown with no ServerHello response. Any advice i..

How to select distinct rows in a datatable and store into an array

I have a dataset objds. objds contains a table named Table1. Table1 contains column named ProcessName. This ProcessName contains repeated names.So i want to select only distinct names.Is this possible..

Entity Framework select distinct name

How can I do this SQL query with Entity Framework? SELECT DISTINCT NAME FROM TestAddresses ..

PreparedStatement with list of parameters in a IN clause

How to set value for in clause in a preparedStatement in JDBC while executing a query. Example: connection.prepareStatement("Select * from test where field in (?)"); If this in-clause can hold mul..

Exception is: InvalidOperationException - The current type, is an interface and cannot be constructed. Are you missing a type mapping?

In my bootstrapper: namespace Conduit.Mam.ClientServices.Common.Initizliaer { public static class Initializer { private static bool isInitialize; private static readonly objec..

Reset input value in angular 2

I have the following input field : <input mdInput placeholder="Name" #filterName name="filterName" > I want to clear value on click of clear button : <button (click)="clearFilters()">C..

The EntityManager is closed

[Doctrine\ORM\ORMException] The EntityManager is closed. After I get a DBAL exception when inserting data, EntityManager closes and I'm not able to reconnect it. I tried like this but it didn..

How do I clear this setInterval inside a function?

Normally, I’d set the interval to a variable and then clear it like var the_int = setInterval(); clearInterval(the_int); but for my code to work I put it in an anonymous function: function interval..

Python unexpected EOF while parsing

Here's my python code. Could someone show me what's wrong with it. while 1: date=input("Example: March 21 | What is the date? ") if date=="June 21": sd="23.5° North Latitude" if date=="March 21"..

Inline style to act as :hover in CSS

I know that embedding CSS styles directly into the HTML tags they affect defeats much of the purpose of CSS, but sometimes it's useful for debugging purposes, as in: <p style="font-size: 24px">..

How to DROP multiple columns with a single ALTER TABLE statement in SQL Server?

I would like to write a single SQL command to drop multiple columns from a single table in one ALTER TABLE statement. From MSDN's ALTER TABLE documentation... DROP { [CONSTRAINT] constraint_name | ..

How to unescape a Java string literal in Java?

I'm processing some Java source code using Java. I'm extracting the string literals and feeding them to a function taking a String. The problem is that I need to pass the unescaped version of the Stri..

How to create Android Facebook Key Hash?

I do not understand this process at all. I have been able to navigate to the folder containing the keytool in the Java SDK. Although I keep getting the error openssl not recognised as an internal or e..

How do I check if a string is unicode or ascii?

What do I have to do in Python to figure out which encoding a string has?..

Method Call Chaining; returning a pointer vs a reference?

I have a Text class that has certain methods that return a pointer to itself, allowing calls to be chained. (The reason being I merely like how the chaining looks and feels, honestly!) My question i..

Maven: How to change path to target directory from command line?

Maven: How to change path to target directory from command line? (I want to use another target directory in some cases)..

Missing Authentication Token while accessing API Gateway?

I am trying to call a Lambda Function through AWS API Gateway. When I mention Authentication type NONE it works fine but API become public and anyone with url can access my API. To make API call secu..

How to create a popup window (PopupWindow) in Android

To create a simple working PopupWindow, we need to do the following: popup_example.xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/ap..