## parallel computing – Amdahls law question: have I solved it correctly

Using Amdahl’s law, answer the following.

• (a) A particular (parallelised) program spends 55% of its time in its parallel part. Compute the bound on speedup possible with 16 cores.
• (b) In addition to improving performance in the parallel part, if the serial part is also optimised by a factor of 2, what is the combined bound of speedup in this case?
• (c) You are given the choice to either perform the optimisations above or to make the serial part five times faster without any speedup in the parallel part. What option would you go for?

I solved it like this:

a:

`1 / (0.45 + (1 - 0.45)/16) = 1 / (0.45 + 0.55 / 16) = 1 / (0.45 + 0.034375) = 1 / 0.484375 = 2.064516129`

b.:

In b I think:
serial is optimized to run 2 times fast => while in a it was
`0.45 + 0.55 = 1`
now it is `0.225 + 0.775 = 1`.
Apply the same formula from part a:

`1 / (0.225 + 0.55 / 16) = 1 / (0.225 + 0.034375) = 1 / 0.259375 = 3.855421687`?

c.:

If it’s just no cores and the serial part being five times faster:

`0.45 + 0.55 = 1`
now it’s `0.09 + 0.55 = 1`
therefore the program would run
`0.09 + 0.55 = 0.64` => `1 / 0.64 = 1.5625` times faster
And since it’s smaller than the results of a and b, it’s not worth it and I would go for option b

Is that correct or I’m mistaken?

## private key – How can I calculate the possible number of correctly formatted version one minikeys?

I’m doing a small research project collecting information on minikeys. In that research process I’ve come across a couple of questions that I have been unable to answer in relation to the assumed keyspace of the version one minikey. The said mini key, was used primarily by Casascius Series 1 coins, and consisted of the following parameters

• Generated using Base58 encoding scheme
• Consists of a total of 22 Characters, of which 21 are random, with the 1st character being a capital S prefix

Has the following requirements to be considered well formatted:

• If the minikey appended by a ? at the end of the string hashed using SHA256 results in the first byte being 00, the string is a well formatted minikey

Key Question: Is there any way to calculate the potential number of keys within the massive 58^21 keyspace that would be considered properly formatted?

My current suspicion is that it’s not possible to do so because the validation involves hashing and the entire input of the entire minikey input would be needed to generate a proper hash (meaning potentially in order to calculate the possible number of valid keys, every potential key, of a impossibly large keyspace would need to be generated, which is currently impossible). However I am asking this question with the hope that this suspicion is incorrect and that it is somehow possible to calculate the possible number of valid well formatted keys.

For reading on this subject I would recommend checking out:

https://en.bitcoin.it/wiki/Mini_private_key_format

Be warned, the python script needs minor modifications to run on Python2.7

Bold is for key questions
Italics if for important thoughts

Note: This post intentionally does not cover the more secure Casascius Series 2 Keys, however it is likely assuming that there exists an answer for Series 1 keys that the process can be used on Series 2 as well.

## Why doesn’t Google Cache my site template correctly?

y u no do it?

Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

Starts at just \$1 per CPM or \$0.10 per CPC.

## forms – How to correctly represent "leave unchanged"

Users can modify various information, everything is in the same modal (including the password).

What would be the best way to represent to the user "leave blank to remain unchanged" (referring to passwords).

The idea is that a user can change the email (among other information) but may not want to change the password – he should be able to update all other information (including password) but only if desired.

## forms – How to correctly represent "does not change"

Users can modify various information, everything is in the same modal (including the password).

What would be the best way to represent to the user "leave blank to remain unchanged" (referring to passwords).

The idea is that a user can change the email (among other information) but may not want to change the password – he should be able to update all other information (including password) but only if desired.

## c – Pointer pointing to another pointer, how to use free correctly?

When I have a pointer pointing to another pointer like:

``````int *ponteiro1 = malloc(sizeof(int));
int *ponteiro2;

*ponteiro1 = 5;

ponteiro2 = ponteiro1;
free(ponteiro2);
``````

And I'm using the free command (pointer2), so should I deallocate pointer1? If yes, should I do a treatment for pointer2?

## repair – Toma M900 Novacam I: My film rewinder is not advancing the film correctly

As you have noticed, the Toma uses an electronic motor to automatically wind the film. At this point, it is a very old electronic device with an unknown story bought from a store without a camera (the store has no incentive to fix it / fix it).

It could be used after priming and simply wear out (likely), it could have fallen / been damaged, it could have been wet, all the lubricants that could have been used have definitely exceeded their primer.

So the sad reality is that this camera is cheaper to replace than to repair. (I found a brand new one in the box on eBay today for \$ 25, for example). So I would simply recommend replacing it. If you want to break it to see if you can fix it yourself, you can too. Do not be sorry if you destroy it in your attempt.

## Java – how to get and set the session attribute correctly for multiple variables in the spring boot controller?

I am writing an application that uses Spring boot security and session management with a JDBC. However, I first designed the app under the impression that the `Controller` was not a singleton. So my controller class was dynamic even if I had read the documents beforehand, I would have realized that it should not be. Although once hosted on a web server, I realized that I had problems with the user session and that I had to read the documentation to better understand it. So now I'm using session management and I'm trying to get all of my variables out of my controller and into my session information in my JDBC. However, I see my car constantly calling `Object name = (Object) session.getAttribute()` or `session.setAttribute("","")` in each method where I placed my variables. I am trying to find the best way to call and send data to my session in JDBC.

FYI: I used as 7 global variables in my controller.

Java method:

``````
@RequestMapping(value = "/edit")
public ModelAndView editPage(@RequestParam(value = "Appcode", required = false, defaultValue = "Appcode") String appcode,HttpSession session) {
ModelAndView modelAndView = new ModelAndView();
session.setAttribute("SELECTED_APP",queryService.findDtoById(appcode));
allPlants = queryService.serverWork();

try {
OTSApplication selected_app = (OTSApplication) session.getAttribute("SELECTED_APP");
rc.setProxy();

if (rc.ValidateUser(id, selected_app.getSys_id()) != 0 || queryService.isAuditor(id)) {
gpSelected = apiRunner.runGPData(selected_app.getGuid());
modelAndView.setViewName("create");
} else {
modelAndView.setViewName("forbidden");
}

} catch (Exception e) {
e.printStackTrace();
modelAndView.setViewName("test");
}

return modelAndView;
}
``````

Variables that must be in session

``````    private APIRunner apiRunner;
private Set aryServer = new HashSet();
private List aryTier = new ArrayList();
private List hmap = new ArrayList();
public List mqlSelectorList = new ArrayList();
private String name, system, mqlList, tag1, tag2, mqlSelector, parseInstruc, myObject, id;
private String queryWithServerAttached, secondQuery;
private List allPlants = new ArrayList();
private static final Logger logger = LoggerFactory.getLogger(OTSController.class);

``````

I know there must be a simple or better standard way to contain these variables and objects in a JDBC session. If I have to, I don't mind, but I don't want to declare a new object `Object name = (Object) session.getAttribute()` whenever I want to use the field. Please let me know of any other means.

## My first proof of linear algebra – is it accurate and written correctly?

This is the first proof exercise of "linear algebra as an introduction to abstract mathematics". This is also my first proof (apart from proving things like the properties of integers and trigonometric identities). I hope someone can criticize it and let me know what I did well or what I did wrong.

Problem: Let a, b, c and d be real numbers. Consider the system of equations (1):
$$ax_1 + bx_2 = 0$$
$$cx_1 + dx_2 = 0$$

Note that $$x_1 = x_2 = 0$$ is a solution for any choice of a, b, c and d.
Prove that, if $$ad-bc neq0$$, then $$x_1 = x_2 = 0$$ is the only solution.

Evidence: We will prove by contrapositive. Presume $$x_1 = x_2 = 0$$ is not the only solution. Presume
$$A = begin {bmatrix} a & b \ c & d end {bmatrix}, X = begin {bmatrix} x_1 \ x_2 end {bmatrix}, 0 = begin {bmatrix} 0 \ 0 end {bmatrix}$$
Then the system of equations (1) is equivalent to the expression $$AX = 0$$. For $$AX = 0$$ to be true we must have either $$A = 0$$ or $$X = 0$$. Since we assume $$x_1 = x_2 = 0$$ is not the only solution, we assume $$X neq0$$. Then for $$AX = 0$$ to be true we must have $$A = 0$$, and so, $$a = b = c = d = 0$$. Yes $$a = b = c = d = 0$$, then $$ab-cd = 0$$. $$blacksquare$$

## Design Templates – Am I structuring this correctly for a .net mvc web application based on onion architecture?

) 1

I'm new to MVC. Most of my career, I have used web forms in Asp.net. Reading MVC was really confusing because from what I learned, in traditional MVC, the models were supposed to be business logic as well as the models / in-house domain objects. But when it comes to Microsoft's MVC, the model means that View Models and MVC is right in the UI / Presentation layer. Now, I'm trying to combine that with the Onion / Clean architecture. I use the Busines Logic layer and the Service layer interchangeably, but for the sake of simplicity for this application.

So my web application basically queries a few CSV files. These are the player data where we have the biographies of the tennis players and their match records and their head to head records. Besides the obvious display of data in the user interface layer inside the view, this data has to be displayed very differently from the way it is stored, let's assume that there is also business logic decisions that are processed at the service / business layer.

Assuming that the application will become much larger than its starting point, I decided to use the repository model and not go directly to the data source. The repository classes and the corresponding interfaces therefore reside in Data Access Layer. All of these are closely related to each other, so if we decide to switch from CSV files to SQL DB, much of this layer will have to be rewritten. It is, so to speak, an outer layer.

The innermost layer is the model / domain objects that make sense from a logical point of view and do not necessarily match 1 to 1 with how they are stored in the database nor how they are displayed in the view. The 3 layers DAL, BL, UI can directly access these model classes. However, these are in their own projects and these depend on nothing outside of this project. From what I understand, this is where ignoring the technology is important because we want to be able to change DAL without a single one without any modifications required for that particular layer.

DI is used both for the Business layer to be able to use DAL and for the UI layer to use the functionality of the Business layer. There are no such separate DTOs and instead domain model objects are used for this.

This is how I intend to configure it for scalability and SoC. Can someone please point out the disadvantages of this and if I understand things correctly?