Python: Not so Lazy as we Thought writes: Maybe lists are not lazy? A simple test confirms this: >>> a = [] >>> b = [] >>> [a.append(1), b.append(2)][0] >>> a [1] >>> b [2] How is this list behaviour not lazy?Read more
Python: Not so Lazy as we Thought writes: Maybe lists are not lazy? A simple test confirms this: >>> a = [] >>> b = [] >>> [a.append(1), b.append(2)][0] >>> a [1] >>> b [2] How is this list behaviour not lazy?Read more
I have some problems with the built-in function Differences. I do not understand how its behaviour comes around under the following circumstances: vec = {a, b, c, d, e, f, g, h}; vec2 = ConstantArray[1, 10]; Differences[#, 1, 0]^2 & /@ {vec, vec2} gives me {{0, 0, 0, 0, 0, 0, 0, 0}, {0, 0,Read more
I am currently migrating databases from SQL Server 2008 (SP4) to SQL Server 2017 (CU3). A significant change is that all filegroups have two data files after migration. To accomplish this task I restore a backup, add the new filegroup with two equally sized files as well as the same autogrowth settings and transfer theRead more
Imagine I have an abstract class Node which has several methods and attributes. (Join a network, send a message, broadcast …). I want to be able to add/remove functionality to/from that Node class (Routing functionality, mining functionality, …) I was thinking about using a Decorator pattern since that let’s me change the behaviour of thatRead more
Am using Magento2 CE 2.1.10 A custom boolean attribute (global scope) has been added, attribute code “custom_force_on_web” with default value of false. Desired outcome is that an out of stock product (either inventory quantity is zero and/or its’ status is set to “Out of Stock”) be visible in its parent category page (frontend) and anyRead more
Need your suggestion on how below works. Situation: We had unsent log on Principal stuck for almost 10 hours with unsent data around 200 GB. Action: Paused and resumed the mirroring. This kicked of the stuck mirroring. All 200 GB is now send to mirror and its trying to restore. But when new transactions areRead more
CREATE TABLE products( products_id serial, location_id integer, –(not unique) idle_products jsonb –has 1000 elements (‘[13,45,8976…..]’::jsonb) ); CREATE EXTENSION btree_gin; CREATE INDEX idx ON products USING GIN(location_id, idle_products); Take just for example; products table have millions of rows and 1000 elements in every row in idle_products column. I am gonna take 25 rows after a queryRead more
Consider the following setup: CREATE TABLE NAMES(Id integer PRIMARY KEY, Name text); INSERT INTO NAMES VALUES(1,’Tom’); INSERT INTO NAMES VALUES(2,’Lucy’); INSERT INTO NAMES VALUES(3,’Frank’); CREATE TABLE fields(fid integer, fname text); INSERT into fields values(1, “Id”); insert into fields values(2, “Name”); SELECT name, (SELECT “Name”) FROM NAMES; The last statement will output Tom|Tom Lucy|Lucy Frank|Frank However,Read more
On Windows system, Mathematica by default opens stream which will automatically transform any “\n” into “\r\n”. But I want pure line feed. In this post, librik suggested using BinaryFormat->True in OpenWrite to explicitly control newline behaviour. In this way, tmp = OpenWrite[file, BinaryFormat -> True]; WriteString[tmp, “test”, “\n”, “test”]; Close[tmp] will give correctly in which,Read more
so far I put functions into objects, if those functions work exclusively on the object’s variables/state. Basically I’m following a non-anemic/rich domain model approach. However, it becomes more difficult, if the behaviour is only partially based on the object’s state. In those cases I see two options Non-anemic approach: pass the additional information as argumentRead more