How would one go about making sure that a .love file only runs if the current version of LOVE2D is better than a given minimum version? Without some sort of check, the resulting errors can be obscure and seemingly unrelated to the LOVE version, requiring the user to waste a lot of time trying to diagnose issues based on misleading errors.
You can add t.version = "0.8.0" to your conf.lua and it will warn the user if he is using a version other than 0.8.0. You shouldn't block mismatched versions, you should warn them.
Here's an example of conf.lua:
function love.conf(t)
t.title = "Game title"
t.author = "Your name"
t.version = "0.8.0"
end
Here's the wiki article on conf.lua.
Related
I am trying to get some basic information from the Steam Community via the steam-condenser gem and so far the Steam.new seems to work just fine with all the players information.
however when I do this (example)
player = SteamId.new("tiger")
stats = player.fetch_games
I get the following error message
Traceback (most recent call last):
1: from lib/assets/ruby/test.rb:15:in `<main>'
/home/zigs/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/steam-condenser-1.3.11/lib/steam/community/steam_id.rb:326:in `fetch_games': undefined method `[]' for nil:NilClass (NoMethodError)
A lot of the information I need seems to be connected to the fetch_games (for example the method total_playtime(id))
Not sure why this is not working. I am lost. Any help or ideas are highly appreciated! Thank you!
TLDR; it looks like this gem no longer works.
the particular module that you're having trouble with is:
def fetch_games
games_data = parse "#{base_url}/games?xml=1"
#games = {}
#recent_playtimes = {}
#total_playtimes = {}
games_data['games']['game'].each do |game_data|
app_id = game_data['appID'].to_i
#games[app_id] = SteamGame.new app_id, game_data
recent = game_data['hoursLast2Weeks'].to_f
total = (game_data['hoursOnRecord'] || '').delete(',').to_f
#recent_playtimes[app_id] = (recent * 60).to_i
#total_playtimes[app_id] = (total * 60).to_i
end
true
end
with the particular problem statement being games_data['games']['game'].each
If we were looking to get information for a particular user, it downloads an XML document about the user from a URL looking like:
http://steamcommunity.com/id/demomenz?xml=1
and this file does not seem to contain any games objects in it.
Having looked at the codebase for the steam-condenser gem; it hasn't really been updated in about 6 years. I can only assume that the XML format has been modified since this time and that the gem will no longer work.
Valve has added more privacy options to Steam Community profiles which are not reflected in the old XML APIs.
Apparently, the profile in question (tiger) has it‘s game details set to “Friends Only” or ”Private” as games are also unavailable in the browser.
The code from the released 1.x versions is no longer guaranteed to work when it comes to Steam Community. Valve deprecated the old XML APIs several years ago. Sadly, the modern Web API hasn‘t gotten much attention from Valve‘s side either. So development of Steam Condenser has mostly come to halt, too.
You might have more luck using the code from the master branch of the GitHub repository which uses Web API for most of the Community features.
You will have to register for a Steam Web API key, though: https://steamcommunity.com/dev/apikey
After upgrading the rgeo gem from 0.6.0 to 2.1.1, we've started to get 'LinearRing failed ring test' on certain geometries that never caused us problems before. (The geometry data is generated from external sources outside of our control, and stored in PostGIS table.)
rgeo initializer:
GEO_FACTORY = RGeo::Geographic.simple_mercator_factory
PROJECTION_FACTORY = GEO_FACTORY.projection_factory
RGeo::ActiveRecord::SpatialFactoryStore.instance.tap do |config|
config.default = PROJECTION_FACTORY
end
Example code:
district = District.first
# Convert projected geometry to geographic geometry
geographic_geometry = GEO_FACTORY.unproject(district.geometry)
RGeo::Error::InvalidGeometry: LinearRing failed ring test
I also tried initializing the factory with the following options, but the errors persisted:
FACTORY = RGeo::Geographic.simple_mercator_factory(uses_lenient_assertions:true)
FACTORY = RGeo::Geographic.simple_mercator_factory(lenient_multi_polygon_assertions:true)
I've inspected some of these geometries where that are failing the LinearRing test, and it appears they are failing for a variety of reasons. Some possibly violate ring winding order, while with others I couldn't perceive the exact problem. But the point is, these are all geometries that we were able to work with before, and now are raising errors. I'd like to understand how we can return to the more lenient mode.
NOTES:
This is only happening on my Macbook (GEOS version 3.8.0), but not on our Linux production server (GEOS version 3.5.0)
REFERENCES:
https://github.com/rgeo/rgeo/issues/194
https://github.com/rgeo/rgeo-geojson/issues/33
This doesn't appear to be an issue with the rgeo gem but rather the underlying geos library on your mac.
There appears to be a difference in the way that geos 3.8.x (3.8.1 is the latest version in Homebrew circa 4/13/2020) and earlier versions of the geos library handle the is_simple calculation that determines Polygon validity. This affects any RGeo factory (most of them but not RGeo::Geographic.spherical_factory or RGeo::Cartesian.simple_factory) backed by the CAPI.
If you download version 3.5.x of geos from https://trac.osgeo.org/geos/ and build it with cmake (takes a while but installs cleanly) you should have consistent behavior between your production and local development environments.
If you were using the simple_mercator factory I doubt that differences in how spherical coordinates (implemented in pure ruby) are validated explain the differences in behavior that you see.
See this issue: https://github.com/rgeo/rgeo/issues/218
You most probably encountered this [1] bug. Reproducing needs Mac OS and shows the error you have:
RGeo::Error::InvalidGeometry (LinearRing failed ring test)
Issue is linked to pull request [2], which found the issue on Float vs BigDecimal difference. Somehow Floats are not so precise, when there are enough decimals included.
Side note: Pull request is only 26 days old, so it is still open, thus you'll need to build it from branch for the moment.
Source:
[1] https://github.com/rgeo/rgeo/issues/212
[2] https://github.com/rgeo/rgeo/pull/213
Totally lacking intuition here.
First i thought i only happens when copying and pasting code from editor. Unfortunately it's more common. Only thing I am doing is trying to insert more code somewhere in the middle of current input or modifying it.
Expected behavior:
Modify input without side effects.
What actually happens:
VERY OFTEN when modifying input it gets messed up.
If that happens every key press will copy and insert current input alongside with pressed character.
Vital notes:
Encoding is set to UTF-8 in terminal(s)
Issue persists on different emulators ( Terminator, gnome-terminal )
Issue persists when using different Ruby runtime console ( IRB, Pry )
Issue appears to be related to Ruby runtime, NOT Linux shell (i guess...)
Issue appears since:
Since system install. Didn't appear on my MacBook Air
System:
ArchLinux, although coworker reported same thing happens on his MacBook Pro.
How to reproduce (works for me):
Open rails console
Type example code: Shift.where(name: "som").where(name: "dom").where(name: "pom")
Navigate cursor to modify first where statement.
Change "som" to "SOM"
Should see it break
Press random key repeatedly to see it break even more.
Images:
Good input
Now i will navigate to first where statement to change "som" to uppercase "SOM"
I basically navigated my cursor and pressed SHIFT+S, SHIFT+O, SHIFT+M
Hope it's clear enough :-)
Thank you!
EDIT 1:
Tried using zsh instead of bash, didn't help
Disabled spring gem, didn't help
EDIT 2:
Folks on reddit suggested that i should check if there are any Ruby readline warnings eg. "Readline is not installed". None of them appear anywhere. Also reinstalled ruby 2.4.1, seems like it's not the problem in my case.
EDIT 3:
I cannot reproduce the issue in a different Rails project.
Issue appears on Rails 5.1.1, meanwhile 5.0.3 works flawlessly.
Is it possible that Rails itself (or rather one of its gems) can be the cause?
I had a very similar issue, and I boiled it down to my coloring.
I had the following in my IRBRC:
class String
def _colorize(color_code)
"\e[#{color_code}m#{self}\e[0m"
end
def red
_colorize(31)
end
def yellow
_colorize(33)
end
end
IRB.conf[:PROMPT][:MY_PROMPT] = {
:AUTO_INDENT => true, # enables auto-indent mode
:PROMPT_I => "[ME]".red + " > ".yellow, # normal prompt
:PROMPT_S => "[ME]".red + " ".yellow, # prompt for continuated strings
:PROMPT_C => "[ME]".red + " * ".yellow, # prompt for continuated statement
:RETURN => "[ME]".red + "=> ".yellow + "%s\n".red # format to return value
}
IRB.conf[:PROMPT_MODE] = :MY_PROMPT
And when I removed the .red and .yellow, everything was just fine.
I think it's because my coloring characters like \e[31m was getting counted as a length 5 characters instead of 0 characters.
My solution was to remove my coloring for the time being. Hopefully someone will come up with a better solution than that.
In a mozille extension I run:
SecSess.Logger.info("ctypes test");
Components.utils.import("resource://gre/modules/ctypes.jsm");
SecSess.Logger.info("1");
this.lib = ctypes.open("libcrypto.so");
SecSess.Logger.info("2");
var a = new Uint8Array(1<<10);
SecSess.Logger.info("3");
var ptr = new ctypes.uint8_t.ptr(a.buffer);
SecSess.Logger.info("4");
Why this ugly logging after each step you might ask? Well this code fails without showing me an error. (or at least I can't find the error message)
This is printed:
ctypes test
1
2
3
So the 5th log message is never printed which means the following statement never completes:
var ptr = new ctypes.uint8_t.ptr(a.buffer);
This is a simplified version of some old code I have to work with and which I also found online as being valid. However it doesn't work. This add-on wasn't developped using the new SDK with jpm. Quite frankly I don't know how and when it was developped but I need to run some tests on it. It comes with a few source files ordered in a components and a modules directory and a chrome.manifest and install.rdf in the root. I copied these files to the extension directory of Mozilla in order for it to work. The extension executes but there seems to be a problem with ctypes. Aren't ctypes fully supported anymore or are these old style add-on no longer valid for the modern Firefox?
Regards,
Roel
I think they landed a a patch to disallow making a pointer from buffers. I'll double check.
Edit:
Ah per this: https://developer.mozilla.org/en-US/docs/Mozilla/js-ctypes/Using_js-ctypes/Working_with_ArrayBuffers, you don't have to wrap it with a ctypes.uint8_t.ptr just pass it like a.buffer to wherever you need it. :)
On my wiki implemented by the MediaWiki interface, I am receiving a Failed to Parse (Unknown Error) for the LaTeX in the page. I checked the LocalSettings.php file, and I have set the proper variable($wgUseTeX) to true.
If it helps, the error message before this was a Failed to Parse(Missing texvc executable), but I "fixed" it to the best of my knowledge by running "make" inside the math directory and installing the texvc executable there. I tested texvc and it works on the commandline.
Could there be anything that I am missing?
aptitude install ocaml
cd /math
make clean
make
Found the answer here: MediaWiki Forums LaTeX Error
It seems that I had to clear the math directory except for the original files, rebuild ocaml, and finally rebuild texvc.
Adding this to LocalSettings solved it for me. Just needed to make the directory calls accurate. Tedious.
$wgUseTeX = true;
$wgUploadDirectory = "{$IP}/images";
$wgUploadPath = "{$wgScriptPath}/images";
$wgMathPath = "{$wgUploadPath}/math";
$wgMathDirectory = "{$wgUploadDirectory}/math";
$wgTmpDirectory = "{$wgUploadDirectory}/tmp";
$wgTexvc = "{$IP}/math/texvc";
Have a look at the README file, paying particular attention to "Ensure that the temporary and math directories exist and can be written to by the user account the web server runs under; if you don't control the server, you may have to make them world-writable."
If that does not help, edit render.ml, comment out the block that says "Commenting this block out will aid in debugging", and re-run make. This will leave all temporary files (including the TeX log) so that you can hopefully see what went wrong.