Not the movie 🙂
I’m following the Django tutorial and it’s surprisingly fun! I ran into an issue that I’m going to document here for any hapless souls that come after me. To seasoned Python devs, it’s blindingly obvious but I’m a newbie.
In the tutorial, we’re only supposed to create 2 models (Poll and Choice) but I decided to add an extra model to my models.py file:
groceryitem = models.IntegerField()
store_name = models.CharField(max_length=255)
transaction_id = models.IntegerField(default=1)
purchase_date = models.DateTimeField(‘date purchased’)
After adding the Transaction model to the admin page to be edited, I was unable to view 127.0.0.1:8000/admin/poll/transaction/ and got this error message:
Exception Type: AttributeError
Exception Value: ‘long’ object has no attribute ‘encode’
When i switched to the interactive shell to check on my Transaction objects, I got this very helpful error message.
TypeError: coercing to Unicode: need string or buffer, long found
When I defined __unicode__ for the Transaction model, I should output a string object instead of the number. Defining __unicode__ is analogous to defining the toString() method in Java (correct me if I’m wrong). To solve y The last line of my Transaction model group of statements should have been:
It’s 9pm on a school night and I’ve got a midnight deadline looming. I’m done with my assignment and it’s time to submit. So, I dutifully attempt to ssh to the server (“Nike”) where I’ll submit my work and I get this message:
Received disconnect from $nike: 2: Too many authentication failures for $username
Crap. The first word that comes to mind is a bad word. I wondered if the issue could be because I’m trying to connect from an off-campus location (i.e. behind one large public IP with hundreds of other students). So, I ssh-ed into my personal account at Dreamhost and ssh-ed to Nike from there; thankfully my Dreamhost IP wasn’t been blacklisted or anything so I was able to authenticate without any bogus “auth” failures. Then, I had a second problem: how to get my files onto the Nike web server.
Ssh-ing to Nike from my home computer was blocked and so was SFTP. So, I uploaded my file to my personal Dreamhost account and then used the scp command (for the first time. #nojudging) to transfer the files from Dreamhost to Nike (perform the SCP operation while logged into Nike). Relevant scp command:
scp ‘firstname.lastname@example.org:/home/jane/myfile.png’ .
And just like that, the mini-disaster was averted. 🙂 Granted, I could’ve emailed the TA and covered myself but I wanted to exhaust my alternatives.
Register to do it! I’m part of a team of undergrads that will attempt this. I don’t have any illusions about our/my performance but I want to learn and grow. Do it!
There are persistent and undeniable race and gender gaps in funding and hiring in the tech sector. But the priesthood has until very recently insisted their boy’s club was open to any innovative hustler.
I’m sure many of you have heard about the Pax Dickinson story. If not, click this link and I’ll wait for you to return with hopefully informed opinions. Some recommended links if that’s too much information to wade through:
- Pax Dickinson and the “Satire” Defense of Misogyny
- Why Pax Matters (by Ms. Tiku who wrote the quote above)
- Speech and Consequences (by famous Lawblog Popehat.com)
TL;DR: A jerk on the internet who is a C-level executive for Business Insider (their CTO) made some troubling tweets that smart legal minds conclude could leave B.I. in a legal lurch and thus he was fired. Timeline: less than a day after the ‘world’ found out.
The Aftermath: In tried and true internet drama fashion, there’s a second wave of opinions suggesting that the internet acted as a lynch mob (can we stop using this terrible metaphor especially in defense of cases like this?? *sigh*), or that Pax’s tweets are art (I shit you not). Some of his defenders argue that his tweets are taken out of context but my contention is that the tweet PD lingers (the one about Jesus) is the least of his offenses! As a hiring manager (and C.T.O…. !!!), you should have better judgement than what he displayed. He is not the first person to be have fired for behaving badly on Twitter but his firing and the internet reaction is wholly justified.
Anyway, I’m tired of getting worked up over this issue. I don’t want to re-litigate the issue; Pax will be fine as he is on a press tour for his startup. There’s a third wave of people writing to counter the defenders and they are doing a much more eloquent job of explaining than I am.
The class I’m most excited about this semester is Computer Security. Our first project was modeled after Capture The Flag contests where you have to pass level N-1 to get to level N, etc. It was a straightforward assignment: 4 levels and brute force our way to find all 4 flags.
The first two levels were files encrypted with dictionary words and easy to decrypt. The third level was bit more involved i.e. some steganography and encoded text contained in an encrypted file while the fourth was an encrypted file contained in an encrypted file. Thankfully, the steganography was more of stuffing extra metadata into the image than modifying the least significant bit or any of the most complex steganography tactics. Also, on the recommendation of our professor, I used the nice python-gnupg module to do much of the heavy lifting. There’s a Java library out there that integrates with GPG but I haven’t been able to make sense of it.
Side note: Python is really nice to use. I’ve resumed my Python tutorial on CodeAcademy.com and I’m going through Zed Shaw’s Learn Python The Hard Way course.
A tool for detecting any modifications to your iDevice. Pretty cool!