instruction stringlengths 0 30k ⌀ |
|---|
To embed JavaScript for the aid of transformation you can use <xsl:script>, but [it is limited][1] to Microsoft's XML objects implementation. Here's an [example][2]:
**scripted.xml**:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="scripted.xsl"?>
<data a="v">
ding dong
... |
Try umount -f /mnt/share. Works OK with NFS, never tried with cifs.
Also, take a look at autofs, it will mount the share only when accessed, and will unmount it afterworlds.
There is a good tutorial at [www.howtoforge.net][1]
[1]: http://www.howtoforge.com/accessing_windows_or_samba_shares_using_autofs |
Personally, I recommend Module::Install, as do a lot of folks I know - the likes of the Catalyst and Moose folks also use it. |
This is a classic problem with Internet games and contests. Your Flash code works with users to decide a score for a game. But users aren't trusted, and the Flash code runs on the user's computer. You're SOL. There is nothing you can do to prevent an attacker from forging high scores:
* Flash is even easier to rever... |
Print out one of the many Vi/Vim cheat sheets you can find on the internet and force yourself to stick with it for a few weeks.
Once you learn some basic commands you can be pretty efficient. From there, just keep plugging away and learn a new command every once in a while. There is no way you can learn ALL the vi c... |
Bash or Ksh ? |
|unix|bash|ksh| |
I'm not new to *nix, however lately I have been spending a lot of time at the prompt to do my development for my job. My question is what are the advantages of using Korn Shell or Bash Shell? Where are the pitfalls of using one over the other? Looking to understand from the perspective of a user, rather than purely scr... |
Quicktime Alternative does what you want, but for the reasons others have stated here, its illegal. Apple probably is not going to let you do what you want. |
sudo ./scriptname
sudo bash will basically switch you over to running a shell as root, although it's probably best to stay as su as little as possible. |
Test Cases VS ASSERTION statement |
|c++|tdd|defensive-programming| |
In my most C++ project I heavily used ASSERTION statement as following:
int doWonderfulThings(const int* fantasticData)
{
ASSERT(fantasticData);
if(!fantasticData)
return -1;
// ,,,
return WOW_VALUE;
}
But TDD community seems like to enjoy doing somet... |
If you're working within a single method (or even in a single class or assembly in some cases) and no one outside is going to see what you're doing, use the fullness of a List. But if you're interacting with outside code, like when you're returning a list from a method, then you only want to declare the interface witho... |
You should use the interface only if you need it, e.g., if your list is casted to an IList implementation other than List. This is true when, for example, you use NHibernate, which casts ILists into an NHibernate bag object when retrieving data.
If List is the only implementation that you will ever use for a certain... |
You probably have the text-to-speech narrator enabled.
[http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2467648&SiteID=1&mode=1][1]
> Just uncheck all checkboxes under
> "Text-To-Speech" narrator software.
>
> --> To open Narrator using the keyboard, press CTRL+ESC, press R,
> type narrator, and then p... |
I don't know which particlar TDD subcommunity you're refering to but the TDD patterns I've come across either use Assert.AreEqual() for positive results or otherwise use an ExpectedException mechanism (e.g., attributes in .NET) to declare the error that should be observed. |
@mk: (2 | 4) evaluates to 6. |
$guest = 1;
$editor = 2;
$admin = 4;
$user = $editor;
if (user == $editor || $user == $admin) {
echo "Test";
} |
Another good use for yield is to perform a function on the elements of an IEnumerable and to return a result of a different type, for example:
public delegate T SomeDelegate(K obj);
public IEnumerable<T> DoActionOnList(IEnumerable<K> list, SomeDelegate action)
{
foreach (var i in list)
... |
@quamrana:
There must be something beyond the /Wall option to enable warning 4365:
C:\Temp>cl /Wall /c foo.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
foo.c
foo.c(6) : warning C4018: '<' ... |
How to determine if the user's browser can view PDF files |
|asp.net|javascript|browser|pdf| |
What's the best way for determining whether the user's browser can view PDF files?
Ideally, it shouldn't matter on the browser or the operating system.
Is there a specific way of doing it in ASP.NET, or would the answer be just JavaScript? |
Let's say table2 has a column "`color varchar(128)`" and this column is properly mapped to Hibernate.
You should be able to do something like this:
from table1 where table2.color = 'red'
This will return all `table1` rows that are linked to a `table2` row whose `color` column is 'red'. Note that in your H... |
Octtrees are the way to go. You subdivide the array into 8 octants:
<pre>
1 2
3 4
---
5 6
7 8
</pre>
And then lay them out in memory in the order 1, 2, 3, 4, 5, 6, 7, 8 as above. You repeat this recursively within each octant until you get down to some base size, probably around 128 bytes or so (this ... |
For me expression language works only if I make that variable accessible, by putting it for example in page context.
<% Object myObject = new Object();
pageContext.setAttribute("myObject", myObject);
%>
<wf:my-tag obj="${myObject}" />
Otherwise tas receives null.
And `<wf:my-tag obj="<%... |
If you are looking for an automation tool, I have often worked with EMS SQLManager, which allows you to generate automatically a ddl script from a database.
Data inserts in reference tables might be mandatory before putting your database on line. This can even be considered as part of the ddl script. EMS can also ge... |
In conclusion, when you use a local variable of a type that implements `IDisposable`, *always*, without exception, use `using`<sup>1</sup>.
If you use nonlocal `IDisposable` variables, then *always* implement the [`IDisposable` pattern](http://www.codeproject.com/KB/cs/idisposable.aspx).
Two simple rules, no exce... |
I'd put binding and converters at entry level, since that is how you spend a lot of time in WPF. |
I'd recommend looking into Subversion or GIT if you need cheap or a free solution. There are some third party plugins like Visual Svn for Subversion to keep you in Visual Studio. If you want something that's close to home (VSS) then try Microsoft's Team System or Source Vault from SourceGear. |
One argument in favor is this:
popularity + extensibility
1) If anyone needs to do X with JavaScript, it's probably been done with jQuery
2) If it's been done much, there's probably a plugin, if not native support
And if it's **really** unique, there are a lot of people to answer your question on SO or else... |
If it's an older SVN repository (or even quite new, but wasn't setup optimally), it maybe using the older BDB style of repository database. http://svn.collab.net/repos/svn/trunk/notes/fsfs has notes on the new one. To change from one to another isn;t too hard - dump the entire history, re-initialise it with the new s... |
If it's an older SVN repository (or even quite new, but wasn't setup optimally), it maybe using the older BDB style of repository database. http://svn.collab.net/repos/svn/trunk/notes/fsfs has notes on the new one. To change from one to another isn;t too hard - dump the entire history, re-initialise it with the new s... |
If you are using NUnit one simple but effective demo is to run NUnit's own test suite(s) in front of them. Seeing a real test suite giving a codebase a workout is worth a thousand words... |
Yes, it will cause a memory leak, because a compiler may allocate memory differently for
new char;
and
new char[n];
commands. For example it may store a size of an array before returned pointer or whatever.
Consider rewriting your code, for example like this
BYTE* pByte = 0;
STRUCT* pSt... |
Rob Walker [reply][1] is good.
Just small addition, if you don't have any constructor or/and distructors, so you basically need allocate and free a chunk of raw memory, consider using free/malloc pair.
[1]: http://stackoverflow.com/questions/73134/will-this-c-code-cause-a-memory-leak-casting-vector-new#73163 |
How to gracefully deal with ViewState errors? |
|c#|.net|exception|viewstate| |
I'm running some c# .net pages with various gridviews. If I ever leave any of them alone in a web browser for an extended period of time (usually overnight), I get the following error when I click any element on the page.
I'm not really sure where to start dealing with the problem. I don't mind resetting the page if... |
You could also have 1 asp page with the entire html form, and hide parts of it until the user fill and "submits" the visible part...
then simply hide the part that is filled out and show the next part of the form...
This would be extremely easy in the .NET framework, use panels for each "wizard step" and add logg... |
In C, the idiom is absolutely required. Consider the problem in which you want a function to add a string (pure C, so a char *) to an array of pointers to char *. The function prototype requires three levels of indirection:
int AddStringToList(unsigned int *count_ptr, char ***list_ptr, const char *string_to_add)... |
How To Detect If Type is Another Generic Type |
|c#| |
example:
public static void DoSomething<K,V>(IDictionary<K,V> items) {
items.Keys.Each(key => {
if (V **is IEnumerable<?>**) { /* do something */ }
else { /* do something else */ }
}
Can this be done without using reflection? How do I say IEnumerable<Whatever> in C#? Should ... |
example:
public static void DoSomething<K,V>(IDictionary<K,V> items) {
items.Keys.Each(key => {
if (items[key] **is IEnumerable<?>**) { /* do something */ }
else { /* do something else */ }
}
Can this be done without using reflection? How do I say IEnumerable<Whatever> in C#... |
According to [this][1], vim-enhanced is just vim "with the perl, python, tcl, and cscope options compiled in." You should be able to find everything you need to know about these compile options in [the documentation][2].
[1]: http://linux.maruhn.com/sec/vim-enhanced.html
[2]: http://vimdoc.sourceforge.net/htm... |
Using a hidden share for your back end is really only "security by obscurity," and not really worth the effort. Sophisticated users can figure it out through any number of methods (depending on how you've locked down your front end):
- view the MSysObjects table and find
the CONNECT string for the tables,
... |
[PC Lint][1] works quite well for this, and it finds all sorts of other goofy problems for you too. It has command line options that can be used to create External Tools in Visual Studio, but I've found that the [Visual Lint][2] addin is easier to work with. Even the free version of Visual Lint helps. But give PC-Lint ... |
> Duncan wrote:
>
>The instances dialog shows: "1 objects" and "max. batch: 1" in those fields and >lists "Win32_OperatingSystem=@"
It sure looks like it should work. You could test your code with another singleton class, like:
"Win32_WmiSetting=@"
and see if you still get the exception. |
ini_set("display_errors","2");
ERROR_REPORTING(E_ALL); |
|exception| |
Most program languages have some kind of exception handling; some languages have return codes, others have try/catch, or rescue/retry, etc., each with its own pecularities in readability, robustness, and practical effectiveness in a large group development effort. Which one is the best and why ? |
|exception|language-agnostic| |
|language-agnostic|exception| |
If you're using a relational database, your suggestion is pretty much the only way to do it. The [theory of normal forms][1] will give you more information about it - the Wikipedia articles about it are quite good, though slightly heavy going simply because it is a tricky theoretical subject when you get into the highe... |
It is likely that they have an abstraction layer and they develop against that. At run-time they instantiate the DX9 or DX10 wrapping concrete engines.
I imagine their abstraction is positioned very close to the DirectX layer and simply provides DX9 with sensible manual implementations of DX10 functions or enhances... |
[NDepend][1] will also report on potentially unused code.
[1]: http://www.ndepend.com |
Server.Transfer is done entirely from the server. Postback is initiated from the client for a form submission.
Maybe you meant to compare with Response.Redirect, which forces the client to submit a new request for a new url. |
Server.Transfer is done entirely from the server. Postback is initiated from the client for posting form contents and postback url identifies the page to post to.
Maybe you meant to compare with Response.Redirect, which forces the client to submit a new request for a new url. |
Assuming you have a value string in `str`, this is the pure-.NET way of doing this.
var encoding = System.Text.Encoding.GetEncoding("iso-8859-2");
var bytes = System.Text.Encoding.Convert(encoding, System.Text.Encoding.Default, encoding.GetBytes(str));
var newString = System.Text.Encoding.Defau... |
What is the best way to handle authentication in ASP.NET MVC with a Universe database? |
|c#|asp.net|mvc|ibm|universe| |
We use an IBM database known as Universe that holds all of our user id's, passwords, and profile information in a table called USERINFO.
Can I use the Membership Provider to connect to this database and authenticate the user?
The database access is actually through a web service since we don't have a direct co... |
Is there a way to have index.html functionallity with content hosted on S3? |
|amazon|amazon-s3|amazon-web-services| |
Is there a way to make S3 default to an index.html page? E.g.: My bucket object listing:
/index.html
/index.htm
/favicon.ico
/images/logo.gif
A call to **www.mysite.com/*index.html*** works great! But if one were to call **www.mysite.com/** we'd either get a 403 or a REST object listing XML d... |
Is there a way to make S3 default to an index.html page? E.g.: My bucket object listing:
/index.html
/favicon.ico
/images/logo.gif
A call to **www.mysite.com/*index.html*** works great! But if one were to call **www.mysite.com/** we'd either get a 403 or a REST object listing XML document dependin... |
b would be faster (performance wise) while reading your setup but it will require you more maintenance code when you will update your class (updating each function).
Now if performance is your true goal, just benchmark it. Write both a and b, load your DB with a few (hundreds of) thousands record and test. Then sele... |
Your server-side script should somehow keep its progress somewhere on server (file, field in database, memcached, etc.).
You should have AJAX function returning current progress. Poll this function once a second and render result accordingly. |
I found Tim Bray's [Annotated XML Specification][1] helpful.
[1]: http://www.xml.com/axml/testaxml.htm |
I guess you're after something practical. What I do is keep my action items away from my work environment, it helps keep me focussed. I keep a pad next to my desk, I write down each action item for the day at the top and half way down start keeping notes. When I've finished a task I tick it off, anything not ticked ... |
If you define a crash as an unhandled problem (i.e. no Java Exception or Error), then this can not be done from within Java (this is the whole point of managed code). Typical crashes in native code happen by dereferencing pointers to wron memory areas (like Nullpointer) or illegal Opcodes. Another source could be faile... |
Bash is the benchmark, but that's mostly because you can be reasonably sure it's installed on every *nix out there. If you're planning to distribute the scripts, use Bash.
I can not really address the actual programming differences between the shells, unfortunately. |
You need to embed it using ActiveX Hosting. There is an [MSDN tutorial][1] on it (note there is a [bug in the MS-published code][2]). If you want a more friendly way, then OpenNETCF has a [commercial control][3] for it as well.
[1]: http://msdn.microsoft.com/en-us/library/aa446515.aspx
[2]: http://blog.open... |
I use the following C++ code to get the window handle to the tray window. **Note:** this has only been tested on Windows XP.
<pre><code>HWND FindSystemTrayIcons(void)
{
// the system tray icons are contained in a specific window hierarchy;
// use the Spy++ utility to see the chain
HWND hwndTray = ::... |
For one thing, bash has tab completion. This alone is enough to make me prefer it over ksh.
[Z shell](http://zsh.org/) has a good combination of ksh's unique features with the nice things that bash provides, plus a lot more stuff on top of that. |
What about [D Programming Language][1]?
[1]: http://www.digitalmars.com/d/2.0/comparison.html |
What about [D Programming Language][1]?
Some links for Fire Lancer:
[Win32 Api][2]
[Derelict (Multimedia lib)][3]
[1]: http://www.digitalmars.com/d/2.0/comparison.html
[2]: http://www.digitalmars.com/d/2.0/windows.html
[3]: http://www.dsource.org/projects/derelict/ |
I would also *highly* recommend looking in to VistaDB (http://www.vistadb.net/) or SQL Compact(http://www.microsoft.com/sql/editions/compact/) for your application. These might not be the right fit for your app... but are def worth a look. |
FlashWindowEx is the way to go. See [here for MSDN documentation](http://msdn.microsoft.com/en-us/library/ms679347%28VS.85%29.aspx)
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool FlashWindowEx(ref FLASHWINFO pwfi);
[StructLayout(LayoutKind.Sequential)]
... |
Delegates are really just structural typing for functions. You could do the same thing with nominal typing and implementing an anonymous class that implements an interface or abstract class, but that ends up being a lot of code when only one function is needed.
Lambda comes from the idea of lambda calculus of Alonz... |
Semaphore can also be used as a ... semaphore.
For example if you have multiple process enqueuing data to a queue, and only one task consuming data from the queue. If you don't want your consuming task to constantly poll the queue for available data, you can use semaphore.
Here the semaphore is not used as an exclu... |
CsvString.split(','); |
Eclipse integrates well with Javadoc and has an HTML-like viewer for it. You can attach source and javadoc to binaries that will show up when you select a class. |
Some sites have 3 inputs for changing a password, one for re-entering the current password and two for entering the new password. If the re-entering input was first and got auto-filled, it wouldn't be a problem. |
IF UAC is enabled, you couldn't write to Program Files. Installing to \AppData will indeed only install the program for one user.
However, you must note that any configuration changes that require changes to the registry probably(I'd have to double check on that) administrator privilege. Off the top of my head modif... |
In Delphi static variables are implemented as *variable types constants* :)
This could be somewhat misleading.
procedure TForm1.Button1Click(Sender: TObject) ;
const
clicks : Integer = 1; //not a true constant
begin
Form1.Caption := IntToStr(clicks) ;
clicks := clicks + 1;
... |
If you seriously think you will out scale a decent multicore "Big Iron" box, then you think about partitioning your data. This is a good, database agnostic way to scale out.
All databases which horizontally will come at a serious cost.
Unless you have mega $$'s to throw at the problem, forget about RAC. While it... |
An inner interface has to be static in order to be accessed. The interface isn't associated with instances of the class, but with the class itself, so it would be accessed with `Foo.Bar`, like so:
public class Baz implements Foo.Bar {
...
}
In most ways, this isn't different from a static inner c... |
You'll have to create a custom provider for that. It isn't very hard, as long as you can access the web service without an issue. |
Use the [deployment Toolkit][1]'s [deployJava.js][2] (though this ensures a minimum version, rather than a specific version)
[1]: http://java.sun.com/javase/downloads/ea/6u10/deploymentToolkit.jsp
[2]: http://java.com/js/deployJava.js |
Are you sure the website in IIS is set to use ASP.NET 2.0 rather than 1.1? |
If SelectionMode is FullRowSelect, then you'll need to override SetSelectedRowCore for that DataGridView, and not call the base SetSelectedRowCore for rows you don't want selected.
If SelectionMode is not FullRowSelect, you'll want to additionally override SetSelectedCellCore (and not call the base SetSelectedCellCo... |
Without knowing how your server side code works it's hard to say. However, there are three stages to the process. Firstly you need to call a job creation script. This returns an id number and sets the server working. Next, every second or so, you need to call a status script which returns an status message that you wan... |
Themes in ASP.Net don't provide the ability to choose from "sub-themes".
However, you can set SkinIDs in your skin files. For example :
<asp:DataList runat="server" SkinID="DataListCouleur" Width="100%" CellPadding="4"
ForeColor="#333333" CellSpacing="2">
<HeaderStyle BackColor="#507CD1" Font-Bold="... |
Yes. It's browser dependant but you can use Javascript. There is a small but practical tutorial on w3schools.com. It's part of the XSLT tutorial.
The page:
http://www.w3schools.com/xsl/xsl_client.asp
The XSLT tutorial:
http://www.w3schools.com/xsl/default.asp
That site will be more helpful than myself. G... |
That's a common approach. You can check for dir/file existence using test operators such as "if [ -d "somedirectory" ]; then" or [ -t "somefile" ]
I use symbolic links more often, though. Then, you can just change your symbolic link to use the version you want.
For example,
<pre>
$ ln -s 1.2.2 current_versi... |
I like the integrated HTML/XML Tidy. Cmd-shift-H is your friend.
Also, nice integration with a variety of scp/sftp clients. |
If it is XHTML (which assumes a lot on my part) would the Xml Diff Patch Toolkit help? http://msdn.microsoft.com/en-us/library/aa302294.aspx |