Daily Archives

Articles indexed Tuesday March 23 2010

Page 18/130 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • MVC2 Binding isn't working for Html.DropDownListFor<>

    - by devlife
    I'm trying to use the Html.DropDownListFor< HtmlHelper and am having a little trouble binding on post. The HTML renders properly but I never get a "selected" value when submitting. <%= Html.DropDownListFor( m => m.TimeZones, Model.TimeZones, new { @class = "SecureDropDown", name = "SelectedTimeZone" } ) %> [Bind(Exclude = "TimeZones")] public class SettingsViewModel : ProfileBaseModel { public IEnumerable TimeZones { get; set; } public string TimeZone { get; set; } public SettingsViewModel() { TimeZones = GetTimeZones(); TimeZone = string.Empty; } private static IEnumerable GetTimeZones() { var timeZones = TimeZoneInfo.GetSystemTimeZones().ToList(); return timeZones.Select( t = new SelectListItem { Text = t.DisplayName, Value = t.Id } ); } } I've tried a few different things and am sure I am doing something stupid... just not sure what it is :)

    Read the article

  • How can i use a C# dll in a Win32 C++ project ?

    - by Agito
    I am working on a solution, most of its core engine is developed as Win32 C++ (and is Platform independent and is also used on OS X), some time ago we needed to call C++ dll's of core engine from C# and I was able to Load main solution's DLL in C# (by the help of some threads here on SO). but now we have certain things implemented in Managed C# dll and need to use it in Win32 C++ project? (and just function definitions and dll are provided)

    Read the article

  • Is there a way to automatically make a makefile from a template toolkit template?

    - by Smack my batch up
    My static web pages are built from a huge bunch of templates which are inter-included using Template Toolkit's "import" and "include", so page.html looks like this: [% INCLUDE top %] [% IMPORT middle %] Then top might have even more files included. I have very many of these files, and they have to be run through to create the web pages in various languages (English, French, etc., not computer languages). This is a very complicated process and when one file is updated I would like to be able to automatically remake only the necessary files, using a makefile or something similar. Are there any tools which can parse template toolkit templates and create a dependency list for use in a makefile? Or are there better ways to automate this process?

    Read the article

  • Excel MAXIF function or emulation?

    - by Andre Boos
    I have a moderately sized dataset in Excel from which I wish to extract the maximum value of the values in Column B, but those that correspond only to cells in Column A that satisfy certain criteria. The desired functionality is similar to that of SUMIF or COUNTIF, but neither of those return data that is necessary. There isn't a MAXIF function, so I ask the SO community: how do I emulate one?

    Read the article

  • A Reusable Builder Class for .NET testing

    - by Liam McLennan
    When writing tests, other than end-to-end integration tests, we often need to construct test data objects. Of course this can be done using the class’s constructor and manually configuring the object, but to get many objects into a valid state soon becomes a large percentage of the testing effort. After many years of painstakingly creating builders for each of my domain objects I have finally become lazy enough to bother to write a generic, reusable builder class for .NET. To use it you instantiate a instance of the builder and configuring it with a builder method for each class you wish it to be able to build. The builder method should require no parameters and should return a new instance of the type in a default, valid state. In other words the builder method should be a Func<TypeToBeBuilt>. The best way to make this clear is with an example. In my application I have the following domain classes that I want to be able to use in my tests: public class Person { public string Name { get; set; } public int Age { get; set; } public bool IsAndroid { get; set; } } public class Building { public string Street { get; set; } public Person Manager { get; set; } } The builder for this domain is created like so: build = new Builder(); build.Configure(new Dictionary<Type, Func<object>> { {typeof(Building), () => new Building {Street = "Queen St", Manager = build.A<Person>()}}, {typeof(Person), () => new Person {Name = "Eugene", Age = 21}} }); Note how Building depends on Person, even though the person builder method is not defined yet. Now in a test I can retrieve a valid object from the builder: var person = build.A<Person>(); If I need a class in a customised state I can supply an Action<TypeToBeBuilt> to mutate the object post construction: var person = build.A<Person>(p => p.Age = 99); The power and efficiency of this approach becomes apparent when your tests require larger and more complex objects than Person and Building. When I get some time I intend to implement the same functionality in Javascript and Ruby. Here is the full source of the Builder class: public class Builder { private Dictionary<Type, Func<object>> defaults; public void Configure(Dictionary<Type, Func<object>> defaults) { this.defaults = defaults; } public T A<T>() { if (!defaults.ContainsKey(typeof(T))) throw new ArgumentException("No object of type " + typeof(T).Name + " has been configured with the builder."); T o = (T)defaults[typeof(T)](); return o; } public T A<T>(Action<T> customisation) { T o = A<T>(); customisation(o); return o; } }

    Read the article

  • IBM Bladecentre H Bootup Sequence Control

    - by Spence
    I have a bladecentre with blades, network and a SAN in a single rack. What I'd like to do is control the startup of the bladecentre so that when the rack is powered on that the blades will delay their bootup until the SAN is powered on correctly. Is this even possible? We have an AMM in the chassis if that helps. Basically we are looking into the reboot that occurs after power is restored to a UPS. I sincerely apologise for the noobness of this question, but I am a software guy trying to help :)

    Read the article

  • can I make Excel always open a delimited text file with "text" translation?

    - by khedron
    Hi there, Opening a tab-delimited data file in Excel to view & manipulate the data is a very common operation around here. However, by default Excel (2003/4 or 2007/8) will read the columns in a "General" format, which occasionally does terrible things like turning "1/2" into "2-Jan". Is there a way to tell Excel never to do this, but always process the values as Text, without going through the format wizard, selecting all of the columns, and doing it manually? Extra points if this works in both Mac and Windows versions of Excel.

    Read the article

  • Changing PerformancePoint Time Intelligence Post Formula Default Value

    - by Gabriel Guimarães
    Is there a way to change the default value of the Time Intelligence Post Formula?? I have a Dashboard where I use From Date and To Date filters, to calculate the values between the user selected period, for those filters I use the Time Intelligence Post Formula,however the default when the user enters the page is always today's date on both filters. (and from today to today analysis doesn't make sense for this) What I would like to to is have a From Date be something like 30 days before today's date, but not forced on the report receiving the filters, I just want the filter to have a default value and then let the user choose whatever he wants. Anybody knows of something that can be done, or this just can't be done?

    Read the article

  • How to make python_select work for '$>python' command?

    - by Jim
    I installed a couple of pythons in different versions with macports, and the apple python 2.6 is also working. Now I need to run a program which requires MySQLdb package support in python, and this package was installed to the python I installed by macports. The program tells me that there is no MySQLdb installed, so I guess it is the apple python working for that program. I searched for some help and found python_select for switching between pythons. However after the command $>sudo python_select python25 told me that it selected the version "python25" for python, when I type $>python it is still apple python 2.6 that launches. The question is that how can I make python25(the one with MySQLdb) work for the program rather than apple python? Another important thing, the program is NOT a .py file and needs to be compiled before running. So do I need to re-install this program? My Mac OS version is Snow Leopard 10.6. Any answer is appreciated.

    Read the article

  • mysql database that can be accessed over a vpn?

    - by user225269
    I have 2 computers. Both with w7 as os. I have installed wampserver on one of them. I have mysql database on wampserver. Then I have made a vb.net program to connect to mysql database. I have put the program on both computers. What I want to do is for those two programs to see the same database that is on one computer. For them to be able to add, delete, update that 1 database. How do I do that? How do I network the mysql database? Do I also have to install wampserver on the other computer? What do I do? Please enlighten me.

    Read the article

  • thumbs.db messing up my upload routine

    - by Scott B
    I'm getting the following error while uploading a zip archive. Warning: ZipArchive::extractTo(C:\xampplite\htdocs\testsite/wp-content/themes/mytheme//styles\mytheme/Thumbs.db) [ziparchive.extractto]: failed to open stream: Permission denied in C:\xampplite\htdocs\testsite\wp-content\themes\mythem\uploader.php on line 17 The thing I can't quite figure is that I don't see a thumbs.db file in either the zip archive or the destination folder that was created (the upload still processes, I just get these errors). The function is below, line 17 is commented... function openZip($file_to_open) { global $target; $zip = new ZipArchive(); $x = $zip->open($file_to_open); if($x === true) { $zip->extractTo($target); //this is line 17 $zip->close(); unlink($file_to_open); } else { die("There was a problem. Please try again!"); } }

    Read the article

  • Why does `intval(1990)` equal `1989`?

    - by George Edison
    Boy, this one is really weird. I expect the following code to print 1990, but it prints 1989! $val = '$19.9'; $val = preg_replace('/[^\d.]/','',$val); $val = intval($val * 100); echo $val; Why on earth is this happening? Edit: and this code: $val = '$19.9'; $val = preg_replace('/[^\d.]/','',$val); echo $val . "<br>"; $val = $val * 100; echo $val . "<br>"; $val = intval($val); echo $val; Prints: 19.9 1990 1989 Why does intval(1990) equal 1989???

    Read the article

  • windows.location.href not working on Firefox3

    - by julio.g
    We have a javascript funtion named "move" which does just "windows.location.href = any given anchor". This function works on IE, Opera and Safari, but somehow is ignored in Firefox. Researching on Google doesn't produce a satisfactory answer why it doesn't work. Does any javascript guru knows about this behavior, and what would be the best practice to jump to an anchor via javascript?

    Read the article

  • Wamp server that works over a network

    - by user28233
    I have 2 computers. Both with w7 as os. I have installed wampserver on one of them. I have mysql database on wampserver. Then I have made a vb.net program to connect to mysql database. I have put the program on both computers. What I want to do is for those two programs to see the same database that is on one computer. For them to be able to add, delete, update that 1 database. How do I do that? How do I network the mysql database? Do I also have to install wampserver on the other computer? What do I do? Please enlighten me.

    Read the article

  • How can I calculate power consumption of my PC in Watt?

    - by Jitendra vyas
    How can I calculate power consumption of my PC in Watt, to prove my House owner ( I live on rent) , my PC doesn't consume much power? He blames me for Huge power bills even he too use Fridge, A.C. etc and his son watch the TV all the time. We both share one Power meter so for bill we pay 50%-50% but He is saying I use PC all the time even night i keep on for downloading. I just want to calculate power consumption of my PC then will calculate monthly expense of unit as per my City's per unit price for power. I've Windows: Microsoft Windows XP Professional 5.1.2600 Service Pack 3 Memory (RAM): 960 MB CPU Info: AMD Sempron(tm) Processor 2500+ CPU Speed: 1399.0 MHz Sound card: Vinyl AC'97 Audio (WAVE) Display Adapters: VIA/S3G UniChrome Pro IGP | NetMeeting driver | RDPDD Chained DD Monitors: 1 - 17inch LCD - LG Screen Resolution: 1280 X 768 - 32 bit Network: Network Present Network Adapters: Bluetooth Device (Personal Area Network) #2 | WAN (PPP/SLIP) Interface CD / DVD Drives: I: ELBY CLONEDRIVE COM Ports: COM1 | COM2 | COM7 | COM8 | COM9 | COM10 LPT Ports: LPT1 Mouse: 3 Button Wheel Mouse Present Hard Disks: C: 29.3GB | D: 29.3GB | E: 97.7GB | F: 97.7GB | G: 211.9GB USB Controllers: 5 host controllers. Firewire (1394): 1 host controllers. Manufacturer: Phoenix Technologies, LTD Product Make: MS-7142 AC Power Status: OnLine BIOS Info: AT/AT COMPATIBLE | 01/18/06 | VIAK8M - 42302e31 Motherboard: MICRO-STAR INTERNATIONAL CO., LTD MS-7142 Modem: ZTE USB Modem FFFE CDMA #2

    Read the article

  • What is Covariance and Contravariance

    - by xyz
    Please explain me in simple terms (if possible simple example) the covariance and contravariance in c# .net . I know many are available(even in stackoverflow) but my problem is in which scenario I should use that is not explained in the articles that I am refering to. e.g. Covariance and Contravariance in Delegates (C# Programming Guide) Thanks

    Read the article

  • How to recognize the touch of a non regular sprite image ?

    - by srikanth rongali
    I have a sprite and if it is touched the touch should be recognized. I used the coordinates to do so. I took the coordinates (min x, min y, max x , max y)of the sprite image. But The sprite image is not a rectangular shape. So, even if I touch the coordinates outside the sprite and inside the rectangular bounds the sprite is recognized. But for my application I need only the sprite to be recognized. So, I have to take only the coordinates of the sprite, but it is not regular shape. I am using CCSprite in my program. So, what can I do to for only the sprite to be selected ? Which classes should use for this? Thank You.

    Read the article

  • onmouseover with django / imagekit

    - by Michael Moreno
    I'm using Imagekit. View.py includes: def pics(request): p = Photo.objects.all() return render_to_response('Shots.html', {'p': p}) The following simple code in the template will generate associated images: {% for p in p %} <img src = "{{ p.display.url }}"> <img src = "{{ p.thumbnail_image.url }}"> {% endfor %} I'm attempting to generate a series of thumbnails {{ p.thumbnail_image.url }} which, when mouseover'd, will generate the slightly larger version of the image, {{ p.display.url }} via Javascript. The following code in the template attempts to do so: <html> <head> <HEAD> <script language="Javascript"> { image1 = new Image image2 = new Image image1.src = {{ p.thumbnail_image.url }} image2.src = {{ p.display.url }} </script> </head> <body> {% for p in p %} <a href="" onMouseOver="document.rollover.src= image2.src onMouseOut="document.rollover.src= image1.src"> <img src="{{ p.thumbnail_image.url }}" border=0 name="rollover"></a> {% endfor %} </body> </html> This will display the series of thumbnails, but the larger image will not display when mouseover'd. I believe it has to do with how I'm specifying the variable {{ p.display.url }}.

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >