Frege’s argument for the existence of abstract mathematical objects

I have some trouble understanding Freges argument in particular as presented here,

In particular the first premise i.e

“The singular terms of the language of mathematics purport to refer to mathematical objects, and its first-order quantifiers purport to range over such objects”

If we refer to our language how is then the object that we introduce independent of us as the “intelligent” agents, which Platonism suggests it should be?

What technique is used to animate interaction between tiny objects in sim games?

In simulation games like Sim City and Factorio, there are numerous interaction between tiny objects that needs to be animated. e.g. random people walking on the sidewalk, then waits for a bus, then board the bus; tiny cars waiting in line for each other at the traffic junction; thousands of items on a convey belt and the robotic arm needs to wait for and item to arrive in front of it to pick it up; conveyor belt sections transferring items from one to another;

I think we cannot check collision detection for every tiny object independently as it will eat a lot of CPU, then what is the technique we can use in these games?

How to get an array of user_id from an array of user objects

I’m following the RailsTutorial book. Now I’m about to finish the final feature of the sample_app project, implementing the newsfeed.

# Returns a user's status feed. def feed   following_ids = "SELECT followed_id FROM relationships                    WHERE  follower_id = :user_id"   Micropost.where("user_id IN (#{following_ids})                    OR user_id = :user_id", user_id: id) end 

This implementation works well, however, I want to turn the SQL Query into Active Record Query.

The idea is, now for each user, I can get an array of the following users through user.followings

irb(main):003:0> user = User.find(1)   User Load (0.3ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = ? LIMIT ?  [["id", 1], ["LIMIT", 1]] => #<User id: 1, name: "Example User", email: "", created_at: "2019-05-23 04:33:11", updated_at: "2019-05-23 04:33:11", password_digest: "$  2a$  10$  vaFfyQIy/oVdK4Q./SNitu4FZH0T1qAfTAM/b4rcEQM...", remember_digest: nil, admin: true, activation_digest: "$  2a$  10$  twXzgR5Ijd8msyeEudLfRuPbH3fZBkURqFWJLJHEnq0...", activated: true, activated_at: "2019-05-23 04:33:11", reset_digest: nil, reset_sent_at: nil> irb(main):004:0> user.following   User Load (0.2ms)  SELECT  "users".* FROM "users" INNER JOIN "relationships" ON "users"."id" = "relationships"."followed_id" WHERE "relationships"."follower_id" = ? LIMIT ?  [["follower_id", 1], ["LIMIT", 11]] => #<ActiveRecord::Associations::CollectionProxy [#<User id: 3, name: "Leif Crooks", email: "", created_at: "2019-05-23 04:33:11", updated_at: "2019-05-23 04:33:11", password_digest: "$  2a$  10$  TOTp70D/dss.8WWFGM7CsuSdeSxhm4h.qW2/PAq1ZiY...", remember_digest: nil, admin: false, activation_digest: "$  2a$  10$  XAcecoi5PzDGVbkvxUn.b.Go/HWHtp9A.BzTnP/KwEJ...", activated: true, activated_at: "2019-05-23 04:33:11", reset_digest: nil, reset_sent_at: nil>, #<User id: 4, name: "Mr. Leopoldo Moore", email: "", created_at: "2019-05-23 04:33:12", updated_at: "2019-05-23 04:33:12", password_digest: "$  2a$  10$  Qu66eTvXw9JvcLX5e/vIKOqsmlsZtcbwZocjDoI9Dax...", remember_digest: nil, admin: false, activation_digest: "$  2a$  10$  43vRoHzX/YtbQjNGVmpkHOGiPENGu2JqEeCBOP0yV7T...", activated: true, activated_at: "2019-05-23 04:33:12", reset_digest: nil, reset_sent_at: nil>, #<User id: 5, name: "Cathrine Oberbrunner", email: "", created_at: "2019-05-23 04:33:12", updated_at: "2019-05-23 04:33:12", password_digest: "$  2a$  10$  kzq39HOWhkblDjhab9si3eKYum8KMPipZ477KXDD56T...", remember_digest: nil, admin: false, activation_digest: "$  2a$  10$  UK3/U4sXCwAvMpQVS8IV7uUxVZtns8Thehx.bKHBkO2...", activated: true, activated_at: "2019-05-23 04:33:12", reset_digest: nil, reset_sent_at: nil>, #<User id: 6, name: "Modesta O'Reilly", email: "", created_at: "2019-05-23 04:33:12", updated_at: "2019-05-23 04:33:12", password_digest: "$  2a$  10$  ortwYRTe/8ZKCXrgBRDeGe.ka13/MweU4S.p3x3328m...", remember_digest: nil, admin: false, activation_digest: "$  2a$  10$  SNjnRb8IzPbbf94DUHF2QO/ACccEGoYCjJdJx7G6jjR...", activated: true, activated_at: "2019-05-23 04:33:12", reset_digest: nil, reset_sent_at: nil>, #<User id: 7, name: "Kathryn Waelchi", email: "", created_at: "2019-05-23 04:33:12", updated_at: "2019-05-23 04:33:12", password_digest: "$  2a$  10$  C.J7OD60iG8G3U9Iq1gKKeVaF1e1lWqDNBU19kCPSa3...", remember_digest: nil, admin: false, activation_digest: "$  2a$  10$  29K3oD78cewabLk75HUihurY9cYcaaSXw/Ck54TsmSC...", activated: true, activated_at: "2019-05-23 04:33:12", reset_digest: nil, reset_sent_at: nil>, #<User id: 8, name: "Jules Kiehn", email: "", created_at: "2019-05-23 04:33:12", updated_at: "2019-05-23 04:33:12", password_digest: "$  2a$  10$  nI504wtFpQ.6UNFeCP5Lc.N3iaMcJr1FFbhtboibYIe...", remember_digest: nil, admin: false, activation_digest: "$  2a$  10$  tMb.q8s1vyVOnLpOChBqj.hDXgnIBEBia3WyetfWFpP...", activated: true, activated_at: "2019-05-23 04:33:12", reset_digest: nil, reset_sent_at: nil>, #<User id: 9, name: "Trinity Carroll", email: "", created_at: "2019-05-23 04:33:12", updated_at: "2019-05-23 04:33:12", password_digest: "$  2a$  10$  U3EJS09QuzKFmB5B4rDUT.xJpCYjYiYVgJJLw0g.5DE...", remember_digest: nil, admin: false, activation_digest: "$  2a$  10$  i4r5VO1k3fFqzW1hwSdcR.FhIa/nOArovw5rFpbzmYD...", activated: true, activated_at: "2019-05-23 04:33:12", reset_digest: nil, reset_sent_at: nil>, #<User id: 10, name: "Ms. Judd Hintz", email: "", created_at: "2019-05-23 04:33:12", updated_at: "2019-05-23 04:33:12", password_digest: "$  2a$  10$  LeErUbCT2z4/t1BKfLOD/eh6YhBYLF4B7HnawYJu5XG...", remember_digest: nil, admin: false, activation_digest: "$  2a$  10$  BHSrPUPYZo0fEJ5juuWng.WSuGrEq7pIFzSoQoowFSJ...", activated: true, activated_at: "2019-05-23 04:33:12", reset_digest: nil, reset_sent_at: nil>, #<User id: 11, name: "Emmanuelle Toy", email: "", created_at: "2019-05-23 04:33:12", updated_at: "2019-05-23 04:33:12", password_digest: "$  2a$  10$  FAAdQ18vejKeBCJ.oxrzi.S17JWeZEZi9byFQzNEbcB...", remember_digest: nil, admin: false, activation_digest: "$  2a$  10$  UlFDwLmpj0kJTdPmmAvaqePC1MMt9kGsl4V9F4PQQe6...", activated: true, activated_at: "2019-05-23 04:33:12", reset_digest: nil, reset_sent_at: nil>, #<User id: 12, name: "Jasmin O'Connell", email: "", created_at: "2019-05-23 04:33:12", updated_at: "2019-05-23 04:33:12", password_digest: "$  2a$  10$  vc6pHmVxLO9Moj6vGU7AOeTYnCCmJrUZMn2vaevw.pR...", remember_digest: nil, admin: false, activation_digest: "$  2a$  10$  jv.PRtYaloeNTGS27FjQT.jwhbRo/PaUujP1QP1LrB7...", activated: true, activated_at: "2019-05-23 04:33:12", reset_digest: nil, reset_sent_at: nil>, ...]> irb(main):005:0>  

I think I’m really close now, but I’m quite new to Rails framework and Ruby language, I don’t know how to go any further in the progress of turning the current author’s implementation of the feed method into fully using Active Record Query. Please help! Any help would be truly appreciated!

Java objects for a network sniffer program

I’m working on a network sniffer program, whose structure uses 3 main classes:

  1. Frame Class – One per monitored frame, holds reference to all the other sub frames
  2. Parse Class – Holds the hex value of the entire frame
  3. Protocol Classes – Individual classes for each network protocol

When a new frame is captured its sent to the Frame() class and put inside a Parse() object for unpacking at each layer:

enter image description here

Inside the frame object, a check is made to see what protocol comes next, that’s then registered up at the top of the frame class (e.g., IPv4 ipv4 = new IPv4(this);), and the Frame instance is passed to that object. When the processing is done in the protocol class, a call is made to one of the switch methods (back in Frame()) to determine which protocol comes next.

Frame Class:

public static int pakCount = 0; public static int parseErrCount = 0; public static boolean print = true;  public int dlt = -1; public Parser parse = null;  public IEEE_802_3_ethernet_header ieee_802_3_ethernet_header = null; public IEEE_802_11_radiotap_header ieee_802_11_radiotap_header = null; public IEEE_802_11_mgmt_beacon ieee_802_11_mgmt_beacon = null; public IPv4 ipv4 = null; public UDP udp = null; public TCP tcp = null; public ICMP icmp = null; public ICMPv6 icmpv6 = null; public IPv6 ipv6 = null;  public static Specification spec = new Specification();  public Frame(String dlt, String hex)  {                Frame.pakCount++;     parse = new Parser(hex);      if (Frame.print)     {         System.out.print("-" + Frame.pakCount);         System.out.println(Utils.repeat(400, "-"));         parse.printHex();     }      dltSwitch(Integer.valueOf(dlt));      if (parse.parseErr == true)     {         parseErrCount++;     } }  public void dltSwitch(int dlt) {     if (Frame.print)         System.out.println("[+] DLT: " + dlt);      switch(dlt)     {         case 1:             ieee_802_3_ethernet_header = new IEEE_802_3_ethernet_header(this);             break;         case 127:             ieee_802_11_radiotap_header = new IEEE_802_11_radiotap_header(this);             ieee_802_11_mgmt_beacon = new IEEE_802_11_mgmt_beacon(this);             break;     } }  public void etherTypeSwitch(int etherType) {            switch (etherType)     {         case 2048:             ipv4 = new IPv4(this);             break;         case 34525:             ipv6 = new IPv6(this);     } }  public void ipProtoSwitch(int proto) {            switch (proto)     {         case 1:             icmp = new ICMP(this);             break;         case 6:             tcp = new TCP(this);             break;         case 17:             udp = new UDP(this);             break;         case 58:             icmpv6 = new ICMPv6(this);             break;     } } 

IpV4 Class: (all the other protocol classes are structurally similar)

public IPv4(Frame frame)  {        this.version = frame.parse.nextBits(4);     this.internetHeaderLength = frame.parse.nextBits(4);     this.typeOfService = frame.parse.nextBytes(1);     this.totalLengthBits = (frame.parse.nextBytesNum(2) * 8);      this.identification = frame.parse.nextBytes(2);     this.unassigned = frame.parse.nextBits(1);     this.dontFrag = frame.parse.nextBits(1);     this.moreFrag = frame.parse.nextBits(1);     this.fragOffset = frame.parse.nextBits(13);      this.ttl = frame.parse.nextBytes(1);     this.protocol = Types.hexToNum(frame.parse.nextBytes(1));     this.checksum = frame.parse.nextBytes(2);      this.sourceIP = frame.parse.nextBytes(4);     this.destIP = frame.parse.nextBytes(4);      print();     frame.ipProtoSwitch(protocol); } 

I’m trying to find a better class organisation to represent these nested classes. The requirements are that the current protocol class being processed needs to be able to access the fields of the protocol class above it. I was thinking of some sort of inheritance but with so many protocol class types I can’t think of a way to make it work.

Twig Templates: How to stringify objects or atleast get a string value?

The item.content for my field item is ‘active’. However, when I use a comparison operator as seen below, it never equates to True but always False. I thought maybe some spacing issues was the reason, but that seems to not be the case.

Is the content in item.content not a string? I am assuming when I call item.content, its probably a object, but I can’t find any documentation on how to turn a object’s value into a string so it equates to true.

{% for item in items %}   {% if item.content == 'active' %}     <div{{ item.attributes.addClass('field__item', 'status_item_active') }}>{{ item.content }}</div>   {% else %}     <div{{ item.attributes.addClass('field__item', 'status_item_notactive') }}>{{ item.content }}</div>   {% endif %} {% endfor %} 

C# convert object’s set “value” to function, if it is a function

I’m trying to execute a function when setting a certain variable to another value, for example:

myvar = new Action<string>(string s) { ///    etc.... } 

and the myvar would have a getter and setter like such:

public object myvar {    get {return null}    set {       value("hi there") // not working since "value" is technically not a function    } } 

so do I need to cast value as a function first? But what if the function is a different kind of function, like Func<string, int, string>, or a simple Action<string> ? And I only want to activate the function if it is a function, so how would I check first?

Which set of compact objects generates the subcategory of a compactly generated stable model category

I couldn’t find any info on what set of compact objects generates the following subcategory:

Let $ k$ be a field of positive characteristic and let $ G$ be either a finite group or a finite group scheme over $ k$ . Then let $ \mathrm{stab}(k[G])$ be a stable model category consiting of finitely generated $ k[G]$ -modules (modulo the projectives). It is a subcategory of $ \mathrm{Stab}(k[G])$ – the stable model category of all $ k[G]$ -modules (modulo the projectives). For $ \mathrm{Stab}(k[G])$ , it is known that compact objects are precisely finitely-generated modules and the simple modules generate $ \mathrm{Stab}(k[G])$ .

More generally, let $ \mathcal{K}$ be a compactly generated stable model category with a set $ \mathcal{C}$ of compact objects and a set $ \mathcal{G}$ of compact generators. What are the compact generators of the subcategory of $ \mathcal{K}$ spanned by objects in $ \mathcal{C}$ ? I realize that this may be unknown, so I’d appreciate any particular examples (I’m more interested in cases where the orignal stable model category has a set of compact generators rather than a single one).

For the definitions I use, I refer to Schwede-Shipley. Of course, substituting the term “stable model category” for “triangulated category” across my question makes no difference.

OpenSSL generating .cnf from windows bat script, error: no objects specified in config file

I’m a little stuck trying to generate certificates against a windows 2012R2 AD CS CA using openSSL.

My bat script asks for some inputs and uses them to generate a .cnf file for that specific request. When i run the script and open the .cnf file i see the following which all appears correct:

[ req ] default_bits       = 2048 distinguished_name = req_distinguished_name req_extensions     = req_ext [ req_distinguished_name ] countryName                 = US stateOrProvinceName         = Michigan localityName               = Detroit organizationName           = LEI commonName                 = [ req_ext ] subjectAltName = @alt_names [alt_names] DNS.1 = DNS.2 = DNS.3 =  

So far so good, after the bat script generates this file it calls the following openSSL command:

openssl req -out TEMP/%_CNAME%.req -newkey rsa:2048 -nodes -keyout TEMP/%_CNAME%.key -config TEMP/%_CNAME%.cnf 

OpenSSL does it’s thing and starts to give me output as follows:

---- You are about to based to enter information that will be incorporated into your certificate request. For some fields there will be a default value, If you enter '.', the field will be left blank. ---- US []: Michigan []: etc... 

Here is where things go sideways. If i just enter through the fields accepting the default values from the .cnf file, i get the following:

error, no objects specified in config file. Problems making Certificate Request 

Now, if i go back and don’t just enter through my defaults, say i set the following:

US []: US 

It then accepts my .cnf files, does not generate an error, but generates an invalid CSR, the only items that show up in the CSR in this case would be Country=US.

I can’t sort this out, i thought it was an encoding issue but when i inspect the file in notepad++ it’s UTF-8 encoded. Anyone have any suggestions?

Here is the section of the bat scripting that genetrates the .cnf file:

REM Create .cnf file @echo off @echo [ req ]> TEMP/%_CNAME%.cnf @echo default_bits       = 2048>> TEMP/%_CNAME%.cnf @echo distinguished_name = req_distinguished_name>> TEMP/%_CNAME%.cnf @echo req_extensions     = req_ext>> TEMP/%_CNAME%.cnf @echo [ req_distinguished_name ]>> TEMP/%_CNAME%.cnf @echo countryName                 = US>> TEMP/%_CNAME%.cnf @echo stateOrProvinceName         = Michigan>> TEMP/%_CNAME%.cnf @echo localityName               = Detroit>> TEMP/%_CNAME%.cnf @echo organizationName           = LEI>> TEMP/%_CNAME%.cnf @echo commonName                 = %_DNS%>> TEMP/%_CNAME%.cnf @echo [ req_ext ]>> TEMP/%_CNAME%.cnf @echo subjectAltName = @alt_names>> TEMP/%_CNAME%.cnf @echo [alt_names]>> TEMP/%_CNAME%.cnf @echo DNS.1 = %_DNS%>> TEMP/%_CNAME%.cnf @echo DNS.2 = %_DNS2%>> TEMP/%_CNAME%.cnf @echo DNS.3 = %_DNS3%>> TEMP/%_CNAME%.cnf 

Determine if action is possible depending on many objects and notify state changes

In the game I’m developing I need to determine if an action is possible. Whether the action is possible is dependent on a number of factors spread across many objects (ActionDeterminers) in the game. These objects may or may not exist, and whether each of the objects allows the action is dynamic.

I had the idea to implement an Observer-style pattern, where these ActionDeterminers can register themselves with a Subject. When the Subject is asked IsActionPossibleEverywhere, it can then call an interface function on each of the ActionDeterminers: IsActionPossible, and then AND all of their results. Is there a name for this pattern?

The issue I’m facing is that I would also like to notify another set of objects (Observers) of changes in the result of IsActionPossibleEverywhere, using the standard Observer pattern. As far as I can tell, I have two options for this:

  1. Polling. I could simply call IsActionPossibleEverywhere in the main loop, and then notify every Observer when the the result changes from the last call. Unfortunately, the IsActionPossibleEverywhere call could potentially be non-performant (depending on each of the ActionDeterminers).

  2. Give each of the ActionDeterminers the additional responsibility of informing the Subject of when their personal IsActionPossible call might change. The Subject will then call IsActionPossibleEverywhere and inform its Observers if the result changed from the last call. This is considerably more complex and has more potential points of failure.

Please let me know if you have any other ideas for how I could implement this system. Thanks!

Reset state or create new objects

I am developing a desktop application that will be run at each station at a call center. It listens for an incoming call, and whenever a call arrives, there are about 30 different classes that need to run various operations. Some of these operations are synchronous, such as setting a flag because they want to log only the first time per call that an event happens. Some of them are asynchronous, such as establishing a socket to another application and sending a start message. At the end of the call, the classes will also have to do some clean up, such as sending an end call message, awaiting a response, and then closing the socket.

Currently, I create all the classes in the composition root, and they live for the life of the application. Each time a call arrives, the state of all of these classes gets reset. Here is a simplified, but working, code sample:

    class Program     {         static void Main(string[] args)         {             var messagePersistence = new MessagePersistence();             var socketConnection = new SocketConnection(messagePersistence);             var otherComponent = new OtherComponent();              ICallComponent[] Components = { messagePersistence, socketConnection, otherComponent };             TestCall testCall = new TestCall(Components, socketConnection);              testCall.Execute().Wait();              // Create another TestCall instance or run the same one again?             testCall.Execute().Wait();              Console.WriteLine("Press any key to end");             Console.ReadKey();         }     }      class TestCall     {         private IEnumerable<ICallComponent> _components;         private IDataReceiver<byte[]> _dataDestination;          public TestCall(IEnumerable<ICallComponent> components, IDataReceiver<byte[]> dataDestination)         {             _components = components;             _dataDestination = dataDestination;         }          public async Task Execute()         {             // Start the components             foreach (ICallComponent Component in _components)             {                 await Component.StartAsync();             }              // This simulates the actual work, which would periodically pull bytes from some source and send them to _dataDestination             using (var Timer = new System.Timers.Timer(500))             {                 Timer.Elapsed +=                     async (sender, e) =>                     {                         await _dataDestination.ProcessData(new byte[] { 1, 2, 3 });                     };                 Timer.Start();                  await Task.Delay(5000);             }              // Stop the components             foreach (ICallComponent Component in _components)             {                 await Component.StopAsync();             }         }      }      interface ICallComponent     {         Task StartAsync();         Task StopAsync();     }      interface IDataReceiver<T>     {         Task ProcessData(T data);     }      class SocketConnection : ICallComponent, IDataReceiver<byte[]>     {         private IDataReceiver<string> _messageDestination;          public SocketConnection(IDataReceiver<string> messageDestination)         {             _messageDestination = messageDestination;         }          public async Task StartAsync()         {             Console.WriteLine("Making socket connection");             await Task.Delay(1);             Console.WriteLine("Executing initial connection handshake");             await Task.Delay(1);             Console.WriteLine("Socket is connected");         }          public async Task StopAsync()         {             Console.WriteLine("Executing close connection handshake");             await Task.Delay(1);             Console.WriteLine("Closing socket connection");             await Task.Delay(1);             Console.WriteLine("Socket is closed");         }          public async Task ProcessData(byte[] data)         {             // Simulate sending data on the socket, and sometimes getting a response that would trigger             // a string going to the destination             await _messageDestination.ProcessData("ABC");         }     }      class MessagePersistence : ICallComponent, IDataReceiver<string>     {         public async Task StartAsync()         {             Console.WriteLine("Creating call database record, start time={0}", DateTime.Now);             await Task.Delay(1);             Console.WriteLine("Database record created");         }          public async Task StopAsync()         {             Console.WriteLine("Finalizing call database record, end time={0}", DateTime.Now);             await Task.Delay(1);             Console.WriteLine("Database record finalized");         }          public async Task ProcessData(string data)         {             Console.WriteLine("Creating message database record, time={0}", DateTime.Now);             await Task.Delay(1);         }     }      class OtherComponent : ICallComponent     {         public async Task StartAsync() { await Task.Delay(1); }         public async Task StopAsync() { await Task.Delay(1); }     }  

My problem is that this seems kind of fragile. The order in which the objects is started becomes very important, especially if the objects are related. Otherwise you can run into a situation where SocketConnection is feeding messages to MessagePersistence, which hasn’t yet completed its startup. This prevents doing something like running the tasks in parallel.

I feel like it would be better to create these objects as needed, so they can never be in an invalid state. In other words, the call started event would call a factory method to asynchronously create objects. That way, the MessagePersistence dependency passed to SocketConnection will be guaranteed to be in a valid state for receiving messages before SocketConnection is even created.

So my thought would be to make an abstract factory like the following:

    interface ICallComponentFactory     {         Task<IEnumerable<IAsyncDisposable>> CreateCallComponentsAsync();     }      interface IAsyncDisposable     {         Task DisposeAsync();     } 

The call started event handler would call the factory method to get a collection of IAsyncDisposables, which it would save in a shared data class injected into it. The call ended event handler would also be injected with this shared data class and could just go through all of them and call DisposeAsync to do the cleanup.

Does this technique make sense? I’m used to a factory creating one instance of an object. Is it weird to have a factory that creates a bunch of objects and returns all of them in a collection? Or is that overkill and things are fine the way they are? Or maybe there is some cleaner way that I’m missing? I’m using C# 6.0 if it matters.