Questions

Creating a new user and password with Ansible

I have an ansible task which creates a new user on ubuntu 12.04; ``` - name: Add deployment user action: user name=deployer password=mypassword ``` it completes as expected but when I login as ...

10 Oct at 10:7

Scanner vs. BufferedReader

As far I know, the two most common methods of reading character-based data from a file in Java is using `Scanner` or `BufferedReader`. I also know that the `BufferedReader` reads files efficiently by ...

How to Read and Write from the Serial Port

I just started learning how to send and receive data from my hardware through the C# GUI. Can anyone please write a detail how to data from the serial port?

5 May at 11:31

How do I fix a .NET windows application crashing at startup with Exception code: 0xE0434352?

I've built a .NET [Windows Forms](http://en.wikipedia.org/wiki/Windows_Forms) application in Visual Studio 2010. I also built a corresponding setup/install package via Visual Studio 2010. This is buil...

24 Mar at 20:53

Splitting a string into chunks of a certain size

Suppose I had a string: ``` string str = "1111222233334444"; ``` How can I break this string into chunks of some size? e.g., breaking this into sizes of 4 would return strings: ``` "1111" "2222" "33...

20 May at 10:52

Capture iOS Simulator video for App Preview

Okay, so we can now submit video previews of our apps on the App Store. According to Apple we should do so with an iOS8 device and `OSX 10.10.` The problem is you have to have all the different device...

Mockito: InvalidUseOfMatchersException

I have a command line tool that performs a DNS check. If the DNS check succeeds, the command proceeds with further tasks. I am trying to write unit tests for this using Mockito. Here's my code: ``` p...

14 Mar at 22:23

Windows 7: unable to register DLL - Error Code:0X80004005

When I tried to register a COM DLL, ``` regsvr32 rpcrt4.dll ``` I get the following error message: `The module "c:\windows\system 32\"rpcrt4.dll" was loaded but the call to DllRegisterServer fail...

14 Jul at 13:21

How to get difference of days/months/years (datediff) between two dates?

I am looking for a way to implement the [SQLServer-function datediff](https://learn.microsoft.com/en-us/sql/t-sql/functions/datediff-transact-sql?view=sql-server-2017) in PostgreSQL. That is, this fun...

Usages of doThrow() doAnswer() doNothing() and doReturn() in mockito

I was learning mockito and I understood the basic usages of the above mentioned functions from the [link](https://static.javadoc.io/org.mockito/mockito-core/2.8.9/org/mockito/Mockito.html#12). But I ...

12 Jun at 13:15

XML Schema (XSD) validation tool?

At the office we are currently writing an application that will generate XML files against a schema that we were given. We have the schema in an .XSD file. Are there tool or libraries that we can us...

15 Sep at 14:35

How to use a variable for a key in a JavaScript object literal?

Why does the following work? ``` <something>.stop().animate( { 'top' : 10 }, 10 ); ``` Whereas this doesn't work: ``` var thetop = 'top'; <something>.stop().animate( { thetop : 10 }, 10 );...

Tool to compare directories (Windows 7)

Due to some [SVN](http://en.wikipedia.org/wiki/Apache_Subversion) movement I got disconnected from SVN while I was in middle of a fairly large enhancement. Now I have my current workspace (with chang...

14 Sep at 07:59

How to run html file on localhost?

I have an HTML file and I run it on localhost. But, this file includes a mirror using a webcam. For example, how can I run [this HTML file](https://web.archive.org/web/20150826061821/http://myprojectg...

How to convert DataSet to DataTable

I am retrieving data from a SQL table so I can display the result on the page as a HTML table. Later I need to be able to save that table as a CSV file. So far I have figured out how to retrieve the...

13 Jan at 08:12

Simulating ENTER keypress in bash script

I've created a really simple bash script that runs a few commands. one of these commands needs user input during runtime. i.e it asks the user "do you want to blah blah blah?", I want to simply send a...

27 Dec at 15:23

pip install failing with: OSError: [Errno 13] Permission denied on directory

`pip install -r requirements.txt` fails with the exception below `OSError: [Errno 13] Permission denied: '/usr/local/lib/...`. What's wrong and how do I fix this? (I am trying to setup [Django](https:...

2 Jul at 04:43

lvalue required as left operand of assignment error when using C++

``` int main() { int x[3]={4,5,6}; int *p=x; p +1=p;/*compiler shows error saying lvalue required as left operand of assignment*/ cout<<p 1; getch(); } ``` ...

20 Mar at 19:48

PostgreSQL INSERT ON CONFLICT UPDATE (upsert) use all excluded values

When you are upserting a row (PostgreSQL >= 9.5), and you want the possible INSERT to be exactly the same as the possible UPDATE, you can write it like this: ``` INSERT INTO tablename (id, username, ...

10 Nov at 16:25

Connect with SSH through a proxy

I have no real idea what I'm doing here so please bear that in mind if you can help me! I am trying to connect to my virtual server through a proxy but I can't connect, it just hangs. I'm assuming th...

9 Oct at 19:6

How to parse unix timestamp to time.Time

I'm trying to parse an Unix [timestamp](https://golang.org/pkg/time/) but I get out of range error. That doesn't really makes sense to me, because the layout is correct (as in the Go docs): ``` packa...

13 Jul at 21:44

"Cannot GET /" with Connect on Node.js

I'm trying to start serving some static web pages using `connect` like this: ``` var connect = require("connect"); var nowjs = require("now"); var io = require("socket.io"); var app = connect.creat...

9 Mar at 00:52

How do I fetch only one branch of a remote Git repository?

I'd like to grab a single branch (not all of them) of a remote repository and create a local tracking branch that can track further updates to that remote branch. The other branches in the remote rep...

3 Aug at 21:23

Script not served by static file handler on IIS7.5

I've just tried to deploy my first web application to IIS on my Windows 7 Home Premium notebook. After creating the application, I had to change to the Classic App Pool, then set that pool for framew...

14 Dec at 03:23

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

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

2 Nov at 11:46