Friday, December 19, 2008
Monday, October 13, 2008
It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level
This error popped up for me when I had accidentally added some websites below my main website. This is caused by settings in the web.config's of lower subdirectories having settings that can only be on the main config's file. Settings of this type include authentication, session state.
I have heard rumor that you can leave those there by marking the folder in the following way, but I have not needed it so I cannot be sure:
Right Click on the virtual directory - select properties and then click on
"Create" next to the "Application" Label and the textbox. It will automatically create the "application" using the virtual directory's name. Now the application can be accessed.
Hopefully this is helpful to others who get an extra web.config in their subdirectories though.
Wednesday, October 8, 2008
<span style="max-width: 100px;" ><xsl:value-of select="subjecttrunc"></xsl:value-of>
Yep you see it it is as easy as adding those tags <xsl:text> </xsl:text> with a space between them of course.
Now I just need to solve showing multiple spaces, so far that has eluded me because multiple of these together still results in one space.
How many savage (like island cannibals) 50-60 lb. kids could you take out (immobilize permanantly or kill) before you were overrun? Assuming there is a limitless amount, you are surrounded by said limitless amount (fleeing would do no good), and they do not have to wait for a 1 on 1 fight.
I thought about this because a 2 year old 60lb pitbull would take me to town probably, but a 60 lb kid despite weight just isnt the champion a 60lb pitbull is.
Tuesday, October 7, 2008
Monday, October 6, 2008
Friday, October 3, 2008
- to learn to play guitar mo'better
- to learn to throw knives (or so other equally cool projectile)
- to get Mario Kart for the Wii
- to get the Jedi game for the Wii (one with swords)
- to finish my stupid massive website idea and have it come to full fruition so I can be like I did that and its cool.
- to learn to scuba dive.
Wednesday, October 1, 2008
Tuesday, August 5, 2008
It might just be me but for a while I found dates confusing. Without a calendar I was lost, I still am, but I have resolved to do something about it. Thus I blog and hopefully ingrain it in my brain and maybe share some useful tools to others wonder about the topic. The thing I find most useful is the day of the week calculation. I find myself wondering "How do I calculate the day of the week? 18 days out, 19, 43???" So here is my attempt at overcoming it. Something they never taught us in school eh?
Any odd month before and including July has 31 Days, after that it is every even month including August. February is the outcast with 28 or 29 days depending on the leap year.
The easiest way I have found to Master the day of the week problem is making sure you know the days a month has. Then imagine the week as a 0 based enumeration (Sunday is 0 add 1 for each day up to Saturday 6.)
Todays Date is Tuesday, August 5, 2008
- Take the current day, Tuesday, which would be 2.
- Keeping in mind the month's number of days choose the day you need out there. Sept 7th.
- 31 - 5 means 26 days left in August, Plus the 7 days into September = 33.
- Now add 33 + 2 (current day of the week) = 35. Now divide 35 by 7 = 0. Which would be Sunday. The remainder is the day of the week from the enumeration, Sunday is 0.
Here is the enumeration in case its confusing:
- 0 - Sunday
- 1 - Monday
- 2 - Tuesday
- 3 - Wednesday
- 4 - Thursday
- 5- Friday
- 6 - Saturday
I know this is random, but I just found it interesting.
Wednesday, June 18, 2008
Al Finkerton, Street Aristocrat, is enticed by a seductive pie at a Bus Stop.
One of my friends, Dax Norman, is a graphic designer who just got his masters at Ringling. This was his thesis animation, careful it is not for those with a weak stomach, it is amazing what can be done with 3D animation these days. Congratulations Dax this is awesome. Now one day when I invent my awesome game programming company I can dominate the world! (with a great graphic designer!) I just have to rip him away from those white Ipod/Iphone toting Apple weirdos. (Props to him getting a job at Apple ... Wait a second where is my Apple hookup?!) I got a DVD copy with full DVD case featuring Finkerton, the main character, along with the town as a backdrop. If you look closely you will see a sign that says, "Swee-atch" this is the invention of Dax I think anyway I find myself swapping it in often for "Sweet" lately so I thought I would give credit where credit is due. I give it two thumbs up. The title I hope you notice is a play on "The Last Temptation of Christ." A closing comment is I have never seen such a tasty bandage. You can check out some of Dax's art I really like it, I do not know if you can buy any of it, he is mostly in animation of course.
|Fresh ground beef, veal, lamb, pork||160°F||71°C|
|Beef, veal, lamb roasts, steaks, chops: medium rare||145°F||63°C|
|Beef, veal, lamb roasts, steaks, chops: medium||160°F||71°C|
|Beef, veal, lamb roasts, steaks, chops: well done||170°F||77°C|
|Fresh pork roasts, steaks, chops: medium||160°F||71°C|
|Fresh pork roasts, steaks, chops: well done||170°F||77°C|
|Ham: cooked before eating||160°F||71°C|
|Ham: fully cooked, to reheat||140°F||60°C|
|Ground chicken/turkey||165° F||74°C|
|Whole chicken/turkey||180° F||82°C|
|Poultry breasts, roasts||170° F||77°C|
Wednesday, June 11, 2008
And go, “Sweet cheese who came up with that syntax, I think if I could write a compiler I would come up with something more elegant than that load of crap.” I do.
For i As Integer = 0 To msgids.Length - 1
‘Do some crap
I hate the for loops in VB, they are something totally different and crappy than any other for loop I have crossed in my life. I was thinking about this while coding and just had to share and see if anyone else out there agrees. VB.NET For loops go like this:
For i As Integer = 0 To msgids.Length - 1
'Do some crap
The "To" is just so dumb, so assumptive and stupid! Now lets look at C++ derived for loops.
for(int i = 0; i < msgids.Length; i++)
//Do some crap
(In case it stays like that pretend < is actually a less than sign /shrug)
Is it just me or is the C++ style so much more elegant and so much more clear. You do not have to make assumptions you know that what we compare to each time is i but you also know you could change that at anytime to be j*i or whatever, robust and clear vs. odd and assumptive.
Rant over and out.
Tuesday, June 10, 2008
This is obviously an Intro to Ajax type situation. This is not a big class but a simple method to do an XMLHttpRequest. You could write a larger overarching Ajax framework, but this example shows the basics behind it.
The script I used is this:
This is the script to make the actual sender, it takes into account the different browsers we might have to accomodate.
XMLHTTP VAR Code:
(!xmlhttp && typeof XMLHttpRequest!='undefined')
xmlhttp = new XMLHttpRequest();
if (!xmlhttp && window.createRequest)
xmlhttp = window.createRequest();
function run(i , j, element)
//This grabs the element name we passed which when we remove we are hiding
element = element + "";
//The URL of the aspx page that is going to accept this request and
// delete the relation in the database
//The meat! We use the xmlhttp from the code that creates it way above
//We are using the "GET" method, sending it the URL, and true means asynchronous response.
// this is not sending the request just creating the object, we send further down.
// Now we defie an function to handle when the status of the XMLHttp object changes.
// ReadyState = 4 means all done
//Read the response text, In my case I am only returning
// false when the backend was unable to process the move
// so we should probably have an else to show failure but I didnt do that yet:)
if(xmlhttp.responseText == "false")
document.getElementById(element).style["visibility"] = "hidden";
//I tell the backend that this is a form
// I send the request
Now if you are anything like I was when I started off down this path you might be wondering, well wtf does remove.aspx do??? I will show you that too but if you only cared about the java you are done :).
This is the only function in Remove.aspx and all it does is send back the exceptions/"" or the word false if it was executed successfully.
So this is sort of a way to give yourself utility function calls with no UI problems. Technically this might be mixing UI and Business logic but the sheer power it provides is just too powerful to pass up.
protected void Page_Load(object sender, EventArgs e)
cret ret = new cret();
if (Request.QueryString["pid"] != null && Request.QueryString["cid"] != null && Int32.TryParse(Request.QueryString["pid"], out parentid) && Int32.TryParse(Request.QueryString["cid"], out childid))
Response.ContentType = "text/plain";
ret = DBData.removeParentalLink(parentid, childid);
If there are any questions or comments feel free.
Monday, June 9, 2008
Wednesday, June 4, 2008
So we have conflicting goals:
- Open and close DB connection as little as possible
- Break up long functions into smaller callable functions (so that adding relations for instance can be called without adding two or even one object to relate)
My ultimate solution to this quandary:
- Public static MySqlConnection in the DBData Class which can be referenced within each function and its state can be checked and maintained (if you opened it you close it, if it was open you leave it)
Thursday, May 29, 2008
Interesting introduction or refreshment on Java. Provides little programming problems and runs test cases against your function to make sure its doing what it is supposed to. These are nice little teasers especially towards the complicated side that you don't normally have to face but give you some good insight.
Wednesday, May 28, 2008
delete Table_1 A
(select * from Table_1 B where A.field_1 = B.field_1 and A.field_2 = B.field_2 and A.field_3 = B.field_3 and A.field_4 = B.field_4 and A.id > B.id)
Thursday, May 22, 2008
I found it very useful so I want to propagate it. I found a need for it while transferring my site from vb.net to C#.
After creating an ASP.NET web form using Microsoft Visual Studio 2005 Team Suite, I renamed the form from it's default name "Default.aspx" to a more user-friendly name "Order.aspx" within MS VS. After adding more code to the C# code-behind page, I discovered the following line: "public partial class _Default"
Being new to the ASP.NET programming language, I changed the "_Default" to "Order" thinking MS VS had failed to rename items within the code it generates. This caused the following error to display at debug/run time: "GetTypeHashCode() : no suitable method found to override"
There were several other errors displayed as well.
The class names must match between the .aspx and .aspx.cs web pages. Here is what the lines in each file should look like:
In the ASPX source file: %@ Page Language="C#" codefile="FormName.aspx.cs" Inherits="FormName_aspx" %
In the ASPX.CS source file: public partial class FormName_aspx : Page
Once I changed the .ASPX file to match the class name in the .ASPX.CS file, the errors were resolved.
Thursday, May 8, 2008
Monday, April 28, 2008
Tuesday, April 22, 2008
Monday, April 21, 2008
Friday, April 18, 2008
Tuesday, April 15, 2008
Some more screwing around with regex more has made me realize I have overcomplicated capture replacement, it is a simple as using a replace and just throwing in the $1, etc into the Regex.Replace functions replace string. I mean what I do works but it is totally unnecessary so I thought I would throw that out there. Apparently they already though of that when they did replace, I wonder why they didnt think of the tristate check treeview since a checkbox can be tristate. Sometimes it is better not to ask why!
The way I did it works well enough but you can see how it could be done below without a temp variable, and it is a little less confusing than using Regex.Result.
Anyway I thought I should share my ignorance, and enlightenment.
ElseIf cbRegEx.Checked = True AndAlso System.Text.RegularExpressions.Regex.IsMatch(txtfind.Text.ToLower, cmbFind.Text) Then
If System.Text.RegularExpressions.Regex.IsMatch(txtfind.Text.Substring(txtfind.SelectionStart, txtfind.SelectionLength), cmbFind.Text) Then
'Smarter, less lines System.Text.RegularExpressions.Regex.Replace(txtfind.Text.Substring(txtfind.SelectionStart, txtfind.SelectionLength), cmbFind.Text, cmbReplace.Text)
'Dumber Many more lines, except the highlighting which is needed
Dim mc As System.Text.RegularExpressions.Match
mc = System.Text.RegularExpressions.Regex.Match(txtfind.Text.Substring(txtfind.SelectionStart, txtfind.SelectionLength), cmbFind.Text)
temprep = cmbReplace.Text
Dim templen As Integer = txtfind.SelectionLength
txtfind.Text = txtfind.Text.Remove(tempstart, templen)
txtfind.Text = txtfind.Text.Insert(tempstart, temprep)
txtfind.SelectionStart = tempstart
txtfind.SelectionLength = temprep.Length
pastend = FindIt()
pastend = FindIt()
Monday, April 14, 2008
One of the coolest web development tools I have seen. Firebug is a firefox add-on that gives you insane website visualization abilities right inside of fire fox. Want to see what that menu would look like unbolded and a different color, its as easy as going to the firebug CSS tab and clicking those CSS features off. I have to say I am super impressed just looking at the highlighting alone will amaze you. Given you should probably not design everything for firefox, but jeez this is a powerful tool. http://www.getfirebug.com/
I forgot to mention, its free. And it allows you to look at any sites inner workings, it is really nice. So you can see how that great site did its design, very cool.
Sunday, April 13, 2008
My arms look allot like this guys. This weekend was a lesson why as a coder (usually a dark, yet monitor lit, room dweller) you should not go off on a whim and ride a bike 60+ miles on the sunniest day Oregon has had all spring. I think it should be a lesson to all coders do not let your loved ones convince you to do crazy things like riding 60 miles in training for riding 100 miles. Some will try to throw out the snarky "Heard of Sunblock?" line, but I am a man dangit. I am not wearing no sissy sun block, me and this guy to the left says so. Luckily my arms usually mist over into a tan, I doubt the guy left can say the same.
On the plus side it was fun to ride 60 miles and be like , I did that I went how far I go in a car in one hour, the same distance in 5-6 hours ... ok it does not sound good when you say it that way ... but I have no combustion engine and did it, there that sounds better. The only bad thing is when you are out 15 miles from no where and go "Geez ... if I hit a piece of glass I am screwed because I did not bring an extra tube." It would suck to walk 15 miles to No Where (Dayton, OR) and try to find a tube there. I am not kidding about it being no where, they do not have a single chain restaraunt, and the only stoplight in town is just a blinking light. Careful also the only restroom in the park is a Honeybucket with some suspect liquid puddling in the bottom of the floor. Laters.
Friday, April 11, 2008
The bottom line to the
Thursday, April 10, 2008
My latest tool, Standalone Find/Replace in VB.NET, to be added on anywhere (including your and my existing projects!) It is a simple standalone find replace form which uses a reference to a object to search it. You will probably only find this useful if you, like I, have to accommodate higher end users doing text editing (usually REGEX stuff in my case.) It is also a good example of leveraging Regex better than many I have seen elsewhere so I thought I would share it. It could be easily ported to C# using SharpDevelop.
It currently accepts the reference to a listview or textbox (with the idea of leaving room for other items I may find useful in the future) and finds text normally or using REGEX matching (.NET regexs, Rock on.)
I have not implemented the replace in the listview because I myself display tables or objects using a listview, but the listview is just to give the user an idea of what is going on in the object behind the scenes and editing the listview will have no effect on the object (unless you wanted to write a listview to object backward conversion for everything you do). Therefore, if you want it to work on your own objects you would have a code that in on your own, and if you want it to replace in listviews you will have to do that too! (unless I suddenly find the need) I think the find option alone on a listview is great though. The "Include subitems" checkbox is listview specific to be able to search all columns or not, optionally.
I got most of the motivation for the GUI from EditPlus a great text editing program which also has a powerful regular expression find replace built in I highly suggest it.
- Include Subitems - As I said above this checkbox makes it where you can search all columns of a listbox instead of just the first, though you can turn it off when you are only concerned about the first column (or text) of the listviewitems.
- Use Regex - makes the top box search by regular expression and has the bottom box replace by regex one of the great options is you can capture in the top area and then put those back in with $1, $2, $3, etc.
- For instance (This is a bit complex but most would probably get it):
- Topbox: (ab)(c) Bottom box: $2$1 Text found: abc Changed to: cab
- Topbox: (http://)[^\.]+(\.[^/]+/) Bottom Box: $1technage$2 TextFound: http://www.blogger.com Changed to: http://technage.blogger.com
- Search Up - Changes from searching in the downward direction to searching in the upward direction.
It contains a great use of MatchCollection.Result() which handles the reinsertion of the captures.
I can do some more chatting and example giving but for now I want to throw it out there and see if anyone has questions or is interested.
Sorry for the crudeness of the textboxes below, but I do not have a real place to host the files except on this blog. And due to the fact these are very small I just put them down there in the text areas to be copied out. If that is too annoying I can add them in a pre.
The codes I have published below are a great example for why one should have a replacer like this because the carriage returns in normal code for VB.NET are resulting in <br />'s to be placed in the code. I assume its a blogger bug, but if anyone knows a great trick to fix it that would be great I looked at some of the FAQ and the groups discussion no one had a definitive way to fix the problem except for removing the carriage returns, but for proper coding format that is the dumbest idea ever. Do people actually use Textarea for something other than displaying code???
NOTE: So use the tool to fix the code once you have compiled it, have it replace the double tabs (\t\t) with a single newline (\n) in regex mode. That should make it pretty again.