Accelerate the evaluation of the quadratic form

My question is yet another "Vectorize this!". Similar question appeared elsewhere (Efficient way of calculating quadratic forms: avoid for loops?), but somehow I can't seem to make it work for my case. I want to calculate quadratic form x'Sxfor

How can I use correctly enum in this C ++ example?

I have a class something like this with a public enum declared: // DataStorage.h class DataStorage { enum ActionType { ADD, REMOVE }; public : data(); void update(ActionType action, Data dataItem); }; And then I have a Main.cc that uses it like so ..

Value of a combination of values ​​- Database design

I have a survey web application. The survey can have a multiple choice question. An answer to a multiple choice question can be dependent on other questions' answer. Example: Question 1 has choices: HP, Acer, Samsung, Lenovo Question 2 has choices: A

Printing Pyside QTableView

I have a Python and PySide app that connects to a mysql database and displays the results of a query in a QTableView. I need to print the contents of the table view. Here's some code: self.db_table = QtGui.QTableView(self) self.model = QtSql.QSqlQuer

Python sklearn.mixture.GMM is not it rugged to scale?

I'm using sklearn.mixture.GMM in Python, and the results seem to depend on data scaling. In the following code example, I change the overall scaling but I do NOT change the relative scaling of the dimensions. Yet under the three different scaling set

How to start a shell script from a specific line?

#!/bin/sh echo "install 1" echo "install 2" [ $? -eq 0 ] || exit $?; cyberciti [ $? -eq 0 ] || exit $?; echo "install 3" echo "install 4" The above script fails at line 4 (cyberciti). How can I take the line number,

Divide the value of the cat

The goal of my script is to get the /cache partitions location (Which works) and then get the block size of that location and divide it by 1024. Then I want to output the size, I've tried many possible ways but I cannot get it to work right. #!/bin/b

How to change strings (in C colors)

I'm simulating inheritance in C, but I'm not so familiar with the language. Below is some of the code. Visual Studio has an error message for emp.name=n which says: expression must be a modifiable lvalue. How do I change it so it can be modified? typ

Provide a valid cache path

I duplicated a working laravel app and renamed it to use for another app. I deleted the vendor folder and run the following commands again: composer self-update composer-update npm install bower install I configured my routes and everything properly

Why is this loop so slow in Cython?

This code rearranges the bits in a 534x713 RGBA4 texture. cpdef bytes toDDSrgba4(bytearray data): cdef bytes new_data = b'' cdef int pixel cdef int red cdef int green cdef int blue cdef int alpha cdef int new_pixel cdef int i for i in range(len(data)

Laravel 4.2 Model Name of ModelNotFoundException

Afternoon SO, I've been trying to workout if there is a way to find out/pass along the model name when a ::findOrFail() query executes the ModelNotFoundException error. This has become an issue for me recently in an application in which orders may be

How do I increase the Tap area for UIButton?

I use UIButton with auto layout. When images are small the tap area is also small. I could imagine several approaches to fix this: increase the image size, i.e., place a transparent area around the image. This is not good because when you position th

Using MVC frameworks for interface and back-end

I'm a bit confused on how to develop a web application using frameworks on both front-end (e.g. Angular) and back-end (e.g. Phalcon). Phalcon's documentation has bits like: <?php echo "<h1>Hello!</h1>"; echo Phalcon\Tag::linkTo(&q

How far is importing my MySQL face?

At my company we occasionally import large customer MySQL databases (40GB+) which can take over a day to load on our developer machines. While we accept this load time since it's done in the background, we lack any solid ability to estimate when the

How to Run an Android TV Application on Real TV

I am in the process of learning android TV programming. I want to get the hardware needed ready. However on the website http://developer.android.com/training/tv/start/start.html I can only find the guideline to run on emulator. I am curious how can I

Identical search result results for multiple search terms?

I would like to know how it is possible to get different scores for a multiple terms search result? Certain results in solr have the same score even when there are multiple terms in the query as you will see in the example below. I have two indexes i

Multidimensional pull-up Object assignment

So far, I'm trying to create a 2-Dimensional JSON array to hold a series of shapes inside a series of 'frames'. So far I thought I had it, but I can only push shapes to frame[0]; as soon as I pass it frame[1] I get the error Uncaught TypeError: Canno

How to echo a custom startup message in vim

Is there a way to echo a custom message in vim on startup? I tried using echo "Message" in my vimrc, but nothing seems to come up.You probably want to set up an autocmd to ensure everything is finished loading before your message appears. autocm

Hide columns in a table using CSS

I want to hide some of the columns in the table below. It is from a wordpress plugin so the ids and classes are predefined. I hope I can solve it with css fx: display:none, but I cant seem to get it to work. <table cellspacing="0" class="

Expand ajax .done scope to wrapping function

I know this might be considered as duplicate, but I could not find a solution for my function below: function countNoFilters(keyword){ keyword = typeof keyword !== 'undefined' ? keyword : "keyword="+$("#keyword-hidden").val(); var getR

Sql request for a similar operator

I have a search box where user enters anything in textbox and submits.Lets say user enters Peter.If we are comparing in sql table with following query select * from xml where name like '%peter%' This query works well,but when i want to search for onl

The FFMPEG command always refers to the older generation

The version of FFMPEG that came on my server does not have the correct codecs I need for web encoding. I've followed this guide to completion to recompile FFMPEG on my server https://trac.ffmpeg.org/wiki/CompilationGuide/Centos Now when I use the FFM

Dynamic session creation at the click of a button

Actually i have created one session object and i am storing multiple textbox, radio & checkbox value in that session. Here is my Code(My Insertion page, where i'll insert values and store in session). protected void btnRegister_Click(object sender, E

Diamond Digital Drawing

I need to draw a numeric diamond, for example with a height of 9: 1 222 33333 4444444 555555555 4444444 33333 222 1 I wrote the code and I managed to get the same diamond, but with stars. I want it with these numbers. How can I do that? Here is what

An algorithm to determine if a number belongs to a group or not

I'm not even sure if this is possible but I think it's worth asking anyway. Say we have 100 devices in a network. Each device has a unique ID. I want to tell a group of these devices to do something by broadcasting only one packet (A packet that all