• What Are You Working On? - December 2014
    1,204 replies, posted
[QUOTE=Sidneys1;46614160]FTFY[/QUOTE] I don't know man, there's a lot of amateur porn these days too.
[QUOTE=Berkin;46613207]This is what I do when I don't want to write ~1600 lines of code: [code]# 4D -> 4D swizzles \#region 4D swizzling\N [%:c4+x;y;z;w] [r:4][s:\2,N] # X {(@x=[ri]) [r:4][s:\2,N] # Y {(@y=[ri]) [r:4][s:\2,N] # Z {(@z=[ri]) [r:4][s:\2,N] # W {(@w=[ri]) /// \<summary\>\N /// Makes \a \([%c4@(x)], [%c4@(y)], [%c4@(z)], [%c4@(w)]\) vector from this one.\N /// \</summary\>\N public V4 [%c4@(x)][%c4@(y)][%c4@(z)][%c4@(w)] =\> new V4\([%c4@(x)], [%c4@(y)], [%c4@(z)], [%c4@(w)]\); } } } } \N\#endregion \2,N # 4D -> 3D swizzles \#region 3D swizzling\N [r:4][s:\2,N] # X {(@x=[ri]) [r:4][s:\2,N] # Y {(@y=[ri]) [r:4][s:\2,N] # Z {(@z=[ri]) /// \<summary\>\N /// Makes \a \([%c4@(x)], [%c4@(y)], [%c4@(z)]\) vector from this one.\N /// \</summary\>\N public V3 [%c4@(x)][%c4@(y)][%c4@(z)] =\> new V3\([%c4@(x)], [%c4@(y)], [%c4@(z)]\); } } } \N\#endregion \2,N # 4D => 2D swizzles \#region 2D swizzling\N [r:4][s:\2,N] # X {(@x=[ri]) [r:4][s:\2,N] # Y {(@y=[ri]) /// \<summary\>\N /// Makes \a \([%c4@(x)], [%c4@(y)]\) vector from this one.\N /// \</summary\>\N public V2 [%c4@(x)][%c4@(y)] =\> new V2\([%c4@(x)], [%c4@(y)]\); } } \N\#endregion[/code] [URL="http://pastebin.com/XwYxj56T"]And here's the glorious output![/URL][/QUOTE] I smell insanity.
[QUOTE=Fourier;46614452]I smell insanity.[/QUOTE] Stop sniffing me!
[QUOTE=Fourier;46614452]I smell insanity.[/QUOTE] I didn't think Perl and regex could've been beat in "what the fuck am I looking at" but clearly I was wrong.
I'm an idiot. I need my clearly defined variable names and white space. I can't focus on anything in that big blob of characters.
[QUOTE=Protocol7;46614621]I'm an idiot. I need my clearly defined variable names and white space. I can't focus on anything in that big blob of characters.[/QUOTE] I've been working on the same language for 3 years. I don't need to be neat to understand it. I can post a properly spaced, annotated version if anyone is genuinely interested in how it works, though.
[QUOTE=Berkin;46613207]This is what I do when I don't want to write ~1600 lines of code: [code]# 4D -> 4D swizzles \#region 4D swizzling\N [%:c4+x;y;z;w] [r:4][s:\2,N] # X {(@x=[ri]) [r:4][s:\2,N] # Y {(@y=[ri]) [r:4][s:\2,N] # Z {(@z=[ri]) [r:4][s:\2,N] # W {(@w=[ri]) /// \<summary\>\N /// Makes \a \([%c4@(x)], [%c4@(y)], [%c4@(z)], [%c4@(w)]\) vector from this one.\N /// \</summary\>\N public V4 [%c4@(x)][%c4@(y)][%c4@(z)][%c4@(w)] =\> new V4\([%c4@(x)], [%c4@(y)], [%c4@(z)], [%c4@(w)]\); } } } } \N\#endregion \2,N # 4D -> 3D swizzles \#region 3D swizzling\N [r:4][s:\2,N] # X {(@x=[ri]) [r:4][s:\2,N] # Y {(@y=[ri]) [r:4][s:\2,N] # Z {(@z=[ri]) /// \<summary\>\N /// Makes \a \([%c4@(x)], [%c4@(y)], [%c4@(z)]\) vector from this one.\N /// \</summary\>\N public V3 [%c4@(x)][%c4@(y)][%c4@(z)] =\> new V3\([%c4@(x)], [%c4@(y)], [%c4@(z)]\); } } } \N\#endregion \2,N # 4D => 2D swizzles \#region 2D swizzling\N [r:4][s:\2,N] # X {(@x=[ri]) [r:4][s:\2,N] # Y {(@y=[ri]) /// \<summary\>\N /// Makes \a \([%c4@(x)], [%c4@(y)]\) vector from this one.\N /// \</summary\>\N public V2 [%c4@(x)][%c4@(y)] =\> new V2\([%c4@(x)], [%c4@(y)]\); } } \N\#endregion[/code] [URL="http://pastebin.com/XwYxj56T"]And here's the glorious output![/URL][/QUOTE] As cool as Rant is, why not use T4 templates in this case: [code] <#@ template hostspecific="false" language="C#" #> <#@ output extension=".cs" #> <# const string chars = "xyzw"; for(int i = 4; i > 1; i--) { #> #region <#=i#>D swizzling <# for(int l = 0; l < Math.Pow(i, chars.Length); l++) { #> /// <summary> /// Makes an (<# string str = ""; for(int i2 = 0; i2 < i; i2++) { str = chars[(l % (int)Math.Pow(4, i2+1)) / (int)Math.Floor(Math.Pow(Math.Pow(2, i2), 2))].ToString() + ", " + str; } Write(str.Substring(0, str.Length-2)); #>) vector from this one. /// </summary> public V<#=i#> <#=str.Replace(", ", "")#> => new V<#=i#>(<#=str.Substring(0, str.Length-2)#>); <# } #> #endregion <# } #> [/code]
[QUOTE=Goz3rr;46614886]As cool as Rant is, why not use T4 templates in this case: [code] <#@ template hostspecific="false" language="C#" #> <#@ output extension=".cs" #> <# const string chars = "xyzw"; for(int i = 4; i > 1; i--) { #> #region <#=i#>D swizzling <# for(int l = 0; l < Math.Pow(i, chars.Length); l++) { #> /// <summary> /// Makes an (<# string str = ""; for(int i2 = 0; i2 < i; i2++) { str = chars[(l % (int)Math.Pow(4, i2+1)) / (int)Math.Floor(Math.Pow(Math.Pow(2, i2), 2))].ToString() + ", " + str; } Write(str.Substring(0, str.Length-2)); #>) vector from this one. /// </summary> public V<#=i#> <#=str.Replace(", ", "")#> => new V<#=i#>(<#=str.Substring(0, str.Length-2)#>); <# } #> #endregion <# } #> [/code][/QUOTE] But can T4 templates choose the correct indefinite article (a/an) before nouns in your XML docs? I think not! :v: Jokes aside, the nice thing about my pattern (albeit being longer than your template) is that it requires no math: [code]# Create a #region directive \#region 4D swizzling\N [%:c4+x;y;z;w] # Create a list of component names (X, Y, Z, W). Name it c4. [r:4] # Repeat next block four times. [s:\2,N] # Separate repetitions with two line breaks. { (@x=[ri]) # Create a variable named x and set it to the current loop's iteration. [r:4] # Repeat next block four times. [s:\2,N] # Separate repetitions with two line breaks. { (@y=[ri]) # Create a variable named x equal to the current loop's iteration. [r:4] # Repeat next block four times. [s:\2,N] # Separate repetitions with two line breaks. { (@z=[ri]) # Create a variable named x equal to the current loop's iteration. [r:4] # Repeat next block four times. [s:\2,N] # Separate repetitions with two line breaks. { (@w=[ri]) Create a variable named w equal to the current loop's iteration. # Write an XML comment describing the components chosen for the current iteration. /// \<summary\>\N /// Makes \a \([%c4@(x)], [%c4@(y)], [%c4@(z)], [%c4@(w)]\) vector from this one.\N /// \</summary\>\N # Write the property declaration. [%c4@...] accesses the items in c4 by index (x, y, z, and w variables). public V4 [%c4@(x)][%c4@(y)][%c4@(z)][%c4@(w)] =\> new V4\([%c4@(x)], [%c4@(y)], [%c4@(z)], [%c4@(w)]\); } } } } # Create an #endregion directive \N\#endregion \2,N # Go down two lines # It's the same process for the other two, just less loops.[/code]
Well, I just got into an awkward situation, I created a new project in VS 2013, however it did not create a solution along with it, which means that I can't create another project so that I can test my stuff, is there any way to add a solution to the project if that makes sense ?
[QUOTE=Fleskhjerta;46615075]Well, I just got into an awkward situation, I created a new project in VS 2013, however it did not create a solution along with it, which means that I can't create another project so that I can test my stuff, is there any way to add a solution to the project if that makes sense ?[/QUOTE] I don't think it's possible to create a project without a solution. It should look like this. [thumb]http://i.imgur.com/DkuLhSM.png[/thumb]
I made a small but useful thing for timing functions... [cpp]/* * scope_timer.hpp */ #pragma once namespace timer { class scope_timer { private: long long &m_ref; long long m_init; public: static long long frequency(); long long elapsed_ticks() const; scope_timer(long long &ref); ~scope_timer(); scope_timer(const scope_timer &copy) = delete; scope_timer(scope_timer &&move) = delete; }; } /* * scope_timer.cpp */ #include <Windows.h> #include "scope_timer.hpp" namespace timer { long long scope_timer::frequency() { LARGE_INTEGER tmp; QueryPerformanceFrequency(&tmp); return tmp.QuadPart; } long long scope_timer::elapsed_ticks() const { LARGE_INTEGER tmp; QueryPerformanceCounter(&tmp); return tmp.QuadPart - m_init; } scope_timer::scope_timer(long long &ref) : m_ref(ref), m_init(0) { m_init = elapsed_ticks(); } scope_timer::~scope_timer() { InterlockedAdd64(&m_ref, elapsed_ticks()); } } [/cpp] It just measures the time it takes from object construction to destruction, then atomically increments the initially supplied variable.
Well, I managed to fix it, but for some reason now, when there is only one project, it "hides" the solution, and I have to manually go through the jungle of the menus to add a project until it shows me the solution.
[QUOTE=Fleskhjerta;46615190]Well, I managed to fix it, but for some reason now, when there is only one project, it "hides" the solution, and I have to manually go through the jungle of the menus to add a project until it shows me the solution.[/QUOTE] [img]http://i.imgur.com/B4mn53e.png[/img]
I'm currently implementing Eric Bruneton's [URL="http://www-evasion.imag.fr/Membres/Eric.Bruneton/#atmo"]Precomputed Atmospheric Scattering[/URL] [img]http://i58.tinypic.com/11j1w5h.jpg[/img] [img]http://i57.tinypic.com/2z8dp3l.jpg[/img]
[QUOTE=mastersrp;46611447]Lua is such a fucking pleasure to work with. I've considered making some web stuff that used Lua in place of PHP for templating, such that you could stop the fuck with[code][/code]and start doing[code]player = _GET["player"] or nil[/code]stop the fuck with checking if a variable is set or not you fucks i have tens of lines that are this fucking bullshit[/QUOTE] [code]player = _GET["player"][/code] [editline]1st December 2014[/editline] [code]player = _GET.player[/code]
[QUOTE=Fleskhjerta;46615075]Well, I just got into an awkward situation, I created a new project in VS 2013, however it did not create a solution along with it, which means that I can't create another project so that I can test my stuff, is there any way to add a solution to the project if that makes sense ?[/QUOTE] I found myself in this situation the other day. Try changing some solution-level settings and see if it generates a .sln for you [editline]1st December 2014[/editline] i am late
Distinctly separate M/V/VM? Check! UI mostly runtime-generated through inheritance and Attributes? Check! Decent UX? Todo. Suggestions? Was originally using GroupBoxes instead of Expanders, but it got difficult to find the correct category and options. [t]http://i.imgur.com/KjnYTP2.png[/t]
I just learned about T4 the text template thing. That is really cool, I just wish that it had proper syntax and auto complete, maybe in 2015? Thankfully it seems like resharper has support so been using that.
Guises, got Wednesday and Thursday off work. What do I work on? I have like 0 personal projects going at the moment and have no idea what to work on. I started working some shitty Java program where is would generate a RPGLE source file out of the information you pass to it, it makes my work life easier but it's a mess and I am procrastinating from cleaning it up. halp what do i do
[QUOTE=Goz3rr;46615210]*image*[/QUOTE] Yep that did the trick, thank you !
I just realized that complex adaptive systems are analogous to perlin noise in that they turn the garbage/noise of extreme complexity into something meaningful by being self-similar Basically perlin noise is why the universe works
[QUOTE=ZenX2;46618102]I just realized that complex adaptive systems are analogous to perlin noise in that [B]they turn the garbage/noise of extreme complexity into something meaningful[/B] by being self-similar Basically perlin noise is why the universe works[/QUOTE] So [I]that's[/I] how reality TV is made! They just run static through a Perlin noise algorithm until it says something intelligible.
Implemented survival mode in my Android game. [video=youtube;ZDucnW2chhA]http://www.youtube.com/watch?v=ZDucnW2chhA[/video] Sorry if the quality is shit, should get better as Youtube processes the video. [editline]2nd December 2014[/editline] AI still needs some work, and so do a few other things. Also have a few more features we want to add to it. Pretty fun so far though.
I've been starting to make a space game since last week, 2000 lines in so far. I've got text rendering and a "working" user interface system from scratch. (You'll see that proper kerning is on the bottom of my to-do list.) The starry backdrop was generated using a program called LuaDraw I made a while ago, if anyone wants it I'll give the files. This is what the code for it looks like: [code]setCanvasSize(1024, 1024) enableAntiAliasing(false) --drawRect(0, 0, 1024, 1024, makeColor(0, 0, 0)) print("The black background is just for testing purposes.") print("Comment out that line before saving it.") for i = 1, 128 do local starcolor = makeColorAlpha(math.random(255), 255, 255, 255) drawPixel(math.random(1024), math.random(1024), starcolor) end[/code] [vid]http://a.pomf.se/lklqvv.webm[/vid] Edit: Oh god megawebm I'm sorry
[QUOTE=TH3_L33T;46615762]I just learned about T4 the text template thing. That is really cool, I just wish that it had proper syntax and auto complete, maybe in 2015? Thankfully it seems like resharper has support so been using that.[/QUOTE] They had a chance to implement a great macro system with T4, but they didn't. Now you just have this marginally useful thing that's always the last choice of a solution to any problem.
As I mentioned in a previous post I'm working on a new way to calculate the 3D strain and displacement fields in bone tissue from SR-CT scans. I was originally processing the data using 3rd party tools but I've decided to write a program to do it, so the whole thing can start with the raw CT data and get to the required end result without messing about with image processing programs or excel or anything. [img]http://i.imgur.com/JCzFXD7.png[/img] [img]http://i.imgur.com/Wy97gdM.png[/img] If anyone's wondering, that's a mouse's finger.
[QUOTE=chaz13;46619569]As I mentioned in a previous post I'm working on a new way to calculate the 3D strain and displacement fields in 3D bone tissue. I was originally processing the data using 3rd party tools but I've decided to write a program to do it, so the whole thing can start with the raw CT data and get to the required end result without messing about with image processing programs or excel or anything. [img]http://i.imgur.com/JCzFXD7.png[/img] [img]http://i.imgur.com/Wy97gdM.png[/img] If anyone's wondering, that's a mouse's finger.[/QUOTE] I have no idea what I'm looking at, but it looks science-y and complicated! Geez, dude.
[QUOTE=utilitron;46613428]The difference between Amateur and Professional is simply: Are you getting paid?[/QUOTE] Am getting paid. Don't feel like a professional. :v: It's an internship where I spend most of my time writing MVC intranet webapps in C# with a JS/Razor front-end. I feel like I just made a buzzword slurry.
[media]http://www.youtube.com/watch?v=_-KSlhppzNE[/media] Here's a new video tutorial/experiment where I explain how to keep track of specific instances of contiguously-stored objects through custom handles.
[QUOTE=ZenX2;46618102]I just realized that complex adaptive systems are analogous to perlin noise in that they turn the garbage/noise of extreme complexity into something meaningful by being self-similar Basically perlin noise is why the universe works[/QUOTE] Your avatar is quite fitting.
Sorry, you need to Log In to post a reply to this thread.