Questions Tagged with #Ecos

A small-footprint real-time operating system intended for use in embedded systems across multiple architectures.

Understanding esModuleInterop in tsconfig file

I was checking out someone .tsconfig file and there I spotted --esModuleInterop This is his .tsconfig file { "compilerOptions": { "moduleResolution": "node", &q..

Specifying onClick event type with Typescript and React.Konva

I'm trying to get rid of my tslint error Type declaration of 'any' loses type-safety. but I'm struggling to figure out what the correct type would be for the Event. I'm working through the Lynda "Bu..

Download and save PDF file with Python requests module

I am trying to download a PDF file from a website and save it to disk. My attempts either fail with encoding errors or result in blank PDFs. In [1]: import requests In [2]: url = 'http://www.hrecos...

Xcode Project vs. Xcode Workspace - Differences

I am trying to understand how the whole ecosystem of iOS works. Until now, I could find an answer for most of my question (and trust me, there have been a lots of them), but for this one, there seems..

How to enter a formula into a cell using VBA?

I am trying to enter a formula into a cell which contains variable called var1a? The code that I have is: Worksheets("EmployeeCosts").Range("B" & var1a).Formula = ""SUM(H5:H""& var1a) B..

What is best way to start and stop hadoop ecosystem, with command line?

I see there are several ways we can start hadoop ecosystem, start-all.sh & stop-all.sh Which say it's deprecated use start-dfs.sh & start-yarn.sh. start-dfs.sh, stop-dfs.sh and start-yarn.s..

How to rollback or commit a transaction in SQL Server

In my stored procedure, I have three insert statements. On duplicate key value insertion first two queries generate the error Violation of PRIMARY KEY constraint and third query runs as usual...

How to multiply a BigDecimal by an integer in Java

How do you multiply a BigDecimal by an integer in Java? I tried this but its not correct. import java.math.BigDecimal; import java.math.MathContext; public class Payment { int itemCost; int ..

Dealing with "Xerces hell" in Java/Maven?

In my office, the mere mention of the word Xerces is enough to incite murderous rage from developers. A cursory glance at the other Xerces questions on SO seem to indicate that almost all Maven users ..

What is Node.js' Connect, Express and "middleware"?

Despite knowing JavaScript quite well, I'm confused what exactly these three projects in Node.js ecosystem do. Is it something like Rails' Rack? Can someone please explain?..

"java.lang.OutOfMemoryError: PermGen space" in Maven build

I'm getting this error while building Maven project, I increased MAVEN_OPTS but all the same, I found some similar posts but they are refering to something else. How do I fix this? The system is out..

How to create a readonly textbox in ASP.NET MVC3 Razor

How do I create a readonly textbox in ASP.NET MVC3 with the Razor view engine? Is there an HTMLHelper method available to do that? Something like the following? @Html.ReadOnlyTextBoxFor(m => m.u..

jQuery 1.9 .live() is not a function

I recently updated jQuery from 1.8 to 2.1. I suddenly discovered that the .live() stops working. I get the error TypeError: $(...).live is not a function. Is there any method I can use in place of .l..

Change :hover CSS properties with JavaScript

How can JavaScript change CSS :hover properties? For example: HTML <table> <tr> <td>Hover 1</td> <td>Hover 2</td> </tr> </table> CSS table ..

Auto-refreshing div with jQuery - setTimeout or another method?

How exactly do you make an auto-refreshing div with JavaScript (specifically, jQuery)? I know about the setTimeout method, but is it really a good practice ? Is there a better method? function updat..

What is a "cache-friendly" code?

What is the difference between "cache unfriendly code" and the "cache friendly" code? How can I make sure I write cache-efficient code? ..

Select rows where column is null

How do you write a SELECT statement that only returns rows where the value for a certain column is null?..

Remove characters before character "."

How effectively remove all character in string that placed before character "."? Input: Amerika.USA Output: USA..

angular 2 sort and filter

In Angularjs 1 it is possible to sort and filter the following way: <ul ng-repeat="friend in friends | filter:query | orderBy: 'name' "> <li>{{friend.name}}</li> </ul> Bu..

How do I clear the dropdownlist values on button click event using jQuery?

How do I clear the dropdownlist values on button click event using jQuery?..

How to get exact browser name and version?

I have tried some solutions but I am unable to get exact name and version: I am trying following code: $browserAgent = $_SERVER['HTTP_USER_AGENT']; echo $browserAgent; Output of above code: Mozil..

Using Python's ftplib to get a directory listing, portably

You can use ftplib for full FTP support in Python. However the preferred way of getting a directory listing is: # File: ftplib-example-1.py import ftplib ftp = ftplib.FTP("www.python.org") ftp.logi..

window.open with headers

Can I control the HTTP headers sent by window.open (cross browser)? If not, can I somehow window.open a page that then issues my request with custom headers inside its popped-up window? I need some ..

jQuery Remove string from string

I am trying to remove a string from a string in jQuery. Here is the string: username1, username2 and username3 like this post. I would like to remove username1, from this list. I tried adding the ..

Sending and receiving UDP packets?

I have made a program to send an UDP packets from a client to a server. Here is the transmitter code: import java.io.IOException; import java.net.*; public class JavaApplication9 { public s..

Display rows with one or more NaN values in pandas dataframe

I have a dataframe in which some rows contain missing values. In [31]: df.head() Out[31]: alpha1 alpha2 gamma1 gamma2 chi2min filename ..

Angularjs action on click of button

I am trying to do some calculation but it is getting done as soon as I enter the amount. I just want this to happen on click of a button rather than automatically. What I have done so far: <!DOCT..

Adding two Java 8 streams, or an extra element to a stream

I can add streams or extra elements, like this: Stream stream = Stream.concat(stream1, Stream.concat(stream2, Stream.of(element)); And I can add new stuff as I go, like this: Stream stream = Strea..

How does spring.jpa.hibernate.ddl-auto property exactly work in Spring?

I was working on my Spring boot app project and noticed that, sometimes there is a connection time out error to my Database on another server(SQL Server). This happens specially when I try to do some..

Making the iPhone vibrate

How can the iPhone be set to vibrate once? For example, when a player loses a life or the game is over, the iPhone should vibrate...

How to make the first option of <select> selected with jQuery

How do I make the first option of selected with jQuery? <select id="target"> <option value="1">...</option> <option value="2">...</option> </select> ..

How to replace all spaces in a string

I have two html text input, out of that what ever user type in first text box that need to reflect on second text box while reflecting it should replace all spaces to semicolon. I did to some extant a..

How to prevent going back to the previous activity?

When the BACK button is pressed on the phone, I want to prevent a specific activity from returning to its previous one. Specifically, I have login and sign up screens, both start a new activity calle..

How do you merge two Git repositories?

Consider the following scenario: I have developed a small experimental project A in its own Git repo. It has now matured, and I'd like A to be part of larger project B, which has its own big reposito..

Gradle task - pass arguments to Java application

I have a Java application that runs with a custom gradle task and the application requires some arguments upon being invoked. These are: programName ( string | -f filename | -d key | -h) Options: ..

Android - Spacing between CheckBox and text

Is there an easy way to add padding between the checkbox in a CheckBox control, and the associated text? I cannot just add leading spaces, because my label is multi-line. As-is, the text is way too ..

How to get a unique computer identifier in Java (like disk ID or motherboard ID)?

I'd like to get an id unique to a computer with Java, on Windows, MacOS and, if possible, Linux. It could be a disk UUID, motherboard S/N... Runtime.getRuntime().exec can be used (it is not an applet..

TransactionRequiredException Executing an update/delete query

Hi I am using hibernate JPA with spring and mongodb and i am running my application on Glassfish-4.0. My service class is : @Component public class Test { @PersistenceContext EntityManager e..

Is it possible to iterate through JSONArray?

Possible Duplicates: JSON Array iteration in Android/Java JSONArray with Java Is it possible to iterate through JSONArray object using Iterator?..

How do I test which class an object is in Objective-C?

How do I test whether an object is an instance of a particular class in Objective-C? Let's say I want to see if object a is an instance of class b, or class c, how do I go about doing it?..

How to escape a single quote inside awk

I want do the following awk 'BEGIN {FS=" ";} {printf "'%s' ", $1}' But escaping single quote this way does not work awk 'BEGIN {FS=" ";} {printf "\'%s\' ", $1}' How to do this? Thanks for help...

Best way to clear a PHP array's values

Which is more efficient for clearing all values in an array? The first one would require me to use that function each time in the loop of the second example. foreach ($array as $i => $value) { ..

Vuejs: Event on route change

In my main page I have dropdowns that show v-show=show by clicking on link @click = "show=!show" and I want to set show=false when I change route. Advise me please how to realize this thing...

Convert Rtf to HTML

We have a crystal report that we need to send out as an e-mail, but the HTML generated from the crystal report is pretty much just plain ugly and causes issues with some e-mail clients. I wanted to e..

How do I get a list of files in a directory in C++?

How do you get a list of files within a directory so each can be processed?..

Twitter Bootstrap - full width navbar

Following the example of TB, I have a navbar that is marked up as follows: <div class="container"> <div class="navbar"> <div class="navbar-inner"> <..

How to run functions in parallel?

I researched first and couldn't find an answer to my question. I am trying to run multiple functions in parallel in Python. I have something like this: files.py import common #common is a util class ..

Less than or equal to

Using the pause command I found that the error is in the first line of this code: if %choice% == 1 if %energy% => %m2enc% set /a enemhp=%enemhp%-%m1hpd%+%earmr% pause set /a energy= %energy%-%m1en..

How to fix curl: (60) SSL certificate: Invalid certificate chain

I get the following error running curl https://npmjs.org/install.sh | sh on Mac OSX 10.9 (Mavericks): install npm@latest curl: (60) SSL certificate problem: Invalid certificate chain More details her..

How to export iTerm2 Profiles

I needed to reformat my computer and now I'm having trouble copying the settings/profiles over. I copied the files in ~/Library/Application\ Support/iTerm/ I also copied ~/Library/Preferences/com.go..

Python: finding lowest integer

I have the following code: l = ['-1.2', '0.0', '1'] x = 100.0 for i in l: if i < x: x = i print x The code should find the lowest value in my list (-1.2) but instead when i print 'x..

Adding elements to a C# array

I would like to programmatically add or remove some elements to a string array in C#, but still keeping the items I had before, a bit like the VB function ReDim Preserve...

how to use "tab space" while writing in text file

SimpleDateFormat formatter = new SimpleDateFormat("ddMMyyyy_HHmmSS"); String strCurrDate = formatter.format(new java.util.Date()); String strfileNm = "Cust_Advice_" + strCurrDate + ".txt"; String ..

What's is the difference between train, validation and test set, in neural networks?

I'm using this library to implement a learning agent. I have generated the training cases, but I don't know for sure what the validation and test sets are. The teacher says: 70% should be train c..

How to read pickle file?

I created some data and stored it several times like this: with open('filename', 'a') as f: pickle.dump(data, f) Every time the size of file increased, but when I open file with open('file..

how to list all sub directories in a directory

I'm working on a project and I need to list all sub directories in a directory for example how could I list all the sub directories in c:\..

How to get ERD diagram for an existing database?

I have a PostgreSQL database. I want to get its ERD. How can I do so?..

align an image and some text on the same line without using div width?

Ok so I'm trying to align an image(which is contained in a div) and some text(also contained in a div) on the same line, without setting width for the text, how can i do it? This is what I have so far..

How to properly add include directories with CMake

About a year ago I asked about header dependencies in CMake. I realized recently that the issue seemed to be that CMake considered those header files to be external to the project. At least, when gen..

Override browser form-filling and input highlighting with HTML/CSS

I have 2 basic forms -- sign in and sign up, both on the same page. Now, I have no problem with the sign in form auto-filling, but the sign up form auto fills as well, and I don't like it. Also, the ..

How do I convert an Array to a List<object> in C#?

How do I convert an Array to a List<object> in C#?..

pandas groupby sort within groups

I want to group my dataframe by two columns and then sort the aggregated results within the groups. In [167]: df Out[167]: count job source 0 2 sales A 1 4 sales B 2 6 sales C 3 ..

How to fix homebrew permissions?

I have uninstalled and installed Homebrew 3 times now because it seems to never allow me to install anything as it denies me permissions at the end of most installations. As an example I will post th..

Screen width in React Native

How do I get screen width in React native? (I need it because I use some absolute components that overlap and their position on screen changes with different devices)..

How can I remove punctuation from input text in Java?

I am trying to get a sentence using input from the user in Java, and i need to make it lowercase and remove all punctuation. Here is my code: String[] words = instring.split("\\s+"); for (int..

How to use Simple Ajax Beginform in Asp.net MVC 4?

I am new in Asp.net MVC and i researched about Ajax.BeginForm but when i apply codes it did not work. Can you share very simple example with Ajax.Beginform with View, Controller, Model? Thanks...

jQuery detect if textarea is empty

I am trying to determine if a textarea is empty if a user deletes what is already pre-populated in the textarea using jQuery. Anyway to do this? This is what I have and its not working $(textarea)...

Is it possible to set a custom font for entire of application?

I need to use certain font for my entire application. I have .ttf file for the same. Is it possible to set this as default font, at application start up and then use it elsewhere in the application? W..

check if array is empty (vba excel)

These if ... then statements are getting the wrong results in my opinion. The first is returning the value 'false' when it should be 'true'. The fourth returns the right value. The second and third re..

How to solve ADB device unauthorized in Android ADB host device?

When I'm using a rooted Android device as ADB host to send adb command "adb devices" to Samsung S4, I received device unauthorized error message. However when I tried adb to Samsung Galaxy Nexus, it i..

Converting to upper and lower case in Java

I want to convert the first character of a string to Uppercase and the rest of the characters to lowercase. How can I do it? Example: String inputval="ABCb" OR "a123BC_DET" or "aBcd" String output..

How to create a pivot query in sql server without aggregate function

I am using MS SQL SERVER 2008 and I have following data: select * from account; | PERIOD | ACCOUNT | VALUE | ---------------------------- | 2000 | Asset | 205 | | 2000 | Equity | 365 | |..

How to send email from MySQL 5.1

I'm trying to send an email to several recipients when a new row is inserted into a table. The list of recipients varies. I would like to be able to set this list using a select statement. I also ha..

How to debug ORA-01775: looping chain of synonyms?

I'm familiar with the issue behind ORA-01775: looping chain of synonyms, but is there any trick to debugging it, or do I just have to "create or replace" my way out of it? Is there a way to query t..

How do I convert a list of ascii values to a string in python?

I've got a list in a Python program that contains a series of numbers, which are themselves ASCII values. How do I convert this into a "regular" string that I can echo to the screen?..

How to create a jQuery plugin with methods?

I'm trying to write a jQuery plugin that will provide additional functions/methods to the object that calls it. All the tutorials I read online (have been browsing for the past 2 hours) include, at th..

EXEC sp_executesql with multiple parameters

How to pass the parameters to the EXEC sp_executesql statement correctly? This is what I have now, but i'm getting errors: alter PROCEDURE [dbo].[usp_getReceivedCases] -- Add the parameters for..

to_string not declared in scope

I am trying to make the to_string(NUMBER) function work in my Ubuntu computer for weeks but it never ever works in the QT environment or anywhere else. My code works perfectly on my Mac osx, but when ..

Copy a file list as text from Windows Explorer

Is there a quick way to copy a list of filenames as text into the clipboard from Windows Explorer? I can do it from the command prompt with dir > filenames.txt, but I am looking for something alon..

GIT: Checkout to a specific folder

I want to use something similar to: git checkout -- <path>/<file> but I want to checkout the file to some folder I choose, rather than the overwriting the local <path>/<file>..

Change line width of lines in matplotlib pyplot legend

I would like to change the thickness/width of the line samples featured in the pyplot legend. Line width of line samples within legend are the same as the lines they represent in the plot (so if lin..

Datatable to html Table

I have question, that maybe someone here wouldn't mind to help me with. I have lets say 3 datatables, each one of them has the following columns: size, quantity, amount, duration Name of datatables an..

Why is a ConcurrentModificationException thrown and how to debug it

I am using a Collection (a HashMap used indirectly by the JPA, it so happens), but apparently randomly the code throws a ConcurrentModificationException. What is causing it and how do I fix this probl..

Setting Icon for wpf application (VS 08)

Before going much further i'll mention I have tried solutions in following: How do I set the icon for my application in visual studio 2008? Set application icon from resources in VS 05 I am trying ..

How can I get the selected VALUE out of a QCombobox?

In Qt, I can get the selected text of a QComboBox by using the combobox->currentText() method. How can I get the selected value? I searched for help but I couldn't find a method currentData() whi..

A circular reference was detected while serializing an object of type 'SubSonic.Schema .DatabaseColumn'.

I am trying to do a simple JSON return but I am having issues I have the following below. public JsonResult GetEventData() { var data = Event.Find(x => x.ID != 0); return Json(data); } I..

Iterating through a string word by word

I wanted to know how to iterate through a string word by word. string = "this is a string" for word in string: print (word) The above gives an output: t h i s i s a s t r i n g But ..

How to store directory files listing into an array?

I'm trying to store the files listing into an array and then loop through the array again. Below is what I get when I run ls -ls command from the console. total 40 36 -rwxrwxr-x 1 amit amit 36720 20..

Login failed for user 'IIS APPPOOL\ASP.NET v4.0'

I have a web project (C# Asp.Net, EF 4, MS SQL 2008 and IIS 7) and I need to migrate it to IIS 7 locally (at the moment works fine with CASSINI). Locally in IIS I have my Default Web Site with my dep..

'Incorrect SET Options' Error When Building Database Project

We are using Visual Studio and a database project to generate our database. I just made a number of database changes (including adding a new table named Correspondence) imported those changes into th..

How to import .py file from another directory?

I have this structure of files (directory and after arrow files): model -> py_file.py report -> other_py_file.py main __init__.py: import model import report model directory: import py_f..

Angular 2: Passing Data to Routes?

I am working on this angular2 project in which I am using ROUTER_DIRECTIVES to navigate from one component to other. There are 2 components. i.e. PagesComponent & DesignerComponent. I want to na..

Number of days between past date and current date in Google spreadsheet

I want to calculate the number of days passed between past date and a current date. My past date is in the format dd/mm/yyyy format. I have used below mentioned formulas but giving the proper output. ..

PHP code to get selected text of a combo box

I have a combo box named "Make". In that combo box I'm loading vehicle manufacturer names. When I click SEARCH button I want to display the selected manufacturer name. Below is part of my HTML code. ..

Difference between r+ and w+ in fopen()

In fopen("myfile", "r+") what is the difference between the "r+" and "w+" open mode? I read this: "r" Open a text file for reading. "w" Open a text file for writing, truncating an an existing ..

Including JavaScript class definition from another file in Node.js

I'm writing a simple server for Node.js and I'm using my own class called User which looks like: function User(socket) { this.socket = socket; this.nickname = null; /* ... just the typic..

Execute a batch file on a remote PC using a batch file on local PC

I want to execute a batch file D:\apache-tomcat-6.0.20\apache-tomcat-7.0.30\bin\shutdown.bat Which is on my server inidsoasrv01. How should I write my .bat file?..

How to kill zombie process

I launched my program in the foreground (a daemon program), and then I killed it with kill -9, but I get a zombie remaining and I m not able to kill it with kill -9. How to kill a zombie process? If ..

PHP unable to load php_curl.dll extension

Follow-up from my post yesterday (Enabling cURL with PHP) The problem is that PHP isn't able to load php_curl.dll. I've tried several steps including uncommenting extension=php_curl.dll, making sure..

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

Npm install failed with "cannot run in wd"

I am trying to get my node environment set up on a new Ubuntu 12.04 instance, with Node 0.8.14 already installed, but I ran into problems when I try to run npm install. So when I try npm install, it s..

Add vertical scroll bar to panel

I am trying to make a Panel scrollable, but only vertically (so AutoScroll won't work because the child controls go past the left edge and must). So how is this done?..

Escape text for HTML

How do i escape text for html use in C#? I want to do sample="<span>blah<span>" and have <span>blah<span> show up as plain text instead of blah only with the tags part ..

How to loop through elements of forms with JavaScript?

I have a form: <form method="POST" action="submit.php"> <input type="text" value="1"> <input type="text" value="2"> <input type="text" value="3"> <input typ..

How to convert date format to DD-MM-YYYY in C#

How to convert date format to DD-MM-YYYY in C#? I am only looking for DD-MM-YYYY format not anything else...

Programmatically get the version number of a DLL

Is it possible to get the version number programmatically from any .NET DLL? If yes, how?..

Detect Safari browser

How to detect Safari browser using JavaScript? I have tried code below and it detects not only Safari but also Chrome browser. function IsSafari() { var is_safari = navigator.userAgent.toLowerCase..

How to rotate a div using jQuery

Is it possible to rotate a div using jQuery? I can rotate an image but can't rotate a div; is there any solution for this?..

Visual Studio Code compile on save

How can I configure Visual Studio Code to compile typescript files on save? I see it is possible to configure a task to build the file in focus using the ${file} as an argument. But I would like th..

How to get start and end of day in Javascript?

How to get start ( 00:00:00 ) and end ( 23:59:59 ) of today in timestamp ( GMT )? Computer use a local time...

Concatenating multiple text files into a single file in Bash

What is the quickest and most pragmatic way to combine all *.txt file in a directory into one large text file? Currently I'm using windows with cygwin so I have access to BASH. Windows shell command..

Align <div> elements side by side

I know this is a rather simple question, but I can't figure it out for the life of me. I have two links which I've applied a background image to. Here's what it currently looks like (apologies for ..

How to import and use image in a Vue single file component?

I think this should be simple, but I am facing some trouble on how to import and use an image in Vue single file component. Can someone help me how to do this? Here is my code snippet: <template la..

Git reset --hard and push to remote repository

I had a repository that had some bad commits on it (D, E and F for this example). A-B-C-D-E-F master and origin/master I've modified the local repository specifically with a git reset --hard. I..

C# SQL Server - Passing a list to a stored procedure

I am calling a SQL Server stored procedure from my C# code: using (SqlConnection conn = new SqlConnection(connstring)) { conn.Open(); using (SqlCommand cmd = new SqlCommand("InsertQuerySPROC", ..

How to convert Rows to Columns in Oracle?

I have a table in this form (this is just the partial view, the table contains more than 100 columns). LOAN NUMBER DOCUMENT_TYPE DOCUMENT_ID 992452533663 Voters ID ..

How to determine if one array contains all elements of another array

Given: a1 = [5, 1, 6, 14, 2, 8] I would like to determine if it contains all elements of: a2 = [2, 6, 15] In this case the result is false. Are there any built-in Ruby/Rails methods to identify..

What's the difference between REST & RESTful

What's the difference between a REST system and a system that is RESTful? From a few things I've read most so called REST services are actually RESTful services. So what is the difference between the..

Starting a node.js server

I recently got into node and I installed it on my localhost. I am using WAMP. I am on Windows Vista. Anwyay, I installed it. I made a new file in my localhost directory with this being called server...

Parse JSON object with string and value only

I have problem when trying to parse with minimum value to map in Android. There some sample JSON format with more information ex: [{id:"1", name:"sql"},{id:"2",name:"android"},{id:"3",name:"mvc"}] ..

When and where to use GetType() or typeof()?

Why this works if (mycontrol.GetType() == typeof(TextBox)) {} and this do not? Type tp = typeof(mycontrol); But this works Type tp = mycontrol.GetType(); I myself use is operator for checkin..

failed to load ad : 3

I'm setting an ad to my Android application using DoubleClick and can't manage to show the final ad, can someone help me? When I test an ad by adding ".addTestDevice("xxx...")" I g..

Call Class Method From Another Class

In Python, is there a way to call a class method from another class? I am attempting to spin my own MVC framework in Python and I can not figure out how to invoke a method from one class in another cl..

Tomcat: LifecycleException when deploying

I just downloaded the Tomcat 7.0.23 package on my Ubuntu 11.10. I followed the instructions on a Google API website to deploy their example webapp. It basically consists of jar files placed in the W..

android pick images from gallery

I want to create a picture chooser from gallery. I use code intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(intent, T..

Best way to structure a tkinter application?

The following is the overall structure of my typical python tkinter program. def funA(): def funA1(): def funA12(): # stuff def funA2(): # stuff def funB(): ..

What is the most compatible way to install python modules on a Mac?

I'm starting to learn python and loving it. I work on a Mac mainly as well as Linux. I'm finding that on Linux (Ubuntu 9.04 mostly) when I install a python module using apt-get it works fine. I can im..

Comparison of C++ unit test frameworks

I know there are already a few questions regarding recommendations for C++ unit test frameworks, but all the answers did not help as they just recommend one of the frameworks but do not provide any in..

Remove an array element and shift the remaining ones

How do I remove an element of an array and shift the remaining elements down. So, if I have an array, array[]={1,2,3,4,5} and want to delete 3 and shift the rest so I have, array[]={1,2,4,5} H..

Get min and max value in PHP Array

I have an array like this: array (0 => array ( 'id' => '20110209172713', 'Date' => '2011-02-09', 'Weight' => '200', ), 1 => array ( 'id' => '20110209172747', 'Date' =>..

How to automatically import data from uploaded CSV or XLS file into Google Sheets

I have a legacy database system (not web accessible) on a server which generates CSV or XLS reports to a Google Drive folder. Currently, I am manually opening those files in Drive web interface and c..

CSS horizontal centering of a fixed div?

#menu { position: fixed; width: 800px; background: rgb(255, 255, 255); /* The Fallback */ background: rgba(255, 255, 255, 0.8); margin-top: 30px; } I know this question is a mill..

Return string Input with parse.string

I'm having an issue with a java program trying to get a string input from a joptionpane menu with a prompt box. With returning a string input. I don't know if im going about it all wrong by trying to..

How to resolve this JNI error when trying to run LWJGL "Hello World"?

I'm trying to run the sample "Hello World" from the LWJGL website From this link: LWJGL "Getting Started" I'm trying to do this via the command line, just so I understand the "behind the scenes" a b..

Should I use the Reply-To header when sending emails as a service to others?

Suppose we have an application that acts as a middleman, allowing Company A to send reports to their customers. Company A --> Company B (me)--> Company A's customers After getting the report we ..

How to use struct timeval to get the execution time?

After reading this article about elapsed time, I wrote a simple code to calculate the execution time of a loop: #include <stdio.h> #include <sys/time.h> int main (int argc, char** argv) ..

Load and execution sequence of a web page?

I have done some web based projects, but I don't think too much about the load and execution sequence of an ordinary web page. But now I need to know detail. It's hard to find answers from Google or S..

Python 2.7 getting user input and manipulating as string without quotations

I want to get a string from a user, and then to manipulate it. testVar = input("Ask user for something.") Is there a way for testVar to be a string without me having the user type his response in q..

Best way to compare 2 XML documents in Java

I'm trying to write an automated test of an application that basically translates a custom message format into an XML message and sends it out the other end. I've got a good set of input/output messa..

Array as session variable

Is it possible to make an array a session variable in PHP? The situation is that I have a table (page 1) with some cells having a link to a particular page. The next page will have a list of names (p..

How do I bind the enter key to a function in tkinter?

I am a Python beginning self-learner, running on MacOS. I'm making a program with a text parser GUI in tkinter, where you type a command in a Entry widget, and hit a Button widget, which triggers my p..

Loop through files in a directory using PowerShell

How can I change the following code to look at all the .log files in the directory and not just the one file? I need to loop through all the files and delete all lines that do not contain "step4" or ..

yii2 hidden input value

In Yii2 I'm trying to construct hidden input echo $form->field($model, 'hidden1')->hiddenInput()->label(false); But I also need it to have some value option, how can I do that ?..

Which language uses .pde extension?

While searching for an implementation of the Barnsley's Fern fractal I came across a implementation that has .pde extension. Which programming language uses this extension? Implementation Page..

How to Install Sublime Text 3 using Homebrew

How can I use homebrew cask to install Sublime Text 3? I only see sublime text 2 in the repos. I even tried tapping homebrew/versions, but no luck. Thanks! EDIT: Answered by my answer below..

Facebook Graph API v2.0+ - /me/friends returns empty, or only friends who also use my application

I am trying to get my friend name and ids with Graph API v2.0, but data returns empty: { "data": [ ] } When I was using v1.0, everything was OK with the following request: FBRequest* friendsRe..

How to get an array of specific "key" in multidimensional array without looping

Let's assume I have the following multidimensional array (retrieved from MySQL or a service): array( array( [id] => xxx, [name] => blah ), array( [id] =>..

Sending HTTP POST Request In Java

lets assume this URL... http://www.example.com/page.php?id=10 (Here id needs to be sent in a POST request) I want to send the id = 10 to the server's page.php, which accepts it in a PO..

HtmlSpecialChars equivalent in Javascript?

Apparently, this is harder to find than I thought it would be. And it even is so simple... Is there a function equivalent to PHP's htmlspecialchars built into Javascript? I know it's fairly easy to i..

Extreme wait-time when taking a SQL Server database offline

I'm trying to perform some offline maintenance (dev database restore from live backup) on my dev database, but the 'Take Offline' command via SQL Server Management Studio is performing extremely slowl..

PHP/MySQL insert row then get 'id'

The 'id' field of my table auto increases when I insert a row. I want to insert a row and then get that ID. I would do it just as I said it, but is there a way I can do it without worrying about the ..

clear table jquery

I have an HTML table filled with a number of rows. How can I remove all the rows from the table?..

How to get size of mysql database?

How to get size of a mysql database? Suppose the target database is called "v3"...

Benefits of EBS vs. instance-store (and vice-versa)

I'm unclear as to what benefits I get from EBS vs. instance-store for my instances on Amazon EC2. If anything, it seems that EBS is way more useful (stop, start, persist + better speed) at relatively ..

Is it possible to access an SQLite database from JavaScript?

I have a set of HTML files and a SQLite database, which I would like to access from the browser, using the file:// scheme. Is it possible to access the database and create queries (and tables) using J..

What are the minimum margins most printers can handle?

Im creating pdfs server side with lots of graphics so maximizing real estate is a must but at the same time ensuring users printers can handle the tight margins is a must. Does anyone have an idea w..

Return an empty Observable

The function more() is supposed to return an Observable from a get request export class Collection{ public more = (): Observable<Response> => { if (this.hasMore()) { re..

sqlplus how to find details of the currently connected database session

I have very recently started to work on oracle databases. Generally I have many sqlplus windows open to different oracle databases. When switching from one sqlplus session to another, how can i view t..

How to check if android checkbox is checked within its onClick method (declared in XML)?

I have a checkbox in android which has the following XML: <CheckBox android:id="@+id/item_check" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClic..

Questions every good Database/SQL developer should be able to answer

I was going through Questions every good .Net developer should be able to answer and was highly impressed with the content and approach of this question and so in the same spirit, I am asking this que..

How to place a div on the right side with absolute position

I've a page where a dynamic message box has to be displayed without disturbing the actual page. This message box has to appear at the top right corner of the page overlapping the existing contents. I..

Truncate string in Laravel blade templates

Is there a truncate modifier for the blade templates in Laravel, pretty much like Smarty? I know I could just write out the actual php in the template but i'm looking for something a little nicer to ..

Why am I getting a FileNotFoundError?

I'm trying to write a simple program to read a file and search for a word then print how many times that word is found in the file. Every time I type in "test.rtf" (which is the name of my ..

File 'app/hero.ts' is not a module error in the console, where to store interfaces files in directory structure with angular2?

I am doing the angular2 tutorial at this address: https://angular.io/docs/ts/latest/tutorial/toh-pt3.html I have put the hero interface in a single file under the app folder, in the console I have thi..

What is the use of join() in Python threading?

I was studying the python threading and came across join(). The author told that if thread is in daemon mode then i need to use join() so that thread can finish itself before main thread terminates. ..

AngularJS $resource RESTful example

I would like to use $resource to call my RESTful web service, (which I am still working on) but I would like to find out if I got my AngularJS script correct first. The todo DTO has: {id, order, cont..

How to check version of python modules?

I just installed the python modules: construct and statlib with setuptools like this: # Install setuptools to be able to download the following sudo apt-get install python-setuptools # Install statl..

Why don’t my SVG images scale using the CSS "width" property?

I'm building a portfolio website. HTML Code <div id = "hero"> <div id = "social"> <img src = "facebook.svg"> <img src = "linkedin.svg"> <img src = "..

Which HTML elements can receive focus?

I'm looking for a definitive list of HTML elements which are allowed to take focus, i.e. which elements will be put into focus when focus() is called on them? I'm writing a jQuery extension which wor..

For Restful API, can GET method use json data?

I don't want to see so long parameters string in the URI. So, can GET method use json data? In my situation, I need to filter the result given kind of parameters. If there are a lot of parameter, the..

How can I copy a file from a remote server to using Putty in Windows?

How do I copy a file from a remote server to my local Windows system using a Putty session?..

HTML/CSS Making a textbox with text that is grayed out, and disappears when I click to enter info, how?

How do I make a textbox that has a grayed out content, and when I click on it to enter text, the grayed out portion, it disappears and allows me to enter the desired text? Example: A "First Name" te..

How to convert from int to string in objective c: example code

I am trying to convert from an int to a string but I am having trouble. I followed the execution through the debugger and the string 'myT' gets the value of 'sum' but the 'if' statement does not work..

How to create a simple http proxy in node.js?

I'm trying to create a proxy server to pass HTTP GET requests from a client to a third party website (say google). My proxy just needs to mirror incoming requests to their corresponding path on the ta..

How to filter multiple values (OR operation) in angularJS

I want to use the filter in angular and want to filter for multiple values, if it has either one of the values then it should be displayed. I have for example this structure: An object movie which..

$("#form1").validate is not a function

<script type="text/javascript"> <!-- $(document).ready(function() { $("#form1").validate({ rules: { budget: { required: true, minlength:3 ..

ORA-00904: invalid identifier

I tried to write the following inner join query using an Oracle database: SELECT Employee.EMPLID as EmpID, Employee.FIRST_NAME AS Name, Team.DEPARTMENT_CODE AS TeamID, Team..

How to check type of files without extensions in python?

I have a folder full of files and they don't have an extension. How can I check file types? I want to check the file type and change the filename accordingly. Let's assume a function filetype(x) retur..

How to return a html page from a restful controller in spring boot?

I want to return a simple html page from controller, but I get only the name of the file not its content. Why? This is my controller code: @RestController public class HomeController { @Request..

SQL Server: UPDATE a table by using ORDER BY

I would like to know if there is a way to use an order by clause when updating a table. I am updating a table and setting a consecutive number, that's why the order of the update is important. Using t..

How can I read a text file from the SD card in Android?

I am new to Android development. I need to read a text file from the SD card and display that text file. Is there any way to view a text file directly in Android or else how can I read and display th..

How to layout multiple panels on a jFrame? (java)

I am in the process of making my own java socket game. My game is painting alright to the full screen (where it says "paint graphics here", but im painting to the whole jframe at the moment). I want..

Get value from hashmap based on key to JSTL

I want to get the value of HashMap based on key. HashMap<String, ArrayList<String>> map = new HashMap<String, ArrayList<String>>(); ArrayList<String> arrayList = ne..

R command for setting working directory to source file location in Rstudio

I am working out some tutorials in R. Each R code is contained in a specific folder. There are data files and other files in there. I want to open the .r file and source it such that I do not have to ..

Regular expression to limit number of characters to 10

I am trying to write a regular expression that will only allow lowercase letters and up to 10 characters. What I have so far looks like this: pattern: /^[a-z]{0,10}+$/ This does not work or compil..

Can you find all classes in a package using reflection?

Is it possible to find all classes or interfaces in a given package? (Quickly looking at e.g. Package, it would seem like no.)..

How do I create a right click context menu in Java Swing?

I'm currently creating a right-click context menu by instantiating a new JMenu on right click and setting its location to that of the mouse's position... Is there a better way?..

How to make Java Set?

Can anyone help me? example A {1,2,3} B {1,4,5} Code snippet: a.intersect(b).print() // Result 1 . twin between two object a.merge(b).print() // Result 1,2,3,4,5 It is valid if I write code be..

Unmarshaling nested JSON objects

There are a few questions on the topic but none of them seem to cover my case, thus I'm creating a new one. I have JSON like the following: {"foo":{ "bar": "1", "baz": "2" }, "more": "text"} Is th..

How to add spacing between columns?

I have two columns: <div class="col-md-6"></div> <div class="col-md-6"></div> How can I add a space between them? The output would simply be two columns ri..

pandas DataFrame: replace nan values with average of columns

I've got a pandas DataFrame filled mostly with real numbers, but there is a few nan values in it as well. How can I replace the nans with averages of columns where they are? This question is very si..

How to implement common bash idioms in Python?

I currently do my textfile manipulation through a bunch of badly remembered AWK, sed, Bash and a tiny bit of Perl. I've seen mentioned a few places that python is good for this kind of thing. How can..

creating batch script to unzip a file without additional zip tools

I'm trying to make a .bat script for windows 7 x64 to create a folder, unzip a file into that folder without having to use additional addons like 7zip or unzip. Been searching and it seemed like windo..

PHP Session data not being saved

I have one of those "I swear I didn't touch the server" situations. I honestly didn't touch any of the php scripts. The problem I am having is that php data is not being saved across different pages o..

Jquery Ajax, return success/error from mvc.net controller

I would like to control when to reply an error message and when a success message but I am always get the error message: here is what I am trying to do: $.ajax({ type: "POST", ..

How to debug a GLSL shader?

I need to debug a GLSL program but I don't know how to output intermediate result. Is it possible to make some debug traces (like with printf) with GLSL ?..

Why is a "GRANT USAGE" created the first time I grant a user privileges?

I'm new to the admin side of DBMS and was setting up a new database tonight (using MySQL) when I noticed this. After granting a user a privilege for the first time, another grant is created that looks..

What does .shape[] do in "for i in range(Y.shape[0])"?

I'm trying to break down a program line by line. Y is a matrix of data but I can't find any concrete data on what .shape[0] does exactly. for i in range(Y.shape[0]): if Y[i] == -1: This program..

Angularjs dynamic ng-pattern validation

I have a form that if a checkbox is false enforces validation on a text input using the ng-required directive. If the checkbox is true, the field is hidden and the ng-required is set to false. The p..

How do I add more members to my ENUM-type column in MySQL?

The MySQL reference manual does not provide a clearcut example on how to do this. I have an ENUM-type column of country names that I need to add more countries to. What is the correct MySQL syntax to..

Use Ant for running program with command line arguments

My program getting command line arguments. How can I pass it when I use Ant?..

Align vertically using CSS 3

With CSS 3, are there any way to vertically align an block element? Do you have an example? Thank you...

REST API error code 500 handling

We are building a new REST API. I was arguing that error code 500 (Internal Server Error) should never be returned. Now, of course if you know the client's params are wrong or something you have eve..

remove url parameters with javascript or jquery

I am trying to use the youtube data api to generate a video playlist. However, the video urls require a format of: youtube.com/watch?v=3sZOD3xKL0Y but what the api generates is: youtube.com/watc..

Removing elements from array Ruby

Let's say I am trying to remove elements from array a = [1,1,1,2,2,3]. If I perform the following: b = a - [1,3] Then I will get: b = [2,2] However, I want the result to be b = [1,1,2,2] i.e...

OnClick vs OnClientClick for an asp:CheckBox?

Does anyone know why a client-side javascript handler for asp:CheckBox needs to be an OnClick="" attribute rather than an OnClientClick="" attribute, as for asp:Button? For example, this works: <..

How do I use Comparator to define a custom sort order?

I want to develop a sorting demo for car list. I am using data table to display car list. Now actually I want to sort the list by car color. Here it is not sort by alphabetic order. I want to use my c..


How to properly create an SVN tag from trunk?

I am creating my first project in Subversion. So far I have branches tags trunk I think I immediately need to make branches singular and start over. Update branches is the norm. I have been do..

MySQL Error: #1142 - SELECT command denied to user

I'm having troubles with a certain query on one of my servers. On all other places I've tested it it works completely fine but on the server i want to use it it isn't working. It's about the followin..

HTML5 - mp4 video does not play in IE9

I have an mp4 video that I want to play in IE9 using HTML5 <video> tag. I added the MIME type to IIS 7 so if I browse http://localhost/video.mp4 it plays in both Chrome and IE9 but not in HTML5,..