instruction
stringlengths
0
30k
I have scripts calling other script files but I need to get the filepath of the file that is currently running within the process. (Executing os.getcwd() returns the original starting script's filepath not the current file's.)
I am trying to implement an "out of proc" COM server written in C#. How do I do this? I need the C# code to be "out of proc" from my main C++ application, because I cannot load the .NET runtime into my main process space.
I am trying to implement an "out of proc" COM server written in C#. How do I do this? I need the C# code to be "out of proc" from my main C++ application, because I cannot load the .NET runtime into my main process space (WHY?: My C++ code is in a DLL that is loaded into many different customer EXE's, some of which ...
Try this (XSLT 2.0): <xsl:template match="/STORIES/STORY"> <component> <xsl:if test="boolean(ARTICLEBODY)"> <xsl:call-template name="insert_paras"> <xsl:with-param name="text" select="ARTICLEBODY/text()"/> </xs...
Broadcast like UDP with the reliability of TCP
|.net|networking|tcp|udp|
I'm working on a .net solution that is run completely inside a single network. When users make a change to the system, I want to launch an announcement and have everyone else hear it and act accordingly. Is there a way that we can broadcast out messages like this (like UDP will let you do) while keeping guaranteed del...
answered in question.
Note: single quotes (even no quotes, if the value doesn't contain a space) is valid according to [the W3C HTML spec][1]. Quote: > By default, SGML requires that all attribute values be delimited using either double quotation marks (ASCII decimal 34) or single quotation marks (ASCII decimal 39)... In certain cases, a...
Using Virtual PC for Web Development with Oracle
|virtual-pc|performance|
I'm new to the Virtual PC party. I was recently introduced to it while working on a small WinForms application and it has been wonderful. I would love to use it when I go back to my real job, which is far more resource intensive. Namely, maintaining and extending multiple very large websites, in Visual Studio 2003 a...
I'm assuming that you're referring to IIS 6. Instead of disabling shutdown altogether, maybe you can just increase the amount of time it waits before killing the process. The server is essentially conserving resources - if your server can stand the resource allocation for a process that mostly sits around doing not...
If you like ASP, and want to move to ASP.NET, skip Webforms and learn MVC.
One way you could do that is to wire up an Application.Load handler in Application.Init, then have that handler unbind itself after running: Sys.Application.add_init(AppInit); function AppInit() { Sys.Application.add_load(RunOnce); } function RunOnce() { // This will only happen ...
Performance, scalability, and a framework that provides a much better foundation for the stateless world of web applications, for a start. [Wikipedia's ASP.Net page has a full section][1] on the differences. [1]: http://en.wikipedia.org/wiki/ASP.NET#ASP.NET_compared_to_ASP_classic
Performance, scalability, and a framework that provides a much better foundation for the stateless world of web applications, for a start. [Wikipedia's ASP.Net page has a section][1] on the differences. [1]: http://en.wikipedia.org/wiki/ASP.NET#ASP.NET_compared_to_ASP_classic
I think Henk nailed it with the "no sttatic access to the type system" thing Another option is that there is no order to types where as numerics and strings can be. Thus a type switch would can't build a binary search tree, just a linear search.
The biggest issue for me is that I create applications, not websites...The UI is a minor part of the problem, the big part is writing the business logic layer, and various enterprise communication components (Connecting to SAP using SOAP? No Problem!). The .NET Toolkit allows me to program in a wonderful object orie...
I have seen this a lot, some of our modules link in excess of a 100 libraries of our code plus system & 3rd party libs. Depending on different linkers HP/Intel/GCC/SUN/SGI/IBM/etc you can get unresolved functions/variables etc, on some platforms you have to list libraries twice. For the most part we use structu...
In Python, how do I get the path and name of the file that is currently executing?
|python|file|scripting|
I have scripts calling other script files but I need to get the filepath of the file that is currently running within the process. For example, let's say I have three files. Using 'execfile', script_1.py calls script_2.py. In turn, script_2.py calls script_3.py. How can I get the file name and path of **script_3.py**...
I have scripts calling other script files but I need to get the filepath of the file that is currently running within the process. For example, let's say I have three files. Using 'execfile', script_1.py calls script_2.py. In turn, script_2.py calls script_3.py. How can I get the file name and path of **script_3.py**...
Other ways to encrypt WCF Connections
|c#|security|wcf|
I'm currently working on a project that requires encrypted data be passed between WCF hosts. As I understand it there are only 2 ways to ensure that data passed over WCF is secure. 1. Using Certificates 2. Using a Domain (or having the same username and password on every machine on the network) Using certificat...
I would think carefully about this since it may not be a necessary feature. Why not just use a text field and let users type in an address? Remember the [KISS principle][1] (Keep It Simple, Stupid). [1]: http://en.wikipedia.org/wiki/KISS_principle
Use a hard-coded key to encrypt the generated key before writing it out. Then you can write it anywhere. Yes you can find the hard-coded key, but so long as you're assuming it's OK to store a symmetric key *anywhere*, it's not less secure.
How do you initialize a 2 dimensional array when you do not know the size
|c#|array-initialize|
I have a two dimensional array that I need to load data into. I know the width of the data (22 values) but I do not know the height. I have it declared as follows: float[,] _calibrationSet; .... int calibrationRow = 0; While (recordsToRead) { for (int i = 0; i < SensorCount;...
The garbage collector runs the finalizer of the object at some indeterminate time. You could implement the IDisposable interface and call the Dispose() method before the object looses Scope - or let the using statement do that for you. see <http://msdn.microsoft.com/en-us/library/system.idisposable.aspx> and <http:...
The garbage collector runs the finalizer of the object at some indeterminate time. You could implement the IDisposable interface and call the Dispose() method before the object looses Scope - or let the using statement do that for you. see <http://msdn.microsoft.com/en-us/library/system.idisposable.aspx> and <http:...
In addition to that omer van kloeten's points. The open source licence is MIT (comparable to BSD licence) this means that if you need make changes to the library you don't have to open-source the changes. (this might be a problem with some companies). For GPL-type licences this can be a problem.
Sprint velocity calculations
|project-management|agile|scrum|methodology|
Need some advice on working out the team velocity for a sprint. Our team normally consists of about 4 developers and 2 testers. The scrum master insists that every team member should contribute equally to the velocity calculation i.e. we should not distinguish between developers and testers when working out how much...
If cross platform support is important then I would second the suggestion to look at Qt. It supports Windows, Linux and the Mac. For free software it is free (there is a GPL version on Unix but not for Windows) but for comercial software it is not particulary cheap. There are now several books on Programming with Qt. ...
For my current PHP project we use the idea of rails migrations and we have a migrations directory in which we keep files title "migration_XX.sql" where XX is the number of the migration. Currently these files are created by hand as updates are made, but their creation could be easily modified. Then we have a script...
Yes your ideas will help. Lean on option 1 if there are no reads happening while your loading. Lean on option 2 if you destination table is being queried during your processing.
Yes your ideas will help. Lean on option 1 if there are no reads happening while your loading. Lean on option 2 if you destination table is being queried during your processing. @Andrew Question. Your inserting in chunks of 300. What is the total amount your inserting? SQL server should be able to handle...
“rusage” statistics
|c++|unix|profiling|
|c++|unix|time|profiling|
I'm trying to use “rusage” statistics in my program to get data similar to that of the [time](http://en.wikipedia.org/wiki/Time_%28Unix%29) tool. However, I'm pretty sure that I'm doing something wrong. The values seem about right but can be a bit weird at times. I didn't find good resources online. Does somebody know ...
Is anyone using Virtual PC to maintain multiple large .NET 1.1 and 2.0 websites? Are there any lessons learned? I used Virtual PC recently with a small WinForms app and it worked great, but then everything works great with WinForms. ASP.NET development hogs way more resources, requires IIS to be running, requires a ...
|performance|virtual-pc|
Is anyone using Virtual PC to maintain multiple large .NET 1.1 and 2.0 websites? Are there any lessons learned? I used Virtual PC recently with a small WinForms app and it worked great, but then everything works great with WinForms. ASP.NET development hogs way more resources, requires IIS to be running, requires a ...
Is your type not public, if so, call the overload that takes in a boolean: Activator.CreateInstance(type, true); Also, in your first example, see if o is null and if not, print out o.GetType().Name to see what it really is.
Combining several third-party libraries into one could create more problems for you--for instance, if two of those libraries define a common symbol which your program doesn't use. Now you've got to extract all (or all-but-one) of the instances of the common symbol before you combine the libraries.
What you can do is that after the broadcast have the **clients** initiate the tcp connections. Otherwise you just have to keep a list of all clients and initiate the connections to each client yourself.
Entity diagrams in ASP.NET MVC
|.net-3.5|asp.net-mvc|graphics|diagram|
What's the best way/tool to display nice diagrams with entity relationships in ASP MVC views? I.e. servers and and applications, or servers with other servers. Are there any third party tools out there that can do this? I've been searching around things like Telerik, but it's really hard to google for this!
|asp.net|asp.net-mvc|.net-3.5|graphics|diagram|
How scalable is System.Threading.Timer?
|c#|.net|multithreading|timer|
I'm writing an app that will need to make use of `Timer`s, but potentially very many of them. How scalable is the `System.Threading.Timer` class? The documentation merely say it's "lightweight", but doesn't explain further. Do these timers get sucked into a single thread (or very small threadpool) that processes all...
This is best handled by DirectShow. DirectShow is currently a part of the platform SDK. HRESULT extractFriendlyName( IMoniker* pMk, std::wstring& str ) { assert( pMk != 0 ); IPropertyBag* pBag = 0; HRESULT hr = pMk->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pBag ); if( F...
[Qt Window Geometry](http://doc.trolltech.com/4.3/geometry.html) Call the move(x, y) method on the child window before show(). The default values for x and y are 0 so that's why it appears in the upper left-hand corner. You can also use the position of the parent window to compute a relative position for the chil...
The difference between using an interface and an abstract class has more to do with code organization for me, than enforcement by the language itself. I use them a lot when preparing code for other developers to work with so that they stay within the intended design patterns. Interfaces are a kind of "design by contrac...
Check out [phc: the PHP compiler][1] If you just want to run it like a script, you may not need to compile it per say, but just run it via the command line. [Read running PHP via the command line.][2] [1]: http://www.phpcompiler.org/ [2]: http://www.php.net/features.commandline
The [Eclipse Web Tools Platform Project][1] includes a JSP debugger. I have only ever needed to use it with Tomcat so I cannot say how well it works with other servlet containers. [1]: http://wiki.eclipse.org/Category:Eclipse_Web_Tools_Platform_Project
Something I bookmarked long ago, but never got to test so far: http://www.schillmania.com/projects/soundmanager2/
.Net 3.5 silent installer?
|.net|.net-3.5|installation|redistributable|
Is there a redistributable .Net 3.5 installation package that is a silent installer? Or alternatively, is there a switch that can be passed to the main redistributable .Net 3.5 installer to make it silent?
FogBugz uses EBS ([Evidence Based Scheduling][1]) to create a probability curve of when you will ship a given project based on existing performance data and estimates. I guess you could do the same thing with this, just you would need to enter for the testers: "Browsing Internet waiting for developers (1 week)" ...
BEA seems to have a free one [BEA JSP plugin][1] - not used it, so not sure how good it is. [1]: http://commerce.bea.com/products/workshop/workshop_prod_fam.jsp
dotnetfx35setup.exe /q /norestart see the .net deployment guide at: http://msdn.microsoft.com/en-us/library/cc160716.aspx
There seems to be a few examples out there that are far better than [what I was going to send you.][1] See [http://krishnabhargav.blogspot.com/2008/02/processing-videos-in-java.html][2]. I'd agree with Stu, however. If you can find a way to get what you want using some command-line tools (and run them using [Comm...
Using nUnit with TFS isn't too difficult. There's even a project on codeplex to implement this: http://www.codeplex.com/nunit4teambuild which even "publishes" the results to the warehouse. I haven't tried it - but I would advise clients who have a large investment (or who have a strong preference for it over the MS...
@Matthew Your query's a start, but it might not work when you have multiple schemas. For example, if I log into our instance as myself, I have read access to all our tables. But if I don't qualify the table name with the schema I'll get an ORA-00942 for tables without synonyms: <pre> SQL> select * from tools; ...
Set based queries are (usually) faster because: 1. They have more information for the query optimizer to optimize 2. They can batch reads from disk 3. There's less logging involved for rollbacks, transaction logs, etc. 4. Less locks are taken, which decreases overhead 5. Set based logic is the focus of RDBM...
Have you tried using transactions? From what you describe, having the server committing 100% of the time to disk, it seems you are sending each row of data in an atomic SQL sentence thus forcing the server to commit (write to disk) every single row. If you used transactions instead, the server would only commit *...
If you're like me, and like videos of presentations, than this is a good tutorial: **A Taste of Haskell** - [Part 1][1] - [Part 2][2] - [Slides][3] It's a three-hour tutorial, that uses [xmonad][4] as a running example to explain Haskell to experienced (imperative) programmers. The presentation is giv...
How to encrypt connection string in WinForms 1.1 app.config?
|database|winforms|
Just looking for the first step basic solution here that keeps the honest people out. Thanks, Mike P.S. When I typed this question into the title box, a set of related questions were automatically listed for me. None answered my question in this case, but this is a really sweet feature!
select timefield from entries where rand() = .01 --will return 1% of rows adjust as needed. --not a mysql expert so I'm not sure how rand() operates in this environment.
What do you want to achieve? Is this a question how video container types are structured? See for example : [http://www.daubnet.com/formats/AVI.html][1] That is a description how avi files are structured. Google may help you in finding other container file formats. [1]: http://www.daubnet.com/formats/AV...
What do you want to achieve? Is this a question how video container types are structured? See for example : [http://www.daubnet.com/formats/AVI.html][1] That is a description how avi files are structured. Google may help you in finding other container file formats. [1]: http://www.daubnet.com/formats/AV...
What do you want to achieve? Is this a question how video container types are structured? See for example : [http://www.daubnet.com/formats/AVI.html][1] That is a description how avi files are structured. Google may help you in finding other container file formats. [1]: http://www.daubnet.com/formats/AV...
> Sergio del Amo: > >> However, I am not getting the pages without tags. I guess i need to write my query with left outer joins. SELECT pagetag.id, page.name, group_concat(tag.name) FROM (page LEFT JOIN pagetag on page.id = pagetag.pageid) LEFT JOIN tag on pagetag.tagid = tag.id group by page....
Add the following to the virtual directory's web.config file: <httpModules> <remove name="ChartStreamHandler"/> </httpModules>
@Rob#37760: select top N points from users order by points desc This query will only select 3 rows if N is 3, see the question. "Top 3" should return 5 rows.
<http://regexlib.com/REDetails.aspx?regexp_id=610> > ^(?=\d)(?:(?:31(?!.(?:0?[2469]|11))|(?:30|29)(?!.0?2)|29(?=.0?2.(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(?:\x20|$))|(?:2[0-8]|1\d|0?[1-9]))([-./])(?:1[012]|0?[1-9])\1(?:1[6-9]|[2-9]\d)?\d\d(?:(?=\x20\d)\x20|$...
<http://regexlib.com/REDetails.aspx?regexp_id=610> > ^(?=\d)(?:(?:31(?!.(?:0?[2469]|11))|(?:30|29)(?!.0?2)|29(?=.0?2.(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(?:\x20|$))|(?:2[0-8]|1\d|0?[1-9]))([-./])(?:1[012]|0?[1-9])\1(?:1[6-9]|[2-9]\d)?\d\d(?:(?=\x20\d)\x20|$...
At work our code base is C++ and Perl and we talk to a MySQL database. For our interface we have some fairly thin custom classes wrapped around the basic MySQL client libraries for our C++ code and the DBI module for our Perl scripts.
As a shot in the dark: Is it a slash issue? I vaguely remember MSBuild forcibly requiring a trailing slash on some of its properties.
SubSonic and LINQ to SQL, hopefully one day soon LINQ to SubSonic though!
I'm not sure whether it will suit your particular case, you didn't mention what platform you're working in, but I've had great success with [Castle Windsor's IOC framework][1]. The dependencies are setup in the config file (it's a .NET framework) [1]: http://www.castleproject.org/container/index.html
Using a [min-heap](http://en.wikipedia.org/wiki/Heap_(data_structure)) is the best way. It is tailor made for this application.
Using a min-heap is the best way. http://en.wikipedia.org/wiki/Heap_(data_structure) It is tailor made for this application. (Markdown is kicking my butt)
Using a min-heap is the best way. <http://en.wikipedia.org/wiki/Heap_&#40;data_structure&#41;> It is tailor made for this application.
Are there benefits to Classic ASP over ASP.net
|asp.net|comparison|asp-classic|interpreted|compiled|
Having worked with Classic ASP for about 2 years now by creating a few 100 simple web forms I can't see a good reason for switching to .net; however, I'm not that versed in .net so I'm sure I could be missing a few things. An over view of why I feel this way is best found here: <a href="http://www.packtpub.com/artic...
Having worked with Classic ASP for about 2 years now by creating a few 100 simple web forms I can't see a good reason for switching to .net; however, I'm not that versed in .net so I'm sure I could be missing a few things. Some points that I often hear around work can be found here: <a href="http://www.packtpub.com/...