At this moment we construct our search query in our website with java script. We have an input box for keyword and another input box for name and so on. If a user enters keyword: test the query looks like:
http://oursite.com/Search?keyword=test
if they enter keyword: test and name: john the string looks like:
http://oursite.com/Sear...
So, I'd like to hear what you all think about this.
I have a project where three different inheritance paths need to all implement another base class. This would be multiple inheritance and isn't allowed in C#. I am curious how I can implement this without code duplication.
EDIT: I don't own the three classes. The three classes are f...
I have some C# code that walks XML schemata using the Xml.Schema classes from the .NET framework. The various simple type restrictions are abstracted in the framework as a whole bunch of classes derived from Xml.Schema.XmlSchemaFacet. Unless there is something I've missed, the only way to know which of the derived facet types a given fac...
I am currently refactoring some code for work and I have come across some function calls prefixed by the "@" symbol. As I understand it, this is intended to escape PHP error reporting if the call fails.
Is this type of thing good practice? I understand the rationale in a development environment but when the site is pushed to production...
how can i refactor this code down to one method or something?
if (!string.IsNullOrEmpty(_gridModel.Header))
_gridModel.Header += ",";
if (item != null)
_gridModel.Header += item.Header;
if (!string.IsNullOrEmpty(_gridModel.Width))
_gridModel.Width += ",...
I am trying to Refactor this code as it is repeated ad nauseum throughout my program.
My problem has to do with the fact that on any given page(tabpage,panel,uc,etc) there are controls at multiple levels to spellcheck.
i.e. -->
foreach (Control control in tpgSystems.Controls)
{
if (control.GetT...
Apologies if this has been asked before. I searched and couldn't find it.
In my application I have about 10 nib files, most of which hold a single significant view object and a number of subviews/controls.
At what point would you consider breaking nibs into pieces? For example in one of my nibs I have an NSCollectionview and the pro...
I use Resharper at work. Some of my colleagues do not.
When I open some code that has been written someone who doesn't, it is immediately obvious by the amount of orange on my screen.
What I am unsure of is to what extent I should feel free to tidy up the messes the have unknowingly left. With most of what I am looking at, it is slop...
Do you intermingle refactoring changes with feature development/bug fixing changes, or do you keep them separate? Large scale refactorings or reformatting of code that can be performed with a tool like Resharper should be kept separate from feature work or bug fixes because it is difficult to do a diff between revisions and see the real ...
I have some code which is the same except that a certain sequence of assignments happen in slightly different orders.
It is easy to factor this out into a method parameter of type int[], which denotes the order.
However, I find it isn't the clearest.
Another option was to factor them out into a object of type AssignmentOrders. I c...
Hi,
I was wondering if there are any good refactoring tools for Oracle databases and especially for PL/SQL. I'm working on a project where half the developers are working with c# and the other half on the db where there is a large and complex schema and a large code base in pl/sql. We also use sql server but the database team work exclus...
Hi all,
Currently I get to edit a lot of Spring.NET XML files, and I do find this work to quite repetitive and, frankly boring.
Most of the stuff I do is sort of 'refactoring' - generalising XML declaration for instances and "inheriting" from those generalised structures to declare more specific ones.
As I said, it's a no-brainier typ...
Do I really need this many echo's or can I make it shorter?
<?php
if (!empty($url))
{
echo '<p>Job: <span>' . $job .'</span></p>';
echo '<p>Skills: <span class="caps">' . $skills . '</span></p>';
echo '<p>Website: <a href="http://' . $url . '" title="' . $url . '">http://' . $url . '</a></p>';
echo '<p>Pay:' . $pay. '</p...
Consider a ViewModel and an View that uses it, where the DataContext is set to the VM in the code behind file. When they are both at the project namespace, the view runs without exceptions with binding statements along the lines of:
ItemsSource="{Binding Path=PrefixFilterChoices}"
where PrefixFilterChoices is a property on the VM. W...
I am just learning jQuery and I wanted to see what I could do with the function below. This function adds or removes css classes to create a pull down menu (it is in fact Stu Nicholl's well known pull down menu). But I'm not getting very far (I've been learning jQuery for approximately an hoour now, so my DOM traversal isn't quite up t...
I've recently been playing around with PostSharp, and it brought to mind a problem I faced a few years back: A client's developer had produced a web application, but they had not given a lot of thought to how they managed state information - storing it (don't ask me why) statically on the Application instance in IIS. Needless to say the ...
I came across this piece of code today:
public static byte[] ReadContentFromFile(String filePath)
{
FileInfo fi = new FileInfo(filePath);
long numBytes = fi.Length;
byte[] buffer = null;
if (numBytes > 0)
{
try
{
FileStream fs = new FileStream(filePath, FileMode.Open);
BinaryRe...
I have a very complex game view with some custom views and some standard controls in the view.
When some actions happen, i want to show a different view within the same area. What i have done is i have created two view objects in the view and incorporated the two views separately. As actions happen, i hide / unhide the views i need and i...
I have a bunch of Javascript functions that look like the following:
function generateBusinessImage (business) {
var business_image = document.createElement('img');
business_image.setAttribute('class','photo');
business_image.alt = business.name;
business_image.title = business.name;
business_image.align = 'right';
business_...
A section of a site I am building needs some form of revision system and so
decided to keep it simple and go with one similar to Stack Overflow.
I quickly created the following which works although seems a little messy. I know I can use beforeSave and afterSave but I have no idea how I could implement it.
I know I could probably move ...