If you find this page, it’s because I have not yet deleted it…
I am in the process of moving all posts to my main blog and, once this is all copied and empty, will delete this sub-domain. The reason is, that
- I cannot be asked to have two separate blogs for me, and
- I set up an SSL certificate for my main blog, which enables me to encrypt all data via HTTPS
I hope you understand, especially as nothing will change for you :p
When writing an application, one may want to make it interface with some web based backend. More specifically, I’ll show how simple it is to send HTTP requests using Swift to a PHP based website and obtain a reply.
The process is actually really simple:
- Generate a NSMutableURLRequest; mutable since you’ll have to set its properties later
- Set the request’s HTTPMethod; that will be POST or GET depending on how you interface with the backend
- Set the request’s HTTPBody; by creating a data String and converting it into an NSData object
- Pass the request to a NSURLSession; using the dataTaskWithRequest() function as it will call its completion handler when finished
- Define the content of the completion handler (if needed); to obtain the reply and check for errors
I’ve been coding on a Swift project recently where I develop a small app that has a preferences window. This preferences windows is supposed to be very small and not take up much screen space, so I decided to drop the title bar. But how do you hide and move it now? That’s what I’ll show here…
NumPy is a package that provides cool and simple functionality for n-dimensional array manipulation. I come from a MATLAB® background, so I wanted to try something easy, yet the results were not as I expected. It’s concerning simple vector multiplication, i.e. using the dot-product. Whereas in MATLAB® the that the two operands are used matters in what the result will be, NumPy seemed to be a bit picky when it came to it. Thanks to stackoverflow I finally understood my confusion and this short post may help someone equally stuck.
For our research on electricity networks work we utilise a BDS licensed power system simulator, a.k.a. OpenDSS (link). This simulation platform receives sequential instructions that first define the equipment properties (i.e. define line, load and transformer specifications), then assign the asset placement (i.e. define the netlist) and then simulates the whole thing. Up until now we only implemented two means of interacting with OpenDSS. One is to generate a big bunch of files that are collated in a common master.dss file. Doing this limits the spectrum of our research to OpenDSS’s inherent capabilities and would not be sufficient for dynamic time series analysis. The more flexible approach was to use MATLAB® which can interact with OpenDSS through a registered Component Object Model (COM) server. With all the functionality that MATLAB brings as well as the capabilities of OpenDSS this seemed like a perfect combination. But now we want to take it even further and implement computer science (CS) based solving mechanisms on real communications protocols, yet these may only be simulated in MATLAB®. So I decided to give Python a try as it seems to be able to interact with OpenDSS in a similar fashion, yet with all its packages makes CS life a hell of a lot easier. So let’s see how I got started with that.