instruction stringlengths 0 30k ⌀ |
|---|
Java import/export dependencies |
|java| |
I'm trying to find a way to list the (static) dependency requirements of a jar file, in terms of which symbols are required at run time.
I can see that the methods exported by classes can be listed using "javap", but there doesn't seem to be an opposite facility to list the 'imports'. Is it possible to do this?
This would be similar to the dumpbin utility in Windows development which can be used to list the exports and imports of a DLL.
|
I'm trying to find a way to list the (static) dependency requirements of a jar file, in terms of which symbols are required at run time.
I can see that the methods exported by classes can be listed using "javap", but there doesn't seem to be an opposite facility to list the 'imports'. Is it possible to do this?
This would be similar to the dumpbin utility in Windows development which can be used to list the exports and imports of a DLL.
EDIT : Thanks for the responses; I checked out all of the suggestions; accepted DependencyFinder as it most closely meets what I was looking for.
|
My selection criteria (mainly programming centric):
- Maintenance: How are updates/hotfixes installed?
- Transaction control: How it is implemented
- Are Stored Procedures supported?
- Can you use exception handling in Stored Procedures?
- Costs
- As a benefit: Can you use recursion on Stored Procedures? (E.g. in SQL Server 2000 the recursion stops after 32 passes IIRC)
|
Simply move your code into an Excel Addin (XLA) - this gets loaded at startup (assuming it's in the %AppData%\Microsoft\Excel\XLSTART folder) but if it's a addin, not a workbook, then only your macros and defined startup functions will be loaded.
If the functions depend on a spreadsheet itself, then you might want to use a combination of templates and addins.
I'm distributing part of an application like this, we have addins for Word, Excel and Powerpoint (XLA, PPA, DOT) and also Office 2007 'ribbon' versions (DOTM, XLAM and PPAM)
The addin startup code creates toolbar buttons if they're not found, this means in any workbook/document/etc they can simply hit the toolbar button to run our code (we have two action buttons and one button that displays a settings dialog)
Templates aren't really the way to go for VBA code, Addins are definitely the way to go...
So to load the toolbars on startup we're using something like.. (checking to see if toolbar exists though - code will run for each worksheet that is opened, but toolbars are persistent for the user session)
Public Sub Workbook_Open()
' startup code / add toolbar / load saved settings, etc.
End Sub
hope that helps :) |
Symfony has a plugin called sfMigrationsLight that handles basic migrations. CakePHP also has migrations.
For whatever reason, migration support has never really been a high priority for most of the PHP frameworks and ORMs out there. |
Stackoverflow uses jquery I think, and I hear that jquery is all the rage |
I really don't think that file-based databases can scale past half a dozen users. The last time I had an Access database (admittedly this was quite a while ago) I had to work really hard to get it to work for 8-9 people.
It is really much easier to install Ubuntu on an old junk computer with PostgreSQL or MySQL. That's what I had to do even when I kept my Access front-end. |
I usually go for this, a public getter that returns System.Collections.ObjectModel.ReadOnlyCollection<T>:
public ReadOnlyCollection<SomeClass> Collection
{
get
{
return new ReadOnlyCollection<SomeClass>(myList);
}
}
And public methods on the object to modify the collection.
Clear();
Add(SomeClass class);
If the class is supposed to be a repository for other people to mess with then I just expose the private variable as per method #1 as it saves writing your own API, but I tend to shy away from that in production code. |
We are starting to use jQuery where I work. I'm not big on JavaScript, but everyone else likes it a lot. I don't know if that helps at all... |
[Ayende][1] was recently trying to make a similar decision, and tried a bunch of so-called embedded databases. Hopefully his [observations][2] can help you.
[1]: http://www.ayende.com/Blog/Default.aspx
[2]: http://www.ayende.com/Blog/archive/2008/07/11/Observations-on-Embedded-databases.aspx |
You should really use a fixed-width field for your length.
- When the program on the receiving end has to read the length field of your packet, how does it know where the length stops?
- If the length of a packet can potentially reach 4 GB, does a 1-3 byte overhead really matter?
- Do you see how complex your code has already become? |
Mechanisms for tracking DB schema changes |
|database|php|mysql|subversion| |
What are the best methods for tracking and/or automating DB schema changes? Our team uses Subversion for version control and we've been able to automate some of our tasks this way (pushing builds up to a staging server, deploying tested code to a production server) but we're still doing database updates manually. I would like to find or create a solution that allows us to work efficiently across servers with different environments while continuing to use Subversion as a backend through which code and DB updates are pushed around to various servers.
Many popular software packages include auto-update scripts which detect DB version and apply the necessary changes. Is this the best way to do this even on a larger scale (across multiple projects and sometimes multiple environments and languages)? If so, is there any existing code out there that simplifies the process or is it best just to roll our own solution? Has anyone implemented something similar before and integrated it into Subversion post-commit hooks, or is this a bad idea?
While a solution that supports multiple platforms would be preferable, we definitely need to support the Linux/Apache/MySQL/PHP stack as the majority of our work is on that platform. |
I have a question on the best way of exposing an asynchronous remote interface.
The conditions are as follows:
* The protocol is asynchronous
* A third party can modify the data at any time
* The command round-trip can be significant
* The model should be well suited for UI interaction
* The protocol supports queries over certain objects, and so must the model
As a means of improving my lacking skills in this area (and brush up my Java in general), I have started a [project](http://Telharmonium.devjavu.com/) to create an Eclipse-based front-end for [xmms2](http://xmms2.xmms.se) (described below).
So, the question is; how should I expose the remote interface as a neat data model (In this case, track management and event handling)?
I welcome anything from generic discussions to pattern name-dropping or concrete examples and patches :)
----------
My primary goal here is learning about this class of problems in general. If my project can gain from it, fine, but I present it strictly to have something to start a discussion around.
I've implemented a protocol abstraction which I call ['client'](http://telharmonium.devjavu.com/browser/trunk/xmms2-client) (for legacy reasons) which allows me to access most exposed features using method calls which I am happy with even if it's far from perfect.
The features provided by the xmms2 daemon are things like track searching, meta-data retrieval and manipulation, change playback state, load playlists and so on and so forth.
I'm in the middle of updating to the latest stable release of xmms2, and I figured I might as well fix some of the glaring weaknesses of my current implementation.
My plan is to build a better abstraction on top of the protocol interface, one that allows a more natural interaction with the daemon. The current ['model'](http://telharmonium.devjavu.com/browser/trunk/xmms2-model) implementation is hard to use and is frankly quite ugly (not to mention the UI-code which is truly horrible atm).
Today I have the [Tracks](http://telharmonium.devjavu.com/browser/trunk/xmms2-model/src/se/fnord/xmms2/model/Tracks.java) interface which I can use to get instances of [Track](http://telharmonium.devjavu.com/browser/trunk/xmms2-model/src/se/fnord/xmms2/model/Track.java) classes based on their id. Searching is performed through the [Collections](http://telharmonium.devjavu.com/browser/trunk/xmms2-model/src/se/fnord/xmms2/model/Collections.java) interface (unfortunate namespace clash) which I'd rather move to Tracks, I think.
Any data can be modified by a third party at any time, and this should be properly reflected in the model and change-notifications distributed
These interfaces are exposed when connecting, by returning an object hierarchy that looks like this:
* Connection
* Playback getPlayback()
* Play, pause, jump, current track etc
* Expose playback state changes
* Tracks getTracks()
* Track getTrack(id) etc
* Expose track updates
* Collections getCollection()
* Load and manipulate playlists or named collections
* Query media library
* Expose collection updates |
> If all you need to do is to be able to flush the cache from a web-application, you could create a simple php-page and then use the system() call...
Cache flushing is part of what we're looking for, but also a way to monitor what scripts are currently in there, how much data is in there, etc - basically the same stuff available on the EA control panel page.
We've played around with munin plugins for showing data usage, and were thinking we'd have to go down the line suggested above (system calls, etc), but were hoping that someone, somewhere would have rolled something similar already! |
You could also adjust the line height of the td element:
td {
line-height: 0
} |
One nice approach I've used lately is to add an event handler for the AppDomain's AssemblyResolve event.
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.AssemblyResolve += new ResolveEventHandler(MyResolveEventHandler);
Then in the event handler method you can load the assembly that was attempted to be loaded and return it from the method.
The other approach is to add an extra path to the fusion binding but I forget how that's done so someone else might have to jump in. |
One nice approach I've used lately is to add an event handler for the AppDomain's AssemblyResolve event.
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.AssemblyResolve += new ResolveEventHandler(MyResolveEventHandler);
Then in the event handler method you can load the assembly that was attempted to be loaded and return it from the method.
The other approach is to add an extra path to the fusion binding's probing paths but I forget how that's done so someone else might have to jump in.
EDIT:
If you have no app.config file then this approach is probably a good one for you. |
One nice approach I've used lately is to add an event handler for the AppDomain's AssemblyResolve event.
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.AssemblyResolve += new ResolveEventHandler(MyResolveEventHandler);
Then in the event handler method you can load the assembly that was attempted to be resolved using one of the Assembly.Load, Assembly.LoadFrom overrides and return it from the method.
The other approach is to add an extra path to the fusion binding's probing paths but I forget how that's done so someone else might have to jump in.
EDIT:
If you have no app.config file then this approach is probably a good one for you although I wonder if in your additional comment you misunderstand the fact that the config file where the Xml for probing is placed is for your application's main executable. |
One nice approach I've used lately is to add an event handler for the AppDomain's AssemblyResolve event.
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.AssemblyResolve += new ResolveEventHandler(MyResolveEventHandler);
Then in the event handler method you can load the assembly that was attempted to be resolved using one of the Assembly.Load, Assembly.LoadFrom overrides and return it from the method.
EDIT:
Based on your additional information I think using the technique above, specifically resolving the references to an assembly yourself is the only real approach that is going to work without restructuring your app. What it gives you is that the location of each and every assembly that the CLR fails to resolve can be determined and loaded by your code at runtime... I've used this in similar situations for both pluggable architectures and for an assembly reference integrity scanning tool. |
Maybe consider not using BITS at all and use the old favourite **Robocopy**. Robocopy is a standalone command-line executable which is part of [the Windows Server 2003 ResKit tools][1] and now standard on Vista/2008. Robocopy has the `/IPG:ms` (Inter-Packet Gap) switch to "dribble" the download, which is designed specifically to not saturate slow links.
[1]: http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd |
There's basicly 2 commands to do this...
- useradd
- adduser (which is a frendlier front end to useradd)
You have to run them has root.
Just read their manuals to find out how to use them. |
Firefox:
- multi-platform
- kiosk add-on
- patch the chrome logic with zip and javascript
- see the FF 3.1 javascript speed improvements
- easily deploy standard bookmarks |
<asp:hyperlink> after opening target in new window - new window cannot be closed |
|asp.net| |
I've got a page with an <asp:hyperlink> control - the link is to a gif file. Right clicking on the link (in IE7) and selecting "open target in new window" correctly displays the image. However I can't then close the new IE window.
What might I be doing wrong ?
TIA
Tom |
I've got a page with an <asp:hyperlink> control - the link is to a gif file. Right clicking on the link (in IE7) and selecting "open target in new window" correctly displays the image. However I can't then close the new IE window.
**MORE INFO:** Works OK in Firefox 3
What might I be doing wrong ?
TIA
Tom |
Pinning pointer arrays in memory |
|c#|optimization|raytracing|unsafe| |
I'm currently working on a ray-tracer in C# as a hobby project. I'm trying to achieve a decent rendering speed by implementing some tricks from a c++ implementation and have run into a spot of trouble.
The objects in the scenes which the ray-tracer renders are stored in a KdTree structure and the tree's nodes are, in turn, stored in an array. The optimization I'm having problems with is while trying to fit as many tree nodes as possible into a cache line. One means of doing this is for nodes to contain a pointer to the left child node only. It is then implicit that the right child follows directly after the left one in the array.
The nodes are structs and during tree construction they are succesfully put into the array by a static memory manager class. When I begin to traverse the tree it, at first, seems to work just fine. Then at a point early in the rendering (about the same place each time), the left child pointer of the root node is suddenly pointing at a null pointer. I have come to the conclusion that the garbage collecter has moved the structs as the array lies on the heap.
I've tried several things to pin the addresses in memory but none of them seems to last for the entire application lifetime as I need. The 'fixed' keyword only seems to help during single method calls and declaring 'fixed' arrays can only be done on simple types which a node isn't. Is there a good way to do this or am I just too far down the path of stuff C# wasn't meant for.
Btw, changing to c++, while perhaps the better choice for a high performance program, is not an option. |
Factory methods (alternative constructors) are indeed a classic example of class methods.
Basically, class methods are suitable anytime you need would like to have a method which naturally fits into the namespace of the class, but is not associated with a particular instance of the class.
As an example, in the excelent [unipath][1] module:
## Current directory
- Path.cwd()
- Return the actual current directory; e.g., Path("/tmp/my_temp_dir"). This is a class method.
- .chdir()
- Make self the current directory.
As the current directory is process wide, the cwd method has no particular instance with which it should be associated. However, changing the cwd to the directory of a given Path instance should indeed be an instance method.
Hmmm... as Path.cwd() does indeed return a Path instance, I guess it could be considered to be a factory method...
[1]: http://pypi.python.org/pypi/Unipath/0.2.1
|
[memcache.php][1] may be what you're looking for.
> memcache.php that you can get stats and dump from multiple memcache servers.
Can [delete keys][2] and [flush servers][3].
[1]: http://livebookmark.net/journal/2008/05/21/memcachephp-stats-like-apcphp/
[2]: http://livebookmark.net/journal/2008/07/30/memcachephp-can-delete-keys-now/
[3]: http://livebookmark.net/journal/2008/08/28/memcachephp-flushes-servers/ |
Task oriented thread pooling |
|c++|multithreading|boost| |
I've created a model for executing worker tasks in a server application using a thread pool associated with an IO completion port such as shown in the posts below:
[http://weblogs.asp.net/kennykerr/archive/2008/01/03/parallel-programming-with-c-part-4-i-o-completion-ports.aspx][1]
[http://blogs.msdn.com/larryosterman/archive/2004/03/29/101329.aspx][2]
Are there any classes in boost that can help with this programming model?
[1]: http://weblogs.asp.net/kennykerr/archive/2008/01/03/parallel-programming-with-c-part-4-i-o-completion-ports.aspx
[2]: http://blogs.msdn.com/larryosterman/archive/2004/03/29/101329.aspx |
(C) What is the difference between ++i and i++ |
|c|forloop|increment| |
In C, what is the difference between using ++i and i++. And which should be used in the incrementation block of a for loop? |
|c|forloop| |
|c|for-loop| |
We seem to be in the golden age of version control, with a ton of choices, all of which have their pros and cons.
Here are the ones I see most used:
- svn - currently the most popular open source?
- git - very hot since Linus switched to it
- mercurial - some smart people I know swear by it
- cvs - the one everybody is switching from
- perforce - imho, the best features, but it's not open source. The two-user license is free, though.
- visual sourcesafe - I'm not much in the Microsoft world, so I have no idea about this one, other than people like to rag on it as they rag on everything from Microsoft.
- sccs - for historical interest we mention this, the great-grandaddy of many of the above
- rcs - and the grandaddy of many of the above
My recommendation: you're safest with eith svn or perforce, since a lot of people use them, they are cross platform, have good guis, you can buy books about them, etc.
Dont consider cvs, sccs, rcs, they are antique.
The nice thing is that, since your projects will be relatively small, you will be able to move your code to a new system once you're more experienced and decide you want to work with another system. |
We seem to be in the golden age of version control, with a ton of choices, all of which have their pros and cons.
Here are the ones I see most used:
- svn - currently the most popular open source?
- git - very hot since Linus switched to it
- mercurial - some smart people I know swear by it
- cvs - the one everybody is switching from
- perforce - imho, the best features, but it's not open source. The two-user license is free, though.
- visual sourcesafe - I'm not much in the Microsoft world, so I have no idea about this one, other than people like to rag on it as they rag on everything from Microsoft.
- sccs - for historical interest we mention this, the great-grandaddy of many of the above
- rcs - and the grandaddy of many of the above
My recommendation: you're safest with either git, svn or perforce, since a lot of people use them, they are cross platform, have good guis, you can buy books about them, etc.
Dont consider cvs, sccs, rcs, they are antique.
The nice thing is that, since your projects will be relatively small, you will be able to move your code to a new system once you're more experienced and decide you want to work with another system. |
Couldn't agree more with what's being said. Fail early, fail fast. Pretty good Exception mantra.
The question about which Exception to throw is mostly a matter of personal taste. In my mind IllegalArgumentException seems more specific than using a NPE since it's telling me that the problem was with an argument I passed to the method and not with a value that may have been generated while performing the method.
My 2 Cents |
Compare a date string to datetime in SQL Server |
|database|mssql|t-sql|datetime| |
In SQL Server I have a DATETIME column which includes a time element.
Example:
'14 AUG 2008 14:23:019'
What is the best method to select the records for a particular day, ignoring the time part?
Example: (Not safe, as it does not match the time part and returns no rows)
SELECT *
FROM table1
WHERE column_datetime = '14 AUG 2008'
*Note: Given this site is also about jotting down notes and techniques you pick up and then forget, I'm going to post my own answer to this question as DATETIME stuff in MSSQL is probably the topic I lookup most in SQLBOL.* |
In SQL Server I have a DATETIME column which includes a time element.
Example:
'14 AUG 2008 14:23:019'
What is the best method to select the records for a particular day, ignoring the time part?
Example: (Not safe, as it does not match the time part and returns no rows)
DECLARE @p_date DATETIME
SET @p_date = CONVERT( DATETIME, '14 AUG 2008', 106 )
SELECT *
FROM table1
WHERE column_datetime = @p_date
*Note: Given this site is also about jotting down notes and techniques you pick up and then forget, I'm going to post my own answer to this question as DATETIME stuff in MSSQL is probably the topic I lookup most in SQLBOL.*
**Update** Clarified example to be more specific. |
HOWTO - Compare a date string to datetime in SQL Server? |
|sql-server|database|t-sql|datetime| |
In SQL Server I have a DATETIME column which includes a time element.
Example:
'14 AUG 2008 14:23:019'
What is the **best** method to only select the records for a particular day, ignoring the time part?
Example: (Not safe, as it does not match the time part and returns no rows)
DECLARE @p_date DATETIME
SET @p_date = CONVERT( DATETIME, '14 AUG 2008', 106 )
SELECT *
FROM table1
WHERE column_datetime = @p_date
*Note: Given this site is also about jotting down notes and techniques you pick up and then forget, I'm going to post my own answer to this question as DATETIME stuff in MSSQL is probably the topic I lookup most in SQLBOL.*
----------
**Update** Clarified example to be more specific.
----------
**Edit** Sorry, But I've had to down-mod WRONG answers (answers that return wrong results).
@Jorrit: `WHERE (date>'20080813' AND date<'20080815')` will return the 13th and the 14th.
@wearejimbo: *Close, but no cigar!* badge awarded to you. You missed out records written at 14/08/2008 23:59:001 to 23:59:999 (i.e. Less than 1 second before midnight.) |
|database|php|svn|mysql|subversion| |
|php|database|svn|mysql| |
|php|database|mysql|svn|migration| |
Check out [article from Cocoa is My Girlfriend][1]. The gist of it, is that there is not performance penalty of using one over the other.
However, the notation does make it more difficult to see what is happening with your variables and what your variables are.
[1]: http://www.cimgf.com/2008/07/08/a-case-against-dot-syntax/ |
Check out [article from Cocoa is My Girlfriend][1]. The gist of it, is that there is no performance penalty of using one over the other.
However, the notation does make it more difficult to see what is happening with your variables and what your variables are.
[1]: http://www.cimgf.com/2008/07/08/a-case-against-dot-syntax/ |
[urlencode()][1] should probably do what you want.
[1]: http://se.php.net/manual/en/function.urlencode.php |
[urlencode()][1] should probably do what you want.
**Edit**: urlencode() works fine on swedish characters.
<pre><code>
<?php
echo urlencode("åäö");
?>
</code></pre>
converts to:
<pre><code>
%E5%E4%F6
</code></pre>
[1]: http://se.php.net/manual/en/function.urlencode.php |
jQuery, easy to learn, easy to use, small footprint, active plugin developer community. Can't go wrong with jQuery. |
For what its worth [jQuery's](http://jquery.com/) website redesign launched this morning (Friday August 29, 2008). Good fun fact. And of course +1 to its mention. |
There aren't any time limits in the question so I suggest that prisoners should decide to take 1 hour per box and open them in the order presented. If the second prisoner is allowed into the room after 2 hours then he knows that the first prisoner found his own number in box 2. Therefore he knows to skip box 2 in his sequence and opens boxes 1, 3, 4...51
First prisoners odds on losing are 50/100
Give that the first prisoner survived then the second prisoners chance of winning are 50/99
So answer appears to be ((50 ^51)*49!)/100!
which according to google makes 2.89*10^-9
which is pretty much nil
So even if the prisoners knew the boxes the previously lucky ones found their number in there'd be no hope
|
The urlencode() function will convert spaces into plus signs (+), so it won't work. The rawurlencode does the trick. Thanks.
Be sure to convert each part of the path separately, otherwise path/file will be converted into path%2Ffile. (which was what I missed) |
Here is the script you would put into a batch file to register all of the files in the current directory with Gacutil. You don't need to put it in a batch file (you can just copy/paste it to a Command Prompt) to do it.
FOR %1 IN (*) DO Gacutil /i %1 |
Here is the script you would put into a batch file to register all of the files in the current directory with Gacutil. You don't need to put it in a batch file (you can just copy/paste it to a Command Prompt) to do it.
FOR %1 IN (*) DO Gacutil /i %1
Edit: Bah, sorry I was late. I didn't see the previous post when I posted mine. |
I needed to pass id and password to a cmd (or bat) file at the time of running rather than hardcoding them into the file.
Here's how I do it.
echo off
fake-command /u %1 /p %2
Here's what the command line looks like:
test.cmd admin P@55w0rd > test-log.txt
The %1 applies to the first parameter the %2 (and here's the tricky part) applies to the second. You can have up to 9 parameters passed in this way.
Afterward: This is my first attempt to answer my own question which, to hear Jeff discuss it is a "...perfectly acceptable...." way of using SO. I'm just not certain if there's already a format for doing it.
----------
## Additional Notes from the Community ##
**Per Frank Krueger**
>Yep, and just don't forget to use variables like %%1 when using if and for and the gang.
>
>If you forget the double %, then you will be substituting in (possibly null) command >line arguments and you will receive some pretty confusing error messages.
|
|command-line|batch-file|ms-dos|cmd| |
|command-line|batch-file|ms-dos|cmd| |
I needed to pass id and password to a cmd (or bat) file at the time of running rather than hardcoding them into the file.
Here's how I do it.
echo off
fake-command /u %1 /p %2
Here's what the command line looks like:
test.cmd admin P@55w0rd > test-log.txt
The %1 applies to the first parameter the %2 (and here's the tricky part) applies to the second. You can have up to 9 parameters passed in this way.
Afterward: This is my first attempt to answer my own question which, to hear Jeff discuss it is a "...perfectly acceptable...." way of using SO. I'm just not certain if there's already a format for doing it.
----------
## Additional Notes from the Community ##
**Per Frank Krueger**
>Yep, and just don't forget to use variables like %%1 when using if and for and the gang.
>
>If you forget the double %, then you will be substituting in (possibly null) command >line arguments and you will receive some pretty confusing error messages.
**Per Greg Hewgill**
>Another useful tip is to use %* to mean "all the rest". For example,
> echo off
> fake-command /u %1 /p %2 %*
>When you run:
> test-command admin password foo bar
>the above batch file will run:
> fake-command /u admin /p password foo bar |
I needed to pass id and password to a cmd (or bat) file at the time of running rather than hardcoding them into the file.
Here's how I do it.
echo off
fake-command /u %1 /p %2
Here's what the command line looks like:
test.cmd admin P@55w0rd > test-log.txt
The %1 applies to the first parameter the %2 (and here's the tricky part) applies to the second. You can have up to 9 parameters passed in this way.
Afterward: This is my first attempt to answer my own question which, to hear Jeff discuss it is a "...perfectly acceptable...." way of using SO. I'm just not certain if there's already a format for doing it.
----------
## Additional Notes from the Community ##
**Per Frank Krueger**
>Yep, and just don't forget to use variables like %%1 when using if and for and the gang.
>
>If you forget the double %, then you will be substituting in (possibly null) command >line arguments and you will receive some pretty confusing error messages.
**Per Greg Hewgill**
>Another useful tip is to use %* to mean "all the rest". For example,
> echo off
> fake-command /u %1 /p %2 %*
>When you run:
> test-command admin password foo bar
>the above batch file will run:
> fake-command /u admin /p password foo bar
**Per thelsdj**
>If you want to intelligently handle missing parameters you can do something like:
> IF %1.==. GOTO No1
> IF %2.==. GOTO No2
> ... do stuff...
> GOTO End1
> :No1
> ECHO No param 1
> GOTO End1
> :No2
> ECHO No param 2
> GOTO End1
> :End1 |
Is it really prohibitive to store the pair of array reference and index?
|
For starters, I would suggest that you use the .net data providers from Oracle - if at all possible. If you are starting off in a project it will be the best way to save yourself pain further down the line. You can get them from [here][1]
[1]: http://www.oracle.com/technology/tech/windows/odpnet/index.html |
Is there any way to draw an image to use 4 points rather than 3 (perspective warp). |
|c#|.net|gdi+| |
Drawing a parallelgram is nicely supported with Graphics.DrawImage:
Bitmap destImage = new Bitmap(srcImage.Width, srcImage.Height);
using (Graphics gr = new Graphics.FromImage(destImage))
{
Point[] destPts = new Point[] { new PointF(x1, y1),
new PointF(x2, y2), new PointF(x4, y4)};
gr.DrawImage(srcImage, destPts);
How, do you do 4 points (obviously the following is not supported, but this is what is wanted):
Bitmap destImage = new Bitmap(srcImage.Width, srcImage.Height);
using (Graphics gr = new Graphics.FromImage(destImage))
{
Point[] destPts = new Point[] { new PointF(x1, y1), new PointF(x2, y2),
new PointF(x3, y3), new PointF(x4, y4)};
gr.DrawImage(srcImage, destPts);
}
|
jar is just a zip file, so I guess you can. If you could get to the source, it's cleaner. Maybe try disassembling the class? |
Firstly, if you're using C# normally, you can't suddenly get a null reference due to the garbage collector moving stuff, because the garbage collector also updates all references, so you don't need to worry about it moving stuff around.
You can pin things in memory but this may cause more problems than it solves. For one thing, it prevents the garbage collector from compacting memory properly, and may impact performance in that way.
One thing I would say from your post is that using structs may not help performance as you hope. C# fails to inline any method calls involving structs, and even though they've fixed this in their latest runtime beta, structs frequently don't perform that well.
Personally, I would say C++ tricks like this don't generally tend to carry over too well into C#. You may have to learn to let go a bit; there can be other more subtle ways to improve performance ;) |
The course [Software Carpentry][1] is aimed specifically at people doing scientific computing and aims to teach the basics and lessons of software engineering, and how best to apply them to projects.
It covers topics like version control, debugging, testing, scripting and various other issues.
I've listened to about 8 or 9 of the lectures and think it is to be highly recommended.
**Edit:** The mp3s of the lectures are [available][2] as well.
[1]: http://www.swc.scipy.org/
[2]: http://www.osl.iu.edu/~lums/swc/index.html |
Adding to this question, can that improve performance? Since the classes not used would not be JIT compiled improving startup time or does the java automatically detect that while compiling to bytecode and do not even deal with the code that is not used? |
You should take a look at [thinstall][1](It has been bought by vmware and is called thinapp now), its an application virtualizer.
[1]: http://www.thinstall.com/ |
Hmm.. Are you sure the specified project is set as the start project (right click > set as startup project) ??
Oh, and obviously you need to be in the correct configuration mode ^_^
(Notice it can be changed to _debug | build | all configurations_ ) |
In general my rule is: "The application should manage it's own schema."
This means schema upgrade scripts are part of any upgrade package for the application and run automatically when the application starts. In case of errors the application fails to start and the upgrade script transaction is not committed. The downside to this is that the application has to have full modification access to the schema (this annoys DBAs).
I've had great success using Hibernates SchemaUpdate feature to manage the table structures. Leaving the upgrade scripts to only handle actual data initialization and occasional removing of columns (SchemaUpdate doesn't do that).
Regarding testing, since the upgrades are part of the application testing them becomes part of the test cycle for the application. |
In general my rule is: "The application should manage it's own schema."
This means schema upgrade scripts are part of any upgrade package for the application and run automatically when the application starts. In case of errors the application fails to start and the upgrade script transaction is not committed. The downside to this is that the application has to have full modification access to the schema (this annoys DBAs).
I've had great success using Hibernates SchemaUpdate feature to manage the table structures. Leaving the upgrade scripts to only handle actual data initialization and occasional removing of columns (SchemaUpdate doesn't do that).
Regarding testing, since the upgrades are part of the application, testing them becomes part of the test cycle for the application. |
Are you sure you are setting the command arguments on the same configuration (Debug|Release) you are debugging? As far as I remember command arguments are per configuration. |
Looks like you're using jQuery? It has a method to clone an element with events: http://docs.jquery.com/Manipulation/clone#true |
Looks like you're using jQuery? It has a method to clone an element with events: http://docs.jquery.com/Manipulation/clone#true
EDIT: Oops I see you're using Prototype. |
The neat thing with SSAS is that you can get those indicators that you talk about quite easily either by creating calculated measures or by using KPIs.
I started with [Delivering Business Intelligence with Microsoft SQL Server 2005][1]. It had some good introduction, but unfortunately it's too verbose when it comes to the details. But if you want to understand SSAS, OLAP and reporting using this framework it's a good start.
Mosha Pasumansky has a [blog][2] on SSAS and [MDX][3] with great [links][4].
Other than that I would recommend Microsofts Online books.
[1]: http://www.amazon.com/Delivering-Business-Intelligence-Microsoft-Server/dp/0072260904/ref=sr_1_1?ie=UTF8&s=books&qid=1219829198&sr=1-1
[2]: http://sqlblog.com/blogs/mosha/default.aspx
[3]: http://en.wikipedia.org/wiki/Multidimensional_Expressions
[4]: http://www.mosha.com/msolap/ |
If by "purist" you mean "most encapsulation", then I typically declare all my fields as private and then use this.field from within the class itself, but all other classes, including subclasses, access instance state using the getters. |
Well, when I build a website I tend to try and forget about the design completely while writing the HTML. I do this so I won't end up with any design-specific markup and so I can focus on the semantic meaning of the elements.
Some pointers how to markup things:
* menu - use the UL (unordered list) element, since that's exactly what a menu is. an unordered list of choices. example:
<ul id="menu">
<li id="home"><a href="/" title="Go to Homepage">Home</a></li>
<li id="about"><a href="/about" title="More about us">About</a></li>
</ul>
if you'd like an horizontal menu you could do this:
#menu li {
display: block;
float: left;
}
* Logo - use a H1 (heading) element for the logo instead of an image.Example:
<pre>
<div id="header">
<h1>My website</h1>
</div>
</pre>
And the CSS (same technique can be applied to the menu above if you would like a menu with graphical items):
#header h1 {
display: block;
text-indent: -9999em;
width: 200px;
height: 100px;
background: transparent url(images/logo.png) no-repeat;
}
* IDs and classes - use IDs to identify elements that you only have one instance of. Use class for identifying elements that you got several instances of.
* Use a textual browser (for instance, lynx). If it makes sense to navigate in this way, you've done good when it comes to accessibility.
I hope this helps :)
|
Well, when I build a website I tend to try and forget about the design completely while writing the HTML. I do this so I won't end up with any design-specific markup and so I can focus on the semantic meaning of the elements.
Some pointers how to markup things:
* menu - use the UL (unordered list) element, since that's exactly what a menu is. an unordered list of choices. example:
<ul id="menu">
<li id="home"><a href="/" title="Go to Homepage">Home</a></li>
<li id="about"><a href="/about" title="More about us">About</a></li>
</ul>
if you'd like an horizontal menu you could do this:
#menu li {
display: block;
float: left;
}
* Logo - use a H1 (heading) element for the logo instead of an image.Example:
<pre><code>
<div id="header">
<h1>My website</h1>
</div>
</code></pre>
And the CSS (same technique can be applied to the menu above if you would like a menu with graphical items):
#header h1 {
display: block;
text-indent: -9999em;
width: 200px;
height: 100px;
background: transparent url(images/logo.png) no-repeat;
}
* IDs and classes - use IDs to identify elements that you only have one instance of. Use class for identifying elements that you got several instances of.
* Use a textual browser (for instance, lynx). If it makes sense to navigate in this way, you've done good when it comes to accessibility.
I hope this helps :)
|
I too am on my adventure into ASP.NET and have also had similar frustrations.. However, you soon get used to it. You just need to remember, **the reason you dont have the tedious HTML crafting is because the ASP.NET controls do it all for you**.
To some extent you can control/tweak these things, even if it means inheriting the control and tweaking the HTML output from there.
I have had to do that in the past, where certain controls were not passing W3C validation by default by putting some extra markup here and there, so I simply overrode and edited as necessary (a fix that too literally a couple of minutes)..
I would say learn about how the controls system works.. Then knock a few together yourself, this has really helped me grok whats going on under the hood, so if I ever get any problems, I have an idea where to go. |
In .NET, how do I launch a file with command line arguments (without knowing the location of the exe)? |
|c#|.net|vb.net| |
Here's the situation: I am trying to launch an application, but the location of the .exe isn't known to me. Now, if the file extension is registered (in Windows), I can do something like:
Process.Start("Sample.xls");
However, I need to pass some command line arguments as well. I couldn't get this to work
Process p = new Process();
p.StartInfo.FileName = "Sample.xls";
p.StartInfo.Arguments = "/r"; // open in read-only mode
p.Start();
Any suggestions on a mechanism to solve this? |
Here's the situation: I am trying to launch an application, but the location of the .exe isn't known to me. Now, if the file extension is registered (in Windows), I can do something like:
Process.Start("Sample.xls");
However, I need to pass some command line arguments as well. I couldn't get this to work
Process p = new Process();
p.StartInfo.FileName = "Sample.xls";
p.StartInfo.Arguments = "/r"; // open in read-only mode
p.Start();
Any suggestions on a mechanism to solve this?
**Edit** @ aku
My StackOverflow search skills are weak; I did not find that post. Though I generally dislike peering into the registry, that's a great solution. Thanks!
|
Dealing with circular dependencies in OCaml |
|ocaml| |
I'm writing an interpreter for an experimental language. Three of the main constructs of the language are definitions, statements, and expressions. Definitions can contain statements and expressions, statements can contain definitions and expressions, and one kind of expression can contain statements. I represent all of these using union types so I can easily use pattern matching on them. Ideally, I would like to put the code for these in different files, but OMake complains about circular dependency issues. As far as I know, circular type definitions across modules are not allowed.
The only way I know of to solve this is to define all three types at once:
type defn = ...
and stmt = ...
and expr = ...
It seems like this requires all the code for types to be in the same file. Is there any way around this? How do you deal with circular definitions in your code? |
How much should one DataSet represent? |