instruction
stringlengths
0
30k
The Wii Remote and Wii Balance Board use bluetooth. You can [pair them with your PC][1] and write your own PC apps that interact with them (like [this guy][2]). If you want to make something that actually runs on the Wii, you can try finding some [homebrew development][3] help. If you want to actually sell your software for Wii, you need: 1. game development experience 2. secure office facilities 3. $2,000 - $10,000 for dev kit (WiiWare is cheapest) [The Nintendo Software Development Support Group][4] [Authorized Developer Application][5] [1]: http://www.wiiprojects.org/bluetooth.html [2]: http://www.cs.cmu.edu/~johnny/projects/wii/ [3]: http://en.wikipedia.org/wiki/Wii_homebrew [4]: http://www.warioworld.com/ [5]: http://www.warioworld.com/apply/
Opcode cache impact on memory ussage
|php|opcode-cache|
Can anyone tell me what is the memory usage overhead associated with PHP opcode cache? I've seen a lot of reviews of opcode cache but all of them only concentrate on the performance increace. I have a small entry level VPS and memory limits are a concern for me.
How Would You Programmatically Create a Pattern from a Date that is Stored in a String?
As others have said, the pattern looks like it should be new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy" As for parsing an arbitrary format date, I'm not aware of any library which does this in Java. If you were keen to develop such a thing, I would start by looking at the perl [str2time][1] function. [1]: http://search.cpan.org/~rse/lcwa-1.0.0/lib/lwp/lib/HTTP/Date.pm
How about: `EEE MMM dd HH:mm:ss zzz yyyy` Just pass the string into the constructor of SimpleDateFormat. To use the object, just call the parse method passing in the string you want converted to a Date. You could take a look at: [http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html][1] [1]: http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
I guess it depends on what you mean by pretty. For example, I do not find it particularly difficult to produce say, reasonable graphs and tables with alternate line shading in Access. It is also possible to use MS Word and fill in bookmarks, or mail merge. If the present system uses VBA to create the PowerPoint presentation, perhaps much of it could be transferred to Access? Microsoft have an article on Access to Powerpoint: <http://msdn.microsoft.com/en-us/library/aa159920(office.11).aspx> Finally, it is not impossible to build HTML output from Access.
How to select the nth row in a SQL database table?
|sql|database|
I'm interested in learning some (ideally) database agnostic ways of selecting the *n*th row from a database table. It would also be interesting to see how this can be achieved using the native functionality of the following databases: - SQL Server - MySQL - PostgreSQL - SQLite - Oracle I am currently doing something like the following in SQL Server 2005, but I'd be interested in seeing other's more agnostic approaches: <pre>WITH Ordered AS ( SELECT ROW_NUMBER() OVER (ORDER BY OrderID) AS RowNumber, OrderID, OrderDate FROM Orders) SELECT * FROM Ordered WHERE RowNumber = 1000000</pre> Credit for the above SQL: [Firoz Ansari's Weblog][1] [1]: http://weblogs.asp.net/Firoz/archive/2005/06/12/411949.aspx
I'm interested in learning some (ideally) database agnostic ways of selecting the *n*th row from a database table. It would also be interesting to see how this can be achieved using the native functionality of the following databases: - SQL Server - MySQL - PostgreSQL - SQLite - Oracle I am currently doing something like the following in SQL Server 2005, but I'd be interested in seeing other's more agnostic approaches: <pre>WITH Ordered AS ( SELECT ROW_NUMBER() OVER (ORDER BY OrderID) AS RowNumber, OrderID, OrderDate FROM Orders) SELECT * FROM Ordered WHERE RowNumber = 1000000</pre> Credit for the above SQL: [Firoz Ansari's Weblog][1] **Update:** See [Troels Arvin's answer][2] regarding the SQL standard. *Troels, have you got any links we can cite?* [1]: http://weblogs.asp.net/Firoz/archive/2005/06/12/411949.aspx [2]: http://stackoverflow.com/questions/16568/how-to-select-the-nth-row-in-a-sql-database-table#42765
|xhtml|powerpoint|embed|
Is it possible to embed a powerpoint presentation (ppt) into a webpage (xhtml)? This will be used on a local Intranet where there is a mix of IE6 and 7 only so no need to consider other browsers.
how do I import a class to use inside Flex application?
|apache-flex|actionscript-3|
I have an actionscript file that defines a class that I would like to use inside a Flex application. I have defined some custom controls in a actionscript file and then import them via the application tag: <pre> <code> &lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:scorecard="com.apterasoftware.scorecard.controls.*" ... &lt;/mx:Application&gt; </code> </pre> but this code is not a flex component, rather it is a library for performing math routines, how do I import this class?
The first few results on Google all sound like good options: http://www.pptfaq.com/FAQ00708.htm http://www.webdeveloper.com/forum/showthread.php?t=86212
Wow! Lots of questions! Until a year ago I relied 100% on transactions. Now its only 98%. In special cases of high traffic websites (like Sara mentioned) and also high partitioned data, enforcing the need of distributed transactions, a transactionless architecture can be adopted. Now you'll have to code referential integrity in the application. Also, I like to manage transactions declaratively using annotations (I'm a Java guy) and aspects. That's a very clean way to determine transaction boundaries and it includes transaction propagation functionality.
You may want to create a third package the runs packageA and then packageB.
You may want to create a third package the runs packageA and then packageB. The third package would only contain two execute package tasks. http://msdn.microsoft.com/en-us/library/ms137609.aspx
You may want to create a third package the runs packageA and then packageB. The third package would only contain two execute package tasks. http://msdn.microsoft.com/en-us/library/ms137609.aspx @Craig A status table is an option but you will have to keep monitoring it. Here is an article about events in SSIS for you original question. http://www.databasejournal.com/features/mssql/article.php/3558006
'stash' takes the uncommitted, "*dirty*" stuff on your working copy, and stashes it away, leaving you with a clean working copy. It doesn't really branch at all. You can then apply the stash on top of any other branch. Or, as of Git 1.6, you can do: git stash branch <branchname> [<stash>] to apply the stash on top of a new branch, all in one command. So, stash works great if you have not committed to the "*wrong*" branch yet. If you've already committed, then the workflow you describe in your question is a better alternative. And by the way, you're right: Git is very flexible, and with that flexibility comes overlapping functionality.
You'd need to import the class inside a script tag. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script> import com.apterasoftware.scorecard.controls.*; // Other imports go here // Functions and other code go here </mx:Script> <!-- Components and other MXML stuff go here --> <mx:VBox> <!-- Just a sample --> </mx:VBox> </mx:Application> Then you'll be able to reference that class anywhere else in your script tag. Depending on how the class is written you may not be able to use binding within the MXML, but you could define your own code to handle that. Namespace declarations are only used to import other MXML components. AS classes are imported using the import statement either within a Script block or another AS file.
If there's no requirement on preserving file type after scaling I'd recommend the following approach. Image src = Image.FromFile("main.gif"); Bitmap dst = new Bitmap(100, 129); using (Graphics g = Graphics.FromImage(dst)) { g.SmoothingMode = SmoothingMode.AntiAlias; g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.DrawImage(src, 0, 0, b.Width, b.Height); } dst.Save("scale.png", ImageFormat.Png); The result will have really nice anti aliased edges ![Hosted by imageshack][1] If you must export the image in gif you're in for a ride; GDI+ doesn't play well with gif. See [this blog post][2] about it for more information [1]: http://img398.imageshack.us/img398/8110/scalezy6.png [2]: http://www.ben-rush.net/blog/PermaLink.aspx?guid=103ed74d-c808-47ba-b82d-6e9367714b3e&dotnet=consultant
If there's no requirement on preserving file type after scaling I'd recommend the following approach. Image src = Image.FromFile("main.gif"); using (Graphics g = Graphics.FromImage(dst)) { g.SmoothingMode = SmoothingMode.AntiAlias; g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.DrawImage(src, 0, 0, b.Width, b.Height); } dst.Save("scale.png", ImageFormat.Png); dst.Dispose(); src.Dispose(); The result will have really nice anti aliased edges ![Hosted by imageshack][1] If you must export the image in gif you're in for a ride; GDI+ doesn't play well with gif. See [this blog post][2] about it for more information **Edit:** I forgot to dispose of the bitmaps in the example; it's been corrected [1]: http://img398.imageshack.us/img398/8110/scalezy6.png [2]: http://www.ben-rush.net/blog/PermaLink.aspx?guid=103ed74d-c808-47ba-b82d-6e9367714b3e&dotnet=consultant
If there's no requirement on preserving file type after scaling I'd recommend the following approach. using (Image src = Image.FromFile("main.gif")) { using (Bitmap dst = new Bitmap(100, 129)) { using (Graphics g = Graphics.FromImage(dst)) { g.SmoothingMode = SmoothingMode.AntiAlias; g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.DrawImage(src, 0, 0, dst.Width, dst.Height); } dst.Save("scale.png", ImageFormat.Png); } } The result will have really nice anti aliased edges ![Hosted by imageshack][1] If you must export the image in gif you're in for a ride; GDI+ doesn't play well with gif. See [this blog post][2] about it for more information **Edit:** I forgot to dispose of the bitmaps in the example; it's been corrected [1]: http://img398.imageshack.us/img398/8110/scalezy6.png [2]: http://www.ben-rush.net/blog/PermaLink.aspx?guid=103ed74d-c808-47ba-b82d-6e9367714b3e&dotnet=consultant
[Here][1] we can read that it is possible, but the exe will be loaded as an library and not started in it's own process like an exe. I don't know if that is a problem for you? It also contains some possible solutions if you do want to make it act like a real out of process com server. But maybe using another way of inter process communication is better. Like .Net Remoting. [1]: http://www.codeproject.com/KB/COM/BuildCOMServersInDotNet.aspx
How can I generate a unique, small, random, and user-friendly key?
|encoding|cryptography|key|
A few months back I was tasked with implementing a unique and random code for our web application. The code would have to be user friendly and as small as possible, but still be essentially random (so users couldn't easily predict the next code in the sequence). It ended up generating values that looked something like this: Af3nT5Xf2 Unfortunately, I was never satisfied with the implementation. Guid's were out of the question, they were simply too big and difficult for users to type in. I was hoping for something more along the lines of 4 or 5 characters/digits, but our particular implementation would generate noticeably patterned sequences if we encoded to less than 9 characters. Here's what we ended up doing: We pulled a unique sequential 32bit id from the database. We then inserted it into the center bits of a 64bit RANDOM integer. We created a lookup table of easily typed and recognized characters (A-Z, a-z, 2-9 skipping easily confused characters such as L,l,1,O,0, etc.). Finally, we used that lookup table to base-54 encode the 64-bit integer. The high bits were random, the low bits were random, but the center bits were sequential. The final result was a code that was much smaller than a guid and looked random, even though it absolutely wasn't. I was never satisfied with this particular implementation. What would you guys have done?
How do you use the new ModelBinder classes in ASP.NET MVC Preview 5
|asp.net-mvc|
You'll notice that Preview 5 includes the following in their release notes: > Added support for custom model binders. Custom binders allow you to define complex types as parameters to an action method. To use this feature, mark the complex type or the parameter declaration with [ModelBinder(…)]. So how do you go about actually using this facility so that I can have something like this work in my Controller: public ActionResult Insert(Contact contact) { if (this.ViewData.ModelState.IsValid) { this.contactService.SaveContact(contact); return this.RedirectToAction("Details", new { id = contact.ID} } }
When you get this (and other errors out of the InnoDB engine) issue: SHOW ENGINE INNODB STATUS; It will give a more detailed reason why the operation couldn't be completed. Make sure to run that from something that'll allow you to scroll or copy the data, as the response is quite long.
I've never been a fan of nested try/catch blocks, so I'd do it something like: var xmlHttp; if (window.XMLHttpRequest) { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } else if (window.ActiveXObject) { try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } if (xmlHttp) { // No errors, do whatever you need. } I think that'll work. But as has been mentioned before - why reinvent the wheel, use a library. Even better - find out how they do it.
Both answers were very helpful! Here's what I ended up with: if( typeof( rpNameSpace ) == "undefined" ) rpNameSpace = {}; rpNameSpace.foo = function() { this.length = 613; } rpNameSpace.foo.prototype.getLength = function() { return this.length * 2; } Then, to use the resulting "namespaced" object: var x = new rpNameSpace.foo() display( x.getLength() ); Thank you both very much. rp
For a set that small is generally not worth it to convert from an Array to a HashMap/set. In fact, you're probably best off keeping them in an array and then sorting them by key and iterating over both lists simultaneously to do the comparison.
Resources for an Oracle beginner
|oracle-database|ibm-midrange|
Can anyone recommend some good resources that highlight the differences between Oracle and the AS/400 database? I am trying to help someone with a lot of AS/400 experience implement an Oracle installation, and they need some guidance. A book or online resource would be ideal.
Since this file is XML you could and should use xsl to transform it to another format. The _IAmUnkown_ - blog has an entry about [decoding/transforming the trx file into html][1]. You can also use [.NetSpecExporter from Bekk][2] to create nice reports. Their product also uses XSL, so you could probably _steal_ it from the downloaded file and apply it with whatever xsl-application you want. [1]: http://preetsangha.blogspot.com/2008/05/decoding-ms-test-trx-file.html [2]: http://boss.bekk.no/display/BOSS/.NetSpecExporter
A very simple method that we've used where I work is this: 1. Set up a webservice/web method that executes the task. This webservice can be secured with username/pass if desired. 2. Create a console app that calls this web service. If desired, you can have the console app send parameters and/or get back some sort of metrics for output to the console or external logging. 3. Schedule this executable in the task scheduler of choice. It's not pretty, but it is simple and reliable. Since the console app is essentially just a heartbeat to tell the app to go do its work, it does not need to share any libraries with the application. Another plus of this methodology is that it's fairly trivial to kick off manually when needed.
Awesome, I'd never really known about the "Administrative Tools -> Local Security Settings -> Local Policies -> User Rights Assignment" under XP. My "Debug programs" policy is set to "Administrators" only, yet trying to debug now just worked and this is several days after installing the .NET framework 3.5, so maybe that installation fixed things in the background.
Jeff discussed this on the Stack Overflow blog - [http://blog.stackoverflow.com/category/aspnet/][1] Basically, Jeff proposed using the CacheItemRemovedCallback as a timer for calling certain tasks. I personally believe that automated tasks should be handled as a service, a Windows scheduled task, or a job in SQL Server. Under Linux, checkout cron. [1]: http://blog.stackoverflow.com/category/aspnet/
Go with <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> More on this topic [here][1] [1]: http://faq.javaranch.com/view?JstlTagLibDefinitions
Could you maybe time some operations and post them so we get an idea what you mean by "slow"? On my machine, I wouldn't call VS 2005 slow, but if you compare it to notepad or my web browser it seems slow. Here's some things that might help people figure out what's going on: - Turn off any features that could affect load time. This includes uninstalling all add-ons and making sure that VS isn't configured to automatically open a project. - Reboot your machine. - Time how long it starts VS 2005 to start, from the time you click the icon until the program starts. - Create a program that you're willing to post here that seems to compile slowly (this might not be possible depending on what it takes to make a slow compile); post the program and how long it takes your computer to build it. - Do you know anyone else with the same kind of machine that has VS 2005 installed? Does it seem slower or faster than yours? I believe Lord Kelvin said the best thing that can be said about situations like this: > When you can measure what you are speaking about, and express it in numbers, you know something about it; but when you cannot measure it, when you cannot express it in numbers, your knowledge of it is of a meager and unsatisfactory kind; it may be the beginning of knowledge, but you have scarcely, in your thoughts, advanced it to the stage of science. Until you give us some measurements to look at, we can't tell you if your machine is genuinely slow or if you are expecting more out of your machine than it can give. Your HT CPU might be the problem; I have roughly equivalent machines at work and at home, but my dual-core work machine runs circles around my single-core home machine when it comes to running VS.
String concatenation: Oracle: || or concat() Sql Server: + These links could be interesting: <http://www.dba-oracle.com/oracle_news/2005_12_16_sql_syntax_differences.htm> <http://www.mssqlcity.com/Articles/Compare/sql_server_vs_oracle.htm> (old one: Ora9 vs Sql 2000)
Managing web services in FlexBuilder - How does the manager work?
|web-services|apache-flex|flexbuilder|
In FlexBuilder 3, there are two items under the 'Data' menu to import and manage web services. After importing a webservice, I can update it with the manage option. However, the webservices seems to disappear after they are imported. The manager does however recognize that a certain WSDL URL was imported and refuses to do anything with it. How does the manager know this, and how can I make it refresh a certain WSDL URL?
Personally, I'd keep the same setup you have now, but change the redirect for a forward. That avoids sending a header back to the client and having them make another request. So, in particular, I'd replace the <% response.sendRedirect("/myproject/MyAction.action"); %> in index.jsp with <jsp:forward page="/MyAction.action" /> The other effect of this change is that the user won't see the URL in the address bar change from "http://server/myproject" to "http://server/myproject/index.jsp", as the forward happens internally on the server.
Apache Webservers
|apache|tomcat|webserver|
What is the difference in terms of functionality between the Apache HTTP Server and Apache Tomcat? I know that Tomcat is written in Java and the HTTP Server is in C, but other than that I do not really know how they are distinguished. Do they have different functionality?
Difference between the Apache HTTP Server and Apache Tomcat?
get file version in powershell
|file|powershell|
How can you get the version information from a `.dll` or `.exe` file in PowerShell? Specifically interested in `File Version`, though other version info (i.e. `Company`, `Language`, `Product Name`, etc) would be helpful as well.
What you're really asking is a related, but substantially different question: how often do I want to truncate names in order to fit them in the database? The answer depends both on the frequency of different lengths of names as well as the maximum lengths chosen. This concern is balanced by the concerns about resources used by the database. Considering how little overhead difference there is between different max lengths for a varchar field I'd generally err on the side of never being forced to truncate a name and make the field as large as I dared.
A PDF is what I'm after, so I'm not sure how outputting another format would help. As it turns out, the footer space just wasn't enough to fit all of this text; verified by the fact that changing the font size to 4pt would fit it all in without a problem. I spent some time attempting to rewrite the footer code using DDX [as outlined here][1] and the [CFPDF][2] tag to implement it; but even after several hours of hacking away and finally getting a valid DDX as reported by the new [isDDX function][3], the CFPDF tag reported that it was invalid DDX for some reason. At this point I decided I had wasted enough of the client's time/money and just reformatted the footer to be 2 lines of centered text, which was good enough. [1]:http://www.coldfusionjedi.com/index.cfm/2008/6/2/Changing-the-size-of-a-footer-in-CFDOCUMENT [2]:http://cfquickdocs.com/cf8/?getDoc=cfpdf [3]:http://cfquickdocs.com/cf8/?getDoc=IsDDX
I have tried the SAXParser once, but once I found [XStream][1] I never went back to it. With XStream you can create Java Objects and convert them to XML. Send them over and use XStream to recreate the object. Very easy to use, fast, and creates clean XML. Either way you have to know what data your going to receiver from the XML file. You can send them over in different ways to know which parser to use. Or have a data object that can hold everything but only one structure is populated (product/store/managers). Maybe something like: public class DataStructure { List<ProductStructure> products; List<StoreStructure> stors; List<ManagerStructure> managers; ... public int getProductCount() { return products.lenght(); } ... } And with XStream convert to XML send over and then recreate the object. Then do what you want with it. [1]: http://xstream.codehaus.org/
Ruby - Convert Integer to String
|ruby|arrays|
I have some Ruby code I'm writing and when I give it the String "0123", I want to be able to print out the individual elements. But when I try to print out these elements, I'm seeing the ASCII values instead: >> a = "0123" => "0123" >> a[0] => 48 I've looked online but can't find any way to get the original "0" back out of it. I'm a little new to Ruby to I know it has to be something simple but I just can't seem to find it.
|ruby|arrays|needs-editing|
|ruby|arrays|
In Ruby, trying to print out the individual elements of a String is giving me trouble. Instead of seeing each character, I'm seeing their ASCII values instead: >> a = "0123" => "0123" >> a[0] => 48 I've looked online but can't find any way to get the original "0" back out of it. I'm a little new to Ruby to I know it has to be something simple but I just can't seem to find it.
In terms of how you arrange your views, you can put your views in subfolders if you'd like and create your own view structure. All views can always be referenced by their full path using the ~syntax. So if you put Index.aspx in \Views\Feature1\Home then you could reference that view using ~/Views/Feature1/Home/Index.aspx.
Territory Map Generation
|language-agnostic|maps|
Is there a trivial, or at least moderately straight-forward way to generate territory maps (e.g. Risk)? I have looked in the past and the best I could find were vague references to Voronoi diagrams. An example of a Voronoi diagram is [here][1]. These hold promise, but I guess i haven't seen any straight-forward ways of rendering these, yet alone holding them in some form of data structure to treat each territory as an object. Another approach that holds promise is flood fill, but again I'm unsure on the best way to start with this approach. Any advice would be much appreciated. [1]: http://www.dma.fi.upm.es/mabellanas/tfcs/fvd/images/voronoi.gif
|language-agnostic|maps|voronoi|
Is there a library for rendering basic flow diagrams in Javascript?
|javascript|
On a web page I want to dynamically render very basic flow diagrams, i.e. a few boxes joined by lines. Ideally the user could then click on one of these boxes (DIVs?) and be taken to a different page. Resorting to Flash seems like an overkill and the quality of Javascript graphing libraries suggests such a feat could be possible.
Is there a library for rendering basic flow diagrams in Javascript/CSS?
|javascript|css|
Since you've already discovered the pseudo-mutable integer "hack," how about this option: Does it make sense for you to make a separate Parser class? If you do this, you can store the current state in a member variable. You probably need to think about how you're going to handle any thread safety issues, and it might be overkill for this particular application, but it might work for you.
This should set the IFRAME height to its content's height: <script type="text/javascript"> document.getElementById('the_iframe').contentWindow.document.body.scrollHeight; document.getElementById('the_iframe').height=the_height; </script> You may want to add `scrolling="no"` to your IFRAME to turn off the scrollbars.
This should set the IFRAME height to its content's height: <script type="text/javascript"> the_height = document.getElementById('the_iframe').contentWindow.document.body.scrollHeight; document.getElementById('the_iframe').height = the_height; </script> You may want to add `scrolling="no"` to your IFRAME to turn off the scrollbars. *edit:* Oops, forgot to declare `the_height`.
In C#, I have used the '[System.IO.Path.GetRandomFileName() : String][1]' method... but I was generating salt for debug file names. This method returns stuff that looks like your first example, except with a random '.xyz' file extension too. If you're in .NET and just want a simpler (but not 'nicer' looking) solution, I would say this is it... you could remove the random file extension if you like. [1]: http://msdn.microsoft.com/en-us/library/system.io.path.getrandomfilename.aspx
There's the [IsThemeActive](http://msdn.microsoft.com/en-us/library/bb759813%28VS.85%29.aspx) WinAPI function.
Well I looked into this. ASP.NET provides a common location for registering the implementation of IControlBinders. They also have the basics of this working via the new Controller.UpdateModel method. So I essentially combined these two concepts by creating an implementation of IModelBinder that does the same thing as Controller.UpdateModel for all public properties of the modelClass. public class ModelBinder : IModelBinder { public object GetValue(ControllerContext controllerContext, string modelName, Type modelType, ModelStateDictionary modelState) { object model = Activator.CreateInstance(modelType); PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(model); foreach (PropertyDescriptor descriptor in properties) { string key = modelName + "." + descriptor.Name; object value = ModelBinders.GetBinder(descriptor.PropertyType).GetValue(controllerContext, key, descriptor.PropertyType, modelState); if (value != null) { try { descriptor.SetValue(model, value); continue; } catch { string errorMessage = String.Format("The value '{0}' is invalid for property '{1}'.", value, key); string attemptedValue = Convert.ToString(value); modelState.AddModelError(key, attemptedValue, errorMessage); } } } return model; } } In your Global.asax.cs you'd need to add something like this: protected void Application_Start() { ModelBinders.Binders.Add(typeof(Contact), new ModelBinder());
>>Use URL fetchers like wget or curl to make HTTP GET requests. >>Secure your URLs with authentication so that no one can execute the tasks without knowing the user/password. You can also tell cron to run php scripts directly, for example. And you can set the permissions on the PHP file to prevent other people accessing them or better yet, don't have these utility scripts in a web accessible directory...
Approach A, but I would also include a explicit deny in addition to you implicit deney. I would make some use cases to be sure your end logic works but here are some examples. User1 is in group1 and group2. User2 is in group1 User3 is in group2 Folder1 allows group1 and deny group2. User1 is denied. User2 is allowed. User3 is denied. I believe your approach users1 would be allowed.
After a bunch of research and experimentation, I've found the answer. - For the record, the current release of nUnit 2.5 Alpha *does not* seem to contain templates for test projects in Visual Studio 2008. - I followed the directions [here][1] which describe how to create your own project templates and then add appropriate registry entries that allow your templates to appear in the drop-down box in the *Create Unit Test Project* dialog box of an MVC project. From a high level, what you have to do is: 1. Create a project 2. Export it as a template (which results in a single ZIP archive) 3. Copy it from the local user's template folder to the Visual Studio main template test folder 4. Execute **devenv.exe /setup** 5. Run **regedit** and create a few registry entries. So much for the testing framework selection being easy! Although, to be fair MVC is not even beta yet. After all that, I did get the framework of choice (NUnit) to show up in the drop down box. However, there was still a bit left to be desired: - Although the test project gets properly created, it did not automatically have a project reference to the main MVC project. When using *Visual Studio Unit Test* as the test project, it automatically does this. - I tried to open the ZIP file produced and edit the MyTemplate.vssettings file as well as the .csproj project file in order to correct the aforementioned issue as well as tweak the names of things so they'd appear more user friendly. This for some reason does not work. The ZIP file produced can not be updated via WinZip or Win-Rar -- each indicates the archive is corrupt. Each can extract the contents, though. So, I tried updating the extracted files and then recreating the ZIP file. Visual Studio did not like it. So, I should probably read [this][2] as well which discusses making project templates for Visual Studio (also referenced in the blog post I linked to above.) I admit to being disappointed though; from all the talk about MVC playing well with other testing frameworks, etc, I thought that it'd be easier to register a 3rd party framework. [1]: http://vishaljoshi.blogspot.com/2008/02/aspnet-mvc-test-framework-integration.html [2]: http://msdn2.microsoft.com/en-us/library/s365byhx.aspx
If you are willing to go with flash, [XML/SWF][1] is a wonderful tool [1]: http://www.maani.us/xml_charts/
If we're talking Windows, then I'd always develop a separate Windows Service to handle such batch tasks. You can always reference the same assemblies that are being used by your web application to avoid any nasty code duplication.
How to prefetch Oracle sequence ID-s in a distributed environment
|java|oracle-database|
I have a distributed Java application running on 5 application servers. The servers all use the same Oracle 9i database running on a 6th machine. The application need to prefetch a batch of 100 IDs from a sequence. It's relatively easy to do in a single-threaded, non-distributed environment, you can just issue these queries: select seq.nextval from dual; alter sequence seq increment by 100; select seq.nextval from dual; The first select fetches the first sequence ID that the application can use, the second select returns the last one that can be used. Things get way more interesting in a multithreaded environment. You can't be sure that before the second select another thread doesn't increase the sequence by 100 again. This issue can be solved by synchronizing the access on the Java side - you only let one thread begin fetching the IDs at one time. The situation becomes really hard when you can't synchronize because parts of the application doesn't run on the same JVM, not even on the same physical machine. I found some references on forums that others have problems with solving this problem too, but none of the answers are really working not to mention being reasonable. Can the community provide a solution for this problem? Some more information: - I can't really play with the transaction isolation levels. I use JPA and the change would affect the entire application, not only the prefetching queries and that's not acceptable for me. - On PostgreSQL I could do the following: select setval('seq', nextval('seq') + n - 1 )
I have a distributed Java application running on 5 application servers. The servers all use the same Oracle 9i database running on a 6th machine. The application need to prefetch a batch of 100 IDs from a sequence. It's relatively easy to do in a single-threaded, non-distributed environment, you can just issue these queries: select seq.nextval from dual; alter sequence seq increment by 100; select seq.nextval from dual; The first select fetches the first sequence ID that the application can use, the second select returns the last one that can be used. Things get way more interesting in a multithreaded environment. You can't be sure that before the second select another thread doesn't increase the sequence by 100 again. This issue can be solved by synchronizing the access on the Java side - you only let one thread begin fetching the IDs at one time. The situation becomes really hard when you can't synchronize because parts of the application doesn't run on the same JVM, not even on the same physical machine. I found some references on forums that others have problems with solving this problem too, but none of the answers are really working not to mention being reasonable. Can the community provide a solution for this problem? Some more information: - I can't really play with the transaction isolation levels. I use JPA and the change would affect the entire application, not only the prefetching queries and that's not acceptable for me. - On PostgreSQL I could do the following: select setval('seq', nextval('seq') + n - 1 ) - The solution by Matthew works when you can use a fixed increment value (which is perfectly acceptable in my case). However is there a solution when you don't want to fix the size of the increment, but want to adjust it dynamically?
We use [buildbot][1], with the build broken down into discrete steps. There is a balance to be found between having build steps be broken down with enough granularity and being a complete unit. For example at my current position, we build the sub-pieces for each of our platforms (Mac, Linux, Windows) on their respective platforms. We then have a single step (with a few sub steps) that compiles them into the final version that will end up in the final distributions. If something goes wrong in any of those steps it is pretty easy to diagnose. My advice is to write the steps out on a whiteboard in as vague terms as you can and then base your steps on that. In my case that would be: 1. Build Plugin Pieces 1. Compile for Mac 2. Compile for PC 3. Compile for Linux 2. Make final Plugins 3. Run Plugin tests 3. Build intermediate IDE (We have to bootstrap building) 4. Build final IDE 5. Run IDE tests [1]: http://buildbot.net/trac
Generally speaking I try and copy whatever appraoch the product group has taken when looking to add functionality of my own. In this case they add their own edit/view/add pages via the list definition itself. I built a solution that also needed its own custom "New" form, not open source unfortunately, though if you are interested you can download it, its called "Tagged Links" (Social Bookmarking for SharePoint) and you can find some links on my blog. To give you a few hints and tips, the following should set you off in the right direction: 1. Created a new list definition. 2. Created a new Content Type In the content type you can define your own "FormTemplates" that references a Rendering Template which determine what gets displayed in the "Middle" bit of those forms. 3. Copied the standard Rendering Template, but then made the changes to it that I needed. 4. Wrapped it all up in a solution, and deployed. My Rendering Template actually included an overridden "Save" Button where I did a lot of the extra work I needed to do during the save. Anyway, it is a little too much work in my opinion but, I think, it most closely matches the standard approach taken by the product developers. Let me know if you need more detail and I will see if I can put together a step-by-step blog post, but hopefully this gets you off on the right direction.
I haven't seen the browser eat exceptions, unless you mean script errors. Script errors can be enabled via the `browser.ScriptErrorsSuppressed` property. If you're talking about real exceptions, not just script errors, can you show us some code that reproduces the problem? We've used the browser extensively and haven't seen what you're describing.
I haven't seen the browser eat exceptions, unless you mean script errors. Script errors can be enabled via the `browser.ScriptErrorsSuppressed` property. If you're talking about real exceptions, not just script errors, can you show us some code that reproduces the problem? We've used the browser extensively and haven't seen what you're describing. *edit* the code sample wasn't there when I asked for a code sample
To make this less tedious, you will need to encapsulate/refactor the mapping between the DataReader and the Object you hold in the list. There is quite of few steps to encapsulate that logic out. If that is the road you want to take, I can post code for you. I am just not sure how practical it would be to post the code here on StackOverflow, but I can give it a shot to keep it concise and to the point. Otherwise, you are stuck with the tedious task of repeating each expectation on the index accessor for the reader. The encapsulation process will also get rid of the strings and make those strings more reusable through your tests.
In SVN these are simply called "properties". You can read about them in the SVN book: <http://svnbook.red-bean.com/en/1.4/svn.advanced.props.html>
In SVN these are simply called "properties". You can read about them in the SVN book: <http://svnbook.red-bean.com/en/1.4/svn.advanced.props.html> --- Err, so, are they called properties or keywords? Oh, I see. In SVN you can associate arbitrary metadata, called "properties", with versioned files; some of the properties you can set are to set up keyword substitution in the files themselves.