• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

10867 Excellent


About fastcall22

  • Rank
    Web Developer

Personal Information

  • Interests

Recent Profile Visitors

28396 profile views
  1. Scrolling 2D Background

    Seamless textures is what you’re looking for. :^) According to the GIMP documentation, there’s already a built–in plugin. EDIT: And there’s a more advanced plugin here: http://registry.gimp.org/node/28112
  2. modeler looking to build a team

    Closing upon OP’s request.
  3. C++ Linker problem.

    Not exactly. See also How does the compilation/linking process work? and “Why can’t I separate the definition of my templates class from its declaration and put it inside a .cpp file?”. Headers declare existence of symbols, not their actual definition. Some of examples of such declarations are: Global variable `extern int my_global_int` Global function `bool is_equal(int,int,int)` Class methods `void Foobar::frobnicate(int)`. Source files provide the definitions of symbols: `int my_global_int = 123;` `bool is_equal(int a, int b, int c) { return a == b && a == c; }` `Foobar::frobnicate(int x) { std::cout << "this=" << this << "x=" << x; }` The source files are compiled into object code. Object code is assembly instructions or data with associated symbols. Headers allow others to know of these symbols’ existence, without having to compile those symbols themselves. It’s the job of the linker to find all of those external symbols and find their definitions, be it in object code you compiled yourself, in a static library provided elsewhere, or even in a dynamic library. Templates are a different kind of beast. They are more code–generating code than they are actual code. Their symbols and definitions aren’t known until it is used. For example: // is_equal.hpp: template<typename T> bool is_equal(T a, T b, T c); // is_equal.cpp: template<typename T> bool is_equal(T a, T b, T c) { return a == b && a == c; } // explicitly instantiate code for `int` and `float` template<> is_equal<int>(int,int,int); template<> is_equal<float>(float,float,float); // main.cpp: #include "is_equal.hpp" int main() { is_equal<int>(1,1,1); // ok is_equal<float>(1.f,1.f,1.f); // ok is_equal<double>(1.0,1.0,1.0); // Unresolved external symbol } Unless the definition of `is_equal` is known upfront, then it cannot be used, unless the object code for those types are provided elsewhere.
  4. Favorite game genres

    This thread is 13 years old (!) Closing.
  5. C++ C++ Custom Memory Allocation

    These types of questions are generally easy to search in your favorite search engine. For example, "C++ dynamic_cast static_cast" gave me this result: https://stackoverflow.com/questions/28002/regular-cast-vs-static-cast-vs-dynamic-cast Additionally, it would seem that the article is not formatted properly. The correct code should look something like: inline void* alignForward(void* address, u8 alignment) { return (void*)( (reinterpret_cast<u8*>(address) + static_cast<u8>(alignment-1)) & static_cast<u8>(~(alignment-1)) ); }
  6. C# How to reduce data sizes?

    What kind of precision do you need for your position coordinates? What are your limits on data? I imagine for something like this, a “snapshot frame” could send the full precision of state (X, Y, Z, rotation), while intermediary frames use less precise or fewer bits for changes between them. If possible, I’d look into gzip compression, but I suspect it won’t have too much of an effect. EDIT: Some rough guesses. Assuming some reference frame that has the full precision of the `(X, Y, Z, rotation)`, and for each frame, we use halffloat precision for deltas for a total of 27 bits/entity, then several million entities will be about 54 Mbits/update. Or perhaps, you could use a variable number of bits and only send the components that need updating: `(ID, (component, value), ...)`…
  7. C++ Will it cast?

    Yes, read IEEE 754 for more detail. The range of integers that can be exactly represented by a single precision float is from -0x01000000 to 0x01000000.
  8. Which is better?

    Please don’t post just to post. Closing. Also, post off–topic discussions to the lounge. Thanks!
  9. That HTML page appears to be a DoS deterrent served by your hosting provider. Upon visiting one of the hosting provider’s sites, it appears that they redirect to this page where a challenge must be solved by your browser. The browser will set a cookie to with the answer before redirecting to your site. If the challenge was solved incorrectly or the user agent is not recognized, then it appears your hosting provider rejects the requests with a 403 forbidden. At this point, I concur with hplus0603 in that you should get a server that you control. Everything you’ve done up until now can be setup on a virtual machine or even your own development instance. Since you plan on using HTTPS, I will assume that at this point you’ve figured out the server situation. You will need to obtain an SSL certificate and install it on your site. You can obtain 3–month certificates for free from letsencrypt, or you can purchase your own SSL certificates from a certificate authority such as Verisign.
  10. How are you testing from your browser? Have you tried mirroring the requests from Postman/PowerShell/curl?
  11. Why its wrong?

    Check your parentheses. You have more opening parentheses than you do closing parentheses. :^)
  12. FM Synth and Plotting with PowerShell

    (Cleaned up from IPBoard upgrade. Publishing it seems to have bumped it up to the top.)
  13. Beep boop, making progress on my FM synthesizer. Had a nasty popping sound with my phase-feedback logic and needed some way to rapidly graph out the logic. Powershell to the rescue: # plot-sample.ps1 $samples = 1024; $width = 2048; $height = 512; [Reflection.Assembly]::LoadWithPartialName("System.Drawing"); $bmp = new-object Drawing.Bitmap $width, $height; $g = [Drawing.Graphics]::FromImage($bmp); $g.SmoothingMode = "AntiAlias"; $penAxis = new-object Drawing.Pen 0xFF808080, 2; $penLineA = new-object Drawing.Pen 0xFF0000F0, 2; $penLineB = new-object Drawing.Pen 0xFFF00000, 2; $ptsA = new-object Drawing.PointF[] $samples; $ptsB = new-object Drawing.PointF[] $samples; 0..($samples-1) |% { $Q = 4*[Math]::pi/$samples; $feedback = 0; } { $ampA = [Math]::sin($_*$Q + $feedback); # A[t] = sin(t + 1.05*A[t-1]) $ampB = [Math]::sin($_*$Q); # B[t] = sin(t) $feedback = $ampA * 1.05; $x = $bmp.Width * $_/$samples; $yA = $bmp.Height * (-$ampA/2.1 + .5); $yB = $bmp.Height * (-$ampB/2.1 + .5); $ptsA[$_] = new-object Drawing.PointF $x, $yA; $ptsB[$_] = new-object Drawing.PointF $x, $yB; } { $g.Clear([Drawing.Color]::White); $g.DrawLine($penAxis,0,$bmp.Height/2,$bmp.Width,$bmp.Height/2); $g.DrawLines($penLineB,$ptsB); $g.DrawLines($penLineA,$ptsA); $bmp.Save("$pwd\plot.png"); } Looks like the logic should be sound. I did find that the phase-feedback wasn't being sin'd in the synthesizer, and that was causing the popping noise. And here's a sample of what it sounds like right now: fm-sample.ogg (36.4KB) And here's the instrument used to generate that sound: /* unit: mul frequency multiplier ofs additive frequency amp volume feed phase feedback envelope: A attack rate, in degrees D1 decay rate to sustain level, in degrees D2 decay rate to silence, in degrees R release rate, in degrees S sustain level program: u unit to render in phase buffer input slot, 0 for null input out phase buffer output slot, 0 for audio data */ instrument i; int idx = 0; // mul ofs amp feed A D1 D2 R S i.units[idx++] = { 2.00f, 0.00f, 0.50f, 1.00f, {80.0, 20.0, 10.0, 45.0, 0.75 }}; i.units[idx++] = { 1.00f, 0.00f, 0.25f, 0.00f, {85.0, 45.0, 5.0, 60.0, 0.50 }}; i.units[idx++] = { 7.00f, 0.33f, 0.12f, 0.00f, {88.5, 60.0, 5.0, 60.0, 0.25 }}; i.units[idx++] = { 1.00f, 0.33f, 0.50f, 0.00f, {87.0, 30.0, 5.0, 60.0, 0.67 }}; i.ct_units = idx; // program: // ┌─┐ ┌─┐ // │0├──►│1├──┐ // └─┘ └─┘ │ ┌─┐ // ├──►│3├──►out // ┌─┐ │ └─┘ // │2├──┘ // └─┘ idx = 0; // u in out i.program[idx++] = { 0, 0, 2 }; i.program[idx++] = { 1, 2, 1 }; i.program[idx++] = { 2, 0, 1 }; i.program[idx++] = { 3, 1, 0 }; i.ct_program = idx; Hue.
  14. Unifying Windows 10 Terminal Settings Again

    And once again, I’ve discovered more undefined behavior with Windows Search. The permissions fix will remove the shortcut from appearing from the start menu. Working on a fix.
  15. Oh boy, it’s that time of year again where all of my terminal settings get reset! Thanks, Windows 10 Fall Creators Update! But this time, I’m prepared !! I’ve made some adjustments to my previous attempt to Unify Windows 10 Terminal Settings. Namely, I’ve fixed the ACL not working as expected. Apparently `set-acl` attempts to reset the owner, which is denied when also removing the write permission. Additionally, the ACL needs to be reloaded in order to get the correct converted ACLs from the item’s parents. The workaround is as follows: # deny current user write permissions $item = get-item $path; $acl = $item.GetAccessControl('access'); # https://stackoverflow.com/a/6646551 $acl.SetAccessRuleProtection($true, $true); # Disable inheritance, assume inherited $item.SetAccessControl($acl); $acl = $item.GetAccessControl('access'); # Reload ACL to obtain inherited permissions $acl.RemoveAccessRuleAll($rule); # Remove existing rules for the user $acl.AddAccessRule($rule); $item.SetAccessControl($acl); I’ve also added back in the registry fix: $console = (get-item HKCU:\).OpenSubKey("Console", $true) $console.GetSubKeyNames() |% { if ( $pscmdlet.ShouldProcess($_, "Remove Subkey") ) { $console.DeleteSubKey($_); } And after running: remove-consoleprops -StartMenu -AdjustPermissions -Registry -ErrorAction Continue … I was pleased to see that it worked as expected! I will be working toward publishing these scripts as a GitHub gist, so these files are versioned and others can contribute. That’s all for now. Thanks for reading; see you around! :^)
  • Advertisement