Daily Archives

Articles indexed Friday February 4 2011

Page 7/12 | < Previous Page | 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How to get the blocks seen by the player?

    - by m4tx
    I'm writing a Minecraft-like game using Ogre engine and I have a problem. I must optimize my game, because when I try draw 10000 blocks, I have 2 FPS... So, I got the idea that blocks display of the plane and to hide the invisible blocks. But I have a problem - how do I know which blocks at a time are visible to the player? And - if you know of other optimization methods for such a game, write what and how to use them in Ogre.

    Read the article

  • What should I read to improve my C++ style

    - by Victor Ronin
    I was developing for quite long time already on C/C++ (mostly C, which makes style poorer). So, I know how to use it. However, quite often I stuck with style decisions like: - should I return error code here, throw exceptions, return error through a parameter - should I have all this stuff in constructor or should I create separate init function for that. and so on. Any solutions WILL work. However, each of them has cons and pros, which I know and most importantly which I don't know. It would be very nice to read something regarding overall C++ development style, coding practices and so forth. What do you recommend?

    Read the article

  • Navigation Dropdown Text Color doesn't work in FF and IE

    - by Genadinik
    Hello, I was able to get the navigation dropdown to show the letters in a different color from the background (white in this case) in Chrome browser. But when I view the same page in IE or FF, the whole background is just all green. Here is an example of such a page: http://www.comehike.com/hikes/hikes_and_groups.php And here is the CSS code that makes the color show up white in Chrome navigation li li a {color:#white; text-decoration:none;} To see the difference, just mouse over the top right where it says "community" or "hikes" Thanks, Alex

    Read the article

  • Helping Kohana 3 ORM to speed up a little

    - by Luke
    I noticed that Kohana 3 ORM runs a "SHOW FULL COLUMNS" for each of my models when I start using them: SHOW FULL COLUMNS FROM `mytable` This query might take a few clock cycles to execute (in the Kohana profiler it's actually the slowest of all queries ran in my current app). Is there a way to help Kohana 3 ORM to speed up by disabling this behaviour and explicitly define the columns in my models instead?

    Read the article

  • Offset time for DST in one specific timezone using JavaScript

    - by Shannon
    I need to offset the time by an hour if it's currently DST in the Pacific Time Zone. How can I determine the current daylight savings status of the Pacific Time Zone, regardless of the user's local timezone? Here's what I have so far. "dst" in line 4 is just a placeholder for a function that would tell me if daylight savings time is active in that zone. function checkTime() { var d = new Date(); var hour = d.getUTCHours(); var offset = dst ? 7 : 8; // is pacific time currently in daylight savings? // is it currently 6 AM, 2 PM, or 10 PM? if (hour === ((6 + offset) % 24) || hour === ((14 + offset) % 24) || hour === ((22 + offset) % 24)) { // do stuff } } checkTime();

    Read the article

  • Replacing tags inside the parent tag using DOM PHP

    - by user585303
    Here is what I got: <div id="list"> <ol> <li>Ordered list 1</li> <li>Ordered list 2</li> <ul><li>Unordered list inside ol ul</li></ul> <ol><li>Ordered list inside ol ol</li></ol> <ol> <ul> <li>Unordered list</li> <ol><li>Ordered list inside ul</li></ol> <ul> <ol> <li>Ordered list 1</li> <ol><li>Ordered list inside ol ol</li></ol> <ol> </div> I need somehow replace LI tags only inside div id="list" - OL tags I need so that it replaces only LI tags only within the first OL tags and not UL or the once inside OL - OL tags I tried using preg_replace_callback but it only replaces all LI tags inside id="list" and from what i figured it will be over my head to limit replacement only with first ol tags and not the rest, so I been suggested to try out PHP DOM since it should be as easy as div id="list" - OL I would appreciate if someone got me started with the code, maybe with something as replacing all LI tags with in the first OL tag within the whole content.

    Read the article

  • Can't find mistake -- 'segmentation fault' - in C

    - by Mosh
    Hello all! I wrote this function but can't get on the problem that gives me 'segmentation fault' msg. Thank you for any help guys !! /*This function extract all header files in a *.c1 file*/ void includes_extractor(FILE *c1_fp, char *c1_file_name ,int c1_file_str_len ) { int i=0; FILE *c2_fp , *header_fp; char ch, *c2_file_name,header_name[80]; /* we can assume line length 80 chars MAX*/ char inc_name[]="include"; char inc_chk[INCLUDE_LEN+1]; /*INCLUDE_LEN is defined | +1 for null*/ /* making the c2 file name */ c2_file_name=(char *) malloc ((c1_file_str_len)*sizeof(char)); if (c2_file_name == NULL) { printf("Out of memory !\n"); exit(0); } strcpy(c2_file_name , c1_file_name); c2_file_name[c1_file_str_len-1] = '\0'; c2_file_name[c1_file_str_len-2] = '2'; /*Open source & destination files + ERR check */ if( !(c1_fp = fopen (c1_file_name,"r") ) ) { fprintf(stderr,"\ncannot open *.c1 file !\n"); exit(0); } if( !(c2_fp = fopen (c2_file_name,"w+") ) ) { fprintf(stderr,"\ncannot open *.c2 file !\n"); exit(0); } /*next code lines are copy char by char from c1 to c2, but if meet header file, copy its content */ ch=fgetc(c1_fp); while (!feof(c1_fp)) { i=0; /*zero i */ if (ch == '#') /*potential #include case*/ { fgets(inc_chk, INCLUDE_LEN+1, c1_fp); /*8 places for "include" + null*/ if(strcmp(inc_chk,inc_name)==0) /*case #include*/ { ch=fgetc(c1_fp); while(ch==' ') /* stop when head with a '<' or '"' */ { ch=fgetc(c1_fp); } /*while(2)*/ ch=fgetc(c1_fp); /*start read header file name*/ while((ch!='"') || (ch!='>')) /*until we get the end of header name*/ { header_name[i] = ch; i++; ch=fgetc(c1_fp); }/*while(3)*/ header_name[i]='\0'; /*close the header_name array*/ if( !(header_fp = fopen (header_name,"r") ) ) /*open *.h for read + ERR chk*/ { fprintf(stderr,"cannot open header file !\n"); exit(0); } while (!feof(header_fp)) /*copy header file content to *.c2 file*/ { ch=fgetc(header_fp); fputc(ch,c2_fp); }/*while(4)*/ fclose(header_fp); } }/*frst if*/ else { fputc(ch,c2_fp); } ch=fgetc(c1_fp); }/*while(1)*/ fclose(c1_fp); fclose(c2_fp); free (c2_file_name); }

    Read the article

  • Refresh a jQuery function

    - by Toro
    Is possible refresh a function every x seconds or refresh it on single event? I explain: I have a function that make pagination on my website, inside every div that are "pages" I have some pictures where I have added LightBox. Everything works nice on the first div (page) but when I change the page it doesnt' work anymore. I tried to fix in this way: $('.pagination a').click(function () { initShadow(); }); In this way it work on the pageLoad and on the first page that I change, than it stop again. So I need to fix this issue, everytime I change the "page" I would like it works fine. Is possible to refresh a function every x second or to refresh it everytime I click on the pagination buttons?

    Read the article

  • Spring 3, Java EE 6

    - by arg20
    I'm learning Java EE 6. I've seen how much progress it has achieved in this release of the umbrella specification. EJBs 3.1 are far easier and more lightweight than previous versions, and CDI is amazing. I'm not familiar with Spring, but I often read that it offered some neat features that the Java EE stack didn't. Yet I also read now that JEE has caught up, and can now fully compete with Spring. I know that choosing from both depends on many factors, but if we only focus on features, say the latest trends etc. Which one has the leading edge?. Can Spring 3 offer some assets The JAVA EE 6 stack can't? Also, what about Seam framework? From what I read it's like java ee 6 but with some additions?

    Read the article

  • Detect when mouse leaves my app

    - by user593747
    Hello I am creating an app in win32 that will display the x, y position(In screen coords) of the mouse whereever the mouse is (inside my app client/NC area & outside). I am at the stage where I want to detect when the mouse leaves my application completely. I have written a simple win32 app that should detect & notify myself when the mouse leaves my app, BUT its not working, I never receive the messages WM_MOUSELEAVE & WM_NCMOUSELEAVE. What do you think is wrong? Am I using the wrong win32 functions? // Track Mouse.cpp : Defines the entry point for the application. // #include "stdafx.h" #include <windows.h> #include <vector> #include <string> #include <cstdlib> static HINSTANCE gInstance; // Globals // enum MouseStatus { DEFAULT = 50001, LEFT_CLIENT, LEFT_NCLIENT }; static MouseStatus mouseState = DEFAULT; static COLORREF bkCol = RGB(0,255,255); // Functions List // BOOL TrackMouse( HWND hwnd ) { // Post: TRACKMOUSEEVENT mouseEvt; ZeroMemory( &mouseEvt, sizeof(TRACKMOUSEEVENT) ); mouseEvt.cbSize = sizeof(TRACKMOUSEEVENT); mouseEvt.dwFlags = TME_LEAVE | TME_NONCLIENT; //mouseEvt.dwHoverTime = HOVER_DEFAULT; mouseEvt.hwndTrack = hwnd; return TrackMouseEvent( &mouseEvt ); } LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_CREATE: { // Track mouse so I can be notified when it leaves my application (Client & NC areas) BOOL trackSuccess = TrackMouse( hwnd ); // Returns successful, so I correctly track the mouse if ( trackSuccess == 0 ) { MessageBoxW( hwnd, L"Failed to track mouse", L"Error", MB_OK|MB_ICONEXCLAMATION ); } else MessageBoxW( hwnd, L"Tracking mouse", L"Success", MB_OK|MB_ICONEXCLAMATION ); } break; case WM_MOUSELEAVE: { // I never receive this message // Detect when the mouse leaves the client area mouseState = LEFT_CLIENT; bkCol = RGB(50,50,50); InvalidateRect( hwnd, NULL, true ); } break; case WM_NCMOUSELEAVE : { // I never receive this message // If the mouse has left the client area & then leaves the NC area then I know // that the mouse has left my app if ( mouseState == LEFT_CLIENT ) { mouseState = LEFT_NCLIENT; BOOL trackSuccess = TrackMouse( hwnd ); if ( trackSuccess == 0 ) { bkCol = RGB(255,255,0); MessageBoxW( hwnd, L"On WM_NCMOUSELEAVE: Failed to track mouse", L"Error", MB_OK|MB_ICONEXCLAMATION ); } else MessageBoxW( hwnd, L"On WM_NCMOUSELEAVE: Tracking mouse", L"Success", MB_OK|MB_ICONEXCLAMATION ); InvalidateRect( hwnd, NULL, true ); } } break; case WM_ACTIVATE: case WM_MOUSEHOVER: { // The mouse is back in my app mouseState = DEFAULT; bkCol = RGB(0,255,255); InvalidateRect( hwnd, NULL, true ); } break; case WM_PAINT: { HDC hdc; PAINTSTRUCT ps; hdc = BeginPaint( hwnd, &ps ); SetBkColor( hdc, bkCol ); Rectangle( hdc, 10, 10, 200, 200 ); EndPaint( hwnd, &ps ); } break; case WM_CLOSE: DestroyWindow(hwnd); break; case WM_DESTROY: PostQuitMessage(0); break; default: break; } return DefWindowProc(hwnd, msg, wParam, lParam); } int WINAPI WinMain(HINSTANCE gInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { WNDCLASSEX wc; HWND hwnd; MSG Msg; wc.cbSize = sizeof(WNDCLASSEX); wc.style = 0; wc.lpfnWndProc = WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = gInstance; wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(DKGRAY_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = L"Custom Class"; wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION); // if registration of main class fails if(!RegisterClassEx(&wc)) { MessageBoxW(NULL, L"Window Registration Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK); return 0; } hwnd = CreateWindowEx( WS_EX_CLIENTEDGE, L"Custom Class", L"App Name", WS_CAPTION|WS_MINIMIZEBOX|WS_VISIBLE|WS_OVERLAPPED|WS_SYSMENU, CW_USEDEFAULT, CW_USEDEFAULT, 600, 500, NULL, NULL, gInstance, NULL); if(hwnd == NULL) { MessageBoxW(NULL, L"Window Creation Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK); return 0; } ShowWindow(hwnd, nCmdShow); UpdateWindow(hwnd); while(GetMessage(&Msg, NULL, 0, 0) > 0) { TranslateMessage(&Msg); DispatchMessage(&Msg); } return Msg.wParam; }

    Read the article

  • PostgreSQL: Why does this simple query not use the index?

    - by David
    I have a table t with a column c, which is an int and has a btree index on it. Why does the following query not utilize this index? explain select c from t group by c; The result I get is: HashAggregate (cost=1005817.55..1005817.71 rows=16 width=4) -> Seq Scan on t (cost=0.00..946059.84 rows=23903084 width=4) My understanding of indexes is limited, but I thought such queries were the purpose of indexes.

    Read the article

  • How to force Maven to download maven-metadata.xml from the central repository?

    - by Alceu Costa
    What I want to do is to force Maven to download the 'maven-metadata.xml' for each artifact that I have in my local repository. The default Maven behaviour is to download only metadata from remote repositories (see this question). Why I want to do that: Currently I have a remote repository running in a build machine. By remote repository I mean a directory located in the build machine that contains all dependencies that I need to build my Maven projects. Note that I'm not using a repository manager like Nexus, the repository is just a copy of a local repository that I have uploaded to my build machine. However, since my local repository did not contain the 'maven-metadata.xml' files, these metadata files are also missing in the build machine repository. If I could retrieve the metadata files from the central repository, then it would be possible to upload a working remote repository to my build machine.

    Read the article

  • Compilation hangs for a class with field double d = 2.2250738585072012e-308

    - by 01es
    I have come across an interesting situation. A coworker committed some changes, which would not compile on my machine neither from the IDE (Eclipse) nor from a command line (Maven). The problem manifested in the compilation process taking 100% CPU and only killing the process would help to stop it. After some analysis the cause of the problem was located and resolved. It turned out be a line "double d = 2.2250738585072012e-308" (without semicolon at the end) in one of the interfaces. The following snipped duplicates it. public class WeirdCompilationIssue { double d = 2.2250738585072012e-308 } Why would compiler hang? A language edge case?

    Read the article

  • NHibernate: How is identity Id updated when saving a transient instance?

    - by bretddog
    If I use session-per-transaction and call: session.SaveOrUpdate(entity) corrected: session.SaveOrUpdateCopy(entity) ..and entity is a transient instance with identity-Id=0. Shall the above line automatically update the Id of the entity, and make the instance persistent? Or should it do so on transaction.Commit? Or do I have to somehow code that explicitly? Obviously the Id of the database row (new, since transient) is autogenerated and saved as some number, but I'm talking about the actual parameter instance here. Which is the business logic instance. EDIT Mappings: public class StoreMap : ClassMap<Store> { public StoreMap() { Id(x => x.Id).GeneratedBy.Identity(); Map(x => x.Name); HasMany(x => x.Staff) // 1:m .Cascade.All(); HasManyToMany(x => x.Products) // m:m .Cascade.All() .Table("StoreProduct"); } } public class EmployeeMap : ClassMap<Employee> { public EmployeeMap() { Id(x => x.Id).GeneratedBy.Identity(); Map(x => x.FirstName); Map(x => x.LastName); References(x => x.Store); // m:1 } } public class ProductMap : ClassMap<Product> { public ProductMap() { Id(x => x.Id).GeneratedBy.Identity(); Map(x => x.Name).Length(20); Map(x => x.Price).CustomSqlType("decimal").Precision(9).Scale(2); HasManyToMany(x => x.StoresStockedIn) .Cascade.All() .Inverse() .Table("StoreProduct"); } } EDIT2 Class definitions: public class Store { public int Id { get; private set; } public string Name { get; set; } public IList<Product> Products { get; set; } public IList<Employee> Staff { get; set; } public Store() { Products = new List<Product>(); Staff = new List<Employee>(); } // AddProduct & AddEmployee is required. "NH needs you to set both sides before // it will save correctly" public void AddProduct(Product product) { product.StoresStockedIn.Add(this); Products.Add(product); } public void AddEmployee(Employee employee) { employee.Store = this; Staff.Add(employee); } } public class Employee { public int Id { get; private set; } public string FirstName { get; set; } public string LastName { get; set; } public Store Store { get; set; } } public class Product { public int Id { get; private set; } public string Name { get; set; } public decimal Price { get; set; } public IList<Store> StoresStockedIn { get; private set; } }

    Read the article

  • Pure HTML + JavaScript client side templating

    - by Dev er dev
    I want to have achieve something similar to Java Tiles framework using only client side technologies (no server side includes). I would like to have one page, eg layout.html which will contain layout definition. Content placeholder in that page would be empty #content div tag. I would like to have different content injected on that page based on url. Something like layout.html?content=main or layout.html?content=edit will display page with content replaced with main.html or edit.html. The goal is to avoid duplicating code, even for layout, and to compose pages without server-side templating. What approach would you suggest? EDIT: I don't need a full templating library, just a way to compose a pages, similar for what tiles do.

    Read the article

  • Can you use regular expressions in struts-config.xml?

    - by rquinn
    I'm trying to route these two url's to different Actions. We are using Struts 1.2: /abc-def/products /abc-def I tried putting this action first: <action path="/abc*/products" type="com.business.exampleAction"> <forward name="success" path="/go"/> </action> and then this one after: <action path="/abc*" type="com.business.differentExampleAction"> <forward name="success" path="/goElsewhere"/> </action> but it always goes to the second action (differentExampleAction in this case). I've tried various iterations for the , like . or (.*), but haven't found anything that actually works yet. From what I've read, it seems like the only regular-expression-like characters allowed in struts-config are the wildcard symbols (* and **), but I hope I am wrong.

    Read the article

  • How to display QuickContact card from widget

    - by alejom99
    I have a widget that displays the picture of some of my contacts and I would like to display the QuickContact card when the user taps on one of the pictures. I know I should be using the method ContactsContract.QuickContact.showQuickContact(), but it requires a View or a Rect as one of the input parameters. My problem is that Widgets only have RemoteViews, so I'm no sure what to pass as the View or Rect parameter. Any ideas would be appreciated.

    Read the article

  • Java List Sorting: Is there a way to keep a list permantly sorted automatically like TreeMap?

    - by david
    In Java you can build up an ArrayList with items and then call: Collections.sort(list, comparator); Is there anyway to pass in the Comparator at the time of List creation like you can do with TreeMap? The goal is to be able add an element to the list and instead of having it automatically appended to the end of the list, the list would keep itself sorted based on the Comparator and insert the new element at the index determined by the Comparator. So basically the list might have to re-sort upon every new element added. Is there anyway to achieve this in this way with the Comparator or by some other similar means? Thanks.

    Read the article

  • Package names - impl v internal

    - by Ben J
    In my time of digging around Java APIs I have come across both impl and internal packages. Up until now I never really thought about the difference - as with all enterprisey Java apps, I figured they just meant that "actual implementation in here; you (API user) should be really using the interface. Go away." A little bit of digging around Stack Overflow seems to suggest that the internal package at least can have some security placed around it. So, what is the difference? I don't think it is a matter of taste because I have seen APIs with both.

    Read the article

  • How to create selectable themes in your ASP.Net applications

    - by nikolaosk
    In this post I am going to show you something that we see in most websites. When we visit a website we are given the choice through a control to select the theme(colors,font size,font family) that we want to be applied to the site. In almost all asp.net web sites we define the look and feel of the site through Themes , skins , Master Pages and Stylesheets . I assume that you know a little bit about CSS,XHTML. I assume that you have little knowledge of web forms and master pages. Before you go on...(read more)

    Read the article

  • Authenticating clients in the new WCF Http stack

    - by cibrax
    About this time last year, I wrote a couple of posts about how to use the “Interceptors” from the REST starker kit for implementing several authentication mechanisms like “SAML”, “Basic Authentication” or “OAuth” in the WCF Web programming model. The things have changed a lot since then, and Glenn finally put on our hands a new version of the Web programming model that deserves some attention and I believe will help us a lot to build more Http oriented services in the .NET stack. What you can get today from wcf.codeplex.com is a preview with some cool features like Http Processors (which I already discussed here), a new and improved version of the HttpClient library, Dependency injection and better TDD support among others. However, the framework still does not support an standard way of doing client authentication on the services (This is something planned for the upcoming releases I believe). For that reason, moving the existing authentication interceptors to this new programming model was one of the things I did in the last few days. In order to make authentication simple and easy to extend,  I first came up with a model based on what I called “Authentication Interceptors”. An authentication interceptor maps to an existing Http authentication mechanism and implements the following interface, public interface IAuthenticationInterceptor{ string Scheme { get; } bool DoAuthentication(HttpRequestMessage request, HttpResponseMessage response, out IPrincipal principal);} An authentication interceptors basically needs to returns the http authentication schema that implements in the property “Scheme”, and implements the authentication mechanism in the method “DoAuthentication”. As you can see, this last method “DoAuthentication” only relies on the HttpRequestMessage and HttpResponseMessage classes, making the testing of this interceptor very simple (There is no need to do some black magic with the WCF context or messages). After this, I implemented a couple of interceptors for supporting basic authentication and brokered authentication with SAML (using WIF) in my services. The following code illustrates how the basic authentication interceptors looks like. public class BasicAuthenticationInterceptor : IAuthenticationInterceptor{ Func<UsernameAndPassword, bool> userValidation; string realm;  public BasicAuthenticationInterceptor(Func<UsernameAndPassword, bool> userValidation, string realm) { if (userValidation == null) throw new ArgumentNullException("userValidation");  if (string.IsNullOrEmpty(realm)) throw new ArgumentNullException("realm");  this.userValidation = userValidation; this.realm = realm; }  public string Scheme { get { return "Basic"; } }  public bool DoAuthentication(HttpRequestMessage request, HttpResponseMessage response, out IPrincipal principal) { string[] credentials = ExtractCredentials(request); if (credentials.Length == 0 || !AuthenticateUser(credentials[0], credentials[1])) { response.StatusCode = HttpStatusCode.Unauthorized; response.Content = new StringContent("Access denied"); response.Headers.WwwAuthenticate.Add(new AuthenticationHeaderValue("Basic", "realm=" + this.realm));  principal = null;  return false; } else { principal = new GenericPrincipal(new GenericIdentity(credentials[0]), new string[] {});  return true; } }  private string[] ExtractCredentials(HttpRequestMessage request) { if (request.Headers.Authorization != null && request.Headers.Authorization.Scheme.StartsWith("Basic")) { string encodedUserPass = request.Headers.Authorization.Parameter.Trim();  Encoding encoding = Encoding.GetEncoding("iso-8859-1"); string userPass = encoding.GetString(Convert.FromBase64String(encodedUserPass)); int separator = userPass.IndexOf(':');  string[] credentials = new string[2]; credentials[0] = userPass.Substring(0, separator); credentials[1] = userPass.Substring(separator + 1);  return credentials; }  return new string[] { }; }  private bool AuthenticateUser(string username, string password) { var usernameAndPassword = new UsernameAndPassword { Username = username, Password = password };  if (this.userValidation(usernameAndPassword)) { return true; }  return false; }} This interceptor receives in the constructor a callback in the form of a Func delegate for authenticating the user and the “realm”, which is required as part of the implementation. The rest is a general implementation of the basic authentication mechanism using standard http request and response messages. I also implemented another interceptor for authenticating a SAML token with WIF. public class SamlAuthenticationInterceptor : IAuthenticationInterceptor{ SecurityTokenHandlerCollection handlers = null;  public SamlAuthenticationInterceptor(SecurityTokenHandlerCollection handlers) { if (handlers == null) throw new ArgumentNullException("handlers");  this.handlers = handlers; }  public string Scheme { get { return "saml"; } }  public bool DoAuthentication(HttpRequestMessage request, HttpResponseMessage response, out IPrincipal principal) { SecurityToken token = ExtractCredentials(request);  if (token != null) { ClaimsIdentityCollection claims = handlers.ValidateToken(token);  principal = new ClaimsPrincipal(claims);  return true; } else { response.StatusCode = HttpStatusCode.Unauthorized; response.Content = new StringContent("Access denied");  principal = null;  return false; } }  private SecurityToken ExtractCredentials(HttpRequestMessage request) { if (request.Headers.Authorization != null && request.Headers.Authorization.Scheme == "saml") { XmlTextReader xmlReader = new XmlTextReader(new StringReader(request.Headers.Authorization.Parameter));  var col = SecurityTokenHandlerCollection.CreateDefaultSecurityTokenHandlerCollection(); SecurityToken token = col.ReadToken(xmlReader);  return token; }  return null; }}This implementation receives a “SecurityTokenHandlerCollection” instance as part of the constructor. This class is part of WIF, and basically represents a collection of token managers to know how to handle specific xml authentication tokens (SAML is one of them). I also created a set of extension methods for injecting these interceptors as part of a service route when the service is initialized. var basicAuthentication = new BasicAuthenticationInterceptor((u) => true, "ContactManager");var samlAuthentication = new SamlAuthenticationInterceptor(serviceConfiguration.SecurityTokenHandlers); // use MEF for providing instancesvar catalog = new AssemblyCatalog(typeof(Global).Assembly);var container = new CompositionContainer(catalog);var configuration = new ContactManagerConfiguration(container); RouteTable.Routes.AddServiceRoute<ContactResource>("contact", configuration, basicAuthentication, samlAuthentication);RouteTable.Routes.AddServiceRoute<ContactsResource>("contacts", configuration, basicAuthentication, samlAuthentication); In the code above, I am injecting the basic authentication and saml authentication interceptors in the “contact” and “contacts” resource implementations that come as samples in the code preview. I will use another post to discuss more in detail how the brokered authentication with SAML model works with this new WCF Http bits. The code is available to download in this location.

    Read the article

  • The Bing Sting - an alternative opinion

    - by Charles Young
    I know I'm a bit of an MS fanboy at times, but please, am I missing something here? Microsoft, with permission of users, exploits clickstream data gathered by observing user behaviour. One use for this data is to improve Bing queries. Google equips twenty of its engineers with laptops and installs the widgets required to provide Microsoft with clickstream data. It then gets their engineers to repeatedly (I assume) type in 'synthetic' queries which bring back 'doctored' hits. It asks its engineers to then click these results (think about this!). So, the behaviour of the engineers is observed and the resulting clickstream data goes off to Microsoft. It is processed and 'improves' Bing results accordingly.   What exactly did Microsoft do wrong here?   Google's so-called 'Bing sting' is clearly a very effective attack from a propaganda perspective, but is poor practice from a company that claims to do no evil. Generating and sending clickstream data deliberately so that you can then subsequently claim that your competitor 'copied' that data from you is neither fair nor reasonable, and suggests to me a degree of desperation in the face of real competition.   Monopolies are undesirable, whether they are Microsoft monopolies or Google monopolies.    Personally, I'm glad Microsoft has technology in place to observe user behaviour (with permission, of course) and improve their search results using such data. I can only assume Google doesn't implement similar capabilities. Sounds to me as if, at least in this respect, Microsoft may offer the better technology.

    Read the article

  • XNA Notes 005

    - by George Clingerman
    Another week and another crazy amount of activity going on in the XNA community. I’m fairly certain I missed over half of it. In fact, if I am missing things, make sure to email me and I’ll try and make sure I catch it next week! ([email protected]). Also, if you’ve got any advice, things you like/don’t like about the way these XNA Notes are going let me know. I always appreciate feedback (currently spammers are leaving me the nicest comments so you guys have work to do!) Without further ado, here’s this week’s notes! Time Critical XNA News The XNA Team Blob reminds us that February 7th is the last day to submit XNA 3.1 games to peer review! http://blogs.msdn.com/b/xna/archive/2011/01/31/7-days-left-to-submit-xna-gs-3-1-games-on-app-hub.aspx XNA MVPS Chris Williams kicks off the marketing campaign for our book http://geekswithblogs.net/cwilliams/archive/2011/01/28/143680.aspx Catalin Zima posts the comparison cheat sheet for why Angry Birds is different than Chickens Can’t Fly http://www.amusedsloth.com/2011/02/comparison-cheat-sheet-for-chickens-cant-fly-and-angry-birds/ Jim Perry congratulates the developers selected by Game Developer Magazine for Best Xbox LIVE Indie Games of 2010 http://machxgames.com/blog/?p=24 @NemoKrad posts his XNAKUUG talks for all to enjoy http://twitter.com/NemoKrad/statuses/33142362502864896 http://xna-uk.net/blogs/randomchaos/archive/2011/02/03/xblig-uk-2011-january-amp-february-talk.aspx George  (that’s me!) preps for his XNA talk coming up on the 8th http://twitter.com/clingermangw/statuses/32669550554124288 http://www.portlandsilverlight.net/Meetings/Details/15 XNA Developers FireFly posts the last tutorial in his XNA Tower Defense tutorial series http://forums.create.msdn.com/forums/p/26442/451460.aspx#451460 http://xnatd.blogspot.com/2011/01/tutorial-14-polishing-game.html @fredericmy posts the main difference when porting a game from Windows Phone 7 to Xbox 360 http://fairyengine.blogspot.com/2011/01/main-differences-when-porting-game-from.html @ElementCy creates a pretty rad video of a MineCraft type terrain created using XNA http://www.youtube.com/watch?v=Waw1f7wnl9I Andrew Russel gets the first XNA badge on gamedev.stackexchange http://twitter.com/_AndrewRussell/statuses/32322877004972032 http://gamedev.stackexchange.com/badges?tab=tags And his funding for ExEn has passed $7000 only $3000 to go http://twitter.com/_AndrewRussell/statuses/33042412804771840 Subodh Pushpak blogs about his Windows Phone 7 XNA talk http://geekswithblogs.net/subodhnpushpak/archive/2011/02/01/windows-phone-7-silverlight--xna-development-talk.aspx Slyprid releases the latest version of Transmute and needs more people to test http://twitter.com/slyprid/statuses/32452488418299904 http://forgottenstarstudios.com/ SpynDoctorGames celebrates the 1 year anniversary of Your Doodles Are Bugged! Congrats! http://twitter.com/SpynDoctorGames/statuses/32511689068908544 Noogy (creator of Dust the Elysian Tail) prepares his conversion to XNA 4.0 http://twitter.com/NoogyTweet/statuses/32522008449253376 @philippedasilva posts about the Indiefreaks Game Framework v0.2.0.0 Input management system http://twitter.com/philippedasilva/statuses/32763393957957632 http://indiefreaks.com/2011/02/02/behind-smart-input-system-feature/ Mommy’s Best Games debates what to do about High Scores with their new update http://mommysbest.blogspot.com/2011/02/high-score-shake-up.html @BinaryTweedDeej want to know if there’s anything the community needs to make XNA games for the PC. Give him some feedback! http://twitter.com/BinaryTweedDeej/status/32895453863354368 @mikebmcl promises to write us all a book (I can’t wait to read it!) http://twitter.com/mikebmcl/statuses/33206499102687233 @werezompire is going to live, LIVE, thanks to all the generosity and support from the community! http://twitter.com/werezompire/statuses/32840147644977153 Xbox LIVE Indie Games (XBLIG) Making money in Xbox 360 indie game development. Is it possible? http://www.bitmob.com/articles/making-money-in-xbox-360-indie-game-development-is-it-possible @AlejandroDaJ posts some thoughts abut the bitmob article http://twitter.com/AlejandroDaJ/statuses/31068552165330944 http://www.apathyworks.com/blog/view.php?id=00215 Kobun gets my respect as an XBLIG champion. I’m not sure who Kobun is, but if you’ve every read through the comment sections any time Kotaku writes about XBLIGs you’ll see a lot of confusion, disinformation in there. Kobun has been waging a secret war battling that lack of knowledge and he does it well. Also he’s running a pretty kick ass site for Xbox LIVE Indie Game reviews http://xboxindies.teamkobun.com/ @radiangames releases his last Xbox LIVE Indie Game...for now http://bit.ly/gMK6lE Playing Avaglide with the Kinect controller http://www.youtube.com/watch?v=UqAYbHww53o http://www.joystiq.com/2011/01/30/kinect-hacks-take-to-the-skies-with-avaglide/ Luke Schneider of Radiangames interviewed in Edge magazine http://www.next-gen.biz/features/radiangames-venture Digital Quarters posts thoughts on why XBLIG’s online requirement kills certain genres http://digitalquarters.blogspot.com/2011/02/thoughts-why-xbligs-online-requirement.html Mommy’s Best Games shares the news that several XBLIGs were featured in the March 2011 issue of Famitsu 360 http://forums.create.msdn.com/forums/p/33455/451487.aspx#451487 NaviFairy continues with his Indie-Game-A-Day http://gaygamer.net/2011/02/indie_game_a_day_epic_dungeon.html http://gaygamer.net/2011/02/indie_game_a_day_break_limit_r.html and more every day...that’s kind of the point! Keep your eye on this series! VVGTV continues with it’s awesome reviews/promotions for XBLIGs http://vvgtv.com/ http://vvgtv.com/2011/02/03/iredia-atrams-secret-xblig-review-2/ http://vvgtv.com/2011/02/02/poopocalypse-coming-soon-to-xblig/ ….and even more, you get the point. Magicka is an Indie Game doing really well on Steam AND it’s made using XNA http://www.magickagame.com/ http://twitter.com/Magickagame/statuses/32712762580799488 GameMarx reviews Antipole http://www.gamemarx.com/reviews/73/antipole-is-vvvvvvery-good.aspx Armless Octopus review Alpha Squad http://www.armlessoctopus.com/2011/01/28/xbox-indie-review-alpha-squad/ An interesting article about Kodu that Jim Perry found http://twitter.com/MachXGames/statuses/32848044105924608 http://www.develop-online.net/news/36915/10-year-old-Jordan-makes-games-The-UK-needs-more-like-her XNA Game Development Sgt. Conker posts about the Natur beta, a new book and whether you can make money with XBLIG http://www.sgtconker.com/ http://www.sgtconker.com/2011/01/a-new-book-on-the-block-and-a-new-natur-beta/ http://www.sgtconker.com/2011/01/making-money-in-xbox-360-indie-game-development-is-it-possible/ Tips for setting up SVN http://bit.ly/fKxgFh @bsimser found tons of royalty free music and soundfx for your XNA Games http://twitter.com/bsimser/statuses/31426632933711872 Post on the new features in the next Sunburn Editor http://www.synapsegaming.com/blogs/fivesidedbarrel/archive/2011/01/28/new-editor-features-prefabs-components-and-more.aspx @jasons_novaleaf posts source code for light pre-pass optimizations for #xna http://twitter.com/jasons_novaleaf/statuses/33348855403642880 http://jcoluna.wordpress.com/2011/02/01/xna-4-0-light-pre-pass-optimization-round-one/ I’ve been learning about doing an A.I. for turn based games and this article was a great resource. http://www.gamasutra.com/view/feature/1535/designing_ai_algorithms_for_.php?print=1

    Read the article

  • error: "net.netfilter.nf_conntrack_acct" is an unknown key

    - by anonymous
    Hello, i have the next error when i run 'sysctl -p' error: "net.netfilter.nf_conntrack_acct" is an unknown key net.netfilter.nf_conntrack_acct = 1 net.ipv4.netfilter.ip_conntrack_max = 9527600 net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 7200 lsmod ipv6 289352 34 loop 19724 0 nf_conntrack_ipv4 19352 0 nf_conntrack 71440 1 nf_conntrack_ipv4 joydev 15232 0 evdev 14592 0 ext3 125456 3 jbd 54696 1 ext3 mbcache 13188 1 ext3 raid1 24832 4 md_mod 81700 5 raid1 thermal_sys 17728 0 Debian 5.0.8 Any idea? Thanks

    Read the article

  • How to make the default virtual host return a 404 header in apache?

    - by user59240
    I know that similar questions have been asked, but the available answers are not very clear, so please bear with me. After setting up a few <VirtualHost>s in apache, I'd like to configure the _defualt_ ServerName so that it returns the 404 message. I.e., unless some explicitly available domain is specified in the Host http header, return 404. (Ideally something more direct than pointing to a now-nonexistent directory.) Any help would be greatly appreciated.

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12  | Next Page >