Search Results

Search found 120 results on 5 pages for 'kristoffer s hansen'.

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

  • Order by null/not null with ICriteria

    - by Kristoffer
    I'd like to sort my result like this: First I want all rows/objects where a column/property is not null, then all where the colmn/property is null. Then I want to sort by another column/property. How can I do this with ICriteria? Do I have to create my own Order class, or can it be done with existing code? ICriteria criteria = Session.CreateCriteria<MyClass>() .AddOrder(Order.Desc("NullableProperty")) // What do I do here? IProjection? Custom Order class? .AddOrder(Order.Asc("OtherProperty"));

    Read the article

  • Why is xslt converter ignoring the content of <link>-tag

    - by Kristoffer Nolgren
    When I put forexample this in my xslt-stylesheet: <link><xsl:text>test</xsl:text></link> Or this: <link>test</link> I get the following result: <link xmlns=""></link> This however: <linkb>test</linkb> Render the following result: <linkb xmlns="">test</linkb> The rest of the xslt does not seem to make any difference, i've tried it in several different and empty xslt-stylesheets This problem appears in backend conversion (php) aswell as frontend-konversion in chrome browser (but not in Firefox) Example of error: dev.resihop.nu (right above the footer)

    Read the article

  • Ordered many-to-many relationship in NHibernate

    - by Kristoffer
    Let's say I have two classes: Item and ItemCollection, where ItemCollection contains an ordered list of Item objects with an index, i.e. the list is ordered in a way specified by the user. Let's also say that they have a many-to-many relationship, an ItemCollection can contain many items and an Item can belong to several ItemCollections. That would, in my head, require three tables in the database. One for Item, one for ItemCollection and one for the ordered mapping. The mapping table would contain three columns: int ItemID int ItemCollectionID int ListIndex QUESTION: How would you design the ItemCollection class? Should the list of Item objects be a list, dictionary or other? What would the NHibernate mapping look like to get the ListIndex into the picture?

    Read the article

  • How do I retrieve a list of base class objects without joins using NHibernate ICriteria?

    - by Kristoffer
    Let's say I have a base class called Pet and two subclasses Cat and Dog that inherit Pet. I simply map these to three tables Pet, Cat and Dog, where the Pet table contains the base class properties and the Cat and Dog tables contain a foreign key to the Pet table and any additional properties specific to a cat or dog. A joined subclass strategy. Now, using NHibernate and ICriteria, how can I get a list of "pure" Pet objects (not cats or dogs, just pets), without making any joins to the other tables?

    Read the article

  • cakephp: Custom Authentication Object authenticate not called

    - by Kristoffer Darj
    The method authenticate in a Custom Authentication Object is never called. Is this a glicth or am I missing something? I don't get anything in the log, I'm just redirected to users/login (or the one I specified) CakeVersion: 2.4.1 <?php //My custom Auth Class //Path: app/Controller/Component/Auth/HashAuthenticate.php App::uses('BaseAuthenticate', 'Controller/Component/Auth'); class HashAuthenticate extends BaseAuthenticate { public function authenticate(CakeRequest $request, CakeResponse $response) { //Seems to not be called CakeLog::write('authenticate'); debug($this); die('gaah'); } } If I add the method getUser() (or unauthenticated() ), those gets called however so at least I know that cake finds the class and so on. It just skips the authenticate-method. The AppController looks like this class AppController extends Controller { public $helpers = array('Html', 'Form', 'Session'); public $components = array('Auth' => array( 'authenticate' => array('Hash'), 'authorize' => array('Controller'), ) ); } I found a similar question here: CakePHP 2.x custom "Authentication adapter &quot;LdapAuthorize&quot; was not found but there the issue was typos.

    Read the article

  • UpdateModel prefix - ASP.NET MVC

    - by Kristoffer Ahl
    I'm having trouble with TryUpdateModel(). My form fields are named with a prefix but I am using - as my separator and not the default dot. <input type="text" id="Record-Title" name="Record-Title" /> When I try to update the model it does not get updated. If i change the name attribute to Record.Title it works perfectly but that is not what I want to do. bool success = TryUpdateModel(record, "Record"); Is it possible to use a custom separator?

    Read the article

  • C# DLL reference changes version and becomes unloadable (Plugin-system)

    - by Kristoffer
    I will try to keep this as simple as possible. I have a rather simple plugin system that has run into a problem. I have 2 assemblies: Host.exe Plugin.dll Plugin.dll references Host.exe (which contains interfaces and classes that Plugin.dll implement and use). At runtime, Host.exe loads Plugin.dll through reflection and this works great. Except when Host.exe updates and gets a new version number. Then I get an error once I try to load Plugin.dll, saying that Host.exe (with the old version number) can't be found. This means I have to rebuild all plugins every time Host.exe changes build number. Anyone got a solution to this?

    Read the article

  • Dynamic Array traversal in PHP

    - by Kristoffer Bohmann
    I want to build a hierarchy from a one-dimensional array and can (almost) do so with a more or less hardcoded code. How can I make the code dynamic? Perhaps with while(isset($array[$key])) { ... }? Or, with an extra function? Like this: $out = my_extra_traverse_function($array,$key); function array_traverse($array,$key=NULL) { $out = (string) $key; $out = $array[$key] . "/" . $out; $key = $array[$key]; $out = $array[$key] ? $array[$key] . "/" . $out : ""; $key = $array[$key]; $out = $array[$key] ? $array[$key] . "/" . $out : ""; $key = $array[$key]; $out = $array[$key] ? $array[$key] . "/" . $out : ""; return $out; } $a = Array(102=>101, 103=>102, 105=>107, 109=>105, 111=>109, 104=>111); echo array_traverse($a,104); Output: 107/105/109/111/104

    Read the article

  • Custom SQL function for NHibernate dialect

    - by Kristoffer Ahl
    I want to be able to call a custom function called "recent_date" as part of my HQL. Like this: [Date] >= recent_date() I created a new dialect, inheriting from MsSql2000Dialect and specified the dialect for my configuration. public class NordicMsSql2000Dialect : MsSql2000Dialect { public NordicMsSql2000Dialect() { RegisterFunction( "recent_date", new SQLFunctionTemplate( NHibernateUtil.Date, "dateadd(day, -15, getdate())" ) ); } } var configuration = Fluently.Configure() .Database( MsSqlConfiguration.MsSql2000 .ConnectionString(c => .... ) .Cache(c => c.UseQueryCache().ProviderClass<HashtableCacheProvider>()) .Dialect<NordicMsSql2000Dialect>() ) .Mappings(m => ....) .BuildConfiguration(); When calling recent_date() I get the following error: System.Data.SqlClient.SqlException: 'recent_date' is not a recognized function name I'm using it in a where statement for a HasMany-mapping like below. HasMany(x => x.RecentValues) .Access.CamelCaseField(Prefix.Underscore) .Cascade.SaveUpdate() .Where("Date >= recent_date()"); What am I missing here?

    Read the article

  • Fluent many-to-many: Deleting one end does not remove the entry in the relation table

    - by Kristoffer
    I have two classes (Parent, Child) that have a many-to-many relationship that only one end (Parent) knows about. My problem is that when I delete a "relation unaware" object (Child), the record in the many-to-many table is left. I want the relationship to be removed regardless of which end of it is deleted. How can I do that with Fluent NHibernate mappings, without adding a Parent property on Child? The classes: public class Parent { public Guid Id { get; set; } public IList<Child> Children { get; set; } } public class Child { public Guid Id { get; set; } // Don't want the property below: // public Parent Parent { get; set; } }

    Read the article

  • Is it possible to run javascript with other target?

    - by Kristoffer Nolgren
    I have a facebook app that I authenticate using a general-purpose authentification. Like this: // Fixar oAuth jso_configure({ "facebook": { client_id: "393963983989013", redirect_uri: "http://resihop.herokuapp.com/", authorization: "https://www.facebook.com/dialog/oauth", presenttoken: "qs" } }); // Make sure that you have jso_ensureTokens({ "facebook": [""] }); // This dumps all cached tokens to console, for easyer debugging. //jso_dump(); jso_ensureTokens({ "facebook": [""] }); It's tirggered on document.ready. Because it's a facebook app I can't run the authentification in the iFrame. Facebook denies this using X-Frame-Options. The solution, if you authenticate with a link is to use target="_top". How do i Achieve the same effect in javascript? Maybe I need to edit one of the funcitons (though ideally not, as they are part of a library) in that case please point me in the right direction.

    Read the article

  • MetadataType and client validation in ASP.NET MVC 2

    - by Kristoffer Ahl
    Inherited properties and MetadataType does not seem to work with client side validation in ASP.NET MVC 2. The validation of our MetadataTypes work as expected on the server but for some reason it does not generate the appropriate client scripts for it. Client side validation kicks in as expected for properties with the DataAnnotations attributes set on the PersonView so I know that client side validation is active and that it works. Does anyone know if or how it can be fixed? Here's what we have: public abstract class PersonView { public string FirstName { get; set; } public string LastName { get; set; } public string Email { get; set; } [Required] public string PhoneNumber { get; set; } public string AddressLine1 { get; set; } public string AddressLine2 { get; set; } public string AddressZipCode { get; set; } public string AddressCity { get; set; } public string AddressCountry { get; set; } } [MetadataType(typeof(CustomerViewMetaData))] public class CustomerView : PersonView {} [MetadataType(typeof(GuestViewMetaData))] public class GuestView : PersonView {} public class GuestViewMetaData { [Required(ErrorMessage = "The guests firstname is required")] public string FirstName { get; set; } [Required(ErrorMessage = "The guests lastname is required")] public string LastName { get; set; } } public class CustomerViewMetaData { [Required(ErrorMessage = "The customers firstname is required")] public string FirstName { get; set; } [Required(ErrorMessage = "The customers lastname is required")] public string LastName { get; set; } [Required(ErrorMessage = "The customers emails is required")] public string Email { get; set; } } As you can see, it's nothing fancy or strange in there... Can it be fixed? Is it a bug in ASP.NET MVC 2?

    Read the article

  • Error when passing data between views

    - by Kristoffer Bilek
    I'm using a plist (array of dictionaries) to populate a tableview. Now, when a cell i pressed, I want to pass the reprecented dictionary to the detail view with a segue. It's working properly to fill the tableview, but how do I send the same value to the detail view? This is my try: #import "WinesViewController.h" #import "WineObject.h" #import "WineCell.h" #import "WinesDetailViewController.h" @interface WinesViewController () @end @implementation WinesViewController - (id)initWithStyle:(UITableViewStyle)style { self = [super initWithStyle:style]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [super viewDidLoad]; } - (void)viewDidUnload { [super viewDidUnload]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationPortrait); } #pragma mark - Table view data source - (void)viewWillAppear:(BOOL)animated { wine = [[WineObject alloc] initWithLibraryName:@"Wine"]; self.title = @"Vinene"; [self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES]; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the number of sections. return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. return [wine libraryCount]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"wineCell"; WineCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; // Configure the cell... cell.nameLabel.text = [[wine libraryItemAtIndex:indexPath.row] valueForKey:@"Name"]; cell.districtLabel.text = [[wine libraryItemAtIndex:indexPath.row] valueForKey:@"District"]; cell.countryLabel.text = [[wine libraryItemAtIndex:indexPath.row] valueForKey:@"Country"]; cell.bottleImageView.image = [UIImage imageNamed:[[wine libraryItemAtIndex:indexPath.row] valueForKey:@"Image"]]; cell.flagImageView.image = [UIImage imageNamed:[[wine libraryItemAtIndex:indexPath.row] valueForKey:@"Flag"]]; cell.fyldeImageView.image = [UIImage imageNamed:[[wine libraryItemAtIndex:indexPath.row] valueForKey:@"Fylde"]]; cell.friskhetImageView.image = [UIImage imageNamed:[[wine libraryItemAtIndex:indexPath.row] valueForKey:@"Friskhet"]]; cell.garvesyreImageView.image = [UIImage imageNamed:[[wine libraryItemAtIndex:indexPath.row] valueForKey:@"Garvesyre"]]; return cell; } #pragma mark - Table view delegate - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] isEqualToString:@"DetailSegue"]) { NSIndexPath *selectedRowIndex = [self.tableView indexPathForSelectedRow]; WinesDetailViewController *winesdetailViewController = [segue destinationViewController]; //Here comes the error line: winesdetailViewController.winedetailName = [wine objectAtIndex:indexPath.row] valueForKey:@"Name"]; } } I get one error for: winesdetailViewController.winedetailName = [wine objectAtIndex:indexPath.row] valueForKey:@"Name"]; Use of undeclaired identifier: indexPath. did you mean NSIndexPath? I think I've missed something important here..

    Read the article

  • $("body").scrollTop() doesn't update in safari

    - by Kristoffer Nolgren
    I'm working on a website: http://beta.projektopia.se/ the body has several background-images that are updated on scroll like this: $(document).ready(function(){ $(document).scroll(function(){ var scrollfactor=$("body").scrollTop()*0.2; var centerscrollpos =scrollfactor+613; var docheight = $(document).height(); var windowheight = $(window).height(); var bottompos = (docheight-980)-((docheight-windowheight)*0.2)+scrollfactor; var scrollpos = 'center '+scrollfactor+'px,center '+bottompos+'px, center '+ centerscrollpos+'px,center 0px'; $("body").css("background-position", scrollpos); }); }); Lots of calculations, but the important thing is that a scrollpos is created that should change the position of the background when you scroll, to create a parallax-effect. It works great in chrome, but in firefox, the variable scrollfactor, that is suppose to get the current scroll-position, doesn't update. ps, some people have this issue due to lack of correct doctype. I believe i have declared it correctly like this: <!DOCTYPE html>

    Read the article

  • Asynchronously get user data in facebook tab?

    - by Kristoffer Nolgren
    Using the php sdk, I check if a user inside a tab likes the corresponding page. If i put the following code inside index.php and use that page as my page-tab-url, <?php require_once("facebook/facebook.php"); // Create our application instance // (replace this with your appId and secret). $facebook = new Facebook(array( 'appId' => '1399475990283166', 'secret' => 'mysercret', 'cookie' => true )); $signed_request = $facebook->getSignedRequest(); echo $signed_request['page']['liked']; ?> it outputs '1'. I would like to achieve this asynchronously instead, so I put the php in a separate file and try to access it using ajax instead $http.post('/facebook/likes.php'). success(function(data){ console.log(data); }).error(function(data){ console.log(data); } ); This sample is using angular, but what javascript library i'm using probably doesn't matter. When I access the info with javascript Facebook doesn't seem to get the info that I liked the page. Adding a print_r($facebook); on the page I'm retreiving the same values as if i'm not in a facebook-tab: ( [sharedSessionID:protected] => [appId:protected] => 1399475990283166 [appSecret:protected] => 679fb0ab947c2b98e818f9240bc793da [user:protected] => [signedRequest:protected] => [state:protected] => [accessToken:protected] => [fileUploadSupport:protected] => [trustForwarded:protected] => ) Can I access theese values asynchronosly somehow?

    Read the article

  • C++ const-reference semantics?

    - by Kristoffer
    Consider the sample application below. It demonstrates what I would call a flawed class design. #include <iostream> using namespace std; struct B { B() : m_value(1) {} long m_value; }; struct A { const B& GetB() const { return m_B; } void Foo(const B &b) { // assert(this != &b); m_B.m_value += b.m_value; m_B.m_value += b.m_value; } protected: B m_B; }; int main(int argc, char* argv[]) { A a; cout << "Original value: " << a.GetB().m_value << endl; cout << "Expected value: 3" << endl; a.Foo(a.GetB()); cout << "Actual value: " << a.GetB().m_value << endl; return 0; } Output: Original value: 1 Expected value: 3 Actual value: 4 Obviously, the programmer is fooled by the constness of b. By mistake b points to this, which yields the undesired behavior. My question: What const-rules should you follow when designing getters/setters? My suggestion: Never return a reference to a member variable if it can be set by reference through a member function. Hence, either return by value or pass parameters by value. (Modern compilers will optimize away the extra copy anyway.)

    Read the article

  • Scrolling an HTML 5 page using JQuery

    - by nikolaosk
    In this post I will show you how to use JQuery to scroll through an HTML 5 page.I had to help a friend of mine to implement this functionality and I thought it would be a good idea to write a post.I will not use any JQuery scrollbar plugin,I will just use the very popular JQuery Library. Please download the library (minified version) from http://jquery.com/download.Please find here all my posts regarding JQuery.Also have a look at my posts regarding HTML 5.In order to be absolutely clear this is not (and could not be) a detailed tutorial on HTML 5. There are other great resources for that.Navigate to the excellent interactive tutorials of W3School.Another excellent resource is HTML 5 Doctor.Two very nice sites that show you what features and specifications are implemented by various browsers and their versions are http://caniuse.com/ and http://html5test.com/. At this times Chrome seems to support most of HTML 5 specifications.Another excellent way to find out if the browser supports HTML 5 and CSS 3 features is to use the Javascript lightweight library Modernizr.In this hands-on example I will be using Expression Web 4.0.This application is not a free application. You can use any HTML editor you like.You can use Visual Studio 2012 Express edition. You can download it here. Let me move on to the actual example.This is the sample HTML 5 page<!DOCTYPE html><html lang="en">  <head>    <title>Liverpool Legends</title>        <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >        <link rel="stylesheet" type="text/css" href="style.css">        <script type="text/javascript" src="jquery-1.8.2.min.js"> </script>     <script type="text/javascript" src="scroll.js">     </script>       </head>  <body>    <header>        <h1>Liverpool Legends</h1>    </header>        <div id="main">        <table>        <caption>Liverpool Players</caption>        <thead>            <tr>                <th>Name</th>                <th>Photo</th>                <th>Position</th>                <th>Age</th>                <th>Scroll</th>            </tr>        </thead>        <tfoot class="footnote">            <tr>                <td colspan="4">We will add more photos soon</td>            </tr>        </tfoot>    <tbody>        <tr class="maintop">        <td>Alan Hansen</td>            <td>            <figure>            <img src="images\Alan-hansen-large.jpg" alt="Alan Hansen">            <figcaption>The best Liverpool Defender <a href="http://en.wikipedia.org/wiki/Alan_Hansen">Alan Hansen</a></figcaption>            </figure>            </td>            <td>Defender</td>            <td>57</td>            <td class="top">Middle</td>        </tr>        <tr>        <td>Graeme Souness</td>            <td>            <figure>            <img src="images\graeme-souness-large.jpg" alt="Graeme Souness">            <figcaption>Souness was the captain of the successful Liverpool team of the early 1980s <a href="http://en.wikipedia.org/wiki/Graeme_Souness">Graeme Souness</a></figcaption>            </figure>            </td>            <td>MidFielder</td>            <td>59</td>        </tr>        <tr>        <td>Ian Rush</td>            <td>            <figure>            <img src="images\ian-rush-large.jpg" alt="Ian Rush">            <figcaption>The deadliest Liverpool Striker <a href="http://it.wikipedia.org/wiki/Ian_Rush">Ian Rush</a></figcaption>            </figure>            </td>            <td>Striker</td>            <td>51</td>        </tr>        <tr class="mainmiddle">        <td>John Barnes</td>            <td>            <figure>            <img src="images\john-barnes-large.jpg" alt="John Barnes">            <figcaption>The best Liverpool Defender <a href="http://en.wikipedia.org/wiki/John_Barnes_(footballer)">John Barnes</a></figcaption>            </figure>            </td>            <td>MidFielder</td>            <td>49</td>            <td class="middle">Bottom</td>        </tr>                <tr>        <td>Kenny Dalglish</td>            <td>            <figure>            <img src="images\kenny-dalglish-large.jpg" alt="Kenny Dalglish">            <figcaption>King Kenny <a href="http://en.wikipedia.org/wiki/Kenny_Dalglish">Kenny Dalglish</a></figcaption>            </figure>            </td>            <td>Midfielder</td>            <td>61</td>        </tr>        <tr>            <td>Michael Owen</td>            <td>            <figure>            <img src="images\michael-owen-large.jpg" alt="Michael Owen">            <figcaption>Michael was Liverpool's top goal scorer from 1997–2004 <a href="http://www.michaelowen.com/">Michael Owen</a></figcaption>            </figure>            </td>            <td>Striker</td>            <td>33</td>        </tr>        <tr>            <td>Robbie Fowler</td>            <td>            <figure>            <img src="images\robbie-fowler-large.jpg" alt="Robbie Fowler">            <figcaption>Fowler scored 183 goals in total for Liverpool <a href="http://en.wikipedia.org/wiki/Robbie_Fowler">Robbie Fowler</a></figcaption>            </figure>            </td>            <td>Striker</td>            <td>38</td>        </tr>        <tr class="mainbottom">            <td>Steven Gerrard</td>            <td>            <figure>            <img src="images\steven-gerrard-large.jpg" alt="Steven Gerrard">            <figcaption>Liverpool's captain <a href="http://en.wikipedia.org/wiki/Steven_Gerrard">Steven Gerrard</a></figcaption>            </figure>            </td>            <td>Midfielder</td>            <td>32</td>            <td class="bottom">Top</td>        </tr>    </tbody></table>          </div>            <footer>        <p>All Rights Reserved</p>      </footer>     </body>  </html>  The markup is very easy to follow and understand. You do not have to type all the code,simply copy and paste it.For those that you are not familiar with HTML 5, please take a closer look at the new tags/elements introduced with HTML 5.When I view the HTML 5 page with Firefox I see the following result. I have also an external stylesheet (style.css). body{background-color:#efefef;}h1{font-size:2.3em;}table { border-collapse: collapse;font-family: Futura, Arial, sans-serif; }caption { font-size: 1.2em; margin: 1em auto; }th, td {padding: .65em; }th, thead { background: #000; color: #fff; border: 1px solid #000; }tr:nth-child(odd) { background: #ccc; }tr:nth-child(even) { background: #404040; }td { border-right: 1px solid #777; }table { border: 1px solid #777;  }.top, .middle, .bottom {    cursor: pointer;    font-size: 22px;    font-weight: bold;    text-align: center;}.footnote{text-align:center;font-family:Tahoma;color:#EB7515;}a{color:#22577a;text-decoration:none;}     a:hover {color:#125949; text-decoration:none;}  footer{background-color:#505050;width:1150px;}These are just simple CSS Rules that style the various HTML 5 tags,classes. The jQuery code that makes it all possible resides inside the scroll.js file.Make sure you type everything correctly.$(document).ready(function() {                 $('.top').click(function(){                     $('html, body').animate({                         scrollTop: $(".mainmiddle").offset().top                     },4000 );                  });                 $('.middle').click(function(){                     $('html, body').animate({                         scrollTop: $(".mainbottom").offset().top                     },4000);                  });                     $('.bottom').click(function(){                     $('html, body').animate({                         scrollTop: $(".maintop").offset().top                     },4000);                  }); });  Let me explain what I am doing here.When I click on the Middle word (  $('.top').click(function(){ ) this relates to the top class that is clicked.Then we declare the elements that we want to participate in the scrolling. In this case is html,body ( $('html, body').animate).These elements will be part of the vertical scrolling.In the next line of code we simply move (navigate) to the element (class mainmiddle that is attached to a tr element.)      scrollTop: $(".mainmiddle").offset().top  Make sure you type all the code correctly and try it for yourself. I have tested this solution will all 4-5 major browsers.Hope it helps!!!

    Read the article

  • Programmatically examine DLL contents

    - by Peter Hansen
    Is it possible programmatically to discover the exported names (globals, entry points, whatever) in a Windows DLL file without implementing a parser for the binary executable file format itself? I know there are tools to do this (though no open source ones I've found), but I'm curious whether there is a Windows API to accomplish the same thing or whether such tools operate merely by examining the binary file directly. I suspect there is an API for .NET libraries: if that's the case then is there a similar one for native DLLs? Edit: http://stackoverflow.com/questions/1128150 is basically an exact duplicate. The answer there is roughly "there is no API, but you can hack it using LoadLibraryEx() and navigating a few resulting data structures". Edit: I was able to use the accepted answer at http://stackoverflow.com/questions/1128150 to create a quick DLL dumper with Python and ctypes that works.

    Read the article

  • WebClient on WP7 - Throw "A request with this method cannot have a request body"

    - by Peter Hansen
    If I execute this code in a Consoleapp it works fine: string uriString = "http://url.com/api/v1.0/d/" + Username + "/some?amount=3&offset=0"; WebClient wc = new WebClient(); wc.Headers["Content-Type"] = "application/json"; wc.Headers["Authorization"] = AuthString.Replace("\\", ""); string responseArrayKvitteringer = wc.DownloadString(uriString); Console.WriteLine(responseArrayKvitteringer); But if I move the code to my WP7 project like this: string uriString = "http://url.com/api/v1.0/d/" + Username + "/some?amount=3&offset=0"; WebClient wc = new WebClient(); wc.Headers["Content-Type"] = "application/json"; wc.Headers["Authorization"] = AuthString.Replace("\\", ""); wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted); wc.DownloadStringAsync(new Uri(uriString)); void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { MessageBox.Show(e.Result); } I got the exception: A request with this method cannot have a request body. Why? The solution is to remove the Content-type: string uriString = "http://url.com/api/v1.0/d/" + Username + "/some?amount=3&offset=0"; WebClient wc = new WebClient(); //wc.Headers["Content-Type"] = "application/json"; wc.Headers["Authorization"] = AuthString.Replace("\\", ""); wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted); wc.DownloadStringAsync(new Uri(uriString)); void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { MessageBox.Show(e.Result); }

    Read the article

  • LGPL and Dual Licensing Ajax Library

    - by Thomas Hansen
    Hi guys, I'm the previous founder of Gaiaware and Gaia Ajax Widgets and when I used to work there we had this rhetoric (which I have confirmed with some very smart FOSS people is correct) that when using a GPL Ajax library you're basically "distributing" the JavaScript which in turn makes the GPL viral clause kick in and forces people to purchase a proprietary license if they're going to build Closed Source stuff... So now I'm the the LGPL world here with Ra-Ajax which is an LGPL licensed library and I've got no intentions of creating a GPL licensed library since I believe strongly in that the LGPL is the "enabler" of the Open Web to prevail. But something interesting have happened which I think might still give me a "business model" here which is the Linking clause of the LGPL which I think goes something like this (pseudo); "If you link to an LGPL licensed thing you get no restrictions on your own derived works"... But so we started creating something we're calling Ajax Starter-Kits which effectively is a "Project Kickstarter" where you can download a finished project/solution which basically enables you to start out with some pre-done boiler plate code for problems such as Ajax DataGrids, Ajax Calendar Applications, Ajax TreeView Applications etc. And the funny thing is that our users would NOT "link" to these, they would effectively BE our users applications... So to wrap up my question. Would this force users of our LGPL licensed Ajax Starter-Kits to LGPL license their own work? Basically if it does we have a business model (and I get very happy) if not I'd just have to hope people would still like to pay us those $29 for our Starter-Kits to support the project... ;) Help rewarded with extreme gratitude...

    Read the article

  • Inheriting from ViewPage forces explicit casting of model in view

    - by Martin Hansen
    I try to inhering from ViewPage as shown in this question http://stackoverflow.com/questions/370500/inheriting-from-viewpage But I get a Compiler Error Message: CS1061: 'object' does not contain a definition for 'Spot' and no extension method 'Spot' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) My viewpage, normally I can do Model.ChildProperty(Spot) when I inherit from ViewPage directly, so I do that here too. But it fails. <%@ Page Language="C#" Inherits="Company.Site.ViewPageBase<WebSite.Models.SpotEntity>" %> <h1><%= Html.Encode(Model.Spot.Title) %></h1> To get it working correctly I have to do like this: <%@ Page Language="C#" Inherits="Company.Site.ViewPageBase<WebSite.Models.SpotEntity>" %> <h1><%= Html.Encode(((WebSite.Models.SpotEntity)Model).Spot.Title) %></h1> Here is my classes: namespace Company.Site { public class ViewPageBase<TModel> : Company.Site.ViewPageBase where TModel:class { private ViewDataDictionary<TModel> _viewData; [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public new ViewDataDictionary<TModel> ViewData { get { if (_viewData == null) { SetViewData(new ViewDataDictionary<TModel>()); } return _viewData; } set { SetViewData(value); } } protected override void SetViewData(ViewDataDictionary viewData) { _viewData = new ViewDataDictionary<TModel>(viewData); base.SetViewData(_viewData); } } public class ViewPageBase : System.Web.Mvc.ViewPage { } } So how do I get it to work without the explicit cast?

    Read the article

  • Getter/setter on javascript array?

    - by Martin Hansen
    Is there a way to get a get/set behaviour on an array? I imagine something like this: var arr = ['one', 'two', 'three']; var _arr = new Array(); for (var i=0; i < arr.length; i++) { arr[i].defineGetter('value', function(index) { //Do something return _arr[index]; }); arr[i].defineSetter('value', function(index, val) { //Do something _arr[index] = val; }); };

    Read the article

  • How to find a word within text using XSLT 2.0 and REGEX (which doesn't have \b word boundary)?

    - by Mads Hansen
    I am attempting to scan a string of words and look for the presence of a particular word(case insensitive) in an XSLT 2.0 stylesheet using REGEX. I have a list of words that I wish to iterate over and determine whether or not they exist within a given string. I want to match on a word anywhere within the given text, but I do not want to match within a word (i.e. A search for foo should not match on "food" and a search for bar should not match on "rebar"). XSLT 2.0 REGEX does not have a word boundary(\b), so I need to replicate it as best I can.

    Read the article

  • VB6 app not executing as scheduled task unless user is logged on

    - by Tedd Hansen
    Hi Would greatly apprechiate some help on this one! It may be a tricky one. :) Problem I have an VB6 application which is set up as scheduled task. It starts every time, but when executing CreateObject it fails if user is not logged on to computer. I am looking for information on what could cause this. Primary suspicion is that some Windows API fails. Key points Behaviour confirmed on Windows 2000, 2003, 2008 and Vista. The application executes as user X at scheduled time, executed by Windows Task Scheduler. It executes every time. Application does start! -- If user X is logged on via RDP it runs perfectly. (Note that user doesn't need to be connected, only logged on) -- If user X is not logged on to computer the application fails. Failure point Application fails when using CreateObject() to instansiate a DCOM object which is also part of the application. The DCOM objects declare .dll-references at startup (globally/on top of .bas-file) and run a small startup function. Failure must be during startup, possibly in one of the .dll-declarations. Thoughts After some Googling my initial suspicion was directed at MAPI. From what I could see MAPI required user to be logged on. The application has MAPI references. But even with all MAPI references removed it still does not work. What is the difference if an user is logged on? Registry mapping? Environment? explorer.exe is running. Isn't the user logged on when application executes as the user? What info would help? A definitive answer would be truly great. Any information regarding any VB6 feature/Windows API that could act differently depending on wether user is logged on or not would definitively help. Similar experiences may lead me in the right direction. Tips on debuggin this. Thanks! :)

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >