Questions

Set background color of WPF Textbox in C# code

How can I change the background and foreground colors of a WPF Textbox programmatically in C#?

21 Apr at 10:28

How to get first N elements of a list in C#?

I would like to use Linq to query a bus schedule in my project, so that at any time I can get the next 5 bus arrival times. How can I limit my query to the first 5 results? More generally, how can I ...

25 Jul at 10:15

Remove spaces from std::string in C++

What is the preferred way to remove spaces from a string in C++? I could loop through all the characters and build a new string, but is there a better way?

11 Jun at 10:11

Add/remove class with jquery based on vertical scroll?

So basically I'd like to remove the class from 'header' after the user scrolls down a little and add another class to change it's look. Trying to figure out the simplest way of doing this but I can't...

23 Sep at 07:51

.NET: Simplest way to send POST with data and read response

To my surprise, I can't do anything nearly as simple as this, from what I can tell, in the .NET BCL: ``` byte[] response = Http.Post ( url: "http://dork.com/service", contentType: "applicatio...

25 Mar at 11:33

Difference in System. exit(0) , System.exit(-1), System.exit(1 ) in Java

I'd like to know the difference between the following in Java ``` System.exit(0); System.exit(-1); System.exit(1); ``` When do I have to use the above code appropriately?

24 May at 17:59

PHP String to Float

I am not familiar with PHP at all and had a quick question. I have 2 variables `pricePerUnit` and `InvoicedUnits`. Here's the code that is setting these to values: ``` $InvoicedUnits = ((string) $In...

28 Jun at 16:31

How to commit changes to another pre-existent branch

I just made changes to a branch. How can I commit the changes to the other branch? I am trying to use: ``` git checkout "the commmit to the changed branch" -b "the other branch" ``` However, I don...

18 Aug at 12:47

Get the current script file name

If I have PHP script, how can I get the filename of the currently executed file without its extension? Given the name of a script of the form "jquery.js.php", how can I extract just the "jquery.js" pa...

10 Aug at 15:27

Bootstrap modal: is not a function

I have a modal in my page. When I try to call it when the windows load, it prints an error to the console that says : ``` $(...).modal is not a function ``` This is my Modal HTML : ``` <div class...

PHP - Move a file into a different folder on the server

I need to allow users on my website to delete their images off the server after they have uploaded them if they no longer want them. I was previously using the `unlink` function in PHP but have since ...

2 Oct at 14:28

#1045 - Access denied for user 'root'@'localhost' (using password: YES)

This might seem redundant but I was unable to find a correct solution. I was unable to login to mysql using the mysql console.It is asking for a password and I have no clue what I actually entered.(I...

30 May at 20:54

Resolving instances with ASP.NET Core DI from within ConfigureServices

How do I manually resolve a type using the ASP.NET Core MVC built-in dependency injection framework? Setting up the container is easy enough: ``` public void ConfigureServices(IServiceCollection ser...

How do I get the current year using SQL on Oracle?

I need to add the current year as a variable in an SQL statement, how can I retrieve the current year using SQL? i.e.

11 Mar at 07:47

What is the easiest way to get current GMT time in Unix timestamp format?

Python provides different packages (`datetime`, `time`, `calendar`) as can be seen [here](https://stackoverflow.com/questions/8542723/change-datetime-to-unix-time-stamp-in-python) in order to deal wit...

14 Oct at 20:36

How do I convert a double into a string in C++?

I need to store a double as a string. I know I can use `printf` if I wanted to display it, but I just want to store it in a string variable so that I can store it in a map later (as the , not the )....

11 Dec at 19:41

xampp MySQL does not start

I installed Xampp on Windows 7 32-bit. When I try to start MySql in XAMPP control panel (v3.2.1) I have the following message and MySql does not start. ``` 23:02:03 [mysql] Problem detected! 23:02...

23 May at 11:54

ERROR in Cannot find module 'node-sass'

Config: macOS High Sierra, version 10.13.2, node:v8.1.2 npm:5.0.3 When I run npm start in my angularjs project I get this error: ``` ERROR in Cannot find module 'node-sass' ``` After this I run: `...

MongoDB - admin user not authorized

I am trying to add authorization to my MongoDB. I am doing all this on Linux with MongoDB 2.6.1. My mongod.conf file is in the old compatibility format (this is how it came with the installation). ...

29 May at 22:0

StringBuilder vs String concatenation in toString() in Java

Given the 2 `toString()` implementations below, which one is preferred: ``` public String toString(){ return "{a:"+ a + ", b:" + b + ", c: " + c +"}"; } ``` or ``` public String toString(){ ...

Returning value from called function in a shell script

I want to return the value from a function called in a shell script. Perhaps I am missing the syntax. I tried using the global variables. But that is also not working. The code is: ``` lockdir="somed...

8 Aug at 21:3

How to make inline plots in Jupyter Notebook larger?

I have made my plots inline on my Ipython Notebook with "`%matplotlib inline`." Now, the plot appears. However, it is very small. Is there a way to make it appear larger using either notebook setti...

Column count doesn't match value count at row 1

So I read the other posts but this question is unique. So this SQL dump file has this as the last entry. ``` INSERT INTO `wp_posts` VALUES(2781, 3, '2013-01-04 17:24:19', '2013-01-05 00:24:19'. ``` ...

21 Aug at 23:46

How can I check the extension of a file?

I'm working on a certain program where I need to do different things depending on the extension of the file. Could I just use this? ``` if m == *.mp3 ... elif m == *.flac ... ```

30 Sep at 18:47

How to allow http content within an iframe on a https site

I load some HTML into an iframe but when a file referenced is using http, not https, I get the following error: > [blocked] The page at {current_pagename} ran insecure content from {referenced_filena...

5 Jan at 12:39