06/25/2011 01:11 AM -
if you've been following my recent blog posts, you know i'm working on a natural user interface for windows using the kinect. i figured it's more of a novelty than useful given its current state and that of windows in general, so i wouldn't make much profit off it if i tried. thus, i've open sourced it.
download releases and code: kinectnui
featured article on chris pirillo's blog
my youtube channel, which includes a bunch of my progress demos.
Post.aspx?Title=KinectNUI+Release+%2f+Open+Source
06/21/2011 01:44 PM -
if you're getting this error in your c# or other .net code:
fatalexecutionengineerror:
the runtime has encountered a fatal error. the address of the error was at 0x63d9acdc, on thread 0x13fc. the error code is 0xc0000005. this error may be a bug in the clr or in the unsafe or non-verifiable portions of user code. common sources of this bug include user marshaling errors for com-interop or pinvoke, which may corrupt the stack.
you are calling getwindowrect with the wrong arguments. i've seen a few different signatures out there. here's the one that works:
rect rect = new rect();
getwindowrect(selectedwindow, out rect);
[dllimport("user32.dll")]
[return: marshalas(unmanagedtype.bool)]
public static extern bool getwindowrect(intptr hwnd, out rect lprect);
the following method signatures will not work:
[dllimport("user32.dll")]
[return: marshalas(unmanagedtype.bool)]
public static extern bool getwindowrect(handleref hwnd, out rect lprect);
[dllimport("user32.dll")]
public static extern void getwindowrect(intptr hwnd, out rectangle rect);
the one that works uses an intptr and not a handleref. i'm guessing you have an intptr to the handle rather than a handleref. so you probably just lucked out.
clearly you're trying to get the dimensions or physical boundaries of a target window. you may even be using wpf. you will also run into the problem that the default rect struct layout keeps its members private. you will need to use this rect signature to gain access to them:
[structlayout(layoutkind.sequential)]
public struct rect
{
public int _left;
public int _top;
public int _right;
public int _bottom;
}
Post.aspx?Title=FatalExecutionEngineError%3a+0xc0000005+upon+call+to+Win32+GetWindowRect
06/20/2011 10:08 PM -
i continue to fiddle with my kinect hack. for the uninitiated, it's a nui ("natural user interface") for windows, which uses the kinect to track the motions of the user. visit my youtube to see the whole list of my kinect demos.
Post.aspx?Title=Kinect+SDK+Demo+%2f+Hack%3a+Dual+Axis+Body+Pan%2c+Zoom%2c+Flip3D%2c+Pie+Menu
06/19/2011 01:19 PM -
Post.aspx?Title=Kinect+SDK+Demo+%238
06/18/2011 10:57 AM -
the kinect sdk was released on thursday. as soon as i heard, i ran out and bought a kinect.
right now, 11am saturday, here's what i've got so far:
Post.aspx?Title=I+have+the+Minority+Report+UI+and+You+Don%27t
06/17/2011 09:38 AM -
for the uninitiated, kinect is a device that lets you be the controller for your xbox 360. it combines a video camera with a depth camera to detect where you are and what you're doing, then passes that info into a game.
yesterday, microsoft released the kinect sdk, so i immediately went out and bought a kinect. here's what i've been doing with it:
i do not own an xbox.
Post.aspx?Title=Kinect+SDK+Hacks%3a+3D+for+Real+Life
06/11/2011 12:56 AM -
there have been many gods worshiped throughout history. it began 300,000 years ago, likely with a desire to explain that which we could not explain. in the beginning, all the forces of nature were gods. the sun was a god; the wind was a god, and so forth. such were the beliefs of the nomads of ancient and neolithic times.
as time progressed, and we learned a little more about the world around us, religions evolved such that he forces of nature were not gods, but merely represented by gods. such was the case in egypt, greece, and rome. as the centuries passed, we systematically reduced the number of gods in such a way that instead of one force, each god represented/controlled many forces.
eventually we killed off all those silly ancient gods and figured out that there was only one god. then it was a simple matter of figuring out exactly what this "god" was all about, how to worship him, and how to live our lives. thank god we figured out all those silly germanic pagans and taoists were all wrong. oh, right, taoism is still around. that's ok, surely they'll see the light. after all, the next rapture is always right around the corner these days.
it took a while before jesus was born, the new testament came out, and we finally proved all those jews wrong. thank god nobody believes all that hokum anymore.
finally, we arrived at christianity. from the council of jerusalem in 50 c.e. to the roman empire in 300 c.e. to the roman catholic church to the crusades to the spanish and portuguese inquisitions, christianity has continued to evolve over the past 1961 years or so, and i have every reason to believe it will continue to do so.
given that religion has been changing for 300,000 years, and that any idea of a supernatural deity can be neither proven nor disproven, i find it difficult to believe that we just happen to live in the day and age, and physical location, where we got it right.
Post.aspx?Title=Religion%3a+It+Keeps+Changing
06/11/2011 12:01 AM -
wikipedia defines critical thinking as "higher-order thinking that questions assumptions" and cites it as being based on:evidence through observationcontextrelevant criteria for making the judgement wellapplicable methods or techniques for forming the judgementapplicable theoretical constructs for understanding the problem and the question at hand
clearly, critical thinking is a very involved process which places great demands on the person performing it. from its description, one might infer it requires a good deal of education, experience, and maturity. specifically, children aren't good at it.
this unfortunate limitation is worsened by the fact that good parents teach their children to respect authority. while an obvious virtue, it is counterintuitive to the concept of objective evaluation. children are taught, be it purposefully or not, that their parents and teachers are pretty much always right and know a lot of stuff. they are taught to learn from these authority figures, and they do a great job of it. kids are impressionable and very good at absorbing knowledge.
parents also generally teach their children what they believe. even when they do not, their beliefs are made clear through their words, worship practices, behaviors, and actions. compounded by childrens' innate ability to learn, they form a cognitive bias. for this specific reason, most people grow up of the same religion as their parents.
simply put, children learn the concept of god before they learn how to think. i believe this to be a primary cause of lifelong religious bias and a major deterrent to a reasonable evaluation of religion. that is, people can't make reasonable decisions on what to believe because they're all biased.
that, in a nutshell, is why people still believe in the supernatural.
Post.aspx?Title=Religion%3a+Critical+Thinking+and+Children
06/10/2011 11:17 PM -
for those of you who haven't figured this out yet, i am an atheist.
over the past 17 years, i have found myself in countless debates with theists (mostly christians and derivations thereof). in order to articulate my reasons, i have found it necessary to research the topic in some detail. i have discovered therein certain patterns and reinforcing concepts which i often reuse, as any scientist would do until disproven.
a series of recent debates on facebook have motivated me to publish my findings. it occurs to me that i really should have all this written down somewhere. to that end, i will be writing some posts on the subject of religion in general, and in particular, my specific reasons for converting.
if you're the type who doesn't like talking about religion, or who is uncomfortable listening to and evaluating other belief systems, stay right where you are. you're in more dire need of my words than anyone else. if you're easily offended by concepts such as logic and reason, then please, go die in a fire.
i'm not sure whether i'll post a bunch of stuff right now and call it good, or do an ongoing series whenever i feel the need to do so. this is my blog after all, and thus my soapbox.
before i start posting my reasons, let me get some overhead stuff out of the way:
i believed myself to be a christian until around the age of 13. then, at the age of reason, i started to question the validity of what i "knew". why did i believe these things? very specific questions started coming up, and i couldn't come up with an answer to most of them. i didn't actually renounce god and label myself an atheist for 2-3 more years. we didn't have much of an internet back then, and research took a lot more time.due to my somewhat christian background, most of my knowledge on the subject of religion is specific to christianity. however, i do not single out the christian god nor any specific belief practices. i find them all equally implausible, and for exactly the same reasons.there is no central atheist group. there are many small groups, but we are not an organized religion in the context of judaism or islam. rather, we are merely people who choose not to believe in the supernatural.i speak for myself, not atheists in general. however, many others will agree with most of what i have to say. their reasons may differ widely.atheists have to come up with our own morals and ethics; but they're generally based on those of society. frequently, this causes us to have the same morals as the religious people around us. however, as freethinkers, we often put our own spin on them.
for example, i know it's usually wrong to kill another person. on the other hand, i think it's ok if that person is a murderer. personally, i take that a step further and believe that the manner of execution should be directly proportional to the manner and quantity of the offender's murders. for example, if he chopped off peoples' heads, his head should be chopped off. it simply doesn't get more fair and balanced than that.there are probably thousands of gods in which you do not believe. you may even have specific reasons. i simply take it one god further.
so it begins.
Post.aspx?Title=Religion%3a+Introduction
06/09/2011 11:33 PM -
a long-winded rant on the simplificiation of oses and other software over time. specifically, i go into patterns i've noticed with windows, linux, and macos. it's a series of patterns that make it easier for users to use the computers, and i don't like it. watch and read on to find out why.
i suggest you watch the video over reading the text. my mannerisms and sub-rants add humor to the effect. however, you may also want to read the article below. in reviewing my video, i found some key points i failed to address. think of it as bonus content.
today i would like to rant for a while, about something that's very important to me: my computers. specifically, i've noticed over the past 25 years or so an ongoing pattern whereas software, and oses in particular are getting easier and easier to use. i don't like it. hear me out.
operating system developers simplify the user experience; they tell you less about what's going on, often removing features in the process. often, users' lives are made generally harder as a byproduct. the big software companies and organizations want to redefine the user experience, establishing some great new paradigm for how something should work. the old way generally worked just fine, and was often faster and more powerful.
examples include renaming 1000 files in windows versus in ms-dos, downloading a new version of an os from within the older version instead of just downloading an iso or buying a dvd, and microsoft's ongoing pattern of making the control panel more difficult to navigate and find things. also of note is an old post of mine about windows explorer changing for the worse. sure, you can go back to the old way in many cases, but it's being moved to the background and will eventually go extinct.
i think it's often the result of one guy in some design meeting who comes up with a new, retarded idea that will be nothing like what users are used to. redefine the user experience, and people will rejoice. right? well, that guy needs to be fired, and here's why...
a simple, easy-to-use user interface is generally a good thing. my ipad 2, for example, is very easy to use. unfortunately, i have no idea what's going on behind the scenes. i'm software developer, so i like knowing what's going on behind the scenes. that's why i have so many utilities and generally keep task managers open on all my systems at any given time.
i keep my im clients, twitter and facebook client, volume mixer, and e-mail open pretty much all the time. it's not that i'm a particularly social guy; it's because i like to have a constant stream of information being thrown at me. i don't necessarily want to have to go out and find the information; i want the information brought to me. more importantly, i want the information to be there.
sometimes it's very specific information; that's why we have google. i go look up a problem, and they give me back a list of pages with possible solutions. i ask it a question, and it gives me an answer. i can go to wolframalpha and enter anything from a population query to a molecular structure to the airspeed of a european unladen swallow, and it will give me back pretty much anything i'd ever want to know about it.
sometimes, it's more broad. some of the older linux distros would show every tiny detail about what it's doing during the boot process. if you switch to (or stay in) the cli interface, you get the same detail about many of the instructions you issue. i like that.
i played around with ubuntu 10.4, and it showed me a lot less of this information and then went to a login gui screen. sure, i can hit esc and see the behind-the-scenes details i was hoping for; but it goes to the pattern. that kind of detail is becoming a thing of the past. this level of detail, and the control that goes along with it, are the two best reasons to use linux.
of course, you can go into the whole religious/political argument about "fighting the man" or "fighting the power" and claim you use linux because you're some sort of new-age hipster, hippie, punk, whatever
Post.aspx?Title=On+the+Ongoing+Simplification+of+Operating+Systems+and+Other+Software
06/06/2011 04:08 PM -
hi, googlers!
if you get an odbcexception reading the driver has reached the maximum number of connections, you forgot to close your connections. wrap your calling method's connection in a using block, and remember to .close() the connection object before returning the result.
Post.aspx?Title=The+driver+has+reached+the+maximum+number+of+connections
06/04/2011 03:57 PM -
thursday night, i read a post on my uncle's blog about helping people in our own country before helping people in other countries. i've been saying this for years. funny how i tend to agree and get along with people decades older than i than i do with people my own age.
so after reading this post, i got motivated and decided to help some of the people around here. i considered for a moment: if i were homeless, what would i need the most? food, clean clothes (especially socks), and shelter. i assume the ones who have survived have found a source of clean water.
well, i'm not about to invite a bunch of total strangers into my home, given the troubles i've had in the past with roommates i knew and liked. how bad would it get with people i don't know at all? people whose personal habits are probably even more disgusting than my own?
i resolved to distribute some clothes and food to them. i went to wal-mart and picked up some brand new socks and t-shirts, along with some canned food. the kind of food that doesn't require a can opener to open, which doesn't need to be heated, and which doesn't go bad for a long time.
i organized these goods into evenly distributed packages to hand out to the homeless, and ventured out to find them. i thought to myself, "self, where does one find homeless people?". so i headed to the bad parts of town and started looking around in dark alleys and near railroad tracks. i looked near restaurants, which are likely to throw away food which is partially eaten but still good to eat. after a few hours of finding nothing, i decided to ask a local expert in hobos.
i pulled up next to a police car and asked the cop where the hobos hang out at night. he gave me a few locations and i went and searched there. i walked a mile up and down a few sets of railroad tracks, looking 100 feet or so off the sides. equipped with my bags of supplies and four-cell maglite, surely i'd find someone.
i walked and i walked, shining my flashlight in every direction, and saying in a loud voice "anybody want free food and clothes?". not a single reply was heard. eventually, my maglite died and i had to return to the car, as it doesn't seem safe to be wandering around pitch black railroad tracks with no flashlight.
i found another cop and asked again, "where all the hobos at?". i was directed to a park and a series of bridges. figuring i could easily see these areas by my headlights alone, i proceeded into said areas.
not one fucking hobo. by now it was 5 a.m. and i had to be at work in three hours, so i headed home for a quick nap.
after work friday i was planning to go look again during daylight, but my altruistic endeavor was preempted by a call from a friend who wanted to hang out. his schedule allowing for about six hours' free time a month, i decided to oblige. the supplies sitting in my car weren't exactly going to go bad after two days.
today, saturday, i awoke, had a hearty breakfast, and ventured out to see my plan to fruition. i established a standard search grid to find the homeless people in areas where i've seen them with signs in the past. i looked on roadsides, in the same areas as thursday night, and even walked along some riverside pathways that went under bridges.
not one fucking hobo. not one.
finally, several hours later, i gave up. either people are finding jobs and getting homes, or they don't want to be found. i went to the nearest catholic church and dropped the supplies off. now i can only hope they do some good.
this was a major disappointment to me. i wanted to give the food and clothes directly to the people who needed them. i wanted to see how happy they were and shake their hands. most importantly, i wanted to be certain that no organization was going to take any off the top. this is why i never donate cash.
i choose to take my failure as a good sign; a sign that the economy is indeed recovering, and that there are fewer and fewer homeless out there. either that, or they don't want to be found. if that be the case, then so be it. i did what i could.
Post.aspx?Title=On+Helping+the+Homeless+-+Locally