Tuesday, August 18, 2015

Ajax parseerror with JSON file all because of caching

I'll keep this short and sweet.

Pretty simple ajax call

var self = this;
$.ajax({
        url:'specs.json',
        datatype: 'text/json',
async: false,
        success: function(data) {
          self.specsData = data;
          cb();
        },
error: function(textStatus, errorThrown) {
console.log(errorThrown);
console.log(textStatus);
}
    });

I threw the error in because it had been a few hours and I couldn't figure out why I was still getting a parseerror message.

I was using iis. I had added the json mime type but it still was throwing this error.

I hit the IIS logs finally after I wanted to make sure it truley was returning a 200 like the browser was showing in "errorThrown" message.

2015-08-18 20:22:49 ::1 GET /JStest/specs.json - 80 - ::1 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/44.0.2403.155+Safari/537.36 304 0 0 0

What? 304? WTF is 304?

Not Modified 304

If the client has done a conditional GET and access is allowed, but the document has not been modified since the date and time specified in If-Modified-Since field, the server responds with a 304 status code and does not send the document body to the client.
Response headers are as if the client had sent a HEAD request, but limited to only those headers which make sense in this context. This means only headers that are relevant to cache managers and which may have changed independently of the document's Last-Modified date. Examples include Date , Server and Expires .
The purpose of this feature is to allow efficient updates of local cache information (including relevant metainformation) without requiring the overhead of multiple HTTP requests (e.g. a HEAD followed by a GET) and minimizing the transmittal of information already known by the requesting client (usually a caching proxy).


Ok. So despite adding the mime type. The browser was told ,"I gave you the file. Use your cache."

So the cached version of the json still had the wrong mime type.

Closed and reopened Chrome. Works perfectly.

Friday, February 21, 2014

Report to rule all reports, or at least document them.

I was tasked to document SSRS and while having BIdocumenter (DocXpress), I found the documentation produced by it a bit verbose and not printer friendly. 120 reports produced 26k pages of documentation.

So, I took a half day and mapped out the ReportServer Database.

After doing it, I thought I should upload it to the community.


I currently only have a version for 2008 but I need to have one done for 2005 before next week and I will try against 2012 as well in a few weeks.

Monday, June 10, 2013

Parameters cannot be extracted from the SQL command

Parameters cannot be extracted from the SQL command. The provider might not help to parse parameter information from the command....."Syntax error, permission violation, or other nonspecific error".

Got this while trying to create a parameter inside an OLE DB Source Editor.

Spent an hour scouring google and couldn't find an answer to my query.

It was a simple query like:

/****     My  Awesome Query     ****/

Select blah1, blah2, blah3
from myblahtable
Where 1=? and myblahdate > ?

Then BAM "Syntax error, permission violation, or other nonspecific error".

Turns out, it was my "/****     My  Awesome Query     ****/" comment that I left in was making it to hard for the parser to find my question marks.

Ugh.

Hope this helps you.

Tuesday, March 26, 2013

BIG-IP_cookie_decoder.py 3.+

Ugh, this is why I end up coding in mostly microsoft products....versioning of the tools itself.

Granted, I love open source but I also hate when I end up fixing syntax because I'm always using an IDE or verion of tools not used by the codes original authors. You can try to guess what version of python or cygwin or whatever scripting language/compiler they are using but eventually you just end up fixing the syntax of their code so you can make it work.

Anyways. If you are looking to decode F5 BigIP cookie entries... here is the following updated python script that will work with 3.3.

It was found at http://blog.taddong.com/2011/12/cookie-decoder-f5-big-ip.html

but here is the updated code for python 3.x.x. (I was using 3.2.3 at the time)

#!/usr/bin/env python

# Description:
#          Python script to decode F5 BIG-IP persistent cookies
#
# Author:  Raul Siles (raul _AT_ taddong _DOT_ com)
#          Taddong (www.taddong.com)
# Date:    2011-12-06
# Version: 0.1
# Revised: Python version 3.x.x - James Murray (jamesmurrayga _@_ hotmail _DOT_ com)

# URL: http://www.taddong.com/tools/BIG-IP_cookie_decoder.py
# F5:  http://support.f5.com/kb/en-us/solutions/public/6000/900/sol6917.html
# Fix: http://support.f5.com/kb/en-us/solutions/public/7000/700/sol7784.html

# Credits: (based on)
# http://penturalabs.wordpress.com/2011/03/29/how-to-decode-big-ip-f5-persistence-cookie-values/

# Example cookie value (encoded string): 1677787402.36895.0000

import struct
import sys

if len(sys.argv) != 2:
        print ("Usage: %s cookie_value" % sys.argv[0])
        exit(1)

encoded_string = sys.argv[1]
print ("\n[*] String to decode: %s\n" % encoded_string)

(host, port, end) = encoded_string.split('.')

print (host, port, end)

# Hexadecimal details:
(a, b, c, d) = struct.pack("<I", int(host))
#print "HOST: 0x%02X 0x%02X 0x%02X 0x%02X\n" % (a,b,c,d)

(v) = struct.pack("<H", int(port))
p = "0x%02X%02X" % (v[0],v[1])
#print "PORT: %s\n" % p
#

print ("[*] Decoded IP:   %s.%s.%s.%s" % (a,b,c,d))
print ("[*] Decoded port: %s\n" % (int(p,16)))