superuser is currently certified at Journeyer level.

Name: Jason Lotito
Member since: 2001-03-12 23:55:17
Last Login: 2015-03-06 21:44:35

FOAF RDF Share This

Homepage: http://www.jasonlotito.com

Notes:

Some stats:

  • Languages: PHP, Python,
    C/C++
  • vi or emacs: vim of course
  • GUI
    Editor: Zend DE for PHP, vim or FTE for everything else

  • KDE or Gnome: KDE
  • Fav. Star Trek Series: Deep
    Space 9
  • Did I read LotR before the movies? Yes,
    long ago, and many times
  • Music: Radiostorm.com:
    Alternative station

Projects

Recent blog entries by superuser

Syndication: RSS 2.0

How to disable the beep in PowerShell

This was annoying, but easily resolved.

You can easily disable this in PowerShell by running this command:

  Set-PSReadlineOption -BellStyle None

However, what you probably want is to disable this every time you open up PowerShell.  Doing this is simple.  In PowerShell, type

notepad $profile

This will most likely ask you to create a file.  Create the file, and then enter the above Set-PSRReadlineOption command into the file.  Save it, and close it.  Now, new PowerShell windows that pop open won’t make that annoying beep.

You can find out more about these profiles over on MSDN.

Syndicated 2017-03-31 04:16:15 from JasonLotito

PowerShell for Bash Users

Working with Objects

PowerShell works with objects rather than plain text.  While this might seem odd, it’s also pretty powerful.  So, if you run the ls command, it will return a bunch of objects that have fields (Members).  You can figure out what this is easily by running ls | get-member.

PS C:\Users\jason_000> ls | get-member
...
Name Property string Name {get;}
Parent Property System.IO.DirectoryInfo Parent {get;}
Root Property System.IO.DirectoryInfo Root {get;}
BaseName ScriptProperty System.Object BaseName {get=$this.Name;}
...

So, I’ve cut out a lot of information, because you get a lot of members you can work with, but you get the idea.  But what this means is if you just want all the names, you can run (ls).name.  That will return a list of just the name members of the objects that would get returned normally.

History

Get-History is history.

Last Command

$$

Syndicated 2017-03-27 04:03:54 from JasonLotito

Lessons from id Software co-founder John Romero

From John Romero’s GDC ’16 talk.

No prototypes. Just make the game. Polish as you go. Don’t depend on polish happening later. Always maintain constantly shippable code.

It’s incredibly important that your game can always be run by your team. Bulletproof your engine by providing defaults upon load failure.

Keep your code absolutely simple. Keep looking at your functions and figure out how you simplify further.

Great tools help make great games. Spend as much time on tools as possible.

We are our own best testing team and should never allow anyone else to experience bugs or see the game crash. Don’t waste others’ time. Test thoroughly before checking in your code.

As soon as you see a bug, you fix it. Do not continue on. If you don’t fix your bugs your new code will be built on a buggy code base and ensure an unstable foundation.

Write your code for this game only – not for a future game. You’re going to be writing new code later because you’ll be smarter.

Encapsulate functionality to ensure design consistency. This minimizes mistakes and saves design time.

Try to code transparently. Tell your lead and peers exactly how you are going to solve your current task and get feedback and advice. Do not treat game programming like each coder is a black box. The project could go off the rails cause delays.

Programming is a creative art form based in logic. Every programmer is different and will code differently. It’s the output that matters.

Syndicated 2017-02-26 01:34:47 from JasonLotito

Devember 2016 – Day 10 and 11 – Router Builder Start

More cleanup today, but more importantly, started working on the Router Builder. This is the magic part of it all. The part that makes it possible to create routers and merge together commands without actually having to write any code. So it’s getting close to be even more fun.

Happy to say as well that the build stuff I built up yesterday on Devember 10 worked on my Windows machine without issue. So I can successfully run this on both my Windows and Mac without issue. So that’s a plus.

Note: spending an hour working on this might not seem like much, but what I’m able to accomplish is still encouraging.

Syndicated 2016-12-11 23:23:42 from JasonLotito

Devember 2016 – Day 8 and 9 – Chrome Caches AJAX Response

I didn’t blog yesterday here, but I did tweet, and I did write code.  It was late, but I still got stuff done.

Today was an interesting day.  I’m still coding, but I came across an interesting bug I’d like to share.

So, in the code I have now, depending on the request’s Accept header, it will return either HTML or JSON.  It’s the same endpoint, but depending on the request made, it will return different results.  The result is the same information, just presented differently.  One way for humans, another for computers.

Now, in Firefox and Safari, this works just fine.  If you go to the page, everything loads up as you’d expect.  If you go back in the browser, and then go forward again, the page that is displayed is the same page you’d expect to see.  The HTML result.

But in Chrome, it doesn’t work like this.  Here is what happens in my case.

First, you make a request to a page /foo/bar.  This request has a header entry:

Accept: text/html

The page loads an HTML page which has JavaScript.  This JavaScript makes a request to the same page /foo/bar, except this time, the Accept header is different.

Accept: application/json

In this case, it’s the same URL, but different requests.  This second request returns JSON as expected.

Now, you click the Back button, and go back a page.  Then you click the Forward button, and instead of seeing the HTML page as you’d expect, you see the JSON result.

Now, even though Chrome has this bug, you can work around it.  When you return the JSON response, you can just send back a response that includes the following headers.

Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Expires: Thu, 18 Nov 1971 01:00:00 GMT

This will prevent the AJAX response from being cached, meaning the last cached item will be the HTML page.

How else can you use this?

So, in thinking about this, I was wondering how else I could use this.  After all, if I make a request to the same URL behind the scene and cache it, I can change what’s cached in the browser.  Is there ever a case where you’d want to change what was cached without showing the user right away? I don’t know.  But it’s interesting.  And it would only work on Chrome.

Syndicated 2016-12-09 23:24:09 from JasonLotito

50 older entries...

 

superuser certified others as follows:

  • superuser certified superuser as Apprentice
  • superuser certified deekayen as Journeyer
  • superuser certified glyph as Journeyer
  • superuser certified mobius as Journeyer
  • superuser certified LinuxNinja as Journeyer
  • superuser certified nzkoz as Apprentice
  • superuser certified julian as Journeyer
  • superuser certified cwinters as Journeyer
  • superuser certified jwalther as Journeyer
  • superuser certified Waldo as Apprentice
  • superuser certified voltron as Journeyer
  • superuser certified ianb as Apprentice
  • superuser certified dbl as Apprentice
  • superuser certified exa as Journeyer
  • superuser certified Mulad as Apprentice
  • superuser certified xcyber as Apprentice
  • superuser certified nickshanks as Apprentice
  • superuser certified ErikLevy as Journeyer
  • superuser certified superant as Master
  • superuser certified mattbradshaw as Apprentice
  • superuser certified neale as Apprentice
  • superuser certified LotR as Journeyer
  • superuser certified mrorganic as Apprentice
  • superuser certified gman as Journeyer
  • superuser certified olandgren as Apprentice
  • superuser certified highgeek as Journeyer
  • superuser certified Maltranar as Journeyer
  • superuser certified acme as Master
  • superuser certified cael as Journeyer
  • superuser certified bneely as Apprentice
  • superuser certified fen as Master
  • superuser certified pcburns as Apprentice
  • superuser certified johnsonm as Master
  • superuser certified rasmus as Master
  • superuser certified elduderino as Apprentice

Others have certified superuser as follows:

  • superuser certified superuser as Apprentice
  • ianb certified superuser as Apprentice
  • mobius certified superuser as Journeyer
  • dbl certified superuser as Apprentice
  • voltron certified superuser as Apprentice
  • superant certified superuser as Journeyer
  • olandgren certified superuser as Apprentice
  • nzkoz certified superuser as Apprentice
  • perlamer certified superuser as Apprentice
  • lerdsuwa certified superuser as Apprentice
  • MikeGTN certified superuser as Apprentice
  • Cardinal certified superuser as Apprentice
  • fxn certified superuser as Journeyer
  • mishan certified superuser as Journeyer
  • aint certified superuser as Apprentice
  • elduderino certified superuser as Apprentice
  • dlc certified superuser as Apprentice
  • ataridatacenter certified superuser as Apprentice

[ Certification disabled because you're not logged in. ]

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!

X
Share this page