I con for give you five...

You seem to have javascript disabled, or your browser is failing to execute it properly. Much of Fimfiction's functionality requires javascript so we suggest you turn it on!
Hello? Is this thing on? OK good. Hey everypony! My name is Twilight Sparkle and my coltfriend, Red Glare, is busy at the moment doing...uhh...something...and he asked me to update his blog for him. Here we go!1) Red wanted me to let all his followers know that he is working hard on his newest chapter of Militant League. I've read what he has so far and it isn't to bad to be honest.2) Red is working hard on his two newest stories. I can't tell you much (mainly because he won't tell me anything) but I do know the titles. The first is called My Little Splatterhouse and it features Red's friend Atomic Vortex. The second is called Shockwave I think and I think he called it a self insert...I still don't know what that means...3) Red is concocting a new story based off of another book he read. If you want to know more you'll have to ask him.OK friends, that's all I have for you. I hope I didn't do too bad with this thing. Read on everypony!-Twilight Sparkle...How the hay to I turn this thing o-
What's up friendos of all shapes and sizes. It's been awhile, huh? Last time I updated was...almost a year ago. Anyway, it's time for a mixed list of news and excuse making!1) The reason it's been so long is because of financial, family, educational and coming of age issues. I don't wanna get into too much detail here, but if you want to know more, hit up my inbox.2) With renewed vigor comes new...well...everything. Starting this Friday, I will be starting a new chapter of Militant League of Ponies. Also, I've started two Brand New Stories, I'll post the links to the previews when (and if) they pass the site admin inspection so look forward to those.3) My friend
is making progress on a badmutha story he's writing called Fallout Equestria: Brotherhood. He's a good friend and an amazing autor so check that out. The link will be below.4) Going to BronyCon again this year. It's gonna be crazy awesome. If you plan on going too let me know and I'll see you there.That's all for now my pony loving amigos. Now hit the books...just don't actually hit them...book are for reading not hitting...yeah...-Red GlareP.S.- Here is that link I promised you guys:
News time everypony!1) New chapter of MLP is up. Read it. Memorize it. Love it.2) I'm gonna be writing guest chapters for Atomic Vortex's fic...which should be interesting because we have two different writing styles.3) Gonna be starting a new fic starring Atomic Vortex. It'll be a Splatterhouse crossover so you can be sure there will much violence and all the blood letting that comes with it.Well there you go. Short, sweet and to the point. No get out there and read you crazy ponies you!-Red Glare
This is for all my Militant League Fans out there. The first section &Training Daze& is almost half over and I was thinking about doing subchapters in between mane sections. Then I thought 'why not let the fans have some fun' and so this challenge came to be. The challenge is this: create your own chapter of Militant League using characters from the story.Rules: -Must be between 1,000 and 2,500 words-Must use characters from Militant League of Ponies: Fighting is Magic-Addional characters are allowed-Must be submitted to me by the end of the end of section two &Operation: Shortcut&-Must be titled in Militant League format (Operation: ...)-A author isn't limited to one entry, so send as many as you wantAnd there you go guys. I can't wait to see what my fans come up with.Keep on writing!-Red Glare
OK everypony, here be some news...1: Militant League- The way I write it is kind of weird. I have study hall as my fourth period class and while I'm tempted to sit there like a vegitable, I decide to write some of my story. So I write the old fashion way. With a pen and a piece of paper. Another thing is I write best when I'm tired for some reason so I'll try and sleep less to write more.2: Computer- My laptop died last month (R.I.P) and that left me only my mom's laptop to write on. Well, sadly I have also killed my mother's laptop (WHY DOES EVERYTHING I TOUCH DIE) so that leaves me only the desktop to use. Because of that, Militant League update will most likely come in bulk. Lucky you guys.. 3: SSFM- The whole collab thing is goin great actually. The first fic will be a collab between all three of us called &Creating Perfection& and the second fic is just me and Grey Byte called &Berry's Punch&. I'd tell you more but I may have said too much already.4: New Stories- I've had a few new ideas for fics. The first one is gonna be called &That Guy& and it's gonna be a HiE fic. I can't tell you much about my second idea because we at SSFM are debating whether or not to turn it into a collab. All I can tell you is the project name is &Project: EoN& and it's gonna be a good one.That's all for me you party ponies. Catch ya on the flip side.-Red Glare
Yay! New chapter of Militant League is out! It's a leigt chapter too, so eat your heart out fan ponies! Also, I have a new, revised soundtrack which I'll post soon. Look forward to that too. See ya soon and enjoy!-Red Glare
Howdy ladies and gentle colts! Just a heads up, me and two other authors (White Noise and Grey Byte) started up a collab channel called Shattered Sounds FM where we'll post our...you guessed it...collab fics. It'll be all three of us or just two sometimes. But even if I'm not one of the authors, still give the story a read. Check out the link below for the channel even though we don't have any fics up yet. Hopefully we will soon so follow us and enjoy. Peace.-Red Glare
Figures that I update Militant League for the first time in almost a month and none of my followers are online.
Yay! The Mare or The Manticore passed by on the first time. I'm just so happy. *cries**regains composure* I'm ok. Any who, READ IT! I worked really hard on it and I've only got good things said about it so far.In other news, a message to site admins: STOP CHANGING STUFF! It's already good the way it is. Thank you.Anyway, that's all for now. Thanks everypony!-Red Glare
Ok, so a quick news update for all of my followers out there. I just submitted a new story at around 3:10 P.M. Eastern time which I am really excited about. It's original version is one of my favorite short stories. The new story is called The Mare or The Manticore. When It passes by the mods (which I hope it does the first time around) I hope you all will read it, so keep a look out.Ta ta for now!-Red GlareP.S.-Hey Dark, if you get on and I'm offline, it's because I'm getting a haircut. xD Don't worry though, because I'll be back on as soon as I get home so yo don't have to whine about me getting on a minute before you go to bed you little baby. Lol jk. So yeah Dark I'll try and get on as soon as possible. See ya then.
...back to news!1) I finished chapter 3 of Militant League (you: YAY!) but I read over it and realized that it was an interesting mixture of rambling and bull shit. So, I deleted that chapter and currently brainstorming for a new one. (you: awwwww...) I know you want more, and I'm working as best as I can. So, as stated in The Human's Guide to Life in Equestria: &The universe hates you, but not totally.&2) Dark Lightning and I are co-writing a new fic called The Misadventures of Dark Lightning and Red Glare. It's gonna be funny as hell, or at least that's what Dark says. Anyways, all I can say is the first chapter is already in progress so I hope everyone is on the edge of their seats in anticipation.And that about covers everything for now. Now sit back and enjoy the soothing sounds of the Militant League of Ponies Soundtrack.-Red Glare
Hey bronies! I have the most epic weekend planned. I have the opportunity to be part of this:Also, here's the soundtrack again:Well, I'm off to Alaska. Wish me luck!
Greetings everypony! I've been hard at work recently with Vinyl Scratch picking out songs to put on the Militant League of Ponies Soundtrack. So far, here's what I got:That's all for now. Capt. Glare out.*salutes*-Captain Red Glare
A few things for this update:1) I'm sorry for all of you guys who wanted a new chapter of Militant League today. Wednesday my computer broke and today I mourned the loss of a fellow brony. I'll get the next chapter out asap.2) To hurry up the story a bit I'm putting together the last of the intro stories into one chapter. The first half is going to be Lemon Jello and Razor Graze and the second half is going to be Jackpot and Cash Out. After that I have one more small intro chapter to go before it is main story line time!And that's it for now. If you'll excuse me, I have some writing to do. Peace!-Red GlareP.S.- R.I.P. Oscar. You will be missed.
3.51 61 20 79 98 01 37 83 09 51 35 04 92 18 48 79 6 45 45 82 44 67 88 21 10 35 75 72 39 07 16 98 64 25 00 15 01 18 97 23 11 43 20 62 39 29 01 41 59 67 37 12 58 62 77 87 33 91 83 10
FIMFiction
My Little Pony: Friendship is Magic Fanfiction
Designed and coded by
Social Media
MLP: Friendship is Magic - & 2016 HasbroREST Tip: Deep etags give you more benefits.
| BitWorking
REST Tip: Deep etags give you more benefits.
ETags, or entity-tags, are an important part of HTTP, being
a critical part of caching, and also used in "conditional" requests.
So what is an etag?
The ETag response-header field value, an entity tag, provides for an "opaque" cache validator.
That's not very helpful, is it?
The easiest way to think of an etag is as an
MD5 or SHA1 hash of all the bytes in a representation.
If just one byte in the representation changes, the etag will change.
ETags are returned in a response to a GET:
joe@joe-laptop:~$ curl --include http://bitworking.org/news/
HTTP/1.1 200 Ok
Date: Wed, 21 Mar :15 GMT
Server: Apache
etag: "078de59b16cfa53e5b51"
Content-Length: 23081
Vary: Accept-Encoding,User-Agent
Connection: close
Content-Type: application/xhtml+ charset=utf-8
&!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&
&html xmlns="http://www.w3.org/1999/xhtml"&
&meta content="text/ charset=utf-8" http-equiv="content-type" /&&link href="/favicon.ico" type="image/ico" rel="shortcut icon" /&
On a subsequent GET request you can put the value in that
ETag: header in an
If-None-Match: header and if there is a representation that has
that etag, i.e. if the representation hasn't changed, then the response
is a 304 with no entity body returned.
That's a great savings in bandwidth.
The inclusion
of an If-* header turns any normal request into a
"conditional" request, in this case our GET became a
"conditional" GET.
The etag is used as a cache-validator and can
be combined with other cache related headers
to great effect. See my article :
In addition to being used during GETs, the etag can be used
to do a "conditional" PUT, which can be used to avoid the
Static files
has built in support for generating etags
for statically served files.
allows you to set what pieces of information are used to
generate an etag. You can choose a combination of inode, last-modified,
and the file size.
Why not turn them all on? Well, in cases where you are
serving the same file from several servers you
definitely want to turn off the use of the 'inode' for generating
the etag since the inode will vary from system to system.
Non-static content
If you are not serving up static content then you need to do some more
work to enable etags. How much work you do will determine how much
benefit you get from etags. The deeper the concept of an entity-tag
permeates your application, the more benefit you will receive.
Constructing ETags
How do you generate an etag? Find all the bits of information that could impact
your representation of a resource and use that information to build
an 'opaque' etag. I usually do that by concatenating the values of these
key pieces of information as strings and then calculating an MD5 or SHA1 hash of that string.
The MD5 hashed value is certainly opaque, and the MD5 hash assures that the actual
etag is only 32 characters long, while ensuring that
they are highly unlikely to collide.
A shallow implementation
You can get away with a very shallow implementation of etags
and get a lot of benefits to your bandwidth.
You could implement
a simple layer in your stack that actually built the full response and
then calculated an MD5 hash of the bytes returned and use that
as an etag. From that simple base you could handle "conditional"
GETs and achieve a savings in bandwidth. This isn't to be sneezed at, as
A deeper implementation
On the other hand, if you bring the concept of etags deeper into
you application you could get even more benfits. First, you could
support things like "conditional" PUTs, which allows clients
to detect lost updates. [For the terminology-oriented this is a
form of .]
Secondly, the data query
and templating needed to create a representation may be
the time-consuming part of the response and the bandwidth
savings may be negligable in comparison. In this case
it's beneficial to bury etag support deep in your application
and use it to shortcut the querying and templating steps.
REST Tip: Deep etags give you more benefits.
For this to work you need to pick out key values or characteristics
of your data the will determine if a representation will
change, and then build an etag from that. For example, in
the case of files, Apache httpd uses a combination of
inode, last-modified time, and the file size. For your
application you may already store a timestamp of when
each resource is modified, which is perfect information
to fold into an etag.
In the case of data stored in a database, if a resource is tied
to a single row in a table then a simple timestamp or revision number
on the row is a good source of information for generating an etag.
But that is just one source. If you then process that through a
template then the 'version' of the template also needs to used in
calculating your etag. A change to the template would alter the
representation even though the revision number for a row in the database
didn't change, so both need to be used together when calculating
Here are some examples of deep etags that
avoid a lot of computation.
Here is the bit of code in the
web service that checks for matching etags:
if_none_match = os.environ.get('HTTP_IF_NONE_MATCH', '')
if if_none_match and str(hash(os.environ.get('QUERY_STRING', '') + __version__)) == if_none_match:
not_modified()
In this case the etag is driven off the query parameters passed into the service and
the version of the file spark.cgi itself.
I took a slightly different approach in the
and instead of using the file version I used the last-modified timestamp
of the program.
def etag(critterid):
file_version = os.stat(sys.argv[0]).st_mtime
etag = sha.sha(critterid)
etag.update(str(file_version))
return '"%s"' % etag.hexdigest()
In both of these services the etag check is done very early and
avoids all of the calculations required for a non-matching response.
But I use a database...
You have a good knowledge of your domain and can come up with
a method of determining an etag from your data. Maybe the
data is never updated, or you keep track of updates already, or
your database keeps fine grained timestamps on rows
that you can use for etag generation.
You should use those.
What I'm going to show you is a sledge hammer approach
that doesn't rely on specialized knowledge of your problem domain.
Like all sledgehammers, it's a heavy tool that should be applied
with care.
If your resource maps one to one with a row in a table, and you keep a revision number
for each row then you can use that as a value to build an etag.
This technique doens't require adding any code to
update the revision number on the rows, that can be done
by using a trigger. Here is an example from SQLite:
CREATE TABLE notes (
INTEGER PRIMARY KEY autoincrement,
INTEGER DEFAULT 0);
CREATE TRIGGER insert_notes_revision AFTER UPDATE ON notes
UPDATE notes SET
rev = rev+1
WHERE id = new.
Let's look at some Python code that handles this, . Just editing. You can't even add or delete
notes, just edit them.
This service is built on my throw away Python framework .
Here are the modifications
to robaccia.py. Note that render() depends upon the caller passing in
some information, raw_etag, to be used as a basis for an etag. It then adds in a dependency on the last-modified timestamp of
the template file. It returns a 304 if appropriate, otherwise
it includes the calculated entity tag in the ETag: header.
def render(environ, start_response, template_file, vars, headers={}, status="200 Ok", raw_etag=None):
file=os.path.join("templates", template_file)
if raw_etag:
last_modified = str(os.stat(file).st_mtime)
hash = md5.new(raw_etag)
hash.update(last_modified)
etag = '"%s"' % hash.hexdigest()
headers['etag'] = etag
if etag == environ.get('HTTP_IF_NONE_MATCH', ''):
start_response('304 Not Modified', [])
(contenttype, serialization) = ('text/ charset=utf-8', 'html')
ext = template_file.rsplit(".")
if len(ext) & 1 and (ext[1] in extensions):
(contenttype, serialization) = extensions[ext[1]]
if serialization in matching:
best = mimeparse.best_match(matching.keys(), environ.get('HTTP_ACCEPT', 'application/xhtml+xml'))
(contenttype, serialization) = (best, match[best])
if serialization == 'xhtml' and environ.get('HTTP_USER_AGENT', '').find("MSIE") &= 0:
(contenttype, serialization) = extensions['html']
template = kid.Template(file, **vars)
body = template.serialize(output=serialization, encoding='utf-8')
headers['Content-Type'] = contenttype
start_response(status, list(headers.iteritems()))
return [body]
And here is the view implementation, based on .
The _raw_etag() method is what builds up the raw information to be used
in the calculation of the etag. In this case it is just a concatenation
of all the 'rev' columns in the rows used to generate the response.
import robaccia
import dbconfig
from wsgicollection import Collection
from config import log
class Notes(Collection):
def _raw_etag(self, cursor):
for row in iter(cursor):
e.append("%d-%d" % (row['id'], row['rev']))
return "-".join(e)
def list(self, environ, start_response):
c = dbconfig.connection.cursor()
rows = list(c.execute("select id, note,"))
return robaccia.render(environ, start_response, 'list.xhtml', {'rows': rows}, raw_etag=self._raw_etag(rows))
def get_edit_form(self, environ, start_response):
c = dbconfig.connection.cursor()
id = environ['wsgiorg.routing_args'][1]['id']
rows = list(c.execute("select id, note, rev from notes where id = ? ;", id))
return robaccia.render(environ, start_response, 'edit_form.xhtml', {'rows': rows}, raw_etag=self._raw_etag(rows))
def update(self, environ, start_response):
c = dbconfig.connection.cursor()
id = environ['wsgiorg.routing_args'][1]['id']
f = environ['formpostdata']
note = f.get('note', ['no note found'])[0]
rev = f.get('rev', ['no rev found'])[0]
c.execute('update notes set note=:note where id=:', locals())
start_response("303 See Other", [('Location', "../")])
You'll note that this implementation requires looking at all the
rows that will be used to generate the response, so this technique
isn't going to save you
it will only save bandwidth, and
the processing time for the templates.
I told you it was a sledgehammer.
One more thing to note, look at the implementation of _raw_etag(), it concatenates the 'id' and 'rev'
for each row used to build the representation. If this list ran to hundreds of items and
we didn't form the etag from an MD5 hash of raw_etag, then we'd end up
schlepping around an etag hundreds of bytes long, which is no way to save bandwidth.
Again, the point isn't to show you exactly how you should be
implementing etags, but to give you some ideas
on how to start, and how
you can use them to speed up your application. The deeper you build
etags into your application, and the earlier to start thinking about
them, the better off you'll be.

我要回帖

更多关于 give you five 的文章

 

随机推荐