Oswald

0

votes
0

answer
6

views

Live Unit Testing with embedded ressources

I have a test using a embedded ressource to check. If i'm executing the test manually, everything works fine. I print all available ressources on startup. Manually executed: Available Ressources: MyCompany.MyFile.json If the same test is excecuted by the live unit testing, an error appears and the...
Oswald
1

votes
2

answer
35

views

How can I access a cousin element, of an element with an identifier in Cypress

I am trying to click a check box in a list of Table rows the only way I can think to access this level is by the span tag with its corresponding name. cy.get('tr > td > span').contains('newCypressTestCore').siblings('td > input').click(); Although this would only return the siblings of the span tag...
Justin Oswald
1

votes
1

answer
253

views

Use NSPredicate to filter entries that start with non-alphabetic character

I have a UITableView that I am trying to split into sections A-Z and then # for everything else, I am trying to filter out the data from my main array into the non-alphabetic section with: NSArray *selectionArray = [nameArray filteredArrayUsingPredicate: [NSPredicate predicateWithFormat:@"NOT (SELF...
Ian Oswald
2

votes
2

answer
104

views

Decoding Http Response Content from Russian (Cyrillic)

I send a request to an API and the server sends some portion of its response in Russian. I url decode the response using code page 1251 encoding but still don't get the result I want. How can I convert the response back to plain english? What encoding do I use?
Oswald Umeh
2

votes
1

answer
1.3k

views

Gtk+: How to set the cursor of a window from a Cairo context?

I have written the following code to set the cursor of a Gtk::Window from a Cairo::Context. When I run the program and move the cursor into the window, the cursor changes to a horizontal black line at the top, followed by some undefinable white shape at the bottom. I was expecting the cursor to chan...
Oswald
17

votes
3

answer
14.2k

views

Can CloudFlare perform automatic failover to a different backend?

I am looking for an easy way to fail over to a different DC quickly, does CloudFlare offer anything special in this regards with things like health checks or is it just like a standard DNS service?
henry.oswald
5

votes
1

answer
1.2k

views

How to create SVG-based graphics with Aurelia

I've created some Angular+SVG graphics samples here: https://github.com/ocampesato/angular-graphics Where can I find a code sample that illustrates how to convert these code samples to Aurelia? A sample HTML page is here: SVG and Angular A sample JS file for the HTML page is here: window.App = angul...
Oswald Campesato
6

votes
4

answer
704

views

SSE incredibly slow

I am currently writing the communication framework for a web game, the communications map can be seen below: The code is as follows: test.php: Test function init() { var source = new EventSource("massrelay.php"); source.onmessage = function(event) { console.log("massrelay sent: " + event.data); va...
James Oswald
6

votes
1

answer
1.2k

views

data.table 1.8.1.: “DT1 = DT2” is not the same as DT1 = copy(DT2)?

I've noticed some inconsistent (inconsistent to me) behaviour in data.table when using different assignment operators. I have to admit I never quite got the difference between "=" and copy(), so maybe we can shed some light here. If you use "=" or "
Florian Oswald
6

votes
1

answer
1.2k

views

Chef - template inside a provider not finding source

I have a little resource and provider for nginx sites which writes out a config file for a site. action :start do template "/etc/nginx/sites-enabled/my_site" do source "nginx_site.conf.erb" notifies :reload, "service[nginx]" end end When I use it from another cookbook the template nginx_site.con...
henry.oswald
6

votes
2

answer
10.5k

views

find rowwise maxCoeff and Index of maxCoeff in Eigen

I want to find the maximum values and indices by row of a matrix. I based this on an example on the eigen website (example 7). #include #include using namespace std; using namespace Eigen; int main() { MatrixXf mat(2,4); mat
Florian Oswald
6

votes
3

answer
8k

views

Backbone set collection attribute (for the url)

I need to pass an id to a collection for use in the url (e.g. /user/1234/projects.json) but am not sure how to do this, an example would be wonderful. The way my application is structured is on launch a collection of 'users' is pulled and rendered, I then want when a user is clicked their 'document...
henry.oswald
2

votes
3

answer
1k

views

Convert string fraction to decimal

I have a plist file that I am reading out a measurement, but some of the measurements are fractions such as 6 3/8". I formatted them that way because it's easier to find that on a tape measure than it is to find 6.375". My problem is now I want to do a conversion to metric on the fly and it isn't...
Ian Oswald
11

votes
1

answer
3.9k

views

carbon/graphite apply new retention to old data

When setting up graphite I accidentally set the retention to 1800 days not 180 days. '10s:6h,10min:1800d' From what I understand changing the retention now won't clean up the old data. I am unsure of how todo this without destroying all the data we have and starting agin.
henry.oswald
2

votes
1

answer
295

views

Can the Vim tabularize plugin match multiple expressions per column?

I'd like to use the vim tabularize plugin to align the following type of code: buy
Florian Oswald
11

votes
3

answer
9.2k

views

Unix zipping sub directory not including parent directory

I want to zip a sub directory and send it elsewhere, the problem I have is when I use the zip command it also includes all the unwanted layers of directories I do not want. e.g. zip -r /new.zip /Unwanted1/Unwanted2/wanted1/wanted2/file.txt ###unzipped produces the following /Unwanted1/Unwanted2/want...
henry.oswald
3

votes
1

answer
2.1k

views

Imagemagick: Rasterize the PDF to a set resolution when reading it in

I want to generate thumbnails of PDFs at a fixed width (548px wide, with the height determined by the PDF page aspect ratio). With ImageMagick, I can do this with the command: $ convert -density 300 -resize 548x input.pdf thumbnail.png This works for arbitrary sized PDFs, however, the larger the PDF...
henry.oswald
11

votes
3

answer
9.6k

views

Vim - Visual Block : Delete rather than insert

I often use visual block then inserting on multiple lines when for example commenting out a lot of code. This is great for inserting text in the same position on multiple lines but I can't figure out how to delete this text later using visual block mode, Backspace, Del and d all don't work. I am usi...
henry.oswald
3

votes
3

answer
1.1k

views

std::max_element skip over NANs

I have a std::vector that may contain several NAN values. I want to find the largest element in the vector. How can I efficiently skip the NANs in the comparison? I'd like to avoid having to call isnan on each element. any ideas? // std::max_element([NAN,NAN,NAN,-31,-89]) = NAN // because NAN > -31...
Florian Oswald
11

votes
3

answer
9.5k

views

Error when using Git credential helper with gnome-keyring as Sudo

I was looking for a way to store credentials securely while connecting to our Git server which uses SSL. I came across this suggestion by @james-ward (only edit I made was I updated our "system" config instead of our "global" config for Git (https://stackoverflow.com/a/14528360/6195194) sudo apt-get...
Richard Oswald
2

votes
1

answer
63

views

Removing Redundant Entries In Access Log

I coded some php script for a webpage at our company, and it records the ip address, the date and time stamp of each visitor, and it injects a cookie into the clients browser to keep track of the number of lifetime visits. It prints all of this information into an Access Log in this format. Visitor...
Matthew Oswald
2

votes
1

answer
46

views

how to make a valid JSON out of a string with non-quoted keys?

I have the followign python problem: '{acorn: 15,acorn_type: 15,area_name: "London",beds_max: 1,beds_min: 1,branch_id: "21062",branch_name: "Realm Estates",brand_name: "Realm Estates",chain_free: false,company_id: "10832",country_code: "gb",county_area_name: "London",currency_code: "GBP",display_add...
Florian Oswald
6

votes
3

answer
4.4k

views

Testing Node.js, mock out and test a module that has been required?

I am struggling to write high quality tests around my node modules. The problem is the require module system. I want to be able to check that a certain required module has a method or its state has changed. There seem to be 2 relatively small libraries which can be used here: node-gently and mockery...
henry.oswald
1

votes
2

answer
1.6k

views

Reference variable name dynamically

I have a struct that looks like this: public struct ChannelSettings { public double slider20Hz; public double slider25Hz; public double slider31_5Hz; public double slider40Hz; } and I am looping through my user interface objects when a slider value is changed like this: foreach (Slider slider in grd...
Ian Oswald
3

votes
1

answer
797

views

Shell script invocation error with MailCore

I am attempting to use MailCore in an app, I have gotten the project from Github and followed the directions at http://libmailcore.com/. Everything seems to import correctly, however when I try to build the project I am getting the Shell Script Invocation Error Can't exec '/usr/bin/make' (No such f...
Ian Oswald
2

votes
1

answer
3.8k

views

WriteFile returning error code 87

I am working on a program that is writing to an HID device and am getting the error 87, Invalid parameter on the WriteFile function. I got the functions from Jan Axelson's USB Complete so I'm not sure why I am getting the error. I am using this to find my device: private void USBInit() { IntPtr dev...
Ian Oswald
3

votes
1

answer
212

views

Linking Rcpp to interp2d (GSL-type library)

I need some help with a linker error I get during installation of an Rcpp package on a linux system where I don't have admin rights. In a nutshell, I get this error: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC I have a file solve.cpp tha...
Florian Oswald
2

votes
2

answer
2.4k

views

How can I convince Eclipse CDT that a macro is defined for source code editing and code completion?

I have in my source code: // foo.cpp struct foo { foo() {} #ifdef I_WANT_THIS_FEATURE void bar() {} #endif }; In my Makefile I have foo.o: foo.cpp g++ -c -DI_WANT_THIS_FEATURE foo.cpp -o foo.o This compiles fine from the command line as well as with the external builder that I have created in Eclips...
Oswald
2

votes
5

answer
137

views

Oracle - How to enforce rules on relationships depending on attributes records (simple example)

In a school system I have 2 tables, one called Staff which holds records of all member of staff for a school, teachers, admin, cooks and cleaners etc. Then I have a second table called Course with a foreign key relating to Staff to state who is the Course leader, now I only want to allow teachers to...
henry.oswald
4

votes
3

answer
537

views

what's the fastest way to reset a julia array to all zeros?

suppose I have an existing array like x = rand(4) and then I want to reset x to zero. Can I avoid doing x = zeros(4). I'm concerened about memory allocation.
Florian Oswald
3

votes
1

answer
111

views

JavaScript variable scope in Google Chrome

I've got the following code : Untitled 1 var top = 9; ( function () { top += 1; document.getElementById( "p" ).innerHTML = top; } )() It works fine in Internet Explorer ( prints 10 ), but in Google Chrome it prints [object Window]. But if i change it like this: ( function () { var top = 9; top...
Alex Oswald
6

votes
1

answer
2.1k

views

Best way to sort all columns of an armadillo matrix by an index vector

I'm wondering whether there's a better way to achieve what I'm doing here. I have an arma matrix and I want to reorder all of it's columns by the indices stored in a uvec vector. I think I'm basically copying the whole matrix. #include using namespace arma; int main(){ // get a discrete random mat...
Florian Oswald
4

votes
1

answer
3.9k

views

mongodb - wiredtiger memory usage growing

We moved over to wiredtiger and have seen memory usage creep up, with mongodb using 90% of the memory on the system. It seems to be slowly creaping up. Before wiredtiger when we used mmap on mongo 2.x memory would sit at 8%. I am worried about the operating system killing the process. Is this normal...
henry.oswald
2

votes
0

answer
941

views

Could not load file or assembly 'WebMatrix.WebData' Error

I am getting an exception message on the server hosting my ASP.NET MVC4 application. The application runs fine but when you make certain request that use types contained in certain third-party assemblies, I get the "Could not load file or assembly..." error message. The most nagging of which is the...
Oswald Umeh
2

votes
0

answer
571

views

julia on PBS cluster: what to give to addprocs()?

I'm trying to setup a cluster across machines on a PBS managed cluster. I'm perfectly able to compute within one node by saying julia -p 12 (after having reserved one node with 12 CPUs). I understand that to use several machines, I have to add them to the master process with addprocs. I was able to...
Florian Oswald
6

votes
1

answer
72

views

Regex parsing from delimited string with sequential groups

I'm trying to parse out words from a delimited string, and have the capture groups in sequential order. for example dog.cat.chicken.horse.whale I know of ([^.]+) which can parse out each word but this puts every string in capture group 1. Match 1 Full match 0-3 `dog` Group 1. 0-3 `dog` Match 2 F...
Richard Oswald
7

votes
2

answer
3.6k

views

Why can't a struct defined inside a function be used as functor to std::for_each?

The following code won't compile. The compiler complains about *no matching function for call to for_each*. Why is this so? #include #include struct Element { void flip() {} }; void flip_all(std::map input) { struct FlipFunctor { void operator() (std::pair& item) { item.second->flip(); } }; std::f...
Oswald
13

votes
1

answer
1.3k

views

Member of base class template is out of scope in derived class template with same template argument

The following code gives me a compilation error 'value' was not declared in this scope. template struct Base { int value; }; template struct Derived : public Base { int getValue() { return value; } }; I find it extremely odd that if Derived inherits from Base, the code compiles, if I return Base::v...
Oswald
5

votes
1

answer
12.8k

views

kibana - display average times

I am using kibana 3 to display my nginx logs which include the request_time, I would like a graph to display the average request times over the last x seconds in kibana but am not sure how todo this. Is this easily done or do I need to push it out to graphite?
henry.oswald
5

votes
2

answer
2.8k

views

Get college/university from ip address

I have a list of ip addresses many of which will be from a university network. What is the best way to find out which universities are in this list?
henry.oswald

View additional