Exploring the depths and potentials of ASP.NET RSS 2.0 or Subscribe to .BenRush by Email
 Friday, March 10, 2006

    I discovered this, probably someone else out there might find it interesting.....but, it's a bad idea to have several round-trips to the database when you want to insert many records (rows). It would be nice to build an array of values to insert with one statement. This can be done easily using ADO.Net:

                comm.CommandText = "insert into blah_lnk (asdf,asdfasdf) values (:1,:2)"
                comm.ArrayBindCount = <array_length>

                Dim id_arr(<array_length>-1) As System.Int32
                For c As System.Int32 = 0 To id_arr.Length - 1
                    id_arr(c) = CType(Session("asdfasdf"), System.Int32)
                Next

                Dim orap As New Oracle.DataAccess.Client.OracleParameter("1", OracleDbType.Varchar2)
                orap.Value = id_arr
                orap.Direction = ParameterDirection.Input
                comm.Parameters.Add(orap)

                Dim orap2 As New Oracle.DataAccess.Client.OracleParameter("2", OracleDbType.Varchar2)
                orap2.Value = arr.ToArray()
                orap2.Direction = ParameterDirection.Input
                comm.Parameters.Add(orap2)

                comm.ExecuteNonQuery()

...anyway, the idea is that you can execute the statement on the array, and allow yourself only one round-trip to the database. I'm not a DB programmer, so this is probably well known, but I didn't know it....


kick it on DotNetKicks.com
Friday, March 10, 2006 2:14:51 AM (Central Standard Time, UTC-06:00)  #    Comments [4] - Trackback
Computing
 Thursday, March 09, 2006

    It was literally cataclysmic...

    I took a long walk tonight - I love walks, there's something about them that can really clear a person's head. I was rolling thoughts around in my head, thinking through things pretty deeply as I often times do. I looked up and saw a street sign that I had seen a hundred times before that suddenly took on a whole new meaning under the cloud of thought I currently had, it said "Keep Right". Suddenly all these desparate thoughts in my mind came together in what felt like a supernova explosion of insight - and I suddenly saw why burnout happens and how people can prevent it. On the same token I realized I had also seen what motivates people to carry on and accomplish things that seem, to many of us, super-human. It all made sense suddenly - I hope you feel the same way....

    But I digress - first, what is burnout? Burnout is, quite simply - a feeling of hopelessness and dispair: you feel loss of control, loss of hope and loss of energy. When burnout happens, you are burned out of the energy that allows you to be actualizing - to get done things, and to be kinetic. The opposite of burnout is energized and focused, it's that state you're in when you can work for hours and hours, go to bed, wake up, and be energetic about "working" again. The opposite of burnout is this passion. Someone who has burned out before (like me) would know that it's one of the most depressing feelings in the world to have, and that it can be straight-up frightening. You see the world in front of you, but it lacks the depth it did before - the possibilities are gone, you just feel there...nothing more.

    You see, life is somewhere around 100% psychological - there is always a level of abstraction regarding our emotions and feelings and reality itself - reality is rarely the thing that causes angst or anxiety or depression, but our reaction to it; or, as Dr. Albert Ellis would say, "The best years of your life are the ones in which you decide your problems are your own. You do not blame them on your mother, the ecology, or the president. You realize that you control your own destiny." If you fear burnout or if you feel under-energized or under-focused, you fear or are experiencing something that is quite literally within your own control, it's not something external to you - it's still totally and wholly under your power. "But energy is not something I can just switch on" you might say - and this is true, it's not something that you can switch on because this opposite of burnout, this energy you might desire, is a side-effect of something else; and focusing on it (or your lack of it) will cause even more problems as you start to feel dispair. Alright....

    ....it is the belief, the feeling, the strong faith you have in yourself that you, or those around you, have a special insight and are right (and the 'others' are wrong) about doing something or the way of doing something that prevents you from burning out. So, in a sense - it's your ability to keep "right" that will keep you going. It is this belief in you're right'ness that also motivates you to pull the long hours, to push the envelope and to accomplish things that most people think impossible. So much is possible by each of us, though, because so much that is seen as impossible is psychological from the get-go; the impass or wall isn't real. If you look back on younger days when you were filled with energy (really think about those days) you probably knew that you were right and everyone else (or most everyone else) was wrong - you were out to prove how right you were and believed so much in yourself and your cause that you took on feets that, in later years, you wonder how you ever accomplished. It is also the ability to do "right" that gives us a feeling of accomplishment and honor - so that when we feel like we have no aim, it's really because we have no idea of the "right" we want to stand for and get....

If you feel like you are on the edge of your last bit of energy - ask yourself if you really believe in what you're doing; and if not, ask why you're still doing it. What's worth something to you in this world is worth doing. That's what keeps you moving.

Anyway....my hero (in case you haven't already realized it) is Richard Feynman. I'll end with a quote of his:

"In the physics, one of the things I have to do in trying to surmount one of these apparently insurmountable problems that all the other guys are also working on [...], I have to think that I have some sort of inside track, that I'm thinking of a way that they're not thinking of. [...] I fool myself into thinking that I have an inside track, or that I have some special mathematical trick that I'm going to use which they don't have, or some kind of a talent, a way that I'm going to do it [...]. I appreciate the possibility that it is in indeed an illusion, but I don't bother myself about that - I work myself up into thinking I'm on that inside track."


kick it on DotNetKicks.com
Thursday, March 09, 2006 10:39:07 PM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
Ranting

....then don't hard-code your connection strings into the data source control. For example, rather than writing:

    <asp:SqlDataSource ID="SqlDataSource_Checkbox" runat="server" SelectCommand="select friendly_rolename from roles"
        ConnectionString="Data Source=blah;Persist Security Info=True;User ID=blah;Password=blahblah" ProviderName="Oracle.Data.DataClient">
    </asp:SqlDataSource>

...place everything in a web.config file and do this instead:

    <asp:SqlDataSource ID="SqlDataSource_Checkbox" runat="server" SelectCommand="select friendly_rolename from roles"
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>">
    </asp:SqlDataSource>

If I see another instance of someone thinking "no code" means "no brains" and copy a damn connection string to forty places in the declarative statements, I'm going to scream....


kick it on DotNetKicks.com
Thursday, March 09, 2006 11:55:38 AM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
Computing

....someone created an interesting post reflecting on his experience with Expression. Read it here.


kick it on DotNetKicks.com
Thursday, March 09, 2006 1:45:42 AM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
Computing

.....check this out if you're interested in Gadgets.


kick it on DotNetKicks.com
Thursday, March 09, 2006 1:40:16 AM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
Computing

Excuse me 'mam, would you mind helping me with my furry lobster?


kick it on DotNetKicks.com
Thursday, March 09, 2006 12:57:39 AM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback

 Wednesday, March 08, 2006

...sometimes I hear people talk about not writing any code to get something accomplished, particular in respect to binding a control to a datasource. They say something like, "...and it took no code to write". For the longest time I was very leery of this particular statement because, often, code is still required. The idea of simply dragging and dropping something and simply expecting it to work seemed bad to me. But, I'm starting to see things a bit differently (but not as I thought I would have had to in order to completely agree with these people).

...first, let's re- (or more clearly) phrase "...and it took no code to write" to "....and it took me, personally, no code to write", and even more precisely "...and it took me,personally, less code to write". There will always be code whenever there is a need to specialize something; and regardless - somebody, SOMEWHERE had to write code (which, again, means bugs). The benefit, however, is that it was written and tested many, many times over - your code, however, rarely is.

The reason why you can never say NO code is because, even when you're jumping through a wizard, you still are required to insert SQL statements, or piece together various statement fragments that eventually combine to offer the solution. This, in a sense, is still code - just declarative and not VB.Net or C# or whatever. It lacks algorithmic fortitude, I guess - but there is still CODE.

Anyway, I'm sure you've read through it before, but check out this article by Dino. Try doing some of this stuff and see how it doesen't prevent code, but simply forces you to think more about the code that you do, eventually, write.


kick it on DotNetKicks.com
Wednesday, March 08, 2006 5:01:51 PM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
Computing

    ....I have a thing for the Simpson's. Check out this page of Homer quotes. Serious blast from the past.


kick it on DotNetKicks.com
Wednesday, March 08, 2006 12:31:09 PM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
Personal Adventures

Computers Blogs - Blog Top Sites

Archive
<March 2006>
SunMonTueWedThuFriSat
2627281234
567891011
12131415161718
19202122232425
2627282930311
2345678
Blogroll
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2009
Benjamin Rush
Sign In
Statistics
Total Posts: 444
This Year: 0
This Month: 0
This Week: 0
Comments: 128
Themes
Pick a theme:
All Content © 2009, Benjamin Rush
DasBlog theme 'Business' created by Christoph De Baene (delarou)