instruction
stringlengths
0
30k
|database|logging|instrumentation|
Jeff mentioned in one of the podcasts that one of the things he always does is put in instrumentation for database calls, so that he can tell what queries are causing slowness etc. This is something I've measured in the past using SQL Profiler, but I'm interested in what strategies other people have used to include th...
Globus Toolkit virtual machine
|linux|globustoolkit|virtual-machine|
Is there anyplace where one can download a virtual machine containing a working install of some Linux distro with Globus Toolkit and some development tools (Java) for testing purposes? A real deployment of a grid is more complicated but I just need something portable, for development.
|linux|globus-toolkit|virtual-machine|
I work with web and winforms apps in c# and I **HATE** triggers with a passion. I have never come across a situation where I could justify using a trigger over moving that logic into the business layer of the application and replicating the trigger logic there. I don't do any DTS type work or anything like that, so ...
I'm not a fan, personally. I'll use them, but only when I uncover a bottleneck in the code that can be cleared by moving actions into a trigger. Generally, I prefer simplicity and one way to keep things simple is to keep logic in one place - the application. I've also worked on jobs where access is very compartmenta...
> I think if you have to use nullable > types, it's better to use Nullable<.T> > rather than the question mark > notation. It makes it eye-achingly > obvious that magic is occurring. Not > sure why anyone would ever want to use > Nullable<.bool> though. In a VB.Net Web-Service where the parameter might not be ...
I find myself bypassing triggers when doing bulk data imports. I think it's justified in such circumstances. If you end up bypassing the triggers very often though, you probably need to take another look at what you put them there for in the first place. In general, I'd vote for "they serve a purpose in some sce...
How do I restyle an Adobe Flex Accordion to include a button in each canvas header?
Jeff mentioned in one of the podcasts that one of the things he always does is put in instrumentation for database calls, so that he can tell what queries are causing slowness etc. This is something I've measured in the past using SQL Profiler, but I'm interested in what strategies other people have used to include th...
An important note is that using vendor SQL queries to retrieve the last inserted ID are safe to use without fearing about concurrent connections. I always thought that you had to create a transaction in order to INSERT a line and then SELECT the last inserted ID in order to avoid retrieving an ID inserted by another...
[http://www.checkupdown.com/status/E503.html][1] > Your Web server is effectively 'closed for repair'. It is still functioning minimally because it can at least respond with a 503 status code, but full service is impossible i.e. your Web site is simply unavailable. There are a myriad possible reasons for this, but gen...
At least for MS VC++, the C Runtime library has several functions that I've found helpful in the past. Check the MSDN help for the `_Crt*` functions.
Managing/Using libraries with Debug builds vs Release builds
|untagged|
I'm curious about everyones practices when it comes to using or distributing libraries for an application that you write. First of all, when developing your application do you link the debug or release version of the libraries? (For when you run your application in debug mode) Then when you run your app in releas...
Customize the Sharepoint add list column page
|sharepoint|list|
I have defined a custom Sharepoint list for special attributes related to a software application inventory and installed it as a feature. I also want to group these attributes in categories. How could I change the Sharepoint page that allows the user to add a column to a list, so that when the user adds a column to my ...
I like having methods instead of just using public fields, as well, but my problem with PHP's default implementation (using __get() and __set()) or your custom implementation is that you aren't establishing getters and setters on a per-property basis. My problem with this is that adding "more logic later" requires that...
SELECT page.content, COUNT(pageTag.tagID) AS tagCount FROM page INNER JOIN pageTag ON page.ID = pageTag.pageID WHERE pageTag.tagID IN (1, 3, 8) GROUP BY page.content ORDER BY tagCount DESC
select page.content, count(pageTag.tagID) as tagCount from page inner join pageTag on page.ID = pageTag.pageID where pageTag.tagID in (1, 3, 8) group by page.content order by tagCount desc
select page.content, count(pageTag.tagID) as tagCount from page inner join pageTag on page.ID = pageTag.pageID where pageTag.tagID in (1, 3, 8) group by page.content order by tagCount desc That gives you the number of tags per each page; ordered ...
As someone with experience in both FORTRAN (77 flavor although it has been a while since I used it seriously) and C/C++ the item to watch out for that immediately jumps to mind are arrays. FORTRAN arrays start with an index of 1 instead of 0 as they do in C/C++/Java. Also, memory arrangement is reversed. So incremen...
UNION will remove duplicates, so just UNION the two together, then search for anything with more than one entry. Given "code" as a primary key, you can say: select dt.* from data_tbl dt ,( select code from ( select * from feed_tbl union select ...
UNION will remove duplicates, so just UNION the two together, then search for anything with more than one entry. Given "code" as a primary key, you can say: *edit: modified to include differences in the PK field itself* select dt.* from data_tbl dt ,( select code from ...
You can use the Image.GetThumbnailImage function to do it for you. http://msdn.microsoft.com/en-us/library/system.drawing.image.getthumbnailimage.aspx (.NET 3.5) http://msdn.microsoft.com/en-us/library/system.drawing.image.getthumbnailimage(VS.80).aspx (.NET 2.0) public bool ThumbnailCallback() { ...
The C# ?? null coalescing operator - Not really hidden, but rarely used. Probably because a lot of developers run a mile when they see the conditional ? operator, so they runt two when they see this one. Used: string mystring = foo ?? "foo was null" rather than string mystring; if (foo...
Is it worth it to learn a dialect of assembly?
|education|
My goals are focused on software application development, and maybe web application development, but most likely desktop applications. I'm embarking on a path to becoming more familiar with C/C++, but should I go much lower than that, into assembly? Or would I not have a benefit for my long-term goals?
I wouldn't start learning ASM. If you want to learn C/C++ then start with that. As the quality of your code matures, you may find you have a need for ASM. 99% of the time you won't, but every now and then you might need it. Also, it does help to know ASM in terms of understanding what C/C++ is doing behind the scene...
GetThumbnailImage would work, but if you want a little better quality you can specify your image options for the BitMap class and save your loaded image into there. Here is some sample code: Image photo; // your uploaded image Bitmap bmp = new Bitmap(resizeToWidth, resizeToHeight); graphic = Graphics...
For all of you who believe the myth that temp variables are in memory only First, the table variable is NOT necessarily memory resident. Under memory pressure, the pages belonging to a table variable can be pushed out to tempdb. Read the article here: [TempDB:: Table variable vs local temporary table][1] ...
How do I change the locations of source files in a symbols file (pdb)
|sharepoint|list|
I know of two things you can do but they don't always apply to all situations. 1. You're going to get better performance if you're using absolute positioning for each control (myNewlyCreatedButton.Location.X/Y) as opposed to using a flow layout panel or a table layout panel. WinForms has to do a lot less math trying...
I know of two things you can do but they don't always apply to all situations. 1. You're going to get better performance if you're using absolute positioning for each control (myNewlyCreatedButton.Location.X/Y) as opposed to using a flow layout panel or a table layout panel. WinForms has to do a lot less math trying...
There's no standard way to do it (just as there is no standard way to create auto-incrementing IDs). Here are two ways to do it in PostgreSQL. Assume this is your table: CREATE TABLE mytable ( id SERIAL PRIMARY KEY, lastname VARCHAR NOT NULL, firstname VARCHAR ); You can do it in two...
You have basically experienced Visual Studio giving up. It gives up for many reason, the page is too complicated to highlight which is usually because there are too many syntax errors. The highlighting is done with some very complicated and intelligent RegEx statements essentially, however if Visual Studio is unable ...
In SQL Server 2005, go to tree view on the left and select Server (name of the actual server) > Management > Activity Monitor. Hope this helps.
on 2000 you can use sp_who2 or the dbo.sysprocesses system table on 2005 take a look at the sys.dm_exec_sessions DMV below is an example SELECT COUNT(*) AS StatusCount,CASE status WHEN 'Running' THEN 'Running - Currently running one or more requests' WHEN 'Sleeping ' THEN 'Sleeping - Currently runn...
I use [Textmate][1] (Mac only) which has Code folding and I find it really useful for folding functions, I know what my "getGet" function does, I don't need it taking up 10 lines of oh so valuable screen space. I never use it to hide a for loop, if statement or similar unless showing the code to someone else where I...
This was talked about on [Coding Horror][1]. My personal belief is that is useful, but like anything in excess can be too much. I use it to order my code blocks into : <br>Enumerations <br>Declarations <br>Constructors <br>Methods <br>Event Handlers <br>Properties [1]: http://www.codinghorror.com/blog...
I personally use #Regions all the time. I find that it helps me to keep things like properties, declarations, etc separated from each other. This is probably a good answer, too! [Coding Horror][1] [1]: http://www.codinghorror.com/blog/archives/001147.html Edit: Dang, Pat beat me to this!
The size of the file is sent as the Content-Length header. Here is how to get it with urllib: site = urllib.urlopen("http://python.org") meta = site.info() print meta.getheaders("Content-Length")
The size of the file is sent as the Content-Length header. Here is how to get it with urllib: >>> site = urllib.urlopen("http://python.org") >>> meta = site.info() >>> print meta.getheaders("Content-Length") ['16535'] >>>
Using the returned-urllib-object method `info()`, you can get various information on the retrived document. Example of grabbing the current Google logo: >>> import urllib >>> d = urllib.urlopen("http://www.google.co.uk/logos/olympics08_opening.gif") >>> print d.info() Content-Type: image/gif ...
Also if the server you are connecting to supports it, look at [Etags][1] and the [If-Modified-Since][2] and [If-None-Match][2] headers. Using these will take advantage of the webserver's caching rules and will return a [304 Not Modified][3] status code if the content hasn't changed. [1]:http://en.wikipedia.org/...
SSL itself doesn't have any limitations, but there are some practical limits you may be running into: - SSL connections require more resources on both ends of the connection, so you may be hitting some built-in server limit. - TCP/IP uses a 16-bit port number to identify connections, only some of which (around 16...
Automate Deployment for Web Applications?
|.net|php|deployment|web-applications|
My team is currently trying to automate the deployment of our .Net and PHP web applications. We want to streamline deployments, and to avoid the hassle and many of the headaches caused by doing it manually. We require a solution that will enable us to: - Compile the application - Version the application wi...
take a look at Martin Fowler's [Patterns of Enterprise Application Architecture][1]: - [Single Table Inheritance][2] - [Class Table Inheritance][3] - [Concrete Table Inheritance][4] [1]: http://www.martinfowler.com/eaaCatalog/ [2]: http://www.martinfowler.com/eaaCatalog/singleTableInheritance.html ...
This might not be what the OP meant to ask, but I thought I might throw this in here. I recently had a unique case of db polymorphism in a project. We had between 60 to 120 possible classes, each with it's own set of 30 to 40 unique attributes, and about 10 - 12 common attributes on all the classes . We decided to...
This might not be what the OP meant to ask, but I thought I might throw this in here. I recently had a unique case of db polymorphism in a project. We had between 60 to 120 possible classes, each with its own set of 30 to 40 unique attributes, and about 10 - 12 common attributes on all the classes . We decided to go...
UNION will remove duplicates, so just UNION the two together, then search for anything with more than one entry. Given "code" as a primary key, you can say: *edit 0: modified to include differences in the PK field itself* *edit 1: if you use this in real life, be sure to list the actual column names. Dont use d...
SQL Server is a Windows app. Novel is either one of: Novell or Linux Neither of these are windows :) It's like asking "why can't I run this Mac application on my windows box". Or "why will my petrol car not run on diesel?" There are old version of Sybase, which SQL Server sprang from, which COULD run on Nove...
A clarification about the *"obj.getClass() != getClass()".* This statement is the result of equals() being inheritance unfriendly. The JLS (Java language specification) specifies that if A.equals(B)==true then B.equals(A) must also return true. If you omit that statement inheriting classes that override equals() (an...
It's best practice *never* to use C-style casts for two main reasons: * as already mentioned, no checking is performed here. The programmer simply cannot know which of the various casts is used which weakens strong typing * the new casts are intentionally visually striking. Since casts often reveal a weakness in th...
Maven2 all the way; has an Eclipse plugin called [m2eclipse][1] to help with managing it, solves exactly the dependency problem and then some. Has a [free online book as documentation][2]. Specifically look at [multi-module projects][3] for bundling many components together and have Maven work out the build order an...
'www.example.com' is the default host as set in ActionController::Integration::Session >> ActionController::Integration::Session.new.host => "www.example.com" It is set in actionpack/lib/action_controller/integration.rb#75 You should be able to change it in your integration test by doing the following...
What you want can be achieved using dependency injection. For example [Microsoft Composite UI app block][1] does exactly what you described [1]: http://msdn.microsoft.com/en-us/library/aa480450.aspx
Using IIS6, how can I place files in a sub-folder but have them served as if they were in the root?
|asp.net|iis-6|url-rewriting|
Our ASP.NET 3.5 website running on IIS 6 has two teams that are adding content: a development team adding code and a business team adding simple web pages. For sanity and organization, we would like for the business team to add their web pages to a sub-folder in the project. Root <-- development team pages go he...
It is possible to subscribe to an event using Reflection var o = new SomeObjectWithEvent; o.GetType().GetEvent("SomeEvent").AddEventHandler(...); [http://msdn.microsoft.com/en-us/library/system.reflection.eventinfo.addeventhandler.aspx][1] Now here is going to be the problem that you are going to have...
|apache-flex|actionscript-3|wishfulthinking|
Here is the sample code for my accordion: <mx:Accordion x="15" y="15" width="230" height="599" styleName="myAccordion"> <mx:Canvas id="pnlSpotlight" label="SPOTLIGHT" height="100%" width="100%" horizontalScrollPolicy="off"> <mx:VBox width="100%" height="80%" paddingTop="2" paddingBottom="1" verticalGap="1">...
|apache-flex|actionscript-3|
What are the advantages of explicit Join Transitive Closure in SQL?
|sql|jointransitiveclosure|
When I'm joining three or more tables together by a common column, I'd write my query like this: SELECT * FROM a, b, c WHERE a.id = b.id AND b.id = c.id a colleague recently asked my why I didn't do explicit _Join Transitive Closure_ in my queries like this: SELECT * FROM a,...
When I'm joining three or more tables together by a common column, I'd write my query like this: SELECT * FROM a, b, c WHERE a.id = b.id AND b.id = c.id a colleague recently asked my why I didn't do explicit _Join Transitive Closure_ in my queries like this: SELECT * FROM a,...
|sql|
Triggers can be very helpful. They can also be very dangerous. I think they're fine for house cleaning tasks like populating audit data (created by, modified date, etc) and in some databases can be used for referential integrity. But I'm not a big fan of putting lots of business logic into them. This can make suppor...
I use static_cast for two reasons. 1. It's explicitly clear what's taking place. I can't read over that without realizing there's a cast going on. With C-style casts you eye can pass right over it without pause. 2. It's easy to search for every place in my code where I'm casting.
Data model for a extensible web form
|database-design|forms|
Suppose that I have a form that contains three 10 fields: field1..field10. I store the form data in one or more database tables, probably using 10 database columns. Now suppose a few months later that I want to add 3 more fields. And in the future I may add/delete fields from this form based on changing require...
Definitely C++-style. The extra typing will help prevent you from casting when you shouldn't :-)
Adaptive Database
|database|orm|
Are there any rapid Database protoyping tools that don't require me to declare a database schema, but rather create it based on the way I'm using my entities. For example, assuming an empty database (pseudo code): user1 = new User() // Creates the user table with a single id column user1.firstName = "Al...
The Internet Explorer 8 beta (2) has a builtin Javascript profiler (in the developer toolbar). It's worth playing with at least...
In T-Sql there are two ways: --filter out the max select max( col ) from [table] where col < ( select max( col ) from [table] ) --sort top two then bottom one select top 1 col from ( select top 2 col from [table] order by col desc )...
Regarding this subject, I'm following the recommandations made by [Scott Meyers](http://en.wikipedia.org/wiki/Scott_Meyers) ([More Effective C++](http://www.amazon.com/More-Effective-Addison-Wesley-Professional-Computing/dp/020163371X/ref=sr_1_4?ie=UTF8&s=books&qid=1219929663&sr=1-4), Item 2 : Prefer C++-style casts). ...
[Fabric][1]. Seems small, simple, procedural. Written in Python, since Ruby is a no-no (why?). [1]: http://www.nongnu.org/fab/
I guess the inbuilt profiler of Visual Studio 2005 comes onyl with the Developer Edition and Team Edition. I have a Professional edition which, it seems doesnot have the inbuilt profiler tool. -AD
[perlfork][1]: > Perl provides a fork() keyword that > corresponds to the Unix system call of > the same name. On most Unix-like > platforms where the fork() system call > is available, Perl's fork() simply > calls it. > > On some platforms such as Windows > where the fork() system call is not > available,...
public TestForm() { Button b = new Button(); this.Controls.Add(b); MethodInfo method = typeof(TestForm).GetMethod("Clickbutton", BindingFlags.NonPublic | BindingFlags.Instance); Type type = typeof(EventHandler); Delegate handler = Delegate...
Since the extensions will be ASPX, ASP.NET will pick up the request... you can write an HttpModule that checks for pages that yield a 404 and then check the subfolder also. If you know that all pages with a certain format will be coming from that folder, then you can just rewrite the URL in ASP.NET (either in Global...
Check out Setup Factory (from indigo rose). It's pretty robust in what it can do. It uses the Windows installer API. It can probably do what you need.
The first reason that comes to mind is **historical**: Since most C, C++, and Java programmers are not accustomed to having such freedoms, they do not demand them. But an actual, and more valid, reason is that the **language complexity would increase**: First of all, should the objects be compared with `.Equal...
|debugging|pdb|symbols|
Basically what I want to do it this: a pdb file contains a location of source files (e.g. <code>C:\dev\proj1\helloworld.cs</code>). Is it possible to modify that pdb file so that it contains a different location (e.g. <code>\\more\differenter\location\proj1\helloworld.cs</code>)?
>>In which scenarios does one out-perform the other? For smalller tables (less than 1000 rows) use a temp variable otherwise use a temp table
I did, and I think it helped me at the time. It doesn't help me day to day anymore, but I think it would depend on your job. I learned assembler 20 years ago on a Commodore and again in University on an IBM mainframe. I can't say it helps me in my current job.