Niet the Dark Absol

1

votes
1

answer
33

views

AVISynth's ImageWriter is giving blank PNG files

Title says it all really. BlankClip(length=100,width=1920,height=1080,pixel_type='RGB32',fps=60,color=$ff0000) \ .ImageWriter('frames/%05d.png',type='png') Expected result: 100 red images What I got: 100 transparent images I've tried the internal ebmp format, and that does give red images, but the '...
1

votes
0

answer
20

views

Duplicate <thead> across columns

Quite simple really. I've probably missed something obvious but here goes. I have a inside a multi-column view. The idea being, it's a fairly tall table so having it on multiple columns makes it less obnoxiously vertical and fits better on-screen. The problem is that the rows in columns 2 and beyon...
1

votes
1

answer
1.1k

views

“Emulate” HTML5 audio buffer property in Firefox?

Okay, so as part of the coursework I'm working on I've added some HTML5 tags. There is an element by the controls that is filled with audio.buffered.end(0)/audio.duration*100+'%' using the onprogress event. However Firefox 3.6 (which is what the examinor will be using unless asked otherwise in the...
Niet the Dark Absol
1

votes
2

answer
554

views

Persistent variable on iframe?

I have a being dynamically created, and it contains an . The may close itself, at which point the is removed. So far I have: var div = document.createElement('div'), ifr = document.createElement('iframe'); // some styles and stuff here, including ifr.src ifr.contentWindow.container = div; // Note...
Niet the Dark Absol
1

votes
2

answer
203

views

Detect (and block) a GET request hidden in an image

It came to my attention a while ago that some people were posting 'images' on my forums, which, when viewed by a logged-in user, forced them to perform actions on the site they may not want to. The actions in question are normally performed by a simple GET request to the relevant page. This has been...
1

votes
1

answer
32

views

Identifying an element across pageloads

I'm not the sure title of this question is the best, but hopefully this explanation will do a good job of making clear what I'm trying to do. It's 4AM, so plesae forgive and confusion I pass on to you. Basically what I would like to do is identify if an element that has been selected by the user sho...
1

votes
2

answer
1.6k

views

Alternative content for HTML5 canvas

Simple question: If I have a setup like , then a browser that doesn't support will load the image. The question is, will a browser that DOES support load the image, even if the image will never be displayed? Or will it simply ignore the tag?
1

votes
3

answer
508

views

How to store data that includes callbacks

There are, of course, many many ways to store a base of data. A database being the most obvious of them. But others include JSON, XML, and so on. The probem I have with the project I'm working on right now is that the data being stored includes callback functions as part of the objects. Functions ca...
1

votes
1

answer
748

views

Is it useful to compress localStorage?

I'll start off with a solid example: I have a function that generates hashes (32-bit integers) and saves them in localStorage. This is to implement a 'don't show me again' feature for common notifications: if the hash is in the list, don't show the notification. After my first attempt at coding this...
1

votes
2

answer
256

views

Background images on options

I'd like to get a element where each is labelled with an icon. I can achieve this using , by applying a background image to the that has each icon coincide with an option, but that relies strongly on the height of the being predictable (which is isn't). I can apply individual background colours...
1

votes
1

answer
655

views

Optimal spritesheet algorithm

One thing I've noticed about spritesheets is that their filesize is not entirely consistent. When you have individual images, assuming they are compressed properly, their filesize won't change. But with spritesheets, the filesize of the image can vary a lot depending on how the images are arranged....
1

votes
2

answer
775

views

RNG gaussian distribution

What I'm trying to do isn't exactly a Gaussian distribution, since it has a finite minimum and maximum. The idea is closer to rolling X dice and counting the total. I currently have the following function: function bellcurve($min=0,$max=100,$entropy=-1) { $sum = 0; if( $entropy < 0) $entropy = ($max...
1

votes
2

answer
1.8k

views

MySQL swap primary key values

The accepted answer to sql swap primary key values fails with the error Can't reopen table: 't' - presumably this has something to do with opening the same table for writing twice, causing a lock. Is there any shortcut, or do I have to get both, set one of them to NULL, set the second one to the fir...
Niet the Dark Absol
1

votes
1

answer
70

views

MySQL update trigger - how to detect unpassed values?

Let's say I have these possible queries: UPDATE table SET field1 = 2 WHERE id = 1; UPDATE table SET field1 = 4, field2 = 8 WHERE id = 16; table has a BEFORE UPDATE trigger that calculates a new value for field2 based on field1, but I want it to only do this if I don't specifically pass a value. I am...
Niet the Dark Absol
1

votes
1

answer
84

views

Sending UTF8 in GET parameter

When navigating to a URL like this: http://example.com/user?u=ヴィックサ I notice that Chrome encodes the characters as: http://example.com/user?u=%E3%83%B4%E3%82%A3%E3%83%83%E3%82%AF%E3%82%B5 And everything works serer-side. However, in IE I get this error from my code: The user you are trying...
1

votes
1

answer
61

views

Detect browser upgrade availability?

So one thing I'm tired of is people not updating their browsers. This is especially problematic in CSS, because I have to duplicate, triplicate or... quadruplicate?... a lot of CSS3 rules to add vendor prefixes. I'd like to know if there's any way to detect whether a browser update is available. Pre...
Niet the Dark Absol
1

votes
2

answer
317

views

Restrict access to parent directories in PHP

I have seen from other questions that I can set open_basedir to restrict access to parent folders. However, I decided to do a bit of experimenting to find out what I could do. First test was to see if I could manually set open_basedir using the ini_set function. Thankfully, it appears that this func...
Niet the Dark Absol
1

votes
1

answer
78

views

On delete set… not null?

I have a table of users, which includes a column referencing their location in the game. I have a table of locations. I have a foreign key tying the two together. I want to make it so that if and when a location is deleted, users are sent to the nearest location - I can easily determine which locati...
1

votes
1

answer
38

views

Animation events firing on psuedo-elements?

I'm observing some inconsistent behaviour regarding animation events. Demo: http://jsfiddle.net/2J37a/ In Chrome, I'm seeing a webkitAnimationIteration event for each iteration of fly in addition to the webkitAnimationIteration event for each iteration of rainbow Firefox is the same as Chrome, but o...
1

votes
1

answer
30

views

Safety of user-supplied LESS

As part of my forum system, there is a means for users to include LESS in their posts. The post content is wrapped in a uniqid-referenced ID and the LESS is wrapped in #IDhere {... }. This gives users full flexibility in their posts. To my knowledge there is no way to break out of the block, and to...
Niet the Dark Absol
1

votes
2

answer
477

views

Adding perspective to fake 3D animation

I'm working on a canvas-based animation, and I'm trying to get a 3D effect in a 2D canvas. So far, things are going well! I've got my 'orbiting line of triangles' working very well: var c = document.createElement('canvas'); c.width = c.height = 100; document.body.appendChild(c); var ctx = c.getCo...
Niet the Dark Absol
1

votes
1

answer
512

views

GameMaker runner crashes when making HTTP requests

I recently got back into using GameMaker:Studio, and hoo boy have there been some massive updates since I last used it! In fact the last time I used it they only had Windows and HTML5 as export options... Anyway, eager to try out some of the new stuff, I decided to take a shot at the native HTTP fun...
1

votes
2

answer
27

views

MySQL “pileup” when importing rows

I have the following cron process running every hour to update global game stats: Create temporary table For each statistic, insert rows into the temporary table (stat key, user, score, rank) Truncate main stats table Copy data from temporary table to main table The last step causes massive backlog...
Niet the Dark Absol
1

votes
1

answer
0

views

Floating an image with CSS: text only flows about original position?

Here's a general outline of what I'm trying to do: TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT...
Niet the Dark Absol
1

votes
1

answer
0

views

Reading animated GIF in PHP

I am in need of reading the individual frames of an animated GIF in PHP. I use GD all the time for image manipulation, but unfortunately it lacks the capability to handle multiple frames in a GIF image. I'm currently in the middle of carving up the GIF file format in an attempt to make my own extrac...
Niet the Dark Absol
1

votes
1

answer
0

views

preg_* functions matching subpattern with quantifier

I have a regex of this form: /(?:^- (.*)$\r*\n*)+/m The intention is to match one or more lines of text that start with -[space]. This works fine, except for when it comes to collecting the matched subpatterns (.*). Only the last one is returned, and any previous subpattern matches (which appear in...
Niet the Dark Absol
1

votes
2

answer
3.7k

views

VirtualDub script to concatenate a series of videos

I'm working on a video piece by piece, saved with the filenames scene1.avi, scene2.avi and so on. I want an easy way to build the video into one block and dub in the audio track. For this purpose, I'm using VirtualDub. Now, it's simple enough for me to open VirtualDub, go through File => Open, load...
Niet the Dark Absol
1

votes
1

answer
127

views

Recursive regex help needed

I'm making a template system whereby I can type: And have it be replaced with text from a file. The optional parameters are placed in the replacement string as %1, %2... So far I have this: $data = preg_replace_callback('/]+)>/',function($m) use (&$userdata) { static $fcache = Array(); $parse = func...
Niet the Dark Absol
1

votes
1

answer
238

views

PHP server “catch-all” requests

I'm using the PHP built-in server for a small, personal project. I'm just wondering if there's any way to rewrite all requests to just one script, which can then use $_SERVER['REQUEST_URI'] and similar in order to process different things. Or, alternatively, is there any way to set a 404 ErrorDocume...
Niet the Dark Absol
1

votes
1

answer
505

views

Viewing dependency tree of Foreign keys

Well... to be honest, I have absolutely no idea where to even start solving this. I'd like to view a dependency tree of all my InnoDB tables' Foreign Keys. I want to have a visual representation available. If it helps, it can be assumed that there are no circular references. I don't know if MySQL ev...
1

votes
1

answer
626

views

PDO + comment + ? = Error‼

(Side-note: Blocking ! in question titles doesn't stop smart-arses like me putting U+203C Double Exclamation Mark instead :p) After a quick round of debugging, I found this: $query =
Niet the Dark Absol
1

votes
1

answer
162

views

Firefox, service workers and the Back button

I'm getting reports that in the latest version of Firefox, pressing Back causes the 'you are offline' page, provided by my ServiceWorker, to appear. Here's the functional part of the ServiceWorker: self.addEventListener('fetch',function(event) { // We only want to call event.respondWith() if this is...
1

votes
3

answer
3k

views

PHP CLI - get user input while still doing things in background

I'm working on a game, written in PHP and that runs in a console. Think back to old MUDs and other text-based games, even some ASCII art! Anyway, what I'm trying to do is have things happening while also accepting user input. For instance, let's say it's a two player game and Player 1 is waiting for...
1

votes
3

answer
41

views

Adjust child size based on number of children

I want to make a UI that is similar to tabs in a browser. To this end, I have elements with this CSS: width: 20%; max-width: 150px; Nice and simple, responsive and awesome. Only supports five tabs, though. If I want to support 10 tabs, it's as easy as changing to width: 10%. So basically, I want som...
3

votes
2

answer
1.8k

views

PHP arrays and memory allocation

Random question that crossed my mind: If I define an array in PHP like so: $arr = Array(); $arr[7392171] = 'some value'; How is this stored internally? Does it map the key 7392171 to 'some value', or does it work like JavaScript and put 7392170 empty values before it? I'm guessing it's the former, b...
Niet the Dark Absol
6

votes
1

answer
5.5k

views

Scrollbar on the left

I currently use the following to make the scrollbar appear on the left, rather than the right: HTML: Content here CSS: .leftscrollbar { overflow:auto; transform:scaleX(-1); } .leftscrollbar>div { transform:scaleX(-1); } It works great, but is there a better way than using two transforms?
Niet the Dark Absol
6

votes
1

answer
5k

views

Viewport units, keeping aspect ratio?

So I've just discovered viewport units, and I really want to use them. First challenge: My element has a 'base size' of 760x670 pixels. I want to use viewport units to scale it up so that either the height is 100vh, or the width is 100vw, whichever is smaller. Unfortnately, although I can use 100vmi...
Niet the Dark Absol
6

votes
2

answer
5.5k

views

Limitations of Web Workers

Please bear in mind that I have never used Web Workers before and I'm having some trouble wrapping my head around them. Here's an explanation of a simplified version of what I'm doing. My page has links to various files - some are text, some are images, etc. Each file has an image showing a generic...
Niet the Dark Absol
19

votes
4

answer
3.9k

views

What types of numbers are representable in binary floating-point?

I've read a lot about floats, but it's all unnecessarily involved. I think I've got it pretty much understood, but there's just one thing I'd like to know for sure: I know that, fractions of the form 1/pow(2,n), with n an integer, can be represented exactly in floating point numbers. This means that...
5

votes
2

answer
3.3k

views

white-space pre-wrap not recalculating

Fiddle illustrating the problem - click the button a few times and the box will shrink, revealing the issue. This issue appears to only happen in Internet Explorer. Basically, when an element that contains white-space: pre-wrap is resized slowly, IE doesn't recalculate word wrapping, resulting in te...

View additional