instruction
stringlengths
0
30k
|silverlight|
As you may know, Silverlight does not have the TileBrush found in WPF. Is there a workaround to do tiling?
Limiting results of System.Data.Linq.Table<T>
|linq-to-sql|
I am trying to inherit from my generated datacontext in LinqToSQL - something like this public class myContext : dbDataContext { public System.Data.Linq.Table<User>() Users { return (from x in this.Users() where x.DeletedOn.HasValue == false select x); } } But my Linq statement return...
I am trying to inherit from my generated datacontext in LinqToSQL - something like this public class myContext : dbDataContext { public System.Data.Linq.Table<User>() Users { return (from x in base.Users() where x.DeletedOn.HasValue == false select x); } } But my Linq statement return...
Lie. Tell him it's research into a new technology. Then tell him you decided the cost didn't justify the benefits. He'll think you did a great job.
Lie. Tell him it's research into a new technology. Then tell him you decided the cost didn't justify the benefits. He'll think you did a great job. lol @ people down modding / marking offensive. Really, if it's a penny pinching boss, who doesn't understand good software from cheap software, what he doesn't know w...
Is there an easy way in .NET to get "st", "nd", "rd" and "th" endings for numbers?
|.net|date|formatting|
I am wondering if there is a method or format string I'm missing in .NET to convert the following: 1 to 1st 2 to 2nd 3 to 3rd 4 to 4th 11 to 11th 101 to 101st 111 to 111th [This link][1] has a bad example of the basic principle involved in writing your own funct...
I am wondering if there is a method or format string I'm missing in .NET to convert the following: 1 to 1st 2 to 2nd 3 to 3rd 4 to 4th 11 to 11th 101 to 101st 111 to 111th [This link][1] has a bad example of the basic principle involved in writing your own funct...
|.net|date|formatting|ordinals|
I agree with Orion, but I'm going to rephrase the decision process. You have a noun and a verb / an object and an action. - If many objects of this type will use this action, try to make the action part of the object. - Otherwise, try to group the action separately, but with related actions. I like the ...
The top post (Leigh Caldwell) will not return duplicate records and needs to be down modded. It will identify the duplicate keys. Furthermore, it will not work if your database doesn't allows the group by to not include all select fields (many do not). If your date field includes a time stamp then you'll need to ...
I'm wondering the same thing, as currently I do something like: DrawingVisual drawingVisual = new DrawingVisual(); using (DrawingContext drawingContext = drawingVisual.RenderOpen()) { // // ... draw on the drawingContext // RenderTargetBitmap bmp = new RenderTargetBitmap...
Don't use atoi and atof as these functions return 0 on failure. Last time I checked 0 is a valid integer and float, therefore no use for determining type. use the strto functions, as these set errno on failure, and also report where the converted data ended. strtoul: <http://www.opengroup.org/onlinepubs/007908799...
Don't use atoi and atof as these functions return 0 on failure. Last time I checked 0 is a valid integer and float, therefore no use for determining type. use the strto functions, as these set errno on failure, and also report where the converted data ended. strtoul: <http://www.opengroup.org/onlinepubs/007908799...
Don't use atoi and atof as these functions return 0 on failure. Last time I checked 0 is a valid integer and float, therefore no use for determining type. use the strto functions, as these set errno on failure, and also report where the converted data ended. strtoul: <http://www.opengroup.org/onlinepubs/007908799...
Don't use atoi and atof as these functions return 0 on failure. Last time I checked 0 is a valid integer and float, therefore no use for determining type. use the strto{l,ul,ull,ll,d} functions, as these set errno on failure, and also report where the converted data ended. strtoul: <http://www.opengroup.org/onlin...
You could use a traits class for this. Something like: #include <iostream> using namespace std; template <typename T> class type_name { public: static const char *name; }; #define DECLARE_TYPE_NAME(x) template<> const char *type_name<x>::name = #x; #define GET_TYPE_NAME...
The header is incorrect, try this instead: header( 'Content-Type: application/javascript' );
Hide google Toolbar by javascript
|javascript|browser|
Is there a way to hide the google toolbar in my browser programmable?
As everybody else has said, no you can't subclass String because it's final. But might something like the following help? public final class NamespaceUtil { // private constructor cos this class only has a static method. private NamespaceUtil() {} public static String ...
Just had a little look, a lot of the things they offer you should be able to do yourself with a little palnning and foresight (combine all javascript files, combine all css, minify, enable GZip... $750 a year seems a little steep, and theres no options. I'm going to give it a whirl and then see how much it improv...
Just had a little look, a lot of the things they offer you should be able to do yourself with a little palnning and foresight (combine all javascript files, combine all css, minify, enable GZip... $750 a year seems a little steep, and theres no options. (edit) After speaking with the marketing bods, it's $499 un...
You will have to call some native code, since IMHO there is no library that does it. Since JNI is cumbersome and hard you might try to use JNA (Java Native Access). https://jna.dev.java.net/
I did it by exporting to CSV, and then importing with whatever utility is available. I quite like the use of the php://output stream. $result = $db_con->query('SELECT * FROM `some_table`'); $fp = fopen('php://output', 'w'); if ($fp && $result) { header('Content-Type: text/csv'); heade...
Turning this on its head, consider you want to design a new language and you want it to run in a managed runtime with a JIT and GC. Then consider that you could: (a) write you own managed runtime (VM) and tackle all sorts of technically difficult issues that will doubtless lead to many bugs, bad performance, improp...
Make a function that will ask you whether you're sure when the buffer has been edited and is not associated with a file. Then add that function to the list `kill-buffer-query-functions'. * a buffer is not visiting a file if and only if the variable `buffer-file-name' is nil EDIT: the following should work if you...
Make a function that will ask you whether you're sure when the buffer has been edited and is not associated with a file. Then add that function to the list `kill-buffer-query-functions'. * a buffer is not visiting a file if and only if the variable `buffer-file-name' is nil EDIT: the following should work if you...
Make a function that will ask you whether you're sure when the buffer has been edited and is not associated with a file. Then add that function to the list `kill-buffer-query-functions'. * a buffer is not visiting a file if and only if the variable `buffer-file-name' is nil EDIT: the following should work if you...
Make a function that will ask you whether you're sure when the buffer has been edited and is not associated with a file. Then add that function to the list `kill-buffer-query-functions'. * a buffer is not visiting a file if and only if the variable `buffer-file-name' is nil EDIT: the following should work if you...
Your best bet maybe to work with experts who do this sort of thing for a living. These guys are actually in our office complex...I've had a chance to work with them on a similar project I was lead on. [http://www.deltasquare.com/About][1] [1]: http://www.deltasquare.com/About
PHP DOMDocument stripping HTML tags
|php|
I'm working on a small templating engine, and I'm using DOMDocument to parse the pages. My test page so far looks like this: <block name="content"> <?php echo 'this is some rendered PHP! <br />' ?> <p>Main column of <span>content</span></p> </block> And part of my class looks like this: ...
Migrating from MySQL to arbitrary standards-compliant SQL2003 server
|sql|mysql|
Is there an incantation of mysqldump or a similar tool that will produce a piece of SQL2003 code to create and fill the same databases in an arbitrary SQL2003 compliant RDBMS? (The one I'm trying right now is MonetDB)
There may be an easier way, but for IPv4, if you can perform ordinary DNS lookups, you can always construct the reverse query yourself. For the IPv4 address A.B.C.D, look up any PTR records at D.C.B.A.in-addr.arpa. For IPv6, you take the 128 hex nibbles and flip them around and append ipv6.arpa. and do the same thing.
I believe unsafe code is used if you want to access something outside of the .NET runtime, ie. it is not managed code (no garbage collection and so on). This includes raw calls to the Windows API and all that jazz.
Short answer: use **time.clock()** for timing in Python. On *nix systems, clock() returns the processor time as a floating point number, expressed in seconds. On Windows, it returns the seconds elapsed since the first call to this function, as a floating point number. time() returns the the seconds since the epoc...
Don't use atoi and atof as these functions return 0 on failure. Last time I checked 0 is a valid integer and float, therefore no use for determining type. use the strto{l,ul,ull,ll,d} functions, as these set errno on failure, and also report where the converted data ended. strtoul: <http://www.opengroup.org/onlin...
Try this, it'll use your locale set for the application: <%=String.Format("{0:C}",GetPrice())%>
This isn't really about whether 'divs are better than tables for layout'. Someone who understands CSS can duplicate any design using 'layout tables' pretty straightforwardly. The real win is using HTML elements for what they are there for. The reason you would not use tables for non-tablular data is the same reason you...
You have two options throw; or throw the orginal exceptional as an innerexception of a new exception. Depending on what you need/
Javascript is **ALWAYS** case-sensitive.
Javascript is **ALWAYS** case-sensitive. It sounds as thought you are talking about whether html attributes (e.g. onclick) are or are not case-sensitive. The answer is that the attributes are not case sensitive, but the way that we access them through the DOM is. So, you can do this: <div id='divYo' onCl...
Javascript is **ALWAYS** case-sensitive. It sounds as thought you are talking about whether html attributes (e.g. onclick) are or are not case-sensitive. The answer is that the attributes are not case sensitive, but the way that we access them through the DOM is. So, you can do this: <div id='divYo' onCl...
I recommend gcc because it's designed to be used on the command line, and you can compile simple programs and see exactly what's happening: g++ -o myprogram myprogram.cc ls -l myprogram One file in, two files out. With Visual C++, most people use it with the GUI, where you have to set up a project and t...
Ultimately the decision comes down to whether it is more helpful to deal with application-level errors like this using exception handling, or via your own home-rolled mechanism like returning status codes. I don't think there's a hard-and-fast rule about which is better, but I would consider: - Who's calling your...
Any tools to get code churn metrics for a Subversion repository?
|svn|project-management|
I'm looking for any tools that can give you code churn metrics (graphs and charts would be even better) for a Subversion repository. One tool I know of is [statsvn][1] - a Java tool that creates some HTML reports and some code churn metrics. I wanted to know if there are any others that are maybe open source, ext...
I'm looking for any tools that can give you code churn metrics (graphs and charts would be even better) for a Subversion repository. One tool I know of is [statsvn][1] - a Java tool that creates some HTML reports and some code churn metrics. Statsvn reports the number of lines modified (churned) by user over time, ...
I'm looking for any tools that can give you code churn metrics (graphs and charts would be even better) for a Subversion repository. One tool I know of is [statsvn][1] - a Java tool that creates some HTML reports and some code churn metrics. I wanted to know if there are any others that are maybe open source, ext...
The pos function gives you the position of the match. If you put your regex in parentheses you can get the length (and thus the end) using <code>length $1</code>. Like this sub match_positions { my ($regex, $string) = @_; return if not $string =~ /($regex)/; return (pos, pos + length ...
Specifying Source for Debugging using Netbeans
|jsf|netbeans|
Using the debugger in Netbeans 6.1, I'd like to step into a method of the JSF library (specifically method saveSerializedView of class StateManager), but I cannot figure out how to specify through the IDE the location of the source code for the JSF library. I'm even having trouble determining which jar file or files Ne...
I had this problem on IIS6 one time when somehow the ASP.NET ISAPI stuff was broke. Running %windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i to recreate the settings took care of it.
.NET framework versions are transmitted in IE, in the User Agent.
You count opening parentheses, left to right. So the order would be (([0-9]{3}).([0-9]{3}).([0-9]{3}).([0-9]{3})) ([0-9]{3}) ([0-9]{3}) ([0-9]{3}) ([0-9]{3}) ([A-Z]+) At least this is what Perl would do. Other regex engines might have different rules.
For big, performance critical applications, building your own containers specifically tailored to your needs may be worth the time investment. I´m talking about *real* game development here.
Lightbox is another popular one: [Lightbox Project Page][1] [1]: http://www.lokeshdhakar.com/projects/lightbox2/
Yes, it can be done as long as both windows are on the same domain. The window.open() function will return a handle to the new window. The child window can access the parent window using the DOM element "opener".
In the event handler, the "source" object (the first parameter of the event handler) is the object raising the event. Type it to button and get the name, or use reflection to get information out of the non-typed object. In addition, if the control is a child of a web control that you do not have raise its own event...
check out jQuery <http://jquery.com> and then the LightBox plugin for jQuery: <http://leandrovieira.com/projects/jquery/lightbox/>
They login to your account and scrape the contents, or use a public API. Either way, it's not a method that I would implement or use myself because I wouldn't trust anyone else with my credentials. And I think it teaches users to be careless with the secrecy of their credentials.
There's nothing wrong with a for/foreach loop. That's all a hypothetical AddRange method would do anyway. The only extra concern I'd have is with memory allocation behaviour, because adding a large number of entries could cause multiple reallocations and re-hashes. There's no way to increase the capacity of an exist...
Siebel On-Premise offers a wealth of integration options. Start with Siebel Bookshelf and specifically Integration Platform Technologies: Siebel Enterprise Application Integration. For your more static data, have a look at MDM. In this case refer to Siebel Master Data Applications Reference for Industry Applications...
The MSDN link is nice, but the security information there isn't complete. The handler registration should contain "%1", not %1. This is a security measure, because some URL sources incorrectly decode %20 before invoking your custom protocol handler. PS. You'll get the entire URL, not just the URL parameters. But the...
You can use templates. template <typename T> const char* typeof(T&) { return "unknown"; } // default template<> const char* typeof(int&) { return "int"; } template<> const char* typeof(float&) { return "float"; } In the example above, when the type is not matched it will print "unknown".
GWT doesn't readily support this since all Java code that is (or rather may be) required for the module that you load is compiled into a single JavaScript file. This single JavaScript file can be large but for non-trivial modules it is smaller than the equivalent hand written JavaScript. Do you have a scenario where...
MySQL statement that returns a SQL statement?
|mysql|php|
I need to do a dump of a table on a remote server, but I can't access the server directly. The only access I have is through PHP scripts. Is there some way in which MySQL will return an INSERT INTO `table_name` (`field1`, `field2`) VALUES ('a', 'b'), ('c', 'd') statement, like what `mysqldump` will return...
|php|mysql|
I need to do a dump of a table on a remote server, but I can't access the server directly. The only access I have is through PHP scripts. Is there some way in which MySQL will return an INSERT INTO `table_name` (`field1`, `field2`) VALUES ('a', 'b'), ('c', 'd') statement, like what `mysqldump` will return...
According to the **[time module docs][1]**: > **clock()** > > On Unix, return the current processor > time as a floating point number > expressed in seconds. The precision, > and in fact the very definition of the > meaning of ``processor time'', depends > on that of the C function of the same > name, but i...
You will need to use the [XML querying in sql server](http://msdn.microsoft.com/en-us/library/ms345122.aspx#sql2k5_xqueryintro_topic8) to do that. somethings like select id, MyField.query('/Object/Type[.="AAA"]/Value') as AAA, MyField.query('/Object/Type[.="BBB"]/Value) AS BBB not sure if that's 100% corre...
You can use a stored procedure that returns all the mapped columns in the table for all the records that are not marked deleted, then map the LINQ to SQL class to the stored procedure's results. I think you just drag-drop the stored proc in Server Explorer on to the class in the LINQ to SQL designer.
I would recommend SVN Access: http://www.jaj.com/projects/svnaccess/ or http://freshmeat.net/projects/svnaccess/ I have used it as is, and have modified it for an enterprise-wide solution at my day job.
This one intrigued me. I know jessegavin posted some code while I went to figure this out, but this one is tested. I have a super-simple working example that lets you drag to and from flash. It's pretty messy as I threw it together during my lunch break. Here's the [demo][1] And the [source][2] The base cla...
We had to use a fixed when an address gets passed to a legacy C DLL. Since the DLL maintained an internal pointer across function calls, all hell would break loose if the GC compacted the heap and moved stuff around.
If you know the patterns, then they become tools in your toolbox. When you look at a task, you select from your tools. At that point you should have a pretty good idea which tool is the best fit for a given problem. This is where formulas stop working and you actually do engineering work.
This tells me the designers of the .NET framework did a good job of covering the problem space--of making sure the "managed code" environment can do everything a traditional (e.g. C++) approach can do with its unsafe code/pointers. In case it cannot, the unsafe/fixed features are there if you need them. I'm sure someo...
Order does not matter, however, the former implies that it s the zero you're checking. Convention dictates the use of hte latter.
The obvious portable way would be to set a Proxy in URL.openConnection. The proxy can be in local host, you can then write a very simple proxy that binds the local address of the client socket. If you can't modify the source where the URL is connected, you can replace the URLStreamHandler either when calling the URL...
Programmatically Make Bound Column Invisible
|asp.net|
I'm trying to make a data bound column invisible after data binding, because it won't exist before data binding. However, the DataGrid.Columns collection indicates a count of 0, making it seem as if the automatically generated columns don't belong to the collection. How can I make a column that is automatically gen...
I understand that this is personal preference. Although by putting the variable second you can ensure that you don't accidentally assign the constant to the variable which used to concearn c developers. This is probably why you are seeing it in c# as developers switch language.
This alternative works where xargs is not availabe: grep -L -r 'Subject: \[SPAM\]' . | while read f; do mv "$f" out; done
Programmatically setting the record pointer in a C# DataGridView
|c#|.net|winforms|datagridview|
How do I programmatically set the record pointer in a C# DataGridView? I've tried "DataGridView.Rows[DesiredRowIndex].Selected=true;", and that does not work. All it does is highlight that row within the grid; it doesn not move the record pointer to that row.