Questions

Python - AttributeError: 'numpy.ndarray' object has no attribute 'append'

This is related to my question, [here](https://stackoverflow.com/questions/42941668/valueerror-could-not-broadcast-input-array-from-shape-22500-3-into-shape-1). I now have the updated code as follows...

3 Apr at 08:46

How to use setprecision in C++

I am new in `C++` , i just want to output my point number up to 2 digits. just like if number is `3.444`, then the output should be `3.44` or if number is `99999.4234` then output should be `99999.42`...

19 Mar at 19:2

Setting an image for a UIButton in code

How do you set the image for a UIButton in code? I have this: ``` UIButton *btnTwo = [UIButton buttonWithType:UIButtonTypeRoundedRect]; btnTwo.frame = CGRectMake(40, 140, 240, 30); [btnTwo setTitle...

11 Aug at 17:15

Generic deep diff between two objects

I have two objects: `oldObj` and `newObj`. The data in `oldObj` was used to populate a form and `newObj` is the result of the user changing data in this form and submitting it. Both objects are deep, ...

20 Jun at 09:12

How to create and use resources in .NET

How do I create a resource that I can reference and use in various parts of my program easily? My specific problem is that I have a NotifyIcon that I want to change the icon of depending on the state...

28 Apr at 05:57

How to exit an Android app programmatically?

I am sure this question has been asked number of times because I read a few. My client wants me to put a button into his app where users can click and exit. I have read [this](https://stackoverflow.co...

Select Tag Helper in ASP.NET Core MVC

I need some help with the select tag helper in ASP.NET Core. I have a list of employees that I'm trying to bind to a select tag helper. My employees are in a `List<Employee> EmployeesList` and select...

How to open Console window in Eclipse?

I accidentally closed the Console window in Eclipse, and now I can't see the result of my code being run. How do you open it again?

3 Nov at 07:20

Android: How can I get the current foreground activity (from a service)?

Is there a native android way to get a reference to the currently running Activity from a service? I have a service running on the background, and I would like to update my current Activity when an e...

6 Oct at 14:51

How to turn NaN from parseInt into 0 for an empty string?

Is it possible somehow to return 0 instead of `NaN` when parsing values in JavaScript? In case of the empty string `parseInt` returns `NaN`. Is it possible to do something like that in JavaScript to...

20 Jul at 21:52

How to have multiple conditions for one if statement in python

So I am writing some code in python 3.1.5 that requires there be more than one condition for something to happen. Example: ``` def example(arg1, arg2, arg3): if arg1 == 1: if arg2 == 2: ...

Sublime Text - JSON formatter shortcut

I'm using [SublimeText2](https://www.sublimetext.com/2). How to reindent `Json` code with a ? I've already installed `packageControl` and it works. I already tried `JsonReindent` package but it has no...

Testing web application on Mac/Safari when I don't own a Mac

Having been caught out recently when a web site I launched displayed perfectly on IE, Firefox, Chrome and Safari on Windows but was corrupted when viewed using Safari on the Mac (by a potential custom...

1 Dec at 11:33

org.hibernate.MappingException: Could not determine type for: java.util.List, at table: College, for columns: [org.hibernate.mapping.Column(students)]

I'm using Hibernate for all CRUD operations in my project. It doesn't work for One-To-Many and Many-To-One relationships. It gives me the below error. `org.hibernate.MappingException: Could not deter...

9 Jun at 17:59

How to make an executable JAR file?

I have a program which consists of two simple Java Swing files. How do I make an executable JAR file for my program?

11 Sep at 22:15

Group a list of objects by an attribute

I need to group a list of objects (`Student`) using an attribute (`Location`) of the particular object. The code is like below: ``` public class Grouping { public static void main(String[] args) {...

24 Oct at 12:30

How do I force Kubernetes to re-pull an image?

I have the following replication controller in Kubernetes on GKE: ``` apiVersion: v1 kind: ReplicationController metadata: name: myapp labels: app: myapp spec: replicas: 2 selector: a...

8 Feb at 06:22

How to execute a Python script from the Django shell?

I need to execute a Python script from the Django shell. I tried: ``` ./manage.py shell << my_script.py ``` But it didn't work. It was just waiting for me to write something.

16 Feb at 11:54

How can I run specific migration in laravel

I create on address table migration but one migration is already in the database it gives following error : > Base table or view already exists: 1050 Table 'notification' already exists So, Can I ru...

10 Jan at 10:46

How do I make JavaScript beep?

I want my web page to beep whenever a user exceeds the maximum character limit of my `<textarea>`.

22 Oct at 17:8

Delete all files in directory (but not directory) - one liner solution

I want to delete all files inside ABC directory. When I tried with `FileUtils.deleteDirectory(new File("C:/test/ABC/"));` it also deletes folder ABC. Is there a one liner solution where I can delete...

26 Mar at 11:48

How to take input in an array + PYTHON?

I am new to Python and want to read keyboard input into an array. The python doc does not describe arrays well. Also I think I have some hiccups with the for loop in Python. I am giving the C code sn...

22 Jun at 14:29

Retrieve a single file from a repository

What is the most efficient mechanism (in respect to data transferred and disk space used) to get the contents of a single file from a remote git repository? So far I've managed to come up with: ``` ...

How can I open a link in a new window?

I have a click handler for a specific link, inside that I want to do something similar to the following: ``` window.location = url ``` I need this to actually open the url in a new window though, h...

8 Jan at 17:8

How to get the current location latitude and longitude in android

In my application, I get the current location's latitude and longitude when application is open, but not when the application is closed. I am using Service class to get the current location latitude ...