Search Results

Search found 1375 results on 55 pages for 'martin hansen'.

Page 30/55 | < Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >

  • How to access generic property without knowing the closed generic type

    - by Martin Booka Weser
    I have a generic Type as follows public class TestGeneric<T> { public T Data { get; set; } public TestGeneric(T data) { this.Data = data; } } If i have now an object (which is coming from some external source) from which i know that it's type is of some closed TestGeneric<, but i don't know the TypeParameter T. Now I need to access the Data of my object. Problem is that i can't cast the object, since i don't know exactly to which closed TestGeneric. I use // thx to http://stackoverflow.com/questions/457676/c-reflection-check-if-a-class-is-derived-from-a-generic-class private static bool IsSubclassOfRawGeneric(Type rawGeneric, Type subclass) { while (subclass != typeof(object)) { var cur = subclass.IsGenericType ? subclass.GetGenericTypeDefinition() : subclass; if (rawGeneric == cur) { return true; } subclass = subclass.BaseType; } return false; } to make sure, my object is of the generic type. The code in question is as follows: public static void Main() { object myObject = new TestGeneric<string>("test"); // or from another source if (IsSubclassOfRawGeneric(typeof(TestGeneric<>), myObject.GetType())) { // the following gives an InvalidCastException // var data = ((TestGeneric<object>)myObject).Data; // if i try to access the property with reflection // i get an InvalidOperationException var dataProperty = typeof(TestGeneric<>).GetProperty("Data"); object data = dataProperty.GetValue(myObject, new object[] { }); } } I need the Data regardless of its type (well, if i could ask for its type using GetType() would be fine, but not necessary) since i just want to dump it in xml using ToString(). Any suggestions? Thanx.

    Read the article

  • using checkbox yo update MySql table

    - by Martin
    Hi All I have been searching round the internet for days on this matter but I keep coming up against a brick wall. What I have is a table full of checkboxes inside an admin area acting as a monthly "to-do" list. It's essentially a worksheet of 30 or so things to do each month that must be checked off each month and notes added if applicable. I have managed to get the checkboxes to update via mysql and be shown somewhere as a list of ticks. I simply did this my setting the value to 1 and on submission it updates the sql table. I have to cover my bases here and also offer the option to un-tick items if they have been ticked b y mistake. But I cant figure out how this is done. Below is my checking code... any help on this matter would be great. <?php $currentTask = ''; echo "<tr class='tr'>"; while ($seolistRow = mysql_fetch_array($seolistRes)) { $taskValue = $seolistRow["taskValue"]; $worksheetID = $seolistRow["worksheetID"]; $taskName = $seolistRow["taskName"]; $taskInfo = $seolistRow["taskInfo"]; if ($taskValue == 1) { $taskDone = "<input type='checkbox' value='1' class='checkbox' name='checkbox".$worksheetID."' id=checkbox'".$worksheetID."' checked='checked' /><div class='taskinfo'>".$taskInfo."</div>"; } else { $taskDone = "<input type='checkbox' value='0' class='checkbox' name='checkbox".$worksheetID."' id='checkbox".$worksheetID."' />"; } if ($currentTask != $taskName) { echo "</tr>"; echo "<tr class='tr'>"; echo "<td class='task'>".$taskName."</td>"; } echo "<td class='tick'>".$taskDone."</td>"; $currentTask = $taskName; } echo "</tr>"; ?>

    Read the article

  • how do i call an overloaded action in .net mvc?

    - by Jeff Martin
    I have an overloaded action in my Controller: public ActionResult AssignList(int id) { ... } [AcceptVerbs((HttpVerbs.Get))] public ActionResult AssignList(int id, bool altList) { ... } I'd like to use the same partial view for both lists but it will potentially have a differently filtered list of Images. I am trying to call it from another view using RenderAction: <% Html.RenderAction("AssignList", "Image", new { id = Model.PotholeId, altList = true }); %> However I am getting the following error: The current request for action 'AssignList' on controller type 'ImageController' is ambiguous between the following action methods: System.Web.Mvc.ActionResult AssignList(Int32) on type UsiWeb.Controllers.ImageController System.Web.Mvc.ActionResult AssignList(Int32, Boolean) on type UsiWeb.Controllers.ImageController How can I call the specific overload?

    Read the article

  • oAuth provider with Django-piston

    - by Martin Eve
    Hi, I'm working with django-piston to attempt to create an API that supports oAuth. I started out using the tutorial at: http://blog.carduner.net/2010/01/26/django-piston-and-oauth/ I added a consumer to piston's admin interface with key and secret both set to "abcd" for test purposes. The urls are successfully wired-up and the oAuth provider is called. However, running my get request token tests with tripit (python get_request_token.py "http://127.0.0.1:8000/api" abcd abcd), I receive the following error: Invalid signature. Expected signature base string: GET&http%3A%2F%2F127.0.0.1%3A8000%2Fapi%2Foauth%2Frequest_token%2F&oauth_consumer_key%3Dabcd%26oauth_nonce%3D0c0bdded5b1afb8eddf94f7ccc672658%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1275135410%26oauth_version%3D1.0 The problem seems to lie inside the _check_signature method of Piston's oauth.py, where valid_sig = signature_method.check_signature(oauth_request, consumer, token, signature) is returning false. I can't, however, work out how to get the signature validated. Any ideas?

    Read the article

  • Linq2sql code generator misbehaving

    - by Martin
    Sometime the linq2sql just makes its mind up about things. I've been pulling my hair for the past hours trying to work out what I'm doing differently from all the other times when I don't get ForeignKeyReferenceAlreadyHasValueException. Turns out that if (this._Activity.HasLoadedOrAssignedValue) { throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); } is present on my primary key in this particular table, and in no other. No matter what I do with the association, I've even tried deleting and dragging the thing back to the designer, it's still there and I'm sure it's not supposed to be. I know why, of course, but I don't know why, so to speak. A while back the association went the other way. Whereas I've left that era behind me, the code generator seems to exhibit phantom pains. The same phenomenon, is responsible for me having to change the namespace in the designer.cs everytime I make changes in the designer. I made the mistake of renaming my namespace and the code generator just doesn't get it. Somebody please help this poor boy out.

    Read the article

  • Using Office 2010 web apps with ASP.NET

    - by Martin de Ruiter
    Would it be possible to use the Office 2010 web apps with an ASP.NET application? For example: - For each user of my ASP.NET application there is a folder with Word documents on my server - The ASP.NET application displays the available documents in a grid to the user - When clicking on one of the documents in the grid, the Word document is loaded in an IFrame which contains the Office 2010 web apps Word interface and editing of the document can take place - After editing, the document can be saved to the server, and the ASP.NET grid displays an updated status Would such a scenario be possible? And what do you need, e.g. Sharepoint, Office 2010 licenses?

    Read the article

  • Pitfalls and practical Use-Cases: Toplink, Hibernate, Eclipse Link, Ibatis ...

    - by Martin K.
    I worked a lot with Hibernate as my JPA implementation. In most cases it works fine! But I have also seen a lot of pitfalls: Remoting with persisted Objects is difficult, because Hibernate replaces the Java collections with its own collection implementation. So the every client must have the Hibernate .jar libraries. You have to take care on LazyLoading exceptions etc. One way to get around this problem is the use of webservices. Dirty checking is done against the Database without any lock. "Delayed SQL", causes that the data access isn't ACID compliant. (Lost data...) Implict Updates So we don't know if an object is modified or not (commit causes updates). Are there similar issues with Toplink, Eclipse Link and Ibatis? When should I use them? Have they a similar performance? Are there reasons to choose Eclipse Link/Toplink... over Hibernate?

    Read the article

  • Alternatives to Google Earth for sat image

    - by Martin Beckett
    I've been asked to add Google Earth images to a desktop app (civil engineering modelling app) I was under the impression that Google's license didn't allow you to do this. Are there any other easily accessible, and similarly high resolution, image sources anyone can recommend (Blue Marble, terraserver) ? As a bonus, any library that lets me use coordinates in a range of local map datums and convert them to Lat/Long without me having to incorporate the whole of CGAL?

    Read the article

  • Can I build this XPath query dynamically in XSLT?

    - by Martin Doms
    I have a document that looks something like <root> <element> <subelement1 /> <subelement2 /> </element> <element> <subelement2 /> <subelement1 /> </element> </root> In my XSLT sheet in the context of /element[2]/[someNode] I want to get a number that represents the distance of /element[1]/[someNode] (ie, the number of preceding siblings of /element1/[someNode]). For example, in the context of /element[2]/subelement1 I'd like to have some way to get the number 2, the distance from /element[1] to /element[1]/subelement2. I only ever need the distance of the given node name from the first instance of . Intuitively I thought I could construct this like <xsl:variable name="nodename" select="name()" /> <xsl:value-of select="/element[1]/$nodename/preceding-sibling::*" /> but unfortunately this sheet doesn't compile. Is what I'm trying to achieve possible in XSLT?

    Read the article

  • MIPS Assembler Instruction parameters

    - by Martin K.
    Hi, why does such a instruction as mul $t1, $v0 , 4 evaluates as expected. But mul $t1, 4 , $v0 results in a syntax error! I wonder why the first one works, because mul only works with registers per default, so I expect that only a solution like this will be workin li $t1, 4 # set $t1 = 4 mul $t1, $v0 , $t1 # set $t1 = 4 * n I'm using the SPIM simulator.

    Read the article

  • Convert an array of bytes into one decimal number as a string

    - by Martin Kirsche
    I'm trying to write function that converts an arbitrary large array of bytes (larger than 64-bit) into a decimal number represented as string in c# and I simply can't figure out how to do it. For example the following code ... Console.WriteLine(ConvertToString( new byte[] { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00 })); .. should print out 22774453838368691933757882222884355840 I don't want to just use an extra library like biginteger for that, because I want it to be simple and like to understand how it works.

    Read the article

  • IntelliJ: Adding resources to the class path, but still gives me "java.util.MissingResourceException: Can't find bundle.... locale en_US"

    - by Martin
    I am quite new to intellij and i have loaded in a project that i wish to compile, everything seems to be going well, but when i compile it. I get the bundle cannot be found. java.util.MissingResourceException: Can't find bundle for base name openfire_i18n, locale en_US at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1499) After doing some investigation, it appears i have to include the resources in the class path, is this correct? I have done Project Settings, Modules, Dependencies, and i added a "Jars or directories" There is a checkbox that says Export, i have tried clicking it and unclicking it :-) My resources i can see are in i8n\ResourceBundle I tried adding the i8n and it asked me for a category for selected files, i put classes RUN - but still same error.. so i tried adding the i8n/ResourceBundle directory RUN - still same error. I notice under my ResourceBundle directory there are C:\Dev\Java\openfire_src_3_7_1\openfire_src\src\i18n\openfire_i18n_en.properties but there is no specific en_US but i thought it supposed to fallback to EN ?? SO i think everything is ok. Can anyone help I am really stuck Thanks

    Read the article

  • Windows Phone - OnNavigatingFrom - problem

    - by Martin Anderson
    I believe this is just a problem for me, due to my lack of programming ability. I am currently exploring transitions between page navigation with Windows Phone apps. I was originally using storyboards, and completed event handlers to have my pages animate on and off screen. These leads to the a problem when you want to navigate to many pages from one page, using the same transition. So I have started looking at OnNavigatedTo, and OnNavigatingFrom events and while it is working nicely for OnNavigatedTo, the later just wont work. It seems the Microsoft.Phone.Navigation assembly does not contain OnNavigatingFrom, and referencing System.Windows.Navigation, compiles ok, but I cant get pages to animate off upon navigation. I have a button on my Page2, which I want to go back to my MainPage (after I over-rided the back key with a message box for testing). I have transitions made on the page, and I have this as the event handler code... private void btnP2_BackToP1Clicked(object sender, System.Windows.RoutedEventArgs e) { NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative)); } With this code for the OnNavigatedTo and OnNavigatingFrom events... protected override void OnNavigatedTo(PhoneNavigationEventArgs e) { PageTransition_In.Begin(); } // // protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) { PageTransition_Out.Begin(); base.OnNavigatingFrom(e); } I have the feeling that OnNavigatingFrom may not(yet) be supported for Windows Phone Apps. OnNavigatedFrom is part of Microsoft.Phone.Navigation, but it only performs actions once the page is no longer active, which is too late to perform any animation effects.

    Read the article

  • How to set AeDebug to get a minidump with the name of the process ?

    - by JC Martin
    I have to perform some post mortem debugging on a C++ project. Known way to perform is to set the cdb debugger as a minidump generator and to process the dumps collects afterwards. I read nearly the whole web and I didn't find a solution to produce a minidump with the name of the process that has crashed Is there a way to set AeDebug\Debugger registry variable in such a manner that cdb generates a dump file with the name of the process ? When I encapsulate the call to cdb.exe in a batch file, it starts well but stays blocked on the symbol searching. I must perform a Ctrl+C in order to stop the batch, then the minidump, with the correct process name, is created... but of course I can't set up such a thing in an unattended production environment... Has anybody done that before ?

    Read the article

  • Show different sub-sets in edit view

    - by Martin R-L
    In the context of C# 4, ASP.NET MVC 2, and NHibernate; I've got the following scenario: Let's assume an entity Product that have an association to ProductType. In a product edit view; how do I implement that only a sub-set of the product's properties are shown in an elegant and DRY way? Use a product view model builder, and from different view models automagically generate the view with my own Html.EditorForModel() (including drop-downs and other stuff not out-of-the-box)? Attribute the properties of one view model and use the Html.EditorForModel() way aforementioned? Use one model, but implement different web controls (view strategies) (can it be done DRY?)? Something else entirely?

    Read the article

  • Add inner-marging to a 4 columns CSS

    - by Martín Marconcini
    I am not a CSS expert (mainly because I haven’t had the need to use much HTML/CSS stuff lately), so I came up with the following style/divs to create a 4 column layout: <style type="text/css"> <!-- .columns:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } * html .columns {height: 1%;} .columns{ display:inline-block; } .columns{ display:block; } .columns .column{ float:left; overflow:hidden; display:inline; } .columns .last{ float:right; } .col4 .first{ left: auto;width:25%; } .col4 .second{ left: auto;width:25%; } .col4 .third{ left: auto;width:25%; } .col4 .last{ left: auto;width:25%; } --> </style> note: most of this stuff comes from this google result, I just adapted it to 4 columns. The HTML then looks like this: <div class="columns col4"> <div class="column first”> SOME TEXT </div><!-- /.first -—> <div class="column second”> MORE TEXT</div><!—- /.second -—> <div class="column third”> SOME MORE TEXT </div><!—- /.third --> <div class="column last”> SOME LAST TEXT </div><!-- /.last -—> </div><!-- /.columns --> Ok, I’ve simplified that a bit (there’s a small image and some < h2 text in there too) but the thing is that I’d like to add some space between the columns. Here’s how it looks now: Do you have any idea what CSS property should I touch? note: If I add margin or padding, one column shifts down because (as I understand it) it doesn’t fit. There might be other CSSs as well, since this came in a template (I have been asked for this change, but I didn’t do any of this, as usual). Thanks for any insight.

    Read the article

  • Installing via Windows Server 2008 Remote Desktop

    - by Martin Pronk
    I’m trying to install Visual Studio 2008 Team Test Load Agent on a server with Windows 2008 Datacenter edition SP2 via remote desktop. After the installation program have restarted the server and tries to continue the installation, I get a command prompt with the following error: C:\Windows\system32>change user /INSTALL Install mode does not apply to a Terminal server configured for remote administration. C:\Windows\system32>"C:\Users\ADMINI~1\AppData\Local\Temp\setup.exe" /TempCopy How do I install programs via Remote Desktop if I’m not allowed to use “change user /INSTALL”? PS: This is a onetime installation.

    Read the article

  • How can I test this SQL Server performance Utility?

    - by Martin Smith
    As part of my MSc I need to do a three month project later this year. I have decided to do something which will likely be useful for me in the workplace and spend the time getting to understand SQL Server internals. The deliverable for this project will be a performance advisor looking at a variety of different rules. Some static such as finding redundant indexes, some more dynamic such as using XEvents to find outlying invocations of stored procedure execution times when certain parameters are passed. I am struggling to come up with a good way of testing this though. I can obviously design a "bad" database and a synthetic workload that my tool will pick up issues on but I also need to demonstrate that it has real world utility. Looking at the self tuning database literature it is common to use TPC benchmarks but I've had a look at the TPCC site and it looks very time consuming to implement and not that good a fit to my project's testing needs in any event (I would still be able to "rig" it by the decisions I made on indexing or physical architecture). Plan A would be to find willing beta tester(s) but in the event that isn't possible I will need a fallback plan. The best idea I have come up with so far is to use the various MS sample applications as examples of real world applications. e.g. http://msftdpprodsamples.codeplex.com/ http://www.asp.net/community/projects/ Does anyone have any better suggestions?

    Read the article

  • How do you test the usability of your user interfaces

    - by Martin
    How do you test the usability of the user interfaces of your applications - be they web or desktop? Do you just throw it all together and then tweak it based on user experience once the application is live? Or do you pass it to a specific usability team for testing prior to release? We are a small software house, but I am interested in the best practices of how to measure usability. Any help appreciated.

    Read the article

  • Strange MSI error when setup.exe is run

    - by Martin Jackson
    We're using Visual Studio 2008's Setup Project to create an installer for our .NET 3.5 app. We host the .exe and .msi files on a website for our client to access, and produce new ones regularly to provide updates. This has all been fine until recently we've noticed some cases where installing via the .exe fails. The symptoms are: The .exe downloads fine, and runs fine. It appears to download the .msi successfully (the "downloading application files" step plods through happily), but then when it gets to the end of the "preparing to install" step, instead of launching the installer UI it pops up a message saying "This installation package could not be opened. Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer package". You'd think that the .msi is just corrupt or something, but running it explicitly (even downloading it from the same location as the .exe to do so) works just fine. This problem is occurring on just some of our machines, which are running a mixture of XP and Windows7. The only pattern I can see in those machines that experience the problem is that they tend to have had the application installed on them longer (i.e. updating the app rather than installing for the first time). It seems to me that it might be something to do with how/where the .exe downloads the .msi to, and perhaps different versions are conflicting there? Has anyone experienced this before? Does anyone know where the installer .exe puts the .msi that it downloads?

    Read the article

  • Full-text search on App Engine with Whoosh

    - by Martin
    I need to do full text searching with Google App Engine. I found the project Whoosh and it works really well, as long as I use the App Engine Development Environement... When I upload my application to App Engine, I am getting the following TraceBack. For my tests, I am using the example application provided in this project. Any idea of what I am doing wrong? <type 'exceptions.ImportError'>: cannot import name loads Traceback (most recent call last): File "/base/data/home/apps/myapp/1.334374478538362709/hello.py", line 6, in <module> from whoosh import store File "/base/data/home/apps/myapp/1.334374478538362709/whoosh/__init__.py", line 17, in <module> from whoosh.index import open_dir, create_in File "/base/data/home/apps/myapp/1.334374478538362709/whoosh/index.py", line 31, in <module> from whoosh import fields, store File "/base/data/home/apps/myapp/1.334374478538362709/whoosh/store.py", line 27, in <module> from whoosh import tables File "/base/data/home/apps/myapp/1.334374478538362709/whoosh/tables.py", line 43, in <module> from marshal import loads Here is the import I have in my Python file. # Whoosh ---------------------------------------------------------------------- sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'utils'))) from whoosh.fields import Schema, STORED, ID, KEYWORD, TEXT from whoosh.index import getdatastoreindex from whoosh.qparser import QueryParser, MultifieldParser Thank you in advance for your help!

    Read the article

  • Python thread pool similar to the multiprocessing Pool?

    - by Martin
    Is there a Pool class for worker threads, similar to the multiprocessing module's Pool class? I like for example the easy way to parallelize a map function def long_running_func(p): c_func_no_gil(p) p = multiprocessing.Pool(4) xs = p.map(long_running_func, range(100)) however I would like to do it without the overhead of creating new processes. I know about the GIL. However, in my usecase, the function will be an IO-bound C function for which the python wrapper will release the GIL before the actual function call. Do I have to write my own threading pool?

    Read the article

  • Should tests be self written in TDD?

    - by martin
    We run a project, which we want to solve with test driven development. I thought about some questions that came up, when initiating the project. One question was, who should write the unit-test for a feature. Should the unit-test be written by the feature-implementing programmer? Or should the unit test be written by another programmer, who defines what a method should do and the feature-implementing programmer implements the method until the tests runs? If i understand the concept of TDD in the right way. The feature-implementing programmer has to write the test by himself, because TDD is procedure with mini-iterations. So it would be too complex to have the tests written by another programmer? What would you say, should the tests in TDD written by the programmer himself or should another programmer write the tests that describes what a method can do?

    Read the article

  • postgresql table for storing automation test results

    - by Martin
    I am building an automation test suite which is running on multiple machines, all reporting their status to a postgresql database. We will run a number of automated tests for which we will store the following information: test ID (a GUID) test name test description status (running, done, waiting to be run) progress (%) start time of test end time of test test result latest screenshot of the running test (updated every 30 seconds) The number of tests isn't huge (say a few thousands) and each machine (say, 50 of them) have a service which checks the database and figures out if it's time to start a new automated test on that machine. How should I organize my SQL table to store all the information? Is a single table with a column per attribute the way to go? If in the future I need to add attributes but want to keep compatibility with old database format (ie I may not want to delete and create a new table with more columns), how should I proceed? Should the new attributes just be in a different table? I'm also thinking of replicating the database. In case of failure, I don't mind if the latest screenshots aren't backed up on the slave database. Should I just store the screenshots in its own table to simplify the replication? Thanks!

    Read the article

< Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >