Search Results

Search found 195 results on 8 pages for 'sir psycho'.

Page 3/8 | < Previous Page | 1 2 3 4 5 6 7 8  | Next Page >

  • Covariance and contravariance real world example

    - by Sir Psycho
    I'm having a little trouble understaing how I would use covariance and contravariance in the real world. So far, the only example's I've seen have been the same old array example. object[] objectArray = new string[] { "string 1", "string 2" }; It would be nice to see an example that would allow me to use it during my development if I could see it being used elsewhere. Can anyone point me to some useful resources?

    Read the article

  • Should HTML be encoded before being persisted?

    - by Sir Psycho
    Should HTML be encoded before being stored in say, a database? Or is it normal practice to encode on its way out to the browser? Should all my text based field lengths be quadrupled in the database to allow for extra storage? Looking for best practice rather than a solid yes or no :-)

    Read the article

  • 'Recursive' LINQ calls

    - by Sir Psycho
    Hi, I'm trying to build an XML tree of some data with a parent child relationship, but in the same table. The two fields of importance are CompetitionID ParentCompetitionID Some data might be CompetitionID=1, ParentCompetitionID=null CompetitionID=2, ParentCompetitionID=1 CompetitionID=3, ParentCompetitionID=1 The broken query I have simply displays results in a flat format. Seeing that I'm working with XML, some sort of recursive functionality is required. I can do this using recursion, but would like to see the linq version. Any help appreciated. var results = from c1 in comps select new { c.CompetitionID, SubComps= from sc in comps.Where (c2 => c2.CompetitionID == c1.CompetitionID) select sc };

    Read the article

  • Streaming data to the browser as a file of unknown size

    - by Sir Psycho
    I have some data which is queried from the database and I'd like to send it to the client as a csv file. The file size varies each time due to the fact that the DB data returned can be of any size. Instead of saving this file to the hard disk, I'd like to send it to the browser at the same time it's being processed into a CSV by my algorithm. Response.Write seems useless. For some reason, the file download dialog is only displayed once my processing is finished. This seems odd as I'm writting all my output to the Response.Output stream. I have downloaded files on the web before where the filesize is not known and the browser just keeps on downloading. Is there any way to achieve this? The following stackoverflow thread did not offer any good advise. http://stackoverflow.com/questions/873995/asp-net-downloading-large-files-of-unknown-size Thanks

    Read the article

  • What happens when ToArray() is called on IEnumerable ?

    - by Sir Psycho
    I'm having trouble understanding what happens when a ToArray() is called on an IEnumerable. I've always assumed that only the references are copied. I would expect the output here to be: true true But instead I get true false What is going on here? class One { public bool Foo { get; set; } } class Two { public bool Foo { get; set; } } void Main() { var collection1 = new[] { new One(), new One() }; IEnumerable<Two> stuff = Convert(collection1); var firstOne = stuff.First(); firstOne.Foo = true; Console.WriteLine (firstOne.Foo); var array = stuff.ToArray(); Console.WriteLine (array[0].Foo); } IEnumerable<Two> Convert(IEnumerable<One> col1) { return from c in col1 select new Two() { Foo = c.Foo }; }

    Read the article

  • Using Int32 or what you need

    - by Sir Psycho
    Should you use Int32 in places where you know the value is not going to be higher than 32,767? I'd like to keep memory down, hoever, using casts everywhere just to perform simple arithmetic is getting annoying. short a = 1; short result = a + 1; // Error short result = (short)(a + 1); // works but looks ugly when does lots of times What would be better for overall application performance?

    Read the article

  • Separating data from the UI code with Linq to SQL entities

    - by Sir Psycho
    If it's important to keep data access 'away' from business and presentation layers, what alternatives or approaches can I take so that my LINQ to SQL entities can stay in the data access layer? So far I seem to be simply duplicating the classes produced by sqlmetal, and passing those object around instead simply to keep the two layers appart. For example, I have a table in my DB called Books. If a user is creating a new book via the UI, the Book class generated by sqlmetal seems like a perfect fit although I'm tightly coupling my design by doing so.

    Read the article

  • ASP.NET jQuery Ajax posting forms

    - by Sir Psycho
    Hi, I can't seem to get the jQuery.ajax() function posting back any of my asp.net generated form controls. I've put a break point on the server side and there aren't any values. Is there a way around this or do I have to build up a list of what I want sent back? Another question slightly off topic, but it seems that although jQuery is a great JS library, it doesn't seem to integrate too well with .net. Has anyone given up with jQuery to perform server side interaction and just gone with ms ajax implementation?

    Read the article

  • Need a scenario where would fail Array.ConstrainedCopy()

    - by Sir Psycho
    Hi, Just playing around with some of the APIs in .NET and I can't seem to find a way to cause Array.ConstrainedCopy() fail. According to MSDN, it's treated as an atomic operation. If it fails during the copy, the entire call fails resulting in no elements being copied as opposed to its Array.Copy() counterpart. Can someone demonstrate this or tell me how to do this?

    Read the article

  • WPF Applications &ndash; Handling the Unhandled

    - by David Totzke
    Instead of just letting your application crash, you can attach a method to the DispatcherUnhandledExceptionEventHandler and one to the AppDomain.Current.UnhandledException.  You wire these up in the code behind of your application which by default is App.xaml.cs.  You can log these errors or throw up a message Don Box and tell the user what happened.  Then you shut down the app gracefully.  You shut it down because something bad happened that you weren’t expecting and at this point there is no guarantee as to the state of the stack or memory or anything really.  All bets are off. If, on the other hand, the method for the UnhandledException is empty and the method for the DispatcherUnhandledEventHandler ends up in a call to a method called LogError() and the LogError() method is FUCKING EMPTY, and you just swallow the exceptions and keep on running, then, not so much.  I spent nearly a day trying to track down a bug that would have been obvious had something been logged or if it just crashed.  It’s my own fault I suppose.  I knew these were hooked up.  I just never suspected that there wouldn’t be any implementation at all.  Live and learn. Customs Man at Heathrow: Anything to declare, Sir? Jekyll and Hyde: Man has not evolved an inch from the slime that spawned him. Customs Man at Heathrow: Very Good, Sir. I tend to agree. Dave Just because I can…

    Read the article

  • wireless is disabled by hardware lenovo 3000g430

    - by sudheer
    sir i have problem with my wifi switch sir please tell me solution for my problem (wifi is disabled by hardware). output of sudo lshw -C network is sudo] password for sudheer: *-network DISABLED description: Wireless interface product: BCM4312 802.11b/g LP-PHY vendor: Broadcom Corporation physical id: 0 bus info: pci@0000:06:00.0 logical name: eth2 version: 01 serial: 00:21:00:72:3a:93 width: 64 bits clock: 33MHz capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless configuration: broadcast=yes driver=wl0 driverversion=5.100.82.38 latency=0 multicast=yes wireless=IEEE 802.11bg resources: irq:19 memory:f4700000-f4703fff *-network description: Ethernet interface product: NetLink BCM5906M Fast Ethernet PCI Express vendor: Broadcom Corporation physical id: 0 bus info: pci@0000:07:00.0 logical name: eth0 version: 02 serial: 00:1e:68:ad:24:0b size: 100Mbit/s capacity: 100Mbit/s width: 64 bits clock: 33MHz capabilities: pm vpd msi pciexpress bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd autonegotiation configuration: autonegotiation=on broadcast=yes driver=tg3 driverversion=3.121 duplex=full firmware=sb v3.04 ip=172.16.52.79 latency=0 link=yes multicast=yes port=twisted pair speed=100Mbit/s resources: irq:47 memory:f4600000-f460ffff output of iwconfig is lo no wireless extensions. eth2 IEEE 802.11 Access Point: Not-Associated Link Quality:5 Signal level:0 Noise level:0 Rx invalid nwid:0 invalid crypt:0 invalid misc:0 eth0 no wireless extensions. sudheer@sudheer:~$ sudo iwlistscanning sudo: iwlistscanning: command not found ***sudheer@sudheer:~$ sudo iwlist scanning*** lo Interface doesn't support scanning. eth2 Failed to read scan data : Invalid argument eth0 Interface doesn't support scanning.

    Read the article

  • WCF SSL secure transfer or large payloads without changing firewall.

    - by Sir Mix
    I need to transfer small amounts of data intermittently from clients to our server in a secure fashion and pull down large binary files from the server ocassionally. It's important for all this to be reliable. I'm anticipating 100,000 clients. I control both ends, but I want to deliver a solution that doesn't require changing the firewall for the majority of customers. A lag of one or two minutes before the information migrates to the server or comes down seems to be acceptable at this time. We need to make the connection secure, so was thinking about SSL, but open to suggestions. Basically, what is the best binding to use in this situation so that we have a secure transmission and the system handles the stress and load in a way that works for 95% of clients out of the box (firewalls will not block in majority of firewall configurations).

    Read the article

  • php parsing xml result from ipb ssi tool

    - by Sir Troll
    Last week my code was running fine and now (without changing anything) it is no longer able to parse the elements out of the XML. The response from the ssi tool: <?xml version="1.0" encoding="ISO-8859-1"?> <ipbsource><topic id="32"> <title>Test topic</title> <lastposter id="1">Drake</lastposter> <starter id="18">Drake</starter> <forum id="3">Updates</forum> <date timestamp="1345600720">22 August 2012 - 03:58 AM</date> </topic> </ipbsource> enter code here Update: Switched to SimpleXML but I can't extract data from the xml: $xml = file_get_contents('http://site.com/forum/ssi.php?a=out&f=2&show=10&type=xml'); $xml = new SimpleXMLElement($xml); $item_array = array(); var_dump($xml); foreach($xml->topic as $el) { var_dump($el); echo 'Title: ' . $el->title; } The var_dump output: object(SimpleXMLElement)#1 (1) { [0]=> string(1) " " }

    Read the article

  • Java WebApp: Loading resource from .jar located in WEB-INF

    - by shaman.sir
    There are a lot of similar questions, but, probably, mine is a little bit different: What is the right way to load resource from inside of .jar file located in WEB-INF/lib folder (if I know the jar file name and the name of the class it resource belongs to), while Web Application is running? Should I use getServletContext().getResourceAsStream(?) for this purpose or the <name-of-known-class>.getResourseAsStream(?), and what path do I need to specify there? So, the structure is: /WEB-INF /classes /some/package/name ?.class #some Java code or Servlet that tries to read 'required-file.xml' /lib /<jar-with-known-name>.jar /another/package/with/known/name SomeKnownClass.class required-file.xml

    Read the article

  • How much more productive are three monitors than two?

    - by Sir Graystar
    I am mulling over whether to buy a new monitor, to go along side my current setup of two 24 (ish) inch monitors. What I want to know is whether this is worth the money (probably around £200)? I think most of us will agree that two monitors is much more productive than one when programming and developing (Jeff Atwood has said this many times on his blog, and I imagine that most of you are fans of his), but is three much more productive than two? What I'm worried about is that I will have so much space that one monitor will be used for things that are not related to the task (music, facebook etc.) and it will actually make me less productive.

    Read the article

  • Hotkeys no longer work in Visual C# 2010 Express

    - by Sir Graystar
    Suddenly none of hotkeys in C# Express work (like F5, F6 etc.). I don't know what I've done, but no doubt its something stupid. Does anyone know how to fixed this? I have tried the Keyboard settings in Options, but it won;t even let me add hotkeys for some reason, even once I've removed the old ones. So re-adding them does not work.

    Read the article

  • ELMAH: Only sending specific exception type via mail

    - by Sir Code-A-Lot
    Hi, I have ELMAH set up for a webapp, logging exceptions to a SQL server. I wish to have ELMAH send me an email too, but only when a specific exception is thrown (ie. MySpecialException). ELMAH must still log all exceptions to SQL server. I know you can do it programmatically in global.asax, but I'd prefer to use web.config. So, how do I restrict ELMAH error mails to filter out everything but a specific exception type, using web.config?

    Read the article

  • C# ASP.NET update SQL database with values from text boxes

    - by Sir Graystar
    Here's what I have. User enters values into text boxes (personal information etc.) and then presses a save changes button. The values in these text boxes get stored in an SQL database. The problem I have is that when updating the database using the values from the text boxes, the page refreshes and the values in the text boxes are lost (or rather they return to the values that are already in the database as the data from the database is loaded into the text boxes on Page_Load). When I update the database using valuse stored in variables it all works fine. What is the best way to update with the values from the text boxes?

    Read the article

  • GWT: What is the way to handle Click on GWT FlowPanel

    - by shaman.sir
    May be a dumb question, but GWT FlowPanel (raw div element) does not provides something to handle a mouseclick/mousemovement on it. Overriding onBrowserEvent do not works either. If setting onclick event using native JavaScript (need to specify positive height before, 'div' have a height of 0 if not specified), then catching these events is working properly. Is there a way to do it without using JSNI?

    Read the article

  • C# ASP.NET Update database with datatable

    - by Sir Graystar
    Scenario: I'm just trying to update my database with the changes made by the user to their information. Here is my code: SqlCommandBuilder cb = new SqlCommandBuilder(da); dt.Rows[0][2] = txtname.Text; dt.Rows[0][3] = txtinterests.Text; dt.Rows[0][4] = txtlocation.Text; da.SelectCommand = new SqlCommand(sqlcommand, conn); da.Update(dt); I know its going to be something obvious, but what have I missed? There are no errors, everything compiles correctly, but nothing happens. The record remains unchanged.

    Read the article

  • How to use email adresses with special chars such as Ø

    - by Sir Code-A-Lot
    By writing this: var recipient = new MailAddress("name@abcø.dk"); Notice the "ø" in the domain part. I get an exception stating: System.FormatException: The specified string is not in the form required for an e-mail address. at System.Net.Mime.MailBnfHelper.ReadMailAddress(String data, Int32& offset, String& displayName) at System.Net.Mail.MailAddress.ParseValue(String address) at System.Net.Mail.MailAddress..ctor(String address, String displayName, Encoding displayNameEncoding) at System.Net.Mail.MailAddress..ctor(String address) The address used should be perfectly valid. So I'm guessing I have to encode the address somehow?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8  | Next Page >