Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

AdamNThompson

@AdamNThompson
About
Posts
19
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • I have fallen in disgrace, I am programming in VB.NET
    A AdamNThompson

    What do VB.NET and fat girls have in common? Just kidding.. If your any good at C# within a day or two you'll be cranking out VB.NET code like it's nothing. It's not a bad language at all, though it's a little verbose in my opinion. At the end of the day your writing against the same .NET framework you already know.

    -Adam N. Thompson adam-thompson.com

    The Lounge csharp

  • Is this a known pattern?
    A AdamNThompson

    Looks like a Repository Pattern to me, or at least a variation. Why don't you post your whole implementation so we can have a better look. I do it like this...

    public class Repository : IRepository
    {
    ObjectContext _context;
    public Repository(ObjectContext context) {
    _context = context;
    }

    public void CommitChanges() {
        \_context.SaveChanges();
    }
    
    string GetSetName<T>() {
        var entitySetProperty =
        \_context.GetType().GetProperties()
           .Single(p => p.PropertyType.IsGenericType && typeof(IQueryable<>)
           .MakeGenericType(typeof(T)).IsAssignableFrom(p.PropertyType));
    
        return entitySetProperty.Name;
    }
    public void Delete<T>(System.Linq.Expressions.Expression<Func<T, bool>> expression) where T: class, new() {
    
        var query = All<T>().Where(expression);
        foreach (var item in query) {
            Delete(item);
        }
    }
    public void Delete<T>(T item) where T: class, new() {
        \_context.DeleteObject(item);
    }
    public void DeleteAll<T>() where T: class, new() {
        var query = All<T>();
        foreach (var item in query) {
            Delete(item);
        }
    }
    public void Dispose() {
        \_context.Dispose();
    }
    public T Single<T>(System.Linq.Expressions.Expression<Func<T, bool>> expression) where T: class, new() {
        return All<T>().FirstOrDefault(expression);
    }
    public T Single<T>(Expression<Func<T, bool>> expression, Expression<Func<T, object>> include) where T : class, new()
    {
        return All<T>(include).FirstOrDefault(expression);
    }
    public T Single<T>(Expression<Func<T, bool>> expression, params Expression<Func<T, object>>\[\] include) where T : class, new()
    {
        return All<T>(include).FirstOrDefault(expression);
    }
    public IQueryable<T> All<T>() where T: class, new() {
        return \_context.CreateQuery<T>(GetSetName<T>()).AsQueryable();
    }
    public IQueryable<T> All<T>(Expression<Func<T, object>> include) where T : class, new()
    {
        return \_context.CreateQuery<T>(GetSetName<T>()).Include<T>(include).AsQueryable();
    }
    public IQueryable<T> All<T>(params Expression<Func<T, object>>\[\] include) wher
    
    The Lounge csharp regex question

  • Really frustrated when moving from C# to C++
    A AdamNThompson

    Fair enough. Maybe I get a little carried away. I would like it if you would elaborate though on how you go about measuring productivity, and why you feel that number 2 on my list is not measurable. I feel like I can look at code and tell if it's going to me maintainable. I look for things like meaningful abstraction, IOC, layered architecture, and so on. If someone is making database calls in a code behind file in their UI project, or is cut and pasting the same block of code throughout their work (both of which I have seen done before), I would consider that suboptimal to maintain, and therefor unproductive.

    -Adam N. Thompson adam-thompson.com

    The Lounge csharp c++

  • Really frustrated when moving from C# to C++
    A AdamNThompson

    "excellent developer (or manager)" In my experience "excellent developer"s are not managers. They want to write software... Not manage people. As for measuring productivity, coming from someone that is managed on productivity alone, I can assure you that it is measurable. 1) You meet you deadlines or you don't 2) Your code is maintainable or it's not 3) Your code is documented or it's not 4) Your code meets the business requirements or it doesn't 5) Your peer code reviews ether go well or they don't These are the things that I am measured on, and my team is accountable for. What time I come in, how I dress, an do on, are all a far second to actual productivity. Now that is progressive management based entirely on productivity. The fact is that when faced with a new project there are a lot of decisions to make. Those decisions directly affect productivity. I don't care what you are developing. As a lead developer it is very clear to me that some technologies are going to be more productive than others given the requirements of the project. I am not trying to discount you, I just want to make the point that productivity is indeed measurable, and that it is important to do so.

    -Adam N. Thompson adam-thompson.com

    The Lounge csharp c++

  • Really frustrated when moving from C# to C++
    A AdamNThompson

    I agree with using the right tool for the right job. All I'm saying is just don't be that guy that codes everything with notepad just to prove a point. We had one of those once and in software consulting that kind of crap doesn't fly anymore. A good developer takes advantage of the tools and frameworks that are available to be more productive! That's all I'm saying...

    -Adam N. Thompson adam-thompson.com

    The Lounge csharp c++

  • Really frustrated when moving from C# to C++
    A AdamNThompson

    Amen to that. I love coding. Both for my paycheck and in my spare time. I have experimented with lots of languages, frameworks and patterns all for the sake of understanding. One thing I have found to be true is that C# is powerful and time efficient, and flexible. C# and .Net are my go to language/platform of choice. Can I accomplish the same thing in C++? Sure I can, It would just take twice as long and give me a head ache. It's one thing to take the time to understand how a language/platform works behind the scenes to grow as a developer, it's whole other thing to take twice as long to code the same application so that you can go around calling yourself a "real man".

    -Adam N. Thompson adam-thompson.com

    The Lounge csharp c++

  • Why Jonny Can't Code
    A AdamNThompson

    Ya, in some cases you may be right. It's just that the programmers that I have that are stright out of college have acidemic knolege but no real practical knolege of how to buld software. These are the ones i end teaching how to step through their veribles in debug mode using break points and stuff like that. They have no idea what a delgate is. And forget get about new language features. I admit that may not be the so in all cases as some people are just more passionate about their work than other. If you'e building a simple app to track Magic Cards. I cold teach a high schooler how. But whe it comes to buildign enterrnrtprist applications. There is a lot to know

    -Adam N. Thompson

    The Lounge html database com question

  • Why Jonny Can't Code
    A AdamNThompson

    "The problem with programming today, is that there's so much drag and drop, point and click, write no code stuff going on that people are taking contract work and hitting a wall the moment they find they need to write code after all" Amen to that. If I have to explain to one more stupid f**k how to loop through an collection, or or use a base page class I'm going to go gehad on their drag n' drop a**. 5 years ago I taught myself how to programm by reading books and tutorials online. I started with VB.NET and now do mostly C#. These days I make a good living building enterprise software. So I think .NET is a great place to start. I have tried several other languages and have not been impressed after working with .NET. I feel like nothing truly compairs. If I can become the developer for a software consulting company just by reading books and make the kind of money that good developers make with no colege degree, just by reading books. .NET is a great place to start. If you cant figure it out, maybe you are fresh out of college where they didn't teach you anything practical, or maybe this industry just isn't for you.

    -Adam N. Thompson

    The Lounge html database com question

  • Ninja or Samurai
    A AdamNThompson

    Ninja, Hands down are way cooler that the samurai! I mean seriously... Ninjas know magic, and leave a trail of death and destruction. That would be so much sweeter that being a gay little samurai. I herd that one time this Ninja totally flipped out and made some poor programmer eat his own laptop. Poor guy was crapin keys for a month.... Now that's cool. If you doubt how totally awesome and sweet ninjas truly are please check out the following link and you will see my point. www.realultimatepower.net -Adam

    -Adam N. Thompson

    The Lounge question discussion

  • Need help with Datalist Edit Command
    A AdamNThompson

    I need a little help with some code I'm working on. I have a Datalist control that is throwing the following expeption. ------------------------------------------------------------------------ Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. ------------------------------------------------------------------------ Here is my code. Sub Edit_Command(ByVal sender As Object, ByVal e As DataListCommandEventArgs) Handles DataList.EditCommand DataList.EditItemIndex = CType(e.Item.ItemIndex, Integer) Dim strDate As String = "" Dim strAssignments As String = "" Dim strSchool As String = "" Dim strProgramme As String = "" Dim strSubject As String = "" Dim strCity As String = "" Dim strState As String = "" Dim strReason As String = "" Dim reader As SqlDataReader Dim cmd As New SqlCommand("SELECT * FROM tblVolDeclinedMissedCanceledAssignments WHERE VolunteerId=" & VolunteerId() & " AND Id=" & e.CommandArgument, cn) cmd.CommandType = Data.CommandType.Text Try cn.Open() reader = cmd.ExecuteReader() While reader.Read strDate = IIf(IsDBNull(reader("Date")), "", reader("Date")) strAssignments = IIf(IsDBNull(reader("Assignment")), "", reader("Assignment")) strSchool = IIf(IsDBNull(reader("SchoolVenue")), "", reader("SchoolVenue")) strProgramme = IIf(IsDBNull(reader("Programme")), "", reader("Programme")) strSubject = IIf(IsDBNull(reader("Subject")), "", reader("Subject")) strCity = IIf(IsDBNull(reader("City")), "", reader("City")) strState = IIf(IsDBNull(reader("StateProvince")), "", reader("StateProvince")) strReason = IIf(IsDBNull(reader("Reason")), "", reader("Reason")) End While Catch ex As Exception Throw New ApplicationException(ex.Message) Finally cn.Close() End Try CType(e.Item.FindControl("rdpEditDate"), Telerik.WebControls.RadDatePicker).SelectedDate = strDate CType(e.Item.FindControl("ddlEditAssignments

    ASP.NET help data-structures debugging

  • Problem Calling Web Service From Production Environment
    A AdamNThompson

    Hi All, I'm having some difficulties and am hoping for some help. I have a site on one of our server used just for web services that I plan to use in other sites on that server. The web service site has been deployed to the server and seems to be working fine. When I call one of the services form my development machine it works fine, but now that I have used one of the services in finished site on that same server I am getting the following error. Server Error in '/' Application. -------------------------------------------------------------------------------- The request failed with HTTP status 400: Bad Request. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Net.WebException: The request failed with HTTP status 400: Bad Request. Source Error: Line 98: [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://exaservice.net/WebServices/SearchSiteHtml", RequestNamespace="http://exaservice.net/WebServices", ResponseNamespace="http://exaservice.net/WebServices", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] Line 99: public string SearchSiteHtml(string url, string webSearch) { Line 100: object[] results = this.Invoke("SearchSiteHtml", new object[] { Line 101: url, Line 102: webSearch}); Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\cc6d9c2e\63ba5077\App_WebReferences.9hwc9vsl.0.cs Line: 100 Stack Trace: [WebException: The request failed with HTTP status 400: Bad Request.] System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +533252 System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +204 net.exaservice.www.SiteSearchWS.SearchSiteHtml(String url, String webSearch) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\cc6d9c2e\63ba5077\App_WebReferences.9hwc9vsl.0.cs:100 Search.Page_Load(Object sender, EventArgs e) in D:\websites\centralfloridafair\html\Search.aspx.vb:10 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive() +47 System.Web.UI.Page.ProcessRequestMai

    ASP.NET help csharp html asp-net wcf

  • MSDN: Am I missing something?
    A AdamNThompson

    Looks kind of like System.Net.Mail to me...

    -Adam N. Thompson

    The Lounge c++ com sysadmin architecture tutorial

  • calling web services with javascript
    A AdamNThompson

    I have a question regarding calling web services from client side. You see the company I work for hosts sites in every version of asp - asp.net, and we have to work on a just about all of them. This makes something simple like sending form data to an email address a little bit of a pain. For /Net 2.0 I always use the System.Net.Mail Namespace, for 1.0/1.1 we have some 3rd party dll, and for classic asp we have some dinosaur code that is creating a COM object that seems to break all the time. Now that I have used them all great, but for newer developers here it’s a pain... I won’t lie... It’s a pain for me too. That’s when I thought, hey, why not build a web service and call it with JavaScript, then we could call it from any site with the same script. There is one problem with that though. It seems you have to use an XmlHTTPRequest which will not work cross domain. The thing is, in this case I really don’t care if it’s all, asynchronous and fancy. I just want it to work reliably. Does anyone know a better cross platform solution? Thanks,

    -Adam N. Thompson

    Web Development question csharp javascript asp-net wcf

  • Best thing CP has done for you...
    A AdamNThompson

    that's cool. I thought I would rewrite it and put a little more time into it though. From the moment I posted that article everyone jumped all over it. I need to find a better example of what I'm trying to convey. the technique I'm trying to show is using loops and counters to define the depth of your arrays, and then using the counter to increment the arrays in the loop thus creating code that works dynamically. I have used that trick in a lot of my code, and need to find a better example. Especially if the control I wrote would have been easier to write with a repeater. -- modified at 14:09 Saturday 29th September, 2007

    -Adam N. Thompson

    The Lounge python

  • Best thing CP has done for you...
    A AdamNThompson

    The articles I have posted on CP have gotten me jobs... i cant think of anything better. When I was first starting out I posted a bunch of stuff on CP and then had work I could show. CP definitly helped me get my first shot at being a developer. Thanks CP...

    -Adam N. Thompson

    The Lounge python

  • Protecting your shared hosting environment.
    A AdamNThompson

    After a little research I have found that this solution would be just to time consumming and require too many resources to work. Vertual machines have to have memory alicated specificly to them. That just wouldn't make since.

    -Adam N. Thompson

    Work Issues sysadmin hosting help workspace

  • Protecting your shared hosting environment.
    A AdamNThompson

    Hi All, I am having some issues at work. We mostly only affer hosting for the sites that we do the development on ourselves. But now we have some inexperianced developers that work for some of our clients uploading crapy code to our production environment, and yesterday it actualy brought down our server, and was quite a big deal. I was wondering if anyone else here has had any similar issues. I mean there are several hosting companies our there allowing anyone and everyone to upload code to their server, and there has got to be some kind of protection from these kind of issues. I have not been with the company long, but can see that this could be a seroous problem. Especialy when most of our revinue is generated by development. I am doing some research myself, but wanted to see if anyone here had any ideas. Thanks, Adam

    -Adam N. Thompson

    Work Issues sysadmin hosting help workspace

  • The code monkeys are invading!
    A AdamNThompson

    I guess I could be considered a "Code Monkey". If that's the case I am proud to be one. I went to school for marketing and worked as an Account Executive for 6 years only to find that I hated my job but liked writing code. I then spent two years learning enough about web programming to be considered for a Jr. Developer position, and finally landed a job with a company that builds custom web apps. I no longer have my own office, and make half the money, but at least now I'm happy with what I do. Plus, with the way the IT industry is moving I'll be doing even better than I was before with a couple more years of experience. According to CNN.com Software Engineer's are the 4th most in demand job for 2002-2012. Does most of my code originate from websites, books, and forums? ABSOLUTLY! However, I don't go around posting questions like the one's in the article above... I think anyone who posts a question on the syntax of an array should be referred to as a "Code Gerbil".

    -fr33l0ader It is your responsibility to program each department of your own mind. Should you neglect this responsibility; the world will program it for you.

    The Lounge csharp html com tutorial question

  • Verisign!
    A AdamNThompson

    There are other alternatives that are way more cost efective. This is what my ISP sent me. "If you are unsure of which Authorized SSL provider to use, we recommend Geotrust, as their pricing is less than Verisign." their price is less than half. Hope this helps.

    -fr33l0ader

    The Lounge cryptography question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups