Skip to content

Instantly share code, notes, and snippets.

@qcom
qcom / errrrrrr
Created October 18, 2012 04:20
error whee!
Traceback (most recent call last):
File "app.py", line 31, in <module>
destbook.save("result.xls")
File "/Users/zach/Work/upload/pages/xlwt/Workbook.py", line 643, in save
doc.save(filename, self.get_biff_data())
File "/Users/zach/Work/upload/pages/xlwt/Workbook.py", line 618, in get_biff_data
shared_str_table = self.__sst_rec()
File "/Users/zach/Work/upload/pages/xlwt/Workbook.py", line 580, in __sst_rec
return self.__sst.get_biff_record()
File "/Users/zach/Work/upload/pages/xlwt/BIFFRecords.py", line 77, in get_biff_record
@qcom
qcom / err.txt
Created October 18, 2012 05:53
More error yay
Traceback (most recent call last):
File "app.py", line 13, in <module>
workbook.save("result.xls")
File "/Users/zach/Work/upload/pages/xlwt/Workbook.py", line 643, in save
doc.save(filename, self.get_biff_data())
File "/Users/zach/Work/upload/pages/xlwt/Workbook.py", line 618, in get_biff_data
shared_str_table = self.__sst_rec()
File "/Users/zach/Work/upload/pages/xlwt/Workbook.py", line 580, in __sst_rec
return self.__sst.get_biff_record()
File "/Users/zach/Work/upload/pages/xlwt/BIFFRecords.py", line 77, in get_biff_record
@qcom
qcom / app.py
Created October 18, 2012 06:24
import glob
import xlwt
workbook = xlwt.Workbook(encoding='utf8')
worksheet = workbook.add_sheet("Sheet 1")
wrapstyle = xlwt.easyxf("alignment: wrap on")
for count, filename in enumerate(glob.glob("*.html")):
worksheet.row(count).write(0, filename[:-5])
<div id="container"><div id="contents"><a name="top"><h3>Master Lock - No. 1KALF</h3></a><p><a id="contents-features" href="#features">Features</a></p><p><a id="contents-lockDimensions" href="#lockDimensions">Specifications</a></p><p><a id="contents-details" href="#details">Details</a></p><p><a id="contents-bestUsedFors" href="#bestUsedFors">Best Used For</a></p><p><a id="contents-faqs" href="#faqs">FAQs</a></p><p><a id="contents-testimonials" href="#testimonials">Testimonials</a></p><p><a id="contents-videos" href="#videos">Videos</a></p><hr/></div><div id="features"><a name="features"><h2 class="features">Features</h2></a><ul><li>Keyed Alike - order multiple locks to open with the same key or order to match other locks with the W1 cylinder</li><li>Commercial grade padlock features superior protection from drilling and prying</li><li>1-3/4" (44mm) wide laminated steel body for superior strength</li><li>1-1/2" (38mm) tall, 5/16" (8mm) diameter hardened steel shackle for superior cut resistance</li><li>Dual lo
I use excel to generate product upload files for Google's Merchant Center, Amazon's Seller Central, and in-house e-commerce solutions.
But it's the same type of data (i.e. products), and sometimes even the same data, just being pushed to different targets.
Maintaining these often half-duplicate xlsx files has become tedious and unwieldy, so I'm wondering if I should have a database of products that would allow me to generate a spreadsheet for each target (by performing certain queries on my more general data I'd assume).
Is this a legitimate time to use a database?
And, if so, should I use a relational database? I'm not too clear as to what kind of data is relational and what kind isn't, but I've read that traditionally relational databases are used in the corporate/e-commerce area.
But that could just be history rather than adeptness.
Anyway, just wondering.
@qcom
qcom / import.sql
Created January 23, 2013 18:17
import xml into sql table
use Products
go
-- create test table
create table XMLTest(SKU int, Description nvarchar(30))
go
-- edit
insert into XMLTest (SKU, Description)
select x.product.query('SKU').value('.', 'INT'),
Version 1:
PRODUCTS
SKU | name |
01 |Hard Hat|
ATTRIBUTES
aID | name |
01 | color |
02 | closure|
@qcom
qcom / query.sql
Last active December 11, 2015 22:09
insert shipping weights into products table
-- 2 Tables: Products(SKU, ShippingWeight, Name, Description ...) and Weights(SKU, ShippingWeight)
select Products.SKU, Weights.ShippingWeight
from Products join Weights
on Products.SKU = Weights.SKU and Products.Vendor = 'MasterLock'
@qcom
qcom / track.html
Created January 30, 2013 20:06
GoSquared Tracking Code
<script type="text/javascript">
var GoSquared = {};
GoSquared.acct = "GSN-848662-J";
(function(w){
function gs(){
w._gstc_lt = +new Date;
var d = document, g = d.createElement("script");
g.type = "text/javascript";
g.src = "//d1l6p2sc9645hc.cloudfront.net/tracker.js";
var s = d.getElementsByTagName("script")[0];
@qcom
qcom / instructions.txt
Created February 7, 2013 00:04
CodeEval Problem (Easy)
Description:
Given a number n and two integers p1,p2 determine if the bits in position p1 and p2 are the same or not. Positions p1,p2 and 1 based.
Input sample:
The first argument will be a text file containing a comma separated list of 3 integers, one list per line. e.g.
86,2,3
125,1,2