Questions

Automatically creating directories with file output

Say I want to make a file: ``` filename = "/foo/bar/baz.txt" with open(filename, "w") as f: f.write("FOOBAR") ``` This gives an `IOError`, since `/foo/bar` does not exist. What is the most pytho...

18 Mar at 16:38

Oracle SQL Query for listing all Schemas in a DB

I wanted to delete some unused schemas on our oracle DB. How can I query for all schema names ?

28 Jan at 21:58

How to hide soft keyboard on android after clicking outside EditText?

Ok everyone knows that to hide a keyboard you need to implement: ``` InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(getCurrentFocus(...

17 Mar at 16:4

Constants in Objective-C

I'm developing a [Cocoa](http://en.wikipedia.org/wiki/Cocoa_%28API%29) application, and I'm using constant `NSString`s as ways to store key names for my preferences. I understand this is a good idea ...

In java how to get substring from a string till a character c?

I have a string (which is basically a file name following a naming convention) `abc.def.ghi` I would like to extract the substring before the first `.` (ie a dot) In java doc api, I can't seem to fi...

7 Oct at 05:57

How to get a variable type in Typescript?

I have a variable. ``` abc:number|string; ``` How can I check its type? I want to do something like below: ``` if (abc.type === "number") { // do something } ```

22 Feb at 05:33

Checking kubernetes pod CPU and memory

I am trying to see how much memory and CPU is utilized by a kubernetes pod. I ran the following command for this: ``` kubectl top pod podname --namespace=default ``` I am getting the following erro...

5 Feb at 10:16

How does one parse XML files?

Is there a simple method of parsing XML files in C#? If so, what?

21 Jun at 04:22

Contains case insensitive

I have the following: ``` if (referrer.indexOf("Ral") == -1) { ... } ``` What I like to do is to make `Ral` case insensitive, so that it can be `RAl`, `rAl`, etc. and still match. Is there a way t...

How to know the version of pip itself

Which shell command gives me the actual version of `pip` I am using? `pip` gives with `pip show` all version of modules that are installed but excludes itself.

18 Sep at 18:51

How to resolve git's "not something we can merge" error

I just encountered a problem when merging a branch into master in git. First, I got the branch name by running `git ls-remote`. Let's call that branch "branch-name". I then ran `git merge branch-name`...

31 May at 17:41

Linear Layout and weight in Android

I always read about this funny weight value in the Android documentations. Now I want to try it for the first time but it isn't working at all. As I understand it from the documentations this layou...

Resource interpreted as Document but transferred with MIME type application/zip

With Chrome 12.0.742.112, if I redirect with the following headers: ``` HTTP/1.1 302 Found Location: http://0.0.0.0:3000/files/download.zip Content-Type: text/html; charset=utf-8 Cache-Control: no-c...

24 Feb at 14:27

Replace words in a string - Ruby

I have a string in Ruby: ``` sentence = "My name is Robert" ``` How can I replace any one word in this sentence easily without using complex code or a loop?

7 Jul at 11:31

CSS change button style after click

I was wondering if there was a way to change a button's style, in css, after it's been clicked, so not a `element:active`.

6 May at 18:41

Cross-thread operation not valid: Control 'textBox1' accessed from a thread other than the thread it was created on

I want to send temperature value from a microcontroller using UART to C# interface and Display temperature on `Label.Content`. Here is my microcontroller code: ``` while(1) { key_scan(); // get va...

4 Jul at 05:24

How do I exit a WPF application programmatically?

How is one supposed to exit an application such as when the user clicks on the Exit menu item from the File menu? I have tried: ``` this.Dispose(); this.Exit(); Application.ShutDown(); Application.Exi...

6 Nov at 15:10

Insert current date/time using now() in a field using MySQL/PHP

Since MySQL evidently cannot automatically insert the function now() in a datetime field in adding new records like some other databases, based on comments, I'm explicitly trying to insert it using an...

13 Apr at 17:17

Two dimensional array in python

I want to know how to declare a two dimensional array in Python. ``` arr = [[]] arr[0].append("aa1") arr[0].append("aa2") arr[1].append("bb1") arr[1].append("bb2") arr[1].append("bb3") ``` The fir...

12 Oct at 04:53

Creating a select box with a search option

I am trying to replicate what you can see here in this image. ![enter image description here](https://i.stack.imgur.com/9NB1w.png) I want to be able to either type in the text field above the box or...

15 Oct at 10:44

Oracle date "Between" Query

I am using oracle database. I want to execute one query to check the data between two dates. ``` NAME START_DATE ------------- ------------- Small Widget 15-JAN-10 04.25.32...

How to launch html using Chrome at "--allow-file-access-from-files" mode?

I have the same situation with [HERE](https://stackoverflow.com/questions/16487803/why-does-this-filesystem-api-requestquota-call-fail) And to solve this problem I have to launch html file using Chro...

23 May at 12:17

What is a bus error? Is it different from a segmentation fault?

What does the "bus error" message mean, and how does it differ from a [segmentation fault](https://en.wikipedia.org/wiki/Segmentation_fault)?

22 Aug at 09:4

How to create PDF files in Python

I'm working on a project which takes some images from user and then creates a PDF file which contains all of these images. Is there any way or any tool to do this in Python? E.g. to create a PDF file...

12 Feb at 15:12

Get the new record primary key ID from MySQL insert query?

Let's say I am doing a MySQL `INSERT` into one of my tables and the table has the column `item_id` which is set to `autoincrement` and `primary key`. `item_id` Currently I am running a second query to...

15 Sep at 11:34