Categories
Mastering Development

Why is my application throwing an InvalidOperationException: Invalid Enum Type after command execution completes?

This exception is thrown at an unknown, but effectively immediate time after returning from a command that creates a window and waits for its exit through Window.ShowDialog. The exception thrown is: System.InvalidOperationException: “Unknown enum type.” with Stack Trace reported in the exception viewer as: at System.RuntimeType.IsEnumDefined(Object value) in f:\dd\ndp\clr\src\BCL\system\rttype.cs:line 4155 This is ostensibly not true… […]

Categories
Mastering Development

How to draw custom cell in JTable?

I am making a JTable that each cell (Except for column 0) has multiple states, and depending on the state I want that cell to show a different graphic. Is there a way to have a paint method or use icons of some sort to paint my own graphics onto the cell? This is my […]

Categories
Development

Custom Partitioner for Plain Producer | Kafka Streams

I have an kafka streams application which has props.put(ProducerConfig.PARTITIONER_CLASS_CONFIG, MyPartitioner.class); or props.put(ProducerConfig.PARTITIONER_CLASS_CONFIG, RoundRobinPartitioner.class); which is a class for distributing messages to different partitions even using same key in kafka 2.4 version RoundRobinPartitioner has this implementation: public class RoundRobinPartitioner implements Partitioner { private final ConcurrentMap<String, AtomicInteger> topicCounterMap = new ConcurrentHashMap(); public RoundRobinPartitioner() { } public void […]

Categories
Development

I already have a checkbox in a Java Swing TreeNode. But how do I make it checkable?

Note: I am NOT asking how to put a checkbox in a JTree – previously, a confused moderator thought this is what I was asking. I already have the checkbox in the tree. I am asking what class or method controls the checkability of the checkbox… In order to get a checkbox inside a Tree […]

Categories
Development JSON

How to write a MassTransit Json Deserializer on Azure Services

here it is how I am publishing to an object to event grid. I want to be able to use the azure service bus to listen to it. public void Publicar<T>(T model, string operation, string entity) { _nomeEvento = entity + operation; Boolean.TryParse(Configuration[“EventGridConfig:Enabled”], out var eventGridIsActive); if (!eventGridIsActive) return; var primaryTopicKey = Configuration[“EventGridConfig:AcessKey”]; var primaryTopic […]

Categories
Development JSON

Newtonsoft Json converter for json with filters

I am writing converter for json like this: { “datatable”: { “data”: [ [ “A85002072C”, “1994-11-15”, 678.9 ] ], “columns”: [ { “name”: “series_id”, “type”: “String” }, { “name”: “date”, “type”: “Date” }, { “name”: “value”, “type”: “double” } ] }, “meta”: { “next_cursor_id”: null } } At the moment my converter looks like this: […]

Categories
Cache Development

Infinispan + Spring Boot – Doesn’t Cache

Trying to Implement infinispan base cache on spring boot using custom annotation: @Aspect @Configuration @Slf4j public class CacheAnnotationAspect { Logger logger = LoggerFactory.getLogger(CacheAnnotationAspect.class); @Autowired InfinispanCacheService cacheService; @Around(“@annotation(com.calsoft.lib.cache.CacheResult)”) public Object cacheResult(ProceedingJoinPoint joinPoint)throws Throwable{ logger.info(“Cache Operation :: CacheResult annotation advice invoked…”); CacheResult cacheResult=(CacheResult) getAnnotation(joinPoint,CacheResult.class); CacheConfig cacheConfig=CacheConfig.from(cacheResult); Object resultFromCache=getFromCache(joinPoint,cacheConfig); if(resultFromCache!= null){ return resultFromCache; } Object result=joinPoint.proceed(joinPoint.getArgs()); storeInCache(result,joinPoint,cacheConfig); return […]

Categories
Development Windows

int validation fails on empty TextBox

I’ve a TextBox bound to an int property with [Required] and [Range(1, 5)]attribute, when app starts TextBox gets 0, if I press Backspace and delete that 0, I get this message in Debug log: System.Windows.Data Error: 7 : ConvertBack cannot convert value ” (type ‘String’). BindingExpression:Path=Order.PartyCode; DataItem=’OrderVM’ (HashCode=66572856); target element is ‘TextBox’ (Name=”); target property […]

Categories
Development

Creating a custom container control makes padding not work

I’ve created a custom container control deriving from the Control class, and when I’m setting some padding values it doesn’t change anything. For example my code: public class LiteContainer : Control { public LiteContainer() { this.BackColor = Color.White; this.Padding = new Padding(10); // Not working. } } I also tried to derive from ScrollableControl instead […]

Categories
Development JSON

.Net Core 3 and EF Core 3 Include Problem (JsonException)

After 4 years, I started to be interested in ‘.NET’ again. I’m trying to develop an application using .NET Core 3 and EF Core. I encountered an error that I could not find a solution for. I could not do on “.Net Core 3” a structure which can be simply created with PHP eloquent. Model; […]