What I did today

Realized we didn’t check out our feature branch correctly at the beginning of our project at work so we were actually committing into the trunk the entire time :frowning: Fortunately it’s not a huge issue, but now it’s all branches and merging for me today!

Finally got a deobfuscated & decompiled project running!
No nefarious intent! I’m writing a multiplayer mod (deterministic lockstep) that will be implemented via bytecode instrumentation.
However concocting bytecode injections into obfuscated code for which I have no runnable source was proving to be extremely hard work.
So now that I have compilable source, I’m able to write the mod using regular techniques, and from this construct the instrumentation code necessary for injection into the compiled binaries.

On a related note:
Did you know; nesting interfaces into inappropriate classes is an incredibly simple technique for creating cyclic dependency chains that bork recompilation!
e.g.

A extends B
B implements A.C

legal bytecode; illegal sourcecode.

The solution is deceptively simple though; elevate all static nested member classes/interfaces to be top-tier. (which involves nothing more than removing the innerclass attribute from every class that references them)

Oh, another thing I learnt today; Enum.valueof(Class,String) doesn’t use reflection for finding members.
Enum members have their name (and ordinal) passed into the constructor as the 1st & 2nd parameters.

This means you can obfuscate enums without worry of breaking external dependencies that might rely upon the enum names.
Though obviously you shouldn’t, because:

  1. Obfuscation of the enum member names will introduce new constant pool entries without making the old ones redundant, thus increase class size
  2. The redundant information makes deobfuscation trivial anyway.

:edit:

Oh yeah, and I finally understand the bytecode implications of all the different flavours of nested classes (along with their formal names!)

inner class:

class A {
class B {}
}

static nested class:

class A {
static class B {}
}

anonymous class:

class A {
{
new B() {};
}
}

local class:

class A{
{
class B {};
}
}

I must confess - in all my years of Java, I’ve never encountered a local class.

Started dev logs for my game in progress. Check it out here: KudoDev

Keep in mind that I’m new at this public relations stuff.

This is a project that is finally ready for some sharing. However, the first post is more of an introduction.

Fixed a major bug that the last developer who worked on this project for me left behind (he left). In the Java SQL result set implementation, there is not a ‘hasNext()’ or ‘isEmpty()’ function. Meaning when a database sends you back the data you requested, you have to figure out another way to check to see if the result set is empty before performing your operations on the supposed data you received.

Well, the old developer thought this:


if(rs.next()) {
   //operations
}

Was a good idea. Spoiler alert, it’s not! The ‘next’ function iterates to the next index in the result set when called. So yes, this is a “valid” way to check if the result set is not empty, but it’s also extremely easy to not realize that it’s actually iterating over the array. I was the lucky one to inherit this bug, going crazy for about an hour trying to figure out why my result set wasn’t returning the single columns of data in my table. The solution is kind of strange, you have to check for the cursor position within the result set, like this:

 
if(rs.isBeforeFirst()) {
    //operations
}

This function returns ‘true’ in the event that the cursor is before the first element, and false if there are no elements in the set or if the cursor is not positioned before the first element. I’m just happy that I finally figured it out, although it’s really strange that the result set doesn’t have any kind of obvious way to check if the set is empty.

On another note, how do I add inline code tags? In my couple of years browsing this forum I have never figured it out :frowning:

Edit: This solution does not seem to work in all cases. I’m getting an error that is stating the result set has no current row even though I am 100% certain I am getting data back in the result set. More investigating will ensue…

I could potentially call the ‘next()’ function and then step back one in the result set to set the current index back to 0. Kind of a strange workaround, but it’s not going to kill anyone.

Upon further investigation, the first call to ‘next()’ actually positions the cursor at the first row of data. Strange, my error must be elsewhere.

Thanks BurntPizza, don’t know why I didn’t think about that.

[icode][/icode]

If you’re ever wondering how someone did something with BBcode, just quote their post and look.

Thats normal )
We all left bugs in code: sometimes because we hurry, and some time because we simple don’t see bug ther )
Don’t take current bug like someting unnatural - when working with someone code you will see many bugs
(or first you think it was bug, fix it and later undestand that code was work right and you broke it :wink: )

I not recommend fix old working function if shi working not like you want, and work fine in old code.
Simple add new function hasNext() and use it,
If you change old you must refractor and double check all old code that use this old bug” function.
An this is a lot of work.

(When you work on own project you have time for this and know wher you and how use old Fun,
Bun working on company with third party code you simple don’t have time for this,
same as for quality control after refactoring.)

This is how big project create thousand newer used function and then call them legacy XD

Why would I leave buggy code in my project when I already know exactly what is wrong, why it isn’t working and have a general idea on how to fix it? I would rather put the work in now refactoring a small amount of code instead of later coming back and realizing my foundation was not solid and now I suddenly have a function that is actually not spitting back the first row of data. Not to mention I am trying to get a job here, I don’t think telling my boss it was too much work to refactor some clearly buggy code would really blow over well.

If that came off the wrong way, then I’m sorry I’m not trying to be rude! I just don’t really understand why I would leave in a small block of code that could cause lots of serious bugs (and it is right now!).

opiop: the developer that left you with that code is doing the right thing. the bug is somewhere else entirely. you should write some unit-tests so you get a firm grasp on the ugly and quirky JDBC API. if you are changing business logic you’d better be damn sure you know how your API behaves. write unit-tests to prove your assumptions, because the spec / javadoc can be unhelpful/ambiguous at times.

I just broke out some unit tests and realized what the issue was. Part of it was definitely my misunderstanding the strange functions of JDBC, part of it was his fault iterating to the first element and then actually not actually doing anything with that first element. I’ve got it worked out now though, and I’ve corrected some other code to reflect these new changes and now everything is working perfectly!

It may be bug in the situation how you want use it.
But in old code it can work perfect
(I see many such examples)
Some ppl say “If it ain’t broke, don’t fix it” XD
And this may be current situation.

Its not about work on fixing 1-2 bugs
Its about broke all project fixing 1 bug on half+ month deadline ^^
(This is time management point of view)

Simple ask boss what you should do with bug, don’t try fix all own silently
and it will be ok (probably ;))

I see what you mean now, thanks for clarifying :slight_smile: Fortunately this is a tiny project that is isolated from the rest of our code base, so I was able to locate the exact problem, and what areas would be affected if I fixed the bug. I agree with you in a larger context to leave it alone until I can find someone to ask about the bug, but in my specific case it was such a huge isolated bug that I just went ahead and squashed it without any negative effects on my other code!

uploaded a test to youtubes :

cQVPcWjp0Gs

seems to work ok at 60 hz :slight_smile:

That is the trippiest thing I have ever seen. If you make a game out of it I will definitely play it… for hours.

@basil_

I will play that game until my eyes inevitably pop.

My project manager is taking just me out to lunch today after I talked to my boss about getting a permanent position here, I’m thinking I might know if I have a job here by the end of the day then :wink: This is ridiculously nerve-wracking and I don’t know if I’m going to make it to lunch without dying of a heart attack or something…

And in other news, I have been tasked with figuring out how to export the entire framework (backend and frontend) for our “portal” (internal tool). The backend is written in Java and is built with Gradle, so that shouldn’t be too hard. But the frontend, which is written in .NET, will be much harder because I’ve never exported or published .NET code.

Congratulations so far for your courage to say what you want. That’s the right thing to do. Stay cool! :slight_smile:
One advice I want to give you that helped me in my career is not thinking “oh god, I hope they will employ me.”
No, you literally have to think the other way around: “I know I am good, and it is their loss if they don’t take me. I do not need/search for them. They searched for me!”
It is a rather counter-intuitive shift in mindset but it is worth it! You will feel alot more worth to yourself and will act this way. Of course not to the point of actually being uppity. :slight_smile:
If you are in the talk with your project manager, do ask the question what they can offer you. Literally ask, what YOU would get if YOU choose them to give your workforce to them in the future.
Also remember, that it is the person asking questions who is in control of the situation. So, figure out questions that you want to ask him/her on that occasion. The goal of those questions is to inform you about what you will get.

Some great tips! I will have to think about questions to ask him during lunch, I’m just hoping I don’t get too nervous and forget everything I was going to talk about :wink: Thank you for all the advice!

I just spent like 15 minutes trying to figure out why my image would not show up on my swing component before realizing I had set a Clip, preventing its painting… :’( :emo:

These days when you just should never have gotten up in the morning… :wink:

J0

uploaded the full length version. took ages! will try OBS instead of virtual dub next time.

enjoy :slight_smile:

B7wNXO6kSOo

Having a little trouble diving back in…

My wife started a new job two weeks ago. Yay! She is doing technical writing/editing for the US Coast Guard, via a contract with Lockheed Martin. Huge boost for the household budget.

Then, after work on Monday, a fellow plowed his car into our car while she was driving home. She is basically okay, is now home with with two small fractures in hip, requires walker to get about. I’ve been dealing with care-taking, household/shopping/cooking/insurance & police & auto tow companies etc. So, yeah, a bit hard to concentrate now that I finally have a moment to myself.

Recent thread on Java compilers here, has me wondering if that would be a way to make a VST. Am looking into this. Writing in Java then converting to C# seems like asking for a ton of headaches. But if an exe can be generated from Java, maybe this is a viable way to go. Then, I should “only” have to refresh my C++ to the point where I can read the links that BurntPizza recommended (from krvaudio).

I had a breakthrough with my audio sequencer coding, right before the accident. It took several weeks and successfully programming a wrong way before I had my head well enough around the issues to come up with what I think is a much better plan. Instead of attempting to deal with a “scheduler” that works directly with frames (44100 frames per second), I’ve written a “PulseManager” that schedules itself every N frames (amount determined by tempo of a piece, e.g., 44100 / 8 for 8th notes at 120 bpm). This PulseManager also employs an observer design pattern, holding an array of subscribing “sequences” (I’m calling them Motif objects) that are each given a single “pulse” with each PulseManager rescheduling. This is a different way of doing things than is done by most sequencers. But I’m not worried about recording gestures in real time, only playback of scores. So it seems to me there are some benefits of doing things this way, rather than using the standard practice tiny “tick”. We shall see.

I got the test code and examples working, and now, plan to use this basic structure to also code things like ‘hairpins’ (crescendos or diminuendos) or tempo changes that are pulse-based as opposed to requiring per-frame attention.