Let \$i= 1 , ... , n\$ and \$j= 1, .... , p\$
and let \$x_{ij}\$ a matrix \$n \times p\$, and \$D\$ is a diagonal matrix \$n \times n\$
We have this equation \$N = X^T D X\$ , where N is a \$p \times p\$ matrix.
I need to write N as a summation form, any help please;
my code in R and in summati...
@Quill The difference for me is that... if I wanted to do this with Objective-C, or C, or C++, I have to first build & compile, then run it. With Swift, it's simple...
I have a device I connect to on TCP socket. I send it a message with what I want and it sends back all sorts of useful information:
Header:
+---------------+----------+----------+
| MagicWord | 2 bytes | 0xCAFE |
| Version | 1 byte | 0x02 |
| Type | 1 byte | Var...
extension UInt32 {
init?(bytes: [UInt8]) {
if bytes.count != 4 {
return nil
}
var value: UInt32 = 0
for byte in bytes {
value = value << 8
value = value | UInt32(byte)
}
self = value
}
}
extension UInt16 {
init?(bytes: [UInt8]) {
if bytes.count != 2 {
return nil
}
var value: UInt16 = 0
for byte in bytes {
value = value << 8
value = value | UInt16(byte)
now I know that I can't just ignore jQuery... I have to learn it, but I have enough understanding of why... to know that it is important, and solves real problems that I would not want to have to solve myself, again, and again.
I'm writing code to create a list of new areas for patches of conserved land within a watershed based on the current size distribution of conserved land patches that are in the watershed now.
I'm generating a new random area based on a normal pdf fitted to the log-transformed distribution of th...
I hope I don't have to do any web-dev any-time soon professionally. But for some reason I was suddenly building webservers at my last job, so you never know.
Which was around the time I started yelling at JavaScript.
Sometimes. Like writing keyhooks involving 5 files that call managed (or is it unmanaged?) code and cause strange and nefarious exceptions, any one of which causes the whole thing to fail.
There is a reason we haven't cleared that for release yet...
@Quill Sure, though I would argue there was also a separate, distinct problem here of escalation and failure of conflict resolution (regardless of who you think is at fault).
Within our application I need to work a lot with simple Ids (just integers).
They are used to make queries against a database. For performance reasons I don't want to materialize them to Entities before the query.
Example:
// not really *that* static typed
public void DoQuery(int userId, int ...
One things for certain... an array of tuples which is basically being used as a glorified dictionary is never going to suffice as an acceptable data model. Moreover, an array of bytes isn't really that much useful than what we start with.
So what's clear, we need an actual data model. So names...
I was asked to implement a minimal vi(vi like) text editor in an interview recently. I had to implement display lines,insert lines, delete lines, redo and undo. I used stacks to store recently run commands and recently deleted lines.
In the redo() command I find recentCommands stack to be alway...
I have a table that look like this
ID NIP SHIFT DATE
289305 01000267 M 2015-12-01 00:00:00.000
289306 01000267 P 2015-12-01 00:00:00.000
289307 01000267 S 2015-12-01 00:00:00.000
289127 01020358 M 2015-12-01 00:00:00.000
289128 01020358 P 2015-12-01 00:00...
I am writing a jQuery plugin that has methods which I believe can be called either with .call or by passing them an object directly. I am trying to decide which one is better practice, and which one should be used for what context.
Here's what I'm working with using .call:
;(function( $, wind...
Mat's Mug has a score of 154 on 35 non-wiki answers for vba, but he's not recieved a bronze tag badge. Why is that? I thought the requirements were a score of 100 on 20 non-wiki answers.
Trying to learn linked lists so I can answer interview questions. Even though I've seen plenty of tutorials to understand how they supposedly work, I don't know if I am doing a good job because I have no one to get feedback from. Here is my attempt.
class Node(object):
def __init__(self, da...
Here's a program I made for estimating a double integral over a general region. It's pretty accurate, but it's VERY, VERY slow. (Getting an accurate enough result takes about 30 seconds)
Here's the code; the lines are indented just for readability.
ClrHome
Input "Surface: ",Str0
Str0→Y₈
Input "...
From a management point of view, "I can't change the existing couts" does not gel with "I can change what the existing couts do". Do you not have any semblance of stability control in your codebase? That's a massive contract violation, far more severe than if you actually replaced the original calls in the code. There's no way I'd accept it in code review. Just sayin'. — Lightness Races in Orbit52 secs ago
I'm working on a programming challenge and the question is as follows:
Once Max found an electronic calculator from his grandfather Dovlet's chest. He noticed that the numbers were written with seven-segment indicators (https://en.wikipedia.org/wiki/Seven-segment_display).
Max starts to type ...
I receive a string with a lot of characters that I don't need and I am trying to remove them and replace them with characters that I am able to work with. My current structure has me redefining the var multiple times which I feel is not efficient and can probably be done better. Please let me k...
I was recently implementing exoplayer in my app to stream an mp3 file. I wanted to replace it with audioTrack class where I feeded an raw inputStream of bytes into the audioTrack. But there was no datasource availble in exoplayer where it could take a raw inputstream as a parameter.
So I created ...
import java.util.Scanner;
public class BasicTranformSixteenToEight {
public static void toBinaryTransform(int n, char[][] arry,
String[] arryBinaryStr) {
String[] arryOctalStr = new String[10];
String str = "";
StringBuilder octalStb = new StringBuilder();...
@JohnSmith I think that belongs to another question already... :/ probably there are some who can help you make faster algorithm in the code review. But there might be some who can do it in SO as well. Try to post it with your updated code. — Ian53 secs ago
public class EvenOddNumberPrinter {
Â
    private static class NumberPrinter {
Â
        // To check if even number is printed or not.
        private boolean isEvenPrinted = true;
Â
        public void printOdd(int number) throws InterruptedException {
            // Get a lock on Number...
@Quill I have been quite inactive lately, but now here I am
I also have a doubt: In your opinion should I answer a question about a programming challange just suggesting a faster algorithm? It just seems to spoil the challange
A lot of opinion based questions will get voted down or marked as off topic for this forum. The idea is that they attract a lot of spam and unrelated comments to this forum. You might try the code review forum within the stack exchange website family. You might also asked something more specific like so you will attract more quality answers. An example would be will this method be more secure and/or faster than the other. I believe the term best practice means a lot of different things to people depending on how they learned to code using that language and where they work. — Larry Lane36 secs ago
Thank you. I will look into codereview once I get some more material here. My next step is to get smtp working. — jaunty36 secs ago
I'm voting to close this question as off-topic because it is about optimizing working code. It may be a good question on Code Review (but make sure to read their guidelines carefully). — Jongware27 secs ago
@Jongware 1: "belongs to CodeReview" is not a reason for closing as off-topic. 2: The OP says he gets an exception, hence this is not working code. — Caridorc32 secs ago
@Caridorc: well the OP himself broke working code by trying to optimize it. So perhaps he could post only the first (working!) part there. (I disagree on your #1; Stack Overflow is for not-working code, Code Review is for working code - per the Help center.) — Jongware38 secs ago
I've tried to practice performance management while dealing with massive amount of dynamic DOM elements.
Please criticize my flaws, and explain how could this perform better focusing mainly on creating elements, displaying them on screen and hiding them when they are not needed anymore.
Please ...
Awhile ago I created a program that unlocked spreadsheets, for a better understanding of what happens when it's run, see here.
I decided to rewrite it again, and go for a more OOP approach..
My questions being, what can be done better here, Is a module better then a class in this program, and a...
Well considering the following function:
def test_func(all_copies, checker):
bad_copies = set(c[0] for c in itertools.permutations(all_copies, 2) if not checker(*c))
all_copies = [c for c in all_copies if c not in bad_copies]
return all_copies
This function basically checks (and re...
im following a tutorial from a guy called Max Wihlborg
here's the video: https://www.youtube.com/watch?v=uU5YPIvJ24Y
now, my problem.
I wrote everything exactly the same as him, but when he went ahead to test it, his worked but mine didnt. i probably made a writing mistake if you could help me ou...
Currently I have an app that have many stores. Each store can have several products. Whom again can have many product attributes assigned to them. For instance a shirt is a product, and size and color would be an attribute.
What this method does is add that product with it attributes to the cart...
I am trying to write the following code which enables the user to enter a student's details (username, firstname, surname) as well their grades (there can be one grade or several). The code can also show the students entered and their marks.
This is what I have so far but I am having issues with...
Any Windows expert around? Trying to help someone troubleshoot an issue with a monitor where the firmware may have become corrupted... would I need to be in BIOS to access something like that or would the Windows shell work OK?
I won't be a help vampire, I promise, I just need to figure out where to start :)