(started this draft 3-4 years ago)
I never expected to live in the Apple eco-system. It started off mild, with my getting an iPod Nano which while not a full-on game changer was the best thing out at the time (coming on a decade ago). Since then I got a couple more and even a big drive model. All of these devices fell into disuse when I eventually got an iPhone 3G. That was my first real foray into the Apple world. That was followed by the 4GS.
I had no choice really. I was switching coasts and moving across the country by car and I wanted/needed something that gave me internet access while going through unseen terrain.
But then one day, after an update, Google Maps disappeared, to be replaced with Apple Maps. That infuriated me. Google Maps had public transportation timetables and routes and I relied heavily on them especially after my move back to the Bay Area. And it was well integrated with other apps for clicking links and such. Apple's maps were too new and lacked much and they basically said "too bad, but you can still get some of that other information from these other apps that are not integrated". So... i un-updated and did not update for months waiting for Google to make a new blessed app. But when it finally came, it wasn't well integrated so I dumped the iPhone in favor of Android.
Have to admit, at the time Android eco system was not as polished and didn't have full app range. But there was some extra freedom. I hated iTunes and the fact that you could only connect the iPhone to one computer. Made sharing and file transfering annoying.
Years later, I have to admit I feel the pull back to the Apple phone world for a few different reasons including some pressure from the critical mass it has; most of my coworkers use it, and relatives. And there's some decision paralysis in the Android world.
2017-01-07
4 years of distraction
I feel the urge to release pent-up crap that blogs used service. 2 kids and job changes and just life get in the way but the urge has returned. Shame I can't post from the office or while connected through VPN (blocked). But what the heck, let's give it a try again.
2013-10-29
Git-er dunn
So I'm a late-comer to this version control phenom called Git. Up until basically a couple weeks ago I'd been mostly tied to Perforce for work and for my own private or local small things I'd maintain my own SVN server repo and for single one-offs even used RCS simply because it was quick and dirty and there were emacs came with bindings by default.
Oh, I was aware of Git and did some reading on it over the years and had the interest, just never had a need until recently. I basically created the need and have been playing with it for a couple weeks now. The need came about because Perforce licenses cost money and at work if you aren't doing development on something in Perforce for a sufficient amount of time, they "threaten" to pull your license. Actually it's not a big deal because I can always just get a new one. Still, I didn't like getting the notification. More than that though, was this company-wide push to migrate towards Git from Perforce, SVN and the others. Now that I've been using it, and given what I've read about it, not only do I understand the move but I wholly endorse it and wish I had used it before and pushed for it at my previous job. It might be the novelty and "shiny new toy" effect but I think it's pretty slick, albeit slightly obtuse in learning since it has some significant points of deviation from what I've used before and requires some re-thinking.
Initial highlights for me are:
All of this is well-known to Git users. There are other bigger philosophical and paradigm shifting things connected to it as well. But this is what effects me. I hear that it was a bit more painful and/or confusing to use in the early days so it's probably just as well that I only pick this up now that it has passed the mass adoption phase. To many I'm sure it's just another version control system, so what, we work fine with the old method, it suits us better, less to learn, the are workarounds to ease the pain points with the old system, it's still improving, etc. etc. For me, little things like this that sort of optimize some annoyance out of existence or greatly reduce it still excite me.
Oh, I was aware of Git and did some reading on it over the years and had the interest, just never had a need until recently. I basically created the need and have been playing with it for a couple weeks now. The need came about because Perforce licenses cost money and at work if you aren't doing development on something in Perforce for a sufficient amount of time, they "threaten" to pull your license. Actually it's not a big deal because I can always just get a new one. Still, I didn't like getting the notification. More than that though, was this company-wide push to migrate towards Git from Perforce, SVN and the others. Now that I've been using it, and given what I've read about it, not only do I understand the move but I wholly endorse it and wish I had used it before and pushed for it at my previous job. It might be the novelty and "shiny new toy" effect but I think it's pretty slick, albeit slightly obtuse in learning since it has some significant points of deviation from what I've used before and requires some re-thinking.
Initial highlights for me are:
- Split location development
- Promiscuous committing and branching
- Speed and Offline work
Split location development
The primary "oh, this is actually cool" feeling came when I realized that it may solve my split development-environment problem (at least the mechanical part). What I mean is, I do/did development on different machines such as laptop and desktop and other remote machine. I'd usually had some helper scripts and such to rsync things back and forth and keep track of what files I changed in each, always at risk of clobbering some work I had done. It was really kludgy but necessary. It was just easier and more convenient to develop on my laptop but I was limited because the gobs of data I needed to run on or the other needed tools/services/libraries were on the servers which my desktop could have access to but that I couldn't bring locally to my laptop. Currently, I'm experimenting with a Git setup where my desktop pulls and pushes from the main repos on the servers, and my laptop pulls and pushes to my desktop. So far it seems like a great way to keep things aligned and with commit changes and history preserved, made possible by branching and merges being first class features of the system.Promiscuous committing and branching
This was new to me in terms of typical work flow. Since branches and merges were kind of painful in the other version control systems, and because even checking work back in to a central repository with others was a time-consuming process (with regression tests, locking, merging, code-reviews, etc), I'd basically work on many multiple things in the same checkout and check them in en masse with a single description just so I didn't have to do it as often. Now I see I can do many local and -- more importantly-- annotated commits which is nice for collecting clusters of work related to the same goal and keeping track of change history. And as well, I find myself now separating different work goals into different branches, even disposable ones, knowing it is still organized and relatively quick and painless to re-merge especially since it will be with myself only. In effect (if not in actuality) I get to be the repo owner and all of the benefits that entails.Speed and offline work
I really like that I truly get to work locally. No waiting on a central repo. I hate when people spout nonsense that free wifi is everywhere and we're never without a connection. Even with your own mobile wifi hotspot you don't always have a connection. Just ride the BART for an hour like I do and see what percentage of that time you have an uninterrupted signal. It's not that I don't wish I had uninterrupted wifi all the time, but I don't want the lack of it to gate me from being able to be productive when I'm a poor offline user. Just as important, I really don't always want to be VPN'd into work either, which is extra annoying because I have to dig out and use a password-generating dongle to VPN in. This is especially frustrating on e.g. BART where interrupted signal can kick me off of VPN every few minutes in some areas. Poo. The side benefit is that since the whole repo is local and I don't need to consult with the central repo for every little thing, it's really fast.All of this is well-known to Git users. There are other bigger philosophical and paradigm shifting things connected to it as well. But this is what effects me. I hear that it was a bit more painful and/or confusing to use in the early days so it's probably just as well that I only pick this up now that it has passed the mass adoption phase. To many I'm sure it's just another version control system, so what, we work fine with the old method, it suits us better, less to learn, the are workarounds to ease the pain points with the old system, it's still improving, etc. etc. For me, little things like this that sort of optimize some annoyance out of existence or greatly reduce it still excite me.
Wow, nearly two years of nothing. Blame life.
I had an itch to write a few rare posts on some things techy and so I go here to look and the last entry was at the end of 2011. Ha! There main reason is that basically 10 years of a normal person's life got squeezed into the last 2 years = New + {wife, kid, house, job} and everything associated with them {moving, immigration, doctors, lawyers, insurance, hunting, etc}. Since this is a lonely page, it's very low priority, and noone else cares, but it's time I start scratching some of those itches.
Well, amongst the accumulated things tech that are significant are:
Well, amongst the accumulated things tech that are significant are:
- I use a Mac now. It was the result of the job change. I've never used one prior to last year. I mean I've touched them and toyed with other people's... but never my own as a primary machine.
- I hardly ever code now. That's a bit of an exaggeration but not by much (partly because I'm not sure whether to count SQL in there). Another job switch thing.
- I'm still stuck writing Python when I do code, and all the things I hated about it before are still present, but I've bended to acknowledging that it benefits from better inertia and there are some interesting modules around for it that I can't seem to find the equal of in e.g. Ruby.
- I'm in a position where I have to use new software tools and in a more structured environment which I'm finding interesting, though sometimes frustrating.
2011-12-15
Vertical Tabs
There were a few key reasons for my wanting to move from Firefox to Google Chrome but the ONLY, I repeat ONLY, reason I finally gave up on Firefox and moved to Google Chrome was because there was at least some form of vertical tab sidebar option in Chrome, albeit crippled compared to tree-style-tabs.
That is... until now.
Chrome updated and now there is no possibility for this tab sidebar. And I for the life of me cannot understand why they are so fucking against having vertical sidebar tabs.
WHAT is the logical argument for it? WHAT?! If you sill live in the 90s and only keep one or a couple tabs open at all times and just love going forward and back and reloading pages, then yes, having a few tabs at the top is more efficient. But if you have a lot of tabs open it SAVES space to have a vertical tab bar. Why? because tabs are wider than high, so you can fit more tabs in the space and have them be readable before you need to resort to scrolling. On the top, you have to shorten the tabs to fit more in and have to use the scroll buttons sooner. To top that off, most screens these days are wide-screen so it's just a better use of screen real-estate; most web-pages are NOT wide screen so there is unused space unless you love to zoom or have gigantic fonts.
I think that because tabs started out on top and are therefore the norm, they are just being lazy pricks and don't want to rock the boat or put in the extra effort on behalf of the mass of us that use a lot of tabs and therefore NEED this vertical tabs on the side.
Maybe they think that we shouldn't have many tabs open ever. Or rather that we should go back to going forwards and backward ad nauseum. There are many useful and valid reasons to have a lot of tabs open. I'm not even talking 35 tabs of memory and resource gobbing youtube videos, I'm talking about normal use and even for work. Example. I often have to look up python modules and it is helpful for me to have a bunch of the ones I'm using open in their own tabs and at my fingertips and NOT have to constantly go forward and backward and search and research and load and reload. And when I'm doing a normal search I like to tab-open the links so I can compare pages and not have to back-button to the list of pages.
Come on!! WTF, man?
That is... until now.
Chrome updated and now there is no possibility for this tab sidebar. And I for the life of me cannot understand why they are so fucking against having vertical sidebar tabs.
WHAT is the logical argument for it? WHAT?! If you sill live in the 90s and only keep one or a couple tabs open at all times and just love going forward and back and reloading pages, then yes, having a few tabs at the top is more efficient. But if you have a lot of tabs open it SAVES space to have a vertical tab bar. Why? because tabs are wider than high, so you can fit more tabs in the space and have them be readable before you need to resort to scrolling. On the top, you have to shorten the tabs to fit more in and have to use the scroll buttons sooner. To top that off, most screens these days are wide-screen so it's just a better use of screen real-estate; most web-pages are NOT wide screen so there is unused space unless you love to zoom or have gigantic fonts.
I think that because tabs started out on top and are therefore the norm, they are just being lazy pricks and don't want to rock the boat or put in the extra effort on behalf of the mass of us that use a lot of tabs and therefore NEED this vertical tabs on the side.
Maybe they think that we shouldn't have many tabs open ever. Or rather that we should go back to going forwards and backward ad nauseum. There are many useful and valid reasons to have a lot of tabs open. I'm not even talking 35 tabs of memory and resource gobbing youtube videos, I'm talking about normal use and even for work. Example. I often have to look up python modules and it is helpful for me to have a bunch of the ones I'm using open in their own tabs and at my fingertips and NOT have to constantly go forward and backward and search and research and load and reload. And when I'm doing a normal search I like to tab-open the links so I can compare pages and not have to back-button to the list of pages.
Come on!! WTF, man?
2011-10-12
screen tricks
GNU screen has been a staple tool for a few years now that I do most thing on remote machines. My main hangup with it is switching windows which I do a lot and requires multiple keypresses (C-a #). This can be alleviated some by splitting the screen (C-a S) so I don't have to switch as often. But that introduces yet another sequence of key strokes (C-a TAB). It's something I can only stomach on a larger screen since I hate terminals with too few lines.
It occurred to me today that I could open up to ssh sessions and have both joined to the same screen session, so that I could keep different windows open in each. Simply open the second terminal with "screen -x".
Another trick I discovered was to add the following to my bashrc.
if [ "$TERM" = "screen" ]; then
screen_set_window_title () {
local HPWD="$PWD"
case $HPWD in
$HOME) HPWD="~";;
*) HPWD=`basename "$HPWD"`;;
esac
printf '\ek%s\e\\' "$HPWD"
}
PROMPT_COMMAND="screen_set_window_title; $PROMPT_COMMAND"
fi
And now my windows have a more sensible name; I do find myself constantly cycling through windows till I find the right screen in the right directory.
VPN, Win7, and not seeing the LAN computers
Here's another one of those mystical computer problems that (at least) one wonderful genius found a solution to that defies explanation as to how he figgered it out.
Problem: I VPN in to work but for some reason cannot see what used to be called the "Network Neighborhood". Basically, if there's a file on the network that I need I can't click on the link to get to it.
Search: Turns out I can use the IP address in an explorer window to see the contents, but hell if I'm going to look up every IP address that I need. It logically leads to a lot of guesswork on the nets looking for a solution that involves network settings, DNS, configs, and even domains and workgroups. Most threads of which drop off without a satisfactory answer and an occasional "works for me"
Solution: Then I found this lonely page quite apart from the other threads in content and direction but which did the trick. How the hell are we supposed to know that something called TCP Auto-tuning would be the culprit?
solution copied here for future reference:
Problem: I VPN in to work but for some reason cannot see what used to be called the "Network Neighborhood". Basically, if there's a file on the network that I need I can't click on the link to get to it.
Search: Turns out I can use the IP address in an explorer window to see the contents, but hell if I'm going to look up every IP address that I need. It logically leads to a lot of guesswork on the nets looking for a solution that involves network settings, DNS, configs, and even domains and workgroups. Most threads of which drop off without a satisfactory answer and an occasional "works for me"
Solution: Then I found this lonely page quite apart from the other threads in content and direction but which did the trick. How the hell are we supposed to know that something called TCP Auto-tuning would be the culprit?
solution copied here for future reference:
Disable TCP Auto-Tuning
1.Open elevated command prompt with administrator’s privileges.
2.Type the following command and press Enter:
netsh interface tcp set global autotuning=disabled
Enable TCP Auto-Tuning
1.Open elevated command prompt with administrator’s privileges.
2.Type the following command and press Enter:
netsh interface tcp set global autotuning=normal
2011-09-06
Browser woes
I've given it as much chance as I could stand for it to somehow correct itself but at the end of the day I have to say that Firefox has failed me. FF has been my only main browser for what seems like as long as I can remember. The primary reason was that it was cross platform and for the longest time I used Linux at work and Windows on the home machines, so I could use the same browser and setup on both. But in recent years it has started to show its bloat. Maybe it was the cool add-ons I loaded, maybe not. One thing is for certain, it wasn't the speedy snappy browser of its youth. That can be forgiven but lately it's been doing something aweful on my main PC. It regularly and frequently just stalls there, whether I'm scrolling, moving the cursor, typing, anything, for several moments it would sit unresponsive, then catch up then do it again. I've recently updated to 5.x then 6.x and the problem never went away despite there being lots of "fixes". I have a habit of keeping a lot of tabs open and I've even gotten into the habit of paying special attention to close many AND to actually starting and restarting my browser in an attempt to free up resources. I ended up putting up with that for long enough, and the constant freezes were the last straw.
So lately I switched to using Chrome. I had it installed some time back but never used it as a primary browser like I intend to now. I gotta say, the snappiness and absence of stalls is refreshing. In fact, VERY REFRESHING. VERY! I'm reminded of an article that I can't remember the details of but it concerned people getting used to having to reboot Windows to solve problems, and expecting software to basically suck... all because that's the only experience many people can have. Can't really fault them for not having money to own multiple computers with different operating systems for comparison. Even I don't feel like I have the time to, say, migrate to working on a Mac when what I have works (most of the time).
Anyhow, Chrome is good. I'm going to keep using it for the time being. It's STILL missing a few things that I grew to depend on in FF, especially these add-ons: Downthemall, DWhelper, and TreeStyleTabs (and to some extent Google Toolbar). Nothing available for Chrome approaches the level of the FF versions. If either of them get their act together (what I want available in Chrome, or FF fixing their performance fiasco, though hopefully both), then I will re-evaluate. Until then, I'm going to be stuck doing most stuff in Chrome and certain things in Firefox. A bit of a sad state of affairs.
2011-06-21
More reboot nonsense
So yeh, I'm to blame for continuing to use the free Adobe Acrobat PDF viewer when there are so many other, probably better, certainly less bloated PDF viewers around. But it was convenient, been using it for over a decade, many sites that generate PDFs helpfully suggest you get it, and they're the creators of the format giving an extra false feeling of competence.
Anyways, it just gave me another notification that an update was ready so I let it update. After installing, it told me I have to reboot my computer for the changes to take effect. I'm sure it's got something to do with that accursed windows registry or something similar because for the life of me I can't think of a good solid reason for a PDF viewer to need a system restart. I know they're not the only software that requires a nonsensical system reboot. Why after how many versions of Windows do we still need to reboot when non-system/kernel/hardware changes are made?
Anyways, it just gave me another notification that an update was ready so I let it update. After installing, it told me I have to reboot my computer for the changes to take effect. I'm sure it's got something to do with that accursed windows registry or something similar because for the life of me I can't think of a good solid reason for a PDF viewer to need a system restart. I know they're not the only software that requires a nonsensical system reboot. Why after how many versions of Windows do we still need to reboot when non-system/kernel/hardware changes are made?
2011-05-19
Reboot-itis
I almost popped a vein the other day with Windows 7 again. It drives me NUTS that it will auto-reboot (post-update) without your permission and no matter what you have running. In fact, I find that policy downright unprofessional. I know they think it's to "protect" the users and perhaps for the vast majority of them maybe there is some benefit; benefit as much to Microsoft as to the user. You see, if they step in as if they were you're IT department forcing you to do it their way for you're own good without choice and in the process manage to actually cut down on exploits and infections, then in the public eye Windows looks good even if they do it in a big brother fashion.
But at least have the decency to let us turn that bloody "feature" off with a simple option click. And I don't mean "Turn off auto-updates" because then you'll just be nagged. And I don't mean scour Google for registry hacks and third party software that sometimes does the trick but sometimes not. I mean an honest to goodness checkbox that says "don't reboot automatically until I say so". Not only do some of us not need it, but it actually interferes with us. My sis sometimes needs to work remotely from her main home machine when she's away and she's completely fucked if her machine decides to reboot and she's not around to turn it back on and run the proper software. Poor thing has had to call relatives to break into her home to turn it back on. And the answer should not be "oh she should install x, y, z, buy u, v, w and edit o, p, q to have l, m, n started upon boot and ...". She's not an IT professional. The simple answer is "Don't shutdown without my permission!", nag me about it later if you must.
While I'm at it... 20 years later and you still need to reboot for what feels like every little freaking thing. A driver here, a service there, registry setup change over yonder. What is it about the system that makes it impossible to just stop-service start-service restart-service and once identified to FIX IT?
(Granted, it's gotten a lot better and it's not always their fault)
But at least have the decency to let us turn that bloody "feature" off with a simple option click. And I don't mean "Turn off auto-updates" because then you'll just be nagged. And I don't mean scour Google for registry hacks and third party software that sometimes does the trick but sometimes not. I mean an honest to goodness checkbox that says "don't reboot automatically until I say so". Not only do some of us not need it, but it actually interferes with us. My sis sometimes needs to work remotely from her main home machine when she's away and she's completely fucked if her machine decides to reboot and she's not around to turn it back on and run the proper software. Poor thing has had to call relatives to break into her home to turn it back on. And the answer should not be "oh she should install x, y, z, buy u, v, w and edit o, p, q to have l, m, n started upon boot and ...". She's not an IT professional. The simple answer is "Don't shutdown without my permission!", nag me about it later if you must.
While I'm at it... 20 years later and you still need to reboot for what feels like every little freaking thing. A driver here, a service there, registry setup change over yonder. What is it about the system that makes it impossible to just stop-service start-service restart-service and once identified to FIX IT?
(Granted, it's gotten a lot better and it's not always their fault)
2011-04-22
Wireless hoops
It's been so long since I scratch-installed Linux on my work-laptop that I had forgotten the pain in the arse it can be to get the wireless working. Not that the steps are necessarily hard nor that the howto's are that difficult to find; it's the frustration and anger when you try one recipe after the next that result in failure until magically something works.
I realise now how many problems I may potentially have avoided by putting Linux in a virtualbox on my personal laptop, where wireless is simply not an issue (all internet bridges to the ethernet port from the host). In fact there's something to be said for virtualbox essentially standardizing all the hardware such that they are not a consideration. I know it's been theorized and toyed with but I now think about how nice it could be if there were no real host (only a host shell that handles the hardware) and all OS's were in a virtual machine. The nearest I can figure for that would be an extremely stripped down Linux, but then Linux doesn't have the most complete set of problem-free device drivers in the first place doesn't it?
Anyhow, this time, the fix I have to remember can be found (among other places) here, with the key novel steps being:
I realise now how many problems I may potentially have avoided by putting Linux in a virtualbox on my personal laptop, where wireless is simply not an issue (all internet bridges to the ethernet port from the host). In fact there's something to be said for virtualbox essentially standardizing all the hardware such that they are not a consideration. I know it's been theorized and toyed with but I now think about how nice it could be if there were no real host (only a host shell that handles the hardware) and all OS's were in a virtual machine. The nearest I can figure for that would be an extremely stripped down Linux, but then Linux doesn't have the most complete set of problem-free device drivers in the first place doesn't it?
Anyhow, this time, the fix I have to remember can be found (among other places) here, with the key novel steps being:
sudo apt-get update sudo apt-get --reinstall install bcmwl-kernel-source
Upper left corner
I forget exactly when but at some point Ubuntu defaulted to having windows with the close/min/max buttons in the upper left corner instead of the upper right. For some historical reason they have always been on the upper right and it was taken for granted and people just got accustomed to expecting it there. Despite it being relatively easy to "fix" I did read some complaints on the choice. I was rather agnostic about the placement actually. In fact, since all menus are left justified (in my language anyways) it sorta makes sense to have the window menu buttons there as well.
Anyhow, today I just found a mildly compelling reason for me to prefer to keep those buttons on the upper left corner. I often enough connect my laptop to my monitor at work which is vastly bigger than my laptop screen, and in doing so I tend to enlarge and space out my windows. If I suspend and unsuspend to the smaller screen, the windows run off the page, BUT the top left corner almost always remains on the screen where I have access to these buttons but not if they were on the other side. It's a minor thing but custom and consistency is the only argument for keeping it on the upper right.
Anyhow, today I just found a mildly compelling reason for me to prefer to keep those buttons on the upper left corner. I often enough connect my laptop to my monitor at work which is vastly bigger than my laptop screen, and in doing so I tend to enlarge and space out my windows. If I suspend and unsuspend to the smaller screen, the windows run off the page, BUT the top left corner almost always remains on the screen where I have access to these buttons but not if they were on the other side. It's a minor thing but custom and consistency is the only argument for keeping it on the upper right.
2011-04-18
Python Logging
I've been using the Python logging module for a couple of weeks now, and I want to like it because A) it's a standard module, B) it has some cool features like multiple handlers and hierarchy. But almost every time I use it I feel like I might as well just write my own logging module suitable for my purposes... because it seems like I have to do that anyways. The module just seems to require too much scaffolding and setup to use.
Here's what I mean. To do it properly you have to:
To be fair, there is a "simple" way to use logging which is to just use the logging module functions "BasicConfig()" and "debug|info|warning|error|etc()" functions without getting a logger for your module. But it doesn't give the behaviour I want and even they prefer you don't use it in this manner.
What I believe is missing is a set of helper-functions and/or sytactic sugar to handle common tasks.
In the above "opener()" is a separate function I have that wraps opening a filename, file object, pipe, or what have you depending on the input and optionally with encoding. Sometimes I miss how easy that is dealt with in Perl.
Here's what I mean. To do it properly you have to:
- get a logger
- set the verbosity level of the logger
- create a file or steam handler
- create a formatter (the default needs replacing)
- add the formatter to the handler
- add the handler to the logger
- do this all again if you want to mirror to stderr AND to a file (which is why I started using logging in the first place)
- put in code to shut down the logging (makes sure the streams get flushed) and for safety use the atexit module, meaning
- import atexit
- register the shutdown
- add an exception hook so that we can log uncaught exceptions too
To be fair, there is a "simple" way to use logging which is to just use the logging module functions "BasicConfig()" and "debug|info|warning|error|etc()" functions without getting a logger for your module. But it doesn't give the behaviour I want and even they prefer you don't use it in this manner.
What I believe is missing is a set of helper-functions and/or sytactic sugar to handle common tasks.
- let more things like Level and Handlers be put in the argument to getLogger
- automatically wrap common things like a File-like object and filename string into a handler instead of having the need to explicitly make one.
- an at-exit shutdown should be somewhat implicit (maybe an option to turn it off) as well as the option to trap other exceptions
- one line (minus "import") to get a logger for my module with any optional formatting and whatnot.
- one line to configure the root logger with all options, that can deal with an array of logging destinations, that will auto-interpret formatting strings and destinations instead of needing to create sub-handlers and formatters, etc.
def add_to_logging(log,whereto=None,level=10,format="%(levelname)s: %(message)s",dateformat='%Y%m%d_%H%M%S'):
''' shortuct to attach a destination to an existing logging object
logfile can be file or gzip or stream or None(meaning stderr) '''
if whereto is None: whereto = sys.stderr
if isinstance(whereto,(str,unicode)):
fp = opener(whereto,'w')
else:
fp = whereto
fh = logging.StreamHandler(fp)
fh.setLevel(level)
if format:
formatter = logging.Formatter(format,dateformat)
fh.setFormatter(formatter)
log.addHandler(fh)
def setupLogging(logname=None,rootname='',timestamp=False,consoleLevel=20):
''' shortcut to set up a dual stderr/logname LOGGING stream
default level for file is DEBUG, for console is INFO
(set consoleLevel to 0 to turn off console)
SEE PYTHON LOGGING DOCUMENTATION FOR LOGGING BEHAVIOR
returns a logging object'''
import atexit
logger = logging.getLogger(rootname)
logger.setLevel(logging.DEBUG)
dateformat='%Y%m%d_%H%M%S'
# change the formatting if timestamp
fmtstring = "%(levelname)s: %(message)s"
if rootname is not None and rootname != '':
fmtstring = "%(name)s:" + fmtstring
if timestamp:
fmtstring = "[%(asctime)s:%(name)s:%(lineno)s:%(levelname)s] %(message)s"
# add a file if specified
if logname:
assert isinstance(logname,(str,unicode))
#logging.basicConfig(filename=logname,format=fmtstring,dateformat=dateformat)
add_to_logging(logger,logname,format=fmtstring,dateformat=dateformat)
# add a console
if consoleLevel!=0:
add_to_logging(logger,sys.stderr,format=fmtstring,level=consoleLevel,dateformat=dateformat)
# cleanup and exception handling
atexit.register(logging.shutdown)
# the following will capture exceptions to the logs as well
sys.excepthook = lambda *x: logger.error('Uncaught Exception',exc_info=x)
return(logger)
In the above "opener()" is a separate function I have that wraps opening a filename, file object, pipe, or what have you depending on the input and optionally with encoding. Sometimes I miss how easy that is dealt with in Perl.
2011-04-12
Download Squad Fired!?
WTF?! Did I miss something? I have a lot of feeds in my RSS reader but this would have been one of the guaranteed survivors were I forced to trim it down to the essentials. Aww man, that sucks. And not much of an explanation to go along with it. There's a gaping void in my feed list now. I valued it more than many of the other feeds they recommend as a replacement and that I even have on my feed list.
Addendum: Ok, looking deeper through the comments followed by a search, it seems AOL-Huffington Post shut them down. Again with the big media guys fracking up the good stuff. shakes fist in air
Addendum: Ok, looking deeper through the comments followed by a search, it seems AOL-Huffington Post shut them down. Again with the big media guys fracking up the good stuff. shakes fist in air
2011-04-11
Emacs, you ugly nerd
I once saw Emacs described as a "thermonuclear text processor" and I find that description fitting. Emacs is a beast. It has a really steep learning curve. But much the same way the *nix in general can have a steep learning curve, after you use it for a long enough time you grow to appreciate the raw power available over the other offerings. Some even take it up a level "Emacs IS my operating system". There are too many quirks with that for me to accept on that part though. I know I can run a shell terminal in Emacs but I never do, mostly because of how the environment seems to get screwed up just enough to turn me off.
Anyhow, I sometimes can't believe how utterly craptastic it is make Emacs look pretty by way of fonts and such. It's a freaking mess. And there is the invariable quirk with it as well. Thankfully the internet comes to the rescue. What I love most about the web coupled with a good search engine is that I often enough am able to find the workaround to a problem I'm having. Not easily some of the time but it puts a whole host of things within the realm of possibility. Most recently I wanted to correct the annoying issue of Emacs not using the default font when opening a new frame via C-x 5 2. Found the snippet of code I needed to add to my .emacs file almost immediately.
Only thing I really regret about using Emacs as much as I do is never having learned Lisp. It's always been on my someday list.
Anyhow, I sometimes can't believe how utterly craptastic it is make Emacs look pretty by way of fonts and such. It's a freaking mess. And there is the invariable quirk with it as well. Thankfully the internet comes to the rescue. What I love most about the web coupled with a good search engine is that I often enough am able to find the workaround to a problem I'm having. Not easily some of the time but it puts a whole host of things within the realm of possibility. Most recently I wanted to correct the annoying issue of Emacs not using the default font when opening a new frame via C-x 5 2. Found the snippet of code I needed to add to my .emacs file almost immediately.
Only thing I really regret about using Emacs as much as I do is never having learned Lisp. It's always been on my someday list.
FF4
I installed Firefox 4 partly because I simply wanted the speed improvements and partly because of newest-gadget-syndrome. I'm pleased to report that I am digging the loading speed improvement immensely. As for the better handling of memory, even with the feature where it will unload unvisited tabs after some time and it can be set to not load all tabs at startup, I find myself again running into the issue of FF taking up way to much memory and slowing to a crawl.
The fatal flaw with FF4 was that they didn't go far enough and just up and swallow the BarTab add-on, the first or second most critical addon in my FF arsenal. I was really dismayed that BarTab hadn't been updated to work with FF4 yet. I tried the tweaks and suggestions to get some of that functionality that's built-in to FF but it just doesn't hold water. I need the ability for tabs to explicitly be unloaded exposed, preferably with a rightclick menu and a menu item to "unload all other tabs". When FF gets slow, this has helped a lot with BarTab.
Thankfully, I just found a hack to get BarTab mostly working with FF4, and it must be treated as Beta. There's already the issue where tabs don't load automatically when clicking on them but pressing F5 is the just price I will pay to have the ability to unload tabs. We'll see though, maybe it will get too annoying.
On a side note, I get really annoyed in the discussions from people imposing their view that you should never have more than a few tabs open. There's merit to the notion that you shouldn't keep more tabs than you need open, but there are lots of times where I do need many open simply so that I do not have to constantly look for previously opened sites. Case in point, I have a bunch of tabs open to a set of Python modules and related info. I just need the page loaded once so I can click on the tab to look something up, I don't want to have to close it and load it up again when I need to look it up again.
The fatal flaw with FF4 was that they didn't go far enough and just up and swallow the BarTab add-on, the first or second most critical addon in my FF arsenal. I was really dismayed that BarTab hadn't been updated to work with FF4 yet. I tried the tweaks and suggestions to get some of that functionality that's built-in to FF but it just doesn't hold water. I need the ability for tabs to explicitly be unloaded exposed, preferably with a rightclick menu and a menu item to "unload all other tabs". When FF gets slow, this has helped a lot with BarTab.
Thankfully, I just found a hack to get BarTab mostly working with FF4, and it must be treated as Beta. There's already the issue where tabs don't load automatically when clicking on them but pressing F5 is the just price I will pay to have the ability to unload tabs. We'll see though, maybe it will get too annoying.
On a side note, I get really annoyed in the discussions from people imposing their view that you should never have more than a few tabs open. There's merit to the notion that you shouldn't keep more tabs than you need open, but there are lots of times where I do need many open simply so that I do not have to constantly look for previously opened sites. Case in point, I have a bunch of tabs open to a set of Python modules and related info. I just need the page loaded once so I can click on the tab to look something up, I don't want to have to close it and load it up again when I need to look it up again.
2011-04-10
Tramp at work
One major change in workflow that I had to get used to with the company change a few years ago was doing most of my work and development through remote terminals. Try as I might to do at least some work on my local machine there was just no escaping that it was just more convenient to do my script writing and edits and tests on the remote machines. A shell is a shell so I can manage: windowless emacs and vim for editting, and screen sessions for stuff. But I hate the lag introduced working remotely, I hate not being able to exploit having remote drives mountable to my local machine, I hate not being able to exploit my local tools and environment. All of this could go away partly if they just enabled sshfs so that I could at least access some of the data for development purposes (much to much to xfer locally and there's policy against it). But alas, they are unwilling to enable it, even if there's no good reason. It's not like i would be able to access anything more than I could anyways.
So one thing I tried before was at least being able to use my local emacs editor to edit remote files with Tramp. I recall having to munge my commandline prompt to get it to work and that it was a little clunky and so I gave up. But I've tried recently tried it again and it went a lot more smoothly to my surprise. It even came with my latest Ubuntu installation (finally updated after a year+ of laziness) vs my downloading and installing it myself previously. So it was trivial to try again and I was pleasantly surprised. Saving and loading has the lag still but everything else gives me the snappiness of a local machine (save for when I have a network interruption). I guess I'm going to try this method out until I come up with a more satisfactory method of doing more work locally without all the constant syncing.
Unfortunately what got me thinking of this again was wanting to try another editor to edit Python. As much as I like (or rather am used to) emacs and vim, Python feels like it require a lot more editor support to do right and to overcome annoyances. So I've been wanting to move to an IDE so I'm testing out Eclipse and the remote access plugin, but so far I am thwarted by it's need to have SFTP enabled remotely or another server running remotely in order to work. Not having root there I just don't have the time or energy to work around trying to hammer that together. I'm bugged to no end that there is no easy facility for installing packages as a user without root.
So one thing I tried before was at least being able to use my local emacs editor to edit remote files with Tramp. I recall having to munge my commandline prompt to get it to work and that it was a little clunky and so I gave up. But I've tried recently tried it again and it went a lot more smoothly to my surprise. It even came with my latest Ubuntu installation (finally updated after a year+ of laziness) vs my downloading and installing it myself previously. So it was trivial to try again and I was pleasantly surprised. Saving and loading has the lag still but everything else gives me the snappiness of a local machine (save for when I have a network interruption). I guess I'm going to try this method out until I come up with a more satisfactory method of doing more work locally without all the constant syncing.
Unfortunately what got me thinking of this again was wanting to try another editor to edit Python. As much as I like (or rather am used to) emacs and vim, Python feels like it require a lot more editor support to do right and to overcome annoyances. So I've been wanting to move to an IDE so I'm testing out Eclipse and the remote access plugin, but so far I am thwarted by it's need to have SFTP enabled remotely or another server running remotely in order to work. Not having root there I just don't have the time or energy to work around trying to hammer that together. I'm bugged to no end that there is no easy facility for installing packages as a user without root.
2011-04-09
No vertical screen split for J00
I got quite happy when I learned there was a version of Gnu Screen that let you do vertical splits. I always have 2 screens side by side (emacs and shell) both distinct ssh sessions with distinct instances of screen. Had this worked it would have saved me some minor inconvenience since I'd only need to log in once and not have to select between the two detached screen sessions.
I said "had it worked". Actually it did work, but there is a side effect that is a deal breaker and it makes me really sad. The fatal flaw is that I mouse select for cut/paste a LOT and the selection does not respect the border between the vertical split. Yes, there is the keyboard option for cut/paste but that's insufficient.
I said "had it worked". Actually it did work, but there is a side effect that is a deal breaker and it makes me really sad. The fatal flaw is that I mouse select for cut/paste a LOT and the selection does not respect the border between the vertical split. Yes, there is the keyboard option for cut/paste but that's insufficient.
2011-04-08
Dell XPS m1330, a most beautiful piece of shit
I remember being quite excited upon receiving my m1330. It was a beautiful laptop. Very sleek and original. Relatively thin. Powerful enough to run my WoW (at the time) by sporting an NVidia card. I loved it. I stopped using my Alienware desktop monstrosity almost entirely. It was a bit pricey though, something like $1600 in '07/'08. Perhaps the only complaint I had was that it came with Vista.
It's sad though, the innards of that thing ended up being junk. I had to have it serviced every year. It overheated, the video would give out, the motherboard would break. I even forked out dough for the extended warranty just to get it fixed (2nd time it died was shortly after the previous warranty expired but they let me buy the extended). It was my main machine at the time, in particular since I had just moved and purged much of my wares, so I kept it serviced. And a part of me wanted it to be a nice working machine because I really did like it cosmetically and feel-wise.
But at last, it just wasn't cutting it. I'm not sure if it was the game upgrades or the vidcard or what, but WoW and other similar games became completely unplayable. It ran a bit clunky. It still had Vista on it just to run the games but when that stop it basically became a linux box. So a year ago, upon getting the Alienware m11x, a machine I also love (though I still think I prefer the m11x look and feel-wise), I gave it to my sister. Not much long after that, it started exhibiting more problems and basically quit on her. I took it back, loaded it up with linux to find that it kept crashing. I had good indication it was the hard drive so I bought another one. Installed it, spent more time putting Ubuntu on it, had it just about set up the way I liked and wouldn't you know.... it completely gives up the ghost. Won't power on or anything. Pisses me off that I had just spent more money on it again only to have it bricked.
I've read about bad experiences with Dell and their machines. It wasn't my experience for the most part, until now. My previous laptop was also a Dell and although it ended up with some issues here and there, it worked for a looong time, on the order of 8 years or so. And (having a warranty) I had fair service. But now I'm very disappointed, doubly so because they put together a machine that I really wanted to like and they ruined it with shoddy parts and internal design and a hefty price tag. Such is the life with gadgets I suppose. I did try and look up how much it would cost me to fix it and I decided that I'd rather spend the money on a new netbook than sink it into an aging machine. I did consider it though. If I could have found a new mobo for, say, $50-70 I would have justified it as a geek hobby.
As to whether or not I'll ever trust Dell again to buy from them... Well, I probably will. I mean, I already have with this Alienware but I'm HOPING that that subdivision of the company (acquired) has a higher standard and from what I read they mostly are. I did have to have it serviced but it was only a fan that stopped working causing overheat and shutdown. I'm getting good use out of it though and that's the important bit. Also, sometimes the price is hard to ignore, I have the discount deals through my company and I have a work-issued Dell as well that is a clunky beast but is still kicking with nary a problem (other than a dead battery) in 3.5 years.
I just wish it wasn't the m1330 that ended up being the lemon.
It's sad though, the innards of that thing ended up being junk. I had to have it serviced every year. It overheated, the video would give out, the motherboard would break. I even forked out dough for the extended warranty just to get it fixed (2nd time it died was shortly after the previous warranty expired but they let me buy the extended). It was my main machine at the time, in particular since I had just moved and purged much of my wares, so I kept it serviced. And a part of me wanted it to be a nice working machine because I really did like it cosmetically and feel-wise.
But at last, it just wasn't cutting it. I'm not sure if it was the game upgrades or the vidcard or what, but WoW and other similar games became completely unplayable. It ran a bit clunky. It still had Vista on it just to run the games but when that stop it basically became a linux box. So a year ago, upon getting the Alienware m11x, a machine I also love (though I still think I prefer the m11x look and feel-wise), I gave it to my sister. Not much long after that, it started exhibiting more problems and basically quit on her. I took it back, loaded it up with linux to find that it kept crashing. I had good indication it was the hard drive so I bought another one. Installed it, spent more time putting Ubuntu on it, had it just about set up the way I liked and wouldn't you know.... it completely gives up the ghost. Won't power on or anything. Pisses me off that I had just spent more money on it again only to have it bricked.
I've read about bad experiences with Dell and their machines. It wasn't my experience for the most part, until now. My previous laptop was also a Dell and although it ended up with some issues here and there, it worked for a looong time, on the order of 8 years or so. And (having a warranty) I had fair service. But now I'm very disappointed, doubly so because they put together a machine that I really wanted to like and they ruined it with shoddy parts and internal design and a hefty price tag. Such is the life with gadgets I suppose. I did try and look up how much it would cost me to fix it and I decided that I'd rather spend the money on a new netbook than sink it into an aging machine. I did consider it though. If I could have found a new mobo for, say, $50-70 I would have justified it as a geek hobby.
As to whether or not I'll ever trust Dell again to buy from them... Well, I probably will. I mean, I already have with this Alienware but I'm HOPING that that subdivision of the company (acquired) has a higher standard and from what I read they mostly are. I did have to have it serviced but it was only a fan that stopped working causing overheat and shutdown. I'm getting good use out of it though and that's the important bit. Also, sometimes the price is hard to ignore, I have the discount deals through my company and I have a work-issued Dell as well that is a clunky beast but is still kicking with nary a problem (other than a dead battery) in 3.5 years.
I just wish it wasn't the m1330 that ended up being the lemon.
Subscribe to:
Posts (Atom)
