instruction
stringlengths
0
30k
Convert complex filename into HTML link
|php|html|
I have a directory with PDF files that I need to create an index for. It is a PHP page with a list of links: <A HREF="path to file">filename</A> The filenames can be complicated: LVD 2-1133 - Ändring av dumpningslina (1984-11-20).pdf What is the correct way to link to this file on a Linux/Apache server? Is there a PHP function to do this conversion?
AFAIK no, one reason is the folder structure on the hard drive, they will have a name like MSSQL10.[instancename]
> Unfortunately, the arguments of > INDIRECT are usually more complex than > that. Here's an actual formula from > one of the sheets, not the most > complex formula we have: > > `=IF(INDIRECT("'"&$B$5&"'!"&$O5&"1")="","",INDIRECT("'"&$B$5&"'!"&$O5&"1"))` hm, you could write a simple parser by ignoring most of the characters and just looking for the relevant parts (in this example: "A..Z", "0..9" and "!:" etc.) but you will run into troubles if the arguments in "indirect" are functions. maybe the safer approach would be to print every occurence of "indirect" in a third sheet. you could then add the desired output and write a small search and replace program to write your changes back. > If you "get" every cell in a huge > spreadsheet you might end up needing > monstrous amounts of memory. I am > still willing to try and take that > risk. PabloG's method of selecting the used range is the way to go (added it into my original code). The speed is pretty good, especially if you check whether the current cell contains a formula. Obviously, this all depends on the size of your workbook.
We branch when a release is ready for final QA. If any issues are discovered during the QA process, the bugs are fixed in the branch, validated and then merged to the trunk. Once the branch passes QA we tag it as a release. Any hotfixes for that release are also done to the branch, validated, merged to the trunk and then tagged as a separate release. The folder structure would look like this (1 QA line, 2 hotfix releases, and the trunk): > /branches >> /REL-1.0 > > /tags >> /REL-1.0 > >> /REL-1.0.1 > >> /REL-1.0.2 > > /trunk
I don't think so. There is a way to create a read-only List and read only Collection, but I don't think there's a built in read only Dictionary. System.ServiceModel has a ReadOnlyDictinoary implementation, but its internal. Probably wouldn't be too hard to copy it though, using Reflector, or to simply create your own from scratch. It basically wraps an Dictionary and throws when a mutator is called.
Migrating database changes from development to live
You can use the `<codeBase>` element found in the application configuration file. More information on "[Locating the Assembly through Codebases or Probing][1]". [1]: http://msdn.microsoft.com/en-us/library/15hyw9x3.aspx
You can use the `<codeBase>` element found in the application configuration file. More information on "[Locating the Assembly through Codebases or Probing][1]". > Well, the loaded assembly doesn't have > an application configuration file. Well if you know the specific folders at runtime you can use [Assembly.LoadFrom][2]. [1]: http://msdn.microsoft.com/en-us/library/15hyw9x3.aspx [2]: http://msdn.microsoft.com/en-us/library/system.reflection.assembly.loadfrom.aspx
Well.. I'd have liked a simple login-pwd combo (that I'd breeze thru with Passwordmaker.org). However being a developer, I can understand that they didnt want to reinvent the login wheel again... OpenID: I enter my blog url => Google sign in => I'm in. It's an extra level.. but it's OK.
Maybe I'm misunderstanding, but don't you only have to ship the libs if the end-user code calls them directly? If all the access to Jpeg methods etc is from your code in your static library, then just link the libs into your lib. I.e. ---------------- | End-user exe | ---------------- | | makes calls to | v -------------------- | Your static lib.a | -------------------- | makes calls to and links v ------------------------------------ ..... | | | ------------- -------- ---------- | libjpeg.a | |libz.a| |libpng.a| ------------- -------- ---------- I.e it's only an issue if end code needs to make direct calls into libz.a, libpng.a etc. If the app code has a legitimate need to call libz.a, for example, then that would as mentioned above be a case for using a dynamic module. PS: Do I get an artists badge? :)
For me, exploring and experimenting within the IDE itself helped me to learn Java and Visual Basic, but I learnt the basics of programming the hard way: Perl 5. There wasn't a free IDE back then, so it meant typing codes into Notepad, saving it, and then run the perl interpreter. I'd say that IDEs make learning the basics of programming easier. Try playing around with control structures and variables first. Say in Java: int a = 5; for (int i = 0; i < a; i++) { System.out.println("i is now " + i); } Basically, simply learning the control structures and variables would allow a beginner to start coding fun stuff already.
The key thing is that the person in question needs to have some problem that they want solving. If you don't have a program that you want to write (and something sensible and well-defined, not "I want to write the next Quake!") then you can't learn to program, because you have nothing to motivate you. I mean, you could read a book and have a rough understanding of a language's syntax and semantics, but until you have _a program that you want written_ you'll never grasp the nettle. If that impetus exists then everything else is just minor details.
Actually, in the case of StackOverflow, a separate account would have saved me a lot of trouble. I decided to use my WordPress.com OpenID, since that's where I'm hosting my blog, but it turned out that WordPress.com have serious problems with their OpenID service, and most of the time I am not able to log on to StackOverflow at all. Of course, I can use a different OpenID provider to log on with, but then I will have a different identity on the site. I guess you could say WordPress.com is to blame for this, but the problem reimains the same. By using OpenID you are depending on another site's service to function. Any problems on the third party's site will in effect also disable your site. As an alternative solution i tried signing in with my Yahoo OpenID, but then I got some random string as the user name, and as DrPizza already pointed out, I would have to edit my personal details anyway. OpenID is a nice idea, but it's still not something I would rely on with the current state of things.
[ImageMagick][1] does a pretty good job. If you're ok with handing off editing tasks to your server... (Seriously? The recommended way of manipulating images in Silverlight is to work with *raw bytes*? That's... incredibly lame.) [1]: http://www.imagemagick.org/script/index.php
How can I get the localized name of a 'special' windows folder (Recycle bin etc.)?
|winapi|localization|recycle-bin|
I'm trying to find out the 'correct' windows API for finding out the localized name of 'special' folders, specifically the Recycle Bin. I want to be able to prompt the user with a suitably localized dialog box asking them if they want to send files to the recycle bin or delete them directly. I've found lots on the internet (and on Stackoverflow) about how to do the actual deletion, and it seems simple enough, I just really want to be able to have the text localized.
Try [JavaCC][1] a parser generator for Java. It has a lot of features for interpreting languages, and it's well supported on Eclipse. [1]: http://javacc.dev.java.net
P/Invoke in Mono
|mono|.net|pinvoke|linux|solaris|
What's the current status of Mono's Platform Invoke implementation on Linux? And on Solaris?
|.net|linux|mono|solaris|pinvoke|
What's the current status of [Mono][1]'s Platform Invoke implementation on Linux? And on Solaris? [1]: http://www.mono-project.com/
All the above answers are correct, as far as I can tell, so I'm going to tell you something else. For production code you really should use the classes in java.util.concurrent. There is very little they cannot do for you, in the area of concurrency in java.
Read this article for code samples and usage: <http://www.codeproject.com/KB/winsdk/SpecialFolders.aspx> Also there is an article on MSDN that helps you [Identify the Location of Special Folders with API Calls][1] [1]: http://msdn.microsoft.com/en-us/library/aa140088(office.10).aspx
Lucene.Net and SQL Server
|sql-server|lucene.net|
Has anyone used Lucene.NET rather than using the full text search that comes with sql server? If so I would be interested on how you implemented it. Did you for example write a windows service that queried the database every hour then saved the results to the lucene.net index?
MySQL vs PostgreSQL for Web Applications
|mysql|postgresql|
I am working on a web application using Python (Django) and would like to know whether MySQL or PostgreSQL would be better when deploying for production. In one [podcast][1] Joel said that he had some problems with MySQL and the data wasn't consistent. I would like to know whether someone had any such problems. Also when it comes to performance which can be easily tweaked? [1]: http://blog.stackoverflow.com/2008/06/podcast-8/
|browser|web-applications|
I am in a position where I can choose the client browser for my web app. The app is being used internally, and we are installing each client "manually".I would like to find a better solution for the browser,so : What is a good browser that I can use as a client to a web application? General functionalities I would like to have: - opening the browser from a shortcut, directly to the application's URL - ability to restrict navigation to a set of allowed URLs - fullscreen mode, no menu, no address bar - javascript - good CSS support - ability to cancel Back button (or at least solve the "Webpage has expired" IE problem) IE7 and FireFox are good candidates, but each seem to have it's own problems and issues.
Your last point, solving the "webpage has expired" problem, can be solved entirely on the server side by judicious use of the "303 see other" HTTP status code. Instead of returning a new page immediately as the result of an HTTP POST, return a 303 result code that redirects to another page that is a GET, that gets the contents you would like to show. This allows the user to use the back button without getting that expired message.
When you run into serious issues, with Firefox you can trace it down to the code and maybe get someone to fix it. With IE, you can't.
There isn't really something you can **do wrong** to prevent a window from being closed on the client. My guess is this is a problem with the system installation. Test this again using another browser on the same computer, and then on another computer.
> What languages/environments have you used for developing scientific software, esp. data analysis? What libraries? (E.g., what do you use for plotting?) python, numpy, pylab (plotting) > Was there any training for people without any significant background in programming? No, but I was working in a multimedia research lab, so almost everybody had a CS background. > Did you have anything like version control, bug tracking? Yes, subversion for version control, trac for bug tracing and wiki. You can get free bug tracker/version control hosting from http://www.assembla.com/ if their TOS fits your project. > How would you go about trying to create a decent environment for programming, without getting too much in the way of the individual scientists (esp. physicists are stubborn people!). Make sure the infrastructure is set up and well maintained and try to sell the benefits of source control.
Because of your specific requirements you might want to consider embedding the IE ActiveX into a desktop application. That way you get full control of the client.
Looks like, among other very interesting proposals, there is one about refining generics and braking backwards compatibility: > Currently, generics are implemented > using erasure, which means that the > generic type information is not > available at runtime, which makes some > kind of code hard to write. Generics > were implemented this way to support > backwards compatibility with older > non-generic code. Reified generics > would make the generic type > information available at runtime, > which would break legacy non-generic > code. However, Neal Gafter has > proposed making types reifiable only > if specified, so as to not break > backward compatibility. at [Alex Miller's article about Java 7 Proposals][1] [1]: http://tech.puredanger.com/java7#reified
Strange, I came up on Google with [many relevant results][1] and [this one][2] is probably the most complete. > The function "getDirectorySize" will > ignore link/shorcuts to > files/directory. The function > "sizeFormat" will suffix the size with > bytes,KB,MB or GB accordingly. Code - function getDirectorySize($path) { $totalsize = 0; $totalcount = 0; $dircount = 0; if ($handle = opendir ($path)) { while (false !== ($file = readdir($handle))) { $nextpath = $path . '/' . $file; if ($file != '.' && $file != '..' && !is_link ($nextpath)) { if (is_dir ($nextpath)) { $dircount++; $result = getDirectorySize($nextpath); $totalsize += $result['size']; $totalcount += $result['count']; $dircount += $result['dircount']; } elseif (is_file ($nextpath)) { $totalsize += filesize ($nextpath); $totalcount++; } } } } closedir ($handle); $total['size'] = $totalsize; $total['count'] = $totalcount; $total['dircount'] = $dircount; return $total; } function sizeFormat($size) { if($size<1024) { return $size." bytes"; } else if($size<(1024*1024)) { $size=round($size/1024,1); return $size." KB"; } else if($size<(1024*1024*1024)) { $size=round($size/(1024*1024),1); return $size." MB"; } else { $size=round($size/(1024*1024*1024),1); return $size." GB"; } } Usage - $path="/httpd/html/pradeep/"; $ar=getDirectorySize($path); echo "<h4>Details for the path : $path</h4>"; echo "Total size : ".sizeFormat($ar['size'])."<br>"; echo "No. of files : ".$ar['count']."<br>"; echo "No. of directories : ".$ar['dircount']."<br>"; Output - Details for the path : /httpd/html/pradeep/ Total size : 2.9 MB No. of files : 196 No. of directories : 20 [1]: http://www.google.com.au/search?hl=en&q=php+directory+size&btnG=Google+Search&meta= [2]: http://www.go4expert.com/forums/showthread.php?t=290
If you're using a DataTable, you can use the (DataTable.DefaultView) [DataView.Sort][1] property. For greater flexibility you can use the [BindingSource][2] component. BindingSource will be the DataSource of your combobox. The you can change your data source from a DataTable or List without changing the DataSource of the combobox. > The BindingSource component serves > many purposes. First, it simplifies > binding controls on a form to data by > providing currency management, change > notification, and other services > between Windows Forms controls and > data sources. [1]: http://msdn.microsoft.com/en-us/library/system.data.dataview.sort.aspx [2]: http://msdn.microsoft.com/en-us/library/system.windows.forms.bindingsource.aspx
If you're using a DataTable, you can use the (DataTable.DefaultView) [DataView.Sort][1] property. For greater flexibility you can use the [BindingSource][2] component. BindingSource will be the DataSource of your combobox. Then you can change your data source from a DataTable to List without changing the DataSource of the combobox. > The BindingSource component serves > many purposes. First, it simplifies > binding controls on a form to data by > providing currency management, change > notification, and other services > between Windows Forms controls and > data sources. [1]: http://msdn.microsoft.com/en-us/library/system.data.dataview.sort.aspx [2]: http://msdn.microsoft.com/en-us/library/system.windows.forms.bindingsource.aspx
|php|mysql|migration|schema|
Perhaps the biggest risk in pushing new functionality to live lies with the database modifications required by the new code. In Rails, I believe they have 'migrations', in which you can programmatically make changes to your development host, and then make the same changes live along with the code that uses the revised schema. And roll both back if needs be, in a synchronised fashion. Has anyone come across a similar toolset for PHP/MySQL? Would love to hear about it, or any programmatic or process solutions to help make this less risky...
<a href="http://en.wikipedia.org/wiki/Url_encoding">URL encoding</a>. I think it's <code>urlencode()</code> in PHP.
custom action dll in managed code
|.net|installation|
How can I call a custom action dll written in managed code (.net) from an installer without using an unmanaged intermediary?
I would suggest [SQLite](http://www.sqlite.org/index.html) because the entire database is stored in a single file, and it quite safely handles multiple users accessing it at the same time. There are several different libraries that you can use for your client application and there is no server software needed. One of the strengths is that it mimics SQL servers so closely that if you need to convert from using a database file to a full-fledged SQL Server, most of your queries in your client won't need to change. You'll just need to migrate the data over to the new server database (which I wouldn't be surprised if there are programs to convert SQLite databases to MySQL databases, for example.)
You can use [rawurlencode()][1] to convert a string according to the RFC 1738 spec. This function replaces all non-alphanumeric characters by their associated code. The difference with [urlencode()][2] is that spaces are encoded as plus signs. You'll probably want to use the last one. This technique is called Percent or URL encoding. See [Wikipedia][3] for more details. [1]: http://php.net/manual/en/function.rawurlencode.php [2]: http://php.net/manual/en/function.urlencode.php [3]: http://en.wikipedia.org/wiki/Url_encoding
[Wikipedia][1]? [1]: http://en.wikipedia.org/wiki/Comparison_of_JavaScript_frameworks
GACUTIL doesn't register DLLs -- not in the "COM" sense. Unlike in COM, GACUTIL copies the file to an opaque directory under %SYSTEMROOT%\assembly and that's where they run from. It wouldn't make sense to ask GACUTIL "register a folder" (not that you can do that with RegSvr32 either). You can use a batch FOR command such as: FOR %a IN (C:\MyFolderWithAssemblies\*.dll) DO GACUTIL /i %a If you place that in a batch file, you must replace %a with %%a
[rawurlencode][1] will encode "exotic" characters in a URL. [1]: http://uk2.php.net/manual/en/function.rawurlencode.php
As far as I know, there is not. But may be you can copy some code (and learn alot) from these articles: [Immutability in C# Part One: Kinds of Immutability][1] [Immutability in C# Part Two: A Simple Immutable Stack][2] [Immutability in C# Part Three: A Covariant Immutable Stack][3] [Immutability in C# Part Four: An Immutable Queue][4] [Immutability in C# Part Six: A Simple Binary Tree][6] [Immutability in C# Part Seven: More on Binary Trees][7] [Immutability in C# Part Eight: Even More On Binary Trees][8] [Immutability in C# Part Nine: Academic? Plus my AVL tree implementation][9] [Immutability in C# Part 10: A double-ended queue][10] [Immutability in C# Part Eleven: A working double-ended queue][11] [1]: http://blogs.msdn.com/ericlippert/archive/2007/11/13/immutability-in-c-part-one-kinds-of-immutability.aspx [2]: http://blogs.msdn.com/ericlippert/archive/2007/12/04/immutability-in-c-part-two-a-simple-immutable-stack.aspx [3]:http://blogs.msdn.com/ericlippert/archive/2007/12/06/immutability-in-c-part-three-a-covariant-immutable-stack.aspx [4]:http://blogs.msdn.com/ericlippert/archive/2007/12/10/immutability-in-c-part-four-an-immutable-queue.aspx [6]:http://blogs.msdn.com/ericlippert/archive/2007/12/18/immutability-in-c-part-six-a-simple-binary-tree.aspx [7]:http://blogs.msdn.com/ericlippert/archive/2007/12/19/immutability-in-c-part-seven-more-on-binary-trees.aspx [8]:http://blogs.msdn.com/ericlippert/archive/2008/01/18/immutability-in-c-part-eight-even-more-on-binary-trees.aspx [9]:http://blogs.msdn.com/ericlippert/archive/2008/01/21/immutability-in-c-part-nine-academic-plus-my-avl-tree-implementation.aspx [10]:http://blogs.msdn.com/ericlippert/archive/2008/01/22/immutability-in-c-part-10-a-double-ended-queue.aspx [11]:http://blogs.msdn.com/ericlippert/archive/2008/02/12/immutability-in-c-part-eleven-a-working-double-ended-queue.aspx
It took me a while to understand OpenID (so many providers!) but I really like the concept. Tie it in with Gravatar and rewriting your profile is much more painless - perhaps one or two fields. The only issues are that you have to trust your OpenID provider - but that's not really what I'd call a problem, more like common sense. **Edit:** People having problems with OpenID providers should consider setting up a new one. My provider is myopenid.com and I've had no problems. You can setup multiple personas (like profiles) so I have one for blog comments, one for technology sites like this. As for having a new SO profile Jeff said something about being able to change your OpenID without losing your profile stats in the future.
Do you need two arrays of DataRows? the DataRow object has a RowState property which will give you what you require. See the MSDN Docs: [http://msdn.microsoft.com/en-us/library/system.data.datarow.rowstate.aspx][1] [1]: http://msdn.microsoft.com/en-us/library/system.data.datarow.rowstate.aspx
At least in the intranet scenario, I think Active Directory (or similar) is still one of the best options.
Also, SSO (as you mentioned) usually implies that I only have to login once (presumably to my workstation) and then from there on, I don't need to sign-in anywhere. OpenID of course doesn't solve that problem. For example, if I use OpenID to sign in to StackOverflow, it doesn't mean I don't need to sign in to another website again using the same openID.
Usually, an overview of each field is a good thing to have when looking at any topic, but it's rare to have a genuine dependence the way we'd think of it. Algebra is always needed. I can't think of a time I've needed any trigonometry. (except to expand it with new things from calculus) I'm even quite sure people wouldn't agree on what a dependency graph would look like, or even in which field each topic belongs. I think the right way to approach it is to just collect a wide range of topics from all of branches and read them in whatever order you feel like, recording dependencies between topics as you go. (respecting them, or not, as you please.) This should have the far more important property of **keeping the student interested**. It's also my experience that if something just has you stumped, just mark it and set it aside for later. As for my school, well, it was similar to Harrison's: * cominatorics, * linear algebra, * calculus, * numerical analysis (error analysis in particular.) * logic, * statistics, (with operations research / queueing therory.)
I seriously think introducing ORM into a legacy application is calling for trouble (and might be the same amount of trouble as a complete rewrite). Other than that, ORM is a great way to go, and should definitely by considered.
I have to say that I absolutely agree with the statements on it being too difficult for the "average" Internet user. I think that OpenID could still be considered "new", even though the original proposal was back in 2005. More high traffic sites are taking it up as just an option for creating an account, rather than requiring users to have an OpenID present. In my opinion, as long as normal username/password account creation is offered alongside OpenID, average Internet users will naturally begin to try and eventually stick with using OpenID. The authentication issues apply just as much to OpenID as registering on any website. You put your trust in the website with your password (assuming you do not use a password storage program) so that shouldn't be used against OpenID. All that aside, the standardization of account creation is absolutely cream gravy to a web developer. I'd just love to not even have to worry about the normal creation process, and rather just drop in an OpenID library and reference it to the database.
There are a couple under development. - [GitNub][1] - [Gitty][2] I don't know if there are any that have hit 1.0. [1]: http://github.com/Caged/gitnub/tree/master "GitNub" [2]: http://github.com/Machx/gitty/tree/master "Gitty"
In todays world: It's neglectible. I think memory consumption was about 50 MB bigger with eAccelerator then it was without when I did my [benchmarks][1]. If you really need the speed but do have headaches that your RAM might be not enough: grab $40 and buy another GIG of RAM for your server ;) [1]: http://blogs.interdose.com/dominik/2008/04/11/benchmarking-php-eaccelerator-und-andere-opcode-caches/
@Silas The sanity checking is a good idea. However, the regex doesn't cover all DOIs. The first element must (currently) be 10, and the second element must (currently) be numeric, but the third element is barely restricted at all: > "Legal characters are the legal graphic characters of Unicode. This specifically excludes the control character ranges 0x00-0x1F and 0x80-0x9F..." and that's where the real problem lies. In practice, I've never seen whitespace used, but the spec specifically allows for it. Basically, there doesn't seem to be a sensible way of detecting the *end* of a DOI.
I have run several [benchmarks with eAcclerator, APC, XCache][1] and (even though it is a optimizer, not a cache) Zent Optimizer ![Benchmark Results][2] Result: eAccelerator is fastest (in all tests), followed by XCache and APC. (The one in the diagram is the number of seconds to call a WordPress home page 10,000 times). Zend Optimizer made everything slower (!). [1]: http://blogs.interdose.com/dominik/2008/04/11/benchmarking-php-eaccelerator-und-andere-opcode-caches/ [2]: http://blogs.interdose.com/dominik/wp-content/uploads/2008/04/opcode_wordpress.png
I have run several [benchmarks with eAcclerator, APC, XCache][1] and (even though it is a optimizer, not a cache) Zend Optimizer ![Benchmark Results][2] Result: eAccelerator is fastest (in all tests), followed by XCache and APC. (The one in the diagram is the number of seconds to call a WordPress home page 10,000 times). Zend Optimizer made everything slower (!). [1]: http://blogs.interdose.com/dominik/2008/04/11/benchmarking-php-eaccelerator-und-andere-opcode-caches/ [2]: http://blogs.interdose.com/dominik/wp-content/uploads/2008/04/opcode_wordpress.png
For Windows: [Filemon](http://technet.microsoft.com/en-us/sysinternals/bb896642.aspx) from SysInternals will show you what files are being accessed. Remember to set your filters so you are not overwhelmed by the chatty file system traffic. ![Filter Dialog][1] [1]: http://img134.imageshack.us/img134/6136/filmobe5.jpg
Are you sure you aren't mixing up SSAS (Analysis Services) and SSIS (integration services)? SSAS is not an ETL, it is an OLAP tool. SSIS is an ETL tool. I agree with everything that Rowan said. I'm just confused by the terms.
In the meantime, I've tried it two tools that have some sort of integration with vim. The first is [Rope][1], a python refactoring library that comes with a Vim (and emacs) plug-in. I tried it for a few renames, and that definately worked as expected. It allowed me to preview the refactoring as a diff, which is nice. It is a bit text-driven, but that's alright for me, just takes longer to learn. The second is [Bicycle Repair Man][2] which I guess wins points on name. Also plugs into vim and emacs. Haven't played much with it yet, but I remember trying it a long time ago. Haven't played with both enough yet, or tried more types of refactoring, but I will do some more hacking with them. [1]: http://rope.sourceforge.net/ [2]: http://bicyclerepair.sourceforge.net/
|mysql|postgresql|
Exposing a remote interface or object model.
|java|osgi|eclipse|oop|
|java|eclipse|oop|osgi|
I have a question on the best way of exposing a remote interface. As a means of improving my lacking skills in this area, I have started a [project](http://Telharmonium.devjavu.com/) to create an Eclipse-based front-end for [xmms2](http://xmms2.xmms.se). 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). So, the question is; how should I expose the remote interface as a neat data model (In particular track management and event handling)? 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 I welcome anything from generic discussions to pattern name-dropping or concrete examples and patches :)
I have a question on the best way of exposing a remote interface. 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). 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). So, the question is; how should I expose the remote interface as a neat data model (In particular track management and event handling)? 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 I welcome anything from generic discussions to pattern name-dropping or concrete examples and patches :)
Keith, I'm working on VS add-in for WPF applications localization. I want to be able to manage project specific settings via "project properties" page. I did some research and it seems that it is not possible to extend existing projects in this way.
Zemanta/Open Calais, how do they do that.
|python|ruby|semantics|
I was wondering how as semantic service like Open Calais figures out the names of companies, or people, tech concepts ,keywords etc from a piece of text. Is it because they have a large database that they match the text against? How would a service like Zemanta know what images to suggest to a piece of text for instance? Was hoping someone could shed some light on this. Thanks alot Marco
In my own wiki system my caching system is pretty simple - when the page is updated it checks links to make sure they are valid and applies the correct formatting/location for those that aren't. The cached page is saved as a HTML page in my cache root. Pages that are marked as 'not created' during the page update are inserted into the a table of the database that holds the page and then a csv of pages that link to it. When someone creates that page it initiates a scan to look through each linking page and re-caches the linking page with the correct link and formatting. If you weren't interested in highlighting non-created pages however you could just have a checker to see if the page is created when you attempt to access it - and if not redirect to the creation page. Then just link to pages as normal in other articles.
Unless your code is already architectured to allow for "hot swapping" of your model layer backend, changing it in any way will always be extremely risky. Trying to build a safety net of unit tests on poorly architected code isn't going to guarantee success, only make you feel safer about changing it. So, unless you have a strong business case for taking on the risks involved it's probably best to leave well enough alone. My 2 cents
To summerize the answers and what I've found so far, here are some good links to answer this question: - [Encrypting Configuration Information in ASP.NET 2.0 Applications - 4GuysFromRolla.com][1] - [Encrypt Connection Strings AppSettings and Web.Config in ASP.NET 2.0 - Security Best Practices][2] - [Encrypting .NET configuration files through code][3] (VB.NET) - [How To: Encrypt Configuration Sections in ASP.NET 2.0 Using DPAPI - MSDN][4] Please feel free to complement with other links, maybe some to WinForms- or WPF-applications. [1]: https://web.archive.org/web/20211029043331/https://aspnet.4guysfromrolla.com/articles/021506-1.aspx [2]: http://davidhayden.com/blog/dave/archive/2005/11/17/2572.aspx [3]: http://blogs.techrepublic.com.com/programming-and-development/?p=448 [4]: http://msdn.microsoft.com/en-us/library/ms998280.aspx
To summarize the answers and what I've found so far, here are some good links to answer this question: - [Encrypting Configuration Information in ASP.NET 2.0 Applications - 4GuysFromRolla.com][1] - [Encrypt Connection Strings AppSettings and Web.Config in ASP.NET 2.0 - Security Best Practices][2] - [Encrypting .NET configuration files through code][3] (VB.NET) - [How To: Encrypt Configuration Sections in ASP.NET 2.0 Using DPAPI - MSDN][4] Please feel free to complement with other links, maybe some to WinForms- or WPF-applications. [1]: https://web.archive.org/web/20211029043331/https://aspnet.4guysfromrolla.com/articles/021506-1.aspx [2]: http://davidhayden.com/blog/dave/archive/2005/11/17/2572.aspx [3]: http://blogs.techrepublic.com.com/programming-and-development/?p=448 [4]: http://msdn.microsoft.com/en-us/library/ms998280.aspx
Honestly? I've never found a use for staticmethod or classmethod. I've yet to see an operation that can't be done using a global function or an instance method. It would be different if python used private and protected members more like Java does. In Java, I need a static method to be able to access an instance's private members to do stuff. In Python, that's rarely necessary. Usually, I see people using staticmethods and classmethods when all they really need to do is use python's module-level namespaces better.
Without a home directory sudo useradd myuser With home directory sudo useradd -m myuser Then set the password sudo passwd myuser
When should I mock?
|mocking|unit-testing|
I have a basic understanding of mock and fake objects, but I'm not sure I have a feeling about when/where to use mocking - especially as it would apply to [this][1] scenario here. [1]: http://stackoverflow.com/questions/37375/how-do-i-unit-test-a-wcf-service
|unit-testing|mocking|
I have a basic understanding of mock and fake objects, but I'm not sure I have a feeling about when/where to use mocking - especially as it would apply to this scenario [**here**][1]. [1]: http://stackoverflow.com/questions/37375/how-do-i-unit-test-a-wcf-service
I'm not exactly a 'natural' scientist (I study transportation) but am an academic who writes a lot of my own software for data analysis. I try to write as much as I can in Python, but sometimes I'm forced to use other languages when I'm working on extending or customizing an existing software tool. There is very little programming training in my field. Most folks are either self-taught, or learned their programming skills from classes taken previously or outside the discipline. I'm a big fan of version control. I used Vault running on my home server for all the code for my dissertation. Right now I'm trying to get the department to set up a Subversion server, but my guess is I will be the only one who uses it, at least at first. I've played around a bit with FogBugs, but unlike version control, I don't think that's nearly as useful for a one-man team. As for encouraging others to use it, that's really the problem I'm facing now. I'm planning on forcing my grad students to use it on research projects they're doing for me, and encouraging them to use it for their own research. If I reach a class involving programming, I'll probably force the students to use version control there too (grading them on what's in the repository). As far as my colleagues and their grad students go, all I can really do is make a server available and rely on gentle persuasion and setting a good example. Frankly, at this point I think it's more important to get them doing regular backups than get them on source control (some folks are carrying around the only copy of their research data on USB flash drives).
I'm not exactly a 'natural' scientist (I study transportation) but am an academic who writes a lot of my own software for data analysis. I try to write as much as I can in Python, but sometimes I'm forced to use other languages when I'm working on extending or customizing an existing software tool. There is very little programming training in my field. Most folks are either self-taught, or learned their programming skills from classes taken previously or outside the discipline. I'm a big fan of version control. I used Vault running on my home server for all the code for my dissertation. Right now I'm trying to get the department to set up a Subversion server, but my guess is I will be the only one who uses it, at least at first. I've played around a bit with FogBugs, but unlike version control, I don't think that's nearly as useful for a one-man team. As for encouraging others to use version control and the like, that's really the problem I'm facing now. I'm planning on forcing my grad students to use it on research projects they're doing for me, and encouraging them to use it for their own research. If I teach a class involving programming, I'll probably force the students to use version control there too (grading them on what's in the repository). As far as my colleagues and their grad students go, all I can really do is make a server available and rely on gentle persuasion and setting a good example. Frankly, at this point I think it's more important to get them doing regular backups than get them on source control (some folks are carrying around the only copy of their research data on USB flash drives).
Best practice for integrating TDD with web application development?
|web|testing|development|tdd|unit|
Unit testing and ASP.NET web applications are an ambiguous point in my group. More often than not, good testing practices fall through the cracks and web applications end up going live for several years with no tests. The cause of this pain point generally revolves around the hassle of writing UI automation mid-development. How do you or your organization integrate best TDD practices with web application development?
|unit-testing|web|development|tdd|
You can use the [LogonUser][1] property of Windows Installer as a condition to the action launching the EXE. [1]: http://msdn.microsoft.com/en-us/library/aa369780(VS.85).aspx
I am a big fan of [Red Gate][1] products that help creating SQL packages to update database schemas. The database scripts can be added to source control to help with versioning and rollback. [1]: http://www.red-gate.com/