Photon Realtime, StripKeysWithNullValues cause heavy GC Alloc

In our current project, we use Photon room properties to sync entities. and i noticed some heavy GC Allocs while deep profiling the game and it always ends down to this method.

enter image description here

Have anyone faced this issue before ? or attempted to fix it ? here is the source code of that method.

/// <summary>         /// This removes all key-value pairs that have a null-reference as value.         /// Photon properties are removed by setting their value to null.         /// Changes the original passed IDictionary!         /// </summary>         /// <param name="original">The IDictionary to strip of keys with null-values.</param>         public static void StripKeysWithNullValues(this IDictionary original)         {             object[] keys = new object[original.Count];             original.Keys.CopyTo(keys, 0);              for (int index = 0; index < keys.Length; index++)             {                 var key = keys[index];                 if (original[key] == null)                 {                     original.Remove(key);                 }             }         } 

How to store real-time data to database

Here is my situation:

  • I have a WebSocket connection that feeds me data real-time
  • I have an async callback function that gets the data and inserts into a queue
  • I have another thread that reads from the queue and stores it into the Postgres database (using python’s psycopg2 library)

The problem is the real-time data comes in faster than the time it takes to insert into the database, and in a couple of hours, the server runs out of memory. (Is this because psycopg2 library is slow?)

A simple solution is to create more threads that insert into the database; however, this will cause the data to be out of order. Is there a database that sorts the data? Other suggestions would be very much appreciated.

By the way, is there a way I could build a WebSocket client using docker/Kubernetes that can do load balancing for me?

Java Card with a Secure Real-Time Clock

A very long time ago, Dallas Semiconductor released the Java-Powered iButton:

Java-Powered iButton

These devices were somewhat similar in purpose to modern Java Card compliant smart cards, except for one detail: they had a built-in primary-cell battery and a secure real-time clock (RTC). The battery was estimated to be good for up to a decade.

Cryptographic iButton Assembly

Sadly, it seems that the Java-Powered iButton didn’t get market traction. However, having a programmable token with an integrated primary-battery and secure real-time clock is extremely useful since it enables the following features:

  • Active countermeasures that instantly zeroize all contained secrets if the secure element is physically tampered with or the battery is disconnected
  • Preventing operations after a certain date
  • Preventing operations before a certain date

If there is a need to have a security token with an integrated real-time clock, are there any modern solutions that don’t require custom hardware engineering? Is there a modern equivalent to the “Java-Powered iButton”?

Where can I find an accurate map of Earth for a real-time third-person game?

I want to create a game that will allow the player to move to any place on Earth. The game will not be first-person, but it will be possible to zoom in quite close nonetheless. What I am lacking is an accurate height-map of the planet. Textures such as albedo, specular or normal would also be very helpful.

I don’t know if such textures exist, but an “accurate” height-map should have a resolution of at most a few meters.

The textures do not have to be 100% real. Some parts can be procedurally generated, as long as they look “realistic”.

puedo usar una sola realtime database de firebase con varias aplicaciones android?

Voy a empezar un proyecto que consta de 3 apps las mismas están relacionadas entre si , es decir necesitan acceder a los mismos datos, he buscado en la documentación de firebase y no pude encontrar si puedo conectar estas tres app y quiza una pagina web a la misma base de datos en firebase o como hacerlo

Real-time Whiteboard using XMPP

I have been looking for implementation of real-time whiteboard application using XMPP. This is my research project and I have been studying XMPP itself and other research paper related to real-time groupware system. Unfortunately I haven’t found any documented work done related to XMPP other than

  • https://xmpp.org/extensions/xep-0113.html
  • https://xmpp.org/extensions/xep-0010.html

The problem is that these are obsolete and deferred and no longer approved for production.

Is XMPP not suitable for such application and maybe that is why no proper work has been done on it ?

I know it is a bit opinion based question I apologies for that. If that is the case then please can you refer me other places where I can ask regarding this.

Is there a WP plug-in that accepts a referral code at checkout without discounting a product? And a Map Locator in real-time?

Good day! I need your expertise before I make a purchase on plugins. I need TWO plugins that will accomplish these two objectives: 1.) E-commerce that will ALLOW a special code (like a coupon code BUT WON’T discount the product.) We need to track where it came from. We have affiliate stores that direct people to buy straight from us on our own website. We want to give commission to the affiliate store that referred our product etc. and needs to respectfully track it with the utmost integrity. This code represents their store the referral was made. AND 2.) We need a store locator map on our website exactly how it appears here: https://www.acehardware.com/store-locator. Thank you, anyone, for your help. The tech gurus with my hosting company referred me here.

Running code generated in realtime in JavaScript with eval()

Consider a front-end JavaScript application where menu items needed to be shown or hidden based on somewhat simple logic (roles that user has and some other logical state).

A simple language was introduced to define this logic in a concise human-readable way and every menu item was assigned a string condition, which looks like this: "isLoggedIn() AND NOT role(PARTNER)".

In order to actually check this condition, a simple compiler was implemented, which translates this language into a valid JavaScript code string and executes it using eval() returning the boolean result in the end.

The compiler works by replacing some constructs, like AND, OR and NOT with valid JavaScript equivalents like &&, || and ! using simple regular expressions:

private compileExpression(expression: string) {    // Adding commas around function arguments (to make them strings)   expression = expression.replace(/(\w+)\((.*?)\)/g, `$  1('$  2')`);    // Replacing "AND"   expression = expression.replace(/\sAND\s/g, ' && ');    // Replacing "OR"   expression = expression.replace(/\sOR\s/g, ' || ');    // Replacing "NOT"   expression = expression.replace(/(\s|^)NOT\s/g, ' !');    // Prefixing predicates   expression = expression.replace(/(\w+)\((.*?)\)/g, 'Π.$  1($  2)');    return expression;  } 

This turns "isLoggedIn() AND NOT role(PARTNER)" into "Π.isLoggedIn() && !Π.role('PARTNER)", which is then executed by eval():

public matchCondition = (condition: string): boolean => {    // Using greek letter "P" for predicate (for shortness and uniqueness)   // noinspection NonAsciiCharacters   const Π = this.predicates;    const expression = this.compileExpression(condition);    const result = eval(expression);    return result;  } 

The Π is an object with simple predicate functions, which return boolean values like isLoggedIn(): boolean and role(roleName: string): boolean.

The expressions, that are being translated and executed are stored statically in local object as strings and are not accessible from global context. Also, all expressions are written by the developers and are not coming from users of the application in any way.

Is it safe to use eval() this way or should it be avoided at all costs (e.g. “eval is evil”, “never use eval”, etc)?

What are the possible attack vectors, that could be used to compromise such eval usage?

If expression strings will be loaded from the HTTPS server using XHR/Fetch, will it change the situation security-wise?